# @contentchef/contentchef-management-js-client 中文文档

规范地址：https://npmcn.com/package/%40contentchef/contentchef-management-js-client/

版本：11\.2\.0-alpha\.9
npm 元数据更新时间：2026-11-10T09:24:55.509Z
中文译文更新时间：2026-11-10T22:08:52.772Z
软件包许可：UNLICENSED

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

原始 npm 页面：https://www.npmjs.com/package/%40contentchef/contentchef-management-js-client
原文对照：https://npmcn.com/package/%40contentchef/contentchef-management-js-client/?lang=original
项目主页：https://github.com/ContentChef/contentchef-management-js-client
源码仓库：https://github.com/ContentChef/contentchef-management-js-client

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

- 包体积（解压后）：386 kB，135 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：2 个
- 首次发布：2020-06-23T13:30:55.762Z
- 最新版本发布：2026-11-10T09:11:29.505Z
- 近 30 天下载量：2701（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：88（近 12 个月 52 个）

## 中文简介

内容 Chef 作者+释放javascript客户端

## 安装

```sh
npm install @contentchef/contentchef-management-js-client
```

也可以使用：`pnpm add @contentchef/contentchef-management-js-client`、`yarn add @contentchef/contentchef-management-js-client`、`bun add @contentchef/contentchef-management-js-client`

## README

# 内容 Chef 管理 JS 客户端

## 安装

使用 npm :

```bash
    $ npm install @contentchef/contentchef-management-js-client
```

使用线条 :

```bash
    $ yarn add @contentchef/contentchef-management-js-client
```

## 实例

-   配置示例 此代码将显示如何正确配置您的内容化学管理 JS 客户端

```Typescript
    class ContentChefApi {
        api: ContentChefClient;

        // The token is the authorizer that is needed to make actions in your space, for security problems the operation of setting the token
        // should me make in a server side application
        apiTokenResolver: AuthenticationTokenResolver = {
                getToken: async () => {
                   return await 'do stuffs to retrieve your api token';
                }
            };
            
        spaceIdResolver: SpaceIdResolver = {
            getSpaceId: async () => {
                return await 'do Stuff to retrieve your space id';
            }
        };

        initializeClient = () => {
            this.api = createChefSpaceClient(apiTokenResolver, spaceIdResolver, { apiRoot: 'https://mgmt.contentchef.io' });
        }
    }

    // We do this to create a singleton of the client
    export const contentChefApi = new ContentChefApi().initializeClient();
```

-   用法实例 此代码将显示在初始配置后如何正确使用您的内容Chef 管理 JS 客户端

```Typescript
    class ContentChefContentStore {
        api: ContentChefClient;

        constructor (chefApi: ContentChefClient) {
            this.api = chefApi
        }
    
        async getContent (reqParams: GetContentRequest) {
            try {
                const response = await this.api.contents.get(reqParam);
                console.log('This is the requested content');
                console.log(response);
            } catch (e) {
               console.log(`An error occurred retrieving the content with id ${reqParams.id}`);
               console.log(e); 
            } 
        }

    }
```

### 文档

生成新文档只需运行命令

使用线条 :

```bash
    $ yarn generate-docs
```

将在项目根部的文件夹 Docs 内创建新文档, 然后在浏览器中只服务索引. html 文件

## 常见问题

### @contentchef/contentchef-management-js-client 是什么？

内容 Chef 作者\+释放javascript客户端

### 如何安装 @contentchef/contentchef-management-js-client？

在项目目录运行 npm install @contentchef/contentchef-management-js-client，或使用 pnpm add / yarn add / bun add。

### @contentchef/contentchef-management-js-client 支持 TypeScript 吗？

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

### @contentchef/contentchef-management-js-client 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @contentchef/contentchef-management-js-client 可以商用吗？

@contentchef/contentchef-management-js-client 使用 UNLICENSED 许可。作者声明为 UNLICENSED，即不授予公开使用许可（与公共领域的 Unlicense 不同）。使用前需获得作者授权。以上为概括，不构成法律意见，请以许可原文为准。

### @contentchef/contentchef-management-js-client 的下载量有多少？

根据 npm 官方下载统计，@contentchef/contentchef-management-js-client 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,701 次，日均约 90 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @contentchef/contentchef-management-js-client 还在维护吗？

最新版本 11\.2\.0-alpha\.9 发布于 2026/11/10（今天）；至今共发布 88 个版本，其中过去 12 个月发布了 52 个；首次发布于 2020/06/23。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

