@aimee.shop/sdk

中文文档
0.29.0发布于 2026/11/06MITTypeScriptES Module近 30 天下载 5972

用于 Aimee 商店前端和商家安全 API 的公共类型SDK 脚本

中文使用文档
文档目录9 节
  1. 软件包
  2. @aimee.shop/sdk
  3. @aimee.shop/sdk-platform
  4. 发展
  5. 认证
  6. 多十年背景
  7. 通知配置( 服务器 /) sk_ 仅限)
  8. CSV出口(服务器 / sk_ 仅限)
  9. 软件包边界

Amee 类型脚本 SDKs

此repo发布两个来自npm工作空间的ESM TypeScript SDK包.

软件包

@aimee.shop/sdk

公共SDK用于商店前端和商家安全的商业API.

npm install @aimee.shop/sdk
import { AimeeSDK } from '@aimee.shop/sdk';

const sdk = new AimeeSDK({
  apiKey: process.env.AIMEE_API_KEY,
  tenantId: 'tenant-uuid',
});

const products = await sdk.products.list({ limit: 20 });
const checkout = await sdk.checkout.create({ cartId: 'cart-uuid' });

浏览器用法 :

import { aimee, browserAuth } from '@aimee.shop/sdk/browser';

await browserAuth.signIn('[email protected]', 'password');
const products = await aimee.products.list();

@aimee.shop/sdk-platform

内部/管理员SDK用于平台操作. 它包括公共SDK表面外加RBAC,支付管理员,工作流程,通知,租户,用户/管理员,API密钥,UCP/admin,沙盒促销,以及内容副本.

npm install @aimee.shop/sdk @aimee.shop/sdk-platform
import { AimeePlatformSDK } from '@aimee.shop/sdk-platform';

const sdk = new AimeePlatformSDK({
  apiKey: process.env.AIMEE_API_KEY,
  tenantId: 'tenant-uuid',
});

const roles = await sdk.rbac.roles.list();
const tenants = await sdk.tenants.list();

发展

npm install
npm run build
npm run typecheck
npm test
npm run status
npm run pack:dry-run

质量规则:

  • npm run status 必须在承诺前通过.
  • 没有 any, (中文(简体) ), as any,或 @ts-ignore。 。 。 .
  • 公共软件包不得包括平台服务文件.
  • 平台软件包是唯一暴露内部/管理员客户端的软件包.

认证

支持的认证模式 :

  • 为服务器侧消费者提供的 API 密钥 .
  • getAccessToken 用于浏览器/框架管理的会议.
  • 用于服务类认证的可识别电子邮件/密码字 .
  • 地方发展的交互式授权.
const sdk = new AimeeSDK({
  getAccessToken: () => authContext.getToken(),
  tenantId: 'tenant-uuid',
});

多十年背景

const tenantSdk = sdk.withTenant('other-tenant');
const storeSdk = sdk.withStore('store-uuid');

范围化实例共享认证, 但获得自己的 HTTP 客户端, 因此租户/ 仓库头被隔离 .

通知配置( 服务器 /) sk_ 仅限)

列出存储和点火测试发送的交易定义 没有下命令 需要密钥 API (sk_)或管理JWT notification-config:read 编号 : notification-config:trigger,加上存储上下文. 可出版(pk_)键返回 403。 这不是在上 @aimee.shop/sdk/storefront。 。 。 . 管理模板/提供者工作继续 @aimee.shop/sdk-platform (单位:千美元)sdk.notifications) (中文(简体) ).

sdk.setStore(storeId);
const { items } = await sdk.notificationConfig.list();
await sdk.notificationConfig.testSend({
  eventName: 'order.created',
  to: '[email protected]',
});

现场订单确认活动是 order.created (无) order.confirmed) (中文(简体) ).

CSV出口(服务器 / sk_ 仅限)

创建 Async CSV 导出任务, 民调直到 completed,然后打开 预签名下载 URL。 要求数 {entity}:export (单位:千美元)orders:export, (中文(简体) ), products:export, (中文(简体) ), customers:export+ 存储范围 实体。 可出版(pk_)键返回 403。 这不是在上 @aimee.shop/sdk/storefront。 。 。 .

sdk.setStore(storeId);
const { jobId } = await sdk.exports.create(
  { entity: 'orders', filters: { status: 'PAID' }, columnSet: 'summary' },
  { idempotencyKey: crypto.randomUUID() },
);
const job = await sdk.exports.get(jobId);
if (job.status === 'completed') {
  const { downloadUrl } = await sdk.exports.getDownloadUrl(jobId);
}

软件包边界

使用 @aimee.shop/sdk 用于店面,公共开发商工具,以及商家安全整合.

使用 @aimee.shop/sdk-platform 用于管理员UI,内部服务和需要平台操作的工具.

@aimee.shop/sdk-platform 对等依赖 @aimee.shop/sdk 并扩展其公共SDK类. 平台消费者应当从 @aimee.shop/sdk-platform 当他们需要 公共加平台组合表面.

版本与发布记录

@aimee.shop/sdk 共发布 65 个版本,首次发布于 2026/09/09;过去 12 个月发布了 65 个版本。

版本发布日期距今
0.29.0latest2026/11/061 天前
0.29.0-dev.292dev2026/11/061 天前
0.29.0-dev.2902026/11/061 天前
0.29.0-dev.2882026/11/061 天前
0.28.02026/11/061 天前
0.28.0-dev.2842026/11/062 天前

关于 @aimee.shop/sdk 的常见问题

@aimee.shop/sdk 是什么?

用于 Aimee 商店前端和商家安全 API 的公共类型SDK 脚本

如何安装 @aimee.shop/sdk?

在项目目录运行 npm install @aimee.shop/sdk,或使用 pnpm add / yarn add / bun add。

@aimee.shop/sdk 支持 TypeScript 吗?

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

@aimee.shop/sdk 支持 ESM 还是 CommonJS?

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

@aimee.shop/sdk 需要什么版本的 Node.js?

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

@aimee.shop/sdk 可以商用吗?

@aimee.shop/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@aimee.shop/sdk 的下载量有多少?

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

@aimee.shop/sdk 还在维护吗?

最新版本 0.29.0 发布于 2026/11/06(1 天前);至今共发布 65 个版本,其中过去 12 个月发布了 65 个;首次发布于 2026/09/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。