@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,283 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"input": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"kdtId",
|
|
7
|
+
"yzOpenId"
|
|
8
|
+
],
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"kdtId": {
|
|
12
|
+
"$ref": "#/definitions/shopId"
|
|
13
|
+
},
|
|
14
|
+
"yzOpenId": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"pattern": "^\\S(?:[\\s\\S]*\\S)?$",
|
|
18
|
+
"description": "trim 后的客户 yzOpenId,不是手机号、微信 openId 或员工 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
|
+
"growth_account"
|
|
34
|
+
],
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"properties": {
|
|
37
|
+
"growth_account": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"required": [
|
|
40
|
+
"growth"
|
|
41
|
+
],
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"properties": {
|
|
44
|
+
"growth": {
|
|
45
|
+
"type": "integer",
|
|
46
|
+
"minimum": -9007199254740991,
|
|
47
|
+
"maximum": 9007199254740991,
|
|
48
|
+
"description": "当前成长值,安全整数;保留 0 与负值,不表示积分或等级。"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"preview": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"required": [
|
|
59
|
+
"method",
|
|
60
|
+
"path",
|
|
61
|
+
"body",
|
|
62
|
+
"scope",
|
|
63
|
+
"prerequisites"
|
|
64
|
+
],
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"properties": {
|
|
67
|
+
"method": {
|
|
68
|
+
"const": "POST"
|
|
69
|
+
},
|
|
70
|
+
"path": {
|
|
71
|
+
"const": "youzan.crm.customer.growth.get/2.0.0"
|
|
72
|
+
},
|
|
73
|
+
"body": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"required": [
|
|
76
|
+
"params"
|
|
77
|
+
],
|
|
78
|
+
"additionalProperties": false,
|
|
79
|
+
"properties": {
|
|
80
|
+
"params": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"required": [
|
|
83
|
+
"user"
|
|
84
|
+
],
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"properties": {
|
|
87
|
+
"user": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"required": [
|
|
90
|
+
"account_type",
|
|
91
|
+
"account_id"
|
|
92
|
+
],
|
|
93
|
+
"additionalProperties": false,
|
|
94
|
+
"properties": {
|
|
95
|
+
"account_type": {
|
|
96
|
+
"const": 5
|
|
97
|
+
},
|
|
98
|
+
"account_id": {
|
|
99
|
+
"type": "string"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"scope": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"required": [
|
|
110
|
+
"kdtId"
|
|
111
|
+
],
|
|
112
|
+
"additionalProperties": false,
|
|
113
|
+
"properties": {
|
|
114
|
+
"kdtId": {
|
|
115
|
+
"$ref": "#/definitions/shopId"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"prerequisites": {
|
|
120
|
+
"type": "array",
|
|
121
|
+
"minItems": 1,
|
|
122
|
+
"maxItems": 1,
|
|
123
|
+
"items": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"required": [
|
|
126
|
+
"method",
|
|
127
|
+
"path",
|
|
128
|
+
"body"
|
|
129
|
+
],
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"properties": {
|
|
132
|
+
"method": {
|
|
133
|
+
"const": "POST"
|
|
134
|
+
},
|
|
135
|
+
"path": {
|
|
136
|
+
"const": "youzan.shop.basic.get/3.0.0"
|
|
137
|
+
},
|
|
138
|
+
"body": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"additionalProperties": false
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"error": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"required": [
|
|
150
|
+
"success",
|
|
151
|
+
"code",
|
|
152
|
+
"message",
|
|
153
|
+
"details"
|
|
154
|
+
],
|
|
155
|
+
"additionalProperties": false,
|
|
156
|
+
"properties": {
|
|
157
|
+
"success": {
|
|
158
|
+
"const": false
|
|
159
|
+
},
|
|
160
|
+
"code": {
|
|
161
|
+
"const": -10001
|
|
162
|
+
},
|
|
163
|
+
"message": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"minLength": 1
|
|
166
|
+
},
|
|
167
|
+
"details": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"required": [
|
|
170
|
+
"category",
|
|
171
|
+
"stage",
|
|
172
|
+
"command",
|
|
173
|
+
"targetScope",
|
|
174
|
+
"requestState",
|
|
175
|
+
"nextStep"
|
|
176
|
+
],
|
|
177
|
+
"additionalProperties": false,
|
|
178
|
+
"properties": {
|
|
179
|
+
"category": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"enum": [
|
|
182
|
+
"validation",
|
|
183
|
+
"configuration",
|
|
184
|
+
"parameter",
|
|
185
|
+
"permission",
|
|
186
|
+
"authentication",
|
|
187
|
+
"scope_unresolved",
|
|
188
|
+
"transport",
|
|
189
|
+
"http",
|
|
190
|
+
"protocol",
|
|
191
|
+
"business_rejected",
|
|
192
|
+
"not_found",
|
|
193
|
+
"target_mismatch",
|
|
194
|
+
"ambiguous"
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
"stage": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"minLength": 1
|
|
200
|
+
},
|
|
201
|
+
"command": {
|
|
202
|
+
"const": "member.growth.get"
|
|
203
|
+
},
|
|
204
|
+
"targetScope": {
|
|
205
|
+
"type": "object",
|
|
206
|
+
"additionalProperties": false,
|
|
207
|
+
"properties": {
|
|
208
|
+
"kdtId": {
|
|
209
|
+
"$ref": "#/definitions/shopId"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"requestState": {
|
|
214
|
+
"enum": [
|
|
215
|
+
"not_sent",
|
|
216
|
+
"sent",
|
|
217
|
+
"unknown"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"nextStep": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"minLength": 1
|
|
223
|
+
},
|
|
224
|
+
"api": {
|
|
225
|
+
"type": "string"
|
|
226
|
+
},
|
|
227
|
+
"httpStatus": {
|
|
228
|
+
"type": "integer"
|
|
229
|
+
},
|
|
230
|
+
"businessCode": {
|
|
231
|
+
"anyOf": [
|
|
232
|
+
{
|
|
233
|
+
"type": "integer"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"type": "string"
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"gatewayCode": {
|
|
241
|
+
"anyOf": [
|
|
242
|
+
{
|
|
243
|
+
"type": "integer"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"type": "string"
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
"trace_id": {
|
|
251
|
+
"type": "string"
|
|
252
|
+
},
|
|
253
|
+
"request_id": {
|
|
254
|
+
"type": "string"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
"definitions": {
|
|
261
|
+
"shopId": {
|
|
262
|
+
"type": "integer",
|
|
263
|
+
"minimum": 1,
|
|
264
|
+
"maximum": 9007199254740991
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"api": {
|
|
268
|
+
"method": "POST",
|
|
269
|
+
"path": "youzan.crm.customer.growth.get/2.0.0"
|
|
270
|
+
},
|
|
271
|
+
"success": {
|
|
272
|
+
"description": "店铺核验通过且当前成长值满足模型后成功,不能用缺失结果代替零。"
|
|
273
|
+
},
|
|
274
|
+
"errors": {
|
|
275
|
+
"description": "失败 stdout 为空,stderr 为一份脱敏错误 JSON,退出码非零;不返回部分成功,不自动重试、切换身份或目标。按 error 模型及安全下一步处理。"
|
|
276
|
+
},
|
|
277
|
+
"notes": [
|
|
278
|
+
"查询一个已知客户的当前成长值,不查询客户档案、流水或规则;错误 141503101 不能解释为成长值 0。",
|
|
279
|
+
"--kdt-id 省略取有效上下文 shopId;缺少上下文时只有显式合法店铺的本地预览可运行。",
|
|
280
|
+
"缺必需内容、null 或错型整体失败,不补零;最多一次店铺核验和一次成长值读取。",
|
|
281
|
+
"本地 --dry-run 不读取凭证、不联网;预览只证明构造计划,不证明对象存在或权限有效。真实执行仍需有效上下文及目标范围授权,at 声明不替代服务端授权。"
|
|
282
|
+
]
|
|
283
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
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 { inputIssue, parseIntegerOption, constraints, modelAt } = require('../../../../../execution/error-details');
|
|
10
|
+
const { resolveTargetShop } = require('../../../../../execution/target-shop');
|
|
11
|
+
const { validateCommandValue } = require('../../../../../execution/command-schema');
|
|
12
|
+
const { parseDateTime, apiDateTime, normalizeTimes } = require('../../../../../execution/datetime');
|
|
13
|
+
const { parseDateTimeRange } = require('../../../../../execution/range');
|
|
14
|
+
const { createBoundShopQuery, failure, bindingPath } = require('../../../../../execution/shop-query');
|
|
15
|
+
const { object } = require('../../../../../execution/query-api');
|
|
16
|
+
const schema = require('./schema.json');
|
|
17
|
+
|
|
18
|
+
const command = 'member.growth-log.list';
|
|
19
|
+
const MAX_PAGE_NO = 2147483647;
|
|
20
|
+
const MAX_RESPONSE_BYTES = 10 * 1024 * 1024;
|
|
21
|
+
const MAX_OUTPUT_BYTES = 5 * 1024 * 1024;
|
|
22
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
23
|
+
const nextStep = '核对原店铺、客户标识、时间窗口和服务端授权;不自动重放、翻页、切换身份或店铺。';
|
|
24
|
+
|
|
25
|
+
function reject(category, stage, scope = {}, requestState = 'not_sent', facts = {}) {
|
|
26
|
+
const error = failure(command, category, stage, scope, requestState, facts);
|
|
27
|
+
error.cliDetails.nextStep = nextStep;
|
|
28
|
+
return error;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function parseWindow(value, now) {
|
|
32
|
+
let range;
|
|
33
|
+
try {
|
|
34
|
+
range = parseDateTimeRange(value, { precision: 'seconds', requireBoth: true });
|
|
35
|
+
} catch {
|
|
36
|
+
throw inputIssue('/createdAt', 'invalid_format', { format: '北京时间 YYYY-MM-DD HH:mm:ss..YYYY-MM-DD HH:mm:ss,必须两端且开始不晚于结束;不接受非零毫秒' });
|
|
37
|
+
}
|
|
38
|
+
const start = parseDateTime(range.start);
|
|
39
|
+
const end = parseDateTime(range.end);
|
|
40
|
+
if (start < now - 360 * DAY_MS || end > now || end - start > 90 * DAY_MS) {
|
|
41
|
+
throw inputIssue('/createdAt', 'constraint', { format: '开始须在最近360天内,结束不晚于当前时刻,跨度不超过90天' });
|
|
42
|
+
}
|
|
43
|
+
return { start: range.start, end: range.end };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function body(input) {
|
|
47
|
+
return { params: JSON.stringify({
|
|
48
|
+
user: { account_type: 5, account_id: input.yzOpenId },
|
|
49
|
+
page: input.pageNo,
|
|
50
|
+
page_size: input.pageSize,
|
|
51
|
+
begin_time: apiDateTime(input.createdAt.start),
|
|
52
|
+
end_time: apiDateTime(input.createdAt.end)
|
|
53
|
+
}) };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function project(data, input, facts) {
|
|
57
|
+
const scope = { kdtId: input.kdtId };
|
|
58
|
+
const invalid = (category, path, reason = 'constraint', stage = 'logs-model') => {
|
|
59
|
+
const error = reject(category, stage, scope, 'sent', facts);
|
|
60
|
+
if (path) error.issues = [{ source: 'output', path, reason,
|
|
61
|
+
expected: constraints(modelAt(schema, 'output', path)) }];
|
|
62
|
+
return error;
|
|
63
|
+
};
|
|
64
|
+
try {
|
|
65
|
+
if (!object(data) || !Array.isArray(data.items)) throw invalid('protocol', '/data/logs', 'invalid_type');
|
|
66
|
+
if (data.items.length > input.pageSize) throw invalid('limit', '/data/logs', 'out_of_range');
|
|
67
|
+
const invalidPage = (field = '') => invalid('protocol', `/data/pagination${field}`, 'constraint', 'pagination');
|
|
68
|
+
if (!object(data.paginator)) throw invalidPage();
|
|
69
|
+
const paginator = data.paginator;
|
|
70
|
+
const total = readTotal(paginator, 'total_count', () => invalidPage('/total'));
|
|
71
|
+
if (!Number.isSafeInteger(paginator.page) || paginator.page !== input.pageNo) throw invalidPage('/pageNo');
|
|
72
|
+
if (!Number.isSafeInteger(paginator.page_size) || paginator.page_size !== input.pageSize) throw invalidPage('/pageSize');
|
|
73
|
+
if (total !== null && (total > MAX_PAGE_NO || data.items.length > total)) throw invalidPage('/total');
|
|
74
|
+
const logs = data.items.map((item, index) => {
|
|
75
|
+
const path = `/data/logs/${index}`;
|
|
76
|
+
if (!object(item)) throw invalid('protocol', path, 'invalid_type');
|
|
77
|
+
if (!Number.isSafeInteger(item.amount)) throw invalid('protocol', `${path}/amount`, 'invalid_type');
|
|
78
|
+
if (!Number.isSafeInteger(item.event_type)) throw invalid('protocol', `${path}/eventType`, 'invalid_type');
|
|
79
|
+
if (item.event_type < -2147483648 || item.event_type > 2147483647) {
|
|
80
|
+
throw invalid('protocol', `${path}/eventType`, 'out_of_range');
|
|
81
|
+
}
|
|
82
|
+
if (!Number.isSafeInteger(item.created_at)) throw invalid('protocol', `${path}/createdAt`, 'invalid_format');
|
|
83
|
+
let createdAt;
|
|
84
|
+
try {
|
|
85
|
+
createdAt = normalizeTimes(item.created_at, modelAt(schema, 'output', `${path}/createdAt`), schema.definitions);
|
|
86
|
+
} catch {
|
|
87
|
+
throw invalid('protocol', `${path}/createdAt`, 'invalid_format');
|
|
88
|
+
}
|
|
89
|
+
const log = { amount: item.amount, eventType: item.event_type, createdAt };
|
|
90
|
+
for (const [source, target] of [['description', 'description'], ['biz_value', 'bizValue']]) {
|
|
91
|
+
if (Object.hasOwn(item, source)) {
|
|
92
|
+
if (typeof item[source] !== 'string') throw invalid('protocol', `${path}/${target}`, 'invalid_type');
|
|
93
|
+
log[target] = item[source];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return log;
|
|
97
|
+
});
|
|
98
|
+
const raw = { data: { logs, pagination: {
|
|
99
|
+
pageNo: paginator.page,
|
|
100
|
+
pageSize: paginator.page_size,
|
|
101
|
+
...(total === null ? {} : { total }),
|
|
102
|
+
hasMore: total === null ? null : BigInt(paginator.page) * BigInt(paginator.page_size) < BigInt(total)
|
|
103
|
+
} } };
|
|
104
|
+
validateCommandValue(schema, 'output', raw);
|
|
105
|
+
return raw;
|
|
106
|
+
} catch (error) {
|
|
107
|
+
if (error?.cliDetails) throw error;
|
|
108
|
+
const failed = invalid('protocol');
|
|
109
|
+
if (error.issues) failed.issues = error.issues;
|
|
110
|
+
if (error.issuesTruncated) failed.issuesTruncated = true;
|
|
111
|
+
throw failed;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function createCommand({ context, now = () => Date.now() } = {}) {
|
|
116
|
+
const leaf = new DiagnosticCommand('list', { path: command, schema, parameterCategory: 'parameter' })
|
|
117
|
+
.description('分页查询指定客户在时间窗口内的成长值变更记录')
|
|
118
|
+
.allowExcessArguments(false)
|
|
119
|
+
.requiredOption('--yz-open-id <id>', '必填:客户 yzOpenId;不是手机号、员工 ID 或微信 openId')
|
|
120
|
+
.requiredOption('--created-at <range>', '必填:北京时间 YYYY-MM-DD HH:mm:ss[.SSS]..YYYY-MM-DD HH:mm:ss[.SSS],非零毫秒拒绝')
|
|
121
|
+
.option('--kdt-id <id>', '目标店铺正安全整数;省略取有效上下文 shopId')
|
|
122
|
+
.option('--page-no <n>', '页码 1..2147483647;每次只读一页', '1')
|
|
123
|
+
.option('--page-size <n>', '每页容量 1..50;默认 10', '10')
|
|
124
|
+
.addOption(new Option('--format <format>', 'json 或 pretty,仅改变缩进')
|
|
125
|
+
.choices(['json', 'pretty']).default('json'))
|
|
126
|
+
.option('--dry-run', '本地预览请求计划,不读取凭证、不联网')
|
|
127
|
+
.addHelpText('after', `
|
|
128
|
+
输出固定为 data.logs 和 data.pagination,保留源顺序、重复、0 与有符号 amount。
|
|
129
|
+
createdAt 将 Unix 秒转换为北京时间三位毫秒;不按数字位数猜测毫秒,不解释增减方向或等级变化。
|
|
130
|
+
时间窗口必须显式提供两端,允许相等;起点不早于当前时刻前 360 天,跨度不超过 90 天,终点不晚于当前时刻。
|
|
131
|
+
主请求固定使用 account_type=5,params 是 JSON 字符串;不提供事件筛选、排序、自动翻页、重试或补查。
|
|
132
|
+
先用同一目标和凭证核验店铺,再读取一页成长流水;失败 stdout 为空,不返回部分结果。
|
|
133
|
+
真实执行需要有效四字段上下文及同店授权;at: all 和店铺核验不证明员工 OAuth 权限。
|
|
134
|
+
最多两次请求,每请求 10 秒;合计响应最多 10 MiB,输出含缩进及换行最多 5 MiB,超限整体失败。
|
|
135
|
+
契约:zan-saas schema member.growth-log.list
|
|
136
|
+
示例:zan-saas member growth-log list --yz-open-id customer-1 --created-at "2026-11-01 00:00:00..2026-11-05 23:59:59" --kdt-id 63077 --dry-run
|
|
137
|
+
`)
|
|
138
|
+
.action(async options => {
|
|
139
|
+
let scope;
|
|
140
|
+
try {
|
|
141
|
+
scope = resolveTargetShop(options, context, command);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
if (error?.cliDetails?.stage === 'validation') error.cliDetails.stage = 'input';
|
|
144
|
+
if (error?.cliDetails?.stage === 'scope') error.cliDetails.stage = 'context';
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
let input;
|
|
148
|
+
try {
|
|
149
|
+
if (/[\u0000-\u001f\u007f-\u009f]/u.test(options.yzOpenId) ||
|
|
150
|
+
!options.yzOpenId.trim()) throw inputIssue('/yzOpenId', 'invalid_format', constraints(modelAt(schema, 'input', '/yzOpenId')));
|
|
151
|
+
input = {
|
|
152
|
+
...scope,
|
|
153
|
+
yzOpenId: options.yzOpenId.trim(),
|
|
154
|
+
pageNo: parseIntegerOption(options.pageNo, schema, '/pageNo'),
|
|
155
|
+
pageSize: parseIntegerOption(options.pageSize, schema, '/pageSize'),
|
|
156
|
+
createdAt: parseWindow(options.createdAt, now())
|
|
157
|
+
};
|
|
158
|
+
validateCommandValue(schema, 'input', input);
|
|
159
|
+
} catch (error) {
|
|
160
|
+
error.inputScope = scope;
|
|
161
|
+
if (error.issues?.some(issue => issue.path === '/createdAt')) error.cliDetails = reject('validation', 'input', scope).cliDetails;
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
const request = { method: schema.api.method, path: schema.api.path, body: body(input) };
|
|
165
|
+
const preview = {
|
|
166
|
+
scope: { kdtId: input.kdtId },
|
|
167
|
+
requests: [
|
|
168
|
+
{ method: 'POST', path: bindingPath, body: {} },
|
|
169
|
+
request
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
validateCommandValue(schema, 'preview', preview);
|
|
173
|
+
if (options.dryRun) {
|
|
174
|
+
process.stdout.write(`${JSON.stringify(preview, null, options.format === 'pretty' ? 2 : 0)}\n`);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
let responseBytes = 0;
|
|
178
|
+
const { read } = await createBoundShopQuery({ kdtId: input.kdtId }, command, 'shop-binding', {
|
|
179
|
+
onResponse: response => { responseBytes += response.responseBytes; },
|
|
180
|
+
transportOptions: { maxResponseBytes: () => MAX_RESPONSE_BYTES - responseBytes, shopApp: false }
|
|
181
|
+
});
|
|
182
|
+
const response = await read(request.path, request.body, 'logs');
|
|
183
|
+
if (responseBytes > MAX_RESPONSE_BYTES) {
|
|
184
|
+
throw reject('limit', 'logs', { kdtId: input.kdtId }, 'sent', response.facts);
|
|
185
|
+
}
|
|
186
|
+
const output = project(response.data, input, response.facts);
|
|
187
|
+
const text = `${JSON.stringify(output, null, options.format === 'pretty' ? 2 : 0)}\n`;
|
|
188
|
+
if (Buffer.byteLength(text) > MAX_OUTPUT_BYTES) {
|
|
189
|
+
throw reject('limit', 'output', { kdtId: input.kdtId }, 'sent', response.facts);
|
|
190
|
+
}
|
|
191
|
+
process.stdout.write(text);
|
|
192
|
+
});
|
|
193
|
+
const seen = new Set();
|
|
194
|
+
for (const option of leaf.options) {
|
|
195
|
+
leaf.on(`option:${option.name()}`, () => {
|
|
196
|
+
if (seen.has(option.name())) throw reject('parameter', 'input');
|
|
197
|
+
seen.add(option.name());
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return leaf;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
module.exports = { kind: 'atomic', risk: 'read', at: 'all', createCommand: withTargetShopDefault(createCommand) };
|