@aimee.shop/sdk

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

Public TypeScript SDK for Aimee storefront and merchant-safe APIs

原始使用文档
文档目录9 节
  1. Packages
  2. @aimee.shop/sdk
  3. @aimee.shop/sdk-platform
  4. Development
  5. Authentication
  6. Multi-Tenant Context
  7. Notification config (server / sk_ only)
  8. CSV exports (server / sk_ only)
  9. Package Boundary

Aimee TypeScript SDKs

This repo publishes two ESM TypeScript SDK packages from one npm workspace.

Packages

@aimee.shop/sdk

Public SDK for storefront and merchant-safe commerce APIs.

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' });

Browser usage:

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

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

@aimee.shop/sdk-platform

Internal/admin SDK for platform operations. It includes the public SDK surface plus RBAC, payments admin, workflows, notifications, tenants, users/admin, API keys, UCP/admin, sandbox promotion, and content copy.

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();

Development

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

Quality rules:

  • npm run status must pass before commit.
  • No any, as any, or @ts-ignore.
  • Public package must not include platform service files.
  • Platform package is the only package that exposes internal/admin clients.

Authentication

Supported auth modes:

  • API key for server-side consumers.
  • getAccessToken for browser/framework-managed sessions.
  • Cognito email/password for service-style auth.
  • Interactive auth for local development.
const sdk = new AimeeSDK({
  getAccessToken: () => authContext.getToken(),
  tenantId: 'tenant-uuid',
});

Multi-Tenant Context

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

Scoped instances share authentication but get their own HTTP client so tenant/store headers are isolated.

Notification config (server / sk_ only)

List which transactional definitions exist for a store and fire a test send without placing an order. Requires a secret API key (sk_) or admin JWT with notification-config:read / notification-config:trigger, plus store context. Publishable (pk_) keys return 403. This is not on @aimee.shop/sdk/storefront. Admin template/provider work stays on @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]',
});

The live order-confirmation event is order.created (not order.confirmed).

CSV exports (server / sk_ only)

Create an async CSV export job, poll until completed, then open the presigned download URL. Requires {entity}:export (orders:export, products:export, customers:export) plus store context for store-scoped entities. Publishable (pk_) keys return 403. This is not on @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);
}

Package Boundary

Use @aimee.shop/sdk for storefronts, public developer tooling, and merchant-safe integrations.

Use @aimee.shop/sdk-platform for admin UI, internal services, and tools that need platform operations.

@aimee.shop/sdk-platform peer-depends on @aimee.shop/sdk and extends its public SDK class. Platform consumers should import SDK symbols from @aimee.shop/sdk-platform when they need the combined public plus platform surface.

版本与发布记录

@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/062 天前
0.28.0-dev.2842026/11/062 天前

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

@aimee.shop/sdk 是什么?

Public TypeScript SDK for Aimee storefront and merchant-safe APIs

如何安装 @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 和提交记录判断。