@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,339 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"input": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"kdtId",
|
|
7
|
+
"tagCategoryId"
|
|
8
|
+
],
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"kdtId": {
|
|
12
|
+
"$ref": "#/definitions/id"
|
|
13
|
+
},
|
|
14
|
+
"tagCategoryId": {
|
|
15
|
+
"$ref": "#/definitions/id"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"description": "CLI 解析参数并完成必要上下文补全后的业务输入;不是直接传入 CLI 的 JSON。原始选项、必填条件和默认值见 options。"
|
|
19
|
+
},
|
|
20
|
+
"output": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"required": [
|
|
23
|
+
"data"
|
|
24
|
+
],
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"properties": {
|
|
27
|
+
"data": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": [
|
|
30
|
+
"tag_category"
|
|
31
|
+
],
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"properties": {
|
|
34
|
+
"tag_category": {
|
|
35
|
+
"$ref": "#/definitions/tagCategory"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"preview": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"required": [
|
|
44
|
+
"targetScope",
|
|
45
|
+
"request"
|
|
46
|
+
],
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"properties": {
|
|
49
|
+
"targetScope": {
|
|
50
|
+
"$ref": "#/definitions/targetScope"
|
|
51
|
+
},
|
|
52
|
+
"request": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"required": [
|
|
55
|
+
"method",
|
|
56
|
+
"path",
|
|
57
|
+
"body"
|
|
58
|
+
],
|
|
59
|
+
"additionalProperties": false,
|
|
60
|
+
"properties": {
|
|
61
|
+
"method": {
|
|
62
|
+
"const": "POST"
|
|
63
|
+
},
|
|
64
|
+
"path": {
|
|
65
|
+
"const": "youzan.scrm.tag.category.get/1.0.0"
|
|
66
|
+
},
|
|
67
|
+
"body": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"required": [
|
|
70
|
+
"tag_category_id"
|
|
71
|
+
],
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"properties": {
|
|
74
|
+
"tag_category_id": {
|
|
75
|
+
"$ref": "#/definitions/id"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"error": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"required": [
|
|
86
|
+
"success",
|
|
87
|
+
"code",
|
|
88
|
+
"message",
|
|
89
|
+
"details"
|
|
90
|
+
],
|
|
91
|
+
"additionalProperties": false,
|
|
92
|
+
"properties": {
|
|
93
|
+
"success": {
|
|
94
|
+
"const": false
|
|
95
|
+
},
|
|
96
|
+
"code": {
|
|
97
|
+
"const": -10001
|
|
98
|
+
},
|
|
99
|
+
"message": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1
|
|
102
|
+
},
|
|
103
|
+
"details": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"required": [
|
|
106
|
+
"category",
|
|
107
|
+
"stage",
|
|
108
|
+
"command",
|
|
109
|
+
"targetScope",
|
|
110
|
+
"requestState",
|
|
111
|
+
"nextStep"
|
|
112
|
+
],
|
|
113
|
+
"additionalProperties": false,
|
|
114
|
+
"properties": {
|
|
115
|
+
"category": {
|
|
116
|
+
"enum": [
|
|
117
|
+
"parameter",
|
|
118
|
+
"configuration",
|
|
119
|
+
"authentication",
|
|
120
|
+
"permission",
|
|
121
|
+
"http",
|
|
122
|
+
"transport",
|
|
123
|
+
"business_rejected",
|
|
124
|
+
"protocol"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"stage": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"minLength": 1
|
|
130
|
+
},
|
|
131
|
+
"command": {
|
|
132
|
+
"const": "customer.tagcategory.get"
|
|
133
|
+
},
|
|
134
|
+
"targetScope": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"additionalProperties": false,
|
|
137
|
+
"properties": {
|
|
138
|
+
"kdtId": {
|
|
139
|
+
"$ref": "#/definitions/id"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"requestState": {
|
|
144
|
+
"enum": [
|
|
145
|
+
"not_sent",
|
|
146
|
+
"sent",
|
|
147
|
+
"unknown"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"nextStep": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"minLength": 1
|
|
153
|
+
},
|
|
154
|
+
"api": {
|
|
155
|
+
"const": "youzan.scrm.tag.category.get/1.0.0"
|
|
156
|
+
},
|
|
157
|
+
"httpStatus": {
|
|
158
|
+
"type": "integer",
|
|
159
|
+
"minimum": 100,
|
|
160
|
+
"maximum": 599
|
|
161
|
+
},
|
|
162
|
+
"businessCode": {
|
|
163
|
+
"anyOf": [
|
|
164
|
+
{
|
|
165
|
+
"type": "integer",
|
|
166
|
+
"minimum": -9007199254740991,
|
|
167
|
+
"maximum": 9007199254740991
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "string",
|
|
171
|
+
"pattern": "^-?[0-9]{1,12}$"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
"gatewayCode": {
|
|
176
|
+
"anyOf": [
|
|
177
|
+
{
|
|
178
|
+
"type": "integer",
|
|
179
|
+
"minimum": 0,
|
|
180
|
+
"maximum": 999999999999
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"type": "string",
|
|
184
|
+
"pattern": "^[0-9]{1,12}$"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"trace_id": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"pattern": "^[a-zA-Z0-9_-]{1,128}$"
|
|
191
|
+
},
|
|
192
|
+
"request_id": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"pattern": "^[a-zA-Z0-9_-]{1,128}$"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"definitions": {
|
|
201
|
+
"id": {
|
|
202
|
+
"type": "integer",
|
|
203
|
+
"minimum": 1,
|
|
204
|
+
"maximum": 9007199254740991,
|
|
205
|
+
"description": "正安全整数 ID;拒绝字符串和超出 JavaScript 安全范围的 Long。"
|
|
206
|
+
},
|
|
207
|
+
"targetScope": {
|
|
208
|
+
"type": "object",
|
|
209
|
+
"required": [
|
|
210
|
+
"kdtId"
|
|
211
|
+
],
|
|
212
|
+
"additionalProperties": false,
|
|
213
|
+
"properties": {
|
|
214
|
+
"kdtId": {
|
|
215
|
+
"$ref": "#/definitions/id"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"roles": {
|
|
220
|
+
"type": "array",
|
|
221
|
+
"items": {
|
|
222
|
+
"type": "integer",
|
|
223
|
+
"minimum": -2147483648,
|
|
224
|
+
"maximum": 2147483647
|
|
225
|
+
},
|
|
226
|
+
"description": "角色整数数组;0 导购员及部门管理员,1 非导购的一线员工,不扩充为封闭枚举。"
|
|
227
|
+
},
|
|
228
|
+
"status": {
|
|
229
|
+
"type": "integer",
|
|
230
|
+
"enum": [
|
|
231
|
+
0,
|
|
232
|
+
1
|
|
233
|
+
],
|
|
234
|
+
"description": "0 正常,1 已禁用;与独立标签模板 status 的方向不同。"
|
|
235
|
+
},
|
|
236
|
+
"tag": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"required": [
|
|
239
|
+
"tag_id",
|
|
240
|
+
"tag_name",
|
|
241
|
+
"tag_status"
|
|
242
|
+
],
|
|
243
|
+
"additionalProperties": false,
|
|
244
|
+
"properties": {
|
|
245
|
+
"tag_id": {
|
|
246
|
+
"$ref": "#/definitions/id"
|
|
247
|
+
},
|
|
248
|
+
"tag_name": {
|
|
249
|
+
"type": "string"
|
|
250
|
+
},
|
|
251
|
+
"tag_status": {
|
|
252
|
+
"$ref": "#/definitions/status"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"tagCategory": {
|
|
257
|
+
"type": "object",
|
|
258
|
+
"required": [
|
|
259
|
+
"tag_category_id",
|
|
260
|
+
"kdt_id",
|
|
261
|
+
"tag_category_name",
|
|
262
|
+
"tags"
|
|
263
|
+
],
|
|
264
|
+
"additionalProperties": false,
|
|
265
|
+
"properties": {
|
|
266
|
+
"tag_category_id": {
|
|
267
|
+
"$ref": "#/definitions/id"
|
|
268
|
+
},
|
|
269
|
+
"kdt_id": {
|
|
270
|
+
"$ref": "#/definitions/id"
|
|
271
|
+
},
|
|
272
|
+
"tag_category_name": {
|
|
273
|
+
"type": "string"
|
|
274
|
+
},
|
|
275
|
+
"tag_add_rule": {
|
|
276
|
+
"type": "integer",
|
|
277
|
+
"enum": [
|
|
278
|
+
0,
|
|
279
|
+
1
|
|
280
|
+
],
|
|
281
|
+
"description": "0 仅唯一添加,1 可重复添加。"
|
|
282
|
+
},
|
|
283
|
+
"tag_category_status": {
|
|
284
|
+
"$ref": "#/definitions/status"
|
|
285
|
+
},
|
|
286
|
+
"support_tag_type": {
|
|
287
|
+
"type": "integer",
|
|
288
|
+
"enum": [
|
|
289
|
+
1,
|
|
290
|
+
2,
|
|
291
|
+
3
|
|
292
|
+
],
|
|
293
|
+
"description": "1 手动打标,2 自动打标,3 全部。"
|
|
294
|
+
},
|
|
295
|
+
"sync_external": {
|
|
296
|
+
"type": "boolean"
|
|
297
|
+
},
|
|
298
|
+
"allow_edit_roles": {
|
|
299
|
+
"$ref": "#/definitions/roles"
|
|
300
|
+
},
|
|
301
|
+
"allow_view_roles": {
|
|
302
|
+
"$ref": "#/definitions/roles"
|
|
303
|
+
},
|
|
304
|
+
"create_source_desc": {
|
|
305
|
+
"type": "string"
|
|
306
|
+
},
|
|
307
|
+
"sync_wecom_helper": {
|
|
308
|
+
"type": "boolean"
|
|
309
|
+
},
|
|
310
|
+
"tags": {
|
|
311
|
+
"type": "array",
|
|
312
|
+
"items": {
|
|
313
|
+
"$ref": "#/definitions/tag"
|
|
314
|
+
},
|
|
315
|
+
"description": "仅代表接口本次返回的组内标签集合;空数组与缺失不同。"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"api": {
|
|
321
|
+
"method": "POST",
|
|
322
|
+
"path": "youzan.scrm.tag.category.get/1.0.0"
|
|
323
|
+
},
|
|
324
|
+
"success": {
|
|
325
|
+
"description": "组 ID 和店铺 ID 匹配目标,必需字段及出现的可选字段满足模型后成功。"
|
|
326
|
+
},
|
|
327
|
+
"errors": {
|
|
328
|
+
"description": "失败 stdout 为空,stderr 为一份脱敏错误 JSON,退出码非零;不返回部分成功,不自动重试、切换身份或目标。按 error 模型及安全下一步处理。"
|
|
329
|
+
},
|
|
330
|
+
"notes": [
|
|
331
|
+
"--kdt-id 省略时使用本次有效上下文 shopId;显式提供的非法值不回退。两者都缺失时拒绝;目标范围、同店核验和服务端权限仍按本命令校验。",
|
|
332
|
+
"指定标签组 ID;店铺省略时使用当前上下文,显式非法值不回退;结果必须匹配目标;可选字段缺失省略,不补零、null 或空数组。",
|
|
333
|
+
"组和组内标签的状态均为 0 正常、1 禁用;本次 tags 不保证历史或全集完整性。",
|
|
334
|
+
"支持微商城单店、零售单店、连锁 D 总部、L 总部及 L 总部高级版;at 不代表跨店授权。",
|
|
335
|
+
"真实调用前须独立核实凭证与目标店铺绑定;本地上下文和结果店铺字段不能替代授权证明,远端链路尚未完成验证。",
|
|
336
|
+
"响应解析后检查 10 MiB、紧凑输出检查 5 MiB,超限整体失败;不是流式内存上限。",
|
|
337
|
+
"本地 --dry-run 不读取凭证、不联网;预览只证明构造计划,不证明对象存在或权限有效。真实执行仍需有效上下文及目标范围授权,at 声明不替代服务端授权。"
|
|
338
|
+
]
|
|
339
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { readTotal } = require('../../../../../execution/list-total');
|
|
4
|
+
|
|
5
|
+
const { withTargetShopDefault } = require('../../../../../execution/target-shop-default');
|
|
6
|
+
|
|
7
|
+
const { Command, Option } = require('commander');
|
|
8
|
+
const { resolveTargetShop } = require('../../../../../execution/target-shop');
|
|
9
|
+
const { validateCommandValue } = require('../../../../../execution/command-schema');
|
|
10
|
+
const { createShopQuery, failure, bindingPath } = require('../../../../../execution/shop-query');
|
|
11
|
+
const { object } = require('../../../../../execution/query-api');
|
|
12
|
+
const schema = require('./schema.json');
|
|
13
|
+
|
|
14
|
+
const command = 'customer.tagcategory.list';
|
|
15
|
+
const reject = (category, stage, scope, state, facts) =>
|
|
16
|
+
failure(command, category, stage, scope, state, facts);
|
|
17
|
+
|
|
18
|
+
function integer(text) {
|
|
19
|
+
if (typeof text !== 'string' || !/^[1-9]\d*$/.test(text) ||
|
|
20
|
+
!Number.isSafeInteger(Number(text))) throw new Error('invalid integer');
|
|
21
|
+
return Number(text);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function buildInput(options, context) {
|
|
25
|
+
const scope = resolveTargetShop(options, context, command);
|
|
26
|
+
try {
|
|
27
|
+
const input = { ...scope, pageNo: integer(options.pageNo), pageSize: integer(options.pageSize) };
|
|
28
|
+
if (options.keyword !== undefined) input.keyword = options.keyword.trim();
|
|
29
|
+
if (options.status !== undefined) input.status = options.status;
|
|
30
|
+
if (options.addRule !== undefined) input.addRule = options.addRule;
|
|
31
|
+
validateCommandValue(schema, 'input', input);
|
|
32
|
+
return input;
|
|
33
|
+
} catch { throw reject('parameter', 'input', scope); }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function project(data, input, facts) {
|
|
37
|
+
const scope = { kdtId: input.kdtId };
|
|
38
|
+
const invalid = () => reject('protocol', 'tag-categories-model', scope, 'sent', facts);
|
|
39
|
+
if (!object(data) || !object(data.paginator) || !Array.isArray(data.items)) throw invalid();
|
|
40
|
+
const page = data.paginator;
|
|
41
|
+
if (page.page !== input.pageNo || page.page_size !== input.pageSize) throw invalid();
|
|
42
|
+
const offset = (BigInt(input.pageNo) - 1n) * BigInt(input.pageSize);
|
|
43
|
+
const reportedTotal = readTotal(page, 'total_count', invalid);
|
|
44
|
+
const total = reportedTotal === null ? null : BigInt(reportedTotal);
|
|
45
|
+
if (data.items.length > input.pageSize ||
|
|
46
|
+
(total !== null && ((data.items.length > 0 && offset + BigInt(data.items.length) > total) ||
|
|
47
|
+
(data.items.length === 0 && offset < total)))) throw invalid();
|
|
48
|
+
const seen = new Set();
|
|
49
|
+
const tagCategories = data.items.map(row => {
|
|
50
|
+
if (!object(row) || row.kdt_id !== input.kdtId) {
|
|
51
|
+
throw reject('target_mismatch', 'tag-categories-model', scope, 'sent', facts);
|
|
52
|
+
}
|
|
53
|
+
if (seen.has(row.tag_category_id) || !Array.isArray(row.tags) ||
|
|
54
|
+
![0, 1].includes(row.tag_add_rule)) throw invalid();
|
|
55
|
+
seen.add(row.tag_category_id);
|
|
56
|
+
return {
|
|
57
|
+
tagCategoryId: row.tag_category_id, kdtId: row.kdt_id, tagCategoryName: row.tag_category_name,
|
|
58
|
+
addRule: row.tag_add_rule === 0 ? 'unique' : 'repeat',
|
|
59
|
+
tags: row.tags.map(tag => {
|
|
60
|
+
if (!object(tag)) throw invalid();
|
|
61
|
+
return { tagId: tag.tag_id, tagName: tag.tag_name };
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
const output = { data: {
|
|
66
|
+
tagCategories,
|
|
67
|
+
pagination: { pageNo: input.pageNo, pageSize: input.pageSize,
|
|
68
|
+
...(reportedTotal === null ? {} : { total: reportedTotal }),
|
|
69
|
+
hasMore: total === null ? null : BigInt(input.pageNo) * BigInt(input.pageSize) < total }
|
|
70
|
+
} };
|
|
71
|
+
try { validateCommandValue(schema, 'output', output); }
|
|
72
|
+
catch { throw invalid(); }
|
|
73
|
+
return output;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function createCommand({ context } = {}) {
|
|
77
|
+
return new Command('list')
|
|
78
|
+
.description('分页查询标签组及本页返回的组内标签,每次只取一页')
|
|
79
|
+
.allowExcessArguments(false)
|
|
80
|
+
.exitOverride(error => {
|
|
81
|
+
if (['commander.helpDisplayed', 'commander.version'].includes(error.code)) throw error;
|
|
82
|
+
throw reject('parameter', 'input');
|
|
83
|
+
})
|
|
84
|
+
.option('--kdt-id <id>', '目标店铺正安全整数;须与凭证店铺一致;省略时使用当前上下文店铺')
|
|
85
|
+
.option('--page-no <n>', '页码正安全整数,从 1 开始', '1')
|
|
86
|
+
.option('--page-size <n>', '每页 1–50 条,默认 20', '20')
|
|
87
|
+
.option('--keyword <text>', '标签组名称关键词,去除首尾空白后不能为空')
|
|
88
|
+
.addOption(new Option('--status <status>', '标签组状态;省略表示全部')
|
|
89
|
+
.choices(['normal', 'disabled']))
|
|
90
|
+
.addOption(new Option('--add-rule <rule>', '组内标签添加规则;省略表示全部')
|
|
91
|
+
.choices(['unique', 'repeat']))
|
|
92
|
+
.addOption(new Option('--format <format>', 'json 或 pretty,仅改变缩进')
|
|
93
|
+
.choices(['json', 'pretty']).default('json'))
|
|
94
|
+
.option('--dry-run', '本地预览店铺核验、筛选和一页请求,不读凭证、不联网')
|
|
95
|
+
.addHelpText('after', `
|
|
96
|
+
返回 data.tagCategories 和 data.pagination 的 pageNo/pageSize/total/hasMore。
|
|
97
|
+
hasMore 为 true 时保留筛选和 pageSize,将 pageNo 加 1 继续,不自动翻页。
|
|
98
|
+
组内标签不截断;外层末页不证明组内标签全集,不保证跨请求快照。
|
|
99
|
+
先核验凭证店铺,再发一次列表请求;空页也须通过店铺核验。
|
|
100
|
+
支持微商城单店及官方列明的连锁 L 总部/网店/门店;组织位置 all 不授予跨店权限。
|
|
101
|
+
失败整体为空 stdout;不重试、不切换店铺或身份,不降级为标签或客户关系查询。
|
|
102
|
+
契约:zan-saas schema customer.tagcategory.list
|
|
103
|
+
示例:zan-saas customer tagcategory list --kdt-id 63077 --page-size 20 --dry-run
|
|
104
|
+
`)
|
|
105
|
+
.action(async options => {
|
|
106
|
+
const input = buildInput(options, context);
|
|
107
|
+
const scope = { kdtId: input.kdtId };
|
|
108
|
+
const body = { page: input.pageNo, page_size: input.pageSize };
|
|
109
|
+
if (input.keyword !== undefined) body.tag_category_name = input.keyword;
|
|
110
|
+
if (input.status !== undefined) body.tag_category_status = input.status === 'normal' ? 0 : 1;
|
|
111
|
+
if (input.addRule !== undefined) body.tag_add_rule = input.addRule === 'unique' ? 0 : 1;
|
|
112
|
+
const preview = {
|
|
113
|
+
method: 'POST', path: schema.api.path, body, scope,
|
|
114
|
+
prerequisites: [{ method: 'POST', path: bindingPath, body: {} }]
|
|
115
|
+
};
|
|
116
|
+
validateCommandValue(schema, 'preview', preview);
|
|
117
|
+
let output = preview;
|
|
118
|
+
if (!options.dryRun) {
|
|
119
|
+
const read = await createShopQuery(scope, command);
|
|
120
|
+
const { data, facts } = await read(preview.path, body, 'tag-categories');
|
|
121
|
+
output = project(data, input, facts);
|
|
122
|
+
}
|
|
123
|
+
process.stdout.write(`${JSON.stringify(output, null, options.format === 'pretty' ? 2 : 0)}\n`);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = { kind: 'atomic', risk: 'read', at: 'all', createCommand: withTargetShopDefault(createCommand) };
|