@youzan-cloud/zan-saas-cli 0.0.0-stage → 0.1.0-beta.4
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/DEPENDENCIES.json +50 -0
- package/INSTALL.md +79 -0
- package/LICENSE +21 -0
- package/NOTICE +1 -0
- package/README.md +151 -2
- package/THIRD_PARTY_NOTICES.txt +162 -0
- package/bin/zan-saas-cli.js +28 -0
- package/internal/registry/index.js +123 -0
- package/internal/registry/manifest.json +424 -0
- package/npm-shrinkwrap.json +86 -0
- package/package.json +33 -4
- package/skills/README.md +30 -0
- package/skills/zan-saas/SKILL.md +54 -0
- package/skills/zan-saas/references/host-entry.md +25 -0
- package/skills/zan-saas-access/SKILL.md +37 -0
- package/skills/zan-saas-access/references/role-list.md +11 -0
- package/skills/zan-saas-access/references/staff-perms-get.md +11 -0
- package/skills/zan-saas-aftersale/SKILL.md +31 -0
- package/skills/zan-saas-aftersale/references/case-list.md +13 -0
- package/skills/zan-saas-aftersale/references/case-scan.md +31 -0
- package/skills/zan-saas-benefit/SKILL.md +46 -0
- package/skills/zan-saas-benefit/references/card-get.md +7 -0
- package/skills/zan-saas-benefit/references/card-grant-list.md +11 -0
- package/skills/zan-saas-benefit/references/card-list.md +7 -0
- package/skills/zan-saas-benefit/references/customer-card-get.md +7 -0
- package/skills/zan-saas-benefit/references/customer-card-list.md +7 -0
- package/skills/zan-saas-coupon/SKILL.md +41 -0
- package/skills/zan-saas-coupon/references/activity-get.md +11 -0
- package/skills/zan-saas-coupon/references/activity-list.md +15 -0
- package/skills/zan-saas-coupon/references/voucher-get.md +13 -0
- package/skills/zan-saas-coupon/references/voucher-list.md +25 -0
- package/skills/zan-saas-customer/SKILL.md +73 -0
- package/skills/zan-saas-customer/references/customer-scan.md +11 -0
- package/skills/zan-saas-customer/references/segment-list.md +22 -0
- package/skills/zan-saas-fulfillment/SKILL.md +36 -0
- package/skills/zan-saas-fulfillment/references/delivery-get.md +11 -0
- package/skills/zan-saas-fulfillment/references/shipment-list.md +11 -0
- package/skills/zan-saas-fulfillment/references/waybill-get.md +9 -0
- package/skills/zan-saas-interaction/SKILL.md +37 -0
- package/skills/zan-saas-interaction/references/lottery-get.md +11 -0
- package/skills/zan-saas-interaction/references/lottery-list.md +19 -0
- package/skills/zan-saas-item/SKILL.md +61 -0
- package/skills/zan-saas-item/references/attribute-list.md +11 -0
- package/skills/zan-saas-item/references/brand-list.md +7 -0
- package/skills/zan-saas-item/references/classification-get.md +7 -0
- package/skills/zan-saas-item/references/classification-list.md +7 -0
- package/skills/zan-saas-item/references/group-list.md +9 -0
- package/skills/zan-saas-item/references/item-content.md +9 -0
- package/skills/zan-saas-item/references/item-get.md +9 -0
- package/skills/zan-saas-item/references/item-search.md +23 -0
- package/skills/zan-saas-item/references/product-identity.md +11 -0
- package/skills/zan-saas-member/SKILL.md +41 -0
- package/skills/zan-saas-member/references/customer-level-get.md +7 -0
- package/skills/zan-saas-member/references/growth-log-list.md +17 -0
- package/skills/zan-saas-member/references/membership-get.md +7 -0
- package/skills/zan-saas-order/SKILL.md +56 -0
- package/skills/zan-saas-order/references/order-get.md +26 -0
- package/skills/zan-saas-order/references/order-list.md +25 -0
- package/skills/zan-saas-order/references/order-scan.md +35 -0
- package/skills/zan-saas-org/SKILL.md +37 -0
- package/skills/zan-saas-org/references/staff-get.md +15 -0
- package/skills/zan-saas-org/references/staff-role-get.md +11 -0
- package/skills/zan-saas-org/references/unit-get.md +11 -0
- package/skills/zan-saas-org/references/unit-list.md +15 -0
- package/skills/zan-saas-points/SKILL.md +42 -0
- package/skills/zan-saas-points/references/account-get.md +7 -0
- package/skills/zan-saas-points/references/log-list.md +17 -0
- package/skills/zan-saas-points/references/rule-list.md +2 -0
- package/skills/zan-saas-privacy/SKILL.md +30 -0
- package/skills/zan-saas-privacy/references/field-decrypt.md +19 -0
- package/skills/zan-saas-shared/SKILL.md +94 -0
- package/skills/zan-saas-shared/references/authentication.md +52 -0
- package/skills/zan-saas-shared/references/value-processing.md +27 -0
- package/skills/zan-saas-stock/SKILL.md +28 -0
- package/skills/zan-saas-stock/references/log-list.md +11 -0
- package/skills/zan-saas-valuecard/SKILL.md +37 -0
- package/skills/zan-saas-valuecard/references/card-get.md +13 -0
- package/skills/zan-saas-valuecard/references/card-list.md +11 -0
- package/src/auth/browser.js +28 -0
- package/src/auth/callback-server.js +99 -0
- package/src/auth/config.js +53 -0
- package/src/auth/credential-store.js +109 -0
- package/src/auth/oauth-client.js +105 -0
- package/src/auth/pkce.js +28 -0
- package/src/auth/session.js +178 -0
- package/src/auth/tool.js +25 -0
- package/src/cli/command-paths.js +126 -0
- package/src/cli/context-help.js +102 -0
- package/src/cli/diagnostic-command.js +57 -0
- package/src/cli/domain-catalog.js +42 -0
- package/src/cli/help-text.js +32 -0
- package/src/cli/native-loader.js +120 -0
- package/src/cli/native-path.js +22 -0
- package/src/cli/parser-policy.js +141 -0
- package/src/cli/program.js +134 -0
- package/src/cli/skill-catalog.js +241 -0
- package/src/commands/native/access/commands.index.json +24 -0
- package/src/commands/native/access/domain.json +3 -0
- package/src/commands/native/access/role/list/command.js +141 -0
- package/src/commands/native/access/role/list/schema.json +393 -0
- package/src/commands/native/access/staff-perms/get/command.js +119 -0
- package/src/commands/native/access/staff-perms/get/schema.json +703 -0
- package/src/commands/native/aftersale/case/get/command.js +104 -0
- package/src/commands/native/aftersale/case/get/exact-json.js +52 -0
- package/src/commands/native/aftersale/case/get/money.js +28 -0
- package/src/commands/native/aftersale/case/get/projection.js +120 -0
- package/src/commands/native/aftersale/case/get/query.js +72 -0
- package/src/commands/native/aftersale/case/get/schema.json +134 -0
- package/src/commands/native/aftersale/case/list/command.js +135 -0
- package/src/commands/native/aftersale/case/list/schema.json +1095 -0
- package/src/commands/native/aftersale/case/scan/command.js +110 -0
- package/src/commands/native/aftersale/case/scan/query.js +62 -0
- package/src/commands/native/aftersale/case/scan/scan.js +78 -0
- package/src/commands/native/aftersale/case/scan/schema.json +964 -0
- package/src/commands/native/aftersale/case/scan/search.js +108 -0
- package/src/commands/native/aftersale/commands.index.json +42 -0
- package/src/commands/native/aftersale/domain.json +3 -0
- package/src/commands/native/aftersale/refund/list/command.js +97 -0
- package/src/commands/native/aftersale/refund/list/money.js +25 -0
- package/src/commands/native/aftersale/refund/list/projection.js +50 -0
- package/src/commands/native/aftersale/refund/list/query.js +73 -0
- package/src/commands/native/aftersale/refund/list/schema.json +130 -0
- package/src/commands/native/aftersale/shared/query.js +58 -0
- package/src/commands/native/aftersale/shared/search.js +128 -0
- package/src/commands/native/benefit/card-definition/get/command.js +110 -0
- package/src/commands/native/benefit/card-definition/get/schema.json +545 -0
- package/src/commands/native/benefit/card-definition/list/command.js +106 -0
- package/src/commands/native/benefit/card-definition/list/schema.json +690 -0
- package/src/commands/native/benefit/card-grant/list/command.js +135 -0
- package/src/commands/native/benefit/card-grant/list/schema.json +758 -0
- package/src/commands/native/benefit/commands.index.json +51 -0
- package/src/commands/native/benefit/customer-card/get/command.js +110 -0
- package/src/commands/native/benefit/customer-card/get/schema.json +340 -0
- package/src/commands/native/benefit/customer-card/list/command.js +103 -0
- package/src/commands/native/benefit/customer-card/list/schema.json +731 -0
- package/src/commands/native/benefit/domain.json +3 -0
- package/src/commands/native/coupon/activity/get/command.js +183 -0
- package/src/commands/native/coupon/activity/get/schema.json +624 -0
- package/src/commands/native/coupon/activity/list/command.js +169 -0
- package/src/commands/native/coupon/activity/list/schema.json +845 -0
- package/src/commands/native/coupon/commands.index.json +42 -0
- package/src/commands/native/coupon/domain.json +3 -0
- package/src/commands/native/coupon/shared/query.js +15 -0
- package/src/commands/native/coupon/voucher/get/command.js +113 -0
- package/src/commands/native/coupon/voucher/get/schema.json +147 -0
- package/src/commands/native/coupon/voucher/list/command.js +155 -0
- package/src/commands/native/coupon/voucher/list/schema.json +772 -0
- package/src/commands/native/customer/commands.index.json +96 -0
- package/src/commands/native/customer/customer/get/adapter.js +82 -0
- package/src/commands/native/customer/customer/get/command.js +106 -0
- package/src/commands/native/customer/customer/get/schema.json +958 -0
- package/src/commands/native/customer/customer/list/command.js +78 -0
- package/src/commands/native/customer/customer/list/input.js +145 -0
- package/src/commands/native/customer/customer/list/query.js +103 -0
- package/src/commands/native/customer/customer/list/schema.json +969 -0
- package/src/commands/native/customer/customer/scan/command.js +80 -0
- package/src/commands/native/customer/customer/scan/scan.js +92 -0
- package/src/commands/native/customer/customer/scan/schema.json +211 -0
- package/src/commands/native/customer/customer-tag/get/command.js +166 -0
- package/src/commands/native/customer/customer-tag/get/schema.json +317 -0
- package/src/commands/native/customer/customer-tag/list/command.js +143 -0
- package/src/commands/native/customer/customer-tag/list/schema.json +259 -0
- package/src/commands/native/customer/domain.json +3 -0
- package/src/commands/native/customer/segment/list/command.js +96 -0
- package/src/commands/native/customer/segment/list/query.js +98 -0
- package/src/commands/native/customer/segment/list/schema.json +135 -0
- package/src/commands/native/customer/segment-customer/list/command.js +171 -0
- package/src/commands/native/customer/segment-customer/list/schema.json +123 -0
- package/src/commands/native/customer/shared/search-input.js +179 -0
- package/src/commands/native/customer/shared/search-page.js +54 -0
- package/src/commands/native/customer/tag/get/command.js +73 -0
- package/src/commands/native/customer/tag/get/schema.json +339 -0
- package/src/commands/native/customer/tagcategory/get/command.js +80 -0
- package/src/commands/native/customer/tagcategory/get/query.js +98 -0
- package/src/commands/native/customer/tagcategory/get/schema.json +339 -0
- package/src/commands/native/customer/tagcategory/list/command.js +127 -0
- package/src/commands/native/customer/tagcategory/list/schema.json +394 -0
- package/src/commands/native/fulfillment/commands.index.json +33 -0
- package/src/commands/native/fulfillment/delivery/get/command.js +107 -0
- package/src/commands/native/fulfillment/delivery/get/projection.js +142 -0
- package/src/commands/native/fulfillment/delivery/get/schema.json +173 -0
- package/src/commands/native/fulfillment/domain.json +3 -0
- package/src/commands/native/fulfillment/shipment/list/command.js +83 -0
- package/src/commands/native/fulfillment/shipment/list/projection.js +130 -0
- package/src/commands/native/fulfillment/shipment/list/schema.json +752 -0
- package/src/commands/native/fulfillment/waybill/get/command.js +193 -0
- package/src/commands/native/fulfillment/waybill/get/response.js +68 -0
- package/src/commands/native/fulfillment/waybill/get/schema.json +190 -0
- package/src/commands/native/interaction/commands.index.json +24 -0
- package/src/commands/native/interaction/domain.json +3 -0
- package/src/commands/native/interaction/lottery/get/command.js +61 -0
- package/src/commands/native/interaction/lottery/get/query.js +152 -0
- package/src/commands/native/interaction/lottery/get/schema.json +1004 -0
- package/src/commands/native/interaction/lottery/list/command.js +176 -0
- package/src/commands/native/interaction/lottery/list/schema.json +898 -0
- package/src/commands/native/item/attribute/list/command.js +122 -0
- package/src/commands/native/item/attribute/list/schema.json +727 -0
- package/src/commands/native/item/brand/list/command.js +114 -0
- package/src/commands/native/item/brand/list/schema.json +725 -0
- package/src/commands/native/item/classification/get/command.js +87 -0
- package/src/commands/native/item/classification/get/schema.json +596 -0
- package/src/commands/native/item/classification/list/command.js +105 -0
- package/src/commands/native/item/classification/list/schema.json +676 -0
- package/src/commands/native/item/commands.index.json +87 -0
- package/src/commands/native/item/domain.json +1 -0
- package/src/commands/native/item/group/list/command.js +122 -0
- package/src/commands/native/item/group/list/schema.json +809 -0
- package/src/commands/native/item/item/get/command.js +122 -0
- package/src/commands/native/item/item/get/schema.json +3799 -0
- package/src/commands/native/item/item/list/command.js +7 -0
- package/src/commands/native/item/item/list/schema.json +1118 -0
- package/src/commands/native/item/item/scan/command.js +7 -0
- package/src/commands/native/item/item/scan/schema.json +1046 -0
- package/src/commands/native/item/item-content/get/command.js +54 -0
- package/src/commands/native/item/item-content/get/schema.json +677 -0
- package/src/commands/native/item/shared/api.js +31 -0
- package/src/commands/native/item/shared/content.js +20 -0
- package/src/commands/native/item/shared/diagnostics.js +61 -0
- package/src/commands/native/item/shared/h5.js +63 -0
- package/src/commands/native/item/shared/identity.js +62 -0
- package/src/commands/native/item/shared/normalize.js +49 -0
- package/src/commands/native/item/shared/scope.js +22 -0
- package/src/commands/native/item/shared/search-command.js +61 -0
- package/src/commands/native/item/shared/search-options.js +150 -0
- package/src/commands/native/item/shared/search.js +158 -0
- package/src/commands/native/member/commands.index.json +60 -0
- package/src/commands/native/member/customer-level/get/command.js +122 -0
- package/src/commands/native/member/customer-level/get/schema.json +300 -0
- package/src/commands/native/member/domain.json +3 -0
- package/src/commands/native/member/growth/get/command.js +64 -0
- package/src/commands/native/member/growth/get/schema.json +283 -0
- package/src/commands/native/member/growth-log/list/command.js +203 -0
- package/src/commands/native/member/growth-log/list/schema.json +695 -0
- package/src/commands/native/member/level/get/command.js +70 -0
- package/src/commands/native/member/level/get/query.js +125 -0
- package/src/commands/native/member/level/get/schema.json +339 -0
- package/src/commands/native/member/level/list/command.js +50 -0
- package/src/commands/native/member/level/list/query.js +109 -0
- package/src/commands/native/member/level/list/schema.json +104 -0
- package/src/commands/native/member/membership/get/command.js +78 -0
- package/src/commands/native/member/membership/get/schema.json +283 -0
- package/src/commands/native/order/commands.index.json +33 -0
- package/src/commands/native/order/domain.json +3 -0
- package/src/commands/native/order/order/get/command.js +155 -0
- package/src/commands/native/order/order/get/schema.json +1167 -0
- package/src/commands/native/order/order/list/command.js +230 -0
- package/src/commands/native/order/order/list/schema.json +1363 -0
- package/src/commands/native/order/order/scan/command.js +148 -0
- package/src/commands/native/order/order/scan/scan.js +89 -0
- package/src/commands/native/order/order/scan/schema.json +1445 -0
- package/src/commands/native/order/shared/projection.js +183 -0
- package/src/commands/native/order/shared/query.js +84 -0
- package/src/commands/native/order/shared/search.js +112 -0
- package/src/commands/native/org/commands.index.json +42 -0
- package/src/commands/native/org/domain.json +3 -0
- package/src/commands/native/org/shared/single-staff.js +115 -0
- package/src/commands/native/org/staff/get/command.js +148 -0
- package/src/commands/native/org/staff/get/schema.json +114 -0
- package/src/commands/native/org/staff-role/get/command.js +45 -0
- package/src/commands/native/org/staff-role/get/schema.json +93 -0
- package/src/commands/native/org/unit/get/command.js +131 -0
- package/src/commands/native/org/unit/get/schema.json +478 -0
- package/src/commands/native/org/unit/list/command.js +187 -0
- package/src/commands/native/org/unit/list/schema.json +828 -0
- package/src/commands/native/points/account/get/command.js +65 -0
- package/src/commands/native/points/account/get/schema.json +303 -0
- package/src/commands/native/points/commands.index.json +33 -0
- package/src/commands/native/points/domain.json +3 -0
- package/src/commands/native/points/log/list/command.js +141 -0
- package/src/commands/native/points/log/list/schema.json +761 -0
- package/src/commands/native/points/rule/list/command.js +82 -0
- package/src/commands/native/points/rule/list/schema.json +294 -0
- package/src/commands/native/privacy/commands.index.json +15 -0
- package/src/commands/native/privacy/domain.json +3 -0
- package/src/commands/native/privacy/field/decrypt/command.js +185 -0
- package/src/commands/native/privacy/field/decrypt/schema.json +656 -0
- package/src/commands/native/privacy/shared/order-source.js +33 -0
- package/src/commands/native/stock/commands.index.json +15 -0
- package/src/commands/native/stock/domain.json +3 -0
- package/src/commands/native/stock/log/list/command.js +207 -0
- package/src/commands/native/stock/log/list/schema.json +922 -0
- package/src/commands/native/valuecard/card/get/command.js +107 -0
- package/src/commands/native/valuecard/card/get/schema.json +683 -0
- package/src/commands/native/valuecard/card/list/command.js +136 -0
- package/src/commands/native/valuecard/card/list/pagination.js +23 -0
- package/src/commands/native/valuecard/card/list/schema.json +780 -0
- package/src/commands/native/valuecard/commands.index.json +24 -0
- package/src/commands/native/valuecard/domain.json +3 -0
- package/src/commands/native/valuecard/shared/projection.js +57 -0
- package/src/commands/system/api.js +47 -0
- package/src/commands/system/auth.js +118 -0
- package/src/commands/system/contracts.js +373 -0
- package/src/commands/system/doctor.js +24 -0
- package/src/commands/system/install.js +41 -0
- package/src/commands/system/printer.js +16 -0
- package/src/commands/system/schema.js +162 -0
- package/src/commands/system/shop-guidance.js +9 -0
- package/src/commands/system/shop.js +237 -0
- package/src/commands/system/skills.js +49 -0
- package/src/execution/beijing-date-time.js +29 -0
- package/src/execution/beijing-time.js +21 -0
- package/src/execution/bounded-input.js +42 -0
- package/src/execution/command-io.js +137 -0
- package/src/execution/command-policy.js +41 -0
- package/src/execution/command-schema.js +131 -0
- package/src/execution/datetime.js +83 -0
- package/src/execution/error-details.js +399 -0
- package/src/execution/error-model.js +82 -0
- package/src/execution/exact-json.js +80 -0
- package/src/execution/list-total.js +10 -0
- package/src/execution/money.js +59 -0
- package/src/execution/parser-error.js +66 -0
- package/src/execution/privacy.js +197 -0
- package/src/execution/public-schema.js +52 -0
- package/src/execution/query-api.js +101 -0
- package/src/execution/range.js +84 -0
- package/src/execution/request-state.js +55 -0
- package/src/execution/schema-completeness.js +116 -0
- package/src/execution/shop-query.js +54 -0
- package/src/execution/target-shop-default.js +23 -0
- package/src/execution/target-shop.js +49 -0
- package/src/identity/context-store.js +54 -0
- package/src/identity/context.js +38 -0
- package/src/installation/install.js +158 -0
- package/src/installation/npm-error.js +93 -0
- package/src/installation/skill.js +113 -0
- package/src/transport/account-api.js +152 -0
- package/src/transport/api.js +199 -0
- package/src/transport/shop-app.js +63 -0
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"input": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"kdtId",
|
|
7
|
+
"cardAlias",
|
|
8
|
+
"include"
|
|
9
|
+
],
|
|
10
|
+
"additionalProperties": false,
|
|
11
|
+
"properties": {
|
|
12
|
+
"kdtId": {
|
|
13
|
+
"$ref": "#/definitions/positiveInteger"
|
|
14
|
+
},
|
|
15
|
+
"cardAlias": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1,
|
|
18
|
+
"pattern": "^[^\\s\\u0000-\\u001f\\u007f-\\u009f](?:[^\\u0000-\\u001f\\u007f-\\u009f]*[^\\s\\u0000-\\u001f\\u007f-\\u009f])?$",
|
|
19
|
+
"description": "完整定义 alias,去首尾空白,拒绝控制字符;不是卡号或商品 ID。"
|
|
20
|
+
},
|
|
21
|
+
"include": {
|
|
22
|
+
"$ref": "#/definitions/include"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"description": "CLI 解析参数并完成必要上下文补全后的业务输入;不是直接传入 CLI 的 JSON。原始选项、必填条件和默认值见 options。"
|
|
26
|
+
},
|
|
27
|
+
"output": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": [
|
|
30
|
+
"data"
|
|
31
|
+
],
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"properties": {
|
|
34
|
+
"data": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"required": [
|
|
37
|
+
"card"
|
|
38
|
+
],
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"properties": {
|
|
41
|
+
"card": {
|
|
42
|
+
"$ref": "#/definitions/card"
|
|
43
|
+
},
|
|
44
|
+
"rights": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"$ref": "#/definitions/right"
|
|
48
|
+
},
|
|
49
|
+
"description": "仅 include rights 时出现;请求后数组必需,真实空数组允许。"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"preview": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"required": [
|
|
58
|
+
"scope",
|
|
59
|
+
"prerequisites",
|
|
60
|
+
"requests",
|
|
61
|
+
"selection"
|
|
62
|
+
],
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"properties": {
|
|
65
|
+
"scope": {
|
|
66
|
+
"$ref": "#/definitions/scope"
|
|
67
|
+
},
|
|
68
|
+
"prerequisites": {
|
|
69
|
+
"type": "array",
|
|
70
|
+
"minItems": 1,
|
|
71
|
+
"maxItems": 1,
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"required": [
|
|
75
|
+
"method",
|
|
76
|
+
"path",
|
|
77
|
+
"body"
|
|
78
|
+
],
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"properties": {
|
|
81
|
+
"method": {
|
|
82
|
+
"const": "POST"
|
|
83
|
+
},
|
|
84
|
+
"path": {
|
|
85
|
+
"const": "youzan.shop.basic.get/3.0.0"
|
|
86
|
+
},
|
|
87
|
+
"body": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"requests": {
|
|
95
|
+
"type": "array",
|
|
96
|
+
"minItems": 1,
|
|
97
|
+
"maxItems": 1,
|
|
98
|
+
"items": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"required": [
|
|
101
|
+
"method",
|
|
102
|
+
"path",
|
|
103
|
+
"body"
|
|
104
|
+
],
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"properties": {
|
|
107
|
+
"method": {
|
|
108
|
+
"const": "POST"
|
|
109
|
+
},
|
|
110
|
+
"path": {
|
|
111
|
+
"const": "youzan.scrm.card.get/4.0.0"
|
|
112
|
+
},
|
|
113
|
+
"body": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"required": [
|
|
116
|
+
"params"
|
|
117
|
+
],
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"properties": {
|
|
120
|
+
"params": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"required": [
|
|
123
|
+
"card_alias"
|
|
124
|
+
],
|
|
125
|
+
"additionalProperties": false,
|
|
126
|
+
"properties": {
|
|
127
|
+
"card_alias": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"minLength": 1
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"description": "对象 {card_alias:cardAlias},不把 params 再序列化为字符串;2026-10-30 用户确认替代初版 curl 字符串编码。"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"selection": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"required": [
|
|
142
|
+
"include"
|
|
143
|
+
],
|
|
144
|
+
"additionalProperties": false,
|
|
145
|
+
"properties": {
|
|
146
|
+
"include": {
|
|
147
|
+
"$ref": "#/definitions/include"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"error": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"required": [
|
|
156
|
+
"success",
|
|
157
|
+
"code",
|
|
158
|
+
"message",
|
|
159
|
+
"details"
|
|
160
|
+
],
|
|
161
|
+
"additionalProperties": false,
|
|
162
|
+
"properties": {
|
|
163
|
+
"success": {
|
|
164
|
+
"const": false
|
|
165
|
+
},
|
|
166
|
+
"code": {
|
|
167
|
+
"const": -10001
|
|
168
|
+
},
|
|
169
|
+
"message": {
|
|
170
|
+
"type": "string"
|
|
171
|
+
},
|
|
172
|
+
"details": {
|
|
173
|
+
"type": "object",
|
|
174
|
+
"required": [
|
|
175
|
+
"category",
|
|
176
|
+
"stage",
|
|
177
|
+
"command",
|
|
178
|
+
"targetScope",
|
|
179
|
+
"requestState",
|
|
180
|
+
"nextStep"
|
|
181
|
+
],
|
|
182
|
+
"additionalProperties": false,
|
|
183
|
+
"properties": {
|
|
184
|
+
"category": {
|
|
185
|
+
"enum": [
|
|
186
|
+
"parameter",
|
|
187
|
+
"validation",
|
|
188
|
+
"configuration",
|
|
189
|
+
"permission",
|
|
190
|
+
"authentication",
|
|
191
|
+
"scope_unresolved",
|
|
192
|
+
"transport",
|
|
193
|
+
"http",
|
|
194
|
+
"protocol",
|
|
195
|
+
"business_rejected",
|
|
196
|
+
"not_found"
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"stage": {
|
|
200
|
+
"type": "string",
|
|
201
|
+
"minLength": 1
|
|
202
|
+
},
|
|
203
|
+
"command": {
|
|
204
|
+
"const": "benefit.card-definition.get"
|
|
205
|
+
},
|
|
206
|
+
"targetScope": {
|
|
207
|
+
"type": "object",
|
|
208
|
+
"additionalProperties": false,
|
|
209
|
+
"properties": {
|
|
210
|
+
"kdtId": {
|
|
211
|
+
"$ref": "#/definitions/positiveInteger"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"requestState": {
|
|
216
|
+
"enum": [
|
|
217
|
+
"not_sent",
|
|
218
|
+
"sent",
|
|
219
|
+
"unknown"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"nextStep": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"minLength": 1
|
|
225
|
+
},
|
|
226
|
+
"api": {
|
|
227
|
+
"type": "string"
|
|
228
|
+
},
|
|
229
|
+
"httpStatus": {
|
|
230
|
+
"type": "integer"
|
|
231
|
+
},
|
|
232
|
+
"businessCode": {
|
|
233
|
+
"anyOf": [
|
|
234
|
+
{
|
|
235
|
+
"$ref": "#/definitions/integer"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"type": "string"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
"gatewayCode": {
|
|
243
|
+
"anyOf": [
|
|
244
|
+
{
|
|
245
|
+
"$ref": "#/definitions/integer"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"type": "string"
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
"trace_id": {
|
|
253
|
+
"type": "string"
|
|
254
|
+
},
|
|
255
|
+
"request_id": {
|
|
256
|
+
"type": "string"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"definitions": {
|
|
263
|
+
"integer": {
|
|
264
|
+
"type": "integer",
|
|
265
|
+
"minimum": -9007199254740991,
|
|
266
|
+
"maximum": 9007199254740991
|
|
267
|
+
},
|
|
268
|
+
"positiveInteger": {
|
|
269
|
+
"type": "integer",
|
|
270
|
+
"minimum": 1,
|
|
271
|
+
"maximum": 9007199254740991
|
|
272
|
+
},
|
|
273
|
+
"nonnegativeInteger": {
|
|
274
|
+
"type": "integer",
|
|
275
|
+
"minimum": 0,
|
|
276
|
+
"maximum": 9007199254740991
|
|
277
|
+
},
|
|
278
|
+
"include": {
|
|
279
|
+
"type": "array",
|
|
280
|
+
"uniqueItems": true,
|
|
281
|
+
"items": {
|
|
282
|
+
"enum": [
|
|
283
|
+
"rights"
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"scope": {
|
|
288
|
+
"type": "object",
|
|
289
|
+
"required": [
|
|
290
|
+
"kdtId"
|
|
291
|
+
],
|
|
292
|
+
"additionalProperties": false,
|
|
293
|
+
"properties": {
|
|
294
|
+
"kdtId": {
|
|
295
|
+
"$ref": "#/definitions/positiveInteger"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"card": {
|
|
300
|
+
"type": "object",
|
|
301
|
+
"required": [
|
|
302
|
+
"cardAlias",
|
|
303
|
+
"name",
|
|
304
|
+
"cardType",
|
|
305
|
+
"status",
|
|
306
|
+
"activateMode",
|
|
307
|
+
"termType"
|
|
308
|
+
],
|
|
309
|
+
"additionalProperties": false,
|
|
310
|
+
"properties": {
|
|
311
|
+
"cardAlias": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"minLength": 1,
|
|
314
|
+
"description": "权益卡定义别名,须精确等于请求 alias。"
|
|
315
|
+
},
|
|
316
|
+
"name": {
|
|
317
|
+
"type": "string",
|
|
318
|
+
"description": "权益卡名称,允许已取得的空文本。"
|
|
319
|
+
},
|
|
320
|
+
"cardType": {
|
|
321
|
+
"$ref": "#/definitions/integer",
|
|
322
|
+
"description": "卡类型:1 无门槛、2 规则、3 付费;未知整数保留,不与列表 grantType 混用。"
|
|
323
|
+
},
|
|
324
|
+
"status": {
|
|
325
|
+
"$ref": "#/definitions/integer",
|
|
326
|
+
"description": "定义状态:1 可用、2 禁用、3 删除;未知整数保留,不推导领取资格。"
|
|
327
|
+
},
|
|
328
|
+
"activateMode": {
|
|
329
|
+
"$ref": "#/definitions/integer",
|
|
330
|
+
"description": "激活方式:0 无需激活、1 手机、2 手机及资料;未知整数保留。"
|
|
331
|
+
},
|
|
332
|
+
"termType": {
|
|
333
|
+
"$ref": "#/definitions/integer",
|
|
334
|
+
"description": "有效期类型:1 永久、2 固定时间、3 领取后天数;未知整数保留。"
|
|
335
|
+
},
|
|
336
|
+
"termDays": {
|
|
337
|
+
"$ref": "#/definitions/nonnegativeInteger",
|
|
338
|
+
"description": "领取后有效天数,单位天;不计算客户实际有效期。"
|
|
339
|
+
},
|
|
340
|
+
"termStartTime": {
|
|
341
|
+
"anyOf": [
|
|
342
|
+
{
|
|
343
|
+
"type": "string",
|
|
344
|
+
"format": "beijing-date-time-ms"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"const": ""
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
"$comment": "upstream-time:text:empty",
|
|
351
|
+
"description": "固定有效期起点;北京时间 YYYY-MM-DD HH:mm:ss.SSS。业务哨兵原值保留:['']。"
|
|
352
|
+
},
|
|
353
|
+
"termEndTime": {
|
|
354
|
+
"anyOf": [
|
|
355
|
+
{
|
|
356
|
+
"type": "string",
|
|
357
|
+
"format": "beijing-date-time-ms"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"const": ""
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"const": "永久有效"
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
"$comment": "upstream-time:text:empty:permanent",
|
|
367
|
+
"description": "固定有效期终点;北京时间 YYYY-MM-DD HH:mm:ss.SSS。业务哨兵原值保留:['', '永久有效']。"
|
|
368
|
+
},
|
|
369
|
+
"termToCardAlias": {
|
|
370
|
+
"type": "string",
|
|
371
|
+
"description": "关联权益卡定义别名,允许空串,不递归查询。"
|
|
372
|
+
},
|
|
373
|
+
"description": {
|
|
374
|
+
"type": "string",
|
|
375
|
+
"description": "权益卡使用须知。"
|
|
376
|
+
},
|
|
377
|
+
"cardUrl": {
|
|
378
|
+
"type": "string",
|
|
379
|
+
"description": "权益卡链接,仅返回,不访问。"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
"right": {
|
|
384
|
+
"type": "object",
|
|
385
|
+
"required": [
|
|
386
|
+
"type",
|
|
387
|
+
"name",
|
|
388
|
+
"isAvailable"
|
|
389
|
+
],
|
|
390
|
+
"additionalProperties": false,
|
|
391
|
+
"properties": {
|
|
392
|
+
"type": {
|
|
393
|
+
"$ref": "#/definitions/integer",
|
|
394
|
+
"description": "1 包邮、2 折扣、3 优惠券、4 积分、7 积分倍率、10 赠品、12 好友体验卡;未知整数保留。"
|
|
395
|
+
},
|
|
396
|
+
"name": {
|
|
397
|
+
"type": "string"
|
|
398
|
+
},
|
|
399
|
+
"isAvailable": {
|
|
400
|
+
"type": "boolean",
|
|
401
|
+
"description": "is_available 配置标记,不表示客户已获得或可使用。"
|
|
402
|
+
},
|
|
403
|
+
"discount": {
|
|
404
|
+
"$ref": "#/definitions/integer",
|
|
405
|
+
"description": "原编码;1 表示 0.01 折,不转百分比。"
|
|
406
|
+
},
|
|
407
|
+
"rate": {
|
|
408
|
+
"$ref": "#/definitions/integer",
|
|
409
|
+
"description": "原倍率编码;15 表示 1.5 倍,不转换。"
|
|
410
|
+
},
|
|
411
|
+
"points": {
|
|
412
|
+
"$ref": "#/definitions/nonnegativeInteger"
|
|
413
|
+
},
|
|
414
|
+
"coupon": {
|
|
415
|
+
"type": "array",
|
|
416
|
+
"maxItems": 30,
|
|
417
|
+
"items": {
|
|
418
|
+
"$ref": "#/definitions/coupon"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
"presents": {
|
|
422
|
+
"type": "array",
|
|
423
|
+
"items": {
|
|
424
|
+
"$ref": "#/definitions/present"
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
"salesman": {
|
|
428
|
+
"$ref": "#/definitions/salesman"
|
|
429
|
+
},
|
|
430
|
+
"custom": {
|
|
431
|
+
"$ref": "#/definitions/custom"
|
|
432
|
+
},
|
|
433
|
+
"experienceCard": {
|
|
434
|
+
"$ref": "#/definitions/experienceCard"
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
"coupon": {
|
|
439
|
+
"type": "object",
|
|
440
|
+
"required": [
|
|
441
|
+
"couponId",
|
|
442
|
+
"number"
|
|
443
|
+
],
|
|
444
|
+
"additionalProperties": false,
|
|
445
|
+
"properties": {
|
|
446
|
+
"couponId": {
|
|
447
|
+
"$ref": "#/definitions/positiveInteger"
|
|
448
|
+
},
|
|
449
|
+
"number": {
|
|
450
|
+
"type": "integer",
|
|
451
|
+
"minimum": 1,
|
|
452
|
+
"maximum": 10
|
|
453
|
+
},
|
|
454
|
+
"name": {
|
|
455
|
+
"type": "string"
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
"present": {
|
|
460
|
+
"type": "object",
|
|
461
|
+
"required": [
|
|
462
|
+
"presentId",
|
|
463
|
+
"number"
|
|
464
|
+
],
|
|
465
|
+
"additionalProperties": false,
|
|
466
|
+
"properties": {
|
|
467
|
+
"presentId": {
|
|
468
|
+
"$ref": "#/definitions/positiveInteger"
|
|
469
|
+
},
|
|
470
|
+
"number": {
|
|
471
|
+
"$ref": "#/definitions/nonnegativeInteger"
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
"salesman": {
|
|
476
|
+
"type": "object",
|
|
477
|
+
"additionalProperties": false,
|
|
478
|
+
"properties": {
|
|
479
|
+
"cpsRate": {
|
|
480
|
+
"$ref": "#/definitions/integer",
|
|
481
|
+
"description": "cps_rate 原百分比编码,2 表示 2%。"
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
"custom": {
|
|
486
|
+
"type": "object",
|
|
487
|
+
"additionalProperties": false,
|
|
488
|
+
"properties": {
|
|
489
|
+
"url": {
|
|
490
|
+
"type": "string",
|
|
491
|
+
"description": "仅返回,不抓取。"
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
"experienceCard": {
|
|
496
|
+
"type": "object",
|
|
497
|
+
"additionalProperties": false,
|
|
498
|
+
"properties": {
|
|
499
|
+
"sharedRewardGiftId": {
|
|
500
|
+
"$ref": "#/definitions/positiveInteger"
|
|
501
|
+
},
|
|
502
|
+
"experienceDays": {
|
|
503
|
+
"$ref": "#/definitions/nonnegativeInteger"
|
|
504
|
+
},
|
|
505
|
+
"stockNum": {
|
|
506
|
+
"$ref": "#/definitions/nonnegativeInteger"
|
|
507
|
+
},
|
|
508
|
+
"rewardPoints": {
|
|
509
|
+
"$ref": "#/definitions/nonnegativeInteger"
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
"modules": {
|
|
515
|
+
"card": {
|
|
516
|
+
"base": true,
|
|
517
|
+
"upstreamPath": "data",
|
|
518
|
+
"required": true,
|
|
519
|
+
"description": "固定基础定义视图,alias 精确匹配,六个核心字段必需。"
|
|
520
|
+
},
|
|
521
|
+
"rights": {
|
|
522
|
+
"base": false,
|
|
523
|
+
"upstreamPath": "data.rights",
|
|
524
|
+
"required": true,
|
|
525
|
+
"description": "按 include 追加递归配置数组;缺失/null/错型失败,不强求未取得的可选 payload。"
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
"api": {
|
|
529
|
+
"method": "POST",
|
|
530
|
+
"path": "youzan.scrm.card.get/4.0.0"
|
|
531
|
+
},
|
|
532
|
+
"success": {
|
|
533
|
+
"description": "cardAlias 精确匹配,基础 card 及所请求 rights 满足模型后整体成功。"
|
|
534
|
+
},
|
|
535
|
+
"errors": {
|
|
536
|
+
"description": "失败 stdout 为空,stderr 为一份脱敏错误 JSON,退出码非零;不返回部分成功,不自动重试、切换身份或目标。按 error 模型及安全下一步处理。 明确业务拒绝 141502105 为 not_found;错 alias 或矛盾成功结果为 protocol。"
|
|
537
|
+
},
|
|
538
|
+
"notes": [
|
|
539
|
+
"查询已知 alias 的权益卡定义,不是客户持卡实例;不推导客户持卡状态、领取资格或列表字段。",
|
|
540
|
+
"默认返回 card,--include rights 追加权益配置;已选模块缺失或错型整体失败,可选字段缺失保持省略。",
|
|
541
|
+
"支持微商城单店、零售单店、连锁 D 总部、网店及合伙人;不承诺教育多校区总部。",
|
|
542
|
+
"不返回付费金额、完整发卡规则、适用店铺或联系人;未知类型整数保留,不据此推断状态。",
|
|
543
|
+
"本地 --dry-run 不读取凭证、不联网;预览只证明构造计划,不证明对象存在或权限有效。真实执行仍需有效上下文及目标范围授权,at 声明不替代服务端授权。"
|
|
544
|
+
]
|
|
545
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { readTotal } = require('../../../../../execution/list-total');
|
|
4
|
+
|
|
5
|
+
const { withTargetShopDefault } = require('../../../../../execution/target-shop-default');
|
|
6
|
+
|
|
7
|
+
const { Option } = require('commander');
|
|
8
|
+
const { DiagnosticCommand } = require('../../../../../cli/diagnostic-command');
|
|
9
|
+
const { parseIntegerOption } = require('../../../../../execution/error-details');
|
|
10
|
+
const { resolveTargetShop } = require('../../../../../execution/target-shop');
|
|
11
|
+
const { validateCommandValue } = require('../../../../../execution/command-schema');
|
|
12
|
+
const { createShopQuery, failure, bindingPath } = require('../../../../../execution/shop-query');
|
|
13
|
+
const { object } = require('../../../../../execution/query-api');
|
|
14
|
+
const schema = require('./schema.json');
|
|
15
|
+
const { normalizeTimes } = require('../../../../../execution/datetime');
|
|
16
|
+
|
|
17
|
+
const command = 'benefit.card-definition.list';
|
|
18
|
+
const reject = (category, stage, scope, state, facts) =>
|
|
19
|
+
failure(command, category, stage, scope, state, facts);
|
|
20
|
+
|
|
21
|
+
function project(data, pageNo) {
|
|
22
|
+
if (!object(data) || !Array.isArray(data.items) ||
|
|
23
|
+
!Number.isSafeInteger(data.page) || !Number.isSafeInteger(data.page_size) ||
|
|
24
|
+
data.items.some(card => !object(card))) {
|
|
25
|
+
throw new Error('Invalid card list');
|
|
26
|
+
}
|
|
27
|
+
const total = readTotal(data, 'total');
|
|
28
|
+
const output = { data: {
|
|
29
|
+
cards: data.items.map(card => ({
|
|
30
|
+
cardAlias: card.card_alias,
|
|
31
|
+
cardId: card.card_id,
|
|
32
|
+
name: card.name,
|
|
33
|
+
isAvailable: card.is_available,
|
|
34
|
+
grantType: card.grant_type,
|
|
35
|
+
...(Object.hasOwn(card, 'card_url') ? { cardUrl: card.card_url } : {}),
|
|
36
|
+
...(Object.hasOwn(card, 'create_time') ? { createdAt: card.create_time } : {})
|
|
37
|
+
})),
|
|
38
|
+
pagination: { pageNo: data.page, pageSize: data.page_size, returned: data.items.length,
|
|
39
|
+
...(total === null ? {} : { total }), hasMore: null, nextPageNo: null, windowLimitReached: false }
|
|
40
|
+
} };
|
|
41
|
+
output.data.cards = normalizeTimes(output.data.cards,
|
|
42
|
+
schema.output.properties.data.properties.cards, schema.definitions);
|
|
43
|
+
validateCommandValue(schema, 'output', output);
|
|
44
|
+
const { cards } = output.data;
|
|
45
|
+
const end = data.page * data.page_size;
|
|
46
|
+
if (data.page !== pageNo || !Number.isSafeInteger(end) ||
|
|
47
|
+
cards.length > data.page_size || (total === 0 && cards.length !== 0) ||
|
|
48
|
+
new Set(cards.map(card => card.cardAlias)).size !== cards.length) {
|
|
49
|
+
throw new Error('Invalid card pagination or aliases');
|
|
50
|
+
}
|
|
51
|
+
const hasMore = total === null ? null : end < total;
|
|
52
|
+
Object.assign(output.data.pagination, { hasMore,
|
|
53
|
+
nextPageNo: hasMore === true && pageNo < 100 ? pageNo + 1 : null, windowLimitReached: hasMore !== false && pageNo === 100 });
|
|
54
|
+
return output;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function createCommand({ context } = {}) {
|
|
58
|
+
return new DiagnosticCommand('list', { path: command, schema, parameterCategory: 'parameter' })
|
|
59
|
+
.description('分页查询店铺配置的权益卡定义列表')
|
|
60
|
+
.allowExcessArguments(false)
|
|
61
|
+
.option('--kdt-id <id>', '目标店铺正安全整数;省略取本次有效上下文 shopId')
|
|
62
|
+
.option('--page-no <n>', '页码,十进制整数 1..100;仅查询指定单页', '1')
|
|
63
|
+
.addOption(new Option('--format <format>', 'json 或 pretty,仅改变缩进')
|
|
64
|
+
.choices(['json', 'pretty']).default('json'))
|
|
65
|
+
.option('--dry-run', '本地预览店铺核验和单页查询,不读凭证、不联网')
|
|
66
|
+
.addHelpText('after', `
|
|
67
|
+
total 只描述本次筛选的接口总数,不保证跨页快照;按 nextPageNo 继续并保留店铺和筛选。
|
|
68
|
+
nextPageNo=null 不能单独解释为结束;windowLimitReached=true 表示达到页码上限,仍有后续。
|
|
69
|
+
时间点统一输出北京时间 YYYY-MM-DD HH:mm:ss.SSS,字段声明的业务哨兵保留。
|
|
70
|
+
输出 data.cards 和 data.pagination(含 total、nextPageNo、windowLimitReached),不自动翻页或重试。
|
|
71
|
+
分页仅支持 --page-no;页容量由服务端决定,不支持 --page-size。
|
|
72
|
+
仅查询商家卡定义,不表示客户持卡、发卡资格或详情权益;不按名称、类型或状态过滤。
|
|
73
|
+
hasMore 表示是否还有下一页;空页或短页不表示耗尽,不承诺跨页快照。
|
|
74
|
+
服务端最多允许 100 页;第 100 页仍有 hasMore=true 时不能继续遍历,不请求第 101 页。
|
|
75
|
+
不提供 --name 或 scan;最多一次店铺核验与一次业务请求。
|
|
76
|
+
真实执行需有效四字段上下文和同店授权凭证;店铺核验不证明员工 OAuth。
|
|
77
|
+
支持微商城单店、零售单店、有赞连锁 D 总部/网店/合伙人,不承诺教育多校区总部。
|
|
78
|
+
契约:zan-saas schema benefit.card-definition.list
|
|
79
|
+
示例:zan-saas benefit card-definition list --page-no 1
|
|
80
|
+
示例:zan-saas benefit card-definition list --kdt-id 63077 --page-no 2 --dry-run
|
|
81
|
+
`)
|
|
82
|
+
.action(async options => {
|
|
83
|
+
const scope = resolveTargetShop(options, context, command);
|
|
84
|
+
let input;
|
|
85
|
+
try {
|
|
86
|
+
input = { ...scope, pageNo: parseIntegerOption(options.pageNo, schema, '/pageNo') };
|
|
87
|
+
validateCommandValue(schema, 'input', input);
|
|
88
|
+
} catch (error) { error.inputScope = scope; throw error; }
|
|
89
|
+
const preview = {
|
|
90
|
+
scope,
|
|
91
|
+
prerequisites: [{ method: 'POST', path: bindingPath, body: {} }],
|
|
92
|
+
requests: [{ method: 'POST', path: schema.api.path, body: { page: input.pageNo } }]
|
|
93
|
+
};
|
|
94
|
+
validateCommandValue(schema, 'preview', preview);
|
|
95
|
+
let output = preview;
|
|
96
|
+
if (!options.dryRun) {
|
|
97
|
+
const read = await createShopQuery(scope, command);
|
|
98
|
+
const { data, facts } = await read(schema.api.path, preview.requests[0].body, 'card-list');
|
|
99
|
+
try { output = project(data, input.pageNo); }
|
|
100
|
+
catch { throw reject('protocol', 'card-list-model', scope, 'sent', facts); }
|
|
101
|
+
}
|
|
102
|
+
process.stdout.write(`${JSON.stringify(output, null, options.format === 'pretty' ? 2 : 0)}\n`);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = { kind: 'atomic', risk: 'read', at: 'all', createCommand: withTargetShopDefault(createCommand) };
|