@youzan-cloud/zan-saas-cli 0.1.0-beta.4 → 0.1.0-beta.8

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.
Files changed (66) hide show
  1. package/bin/zan-saas-cli.js +8 -11
  2. package/internal/registry/manifest.json +25 -20
  3. package/npm-shrinkwrap.json +2 -2
  4. package/package.json +1 -1
  5. package/skills/zan-saas/SKILL.md +3 -3
  6. package/skills/zan-saas/references/host-entry.md +8 -0
  7. package/skills/zan-saas-order/SKILL.md +12 -1
  8. package/skills/zan-saas-order/references/branch-counts.md +45 -0
  9. package/skills/zan-saas-order/references/order-get.md +2 -0
  10. package/skills/zan-saas-order/references/order-list.md +2 -0
  11. package/skills/zan-saas-order/references/order-scan.md +2 -0
  12. package/skills/zan-saas-org/SKILL.md +6 -0
  13. package/skills/zan-saas-org/references/unit-list.md +2 -0
  14. package/skills/zan-saas-shared/SKILL.md +20 -5
  15. package/skills/zan-saas-shared/references/authentication.md +9 -4
  16. package/skills/zan-saas-shared/references/gateway-errors.md +29 -0
  17. package/skills/zan-saas-shared/references/shop-context.md +39 -0
  18. package/skills/zan-saas-valuecard/SKILL.md +8 -2
  19. package/skills/zan-saas-valuecard/references/transaction-list.md +25 -0
  20. package/skills/zan-saas-valuecard/references/transaction-scan.md +23 -0
  21. package/src/auth/credential-source.js +26 -0
  22. package/src/auth/credential-store.js +61 -5
  23. package/src/auth/session.js +80 -27
  24. package/src/cli/command-paths.js +3 -2
  25. package/src/cli/context-help.js +3 -1
  26. package/src/cli/program.js +20 -4
  27. package/src/commands/native/access/commands.index.json +1 -1
  28. package/src/commands/native/access/role/list/command.js +4 -32
  29. package/src/commands/native/customer/commands.index.json +1 -1
  30. package/src/commands/native/customer/customer-tag/list/command.js +2 -2
  31. package/src/commands/native/member/commands.index.json +1 -1
  32. package/src/commands/native/order/commands.index.json +3 -3
  33. package/src/commands/native/order/order/get/command.js +14 -9
  34. package/src/commands/native/order/order/get/schema.json +197 -41
  35. package/src/commands/native/order/order/list/command.js +9 -6
  36. package/src/commands/native/order/order/list/schema.json +140 -10
  37. package/src/commands/native/order/order/scan/command.js +8 -5
  38. package/src/commands/native/order/order/scan/scan.js +1 -1
  39. package/src/commands/native/order/order/scan/schema.json +135 -8
  40. package/src/commands/native/order/shared/query.js +57 -9
  41. package/src/commands/native/order/shared/search.js +1 -1
  42. package/src/commands/native/org/commands.index.json +4 -4
  43. package/src/commands/native/valuecard/commands.index.json +20 -2
  44. package/src/commands/native/valuecard/domain.json +1 -1
  45. package/src/commands/native/valuecard/transaction/list/command.js +110 -0
  46. package/src/commands/native/valuecard/transaction/list/projection.js +71 -0
  47. package/src/commands/native/valuecard/transaction/list/schema.json +888 -0
  48. package/src/commands/native/valuecard/transaction/scan/command.js +130 -0
  49. package/src/commands/native/valuecard/transaction/scan/projection.js +58 -0
  50. package/src/commands/native/valuecard/transaction/scan/scan.js +70 -0
  51. package/src/commands/native/valuecard/transaction/scan/schema.json +954 -0
  52. package/src/commands/system/api.js +1 -1
  53. package/src/commands/system/auth.js +13 -2
  54. package/src/commands/system/contracts.js +27 -19
  55. package/src/commands/system/shop-contracts.js +97 -0
  56. package/src/commands/system/shop.js +128 -27
  57. package/src/execution/error-details.js +13 -18
  58. package/src/execution/gateway-guidance.js +43 -0
  59. package/src/execution/shop-query.js +6 -3
  60. package/src/identity/context-store.js +14 -10
  61. package/src/identity/file-store.js +147 -0
  62. package/src/identity/session-store.js +261 -0
  63. package/src/identity/shop-location.js +158 -0
  64. package/src/identity/unit-membership.js +42 -0
  65. package/src/transport/api.js +78 -11
  66. package/src/transport/shop-app.js +8 -1
@@ -0,0 +1,954 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "input": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "kdtId",
8
+ "bizType",
9
+ "occurredAt",
10
+ "filters",
11
+ "pageNo",
12
+ "pageSize",
13
+ "format",
14
+ "dryRun"
15
+ ],
16
+ "properties": {
17
+ "kdtId": {
18
+ "$ref": "#/definitions/shopId"
19
+ },
20
+ "bizType": {
21
+ "$ref": "#/definitions/bizType"
22
+ },
23
+ "occurredAt": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": [
27
+ "start",
28
+ "end"
29
+ ],
30
+ "properties": {
31
+ "start": {
32
+ "$ref": "#/definitions/time"
33
+ },
34
+ "end": {
35
+ "$ref": "#/definitions/time"
36
+ }
37
+ },
38
+ "description": "显式业务时间范围,开始严格早于结束,零毫秒规范化为三位,不支持非零毫秒。"
39
+ },
40
+ "filters": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": [],
44
+ "properties": {
45
+ "mobile": {
46
+ "type": "string",
47
+ "pattern": "^\\+?[0-9]{5,20}$",
48
+ "description": "流水中的完整手机号,可选 + 和 5..20 位数字,保留前导零及国家码;不等于 yzOpenId。"
49
+ },
50
+ "billCardNo": {
51
+ "$ref": "#/definitions/identifier",
52
+ "description": "流水记载卡号,不等于 card.cardNo。"
53
+ },
54
+ "transactionNo": {
55
+ "$ref": "#/definitions/identifier",
56
+ "description": "储值业务流水号,不承诺全局唯一。"
57
+ },
58
+ "tradeNo": {
59
+ "$ref": "#/definitions/identifier",
60
+ "description": "有赞交易单号,不是外部支付请求号,不限定 E 前缀。"
61
+ }
62
+ },
63
+ "description": "至少一个精确匹配条件,多条件为 AND,仅匹配流水原始字符串,不推断历史身份。",
64
+ "minProperties": 1
65
+ },
66
+ "pageNo": {
67
+ "$ref": "#/definitions/pageNo"
68
+ },
69
+ "pageSize": {
70
+ "$ref": "#/definitions/pageSize"
71
+ },
72
+ "format": {
73
+ "type": "string",
74
+ "enum": [
75
+ "json",
76
+ "pretty"
77
+ ],
78
+ "description": "只改变 JSON 缩进。"
79
+ },
80
+ "dryRun": {
81
+ "type": "boolean",
82
+ "description": "本地脱敏预览,不读取凭证或联网。"
83
+ }
84
+ },
85
+ "description": "CLI 解析及上下文补全后的规范化业务输入,不是 argv 或服务端请求体;固定内部预算不属于 input。"
86
+ },
87
+ "output": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": [
91
+ "data"
92
+ ],
93
+ "properties": {
94
+ "data": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": [
98
+ "transactions",
99
+ "pagination"
100
+ ],
101
+ "properties": {
102
+ "transactions": {
103
+ "type": "array",
104
+ "maxItems": 200,
105
+ "items": {
106
+ "type": "object",
107
+ "additionalProperties": false,
108
+ "required": [
109
+ "transactionNo",
110
+ "billCardNo",
111
+ "occurredAt",
112
+ "bizType",
113
+ "validity",
114
+ "amount",
115
+ "reportedBalance"
116
+ ],
117
+ "properties": {
118
+ "transactionNo": {
119
+ "type": "string",
120
+ "minLength": 1,
121
+ "description": "原始储值流水号,保留前导零,不承诺全局唯一。"
122
+ },
123
+ "billCardNo": {
124
+ "type": "string",
125
+ "minLength": 1,
126
+ "description": "流水记录卡号,不自动关联到当前系统资产卡号。"
127
+ },
128
+ "occurredAt": {
129
+ "$ref": "#/definitions/time",
130
+ "description": "流水业务时间,北京时间固定毫秒文本。"
131
+ },
132
+ "bizType": {
133
+ "type": "string",
134
+ "minLength": 1,
135
+ "description": "保留原始非空字符串。已知代码 RECHARGE 充值、GROUP_GIVE_RECHARGE 赠送、REFUND 退款、RECHARGE_REFUND 充值退款、PAY 消费或支付、ADJUSTMENT 调账、CARD_BALANCE_IMPORT 导入、RECEDE_CARD 退卡、GIFT_CARD_ACTIVE 激活或礼品卡激活、RECHARGE_BONUS 充值赠送、REFUND_CLOSE_TRANSFER 退款销卡转出或转入、COMBINE 卡换绑转出或转入。也可能返回中文原值,未知非空字符串保留,不用请求类型覆盖。"
136
+ },
137
+ "validity": {
138
+ "type": "string",
139
+ "minLength": 1,
140
+ "description": "原始记录有效性,JSON string \"0\" 或 \"无效\" 为无效,\"1\" 或 \"有效\" 为有效;未知非空字符串保留,不自动转数字或推断处理状态。"
141
+ },
142
+ "amount": {
143
+ "type": "object",
144
+ "additionalProperties": false,
145
+ "required": [
146
+ "totalAmount",
147
+ "principalAmount",
148
+ "bonusAmount"
149
+ ],
150
+ "properties": {
151
+ "totalAmount": {
152
+ "$ref": "#/definitions/money",
153
+ "description": "本次业务总金额,CNY 元两位字符串,保留源符号。"
154
+ },
155
+ "principalAmount": {
156
+ "$ref": "#/definitions/money",
157
+ "description": "本次业务本金金额,CNY 元两位字符串。"
158
+ },
159
+ "bonusAmount": {
160
+ "$ref": "#/definitions/money",
161
+ "description": "本次业务赠送金金额,CNY 元两位字符串。"
162
+ }
163
+ },
164
+ "description": "本次业务金额,不等于统一余额增量,不依据业务类型改变符号,不强制分项加总。"
165
+ },
166
+ "reportedBalance": {
167
+ "type": "object",
168
+ "additionalProperties": false,
169
+ "required": [
170
+ "totalBalance",
171
+ "principalBalance",
172
+ "bonusBalance"
173
+ ],
174
+ "properties": {
175
+ "totalBalance": {
176
+ "$ref": "#/definitions/money",
177
+ "description": "附带总余额,CNY 元两位字符串。"
178
+ },
179
+ "principalBalance": {
180
+ "$ref": "#/definitions/money",
181
+ "description": "附带本金余额,CNY 元两位字符串。"
182
+ },
183
+ "bonusBalance": {
184
+ "$ref": "#/definitions/money",
185
+ "description": "附带赠送金余额,CNY 元两位字符串。"
186
+ }
187
+ },
188
+ "description": "记录附带的余额,时点未明确,不能推算交易前后余额;总额等于本金加赠送金。"
189
+ },
190
+ "kdtId": {
191
+ "type": "string",
192
+ "pattern": "^[1-9][0-9]*$",
193
+ "description": "可选记录所属店铺 ID,正安全整数精确转文本,不推断为受理店铺 ID。"
194
+ },
195
+ "mobile": {
196
+ "type": "string",
197
+ "description": "可选流水手机号,使用 mobile 筛选时必需且非空;不保证明文或稳定客户关联。"
198
+ },
199
+ "tradeNo": {
200
+ "type": "string",
201
+ "description": "可选有赞交易单号,使用 tradeNo 筛选时必需且非空;不限定 E 前缀。"
202
+ },
203
+ "externalRequestNo": {
204
+ "type": "string",
205
+ "description": "可选外部储值支付请求传入的 pay_request_no,不当成交易单号。"
206
+ },
207
+ "remark": {
208
+ "type": "string",
209
+ "description": "可选业务备注,原值保留。"
210
+ },
211
+ "externalRemark": {
212
+ "type": "string",
213
+ "description": "可选外部储值支付请求备注,原值保留。"
214
+ },
215
+ "nickname": {
216
+ "type": "string",
217
+ "description": "可选用户昵称,不用于身份关联。"
218
+ },
219
+ "acceptShopName": {
220
+ "type": "string",
221
+ "description": "可选受理店铺名称,不替代店铺或机构 ID。"
222
+ }
223
+ },
224
+ "description": "已经满足全部本地条件的单条流水;保留重复项、无效记录及未知字典值,不代表完整历史。"
225
+ },
226
+ "description": "本地 AND 精确匹配的完整记录,服务端取得顺序不变,无去重,不返回同页其它记录。"
227
+ },
228
+ "pagination": {
229
+ "type": "object",
230
+ "additionalProperties": false,
231
+ "required": [
232
+ "startPageNo",
233
+ "pageSize",
234
+ "scannedPages",
235
+ "scannedRecords",
236
+ "returned",
237
+ "requestCount",
238
+ "hasMore",
239
+ "nextPageNo",
240
+ "traversalCompleted",
241
+ "stopReason"
242
+ ],
243
+ "properties": {
244
+ "startPageNo": {
245
+ "$ref": "#/definitions/pageNo"
246
+ },
247
+ "pageSize": {
248
+ "$ref": "#/definitions/pageSize"
249
+ },
250
+ "scannedPages": {
251
+ "type": "integer",
252
+ "minimum": 0,
253
+ "maximum": 20,
254
+ "description": "本轮完整检查并接纳的页数。"
255
+ },
256
+ "scannedRecords": {
257
+ "type": "integer",
258
+ "minimum": 0,
259
+ "maximum": 1000,
260
+ "description": "本轮检查并接纳的原始流水条数,包含不匹配记录。"
261
+ },
262
+ "returned": {
263
+ "type": "integer",
264
+ "minimum": 0,
265
+ "maximum": 200,
266
+ "description": "transactions 长度,不超过固定 200 条。"
267
+ },
268
+ "requestCount": {
269
+ "type": "integer",
270
+ "minimum": 1,
271
+ "maximum": 21,
272
+ "description": "业务 API 请求次数,包括一次店铺绑定及未接纳的漂移页;不含认证准备。"
273
+ },
274
+ "hasMore": {
275
+ "type": [
276
+ "boolean",
277
+ "null"
278
+ ],
279
+ "description": "最后接纳页之后服务端原始查询是否有后页,不指还有匹配记录;未知或漂移为 null。"
280
+ },
281
+ "nextPageNo": {
282
+ "type": [
283
+ "integer",
284
+ "null"
285
+ ],
286
+ "minimum": 1,
287
+ "maximum": 5000,
288
+ "description": "未完成且窗口内可继续时的下一完整页;漂移指向未接纳页;耗尽、窗口满、总数未知为 null。"
289
+ },
290
+ "traversalCompleted": {
291
+ "type": "boolean",
292
+ "description": "仅表示指定起始页之后已走完本次可观察范围,不代表全历史、稳定身份或完整账本。"
293
+ },
294
+ "stopReason": {
295
+ "type": "string",
296
+ "enum": [
297
+ "pages_exhausted",
298
+ "max_items",
299
+ "max_requests",
300
+ "window_limit",
301
+ "total_unknown",
302
+ "inconsistent_page"
303
+ ],
304
+ "description": "pages_exhausted 可靠总数确认耗尽;max_items 200 条预算无法容纳最坏整页;max_requests 达 21 次;window_limit 达页容量乘积 5000;total_unknown 缺可靠总数;inconsistent_page 跨页总数漂移,未接纳该页。仅 pages_exhausted 表示完成。"
305
+ }
306
+ },
307
+ "description": "只描述本次起始页之后的观察,不提供匹配 total;筛选空集不代表无历史。"
308
+ }
309
+ },
310
+ "description": "有界精确匹配结果及扫描停止状态。"
311
+ }
312
+ },
313
+ "description": "成功时只返回 data,不回显筛选、时间或凭证。"
314
+ },
315
+ "preview": {
316
+ "type": "object",
317
+ "additionalProperties": false,
318
+ "required": [
319
+ "command",
320
+ "kind",
321
+ "risk",
322
+ "target",
323
+ "requests",
324
+ "localFilters",
325
+ "limits"
326
+ ],
327
+ "properties": {
328
+ "command": {
329
+ "const": "valuecard.transaction.scan",
330
+ "description": "命令点路径。"
331
+ },
332
+ "kind": {
333
+ "const": "atomic",
334
+ "description": "固定原子查询职责。"
335
+ },
336
+ "risk": {
337
+ "const": "read",
338
+ "description": "只读操作。"
339
+ },
340
+ "target": {
341
+ "type": "object",
342
+ "additionalProperties": false,
343
+ "required": [
344
+ "kdtId"
345
+ ],
346
+ "properties": {
347
+ "kdtId": {
348
+ "$ref": "#/definitions/shopId"
349
+ }
350
+ },
351
+ "description": "固定目标店铺。"
352
+ },
353
+ "requests": {
354
+ "type": "array",
355
+ "minItems": 2,
356
+ "maxItems": 2,
357
+ "items": {
358
+ "type": "object",
359
+ "additionalProperties": false,
360
+ "required": [
361
+ "method",
362
+ "path",
363
+ "body"
364
+ ],
365
+ "properties": {
366
+ "method": {
367
+ "const": "POST",
368
+ "description": "只读接口使用 POST。"
369
+ },
370
+ "path": {
371
+ "type": "string",
372
+ "description": "绑定或首个流水页的接口路径。"
373
+ },
374
+ "body": {
375
+ "type": "object",
376
+ "description": "绑定为空对象;流水页仅包含 biz_type、begin_time、end_time、page、page_size,无本地筛选。",
377
+ "additionalProperties": false,
378
+ "properties": {
379
+ "biz_type": {
380
+ "type": "string",
381
+ "description": "单一业务类型的大写代码。"
382
+ },
383
+ "begin_time": {
384
+ "type": "string",
385
+ "description": "北京时间开始秒文本。"
386
+ },
387
+ "end_time": {
388
+ "type": "string",
389
+ "description": "北京时间结束秒文本。"
390
+ },
391
+ "page": {
392
+ "$ref": "#/definitions/pageNo"
393
+ },
394
+ "page_size": {
395
+ "$ref": "#/definitions/pageSize"
396
+ }
397
+ }
398
+ }
399
+ },
400
+ "description": "预览中的首批只读请求,不预造依赖响应的后续页。"
401
+ },
402
+ "description": "一次绑定与首个流水页请求。"
403
+ },
404
+ "localFilters": {
405
+ "type": "object",
406
+ "additionalProperties": false,
407
+ "required": [],
408
+ "properties": {
409
+ "mobile": {
410
+ "const": "***",
411
+ "description": "已提供条件的遮盖值。"
412
+ },
413
+ "billCardNo": {
414
+ "const": "***",
415
+ "description": "已提供条件的遮盖值。"
416
+ },
417
+ "transactionNo": {
418
+ "const": "***",
419
+ "description": "已提供条件的遮盖值。"
420
+ },
421
+ "tradeNo": {
422
+ "const": "***",
423
+ "description": "已提供条件的遮盖值。"
424
+ }
425
+ },
426
+ "description": "仅包含实际提供的条件名称,全部值遮盖为 ***。"
427
+ },
428
+ "limits": {
429
+ "type": "object",
430
+ "additionalProperties": false,
431
+ "required": [
432
+ "maxItems",
433
+ "maxRequests",
434
+ "pageSize"
435
+ ],
436
+ "properties": {
437
+ "maxItems": {
438
+ "const": 200,
439
+ "description": "固定最多 200 条匹配记录,按整页预留。"
440
+ },
441
+ "maxRequests": {
442
+ "const": 21,
443
+ "description": "固定最多 21 次业务请求,包含一次绑定。"
444
+ },
445
+ "pageSize": {
446
+ "$ref": "#/definitions/pageSize"
447
+ }
448
+ },
449
+ "description": "固定内部执行计划摘要,不属于规范化 input,也不能通过选项调参。"
450
+ }
451
+ },
452
+ "description": "零认证零请求的脱敏执行计划;只展示绑定及首个流水页。"
453
+ },
454
+ "error": {
455
+ "type": "object",
456
+ "required": [
457
+ "success",
458
+ "code",
459
+ "message",
460
+ "details"
461
+ ],
462
+ "additionalProperties": false,
463
+ "properties": {
464
+ "success": {
465
+ "const": false
466
+ },
467
+ "code": {
468
+ "const": -10001
469
+ },
470
+ "message": {
471
+ "type": "string",
472
+ "minLength": 1
473
+ },
474
+ "details": {
475
+ "type": "object",
476
+ "required": [
477
+ "category",
478
+ "stage",
479
+ "command",
480
+ "targetScope",
481
+ "requestState",
482
+ "nextStep",
483
+ "errorVersion",
484
+ "recovery",
485
+ "execution"
486
+ ],
487
+ "additionalProperties": false,
488
+ "properties": {
489
+ "category": {
490
+ "type": "string",
491
+ "enum": [
492
+ "validation",
493
+ "configuration",
494
+ "parameter",
495
+ "permission",
496
+ "authentication",
497
+ "scope_unresolved",
498
+ "transport",
499
+ "http",
500
+ "protocol",
501
+ "business_rejected",
502
+ "not_found",
503
+ "limit"
504
+ ]
505
+ },
506
+ "stage": {
507
+ "type": "string",
508
+ "minLength": 1
509
+ },
510
+ "command": {
511
+ "const": "valuecard.transaction.scan"
512
+ },
513
+ "targetScope": {
514
+ "type": "object",
515
+ "additionalProperties": false,
516
+ "properties": {
517
+ "kdtId": {
518
+ "$ref": "#/definitions/shopId"
519
+ }
520
+ }
521
+ },
522
+ "requestState": {
523
+ "enum": [
524
+ "not_sent",
525
+ "sent",
526
+ "unknown"
527
+ ]
528
+ },
529
+ "nextStep": {
530
+ "type": "string",
531
+ "minLength": 1
532
+ },
533
+ "api": {
534
+ "type": "string",
535
+ "minLength": 1
536
+ },
537
+ "httpStatus": {
538
+ "type": "integer",
539
+ "minimum": 100,
540
+ "maximum": 599
541
+ },
542
+ "businessCode": {
543
+ "$ref": "#/definitions/code"
544
+ },
545
+ "gatewayCode": {
546
+ "$ref": "#/definitions/code"
547
+ },
548
+ "trace_id": {
549
+ "$ref": "#/definitions/trace"
550
+ },
551
+ "request_id": {
552
+ "$ref": "#/definitions/trace"
553
+ },
554
+ "errorVersion": {
555
+ "const": 2,
556
+ "description": "本命令采用错误诊断协议第二版。"
557
+ },
558
+ "issues": {
559
+ "type": "array",
560
+ "minItems": 1,
561
+ "maxItems": 16,
562
+ "items": {
563
+ "$ref": "#/definitions/diagnosticIssue"
564
+ },
565
+ "description": "最多十六个已定位问题,不包含收到的原值。"
566
+ },
567
+ "issuesTruncated": {
568
+ "const": true,
569
+ "description": "问题超过返回上限,当前列表没有穷尽全部问题。"
570
+ },
571
+ "recovery": {
572
+ "$ref": "#/definitions/diagnosticRecovery",
573
+ "description": "受限的恢复说明,不会自动执行。"
574
+ },
575
+ "execution": {
576
+ "$ref": "#/definitions/diagnosticExecution",
577
+ "description": "整次调用的请求观察,独立于失败阶段的 requestState。"
578
+ }
579
+ }
580
+ }
581
+ }
582
+ },
583
+ "definitions": {
584
+ "shopId": {
585
+ "type": "integer",
586
+ "minimum": 1,
587
+ "maximum": 9007199254740991
588
+ },
589
+ "code": {
590
+ "anyOf": [
591
+ {
592
+ "type": "integer",
593
+ "minimum": -9007199254740991,
594
+ "maximum": 9007199254740991
595
+ },
596
+ {
597
+ "type": "string",
598
+ "pattern": "^-?[0-9]{1,12}$"
599
+ }
600
+ ]
601
+ },
602
+ "trace": {
603
+ "type": "string",
604
+ "pattern": "^[a-zA-Z0-9_-]{1,128}$"
605
+ },
606
+ "diagnosticExpected": {
607
+ "type": "object",
608
+ "additionalProperties": false,
609
+ "required": [],
610
+ "properties": {
611
+ "type": {
612
+ "anyOf": [
613
+ {
614
+ "type": "string",
615
+ "description": "预期的 JSON 类型。"
616
+ },
617
+ {
618
+ "type": "array",
619
+ "items": {
620
+ "type": "string",
621
+ "description": "预期的 JSON 类型。"
622
+ }
623
+ }
624
+ ],
625
+ "description": "同版模型允许的类型。"
626
+ },
627
+ "enum": {
628
+ "type": "array",
629
+ "items": {
630
+ "anyOf": [
631
+ {
632
+ "type": "string"
633
+ },
634
+ {
635
+ "type": "number"
636
+ },
637
+ {
638
+ "type": "boolean"
639
+ },
640
+ {
641
+ "type": "null"
642
+ }
643
+ ],
644
+ "description": "契约声明的静态标量约束。"
645
+ },
646
+ "description": "同版模型允许的静态值。"
647
+ },
648
+ "const": {
649
+ "anyOf": [
650
+ {
651
+ "type": "string"
652
+ },
653
+ {
654
+ "type": "number"
655
+ },
656
+ {
657
+ "type": "boolean"
658
+ },
659
+ {
660
+ "type": "null"
661
+ }
662
+ ],
663
+ "description": "契约声明的静态标量约束。"
664
+ },
665
+ "minimum": {
666
+ "type": "number",
667
+ "description": "包含的最小值。"
668
+ },
669
+ "maximum": {
670
+ "type": "number",
671
+ "description": "包含的最大值。"
672
+ },
673
+ "exclusiveMinimum": {
674
+ "type": "number",
675
+ "description": "不包含的最小值。"
676
+ },
677
+ "exclusiveMaximum": {
678
+ "type": "number",
679
+ "description": "不包含的最大值。"
680
+ },
681
+ "minLength": {
682
+ "type": "integer",
683
+ "description": "最少字符数。"
684
+ },
685
+ "maxLength": {
686
+ "type": "integer",
687
+ "description": "最多字符数。"
688
+ },
689
+ "minItems": {
690
+ "type": "integer",
691
+ "description": "最少元素数。"
692
+ },
693
+ "maxItems": {
694
+ "type": "integer",
695
+ "description": "最多元素数。"
696
+ },
697
+ "format": {
698
+ "type": "string",
699
+ "description": "同版模型声明的格式。"
700
+ },
701
+ "pattern": {
702
+ "type": "string",
703
+ "description": "同版模型声明的字符约束。"
704
+ },
705
+ "additionalProperties": {
706
+ "const": false,
707
+ "description": "对象拒绝契约以外的属性。"
708
+ },
709
+ "contains": {
710
+ "type": "object",
711
+ "additionalProperties": false,
712
+ "required": [
713
+ "const"
714
+ ],
715
+ "properties": {
716
+ "const": {
717
+ "anyOf": [
718
+ {
719
+ "type": "string"
720
+ },
721
+ {
722
+ "type": "number"
723
+ },
724
+ {
725
+ "type": "boolean"
726
+ },
727
+ {
728
+ "type": "null"
729
+ }
730
+ ],
731
+ "description": "契约声明的静态标量约束。"
732
+ }
733
+ }
734
+ },
735
+ "items": {
736
+ "type": "object",
737
+ "additionalProperties": false,
738
+ "required": [
739
+ "enum"
740
+ ],
741
+ "properties": {
742
+ "enum": {
743
+ "type": "array",
744
+ "items": {
745
+ "anyOf": [
746
+ {
747
+ "type": "string"
748
+ },
749
+ {
750
+ "type": "number"
751
+ },
752
+ {
753
+ "type": "boolean"
754
+ },
755
+ {
756
+ "type": "null"
757
+ }
758
+ ],
759
+ "description": "契约声明的静态标量约束。"
760
+ },
761
+ "description": "元素允许的静态值。"
762
+ }
763
+ }
764
+ }
765
+ }
766
+ },
767
+ "diagnosticIssue": {
768
+ "type": "object",
769
+ "additionalProperties": false,
770
+ "required": [
771
+ "source",
772
+ "reason"
773
+ ],
774
+ "properties": {
775
+ "source": {
776
+ "enum": [
777
+ "argv",
778
+ "input",
779
+ "context",
780
+ "output",
781
+ "preview"
782
+ ],
783
+ "description": "问题所属的参数、输入、上下文、结果或预览模型。"
784
+ },
785
+ "path": {
786
+ "type": "string",
787
+ "description": "对应模型中的 JSON Pointer;不含原始输入或动态字典键。"
788
+ },
789
+ "option": {
790
+ "type": "string",
791
+ "description": "可定位时给出的已注册 CLI 选项。"
792
+ },
793
+ "reason": {
794
+ "enum": [
795
+ "required",
796
+ "invalid_type",
797
+ "invalid_choice",
798
+ "out_of_range",
799
+ "invalid_format",
800
+ "conditional_required",
801
+ "constraint",
802
+ "unexpected_property",
803
+ "unknown_option",
804
+ "unknown_command",
805
+ "excess_arguments",
806
+ "missing_value"
807
+ ],
808
+ "description": "字段违反的约束类型,原始值不回显。"
809
+ },
810
+ "expected": {
811
+ "$ref": "#/definitions/diagnosticExpected",
812
+ "description": "同版契约的静态预期。"
813
+ },
814
+ "relatedPaths": {
815
+ "type": "array",
816
+ "items": {
817
+ "type": "string",
818
+ "description": "关联字段的 JSON Pointer。"
819
+ },
820
+ "description": "触发条件约束的关联字段。"
821
+ }
822
+ }
823
+ },
824
+ "diagnosticRecovery": {
825
+ "type": "object",
826
+ "additionalProperties": false,
827
+ "required": [
828
+ "action",
829
+ "automaticBusinessRetry"
830
+ ],
831
+ "properties": {
832
+ "action": {
833
+ "enum": [
834
+ "correct_input",
835
+ "complete_authentication",
836
+ "request_access_review",
837
+ "stop_and_inspect"
838
+ ],
839
+ "description": "依次表示修正本地输入、补认证、核对权限或停止核查;仅是说明,不执行操作或授予权限。"
840
+ },
841
+ "automaticBusinessRetry": {
842
+ "const": false,
843
+ "description": "不据此自动重放业务请求。"
844
+ }
845
+ }
846
+ },
847
+ "diagnosticExecution": {
848
+ "type": "object",
849
+ "additionalProperties": false,
850
+ "required": [
851
+ "requestState",
852
+ "coverage",
853
+ "observedAttempts"
854
+ ],
855
+ "properties": {
856
+ "requestState": {
857
+ "enum": [
858
+ "not_sent",
859
+ "sent",
860
+ "unknown"
861
+ ],
862
+ "description": "整次调用尚未发送、已有发送记录或无法排除未知请求;不代表业务完成。"
863
+ },
864
+ "coverage": {
865
+ "enum": [
866
+ "complete",
867
+ "partial"
868
+ ],
869
+ "description": "请求观察覆盖全部已接入路径,或存在未观测路径;部分覆盖不能声明零请求。"
870
+ },
871
+ "observedAttempts": {
872
+ "type": "integer",
873
+ "minimum": 0,
874
+ "maximum": 9007199254740991,
875
+ "description": "本地已进入发送边界的观测次数下界,不是服务端执行次数。"
876
+ }
877
+ }
878
+ },
879
+ "bizType": {
880
+ "type": "string",
881
+ "enum": [
882
+ "recharge",
883
+ "group_give_recharge",
884
+ "refund",
885
+ "recharge_refund",
886
+ "pay",
887
+ "card_account_adjustment_add",
888
+ "card_account_adjustment_subtract",
889
+ "card_balance_import_add",
890
+ "card_balance_import_subtract",
891
+ "recede_card",
892
+ "gift_card_active",
893
+ "recharge_bonus",
894
+ "refund_close_transfer_in",
895
+ "refund_close_transfer_out",
896
+ "combine_in",
897
+ "combine_out"
898
+ ],
899
+ "description": "recharge 充值;group_give_recharge 赠送;refund 退款;recharge_refund 充值退款;pay 消费;card_account_adjustment_add 调账增加;card_account_adjustment_subtract 调账减少;card_balance_import_add 导入增加;card_balance_import_subtract 导入减少;recede_card 退卡;gift_card_active 激活;recharge_bonus 充值赠送;refund_close_transfer_in 退款销卡转入;refund_close_transfer_out 退款销卡转出;combine_in 卡换绑转入;combine_out 卡换绑转出。单次只选一种,不支持 all 或 CSV。"
900
+ },
901
+ "identifier": {
902
+ "type": "string",
903
+ "minLength": 1,
904
+ "maxLength": 200,
905
+ "pattern": "^[^\\s\\u0000-\\u001f\\u007f-\\u009f](?:[^\\u0000-\\u001f\\u007f-\\u009f]*[^\\s\\u0000-\\u001f\\u007f-\\u009f])?$",
906
+ "description": "完整原始标识,最长 200 字符,不含首尾空白或控制字符,保留前导零和大小写。"
907
+ },
908
+ "pageNo": {
909
+ "type": "integer",
910
+ "minimum": 1,
911
+ "maximum": 5000,
912
+ "description": "本轮起始页码;与 pageSize 的乘积不大于 5000,不证明前页已经核实。"
913
+ },
914
+ "pageSize": {
915
+ "type": "integer",
916
+ "minimum": 1,
917
+ "maximum": 50,
918
+ "description": "单个服务端页的固定容量;同次扫描不改变。"
919
+ },
920
+ "time": {
921
+ "type": "string",
922
+ "format": "beijing-date-time-ms",
923
+ "description": "北京时间 YYYY-MM-DD HH:mm:ss.SSS,固定三位毫秒。"
924
+ },
925
+ "money": {
926
+ "type": "string",
927
+ "pattern": "^-?(?:0|[1-9][0-9]*)\\.[0-9]{2}$",
928
+ "description": "默认 CNY 人民币元,固定两位,保留源符号,范围 ±90071992547409.91,不执行换汇。"
929
+ }
930
+ },
931
+ "api": {
932
+ "method": "POST",
933
+ "path": "youzan.cardvoucher.giftcard.bill.query/3.0.0"
934
+ },
935
+ "notes": [
936
+ "四个本地条件至少一个,多条件为 AND,保留前导零、大小写及国家码;不会发送客户、卡号或交易单号作为服务端筛选。手机号不是 yzOpenId,流水卡号不等于 card.cardNo。",
937
+ "固定最多 200 条匹配记录、21 次业务请求,包含一次同凭证店铺绑定;固定串行,不自动重试、二分、后台执行、换身份或切店。不提供 --max-items、--max-requests,input 不含 limits。",
938
+ "每次读取前为最坏完整页预留匹配容量,返回可能少于 200 条,不截断半页。可靠末页耗尽优先于预算;否则依次检查漂移、总数未知、窗口、匹配条数及请求预算。",
939
+ "未完成且 nextPageNo 非空时,保持同店铺、类型、时间、筛选和 pageSize,以 --page-no 继续;不是稳定断点,可能重复或遗漏。窗口满需缩小时间范围;总数漂移建议缩小范围从第一页重查。",
940
+ "空页、短页或匹配数组为空均不单独证明耗尽或无历史。只用可靠总数确认耗尽,不提供匹配 total、不汇总资产,不承诺稳定降序、快照或完整历史。",
941
+ "金额为 CNY 元两位字符串,六个金额保留源符号;reportedBalance 时点未明确,不推算交易前后余额,不按类型猜增减,不进行自动对账。",
942
+ "所有记录先验证核心模型和当前筛选字段再匹配,缺匹配字段不得视为不匹配;必需字符串非空且无控制字符。可选文本省略则省略、空串原样保留、null 或错型失败;未知附加字段不透传。",
943
+ "单响应最多 10 MiB,累计业务响应最多 20 MiB,最终 UTF-8 输出含换行最多 5 MiB;超限或后页业务、网络、模型错误整体失败,不输出前页结果。",
944
+ "真实调用需要有效四字段上下文及同店凭证;at: all 不证明员工 OAuth、所有产品或跨机构权限。预览所有条件值遮盖,不读取凭证、不联网。",
945
+ "新储值商家支持全部卡交易查询,老储值商家仅支持礼品卡流水;不把当前查询范围扩大为所有资产或全历史。"
946
+ ],
947
+ "success": {
948
+ "description": "绑定及全部已执行请求成功,整页模型有效,输出已观察的精确匹配记录及六种停止原因之一;预算、漂移或未知总数不伪装完成。"
949
+ },
950
+ "errors": {
951
+ "description": "失败 stdout 为空,stderr 为脱敏错误 JSON,退出非零;保持原店铺和条件核查,时间或大窗口错误应缩小范围,不自动重试。",
952
+ "diagnosticsVersion": 2
953
+ }
954
+ }