# @meshmakers/octo-services 中文文档

规范地址：https://npmcn.com/package/%40meshmakers/octo-services/

版本：3\.5\.550
npm 元数据更新时间：2026-11-01T19:23:40.086Z
中文译文更新时间：2026-11-01T21:31:44.388Z
软件包许可：未声明

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40meshmakers/octo-services
原文对照：https://npmcn.com/package/%40meshmakers/octo-services/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：8.4 MB，8 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：1 个
- peer 依赖：graphql ^16\.0\.0 \|\| ^17\.0\.0，@angular/core ^22\.0\.0，tus-js-client ^4\.3\.1，@apollo/client ^4\.1\.0，apollo-angular ^14\.0\.0，@angular/common ^22\.0\.0，@meshmakers/shared-ui \*，@meshmakers/shared-auth \*，@meshmakers/shared-services \*
- 首次发布：2022-11-13T22:09:41.688Z
- 最新版本发布：2026-11-01T19:23:39.918Z
- 已发布版本数：716（近 12 个月 288 个）

## 中文简介

Angular库提供与OctoMesh后端api交互的服务。

## 安装

```sh
npm install @meshmakers/octo-services
```

也可以使用：`pnpm add @meshmakers/octo-services`、`yarn add @meshmakers/octo-services`、`bun add @meshmakers/octo-services`

## README

# @meshmakers / octo-services

Angular库提供与OctoMesh后端api交互的服务。

部分 [@meshmakers](https://www.npmjs.com/org/meshmakers) 包的生态系统。

## 功能

-   **HTTP服务** -资产存储库，身份服务，Bot服务，通信控制器的REST API客户端
-   **GraphQL服务** - Construction Kit查询类型、属性和模型
-   **作业管理** -后台作业执行与进度跟踪
-   **摘要上传** —对于大型数据库恢复，支持文件上传
-   **错误处理** Apollo Link用于GraphQL错误处理和用户通知

## 构建和测试

```bash
# Build
npm run build:octo-services

# Lint
npm run lint:octo-services

# Run tests
npm run test:octo-services
```

## 体系结构

```
octo-services/
├── src/
│   ├── public-api.ts
│   └── lib/
│       ├── services/
│       │   ├── health.service.ts            # Backend health checks
│       │   ├── asset-repo.service.ts        # Tenant and model management
│       │   ├── identity-service.ts          # User, role, client management
│       │   ├── bot-service.ts               # Background job execution
│       │   ├── job-management.service.ts    # Job progress tracking with UI
│       │   ├── communication.service.ts     # Adapter and pipeline management
│       │   ├── tus-upload.service.ts        # Resumable file uploads (TUS)
│       │   ├── ck-type-selector.service.ts  # Query CK types (GraphQL)
│       │   ├── ck-type-attribute.service.ts # Query CK type attributes (GraphQL)
│       │   ├── ck-model.service.ts          # Check model availability (GraphQL)
│       │   ├── attribute-selector.service.ts # Query columns (GraphQL)
│       │   ├── configuration.service.ts     # Configuration injection token
│       │   └── tenant-provider.ts           # Tenant ID injection token
│       ├── graphQL/                         # GraphQL queries and generated types
│       ├── shared/                          # DTOs, models, and utilities
│       ├── options/                         # Configuration options
│       └── compat/                          # Backward compatibility exports
```

## 服务

### HTTP服务

| 服务 | 描述 |
| --- | --- |
| `HealthService` | 后端运行状况检查（资产回购、身份、Bot、通信、网格适配器） |
| `AssetRepoService` | 租户管理、模型导入/导出、用户合并 |
| `IdentityService` | 用户、角色和OAuth客户端管理 |
| `BotService` | 后台作业执行（修复脚本、转储/还原） |
| `JobManagementService` | 使用UI对话框跟踪作业进度 |
| `FileDownloadService` | 经过身份验证的blob下载(通过 `authorizeInterceptor`（实际文件名） `BINARY_LINKED` 值或URL |
| `FilesClientService` | 平台文件系统（AB#6178/AB#6230）的文件字节API：按路径或文件夹rtId上传进度，替换内容，按路径或rtId下载/预览，压缩，文件夹统计，功能，问题细节代码 |
| `CommunicationService` | 适配器部署、管道执行和调试 |
| `TusUploadService` | 通过TUS协议上传可恢复的文件 |

### GraphQL服务

| 服务 | 描述 |
| --- | --- |
| `CkTypeSelectorService` | 使用过滤、分页和派生类型查询CK类型 |
| `CkTypeAttributeService` | 查询CK类型和记录属性 |
| `CkModelService` | 检查型号可用性和版本 |
| `AttributeSelectorService` | 查询CK类型的可用查询列 |

## 快速入门

### 1\. 实现配置服务

```typescript
import { Injectable } from '@angular/core';
import { IConfigurationService, AddInConfiguration } from '@meshmakers/octo-services';

@Injectable({ providedIn: 'root' })
export class AppConfigurationService implements IConfigurationService {
  private _config: AddInConfiguration = {} as AddInConfiguration;

  get config(): AddInConfiguration {
    return this._config;
  }

  async loadConfigAsync(): Promise<void> {
    this._config = await fetch('/assets/config.json').then(r => r.json());
  }
}
```

### 2\. 注册供应商

```typescript
import { CONFIGURATION_SERVICE } from '@meshmakers/octo-services';
import { AppConfigurationService } from './services/app-configuration.service';

export const appConfig: ApplicationConfig = {
  providers: [
    { provide: CONFIGURATION_SERVICE, useClass: AppConfigurationService }
  ]
};
```

### 3\. 使用服务

```typescript
import { HealthService, CkTypeSelectorService } from '@meshmakers/octo-services';

@Component({ ... })
export class MyComponent {
  private readonly healthService = inject(HealthService);
  private readonly ckTypeSelector = inject(CkTypeSelectorService);

  async checkHealth(): Promise<void> {
    const health = await this.healthService.getAssetRepoServiceHealthAsync();
    console.log('Status:', health?.status);
  }

  loadTypes(): void {
    this.ckTypeSelector.getCkTypes({ searchText: 'Customer' })
      .subscribe(result => console.log('Types:', result.items));
  }
}
```

## 详细的文档

看到 [文档/ README.md](https://npmcn.com/package/%40meshmakers/octo-services/docs/README.md) 获取完整的API参考，包括所有方法签名和使用示例。

看到 [CLAUDE.md](https://npmcn.com/package/%40meshmakers/octo-services/CLAUDE.md) 用于开发指南、CK ID类型、GraphQL实用程序和测试模式。

## 依赖关系

-   **角21** (核心,常见/ http)
-   **阿波罗角** (同行的依赖, `^14.0.0`）
-   **@apollo /客户端** (同行的依赖, `^4.1.0` ——最老的x行包含这里使用的所有API，所以在apollo-angular 14.1 / @apollo/client 4.1上的主机继续安装；在运行时导入： `InMemoryCache`， `ApolloLink`，错误链接)
-   **graphql** (同行的依赖, `^16.0.0 || ^17.0.0` 比如apollo-angular / @apollo/client；只有 `DocumentNode` 类型（由公共API公开）。
-   **tus-js-client** (可恢复的上传)
-   **@meshmakers / shared-auth** （AuthorizeService用于TUS上传）
-   **@meshmakers /共享服务** (MessageService PagedResultDto)
-   **@meshmakers /共享的ui** （ProgressWindowService用于作业跟踪）

## 文件和测试标准

-   **所有开发人员文档必须用英语编写**
-   **每次代码更改都必须包含更新的文档** -更新自述文件。医学博士,克劳德。医学博士,文档/ README。在添加、修改或删除功能时使用
-   **必须执行单元测试和集成测试** 每次代码更改之后
-   **必须更新现有的测试** 当被测试代码的行为发生变化时
-   **必须添加新的测试** 当实现新的特性、组件或服务时
-   永远不要提交测试失败的代码

## 常见问题

### @meshmakers/octo-services 是什么？

Angular库提供与OctoMesh后端api交互的服务。

### 如何安装 @meshmakers/octo-services？

在项目目录运行 npm install @meshmakers/octo-services，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：graphql（^16\.0\.0 \|\| ^17\.0\.0）、@angular/core（^22\.0\.0）、tus-js-client（^4\.3\.1）、@apollo/client（^4\.1\.0）、apollo-angular（^14\.0\.0）、@angular/common（^22\.0\.0）、@meshmakers/shared-ui（\*）、@meshmakers/shared-auth（\*）、@meshmakers/shared-services（\*）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @meshmakers/octo-services 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @meshmakers/octo-services 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @meshmakers/octo-services 可以商用吗？

@meshmakers/octo-services 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @meshmakers/octo-services 还在维护吗？

最新版本 3\.5\.550 发布于 2026/11/02（1 天前）；至今共发布 716 个版本，其中过去 12 个月发布了 288 个；首次发布于 2022/11/14。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

