@endora-commerce/contracts 0.109.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 (385) hide show
  1. package/dist/accept-language.d.ts +31 -0
  2. package/dist/accept-language.js +64 -0
  3. package/dist/actor.d.ts +16 -0
  4. package/dist/addresses.d.ts +35 -0
  5. package/dist/addresses.js +8 -1
  6. package/dist/admin-actions.d.ts +2 -0
  7. package/dist/admin-actions.js +18 -0
  8. package/dist/admin-contributions.d.ts +99 -12
  9. package/dist/admin-contributions.js +36 -10
  10. package/dist/admin-roles.d.ts +17 -2
  11. package/dist/admin-users.d.ts +9 -0
  12. package/dist/admin.d.ts +114 -4
  13. package/dist/admin.js +98 -3
  14. package/dist/api-keys.d.ts +22 -0
  15. package/dist/api-keys.js +4 -0
  16. package/dist/assets-library.d.ts +45 -0
  17. package/dist/assets-library.js +20 -3
  18. package/dist/audit-logs.d.ts +12 -0
  19. package/dist/audit-logs.js +12 -0
  20. package/dist/auth.d.ts +9 -0
  21. package/dist/auth.js +9 -0
  22. package/dist/blog.d.ts +382 -22
  23. package/dist/blog.js +199 -17
  24. package/dist/carts.d.ts +423 -36
  25. package/dist/carts.js +150 -12
  26. package/dist/catalog.d.ts +379 -208
  27. package/dist/catalog.js +241 -163
  28. package/dist/cms-brand.d.ts +14 -14
  29. package/dist/cms.d.ts +71 -16
  30. package/dist/cms.js +15 -0
  31. package/dist/command-hooks.d.ts +301 -0
  32. package/dist/command-hooks.js +248 -0
  33. package/dist/common.d.ts +23 -6
  34. package/dist/common.js +25 -2
  35. package/dist/comparisons.d.ts +21 -14
  36. package/dist/comparisons.js +2 -1
  37. package/dist/credit-limits.d.ts +22 -0
  38. package/dist/credit-limits.js +35 -0
  39. package/dist/crm.d.ts +134 -78
  40. package/dist/crm.js +21 -5
  41. package/dist/custom-fields.d.ts +417 -49
  42. package/dist/custom-fields.js +142 -1
  43. package/dist/customer-accounts.d.ts +324 -22
  44. package/dist/customer-accounts.js +43 -0
  45. package/dist/customer-notifications.d.ts +143 -0
  46. package/dist/customer-notifications.js +41 -0
  47. package/dist/customers.d.ts +92 -73
  48. package/dist/customers.js +98 -10
  49. package/dist/dictionary.d.ts +53 -0
  50. package/dist/dictionary.js +25 -0
  51. package/dist/document-templates.d.ts +12 -12
  52. package/dist/email.d.ts +34 -0
  53. package/dist/email.js +6 -0
  54. package/dist/errors.d.ts +431 -3
  55. package/dist/errors.js +523 -3
  56. package/dist/forms-logic.d.ts +79 -0
  57. package/dist/forms-logic.fixtures.d.ts +52 -0
  58. package/dist/forms-logic.fixtures.js +610 -0
  59. package/dist/forms-logic.js +699 -0
  60. package/dist/forms.d.ts +9833 -0
  61. package/dist/forms.js +827 -0
  62. package/dist/i18n.d.ts +34 -0
  63. package/dist/i18n.js +15 -0
  64. package/dist/import-export.d.ts +180 -0
  65. package/dist/import-export.js +60 -0
  66. package/dist/index.d.ts +16 -1
  67. package/dist/index.js +30 -1
  68. package/dist/inventory.d.ts +9 -9
  69. package/dist/invoice-ledger.d.ts +13 -13
  70. package/dist/invoices.d.ts +126 -0
  71. package/dist/invoices.js +53 -0
  72. package/dist/line-bounds.d.ts +53 -0
  73. package/dist/line-bounds.js +65 -0
  74. package/dist/megamenu.d.ts +27 -27
  75. package/dist/mfa.d.ts +210 -4
  76. package/dist/mfa.js +136 -0
  77. package/dist/modules.d.ts +56 -8
  78. package/dist/modules.js +128 -3
  79. package/dist/money-decimal.d.ts +54 -0
  80. package/dist/money-decimal.js +95 -0
  81. package/dist/newsletter.d.ts +4 -4
  82. package/dist/orders.d.ts +246 -12
  83. package/dist/orders.js +140 -7
  84. package/dist/organization-hooks.d.ts +99 -0
  85. package/dist/organization-hooks.js +22 -0
  86. package/dist/organization-registry-lookup.d.ts +362 -0
  87. package/dist/organization-registry-lookup.js +196 -0
  88. package/dist/organization-roles.d.ts +341 -0
  89. package/dist/organization-roles.js +218 -0
  90. package/dist/organizations.d.ts +1074 -103
  91. package/dist/organizations.js +293 -28
  92. package/dist/page-builder-props.d.ts +56 -56
  93. package/dist/pim-connector.d.ts +7 -3
  94. package/dist/pim-connector.js +6 -2
  95. package/dist/pim-field-path.d.ts +5 -1
  96. package/dist/pim-field-path.js +37 -81
  97. package/dist/pim-locale-mapping.d.ts +131 -0
  98. package/dist/pim-locale-mapping.js +193 -0
  99. package/dist/price-books.d.ts +215 -63
  100. package/dist/price-books.js +47 -2
  101. package/dist/price-lists.d.ts +13 -10
  102. package/dist/product-feeds.d.ts +249 -100
  103. package/dist/product-feeds.js +46 -2
  104. package/dist/product-scope-model.d.ts +161 -0
  105. package/dist/product-scope-model.js +161 -0
  106. package/dist/product-scope-overrides.d.ts +0 -103
  107. package/dist/product-scope-overrides.js +0 -54
  108. package/dist/product-scoped-values.d.ts +2610 -0
  109. package/dist/product-scoped-values.js +425 -0
  110. package/dist/product-scopes.d.ts +199 -64
  111. package/dist/product-scopes.js +120 -23
  112. package/dist/product-tax-rates.d.ts +38 -0
  113. package/dist/product-tax-rates.js +45 -0
  114. package/dist/product-url-keys.d.ts +51 -45
  115. package/dist/product-url-keys.js +73 -39
  116. package/dist/product-value-resolver.d.ts +37 -60
  117. package/dist/product-value-resolver.js +36 -96
  118. package/dist/projects.d.ts +76 -28
  119. package/dist/projects.js +53 -9
  120. package/dist/promotions.d.ts +163 -11
  121. package/dist/promotions.js +23 -1
  122. package/dist/pwa.d.ts +41 -2
  123. package/dist/quick-order.d.ts +159 -9
  124. package/dist/quick-order.js +79 -4
  125. package/dist/quote-requests.d.ts +231 -17
  126. package/dist/quote-requests.js +111 -9
  127. package/dist/record-references.d.ts +15 -15
  128. package/dist/record-references.js +2 -3
  129. package/dist/record-rich-text.js +2 -1
  130. package/dist/returns.d.ts +214 -52
  131. package/dist/returns.js +143 -28
  132. package/dist/sales-channels.d.ts +34 -3
  133. package/dist/sales-channels.js +16 -1
  134. package/dist/saved-list-views.d.ts +28 -0
  135. package/dist/saved-list-views.js +14 -1
  136. package/dist/schema-extensions.d.ts +36 -0
  137. package/dist/schema-extensions.js +29 -0
  138. package/dist/scoped-write-encoding.d.ts +100 -0
  139. package/dist/scoped-write-encoding.js +135 -0
  140. package/dist/search.d.ts +18 -16
  141. package/dist/seo.d.ts +83 -30
  142. package/dist/seo.js +8 -1
  143. package/dist/settings.d.ts +173 -2
  144. package/dist/settings.js +53 -2
  145. package/dist/shopping-lists.d.ts +63 -4
  146. package/dist/shopping-lists.js +57 -3
  147. package/dist/storefront-cache-tags.d.ts +22 -0
  148. package/dist/storefront-cache-tags.js +12 -0
  149. package/dist/storefront-value-overrides.d.ts +18 -56
  150. package/dist/storefront-value-overrides.js +11 -86
  151. package/dist/tasks.d.ts +27 -27
  152. package/dist/taxes.d.ts +27 -0
  153. package/dist/taxes.js +4 -0
  154. package/dist/transactional-emails.d.ts +48 -22
  155. package/dist/webhooks.d.ts +75 -0
  156. package/dist/webhooks.js +24 -0
  157. package/package.json +5 -3
  158. package/dist/actor.d.ts.map +0 -1
  159. package/dist/actor.js.map +0 -1
  160. package/dist/addresses.d.ts.map +0 -1
  161. package/dist/addresses.js.map +0 -1
  162. package/dist/admin-actions.d.ts.map +0 -1
  163. package/dist/admin-actions.js.map +0 -1
  164. package/dist/admin-contributions.d.ts.map +0 -1
  165. package/dist/admin-contributions.js.map +0 -1
  166. package/dist/admin-feedback.d.ts.map +0 -1
  167. package/dist/admin-feedback.js.map +0 -1
  168. package/dist/admin-i18n.d.ts.map +0 -1
  169. package/dist/admin-i18n.js.map +0 -1
  170. package/dist/admin-name.d.ts.map +0 -1
  171. package/dist/admin-name.js.map +0 -1
  172. package/dist/admin-notifications.d.ts.map +0 -1
  173. package/dist/admin-notifications.js.map +0 -1
  174. package/dist/admin-preferences.d.ts.map +0 -1
  175. package/dist/admin-preferences.js.map +0 -1
  176. package/dist/admin-roles.d.ts.map +0 -1
  177. package/dist/admin-roles.js.map +0 -1
  178. package/dist/admin-search.d.ts.map +0 -1
  179. package/dist/admin-search.js.map +0 -1
  180. package/dist/admin-users.d.ts.map +0 -1
  181. package/dist/admin-users.js.map +0 -1
  182. package/dist/admin.d.ts.map +0 -1
  183. package/dist/admin.js.map +0 -1
  184. package/dist/analytics.d.ts.map +0 -1
  185. package/dist/analytics.js.map +0 -1
  186. package/dist/api-keys.d.ts.map +0 -1
  187. package/dist/api-keys.js.map +0 -1
  188. package/dist/assets-library.d.ts.map +0 -1
  189. package/dist/assets-library.js.map +0 -1
  190. package/dist/audit-logs.d.ts.map +0 -1
  191. package/dist/audit-logs.js.map +0 -1
  192. package/dist/auth.d.ts.map +0 -1
  193. package/dist/auth.js.map +0 -1
  194. package/dist/blog.d.ts.map +0 -1
  195. package/dist/blog.js.map +0 -1
  196. package/dist/capabilities.d.ts.map +0 -1
  197. package/dist/capabilities.js.map +0 -1
  198. package/dist/carts.d.ts.map +0 -1
  199. package/dist/carts.js.map +0 -1
  200. package/dist/catalog.d.ts.map +0 -1
  201. package/dist/catalog.js.map +0 -1
  202. package/dist/cms-brand.d.ts.map +0 -1
  203. package/dist/cms-brand.js.map +0 -1
  204. package/dist/cms-contact-form.d.ts.map +0 -1
  205. package/dist/cms-contact-form.js.map +0 -1
  206. package/dist/cms.d.ts.map +0 -1
  207. package/dist/cms.js.map +0 -1
  208. package/dist/common.d.ts.map +0 -1
  209. package/dist/common.js.map +0 -1
  210. package/dist/comparisons.d.ts.map +0 -1
  211. package/dist/comparisons.js.map +0 -1
  212. package/dist/credentials.d.ts.map +0 -1
  213. package/dist/credentials.js.map +0 -1
  214. package/dist/credit-limits.d.ts.map +0 -1
  215. package/dist/credit-limits.js.map +0 -1
  216. package/dist/crm-rich-text.d.ts.map +0 -1
  217. package/dist/crm-rich-text.js.map +0 -1
  218. package/dist/crm.d.ts.map +0 -1
  219. package/dist/crm.js.map +0 -1
  220. package/dist/currencies.d.ts.map +0 -1
  221. package/dist/currencies.js.map +0 -1
  222. package/dist/custom-fields.d.ts.map +0 -1
  223. package/dist/custom-fields.js.map +0 -1
  224. package/dist/customer-accounts.d.ts.map +0 -1
  225. package/dist/customer-accounts.js.map +0 -1
  226. package/dist/customers.d.ts.map +0 -1
  227. package/dist/customers.js.map +0 -1
  228. package/dist/dictionary.d.ts.map +0 -1
  229. package/dist/dictionary.js.map +0 -1
  230. package/dist/document-templates.d.ts.map +0 -1
  231. package/dist/document-templates.js.map +0 -1
  232. package/dist/document-values.d.ts.map +0 -1
  233. package/dist/document-values.js.map +0 -1
  234. package/dist/email-address.d.ts.map +0 -1
  235. package/dist/email-address.js.map +0 -1
  236. package/dist/email.d.ts.map +0 -1
  237. package/dist/email.js.map +0 -1
  238. package/dist/envelopes.d.ts.map +0 -1
  239. package/dist/envelopes.js.map +0 -1
  240. package/dist/environment-inputs.d.ts.map +0 -1
  241. package/dist/environment-inputs.js.map +0 -1
  242. package/dist/erp-connector.d.ts.map +0 -1
  243. package/dist/erp-connector.js.map +0 -1
  244. package/dist/errors.d.ts.map +0 -1
  245. package/dist/errors.js.map +0 -1
  246. package/dist/google-analytics.d.ts.map +0 -1
  247. package/dist/google-analytics.js.map +0 -1
  248. package/dist/google-tag-manager.d.ts.map +0 -1
  249. package/dist/google-tag-manager.js.map +0 -1
  250. package/dist/i18n.d.ts.map +0 -1
  251. package/dist/i18n.js.map +0 -1
  252. package/dist/import-export.d.ts.map +0 -1
  253. package/dist/import-export.js.map +0 -1
  254. package/dist/index.d.ts.map +0 -1
  255. package/dist/index.js.map +0 -1
  256. package/dist/inventory.d.ts.map +0 -1
  257. package/dist/inventory.js.map +0 -1
  258. package/dist/invoice-ledger.d.ts.map +0 -1
  259. package/dist/invoice-ledger.js.map +0 -1
  260. package/dist/invoices.d.ts.map +0 -1
  261. package/dist/invoices.js.map +0 -1
  262. package/dist/kernel.d.ts.map +0 -1
  263. package/dist/kernel.js.map +0 -1
  264. package/dist/languages.d.ts.map +0 -1
  265. package/dist/languages.js.map +0 -1
  266. package/dist/line-groups.d.ts.map +0 -1
  267. package/dist/line-groups.js.map +0 -1
  268. package/dist/linkedin-ads.d.ts.map +0 -1
  269. package/dist/linkedin-ads.js.map +0 -1
  270. package/dist/localized-name.d.ts.map +0 -1
  271. package/dist/localized-name.js.map +0 -1
  272. package/dist/megamenu.d.ts.map +0 -1
  273. package/dist/megamenu.js.map +0 -1
  274. package/dist/meta-ads.d.ts.map +0 -1
  275. package/dist/meta-ads.js.map +0 -1
  276. package/dist/mfa.d.ts.map +0 -1
  277. package/dist/mfa.js.map +0 -1
  278. package/dist/modules.d.ts.map +0 -1
  279. package/dist/modules.js.map +0 -1
  280. package/dist/money-decimal.d.ts.map +0 -1
  281. package/dist/money-decimal.js.map +0 -1
  282. package/dist/money-input.d.ts.map +0 -1
  283. package/dist/money-input.js.map +0 -1
  284. package/dist/newsletter.d.ts.map +0 -1
  285. package/dist/newsletter.js.map +0 -1
  286. package/dist/order-minimums.d.ts.map +0 -1
  287. package/dist/order-minimums.js.map +0 -1
  288. package/dist/orders.d.ts.map +0 -1
  289. package/dist/orders.js.map +0 -1
  290. package/dist/organizations.d.ts.map +0 -1
  291. package/dist/organizations.js.map +0 -1
  292. package/dist/page-builder-props.d.ts.map +0 -1
  293. package/dist/page-builder-props.js.map +0 -1
  294. package/dist/page-builder-values.d.ts.map +0 -1
  295. package/dist/page-builder-values.js.map +0 -1
  296. package/dist/pagination.d.ts.map +0 -1
  297. package/dist/pagination.js.map +0 -1
  298. package/dist/payment-methods.d.ts.map +0 -1
  299. package/dist/payment-methods.js.map +0 -1
  300. package/dist/payment-return-url.d.ts.map +0 -1
  301. package/dist/payment-return-url.js.map +0 -1
  302. package/dist/payments.d.ts.map +0 -1
  303. package/dist/payments.js.map +0 -1
  304. package/dist/pim-connector.d.ts.map +0 -1
  305. package/dist/pim-connector.js.map +0 -1
  306. package/dist/pim-field-path.d.ts.map +0 -1
  307. package/dist/pim-field-path.js.map +0 -1
  308. package/dist/platform-info.d.ts.map +0 -1
  309. package/dist/platform-info.js.map +0 -1
  310. package/dist/platform-language.d.ts.map +0 -1
  311. package/dist/platform-language.js.map +0 -1
  312. package/dist/price-book-decimal.d.ts.map +0 -1
  313. package/dist/price-book-decimal.js.map +0 -1
  314. package/dist/price-books.d.ts.map +0 -1
  315. package/dist/price-books.js.map +0 -1
  316. package/dist/price-lists.d.ts.map +0 -1
  317. package/dist/price-lists.js.map +0 -1
  318. package/dist/product-feeds.d.ts.map +0 -1
  319. package/dist/product-feeds.js.map +0 -1
  320. package/dist/product-scope-overrides.d.ts.map +0 -1
  321. package/dist/product-scope-overrides.js.map +0 -1
  322. package/dist/product-scopes.d.ts.map +0 -1
  323. package/dist/product-scopes.js.map +0 -1
  324. package/dist/product-summary-text.d.ts.map +0 -1
  325. package/dist/product-summary-text.js.map +0 -1
  326. package/dist/product-url-keys.d.ts.map +0 -1
  327. package/dist/product-url-keys.js.map +0 -1
  328. package/dist/product-value-resolver.d.ts.map +0 -1
  329. package/dist/product-value-resolver.js.map +0 -1
  330. package/dist/projects.d.ts.map +0 -1
  331. package/dist/projects.js.map +0 -1
  332. package/dist/promotions.d.ts.map +0 -1
  333. package/dist/promotions.js.map +0 -1
  334. package/dist/prompt-actions.d.ts.map +0 -1
  335. package/dist/prompt-actions.js.map +0 -1
  336. package/dist/pwa.d.ts.map +0 -1
  337. package/dist/pwa.js.map +0 -1
  338. package/dist/quick-order.d.ts.map +0 -1
  339. package/dist/quick-order.js.map +0 -1
  340. package/dist/quote-requests.d.ts.map +0 -1
  341. package/dist/quote-requests.js.map +0 -1
  342. package/dist/record-references.d.ts.map +0 -1
  343. package/dist/record-references.js.map +0 -1
  344. package/dist/record-rich-text.d.ts.map +0 -1
  345. package/dist/record-rich-text.js.map +0 -1
  346. package/dist/returns.d.ts.map +0 -1
  347. package/dist/returns.js.map +0 -1
  348. package/dist/sales-channels.d.ts.map +0 -1
  349. package/dist/sales-channels.js.map +0 -1
  350. package/dist/saved-list-views.d.ts.map +0 -1
  351. package/dist/saved-list-views.js.map +0 -1
  352. package/dist/scope-notice.d.ts.map +0 -1
  353. package/dist/scope-notice.js.map +0 -1
  354. package/dist/scoped-translations.d.ts +0 -48
  355. package/dist/scoped-translations.d.ts.map +0 -1
  356. package/dist/scoped-translations.js +0 -78
  357. package/dist/scoped-translations.js.map +0 -1
  358. package/dist/search.d.ts.map +0 -1
  359. package/dist/search.js.map +0 -1
  360. package/dist/seo.d.ts.map +0 -1
  361. package/dist/seo.js.map +0 -1
  362. package/dist/settings.d.ts.map +0 -1
  363. package/dist/settings.js.map +0 -1
  364. package/dist/shipments.d.ts.map +0 -1
  365. package/dist/shipments.js.map +0 -1
  366. package/dist/shipping-methods.d.ts.map +0 -1
  367. package/dist/shipping-methods.js.map +0 -1
  368. package/dist/shopping-lists.d.ts.map +0 -1
  369. package/dist/shopping-lists.js.map +0 -1
  370. package/dist/storefront-cache-tags.d.ts.map +0 -1
  371. package/dist/storefront-cache-tags.js.map +0 -1
  372. package/dist/storefront-language-path.d.ts.map +0 -1
  373. package/dist/storefront-language-path.js.map +0 -1
  374. package/dist/storefront-value-overrides.d.ts.map +0 -1
  375. package/dist/storefront-value-overrides.js.map +0 -1
  376. package/dist/tasks.d.ts.map +0 -1
  377. package/dist/tasks.js.map +0 -1
  378. package/dist/taxes.d.ts.map +0 -1
  379. package/dist/taxes.js.map +0 -1
  380. package/dist/text-normalization.d.ts.map +0 -1
  381. package/dist/text-normalization.js.map +0 -1
  382. package/dist/transactional-emails.d.ts.map +0 -1
  383. package/dist/transactional-emails.js.map +0 -1
  384. package/dist/webhooks.d.ts.map +0 -1
  385. package/dist/webhooks.js.map +0 -1
@@ -15,7 +15,7 @@
15
15
  import { z } from 'zod';
16
16
  import { isoDateTimeSchema, uuidSchema } from './common.js';
17
17
  import { collectionEnvelope, dataEnvelope } from './envelopes.js';
18
- import { listQuerySchema } from './pagination.js';
18
+ import { listQuerySchema, paginationSchema } from './pagination.js';
19
19
  import { pinnedPriceBookUnpublishableReasonSchema } from './price-lists.js';
20
20
  // ---------------------------------------------------------------------------
21
21
  // (1) Enumerations
@@ -131,6 +131,11 @@ export const feedRunIssueReasonSchema = z.enum([
131
131
  'missing_image',
132
132
  'private_image_asset',
133
133
  'missing_required_field',
134
+ /**
135
+ * Feature 174 — no longer emitted: a product's Global text satisfies every (channel, language),
136
+ * so there is no language fallback to report. Kept because run issues recorded before 174 still
137
+ * carry it and are read back through this schema (and labelled by the admin's run history).
138
+ */
134
139
  'missing_translation',
135
140
  'unresolvable_link',
136
141
  'unmapped_provider_category',
@@ -540,6 +545,11 @@ export const feedTemplateSchema = z.object({
540
545
  fields: z.array(feedTemplateFieldSchema),
541
546
  /** Number of feeds referencing this template — drives the delete refusal message (FR-010). */
542
547
  usedByFeedCount: z.number().int().nonnegative(),
548
+ /**
549
+ * The length of `fields`. Every template reply answers it; the list, which
550
+ * carries no `fields`, shows it as the field count (issue #599).
551
+ */
552
+ fieldCount: z.number().int().nonnegative().optional(),
543
553
  version: z.number().int().positive(),
544
554
  createdAt: isoDateTimeSchema,
545
555
  updatedAt: isoDateTimeSchema,
@@ -584,7 +594,26 @@ export const duplicateFeedTemplateRequestSchema = z.object({
584
594
  name: z.string().trim().min(1).max(200),
585
595
  });
586
596
  export const feedTemplateResponseSchema = dataEnvelope(feedTemplateSchema);
587
- export const feedTemplateListResponseSchema = collectionEnvelope(feedTemplateSchema.omit({ fields: true }));
597
+ /**
598
+ * `GET /api/v1/admin/feed-templates` — every template, without its field list.
599
+ *
600
+ * `pagination` is optional: the route answers the whole list in one page and has
601
+ * never sent it (issue #599). The rows are `feedTemplateSchema` minus `fields`.
602
+ */
603
+ export const feedTemplateListResponseSchema = collectionEnvelope(feedTemplateSchema.omit({ fields: true })).extend({ pagination: paginationSchema.optional() });
604
+ /**
605
+ * FR-074 — a save that removes a provider-required field. Refused with a `409`
606
+ * carrying these until the operator acknowledges them, then answered beside the
607
+ * saved template.
608
+ */
609
+ export const feedTemplateSaveWarningSchema = z.object({
610
+ code: z.literal('provider_required_field_removed'),
611
+ outputName: z.string(),
612
+ });
613
+ /** `PUT /api/v1/admin/feed-templates/:id` — the saved template and the warnings the save acknowledged (issue #599). */
614
+ export const feedTemplateUpdateResponseSchema = feedTemplateResponseSchema.extend({
615
+ warnings: z.array(feedTemplateSaveWarningSchema),
616
+ });
588
617
  // ---------------------------------------------------------------------------
589
618
  // (4b) Guided binding catalogue (FR-070)
590
619
  //
@@ -829,6 +858,21 @@ export const duplicateProductFeedRequestSchema = z.object({
829
858
  });
830
859
  export const productFeedResponseSchema = dataEnvelope(productFeedSchema);
831
860
  export const productFeedListResponseSchema = collectionEnvelope(productFeedSchema);
861
+ /**
862
+ * Issue #414 — one price book a feed's settings offer to pin the feed to
863
+ * (`GET /api/v1/admin/product-feeds/:id/price-book-options`): every book in the
864
+ * feed's currency, plus the book the feed is pinned to whatever its currency.
865
+ * `unpublishableReason` is why the book would publish no prices for this feed
866
+ * now (feature 160 FR-029, owner ruling 2026-10-23), `null` when it would.
867
+ */
868
+ export const productFeedPriceBookOptionSchema = z.object({
869
+ id: z.string().min(1),
870
+ name: z.string(),
871
+ /** The currency's base book. */
872
+ isBase: z.boolean(),
873
+ unpublishableReason: pinnedPriceBookUnpublishableReasonSchema.nullable(),
874
+ });
875
+ export const productFeedPriceBookOptionsResponseSchema = dataEnvelope(z.array(productFeedPriceBookOptionSchema));
832
876
  /** Returned exactly once, on create and on rotate. Never re-readable (FR-047). */
833
877
  export const productFeedTokenIssuedResponseSchema = dataEnvelope(z.object({
834
878
  token: z.string(),
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Feature 174 (`specs/174-product-editor-scope-switcher/`; research R1, data-model §0 and §9) —
3
+ * the one scope vocabulary of product data and the one resolver every store feeds.
4
+ *
5
+ * Three levels, widest first: **Global** (the product row), **Channel** (a sales channel, no
6
+ * language) and **Channel × language**. There is no Language-only scope anywhere (FR-010).
7
+ *
8
+ * A store hands the resolver rows of one shape, {@link ScopedRow}: a row's **presence** is the
9
+ * override, whatever its value (FR-013). A row whose value is `{ kind: 'empty' }` is an empty
10
+ * override and stops the fallback; no row inherits from the scope above.
11
+ *
12
+ * Its only import is type-only, so every other contract file may import it without a
13
+ * runtime cycle. It is shared by the backend and the admin SPA (feature 022 precedent).
14
+ */
15
+ import type { AttributeValueType } from './catalog.js';
16
+ /** A scope as the server and the editor address it. */
17
+ export type ScopeRef = {
18
+ level: 'global';
19
+ } | {
20
+ level: 'channel';
21
+ channelId: string;
22
+ } | {
23
+ level: 'channel_language';
24
+ channelId: string;
25
+ languageCode: string;
26
+ };
27
+ /** The level of a scope in the short form the scope sets use. */
28
+ export type ScopeLevel = 'G' | 'C' | 'CL';
29
+ /** Every level, widest first. */
30
+ export declare const SCOPE_LEVELS: readonly ScopeLevel[];
31
+ /** A stored value at one scope: a value, or an empty override (FR-013). */
32
+ export type ScopedValue<T> = {
33
+ kind: 'value';
34
+ value: T;
35
+ } | {
36
+ kind: 'empty';
37
+ };
38
+ /** One stored override, in the shape every store's adapter produces. `languageCode null` = C. */
39
+ export interface ScopedRow<T> {
40
+ channelId: string;
41
+ languageCode: string | null;
42
+ value: ScopedValue<T>;
43
+ }
44
+ /**
45
+ * Where an effective value comes from (FR-109): `set` — own value at this scope; `set_empty` —
46
+ * own empty override; `inherited_channel` / `inherited_global` — from the scope above (the
47
+ * value may be `null` when that scope holds an empty override); `absent` — no value at any scope.
48
+ */
49
+ export type ScopedSource = 'set' | 'set_empty' | 'inherited_channel' | 'inherited_global' | 'absent';
50
+ export declare const SCOPED_SOURCES: readonly ScopedSource[];
51
+ export interface ScopedResolution<T> {
52
+ /** The effective value; `null` when the answer is an empty override or there is none. */
53
+ value: T | null;
54
+ source: ScopedSource;
55
+ }
56
+ /** `G`, `C` or `CL` for a scope. */
57
+ export declare function levelOf(scope: ScopeRef): ScopeLevel;
58
+ /**
59
+ * Whether two language tags name the same language as a channel spells it — compared
60
+ * case-insensitively (`de-DE` = `de-de`), never by base language. `null` / `undefined` (no
61
+ * language: a channel or global row) equals only itself. The one comparison every scope, key
62
+ * and value read uses.
63
+ */
64
+ export declare function sameLanguage(a: string | null | undefined, b: string | null | undefined): boolean;
65
+ /**
66
+ * The scope a request names (`contracts/scoped-values-api.md` §1): neither → Global, a channel
67
+ * only → Channel, both → Channel × language. A language without a channel is refused — there
68
+ * is no Language scope (FR-010); the caller answers `422 VALIDATION_FAILED`,
69
+ * `details.field = 'scope'`. Membership and offered languages are the caller's check.
70
+ */
71
+ export declare function scopeFromRequest(input: {
72
+ channelId?: string | null | undefined;
73
+ languageCode?: string | null | undefined;
74
+ }): {
75
+ ok: true;
76
+ scope: ScopeRef;
77
+ } | {
78
+ ok: false;
79
+ reason: 'language_without_channel';
80
+ };
81
+ /**
82
+ * The effective value of one field at `scope`: `row(C, L) ?? row(C, null) ?? global`,
83
+ * restricted to `levels` (the field's scope set). A row present at a level wins whatever it
84
+ * holds; an empty row is the answer (FR-013). `global` `null` / `undefined` = no Global value.
85
+ * Rows of another channel or language never match, so orphaned rows are ignored by
86
+ * construction (163 FR-015).
87
+ */
88
+ export declare function resolveScoped<T>(input: {
89
+ global: T | null | undefined;
90
+ rows: readonly ScopedRow<T>[];
91
+ scope: ScopeRef;
92
+ levels: readonly ScopeLevel[];
93
+ }): ScopedResolution<T>;
94
+ /** What a field accepts: its scope set, whether it is required, whether it takes an empty override. */
95
+ export interface FieldScopeSpec {
96
+ levels: readonly ScopeLevel[];
97
+ /** Refuses an empty override (`required_empty`, FR-062). */
98
+ required: boolean;
99
+ /** Takes an empty override at all; single selects and booleans do not (`not_emptyable`). */
100
+ emptyable: boolean;
101
+ }
102
+ /** The SEO fields catalog's save writes through `seo`'s port (`contracts/seo-ports.md`). */
103
+ export declare const SEO_PRODUCT_META_FIELDS: readonly ["title", "description", "ogTitle", "ogDescription", "ogImageUrl"];
104
+ export type SeoProductMetaField = (typeof SEO_PRODUCT_META_FIELDS)[number];
105
+ /** The gallery roles a scope can reassign. */
106
+ export declare const GALLERY_ROLE_LABELS: readonly ["base_image", "small_image", "thumbnail"];
107
+ export type GalleryRoleLabel = (typeof GALLERY_ROLE_LABELS)[number];
108
+ /**
109
+ * The scope set of every product field family except user attributes (those derive theirs
110
+ * from the definition, {@link attributeFieldSpec}). A field not listed is global-only (spec
111
+ * *Terms*). Subject families are keyed without the subject id: `gallery:altText` covers
112
+ * `gallery:<itemId>:altText`.
113
+ */
114
+ export declare const PRODUCT_FIELD_SCOPE_SETS: Readonly<{
115
+ name: FieldScopeSpec;
116
+ description: FieldScopeSpec;
117
+ status: FieldScopeSpec;
118
+ window: FieldScopeSpec;
119
+ audience: FieldScopeSpec;
120
+ minOrderQuantity: FieldScopeSpec;
121
+ returnable: FieldScopeSpec;
122
+ urlKey: FieldScopeSpec;
123
+ 'seo:title': FieldScopeSpec;
124
+ 'seo:description': FieldScopeSpec;
125
+ 'seo:ogTitle': FieldScopeSpec;
126
+ 'seo:ogDescription': FieldScopeSpec;
127
+ 'seo:ogImageUrl': FieldScopeSpec;
128
+ 'gallery:altText': FieldScopeSpec;
129
+ 'gallery:hidden': FieldScopeSpec;
130
+ galleryRole: FieldScopeSpec;
131
+ 'attachment:name': FieldScopeSpec;
132
+ 'attachment:description': FieldScopeSpec;
133
+ 'attachment:hidden': FieldScopeSpec;
134
+ 'packagingUnit:name': FieldScopeSpec;
135
+ }>;
136
+ export type ProductFieldFamily = keyof typeof PRODUCT_FIELD_SCOPE_SETS;
137
+ /**
138
+ * A scoped field path: a family of {@link PRODUCT_FIELD_SCOPE_SETS} with its subject id, or
139
+ * `attribute:<key>`.
140
+ */
141
+ export type FieldPath = 'name' | 'description' | 'status' | 'window' | 'audience' | 'minOrderQuantity' | 'returnable' | 'urlKey' | `seo:${SeoProductMetaField}` | `attribute:${string}` | `gallery:${string}:altText` | `gallery:${string}:hidden` | `galleryRole:${GalleryRoleLabel}` | `attachment:${string}:${'name' | 'description' | 'hidden'}` | `packagingUnit:${string}:name`;
142
+ /**
143
+ * The family row of a concrete field path, or `null` for an attribute path (use
144
+ * {@link attributeFieldSpec}), a global-only or unknown field, or a malformed sub-field.
145
+ */
146
+ export declare function fieldScopeSpec(path: string): FieldScopeSpec | null;
147
+ /** The scope set an attribute definition derives (R15): not scopable → G; text → G, C, CL; else G, C. */
148
+ export declare function attributeScopeSet(def: {
149
+ scopable: boolean;
150
+ valueType: AttributeValueType;
151
+ }): readonly ScopeLevel[];
152
+ /**
153
+ * An attribute's {@link FieldScopeSpec}: its scope set, `required` from the definition, and
154
+ * `emptyable` false for single selects (`enum`, `select`) and booleans (data-model §9).
155
+ */
156
+ export declare function attributeFieldSpec(def: {
157
+ scopable: boolean;
158
+ valueType: AttributeValueType;
159
+ isRequired: boolean;
160
+ }): FieldScopeSpec;
161
+ //# sourceMappingURL=product-scope-model.d.ts.map
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Feature 174 (`specs/174-product-editor-scope-switcher/`; research R1, data-model §0 and §9) —
3
+ * the one scope vocabulary of product data and the one resolver every store feeds.
4
+ *
5
+ * Three levels, widest first: **Global** (the product row), **Channel** (a sales channel, no
6
+ * language) and **Channel × language**. There is no Language-only scope anywhere (FR-010).
7
+ *
8
+ * A store hands the resolver rows of one shape, {@link ScopedRow}: a row's **presence** is the
9
+ * override, whatever its value (FR-013). A row whose value is `{ kind: 'empty' }` is an empty
10
+ * override and stops the fallback; no row inherits from the scope above.
11
+ *
12
+ * Its only import is type-only, so every other contract file may import it without a
13
+ * runtime cycle. It is shared by the backend and the admin SPA (feature 022 precedent).
14
+ */
15
+ import { isUuidShape } from './common.js';
16
+ /** Every level, widest first. */
17
+ export const SCOPE_LEVELS = ['G', 'C', 'CL'];
18
+ export const SCOPED_SOURCES = [
19
+ 'set',
20
+ 'set_empty',
21
+ 'inherited_channel',
22
+ 'inherited_global',
23
+ 'absent',
24
+ ];
25
+ /** `G`, `C` or `CL` for a scope. */
26
+ export function levelOf(scope) {
27
+ if (scope.level === 'global')
28
+ return 'G';
29
+ if (scope.level === 'channel')
30
+ return 'C';
31
+ return 'CL';
32
+ }
33
+ /**
34
+ * Whether two language tags name the same language as a channel spells it — compared
35
+ * case-insensitively (`de-DE` = `de-de`), never by base language. `null` / `undefined` (no
36
+ * language: a channel or global row) equals only itself. The one comparison every scope, key
37
+ * and value read uses.
38
+ */
39
+ export function sameLanguage(a, b) {
40
+ if (a == null || b == null)
41
+ return (a ?? null) === (b ?? null);
42
+ return a.toLowerCase() === b.toLowerCase();
43
+ }
44
+ /**
45
+ * The scope a request names (`contracts/scoped-values-api.md` §1): neither → Global, a channel
46
+ * only → Channel, both → Channel × language. A language without a channel is refused — there
47
+ * is no Language scope (FR-010); the caller answers `422 VALIDATION_FAILED`,
48
+ * `details.field = 'scope'`. Membership and offered languages are the caller's check.
49
+ */
50
+ export function scopeFromRequest(input) {
51
+ const channelId = input.channelId ?? null;
52
+ const languageCode = input.languageCode ?? null;
53
+ if (channelId === null) {
54
+ return languageCode === null ? { ok: true, scope: { level: 'global' } } : { ok: false, reason: 'language_without_channel' };
55
+ }
56
+ if (languageCode === null)
57
+ return { ok: true, scope: { level: 'channel', channelId } };
58
+ return { ok: true, scope: { level: 'channel_language', channelId, languageCode } };
59
+ }
60
+ // --- 2. The resolver --------------------------------------------------------------------------
61
+ function toResolution(value, own, inheritedFrom) {
62
+ if (value.kind === 'empty')
63
+ return { value: null, source: own ? 'set_empty' : inheritedFrom };
64
+ return { value: value.value, source: own ? 'set' : inheritedFrom };
65
+ }
66
+ /**
67
+ * The effective value of one field at `scope`: `row(C, L) ?? row(C, null) ?? global`,
68
+ * restricted to `levels` (the field's scope set). A row present at a level wins whatever it
69
+ * holds; an empty row is the answer (FR-013). `global` `null` / `undefined` = no Global value.
70
+ * Rows of another channel or language never match, so orphaned rows are ignored by
71
+ * construction (163 FR-015).
72
+ */
73
+ export function resolveScoped(input) {
74
+ const { scope, levels, rows } = input;
75
+ const global = input.global ?? null;
76
+ const fromGlobal = (own) => global === null ? { value: null, source: 'absent' } : { value: global, source: own ? 'set' : 'inherited_global' };
77
+ if (scope.level === 'global')
78
+ return fromGlobal(true);
79
+ if (scope.level === 'channel_language' && levels.includes('CL')) {
80
+ const own = rows.find((row) => row.channelId === scope.channelId && row.languageCode !== null && sameLanguage(row.languageCode, scope.languageCode));
81
+ if (own !== undefined)
82
+ return toResolution(own.value, true, 'inherited_channel');
83
+ }
84
+ if (levels.includes('C')) {
85
+ const channelRow = rows.find((row) => row.channelId === scope.channelId && row.languageCode === null);
86
+ if (channelRow !== undefined)
87
+ return toResolution(channelRow.value, scope.level === 'channel', 'inherited_channel');
88
+ }
89
+ return fromGlobal(false);
90
+ }
91
+ const ALL = ['G', 'C', 'CL'];
92
+ const GC = ['G', 'C'];
93
+ const ONLY_G = ['G'];
94
+ const spec = (levels, required, emptyable) => Object.freeze({ levels, required, emptyable });
95
+ /** The SEO fields catalog's save writes through `seo`'s port (`contracts/seo-ports.md`). */
96
+ export const SEO_PRODUCT_META_FIELDS = ['title', 'description', 'ogTitle', 'ogDescription', 'ogImageUrl'];
97
+ /** The gallery roles a scope can reassign. */
98
+ export const GALLERY_ROLE_LABELS = ['base_image', 'small_image', 'thumbnail'];
99
+ /**
100
+ * The scope set of every product field family except user attributes (those derive theirs
101
+ * from the definition, {@link attributeFieldSpec}). A field not listed is global-only (spec
102
+ * *Terms*). Subject families are keyed without the subject id: `gallery:altText` covers
103
+ * `gallery:<itemId>:altText`.
104
+ */
105
+ export const PRODUCT_FIELD_SCOPE_SETS = Object.freeze({
106
+ name: spec(ALL, true, false),
107
+ description: spec(ALL, false, true),
108
+ status: spec(ALL, false, false),
109
+ window: spec(GC, false, true),
110
+ audience: spec(GC, false, false),
111
+ minOrderQuantity: spec(GC, false, true),
112
+ returnable: spec(GC, false, false),
113
+ urlKey: spec(ALL, true, false),
114
+ 'seo:title': spec(ALL, false, true),
115
+ 'seo:description': spec(ALL, false, true),
116
+ 'seo:ogTitle': spec(ALL, false, true),
117
+ 'seo:ogDescription': spec(ALL, false, true),
118
+ 'seo:ogImageUrl': spec(ALL, false, true),
119
+ 'gallery:altText': spec(ALL, false, true),
120
+ 'gallery:hidden': spec(ALL, false, false),
121
+ galleryRole: spec(ALL, false, true),
122
+ 'attachment:name': spec(ALL, false, true),
123
+ 'attachment:description': spec(ALL, false, true),
124
+ 'attachment:hidden': spec(ALL, false, false),
125
+ 'packagingUnit:name': spec(ALL, false, true),
126
+ });
127
+ /**
128
+ * The family row of a concrete field path, or `null` for an attribute path (use
129
+ * {@link attributeFieldSpec}), a global-only or unknown field, or a malformed sub-field.
130
+ */
131
+ export function fieldScopeSpec(path) {
132
+ const sets = PRODUCT_FIELD_SCOPE_SETS;
133
+ if (!path.includes(':') || path.startsWith('seo:'))
134
+ return Object.hasOwn(sets, path) ? sets[path] : null;
135
+ const parts = path.split(':');
136
+ const [family, a, b] = parts;
137
+ if (family === 'galleryRole' && parts.length === 2) {
138
+ return GALLERY_ROLE_LABELS.includes(a) ? sets['galleryRole'] : null;
139
+ }
140
+ if (parts.length !== 3 || !isUuidShape(a))
141
+ return null;
142
+ const key = `${family}:${b}`;
143
+ if (family !== 'gallery' && family !== 'attachment' && family !== 'packagingUnit')
144
+ return null;
145
+ return Object.hasOwn(sets, key) ? sets[key] : null;
146
+ }
147
+ /** The scope set an attribute definition derives (R15): not scopable → G; text → G, C, CL; else G, C. */
148
+ export function attributeScopeSet(def) {
149
+ if (!def.scopable)
150
+ return ONLY_G;
151
+ return def.valueType === 'string' ? ALL : GC;
152
+ }
153
+ /**
154
+ * An attribute's {@link FieldScopeSpec}: its scope set, `required` from the definition, and
155
+ * `emptyable` false for single selects (`enum`, `select`) and booleans (data-model §9).
156
+ */
157
+ export function attributeFieldSpec(def) {
158
+ const notEmptyable = def.valueType === 'enum' || def.valueType === 'select' || def.valueType === 'boolean';
159
+ return { levels: attributeScopeSet(def), required: def.isRequired, emptyable: !notEmptyable && !def.isRequired };
160
+ }
161
+ //# sourceMappingURL=product-scope-model.js.map
@@ -10,114 +10,11 @@ import { z } from 'zod';
10
10
  export declare const attributeKeySchema: z.ZodString;
11
11
  /** BCP-47-ish language code. The dictionary module governs the active list. */
12
12
  export declare const languageCodeSchema: z.ZodString;
13
- /** Wrapped value column shape — `{ v: ... }` keeps the JSONB an object. */
14
- export declare const overrideValueSchema: z.ZodObject<{
15
- v: z.ZodUnknown;
16
- }, z.core.$strip>;
17
- export declare const productValueOverrideSchema: z.ZodObject<{
18
- id: z.ZodString;
19
- attributeKey: z.ZodString;
20
- channelId: z.ZodString;
21
- languageCode: z.ZodNullable<z.ZodString>;
22
- value: z.ZodObject<{
23
- v: z.ZodUnknown;
24
- }, z.core.$strip>;
25
- updatedAt: z.ZodString;
26
- }, z.core.$strip>;
27
- export type ProductValueOverride = z.infer<typeof productValueOverrideSchema>;
28
- export declare const productValueOverridesGetResponseSchema: z.ZodObject<{
29
- productId: z.ZodString;
30
- overrides: z.ZodArray<z.ZodObject<{
31
- id: z.ZodString;
32
- attributeKey: z.ZodString;
33
- channelId: z.ZodString;
34
- languageCode: z.ZodNullable<z.ZodString>;
35
- value: z.ZodObject<{
36
- v: z.ZodUnknown;
37
- }, z.core.$strip>;
38
- updatedAt: z.ZodString;
39
- }, z.core.$strip>>;
40
- }, z.core.$strip>;
41
- export type ProductValueOverridesGetResponse = z.infer<typeof productValueOverridesGetResponseSchema>;
42
- export declare const productValueOverrideUpsertSchema: z.ZodObject<{
43
- attributeKey: z.ZodString;
44
- channelId: z.ZodString;
45
- languageCode: z.ZodNullable<z.ZodString>;
46
- value: z.ZodObject<{
47
- v: z.ZodUnknown;
48
- }, z.core.$strip>;
49
- }, z.core.$strip>;
50
- export type ProductValueOverrideUpsert = z.infer<typeof productValueOverrideUpsertSchema>;
51
- export declare const productValueOverrideDeleteSchema: z.ZodObject<{
52
- attributeKey: z.ZodString;
53
- channelId: z.ZodString;
54
- languageCode: z.ZodNullable<z.ZodString>;
55
- }, z.core.$strip>;
56
- export type ProductValueOverrideDelete = z.infer<typeof productValueOverrideDeleteSchema>;
57
- export declare const productValueOverridesPatchRequestSchema: z.ZodObject<{
58
- upserts: z.ZodDefault<z.ZodArray<z.ZodObject<{
59
- attributeKey: z.ZodString;
60
- channelId: z.ZodString;
61
- languageCode: z.ZodNullable<z.ZodString>;
62
- value: z.ZodObject<{
63
- v: z.ZodUnknown;
64
- }, z.core.$strip>;
65
- }, z.core.$strip>>>;
66
- deletes: z.ZodDefault<z.ZodArray<z.ZodObject<{
67
- attributeKey: z.ZodString;
68
- channelId: z.ZodString;
69
- languageCode: z.ZodNullable<z.ZodString>;
70
- }, z.core.$strip>>>;
71
- }, z.core.$strip>;
72
- export type ProductValueOverridesPatchRequest = z.infer<typeof productValueOverridesPatchRequestSchema>;
73
- export declare const productValueOverridesPatchResponseSchema: z.ZodObject<{
74
- productId: z.ZodString;
75
- applied: z.ZodObject<{
76
- upserted: z.ZodNumber;
77
- deleted: z.ZodNumber;
78
- }, z.core.$strip>;
79
- overrides: z.ZodArray<z.ZodObject<{
80
- id: z.ZodString;
81
- attributeKey: z.ZodString;
82
- channelId: z.ZodString;
83
- languageCode: z.ZodNullable<z.ZodString>;
84
- value: z.ZodObject<{
85
- v: z.ZodUnknown;
86
- }, z.core.$strip>;
87
- updatedAt: z.ZodString;
88
- }, z.core.$strip>>;
89
- }, z.core.$strip>;
90
- export type ProductValueOverridesPatchResponse = z.infer<typeof productValueOverridesPatchResponseSchema>;
91
- export declare const productScopeChannelSchema: z.ZodObject<{
92
- id: z.ZodString;
93
- code: z.ZodString;
94
- name: z.ZodString;
95
- languages: z.ZodArray<z.ZodString>;
96
- isDefault: z.ZodBoolean;
97
- }, z.core.$strip>;
98
- export type ProductScopeChannel = z.infer<typeof productScopeChannelSchema>;
99
13
  export declare const productEditorPreferenceFieldsSchema: z.ZodObject<{
100
14
  lastChannelId: z.ZodNullable<z.ZodString>;
101
15
  lastLanguageCode: z.ZodNullable<z.ZodString>;
102
16
  }, z.core.$strip>;
103
17
  export type ProductEditorPreferenceFields = z.infer<typeof productEditorPreferenceFieldsSchema>;
104
- export declare const productScopeContextResponseSchema: z.ZodObject<{
105
- productId: z.ZodString;
106
- channels: z.ZodArray<z.ZodObject<{
107
- id: z.ZodString;
108
- code: z.ZodString;
109
- name: z.ZodString;
110
- languages: z.ZodArray<z.ZodString>;
111
- isDefault: z.ZodBoolean;
112
- }, z.core.$strip>>;
113
- languagesUnion: z.ZodArray<z.ZodString>;
114
- primaryAdminLanguage: z.ZodString;
115
- preference: z.ZodNullable<z.ZodObject<{
116
- lastChannelId: z.ZodNullable<z.ZodString>;
117
- lastLanguageCode: z.ZodNullable<z.ZodString>;
118
- }, z.core.$strip>>;
119
- }, z.core.$strip>;
120
- export type ProductScopeContextResponse = z.infer<typeof productScopeContextResponseSchema>;
121
18
  export declare const productEditorPreferenceRequestSchema: z.ZodObject<{
122
19
  lastChannelId: z.ZodNullable<z.ZodString>;
123
20
  lastLanguageCode: z.ZodNullable<z.ZodString>;
@@ -12,64 +12,10 @@ import { isoDateTimeSchema, uuidSchema } from './common.js';
12
12
  export const attributeKeySchema = z.string().min(1).max(64);
13
13
  /** BCP-47-ish language code. The dictionary module governs the active list. */
14
14
  export const languageCodeSchema = z.string().min(1).max(16);
15
- /** Wrapped value column shape — `{ v: ... }` keeps the JSONB an object. */
16
- export const overrideValueSchema = z.object({ v: z.unknown() });
17
- // --- GET /admin/products/:id/value-overrides --------------------------------
18
- export const productValueOverrideSchema = z.object({
19
- id: uuidSchema,
20
- attributeKey: attributeKeySchema,
21
- channelId: uuidSchema,
22
- languageCode: languageCodeSchema.nullable(),
23
- value: overrideValueSchema,
24
- updatedAt: isoDateTimeSchema,
25
- });
26
- export const productValueOverridesGetResponseSchema = z.object({
27
- productId: uuidSchema,
28
- overrides: z.array(productValueOverrideSchema),
29
- });
30
- // --- PATCH /admin/products/:id/value-overrides ------------------------------
31
- export const productValueOverrideUpsertSchema = z.object({
32
- attributeKey: attributeKeySchema,
33
- channelId: uuidSchema,
34
- languageCode: languageCodeSchema.nullable(),
35
- value: overrideValueSchema,
36
- });
37
- export const productValueOverrideDeleteSchema = z.object({
38
- attributeKey: attributeKeySchema,
39
- channelId: uuidSchema,
40
- languageCode: languageCodeSchema.nullable(),
41
- });
42
- export const productValueOverridesPatchRequestSchema = z.object({
43
- upserts: z.array(productValueOverrideUpsertSchema).default([]),
44
- deletes: z.array(productValueOverrideDeleteSchema).default([]),
45
- });
46
- export const productValueOverridesPatchResponseSchema = z.object({
47
- productId: uuidSchema,
48
- applied: z.object({
49
- upserted: z.number().int().min(0),
50
- deleted: z.number().int().min(0),
51
- }),
52
- overrides: z.array(productValueOverrideSchema),
53
- });
54
- // --- GET /admin/products/:id/scope-context ----------------------------------
55
- export const productScopeChannelSchema = z.object({
56
- id: uuidSchema,
57
- code: z.string().min(1),
58
- name: z.string().min(1),
59
- languages: z.array(languageCodeSchema),
60
- isDefault: z.boolean(),
61
- });
62
15
  export const productEditorPreferenceFieldsSchema = z.object({
63
16
  lastChannelId: uuidSchema.nullable(),
64
17
  lastLanguageCode: languageCodeSchema.nullable(),
65
18
  });
66
- export const productScopeContextResponseSchema = z.object({
67
- productId: uuidSchema,
68
- channels: z.array(productScopeChannelSchema),
69
- languagesUnion: z.array(languageCodeSchema),
70
- primaryAdminLanguage: languageCodeSchema,
71
- preference: productEditorPreferenceFieldsSchema.nullable(),
72
- });
73
19
  // --- PUT /admin/products/:id/editor-preference ------------------------------
74
20
  export const productEditorPreferenceRequestSchema = productEditorPreferenceFieldsSchema;
75
21
  export const productEditorPreferenceResponseSchema = z.object({