@endora-commerce/mod-catalog 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 (615) hide show
  1. package/dist/admin/components/CopyToChannelsDialog.d.ts +37 -0
  2. package/dist/admin/components/CopyToChannelsDialog.js +83 -0
  3. package/dist/admin/components/PackagingUnitsEditor.d.ts +13 -4
  4. package/dist/admin/components/PackagingUnitsEditor.js +21 -85
  5. package/dist/admin/components/ProductAttachmentsSection.d.ts +1 -3
  6. package/dist/admin/components/ProductAttachmentsSection.js +59 -98
  7. package/dist/admin/components/ProductAttributesTab.d.ts +1 -11
  8. package/dist/admin/components/ProductAttributesTab.js +128 -119
  9. package/dist/admin/components/ProductContentCard.d.ts +41 -0
  10. package/dist/admin/components/ProductContentCard.js +28 -0
  11. package/dist/admin/components/ProductEditorSaveAction.d.ts +22 -0
  12. package/dist/admin/components/ProductEditorSaveAction.js +23 -0
  13. package/dist/admin/components/ProductGallerySection.d.ts +2 -13
  14. package/dist/admin/components/ProductGallerySection.js +98 -354
  15. package/dist/admin/components/ProductInventoryTab.d.ts +12 -1
  16. package/dist/admin/components/ProductInventoryTab.js +52 -115
  17. package/dist/admin/components/ProductOrderRulesCard.d.ts +11 -15
  18. package/dist/admin/components/ProductOrderRulesCard.js +15 -268
  19. package/dist/admin/components/ProductScopeBar.d.ts +34 -0
  20. package/dist/admin/components/ProductScopeBar.js +70 -0
  21. package/dist/admin/components/ProductScopeOverview.d.ts +13 -1
  22. package/dist/admin/components/ProductScopeOverview.js +56 -37
  23. package/dist/admin/components/ProductUrlRedirects.d.ts +15 -0
  24. package/dist/admin/components/ProductUrlRedirects.js +70 -0
  25. package/dist/admin/components/ProductsBulkEditDialog.js +4 -3
  26. package/dist/admin/components/editor/DetailsTab.d.ts +30 -0
  27. package/dist/admin/components/editor/DetailsTab.js +60 -0
  28. package/dist/admin/components/editor/SectionHeading.d.ts +22 -0
  29. package/dist/admin/components/editor/SectionHeading.js +19 -0
  30. package/dist/admin/components/editor/confirm-removal.d.ts +13 -0
  31. package/dist/admin/components/editor/confirm-removal.js +33 -0
  32. package/dist/admin/components/editor/editor-context.d.ts +55 -0
  33. package/dist/admin/components/editor/editor-context.js +88 -0
  34. package/dist/admin/components/editor/scoped-controls.d.ts +46 -0
  35. package/dist/admin/components/editor/scoped-controls.js +64 -0
  36. package/dist/admin/index.d.ts +1 -1
  37. package/dist/admin/index.js +11 -0
  38. package/dist/admin/lib/attribute-scope.d.ts +17 -14
  39. package/dist/admin/lib/attribute-scope.js +12 -9
  40. package/dist/admin/lib/bulk-result-outcome.d.ts +14 -0
  41. package/dist/admin/lib/bulk-result-outcome.js +13 -0
  42. package/dist/admin/lib/editor-scope.d.ts +35 -0
  43. package/dist/admin/lib/editor-scope.js +114 -0
  44. package/dist/admin/lib/order-minimum-input.d.ts +13 -0
  45. package/dist/admin/lib/order-minimum-input.js +16 -0
  46. package/dist/admin/lib/product-labels.d.ts +0 -2
  47. package/dist/admin/lib/product-labels.js +1 -5
  48. package/dist/admin/lib/product-scopes-api.d.ts +5 -22
  49. package/dist/admin/lib/product-scopes-api.js +4 -48
  50. package/dist/admin/lib/product-url-keys-api.d.ts +4 -27
  51. package/dist/admin/lib/product-url-keys-api.js +1 -50
  52. package/dist/admin/lib/scope-overview.d.ts +13 -14
  53. package/dist/admin/lib/scope-overview.js +36 -31
  54. package/dist/admin/lib/scoped-editor-store.d.ts +81 -0
  55. package/dist/admin/lib/scoped-editor-store.js +198 -0
  56. package/dist/admin/lib/scoped-values-api.d.ts +14 -0
  57. package/dist/admin/lib/scoped-values-api.js +55 -0
  58. package/dist/admin/pages/AttachmentTypesPage.js +14 -4
  59. package/dist/admin/pages/AttributeSetsPage.js +11 -4
  60. package/dist/admin/pages/AttributesManager.js +130 -40
  61. package/dist/admin/pages/BulkOperationDetailPage.js +11 -4
  62. package/dist/admin/pages/CategoriesTree.d.ts +5 -0
  63. package/dist/admin/pages/CategoriesTree.js +226 -40
  64. package/dist/admin/pages/ProductContentPage.d.ts +27 -0
  65. package/dist/admin/pages/ProductContentPage.js +161 -0
  66. package/dist/admin/pages/ProductCreateForm.d.ts +3 -0
  67. package/dist/admin/pages/ProductCreateForm.js +87 -0
  68. package/dist/admin/pages/ProductEditor.js +938 -458
  69. package/dist/admin/pages/ProductsList.js +33 -38
  70. package/dist/backend/admin-search-provider.d.ts +2 -1
  71. package/dist/backend/admin-search-provider.js +1 -1
  72. package/dist/backend/commands/attribute-commands.d.ts +4 -3
  73. package/dist/backend/commands/attribute-commands.js +137 -30
  74. package/dist/backend/commands/product-content-commands.d.ts +31 -0
  75. package/dist/backend/commands/product-content-commands.js +70 -0
  76. package/dist/backend/commands/scoped-values.commands.d.ts +95 -0
  77. package/dist/backend/commands/scoped-values.commands.js +235 -0
  78. package/dist/backend/demo/reset.js +2 -1
  79. package/dist/backend/demo/rows.d.ts +18 -0
  80. package/dist/backend/demo/rows.js +18 -0
  81. package/dist/backend/demo/seed.d.ts +2 -1
  82. package/dist/backend/demo/seed.js +20 -6
  83. package/dist/backend/entities/gallery-item-scope-override.entity.d.ts +30 -0
  84. package/dist/backend/entities/gallery-item-scope-override.entity.js +80 -0
  85. package/dist/backend/entities/gallery-item.entity.d.ts +7 -6
  86. package/dist/backend/entities/gallery-item.entity.js +11 -6
  87. package/dist/backend/entities/gallery-role-scope-override.entity.d.ts +28 -0
  88. package/dist/backend/entities/gallery-role-scope-override.entity.js +75 -0
  89. package/dist/backend/entities/product-attachment-scope-override.entity.d.ts +30 -0
  90. package/dist/backend/entities/product-attachment-scope-override.entity.js +80 -0
  91. package/dist/backend/entities/product-attachment.entity.d.ts +4 -6
  92. package/dist/backend/entities/product-attachment.entity.js +6 -12
  93. package/dist/backend/entities/product-attribute.entity.d.ts +5 -9
  94. package/dist/backend/entities/product-attribute.entity.js +5 -13
  95. package/dist/backend/entities/product-channel-scope.entity.d.ts +7 -2
  96. package/dist/backend/entities/product-channel-scope.entity.js +10 -1
  97. package/dist/backend/entities/product-content-value.entity.d.ts +39 -0
  98. package/dist/backend/entities/product-content-value.entity.js +81 -0
  99. package/dist/backend/entities/product-packaging-unit-scope-override.entity.d.ts +30 -0
  100. package/dist/backend/entities/product-packaging-unit-scope-override.entity.js +80 -0
  101. package/dist/backend/entities/product-packaging-unit.entity.d.ts +1 -7
  102. package/dist/backend/entities/product-packaging-unit.entity.js +0 -10
  103. package/dist/backend/entities/product-url-key.entity.d.ts +14 -19
  104. package/dist/backend/entities/product-url-key.entity.js +17 -22
  105. package/dist/backend/entities/product-url-redirect.entity.d.ts +8 -13
  106. package/dist/backend/entities/product-url-redirect.entity.js +13 -14
  107. package/dist/backend/entities/product-variant.entity.d.ts +8 -1
  108. package/dist/backend/entities/product-variant.entity.js +13 -2
  109. package/dist/backend/entities/product.entity.d.ts +31 -14
  110. package/dist/backend/entities/product.entity.js +41 -34
  111. package/dist/backend/index.d.ts +11 -3
  112. package/dist/backend/index.js +155 -49
  113. package/dist/backend/plugin.d.ts +36 -6
  114. package/dist/backend/plugin.js +36 -13
  115. package/dist/backend/prompt-tools.d.ts +3 -2
  116. package/dist/backend/prompt-tools.js +18 -7
  117. package/dist/backend/routes.admin.d.ts +15 -16
  118. package/dist/backend/routes.admin.js +122 -103
  119. package/dist/backend/routes.api-key.js +4 -2
  120. package/dist/backend/routes.external.js +3 -2
  121. package/dist/backend/routes.public.d.ts +8 -1
  122. package/dist/backend/routes.public.js +68 -11
  123. package/dist/backend/services/asset-references.d.ts +12 -1
  124. package/dist/backend/services/asset-references.js +42 -2
  125. package/dist/backend/services/attachment-packaging-scopes.d.ts +38 -20
  126. package/dist/backend/services/attachment-packaging-scopes.js +58 -75
  127. package/dist/backend/services/attachment.service.d.ts +4 -8
  128. package/dist/backend/services/attachment.service.js +35 -49
  129. package/dist/backend/services/attribute-filter-match.d.ts +14 -0
  130. package/dist/backend/services/attribute-filter-match.js +19 -0
  131. package/dist/backend/services/attribute-scope-preview.d.ts +17 -7
  132. package/dist/backend/services/attribute-scope-preview.js +30 -20
  133. package/dist/backend/services/attribute-set.service.d.ts +10 -1
  134. package/dist/backend/services/attribute-set.service.js +30 -4
  135. package/dist/backend/services/attribute-type-mapping.d.ts +2 -2
  136. package/dist/backend/services/attribute-type-mapping.js +6 -0
  137. package/dist/backend/services/attribute-usage.d.ts +31 -0
  138. package/dist/backend/services/attribute-usage.js +29 -0
  139. package/dist/backend/services/bulk-operation.service.d.ts +1 -1
  140. package/dist/backend/services/bulk-operation.service.js +16 -6
  141. package/dist/backend/services/bundle.service.js +19 -1
  142. package/dist/backend/services/catalog-admin-search.service.d.ts +3 -2
  143. package/dist/backend/services/catalog-admin-search.service.js +6 -6
  144. package/dist/backend/services/catalog-admin.service.d.ts +63 -12
  145. package/dist/backend/services/catalog-admin.service.js +368 -195
  146. package/dist/backend/services/catalog-attribute-read.service.d.ts +14 -0
  147. package/dist/backend/services/catalog-attribute-read.service.js +9 -19
  148. package/dist/backend/services/catalog-bulk-import.service.d.ts +58 -5
  149. package/dist/backend/services/catalog-bulk-import.service.js +192 -142
  150. package/dist/backend/services/catalog-bulk-update.service.d.ts +5 -3
  151. package/dist/backend/services/catalog-bulk-update.service.js +21 -8
  152. package/dist/backend/services/catalog-product-read.service.d.ts +11 -1
  153. package/dist/backend/services/catalog-product-read.service.js +37 -17
  154. package/dist/backend/services/catalog-query.service.d.ts +48 -8
  155. package/dist/backend/services/catalog-query.service.js +180 -116
  156. package/dist/backend/services/catalog-quick-search.service.js +5 -5
  157. package/dist/backend/services/catalog-write-ports.d.ts +14 -16
  158. package/dist/backend/services/catalog-write-ports.js +11 -70
  159. package/dist/backend/services/category-admin.service.js +29 -5
  160. package/dist/backend/services/content-attribute-rules.d.ts +61 -0
  161. package/dist/backend/services/content-attribute-rules.js +102 -0
  162. package/dist/backend/services/effective-value.sql.d.ts +24 -38
  163. package/dist/backend/services/effective-value.sql.js +37 -87
  164. package/dist/backend/services/gallery-scopes.d.ts +45 -22
  165. package/dist/backend/services/gallery-scopes.js +116 -109
  166. package/dist/backend/services/gallery.service.d.ts +13 -27
  167. package/dist/backend/services/gallery.service.js +75 -199
  168. package/dist/backend/services/grouped.service.js +20 -3
  169. package/dist/backend/services/packaging-unit.service.js +7 -12
  170. package/dist/backend/services/page-builder-content.d.ts +64 -0
  171. package/dist/backend/services/page-builder-content.js +113 -0
  172. package/dist/backend/services/primary-asset-url.d.ts +6 -1
  173. package/dist/backend/services/primary-asset-url.js +9 -4
  174. package/dist/backend/services/product-availability.service.d.ts +16 -3
  175. package/dist/backend/services/product-availability.service.js +58 -21
  176. package/dist/backend/services/product-content.service.d.ts +62 -0
  177. package/dist/backend/services/product-content.service.js +122 -0
  178. package/dist/backend/services/product-editor-preferences.service.d.ts +6 -0
  179. package/dist/backend/services/product-editor-preferences.service.js +12 -0
  180. package/dist/backend/services/product-global-field-rules.d.ts +39 -0
  181. package/dist/backend/services/product-global-field-rules.js +84 -0
  182. package/dist/backend/services/product-link.service.js +14 -16
  183. package/dist/backend/services/product-list-view-service.js +5 -8
  184. package/dist/backend/services/product-page-revalidation.d.ts +9 -0
  185. package/dist/backend/services/product-page-revalidation.js +19 -0
  186. package/dist/backend/services/product-scopes.service.d.ts +18 -8
  187. package/dist/backend/services/product-scopes.service.js +91 -36
  188. package/dist/backend/services/product-value-resolver.service.d.ts +2 -2
  189. package/dist/backend/services/product-value-resolver.service.js +4 -7
  190. package/dist/backend/services/publication-window-sweep.d.ts +61 -7
  191. package/dist/backend/services/publication-window-sweep.js +106 -19
  192. package/dist/backend/services/scheduled-work-probe.d.ts +34 -0
  193. package/dist/backend/services/scheduled-work-probe.js +30 -0
  194. package/dist/backend/services/scope-completeness.d.ts +11 -11
  195. package/dist/backend/services/scope-completeness.js +26 -33
  196. package/dist/backend/services/scope-overview.service.d.ts +24 -24
  197. package/dist/backend/services/scope-overview.service.js +33 -76
  198. package/dist/backend/services/scoped-store-adapters.d.ts +58 -0
  199. package/dist/backend/services/scoped-store-adapters.js +92 -0
  200. package/dist/backend/services/scoped-values-global-only.d.ts +36 -0
  201. package/dist/backend/services/scoped-values-global-only.js +92 -0
  202. package/dist/backend/services/scoped-values-import.d.ts +86 -0
  203. package/dist/backend/services/scoped-values-import.js +320 -0
  204. package/dist/backend/services/scoped-values-read.service.d.ts +56 -0
  205. package/dist/backend/services/scoped-values-read.service.js +289 -0
  206. package/dist/backend/services/scoped-values-save.service.d.ts +79 -0
  207. package/dist/backend/services/scoped-values-save.service.js +675 -0
  208. package/dist/backend/services/scoped-values-state.d.ts +94 -0
  209. package/dist/backend/services/scoped-values-state.js +159 -0
  210. package/dist/backend/services/scoped-values.service.d.ts +36 -0
  211. package/dist/backend/services/scoped-values.service.js +92 -0
  212. package/dist/backend/services/storefront-value-overrides.d.ts +7 -8
  213. package/dist/backend/services/storefront-value-overrides.js +11 -14
  214. package/dist/backend/services/table-maintenance-queue.d.ts +78 -0
  215. package/dist/backend/services/table-maintenance-queue.js +97 -0
  216. package/dist/backend/services/url-key-resolution.service.d.ts +12 -18
  217. package/dist/backend/services/url-key-resolution.service.js +43 -43
  218. package/dist/backend/services/url-key.service.d.ts +87 -135
  219. package/dist/backend/services/url-key.service.js +447 -619
  220. package/dist/manifest.d.ts +51 -1
  221. package/dist/manifest.js +111 -7
  222. package/dist/migrations/20261030T113855_catalog_scope_model_texts.d.ts +36 -0
  223. package/dist/migrations/20261030T113855_catalog_scope_model_texts.js +225 -0
  224. package/dist/migrations/20261030T113859_catalog_scope_model_order_rules.d.ts +18 -0
  225. package/dist/migrations/20261030T113859_catalog_scope_model_order_rules.js +39 -0
  226. package/dist/migrations/20261030T113904_catalog_scope_model_url_keys.d.ts +6 -0
  227. package/dist/migrations/20261030T113904_catalog_scope_model_url_keys.js +119 -0
  228. package/dist/migrations/20261030T113908_catalog_scope_model_media.d.ts +6 -0
  229. package/dist/migrations/20261030T113908_catalog_scope_model_media.js +185 -0
  230. package/dist/migrations/20261104T121504_catalog_product_content_values.d.ts +36 -0
  231. package/dist/migrations/20261104T121504_catalog_product_content_values.js +53 -0
  232. package/dist/migrations/20261107T093126_catalog_sku_unique_among_live.d.ts +33 -0
  233. package/dist/migrations/20261107T093126_catalog_sku_unique_among_live.js +58 -0
  234. package/dist/migrations/20261107T120008_catalog_product_created_at_milliseconds.d.ts +36 -0
  235. package/dist/migrations/20261107T120008_catalog_product_created_at_milliseconds.js +40 -0
  236. package/dist/migrations/20261114T000706_catalog_category_main_image.d.ts +37 -0
  237. package/dist/migrations/20261114T000706_catalog_category_main_image.js +56 -0
  238. package/dist/migrations/index.d.ts +9 -1
  239. package/dist/migrations/index.js +17 -1
  240. package/docs/catalog/attachments.md +53 -43
  241. package/docs/catalog/attribute-sets.md +3 -2
  242. package/docs/catalog/attributes.md +99 -25
  243. package/docs/catalog/category-content.md +9 -3
  244. package/docs/catalog/composite-products.md +5 -3
  245. package/docs/catalog/editing-a-product-at-a-scope.md +151 -0
  246. package/docs/catalog/gallery-and-labels.md +61 -60
  247. package/docs/catalog/packaging-units.md +43 -34
  248. package/docs/catalog/per-channel-per-language-overrides.md +83 -410
  249. package/docs/catalog/product-content.md +184 -0
  250. package/docs/catalog/product-links.md +2 -2
  251. package/docs/catalog/url-keys-and-redirects.md +79 -79
  252. package/docs/catalog.md +113 -31
  253. package/i18n/en.json +317 -274
  254. package/i18n/pl.json +319 -276
  255. package/package.json +13 -12
  256. package/dist/admin/components/AttachmentScopesDialog.d.ts +0 -22
  257. package/dist/admin/components/AttachmentScopesDialog.d.ts.map +0 -1
  258. package/dist/admin/components/AttachmentScopesDialog.js +0 -70
  259. package/dist/admin/components/AttachmentScopesDialog.js.map +0 -1
  260. package/dist/admin/components/PackagingUnitsEditor.d.ts.map +0 -1
  261. package/dist/admin/components/PackagingUnitsEditor.js.map +0 -1
  262. package/dist/admin/components/ProductAttachmentsSection.d.ts.map +0 -1
  263. package/dist/admin/components/ProductAttachmentsSection.js.map +0 -1
  264. package/dist/admin/components/ProductAttributesTab.d.ts.map +0 -1
  265. package/dist/admin/components/ProductAttributesTab.js.map +0 -1
  266. package/dist/admin/components/ProductGallerySection.d.ts.map +0 -1
  267. package/dist/admin/components/ProductGallerySection.js.map +0 -1
  268. package/dist/admin/components/ProductInventoryTab.d.ts.map +0 -1
  269. package/dist/admin/components/ProductInventoryTab.js.map +0 -1
  270. package/dist/admin/components/ProductOrderRulesCard.d.ts.map +0 -1
  271. package/dist/admin/components/ProductOrderRulesCard.js.map +0 -1
  272. package/dist/admin/components/ProductScopeControls.d.ts +0 -31
  273. package/dist/admin/components/ProductScopeControls.d.ts.map +0 -1
  274. package/dist/admin/components/ProductScopeControls.js +0 -243
  275. package/dist/admin/components/ProductScopeControls.js.map +0 -1
  276. package/dist/admin/components/ProductScopeEditor.d.ts +0 -88
  277. package/dist/admin/components/ProductScopeEditor.d.ts.map +0 -1
  278. package/dist/admin/components/ProductScopeEditor.js +0 -396
  279. package/dist/admin/components/ProductScopeEditor.js.map +0 -1
  280. package/dist/admin/components/ProductScopeOverview.d.ts.map +0 -1
  281. package/dist/admin/components/ProductScopeOverview.js.map +0 -1
  282. package/dist/admin/components/ProductStatusPills.d.ts.map +0 -1
  283. package/dist/admin/components/ProductStatusPills.js.map +0 -1
  284. package/dist/admin/components/ProductUrlKeysPanel.d.ts +0 -17
  285. package/dist/admin/components/ProductUrlKeysPanel.d.ts.map +0 -1
  286. package/dist/admin/components/ProductUrlKeysPanel.js +0 -215
  287. package/dist/admin/components/ProductUrlKeysPanel.js.map +0 -1
  288. package/dist/admin/components/ProductsBulkEditDialog.d.ts.map +0 -1
  289. package/dist/admin/components/ProductsBulkEditDialog.js.map +0 -1
  290. package/dist/admin/components/ScopedDialogParts.d.ts +0 -23
  291. package/dist/admin/components/ScopedDialogParts.d.ts.map +0 -1
  292. package/dist/admin/components/ScopedDialogParts.js +0 -16
  293. package/dist/admin/components/ScopedDialogParts.js.map +0 -1
  294. package/dist/admin/index.d.ts.map +0 -1
  295. package/dist/admin/index.js.map +0 -1
  296. package/dist/admin/lib/attribute-scope.d.ts.map +0 -1
  297. package/dist/admin/lib/attribute-scope.js.map +0 -1
  298. package/dist/admin/lib/bulk-operation-log-text.d.ts.map +0 -1
  299. package/dist/admin/lib/bulk-operation-log-text.js.map +0 -1
  300. package/dist/admin/lib/media-scopes.d.ts +0 -41
  301. package/dist/admin/lib/media-scopes.d.ts.map +0 -1
  302. package/dist/admin/lib/media-scopes.js +0 -66
  303. package/dist/admin/lib/media-scopes.js.map +0 -1
  304. package/dist/admin/lib/product-labels.d.ts.map +0 -1
  305. package/dist/admin/lib/product-labels.js.map +0 -1
  306. package/dist/admin/lib/product-scope-drafts.d.ts +0 -77
  307. package/dist/admin/lib/product-scope-drafts.d.ts.map +0 -1
  308. package/dist/admin/lib/product-scope-drafts.js +0 -133
  309. package/dist/admin/lib/product-scope-drafts.js.map +0 -1
  310. package/dist/admin/lib/product-scopes-api.d.ts.map +0 -1
  311. package/dist/admin/lib/product-scopes-api.js.map +0 -1
  312. package/dist/admin/lib/product-url-keys-api.d.ts.map +0 -1
  313. package/dist/admin/lib/product-url-keys-api.js.map +0 -1
  314. package/dist/admin/lib/resolve-product-selection.d.ts.map +0 -1
  315. package/dist/admin/lib/resolve-product-selection.js.map +0 -1
  316. package/dist/admin/lib/scope-overview.d.ts.map +0 -1
  317. package/dist/admin/lib/scope-overview.js.map +0 -1
  318. package/dist/admin/pages/AttachmentTypesPage.d.ts.map +0 -1
  319. package/dist/admin/pages/AttachmentTypesPage.js.map +0 -1
  320. package/dist/admin/pages/AttributeSetsPage.d.ts.map +0 -1
  321. package/dist/admin/pages/AttributeSetsPage.js.map +0 -1
  322. package/dist/admin/pages/AttributesManager.d.ts.map +0 -1
  323. package/dist/admin/pages/AttributesManager.js.map +0 -1
  324. package/dist/admin/pages/BulkOperationDetailPage.d.ts.map +0 -1
  325. package/dist/admin/pages/BulkOperationDetailPage.js.map +0 -1
  326. package/dist/admin/pages/BulkOperationsPage.d.ts.map +0 -1
  327. package/dist/admin/pages/BulkOperationsPage.js.map +0 -1
  328. package/dist/admin/pages/CategoriesTree.d.ts.map +0 -1
  329. package/dist/admin/pages/CategoriesTree.js.map +0 -1
  330. package/dist/admin/pages/CategoryContentPage.d.ts.map +0 -1
  331. package/dist/admin/pages/CategoryContentPage.js.map +0 -1
  332. package/dist/admin/pages/ProductEditor.d.ts.map +0 -1
  333. package/dist/admin/pages/ProductEditor.js.map +0 -1
  334. package/dist/admin/pages/ProductsList.d.ts.map +0 -1
  335. package/dist/admin/pages/ProductsList.js.map +0 -1
  336. package/dist/backend/admin-search-provider.d.ts.map +0 -1
  337. package/dist/backend/admin-search-provider.js.map +0 -1
  338. package/dist/backend/commands/attribute-commands.d.ts.map +0 -1
  339. package/dist/backend/commands/attribute-commands.js.map +0 -1
  340. package/dist/backend/demo/reset.d.ts.map +0 -1
  341. package/dist/backend/demo/reset.js.map +0 -1
  342. package/dist/backend/demo/rows.d.ts.map +0 -1
  343. package/dist/backend/demo/rows.js.map +0 -1
  344. package/dist/backend/demo/seed.d.ts.map +0 -1
  345. package/dist/backend/demo/seed.js.map +0 -1
  346. package/dist/backend/entities/attachment-type.entity.d.ts.map +0 -1
  347. package/dist/backend/entities/attachment-type.entity.js.map +0 -1
  348. package/dist/backend/entities/attribute-set-attribute.entity.d.ts.map +0 -1
  349. package/dist/backend/entities/attribute-set-attribute.entity.js.map +0 -1
  350. package/dist/backend/entities/attribute-set.entity.d.ts.map +0 -1
  351. package/dist/backend/entities/attribute-set.entity.js.map +0 -1
  352. package/dist/backend/entities/bulk-operation.entity.d.ts.map +0 -1
  353. package/dist/backend/entities/bulk-operation.entity.js.map +0 -1
  354. package/dist/backend/entities/bundle-slot-option.entity.d.ts.map +0 -1
  355. package/dist/backend/entities/bundle-slot-option.entity.js.map +0 -1
  356. package/dist/backend/entities/bundle-slot.entity.d.ts.map +0 -1
  357. package/dist/backend/entities/bundle-slot.entity.js.map +0 -1
  358. package/dist/backend/entities/category.entity.d.ts.map +0 -1
  359. package/dist/backend/entities/category.entity.js.map +0 -1
  360. package/dist/backend/entities/gallery-item-channel-hidden.entity.d.ts +0 -14
  361. package/dist/backend/entities/gallery-item-channel-hidden.entity.d.ts.map +0 -1
  362. package/dist/backend/entities/gallery-item-channel-hidden.entity.js +0 -42
  363. package/dist/backend/entities/gallery-item-channel-hidden.entity.js.map +0 -1
  364. package/dist/backend/entities/gallery-item-channel-label.entity.d.ts +0 -18
  365. package/dist/backend/entities/gallery-item-channel-label.entity.d.ts.map +0 -1
  366. package/dist/backend/entities/gallery-item-channel-label.entity.js +0 -49
  367. package/dist/backend/entities/gallery-item-channel-label.entity.js.map +0 -1
  368. package/dist/backend/entities/gallery-item-label.entity.d.ts.map +0 -1
  369. package/dist/backend/entities/gallery-item-label.entity.js.map +0 -1
  370. package/dist/backend/entities/gallery-item.entity.d.ts.map +0 -1
  371. package/dist/backend/entities/gallery-item.entity.js.map +0 -1
  372. package/dist/backend/entities/grouped-item.entity.d.ts.map +0 -1
  373. package/dist/backend/entities/grouped-item.entity.js.map +0 -1
  374. package/dist/backend/entities/product-attachment-channel-hidden.entity.d.ts +0 -13
  375. package/dist/backend/entities/product-attachment-channel-hidden.entity.d.ts.map +0 -1
  376. package/dist/backend/entities/product-attachment-channel-hidden.entity.js +0 -41
  377. package/dist/backend/entities/product-attachment-channel-hidden.entity.js.map +0 -1
  378. package/dist/backend/entities/product-attachment.entity.d.ts.map +0 -1
  379. package/dist/backend/entities/product-attachment.entity.js.map +0 -1
  380. package/dist/backend/entities/product-attribute.entity.d.ts.map +0 -1
  381. package/dist/backend/entities/product-attribute.entity.js.map +0 -1
  382. package/dist/backend/entities/product-channel-language-scope.entity.d.ts.map +0 -1
  383. package/dist/backend/entities/product-channel-language-scope.entity.js.map +0 -1
  384. package/dist/backend/entities/product-channel-scope.entity.d.ts.map +0 -1
  385. package/dist/backend/entities/product-channel-scope.entity.js.map +0 -1
  386. package/dist/backend/entities/product-editor-preference.entity.d.ts.map +0 -1
  387. package/dist/backend/entities/product-editor-preference.entity.js.map +0 -1
  388. package/dist/backend/entities/product-link.entity.d.ts.map +0 -1
  389. package/dist/backend/entities/product-link.entity.js.map +0 -1
  390. package/dist/backend/entities/product-list-saved-view.entity.d.ts.map +0 -1
  391. package/dist/backend/entities/product-list-saved-view.entity.js.map +0 -1
  392. package/dist/backend/entities/product-packaging-unit.entity.d.ts.map +0 -1
  393. package/dist/backend/entities/product-packaging-unit.entity.js.map +0 -1
  394. package/dist/backend/entities/product-url-key.entity.d.ts.map +0 -1
  395. package/dist/backend/entities/product-url-key.entity.js.map +0 -1
  396. package/dist/backend/entities/product-url-redirect.entity.d.ts.map +0 -1
  397. package/dist/backend/entities/product-url-redirect.entity.js.map +0 -1
  398. package/dist/backend/entities/product-value-override.entity.d.ts.map +0 -1
  399. package/dist/backend/entities/product-value-override.entity.js.map +0 -1
  400. package/dist/backend/entities/product-variant.entity.d.ts.map +0 -1
  401. package/dist/backend/entities/product-variant.entity.js.map +0 -1
  402. package/dist/backend/entities/product.entity.d.ts.map +0 -1
  403. package/dist/backend/entities/product.entity.js.map +0 -1
  404. package/dist/backend/index.d.ts.map +0 -1
  405. package/dist/backend/index.js.map +0 -1
  406. package/dist/backend/plugin.d.ts.map +0 -1
  407. package/dist/backend/plugin.js.map +0 -1
  408. package/dist/backend/prompt-tools.d.ts.map +0 -1
  409. package/dist/backend/prompt-tools.js.map +0 -1
  410. package/dist/backend/routes.admin.d.ts.map +0 -1
  411. package/dist/backend/routes.admin.js.map +0 -1
  412. package/dist/backend/routes.admin.url-keys.d.ts.map +0 -1
  413. package/dist/backend/routes.admin.url-keys.js.map +0 -1
  414. package/dist/backend/routes.api-key.d.ts.map +0 -1
  415. package/dist/backend/routes.api-key.js.map +0 -1
  416. package/dist/backend/routes.external.d.ts.map +0 -1
  417. package/dist/backend/routes.external.js.map +0 -1
  418. package/dist/backend/routes.public.d.ts.map +0 -1
  419. package/dist/backend/routes.public.js.map +0 -1
  420. package/dist/backend/routes.public.url-keys.d.ts.map +0 -1
  421. package/dist/backend/routes.public.url-keys.js.map +0 -1
  422. package/dist/backend/saved-view-actor.d.ts.map +0 -1
  423. package/dist/backend/saved-view-actor.js.map +0 -1
  424. package/dist/backend/services/asset-references.d.ts.map +0 -1
  425. package/dist/backend/services/asset-references.js.map +0 -1
  426. package/dist/backend/services/attachment-packaging-scopes.d.ts.map +0 -1
  427. package/dist/backend/services/attachment-packaging-scopes.js.map +0 -1
  428. package/dist/backend/services/attachment.service.d.ts.map +0 -1
  429. package/dist/backend/services/attachment.service.js.map +0 -1
  430. package/dist/backend/services/attribute-option-validator.d.ts.map +0 -1
  431. package/dist/backend/services/attribute-option-validator.js.map +0 -1
  432. package/dist/backend/services/attribute-scope-preview.d.ts.map +0 -1
  433. package/dist/backend/services/attribute-scope-preview.js.map +0 -1
  434. package/dist/backend/services/attribute-set-validations.d.ts.map +0 -1
  435. package/dist/backend/services/attribute-set-validations.js.map +0 -1
  436. package/dist/backend/services/attribute-set.service.d.ts.map +0 -1
  437. package/dist/backend/services/attribute-set.service.js.map +0 -1
  438. package/dist/backend/services/attribute-type-mapping.d.ts.map +0 -1
  439. package/dist/backend/services/attribute-type-mapping.js.map +0 -1
  440. package/dist/backend/services/attribute-value-key.service.d.ts.map +0 -1
  441. package/dist/backend/services/attribute-value-key.service.js.map +0 -1
  442. package/dist/backend/services/audit-references.d.ts.map +0 -1
  443. package/dist/backend/services/audit-references.js.map +0 -1
  444. package/dist/backend/services/bulk-operation-queue.d.ts.map +0 -1
  445. package/dist/backend/services/bulk-operation-queue.js.map +0 -1
  446. package/dist/backend/services/bulk-operation.service.d.ts.map +0 -1
  447. package/dist/backend/services/bulk-operation.service.js.map +0 -1
  448. package/dist/backend/services/bundle.service.d.ts.map +0 -1
  449. package/dist/backend/services/bundle.service.js.map +0 -1
  450. package/dist/backend/services/catalog-admin-search.service.d.ts.map +0 -1
  451. package/dist/backend/services/catalog-admin-search.service.js.map +0 -1
  452. package/dist/backend/services/catalog-admin.service.d.ts.map +0 -1
  453. package/dist/backend/services/catalog-admin.service.js.map +0 -1
  454. package/dist/backend/services/catalog-attribute-read.service.d.ts.map +0 -1
  455. package/dist/backend/services/catalog-attribute-read.service.js.map +0 -1
  456. package/dist/backend/services/catalog-bulk-import.service.d.ts.map +0 -1
  457. package/dist/backend/services/catalog-bulk-import.service.js.map +0 -1
  458. package/dist/backend/services/catalog-bulk-update.service.d.ts.map +0 -1
  459. package/dist/backend/services/catalog-bulk-update.service.js.map +0 -1
  460. package/dist/backend/services/catalog-category-read.service.d.ts.map +0 -1
  461. package/dist/backend/services/catalog-category-read.service.js.map +0 -1
  462. package/dist/backend/services/catalog-org-price-decorator.d.ts.map +0 -1
  463. package/dist/backend/services/catalog-org-price-decorator.js.map +0 -1
  464. package/dist/backend/services/catalog-product-filter.service.d.ts.map +0 -1
  465. package/dist/backend/services/catalog-product-filter.service.js.map +0 -1
  466. package/dist/backend/services/catalog-product-read.service.d.ts.map +0 -1
  467. package/dist/backend/services/catalog-product-read.service.js.map +0 -1
  468. package/dist/backend/services/catalog-query.service.d.ts.map +0 -1
  469. package/dist/backend/services/catalog-query.service.js.map +0 -1
  470. package/dist/backend/services/catalog-quick-search.service.d.ts.map +0 -1
  471. package/dist/backend/services/catalog-quick-search.service.js.map +0 -1
  472. package/dist/backend/services/catalog-write-ports.d.ts.map +0 -1
  473. package/dist/backend/services/catalog-write-ports.js.map +0 -1
  474. package/dist/backend/services/category-admin.service.d.ts.map +0 -1
  475. package/dist/backend/services/category-admin.service.js.map +0 -1
  476. package/dist/backend/services/channel-url-facts.d.ts.map +0 -1
  477. package/dist/backend/services/channel-url-facts.js.map +0 -1
  478. package/dist/backend/services/effective-value.sql.d.ts.map +0 -1
  479. package/dist/backend/services/effective-value.sql.js.map +0 -1
  480. package/dist/backend/services/gallery-scopes.d.ts.map +0 -1
  481. package/dist/backend/services/gallery-scopes.js.map +0 -1
  482. package/dist/backend/services/gallery.service.d.ts.map +0 -1
  483. package/dist/backend/services/gallery.service.js.map +0 -1
  484. package/dist/backend/services/grouped.service.d.ts.map +0 -1
  485. package/dist/backend/services/grouped.service.js.map +0 -1
  486. package/dist/backend/services/label-resolver.d.ts.map +0 -1
  487. package/dist/backend/services/label-resolver.js.map +0 -1
  488. package/dist/backend/services/linkable-asset.d.ts.map +0 -1
  489. package/dist/backend/services/linkable-asset.js.map +0 -1
  490. package/dist/backend/services/packaging-unit.service.d.ts.map +0 -1
  491. package/dist/backend/services/packaging-unit.service.js.map +0 -1
  492. package/dist/backend/services/primary-asset-url.d.ts.map +0 -1
  493. package/dist/backend/services/primary-asset-url.js.map +0 -1
  494. package/dist/backend/services/product-availability.service.d.ts.map +0 -1
  495. package/dist/backend/services/product-availability.service.js.map +0 -1
  496. package/dist/backend/services/product-availability.sql.d.ts.map +0 -1
  497. package/dist/backend/services/product-availability.sql.js.map +0 -1
  498. package/dist/backend/services/product-editor-preferences.service.d.ts.map +0 -1
  499. package/dist/backend/services/product-editor-preferences.service.js.map +0 -1
  500. package/dist/backend/services/product-link.service.d.ts.map +0 -1
  501. package/dist/backend/services/product-link.service.js.map +0 -1
  502. package/dist/backend/services/product-list-view-service.d.ts.map +0 -1
  503. package/dist/backend/services/product-list-view-service.js.map +0 -1
  504. package/dist/backend/services/product-overrides.service.d.ts +0 -84
  505. package/dist/backend/services/product-overrides.service.d.ts.map +0 -1
  506. package/dist/backend/services/product-overrides.service.js +0 -211
  507. package/dist/backend/services/product-overrides.service.js.map +0 -1
  508. package/dist/backend/services/product-page-revalidation.d.ts.map +0 -1
  509. package/dist/backend/services/product-page-revalidation.js.map +0 -1
  510. package/dist/backend/services/product-scope-context.service.d.ts +0 -36
  511. package/dist/backend/services/product-scope-context.service.d.ts.map +0 -1
  512. package/dist/backend/services/product-scope-context.service.js +0 -107
  513. package/dist/backend/services/product-scope-context.service.js.map +0 -1
  514. package/dist/backend/services/product-scopes.service.d.ts.map +0 -1
  515. package/dist/backend/services/product-scopes.service.js.map +0 -1
  516. package/dist/backend/services/product-summary-text.d.ts.map +0 -1
  517. package/dist/backend/services/product-summary-text.js.map +0 -1
  518. package/dist/backend/services/product-type-validations.d.ts.map +0 -1
  519. package/dist/backend/services/product-type-validations.js.map +0 -1
  520. package/dist/backend/services/product-value-resolver.service.d.ts.map +0 -1
  521. package/dist/backend/services/product-value-resolver.service.js.map +0 -1
  522. package/dist/backend/services/publication-window-sweep.d.ts.map +0 -1
  523. package/dist/backend/services/publication-window-sweep.js.map +0 -1
  524. package/dist/backend/services/scope-completeness.d.ts.map +0 -1
  525. package/dist/backend/services/scope-completeness.js.map +0 -1
  526. package/dist/backend/services/scope-overview.service.d.ts.map +0 -1
  527. package/dist/backend/services/scope-overview.service.js.map +0 -1
  528. package/dist/backend/services/sql-id-arrays.d.ts.map +0 -1
  529. package/dist/backend/services/sql-id-arrays.js.map +0 -1
  530. package/dist/backend/services/storefront-value-overrides.d.ts.map +0 -1
  531. package/dist/backend/services/storefront-value-overrides.js.map +0 -1
  532. package/dist/backend/services/system-attribute-scopes.d.ts.map +0 -1
  533. package/dist/backend/services/system-attribute-scopes.js.map +0 -1
  534. package/dist/backend/services/url-key-resolution.service.d.ts.map +0 -1
  535. package/dist/backend/services/url-key-resolution.service.js.map +0 -1
  536. package/dist/backend/services/url-key.service.d.ts.map +0 -1
  537. package/dist/backend/services/url-key.service.js.map +0 -1
  538. package/dist/backend/services/viewer-organization.d.ts.map +0 -1
  539. package/dist/backend/services/viewer-organization.js.map +0 -1
  540. package/dist/manifest.d.ts.map +0 -1
  541. package/dist/manifest.js.map +0 -1
  542. package/dist/migrations/20260429T064146_catalog_attribute_sets_init.d.ts.map +0 -1
  543. package/dist/migrations/20260429T064146_catalog_attribute_sets_init.js.map +0 -1
  544. package/dist/migrations/20260429T070004_catalog_product_attribute_extensions.d.ts.map +0 -1
  545. package/dist/migrations/20260429T070004_catalog_product_attribute_extensions.js.map +0 -1
  546. package/dist/migrations/20260429T102322_catalog_product_type_and_virtual_fields.d.ts.map +0 -1
  547. package/dist/migrations/20260429T102322_catalog_product_type_and_virtual_fields.js.map +0 -1
  548. package/dist/migrations/20260429T111839_catalog_gallery_items_and_labels.d.ts.map +0 -1
  549. package/dist/migrations/20260429T111839_catalog_gallery_items_and_labels.js.map +0 -1
  550. package/dist/migrations/20260429T112543_catalog_product_attachments.d.ts.map +0 -1
  551. package/dist/migrations/20260429T112543_catalog_product_attachments.js.map +0 -1
  552. package/dist/migrations/20260429T123726_catalog_product_links.d.ts.map +0 -1
  553. package/dist/migrations/20260429T123726_catalog_product_links.js.map +0 -1
  554. package/dist/migrations/20260429T130803_catalog_grouped_and_bundle.d.ts.map +0 -1
  555. package/dist/migrations/20260429T130803_catalog_grouped_and_bundle.js.map +0 -1
  556. package/dist/migrations/20260501T185835_catalog_product_attribute_is_comparable.d.ts.map +0 -1
  557. package/dist/migrations/20260501T185835_catalog_product_attribute_is_comparable.js.map +0 -1
  558. package/dist/migrations/20260505T060113_catalog_attribute_options_and_flags.d.ts.map +0 -1
  559. package/dist/migrations/20260505T060113_catalog_attribute_options_and_flags.js.map +0 -1
  560. package/dist/migrations/20260515T082629_catalog_attribute_mass_editable.d.ts.map +0 -1
  561. package/dist/migrations/20260515T082629_catalog_attribute_mass_editable.js.map +0 -1
  562. package/dist/migrations/20260526T124736_catalog_product_status_inactive.d.ts.map +0 -1
  563. package/dist/migrations/20260526T124736_catalog_product_status_inactive.js.map +0 -1
  564. package/dist/migrations/20260611T140346_catalog_product_value_overrides_init.d.ts.map +0 -1
  565. package/dist/migrations/20260611T140346_catalog_product_value_overrides_init.js.map +0 -1
  566. package/dist/migrations/20260611T140400_catalog_attribute_quick_searchable.d.ts.map +0 -1
  567. package/dist/migrations/20260611T140400_catalog_attribute_quick_searchable.js.map +0 -1
  568. package/dist/migrations/20260611T140407_catalog_bulk_operations.d.ts.map +0 -1
  569. package/dist/migrations/20260611T140407_catalog_bulk_operations.js.map +0 -1
  570. package/dist/migrations/20260611T140408_catalog_bulk_operation_logs.d.ts.map +0 -1
  571. package/dist/migrations/20260611T140408_catalog_bulk_operation_logs.js.map +0 -1
  572. package/dist/migrations/20260611T140412_catalog_product_packaging_units.d.ts.map +0 -1
  573. package/dist/migrations/20260611T140412_catalog_product_packaging_units.js.map +0 -1
  574. package/dist/migrations/20260718T060659_catalog_bulk_operation_revert_state.d.ts.map +0 -1
  575. package/dist/migrations/20260718T060659_catalog_bulk_operation_revert_state.js.map +0 -1
  576. package/dist/migrations/20260718T200343_catalog_category_custom_field_values.d.ts.map +0 -1
  577. package/dist/migrations/20260718T200343_catalog_category_custom_field_values.js.map +0 -1
  578. package/dist/migrations/20260723T230401_catalog_attributes_on_custom_fields.d.ts.map +0 -1
  579. package/dist/migrations/20260723T230401_catalog_attributes_on_custom_fields.js.map +0 -1
  580. package/dist/migrations/20260804T152604_catalog_widen_product_sku.d.ts.map +0 -1
  581. package/dist/migrations/20260804T152604_catalog_widen_product_sku.js.map +0 -1
  582. package/dist/migrations/20260804T160244_catalog_category_activation.d.ts.map +0 -1
  583. package/dist/migrations/20260804T160244_catalog_category_activation.js.map +0 -1
  584. package/dist/migrations/20260912T094557_catalog_sales_channel_products.d.ts.map +0 -1
  585. package/dist/migrations/20260912T094557_catalog_sales_channel_products.js.map +0 -1
  586. package/dist/migrations/20260912T094623_catalog_sales_channel_categories.d.ts.map +0 -1
  587. package/dist/migrations/20260912T094623_catalog_sales_channel_categories.js.map +0 -1
  588. package/dist/migrations/20260925T125527_catalog_inventory_columns.d.ts.map +0 -1
  589. package/dist/migrations/20260925T125527_catalog_inventory_columns.js.map +0 -1
  590. package/dist/migrations/20261008T080839_catalog_product_attribute_is_price_rule.d.ts.map +0 -1
  591. package/dist/migrations/20261008T080839_catalog_product_attribute_is_price_rule.js.map +0 -1
  592. package/dist/migrations/20261008T092714_catalog_category_content.d.ts.map +0 -1
  593. package/dist/migrations/20261008T092714_catalog_category_content.js.map +0 -1
  594. package/dist/migrations/20261014T170531_catalog_product_list_saved_views.d.ts.map +0 -1
  595. package/dist/migrations/20261014T170531_catalog_product_list_saved_views.js.map +0 -1
  596. package/dist/migrations/20261016T082008_catalog_order_rules.d.ts.map +0 -1
  597. package/dist/migrations/20261016T082008_catalog_order_rules.js.map +0 -1
  598. package/dist/migrations/20261022T035133_catalog_product_scopes.d.ts.map +0 -1
  599. package/dist/migrations/20261022T035133_catalog_product_scopes.js.map +0 -1
  600. package/dist/migrations/20261022T054223_catalog_product_url_keys.d.ts.map +0 -1
  601. package/dist/migrations/20261022T054223_catalog_product_url_keys.js.map +0 -1
  602. package/dist/migrations/20261022T111811_catalog_price_fields_removed.d.ts.map +0 -1
  603. package/dist/migrations/20261022T111811_catalog_price_fields_removed.js.map +0 -1
  604. package/dist/migrations/20261022T182523_catalog_admin_name_keys.d.ts.map +0 -1
  605. package/dist/migrations/20261022T182523_catalog_admin_name_keys.js.map +0 -1
  606. package/dist/migrations/20261025T222634_catalog_product_status_drop_draft.d.ts.map +0 -1
  607. package/dist/migrations/20261025T222634_catalog_product_status_drop_draft.js.map +0 -1
  608. package/dist/migrations/20261026T033453_catalog_product_media_scopes.d.ts.map +0 -1
  609. package/dist/migrations/20261026T033453_catalog_product_media_scopes.js.map +0 -1
  610. package/dist/migrations/20261026T084533_catalog_attachment_packaging_translations.d.ts.map +0 -1
  611. package/dist/migrations/20261026T084533_catalog_attachment_packaging_translations.js.map +0 -1
  612. package/dist/migrations/index.d.ts.map +0 -1
  613. package/dist/migrations/index.js.map +0 -1
  614. package/dist/ports/index.d.ts.map +0 -1
  615. package/dist/ports/index.js.map +0 -1
@@ -1,4 +1,5 @@
1
- import { patchProductScopesRequestSchema, } from '@endora-commerce/contracts';
1
+ import {} from '@endora-commerce/contracts';
2
+ import { assertIntegrationCall, runScopedImport } from './scoped-values-import.js';
2
3
  import { toCatalogCategoryRecord } from './catalog-category-read.service.js';
3
4
  import { toCatalogProductRecord, toCatalogProductVariantRecord, } from './catalog-product-read.service.js';
4
5
  /**
@@ -62,79 +63,19 @@ export function createCatalogPromoAttributePort(getService) {
62
63
  };
63
64
  }
64
65
  /**
65
- * Feature 163 (R17, `contracts/url-keys-and-redirects.md` §5) — the scoped write
66
- * of a connector or an importer.
67
- *
68
- * It writes only the scopes the input names, so a connector writing global values
69
- * removes no operator override (FR-091). Status, window, audience and order rules
70
- * go through `ProductScopesService` — the operator's Command, its validation
71
- * (FR-014: a value for a channel the product is not in is refused) and its event;
72
- * URL keys through `UrlKeyService` in import mode, where a key another product
73
- * holds is not written and is reported, and a redirect is never taken over
74
- * (FR-093). No completeness gate runs on this path (A-6).
66
+ * Feature 174 (T083; `contracts/pim-locale-mapping.md` §4, R13a, R21) — the scoped write of a
67
+ * connector, v2: the call-level checks (a registered `source`, the cell cap, no duplicate cell),
68
+ * then one Command `product.scoped_values.import` on the save's planner and writers
69
+ * (`scoped-values-import.ts`): per-cell refusals, the integration allowlist, every subject bound to
70
+ * the product, no completeness gate (A-6), URL keys in `integration` mode (FR-093).
75
71
  */
76
- export function createCatalogProductScopeWritePort(getScopes, getUrlKeys) {
72
+ export function createCatalogProductScopeWritePort(deps) {
77
73
  return {
78
74
  async applyScopes(productId, input, options) {
79
- const request = toScopesPatch(input);
80
- if (request.channels.length > 0 || request.global !== undefined) {
81
- // The write alone (checkpoint C code review, N2): an integration reads nothing
82
- // back, and passes no completeness mode — it is never gated (A-6).
83
- await getScopes().writeStatus(productId, request);
84
- }
85
- const urlKeys = input.urlKeys?.length ? await getUrlKeys().importKeys(productId, input.urlKeys, options.source) : [];
86
- return { urlKeys };
75
+ assertIntegrationCall(input.cells, options.source, deps.isRegisteredModule);
76
+ const { changedFields: _changed, ...result } = await runScopedImport(deps.commandBus(), deps.importDeps(), productId, input.cells, { source: options.source });
77
+ return result;
87
78
  },
88
79
  };
89
80
  }
90
- const isoOrNull = (value) => (value === null ? null : value.toISOString());
91
- /** The input as the scopes PATCH body: one entry per channel named, only the keys named. */
92
- export function toScopesPatch(input) {
93
- const channels = new Map();
94
- const entry = (channelId) => {
95
- let found = channels.get(channelId);
96
- if (!found) {
97
- found = { channelId };
98
- channels.set(channelId, found);
99
- }
100
- return found;
101
- };
102
- let global;
103
- for (const status of input.status ?? []) {
104
- const target = entry(status.channelId);
105
- if (status.languageCode === null) {
106
- target.status = status.value;
107
- }
108
- else {
109
- target.languageStatuses = [
110
- ...(target.languageStatuses ?? []),
111
- { languageCode: status.languageCode, status: status.value },
112
- ];
113
- }
114
- }
115
- for (const window of input.window ?? []) {
116
- if (window.channelId === null) {
117
- // The global window is a pair; "use inherited" has no meaning there, so `null` opens both ends.
118
- global = { publishFrom: isoOrNull(window.value?.from ?? null), publishUntil: isoOrNull(window.value?.until ?? null) };
119
- }
120
- else {
121
- entry(window.channelId).window =
122
- window.value === null ? null : { from: isoOrNull(window.value.from), until: isoOrNull(window.value.until) };
123
- }
124
- }
125
- for (const audience of input.audience ?? []) {
126
- entry(audience.channelId).audience = audience.value;
127
- }
128
- for (const rules of input.orderRules ?? []) {
129
- const target = entry(rules.channelId);
130
- if (rules.minOrderQuantity !== undefined)
131
- target.minOrderQuantity = rules.minOrderQuantity;
132
- if (rules.returnable !== undefined)
133
- target.returnable = rules.returnable;
134
- }
135
- return patchProductScopesRequestSchema.parse({
136
- channels: [...channels.values()],
137
- ...(global !== undefined ? { global } : {}),
138
- });
139
- }
140
81
  //# sourceMappingURL=catalog-write-ports.js.map
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { UniqueConstraintViolationException } from '@mikro-orm/core';
3
- import { ERROR_CODES, isCustomFieldValidationFailure, } from '@endora-commerce/contracts';
3
+ import { ERROR_CODES, isCustomFieldValidationFailure, isUuidShape, } from '@endora-commerce/contracts';
4
4
  import { HttpError } from '@endora-commerce/platform/http';
5
5
  import { Category } from '../entities/category.entity.js';
6
6
  import { requireLinkableAsset } from './linkable-asset.js';
@@ -136,6 +136,11 @@ export class CategoryAdminService {
136
136
  const cat = await this.#audited('category.create', id, async (em) => {
137
137
  if (input.parentCategoryId)
138
138
  await this.#assertParentExists(em, input.parentCategoryId);
139
+ // Feature 175 (FR-015, FR-016) — validated as a merge onto an empty bag,
140
+ // inside this Command: a refusal rolls the create back, a `required`
141
+ // definition is refused even when no value is sent, and the audit row
142
+ // below carries what was stored.
143
+ const customFieldValues = await this.#mergeCustomFields({}, input.customFieldValues ?? {});
139
144
  const created = em.create(Category, {
140
145
  id,
141
146
  ...(input.parentCategoryId !== undefined
@@ -146,13 +151,17 @@ export class CategoryAdminService {
146
151
  sortOrder: input.sortOrder ?? 0,
147
152
  // Feature 068 — omitted means active (the column default).
148
153
  ...(input.isActive !== undefined ? { isActive: input.isActive } : {}),
154
+ customFieldValues,
149
155
  });
150
156
  try {
151
157
  await em.flush();
152
158
  }
153
159
  catch (err) {
154
160
  if (err instanceof UniqueConstraintViolationException) {
155
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, `Slug "${input.slug}" already exists under this parent.`);
161
+ throw new HttpError(409, ERROR_CODES.CATEGORY_SLUG_TAKEN, `Slug "${input.slug}" already exists under this parent.`, {
162
+ slug: input.slug,
163
+ parentCategoryId: input.parentCategoryId ?? null,
164
+ });
156
165
  }
157
166
  throw err;
158
167
  }
@@ -165,6 +174,7 @@ export class CategoryAdminService {
165
174
  parentCategoryId: created.parentCategoryId ?? null,
166
175
  sortOrder: created.sortOrder,
167
176
  isActive: created.isActive,
177
+ customFieldValues: created.customFieldValues,
168
178
  },
169
179
  };
170
180
  });
@@ -177,6 +187,8 @@ export class CategoryAdminService {
177
187
  }
178
188
  async update(id, input) {
179
189
  return this.#audited('category.update', id, async (em) => {
190
+ if (!isUuidShape(id))
191
+ throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Category not found.');
180
192
  const cat = await em.findOne(Category, { id, deletedAt: null });
181
193
  if (!cat)
182
194
  throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Category not found.');
@@ -219,7 +231,10 @@ export class CategoryAdminService {
219
231
  }
220
232
  catch (err) {
221
233
  if (err instanceof UniqueConstraintViolationException) {
222
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, 'Another category already uses this slug under that parent.');
234
+ throw new HttpError(409, ERROR_CODES.CATEGORY_SLUG_TAKEN, 'Another category already uses this slug under that parent.', {
235
+ slug: cat.slug,
236
+ parentCategoryId: cat.parentCategoryId ?? null,
237
+ });
223
238
  }
224
239
  throw err;
225
240
  }
@@ -242,12 +257,14 @@ export class CategoryAdminService {
242
257
  }
243
258
  async softDelete(id) {
244
259
  await this.#audited('category.delete', id, async (em) => {
260
+ if (!isUuidShape(id))
261
+ throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Category not found.');
245
262
  const cat = await em.findOne(Category, { id, deletedAt: null });
246
263
  if (!cat)
247
264
  throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Category not found.');
248
265
  const childCount = await em.count(Category, { parentCategoryId: id, deletedAt: null });
249
266
  if (childCount > 0) {
250
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, `Cannot delete: ${childCount} child category(ies) still attached. Move or delete them first.`);
267
+ throw new HttpError(409, ERROR_CODES.CATEGORY_HAS_CHILDREN, `Cannot delete: ${childCount} child category(ies) still attached. Move or delete them first.`, { categoryId: id, childCount });
251
268
  }
252
269
  cat.deletedAt = new Date();
253
270
  return { result: cat, before: { name: cat.name, slug: cat.slug }, after: { deletedAt: cat.deletedAt } };
@@ -261,6 +278,8 @@ export class CategoryAdminService {
261
278
  * other read of this entity leaves the document in the database.
262
279
  */
263
280
  async getContent(id) {
281
+ if (!isUuidShape(id))
282
+ throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Category not found.');
264
283
  const cat = await this.emFactory().findOne(Category, { id, deletedAt: null }, { populate: ['content'] });
265
284
  if (!cat)
266
285
  throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Category not found.');
@@ -311,6 +330,8 @@ export class CategoryAdminService {
311
330
  // by the caller as one `low_stock_threshold.update` summary — see the doc
312
331
  // comment above and `ThresholdAdminService.patch`.
313
332
  const em = this.emFactory();
333
+ if (!isUuidShape(id))
334
+ throw new HttpError(404, ERROR_CODES.NOT_FOUND, `Category ${id} not found`);
314
335
  const cat = await em.findOne(Category, { id, deletedAt: null });
315
336
  if (!cat)
316
337
  throw new HttpError(404, ERROR_CODES.NOT_FOUND, `Category ${id} not found`);
@@ -333,7 +354,10 @@ export class CategoryAdminService {
333
354
  const seen = new Set();
334
355
  while (cursor) {
335
356
  if (cursor === movedId) {
336
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, 'Cannot move category beneath one of its descendants.');
357
+ throw new HttpError(409, ERROR_CODES.CATEGORY_MOVE_CYCLE, 'Cannot move category beneath one of its descendants.', {
358
+ categoryId: movedId,
359
+ parentCategoryId: newParentId,
360
+ });
337
361
  }
338
362
  if (seen.has(cursor))
339
363
  break; // defensive guard against pre-existing cycles
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Feature 172 (`specs/172-product-content-attributes/`, research R-6) — what a
3
+ * Page Builder content attribute may be.
4
+ *
5
+ * Its value is a document per language, stored apart from the product's
6
+ * ordinary attribute values, so every capability that hands an attribute's
7
+ * value to a consumer of short scalar values is held off. Holding them off is
8
+ * what keeps the attribute out of search, filters, comparison, promotions,
9
+ * price lists, bulk edit, per-channel overrides and "Parametry" by
10
+ * construction (research R-6, R-15).
11
+ *
12
+ * Feature 174 (`specs/174-product-editor-scope-switcher/`, FR-012) replaced the
13
+ * channel and language scope flags with one `scopable` flag, which means
14
+ * "has values at Channel and Channel × language". A content attribute's
15
+ * languages are its envelope's, not scoped values, so `scopable` is one more
16
+ * locked capability: it carries FR-040's per-channel refusal, and FR-004's
17
+ * "always language-scoped" is the envelope itself. Both attribute Commands call this with the
18
+ * **effective** flags — on update, the stored flags with the patch applied — so
19
+ * a PATCH that switches one flag on is judged against the stored type.
20
+ *
21
+ * A refusal, never a silent coercion: an integration must not believe it made
22
+ * a content attribute searchable (US1 #2).
23
+ */
24
+ /** The capabilities a content attribute holds off (FR-003). */
25
+ export declare const CONTENT_ATTRIBUTE_LOCKED_FLAGS: readonly ["isSearchable", "isFilterable", "isVariantAxis", "displayAsSlider", "isComparable", "quickSearchable", "isPromoRule", "isPriceRule", "massEditable", "isRequired", "isVisibleOnProductPage", "scopable"];
26
+ export type ContentAttributeLockedFlag = (typeof CONTENT_ATTRIBUTE_LOCKED_FLAGS)[number];
27
+ export type ContentAttributeFlags = Partial<Record<ContentAttributeLockedFlag, boolean | undefined>>;
28
+ /**
29
+ * Refuse every locked capability switched on (FR-003, FR-040).
30
+ *
31
+ * On create the request names the type itself, so the rule judges the request
32
+ * alone: `400 VALIDATION_FAILED`, one `details` entry per offending field. On
33
+ * update the caller passes the stored attribute — its stored type is what
34
+ * refuses the flag — and the refusal is `400 CONTENT_ATTRIBUTE_CAPABILITY_LOCKED`
35
+ * with the flags joined in `details.capabilities` (issue #1218, #86; the same
36
+ * split #624 made for the slider).
37
+ */
38
+ export declare function assertContentAttributeShape(flags: ContentAttributeFlags, stored?: {
39
+ readonly attributeKey: string;
40
+ }): void;
41
+ /**
42
+ * The value type of an attribute never moves to or from `page_builder`
43
+ * (FR-005): a document and a scalar value are not convertible into each other.
44
+ * Takes the legacy (DB) form of both sides.
45
+ *
46
+ * Issue #1218 (#86) — the stored type refuses a well-formed request, so the
47
+ * refusal is the value-type lock's code with the token `page_builder`, whose
48
+ * sentence names the attribute.
49
+ */
50
+ export declare function assertTypeChangeAllowed(from: string, to: string, attributeKey: string): void;
51
+ /**
52
+ * The ordinary attribute-values path never carries a content attribute's key
53
+ * (FR-014, FR-042 inbound, research R-7): its value is a document authored on
54
+ * the product content screen and stored apart from `attribute_values`. Refused
55
+ * whether the key is new or "already stored" — a resend must not smuggle one.
56
+ */
57
+ export declare function assertNoContentAttributeValues(attributeValues: Readonly<Record<string, unknown>> | undefined, views: ReadonlyArray<{
58
+ key: string;
59
+ valueType: string;
60
+ }>): void;
61
+ //# sourceMappingURL=content-attribute-rules.d.ts.map
@@ -0,0 +1,102 @@
1
+ import { ERROR_CODES } from '@endora-commerce/contracts';
2
+ import { HttpError } from '@endora-commerce/platform/http';
3
+ /**
4
+ * Feature 172 (`specs/172-product-content-attributes/`, research R-6) — what a
5
+ * Page Builder content attribute may be.
6
+ *
7
+ * Its value is a document per language, stored apart from the product's
8
+ * ordinary attribute values, so every capability that hands an attribute's
9
+ * value to a consumer of short scalar values is held off. Holding them off is
10
+ * what keeps the attribute out of search, filters, comparison, promotions,
11
+ * price lists, bulk edit, per-channel overrides and "Parametry" by
12
+ * construction (research R-6, R-15).
13
+ *
14
+ * Feature 174 (`specs/174-product-editor-scope-switcher/`, FR-012) replaced the
15
+ * channel and language scope flags with one `scopable` flag, which means
16
+ * "has values at Channel and Channel × language". A content attribute's
17
+ * languages are its envelope's, not scoped values, so `scopable` is one more
18
+ * locked capability: it carries FR-040's per-channel refusal, and FR-004's
19
+ * "always language-scoped" is the envelope itself. Both attribute Commands call this with the
20
+ * **effective** flags — on update, the stored flags with the patch applied — so
21
+ * a PATCH that switches one flag on is judged against the stored type.
22
+ *
23
+ * A refusal, never a silent coercion: an integration must not believe it made
24
+ * a content attribute searchable (US1 #2).
25
+ */
26
+ /** The capabilities a content attribute holds off (FR-003). */
27
+ export const CONTENT_ATTRIBUTE_LOCKED_FLAGS = [
28
+ 'isSearchable',
29
+ 'isFilterable',
30
+ 'isVariantAxis',
31
+ 'displayAsSlider',
32
+ 'isComparable',
33
+ 'quickSearchable',
34
+ 'isPromoRule',
35
+ 'isPriceRule',
36
+ 'massEditable',
37
+ 'isRequired',
38
+ 'isVisibleOnProductPage',
39
+ 'scopable',
40
+ ];
41
+ const ISSUE = 'not available for Page Builder content';
42
+ /**
43
+ * Refuse every locked capability switched on (FR-003, FR-040).
44
+ *
45
+ * On create the request names the type itself, so the rule judges the request
46
+ * alone: `400 VALIDATION_FAILED`, one `details` entry per offending field. On
47
+ * update the caller passes the stored attribute — its stored type is what
48
+ * refuses the flag — and the refusal is `400 CONTENT_ATTRIBUTE_CAPABILITY_LOCKED`
49
+ * with the flags joined in `details.capabilities` (issue #1218, #86; the same
50
+ * split #624 made for the slider).
51
+ */
52
+ export function assertContentAttributeShape(flags, stored) {
53
+ const refused = CONTENT_ATTRIBUTE_LOCKED_FLAGS.filter((flag) => flags[flag] === true);
54
+ if (refused.length === 0)
55
+ return;
56
+ const message = `Page Builder content attributes cannot have: ${refused.join(', ')}.`;
57
+ if (stored) {
58
+ throw new HttpError(400, ERROR_CODES.CONTENT_ATTRIBUTE_CAPABILITY_LOCKED, message, {
59
+ attributeKey: stored.attributeKey,
60
+ capabilities: refused.join(', '),
61
+ });
62
+ }
63
+ throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, message, refused.map((flag) => ({ path: flag, issue: ISSUE })));
64
+ }
65
+ /**
66
+ * The value type of an attribute never moves to or from `page_builder`
67
+ * (FR-005): a document and a scalar value are not convertible into each other.
68
+ * Takes the legacy (DB) form of both sides.
69
+ *
70
+ * Issue #1218 (#86) — the stored type refuses a well-formed request, so the
71
+ * refusal is the value-type lock's code with the token `page_builder`, whose
72
+ * sentence names the attribute.
73
+ */
74
+ export function assertTypeChangeAllowed(from, to, attributeKey) {
75
+ if (from === to)
76
+ return;
77
+ if (from === 'page_builder' || to === 'page_builder') {
78
+ throw new HttpError(409, ERROR_CODES.ATTRIBUTE_VALUE_TYPE_LOCKED, 'The value type of a Page Builder content attribute cannot be changed.', { code: 'page_builder', attributeKey });
79
+ }
80
+ }
81
+ /**
82
+ * The ordinary attribute-values path never carries a content attribute's key
83
+ * (FR-014, FR-042 inbound, research R-7): its value is a document authored on
84
+ * the product content screen and stored apart from `attribute_values`. Refused
85
+ * whether the key is new or "already stored" — a resend must not smuggle one.
86
+ */
87
+ export function assertNoContentAttributeValues(attributeValues, views) {
88
+ if (!attributeValues)
89
+ return;
90
+ const keys = Object.keys(attributeValues);
91
+ if (keys.length === 0)
92
+ return;
93
+ const contentKeys = new Set(views.filter((view) => view.valueType === 'page_builder').map((view) => view.key));
94
+ const refused = keys.filter((key) => contentKeys.has(key));
95
+ if (refused.length === 0)
96
+ return;
97
+ throw new HttpError(400, ERROR_CODES.ATTRIBUTE_VALUE_REJECTED, `Page Builder content cannot be set through attribute values: ${refused.join(', ')}.`, refused.map((key) => ({
98
+ path: `attributeValues.${key}`,
99
+ issue: 'Page Builder content is edited on the product content screen',
100
+ })));
101
+ }
102
+ //# sourceMappingURL=content-attribute-rules.js.map
@@ -1,36 +1,26 @@
1
- import type { AttributeScope } from '@endora-commerce/contracts';
1
+ import type { ScopeLevel } from '@endora-commerce/contracts';
2
2
  /**
3
- * Feature 163 (FR-017 b, `specs/163-product-data-scopes/research.md` R19) —
4
- * #384's storefront walk (`channelOverrideFor` / `effectiveSystemText` /
5
- * `effectiveAttributeValues` in `@endora-commerce/contracts`) restated as SQL,
6
- * so a listing can search, filter, count and sort by the value a card shows.
3
+ * Feature 163 (FR-017 b), rewritten by feature 174 (`specs/174-product-editor-scope-switcher/`,
4
+ * research R1, data-model §0) — the storefront's effective value restated as SQL, so a listing
5
+ * can search, filter, count and sort by the value a card shows.
7
6
  *
8
- * The walk, over the language chain `languages` (`overrideLanguages(L, channel
9
- * default)`): at each language, the (channel, language) override answers; else
10
- * the walk stops where the baseline answers. If nothing stopped it and the
11
- * baseline is a per-language object, its **first key** is a last leg. Whatever
12
- * stopped it, the channel-only override is asked last; else the baseline.
7
+ * The chain is `resolveScoped`'s: the (channel, language) override row, else the channel row
8
+ * (`language_code is null`), else the Global value on the product row. A **present** row answers
9
+ * whatever it holds; `{"v": null}` is an empty override and answers "nothing" — detected with
10
+ * `jsonb_typeof(value -> 'v') = 'null'`, never with `->>`, which folds `null` and `""` (R22).
13
11
  *
14
- * The override rows of one product, one attribute and one channel are read once
15
- * per row, as a JSON object keyed by language (`''` for the channel-only slot —
16
- * a language code is never empty), so the expression costs one keyed lookup per
17
- * product however long the chain is. PostgreSQL's `jsonb` keeps object keys in
18
- * one stored order, and both `jsonb_object_keys` here and the driver's parsed
19
- * object (`Object.keys`) read that order, so "first key" is one key on both sides.
12
+ * `effective-value.sql.test.ts` and `backend/test/integration/catalog/effective-text-parity.test.ts`
13
+ * hold the SQL equal to the TypeScript chain (T033, T035).
20
14
  *
21
- * `backend/test/integration/catalog/effective-text-parity.test.ts` holds the SQL
22
- * equal to the TypeScript walk over a grid.
23
- *
24
- * Descriptions, never `raw()` fragments — the caller creates the key in the
25
- * expression that executes it (`catalog-query.service.ts`' rule). Every bound
26
- * value is collected **as the SQL is written**, so the placeholders and the
27
- * values cannot come apart.
15
+ * Descriptions, never `raw()` fragments — the caller creates the key in the expression that
16
+ * executes it (`catalog-query.service.ts`' rule). Every bound value is collected **as the SQL is
17
+ * written**, so the placeholders and the values cannot come apart.
28
18
  */
29
- /** Where the walk runs: the request's channel and its language chain. */
19
+ /** Where the chain runs: the request's channel and its resolved content language. */
30
20
  export interface EffectiveValueScope {
31
21
  channelId: string;
32
- /** `overrideLanguages(L, channel default)` — ordered, de-duplicated. */
33
- languages: readonly string[];
22
+ /** Already resolved against the channel (`scopeLanguageOf`); `null` = the channel row only. */
23
+ languageCode: string | null;
34
24
  }
35
25
  /** An SQL expression over a row alias, with the values its `?` placeholders bind, in order. */
36
26
  export interface SqlExpression {
@@ -38,19 +28,15 @@ export interface SqlExpression {
38
28
  params: unknown[];
39
29
  }
40
30
  /**
41
- * The effective Name (or Description) a storefront card shows at (channel,
42
- * language chain) — `effectiveSystemText(overrides, key, { channelId,
43
- * languages }, baseline, pickLang(baseline, …))` as one `text` expression.
44
- *
45
- * `pickLanguages` is the chain the card's baseline pick walks (`pickLang`'s:
46
- * the request language, the channel default, `en-US`, `en`).
31
+ * The effective Name (or Description) at (channel, language) as one `text` expression. An empty
32
+ * override answers `''` (a deliberately empty description sorts and searches as no text); no row
33
+ * at C×L or C answers the Global text (`''` when the Global description is `null`).
47
34
  */
48
- export declare function effectiveTextSql(attributeKey: 'name' | 'description', scope: EffectiveValueScope, pickLanguages?: readonly string[]): SqlExpression;
35
+ export declare function effectiveTextSql(attributeKey: 'name' | 'description', scope: EffectiveValueScope): SqlExpression;
49
36
  /**
50
- * The effective value of a user attribute (`effectiveAttributeValues`) as a
51
- * `jsonb` expression: the override the walk lands on, else the baseline
52
- * `attribute_values -> key`. An attribute that is not channel-scoped has no
53
- * override slot and is its baseline.
37
+ * The effective value of a user attribute as a `jsonb` expression, restricted to the attribute's
38
+ * scope set: the C×L row's `v` (for a set holding `CL`), else the C row's (for `C`), else the
39
+ * Global `attribute_values -> key`. An empty override answers JSON `null`.
54
40
  */
55
- export declare function effectiveAttributeSql(attributeKey: string, attributeScope: AttributeScope, scope: EffectiveValueScope): SqlExpression;
41
+ export declare function effectiveAttributeSql(attributeKey: string, levels: readonly ScopeLevel[], scope: EffectiveValueScope): SqlExpression;
56
42
  //# sourceMappingURL=effective-value.sql.d.ts.map
@@ -6,106 +6,56 @@ class Writer {
6
6
  return '?';
7
7
  }
8
8
  }
9
- /**
10
- * `isNonEmpty` for a `jsonb` value: a missing or JSON `null` value is empty, as is `""`, `[]`, `{}`.
11
- *
12
- * The two scalar kinds that are always non-empty are named rather than left to
13
- * an `else`: a missing key is SQL `NULL`, `jsonb_typeof(NULL)` is `NULL`, and a
14
- * simple `case` over a `NULL` matches no `when` — an `else true` would read every
15
- * absent override slot as present and stop the walk at its first leg.
16
- */
17
- function nonEmpty(x) {
18
- return (`coalesce(case jsonb_typeof(${x()}) ` +
19
- `when 'string' then (${x()} #>> '{}') <> '' ` +
20
- `when 'array' then jsonb_array_length(${x()}) > 0 ` +
21
- `when 'object' then ${x()} <> '{}'::jsonb ` +
22
- `when 'number' then true ` +
23
- `when 'boolean' then true ` +
24
- `else false end, false)`);
25
- }
26
- /** The baseline's first key, or `null` when it is not an object. */
27
- function firstKey(base) {
28
- return `(case when jsonb_typeof(${base()}) = 'object' then (select k from jsonb_object_keys(${base()}) k limit 1) end)`;
29
- }
30
- /**
31
- * The walk as SQL. `base()` renders the baseline (it may bind values, so it is
32
- * rendered at each use); `pick(v)` turns the override that answered into the
33
- * result; `rest()` is "no override applies".
34
- */
35
- function walk(w, base, scope, languageScoped, pick, rest) {
36
- const slot = (language) => () => `(ov.m -> ${language()})`;
37
- const channelOnly = () => `(ov.m -> '')`;
38
- const channelOrRest = () => `(case when ${nonEmpty(channelOnly)} then ${pick(channelOnly)} else ${rest()} end)`;
39
- const parts = [];
40
- for (const language of scope.languages) {
41
- const bound = () => `${w.bind(language)}::text`;
42
- if (languageScoped) {
43
- parts.push(`when ${nonEmpty(slot(bound))} then ${pick(slot(bound))}`);
44
- }
45
- const answers = `(case when jsonb_typeof(${base()}) = 'object' ` +
46
- `then ${nonEmpty(() => `(${base()} -> ${bound()})`)} else ${nonEmpty(base)} end)`;
47
- parts.push(`when ${answers} then ${channelOrRest()}`);
48
- }
49
- if (languageScoped) {
50
- const first = slot(() => firstKey(base));
51
- parts.push(`when (case when jsonb_typeof(${base()}) = 'object' then ${nonEmpty(first)} else false end) then ${pick(first)}`);
52
- }
53
- return `(case ${parts.join(' ')} else ${channelOrRest()} end)`;
54
- }
55
- /**
56
- * The override rows of one product, attribute and channel, keyed by language
57
- * (`''` = the channel-only slot). Written **after** the select list that reads
58
- * `ov.m`, so it binds after it.
59
- */
60
- function overridesOf(w, alias, attributeKey, channelId) {
61
- return (`(select coalesce(jsonb_object_agg(coalesce(o.language_code, ''), o.value -> 'v'), '{}'::jsonb) as m ` +
62
- `from product_value_overrides o ` +
63
- `where o.product_id = ${alias}.id and o.attribute_key = ${w.bind(attributeKey)} and o.channel_id = ${w.bind(channelId)})`);
64
- }
65
- /**
66
- * The storefront's baseline pick of a per-language text (`pickLang`): the first
67
- * leg holding a non-empty string, else the first key's value, else `''`.
68
- */
69
- function baselinePick(w, base, languages) {
70
- const legs = languages.map((language) => `nullif(${base} ->> ${w.bind(language)}::text, '')`);
71
- const first = `(case when jsonb_typeof(${base}) = 'object' then (select e.value from jsonb_each_text(${base}) e limit 1) end)`;
72
- return `coalesce(${[...legs, first].join(', ')}, '')`;
73
- }
74
9
  function render(build) {
75
10
  const probe = new Writer();
76
11
  build(probe, 'a');
77
12
  return { sql: (alias) => build(new Writer(), alias), params: probe.params };
78
13
  }
14
+ /** The `value` of one override row at a scope, or SQL `NULL` when there is no row. */
15
+ function overrideValue(w, alias, attributeKey, channelId, languageCode) {
16
+ // Bound in the order the placeholders are written: attribute, channel, then the language.
17
+ const head = `(select o.value from product_value_overrides o ` +
18
+ `where o.product_id = ${alias}.id and o.attribute_key = ${w.bind(attributeKey)} ` +
19
+ `and o.channel_id = ${w.bind(channelId)} and `;
20
+ const language = languageCode === null ? `o.language_code is null` : `lower(o.language_code) = lower(${w.bind(languageCode)}::text)`;
21
+ return `${head}${language} limit 1)`;
22
+ }
79
23
  /**
80
- * The effective Name (or Description) a storefront card shows at (channel,
81
- * language chain) — `effectiveSystemText(overrides, key, { channelId,
82
- * languages }, baseline, pickLang(baseline, …))` as one `text` expression.
83
- *
84
- * `pickLanguages` is the chain the card's baseline pick walks (`pickLang`'s:
85
- * the request language, the channel default, `en-US`, `en`).
24
+ * The effective Name (or Description) at (channel, language) as one `text` expression. An empty
25
+ * override answers `''` (a deliberately empty description sorts and searches as no text); no row
26
+ * at C×L or C answers the Global text (`''` when the Global description is `null`).
86
27
  */
87
- export function effectiveTextSql(attributeKey, scope, pickLanguages = scope.languages) {
28
+ export function effectiveTextSql(attributeKey, scope) {
88
29
  return render((w, alias) => {
89
- const base = `${alias}.${attributeKey}`;
90
- const text = (v) => `(case when jsonb_typeof(${v()}) = 'string' and (${v()} #>> '{}') <> '' then ${v()} #>> '{}' ` +
91
- `else ${baselinePick(w, base, pickLanguages)} end)`;
92
- const body = walk(w, () => base, scope, true, text, () => baselinePick(w, base, pickLanguages));
93
- return `(select ${body} from ${overridesOf(w, alias, attributeKey, scope.channelId)} ov)`;
30
+ const text = (value) => `(case when jsonb_typeof(${value} -> 'v') = 'string' then ${value} ->> 'v' else '' end)`;
31
+ const legs = [];
32
+ if (scope.languageCode !== null) {
33
+ legs.push(`when x.cl is not null then ${text('x.cl')}`);
34
+ }
35
+ legs.push(`when x.c is not null then ${text('x.c')}`);
36
+ const cl = scope.languageCode === null ? 'null::jsonb' : overrideValue(w, alias, attributeKey, scope.channelId, scope.languageCode);
37
+ const c = overrideValue(w, alias, attributeKey, scope.channelId, null);
38
+ return `(select case ${legs.join(' ')} else coalesce(${alias}.${attributeKey}, '') end from (select ${cl} as cl, ${c} as c) x)`;
94
39
  });
95
40
  }
96
41
  /**
97
- * The effective value of a user attribute (`effectiveAttributeValues`) as a
98
- * `jsonb` expression: the override the walk lands on, else the baseline
99
- * `attribute_values -> key`. An attribute that is not channel-scoped has no
100
- * override slot and is its baseline.
42
+ * The effective value of a user attribute as a `jsonb` expression, restricted to the attribute's
43
+ * scope set: the C×L row's `v` (for a set holding `CL`), else the C row's (for `C`), else the
44
+ * Global `attribute_values -> key`. An empty override answers JSON `null`.
101
45
  */
102
- export function effectiveAttributeSql(attributeKey, attributeScope, scope) {
46
+ export function effectiveAttributeSql(attributeKey, levels, scope) {
103
47
  return render((w, alias) => {
104
- const base = () => `(${alias}.attribute_values -> ${w.bind(attributeKey)}::text)`;
105
- if (!attributeScope.channelScoped)
106
- return base();
107
- const body = walk(w, base, scope, attributeScope.languageScoped, (v) => v(), base);
108
- return `(select ${body} from ${overridesOf(w, alias, attributeKey, scope.channelId)} ov)`;
48
+ const base = `(${alias}.attribute_values -> ${w.bind(attributeKey)}::text)`;
49
+ if (!levels.includes('C'))
50
+ return base;
51
+ const useCl = levels.includes('CL') && scope.languageCode !== null;
52
+ const legs = [];
53
+ if (useCl)
54
+ legs.push(`when x.cl is not null then x.cl -> 'v'`);
55
+ legs.push(`when x.c is not null then x.c -> 'v'`);
56
+ const cl = useCl ? overrideValue(w, alias, attributeKey, scope.channelId, scope.languageCode) : 'null::jsonb';
57
+ const c = overrideValue(w, alias, attributeKey, scope.channelId, null);
58
+ return `(select case ${legs.join(' ')} else ${base} end from (select ${cl} as cl, ${c} as c) x)`;
109
59
  });
110
60
  }
111
61
  //# sourceMappingURL=effective-value.sql.js.map