npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cn-quickotp/k3cloud-webapi-sdk

v1.0.3

Published

Kingdee K3Cloud (金蝶云星空) WebAPI SDK for JavaScript — CommonJS, zero-framework core.

Readme

@cn-quickotp/k3cloud-webapi-sdk

金蝶云星空 WebAPI 的 JavaScript SDK(CommonJS,运行时零依赖)。

安装

npm install @cn-quickotp/k3cloud-webapi-sdk

要求 Node.js >= 18;浏览器环境直接使用全局 fetch,无需额外依赖。

快速开始

const { createClient, K3CloudError } = require('@cn-quickotp/k3cloud-webapi-sdk');

const client = createClient({
  serverUrl: 'https://example.k3cloud.com/K3Cloud/',
  acctId: '000000',
  username: 'demo',
  password: '******',
  appKey: 'your-app-key',
  appSec: 'your-app-sec',
});

try {
  await client.login();

  const saved = await client.bill.save('SAL_SaleOrder', {
    FormId: 'SAL_SaleOrder',
    Data: { FBillerId: 'A001' },
  });

  const rows = await client.bill.executeBillQuery({
    FormId: 'SAL_SaleOrder',
    FieldKeys: 'FBillNo',
    TopRowCount: 20,
  });

  const meta = await client.metadata.queryBusinessInfo('SAL_SaleOrder');
} catch (err) {
  if (err instanceof K3CloudError) {
    console.error(err.code, err.message);
  }
} finally {
  await client.logout();
}

由环境变量创建

const { createClientFromEnv } = require('@cn-quickotp/k3cloud-webapi-sdk');

const client = createClientFromEnv();

对应环境变量:K3CLOUD_SERVER_URL、K3CLOUD_ACCT_ID、K3CLOUD_USERNAME、K3CLOUD_PASSWORD、K3CLOUD_APP_KEY、K3CLOUD_APP_SEC、K3CLOUD_LANG。

浏览器

浏览器环境从 localStorage 的 k3cloud.* 键读取配置,并使用全局 fetch。

配置项

| 配置项 | 类型 | 必填 | 默认值 | 说明 | | -------------- | -------- | ---- | --------------------------- | ------------------------------------------------ | | serverUrl | string | 是 | http://localhost/K3Cloud/ | 服务根地址,结尾 / 可省略 | | acctId | string | 是 | — | 账套 ID | | username | string | 是 | — | 登录用户名 | | password | string | 是 | — | 登录密码 | | appKey | string | 是 | — | 应用 Key | | appSec | string | 是 | — | 应用密钥 | | lang | number | 否 | 2052 | 语言标识 | | timeout | number | 否 | 30000 | 单次请求超时(毫秒) | | retries | number | 否 | 3 | 网络错误与 5xx 的重试次数 | | retryBaseDelay | number | 否 | 500 | 重试退避基数(毫秒) | | logger | object | 否 | — | 日志器,需含 debug / info / warn / error | | fetchImpl | function | 否 | 全局 fetch | 自定义 fetch 实现,用于测试或特殊运行时 |

优先级:默认值 < 环境变量 < 显式传入。必填项缺失时抛出 VALIDATION 错误并列出全部缺失字段。

错误码

| code | 说明 | | ---------- | ---------------------------- | | VALIDATION | 配置或参数校验失败 | | AUTH | 登录凭证缺失或登录失败 | | SESSION | 会话失效且重新登录后仍未通过 | | NETWORK | 网络请求失败 | | TIMEOUT | 请求超时 | | HTTP | HTTP 非 2xx 响应 | | PARSE | 响应体解析失败 | | BUSINESS | 业务处理失败 |

所有错误均为 K3CloudError 实例,含 code、message 与 details;日志输出对 password、appSec 自动脱敏。

示例

可运行示例见 examples/node-cjs/。

AI创建新项目规范目录结构 强规范

Project/
├── command.js              # CLI 入口
├── libs/
│   ├── erp.js              # 凭证加载、客户端创建、单据查询
│   ├── snapshot.js         # SQLite 快照库读写
│   ├── views.js            # 视图配置读写
│   ├── refresh.js          # 全量刷新编排
│   ├── selfcheck.js        # 恒等式与完整性自检
│   ├── inventory/
│   │   ├── constants.js    # 口径常量
│   │   ├── materials.js    # 物料清单
│   │   ├── masterData.js   # 仓库/换算率主数据与缓存
│   │   ├── collect.js      # 单项取数与分步式单据明细
│   │   ├── buildRows.js    # 仓库行与合计
│   │   ├── batches.js      # 批次明细
│   │   └── index.js        # InventoryService
│   └── utils/              # 日志、时间
├── scripts/                # 每个文件对应一个命令(probe / refresh / server / check)
├── web/index.html          # 单文件看板页面
└── tmps/                   # 运行期产物:data/ cache/ logs/ lifecycle/

许可

MulanPSL-2.0