# @adobe/aio-lib-templates 中文文档

规范地址：https://npmcn.com/package/%40adobe/aio-lib-templates/

版本：3\.0\.4
npm 元数据更新时间：2026-10-01T01:32:23.997Z
中文译文更新时间：2026-11-05T20:46:19.519Z
软件包许可：Apache-2\.0

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

原始 npm 页面：https://www.npmjs.com/package/%40adobe/aio-lib-templates
原文对照：https://npmcn.com/package/%40adobe/aio-lib-templates/?lang=original
项目主页：https://github.com/adobe/aio-lib-templates
源码仓库：https://github.com/adobe/aio-lib-templates

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

- 包体积（解压后）：48.9 kB，7 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=18
- 运行依赖：3 个
- 首次发布：2022-06-10T04:34:40.138Z
- 最新版本发布：2025-11-12T04:21:06.664Z
- 近 30 天下载量：24572（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：11（近 12 个月 1 个）

## 中文简介

一个与 Adobe App Builder 模板注册库进行通信的库.

## 安装

```sh
npm install @adobe/aio-lib-templates
```

也可以使用：`pnpm add @adobe/aio-lib-templates`、`yarn add @adobe/aio-lib-templates`、`bun add @adobe/aio-lib-templates`

## README

## Adobe App 构建器模板库

这是用于 Adobe I/O CLI 和 SDKs 通信的辅助库 [Adobe App 构建器模板注册](https://github.com/adobe/aio-template-submission) 通过它的REST API.

### 安装

```bash
$ npm install @adobe/aio-lib-templates
```

### 使用量

#### 搜索 Adobe 应用程序构建模板

搜索 Adobe App 构建器模板 [Adobe App 构建器模板注册](https://github.com/adobe/aio-template-submission) 并且通过结果而凝聚.

```javascript
const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init();
    // an optional Search Criteria object
    // without Search Criteria the following code will paginate through all Adobe App Builder templates
    const searchCriteria = {
        [sdk.SEARCH_CRITERIA_CATEGORIES]: ['action', sdk.SEARCH_CRITERIA_FILTER_NOT + 'ui', sdk.SEARCH_CRITERIA_FILTER_OR + 'runtime'],
        [sdk.SEARCH_CRITERIA_STATUSES]: [sdk.TEMPLATE_STATUS_APPROVED],
        [sdk.SEARCH_CRITERIA_ADOBE_RECOMMENDED]: true
    };
    // an optional OrderBy Criteria object
    const orderByCriteria = {
        [sdk.ORDER_BY_CRITERIA_NAMES]: sdk.ORDER_BY_CRITERIA_SORT_DESC
    };
    for await (const templates of templateRegistryClient.getTemplates(searchCriteria, orderByCriteria)) {
        for (const template of templates) {
            console.log(template);
        }
    }
}
```

##### 支助 **搜索标准** 属性

| 密钥 | 数值 | SDK 常数 | 说明 |
| --- | --- | --- | --- |
| `names` | 字符串列表 | (中文(简体) ) | 通过模板名称过滤 . |
| `categories` | 字符串列表 | (原始内容存档于2013-10-12) (中文(简体) ) | 按模板类别过滤 . |
| `statuses` | 字符串列表 | (原始内容存档于2017-10-21) (中文(简体) ) | 通过模板状态过滤(TEMPLATE STATUS IN VERIVIation,TEMPLATE STATUS APPROVED,TEMPLATE STATUS REJETED). |
| `apis` | 字符串列表 | (原始内容存档于2017-10-21) (中文(简体) ) | 通过模板 API 过滤 。 支持EMPTY和任意过滤器. |
| `extensions` | 字符串列表 | 研究 标准 延长 | 通过模板扩展点过滤 。 支持EMPTY和任意过滤器. |
| `events` | 只有EMPTY和任何过滤器 | 搜索 标准 测试 | 通过模板事件过滤 。 现在只支持EMPTY和任何过滤器. |
| `runtime` | 布尔 | 搜索 标准 运行 | 是否需要 Adobe I/O 运行时间 ? 支持EMPTY和任意过滤器. |
| `adobeRecommended` | 布尔 | (原始内容存档于2017-10-21) (中文(简体) ) | 表示 Adobe 的模板 . |

###### 过滤运算符

| 过滤类型 | 数值 | SDK 常数 | 说明 |
| --- | --- | --- | --- |
| (无) | '',一个空字符串 | (原始内容存档于2013-10-12). SEARCH CRITERIA FILTER NONE | 返回所有没有属性集的模板 . |
| 没有 | \*,星号符号 | (原始内容存档于2017-10-21) (中文(中国大陆) ). SEARCH CRITIA FILLTER ANY | 返回所有拥有属性集的模板 . |
| 没有 | 一个感叹点符号 | (原始内容存档于2017-10-21) (中文(简体) ). SEARCH CRITERIA FILTER NOT | 不包括包含已取消的查询参数值的所有模板. |
| 或 | |,一个管子符号 | (原始内容存档于2013-10-12) (中文(简体) ). SEARCH CRITERIA FILLTER OR | 阵列过滤器, 例如: `categories`,默认返回所有匹配模板的相交点(AND)。 这个过滤操作员增加了为单个值指定逻辑"OR"的能力. |

##### 支助 **按标准排列** 属性

| 密钥 | 数值 | SDK 常数 | 说明 |
| --- | --- | --- | --- |
| `names` | 字符串、 desc 或 asc | 命令 BY 标准 名称 | 按模板名称排序 . |
| `statuses` | 字符串、 desc 或 asc | 命令 BY 标准 统计 | 按模板状态排序 . |
| `adobeRecommended` | 字符串、 desc 或 asc | 命令 BY 标准 ADOBE 建议 | 按"Adobe推荐"旗来排序. |
| `publishDate` | 字符串、 desc 或 asc | 命令 BY 标准 日期 | 按出版日期排序. |

#### 从 Adobe App 构建器模板注册处获取模板

获取模板从 [Adobe App 构建器模板注册](https://github.com/adobe/aio-template-submission)。 。 。 .

```javascript
const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init();
    const templateName = '@author/app-builder-template';
    try {
        const template = await templateRegistryClient.getTemplate(templateName);
        console.log(template);
    } catch (error) {
        console.log(error.toString());
    }
}
```

#### 向 Adobe App 构建器模板注册处添加新模板

添加新模板到 [Adobe App 构建器模板注册](https://github.com/adobe/aio-template-submission)。 。 。 .

```javascript
const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init({
        'auth': {
            'token': '<IMS_ACCESS_TOKEN>'
        }
    });
    const templateName = '@author/app-builder-template';
    const githubRepoUrl = 'https://github.com/author/app-builder-template';
    try {
        const template = await templateRegistryClient.addTemplate(templateName, githubRepoUrl);
        console.log(`A new template "${template.name}" has been successfully added to Adobe App Builder Template Registry.`);
        console.log(`Its status is "${sdk.TEMPLATE_STATUS_IN_VERIFICATION}". Please use the "${template.reviewLink}" link to check the verification status.`);
    } catch (error) {
        console.log(error.toString());
    }
}
```

#### 更新模板到 Adobe App 构建器模板注册

更新模板到 [Adobe App 构建器模板注册](https://github.com/adobe/aio-template-submission)。 。 。 .

**注:仅凭IMS服务代号即可访问**

```javascript
const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init({
        'auth': {
            'token': '<IMS_ACCESS_TOKEN>'
        }
    });
    const templateId = '66431bb2f682a35bf4b1b002';
    const githubRepoUrl = 'https://github.com/author/app-builder-template';
    try {
        const template = await templateRegistryClient.updateTemplate(templateId, githubRepoUrl);
        console.log(`template with Id "${template.templateId}" has been successfully updated to Adobe App Builder Template Registry.`);
    } catch (error) {
        console.log(error.toString());
    }
}
```

#### 从 Adobe App 构建器模板注册处删除模板

删除模板 [Adobe App 构建器模板注册](https://github.com/adobe/aio-template-submission)。 。 。 .

```javascript
const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init({
        'auth': {
            'token': '<IMS_ACCESS_TOKEN>'
        }
    });
    const templateName = '@author/app-builder-template';
    try {
        await templateRegistryClient.deleteTemplate(templateName);
        console.log(`"${templateName}" has been successfully deleted from Adobe App Builder Template Registry.`);
    } catch (error) {
        console.log(error.toString());
    }
}
```

#### 安装模板

从开发者控制台安装模板

**注:仅凭IMS服务代号即可访问**

```javascript
const sdk = require('@adobe/aio-lib-templates');

async function sdkTest() {
    const templateRegistryClient = sdk.init({
        'auth': {
            'token': '<IMS_ACCESS_TOKEN>'
        }
    });
    const templateId = '<valid templateId>';
    const templateInstallRequestBody = {
        orgId: '<valid orgId>',
        projectName: '<projectName>',
        description: '<description>',
        metadata: {
            domain : '<domain>',
            defaultRedirectUri: '<defaultRedirectUri>'
        },
        apis: [
            {
                code: 'SDKCode',
                credentialType: 'valid credentialType',
                flowType: 'valid flowType',
                licenseConfigs: [
                    {
                        id: 'valid id',
                        productId: 'valid productId',
                        op: 'valid op',
                    }
                ]
            }
        ]
    }
    try {
        await templateRegistryClient.installTemplate(templateId, templateInstallRequestBody);
        console.log(`Template with id "${templateId}" has been successfully installed.`);
    } catch (error) {
        console.log(error.toString());
    }
}
```

### 探索

`goto` [API 密码](https://npmcn.com/package/%40adobe/aio-lib-templates/doc/api.md)

### 捐款

欢迎捐款! 读取 [贡献指南](https://npmcn.com/package/%40adobe/aio-lib-templates/CONTRIBUTING.md) 更多信息.

### 许可证发放

这个项目根据Apache V2许可证获得许可. 见 [自由主义](https://npmcn.com/package/%40adobe/aio-lib-templates/LICENSE) 更多信息.

## 常见问题

### @adobe/aio-lib-templates 是什么？

一个与 Adobe App Builder 模板注册库进行通信的库\.

### 如何安装 @adobe/aio-lib-templates？

在项目目录运行 npm install @adobe/aio-lib-templates，或使用 pnpm add / yarn add / bun add。

### @adobe/aio-lib-templates 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/adobe\_\_aio-lib-templates 是否存在。

### @adobe/aio-lib-templates 支持 ESM 还是 CommonJS？

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

### @adobe/aio-lib-templates 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @adobe/aio-lib-templates 可以商用吗？

@adobe/aio-lib-templates 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @adobe/aio-lib-templates 的下载量有多少？

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

### @adobe/aio-lib-templates 还在维护吗？

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

