@acosmi/sdk-ts 1.9.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,49 @@ All notable changes to `@acosmi/sdk-ts` will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.1] - 2026-05-25 — Packaging fix
9
+
10
+ ### Fixed
11
+
12
+ - `package.json` `files` 字段白名单遗漏 — v2.0.0 publish 后发现 `docs/pii-role-matrix.md` (新建) 与 `docs/开发与发布手册.md` (修订) 未进 npm 包. 集成方 `npm install @acosmi/sdk-ts` 后 `node_modules/@acosmi/sdk-ts/docs/` 缺这两份关键文档. 修白名单加显式三份 `docs/*.md` (排除 `docs/api/` 1.7MB TypeDoc 输出避免包膨胀).
13
+
14
+ ## [2.0.0] - 2026-05-25 — BREAKING (Phase 3 复核 + 全量根治)
15
+
16
+ 商品化 P1-P7 Phase 3 深度复核审计 (主仓 9 commit, HEAD `e510f68a`) + SDK 全量同步.
17
+ **用户裁决: major bump** (角色 fail-OPEN 别名废除 + admin 错误码契约变更 + PII 真加密 = breaking).
18
+
19
+ ### Added (Phase C — 主仓 user-facing 端点同步)
20
+
21
+ - `casehall.getMyLawyerCredentialStatus()` — 律师自查执业证审核状态. 端点 `GET /api/casehall/lawyer-credentials/my` (主仓 `LawyerCredentialConsumerController`). 普通用户调返 `[]` 不抛.
22
+ - `enterprise.getMyEnterpriseKycStatus()` — 企业 OWNER 自查 KYC 状态. 端点 `GET /api/distribution/enterprise/kyc/my` (主仓 `EnterpriseKycConsumerController`). 非 OWNER 调返 `{enterpriseId:undefined}` 空 view, 不抛.
23
+ - 新增类型 `LawyerCredentialMyView` (`src/casehall/types.ts`) + `EnterpriseKycMyStatusView` (`src/enterprise/types.ts`), 与主仓 VO 字段对齐, 显式白名单剔除 `fields_json` / `rawJson` 等 PII L3 字段.
24
+
25
+ ### Changed (BREAKING — Phase 3 复核引入的契约变更)
26
+
27
+ - **admin 写端点响应改 HTTP 状态码语义**: csign / compliance-billing admin POST 端点
28
+ (`/api/admin/csign/seals` / `/api/distribution/compliance-billing/commit|cancel|refund` 等)
29
+ 跨租户/不存在改返 HTTP `403`/`404` (之前 `200` + `{ok:false}`); 印章/能力未配置返 HTTP `501`
30
+ (之前 `200` + `{code:NOT_CONFIGURED}`). 集成方需用 `try-catch` 拦 `HTTPError.statusCode`,
31
+ 不再读 `CommonResult.ok` 字段. 详见 `src/compliance/errors.ts` 头部注释段.
32
+ - **角色严格化**: `ROLE_ADMIN` / `ROLE_USER` / `INTERNAL` 三个旧别名失效 (主仓
33
+ `SensitiveSerializer.normalizeAuthority` 不再自动升级到 `platform_admin` / `consumer` / `s2s`
34
+ 视角). yudao 后台通用 admin token 调用 PII 端点会拿到 guest 脱敏视图. 集成方需用正式
35
+ `ROLE_PLATFORM_ADMIN` / `ROLE_S2S` / `ROLE_LAWYER` / `ROLE_CONSUMER` 之一. 详见
36
+ `docs/pii-role-matrix.md`.
37
+
38
+ ### Docs
39
+
40
+ - 新建 `docs/pii-role-matrix.md` — 4 角色 × 3 PII 级矩阵 + 旧别名 breaking 说明 + 脱敏算法
41
+ 引用 + 集成方测试 mock 示例.
42
+ - `src/finance/types.ts` `Invoice` JSDoc 升级 P2-016 注释 — 补充 v1.9.0+ 真落盘加密
43
+ (V51 + V63 + V64), keyVersion v1/v2 payload 协议, 角色严格化 4 正式角色枚举.
44
+ - `src/compliance/errors.ts` 头部注释新增"v1.9.0+ admin 写端点行为变更"段 — 解释 403/404/501
45
+ HTTP 状态码契约改造与集成方应对.
46
+ - `README.md` 状态行版本号 1.6.0 → 1.9.0, 概要补 v1.7/v1.8/v1.9 highlight.
47
+ - `docs/开发与发布手册.md` 最后更新 2026-05-22 → 2026-05-25, 当前版本 1.5.0 → 1.9.0,
48
+ §4 目录结构补 6 个 namespace (casehall / enterprise / finance / pricing / products /
49
+ subscription).
50
+
8
51
  ## [1.9.0] - 2026-05-25
9
52
 
10
53
  ### Added — 商品化总规划 P7: 财务 finance namespace (发票/退款/对公转账)
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ## 状态
8
8
 
9
9
  - 主实现 / 事实标准:本 TS SDK 现为 Acosmi SDK 的主力实现。Go SDK [acosmi-sdk-go](https://github.com/acosmi/acosmi-sdk-go) 已暂停维护,待 TS 稳定后再从 TS 反向翻译补齐
10
- - 当前版本:**1.6.0**(v1.6.0 新增 `ChatRequest.endUserId` 业务侧终端用户 id + SSE keep-alive 注释行自动跳过 + per-request 超时 5min→11min 覆盖上游"开始推理前最长 10min 保活"窗口;详见下方"用户隔离 (v1.6.0+)"+ [CHANGELOG](./CHANGELOG.md))。`1.5.x` 文档复核 + `src/shared/` 跨域 DTO + compliance gateway S1-S6 rollup;`1.4.x` `src/` 按业务域重组 + 浏览器 Web OAuth;`1.3.x` `client.compliance` 合规域客户端
10
+ - 当前版本:**2.0.0**(Phase 3 复核 + 全量根治 BREAKING 升级,2026-05-25)。**Phase 3 复核**: 主仓 9 commit 闭环 20 P0 (RBAC 表达式统一 / PII 真落盘加密链 / K7 视频 webhook 幂等 / K8 OCR SSRF / K9 KYC main flow / admin 写端点错误码契约). **SDK 同步**: 新增 `casehall.getMyLawyerCredentialStatus()` + `enterprise.getMyEnterpriseKycStatus()` 律师/企业 OWNER 自查端点; `finance/types.ts` P2-016 PII 注释升级 (含 keyVersion v1/v2 payload 协议); 新建 `docs/pii-role-matrix.md` (4 角色 × 3 PII 级矩阵); admin 写端点错误码改 HTTP 状态码语义 (`200+{ok:false}` `403/404/501`). **v1.x 历史**: 1.9.0 finance / 1.8.1 enterprise / 1.8.0 casehall / 1.7.0 csign+pricing / 1.6.0 endUserId+11min 保活. 详见 [CHANGELOG](./CHANGELOG.md).
11
11
  - 测试:发布前需通过 typecheck/lint/vitest/build/packed-tarball smoke (`npm run test:pack`)
12
12
  - API 参考文档:`npm run docs` 经 TypeDoc 生成到 `docs/api/`
13
13
  - 包链接:[npm](https://www.npmjs.com/package/@acosmi/sdk-ts) · [GitHub Releases](https://github.com/acosmi/sdk-ts/releases)
@@ -6341,6 +6341,15 @@ Client.prototype.listLegalSKUs = async function(region, signal) {
6341
6341
  );
6342
6342
  return resp.data ?? [];
6343
6343
  };
6344
+ Client.prototype.getMyLawyerCredentialStatus = async function(signal) {
6345
+ const resp = await this.doJSON(
6346
+ "GET",
6347
+ `/api/casehall/lawyer-credentials/my`,
6348
+ null,
6349
+ signal
6350
+ );
6351
+ return resp.data ?? [];
6352
+ };
6344
6353
 
6345
6354
  // src/enterprise/client.ts
6346
6355
  Client.prototype.listMyEnterprises = async function(signal) {
@@ -6436,6 +6445,15 @@ Client.prototype.getOrgConsumeReport = async function(enterpriseId, signal) {
6436
6445
  }
6437
6446
  return resp.data;
6438
6447
  };
6448
+ Client.prototype.getMyEnterpriseKycStatus = async function(signal) {
6449
+ const resp = await this.doJSON(
6450
+ "GET",
6451
+ `/api/distribution/enterprise/kyc/my`,
6452
+ null,
6453
+ signal
6454
+ );
6455
+ return resp.data ?? {};
6456
+ };
6439
6457
 
6440
6458
  // src/finance/client.ts
6441
6459
  Client.prototype.requestRefund = async function(req, signal) {
@@ -6487,13 +6505,8 @@ Client.prototype.initiateCorporateTransfer = async function(req, signal) {
6487
6505
  return resp.data;
6488
6506
  };
6489
6507
  Client.prototype.uploadCorporateTransferProof = async function(id, proofUrl, signal) {
6490
- const qs = new URLSearchParams({ proofUrl });
6491
- const resp = await this.doJSON(
6492
- "POST",
6493
- `/api/distribution/finance/corporate-transfer/${id}/upload-proof?${qs.toString()}`,
6494
- null,
6495
- signal
6496
- );
6508
+ const path = `/api/distribution/finance/corporate-transfer/${encodeURIComponent(String(id))}/upload-proof?proofUrl=${encodeURIComponent(proofUrl)}`;
6509
+ const resp = await this.doJSON("POST", path, null, signal);
6497
6510
  return resp.data ?? false;
6498
6511
  };
6499
6512
  Client.prototype.listMyCorporateTransfers = async function(signal) {