@endora-commerce/contracts 0.110.0 → 0.111.0

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 (347) hide show
  1. package/dist/accept-language.d.ts +31 -0
  2. package/dist/accept-language.js +64 -0
  3. package/dist/admin-actions.d.ts +2 -0
  4. package/dist/admin-actions.js +18 -0
  5. package/dist/admin-contributions.d.ts +37 -5
  6. package/dist/admin-contributions.js +9 -2
  7. package/dist/admin-roles.d.ts +9 -0
  8. package/dist/admin.d.ts +37 -0
  9. package/dist/admin.js +19 -0
  10. package/dist/api-keys.d.ts +22 -0
  11. package/dist/api-keys.js +4 -0
  12. package/dist/assets-library.d.ts +19 -0
  13. package/dist/assets-library.js +14 -0
  14. package/dist/auth.d.ts +9 -0
  15. package/dist/auth.js +9 -0
  16. package/dist/carts.d.ts +30 -1
  17. package/dist/carts.js +20 -5
  18. package/dist/catalog.d.ts +61 -22
  19. package/dist/catalog.js +32 -6
  20. package/dist/cms.d.ts +33 -3
  21. package/dist/cms.js +15 -0
  22. package/dist/command-hooks.d.ts +301 -0
  23. package/dist/command-hooks.js +248 -0
  24. package/dist/comparisons.d.ts +14 -14
  25. package/dist/credit-limits.d.ts +21 -0
  26. package/dist/credit-limits.js +21 -0
  27. package/dist/crm.d.ts +81 -55
  28. package/dist/crm.js +15 -5
  29. package/dist/custom-fields.d.ts +403 -49
  30. package/dist/custom-fields.js +127 -0
  31. package/dist/customer-accounts.d.ts +138 -0
  32. package/dist/customer-accounts.js +4 -0
  33. package/dist/customer-notifications.d.ts +143 -0
  34. package/dist/customer-notifications.js +41 -0
  35. package/dist/customers.d.ts +52 -0
  36. package/dist/customers.js +53 -0
  37. package/dist/dictionary.d.ts +53 -0
  38. package/dist/dictionary.js +25 -0
  39. package/dist/document-templates.d.ts +4 -4
  40. package/dist/email.d.ts +34 -0
  41. package/dist/email.js +6 -0
  42. package/dist/errors.d.ts +312 -2
  43. package/dist/errors.js +377 -2
  44. package/dist/forms.d.ts +88 -88
  45. package/dist/i18n.d.ts +34 -0
  46. package/dist/i18n.js +15 -0
  47. package/dist/index.d.ts +7 -1
  48. package/dist/index.js +12 -1
  49. package/dist/invoice-ledger.d.ts +6 -6
  50. package/dist/invoices.d.ts +126 -0
  51. package/dist/invoices.js +49 -0
  52. package/dist/line-bounds.d.ts +53 -0
  53. package/dist/line-bounds.js +65 -0
  54. package/dist/megamenu.d.ts +27 -27
  55. package/dist/mfa.d.ts +86 -0
  56. package/dist/mfa.js +90 -0
  57. package/dist/modules.d.ts +21 -5
  58. package/dist/modules.js +60 -3
  59. package/dist/orders.d.ts +141 -0
  60. package/dist/orders.js +80 -3
  61. package/dist/organization-hooks.d.ts +99 -0
  62. package/dist/organization-hooks.js +22 -0
  63. package/dist/organization-registry-lookup.d.ts +5 -5
  64. package/dist/organization-roles.d.ts +1 -0
  65. package/dist/organization-roles.js +7 -0
  66. package/dist/organizations.d.ts +954 -17
  67. package/dist/organizations.js +229 -8
  68. package/dist/price-books.d.ts +173 -25
  69. package/dist/price-books.js +41 -0
  70. package/dist/price-lists.d.ts +5 -2
  71. package/dist/product-feeds.d.ts +157 -8
  72. package/dist/product-feeds.js +41 -2
  73. package/dist/product-scopes.d.ts +17 -0
  74. package/dist/product-scopes.js +31 -5
  75. package/dist/projects.d.ts +61 -28
  76. package/dist/projects.js +47 -9
  77. package/dist/promotions.d.ts +157 -5
  78. package/dist/promotions.js +23 -1
  79. package/dist/pwa.d.ts +39 -0
  80. package/dist/quick-order.d.ts +9 -3
  81. package/dist/quick-order.js +4 -3
  82. package/dist/quote-requests.d.ts +168 -5
  83. package/dist/quote-requests.js +69 -8
  84. package/dist/record-references.d.ts +15 -15
  85. package/dist/returns.d.ts +6 -0
  86. package/dist/returns.js +4 -2
  87. package/dist/sales-channels.d.ts +34 -3
  88. package/dist/sales-channels.js +16 -1
  89. package/dist/schema-extensions.d.ts +36 -0
  90. package/dist/schema-extensions.js +29 -0
  91. package/dist/seo.d.ts +2 -2
  92. package/dist/settings.d.ts +44 -2
  93. package/dist/settings.js +17 -2
  94. package/dist/shopping-lists.d.ts +39 -1
  95. package/dist/shopping-lists.js +37 -3
  96. package/dist/storefront-cache-tags.d.ts +10 -0
  97. package/dist/tasks.d.ts +21 -21
  98. package/dist/taxes.d.ts +27 -0
  99. package/dist/taxes.js +4 -0
  100. package/dist/transactional-emails.d.ts +39 -13
  101. package/dist/webhooks.d.ts +75 -0
  102. package/dist/webhooks.js +24 -0
  103. package/package.json +4 -2
  104. package/dist/actor.d.ts.map +0 -1
  105. package/dist/actor.js.map +0 -1
  106. package/dist/addresses.d.ts.map +0 -1
  107. package/dist/addresses.js.map +0 -1
  108. package/dist/admin-actions.d.ts.map +0 -1
  109. package/dist/admin-actions.js.map +0 -1
  110. package/dist/admin-contributions.d.ts.map +0 -1
  111. package/dist/admin-contributions.js.map +0 -1
  112. package/dist/admin-feedback.d.ts.map +0 -1
  113. package/dist/admin-feedback.js.map +0 -1
  114. package/dist/admin-i18n.d.ts.map +0 -1
  115. package/dist/admin-i18n.js.map +0 -1
  116. package/dist/admin-name.d.ts.map +0 -1
  117. package/dist/admin-name.js.map +0 -1
  118. package/dist/admin-notifications.d.ts.map +0 -1
  119. package/dist/admin-notifications.js.map +0 -1
  120. package/dist/admin-preferences.d.ts.map +0 -1
  121. package/dist/admin-preferences.js.map +0 -1
  122. package/dist/admin-roles.d.ts.map +0 -1
  123. package/dist/admin-roles.js.map +0 -1
  124. package/dist/admin-search.d.ts.map +0 -1
  125. package/dist/admin-search.js.map +0 -1
  126. package/dist/admin-users.d.ts.map +0 -1
  127. package/dist/admin-users.js.map +0 -1
  128. package/dist/admin.d.ts.map +0 -1
  129. package/dist/admin.js.map +0 -1
  130. package/dist/analytics.d.ts.map +0 -1
  131. package/dist/analytics.js.map +0 -1
  132. package/dist/api-keys.d.ts.map +0 -1
  133. package/dist/api-keys.js.map +0 -1
  134. package/dist/assets-library.d.ts.map +0 -1
  135. package/dist/assets-library.js.map +0 -1
  136. package/dist/audit-logs.d.ts.map +0 -1
  137. package/dist/audit-logs.js.map +0 -1
  138. package/dist/auth.d.ts.map +0 -1
  139. package/dist/auth.js.map +0 -1
  140. package/dist/blog.d.ts.map +0 -1
  141. package/dist/blog.js.map +0 -1
  142. package/dist/capabilities.d.ts.map +0 -1
  143. package/dist/capabilities.js.map +0 -1
  144. package/dist/carts.d.ts.map +0 -1
  145. package/dist/carts.js.map +0 -1
  146. package/dist/catalog.d.ts.map +0 -1
  147. package/dist/catalog.js.map +0 -1
  148. package/dist/cms-brand.d.ts.map +0 -1
  149. package/dist/cms-brand.js.map +0 -1
  150. package/dist/cms-contact-form.d.ts.map +0 -1
  151. package/dist/cms-contact-form.js.map +0 -1
  152. package/dist/cms.d.ts.map +0 -1
  153. package/dist/cms.js.map +0 -1
  154. package/dist/common.d.ts.map +0 -1
  155. package/dist/common.js.map +0 -1
  156. package/dist/comparisons.d.ts.map +0 -1
  157. package/dist/comparisons.js.map +0 -1
  158. package/dist/credentials.d.ts.map +0 -1
  159. package/dist/credentials.js.map +0 -1
  160. package/dist/credit-limits.d.ts.map +0 -1
  161. package/dist/credit-limits.js.map +0 -1
  162. package/dist/crm-rich-text.d.ts.map +0 -1
  163. package/dist/crm-rich-text.js.map +0 -1
  164. package/dist/crm.d.ts.map +0 -1
  165. package/dist/crm.js.map +0 -1
  166. package/dist/currencies.d.ts.map +0 -1
  167. package/dist/currencies.js.map +0 -1
  168. package/dist/custom-fields.d.ts.map +0 -1
  169. package/dist/custom-fields.js.map +0 -1
  170. package/dist/customer-accounts.d.ts.map +0 -1
  171. package/dist/customer-accounts.js.map +0 -1
  172. package/dist/customers.d.ts.map +0 -1
  173. package/dist/customers.js.map +0 -1
  174. package/dist/dictionary.d.ts.map +0 -1
  175. package/dist/dictionary.js.map +0 -1
  176. package/dist/document-templates.d.ts.map +0 -1
  177. package/dist/document-templates.js.map +0 -1
  178. package/dist/document-values.d.ts.map +0 -1
  179. package/dist/document-values.js.map +0 -1
  180. package/dist/email-address.d.ts.map +0 -1
  181. package/dist/email-address.js.map +0 -1
  182. package/dist/email.d.ts.map +0 -1
  183. package/dist/email.js.map +0 -1
  184. package/dist/envelopes.d.ts.map +0 -1
  185. package/dist/envelopes.js.map +0 -1
  186. package/dist/environment-inputs.d.ts.map +0 -1
  187. package/dist/environment-inputs.js.map +0 -1
  188. package/dist/erp-connector.d.ts.map +0 -1
  189. package/dist/erp-connector.js.map +0 -1
  190. package/dist/errors.d.ts.map +0 -1
  191. package/dist/errors.js.map +0 -1
  192. package/dist/forms-logic.d.ts.map +0 -1
  193. package/dist/forms-logic.fixtures.d.ts.map +0 -1
  194. package/dist/forms-logic.fixtures.js.map +0 -1
  195. package/dist/forms-logic.js.map +0 -1
  196. package/dist/forms.d.ts.map +0 -1
  197. package/dist/forms.js.map +0 -1
  198. package/dist/google-analytics.d.ts.map +0 -1
  199. package/dist/google-analytics.js.map +0 -1
  200. package/dist/google-tag-manager.d.ts.map +0 -1
  201. package/dist/google-tag-manager.js.map +0 -1
  202. package/dist/i18n.d.ts.map +0 -1
  203. package/dist/i18n.js.map +0 -1
  204. package/dist/import-export.d.ts.map +0 -1
  205. package/dist/import-export.js.map +0 -1
  206. package/dist/index.d.ts.map +0 -1
  207. package/dist/index.js.map +0 -1
  208. package/dist/inventory.d.ts.map +0 -1
  209. package/dist/inventory.js.map +0 -1
  210. package/dist/invoice-ledger.d.ts.map +0 -1
  211. package/dist/invoice-ledger.js.map +0 -1
  212. package/dist/invoices.d.ts.map +0 -1
  213. package/dist/invoices.js.map +0 -1
  214. package/dist/kernel.d.ts.map +0 -1
  215. package/dist/kernel.js.map +0 -1
  216. package/dist/languages.d.ts.map +0 -1
  217. package/dist/languages.js.map +0 -1
  218. package/dist/line-groups.d.ts.map +0 -1
  219. package/dist/line-groups.js.map +0 -1
  220. package/dist/linkedin-ads.d.ts.map +0 -1
  221. package/dist/linkedin-ads.js.map +0 -1
  222. package/dist/localized-name.d.ts.map +0 -1
  223. package/dist/localized-name.js.map +0 -1
  224. package/dist/megamenu.d.ts.map +0 -1
  225. package/dist/megamenu.js.map +0 -1
  226. package/dist/meta-ads.d.ts.map +0 -1
  227. package/dist/meta-ads.js.map +0 -1
  228. package/dist/mfa.d.ts.map +0 -1
  229. package/dist/mfa.js.map +0 -1
  230. package/dist/modules.d.ts.map +0 -1
  231. package/dist/modules.js.map +0 -1
  232. package/dist/money-decimal.d.ts.map +0 -1
  233. package/dist/money-decimal.js.map +0 -1
  234. package/dist/money-input.d.ts.map +0 -1
  235. package/dist/money-input.js.map +0 -1
  236. package/dist/newsletter.d.ts.map +0 -1
  237. package/dist/newsletter.js.map +0 -1
  238. package/dist/order-minimums.d.ts.map +0 -1
  239. package/dist/order-minimums.js.map +0 -1
  240. package/dist/orders.d.ts.map +0 -1
  241. package/dist/orders.js.map +0 -1
  242. package/dist/organization-registry-lookup.d.ts.map +0 -1
  243. package/dist/organization-registry-lookup.js.map +0 -1
  244. package/dist/organization-roles.d.ts.map +0 -1
  245. package/dist/organization-roles.js.map +0 -1
  246. package/dist/organizations.d.ts.map +0 -1
  247. package/dist/organizations.js.map +0 -1
  248. package/dist/page-builder-props.d.ts.map +0 -1
  249. package/dist/page-builder-props.js.map +0 -1
  250. package/dist/page-builder-values.d.ts.map +0 -1
  251. package/dist/page-builder-values.js.map +0 -1
  252. package/dist/pagination.d.ts.map +0 -1
  253. package/dist/pagination.js.map +0 -1
  254. package/dist/payment-methods.d.ts.map +0 -1
  255. package/dist/payment-methods.js.map +0 -1
  256. package/dist/payment-return-url.d.ts.map +0 -1
  257. package/dist/payment-return-url.js.map +0 -1
  258. package/dist/payments.d.ts.map +0 -1
  259. package/dist/payments.js.map +0 -1
  260. package/dist/pim-connector.d.ts.map +0 -1
  261. package/dist/pim-connector.js.map +0 -1
  262. package/dist/pim-field-path.d.ts.map +0 -1
  263. package/dist/pim-field-path.js.map +0 -1
  264. package/dist/pim-locale-mapping.d.ts.map +0 -1
  265. package/dist/pim-locale-mapping.js.map +0 -1
  266. package/dist/platform-info.d.ts.map +0 -1
  267. package/dist/platform-info.js.map +0 -1
  268. package/dist/platform-language.d.ts.map +0 -1
  269. package/dist/platform-language.js.map +0 -1
  270. package/dist/price-book-decimal.d.ts.map +0 -1
  271. package/dist/price-book-decimal.js.map +0 -1
  272. package/dist/price-books.d.ts.map +0 -1
  273. package/dist/price-books.js.map +0 -1
  274. package/dist/price-lists.d.ts.map +0 -1
  275. package/dist/price-lists.js.map +0 -1
  276. package/dist/product-feeds.d.ts.map +0 -1
  277. package/dist/product-feeds.js.map +0 -1
  278. package/dist/product-scope-model.d.ts.map +0 -1
  279. package/dist/product-scope-model.js.map +0 -1
  280. package/dist/product-scope-overrides.d.ts.map +0 -1
  281. package/dist/product-scope-overrides.js.map +0 -1
  282. package/dist/product-scoped-values.d.ts.map +0 -1
  283. package/dist/product-scoped-values.js.map +0 -1
  284. package/dist/product-scopes.d.ts.map +0 -1
  285. package/dist/product-scopes.js.map +0 -1
  286. package/dist/product-summary-text.d.ts.map +0 -1
  287. package/dist/product-summary-text.js.map +0 -1
  288. package/dist/product-tax-rates.d.ts.map +0 -1
  289. package/dist/product-tax-rates.js.map +0 -1
  290. package/dist/product-url-keys.d.ts.map +0 -1
  291. package/dist/product-url-keys.js.map +0 -1
  292. package/dist/product-value-resolver.d.ts.map +0 -1
  293. package/dist/product-value-resolver.js.map +0 -1
  294. package/dist/projects.d.ts.map +0 -1
  295. package/dist/projects.js.map +0 -1
  296. package/dist/promotions.d.ts.map +0 -1
  297. package/dist/promotions.js.map +0 -1
  298. package/dist/prompt-actions.d.ts.map +0 -1
  299. package/dist/prompt-actions.js.map +0 -1
  300. package/dist/pwa.d.ts.map +0 -1
  301. package/dist/pwa.js.map +0 -1
  302. package/dist/quick-order.d.ts.map +0 -1
  303. package/dist/quick-order.js.map +0 -1
  304. package/dist/quote-requests.d.ts.map +0 -1
  305. package/dist/quote-requests.js.map +0 -1
  306. package/dist/record-references.d.ts.map +0 -1
  307. package/dist/record-references.js.map +0 -1
  308. package/dist/record-rich-text.d.ts.map +0 -1
  309. package/dist/record-rich-text.js.map +0 -1
  310. package/dist/returns.d.ts.map +0 -1
  311. package/dist/returns.js.map +0 -1
  312. package/dist/sales-channels.d.ts.map +0 -1
  313. package/dist/sales-channels.js.map +0 -1
  314. package/dist/saved-list-views.d.ts.map +0 -1
  315. package/dist/saved-list-views.js.map +0 -1
  316. package/dist/scope-notice.d.ts.map +0 -1
  317. package/dist/scope-notice.js.map +0 -1
  318. package/dist/scoped-write-encoding.d.ts.map +0 -1
  319. package/dist/scoped-write-encoding.js.map +0 -1
  320. package/dist/search.d.ts.map +0 -1
  321. package/dist/search.js.map +0 -1
  322. package/dist/seo.d.ts.map +0 -1
  323. package/dist/seo.js.map +0 -1
  324. package/dist/settings.d.ts.map +0 -1
  325. package/dist/settings.js.map +0 -1
  326. package/dist/shipments.d.ts.map +0 -1
  327. package/dist/shipments.js.map +0 -1
  328. package/dist/shipping-methods.d.ts.map +0 -1
  329. package/dist/shipping-methods.js.map +0 -1
  330. package/dist/shopping-lists.d.ts.map +0 -1
  331. package/dist/shopping-lists.js.map +0 -1
  332. package/dist/storefront-cache-tags.d.ts.map +0 -1
  333. package/dist/storefront-cache-tags.js.map +0 -1
  334. package/dist/storefront-language-path.d.ts.map +0 -1
  335. package/dist/storefront-language-path.js.map +0 -1
  336. package/dist/storefront-value-overrides.d.ts.map +0 -1
  337. package/dist/storefront-value-overrides.js.map +0 -1
  338. package/dist/tasks.d.ts.map +0 -1
  339. package/dist/tasks.js.map +0 -1
  340. package/dist/taxes.d.ts.map +0 -1
  341. package/dist/taxes.js.map +0 -1
  342. package/dist/text-normalization.d.ts.map +0 -1
  343. package/dist/text-normalization.js.map +0 -1
  344. package/dist/transactional-emails.d.ts.map +0 -1
  345. package/dist/transactional-emails.js.map +0 -1
  346. package/dist/webhooks.d.ts.map +0 -1
  347. package/dist/webhooks.js.map +0 -1
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `Accept-Language` as an ordered list of tags, heaviest `q` first.
3
+ *
4
+ * RFC 9110 makes the header a q-weighted list, so `split(',')[0]` reads
5
+ * `en;q=0.2,pl;q=0.9` as English. This is the one parse: the platform's
6
+ * prose-language ladder (`kernel/i18n/request-language.ts`) and the channel
7
+ * content-language rule (`requestScopeLanguage`, `product-scopes.ts`) both read
8
+ * the header through it (feature 083 R9; moved here from the kernel by
9
+ * issue #397 so a module can reach it).
10
+ *
11
+ * Bounded twice, because the header is attacker-controlled on every request:
12
+ * to {@link MAX_HEADER_LENGTH} characters and, after weighting, to
13
+ * {@link MAX_TAGS} tags. Exceeding either is not an error — the remainder is
14
+ * simply not read. A malformed `q` drops its tag rather than guessing a weight.
15
+ * `*` is returned as an ordinary tag; no consumer matches it to a language.
16
+ */
17
+ export declare function parseAcceptLanguage(header: string | readonly string[] | undefined): string[];
18
+ /** One element of a parsed `Accept-Language` header: the tag and its weight. */
19
+ export interface WeightedLanguageTag {
20
+ tag: string;
21
+ /** The `q` parameter as written, `1` when absent. Not clamped: `0` and below are kept. */
22
+ q: number;
23
+ }
24
+ /**
25
+ * {@link parseAcceptLanguage} with the weights kept, in the same order and under the same
26
+ * bounds. For a consumer that has to tell a tag at `q=0` — "not acceptable" (RFC 9110) — from
27
+ * an ordinary one, as the storefront's locale redirect does (issue #1011); every other reader
28
+ * takes {@link parseAcceptLanguage}.
29
+ */
30
+ export declare function weightedAcceptLanguage(header: string | readonly string[] | undefined): WeightedLanguageTag[];
31
+ //# sourceMappingURL=accept-language.d.ts.map
@@ -0,0 +1,64 @@
1
+ /** Bound on the header read — the parse half of the security bound (D-139 § 8.1). */
2
+ const MAX_HEADER_LENGTH = 512;
3
+ /** Bound on how many tags are considered, applied **after** q-sorting. */
4
+ const MAX_TAGS = 10;
5
+ /**
6
+ * `Accept-Language` as an ordered list of tags, heaviest `q` first.
7
+ *
8
+ * RFC 9110 makes the header a q-weighted list, so `split(',')[0]` reads
9
+ * `en;q=0.2,pl;q=0.9` as English. This is the one parse: the platform's
10
+ * prose-language ladder (`kernel/i18n/request-language.ts`) and the channel
11
+ * content-language rule (`requestScopeLanguage`, `product-scopes.ts`) both read
12
+ * the header through it (feature 083 R9; moved here from the kernel by
13
+ * issue #397 so a module can reach it).
14
+ *
15
+ * Bounded twice, because the header is attacker-controlled on every request:
16
+ * to {@link MAX_HEADER_LENGTH} characters and, after weighting, to
17
+ * {@link MAX_TAGS} tags. Exceeding either is not an error — the remainder is
18
+ * simply not read. A malformed `q` drops its tag rather than guessing a weight.
19
+ * `*` is returned as an ordinary tag; no consumer matches it to a language.
20
+ */
21
+ export function parseAcceptLanguage(header) {
22
+ return weightedAcceptLanguage(header).map((entry) => entry.tag);
23
+ }
24
+ /**
25
+ * {@link parseAcceptLanguage} with the weights kept, in the same order and under the same
26
+ * bounds. For a consumer that has to tell a tag at `q=0` — "not acceptable" (RFC 9110) — from
27
+ * an ordinary one, as the storefront's locale redirect does (issue #1011); every other reader
28
+ * takes {@link parseAcceptLanguage}.
29
+ */
30
+ export function weightedAcceptLanguage(header) {
31
+ const raw = typeof header === 'string' ? header : header?.[0];
32
+ if (!raw)
33
+ return [];
34
+ const weighted = [];
35
+ for (const part of raw.slice(0, MAX_HEADER_LENGTH).split(',')) {
36
+ const [tagPart, ...parameters] = part.split(';');
37
+ const tag = tagPart?.trim() ?? '';
38
+ if (tag.length === 0)
39
+ continue;
40
+ const weight = readWeight(parameters);
41
+ if (weight === null)
42
+ continue;
43
+ weighted.push({ tag, weight, order: weighted.length });
44
+ }
45
+ weighted.sort((a, b) => b.weight - a.weight || a.order - b.order);
46
+ return weighted.slice(0, MAX_TAGS).map((entry) => ({ tag: entry.tag, q: entry.weight }));
47
+ }
48
+ /** The `q` parameter of one list element: its weight, `1` by default, or `null` if malformed. */
49
+ function readWeight(parameters) {
50
+ for (const parameter of parameters) {
51
+ const separator = parameter.indexOf('=');
52
+ if (separator < 0)
53
+ continue;
54
+ if (parameter.slice(0, separator).trim().toLowerCase() !== 'q')
55
+ continue;
56
+ const value = parameter.slice(separator + 1).trim();
57
+ const parsed = Number(value);
58
+ if (value.length === 0 || !Number.isFinite(parsed))
59
+ return null;
60
+ return parsed;
61
+ }
62
+ return 1;
63
+ }
64
+ //# sourceMappingURL=accept-language.js.map
@@ -126,6 +126,7 @@ export declare const ModuleActionSchema: z.ZodObject<{
126
126
  }>;
127
127
  targetRoute: z.ZodString;
128
128
  requiredPermission: z.ZodOptional<z.ZodString>;
129
+ entryApiRoute: z.ZodOptional<z.ZodString>;
129
130
  keywords: z.ZodDefault<z.ZodArray<z.ZodString>>;
130
131
  keywordsKey: z.ZodOptional<z.ZodString>;
131
132
  weight: z.ZodDefault<z.ZodNumber>;
@@ -208,6 +209,7 @@ export declare const ModuleActionsManifestSchema: z.ZodArray<z.ZodObject<{
208
209
  }>;
209
210
  targetRoute: z.ZodString;
210
211
  requiredPermission: z.ZodOptional<z.ZodString>;
212
+ entryApiRoute: z.ZodOptional<z.ZodString>;
211
213
  keywords: z.ZodDefault<z.ZodArray<z.ZodString>>;
212
214
  keywordsKey: z.ZodOptional<z.ZodString>;
213
215
  weight: z.ZodDefault<z.ZodNumber>;
@@ -195,6 +195,8 @@ export const KnownIconNameSchema = z.enum([
195
195
  const actionIdRe = /^[a-z][a-z0-9-]*$/;
196
196
  const translationKeyRe = /^[a-z][a-zA-Z0-9_]*(\.[a-z][a-zA-Z0-9_]*)*$/;
197
197
  const adminRouteRe = /^\/[A-Za-z0-9/_-]*$/;
198
+ /** A registered admin API path, `:param` segments included — never the bare prefix. */
199
+ const entryApiRouteRe = /^\/api\/v1\/admin(\/[A-Za-z0-9_:.-]+)+$/;
198
200
  // ---------------------------------------------------------------------------
199
201
  // Manifest-side action declaration
200
202
  // ---------------------------------------------------------------------------
@@ -222,6 +224,22 @@ export const ModuleActionSchema = z.object({
222
224
  * codebase mixes colon and dot notation; both are accepted by design.
223
225
  */
224
226
  requiredPermission: z.string().min(1).max(64).optional(),
227
+ /**
228
+ * Issue #1088 — the admin API route the target screen **opens on**, the
229
+ * request whose gate decides whether the screen renders at all. Declared only
230
+ * where the SPA placement does not name it: the outbox is a tab of
231
+ * `/platform/command-hooks`, and its entry request is
232
+ * `GET /api/v1/admin/command-outbox`. Nothing reads it at runtime —
233
+ * `check:action-route-permissions` compares `requiredPermission` against this
234
+ * route instead of reconstructing one from `targetRoute`, and reports a
235
+ * declaration no registration answers. The method follows the target: GET,
236
+ * or the write verbs for a `/new` create form.
237
+ */
238
+ entryApiRoute: z
239
+ .string()
240
+ .max(255)
241
+ .regex(entryApiRouteRe, 'Entry API route must be a path under /api/v1/admin/')
242
+ .optional(),
225
243
  /**
226
244
  * Search words matched in **every** admin language. English, like every
227
245
  * other default a manifest carries; a word an operator types in their own
@@ -52,15 +52,15 @@ export type PermissionRequirement = z.infer<typeof PermissionRequirementSchema>;
52
52
  * two headings of one each and the operator reads it as two features.
53
53
  */
54
54
  export declare const AdminNavSectionNameSchema: z.ZodEnum<{
55
+ catalog: "catalog";
56
+ crm: "crm";
55
57
  channels: "channels";
56
58
  content: "content";
57
59
  system: "system";
58
60
  newsletter: "newsletter";
59
61
  main: "main";
60
62
  sales: "sales";
61
- crm: "crm";
62
63
  work: "work";
63
- catalog: "catalog";
64
64
  inventory: "inventory";
65
65
  pricing: "pricing";
66
66
  customers: "customers";
@@ -128,9 +128,30 @@ export declare const AdminZoneNameSchema: z.ZodEnum<{
128
128
  "task.detail.after": "task.detail.after";
129
129
  }>;
130
130
  export type AdminZoneName = z.infer<typeof AdminZoneNameSchema>;
131
+ /**
132
+ * The host editor's save session, as a zone contribution sees it (feature 180,
133
+ * `specs/180-one-save-zone-editors/contracts/save-participation.md` §1, FR-002).
134
+ *
135
+ * **Opaque, and carrying no function, on purpose.** The host's
136
+ * `SaveSessionProvider` (`@endora-commerce/admin-kit/lib`) creates it, keeps it
137
+ * stable for the session's life — so `AdminZone`'s per-factory lazy components
138
+ * do not remount — and resolves it back to the live session when a
139
+ * contribution calls `useSaveParticipant(handle, …)`. A function-typed member
140
+ * here would pull React's types into this package.
141
+ *
142
+ * It is a prop of exactly the zones whose host editor has one Save covering its
143
+ * panels (`spec.md` § *Editors that adopt the one Save*). A zone without it
144
+ * offers no session, so a contribution there that tries to take part is a
145
+ * `tsc` error rather than a draft nothing ever saves.
146
+ */
147
+ export interface EditorSaveSessionHandle {
148
+ readonly sessionId: string;
149
+ }
131
150
  /** A zone mounted once per product editor. */
132
151
  export interface ProductEditorZoneProps {
133
152
  readonly productId: string;
153
+ /** Feature 180 — the product editor's one Save (FR-002). */
154
+ readonly saveSession: EditorSaveSessionHandle;
134
155
  }
135
156
  /**
136
157
  * The product editor's SEO zone (feature 174, `contracts/editor-ui.md` §5): the editor scope,
@@ -189,7 +210,8 @@ export interface InvoiceDetailZoneProps {
189
210
  readonly ksefReferenceNumber: string | null;
190
211
  }
191
212
  /**
192
- * A zone mounted once at the end of the category editor's form.
213
+ * A zone mounted once at the end of the category editor's form, before its save
214
+ * row (feature 180, FR-052).
193
215
  *
194
216
  * The entity's own id and nothing else, which is what the one contribution
195
217
  * reads: `DisplayModeOverrideRow` takes a scope and a target id, and the scope
@@ -198,6 +220,8 @@ export interface InvoiceDetailZoneProps {
198
220
  */
199
221
  export interface CategoryEditorZoneProps {
200
222
  readonly categoryId: string;
223
+ /** Feature 180 — the category editor's Save (FR-002, FR-050). */
224
+ readonly saveSession: EditorSaveSessionHandle;
201
225
  }
202
226
  /**
203
227
  * A zone mounted once on the category content screen, around one language's
@@ -247,6 +271,8 @@ export interface ProductContentEditorZoneProps {
247
271
  */
248
272
  export interface SalesChannelEditorZoneProps {
249
273
  readonly channelId: string;
274
+ /** Feature 180 — the identity form's Save (FR-002, FR-070). */
275
+ readonly saveSession: EditorSaveSessionHandle;
250
276
  }
251
277
  /**
252
278
  * A zone mounted once at the end of an organization's detail screen.
@@ -260,6 +286,8 @@ export interface SalesChannelEditorZoneProps {
260
286
  */
261
287
  export interface OrganizationDetailZoneProps {
262
288
  readonly organizationId: string;
289
+ /** Feature 180 — the organization screen's one Save (FR-002, FR-060). */
290
+ readonly saveSession: EditorSaveSessionHandle;
263
291
  }
264
292
  /**
265
293
  * A zone mounted once at the end of a customer's detail screen.
@@ -271,6 +299,8 @@ export interface OrganizationDetailZoneProps {
271
299
  */
272
300
  export interface CustomerDetailZoneProps {
273
301
  readonly customerId: string;
302
+ /** Feature 180 — the customer screen's one Save (FR-002, FR-060). */
303
+ readonly saveSession: EditorSaveSessionHandle;
274
304
  }
275
305
  /**
276
306
  * A zone mounted once as the body of the order detail's Payment tab.
@@ -426,6 +456,8 @@ export interface ProductEditorFieldZoneProps {
426
456
  * {@link AdminZoneNameSchema}'s contract.
427
457
  */
428
458
  readonly languageCodes: readonly string[] | null;
459
+ /** Feature 180 — the product editor's one Save (FR-002). */
460
+ readonly saveSession: EditorSaveSessionHandle;
429
461
  }
430
462
  /**
431
463
  * The props each zone carries, and the contract both ends are checked against.
@@ -563,15 +595,15 @@ export declare const AdminNavDeclarationSchema: z.ZodObject<{
563
595
  CalendarDays: "CalendarDays";
564
596
  }>;
565
597
  section: z.ZodEnum<{
598
+ catalog: "catalog";
599
+ crm: "crm";
566
600
  channels: "channels";
567
601
  content: "content";
568
602
  system: "system";
569
603
  newsletter: "newsletter";
570
604
  main: "main";
571
605
  sales: "sales";
572
- crm: "crm";
573
606
  work: "work";
574
- catalog: "catalog";
575
607
  inventory: "inventory";
576
608
  pricing: "pricing";
577
609
  customers: "customers";
@@ -213,11 +213,18 @@ export const AdminZoneNameSchema = z.enum([
213
213
  */
214
214
  'invoice.detail.after',
215
215
  /**
216
- * The end of the category editor's form, after its save/cancel row.
216
+ * The end of the category editor's form, before its save row.
217
+ *
218
+ * Feature 180 (FR-052) places the mount above the Save / Cancel row, so what
219
+ * the Save covers sits above it; the name is kept. Until the category editor
220
+ * adopts the one Save (WP-6), `CategoriesTree.tsx` still renders it after the
221
+ * row.
217
222
  *
218
223
  * Mounted **once** per open category, and named from the host's own word for
219
224
  * the place (Z14): `catalog`'s `CategoriesTree.tsx` is the editor, and the
220
- * place is *after* everything the editor itself offers. Props:
225
+ * place is the end of its form, after the editor's own fields and before its
226
+ * Save row — what the Save covers sits above it (feature 180, FR-052; the
227
+ * name predates the move and was kept). Props:
221
228
  * {@link CategoryEditorZoneProps}.
222
229
  *
223
230
  * The first member whose contributor is `price_lists`. `catalog` imported
@@ -168,6 +168,15 @@ export interface PermissionReadPort {
168
168
  * failing there. It is a 403 `ADMIN_ROLE_REQUIRED`.
169
169
  */
170
170
  resolveRole(adminUserId: string): Promise<AdminRoleResolution>;
171
+ /**
172
+ * {@link resolveRole} for many administrators at once, in a fixed number of
173
+ * reads: every id asked has an entry, the role or the same refusal
174
+ * `resolveRole` answers for it.
175
+ *
176
+ * Added for issue #461: the Projects `@` list asked `resolveRole` (through
177
+ * `adminTenantScopePort`) and `listPermissions` once per candidate.
178
+ */
179
+ resolveRoles(adminUserIds: readonly string[]): Promise<Map<string, AdminRoleResolution>>;
171
180
  }
172
181
  /** What {@link PermissionReadPort.resolveRole} answers: a role, or the refusal. */
173
182
  export type AdminRoleResolution = {
package/dist/admin.d.ts CHANGED
@@ -21,6 +21,7 @@ export declare const adminUserSchema: z.ZodObject<{
21
21
  lastLoginAt: z.ZodNullable<z.ZodString>;
22
22
  createdAt: z.ZodString;
23
23
  updatedAt: z.ZodString;
24
+ preferredLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
25
  avatarAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
26
  bio: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
26
27
  }, z.core.$strip>;
@@ -85,6 +86,7 @@ export declare const adminMeResponseSchema: z.ZodObject<{
85
86
  lastLoginAt: z.ZodNullable<z.ZodString>;
86
87
  createdAt: z.ZodString;
87
88
  updatedAt: z.ZodString;
89
+ preferredLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
90
  avatarAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
91
  bio: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
90
92
  }, z.core.$strip>;
@@ -116,6 +118,41 @@ export declare const adminLoginRequestSchema: z.ZodObject<{
116
118
  email: z.ZodString;
117
119
  password: z.ZodString;
118
120
  }, z.core.$strip>;
121
+ /**
122
+ * `POST /api/v1/auth/admin/login` — the first sign-in step (issue #599). Only
123
+ * `authenticated` sets the session cookie and names the administrator; the
124
+ * other two arms hand the client the opaque ticket its second step takes.
125
+ */
126
+ export declare const adminLoginResponseSchema: z.ZodObject<{
127
+ data: z.ZodDiscriminatedUnion<[z.ZodObject<{
128
+ status: z.ZodLiteral<"authenticated">;
129
+ adminUser: z.ZodObject<{
130
+ id: z.ZodString;
131
+ email: z.ZodString;
132
+ firstName: z.ZodString;
133
+ lastName: z.ZodString;
134
+ adminRoleId: z.ZodNullable<z.ZodString>;
135
+ twoFactorEnabled: z.ZodBoolean;
136
+ status: z.ZodEnum<{
137
+ active: "active";
138
+ inactive: "inactive";
139
+ }>;
140
+ lastLoginAt: z.ZodNullable<z.ZodString>;
141
+ createdAt: z.ZodString;
142
+ updatedAt: z.ZodString;
143
+ preferredLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
+ avatarAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
+ bio: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
146
+ }, z.core.$strip>;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ status: z.ZodLiteral<"mfaRequired">;
149
+ challengeId: z.ZodString;
150
+ }, z.core.$strip>, z.ZodObject<{
151
+ status: z.ZodLiteral<"mfaSetupRequired">;
152
+ setupTicket: z.ZodString;
153
+ }, z.core.$strip>], "status">;
154
+ }, z.core.$strip>;
155
+ export type AdminLoginResponse = z.infer<typeof adminLoginResponseSchema>;
119
156
  export declare const impersonationRequestSchema: z.ZodObject<{
120
157
  customerAccountId: z.ZodString;
121
158
  reason: z.ZodOptional<z.ZodString>;
package/dist/admin.js CHANGED
@@ -21,6 +21,13 @@ export const adminUserSchema = z.object({
21
21
  lastLoginAt: isoDateTimeSchema.nullable(),
22
22
  createdAt: isoDateTimeSchema,
23
23
  updatedAt: isoDateTimeSchema,
24
+ /**
25
+ * Feature 019 — the administrator's Admin UI language, `null` when none is
26
+ * saved (the UI then opens in its default). Answered by every admin-user read
27
+ * since 019 and declared here only by issue #599; optional for a client that
28
+ * predates it.
29
+ */
30
+ preferredLanguage: z.string().nullable().optional(),
24
31
  /** Feature 171 (US6) — the author avatar, a library asset. Optional for clients that predate it. */
25
32
  avatarAssetId: uuidSchema.nullable().optional(),
26
33
  /** Feature 171 (US6) — the author biography per language. */
@@ -96,6 +103,18 @@ export const adminLoginRequestSchema = z.object({
96
103
  email: z.string().email(),
97
104
  password: z.string(),
98
105
  });
106
+ /**
107
+ * `POST /api/v1/auth/admin/login` — the first sign-in step (issue #599). Only
108
+ * `authenticated` sets the session cookie and names the administrator; the
109
+ * other two arms hand the client the opaque ticket its second step takes.
110
+ */
111
+ export const adminLoginResponseSchema = z.object({
112
+ data: z.discriminatedUnion('status', [
113
+ z.object({ status: z.literal('authenticated'), adminUser: adminUserSchema }),
114
+ z.object({ status: z.literal('mfaRequired'), challengeId: z.string().min(1) }),
115
+ z.object({ status: z.literal('mfaSetupRequired'), setupTicket: z.string().min(1) }),
116
+ ]),
117
+ });
99
118
  export const impersonationRequestSchema = z.object({
100
119
  customerAccountId: uuidSchema,
101
120
  reason: z.string().max(2000).optional(),
@@ -61,6 +61,28 @@ export declare const apiKeySchema: z.ZodObject<{
61
61
  expiresAt: z.ZodNullable<z.ZodString>;
62
62
  }, z.core.$strip>;
63
63
  export type ApiKey = z.infer<typeof apiKeySchema>;
64
+ /** `GET /api/v1/admin/api-keys` — every key, revoked ones included, newest first (issue #599). */
65
+ export declare const apiKeyListResponseSchema: z.ZodObject<{
66
+ data: z.ZodArray<z.ZodObject<{
67
+ id: z.ZodString;
68
+ name: z.ZodString;
69
+ lastFour: z.ZodString;
70
+ scopes: z.ZodArray<z.ZodString>;
71
+ status: z.ZodEnum<{
72
+ active: "active";
73
+ revoked: "revoked";
74
+ }>;
75
+ lastUsedAt: z.ZodNullable<z.ZodString>;
76
+ revokedAt: z.ZodNullable<z.ZodString>;
77
+ createdAt: z.ZodString;
78
+ updatedAt: z.ZodString;
79
+ organizationId: z.ZodNullable<z.ZodString>;
80
+ salesChannelId: z.ZodNullable<z.ZodString>;
81
+ customerAccountId: z.ZodNullable<z.ZodString>;
82
+ expiresAt: z.ZodNullable<z.ZodString>;
83
+ }, z.core.$strip>>;
84
+ }, z.core.$strip>;
85
+ export type ApiKeyListResponse = z.infer<typeof apiKeyListResponseSchema>;
64
86
  export declare const createApiKeyRequestSchema: z.ZodObject<{
65
87
  name: z.ZodString;
66
88
  scopes: z.ZodArray<z.ZodEnum<{
package/dist/api-keys.js CHANGED
@@ -55,6 +55,10 @@ export const apiKeySchema = z.object({
55
55
  customerAccountId: uuidSchema.nullable(),
56
56
  expiresAt: isoDateTimeSchema.nullable(),
57
57
  });
58
+ /** `GET /api/v1/admin/api-keys` — every key, revoked ones included, newest first (issue #599). */
59
+ export const apiKeyListResponseSchema = z.object({
60
+ data: z.array(apiKeySchema),
61
+ });
58
62
  export const createApiKeyRequestSchema = z.object({
59
63
  name: z.string().min(1).max(160),
60
64
  scopes: z.array(apiKeyScopeSchema).min(1),
@@ -496,6 +496,25 @@ export interface AssetRecord {
496
496
  /** Operator-chosen alias, or null. */
497
497
  permalink: string | null;
498
498
  }
499
+ /**
500
+ * The event `assets_library` publishes on the in-process EventBus after a
501
+ * committed write that changes what an embedded asset renders as — its bytes
502
+ * (a replace, a restore of the previous version, and with them the
503
+ * `?v=<contentVersion>` marker), its URL (a permalink set or removed, a
504
+ * visibility change), its rendered details (filename, label, alt text, MIME
505
+ * type), or whether it is live at all (a soft delete, a restore). Issue #363.
506
+ *
507
+ * It exists for whoever caches an answer that **embeds** an asset — `cms`
508
+ * caches resolved pages, blocks and hooks — because such a cache cannot
509
+ * otherwise learn that the embedded asset moved. The owner names no consumer:
510
+ * a subscriber that is absent or switched off simply hears nothing.
511
+ */
512
+ export declare const ASSET_CHANGED_EVENT = "assets_library.asset_changed.v1";
513
+ /** The payload of {@link ASSET_CHANGED_EVENT}, beside the bus's `eventId` / `occurredAt`. */
514
+ export interface AssetChangedEvent {
515
+ /** The assets the write changed — at least one. */
516
+ readonly assetIds: readonly string[];
517
+ }
499
518
  /**
500
519
  * Container name: `assetReadPort`. Owner: `assets_library`.
501
520
  *
@@ -277,4 +277,18 @@ export const assetEmbedResolutionSchema = z.object({
277
277
  label: z.string().nullable(),
278
278
  visibility: assetVisibilitySchema,
279
279
  });
280
+ /**
281
+ * The event `assets_library` publishes on the in-process EventBus after a
282
+ * committed write that changes what an embedded asset renders as — its bytes
283
+ * (a replace, a restore of the previous version, and with them the
284
+ * `?v=<contentVersion>` marker), its URL (a permalink set or removed, a
285
+ * visibility change), its rendered details (filename, label, alt text, MIME
286
+ * type), or whether it is live at all (a soft delete, a restore). Issue #363.
287
+ *
288
+ * It exists for whoever caches an answer that **embeds** an asset — `cms`
289
+ * caches resolved pages, blocks and hooks — because such a cache cannot
290
+ * otherwise learn that the embedded asset moved. The owner names no consumer:
291
+ * a subscriber that is absent or switched off simply hears nothing.
292
+ */
293
+ export const ASSET_CHANGED_EVENT = 'assets_library.asset_changed.v1';
280
294
  //# sourceMappingURL=assets-library.js.map
package/dist/auth.d.ts CHANGED
@@ -32,6 +32,15 @@ export declare const ADMIN_SESSION_COOKIE_NAME = "b2b_admin_session";
32
32
  * minutes, never in a URL.
33
33
  */
34
34
  export declare const MFA_CHALLENGE_COOKIE_NAME = "b2b_mfa_challenge";
35
+ /**
36
+ * The storefront's one-render "your basket was carried over" notice: `adopted`
37
+ * or `merged`, read and cleared by the next page render. Two writers, one
38
+ * reader, as {@link MFA_CHALLENGE_COOKIE_NAME}: the storefront's sign-in
39
+ * actions set it, and so does `mfa`'s federated callback, which signs the
40
+ * customer in with no storefront action in between (issue #1188). `httpOnly`,
41
+ * path `/`, thirty seconds.
42
+ */
43
+ export declare const CART_MERGE_FLASH_COOKIE_NAME = "b2b_cart_merge_flash";
35
44
  /**
36
45
  * The cookie a completed administrator sign-in leaves on the device, so that
37
46
  * the device is recognised as one the account has been used from.
package/dist/auth.js CHANGED
@@ -33,6 +33,15 @@ export const ADMIN_SESSION_COOKIE_NAME = 'b2b_admin_session';
33
33
  * minutes, never in a URL.
34
34
  */
35
35
  export const MFA_CHALLENGE_COOKIE_NAME = 'b2b_mfa_challenge';
36
+ /**
37
+ * The storefront's one-render "your basket was carried over" notice: `adopted`
38
+ * or `merged`, read and cleared by the next page render. Two writers, one
39
+ * reader, as {@link MFA_CHALLENGE_COOKIE_NAME}: the storefront's sign-in
40
+ * actions set it, and so does `mfa`'s federated callback, which signs the
41
+ * customer in with no storefront action in between (issue #1188). `httpOnly`,
42
+ * path `/`, thirty seconds.
43
+ */
44
+ export const CART_MERGE_FLASH_COOKIE_NAME = 'b2b_cart_merge_flash';
36
45
  /**
37
46
  * The cookie a completed administrator sign-in leaves on the device, so that
38
47
  * the device is recognised as one the account has been used from.
package/dist/carts.d.ts CHANGED
@@ -86,6 +86,11 @@ export declare const updateCartItemRequestStrictSchema: z.ZodObject<{
86
86
  quantity: z.ZodNumber;
87
87
  }, z.core.$strip>;
88
88
  export type UpdateCartItemRequestStrict = z.infer<typeof updateCartItemRequestStrictSchema>;
89
+ /**
90
+ * `0` removes the line; anything else up to `LINE_QUANTITY_MAX` (issue #351,
91
+ * architect ruling R3 — it stopped at 999, below what the add path accepts, so a
92
+ * buyer could add a line they could then not edit).
93
+ */
89
94
  export declare const updateCartItemRequestSchema: z.ZodObject<{
90
95
  quantity: z.ZodNumber;
91
96
  }, z.core.$strip>;
@@ -858,6 +863,13 @@ export declare const cartAuditFeedEntrySchema: z.ZodObject<{
858
863
  reason: z.ZodNullable<z.ZodString>;
859
864
  }, z.core.$strip>;
860
865
  export type CartAuditFeedEntry = z.infer<typeof cartAuditFeedEntrySchema>;
866
+ /**
867
+ * @deprecated Since issue #657 — not the shape of `GET
868
+ * /api/v1/organization/carts/:id`, and never was: the route has never answered
869
+ * `cartFullPayloadSchema`'s fields or `auditEntries`, so a real reply fails
870
+ * this schema. Use {@link orgCartDetailViewSchema}, which the route is typed
871
+ * against. Kept, unchanged, until the next breaking-change release removes it.
872
+ */
861
873
  export declare const orgCartDetailPayloadSchema: z.ZodObject<{
862
874
  id: z.ZodNullable<z.ZodString>;
863
875
  customerAccountId: z.ZodNullable<z.ZodString>;
@@ -1019,7 +1031,9 @@ export declare const orgCartDetailPayloadSchema: z.ZodObject<{
1019
1031
  reason: z.ZodNullable<z.ZodString>;
1020
1032
  }, z.core.$strip>>;
1021
1033
  }, z.core.$strip>;
1034
+ /** @deprecated Since issue #657 — use {@link OrgCartDetailView}. */
1022
1035
  export type OrgCartDetailPayload = z.infer<typeof orgCartDetailPayloadSchema>;
1036
+ /** @deprecated Since issue #657 — use {@link orgCartDetailViewResponseSchema}. */
1023
1037
  export declare const orgCartDetailResponseSchema: z.ZodObject<{
1024
1038
  data: z.ZodObject<{
1025
1039
  id: z.ZodNullable<z.ZodString>;
@@ -1183,6 +1197,7 @@ export declare const orgCartDetailResponseSchema: z.ZodObject<{
1183
1197
  }, z.core.$strip>>;
1184
1198
  }, z.core.$strip>;
1185
1199
  }, z.core.$strip>;
1200
+ /** @deprecated Since issue #657 — use {@link OrgCartDetailViewResponse}. */
1186
1201
  export type OrgCartDetailResponse = z.infer<typeof orgCartDetailResponseSchema>;
1187
1202
  /**
1188
1203
  * Issue #650 — one line of {@link orgCartDetailViewSchema}: what the
@@ -1212,7 +1227,7 @@ export type OrgCartDetailLine = z.infer<typeof orgCartDetailLineSchema>;
1212
1227
  * {@link orgCartDetailPayloadSchema} above is not this route's shape and never
1213
1228
  * was: the route has answered the summary fields plus the approval timestamps
1214
1229
  * since feature 027. It is left as published rather than changed under its
1215
- * consumers.
1230
+ * consumers, and deprecated since issue #657.
1216
1231
  */
1217
1232
  export declare const orgCartDetailViewSchema: z.ZodObject<{
1218
1233
  id: z.ZodString;
@@ -1929,6 +1944,19 @@ export interface CartWritePort {
1929
1944
  *
1930
1945
  * `language` names a refused product — the language the response is answered
1931
1946
  * in (`request.responseLanguage()`); absent, the record's own fallback chain.
1947
+ * A message language only: it never decides which (channel, language) a line
1948
+ * is asked about.
1949
+ *
1950
+ * `languageTag` (issue #1293) — the buyer request's scope language: the
1951
+ * channel language its `Accept-Language` asks for (`requestScopeLanguage`).
1952
+ * Every line is judged for availability, and a below-minimum line named, at
1953
+ * the basket's (channel, `languageTag` resolved against the channel's own
1954
+ * languages), exactly as `POST /cart/items` judges a line of the same
1955
+ * request. Absent: the channel's default language, as before — the answer
1956
+ * for a caller with no storefront request (an API-key order, an operator
1957
+ * naming a customer's channel). Honoured only while the basket's channel is
1958
+ * the request's resolved one; any other basket is asked about at its
1959
+ * channel's default language.
1932
1960
  */
1933
1961
  addItems(actor: {
1934
1962
  customer?: CartCustomerContext;
@@ -1939,6 +1967,7 @@ export interface CartWritePort {
1939
1967
  workingBasket?: boolean;
1940
1968
  keepRepeatedLines?: boolean;
1941
1969
  language?: string;
1970
+ languageTag?: string;
1942
1971
  }): Promise<CartWithItems & {
1943
1972
  outcomes: CartBatchLineOutcome[];
1944
1973
  }>;
package/dist/carts.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { isoDateTimeSchema, moneySchema, uuidSchema } from './common.js';
3
+ import { boundedLineQuantity, lineQuantitySchema } from './line-bounds.js';
3
4
  /**
4
5
  * Cart + CartItem contracts. The Cart can be anonymous (cookie-held) or
5
6
  * logged-in; `mergeAnonymousOnLogin` merges the anonymous basket into the
@@ -54,9 +55,10 @@ export const addCartItemRequestSchema = z.object({
54
55
  /**
55
56
  * Without `packagingUnitId` this is the number of base pieces. With
56
57
  * `packagingUnitId` it is the number of packaging units, and the resulting
57
- * line quantity is `unit.baseQuantity × quantity` (feature 043).
58
+ * line quantity is `unit.baseQuantity × quantity` (feature 043). At most
59
+ * `LINE_QUANTITY_MAX` (issue #351).
58
60
  */
59
- quantity: z.number().int().positive(),
61
+ quantity: lineQuantitySchema,
60
62
  /** Feature 043 — order by a packaging unit (e.g. a pallet) of this product. */
61
63
  packagingUnitId: uuidSchema.optional(),
62
64
  });
@@ -66,10 +68,15 @@ export const addCartItemRequestSchema = z.object({
66
68
  // is kept as `updateCartItemRequestStrictSchema` for any caller that still
67
69
  // needs the positive-only check.
68
70
  export const updateCartItemRequestStrictSchema = z.object({
69
- quantity: z.number().int().positive(),
71
+ quantity: lineQuantitySchema,
70
72
  });
73
+ /**
74
+ * `0` removes the line; anything else up to `LINE_QUANTITY_MAX` (issue #351,
75
+ * architect ruling R3 — it stopped at 999, below what the add path accepts, so a
76
+ * buyer could add a line they could then not edit).
77
+ */
71
78
  export const updateCartItemRequestSchema = z.object({
72
- quantity: z.number().int().min(0).max(999),
79
+ quantity: boundedLineQuantity(z.number().int().min(0)),
73
80
  });
74
81
  // ────────────────────────────────────────────────────────────────────────
75
82
  // Feature 027 — status & approval enums (shared across surfaces)
@@ -462,11 +469,19 @@ export const cartAuditFeedEntrySchema = z.object({
462
469
  toState: z.string().nullable(),
463
470
  reason: z.string().nullable(),
464
471
  });
472
+ /**
473
+ * @deprecated Since issue #657 — not the shape of `GET
474
+ * /api/v1/organization/carts/:id`, and never was: the route has never answered
475
+ * `cartFullPayloadSchema`'s fields or `auditEntries`, so a real reply fails
476
+ * this schema. Use {@link orgCartDetailViewSchema}, which the route is typed
477
+ * against. Kept, unchanged, until the next breaking-change release removes it.
478
+ */
465
479
  export const orgCartDetailPayloadSchema = cartFullPayloadSchema.extend({
466
480
  ownerCustomerAccountId: uuidSchema,
467
481
  ownerDisplayName: z.string(),
468
482
  auditEntries: z.array(cartAuditFeedEntrySchema),
469
483
  });
484
+ /** @deprecated Since issue #657 — use {@link orgCartDetailViewResponseSchema}. */
470
485
  export const orgCartDetailResponseSchema = z.object({ data: orgCartDetailPayloadSchema });
471
486
  /**
472
487
  * Issue #650 — one line of {@link orgCartDetailViewSchema}: what the
@@ -490,7 +505,7 @@ export const orgCartDetailLineSchema = z.object({
490
505
  * {@link orgCartDetailPayloadSchema} above is not this route's shape and never
491
506
  * was: the route has answered the summary fields plus the approval timestamps
492
507
  * since feature 027. It is left as published rather than changed under its
493
- * consumers.
508
+ * consumers, and deprecated since issue #657.
494
509
  */
495
510
  export const orgCartDetailViewSchema = orgCartSummarySchema.extend({
496
511
  ownerCustomerAccountId: uuidSchema.nullable(),