@youzan-cloud/zan-saas-cli 0.0.0-stage → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEPENDENCIES.json +50 -0
- package/INSTALL.md +79 -0
- package/LICENSE +21 -0
- package/NOTICE +1 -0
- package/README.md +151 -2
- package/THIRD_PARTY_NOTICES.txt +162 -0
- package/bin/zan-saas-cli.js +28 -0
- package/internal/registry/index.js +123 -0
- package/internal/registry/manifest.json +424 -0
- package/npm-shrinkwrap.json +86 -0
- package/package.json +33 -4
- package/skills/README.md +30 -0
- package/skills/zan-saas/SKILL.md +54 -0
- package/skills/zan-saas/references/host-entry.md +25 -0
- package/skills/zan-saas-access/SKILL.md +37 -0
- package/skills/zan-saas-access/references/role-list.md +11 -0
- package/skills/zan-saas-access/references/staff-perms-get.md +11 -0
- package/skills/zan-saas-aftersale/SKILL.md +31 -0
- package/skills/zan-saas-aftersale/references/case-list.md +13 -0
- package/skills/zan-saas-aftersale/references/case-scan.md +31 -0
- package/skills/zan-saas-benefit/SKILL.md +46 -0
- package/skills/zan-saas-benefit/references/card-get.md +7 -0
- package/skills/zan-saas-benefit/references/card-grant-list.md +11 -0
- package/skills/zan-saas-benefit/references/card-list.md +7 -0
- package/skills/zan-saas-benefit/references/customer-card-get.md +7 -0
- package/skills/zan-saas-benefit/references/customer-card-list.md +7 -0
- package/skills/zan-saas-coupon/SKILL.md +41 -0
- package/skills/zan-saas-coupon/references/activity-get.md +11 -0
- package/skills/zan-saas-coupon/references/activity-list.md +15 -0
- package/skills/zan-saas-coupon/references/voucher-get.md +13 -0
- package/skills/zan-saas-coupon/references/voucher-list.md +25 -0
- package/skills/zan-saas-customer/SKILL.md +73 -0
- package/skills/zan-saas-customer/references/customer-scan.md +11 -0
- package/skills/zan-saas-customer/references/segment-list.md +22 -0
- package/skills/zan-saas-fulfillment/SKILL.md +36 -0
- package/skills/zan-saas-fulfillment/references/delivery-get.md +11 -0
- package/skills/zan-saas-fulfillment/references/shipment-list.md +11 -0
- package/skills/zan-saas-fulfillment/references/waybill-get.md +9 -0
- package/skills/zan-saas-interaction/SKILL.md +37 -0
- package/skills/zan-saas-interaction/references/lottery-get.md +11 -0
- package/skills/zan-saas-interaction/references/lottery-list.md +19 -0
- package/skills/zan-saas-item/SKILL.md +61 -0
- package/skills/zan-saas-item/references/attribute-list.md +11 -0
- package/skills/zan-saas-item/references/brand-list.md +7 -0
- package/skills/zan-saas-item/references/classification-get.md +7 -0
- package/skills/zan-saas-item/references/classification-list.md +7 -0
- package/skills/zan-saas-item/references/group-list.md +9 -0
- package/skills/zan-saas-item/references/item-content.md +9 -0
- package/skills/zan-saas-item/references/item-get.md +9 -0
- package/skills/zan-saas-item/references/item-search.md +23 -0
- package/skills/zan-saas-item/references/product-identity.md +11 -0
- package/skills/zan-saas-member/SKILL.md +41 -0
- package/skills/zan-saas-member/references/customer-level-get.md +7 -0
- package/skills/zan-saas-member/references/growth-log-list.md +17 -0
- package/skills/zan-saas-member/references/membership-get.md +7 -0
- package/skills/zan-saas-order/SKILL.md +56 -0
- package/skills/zan-saas-order/references/order-get.md +26 -0
- package/skills/zan-saas-order/references/order-list.md +25 -0
- package/skills/zan-saas-order/references/order-scan.md +35 -0
- package/skills/zan-saas-org/SKILL.md +37 -0
- package/skills/zan-saas-org/references/staff-get.md +15 -0
- package/skills/zan-saas-org/references/staff-role-get.md +11 -0
- package/skills/zan-saas-org/references/unit-get.md +11 -0
- package/skills/zan-saas-org/references/unit-list.md +15 -0
- package/skills/zan-saas-points/SKILL.md +42 -0
- package/skills/zan-saas-points/references/account-get.md +7 -0
- package/skills/zan-saas-points/references/log-list.md +17 -0
- package/skills/zan-saas-points/references/rule-list.md +2 -0
- package/skills/zan-saas-privacy/SKILL.md +30 -0
- package/skills/zan-saas-privacy/references/field-decrypt.md +19 -0
- package/skills/zan-saas-shared/SKILL.md +94 -0
- package/skills/zan-saas-shared/references/authentication.md +52 -0
- package/skills/zan-saas-shared/references/value-processing.md +27 -0
- package/skills/zan-saas-stock/SKILL.md +28 -0
- package/skills/zan-saas-stock/references/log-list.md +11 -0
- package/skills/zan-saas-valuecard/SKILL.md +37 -0
- package/skills/zan-saas-valuecard/references/card-get.md +13 -0
- package/skills/zan-saas-valuecard/references/card-list.md +11 -0
- package/src/auth/browser.js +28 -0
- package/src/auth/callback-server.js +99 -0
- package/src/auth/config.js +53 -0
- package/src/auth/credential-store.js +109 -0
- package/src/auth/oauth-client.js +105 -0
- package/src/auth/pkce.js +28 -0
- package/src/auth/session.js +178 -0
- package/src/auth/tool.js +25 -0
- package/src/cli/command-paths.js +126 -0
- package/src/cli/context-help.js +102 -0
- package/src/cli/diagnostic-command.js +57 -0
- package/src/cli/domain-catalog.js +42 -0
- package/src/cli/help-text.js +32 -0
- package/src/cli/native-loader.js +120 -0
- package/src/cli/native-path.js +22 -0
- package/src/cli/parser-policy.js +141 -0
- package/src/cli/program.js +134 -0
- package/src/cli/skill-catalog.js +241 -0
- package/src/commands/native/access/commands.index.json +24 -0
- package/src/commands/native/access/domain.json +3 -0
- package/src/commands/native/access/role/list/command.js +141 -0
- package/src/commands/native/access/role/list/schema.json +393 -0
- package/src/commands/native/access/staff-perms/get/command.js +119 -0
- package/src/commands/native/access/staff-perms/get/schema.json +703 -0
- package/src/commands/native/aftersale/case/get/command.js +104 -0
- package/src/commands/native/aftersale/case/get/exact-json.js +52 -0
- package/src/commands/native/aftersale/case/get/money.js +28 -0
- package/src/commands/native/aftersale/case/get/projection.js +120 -0
- package/src/commands/native/aftersale/case/get/query.js +72 -0
- package/src/commands/native/aftersale/case/get/schema.json +134 -0
- package/src/commands/native/aftersale/case/list/command.js +135 -0
- package/src/commands/native/aftersale/case/list/schema.json +1095 -0
- package/src/commands/native/aftersale/case/scan/command.js +110 -0
- package/src/commands/native/aftersale/case/scan/query.js +62 -0
- package/src/commands/native/aftersale/case/scan/scan.js +78 -0
- package/src/commands/native/aftersale/case/scan/schema.json +964 -0
- package/src/commands/native/aftersale/case/scan/search.js +108 -0
- package/src/commands/native/aftersale/commands.index.json +42 -0
- package/src/commands/native/aftersale/domain.json +3 -0
- package/src/commands/native/aftersale/refund/list/command.js +97 -0
- package/src/commands/native/aftersale/refund/list/money.js +25 -0
- package/src/commands/native/aftersale/refund/list/projection.js +50 -0
- package/src/commands/native/aftersale/refund/list/query.js +73 -0
- package/src/commands/native/aftersale/refund/list/schema.json +130 -0
- package/src/commands/native/aftersale/shared/query.js +58 -0
- package/src/commands/native/aftersale/shared/search.js +128 -0
- package/src/commands/native/benefit/card-definition/get/command.js +110 -0
- package/src/commands/native/benefit/card-definition/get/schema.json +545 -0
- package/src/commands/native/benefit/card-definition/list/command.js +105 -0
- package/src/commands/native/benefit/card-definition/list/schema.json +690 -0
- package/src/commands/native/benefit/card-grant/list/command.js +135 -0
- package/src/commands/native/benefit/card-grant/list/schema.json +758 -0
- package/src/commands/native/benefit/commands.index.json +51 -0
- package/src/commands/native/benefit/customer-card/get/command.js +110 -0
- package/src/commands/native/benefit/customer-card/get/schema.json +340 -0
- package/src/commands/native/benefit/customer-card/list/command.js +102 -0
- package/src/commands/native/benefit/customer-card/list/schema.json +731 -0
- package/src/commands/native/benefit/domain.json +3 -0
- package/src/commands/native/coupon/activity/get/command.js +183 -0
- package/src/commands/native/coupon/activity/get/schema.json +624 -0
- package/src/commands/native/coupon/activity/list/command.js +169 -0
- package/src/commands/native/coupon/activity/list/schema.json +845 -0
- package/src/commands/native/coupon/commands.index.json +42 -0
- package/src/commands/native/coupon/domain.json +3 -0
- package/src/commands/native/coupon/shared/query.js +15 -0
- package/src/commands/native/coupon/voucher/get/command.js +113 -0
- package/src/commands/native/coupon/voucher/get/schema.json +147 -0
- package/src/commands/native/coupon/voucher/list/command.js +155 -0
- package/src/commands/native/coupon/voucher/list/schema.json +772 -0
- package/src/commands/native/customer/commands.index.json +96 -0
- package/src/commands/native/customer/customer/get/adapter.js +82 -0
- package/src/commands/native/customer/customer/get/command.js +106 -0
- package/src/commands/native/customer/customer/get/schema.json +958 -0
- package/src/commands/native/customer/customer/list/command.js +78 -0
- package/src/commands/native/customer/customer/list/input.js +145 -0
- package/src/commands/native/customer/customer/list/query.js +103 -0
- package/src/commands/native/customer/customer/list/schema.json +969 -0
- package/src/commands/native/customer/customer/scan/command.js +80 -0
- package/src/commands/native/customer/customer/scan/scan.js +92 -0
- package/src/commands/native/customer/customer/scan/schema.json +211 -0
- package/src/commands/native/customer/customer-tag/get/command.js +166 -0
- package/src/commands/native/customer/customer-tag/get/schema.json +317 -0
- package/src/commands/native/customer/customer-tag/list/command.js +143 -0
- package/src/commands/native/customer/customer-tag/list/schema.json +259 -0
- package/src/commands/native/customer/domain.json +3 -0
- package/src/commands/native/customer/segment/list/command.js +96 -0
- package/src/commands/native/customer/segment/list/query.js +98 -0
- package/src/commands/native/customer/segment/list/schema.json +135 -0
- package/src/commands/native/customer/segment-customer/list/command.js +171 -0
- package/src/commands/native/customer/segment-customer/list/schema.json +123 -0
- package/src/commands/native/customer/shared/search-input.js +179 -0
- package/src/commands/native/customer/shared/search-page.js +54 -0
- package/src/commands/native/customer/tag/get/command.js +73 -0
- package/src/commands/native/customer/tag/get/schema.json +339 -0
- package/src/commands/native/customer/tagcategory/get/command.js +80 -0
- package/src/commands/native/customer/tagcategory/get/query.js +98 -0
- package/src/commands/native/customer/tagcategory/get/schema.json +339 -0
- package/src/commands/native/customer/tagcategory/list/command.js +127 -0
- package/src/commands/native/customer/tagcategory/list/schema.json +394 -0
- package/src/commands/native/fulfillment/commands.index.json +33 -0
- package/src/commands/native/fulfillment/delivery/get/command.js +107 -0
- package/src/commands/native/fulfillment/delivery/get/projection.js +142 -0
- package/src/commands/native/fulfillment/delivery/get/schema.json +173 -0
- package/src/commands/native/fulfillment/domain.json +3 -0
- package/src/commands/native/fulfillment/shipment/list/command.js +83 -0
- package/src/commands/native/fulfillment/shipment/list/projection.js +130 -0
- package/src/commands/native/fulfillment/shipment/list/schema.json +752 -0
- package/src/commands/native/fulfillment/waybill/get/command.js +193 -0
- package/src/commands/native/fulfillment/waybill/get/response.js +68 -0
- package/src/commands/native/fulfillment/waybill/get/schema.json +190 -0
- package/src/commands/native/interaction/commands.index.json +24 -0
- package/src/commands/native/interaction/domain.json +3 -0
- package/src/commands/native/interaction/lottery/get/command.js +61 -0
- package/src/commands/native/interaction/lottery/get/query.js +152 -0
- package/src/commands/native/interaction/lottery/get/schema.json +1004 -0
- package/src/commands/native/interaction/lottery/list/command.js +176 -0
- package/src/commands/native/interaction/lottery/list/schema.json +898 -0
- package/src/commands/native/item/attribute/list/command.js +122 -0
- package/src/commands/native/item/attribute/list/schema.json +727 -0
- package/src/commands/native/item/brand/list/command.js +114 -0
- package/src/commands/native/item/brand/list/schema.json +725 -0
- package/src/commands/native/item/classification/get/command.js +87 -0
- package/src/commands/native/item/classification/get/schema.json +596 -0
- package/src/commands/native/item/classification/list/command.js +105 -0
- package/src/commands/native/item/classification/list/schema.json +676 -0
- package/src/commands/native/item/commands.index.json +87 -0
- package/src/commands/native/item/domain.json +1 -0
- package/src/commands/native/item/group/list/command.js +122 -0
- package/src/commands/native/item/group/list/schema.json +809 -0
- package/src/commands/native/item/item/get/command.js +122 -0
- package/src/commands/native/item/item/get/schema.json +3799 -0
- package/src/commands/native/item/item/list/command.js +7 -0
- package/src/commands/native/item/item/list/schema.json +1118 -0
- package/src/commands/native/item/item/scan/command.js +7 -0
- package/src/commands/native/item/item/scan/schema.json +1046 -0
- package/src/commands/native/item/item-content/get/command.js +54 -0
- package/src/commands/native/item/item-content/get/schema.json +677 -0
- package/src/commands/native/item/shared/api.js +31 -0
- package/src/commands/native/item/shared/content.js +20 -0
- package/src/commands/native/item/shared/diagnostics.js +61 -0
- package/src/commands/native/item/shared/h5.js +63 -0
- package/src/commands/native/item/shared/identity.js +62 -0
- package/src/commands/native/item/shared/normalize.js +49 -0
- package/src/commands/native/item/shared/scope.js +22 -0
- package/src/commands/native/item/shared/search-command.js +61 -0
- package/src/commands/native/item/shared/search-options.js +150 -0
- package/src/commands/native/item/shared/search.js +158 -0
- package/src/commands/native/member/commands.index.json +60 -0
- package/src/commands/native/member/customer-level/get/command.js +122 -0
- package/src/commands/native/member/customer-level/get/schema.json +300 -0
- package/src/commands/native/member/domain.json +3 -0
- package/src/commands/native/member/growth/get/command.js +64 -0
- package/src/commands/native/member/growth/get/schema.json +283 -0
- package/src/commands/native/member/growth-log/list/command.js +203 -0
- package/src/commands/native/member/growth-log/list/schema.json +695 -0
- package/src/commands/native/member/level/get/command.js +70 -0
- package/src/commands/native/member/level/get/query.js +125 -0
- package/src/commands/native/member/level/get/schema.json +339 -0
- package/src/commands/native/member/level/list/command.js +50 -0
- package/src/commands/native/member/level/list/query.js +109 -0
- package/src/commands/native/member/level/list/schema.json +104 -0
- package/src/commands/native/member/membership/get/command.js +78 -0
- package/src/commands/native/member/membership/get/schema.json +283 -0
- package/src/commands/native/order/commands.index.json +33 -0
- package/src/commands/native/order/domain.json +3 -0
- package/src/commands/native/order/order/get/command.js +155 -0
- package/src/commands/native/order/order/get/schema.json +1167 -0
- package/src/commands/native/order/order/list/command.js +230 -0
- package/src/commands/native/order/order/list/schema.json +1363 -0
- package/src/commands/native/order/order/scan/command.js +148 -0
- package/src/commands/native/order/order/scan/scan.js +89 -0
- package/src/commands/native/order/order/scan/schema.json +1445 -0
- package/src/commands/native/order/shared/projection.js +183 -0
- package/src/commands/native/order/shared/query.js +84 -0
- package/src/commands/native/order/shared/search.js +112 -0
- package/src/commands/native/org/commands.index.json +42 -0
- package/src/commands/native/org/domain.json +3 -0
- package/src/commands/native/org/shared/single-staff.js +115 -0
- package/src/commands/native/org/staff/get/command.js +148 -0
- package/src/commands/native/org/staff/get/schema.json +114 -0
- package/src/commands/native/org/staff-role/get/command.js +45 -0
- package/src/commands/native/org/staff-role/get/schema.json +93 -0
- package/src/commands/native/org/unit/get/command.js +131 -0
- package/src/commands/native/org/unit/get/schema.json +478 -0
- package/src/commands/native/org/unit/list/command.js +187 -0
- package/src/commands/native/org/unit/list/schema.json +828 -0
- package/src/commands/native/points/account/get/command.js +65 -0
- package/src/commands/native/points/account/get/schema.json +303 -0
- package/src/commands/native/points/commands.index.json +33 -0
- package/src/commands/native/points/domain.json +3 -0
- package/src/commands/native/points/log/list/command.js +141 -0
- package/src/commands/native/points/log/list/schema.json +761 -0
- package/src/commands/native/points/rule/list/command.js +82 -0
- package/src/commands/native/points/rule/list/schema.json +294 -0
- package/src/commands/native/privacy/commands.index.json +15 -0
- package/src/commands/native/privacy/domain.json +3 -0
- package/src/commands/native/privacy/field/decrypt/command.js +185 -0
- package/src/commands/native/privacy/field/decrypt/schema.json +656 -0
- package/src/commands/native/privacy/shared/order-source.js +33 -0
- package/src/commands/native/stock/commands.index.json +15 -0
- package/src/commands/native/stock/domain.json +3 -0
- package/src/commands/native/stock/log/list/command.js +207 -0
- package/src/commands/native/stock/log/list/schema.json +922 -0
- package/src/commands/native/valuecard/card/get/command.js +107 -0
- package/src/commands/native/valuecard/card/get/schema.json +683 -0
- package/src/commands/native/valuecard/card/list/command.js +136 -0
- package/src/commands/native/valuecard/card/list/pagination.js +23 -0
- package/src/commands/native/valuecard/card/list/schema.json +780 -0
- package/src/commands/native/valuecard/commands.index.json +24 -0
- package/src/commands/native/valuecard/domain.json +3 -0
- package/src/commands/native/valuecard/shared/projection.js +57 -0
- package/src/commands/system/api.js +47 -0
- package/src/commands/system/auth.js +118 -0
- package/src/commands/system/contracts.js +373 -0
- package/src/commands/system/doctor.js +24 -0
- package/src/commands/system/install.js +41 -0
- package/src/commands/system/printer.js +16 -0
- package/src/commands/system/schema.js +162 -0
- package/src/commands/system/shop-guidance.js +9 -0
- package/src/commands/system/shop.js +237 -0
- package/src/commands/system/skills.js +49 -0
- package/src/execution/beijing-date-time.js +29 -0
- package/src/execution/beijing-time.js +21 -0
- package/src/execution/bounded-input.js +42 -0
- package/src/execution/command-io.js +137 -0
- package/src/execution/command-policy.js +41 -0
- package/src/execution/command-schema.js +131 -0
- package/src/execution/datetime.js +83 -0
- package/src/execution/error-details.js +399 -0
- package/src/execution/error-model.js +82 -0
- package/src/execution/exact-json.js +80 -0
- package/src/execution/list-total.js +10 -0
- package/src/execution/money.js +59 -0
- package/src/execution/parser-error.js +66 -0
- package/src/execution/privacy.js +197 -0
- package/src/execution/public-schema.js +52 -0
- package/src/execution/query-api.js +101 -0
- package/src/execution/range.js +84 -0
- package/src/execution/request-state.js +55 -0
- package/src/execution/schema-completeness.js +116 -0
- package/src/execution/shop-query.js +54 -0
- package/src/execution/target-shop-default.js +23 -0
- package/src/execution/target-shop.js +49 -0
- package/src/identity/context-store.js +54 -0
- package/src/identity/context.js +38 -0
- package/src/installation/install.js +158 -0
- package/src/installation/npm-error.js +93 -0
- package/src/installation/skill.js +113 -0
- package/src/transport/account-api.js +152 -0
- package/src/transport/api.js +199 -0
- package/src/transport/shop-app.js +63 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"input": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"kdtId"
|
|
7
|
+
],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"kdtId": {
|
|
11
|
+
"$ref": "#/definitions/shopId"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"output": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": [
|
|
18
|
+
"data"
|
|
19
|
+
],
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"properties": {
|
|
22
|
+
"data": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": [
|
|
25
|
+
"roles"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"properties": {
|
|
29
|
+
"roles": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"items": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"required": [
|
|
34
|
+
"roleId",
|
|
35
|
+
"name"
|
|
36
|
+
],
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"properties": {
|
|
39
|
+
"roleId": {
|
|
40
|
+
"$ref": "#/definitions/shopId",
|
|
41
|
+
"description": "角色定义标识,正安全整数,不是员工或组织标识。"
|
|
42
|
+
},
|
|
43
|
+
"name": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"minLength": 1,
|
|
46
|
+
"description": "角色名称,原文保留。"
|
|
47
|
+
},
|
|
48
|
+
"bizCode": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "角色所属业务编码,缺失或 null 时省略;空字符串保留。"
|
|
51
|
+
},
|
|
52
|
+
"roleType": {
|
|
53
|
+
"type": "integer",
|
|
54
|
+
"minimum": -9007199254740991,
|
|
55
|
+
"maximum": 9007199254740991,
|
|
56
|
+
"description": "角色类型原始整数码;未定义枚举含义,不推导 system/custom。"
|
|
57
|
+
},
|
|
58
|
+
"remark": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "角色说明原文,缺失或 null 时省略;空字符串保留。"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"preview": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"required": [
|
|
72
|
+
"scope",
|
|
73
|
+
"requests",
|
|
74
|
+
"maxOrganizationPages"
|
|
75
|
+
],
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"properties": {
|
|
78
|
+
"scope": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"required": [
|
|
81
|
+
"kdtId"
|
|
82
|
+
],
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"properties": {
|
|
85
|
+
"kdtId": {
|
|
86
|
+
"$ref": "#/definitions/shopId"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"requests": {
|
|
91
|
+
"type": "array",
|
|
92
|
+
"minItems": 2,
|
|
93
|
+
"maxItems": 3,
|
|
94
|
+
"items": {
|
|
95
|
+
"oneOf": [
|
|
96
|
+
{
|
|
97
|
+
"type": "object",
|
|
98
|
+
"required": [
|
|
99
|
+
"stage",
|
|
100
|
+
"method",
|
|
101
|
+
"path",
|
|
102
|
+
"body"
|
|
103
|
+
],
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"properties": {
|
|
106
|
+
"stage": {
|
|
107
|
+
"const": "shop-binding"
|
|
108
|
+
},
|
|
109
|
+
"method": {
|
|
110
|
+
"const": "POST"
|
|
111
|
+
},
|
|
112
|
+
"path": {
|
|
113
|
+
"const": "youzan.shop.basic.get/3.0.0"
|
|
114
|
+
},
|
|
115
|
+
"body": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"required": [],
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"properties": {}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "object",
|
|
125
|
+
"required": [
|
|
126
|
+
"stage",
|
|
127
|
+
"method",
|
|
128
|
+
"path",
|
|
129
|
+
"body"
|
|
130
|
+
],
|
|
131
|
+
"additionalProperties": false,
|
|
132
|
+
"properties": {
|
|
133
|
+
"stage": {
|
|
134
|
+
"const": "target-membership"
|
|
135
|
+
},
|
|
136
|
+
"method": {
|
|
137
|
+
"const": "POST"
|
|
138
|
+
},
|
|
139
|
+
"path": {
|
|
140
|
+
"const": "youzan.shop.chain.descendent.organization.list/1.0.1"
|
|
141
|
+
},
|
|
142
|
+
"body": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"required": [
|
|
145
|
+
"page_num",
|
|
146
|
+
"page_size",
|
|
147
|
+
"with_dept_info",
|
|
148
|
+
"with_shop_status_and_lifecycle_end_time",
|
|
149
|
+
"with_crm_shop"
|
|
150
|
+
],
|
|
151
|
+
"additionalProperties": false,
|
|
152
|
+
"properties": {
|
|
153
|
+
"page_num": {
|
|
154
|
+
"const": 1
|
|
155
|
+
},
|
|
156
|
+
"page_size": {
|
|
157
|
+
"const": 50
|
|
158
|
+
},
|
|
159
|
+
"with_dept_info": {
|
|
160
|
+
"const": false
|
|
161
|
+
},
|
|
162
|
+
"with_shop_status_and_lifecycle_end_time": {
|
|
163
|
+
"const": false
|
|
164
|
+
},
|
|
165
|
+
"with_crm_shop": {
|
|
166
|
+
"const": false
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"type": "object",
|
|
174
|
+
"required": [
|
|
175
|
+
"stage",
|
|
176
|
+
"method",
|
|
177
|
+
"path",
|
|
178
|
+
"body"
|
|
179
|
+
],
|
|
180
|
+
"additionalProperties": false,
|
|
181
|
+
"properties": {
|
|
182
|
+
"stage": {
|
|
183
|
+
"const": "roles"
|
|
184
|
+
},
|
|
185
|
+
"method": {
|
|
186
|
+
"const": "POST"
|
|
187
|
+
},
|
|
188
|
+
"path": {
|
|
189
|
+
"const": "youzan.shop.rig.list.role/1.0.0"
|
|
190
|
+
},
|
|
191
|
+
"body": {
|
|
192
|
+
"type": "object",
|
|
193
|
+
"required": [
|
|
194
|
+
"third_tenant_id",
|
|
195
|
+
"third_user_id",
|
|
196
|
+
"namespace",
|
|
197
|
+
"filter"
|
|
198
|
+
],
|
|
199
|
+
"additionalProperties": false,
|
|
200
|
+
"properties": {
|
|
201
|
+
"third_tenant_id": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"pattern": "^[1-9]\\d*$"
|
|
204
|
+
},
|
|
205
|
+
"third_user_id": {
|
|
206
|
+
"const": "-1"
|
|
207
|
+
},
|
|
208
|
+
"namespace": {
|
|
209
|
+
"const": "np_yz_shop"
|
|
210
|
+
},
|
|
211
|
+
"filter": {
|
|
212
|
+
"type": "object",
|
|
213
|
+
"required": ["biz_key_group"],
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"properties": {
|
|
216
|
+
"biz_key_group": { "const": "shop_ability" }
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"maxOrganizationPages": {
|
|
227
|
+
"const": 20
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"error": {
|
|
232
|
+
"type": "object",
|
|
233
|
+
"required": [
|
|
234
|
+
"success",
|
|
235
|
+
"code",
|
|
236
|
+
"message",
|
|
237
|
+
"details"
|
|
238
|
+
],
|
|
239
|
+
"additionalProperties": false,
|
|
240
|
+
"properties": {
|
|
241
|
+
"success": {
|
|
242
|
+
"const": false
|
|
243
|
+
},
|
|
244
|
+
"code": {
|
|
245
|
+
"const": -10001
|
|
246
|
+
},
|
|
247
|
+
"message": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"minLength": 1
|
|
250
|
+
},
|
|
251
|
+
"details": {
|
|
252
|
+
"type": "object",
|
|
253
|
+
"required": [
|
|
254
|
+
"category",
|
|
255
|
+
"stage",
|
|
256
|
+
"command",
|
|
257
|
+
"targetScope",
|
|
258
|
+
"requestState",
|
|
259
|
+
"nextStep"
|
|
260
|
+
],
|
|
261
|
+
"additionalProperties": false,
|
|
262
|
+
"properties": {
|
|
263
|
+
"category": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"enum": [
|
|
266
|
+
"validation",
|
|
267
|
+
"configuration",
|
|
268
|
+
"parameter",
|
|
269
|
+
"permission",
|
|
270
|
+
"authentication",
|
|
271
|
+
"scope_unresolved",
|
|
272
|
+
"transport",
|
|
273
|
+
"http",
|
|
274
|
+
"protocol",
|
|
275
|
+
"business_rejected"
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
"stage": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"enum": [
|
|
281
|
+
"validation",
|
|
282
|
+
"context",
|
|
283
|
+
"scope",
|
|
284
|
+
"input",
|
|
285
|
+
"configuration",
|
|
286
|
+
"shop-binding",
|
|
287
|
+
"target-membership",
|
|
288
|
+
"roles",
|
|
289
|
+
"roles-model",
|
|
290
|
+
"transport",
|
|
291
|
+
"http",
|
|
292
|
+
"response"
|
|
293
|
+
]
|
|
294
|
+
},
|
|
295
|
+
"command": {
|
|
296
|
+
"const": "access.role.list"
|
|
297
|
+
},
|
|
298
|
+
"targetScope": {
|
|
299
|
+
"type": "object",
|
|
300
|
+
"additionalProperties": false,
|
|
301
|
+
"properties": {
|
|
302
|
+
"kdtId": {
|
|
303
|
+
"$ref": "#/definitions/shopId"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"requestState": {
|
|
308
|
+
"enum": [
|
|
309
|
+
"not_sent",
|
|
310
|
+
"sent",
|
|
311
|
+
"unknown"
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
"nextStep": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"minLength": 1
|
|
317
|
+
},
|
|
318
|
+
"api": {
|
|
319
|
+
"type": "string"
|
|
320
|
+
},
|
|
321
|
+
"httpStatus": {
|
|
322
|
+
"type": "integer"
|
|
323
|
+
},
|
|
324
|
+
"businessCode": {
|
|
325
|
+
"anyOf": [
|
|
326
|
+
{
|
|
327
|
+
"type": "integer",
|
|
328
|
+
"minimum": -9007199254740991,
|
|
329
|
+
"maximum": 9007199254740991
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"type": "string",
|
|
333
|
+
"pattern": "^-?\\d{1,12}$"
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
"gatewayCode": {
|
|
338
|
+
"anyOf": [
|
|
339
|
+
{
|
|
340
|
+
"type": "integer",
|
|
341
|
+
"minimum": -9007199254740991,
|
|
342
|
+
"maximum": 9007199254740991
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"type": "string",
|
|
346
|
+
"pattern": "^-?\\d{1,12}$"
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
"trace_id": {
|
|
351
|
+
"type": "string",
|
|
352
|
+
"pattern": "^[a-zA-Z0-9_-]{1,128}$"
|
|
353
|
+
},
|
|
354
|
+
"request_id": {
|
|
355
|
+
"type": "string",
|
|
356
|
+
"pattern": "^[a-zA-Z0-9_-]{1,128}$"
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"definitions": {
|
|
363
|
+
"shopId": {
|
|
364
|
+
"type": "integer",
|
|
365
|
+
"minimum": 1,
|
|
366
|
+
"maximum": 9007199254740991,
|
|
367
|
+
"description": "目标店铺正安全整数;默认上下文 shopId。真实执行先核实凭证绑定,非总部不可跨店,总部跨店另核实归属。"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
"modules": {
|
|
371
|
+
"roles": {
|
|
372
|
+
"base": true,
|
|
373
|
+
"upstreamPath": "data",
|
|
374
|
+
"required": true,
|
|
375
|
+
"description": "角色定义目录,必须明确返回数组和核心字段;不代表员工角色或权限。"
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"api": {
|
|
379
|
+
"method": "POST",
|
|
380
|
+
"path": "youzan.shop.rig.list.role/1.0.0"
|
|
381
|
+
},
|
|
382
|
+
"success": {
|
|
383
|
+
"description": "已核实当前凭证主体与目标归属,取得完整且模型有效的本次角色目录,返回 data.roles。仅明确空数组表示本次结果为空。"
|
|
384
|
+
},
|
|
385
|
+
"notes": [
|
|
386
|
+
"查询角色定义,不按员工或角色类型筛选;不支持调用者增加目录过滤条件。",
|
|
387
|
+
"角色保留顺序与重复,不排序、截断或分页。空数组只表示本次结果为空。",
|
|
388
|
+
"可选字段缺失或 null 时省略,非 null 错型整体失败;未选字段忽略。",
|
|
389
|
+
"同店最多两次请求;总部跨店最多一次主体回读、20 页每页 50 条归属核验、一次目录读取;不重试。",
|
|
390
|
+
"预算用尽或归属未核实只表示不能安全继续,不证明目标不属于总部。",
|
|
391
|
+
"目录成功不代表店铺员工身份授权与权限隔离验收通过。"
|
|
392
|
+
]
|
|
393
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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 { withInputScope, constraints, modelAt } = require('../../../../../execution/error-details');
|
|
8
|
+
const schema = require('./schema.json');
|
|
9
|
+
const { validateCommandValue } = require('../../../../../execution/command-schema');
|
|
10
|
+
const { object } = require('../../../../../execution/query-api');
|
|
11
|
+
const { failure } = require('../../../../../execution/shop-query');
|
|
12
|
+
const { staffInput, staffPreview, readSingleShopStaffIdentity } = require('../../../org/shared/single-staff');
|
|
13
|
+
|
|
14
|
+
const command = 'access.staff-perms.get';
|
|
15
|
+
const maxResponseBytes = 8 * 1024 * 1024;
|
|
16
|
+
const reject = (category, stage, scope, state, facts) =>
|
|
17
|
+
failure(command, category, stage, scope, state, facts);
|
|
18
|
+
|
|
19
|
+
function buildInput(options, context) {
|
|
20
|
+
const input = staffInput(options, context, command, schema);
|
|
21
|
+
return withInputScope({ kdtId: input.kdtId }, () => {
|
|
22
|
+
const normalized = { ...input,
|
|
23
|
+
...(options.permKey === undefined ? {} : { permKey: options.permKey }) };
|
|
24
|
+
validateCommandValue(schema, 'input', normalized);
|
|
25
|
+
return Object.freeze(normalized);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function permissionBody(input, staffId) {
|
|
30
|
+
return { kdt_id: input.kdtId, yz_open_id: staffId, platform: 0,
|
|
31
|
+
...(input.permKey === undefined ? {} : { perm_keys: JSON.stringify([input.permKey]) }) };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function previewFor(input) {
|
|
35
|
+
const preview = staffPreview(input);
|
|
36
|
+
return { scope: preview.scope, requests: [...preview.requests,
|
|
37
|
+
{ stage: 'permissions', method: 'POST', path: schema.api.path,
|
|
38
|
+
body: permissionBody(input, '***') }
|
|
39
|
+
] };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function execute(input) {
|
|
43
|
+
const { read, staff, facts } = await readSingleShopStaffIdentity(input, command, {
|
|
44
|
+
transportOptions: { maxResponseBytes: () => maxResponseBytes }
|
|
45
|
+
});
|
|
46
|
+
if (typeof staff.yz_open_id !== 'string' || !/\S/.test(staff.yz_open_id)) {
|
|
47
|
+
const error = reject('protocol', 'staff-model', { kdtId: input.kdtId }, 'sent', facts);
|
|
48
|
+
error.diagnosticReason = 'staff_identity_invalid';
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
if (typeof staff.account === 'string' && /^1\d{10}$/.test(staff.account) && staff.account !== input.mobile) {
|
|
52
|
+
const error = reject('scope_unresolved', 'staff-model', { kdtId: input.kdtId }, 'sent', facts);
|
|
53
|
+
error.diagnosticReason = 'staff_account_mismatch';
|
|
54
|
+
redactDiagnostics(error, [input.mobile, staff.yz_open_id]);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
let response;
|
|
58
|
+
try {
|
|
59
|
+
response = await read(schema.api.path, permissionBody(input, staff.yz_open_id), 'permissions');
|
|
60
|
+
} catch (error) {
|
|
61
|
+
redactDiagnostics(error, [input.mobile, staff.yz_open_id]);
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
const invalid = (path, reason) => {
|
|
65
|
+
const error = reject('protocol', 'permissions-model', { kdtId: input.kdtId }, 'sent', response.facts);
|
|
66
|
+
if (path) error.issues = [{ source: 'output', path, reason,
|
|
67
|
+
expected: constraints(modelAt(schema, 'output', path)) }];
|
|
68
|
+
return error;
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
if (!Array.isArray(response.data)) throw invalid('/data/permissions', response.data === undefined ? 'required' : 'invalid_type');
|
|
72
|
+
const permissions = response.data.map((permission, index) => {
|
|
73
|
+
if (!object(permission)) throw invalid(`/data/permissions/${index}`, 'invalid_type');
|
|
74
|
+
return { permId: permission.perm_id, permKey: permission.perm_key, name: permission.name };
|
|
75
|
+
});
|
|
76
|
+
const result = { data: { permissions } };
|
|
77
|
+
validateCommandValue(schema, 'output', result);
|
|
78
|
+
return result;
|
|
79
|
+
} catch (cause) {
|
|
80
|
+
const error = cause.cliDetails ? cause : invalid();
|
|
81
|
+
if (cause.issues) error.issues = cause.issues;
|
|
82
|
+
if (cause.issuesTruncated) error.issuesTruncated = true;
|
|
83
|
+
redactDiagnostics(error, [input.mobile, staff.yz_open_id]);
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function redactDiagnostics(error, values) {
|
|
89
|
+
for (const field of ['businessCode', 'gatewayCode', 'trace_id', 'request_id']) {
|
|
90
|
+
if (values.some(value => String(error.cliDetails?.[field]).includes(value))) delete error.cliDetails[field];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function createCommand({ context } = {}) {
|
|
95
|
+
return new DiagnosticCommand('get', { path: command, schema, parameterCategory: 'parameter' })
|
|
96
|
+
.description('按登录账号手机号读取当前单店员工权限点,可核对一个指定 key')
|
|
97
|
+
.allowExcessArguments(false)
|
|
98
|
+
.requiredOption('--mobile <phone>', '必填:员工登录账号的 11 位手机号,不是客户或联系人号码')
|
|
99
|
+
.option('--kdt-id <id>', '当前单店正安全整数;省略取上下文 shopId,不支持跨店或总部')
|
|
100
|
+
.option('--perm-key <key>', '单个权限 key,不拆分逗号;省略查询全部权限点')
|
|
101
|
+
.addOption(new Option('--format <format>', 'json 或 pretty,仅改变缩进')
|
|
102
|
+
.choices(['json', 'pretty']).default('json'))
|
|
103
|
+
.option('--dry-run', '仅本地预览,手机号和派生员工标识脱敏;零请求')
|
|
104
|
+
.addHelpText('after', '\n先核验同店及单店组织角色,再定位员工并查询权限,最多三请求,不重试或切店。\n每次响应最多 8 MiB,超限整体失败,不输出部分权限。\n空数组仅表示本次筛选范围没有返回权限点;指定 key 的空结果不代表员工没有其他权限。角色关联、角色目录不等于权限事实。\n单店组织角色不证明产品类型或员工授权,网关决定实际可读范围。\n契约:zan-saas schema access.staff-perms.get\n示例:zan-saas access staff-perms get --mobile 13800000000 --dry-run')
|
|
105
|
+
.action(async options => {
|
|
106
|
+
const input = buildInput(options, context);
|
|
107
|
+
const preview = previewFor(input);
|
|
108
|
+
validateCommandValue(schema, 'preview', preview);
|
|
109
|
+
try {
|
|
110
|
+
const result = options.dryRun ? preview : await execute(input);
|
|
111
|
+
console.log(JSON.stringify(result, null, options.format === 'pretty' ? 2 : 0));
|
|
112
|
+
} catch (error) {
|
|
113
|
+
redactDiagnostics(error, [input.mobile]);
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
module.exports = { kind: 'atomic', risk: 'read', at: 'shop', createCommand: withTargetShopDefault(createCommand) };
|