@youzan-cloud/zan-saas-cli 0.0.0-stage → 0.1.0-beta.3
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 +105 -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 +102 -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,339 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"input": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"kdtId",
|
|
7
|
+
"tagId"
|
|
8
|
+
],
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"kdtId": {
|
|
12
|
+
"$ref": "#/definitions/shopId"
|
|
13
|
+
},
|
|
14
|
+
"tagId": {
|
|
15
|
+
"type": "integer",
|
|
16
|
+
"minimum": 1,
|
|
17
|
+
"maximum": 9007199254740991,
|
|
18
|
+
"description": "必填:标签定义正安全整数 ID;不是标签组 ID"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"description": "CLI 解析参数并完成必要上下文补全后的业务输入;不是直接传入 CLI 的 JSON。原始选项、必填条件和默认值见 options。"
|
|
22
|
+
},
|
|
23
|
+
"output": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"required": [
|
|
26
|
+
"data"
|
|
27
|
+
],
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"properties": {
|
|
30
|
+
"data": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"required": [
|
|
33
|
+
"tag"
|
|
34
|
+
],
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"properties": {
|
|
37
|
+
"tag": {
|
|
38
|
+
"$ref": "#/definitions/tag"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"preview": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"required": [
|
|
47
|
+
"method",
|
|
48
|
+
"path",
|
|
49
|
+
"body",
|
|
50
|
+
"scope",
|
|
51
|
+
"prerequisites"
|
|
52
|
+
],
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"properties": {
|
|
55
|
+
"method": {
|
|
56
|
+
"const": "POST"
|
|
57
|
+
},
|
|
58
|
+
"path": {
|
|
59
|
+
"const": "youzan.scrm.tag.get/1.0.0"
|
|
60
|
+
},
|
|
61
|
+
"body": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"required": [
|
|
64
|
+
"tag_id"
|
|
65
|
+
],
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"properties": {
|
|
68
|
+
"tag_id": {
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"minimum": 1,
|
|
71
|
+
"maximum": 9007199254740991
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"scope": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"required": [
|
|
78
|
+
"kdtId"
|
|
79
|
+
],
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"properties": {
|
|
82
|
+
"kdtId": {
|
|
83
|
+
"$ref": "#/definitions/shopId"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"prerequisites": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"minItems": 1,
|
|
90
|
+
"maxItems": 1,
|
|
91
|
+
"items": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"required": [
|
|
94
|
+
"method",
|
|
95
|
+
"path",
|
|
96
|
+
"body"
|
|
97
|
+
],
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"properties": {
|
|
100
|
+
"method": {
|
|
101
|
+
"const": "POST"
|
|
102
|
+
},
|
|
103
|
+
"path": {
|
|
104
|
+
"const": "youzan.shop.basic.get/3.0.0"
|
|
105
|
+
},
|
|
106
|
+
"body": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"additionalProperties": false
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"error": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"required": [
|
|
118
|
+
"success",
|
|
119
|
+
"code",
|
|
120
|
+
"message",
|
|
121
|
+
"details"
|
|
122
|
+
],
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"properties": {
|
|
125
|
+
"success": {
|
|
126
|
+
"const": false
|
|
127
|
+
},
|
|
128
|
+
"code": {
|
|
129
|
+
"const": -10001
|
|
130
|
+
},
|
|
131
|
+
"message": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"minLength": 1
|
|
134
|
+
},
|
|
135
|
+
"details": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"required": [
|
|
138
|
+
"category",
|
|
139
|
+
"stage",
|
|
140
|
+
"command",
|
|
141
|
+
"targetScope",
|
|
142
|
+
"requestState",
|
|
143
|
+
"nextStep"
|
|
144
|
+
],
|
|
145
|
+
"additionalProperties": false,
|
|
146
|
+
"properties": {
|
|
147
|
+
"category": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"enum": [
|
|
150
|
+
"validation",
|
|
151
|
+
"configuration",
|
|
152
|
+
"parameter",
|
|
153
|
+
"permission",
|
|
154
|
+
"authentication",
|
|
155
|
+
"scope_unresolved",
|
|
156
|
+
"transport",
|
|
157
|
+
"http",
|
|
158
|
+
"protocol",
|
|
159
|
+
"business_rejected",
|
|
160
|
+
"not_found",
|
|
161
|
+
"target_mismatch",
|
|
162
|
+
"ambiguous"
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"stage": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"minLength": 1
|
|
168
|
+
},
|
|
169
|
+
"command": {
|
|
170
|
+
"const": "customer.tag.get"
|
|
171
|
+
},
|
|
172
|
+
"targetScope": {
|
|
173
|
+
"type": "object",
|
|
174
|
+
"additionalProperties": false,
|
|
175
|
+
"properties": {
|
|
176
|
+
"kdtId": {
|
|
177
|
+
"$ref": "#/definitions/shopId"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"requestState": {
|
|
182
|
+
"enum": [
|
|
183
|
+
"not_sent",
|
|
184
|
+
"sent",
|
|
185
|
+
"unknown"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"nextStep": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"minLength": 1
|
|
191
|
+
},
|
|
192
|
+
"api": {
|
|
193
|
+
"type": "string"
|
|
194
|
+
},
|
|
195
|
+
"httpStatus": {
|
|
196
|
+
"type": "integer"
|
|
197
|
+
},
|
|
198
|
+
"businessCode": {
|
|
199
|
+
"anyOf": [
|
|
200
|
+
{
|
|
201
|
+
"type": "integer"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"type": "string"
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
"gatewayCode": {
|
|
209
|
+
"anyOf": [
|
|
210
|
+
{
|
|
211
|
+
"type": "integer"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"type": "string"
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
"trace_id": {
|
|
219
|
+
"type": "string"
|
|
220
|
+
},
|
|
221
|
+
"request_id": {
|
|
222
|
+
"type": "string"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"definitions": {
|
|
229
|
+
"shopId": {
|
|
230
|
+
"type": "integer",
|
|
231
|
+
"minimum": 1,
|
|
232
|
+
"maximum": 9007199254740991
|
|
233
|
+
},
|
|
234
|
+
"tag": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"required": [
|
|
237
|
+
"tag_id",
|
|
238
|
+
"tag_name"
|
|
239
|
+
],
|
|
240
|
+
"additionalProperties": false,
|
|
241
|
+
"properties": {
|
|
242
|
+
"tag_id": {
|
|
243
|
+
"type": "integer",
|
|
244
|
+
"minimum": 1,
|
|
245
|
+
"maximum": 9007199254740991
|
|
246
|
+
},
|
|
247
|
+
"tag_name": {
|
|
248
|
+
"type": "string"
|
|
249
|
+
},
|
|
250
|
+
"tag_customer_num": {
|
|
251
|
+
"type": "integer",
|
|
252
|
+
"minimum": 0,
|
|
253
|
+
"maximum": 9007199254740991
|
|
254
|
+
},
|
|
255
|
+
"tag_category_id": {
|
|
256
|
+
"type": "integer",
|
|
257
|
+
"minimum": 0,
|
|
258
|
+
"maximum": 9007199254740991
|
|
259
|
+
},
|
|
260
|
+
"status": {
|
|
261
|
+
"type": "integer",
|
|
262
|
+
"enum": [
|
|
263
|
+
0,
|
|
264
|
+
1
|
|
265
|
+
],
|
|
266
|
+
"description": "0 不可用,1 可用;方向不同于标签组状态。"
|
|
267
|
+
},
|
|
268
|
+
"tag_biz_type": {
|
|
269
|
+
"type": "string"
|
|
270
|
+
},
|
|
271
|
+
"tag_type": {
|
|
272
|
+
"type": "integer",
|
|
273
|
+
"enum": [
|
|
274
|
+
1,
|
|
275
|
+
2
|
|
276
|
+
],
|
|
277
|
+
"description": "1 手动标签,2 自动标签。"
|
|
278
|
+
},
|
|
279
|
+
"created_at": {
|
|
280
|
+
"anyOf": [
|
|
281
|
+
{
|
|
282
|
+
"type": "string",
|
|
283
|
+
"format": "beijing-date-time-ms"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"const": ""
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
"$comment": "upstream-time:text:empty",
|
|
290
|
+
"description": "日期时间;北京时间 YYYY-MM-DD HH:mm:ss.SSS。业务哨兵原值保留:['']。"
|
|
291
|
+
},
|
|
292
|
+
"updated_at": {
|
|
293
|
+
"anyOf": [
|
|
294
|
+
{
|
|
295
|
+
"type": "string",
|
|
296
|
+
"format": "beijing-date-time-ms"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"const": ""
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"$comment": "upstream-time:text:empty",
|
|
303
|
+
"description": "日期时间;北京时间 YYYY-MM-DD HH:mm:ss.SSS。业务哨兵原值保留:['']。"
|
|
304
|
+
},
|
|
305
|
+
"is_deleted": {
|
|
306
|
+
"type": "integer",
|
|
307
|
+
"enum": [
|
|
308
|
+
0,
|
|
309
|
+
1
|
|
310
|
+
],
|
|
311
|
+
"description": "0 未删除,1 已删除。"
|
|
312
|
+
},
|
|
313
|
+
"tag_source": {
|
|
314
|
+
"type": "integer",
|
|
315
|
+
"minimum": -9007199254740991,
|
|
316
|
+
"maximum": 9007199254740991,
|
|
317
|
+
"description": "标签来源整数码,未知值保留,不自行解释。"
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"api": {
|
|
323
|
+
"method": "POST",
|
|
324
|
+
"path": "youzan.scrm.tag.get/1.0.0"
|
|
325
|
+
},
|
|
326
|
+
"success": {
|
|
327
|
+
"description": "店铺核验通过,标签 ID 精确匹配且名称及出现的已选字段满足模型后成功。"
|
|
328
|
+
},
|
|
329
|
+
"errors": {
|
|
330
|
+
"description": "失败 stdout 为空,stderr 为一份脱敏错误 JSON,退出码非零;不返回部分成功,不自动重试、切换身份或目标。按 error 模型及安全下一步处理。"
|
|
331
|
+
},
|
|
332
|
+
"notes": [
|
|
333
|
+
"--kdt-id 省略时使用本次有效上下文 shopId;显式提供的非法值不回退。两者都缺失时拒绝;目标范围、同店核验和服务端权限仍按本命令校验。",
|
|
334
|
+
"查询指定店铺的标签定义,不是客户标签关系;必须提供标签 ID;店铺省略时使用当前上下文,不搜索名称或补查标签组。",
|
|
335
|
+
"标签 ID 和名称为成功必需项;其他选定明细缺失省略,已出现字段 null 或错型失败。",
|
|
336
|
+
"仅承诺微商城单店;at=shop 不表示零售、总部或所有连锁分店均受支持。",
|
|
337
|
+
"本地 --dry-run 不读取凭证、不联网;预览只证明构造计划,不证明对象存在或权限有效。真实执行仍需有效上下文及目标范围授权,at 声明不替代服务端授权。"
|
|
338
|
+
]
|
|
339
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { withTargetShopDefault } = require('../../../../../execution/target-shop-default');
|
|
4
|
+
|
|
5
|
+
const { Command } = require('commander');
|
|
6
|
+
const { validateCommandValue } = require('../../../../../execution/command-schema');
|
|
7
|
+
const { queryTagCategory, failure } = require('./query');
|
|
8
|
+
const schema = require('./schema.json');
|
|
9
|
+
|
|
10
|
+
function parameterError() {
|
|
11
|
+
const error = failure('parameter', 'input');
|
|
12
|
+
error.message = '标签组查询参数无效,请查看 zan-saas customer tagcategory get --help。';
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function positiveId(value) {
|
|
17
|
+
if (typeof value !== 'string' || !/^[1-9]\d*$/.test(value) ||
|
|
18
|
+
!Number.isSafeInteger(Number(value))) throw parameterError();
|
|
19
|
+
return Number(value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function buildInput(options, context) {
|
|
23
|
+
const input = {
|
|
24
|
+
kdtId: positiveId(options.kdtId), tagCategoryId: positiveId(options.tagCategoryId)
|
|
25
|
+
};
|
|
26
|
+
if (!['json', 'pretty'].includes(options.format)) throw parameterError();
|
|
27
|
+
validateCommandValue(schema, 'input', input);
|
|
28
|
+
const targetScope = { kdtId: input.kdtId };
|
|
29
|
+
if (context?.orgType === 'shop' && String(input.kdtId) !== context.shopId) {
|
|
30
|
+
throw failure('permission', 'context', targetScope);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
targetScope,
|
|
34
|
+
request: {
|
|
35
|
+
method: 'POST', path: schema.api.path, body: { tag_category_id: input.tagCategoryId }
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createCommand({ context } = {}) {
|
|
41
|
+
return new Command('get')
|
|
42
|
+
.description('按店铺和标签组 ID 读取一个标签组及本次返回的组内标签')
|
|
43
|
+
.allowExcessArguments(false)
|
|
44
|
+
.exitOverride(error => {
|
|
45
|
+
if (['commander.helpDisplayed', 'commander.version'].includes(error.code)) throw error;
|
|
46
|
+
throw parameterError();
|
|
47
|
+
})
|
|
48
|
+
.option('--kdt-id <id>', '目标店铺 ID;当前调用范围须与目标店铺一致;省略时使用当前上下文店铺')
|
|
49
|
+
.requiredOption('--tag-category-id <id>', '标签组 ID;不能使用标签 ID 代替')
|
|
50
|
+
.option('--format <format>', 'json 或 pretty(仅改变缩进)', 'json')
|
|
51
|
+
.option('--dry-run', '纯本地预览目标范围和请求,不读凭证、不联网')
|
|
52
|
+
.addHelpText('after', `
|
|
53
|
+
返回 data.tag_category;组状态与组内标签状态均为 0 正常、1 禁用。
|
|
54
|
+
空 tags 表示本次返回为空;缺失 tags 失败,不补造标签全集或历史快照。
|
|
55
|
+
只有一次详情请求,无分页、名称搜索、include、列表降级或自动重试。
|
|
56
|
+
支持微商城单店、零售单店及接口声明的连锁 D/L 总部;at: all 只表示组织位置。
|
|
57
|
+
执行需要有效的用户、组织与店铺上下文,可通过登录后选店或 ZAN_SAAS_CONTEXT 提供;目标范围和服务端授权按本命令契约校验,公共调用前置见 zan-saas skills read zan-saas-shared。
|
|
58
|
+
非总部目标须匹配上下文 shopId。上下文不是授权证明;API 不发送 kdt_id,
|
|
59
|
+
当前调用须具备目标店铺的服务端授权,不能仅靠返回 kdt_id 或本地上下文代证。
|
|
60
|
+
尚未确认目标范围时停止真实调用;参数校验和本地预览不证明远端准入。
|
|
61
|
+
dry-run 无上下文也可本地预览;已有无效或冲突上下文时拒绝。失败 stdout 为空,stderr 为脱敏错误 JSON。
|
|
62
|
+
|
|
63
|
+
示例:
|
|
64
|
+
zan-saas customer tagcategory get --kdt-id 63077 --tag-category-id 10355
|
|
65
|
+
zan-saas customer tagcategory get --kdt-id 63077 --tag-category-id 10355 --dry-run
|
|
66
|
+
`)
|
|
67
|
+
.action(async options => {
|
|
68
|
+
let input;
|
|
69
|
+
try { input = buildInput(options, context); }
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error.cliDetails) throw error;
|
|
72
|
+
throw parameterError();
|
|
73
|
+
}
|
|
74
|
+
const output = options.dryRun ? input : await queryTagCategory(input);
|
|
75
|
+
if (options.dryRun) validateCommandValue(schema, 'preview', output);
|
|
76
|
+
process.stdout.write(`${JSON.stringify(output, null, options.format === 'pretty' ? 2 : 0)}\n`);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
module.exports = { kind: 'atomic', risk: 'read', at: 'all', createCommand: withTargetShopDefault(createCommand) };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { requestApi, ApiConfigurationError } = require('../../../../../transport/api');
|
|
4
|
+
const { validateCommandValue } = require('../../../../../execution/command-schema');
|
|
5
|
+
const schema = require('./schema.json');
|
|
6
|
+
|
|
7
|
+
const commandPath = 'customer.tagcategory.get';
|
|
8
|
+
const MAX_RESPONSE_BYTES = 10 * 1024 * 1024;
|
|
9
|
+
const MAX_OUTPUT_BYTES = 5 * 1024 * 1024;
|
|
10
|
+
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
11
|
+
|
|
12
|
+
function failure(category, stage, scope = {}, facts = {}, requestState = 'not_sent') {
|
|
13
|
+
const error = new Error(`标签组查询失败:${category}(${stage})`);
|
|
14
|
+
error.cliDetails = {
|
|
15
|
+
category, stage, command: commandPath, targetScope: scope, requestState,
|
|
16
|
+
nextStep: '核对同版 schema、目标店铺、标签组 ID 和服务端店铺授权;不自动重试、换店或换身份。',
|
|
17
|
+
...facts
|
|
18
|
+
};
|
|
19
|
+
return error;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function safeFacts(response, result) {
|
|
23
|
+
const facts = { api: schema.api.path, httpStatus: response.httpStatus };
|
|
24
|
+
if (Number.isSafeInteger(result?.code) ||
|
|
25
|
+
(typeof result?.code === 'string' && /^-?\d{1,12}$/.test(result.code))) {
|
|
26
|
+
facts.businessCode = result.code;
|
|
27
|
+
}
|
|
28
|
+
for (const field of ['trace_id', 'request_id']) {
|
|
29
|
+
const value = result?.[field] ?? result?.gw_err_resp?.[field];
|
|
30
|
+
if (typeof value === 'string' && /^[a-zA-Z0-9_-]{1,128}$/.test(value)) {
|
|
31
|
+
facts[field] = value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (object(result?.gw_err_resp) &&
|
|
35
|
+
/^(?:\d{1,12})$/.test(String(result.gw_err_resp.err_code))) {
|
|
36
|
+
facts.gatewayCode = result.gw_err_resp.err_code;
|
|
37
|
+
}
|
|
38
|
+
return facts;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function selectFields(value, definition) {
|
|
42
|
+
if (!object(value)) return value;
|
|
43
|
+
return Object.fromEntries(Object.keys(definition.properties)
|
|
44
|
+
.filter(field => Object.hasOwn(value, field))
|
|
45
|
+
.map(field => [field, value[field]]));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function queryTagCategory(input) {
|
|
49
|
+
const { targetScope, request } = input;
|
|
50
|
+
let response;
|
|
51
|
+
try {
|
|
52
|
+
response = await requestApi(request);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (error instanceof ApiConfigurationError) {
|
|
55
|
+
throw failure('configuration', 'configuration', targetScope);
|
|
56
|
+
}
|
|
57
|
+
throw failure('transport', 'request', targetScope, {}, 'unknown');
|
|
58
|
+
}
|
|
59
|
+
let result;
|
|
60
|
+
const withinBudget = Buffer.byteLength(response.body, 'utf8') <= MAX_RESPONSE_BYTES;
|
|
61
|
+
if (withinBudget) {
|
|
62
|
+
try { result = JSON.parse(response.body); }
|
|
63
|
+
catch { result = null; }
|
|
64
|
+
}
|
|
65
|
+
const facts = safeFacts(response, result);
|
|
66
|
+
const invalid = stage => failure('protocol', stage, targetScope, facts, 'sent');
|
|
67
|
+
if (!response.ok) {
|
|
68
|
+
const category = response.httpStatus === 401 ? 'authentication' :
|
|
69
|
+
response.httpStatus === 403 ? 'permission' : 'http';
|
|
70
|
+
throw failure(category, 'response', targetScope, facts, 'sent');
|
|
71
|
+
}
|
|
72
|
+
if (!withinBudget) throw invalid('response-budget');
|
|
73
|
+
if (!object(result)) throw invalid('response');
|
|
74
|
+
if (facts.gatewayCode !== undefined) {
|
|
75
|
+
if (result.success === true || result.code === 200) throw invalid('response');
|
|
76
|
+
throw failure('business_rejected', 'response', targetScope, facts, 'sent');
|
|
77
|
+
}
|
|
78
|
+
if (result.success === false ||
|
|
79
|
+
(Number.isSafeInteger(result.code) && result.code !== 200)) {
|
|
80
|
+
throw failure('business_rejected', 'response', targetScope, facts, 'sent');
|
|
81
|
+
}
|
|
82
|
+
if (result.success !== true || result.code !== 200) throw invalid('success-signals');
|
|
83
|
+
if (!object(result.data) || result.data.kdt_id !== targetScope.kdtId ||
|
|
84
|
+
result.data.tag_category_id !== request.body.tag_category_id) throw invalid('identity');
|
|
85
|
+
const category = selectFields(result.data, schema.definitions.tagCategory);
|
|
86
|
+
if (Array.isArray(category.tags)) {
|
|
87
|
+
category.tags = category.tags.map(tag => selectFields(tag, schema.definitions.tag));
|
|
88
|
+
}
|
|
89
|
+
const output = { data: { tag_category: category } };
|
|
90
|
+
try { validateCommandValue(schema, 'output', output); }
|
|
91
|
+
catch { throw invalid('model'); }
|
|
92
|
+
if (Buffer.byteLength(JSON.stringify(output), 'utf8') > MAX_OUTPUT_BYTES) {
|
|
93
|
+
throw invalid('output-budget');
|
|
94
|
+
}
|
|
95
|
+
return output;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = { queryTagCategory, failure, MAX_RESPONSE_BYTES, MAX_OUTPUT_BYTES };
|