@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,677 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "input": {
4
+ "type": "object",
5
+ "required": [
6
+ "kdtId",
7
+ "item_id",
8
+ "channel"
9
+ ],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "kdtId": {
13
+ "type": "integer",
14
+ "minimum": 1,
15
+ "maximum": 9007199254740991,
16
+ "description": "目标店铺 ID。"
17
+ },
18
+ "item_id": {
19
+ "type": "integer",
20
+ "minimum": 1,
21
+ "maximum": 9007199254740991,
22
+ "description": "商品 ID,同一商品在各分店和渠道使用相同值;与目标店铺和渠道一起定位,不接受渠道商品 ID 替代。"
23
+ },
24
+ "channel": {
25
+ "type": "integer",
26
+ "enum": [
27
+ 0,
28
+ 1
29
+ ],
30
+ "description": "0网店、1门店。"
31
+ }
32
+ },
33
+ "description": "CLI 解析参数并完成必要上下文补全后的业务输入;不是直接传入 CLI 的 JSON。原始选项、必填条件和默认值见 options。"
34
+ },
35
+ "output": {
36
+ "type": "object",
37
+ "required": [
38
+ "data"
39
+ ],
40
+ "additionalProperties": false,
41
+ "properties": {
42
+ "data": {
43
+ "type": "object",
44
+ "required": [
45
+ "content"
46
+ ],
47
+ "additionalProperties": false,
48
+ "properties": {
49
+ "content": {
50
+ "$ref": "#/definitions/content"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "preview": {
57
+ "type": "object",
58
+ "required": [
59
+ "method",
60
+ "path",
61
+ "body"
62
+ ],
63
+ "additionalProperties": false,
64
+ "properties": {
65
+ "method": {
66
+ "const": "POST"
67
+ },
68
+ "path": {
69
+ "const": "youzan.item.itemdesc.get/1.0.0"
70
+ },
71
+ "body": {
72
+ "type": "object",
73
+ "required": [
74
+ "request"
75
+ ],
76
+ "additionalProperties": false,
77
+ "properties": {
78
+ "request": {
79
+ "type": "object",
80
+ "required": [
81
+ "kdt_id",
82
+ "item_id",
83
+ "channel"
84
+ ],
85
+ "additionalProperties": false,
86
+ "properties": {
87
+ "kdt_id": {
88
+ "type": "integer",
89
+ "minimum": 1,
90
+ "maximum": 9007199254740991,
91
+ "description": "目标店铺 ID。"
92
+ },
93
+ "item_id": {
94
+ "type": "integer",
95
+ "minimum": 1,
96
+ "maximum": 9007199254740991,
97
+ "description": "商品 ID,同一商品在各分店和渠道使用相同值;与目标店铺和渠道一起定位,不接受渠道商品 ID 替代。"
98
+ },
99
+ "channel": {
100
+ "type": "integer",
101
+ "enum": [
102
+ 0,
103
+ 1
104
+ ],
105
+ "description": "0网店、1门店。"
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "definitions": {
114
+ "scope": {
115
+ "type": "object",
116
+ "required": [
117
+ "kdtId",
118
+ "item_id",
119
+ "channel"
120
+ ],
121
+ "additionalProperties": false,
122
+ "properties": {
123
+ "kdtId": {
124
+ "type": "integer",
125
+ "minimum": 1,
126
+ "maximum": 9007199254740991,
127
+ "description": "目标店铺 ID。"
128
+ },
129
+ "item_id": {
130
+ "type": "integer",
131
+ "minimum": 1,
132
+ "maximum": 9007199254740991,
133
+ "description": "商品 ID,同一商品在各分店和渠道使用相同值;与目标店铺和渠道一起定位,不接受渠道商品 ID 替代。"
134
+ },
135
+ "channel": {
136
+ "type": "integer",
137
+ "enum": [
138
+ 0,
139
+ 1
140
+ ],
141
+ "description": "0网店、1门店。"
142
+ }
143
+ }
144
+ },
145
+ "content": {
146
+ "type": "object",
147
+ "properties": {
148
+ "template_id": {
149
+ "type": [
150
+ "integer",
151
+ "null"
152
+ ],
153
+ "minimum": -9007199254740991,
154
+ "maximum": 9007199254740991,
155
+ "description": "商品页模板ID"
156
+ },
157
+ "content": {
158
+ "type": [
159
+ "string",
160
+ "null"
161
+ ],
162
+ "description": "详情页内容"
163
+ },
164
+ "components": {
165
+ "type": [
166
+ "string",
167
+ "null"
168
+ ],
169
+ "description": "商品自定义组件"
170
+ },
171
+ "component_cover_image": {
172
+ "type": [
173
+ "object",
174
+ "null"
175
+ ],
176
+ "properties": {
177
+ "image_id": {
178
+ "type": [
179
+ "integer",
180
+ "null"
181
+ ],
182
+ "minimum": -9007199254740991,
183
+ "maximum": 9007199254740991,
184
+ "description": "图片ID。"
185
+ },
186
+ "height": {
187
+ "type": [
188
+ "integer",
189
+ "null"
190
+ ],
191
+ "minimum": -9007199254740991,
192
+ "maximum": 9007199254740991,
193
+ "description": "高"
194
+ },
195
+ "width": {
196
+ "type": [
197
+ "integer",
198
+ "null"
199
+ ],
200
+ "minimum": -9007199254740991,
201
+ "maximum": 9007199254740991,
202
+ "description": "宽"
203
+ },
204
+ "url": {
205
+ "type": [
206
+ "string",
207
+ "null"
208
+ ],
209
+ "description": "图片url"
210
+ }
211
+ },
212
+ "additionalProperties": true,
213
+ "description": "商品组件封面图。微页面 显示 商品封面图。"
214
+ }
215
+ },
216
+ "additionalProperties": true,
217
+ "description": "返回数据"
218
+ },
219
+ "diagnosticExpected": {
220
+ "type": "object",
221
+ "additionalProperties": false,
222
+ "required": [],
223
+ "properties": {
224
+ "type": {
225
+ "anyOf": [
226
+ {
227
+ "type": "string",
228
+ "description": "预期的 JSON 类型。"
229
+ },
230
+ {
231
+ "type": "array",
232
+ "items": {
233
+ "type": "string",
234
+ "description": "预期的 JSON 类型。"
235
+ }
236
+ }
237
+ ],
238
+ "description": "同版模型允许的类型。"
239
+ },
240
+ "enum": {
241
+ "type": "array",
242
+ "items": {
243
+ "anyOf": [
244
+ {
245
+ "type": "string"
246
+ },
247
+ {
248
+ "type": "number"
249
+ },
250
+ {
251
+ "type": "boolean"
252
+ },
253
+ {
254
+ "type": "null"
255
+ }
256
+ ],
257
+ "description": "契约声明的静态标量约束。"
258
+ },
259
+ "description": "同版模型允许的静态值。"
260
+ },
261
+ "const": {
262
+ "anyOf": [
263
+ {
264
+ "type": "string"
265
+ },
266
+ {
267
+ "type": "number"
268
+ },
269
+ {
270
+ "type": "boolean"
271
+ },
272
+ {
273
+ "type": "null"
274
+ }
275
+ ],
276
+ "description": "契约声明的静态标量约束。"
277
+ },
278
+ "minimum": {
279
+ "type": "number",
280
+ "description": "包含的最小值。"
281
+ },
282
+ "maximum": {
283
+ "type": "number",
284
+ "description": "包含的最大值。"
285
+ },
286
+ "exclusiveMinimum": {
287
+ "type": "number",
288
+ "description": "不包含的最小值。"
289
+ },
290
+ "exclusiveMaximum": {
291
+ "type": "number",
292
+ "description": "不包含的最大值。"
293
+ },
294
+ "minLength": {
295
+ "type": "integer",
296
+ "description": "最少字符数。"
297
+ },
298
+ "maxLength": {
299
+ "type": "integer",
300
+ "description": "最多字符数。"
301
+ },
302
+ "minItems": {
303
+ "type": "integer",
304
+ "description": "最少元素数。"
305
+ },
306
+ "maxItems": {
307
+ "type": "integer",
308
+ "description": "最多元素数。"
309
+ },
310
+ "format": {
311
+ "type": "string",
312
+ "description": "同版模型声明的格式。"
313
+ },
314
+ "pattern": {
315
+ "type": "string",
316
+ "description": "同版模型声明的字符约束。"
317
+ },
318
+ "additionalProperties": {
319
+ "const": false,
320
+ "description": "对象拒绝契约以外的属性。"
321
+ },
322
+ "contains": {
323
+ "type": "object",
324
+ "additionalProperties": false,
325
+ "required": [
326
+ "const"
327
+ ],
328
+ "properties": {
329
+ "const": {
330
+ "anyOf": [
331
+ {
332
+ "type": "string"
333
+ },
334
+ {
335
+ "type": "number"
336
+ },
337
+ {
338
+ "type": "boolean"
339
+ },
340
+ {
341
+ "type": "null"
342
+ }
343
+ ],
344
+ "description": "契约声明的静态标量约束。"
345
+ }
346
+ }
347
+ },
348
+ "items": {
349
+ "type": "object",
350
+ "additionalProperties": false,
351
+ "required": [
352
+ "enum"
353
+ ],
354
+ "properties": {
355
+ "enum": {
356
+ "type": "array",
357
+ "items": {
358
+ "anyOf": [
359
+ {
360
+ "type": "string"
361
+ },
362
+ {
363
+ "type": "number"
364
+ },
365
+ {
366
+ "type": "boolean"
367
+ },
368
+ {
369
+ "type": "null"
370
+ }
371
+ ],
372
+ "description": "契约声明的静态标量约束。"
373
+ },
374
+ "description": "元素允许的静态值。"
375
+ }
376
+ }
377
+ }
378
+ }
379
+ },
380
+ "diagnosticIssue": {
381
+ "type": "object",
382
+ "additionalProperties": false,
383
+ "required": [
384
+ "source",
385
+ "reason"
386
+ ],
387
+ "properties": {
388
+ "source": {
389
+ "enum": [
390
+ "argv",
391
+ "input",
392
+ "context",
393
+ "output",
394
+ "preview"
395
+ ],
396
+ "description": "问题所属的参数、输入、上下文、结果或预览模型。"
397
+ },
398
+ "path": {
399
+ "type": "string",
400
+ "description": "对应模型中的 JSON Pointer;不含原始输入或动态字典键。"
401
+ },
402
+ "option": {
403
+ "type": "string",
404
+ "description": "可定位时给出的已注册 CLI 选项。"
405
+ },
406
+ "reason": {
407
+ "enum": [
408
+ "required",
409
+ "invalid_type",
410
+ "invalid_choice",
411
+ "out_of_range",
412
+ "invalid_format",
413
+ "conditional_required",
414
+ "constraint",
415
+ "unexpected_property",
416
+ "unknown_option",
417
+ "unknown_command",
418
+ "excess_arguments",
419
+ "missing_value"
420
+ ],
421
+ "description": "字段违反的约束类型,原始值不回显。"
422
+ },
423
+ "expected": {
424
+ "$ref": "#/definitions/diagnosticExpected",
425
+ "description": "同版契约的静态预期。"
426
+ },
427
+ "relatedPaths": {
428
+ "type": "array",
429
+ "items": {
430
+ "type": "string",
431
+ "description": "关联字段的 JSON Pointer。"
432
+ },
433
+ "description": "触发条件约束的关联字段。"
434
+ }
435
+ }
436
+ },
437
+ "diagnosticRecovery": {
438
+ "type": "object",
439
+ "additionalProperties": false,
440
+ "required": [
441
+ "action",
442
+ "automaticBusinessRetry"
443
+ ],
444
+ "properties": {
445
+ "action": {
446
+ "enum": [
447
+ "correct_input",
448
+ "complete_authentication",
449
+ "request_access_review",
450
+ "stop_and_inspect"
451
+ ],
452
+ "description": "依次表示修正本地输入、补认证、核对权限或停止核查;仅是说明,不执行操作或授予权限。"
453
+ },
454
+ "automaticBusinessRetry": {
455
+ "const": false,
456
+ "description": "不据此自动重放业务请求。"
457
+ }
458
+ }
459
+ },
460
+ "diagnosticExecution": {
461
+ "type": "object",
462
+ "additionalProperties": false,
463
+ "required": [
464
+ "requestState",
465
+ "coverage",
466
+ "observedAttempts"
467
+ ],
468
+ "properties": {
469
+ "requestState": {
470
+ "enum": [
471
+ "not_sent",
472
+ "sent",
473
+ "unknown"
474
+ ],
475
+ "description": "整次调用尚未发送、已有发送记录或无法排除未知请求;不代表业务完成。"
476
+ },
477
+ "coverage": {
478
+ "enum": [
479
+ "complete",
480
+ "partial"
481
+ ],
482
+ "description": "请求观察覆盖全部已接入路径,或存在未观测路径;部分覆盖不能声明零请求。"
483
+ },
484
+ "observedAttempts": {
485
+ "type": "integer",
486
+ "minimum": 0,
487
+ "maximum": 9007199254740991,
488
+ "description": "本地已进入发送边界的观测次数下界,不是服务端执行次数。"
489
+ }
490
+ }
491
+ }
492
+ },
493
+ "modules": {
494
+ "content": {
495
+ "base": true,
496
+ "upstreamPath": "data",
497
+ "required": true,
498
+ "description": "商品图文对象,保留HTML、组件字符串、模板及封面;不含基本商品资料和H5加工。"
499
+ }
500
+ },
501
+ "api": {
502
+ "method": "POST",
503
+ "path": "youzan.item.itemdesc.get/1.0.0"
504
+ },
505
+ "success": {
506
+ "description": "单个商品图文对象满足模型后输出 data.content。"
507
+ },
508
+ "errors": {
509
+ "description": "失败 stdout 为空,stderr 为一份脱敏错误 JSON,退出码非零;不返回部分成功,不自动重试、切换身份或目标。按 error 模型及安全下一步处理。",
510
+ "diagnosticsVersion": 2
511
+ },
512
+ "notes": [
513
+ "--kdt-id 省略时使用本次有效上下文 shopId;显式提供的非法值不回退。两者都缺失时拒绝;目标范围、同店核验和服务端权限仍按本命令校验。",
514
+ "按店铺、商品 ID 和渠道只查询图文,成功返回 data.content;不补查商品资料、H5 或角色。",
515
+ "HTML 和 components 字符串作为数据返回,不解析、不渲染、不访问其中链接。",
516
+ "可选字段缺失保持省略,未知扩展保留;缺少图文对象或错型失败,不能据此推断商品不存在。",
517
+ "不支持分店查询总部或分店渠道互查;at=all 不表示任意跨店授权,员工链路尚未完成真实验收。",
518
+ "本地 --dry-run 不读取凭证、不联网;预览只证明构造计划,不证明对象存在或权限有效。真实执行仍需有效上下文及目标范围授权,at 声明不替代服务端授权。",
519
+ "商品标识采用新版口径:item_id/sku_id 跨分店和渠道统一,channel_item_id/channel_sku_id 对应目标店铺渠道的旧标识。商品查询使用统一商品 ID 和渠道,不接受旧渠道 ID 替代,不因标识数值相等而互换。"
520
+ ],
521
+ "error": {
522
+ "type": "object",
523
+ "required": [
524
+ "success",
525
+ "code",
526
+ "message",
527
+ "details"
528
+ ],
529
+ "additionalProperties": false,
530
+ "properties": {
531
+ "success": {
532
+ "const": false
533
+ },
534
+ "code": {
535
+ "const": -10001
536
+ },
537
+ "message": {
538
+ "type": "string",
539
+ "minLength": 1
540
+ },
541
+ "details": {
542
+ "type": "object",
543
+ "required": [
544
+ "category",
545
+ "stage",
546
+ "command",
547
+ "targetScope",
548
+ "requestState",
549
+ "nextStep",
550
+ "errorVersion",
551
+ "recovery",
552
+ "execution"
553
+ ],
554
+ "additionalProperties": false,
555
+ "properties": {
556
+ "category": {
557
+ "type": "string",
558
+ "enum": [
559
+ "parameter",
560
+ "configuration",
561
+ "transport",
562
+ "authentication",
563
+ "permission",
564
+ "http",
565
+ "protocol",
566
+ "business_rejected",
567
+ "not_found",
568
+ "scope_unresolved",
569
+ "pagination_stalled",
570
+ "budget_exceeded",
571
+ "missing_alias"
572
+ ]
573
+ },
574
+ "stage": {
575
+ "type": "string",
576
+ "minLength": 1
577
+ },
578
+ "command": {
579
+ "const": "item.item-content.get"
580
+ },
581
+ "targetScope": {
582
+ "oneOf": [
583
+ {
584
+ "$ref": "#/definitions/scope"
585
+ },
586
+ {
587
+ "type": "object",
588
+ "maxProperties": 0
589
+ }
590
+ ]
591
+ },
592
+ "requestState": {
593
+ "type": "string",
594
+ "enum": [
595
+ "not_sent",
596
+ "sent",
597
+ "unknown"
598
+ ],
599
+ "description": "not_sent 确认本步请求未发送;sent 已取得本步响应;unknown 传输中断,无法确定本步结果。不是整个多步查询的发送汇总。"
600
+ },
601
+ "nextStep": {
602
+ "type": "string",
603
+ "minLength": 1
604
+ },
605
+ "api": {
606
+ "type": "string",
607
+ "minLength": 1
608
+ },
609
+ "httpStatus": {
610
+ "type": "integer",
611
+ "minimum": 100,
612
+ "maximum": 599
613
+ },
614
+ "businessCode": {
615
+ "oneOf": [
616
+ {
617
+ "type": "integer",
618
+ "minimum": -9007199254740991,
619
+ "maximum": 9007199254740991
620
+ },
621
+ {
622
+ "type": "string",
623
+ "pattern": "^-?\\d{1,12}$"
624
+ }
625
+ ]
626
+ },
627
+ "gatewayCode": {
628
+ "oneOf": [
629
+ {
630
+ "type": "integer",
631
+ "minimum": -9007199254740991,
632
+ "maximum": 9007199254740991
633
+ },
634
+ {
635
+ "type": "string",
636
+ "pattern": "^-?\\d{1,12}$"
637
+ }
638
+ ]
639
+ },
640
+ "trace_id": {
641
+ "type": "string",
642
+ "pattern": "^[a-zA-Z0-9_-]{1,128}$"
643
+ },
644
+ "request_id": {
645
+ "type": "string",
646
+ "pattern": "^[a-zA-Z0-9_-]{1,128}$"
647
+ },
648
+ "errorVersion": {
649
+ "const": 2,
650
+ "description": "本命令采用错误诊断协议第二版。"
651
+ },
652
+ "issues": {
653
+ "type": "array",
654
+ "minItems": 1,
655
+ "maxItems": 16,
656
+ "items": {
657
+ "$ref": "#/definitions/diagnosticIssue"
658
+ },
659
+ "description": "最多十六个已定位问题,不包含收到的原值。"
660
+ },
661
+ "issuesTruncated": {
662
+ "const": true,
663
+ "description": "问题超过返回上限,当前列表没有穷尽全部问题。"
664
+ },
665
+ "recovery": {
666
+ "$ref": "#/definitions/diagnosticRecovery",
667
+ "description": "受限的恢复说明,不会自动执行。"
668
+ },
669
+ "execution": {
670
+ "$ref": "#/definitions/diagnosticExecution",
671
+ "description": "整次调用的请求观察,独立于失败阶段的 requestState。"
672
+ }
673
+ }
674
+ }
675
+ }
676
+ }
677
+ }
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ QueryError, readApiEnvelope, assertSafeNumbers, object
5
+ } = require('../../../../execution/query-api');
6
+
7
+ class ItemQueryError extends QueryError {
8
+ constructor(category, stage, scope, facts = {}, sent = 'not_sent', command = 'item.item.get') {
9
+ super(category, stage, scope, facts, sent, command,
10
+ '核对当前命令的 schema、目标店铺及渠道;接口拒绝时核对服务端授权,不自动切换目标。');
11
+ this.message = `商品查询失败:${category}(${stage})`;
12
+ }
13
+ }
14
+
15
+ async function readApi(path, body, stage, scope, command = 'item.item.get') {
16
+ const failure = (category, facts = {}, sent = 'sent', at = stage) =>
17
+ new ItemQueryError(category, at, scope, facts, sent, command);
18
+ const { result, facts } = await readApiEnvelope(path, body,
19
+ (category, details, sent, at) => failure(category, details, sent,
20
+ at === 'configuration' ? at : stage));
21
+ if (result.success === false || !(result.success === true || [0, 200].includes(result.code))) {
22
+ throw failure('business_rejected', facts);
23
+ }
24
+ // Invalid business data must not erase safe diagnostics from a rejected response.
25
+ try { assertSafeNumbers(result); }
26
+ catch { throw failure('protocol', facts); }
27
+ if (!Object.hasOwn(result, 'data')) throw failure('protocol', facts);
28
+ return result.data;
29
+ }
30
+
31
+ module.exports = { ItemQueryError, readApi, object };