@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.
Files changed (329) hide show
  1. package/DEPENDENCIES.json +50 -0
  2. package/INSTALL.md +79 -0
  3. package/LICENSE +21 -0
  4. package/NOTICE +1 -0
  5. package/README.md +151 -2
  6. package/THIRD_PARTY_NOTICES.txt +162 -0
  7. package/bin/zan-saas-cli.js +28 -0
  8. package/internal/registry/index.js +123 -0
  9. package/internal/registry/manifest.json +424 -0
  10. package/npm-shrinkwrap.json +86 -0
  11. package/package.json +33 -4
  12. package/skills/README.md +30 -0
  13. package/skills/zan-saas/SKILL.md +54 -0
  14. package/skills/zan-saas/references/host-entry.md +25 -0
  15. package/skills/zan-saas-access/SKILL.md +37 -0
  16. package/skills/zan-saas-access/references/role-list.md +11 -0
  17. package/skills/zan-saas-access/references/staff-perms-get.md +11 -0
  18. package/skills/zan-saas-aftersale/SKILL.md +31 -0
  19. package/skills/zan-saas-aftersale/references/case-list.md +13 -0
  20. package/skills/zan-saas-aftersale/references/case-scan.md +31 -0
  21. package/skills/zan-saas-benefit/SKILL.md +46 -0
  22. package/skills/zan-saas-benefit/references/card-get.md +7 -0
  23. package/skills/zan-saas-benefit/references/card-grant-list.md +11 -0
  24. package/skills/zan-saas-benefit/references/card-list.md +7 -0
  25. package/skills/zan-saas-benefit/references/customer-card-get.md +7 -0
  26. package/skills/zan-saas-benefit/references/customer-card-list.md +7 -0
  27. package/skills/zan-saas-coupon/SKILL.md +41 -0
  28. package/skills/zan-saas-coupon/references/activity-get.md +11 -0
  29. package/skills/zan-saas-coupon/references/activity-list.md +15 -0
  30. package/skills/zan-saas-coupon/references/voucher-get.md +13 -0
  31. package/skills/zan-saas-coupon/references/voucher-list.md +25 -0
  32. package/skills/zan-saas-customer/SKILL.md +73 -0
  33. package/skills/zan-saas-customer/references/customer-scan.md +11 -0
  34. package/skills/zan-saas-customer/references/segment-list.md +22 -0
  35. package/skills/zan-saas-fulfillment/SKILL.md +36 -0
  36. package/skills/zan-saas-fulfillment/references/delivery-get.md +11 -0
  37. package/skills/zan-saas-fulfillment/references/shipment-list.md +11 -0
  38. package/skills/zan-saas-fulfillment/references/waybill-get.md +9 -0
  39. package/skills/zan-saas-interaction/SKILL.md +37 -0
  40. package/skills/zan-saas-interaction/references/lottery-get.md +11 -0
  41. package/skills/zan-saas-interaction/references/lottery-list.md +19 -0
  42. package/skills/zan-saas-item/SKILL.md +61 -0
  43. package/skills/zan-saas-item/references/attribute-list.md +11 -0
  44. package/skills/zan-saas-item/references/brand-list.md +7 -0
  45. package/skills/zan-saas-item/references/classification-get.md +7 -0
  46. package/skills/zan-saas-item/references/classification-list.md +7 -0
  47. package/skills/zan-saas-item/references/group-list.md +9 -0
  48. package/skills/zan-saas-item/references/item-content.md +9 -0
  49. package/skills/zan-saas-item/references/item-get.md +9 -0
  50. package/skills/zan-saas-item/references/item-search.md +23 -0
  51. package/skills/zan-saas-item/references/product-identity.md +11 -0
  52. package/skills/zan-saas-member/SKILL.md +41 -0
  53. package/skills/zan-saas-member/references/customer-level-get.md +7 -0
  54. package/skills/zan-saas-member/references/growth-log-list.md +17 -0
  55. package/skills/zan-saas-member/references/membership-get.md +7 -0
  56. package/skills/zan-saas-order/SKILL.md +56 -0
  57. package/skills/zan-saas-order/references/order-get.md +26 -0
  58. package/skills/zan-saas-order/references/order-list.md +25 -0
  59. package/skills/zan-saas-order/references/order-scan.md +35 -0
  60. package/skills/zan-saas-org/SKILL.md +37 -0
  61. package/skills/zan-saas-org/references/staff-get.md +15 -0
  62. package/skills/zan-saas-org/references/staff-role-get.md +11 -0
  63. package/skills/zan-saas-org/references/unit-get.md +11 -0
  64. package/skills/zan-saas-org/references/unit-list.md +15 -0
  65. package/skills/zan-saas-points/SKILL.md +42 -0
  66. package/skills/zan-saas-points/references/account-get.md +7 -0
  67. package/skills/zan-saas-points/references/log-list.md +17 -0
  68. package/skills/zan-saas-points/references/rule-list.md +2 -0
  69. package/skills/zan-saas-privacy/SKILL.md +30 -0
  70. package/skills/zan-saas-privacy/references/field-decrypt.md +19 -0
  71. package/skills/zan-saas-shared/SKILL.md +94 -0
  72. package/skills/zan-saas-shared/references/authentication.md +52 -0
  73. package/skills/zan-saas-shared/references/value-processing.md +27 -0
  74. package/skills/zan-saas-stock/SKILL.md +28 -0
  75. package/skills/zan-saas-stock/references/log-list.md +11 -0
  76. package/skills/zan-saas-valuecard/SKILL.md +37 -0
  77. package/skills/zan-saas-valuecard/references/card-get.md +13 -0
  78. package/skills/zan-saas-valuecard/references/card-list.md +11 -0
  79. package/src/auth/browser.js +28 -0
  80. package/src/auth/callback-server.js +99 -0
  81. package/src/auth/config.js +53 -0
  82. package/src/auth/credential-store.js +109 -0
  83. package/src/auth/oauth-client.js +105 -0
  84. package/src/auth/pkce.js +28 -0
  85. package/src/auth/session.js +178 -0
  86. package/src/auth/tool.js +25 -0
  87. package/src/cli/command-paths.js +126 -0
  88. package/src/cli/context-help.js +102 -0
  89. package/src/cli/diagnostic-command.js +57 -0
  90. package/src/cli/domain-catalog.js +42 -0
  91. package/src/cli/help-text.js +32 -0
  92. package/src/cli/native-loader.js +120 -0
  93. package/src/cli/native-path.js +22 -0
  94. package/src/cli/parser-policy.js +141 -0
  95. package/src/cli/program.js +134 -0
  96. package/src/cli/skill-catalog.js +241 -0
  97. package/src/commands/native/access/commands.index.json +24 -0
  98. package/src/commands/native/access/domain.json +3 -0
  99. package/src/commands/native/access/role/list/command.js +141 -0
  100. package/src/commands/native/access/role/list/schema.json +393 -0
  101. package/src/commands/native/access/staff-perms/get/command.js +119 -0
  102. package/src/commands/native/access/staff-perms/get/schema.json +703 -0
  103. package/src/commands/native/aftersale/case/get/command.js +104 -0
  104. package/src/commands/native/aftersale/case/get/exact-json.js +52 -0
  105. package/src/commands/native/aftersale/case/get/money.js +28 -0
  106. package/src/commands/native/aftersale/case/get/projection.js +120 -0
  107. package/src/commands/native/aftersale/case/get/query.js +72 -0
  108. package/src/commands/native/aftersale/case/get/schema.json +134 -0
  109. package/src/commands/native/aftersale/case/list/command.js +135 -0
  110. package/src/commands/native/aftersale/case/list/schema.json +1095 -0
  111. package/src/commands/native/aftersale/case/scan/command.js +110 -0
  112. package/src/commands/native/aftersale/case/scan/query.js +62 -0
  113. package/src/commands/native/aftersale/case/scan/scan.js +78 -0
  114. package/src/commands/native/aftersale/case/scan/schema.json +964 -0
  115. package/src/commands/native/aftersale/case/scan/search.js +108 -0
  116. package/src/commands/native/aftersale/commands.index.json +42 -0
  117. package/src/commands/native/aftersale/domain.json +3 -0
  118. package/src/commands/native/aftersale/refund/list/command.js +97 -0
  119. package/src/commands/native/aftersale/refund/list/money.js +25 -0
  120. package/src/commands/native/aftersale/refund/list/projection.js +50 -0
  121. package/src/commands/native/aftersale/refund/list/query.js +73 -0
  122. package/src/commands/native/aftersale/refund/list/schema.json +130 -0
  123. package/src/commands/native/aftersale/shared/query.js +58 -0
  124. package/src/commands/native/aftersale/shared/search.js +128 -0
  125. package/src/commands/native/benefit/card-definition/get/command.js +110 -0
  126. package/src/commands/native/benefit/card-definition/get/schema.json +545 -0
  127. package/src/commands/native/benefit/card-definition/list/command.js +106 -0
  128. package/src/commands/native/benefit/card-definition/list/schema.json +690 -0
  129. package/src/commands/native/benefit/card-grant/list/command.js +135 -0
  130. package/src/commands/native/benefit/card-grant/list/schema.json +758 -0
  131. package/src/commands/native/benefit/commands.index.json +51 -0
  132. package/src/commands/native/benefit/customer-card/get/command.js +110 -0
  133. package/src/commands/native/benefit/customer-card/get/schema.json +340 -0
  134. package/src/commands/native/benefit/customer-card/list/command.js +103 -0
  135. package/src/commands/native/benefit/customer-card/list/schema.json +731 -0
  136. package/src/commands/native/benefit/domain.json +3 -0
  137. package/src/commands/native/coupon/activity/get/command.js +183 -0
  138. package/src/commands/native/coupon/activity/get/schema.json +624 -0
  139. package/src/commands/native/coupon/activity/list/command.js +169 -0
  140. package/src/commands/native/coupon/activity/list/schema.json +845 -0
  141. package/src/commands/native/coupon/commands.index.json +42 -0
  142. package/src/commands/native/coupon/domain.json +3 -0
  143. package/src/commands/native/coupon/shared/query.js +15 -0
  144. package/src/commands/native/coupon/voucher/get/command.js +113 -0
  145. package/src/commands/native/coupon/voucher/get/schema.json +147 -0
  146. package/src/commands/native/coupon/voucher/list/command.js +155 -0
  147. package/src/commands/native/coupon/voucher/list/schema.json +772 -0
  148. package/src/commands/native/customer/commands.index.json +96 -0
  149. package/src/commands/native/customer/customer/get/adapter.js +82 -0
  150. package/src/commands/native/customer/customer/get/command.js +106 -0
  151. package/src/commands/native/customer/customer/get/schema.json +958 -0
  152. package/src/commands/native/customer/customer/list/command.js +78 -0
  153. package/src/commands/native/customer/customer/list/input.js +145 -0
  154. package/src/commands/native/customer/customer/list/query.js +103 -0
  155. package/src/commands/native/customer/customer/list/schema.json +969 -0
  156. package/src/commands/native/customer/customer/scan/command.js +80 -0
  157. package/src/commands/native/customer/customer/scan/scan.js +92 -0
  158. package/src/commands/native/customer/customer/scan/schema.json +211 -0
  159. package/src/commands/native/customer/customer-tag/get/command.js +166 -0
  160. package/src/commands/native/customer/customer-tag/get/schema.json +317 -0
  161. package/src/commands/native/customer/customer-tag/list/command.js +143 -0
  162. package/src/commands/native/customer/customer-tag/list/schema.json +259 -0
  163. package/src/commands/native/customer/domain.json +3 -0
  164. package/src/commands/native/customer/segment/list/command.js +96 -0
  165. package/src/commands/native/customer/segment/list/query.js +98 -0
  166. package/src/commands/native/customer/segment/list/schema.json +135 -0
  167. package/src/commands/native/customer/segment-customer/list/command.js +171 -0
  168. package/src/commands/native/customer/segment-customer/list/schema.json +123 -0
  169. package/src/commands/native/customer/shared/search-input.js +179 -0
  170. package/src/commands/native/customer/shared/search-page.js +54 -0
  171. package/src/commands/native/customer/tag/get/command.js +73 -0
  172. package/src/commands/native/customer/tag/get/schema.json +339 -0
  173. package/src/commands/native/customer/tagcategory/get/command.js +80 -0
  174. package/src/commands/native/customer/tagcategory/get/query.js +98 -0
  175. package/src/commands/native/customer/tagcategory/get/schema.json +339 -0
  176. package/src/commands/native/customer/tagcategory/list/command.js +127 -0
  177. package/src/commands/native/customer/tagcategory/list/schema.json +394 -0
  178. package/src/commands/native/fulfillment/commands.index.json +33 -0
  179. package/src/commands/native/fulfillment/delivery/get/command.js +107 -0
  180. package/src/commands/native/fulfillment/delivery/get/projection.js +142 -0
  181. package/src/commands/native/fulfillment/delivery/get/schema.json +173 -0
  182. package/src/commands/native/fulfillment/domain.json +3 -0
  183. package/src/commands/native/fulfillment/shipment/list/command.js +83 -0
  184. package/src/commands/native/fulfillment/shipment/list/projection.js +130 -0
  185. package/src/commands/native/fulfillment/shipment/list/schema.json +752 -0
  186. package/src/commands/native/fulfillment/waybill/get/command.js +193 -0
  187. package/src/commands/native/fulfillment/waybill/get/response.js +68 -0
  188. package/src/commands/native/fulfillment/waybill/get/schema.json +190 -0
  189. package/src/commands/native/interaction/commands.index.json +24 -0
  190. package/src/commands/native/interaction/domain.json +3 -0
  191. package/src/commands/native/interaction/lottery/get/command.js +61 -0
  192. package/src/commands/native/interaction/lottery/get/query.js +152 -0
  193. package/src/commands/native/interaction/lottery/get/schema.json +1004 -0
  194. package/src/commands/native/interaction/lottery/list/command.js +176 -0
  195. package/src/commands/native/interaction/lottery/list/schema.json +898 -0
  196. package/src/commands/native/item/attribute/list/command.js +122 -0
  197. package/src/commands/native/item/attribute/list/schema.json +727 -0
  198. package/src/commands/native/item/brand/list/command.js +114 -0
  199. package/src/commands/native/item/brand/list/schema.json +725 -0
  200. package/src/commands/native/item/classification/get/command.js +87 -0
  201. package/src/commands/native/item/classification/get/schema.json +596 -0
  202. package/src/commands/native/item/classification/list/command.js +105 -0
  203. package/src/commands/native/item/classification/list/schema.json +676 -0
  204. package/src/commands/native/item/commands.index.json +87 -0
  205. package/src/commands/native/item/domain.json +1 -0
  206. package/src/commands/native/item/group/list/command.js +122 -0
  207. package/src/commands/native/item/group/list/schema.json +809 -0
  208. package/src/commands/native/item/item/get/command.js +122 -0
  209. package/src/commands/native/item/item/get/schema.json +3799 -0
  210. package/src/commands/native/item/item/list/command.js +7 -0
  211. package/src/commands/native/item/item/list/schema.json +1118 -0
  212. package/src/commands/native/item/item/scan/command.js +7 -0
  213. package/src/commands/native/item/item/scan/schema.json +1046 -0
  214. package/src/commands/native/item/item-content/get/command.js +54 -0
  215. package/src/commands/native/item/item-content/get/schema.json +677 -0
  216. package/src/commands/native/item/shared/api.js +31 -0
  217. package/src/commands/native/item/shared/content.js +20 -0
  218. package/src/commands/native/item/shared/diagnostics.js +61 -0
  219. package/src/commands/native/item/shared/h5.js +63 -0
  220. package/src/commands/native/item/shared/identity.js +62 -0
  221. package/src/commands/native/item/shared/normalize.js +49 -0
  222. package/src/commands/native/item/shared/scope.js +22 -0
  223. package/src/commands/native/item/shared/search-command.js +61 -0
  224. package/src/commands/native/item/shared/search-options.js +150 -0
  225. package/src/commands/native/item/shared/search.js +158 -0
  226. package/src/commands/native/member/commands.index.json +60 -0
  227. package/src/commands/native/member/customer-level/get/command.js +122 -0
  228. package/src/commands/native/member/customer-level/get/schema.json +300 -0
  229. package/src/commands/native/member/domain.json +3 -0
  230. package/src/commands/native/member/growth/get/command.js +64 -0
  231. package/src/commands/native/member/growth/get/schema.json +283 -0
  232. package/src/commands/native/member/growth-log/list/command.js +203 -0
  233. package/src/commands/native/member/growth-log/list/schema.json +695 -0
  234. package/src/commands/native/member/level/get/command.js +70 -0
  235. package/src/commands/native/member/level/get/query.js +125 -0
  236. package/src/commands/native/member/level/get/schema.json +339 -0
  237. package/src/commands/native/member/level/list/command.js +50 -0
  238. package/src/commands/native/member/level/list/query.js +109 -0
  239. package/src/commands/native/member/level/list/schema.json +104 -0
  240. package/src/commands/native/member/membership/get/command.js +78 -0
  241. package/src/commands/native/member/membership/get/schema.json +283 -0
  242. package/src/commands/native/order/commands.index.json +33 -0
  243. package/src/commands/native/order/domain.json +3 -0
  244. package/src/commands/native/order/order/get/command.js +155 -0
  245. package/src/commands/native/order/order/get/schema.json +1167 -0
  246. package/src/commands/native/order/order/list/command.js +230 -0
  247. package/src/commands/native/order/order/list/schema.json +1363 -0
  248. package/src/commands/native/order/order/scan/command.js +148 -0
  249. package/src/commands/native/order/order/scan/scan.js +89 -0
  250. package/src/commands/native/order/order/scan/schema.json +1445 -0
  251. package/src/commands/native/order/shared/projection.js +183 -0
  252. package/src/commands/native/order/shared/query.js +84 -0
  253. package/src/commands/native/order/shared/search.js +112 -0
  254. package/src/commands/native/org/commands.index.json +42 -0
  255. package/src/commands/native/org/domain.json +3 -0
  256. package/src/commands/native/org/shared/single-staff.js +115 -0
  257. package/src/commands/native/org/staff/get/command.js +148 -0
  258. package/src/commands/native/org/staff/get/schema.json +114 -0
  259. package/src/commands/native/org/staff-role/get/command.js +45 -0
  260. package/src/commands/native/org/staff-role/get/schema.json +93 -0
  261. package/src/commands/native/org/unit/get/command.js +131 -0
  262. package/src/commands/native/org/unit/get/schema.json +478 -0
  263. package/src/commands/native/org/unit/list/command.js +187 -0
  264. package/src/commands/native/org/unit/list/schema.json +828 -0
  265. package/src/commands/native/points/account/get/command.js +65 -0
  266. package/src/commands/native/points/account/get/schema.json +303 -0
  267. package/src/commands/native/points/commands.index.json +33 -0
  268. package/src/commands/native/points/domain.json +3 -0
  269. package/src/commands/native/points/log/list/command.js +141 -0
  270. package/src/commands/native/points/log/list/schema.json +761 -0
  271. package/src/commands/native/points/rule/list/command.js +82 -0
  272. package/src/commands/native/points/rule/list/schema.json +294 -0
  273. package/src/commands/native/privacy/commands.index.json +15 -0
  274. package/src/commands/native/privacy/domain.json +3 -0
  275. package/src/commands/native/privacy/field/decrypt/command.js +185 -0
  276. package/src/commands/native/privacy/field/decrypt/schema.json +656 -0
  277. package/src/commands/native/privacy/shared/order-source.js +33 -0
  278. package/src/commands/native/stock/commands.index.json +15 -0
  279. package/src/commands/native/stock/domain.json +3 -0
  280. package/src/commands/native/stock/log/list/command.js +207 -0
  281. package/src/commands/native/stock/log/list/schema.json +922 -0
  282. package/src/commands/native/valuecard/card/get/command.js +107 -0
  283. package/src/commands/native/valuecard/card/get/schema.json +683 -0
  284. package/src/commands/native/valuecard/card/list/command.js +136 -0
  285. package/src/commands/native/valuecard/card/list/pagination.js +23 -0
  286. package/src/commands/native/valuecard/card/list/schema.json +780 -0
  287. package/src/commands/native/valuecard/commands.index.json +24 -0
  288. package/src/commands/native/valuecard/domain.json +3 -0
  289. package/src/commands/native/valuecard/shared/projection.js +57 -0
  290. package/src/commands/system/api.js +47 -0
  291. package/src/commands/system/auth.js +118 -0
  292. package/src/commands/system/contracts.js +373 -0
  293. package/src/commands/system/doctor.js +24 -0
  294. package/src/commands/system/install.js +41 -0
  295. package/src/commands/system/printer.js +16 -0
  296. package/src/commands/system/schema.js +162 -0
  297. package/src/commands/system/shop-guidance.js +9 -0
  298. package/src/commands/system/shop.js +237 -0
  299. package/src/commands/system/skills.js +49 -0
  300. package/src/execution/beijing-date-time.js +29 -0
  301. package/src/execution/beijing-time.js +21 -0
  302. package/src/execution/bounded-input.js +42 -0
  303. package/src/execution/command-io.js +137 -0
  304. package/src/execution/command-policy.js +41 -0
  305. package/src/execution/command-schema.js +131 -0
  306. package/src/execution/datetime.js +83 -0
  307. package/src/execution/error-details.js +399 -0
  308. package/src/execution/error-model.js +82 -0
  309. package/src/execution/exact-json.js +80 -0
  310. package/src/execution/list-total.js +10 -0
  311. package/src/execution/money.js +59 -0
  312. package/src/execution/parser-error.js +66 -0
  313. package/src/execution/privacy.js +197 -0
  314. package/src/execution/public-schema.js +52 -0
  315. package/src/execution/query-api.js +101 -0
  316. package/src/execution/range.js +84 -0
  317. package/src/execution/request-state.js +55 -0
  318. package/src/execution/schema-completeness.js +116 -0
  319. package/src/execution/shop-query.js +54 -0
  320. package/src/execution/target-shop-default.js +23 -0
  321. package/src/execution/target-shop.js +49 -0
  322. package/src/identity/context-store.js +54 -0
  323. package/src/identity/context.js +38 -0
  324. package/src/installation/install.js +158 -0
  325. package/src/installation/npm-error.js +93 -0
  326. package/src/installation/skill.js +113 -0
  327. package/src/transport/account-api.js +152 -0
  328. package/src/transport/api.js +199 -0
  329. package/src/transport/shop-app.js +63 -0
@@ -0,0 +1,703 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "input": {
4
+ "type": "object",
5
+ "required": [
6
+ "kdtId",
7
+ "mobile"
8
+ ],
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "kdtId": {
12
+ "$ref": "#/definitions/shopId"
13
+ },
14
+ "mobile": {
15
+ "type": "string",
16
+ "pattern": "^1[0-9]{10}$",
17
+ "description": "员工登录账号手机号;仅去首尾普通空格,不使用联系人或客户号码。"
18
+ },
19
+ "permKey": {
20
+ "$ref": "#/definitions/permKey"
21
+ }
22
+ }
23
+ },
24
+ "output": {
25
+ "type": "object",
26
+ "required": [
27
+ "data"
28
+ ],
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "data": {
32
+ "type": "object",
33
+ "required": [
34
+ "permissions"
35
+ ],
36
+ "additionalProperties": false,
37
+ "properties": {
38
+ "permissions": {
39
+ "type": "array",
40
+ "description": "本次筛选范围的员工权限点,非仅菜单权限;无分页,保持顺序及重复。省略 permKey 时读取完整权限点;指定时只查询该 key,成功空数组不表示员工没有其他权限。",
41
+ "items": {
42
+ "type": "object",
43
+ "required": [
44
+ "permId",
45
+ "permKey",
46
+ "name"
47
+ ],
48
+ "additionalProperties": false,
49
+ "properties": {
50
+ "permId": {
51
+ "type": "integer",
52
+ "minimum": 1,
53
+ "maximum": 9007199254740991,
54
+ "description": "权限点标识,不是角色或员工标识。"
55
+ },
56
+ "permKey": {
57
+ "type": "string",
58
+ "description": "权限点业务 key,服务端空串保留,不由名称推导。"
59
+ },
60
+ "name": {
61
+ "type": "string",
62
+ "description": "权限点名称,空串保留。"
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "preview": {
72
+ "type": "object",
73
+ "required": [
74
+ "scope",
75
+ "requests"
76
+ ],
77
+ "additionalProperties": false,
78
+ "properties": {
79
+ "scope": {
80
+ "type": "object",
81
+ "required": [
82
+ "kdtId"
83
+ ],
84
+ "additionalProperties": false,
85
+ "properties": {
86
+ "kdtId": {
87
+ "$ref": "#/definitions/shopId"
88
+ }
89
+ }
90
+ },
91
+ "requests": {
92
+ "type": "array",
93
+ "minItems": 3,
94
+ "maxItems": 3,
95
+ "additionalItems": false,
96
+ "items": [
97
+ {
98
+ "type": "object",
99
+ "required": [
100
+ "stage",
101
+ "method",
102
+ "path",
103
+ "body"
104
+ ],
105
+ "additionalProperties": false,
106
+ "properties": {
107
+ "stage": {
108
+ "const": "shop-binding"
109
+ },
110
+ "method": {
111
+ "const": "POST"
112
+ },
113
+ "path": {
114
+ "const": "youzan.shop.basic.get/3.0.0"
115
+ },
116
+ "body": {
117
+ "type": "object",
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": "staff"
135
+ },
136
+ "method": {
137
+ "const": "POST"
138
+ },
139
+ "path": {
140
+ "const": "youzan.shop.single.staff.get/1.0.0"
141
+ },
142
+ "body": {
143
+ "type": "object",
144
+ "required": [
145
+ "account"
146
+ ],
147
+ "additionalProperties": false,
148
+ "properties": {
149
+ "account": {
150
+ "const": "***"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ },
156
+ {
157
+ "type": "object",
158
+ "required": [
159
+ "stage",
160
+ "method",
161
+ "path",
162
+ "body"
163
+ ],
164
+ "additionalProperties": false,
165
+ "properties": {
166
+ "stage": {
167
+ "const": "permissions"
168
+ },
169
+ "method": {
170
+ "const": "POST"
171
+ },
172
+ "path": {
173
+ "const": "youzan.shop.rig.open.query.perms/1.0.0"
174
+ },
175
+ "body": {
176
+ "type": "object",
177
+ "required": [
178
+ "kdt_id",
179
+ "yz_open_id",
180
+ "platform"
181
+ ],
182
+ "additionalProperties": false,
183
+ "properties": {
184
+ "kdt_id": {
185
+ "$ref": "#/definitions/shopId"
186
+ },
187
+ "yz_open_id": {
188
+ "const": "***"
189
+ },
190
+ "platform": {
191
+ "const": 0,
192
+ "description": "通用终端。"
193
+ },
194
+ "perm_keys": {
195
+ "type": "string",
196
+ "description": "选定单个权限 key 的 JSON 数组文本;不选择时省略。"
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }
202
+ ]
203
+ }
204
+ }
205
+ },
206
+ "error": {
207
+ "type": "object",
208
+ "required": [
209
+ "success",
210
+ "code",
211
+ "message",
212
+ "details"
213
+ ],
214
+ "additionalProperties": false,
215
+ "properties": {
216
+ "success": {
217
+ "const": false
218
+ },
219
+ "code": {
220
+ "const": -10001
221
+ },
222
+ "message": {
223
+ "type": "string",
224
+ "minLength": 1
225
+ },
226
+ "details": {
227
+ "type": "object",
228
+ "required": [
229
+ "category",
230
+ "stage",
231
+ "command",
232
+ "targetScope",
233
+ "requestState",
234
+ "nextStep",
235
+ "errorVersion",
236
+ "recovery",
237
+ "execution"
238
+ ],
239
+ "additionalProperties": false,
240
+ "properties": {
241
+ "category": {
242
+ "enum": [
243
+ "parameter",
244
+ "validation",
245
+ "configuration",
246
+ "authentication",
247
+ "permission",
248
+ "scope_unresolved",
249
+ "transport",
250
+ "http",
251
+ "protocol",
252
+ "business_rejected",
253
+ "not_found",
254
+ "limit"
255
+ ]
256
+ },
257
+ "stage": {
258
+ "enum": [
259
+ "input",
260
+ "context",
261
+ "scope",
262
+ "configuration",
263
+ "shop-binding",
264
+ "staff",
265
+ "staff-model",
266
+ "permissions",
267
+ "permissions-model",
268
+ "transport",
269
+ "http",
270
+ "response"
271
+ ]
272
+ },
273
+ "command": {
274
+ "const": "access.staff-perms.get"
275
+ },
276
+ "targetScope": {
277
+ "type": "object",
278
+ "additionalProperties": false,
279
+ "properties": {
280
+ "kdtId": {
281
+ "$ref": "#/definitions/shopId"
282
+ }
283
+ }
284
+ },
285
+ "requestState": {
286
+ "enum": [
287
+ "not_sent",
288
+ "sent",
289
+ "unknown"
290
+ ]
291
+ },
292
+ "nextStep": {
293
+ "type": "string",
294
+ "minLength": 1
295
+ },
296
+ "api": {
297
+ "type": "string"
298
+ },
299
+ "httpStatus": {
300
+ "type": "integer"
301
+ },
302
+ "businessCode": {
303
+ "$ref": "#/definitions/diagnosticCode"
304
+ },
305
+ "gatewayCode": {
306
+ "$ref": "#/definitions/diagnosticCode"
307
+ },
308
+ "trace_id": {
309
+ "type": "string",
310
+ "pattern": "^[A-Za-z0-9_-]{1,128}$"
311
+ },
312
+ "request_id": {
313
+ "type": "string",
314
+ "pattern": "^[A-Za-z0-9_-]{1,128}$"
315
+ },
316
+ "errorVersion": {
317
+ "const": 2,
318
+ "description": "本命令采用错误诊断协议第二版。"
319
+ },
320
+ "issues": {
321
+ "type": "array",
322
+ "minItems": 1,
323
+ "maxItems": 16,
324
+ "items": {
325
+ "$ref": "#/definitions/diagnosticIssue"
326
+ },
327
+ "description": "最多十六个已定位问题,不包含收到的原值。"
328
+ },
329
+ "issuesTruncated": {
330
+ "const": true,
331
+ "description": "问题超过返回上限,当前列表没有穷尽全部问题。"
332
+ },
333
+ "recovery": {
334
+ "$ref": "#/definitions/diagnosticRecovery",
335
+ "description": "受限的恢复说明,不会自动执行。"
336
+ },
337
+ "execution": {
338
+ "$ref": "#/definitions/diagnosticExecution",
339
+ "description": "整次调用的请求观察,独立于失败阶段的 requestState。"
340
+ }
341
+ }
342
+ }
343
+ }
344
+ },
345
+ "definitions": {
346
+ "shopId": {
347
+ "type": "integer",
348
+ "minimum": 1,
349
+ "maximum": 9007199254740991,
350
+ "description": "当前上下文同店正安全整数,凭证、员工资料与权限查询必须同店。"
351
+ },
352
+ "permKey": {
353
+ "type": "string",
354
+ "minLength": 1,
355
+ "pattern": "^[^\\s\\x00-\\x1f\\x7f-\\x9f]+$",
356
+ "description": "一个不含空白或控制字符的权限 key,按单值原文传递,不拆分逗号。"
357
+ },
358
+ "diagnosticCode": {
359
+ "anyOf": [
360
+ {
361
+ "type": "integer",
362
+ "minimum": -9007199254740991,
363
+ "maximum": 9007199254740991
364
+ },
365
+ {
366
+ "type": "string",
367
+ "pattern": "^-?\\d{1,12}$"
368
+ }
369
+ ]
370
+ },
371
+ "diagnosticExpected": {
372
+ "type": "object",
373
+ "additionalProperties": false,
374
+ "required": [],
375
+ "properties": {
376
+ "type": {
377
+ "anyOf": [
378
+ {
379
+ "type": "string",
380
+ "description": "预期的 JSON 类型。"
381
+ },
382
+ {
383
+ "type": "array",
384
+ "items": {
385
+ "type": "string",
386
+ "description": "预期的 JSON 类型。"
387
+ }
388
+ }
389
+ ],
390
+ "description": "同版模型允许的类型。"
391
+ },
392
+ "enum": {
393
+ "type": "array",
394
+ "items": {
395
+ "anyOf": [
396
+ {
397
+ "type": "string"
398
+ },
399
+ {
400
+ "type": "number"
401
+ },
402
+ {
403
+ "type": "boolean"
404
+ },
405
+ {
406
+ "type": "null"
407
+ }
408
+ ],
409
+ "description": "契约声明的静态标量约束。"
410
+ },
411
+ "description": "同版模型允许的静态值。"
412
+ },
413
+ "const": {
414
+ "anyOf": [
415
+ {
416
+ "type": "string"
417
+ },
418
+ {
419
+ "type": "number"
420
+ },
421
+ {
422
+ "type": "boolean"
423
+ },
424
+ {
425
+ "type": "null"
426
+ }
427
+ ],
428
+ "description": "契约声明的静态标量约束。"
429
+ },
430
+ "minimum": {
431
+ "type": "number",
432
+ "description": "包含的最小值。"
433
+ },
434
+ "maximum": {
435
+ "type": "number",
436
+ "description": "包含的最大值。"
437
+ },
438
+ "exclusiveMinimum": {
439
+ "type": "number",
440
+ "description": "不包含的最小值。"
441
+ },
442
+ "exclusiveMaximum": {
443
+ "type": "number",
444
+ "description": "不包含的最大值。"
445
+ },
446
+ "minLength": {
447
+ "type": "integer",
448
+ "description": "最少字符数。"
449
+ },
450
+ "maxLength": {
451
+ "type": "integer",
452
+ "description": "最多字符数。"
453
+ },
454
+ "minItems": {
455
+ "type": "integer",
456
+ "description": "最少元素数。"
457
+ },
458
+ "maxItems": {
459
+ "type": "integer",
460
+ "description": "最多元素数。"
461
+ },
462
+ "format": {
463
+ "type": "string",
464
+ "description": "同版模型声明的格式。"
465
+ },
466
+ "pattern": {
467
+ "type": "string",
468
+ "description": "同版模型声明的字符约束。"
469
+ },
470
+ "additionalProperties": {
471
+ "const": false,
472
+ "description": "对象拒绝契约以外的属性。"
473
+ },
474
+ "contains": {
475
+ "type": "object",
476
+ "additionalProperties": false,
477
+ "required": [
478
+ "const"
479
+ ],
480
+ "properties": {
481
+ "const": {
482
+ "anyOf": [
483
+ {
484
+ "type": "string"
485
+ },
486
+ {
487
+ "type": "number"
488
+ },
489
+ {
490
+ "type": "boolean"
491
+ },
492
+ {
493
+ "type": "null"
494
+ }
495
+ ],
496
+ "description": "契约声明的静态标量约束。"
497
+ }
498
+ }
499
+ },
500
+ "items": {
501
+ "type": "object",
502
+ "additionalProperties": false,
503
+ "required": [
504
+ "enum"
505
+ ],
506
+ "properties": {
507
+ "enum": {
508
+ "type": "array",
509
+ "items": {
510
+ "anyOf": [
511
+ {
512
+ "type": "string"
513
+ },
514
+ {
515
+ "type": "number"
516
+ },
517
+ {
518
+ "type": "boolean"
519
+ },
520
+ {
521
+ "type": "null"
522
+ }
523
+ ],
524
+ "description": "契约声明的静态标量约束。"
525
+ },
526
+ "description": "元素允许的静态值。"
527
+ }
528
+ }
529
+ }
530
+ }
531
+ },
532
+ "diagnosticIssue": {
533
+ "type": "object",
534
+ "additionalProperties": false,
535
+ "required": [
536
+ "source",
537
+ "reason"
538
+ ],
539
+ "properties": {
540
+ "source": {
541
+ "enum": [
542
+ "argv",
543
+ "input",
544
+ "context",
545
+ "output",
546
+ "preview"
547
+ ],
548
+ "description": "问题所属的参数、输入、上下文、结果或预览模型。"
549
+ },
550
+ "path": {
551
+ "type": "string",
552
+ "description": "对应模型中的 JSON Pointer;不含原始输入或动态字典键。"
553
+ },
554
+ "option": {
555
+ "type": "string",
556
+ "description": "可定位时给出的已注册 CLI 选项。"
557
+ },
558
+ "reason": {
559
+ "enum": [
560
+ "required",
561
+ "invalid_type",
562
+ "invalid_choice",
563
+ "out_of_range",
564
+ "invalid_format",
565
+ "conditional_required",
566
+ "constraint",
567
+ "unexpected_property",
568
+ "unknown_option",
569
+ "unknown_command",
570
+ "excess_arguments",
571
+ "missing_value"
572
+ ],
573
+ "description": "字段违反的约束类型,原始值不回显。"
574
+ },
575
+ "expected": {
576
+ "$ref": "#/definitions/diagnosticExpected",
577
+ "description": "同版契约的静态预期。"
578
+ },
579
+ "relatedPaths": {
580
+ "type": "array",
581
+ "items": {
582
+ "type": "string",
583
+ "description": "关联字段的 JSON Pointer。"
584
+ },
585
+ "description": "触发条件约束的关联字段。"
586
+ }
587
+ }
588
+ },
589
+ "diagnosticRecovery": {
590
+ "type": "object",
591
+ "additionalProperties": false,
592
+ "required": [
593
+ "action",
594
+ "automaticBusinessRetry"
595
+ ],
596
+ "properties": {
597
+ "action": {
598
+ "enum": [
599
+ "correct_input",
600
+ "complete_authentication",
601
+ "request_access_review",
602
+ "stop_and_inspect"
603
+ ],
604
+ "description": "依次表示修正本地输入、补认证、核对权限或停止核查;仅是说明,不执行操作或授予权限。"
605
+ },
606
+ "automaticBusinessRetry": {
607
+ "const": false,
608
+ "description": "不据此自动重放业务请求。"
609
+ }
610
+ }
611
+ },
612
+ "diagnosticExecution": {
613
+ "type": "object",
614
+ "additionalProperties": false,
615
+ "required": [
616
+ "requestState",
617
+ "coverage",
618
+ "observedAttempts"
619
+ ],
620
+ "properties": {
621
+ "requestState": {
622
+ "enum": [
623
+ "not_sent",
624
+ "sent",
625
+ "unknown"
626
+ ],
627
+ "description": "整次调用尚未发送、已有发送记录或无法排除未知请求;不代表业务完成。"
628
+ },
629
+ "coverage": {
630
+ "enum": [
631
+ "complete",
632
+ "partial"
633
+ ],
634
+ "description": "请求观察覆盖全部已接入路径,或存在未观测路径;部分覆盖不能声明零请求。"
635
+ },
636
+ "observedAttempts": {
637
+ "type": "integer",
638
+ "minimum": 0,
639
+ "maximum": 9007199254740991,
640
+ "description": "本地已进入发送边界的观测次数下界,不是服务端执行次数。"
641
+ }
642
+ }
643
+ }
644
+ },
645
+ "modules": {
646
+ "permissions": {
647
+ "base": true,
648
+ "required": true,
649
+ "upstreamPath": "data",
650
+ "description": "当前员工权限点的有限视图,不推导授角建议或购买状态。"
651
+ }
652
+ },
653
+ "api": {
654
+ "method": "POST",
655
+ "path": "youzan.shop.rig.open.query.perms/1.0.0"
656
+ },
657
+ "success": {
658
+ "description": "凭证及员工均属于当前单店,权限查询明确成功且每个权限点字段有效,返回 data.permissions。"
659
+ },
660
+ "errors": {
661
+ "description": "员工不存在、业务拒绝、调用者无权限和协议异常均失败;缺字段不补空数组。失败 stdout 为空,stderr 单一脱敏信封,不输出部分员工或权限。",
662
+ "diagnosticsVersion": 2,
663
+ "responseReasons": {
664
+ "staff_object_invalid": {
665
+ "category": "protocol",
666
+ "stage": "staff-model",
667
+ "message": "员工接口返回的 data 不是员工对象,已停止查询权限。",
668
+ "nextStep": "保留本次店铺和失败记录,向服务端核对员工接口的响应字段及目标归属;不重放、换店或换身份。"
669
+ },
670
+ "staff_shop_id_invalid": {
671
+ "category": "protocol",
672
+ "stage": "staff-model",
673
+ "message": "员工接口返回的 data.kdt_id 缺失或不是正安全整数,已停止查询权限。",
674
+ "nextStep": "保留本次店铺和失败记录,向服务端核对员工接口的响应字段及目标归属;不重放、换店或换身份。"
675
+ },
676
+ "staff_shop_mismatch": {
677
+ "category": "scope_unresolved",
678
+ "stage": "staff-model",
679
+ "message": "员工接口返回的 data.kdt_id 与目标店铺不一致,已停止查询权限。",
680
+ "nextStep": "保留本次店铺和失败记录,向服务端核对员工接口的响应字段及目标归属;不重放、换店或换身份。"
681
+ },
682
+ "staff_identity_invalid": {
683
+ "category": "protocol",
684
+ "stage": "staff-model",
685
+ "message": "员工接口返回的 data.yz_open_id 缺失或不是非空字符串,已停止查询权限。",
686
+ "nextStep": "保留本次店铺和失败记录,向服务端核对员工接口的响应字段及目标归属;不重放、换店或换身份。"
687
+ },
688
+ "staff_account_mismatch": {
689
+ "category": "scope_unresolved",
690
+ "stage": "staff-model",
691
+ "message": "员工接口返回的 data.account 与输入登录账号不一致,已停止查询权限。",
692
+ "nextStep": "保留本次店铺和失败记录,向服务端核对员工接口的响应字段及目标归属;不重放、换店或换身份。"
693
+ }
694
+ }
695
+ },
696
+ "notes": [
697
+ "仅当前授权微商城单店;不支持总部、跨店或账号扫描。单店组织角色不能证明产品适用性,服务端决定实际授权范围。",
698
+ "先核验凭证店铺,再定位员工并查询权限,最多三请求、同一目标和凭证快照;10 秒超时,不重试、重定向或切换身份。",
699
+ "dry-run 不联网,账号和派生员工标识固定掩码;缺少上下文时只能指定合法店铺做预览。",
700
+ "省略 perm-key 查询全部权限点,提供时仅查询一个 key;不缩减为菜单权限,不从员工角色或角色目录推导。",
701
+ "每次响应最多 8 MiB,超限整体失败,不截断权限集合;最多三次请求。"
702
+ ]
703
+ }