@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,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 3,
|
|
3
|
+
"domain": "customer",
|
|
4
|
+
"businessCommands": [
|
|
5
|
+
{
|
|
6
|
+
"path": "customer.customer.get",
|
|
7
|
+
"kind": "atomic",
|
|
8
|
+
"risk": "read",
|
|
9
|
+
"availability": "available",
|
|
10
|
+
"at": "all",
|
|
11
|
+
"module": "customer/customer/get/command.js",
|
|
12
|
+
"fingerprint": "2e9565e2ab0891042d85257c31c721746ffc183f7613e2483f1fae8652c6889f"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "customer.customer.list",
|
|
16
|
+
"kind": "atomic",
|
|
17
|
+
"risk": "read",
|
|
18
|
+
"availability": "available",
|
|
19
|
+
"at": "all",
|
|
20
|
+
"module": "customer/customer/list/command.js",
|
|
21
|
+
"fingerprint": "fba8479d7ba8519d0cd3daf3bbeec97c4c7440241f08ab06db16645a9e46ce0b"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "customer.customer.scan",
|
|
25
|
+
"kind": "atomic",
|
|
26
|
+
"risk": "read",
|
|
27
|
+
"availability": "available",
|
|
28
|
+
"at": "all",
|
|
29
|
+
"module": "customer/customer/scan/command.js",
|
|
30
|
+
"fingerprint": "080a670afe0bc3ad2c3cbb81d42ef6c3010719135b360af08edda39a87de1b10"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "customer.customer-tag.get",
|
|
34
|
+
"kind": "atomic",
|
|
35
|
+
"risk": "read",
|
|
36
|
+
"availability": "available",
|
|
37
|
+
"at": "all",
|
|
38
|
+
"module": "customer/customer-tag/get/command.js",
|
|
39
|
+
"fingerprint": "4a58ad508c8e58b53eef31c755d7682a44a09da12049dc66486b7b7b6c0dc04e"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "customer.customer-tag.list",
|
|
43
|
+
"kind": "atomic",
|
|
44
|
+
"risk": "read",
|
|
45
|
+
"availability": "available",
|
|
46
|
+
"at": "all",
|
|
47
|
+
"module": "customer/customer-tag/list/command.js",
|
|
48
|
+
"fingerprint": "60e6f754b729a536d83aa3c01a5f0069a2bdb3d927129cdc4497e6f04cff2b47"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "customer.segment.list",
|
|
52
|
+
"kind": "atomic",
|
|
53
|
+
"risk": "read",
|
|
54
|
+
"availability": "available",
|
|
55
|
+
"at": "all",
|
|
56
|
+
"module": "customer/segment/list/command.js",
|
|
57
|
+
"fingerprint": "de16f1c293580825ea5ebf4cdf01fccbc8af27de5852027537228ec1467b5171"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "customer.segment-customer.list",
|
|
61
|
+
"kind": "atomic",
|
|
62
|
+
"risk": "read",
|
|
63
|
+
"availability": "available",
|
|
64
|
+
"at": "all",
|
|
65
|
+
"module": "customer/segment-customer/list/command.js",
|
|
66
|
+
"fingerprint": "280e382e6fed355e6901888a0f7c2fb6923ea6ba809d4ec8e3c1e438b84ac913"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "customer.tag.get",
|
|
70
|
+
"kind": "atomic",
|
|
71
|
+
"risk": "read",
|
|
72
|
+
"availability": "available",
|
|
73
|
+
"at": "shop",
|
|
74
|
+
"module": "customer/tag/get/command.js",
|
|
75
|
+
"fingerprint": "306903ec91ccca08a1a5d52877b2eb253db866b7ef443dc4f6e5607f4d35cc01"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "customer.tagcategory.get",
|
|
79
|
+
"kind": "atomic",
|
|
80
|
+
"risk": "read",
|
|
81
|
+
"availability": "available",
|
|
82
|
+
"at": "all",
|
|
83
|
+
"module": "customer/tagcategory/get/command.js",
|
|
84
|
+
"fingerprint": "4a205a901d0842b5e39d0455b6d5a8adde3cc480fb9167f21a04e6d8b03feed4"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"path": "customer.tagcategory.list",
|
|
88
|
+
"kind": "atomic",
|
|
89
|
+
"risk": "read",
|
|
90
|
+
"availability": "available",
|
|
91
|
+
"at": "all",
|
|
92
|
+
"module": "customer/tagcategory/list/command.js",
|
|
93
|
+
"fingerprint": "988fe0d0c3e79b9f3abbb91be159a0d727319bbd5d96ea0406526d7e77828cb5"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const schema = require('./schema.json');
|
|
4
|
+
const { normalizeMoney } = require('../../../../../execution/money');
|
|
5
|
+
const { normalizeTimes } = require('../../../../../execution/datetime');
|
|
6
|
+
const { validateCommandValue } = require('../../../../../execution/command-schema');
|
|
7
|
+
const { getNestedValue, validateRequiredModules } = require('../../../../../execution/command-io');
|
|
8
|
+
const {
|
|
9
|
+
QueryError, object, assertSafeNumbers, assertApiSuccess
|
|
10
|
+
} = require('../../../../../execution/query-api');
|
|
11
|
+
|
|
12
|
+
const command = 'customer.customer.get';
|
|
13
|
+
const nextStep = '核对本条命令的 help/schema、原店铺和客户标识及服务端授权;不自动切换目标、身份或创建客户。';
|
|
14
|
+
const moduleSources = {
|
|
15
|
+
level_summary: { selector: 'benefit_level' },
|
|
16
|
+
valuecard_balance: { selector: 'prepaid', balanceField: 'prepaid_balance' },
|
|
17
|
+
valuecard_gift: { selector: 'giftcard', balanceField: 'giftcard_balance' }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function upstreamModule(name) {
|
|
21
|
+
return moduleSources[name]?.selector || name;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function failure(category, stage, scope = {}, requestState = 'not_sent', facts = {}) {
|
|
25
|
+
const error = new QueryError(category, stage, scope, facts, requestState, command, nextStep);
|
|
26
|
+
error.message = `客户查询失败:${category}(${stage})。请查看 zan-saas customer customer get --help。`;
|
|
27
|
+
return error;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function assertCustomerSuccess(result, scope, facts) {
|
|
31
|
+
assertApiSuccess(result, category => {
|
|
32
|
+
throw failure(category, 'customer', scope, 'sent', facts);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function moduleModel(name) {
|
|
37
|
+
const reference = schema.output.properties.data.properties[name].$ref;
|
|
38
|
+
return schema.definitions[reference.slice('#/definitions/'.length)];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function projectFields(value, model) {
|
|
42
|
+
if (model.$ref) model = schema.definitions[model.$ref.slice('#/definitions/'.length)];
|
|
43
|
+
if (Array.isArray(value) && model.items) {
|
|
44
|
+
return value.map(item => projectFields(item, model.items));
|
|
45
|
+
}
|
|
46
|
+
if (object(value) && model.properties) {
|
|
47
|
+
return Object.fromEntries(Object.entries(model.properties)
|
|
48
|
+
.filter(([key]) => Object.hasOwn(value, key))
|
|
49
|
+
.map(([key, child]) => [key, projectFields(value[key], child)]));
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function adaptCustomer(result, input, facts) {
|
|
55
|
+
const { include, kdtId, yzOpenId } = input;
|
|
56
|
+
const scope = { kdtId };
|
|
57
|
+
const invalid = () => failure('protocol', 'customer-model', scope, 'sent', facts);
|
|
58
|
+
if (!object(result.data) || result.data.yz_open_id !== yzOpenId) throw invalid();
|
|
59
|
+
try {
|
|
60
|
+
const data = {};
|
|
61
|
+
for (const name of ['user_base', ...include]) {
|
|
62
|
+
const source = getNestedValue(result, schema.modules[name].upstreamPath);
|
|
63
|
+
if (!object(source)) throw invalid();
|
|
64
|
+
const model = moduleModel(name);
|
|
65
|
+
const balanceField = moduleSources[name]?.balanceField;
|
|
66
|
+
const fields = balanceField
|
|
67
|
+
? (Object.hasOwn(source, balanceField) ? { totalBalance: source[balanceField] } : {})
|
|
68
|
+
: source;
|
|
69
|
+
const projected = projectFields(fields, model);
|
|
70
|
+
assertSafeNumbers(projected);
|
|
71
|
+
data[name] = normalizeTimes(normalizeMoney(projected, model), model, schema.definitions);
|
|
72
|
+
}
|
|
73
|
+
validateRequiredModules(data, new Set(include), ['user_base']);
|
|
74
|
+
const output = { data };
|
|
75
|
+
validateCommandValue(schema, 'output', output);
|
|
76
|
+
return output;
|
|
77
|
+
} catch {
|
|
78
|
+
throw invalid();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = { failure, assertCustomerSuccess, adaptCustomer, upstreamModule };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { withTargetShopDefault } = require('../../../../../execution/target-shop-default');
|
|
4
|
+
|
|
5
|
+
const { Option } = require('commander');
|
|
6
|
+
const { DiagnosticCommand } = require('../../../../../cli/diagnostic-command');
|
|
7
|
+
const { inputIssue, withInputScope, constraints, modelAt } = require('../../../../../execution/error-details');
|
|
8
|
+
const schema = require('./schema.json');
|
|
9
|
+
const { queryDefinition, validateCommandValue } = require('../../../../../execution/command-schema');
|
|
10
|
+
const { parseIncludeModules } = require('../../../../../execution/command-io');
|
|
11
|
+
const { readApiEnvelope } = require('../../../../../execution/query-api');
|
|
12
|
+
const { failure, assertCustomerSuccess, adaptCustomer, upstreamModule } = require('./adapter');
|
|
13
|
+
|
|
14
|
+
const { includeModules } = queryDefinition(schema);
|
|
15
|
+
|
|
16
|
+
function buildInput(options, context) {
|
|
17
|
+
if (typeof options.kdtId !== 'string' || options.kdtId !== options.kdtId.trim() ||
|
|
18
|
+
!/^[1-9]\d*$/.test(options.kdtId) || !Number.isSafeInteger(Number(options.kdtId))) {
|
|
19
|
+
throw inputIssue('/kdtId', 'invalid_format', constraints(modelAt(schema, 'input', '/kdtId')));
|
|
20
|
+
}
|
|
21
|
+
const input = withInputScope({ kdtId: Number(options.kdtId) }, () => {
|
|
22
|
+
if (typeof options.yzOpenId !== 'string') {
|
|
23
|
+
throw inputIssue('/yzOpenId', 'invalid_type', constraints(modelAt(schema, 'input', '/yzOpenId')));
|
|
24
|
+
}
|
|
25
|
+
const normalized = { kdtId: Number(options.kdtId), yzOpenId: options.yzOpenId.trim(),
|
|
26
|
+
include: [...parseIncludeModules(options.include, includeModules, '/include')] };
|
|
27
|
+
validateCommandValue(schema, 'input', normalized);
|
|
28
|
+
return normalized;
|
|
29
|
+
});
|
|
30
|
+
const scope = { kdtId: input.kdtId };
|
|
31
|
+
if (context?.orgType === 'shop' && String(input.kdtId) !== context.shopId) {
|
|
32
|
+
throw failure('permission', 'scope', scope);
|
|
33
|
+
}
|
|
34
|
+
return input;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function requestFor(input) {
|
|
38
|
+
return {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
path: schema.api.path,
|
|
41
|
+
body: {
|
|
42
|
+
kdt_id: input.kdtId, yz_open_id: input.yzOpenId,
|
|
43
|
+
fields: ['user_base', ...input.include.map(upstreamModule)].join(',')
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function execute(input, request) {
|
|
49
|
+
const scope = { kdtId: input.kdtId };
|
|
50
|
+
const { result, facts } = await readApiEnvelope(request.path, request.body,
|
|
51
|
+
(category, details, state, stage) => failure(category, stage, scope, state, details));
|
|
52
|
+
assertCustomerSuccess(result, scope, facts);
|
|
53
|
+
return adaptCustomer(result, input, facts);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function createCommand({ context } = {}) {
|
|
57
|
+
return new DiagnosticCommand('get', { path: 'customer.customer.get', schema, parameterCategory: 'parameter' })
|
|
58
|
+
.description('查询客户基础资料,可追加标签、等级关系、积分、交易及资产摘要')
|
|
59
|
+
.allowExcessArguments(false)
|
|
60
|
+
.option('--kdt-id <id>', '目标店铺 ID,正安全整数;省略时使用当前上下文店铺')
|
|
61
|
+
.requiredOption('--yz-open-id <id>', '必填:该店铺客户的 yzOpenId,非空字符串;不是手机号')
|
|
62
|
+
.option('--include <modules>', `追加模块:${includeModules.join(', ')};始终请求 user_base`)
|
|
63
|
+
.addOption(new Option('--format <format>', 'json 或 pretty,仅改变缩进')
|
|
64
|
+
.choices(['json', 'pretty']).default('json'))
|
|
65
|
+
.option('--dry-run', '仅本地校验并预览请求,不读凭证、不联网')
|
|
66
|
+
.addHelpText('after', `
|
|
67
|
+
默认返回 data.user_base。--include 追加模块,不替换基础资料;空值、空项和未知模块均拒绝。
|
|
68
|
+
基础视图只选 yz_open_id、name、show_name、mobile、gender、created_at;除客户主键外可省略。
|
|
69
|
+
模块按字段对象组织,如 data.tags.tags、data.level.level_infos、data.credit.points,不重复tag_ids。
|
|
70
|
+
level 是免费/付费等级关系摘要;level_summary 是单值等级摘要,不据此推算等级关系或会员身份。
|
|
71
|
+
valuecard_balance、valuecard_gift 分别是余额卡、礼品卡余额摘要,均以 totalBalance 返回。
|
|
72
|
+
两类摘要的归集范围未明确,不相加为客户总资产,不断言与逐卡余额求和相等。
|
|
73
|
+
benefit_cards 的 id 是客户卡摘要标识,不能当作 cardAlias 或 cardNo 使用。
|
|
74
|
+
时间点统一输出北京时间 YYYY-MM-DD HH:mm:ss.SSS,字段声明的业务哨兵保留。
|
|
75
|
+
behavior只含购买/退款次数、金额和最近购买时间,不含全渠道汇总;credit只含当前points。
|
|
76
|
+
四个已定义金额由接口分整数精确转为元两位字符串,例如 "159.00",不能再次除以100。
|
|
77
|
+
只返回所选字段,数组元素也按模型裁取;未选择的API字段或新增扩展不影响本视图。
|
|
78
|
+
可选明细缺失时省略,不证明无值;已选字段错型/null或请求模块缺少核心内容时整体失败。
|
|
79
|
+
只支持官方 success=true、数字code=200、扁平data信封,不猜测旧response.customer包装。
|
|
80
|
+
不提供手机号定位、客户列表、入会、发卡或任意字段选择,不派生会员身份。
|
|
81
|
+
完整字段、单位、必需内容和可选明细规则见 zan-saas schema customer.customer.get。
|
|
82
|
+
执行需要有效的用户、组织与店铺上下文,可通过登录后选店或 ZAN_SAAS_CONTEXT 提供;目标范围和服务端授权按本命令契约校验,公共调用前置见 zan-saas skills read zan-saas-shared。
|
|
83
|
+
非总部目标须等于上下文shopId;总部显式目标的归属和权限由服务端校验。
|
|
84
|
+
缺少上下文可本地预览,已提供无效或冲突上下文则拒绝。
|
|
85
|
+
一次调用至多1个业务请求,不自动重试、重定向、切店或换身份。
|
|
86
|
+
保留服务端查询扩展点默认值;只读分类不证明服务端自定义扩展无副作用。
|
|
87
|
+
成功/预览stdout为一份JSON,失败stdout为空、stderr为错误JSON。当前未证明真实员工网关和字段可见性。
|
|
88
|
+
|
|
89
|
+
示例:
|
|
90
|
+
zan-saas customer customer get --kdt-id 63077 --yz-open-id customer-1
|
|
91
|
+
zan-saas customer customer get --kdt-id 63077 --yz-open-id customer-1 --include tags,level --format pretty
|
|
92
|
+
zan-saas customer customer get --kdt-id 63077 --yz-open-id customer-1 --include credit,valuecard_balance --dry-run
|
|
93
|
+
`)
|
|
94
|
+
.action(async options => {
|
|
95
|
+
const input = buildInput(options, context);
|
|
96
|
+
const request = requestFor(input);
|
|
97
|
+
let result;
|
|
98
|
+
if (options.dryRun) {
|
|
99
|
+
validateCommandValue(schema, 'preview', request);
|
|
100
|
+
result = request;
|
|
101
|
+
} else result = await execute(input, request);
|
|
102
|
+
process.stdout.write(`${JSON.stringify(result, null, options.format === 'pretty' ? 2 : 0)}\n`);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = { kind: 'atomic', risk: 'read', at: 'all', createCommand: withTargetShopDefault(createCommand) };
|