@acosmi/sdk-ts 1.4.2 → 1.5.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 +132 -0
- package/README.md +91 -2
- package/dist/browser/index.mjs +521 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +521 -2
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +527 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1079 -31
- package/dist/node/index.d.ts +1079 -31
- package/dist/node/index.mjs +521 -2
- package/dist/node/index.mjs.map +1 -1
- package/docs/compliance.md +452 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3464,6 +3464,115 @@ function normalizeRawMessages(rm) {
|
|
|
3464
3464
|
// src/shared/index.ts
|
|
3465
3465
|
init_errors();
|
|
3466
3466
|
|
|
3467
|
+
// src/shared/operation.ts
|
|
3468
|
+
var IdempotencyKeyHeader = "Idempotency-Key";
|
|
3469
|
+
|
|
3470
|
+
// src/shared/retry-advice.ts
|
|
3471
|
+
var RETRY_ADVICE_REASONS = [
|
|
3472
|
+
"unknown",
|
|
3473
|
+
"retrying",
|
|
3474
|
+
"failed",
|
|
3475
|
+
"gate_closed",
|
|
3476
|
+
"step_up_required",
|
|
3477
|
+
"tenant_mismatch",
|
|
3478
|
+
"insufficient_scope",
|
|
3479
|
+
"quota_exceeded",
|
|
3480
|
+
"provider_timeout",
|
|
3481
|
+
"local_verify_failed",
|
|
3482
|
+
"billing_preflight_failed"
|
|
3483
|
+
];
|
|
3484
|
+
var COMPLIANCE_KEY_TO_RETRY_REASON = {
|
|
3485
|
+
// 通用 / token / scope
|
|
3486
|
+
COMPLIANCE_UNAUTHORIZED: "failed",
|
|
3487
|
+
COMPLIANCE_INSUFFICIENT_SCOPE: "insufficient_scope",
|
|
3488
|
+
COMPLIANCE_STEP_UP_REQUIRED: "step_up_required",
|
|
3489
|
+
COMPLIANCE_TOKEN_INVALID: "failed",
|
|
3490
|
+
// 主体快照
|
|
3491
|
+
SUBJECT_SNAPSHOT_REQUIRED: "failed",
|
|
3492
|
+
SUBJECT_SNAPSHOT_NOT_FOUND: "failed",
|
|
3493
|
+
SUBJECT_SNAPSHOT_TENANT_MISMATCH: "tenant_mismatch",
|
|
3494
|
+
// Evidence / Timestamp / Package / Report
|
|
3495
|
+
EVIDENCE_ASSET_NOT_FOUND: "failed",
|
|
3496
|
+
EVIDENCE_ASSET_HASH_MISMATCH: "local_verify_failed",
|
|
3497
|
+
EVIDENCE_ASSET_PAYLOAD_REQUIRED: "failed",
|
|
3498
|
+
TIMESTAMP_TOKEN_NOT_FOUND: "failed",
|
|
3499
|
+
TIMESTAMP_PROVIDER_FAILED: "failed",
|
|
3500
|
+
TIMESTAMP_PROVIDER_UNKNOWN: "unknown",
|
|
3501
|
+
TIMESTAMP_LOCAL_VERIFY_FAILED: "local_verify_failed",
|
|
3502
|
+
TIMESTAMP_PROVIDER_NOT_AVAILABLE: "provider_timeout",
|
|
3503
|
+
EVIDENCE_PACKAGE_NOT_FOUND: "failed",
|
|
3504
|
+
EVIDENCE_PACKAGE_TIMESTAMP_REQUIRED: "failed",
|
|
3505
|
+
EVIDENCE_PACKAGE_MANIFEST_HASH_MISMATCH: "local_verify_failed",
|
|
3506
|
+
REPORT_NOT_FOUND: "failed",
|
|
3507
|
+
REPORT_ALREADY_PUBLISHED: "failed",
|
|
3508
|
+
REPORT_DRAFT_REQUIRED: "failed",
|
|
3509
|
+
EVIDENCE_VERIFY_TARGET_REQUIRED: "failed",
|
|
3510
|
+
EVIDENCE_VERIFY_TARGET_NOT_FOUND: "failed",
|
|
3511
|
+
// Provider request
|
|
3512
|
+
PROVIDER_REQUEST_UNKNOWN_NO_RETRY: "unknown",
|
|
3513
|
+
PROVIDER_CALLBACK_SOURCE_INVALID: "failed",
|
|
3514
|
+
PROVIDER_NOT_CONFIGURED: "gate_closed",
|
|
3515
|
+
PROVIDER_REQUEST_NOT_FOUND: "failed",
|
|
3516
|
+
PROVIDER_REQUEST_IDEMPOTENCY_REQUIRED: "failed",
|
|
3517
|
+
PROVIDER_REQUEST_STATUS_NOT_TERMINAL: "retrying",
|
|
3518
|
+
// Envelope
|
|
3519
|
+
ENVELOPE_NOT_FOUND: "failed",
|
|
3520
|
+
ENVELOPE_TENANT_MISMATCH: "tenant_mismatch",
|
|
3521
|
+
ENVELOPE_STATE_NOT_ALLOWED: "failed",
|
|
3522
|
+
ENVELOPE_GATE_CLOSED: "gate_closed",
|
|
3523
|
+
CONTRACT_NOT_FOUND: "failed",
|
|
3524
|
+
CONTRACT_HASH_MISMATCH: "local_verify_failed",
|
|
3525
|
+
PROVIDER_AUTHORIZATION_NOT_CONFIRMED: "failed",
|
|
3526
|
+
ENVELOPE_EVIDENCE_NOT_READY: "retrying",
|
|
3527
|
+
// Seal approval / use
|
|
3528
|
+
SEAL_ASSET_NOT_FOUND: "failed",
|
|
3529
|
+
SEAL_APPROVAL_NOT_FOUND: "failed",
|
|
3530
|
+
SEAL_APPROVAL_STATE_NOT_APPROVED: "failed",
|
|
3531
|
+
SEAL_APPROVAL_EXPIRED: "failed",
|
|
3532
|
+
SEAL_APPROVAL_ALREADY_USED: "failed",
|
|
3533
|
+
SEAL_APPROVAL_NONCE_USED: "failed",
|
|
3534
|
+
SEAL_APPROVAL_SEAL_MISMATCH: "failed",
|
|
3535
|
+
SEAL_APPROVAL_LOCATION_MISMATCH: "failed",
|
|
3536
|
+
SEAL_APPROVAL_TRANSACTOR_MISMATCH: "failed",
|
|
3537
|
+
SEAL_APPROVAL_CONTRACT_HASH_MISMATCH: "local_verify_failed",
|
|
3538
|
+
SEAL_APPROVAL_INVALID_TRANSITION: "failed",
|
|
3539
|
+
SEAL_USE_ALREADY_CONSUMED: "failed",
|
|
3540
|
+
// Audit chain
|
|
3541
|
+
AUDIT_CHAIN_TAMPER_DETECTED: "local_verify_failed",
|
|
3542
|
+
// Billing
|
|
3543
|
+
BILLING_COMMIT_REQUIRES_LOCAL_VERIFY: "local_verify_failed",
|
|
3544
|
+
BILLING_COMMIT_REQUIRES_PROVIDER_SUCCESS: "billing_preflight_failed",
|
|
3545
|
+
BILLING_CALLBACK_CANNOT_COMMIT: "billing_preflight_failed",
|
|
3546
|
+
BILLING_PROVIDER_UNKNOWN_NOT_COMMITTABLE: "billing_preflight_failed",
|
|
3547
|
+
BILLING_S2S_FORBIDDEN: "failed",
|
|
3548
|
+
// SDK fallback
|
|
3549
|
+
UNKNOWN_COMPLIANCE_ERROR: "unknown"
|
|
3550
|
+
};
|
|
3551
|
+
function retryReasonForComplianceKey(key) {
|
|
3552
|
+
return COMPLIANCE_KEY_TO_RETRY_REASON[key] ?? "unknown";
|
|
3553
|
+
}
|
|
3554
|
+
var OAUTH_ERROR_TO_RETRY_REASON = {
|
|
3555
|
+
insufficient_scope: "insufficient_scope",
|
|
3556
|
+
invalid_token: "failed",
|
|
3557
|
+
invalid_grant: "failed",
|
|
3558
|
+
invalid_request: "failed",
|
|
3559
|
+
access_denied: "failed",
|
|
3560
|
+
unsupported_grant_type: "failed"
|
|
3561
|
+
};
|
|
3562
|
+
function retryReasonForOAuthError(oauthError) {
|
|
3563
|
+
return OAUTH_ERROR_TO_RETRY_REASON[oauthError] ?? "unknown";
|
|
3564
|
+
}
|
|
3565
|
+
function complianceErrorToRetryAdvice(info) {
|
|
3566
|
+
return {
|
|
3567
|
+
retryable: info.retryable,
|
|
3568
|
+
sameIdempotencyKeyRequired: !info.terminal,
|
|
3569
|
+
manualActionRequired: info.terminal || info.stepUpRequired,
|
|
3570
|
+
reason: retryReasonForComplianceKey(info.key),
|
|
3571
|
+
developerMessage: info.message,
|
|
3572
|
+
supportCode: `compliance:${info.code}`
|
|
3573
|
+
};
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3467
3576
|
// src/auth/scopes.ts
|
|
3468
3577
|
var ScopeAI = "ai";
|
|
3469
3578
|
var ScopeSkills = "skills";
|
|
@@ -4827,6 +4936,8 @@ var ScopeComplianceSealUseExecute = "compliance:seal_use:execute";
|
|
|
4827
4936
|
var ScopeComplianceReportsRead = "compliance:reports:read";
|
|
4828
4937
|
var ScopeComplianceReportsWrite = "compliance:reports:write";
|
|
4829
4938
|
var ScopeComplianceReportsPublish = "compliance:reports:publish";
|
|
4939
|
+
var ScopeComplianceContractTemplateRead = "compliance:contract_template:read";
|
|
4940
|
+
var ScopeComplianceContractTemplateWrite = "compliance:contract_template:write";
|
|
4830
4941
|
function complianceScopes() {
|
|
4831
4942
|
return [
|
|
4832
4943
|
ScopeComplianceEvidenceRead,
|
|
@@ -4841,7 +4952,9 @@ function complianceScopes() {
|
|
|
4841
4952
|
ScopeComplianceSealUseExecute,
|
|
4842
4953
|
ScopeComplianceReportsRead,
|
|
4843
4954
|
ScopeComplianceReportsWrite,
|
|
4844
|
-
ScopeComplianceReportsPublish
|
|
4955
|
+
ScopeComplianceReportsPublish,
|
|
4956
|
+
ScopeComplianceContractTemplateRead,
|
|
4957
|
+
ScopeComplianceContractTemplateWrite
|
|
4845
4958
|
];
|
|
4846
4959
|
}
|
|
4847
4960
|
|
|
@@ -5063,6 +5176,21 @@ var ComplianceClient = class {
|
|
|
5063
5176
|
signal
|
|
5064
5177
|
);
|
|
5065
5178
|
}
|
|
5179
|
+
/**
|
|
5180
|
+
* 读 — 证据资产分页列表(compliance gateway S1)。
|
|
5181
|
+
*
|
|
5182
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。返回 yudao `PageResult<T>`
|
|
5183
|
+
* (`{ total, list }`)。所有过滤项可选;`createTimeStart` / `createTimeEnd`
|
|
5184
|
+
* 由调用方按 `yyyy-MM-dd HH:mm:ss` 提供,SDK 原样透传。
|
|
5185
|
+
*/
|
|
5186
|
+
listEvidenceAssets(req = {}, signal) {
|
|
5187
|
+
return this.read(
|
|
5188
|
+
"GET",
|
|
5189
|
+
`/compliance/evidence/assets/page${pageQuery(req, ["assetType", "status", "createTimeStart", "createTimeEnd"])}`,
|
|
5190
|
+
null,
|
|
5191
|
+
signal
|
|
5192
|
+
);
|
|
5193
|
+
}
|
|
5066
5194
|
/**
|
|
5067
5195
|
* 公开 verify。隐私边界:返回字段不含 PII / 合同原文 / storage / provider raw。
|
|
5068
5196
|
*
|
|
@@ -5107,6 +5235,20 @@ var ComplianceClient = class {
|
|
|
5107
5235
|
signal
|
|
5108
5236
|
);
|
|
5109
5237
|
}
|
|
5238
|
+
/**
|
|
5239
|
+
* 读 — 时间章分页列表(compliance gateway S1)。
|
|
5240
|
+
*
|
|
5241
|
+
* 走 GET 读路径。返回 yudao `PageResult<T>`。所有过滤项可选;`createTimeStart` /
|
|
5242
|
+
* `createTimeEnd` 由调用方按 `yyyy-MM-dd HH:mm:ss` 提供,SDK 原样透传。
|
|
5243
|
+
*/
|
|
5244
|
+
listTimestamps(req = {}, signal) {
|
|
5245
|
+
return this.read(
|
|
5246
|
+
"GET",
|
|
5247
|
+
`/compliance/timestamps/page${pageQuery(req, ["provider", "verificationStatus", "createTimeStart", "createTimeEnd"])}`,
|
|
5248
|
+
null,
|
|
5249
|
+
signal
|
|
5250
|
+
);
|
|
5251
|
+
}
|
|
5110
5252
|
/** verify — 本地离线校验已申请的时间章。 */
|
|
5111
5253
|
verifyTimestamp(req, opts = {}) {
|
|
5112
5254
|
return this.write(
|
|
@@ -5131,6 +5273,38 @@ var ComplianceClient = class {
|
|
|
5131
5273
|
);
|
|
5132
5274
|
}
|
|
5133
5275
|
// =========================================================================
|
|
5276
|
+
// TSA readonly views (read-only — compliance gateway S3 / gap-register U-7)
|
|
5277
|
+
// =========================================================================
|
|
5278
|
+
/**
|
|
5279
|
+
* 读 — 时间章授权机构(TSA)provider 列表(compliance gateway S3)。
|
|
5280
|
+
*
|
|
5281
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。后端 G3 为每个 TSA provider 返回
|
|
5282
|
+
* 一条 {@link TsaProvider}:名称、所处环境、当前是否可用。只读视图,不含
|
|
5283
|
+
* provider 端点 / 凭证 / 证书等内部接入材料。
|
|
5284
|
+
*/
|
|
5285
|
+
listTsaProviders(signal) {
|
|
5286
|
+
return this.read(
|
|
5287
|
+
"GET",
|
|
5288
|
+
"/compliance/timestamps/providers",
|
|
5289
|
+
null,
|
|
5290
|
+
signal
|
|
5291
|
+
);
|
|
5292
|
+
}
|
|
5293
|
+
/**
|
|
5294
|
+
* 读 — 时间章统计视图(compliance gateway S3)。
|
|
5295
|
+
*
|
|
5296
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。返回 {@link TsaStats}:时间章总数
|
|
5297
|
+
* + 按校验状态分桶的计数。只读聚合视图。
|
|
5298
|
+
*/
|
|
5299
|
+
getTsaStats(signal) {
|
|
5300
|
+
return this.read(
|
|
5301
|
+
"GET",
|
|
5302
|
+
"/compliance/timestamps/stats",
|
|
5303
|
+
null,
|
|
5304
|
+
signal
|
|
5305
|
+
);
|
|
5306
|
+
}
|
|
5307
|
+
// =========================================================================
|
|
5134
5308
|
// Evidence Package
|
|
5135
5309
|
// =========================================================================
|
|
5136
5310
|
/** 构建证据包(写)。 */
|
|
@@ -5143,6 +5317,20 @@ var ComplianceClient = class {
|
|
|
5143
5317
|
writeCtx(opts)
|
|
5144
5318
|
);
|
|
5145
5319
|
}
|
|
5320
|
+
/**
|
|
5321
|
+
* 读 — 证据包分页列表(compliance gateway S1)。
|
|
5322
|
+
*
|
|
5323
|
+
* 走 GET 读路径。返回 yudao `PageResult<T>`。所有过滤项可选;`createTimeStart` /
|
|
5324
|
+
* `createTimeEnd` 由调用方按 `yyyy-MM-dd HH:mm:ss` 提供,SDK 原样透传。
|
|
5325
|
+
*/
|
|
5326
|
+
listEvidencePackages(req = {}, signal) {
|
|
5327
|
+
return this.read(
|
|
5328
|
+
"GET",
|
|
5329
|
+
`/compliance/evidence/packages/page${pageQuery(req, ["status", "createTimeStart", "createTimeEnd"])}`,
|
|
5330
|
+
null,
|
|
5331
|
+
signal
|
|
5332
|
+
);
|
|
5333
|
+
}
|
|
5146
5334
|
// =========================================================================
|
|
5147
5335
|
// Report
|
|
5148
5336
|
// =========================================================================
|
|
@@ -5159,6 +5347,20 @@ var ComplianceClient = class {
|
|
|
5159
5347
|
signal
|
|
5160
5348
|
);
|
|
5161
5349
|
}
|
|
5350
|
+
/**
|
|
5351
|
+
* 读 — 证据报告分页列表(compliance gateway S1)。
|
|
5352
|
+
*
|
|
5353
|
+
* 走 GET 读路径。返回 yudao `PageResult<T>`。所有过滤项可选;`createTimeStart` /
|
|
5354
|
+
* `createTimeEnd` 由调用方按 `yyyy-MM-dd HH:mm:ss` 提供,SDK 原样透传。
|
|
5355
|
+
*/
|
|
5356
|
+
listReports(req = {}, signal) {
|
|
5357
|
+
return this.read(
|
|
5358
|
+
"GET",
|
|
5359
|
+
`/compliance/reports/page${pageQuery(req, ["status", "createTimeStart", "createTimeEnd"])}`,
|
|
5360
|
+
null,
|
|
5361
|
+
signal
|
|
5362
|
+
);
|
|
5363
|
+
}
|
|
5162
5364
|
/**
|
|
5163
5365
|
* 发布报告(写,step-up 必须)。
|
|
5164
5366
|
*
|
|
@@ -5209,6 +5411,20 @@ var ComplianceClient = class {
|
|
|
5209
5411
|
signal
|
|
5210
5412
|
);
|
|
5211
5413
|
}
|
|
5414
|
+
/**
|
|
5415
|
+
* 读 — 签署 envelope 分页列表(compliance gateway S1)。
|
|
5416
|
+
*
|
|
5417
|
+
* 走 GET 读路径。返回 yudao `PageResult<T>`。所有过滤项可选;`createTimeStart` /
|
|
5418
|
+
* `createTimeEnd` 由调用方按 `yyyy-MM-dd HH:mm:ss` 提供,SDK 原样透传。
|
|
5419
|
+
*/
|
|
5420
|
+
listSigningEnvelopes(req = {}, signal) {
|
|
5421
|
+
return this.read(
|
|
5422
|
+
"GET",
|
|
5423
|
+
`/compliance/signing-envelopes/page${pageQuery(req, ["status", "createTimeStart", "createTimeEnd"])}`,
|
|
5424
|
+
null,
|
|
5425
|
+
signal
|
|
5426
|
+
);
|
|
5427
|
+
}
|
|
5212
5428
|
/**
|
|
5213
5429
|
* 正式签署(写,step-up 必须)。
|
|
5214
5430
|
*
|
|
@@ -5245,6 +5461,52 @@ var ComplianceClient = class {
|
|
|
5245
5461
|
writeCtx(opts)
|
|
5246
5462
|
);
|
|
5247
5463
|
}
|
|
5464
|
+
/**
|
|
5465
|
+
* 读 — envelope 下挂的合同列表(compliance gateway S4)。
|
|
5466
|
+
*
|
|
5467
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。后端 G4 为每份挂在该 envelope 上的
|
|
5468
|
+
* 合同返回一条 {@link EnvelopeContractItem}:编号 / 标题 / MIME / 大小 / 哈希
|
|
5469
|
+
* 指纹 / 状态。返回普通数组(非 `PageResult`)。SDK-safe 视图——不含合同原文 /
|
|
5470
|
+
* storage key / provider raw payload。
|
|
5471
|
+
*/
|
|
5472
|
+
listEnvelopeContracts(envelopeId, signal) {
|
|
5473
|
+
return this.read(
|
|
5474
|
+
"GET",
|
|
5475
|
+
`/compliance/signing-envelopes/${encodeURIComponent(envelopeId)}/contracts`,
|
|
5476
|
+
null,
|
|
5477
|
+
signal
|
|
5478
|
+
);
|
|
5479
|
+
}
|
|
5480
|
+
/**
|
|
5481
|
+
* 读 — envelope 关联的 provider 请求列表(compliance gateway S4)。
|
|
5482
|
+
*
|
|
5483
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。后端 G4 复用操作投影
|
|
5484
|
+
* {@link OperationPageItem}:描述每次 provider 请求本身的执行进度,与 envelope
|
|
5485
|
+
* 领域状态正交。返回普通数组(非 `PageResult`)。
|
|
5486
|
+
*/
|
|
5487
|
+
listEnvelopeProviderRequests(envelopeId, signal) {
|
|
5488
|
+
return this.read(
|
|
5489
|
+
"GET",
|
|
5490
|
+
`/compliance/signing-envelopes/${encodeURIComponent(envelopeId)}/provider-requests`,
|
|
5491
|
+
null,
|
|
5492
|
+
signal
|
|
5493
|
+
);
|
|
5494
|
+
}
|
|
5495
|
+
/**
|
|
5496
|
+
* 作废 envelope(写,compliance gateway S4)。
|
|
5497
|
+
*
|
|
5498
|
+
* 走 compliance 写路径——发送前 `ensureToken` 一次、不自动重试、`401` 不刷新
|
|
5499
|
+
* 重放;支持 `Idempotency-Key` header(强烈建议调用方持久化幂等键,重试 / 恢复
|
|
5500
|
+
* 时复用,避免重复作废)。`req.reason` 为必填的作废原因,随 JSON body 提交。
|
|
5501
|
+
*/
|
|
5502
|
+
voidEnvelope(envelopeId, req, opts = {}) {
|
|
5503
|
+
return this.write(
|
|
5504
|
+
"POST",
|
|
5505
|
+
`/compliance/signing-envelopes/${encodeURIComponent(envelopeId)}/void`,
|
|
5506
|
+
req,
|
|
5507
|
+
writeCtx(opts)
|
|
5508
|
+
);
|
|
5509
|
+
}
|
|
5248
5510
|
// =========================================================================
|
|
5249
5511
|
// Seal Approval
|
|
5250
5512
|
// =========================================================================
|
|
@@ -5319,6 +5581,45 @@ var ComplianceClient = class {
|
|
|
5319
5581
|
signal
|
|
5320
5582
|
);
|
|
5321
5583
|
}
|
|
5584
|
+
/**
|
|
5585
|
+
* 读 — 用印审批分页列表(compliance gateway S1)。
|
|
5586
|
+
*
|
|
5587
|
+
* 与 {@link listPendingSealApprovals}(仅 pending、不分页)不同,本方法支持分页与
|
|
5588
|
+
* 状态 / 时间过滤。走 GET 读路径。返回 yudao `PageResult<T>`。所有过滤项可选;
|
|
5589
|
+
* `createTimeStart` / `createTimeEnd` 由调用方按 `yyyy-MM-dd HH:mm:ss` 提供,
|
|
5590
|
+
* SDK 原样透传。
|
|
5591
|
+
*/
|
|
5592
|
+
listSealApprovals(req = {}, signal) {
|
|
5593
|
+
return this.read(
|
|
5594
|
+
"GET",
|
|
5595
|
+
`/compliance/seal-approvals/page${pageQuery(req, ["status", "createTimeStart", "createTimeEnd"])}`,
|
|
5596
|
+
null,
|
|
5597
|
+
signal
|
|
5598
|
+
);
|
|
5599
|
+
}
|
|
5600
|
+
// =========================================================================
|
|
5601
|
+
// Seal Use (read-only — compliance gateway S6 / gap-register U-4)
|
|
5602
|
+
// =========================================================================
|
|
5603
|
+
/**
|
|
5604
|
+
* 读 — 用印执行记录分页列表(compliance gateway S6)。
|
|
5605
|
+
*
|
|
5606
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。返回 yudao `PageResult<T>`
|
|
5607
|
+
* (`{ total, list }`)。一次用印执行(seal use)描述 envelope / contract /
|
|
5608
|
+
* seal / 审批联动后【真正调用 provider 落章】的那一笔记录,与 envelope
|
|
5609
|
+
* 领域状态正交。所有过滤项可选;`createTimeStart` / `createTimeEnd` 由调用方
|
|
5610
|
+
* 按 `yyyy-MM-dd HH:mm:ss` 提供,SDK 原样透传。
|
|
5611
|
+
*
|
|
5612
|
+
* 与后端复用同一只读 scope `CONTRACT_SIGNING_READ`
|
|
5613
|
+
*({@link ScopeComplianceContractSigningRead})——不引入新 scope。
|
|
5614
|
+
*/
|
|
5615
|
+
listSealUses(req = {}, signal) {
|
|
5616
|
+
return this.read(
|
|
5617
|
+
"GET",
|
|
5618
|
+
`/compliance/seal-uses/page${pageQuery(req, ["sealId", "envelopeId", "usageStatus", "createTimeStart", "createTimeEnd"])}`,
|
|
5619
|
+
null,
|
|
5620
|
+
signal
|
|
5621
|
+
);
|
|
5622
|
+
}
|
|
5322
5623
|
// =========================================================================
|
|
5323
5624
|
// Provider Request (read-only)
|
|
5324
5625
|
// =========================================================================
|
|
@@ -5346,6 +5647,206 @@ var ComplianceClient = class {
|
|
|
5346
5647
|
);
|
|
5347
5648
|
}
|
|
5348
5649
|
// =========================================================================
|
|
5650
|
+
// Capabilities (read-only — compliance gateway S2 / gap-register U-6)
|
|
5651
|
+
// =========================================================================
|
|
5652
|
+
/**
|
|
5653
|
+
* 读 — compliance 能力闸门列表(compliance gateway S2)。
|
|
5654
|
+
*
|
|
5655
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。后端 G2 为每个高风险 / 收费动作
|
|
5656
|
+
* (`signEnvelope` / `createH5SigningUrl` / `publishReport` /
|
|
5657
|
+
* `approveSealApproval` / `executeSealUse` / `createSeal`)返回一条
|
|
5658
|
+
* {@link ComplianceCapability}:是否可执行、所处状态、所需 scope / step-up。
|
|
5659
|
+
*
|
|
5660
|
+
* 调用方在高风险动作执行【前】查询本结果做门控;拿不到能力时必须 fail-closed
|
|
5661
|
+
*(按 `executable=false` 处理)。
|
|
5662
|
+
*/
|
|
5663
|
+
getCapabilities(signal) {
|
|
5664
|
+
return this.read(
|
|
5665
|
+
"GET",
|
|
5666
|
+
"/compliance/capabilities",
|
|
5667
|
+
null,
|
|
5668
|
+
signal
|
|
5669
|
+
);
|
|
5670
|
+
}
|
|
5671
|
+
/**
|
|
5672
|
+
* 读 — 单个动作的能力闸门视图(便捷方法)。
|
|
5673
|
+
*
|
|
5674
|
+
* 拉取完整 {@link getCapabilities} 列表并返回 `action` 匹配的那一条,无匹配时
|
|
5675
|
+
* 返回 `undefined`。**每次调用产生一次网络请求**——需要门控多个动作时应改用
|
|
5676
|
+
* {@link getCapabilities} 一次性取回再本地查表,避免重复请求。
|
|
5677
|
+
*
|
|
5678
|
+
* 与 {@link getCapabilities} 一致走 GET 读路径(允许 401 单次刷新重放)。
|
|
5679
|
+
*/
|
|
5680
|
+
async getFeatureGate(action, signal) {
|
|
5681
|
+
const caps = await this.getCapabilities(signal);
|
|
5682
|
+
return caps.find((c) => c.action === action);
|
|
5683
|
+
}
|
|
5684
|
+
// =========================================================================
|
|
5685
|
+
// Operation projection (read-only — compliance gateway S2 / gap-register U-5)
|
|
5686
|
+
// =========================================================================
|
|
5687
|
+
/**
|
|
5688
|
+
* 读 — compliance 操作投影分页列表(compliance gateway S2)。
|
|
5689
|
+
*
|
|
5690
|
+
* 走 GET 读路径。返回 yudao `PageResult<T>`(`{ total, list }`)。所有过滤项
|
|
5691
|
+
* 可选;`createTimeStart` / `createTimeEnd` 由调用方按 `yyyy-MM-dd HH:mm:ss`
|
|
5692
|
+
* 提供,SDK 原样透传,不做格式校验或时区转换。
|
|
5693
|
+
*
|
|
5694
|
+
* 操作投影描述【一次操作】本身的执行进度,与履约对象的领域状态正交。
|
|
5695
|
+
*/
|
|
5696
|
+
listOperations(req = {}, signal) {
|
|
5697
|
+
return this.read(
|
|
5698
|
+
"GET",
|
|
5699
|
+
`/compliance/operations/page${pageQuery(req, ["status", "createTimeStart", "createTimeEnd"])}`,
|
|
5700
|
+
null,
|
|
5701
|
+
signal
|
|
5702
|
+
);
|
|
5703
|
+
}
|
|
5704
|
+
/**
|
|
5705
|
+
* 读 — compliance 操作投影详情(compliance gateway S2)。
|
|
5706
|
+
*
|
|
5707
|
+
* `id` 为数值行主键(非 `operationId` 幂等键)。走 GET 读路径(允许 401 单次
|
|
5708
|
+
* 刷新重放)。
|
|
5709
|
+
*/
|
|
5710
|
+
getOperation(id, signal) {
|
|
5711
|
+
return this.read(
|
|
5712
|
+
"GET",
|
|
5713
|
+
`/compliance/operations/${encodeURIComponent(id)}`,
|
|
5714
|
+
null,
|
|
5715
|
+
signal
|
|
5716
|
+
);
|
|
5717
|
+
}
|
|
5718
|
+
// =========================================================================
|
|
5719
|
+
// Contract Template (compliance gateway S5 — gap-register U-2)
|
|
5720
|
+
// =========================================================================
|
|
5721
|
+
/**
|
|
5722
|
+
* 创建合同模板(写)。
|
|
5723
|
+
*
|
|
5724
|
+
* 走 compliance 写路径——发送前 `ensureToken` 一次、不自动重试、`401` 不刷新
|
|
5725
|
+
* 重放;支持 `Idempotency-Key` header(强烈建议调用方持久化幂等键,重试 / 恢复
|
|
5726
|
+
* 时复用,避免重复创建模板)。模板创建后初始状态为 `DRAFT`。
|
|
5727
|
+
*/
|
|
5728
|
+
createContractTemplate(req, opts = {}) {
|
|
5729
|
+
return this.write(
|
|
5730
|
+
"POST",
|
|
5731
|
+
"/compliance/contract-templates",
|
|
5732
|
+
req,
|
|
5733
|
+
writeCtx(opts)
|
|
5734
|
+
);
|
|
5735
|
+
}
|
|
5736
|
+
/**
|
|
5737
|
+
* 更新合同模板(写,仅 DRAFT 状态)。
|
|
5738
|
+
*
|
|
5739
|
+
* 走 compliance 写路径——`Idempotency-Key`、不重试、`401` 不刷新重放。所有字段
|
|
5740
|
+
* 可选,缺省字段视为不修改。服务端在 PUBLISHED / ARCHIVED 状态下会拒绝更新。
|
|
5741
|
+
*/
|
|
5742
|
+
updateContractTemplate(id, req, opts = {}) {
|
|
5743
|
+
return this.write(
|
|
5744
|
+
"POST",
|
|
5745
|
+
`/compliance/contract-templates/${encodeURIComponent(id)}`,
|
|
5746
|
+
req,
|
|
5747
|
+
writeCtx(opts)
|
|
5748
|
+
);
|
|
5749
|
+
}
|
|
5750
|
+
/**
|
|
5751
|
+
* 删除合同模板(写,仅 DRAFT 状态)。
|
|
5752
|
+
*
|
|
5753
|
+
* 走 compliance 写路径——`Idempotency-Key`、不重试、`401` 不刷新重放。服务端
|
|
5754
|
+
* 在 PUBLISHED / ARCHIVED 状态下会拒绝删除——已发布的模板应改走 `archive`。
|
|
5755
|
+
*/
|
|
5756
|
+
deleteContractTemplate(id, opts = {}) {
|
|
5757
|
+
return this.write(
|
|
5758
|
+
"POST",
|
|
5759
|
+
`/compliance/contract-templates/${encodeURIComponent(id)}/delete`,
|
|
5760
|
+
null,
|
|
5761
|
+
writeCtx(opts)
|
|
5762
|
+
);
|
|
5763
|
+
}
|
|
5764
|
+
/** 读 — 合同模板详情。 */
|
|
5765
|
+
getContractTemplate(id, signal) {
|
|
5766
|
+
return this.read(
|
|
5767
|
+
"GET",
|
|
5768
|
+
`/compliance/contract-templates/${encodeURIComponent(id)}`,
|
|
5769
|
+
null,
|
|
5770
|
+
signal
|
|
5771
|
+
);
|
|
5772
|
+
}
|
|
5773
|
+
/**
|
|
5774
|
+
* 读 — 合同模板分页列表(compliance gateway S5)。
|
|
5775
|
+
*
|
|
5776
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。返回 yudao `PageResult<T>`
|
|
5777
|
+
* (`{ total, list }`)。所有过滤项可选;`createTimeStart` / `createTimeEnd`
|
|
5778
|
+
* 由调用方按 `yyyy-MM-dd HH:mm:ss` 提供,SDK 原样透传。列表项视图
|
|
5779
|
+
* {@link ContractTemplatePageItem} 不含 `fields`——字段叠加只在详情 / 版本
|
|
5780
|
+
* 快照里返回。
|
|
5781
|
+
*/
|
|
5782
|
+
listContractTemplates(req = {}, signal) {
|
|
5783
|
+
return this.read(
|
|
5784
|
+
"GET",
|
|
5785
|
+
`/compliance/contract-templates/page${pageQuery(req, ["status", "createTimeStart", "createTimeEnd"])}`,
|
|
5786
|
+
null,
|
|
5787
|
+
signal
|
|
5788
|
+
);
|
|
5789
|
+
}
|
|
5790
|
+
/**
|
|
5791
|
+
* 上传合同模板 PDF(写)。
|
|
5792
|
+
*
|
|
5793
|
+
* 走 compliance 写路径——`Idempotency-Key`、不重试、`401` 不刷新重放。请求体
|
|
5794
|
+
* 为 `{ pdfBase64 }`;SDK 不在客户端做 PDF 解析 / 几何校验,原样透传给后端。
|
|
5795
|
+
* 返回上传后的最新模板视图(含 `pdfHash` / `pdfPageCount`)。
|
|
5796
|
+
*/
|
|
5797
|
+
uploadContractTemplatePdf(id, req, opts = {}) {
|
|
5798
|
+
return this.write(
|
|
5799
|
+
"POST",
|
|
5800
|
+
`/compliance/contract-templates/${encodeURIComponent(id)}/pdf`,
|
|
5801
|
+
req,
|
|
5802
|
+
writeCtx(opts)
|
|
5803
|
+
);
|
|
5804
|
+
}
|
|
5805
|
+
/**
|
|
5806
|
+
* 发布合同模板(写)。DRAFT → PUBLISHED,落版本快照。
|
|
5807
|
+
*
|
|
5808
|
+
* 走 compliance 写路径——`Idempotency-Key`、不重试、`401` 不刷新重放。
|
|
5809
|
+
* publish 后 `currentVersion` 递增,`fields` 与 `pdfHash` 同步固化进版本表。
|
|
5810
|
+
*/
|
|
5811
|
+
publishContractTemplate(id, opts = {}) {
|
|
5812
|
+
return this.write(
|
|
5813
|
+
"POST",
|
|
5814
|
+
`/compliance/contract-templates/${encodeURIComponent(id)}/publish`,
|
|
5815
|
+
null,
|
|
5816
|
+
writeCtx(opts)
|
|
5817
|
+
);
|
|
5818
|
+
}
|
|
5819
|
+
/**
|
|
5820
|
+
* 归档合同模板(写)。PUBLISHED → ARCHIVED。
|
|
5821
|
+
*
|
|
5822
|
+
* 走 compliance 写路径——`Idempotency-Key`、不重试、`401` 不刷新重放。
|
|
5823
|
+
* 已归档模板只读,不再允许 publish / 编辑 / 删除。
|
|
5824
|
+
*/
|
|
5825
|
+
archiveContractTemplate(id, opts = {}) {
|
|
5826
|
+
return this.write(
|
|
5827
|
+
"POST",
|
|
5828
|
+
`/compliance/contract-templates/${encodeURIComponent(id)}/archive`,
|
|
5829
|
+
null,
|
|
5830
|
+
writeCtx(opts)
|
|
5831
|
+
);
|
|
5832
|
+
}
|
|
5833
|
+
/**
|
|
5834
|
+
* 读 — 合同模板版本快照列表。
|
|
5835
|
+
*
|
|
5836
|
+
* 走 GET 读路径(允许 401 单次刷新重放)。返回 {@link ContractTemplateVersion}
|
|
5837
|
+
* 普通数组(非 `PageResult`)——每次 publish 落一个不可变快照,记录当时的
|
|
5838
|
+
* `name` / `pdfHash` / `fields` / `statusAtSnapshot`,是离线复核 / 版本对账
|
|
5839
|
+
* 的依据。
|
|
5840
|
+
*/
|
|
5841
|
+
listContractTemplateVersions(id, signal) {
|
|
5842
|
+
return this.read(
|
|
5843
|
+
"GET",
|
|
5844
|
+
`/compliance/contract-templates/${encodeURIComponent(id)}/versions`,
|
|
5845
|
+
null,
|
|
5846
|
+
signal
|
|
5847
|
+
);
|
|
5848
|
+
}
|
|
5849
|
+
// =========================================================================
|
|
5349
5850
|
// Error classification (re-export for convenience)
|
|
5350
5851
|
// =========================================================================
|
|
5351
5852
|
classifyError(err) {
|
|
@@ -5504,6 +6005,24 @@ function classifyProviderStatus(status) {
|
|
|
5504
6005
|
return "continue";
|
|
5505
6006
|
}
|
|
5506
6007
|
}
|
|
6008
|
+
function pageQuery(req, filterKeys) {
|
|
6009
|
+
const q = new URLSearchParams();
|
|
6010
|
+
const append = (key, value) => {
|
|
6011
|
+
if (value == null) return;
|
|
6012
|
+
const s = typeof value === "string" ? value : String(value);
|
|
6013
|
+
if (s === "") return;
|
|
6014
|
+
q.set(key, s);
|
|
6015
|
+
};
|
|
6016
|
+
append("pageNo", req.pageNo);
|
|
6017
|
+
append("pageSize", req.pageSize);
|
|
6018
|
+
append("sortBy", req.sortBy);
|
|
6019
|
+
append("sortDirection", req.sortDirection);
|
|
6020
|
+
for (const key of filterKeys) {
|
|
6021
|
+
append(String(key), req[key]);
|
|
6022
|
+
}
|
|
6023
|
+
const qs = q.toString();
|
|
6024
|
+
return qs ? "?" + qs : "";
|
|
6025
|
+
}
|
|
5507
6026
|
function writeCtx(opts, extraHeaders = {}) {
|
|
5508
6027
|
return {
|
|
5509
6028
|
idempotencyKey: opts.idempotencyKey,
|
|
@@ -5567,6 +6086,6 @@ Client.prototype.getBugReport = async function(bugID, signal) {
|
|
|
5567
6086
|
return resp.data;
|
|
5568
6087
|
};
|
|
5569
6088
|
|
|
5570
|
-
export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, 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, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OpenAIAdapter, OrderTerminalError, ProviderFormat, RateLimitError, ScopeAI, ScopeAccount, ScopeComplianceContractSigningRead, ScopeComplianceContractSigningWrite, 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, complianceScopes, computeBackoff, createWebAuthorizationRequest, defaultRetryable, defaultSafeToRetry, discover, discoverWebOAuthMetadata, discoverWithProfile, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, generateState, getAdapter, getAdapterForModel, isBillingConfirmable, isComplianceBusinessError, isComplianceTerminalError, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, parseNotificationEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge };
|
|
6089
|
+
export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, ComplianceClient, CompliancePollError, 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, ProviderFormat, RETRY_ADVICE_REASONS, RateLimitError, 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, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, parseNotificationEvent, parseSettlement, parseSourcesEvent, refreshToken, register, registerWebOAuthClient, retryReasonForComplianceKey, retryReasonForOAuthError, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge };
|
|
5571
6090
|
//# sourceMappingURL=index.mjs.map
|
|
5572
6091
|
//# sourceMappingURL=index.mjs.map
|