@geins/core

中文文档
0.13.0发布于 2026/11/09MITTypeScriptESM + CJS近 30 天下载 2084

Foundation package for the Geins SDK. Provides the API client, channel management, event bus, storage abstractions, and error types that all domain packages build on.

原始使用文档
文档目录5 节
  1. Install
  2. Quick start
  3. API overview
  4. Documentation
  5. License

@geins/core

Foundation package for the Geins SDK. Provides the API client, channel management, event bus, storage abstractions, and error types that all domain packages build on.

Install

npm install @geins/core
# or
yarn add @geins/core

Quick start

import { GeinsCore } from '@geins/core';

const core = new GeinsCore({
  apiKey: 'your-api-key',
  accountName: 'your-account',
  channel: 'your-channel-id',
  environment: 'prod',
});

// Channel info
const channel = await core.channel.current();

// Event bus
core.events.listenerAdd((msg) => console.log(msg), 'USER');

API overview

ExportDescription
GeinsCoreRoot entry point — holds the API client, channel, events, and settings.
EventServiceIn-process event bus with cross-tab BroadcastChannel support.
StorageInterfacePluggable storage abstraction (cookie, memory, or custom).
CookieStorageAdapterDefault StorageInterface backed by browser cookies.
MemoryStorageIn-memory StorageInterface for tests and server-side usage.
GeinsErrorBase error class with typed GeinsErrorCode.
AuthError, CartError, CheckoutErrorDomain-specific error subclasses.
NetworkRequestError, TimeoutError, RateLimitErrorNetwork-layer errors.
BasePackageAbstract base class for domain packages (CRM, CMS, OMS).
BaseApiServiceAbstract base class for GraphQL-backed services.

Documentation

See the full documentation for detailed usage.

License

MIT

版本与发布记录

@geins/core 共发布 103 个版本,首次发布于 2024/11/12;过去 12 个月发布了 49 个版本。

版本发布日期距今
0.13.0latest2026/11/096 天前
0.11.0-canary-17273fca6f093139e2405de03d8a4a31378c40c3canary2026/11/096 天前
0.11.0-canary-8b01e513a66e8b70ea1743c0266e6929e6bc5fa42026/11/096 天前
0.12.22026/11/096 天前
0.11.0-canary-b242ee14e433fb7ebe33466e2f7ed3c2ebf1f8052026/11/069 天前
0.12.12026/10/2224 天前

关于 @geins/core 的常见问题

@geins/core 是什么?

Foundation package for the Geins SDK. Provides the API client, channel management, event bus, storage abstractions, and error types that all domain packages build on.

如何安装 @geins/core?

在项目目录运行 npm install @geins/core,或使用 pnpm add / yarn add / bun add。

@geins/core 支持 TypeScript 吗?

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

@geins/core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@geins/core 可以商用吗?

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

@geins/core 的下载量有多少?

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

@geins/core 还在维护吗?

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