@acosmi/sdk-ts 1.6.0 → 2.0.0
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 +178 -0
- package/README.md +1 -1
- package/dist/browser/index.mjs +394 -1
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +394 -1
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +397 -0
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +726 -1
- package/dist/node/index.d.ts +726 -1
- package/dist/node/index.mjs +394 -1
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,184 @@ 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.0] - 2026-05-25 — BREAKING (Phase 3 复核 + 全量根治)
|
|
9
|
+
|
|
10
|
+
商品化 P1-P7 Phase 3 深度复核审计 (主仓 9 commit, HEAD `e510f68a`) + SDK 全量同步.
|
|
11
|
+
**用户裁决: major bump** (角色 fail-OPEN 别名废除 + admin 错误码契约变更 + PII 真加密 = breaking).
|
|
12
|
+
|
|
13
|
+
### Added (Phase C — 主仓 user-facing 端点同步)
|
|
14
|
+
|
|
15
|
+
- `casehall.getMyLawyerCredentialStatus()` — 律师自查执业证审核状态. 端点 `GET /api/casehall/lawyer-credentials/my` (主仓 `LawyerCredentialConsumerController`). 普通用户调返 `[]` 不抛.
|
|
16
|
+
- `enterprise.getMyEnterpriseKycStatus()` — 企业 OWNER 自查 KYC 状态. 端点 `GET /api/distribution/enterprise/kyc/my` (主仓 `EnterpriseKycConsumerController`). 非 OWNER 调返 `{enterpriseId:undefined}` 空 view, 不抛.
|
|
17
|
+
- 新增类型 `LawyerCredentialMyView` (`src/casehall/types.ts`) + `EnterpriseKycMyStatusView` (`src/enterprise/types.ts`), 与主仓 VO 字段对齐, 显式白名单剔除 `fields_json` / `rawJson` 等 PII L3 字段.
|
|
18
|
+
|
|
19
|
+
### Changed (BREAKING — Phase 3 复核引入的契约变更)
|
|
20
|
+
|
|
21
|
+
- **admin 写端点响应改 HTTP 状态码语义**: csign / compliance-billing admin POST 端点
|
|
22
|
+
(`/api/admin/csign/seals` / `/api/distribution/compliance-billing/commit|cancel|refund` 等)
|
|
23
|
+
跨租户/不存在改返 HTTP `403`/`404` (之前 `200` + `{ok:false}`); 印章/能力未配置返 HTTP `501`
|
|
24
|
+
(之前 `200` + `{code:NOT_CONFIGURED}`). 集成方需用 `try-catch` 拦 `HTTPError.statusCode`,
|
|
25
|
+
不再读 `CommonResult.ok` 字段. 详见 `src/compliance/errors.ts` 头部注释段.
|
|
26
|
+
- **角色严格化**: `ROLE_ADMIN` / `ROLE_USER` / `INTERNAL` 三个旧别名失效 (主仓
|
|
27
|
+
`SensitiveSerializer.normalizeAuthority` 不再自动升级到 `platform_admin` / `consumer` / `s2s`
|
|
28
|
+
视角). yudao 后台通用 admin token 调用 PII 端点会拿到 guest 脱敏视图. 集成方需用正式
|
|
29
|
+
`ROLE_PLATFORM_ADMIN` / `ROLE_S2S` / `ROLE_LAWYER` / `ROLE_CONSUMER` 之一. 详见
|
|
30
|
+
`docs/pii-role-matrix.md`.
|
|
31
|
+
|
|
32
|
+
### Docs
|
|
33
|
+
|
|
34
|
+
- 新建 `docs/pii-role-matrix.md` — 4 角色 × 3 PII 级矩阵 + 旧别名 breaking 说明 + 脱敏算法
|
|
35
|
+
引用 + 集成方测试 mock 示例.
|
|
36
|
+
- `src/finance/types.ts` `Invoice` JSDoc 升级 P2-016 注释 — 补充 v1.9.0+ 真落盘加密
|
|
37
|
+
(V51 + V63 + V64), keyVersion v1/v2 payload 协议, 角色严格化 4 正式角色枚举.
|
|
38
|
+
- `src/compliance/errors.ts` 头部注释新增"v1.9.0+ admin 写端点行为变更"段 — 解释 403/404/501
|
|
39
|
+
HTTP 状态码契约改造与集成方应对.
|
|
40
|
+
- `README.md` 状态行版本号 1.6.0 → 1.9.0, 概要补 v1.7/v1.8/v1.9 highlight.
|
|
41
|
+
- `docs/开发与发布手册.md` 最后更新 2026-05-22 → 2026-05-25, 当前版本 1.5.0 → 1.9.0,
|
|
42
|
+
§4 目录结构补 6 个 namespace (casehall / enterprise / finance / pricing / products /
|
|
43
|
+
subscription).
|
|
44
|
+
|
|
45
|
+
## [1.9.0] - 2026-05-25
|
|
46
|
+
|
|
47
|
+
### Added — 商品化总规划 P7: 财务 finance namespace (发票/退款/对公转账)
|
|
48
|
+
|
|
49
|
+
钉死决策 (§13.7):
|
|
50
|
+
- 决策 14 对公转账: 支付页弹窗 + 企业微信对接销售/财务 + 财务系统手工 mark, **零银行 API**.
|
|
51
|
+
- 决策 15 退款规则: 订阅不退 / Token 包 7 天未用全额 / 服务交付后不退, 按 dist_refund_policy 表配置, 不硬编码.
|
|
52
|
+
- R12 价格快照: 订单创建时同步落 dist_order_price_snapshot, 支付回调按快照算 entitlement, 防 in-flight 改价错配.
|
|
53
|
+
|
|
54
|
+
- 新 namespace `finance/`:
|
|
55
|
+
- 类型 (`finance/types`):
|
|
56
|
+
- `Invoice` (普票/增普/增专) + `RequestInvoiceInput`
|
|
57
|
+
- `RefundPolicy` (5 条 seed: SUBSCRIPTION_NO_REFUND / TOKEN_PACK_7DAY_UNUSED / TOKEN_PACK_PRORATA_USED / COMPLIANCE_NO_REFUND_AFTER_DELIVERY / LEGAL_NO_REFUND_AFTER_DELIVERY)
|
|
58
|
+
- `RefundRecord` + `RequestRefundInput` (productFamily 派生 policyCode)
|
|
59
|
+
- `CorporateTransfer` + `InitiateCorporateTransferInput` + `InitiateCorporateTransferResult` (qrUrl/salesWechatId/financeEmail 弹窗数据)
|
|
60
|
+
- 方法 (与 tk-dist `/api/distribution/finance/**` 对齐):
|
|
61
|
+
- `client.requestRefund(req)` / `client.listMyRefunds()`
|
|
62
|
+
- `client.requestInvoice(req)` / `client.listMyInvoices()`
|
|
63
|
+
- `client.initiateCorporateTransfer(req)` / `client.uploadCorporateTransferProof(id, url)` / `client.listMyCorporateTransfers()`
|
|
64
|
+
|
|
65
|
+
### Notes
|
|
66
|
+
|
|
67
|
+
- admin 板块 (审批 / 财务工作台 / 月度对账 / dashboard) 由 admin UI 直连 `/api/admin/finance/**`, 不在 SDK 边界.
|
|
68
|
+
- DistPricingConfigService 新增 3 key 支撑决策 14 弹窗: `corporate_transfer_qr_url` / `corporate_transfer_sales_wechat_id` / `corporate_transfer_finance_email` (ops 热更).
|
|
69
|
+
- V51 SQL: 7 CREATE TABLE (`dist_invoice` / `dist_contract` / `dist_corporate_transfer` / `dist_refund_policy` / `dist_refund_record` / `dist_order_price_snapshot` / `dist_reconciliation`) + 5 INSERT seed policy + 3 INSERT seed pricing config.
|
|
70
|
+
- R12 实施: `OrderPaymentService.createPurchase` 在 `orderMapper.insert(order)` 后同步调 `OrderPriceSnapshotService.captureSnapshot(orderId, productId)`.
|
|
71
|
+
- 月度对账作业 `MonthlyReconciliationJob` 每月 1 号 02:30 跑上月对账, 差异 > 1% → log.error 告警.
|
|
72
|
+
|
|
73
|
+
## [1.8.1] - 2026-05-25
|
|
74
|
+
|
|
75
|
+
### Added — 商品化总规划 P6a: 企业席位 enterprise namespace
|
|
76
|
+
|
|
77
|
+
钉死决策 (§-1.4 H10 + §-1.2.D): tk-dist 新建 `dist_enterprise_*` 独立表族, 与 `dist_org_node` 分销代理体系
|
|
78
|
+
完全分离 (实测分销 dist_org_node 1 条 + dist_org_member 24 条均为代理身份, 不复用). §-1.2.D 钉死 4 项:
|
|
79
|
+
销售对接 ≥200 席 / 月度变更 3 次/订阅 / per_seat_cap = pool/seats×1.5 / pool = seats × Pro Max × 0.8.
|
|
80
|
+
|
|
81
|
+
- 新 namespace `enterprise/`:
|
|
82
|
+
- 类型 (`enterprise/types`):
|
|
83
|
+
- `EnterpriseSummary` (企业组织, contactPhone/Email 仅 OWNER/ADMIN 可见)
|
|
84
|
+
- `EnterpriseMember` (OWNER / ADMIN / MEMBER 角色, 不参与佣金)
|
|
85
|
+
- `OrgSubscription` (订阅 + §-1.2.D 4 项派生计算字段)
|
|
86
|
+
- `OrgSeat` (席位, seat_no 1..N, per_seat_monthly_cap_tk override)
|
|
87
|
+
- `InviteMemberRequest` / `AssignSeatRequest` / `OrgConsumeReport`
|
|
88
|
+
- 方法 (与 tk-dist `/api/admin/enterprises/**` + `/me/enterprises` 端点对齐):
|
|
89
|
+
- `client.listMyEnterprises()` / `client.getEnterprise(id)`
|
|
90
|
+
- `client.inviteMember(req)` / `client.listEnterpriseMembers(enterpriseId)`
|
|
91
|
+
- `client.listOrgSubscriptions(enterpriseId)`
|
|
92
|
+
- `client.listSeats(orgSubscriptionId)` / `client.assignSeat(req)` / `client.revokeSeat(seatId, note?)`
|
|
93
|
+
- `client.getOrgConsumeReport(enterpriseId)`
|
|
94
|
+
|
|
95
|
+
### Notes
|
|
96
|
+
|
|
97
|
+
- 不升 major (与 P5 1.8.0 兼容); admin 9 controllers (Enterprise / Member / Subscription / Seat /
|
|
98
|
+
SeatAssignment / Settlement / Sales / Billing / RiskControl) 由 admin UI 直连, 不在 SDK 边界.
|
|
99
|
+
- 后端 EntitlementService.hold() 入口已加 P6a enterprise pool fast-path (用户被分配席位 → 走简化
|
|
100
|
+
SHARED 池扣减; 池满 / 超 per_seat_cap → fallback 个人桶 + Free 兜底, 现有逻辑零侵入).
|
|
101
|
+
- web /org/console 路由占位 skeleton (订阅概览 / 成员管理 / 席位分配 / 用量统计), SDK 接入留 P6b.
|
|
102
|
+
- P6b (变更规则 + console UI 接入) + P6c (AI 初审外包对接) 后续 wave 实施.
|
|
103
|
+
|
|
104
|
+
## [1.8.0] - 2026-05-25
|
|
105
|
+
|
|
106
|
+
### Added — 商品化总规划 P5 (方案 B): 法律案件咨询 casehall namespace
|
|
107
|
+
|
|
108
|
+
钉死决策: Java tk-dist `yudao-module-casehall` 子模块, 与 `yudao-module-compliance` 并列体系
|
|
109
|
+
(不另起架构分裂). Go 网关侧 `legal_* 10 表` 保留供 `legal-wf-*` 工作流运行时使用,
|
|
110
|
+
与本商业化数据流松耦合。
|
|
111
|
+
|
|
112
|
+
- 新 namespace `casehall/`:
|
|
113
|
+
- 类型 (`casehall/types`):
|
|
114
|
+
- `LawyerSummary` (公开 L1 视图, licenseNo 等 PII L3 已脱敏剥离)
|
|
115
|
+
- `SubmitCaseLeadRequest` / `CaseLead` / `CaseMatter`
|
|
116
|
+
- `LegalConsultation` / `BookConsultationRequest`
|
|
117
|
+
- `LegalServiceOrder` / `LegalServiceSku`
|
|
118
|
+
- `LegalSkuCode` literal union (5 SKU)
|
|
119
|
+
- 方法 (与 tk-dist `/casehall/app/**` C 端公开 + `/casehall/me/**` 登录态对齐):
|
|
120
|
+
- `client.listLawyers({ practiceArea?, location?, pageNo?, pageSize? })`
|
|
121
|
+
- `client.getLawyer(id)`
|
|
122
|
+
- `client.submitCaseLead(req)` / `client.listMyCaseLeads()` / `client.getMyCases()`
|
|
123
|
+
- `client.bookConsultation(req)` / `client.listMyConsultations()`
|
|
124
|
+
- `client.listMyLegalOrders()` / `client.listLegalSKUs(region?)`
|
|
125
|
+
- 5 Legal SKU (复用 `dist_compliance_sku.benefit_type='LEGAL_SERVICE'`, V49 注入):
|
|
126
|
+
- `LEGAL_CONSULTATION_ONCE` 19900 分
|
|
127
|
+
- `LEGAL_CONSULTATION_60MIN` 35900 分
|
|
128
|
+
- `LEGAL_DOC_REVIEW_HUMAN` 49900 分
|
|
129
|
+
- `LEGAL_CASE_LEAD_CLAIM` 9900 分
|
|
130
|
+
- `LEGAL_LAWYER_SERVICE_PKG` 199900 分
|
|
131
|
+
|
|
132
|
+
### Notes
|
|
133
|
+
|
|
134
|
+
- admin 板块 9 模块 (`/casehall/admin/**`) 不在 SDK 边界, 仅 admin UI 直连。
|
|
135
|
+
- 路由实际生效由后续窗口在 nexus-v4 网关层路由白名单中开放。
|
|
136
|
+
|
|
137
|
+
## [1.7.0] - 2026-05-25
|
|
138
|
+
|
|
139
|
+
### Added — 商品化总规划 P4: csign 电子认证 SKU (扩展 pricing namespace)
|
|
140
|
+
|
|
141
|
+
- 新类型 (`pricing/types`): `ComplianceSku` / `ComplianceQuoteResponse` / `ComplianceBenefitType`
|
|
142
|
+
- 新方法 (匿名可调用):
|
|
143
|
+
- `client.listComplianceSkus(region?)` → `ComplianceSku[]`
|
|
144
|
+
- `client.quoteCompliance(skuCode, quantity?, region?)` → `ComplianceQuoteResponse`
|
|
145
|
+
- 端点 (Go 网关反代到 tk-dist `/api/distribution/public/compliance/**`, @PermitAll 匿名):
|
|
146
|
+
- `/distribution/public/compliance/skus?region=CN|OS|GLOBAL`
|
|
147
|
+
- `/distribution/public/compliance/quote?skuCode=...&quantity=...®ion=...`
|
|
148
|
+
- 字段白名单: 公开端点不暴露 `upstreamCostFen` / `status` / 内部 id
|
|
149
|
+
|
|
150
|
+
### Added — 商品化总规划 P1: 订阅档位 + 公开业务参数 namespace
|
|
151
|
+
|
|
152
|
+
- 新 namespace `subscription/`:
|
|
153
|
+
- 类型: `SubscriptionPlan` / `UserSubscription` / `SubscriptionAudience` / `RolloverPolicy`
|
|
154
|
+
- 方法: `client.listPlans(audience?)` / `client.listUserSubscriptions()`
|
|
155
|
+
- 新 namespace `pricing/`:
|
|
156
|
+
- 类型: `PricingConfig` (Record<string,string>) / `PublicModelSummary`
|
|
157
|
+
- 方法: `client.getPricingConfig(key?)` / `client.listPublicModels()`
|
|
158
|
+
- 端点 (Go 网关反代到 tk-dist `/api/distribution/public/pricing/**`, 网关代理路由 P3 商品中心补):
|
|
159
|
+
- `/distribution/public/pricing/plans?audience=PERSONAL|ENTERPRISE`
|
|
160
|
+
- `/distribution/public/pricing/config?key=...`
|
|
161
|
+
- `/distribution/public/pricing/models`
|
|
162
|
+
- `/distribution/user/subscriptions`
|
|
163
|
+
|
|
164
|
+
### Added — 商品化总规划 P3: 商品中心 namespace (同 minor 升级, version 仍 1.7.0)
|
|
165
|
+
|
|
166
|
+
- 新 namespace `products/`:
|
|
167
|
+
- 类型: `Product` / `ProductFamily` / `Audience` / `BillingMode` / `RegionScope`
|
|
168
|
+
- 枚举常量: `ProductFamilyEnum` / `AudienceEnum` / `BillingModeEnum` / `RegionScopeEnum`
|
|
169
|
+
- 方法: `client.listProductsByFamily(family?, audience?, region?)` / `client.getProductBySlug(slug, region?)`
|
|
170
|
+
- 端点 (Go 网关反代到 tk-dist `/api/distribution/public/products/**`):
|
|
171
|
+
- `/distribution/public/products/by-family?family=MODEL_MEMBERSHIP&audience=PERSONAL®ion=GLOBAL`
|
|
172
|
+
- `/distribution/public/products/by-slug/{slug}`
|
|
173
|
+
- 字段白名单严格 (与后端 `DistProductMappingService#toPublicResponse` 同源):
|
|
174
|
+
仅暴露 `id / publicSlug / displayName / productFamily / audience / billingMode / regionScope / basePriceFen / tokenQuota / displayMetadataJson`.
|
|
175
|
+
`featureGateJson` (H5 能力开关) / `retiredAt` / `salesChannelJson` / `priceSnapshotPolicy` 禁止外泄.
|
|
176
|
+
- 后端 V47 DDL: `dist_product_mapping` 加 9 字段 (`product_family / audience / billing_mode / feature_gate_json / region_scope / sales_channel_json / price_snapshot_policy / display_metadata_json / retired_at`).
|
|
177
|
+
|
|
178
|
+
### Compatibility — 100% 后向
|
|
179
|
+
|
|
180
|
+
- 新增三个 barrel namespace (subscription/pricing/products), 现有所有 import 路径不变.
|
|
181
|
+
- 新增方法走 declaration merging 注入 `Client.prototype`, 不破坏既有签名.
|
|
182
|
+
- 缺省 wire 字段策略与 v1.6.x 一致 (snake_case → camelCase 不做映射, 直接吃 Java 返回结构).
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
8
186
|
## [1.6.0] - 2026-05-24
|
|
9
187
|
|
|
10
188
|
### Added — 业务侧终端用户 id (endUserId) + 请求保活
|
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
|
-
- 当前版本:**
|
|
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)
|
package/dist/browser/index.mjs
CHANGED
|
@@ -6126,6 +6126,399 @@ Client.prototype.getBugReport = async function(bugID, signal) {
|
|
|
6126
6126
|
return resp.data;
|
|
6127
6127
|
};
|
|
6128
6128
|
|
|
6129
|
-
|
|
6129
|
+
// src/subscription/client.ts
|
|
6130
|
+
Client.prototype.listPlans = async function(audience, signal) {
|
|
6131
|
+
const query = audience ? `?audience=${encodeURIComponent(audience)}` : "";
|
|
6132
|
+
const resp = await this.doJSON(
|
|
6133
|
+
"GET",
|
|
6134
|
+
`/distribution/public/pricing/plans${query}`,
|
|
6135
|
+
null,
|
|
6136
|
+
signal
|
|
6137
|
+
);
|
|
6138
|
+
return Array.isArray(resp.data) ? resp.data : [];
|
|
6139
|
+
};
|
|
6140
|
+
Client.prototype.listUserSubscriptions = async function(signal) {
|
|
6141
|
+
const resp = await this.doJSON(
|
|
6142
|
+
"GET",
|
|
6143
|
+
"/distribution/user/subscriptions",
|
|
6144
|
+
null,
|
|
6145
|
+
signal
|
|
6146
|
+
);
|
|
6147
|
+
return Array.isArray(resp.data) ? resp.data : [];
|
|
6148
|
+
};
|
|
6149
|
+
|
|
6150
|
+
// src/pricing/client.ts
|
|
6151
|
+
Client.prototype.getPricingConfig = async function(key, signal) {
|
|
6152
|
+
const query = key ? `?key=${encodeURIComponent(key)}` : "";
|
|
6153
|
+
const resp = await this.doJSON(
|
|
6154
|
+
"GET",
|
|
6155
|
+
`/distribution/public/pricing/config${query}`,
|
|
6156
|
+
null,
|
|
6157
|
+
signal
|
|
6158
|
+
);
|
|
6159
|
+
return resp.data ?? {};
|
|
6160
|
+
};
|
|
6161
|
+
Client.prototype.listPublicModels = async function(signal) {
|
|
6162
|
+
const resp = await this.doJSON(
|
|
6163
|
+
"GET",
|
|
6164
|
+
"/distribution/public/pricing/models",
|
|
6165
|
+
null,
|
|
6166
|
+
signal
|
|
6167
|
+
);
|
|
6168
|
+
return Array.isArray(resp.data) ? resp.data : [];
|
|
6169
|
+
};
|
|
6170
|
+
Client.prototype.listComplianceSkus = async function(region, signal) {
|
|
6171
|
+
const query = region ? `?region=${encodeURIComponent(region)}` : "";
|
|
6172
|
+
const resp = await this.doJSON(
|
|
6173
|
+
"GET",
|
|
6174
|
+
`/distribution/public/compliance/skus${query}`,
|
|
6175
|
+
null,
|
|
6176
|
+
signal
|
|
6177
|
+
);
|
|
6178
|
+
return Array.isArray(resp.data) ? resp.data : [];
|
|
6179
|
+
};
|
|
6180
|
+
Client.prototype.quoteCompliance = async function(skuCode, quantity, region, signal) {
|
|
6181
|
+
if (!skuCode) {
|
|
6182
|
+
throw new Error("quoteCompliance: skuCode is required");
|
|
6183
|
+
}
|
|
6184
|
+
const params = [`skuCode=${encodeURIComponent(skuCode)}`];
|
|
6185
|
+
if (quantity != null) params.push(`quantity=${quantity}`);
|
|
6186
|
+
if (region) params.push(`region=${encodeURIComponent(region)}`);
|
|
6187
|
+
const resp = await this.doJSON(
|
|
6188
|
+
"GET",
|
|
6189
|
+
`/distribution/public/compliance/quote?${params.join("&")}`,
|
|
6190
|
+
null,
|
|
6191
|
+
signal
|
|
6192
|
+
);
|
|
6193
|
+
return resp.data ?? { skuCode, available: false };
|
|
6194
|
+
};
|
|
6195
|
+
|
|
6196
|
+
// src/products/types.ts
|
|
6197
|
+
var ProductFamilyEnum = {
|
|
6198
|
+
MODEL_MEMBERSHIP: "MODEL_MEMBERSHIP",
|
|
6199
|
+
TOKEN_PACK: "TOKEN_PACK",
|
|
6200
|
+
COMPLIANCE: "COMPLIANCE",
|
|
6201
|
+
LEGAL: "LEGAL",
|
|
6202
|
+
DESIGN_AGENT: "DESIGN_AGENT",
|
|
6203
|
+
ENTERPRISE: "ENTERPRISE"
|
|
6204
|
+
};
|
|
6205
|
+
var AudienceEnum = {
|
|
6206
|
+
PERSONAL: "PERSONAL",
|
|
6207
|
+
ENTERPRISE: "ENTERPRISE",
|
|
6208
|
+
DEVELOPER: "DEVELOPER"
|
|
6209
|
+
};
|
|
6210
|
+
var BillingModeEnum = {
|
|
6211
|
+
ONE_TIME: "ONE_TIME",
|
|
6212
|
+
SUBSCRIPTION: "SUBSCRIPTION",
|
|
6213
|
+
METERED: "METERED",
|
|
6214
|
+
HYBRID: "HYBRID"
|
|
6215
|
+
};
|
|
6216
|
+
var RegionScopeEnum = {
|
|
6217
|
+
CN: "CN",
|
|
6218
|
+
OS: "OS",
|
|
6219
|
+
GLOBAL: "GLOBAL"
|
|
6220
|
+
};
|
|
6221
|
+
|
|
6222
|
+
// src/products/client.ts
|
|
6223
|
+
Client.prototype.listProductsByFamily = async function(family, audience, region, signal) {
|
|
6224
|
+
const params = [];
|
|
6225
|
+
if (family) params.push(`family=${encodeURIComponent(family)}`);
|
|
6226
|
+
if (audience) params.push(`audience=${encodeURIComponent(audience)}`);
|
|
6227
|
+
if (region) params.push(`region=${encodeURIComponent(region)}`);
|
|
6228
|
+
const query = params.length > 0 ? `?${params.join("&")}` : "";
|
|
6229
|
+
const resp = await this.doJSON(
|
|
6230
|
+
"GET",
|
|
6231
|
+
`/distribution/public/products/by-family${query}`,
|
|
6232
|
+
null,
|
|
6233
|
+
signal
|
|
6234
|
+
);
|
|
6235
|
+
return Array.isArray(resp.data) ? resp.data : [];
|
|
6236
|
+
};
|
|
6237
|
+
Client.prototype.getProductBySlug = async function(slug, region, signal) {
|
|
6238
|
+
if (!slug) {
|
|
6239
|
+
throw new Error("getProductBySlug: slug is required");
|
|
6240
|
+
}
|
|
6241
|
+
const query = region ? `?region=${encodeURIComponent(region)}` : "";
|
|
6242
|
+
const resp = await this.doJSON(
|
|
6243
|
+
"GET",
|
|
6244
|
+
`/distribution/public/products/by-slug/${encodeURIComponent(slug)}${query}`,
|
|
6245
|
+
null,
|
|
6246
|
+
signal
|
|
6247
|
+
);
|
|
6248
|
+
if (!resp.data) {
|
|
6249
|
+
throw new Error(`getProductBySlug: product not found (slug=${slug})`);
|
|
6250
|
+
}
|
|
6251
|
+
return resp.data;
|
|
6252
|
+
};
|
|
6253
|
+
|
|
6254
|
+
// src/casehall/client.ts
|
|
6255
|
+
Client.prototype.listLawyers = async function(params, signal) {
|
|
6256
|
+
const qs = new URLSearchParams();
|
|
6257
|
+
if (params?.practiceArea) qs.set("practiceArea", params.practiceArea);
|
|
6258
|
+
if (params?.location) qs.set("location", params.location);
|
|
6259
|
+
if (params?.pageNo != null) qs.set("pageNo", String(params.pageNo));
|
|
6260
|
+
if (params?.pageSize != null) qs.set("pageSize", String(params.pageSize));
|
|
6261
|
+
const q = qs.toString() ? `?${qs.toString()}` : "";
|
|
6262
|
+
const resp = await this.doJSON(
|
|
6263
|
+
"GET",
|
|
6264
|
+
`/casehall/app/lawyers${q}`,
|
|
6265
|
+
null,
|
|
6266
|
+
signal
|
|
6267
|
+
);
|
|
6268
|
+
return resp.data ?? [];
|
|
6269
|
+
};
|
|
6270
|
+
Client.prototype.getLawyer = async function(id, signal) {
|
|
6271
|
+
const resp = await this.doJSON(
|
|
6272
|
+
"GET",
|
|
6273
|
+
`/casehall/app/lawyers/${id}`,
|
|
6274
|
+
null,
|
|
6275
|
+
signal
|
|
6276
|
+
);
|
|
6277
|
+
if (!resp.data) throw new Error(`lawyer ${id} not found`);
|
|
6278
|
+
return resp.data;
|
|
6279
|
+
};
|
|
6280
|
+
Client.prototype.submitCaseLead = async function(req, signal) {
|
|
6281
|
+
const resp = await this.doJSON(
|
|
6282
|
+
"POST",
|
|
6283
|
+
`/casehall/me/case-leads`,
|
|
6284
|
+
req,
|
|
6285
|
+
signal
|
|
6286
|
+
);
|
|
6287
|
+
return resp.data ?? { id: 0 };
|
|
6288
|
+
};
|
|
6289
|
+
Client.prototype.listMyCaseLeads = async function(signal) {
|
|
6290
|
+
const resp = await this.doJSON(
|
|
6291
|
+
"GET",
|
|
6292
|
+
`/casehall/me/case-leads`,
|
|
6293
|
+
null,
|
|
6294
|
+
signal
|
|
6295
|
+
);
|
|
6296
|
+
return resp.data ?? [];
|
|
6297
|
+
};
|
|
6298
|
+
Client.prototype.getMyCases = async function(signal) {
|
|
6299
|
+
const resp = await this.doJSON(
|
|
6300
|
+
"GET",
|
|
6301
|
+
`/casehall/me/cases`,
|
|
6302
|
+
null,
|
|
6303
|
+
signal
|
|
6304
|
+
);
|
|
6305
|
+
return resp.data ?? [];
|
|
6306
|
+
};
|
|
6307
|
+
Client.prototype.bookConsultation = async function(req, signal) {
|
|
6308
|
+
const resp = await this.doJSON(
|
|
6309
|
+
"POST",
|
|
6310
|
+
`/casehall/me/consultations`,
|
|
6311
|
+
req,
|
|
6312
|
+
signal
|
|
6313
|
+
);
|
|
6314
|
+
return resp.data ?? { consultationId: 0 };
|
|
6315
|
+
};
|
|
6316
|
+
Client.prototype.listMyConsultations = async function(signal) {
|
|
6317
|
+
const resp = await this.doJSON(
|
|
6318
|
+
"GET",
|
|
6319
|
+
`/casehall/me/consultations`,
|
|
6320
|
+
null,
|
|
6321
|
+
signal
|
|
6322
|
+
);
|
|
6323
|
+
return resp.data ?? [];
|
|
6324
|
+
};
|
|
6325
|
+
Client.prototype.listMyLegalOrders = async function(signal) {
|
|
6326
|
+
const resp = await this.doJSON(
|
|
6327
|
+
"GET",
|
|
6328
|
+
`/casehall/me/orders`,
|
|
6329
|
+
null,
|
|
6330
|
+
signal
|
|
6331
|
+
);
|
|
6332
|
+
return resp.data ?? [];
|
|
6333
|
+
};
|
|
6334
|
+
Client.prototype.listLegalSKUs = async function(region, signal) {
|
|
6335
|
+
const q = region ? `?region=${encodeURIComponent(region)}&benefitType=LEGAL_SERVICE` : `?benefitType=LEGAL_SERVICE`;
|
|
6336
|
+
const resp = await this.doJSON(
|
|
6337
|
+
"GET",
|
|
6338
|
+
`/casehall/app/legal-skus${q}`,
|
|
6339
|
+
null,
|
|
6340
|
+
signal
|
|
6341
|
+
);
|
|
6342
|
+
return resp.data ?? [];
|
|
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
|
+
};
|
|
6353
|
+
|
|
6354
|
+
// src/enterprise/client.ts
|
|
6355
|
+
Client.prototype.listMyEnterprises = async function(signal) {
|
|
6356
|
+
const resp = await this.doJSON(
|
|
6357
|
+
"GET",
|
|
6358
|
+
`/me/enterprises`,
|
|
6359
|
+
null,
|
|
6360
|
+
signal
|
|
6361
|
+
);
|
|
6362
|
+
return resp.data ?? [];
|
|
6363
|
+
};
|
|
6364
|
+
Client.prototype.getEnterprise = async function(id, signal) {
|
|
6365
|
+
const resp = await this.doJSON(
|
|
6366
|
+
"GET",
|
|
6367
|
+
`/api/admin/enterprises/${id}`,
|
|
6368
|
+
null,
|
|
6369
|
+
signal
|
|
6370
|
+
);
|
|
6371
|
+
if (!resp.data) throw new Error(`enterprise ${id} not found`);
|
|
6372
|
+
return resp.data;
|
|
6373
|
+
};
|
|
6374
|
+
Client.prototype.inviteMember = async function(req, signal) {
|
|
6375
|
+
const resp = await this.doJSON(
|
|
6376
|
+
"POST",
|
|
6377
|
+
`/api/admin/enterprise-members`,
|
|
6378
|
+
req,
|
|
6379
|
+
signal
|
|
6380
|
+
);
|
|
6381
|
+
if (!resp.data) throw new Error("invite member failed");
|
|
6382
|
+
return resp.data;
|
|
6383
|
+
};
|
|
6384
|
+
Client.prototype.listEnterpriseMembers = async function(enterpriseId, signal) {
|
|
6385
|
+
const resp = await this.doJSON(
|
|
6386
|
+
"GET",
|
|
6387
|
+
`/api/admin/enterprise-members/by-enterprise/${enterpriseId}`,
|
|
6388
|
+
null,
|
|
6389
|
+
signal
|
|
6390
|
+
);
|
|
6391
|
+
return resp.data ?? [];
|
|
6392
|
+
};
|
|
6393
|
+
Client.prototype.listOrgSubscriptions = async function(enterpriseId, signal) {
|
|
6394
|
+
const resp = await this.doJSON(
|
|
6395
|
+
"GET",
|
|
6396
|
+
`/api/admin/org-subscriptions/by-enterprise/${enterpriseId}`,
|
|
6397
|
+
null,
|
|
6398
|
+
signal
|
|
6399
|
+
);
|
|
6400
|
+
return resp.data ?? [];
|
|
6401
|
+
};
|
|
6402
|
+
Client.prototype.listSeats = async function(orgSubscriptionId, signal) {
|
|
6403
|
+
const resp = await this.doJSON(
|
|
6404
|
+
"GET",
|
|
6405
|
+
`/api/admin/org-seats/by-subscription/${orgSubscriptionId}`,
|
|
6406
|
+
null,
|
|
6407
|
+
signal
|
|
6408
|
+
);
|
|
6409
|
+
return resp.data ?? [];
|
|
6410
|
+
};
|
|
6411
|
+
Client.prototype.assignSeat = async function(req, signal) {
|
|
6412
|
+
const resp = await this.doJSON(
|
|
6413
|
+
"POST",
|
|
6414
|
+
`/api/admin/org-seats/assign`,
|
|
6415
|
+
req,
|
|
6416
|
+
signal
|
|
6417
|
+
);
|
|
6418
|
+
if (!resp.data) throw new Error("assign seat failed");
|
|
6419
|
+
return resp.data;
|
|
6420
|
+
};
|
|
6421
|
+
Client.prototype.revokeSeat = async function(seatId, note, signal) {
|
|
6422
|
+
const qs = note ? `?note=${encodeURIComponent(note)}` : "";
|
|
6423
|
+
await this.doJSON(
|
|
6424
|
+
"POST",
|
|
6425
|
+
`/api/admin/org-seats/${seatId}/revoke${qs}`,
|
|
6426
|
+
null,
|
|
6427
|
+
signal
|
|
6428
|
+
);
|
|
6429
|
+
};
|
|
6430
|
+
Client.prototype.getOrgConsumeReport = async function(enterpriseId, signal) {
|
|
6431
|
+
const resp = await this.doJSON(
|
|
6432
|
+
"GET",
|
|
6433
|
+
`/api/admin/enterprise-settlements/overview/${enterpriseId}`,
|
|
6434
|
+
null,
|
|
6435
|
+
signal
|
|
6436
|
+
);
|
|
6437
|
+
if (!resp.data) {
|
|
6438
|
+
return {
|
|
6439
|
+
enterpriseId,
|
|
6440
|
+
subscriptionCount: 0,
|
|
6441
|
+
totalPoolTk: 0,
|
|
6442
|
+
totalUsedTk: 0,
|
|
6443
|
+
totalPriceFen: 0
|
|
6444
|
+
};
|
|
6445
|
+
}
|
|
6446
|
+
return resp.data;
|
|
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
|
+
};
|
|
6457
|
+
|
|
6458
|
+
// src/finance/client.ts
|
|
6459
|
+
Client.prototype.requestRefund = async function(req, signal) {
|
|
6460
|
+
const resp = await this.doJSON(
|
|
6461
|
+
"POST",
|
|
6462
|
+
`/api/distribution/finance/refund/request`,
|
|
6463
|
+
req,
|
|
6464
|
+
signal
|
|
6465
|
+
);
|
|
6466
|
+
if (!resp.data) throw new Error("refund/request: empty response");
|
|
6467
|
+
return resp.data;
|
|
6468
|
+
};
|
|
6469
|
+
Client.prototype.listMyRefunds = async function(signal) {
|
|
6470
|
+
const resp = await this.doJSON(
|
|
6471
|
+
"GET",
|
|
6472
|
+
`/api/distribution/finance/refund/my`,
|
|
6473
|
+
null,
|
|
6474
|
+
signal
|
|
6475
|
+
);
|
|
6476
|
+
return resp.data ?? [];
|
|
6477
|
+
};
|
|
6478
|
+
Client.prototype.requestInvoice = async function(req, signal) {
|
|
6479
|
+
const resp = await this.doJSON(
|
|
6480
|
+
"POST",
|
|
6481
|
+
`/api/distribution/finance/invoice/request`,
|
|
6482
|
+
req,
|
|
6483
|
+
signal
|
|
6484
|
+
);
|
|
6485
|
+
if (!resp.data) throw new Error("invoice/request: empty response");
|
|
6486
|
+
return resp.data;
|
|
6487
|
+
};
|
|
6488
|
+
Client.prototype.listMyInvoices = async function(signal) {
|
|
6489
|
+
const resp = await this.doJSON(
|
|
6490
|
+
"GET",
|
|
6491
|
+
`/api/distribution/finance/invoice/my`,
|
|
6492
|
+
null,
|
|
6493
|
+
signal
|
|
6494
|
+
);
|
|
6495
|
+
return resp.data ?? [];
|
|
6496
|
+
};
|
|
6497
|
+
Client.prototype.initiateCorporateTransfer = async function(req, signal) {
|
|
6498
|
+
const resp = await this.doJSON(
|
|
6499
|
+
"POST",
|
|
6500
|
+
`/api/distribution/finance/corporate-transfer/initiate`,
|
|
6501
|
+
req,
|
|
6502
|
+
signal
|
|
6503
|
+
);
|
|
6504
|
+
if (!resp.data) throw new Error("corporate-transfer/initiate: empty response");
|
|
6505
|
+
return resp.data;
|
|
6506
|
+
};
|
|
6507
|
+
Client.prototype.uploadCorporateTransferProof = async function(id, proofUrl, signal) {
|
|
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);
|
|
6510
|
+
return resp.data ?? false;
|
|
6511
|
+
};
|
|
6512
|
+
Client.prototype.listMyCorporateTransfers = async function(signal) {
|
|
6513
|
+
const resp = await this.doJSON(
|
|
6514
|
+
"GET",
|
|
6515
|
+
`/api/distribution/finance/corporate-transfer/my`,
|
|
6516
|
+
null,
|
|
6517
|
+
signal
|
|
6518
|
+
);
|
|
6519
|
+
return resp.data ?? [];
|
|
6520
|
+
};
|
|
6521
|
+
|
|
6522
|
+
export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, AudienceEnum, BillingModeEnum, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, LocalStorageTokenStore as DefaultBrowserTokenStore, DefaultRetryPolicy, ErrAuthDenied, ErrBillingCallbackCannotCommit, ErrBillingCommitRequiresLocalVerify, ErrBillingS2sForbidden, ErrBrowserOpen, ErrComplianceStepUpRequired, ErrDiscovery, ErrEnvelopeGateClosed, ErrOAuthCORSBlocked, ErrProviderNotConfigured, ErrProviderUnknownNoRetry, ErrRefreshProxyFailed, ErrRegistration, ErrSSLProxy, ErrSealApprovalContractHashMismatch, ErrSealApprovalExpired, ErrSealApprovalLocationMismatch, ErrSealApprovalNonceUsed, ErrSealApprovalNotApproved, ErrSealApprovalSealMismatch, ErrSealApprovalTransactorMismatch, ErrSealUseAlreadyConsumed, ErrStateMismatch, ErrTimeout, ErrTokenExchange, ErrTokenExpired, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, IdempotencyKeyHeader, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OpenAIAdapter, OrderTerminalError, ProductFamilyEnum, ProviderFormat, RETRY_ADVICE_REASONS, RateLimitError, RegionScopeEnum, ScopeAI, ScopeAccount, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, ScopeComplianceContractTemplateRead, ScopeComplianceContractTemplateWrite, ScopeComplianceEvidenceRead, ScopeComplianceEvidenceWrite, ScopeComplianceReportsPublish, ScopeComplianceReportsRead, ScopeComplianceReportsWrite, ScopeComplianceSealApprovalApprove, ScopeComplianceSealApprovalRequest, ScopeComplianceSealManage, ScopeComplianceSealUseExecute, ScopeComplianceTimestampIssue, ScopeComplianceTimestampVerify, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, classifyComplianceError, commerceScopes, completeWebAuthorizationRequest, complianceErrorToRetryAdvice, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSECommentLine, isSSLError, maxEndUserIdLength, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, parseNotificationEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge, validateEndUserId };
|
|
6130
6523
|
//# sourceMappingURL=index.mjs.map
|
|
6131
6524
|
//# sourceMappingURL=index.mjs.map
|