@endora-commerce/mod-catalog 0.110.0 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (465) hide show
  1. package/dist/admin/components/PackagingUnitsEditor.js +2 -1
  2. package/dist/admin/components/ProductAttachmentsSection.js +1 -1
  3. package/dist/admin/components/ProductAttributesTab.js +1 -1
  4. package/dist/admin/components/ProductEditorSaveAction.d.ts +22 -0
  5. package/dist/admin/components/ProductEditorSaveAction.js +23 -0
  6. package/dist/admin/components/ProductGallerySection.js +1 -1
  7. package/dist/admin/components/ProductInventoryTab.d.ts +12 -1
  8. package/dist/admin/components/ProductInventoryTab.js +52 -115
  9. package/dist/admin/components/ProductScopeBar.d.ts +6 -0
  10. package/dist/admin/components/ProductScopeBar.js +2 -2
  11. package/dist/admin/components/ProductScopeOverview.js +10 -6
  12. package/dist/admin/components/ProductUrlRedirects.js +1 -1
  13. package/dist/admin/components/ProductsBulkEditDialog.js +4 -3
  14. package/dist/admin/components/editor/DetailsTab.js +3 -2
  15. package/dist/admin/components/editor/{ImmediateBadge.d.ts → SectionHeading.d.ts} +6 -5
  16. package/dist/admin/components/editor/{ImmediateBadge.js → SectionHeading.js} +8 -10
  17. package/dist/admin/components/editor/editor-context.d.ts +3 -1
  18. package/dist/admin/lib/bulk-result-outcome.d.ts +14 -0
  19. package/dist/admin/lib/bulk-result-outcome.js +13 -0
  20. package/dist/admin/lib/product-scopes-api.js +3 -3
  21. package/dist/admin/lib/product-url-keys-api.js +1 -1
  22. package/dist/admin/pages/AttachmentTypesPage.js +14 -4
  23. package/dist/admin/pages/AttributeSetsPage.js +11 -4
  24. package/dist/admin/pages/AttributesManager.js +11 -2
  25. package/dist/admin/pages/BulkOperationDetailPage.js +11 -4
  26. package/dist/admin/pages/CategoriesTree.d.ts +5 -0
  27. package/dist/admin/pages/CategoriesTree.js +226 -40
  28. package/dist/admin/pages/ProductEditor.js +172 -75
  29. package/dist/admin/pages/ProductsList.js +25 -20
  30. package/dist/backend/commands/attribute-commands.js +59 -13
  31. package/dist/backend/index.d.ts +3 -0
  32. package/dist/backend/index.js +20 -1
  33. package/dist/backend/routes.admin.js +12 -4
  34. package/dist/backend/routes.external.js +3 -2
  35. package/dist/backend/routes.public.js +9 -4
  36. package/dist/backend/services/bulk-operation.service.d.ts +1 -1
  37. package/dist/backend/services/bulk-operation.service.js +4 -0
  38. package/dist/backend/services/catalog-admin.service.js +19 -9
  39. package/dist/backend/services/catalog-attribute-read.service.js +2 -0
  40. package/dist/backend/services/catalog-bulk-import.service.d.ts +6 -0
  41. package/dist/backend/services/catalog-bulk-import.service.js +2 -0
  42. package/dist/backend/services/catalog-query.service.d.ts +10 -1
  43. package/dist/backend/services/catalog-query.service.js +26 -0
  44. package/dist/backend/services/category-admin.service.js +20 -4
  45. package/dist/backend/services/content-attribute-rules.d.ts +16 -4
  46. package/dist/backend/services/content-attribute-rules.js +25 -12
  47. package/dist/backend/services/grouped.service.js +7 -2
  48. package/dist/backend/services/product-scopes.service.d.ts +3 -2
  49. package/dist/backend/services/product-scopes.service.js +4 -3
  50. package/dist/backend/services/table-maintenance-queue.d.ts +78 -0
  51. package/dist/backend/services/table-maintenance-queue.js +97 -0
  52. package/dist/manifest.d.ts +45 -1
  53. package/dist/manifest.js +77 -7
  54. package/dist/migrations/20261114T000706_catalog_category_main_image.d.ts +37 -0
  55. package/dist/migrations/20261114T000706_catalog_category_main_image.js +56 -0
  56. package/dist/migrations/index.d.ts +2 -1
  57. package/dist/migrations/index.js +3 -1
  58. package/docs/catalog/attribute-sets.md +1 -0
  59. package/docs/catalog/attributes.md +34 -20
  60. package/docs/catalog/category-content.md +6 -3
  61. package/docs/catalog/composite-products.md +3 -1
  62. package/docs/catalog/editing-a-product-at-a-scope.md +60 -4
  63. package/docs/catalog/product-content.md +10 -6
  64. package/docs/catalog.md +45 -17
  65. package/i18n/en.json +48 -5
  66. package/i18n/pl.json +49 -6
  67. package/package.json +11 -10
  68. package/dist/admin/components/CopyToChannelsDialog.d.ts.map +0 -1
  69. package/dist/admin/components/CopyToChannelsDialog.js.map +0 -1
  70. package/dist/admin/components/PackagingUnitsEditor.d.ts.map +0 -1
  71. package/dist/admin/components/PackagingUnitsEditor.js.map +0 -1
  72. package/dist/admin/components/ProductAttachmentsSection.d.ts.map +0 -1
  73. package/dist/admin/components/ProductAttachmentsSection.js.map +0 -1
  74. package/dist/admin/components/ProductAttributesTab.d.ts.map +0 -1
  75. package/dist/admin/components/ProductAttributesTab.js.map +0 -1
  76. package/dist/admin/components/ProductContentCard.d.ts.map +0 -1
  77. package/dist/admin/components/ProductContentCard.js.map +0 -1
  78. package/dist/admin/components/ProductGallerySection.d.ts.map +0 -1
  79. package/dist/admin/components/ProductGallerySection.js.map +0 -1
  80. package/dist/admin/components/ProductInventoryTab.d.ts.map +0 -1
  81. package/dist/admin/components/ProductInventoryTab.js.map +0 -1
  82. package/dist/admin/components/ProductOrderRulesCard.d.ts.map +0 -1
  83. package/dist/admin/components/ProductOrderRulesCard.js.map +0 -1
  84. package/dist/admin/components/ProductScopeBar.d.ts.map +0 -1
  85. package/dist/admin/components/ProductScopeBar.js.map +0 -1
  86. package/dist/admin/components/ProductScopeOverview.d.ts.map +0 -1
  87. package/dist/admin/components/ProductScopeOverview.js.map +0 -1
  88. package/dist/admin/components/ProductStatusPills.d.ts.map +0 -1
  89. package/dist/admin/components/ProductStatusPills.js.map +0 -1
  90. package/dist/admin/components/ProductUrlRedirects.d.ts.map +0 -1
  91. package/dist/admin/components/ProductUrlRedirects.js.map +0 -1
  92. package/dist/admin/components/ProductsBulkEditDialog.d.ts.map +0 -1
  93. package/dist/admin/components/ProductsBulkEditDialog.js.map +0 -1
  94. package/dist/admin/components/editor/DetailsTab.d.ts.map +0 -1
  95. package/dist/admin/components/editor/DetailsTab.js.map +0 -1
  96. package/dist/admin/components/editor/ImmediateBadge.d.ts.map +0 -1
  97. package/dist/admin/components/editor/ImmediateBadge.js.map +0 -1
  98. package/dist/admin/components/editor/confirm-removal.d.ts.map +0 -1
  99. package/dist/admin/components/editor/confirm-removal.js.map +0 -1
  100. package/dist/admin/components/editor/editor-context.d.ts.map +0 -1
  101. package/dist/admin/components/editor/editor-context.js.map +0 -1
  102. package/dist/admin/components/editor/scoped-controls.d.ts.map +0 -1
  103. package/dist/admin/components/editor/scoped-controls.js.map +0 -1
  104. package/dist/admin/index.d.ts.map +0 -1
  105. package/dist/admin/index.js.map +0 -1
  106. package/dist/admin/lib/attribute-scope.d.ts.map +0 -1
  107. package/dist/admin/lib/attribute-scope.js.map +0 -1
  108. package/dist/admin/lib/bulk-operation-log-text.d.ts.map +0 -1
  109. package/dist/admin/lib/bulk-operation-log-text.js.map +0 -1
  110. package/dist/admin/lib/editor-scope.d.ts.map +0 -1
  111. package/dist/admin/lib/editor-scope.js.map +0 -1
  112. package/dist/admin/lib/order-minimum-input.d.ts.map +0 -1
  113. package/dist/admin/lib/order-minimum-input.js.map +0 -1
  114. package/dist/admin/lib/product-labels.d.ts.map +0 -1
  115. package/dist/admin/lib/product-labels.js.map +0 -1
  116. package/dist/admin/lib/product-scopes-api.d.ts.map +0 -1
  117. package/dist/admin/lib/product-scopes-api.js.map +0 -1
  118. package/dist/admin/lib/product-url-keys-api.d.ts.map +0 -1
  119. package/dist/admin/lib/product-url-keys-api.js.map +0 -1
  120. package/dist/admin/lib/resolve-product-selection.d.ts.map +0 -1
  121. package/dist/admin/lib/resolve-product-selection.js.map +0 -1
  122. package/dist/admin/lib/scope-overview.d.ts.map +0 -1
  123. package/dist/admin/lib/scope-overview.js.map +0 -1
  124. package/dist/admin/lib/scoped-editor-store.d.ts.map +0 -1
  125. package/dist/admin/lib/scoped-editor-store.js.map +0 -1
  126. package/dist/admin/lib/scoped-values-api.d.ts.map +0 -1
  127. package/dist/admin/lib/scoped-values-api.js.map +0 -1
  128. package/dist/admin/pages/AttachmentTypesPage.d.ts.map +0 -1
  129. package/dist/admin/pages/AttachmentTypesPage.js.map +0 -1
  130. package/dist/admin/pages/AttributeSetsPage.d.ts.map +0 -1
  131. package/dist/admin/pages/AttributeSetsPage.js.map +0 -1
  132. package/dist/admin/pages/AttributesManager.d.ts.map +0 -1
  133. package/dist/admin/pages/AttributesManager.js.map +0 -1
  134. package/dist/admin/pages/BulkOperationDetailPage.d.ts.map +0 -1
  135. package/dist/admin/pages/BulkOperationDetailPage.js.map +0 -1
  136. package/dist/admin/pages/BulkOperationsPage.d.ts.map +0 -1
  137. package/dist/admin/pages/BulkOperationsPage.js.map +0 -1
  138. package/dist/admin/pages/CategoriesTree.d.ts.map +0 -1
  139. package/dist/admin/pages/CategoriesTree.js.map +0 -1
  140. package/dist/admin/pages/CategoryContentPage.d.ts.map +0 -1
  141. package/dist/admin/pages/CategoryContentPage.js.map +0 -1
  142. package/dist/admin/pages/ProductContentPage.d.ts.map +0 -1
  143. package/dist/admin/pages/ProductContentPage.js.map +0 -1
  144. package/dist/admin/pages/ProductCreateForm.d.ts.map +0 -1
  145. package/dist/admin/pages/ProductCreateForm.js.map +0 -1
  146. package/dist/admin/pages/ProductEditor.d.ts.map +0 -1
  147. package/dist/admin/pages/ProductEditor.js.map +0 -1
  148. package/dist/admin/pages/ProductsList.d.ts.map +0 -1
  149. package/dist/admin/pages/ProductsList.js.map +0 -1
  150. package/dist/backend/admin-search-provider.d.ts.map +0 -1
  151. package/dist/backend/admin-search-provider.js.map +0 -1
  152. package/dist/backend/commands/attribute-commands.d.ts.map +0 -1
  153. package/dist/backend/commands/attribute-commands.js.map +0 -1
  154. package/dist/backend/commands/product-content-commands.d.ts.map +0 -1
  155. package/dist/backend/commands/product-content-commands.js.map +0 -1
  156. package/dist/backend/commands/scoped-values.commands.d.ts.map +0 -1
  157. package/dist/backend/commands/scoped-values.commands.js.map +0 -1
  158. package/dist/backend/demo/reset.d.ts.map +0 -1
  159. package/dist/backend/demo/reset.js.map +0 -1
  160. package/dist/backend/demo/rows.d.ts.map +0 -1
  161. package/dist/backend/demo/rows.js.map +0 -1
  162. package/dist/backend/demo/seed.d.ts.map +0 -1
  163. package/dist/backend/demo/seed.js.map +0 -1
  164. package/dist/backend/entities/attachment-type.entity.d.ts.map +0 -1
  165. package/dist/backend/entities/attachment-type.entity.js.map +0 -1
  166. package/dist/backend/entities/attribute-set-attribute.entity.d.ts.map +0 -1
  167. package/dist/backend/entities/attribute-set-attribute.entity.js.map +0 -1
  168. package/dist/backend/entities/attribute-set.entity.d.ts.map +0 -1
  169. package/dist/backend/entities/attribute-set.entity.js.map +0 -1
  170. package/dist/backend/entities/bulk-operation.entity.d.ts.map +0 -1
  171. package/dist/backend/entities/bulk-operation.entity.js.map +0 -1
  172. package/dist/backend/entities/bundle-slot-option.entity.d.ts.map +0 -1
  173. package/dist/backend/entities/bundle-slot-option.entity.js.map +0 -1
  174. package/dist/backend/entities/bundle-slot.entity.d.ts.map +0 -1
  175. package/dist/backend/entities/bundle-slot.entity.js.map +0 -1
  176. package/dist/backend/entities/category.entity.d.ts.map +0 -1
  177. package/dist/backend/entities/category.entity.js.map +0 -1
  178. package/dist/backend/entities/gallery-item-label.entity.d.ts.map +0 -1
  179. package/dist/backend/entities/gallery-item-label.entity.js.map +0 -1
  180. package/dist/backend/entities/gallery-item-scope-override.entity.d.ts.map +0 -1
  181. package/dist/backend/entities/gallery-item-scope-override.entity.js.map +0 -1
  182. package/dist/backend/entities/gallery-item.entity.d.ts.map +0 -1
  183. package/dist/backend/entities/gallery-item.entity.js.map +0 -1
  184. package/dist/backend/entities/gallery-role-scope-override.entity.d.ts.map +0 -1
  185. package/dist/backend/entities/gallery-role-scope-override.entity.js.map +0 -1
  186. package/dist/backend/entities/grouped-item.entity.d.ts.map +0 -1
  187. package/dist/backend/entities/grouped-item.entity.js.map +0 -1
  188. package/dist/backend/entities/product-attachment-scope-override.entity.d.ts.map +0 -1
  189. package/dist/backend/entities/product-attachment-scope-override.entity.js.map +0 -1
  190. package/dist/backend/entities/product-attachment.entity.d.ts.map +0 -1
  191. package/dist/backend/entities/product-attachment.entity.js.map +0 -1
  192. package/dist/backend/entities/product-attribute.entity.d.ts.map +0 -1
  193. package/dist/backend/entities/product-attribute.entity.js.map +0 -1
  194. package/dist/backend/entities/product-channel-language-scope.entity.d.ts.map +0 -1
  195. package/dist/backend/entities/product-channel-language-scope.entity.js.map +0 -1
  196. package/dist/backend/entities/product-channel-scope.entity.d.ts.map +0 -1
  197. package/dist/backend/entities/product-channel-scope.entity.js.map +0 -1
  198. package/dist/backend/entities/product-content-value.entity.d.ts.map +0 -1
  199. package/dist/backend/entities/product-content-value.entity.js.map +0 -1
  200. package/dist/backend/entities/product-editor-preference.entity.d.ts.map +0 -1
  201. package/dist/backend/entities/product-editor-preference.entity.js.map +0 -1
  202. package/dist/backend/entities/product-link.entity.d.ts.map +0 -1
  203. package/dist/backend/entities/product-link.entity.js.map +0 -1
  204. package/dist/backend/entities/product-list-saved-view.entity.d.ts.map +0 -1
  205. package/dist/backend/entities/product-list-saved-view.entity.js.map +0 -1
  206. package/dist/backend/entities/product-packaging-unit-scope-override.entity.d.ts.map +0 -1
  207. package/dist/backend/entities/product-packaging-unit-scope-override.entity.js.map +0 -1
  208. package/dist/backend/entities/product-packaging-unit.entity.d.ts.map +0 -1
  209. package/dist/backend/entities/product-packaging-unit.entity.js.map +0 -1
  210. package/dist/backend/entities/product-url-key.entity.d.ts.map +0 -1
  211. package/dist/backend/entities/product-url-key.entity.js.map +0 -1
  212. package/dist/backend/entities/product-url-redirect.entity.d.ts.map +0 -1
  213. package/dist/backend/entities/product-url-redirect.entity.js.map +0 -1
  214. package/dist/backend/entities/product-value-override.entity.d.ts.map +0 -1
  215. package/dist/backend/entities/product-value-override.entity.js.map +0 -1
  216. package/dist/backend/entities/product-variant.entity.d.ts.map +0 -1
  217. package/dist/backend/entities/product-variant.entity.js.map +0 -1
  218. package/dist/backend/entities/product.entity.d.ts.map +0 -1
  219. package/dist/backend/entities/product.entity.js.map +0 -1
  220. package/dist/backend/index.d.ts.map +0 -1
  221. package/dist/backend/index.js.map +0 -1
  222. package/dist/backend/plugin.d.ts.map +0 -1
  223. package/dist/backend/plugin.js.map +0 -1
  224. package/dist/backend/prompt-tools.d.ts.map +0 -1
  225. package/dist/backend/prompt-tools.js.map +0 -1
  226. package/dist/backend/routes.admin.d.ts.map +0 -1
  227. package/dist/backend/routes.admin.js.map +0 -1
  228. package/dist/backend/routes.admin.url-keys.d.ts.map +0 -1
  229. package/dist/backend/routes.admin.url-keys.js.map +0 -1
  230. package/dist/backend/routes.api-key.d.ts.map +0 -1
  231. package/dist/backend/routes.api-key.js.map +0 -1
  232. package/dist/backend/routes.external.d.ts.map +0 -1
  233. package/dist/backend/routes.external.js.map +0 -1
  234. package/dist/backend/routes.public.d.ts.map +0 -1
  235. package/dist/backend/routes.public.js.map +0 -1
  236. package/dist/backend/routes.public.url-keys.d.ts.map +0 -1
  237. package/dist/backend/routes.public.url-keys.js.map +0 -1
  238. package/dist/backend/saved-view-actor.d.ts.map +0 -1
  239. package/dist/backend/saved-view-actor.js.map +0 -1
  240. package/dist/backend/services/asset-references.d.ts.map +0 -1
  241. package/dist/backend/services/asset-references.js.map +0 -1
  242. package/dist/backend/services/attachment-packaging-scopes.d.ts.map +0 -1
  243. package/dist/backend/services/attachment-packaging-scopes.js.map +0 -1
  244. package/dist/backend/services/attachment.service.d.ts.map +0 -1
  245. package/dist/backend/services/attachment.service.js.map +0 -1
  246. package/dist/backend/services/attribute-filter-match.d.ts.map +0 -1
  247. package/dist/backend/services/attribute-filter-match.js.map +0 -1
  248. package/dist/backend/services/attribute-option-validator.d.ts.map +0 -1
  249. package/dist/backend/services/attribute-option-validator.js.map +0 -1
  250. package/dist/backend/services/attribute-scope-preview.d.ts.map +0 -1
  251. package/dist/backend/services/attribute-scope-preview.js.map +0 -1
  252. package/dist/backend/services/attribute-set-validations.d.ts.map +0 -1
  253. package/dist/backend/services/attribute-set-validations.js.map +0 -1
  254. package/dist/backend/services/attribute-set.service.d.ts.map +0 -1
  255. package/dist/backend/services/attribute-set.service.js.map +0 -1
  256. package/dist/backend/services/attribute-type-mapping.d.ts.map +0 -1
  257. package/dist/backend/services/attribute-type-mapping.js.map +0 -1
  258. package/dist/backend/services/attribute-usage.d.ts.map +0 -1
  259. package/dist/backend/services/attribute-usage.js.map +0 -1
  260. package/dist/backend/services/attribute-value-key.service.d.ts.map +0 -1
  261. package/dist/backend/services/attribute-value-key.service.js.map +0 -1
  262. package/dist/backend/services/audit-references.d.ts.map +0 -1
  263. package/dist/backend/services/audit-references.js.map +0 -1
  264. package/dist/backend/services/bulk-operation-queue.d.ts.map +0 -1
  265. package/dist/backend/services/bulk-operation-queue.js.map +0 -1
  266. package/dist/backend/services/bulk-operation.service.d.ts.map +0 -1
  267. package/dist/backend/services/bulk-operation.service.js.map +0 -1
  268. package/dist/backend/services/bundle.service.d.ts.map +0 -1
  269. package/dist/backend/services/bundle.service.js.map +0 -1
  270. package/dist/backend/services/catalog-admin-search.service.d.ts.map +0 -1
  271. package/dist/backend/services/catalog-admin-search.service.js.map +0 -1
  272. package/dist/backend/services/catalog-admin.service.d.ts.map +0 -1
  273. package/dist/backend/services/catalog-admin.service.js.map +0 -1
  274. package/dist/backend/services/catalog-attribute-read.service.d.ts.map +0 -1
  275. package/dist/backend/services/catalog-attribute-read.service.js.map +0 -1
  276. package/dist/backend/services/catalog-bulk-import.service.d.ts.map +0 -1
  277. package/dist/backend/services/catalog-bulk-import.service.js.map +0 -1
  278. package/dist/backend/services/catalog-bulk-update.service.d.ts.map +0 -1
  279. package/dist/backend/services/catalog-bulk-update.service.js.map +0 -1
  280. package/dist/backend/services/catalog-category-read.service.d.ts.map +0 -1
  281. package/dist/backend/services/catalog-category-read.service.js.map +0 -1
  282. package/dist/backend/services/catalog-org-price-decorator.d.ts.map +0 -1
  283. package/dist/backend/services/catalog-org-price-decorator.js.map +0 -1
  284. package/dist/backend/services/catalog-product-filter.service.d.ts.map +0 -1
  285. package/dist/backend/services/catalog-product-filter.service.js.map +0 -1
  286. package/dist/backend/services/catalog-product-read.service.d.ts.map +0 -1
  287. package/dist/backend/services/catalog-product-read.service.js.map +0 -1
  288. package/dist/backend/services/catalog-query.service.d.ts.map +0 -1
  289. package/dist/backend/services/catalog-query.service.js.map +0 -1
  290. package/dist/backend/services/catalog-quick-search.service.d.ts.map +0 -1
  291. package/dist/backend/services/catalog-quick-search.service.js.map +0 -1
  292. package/dist/backend/services/catalog-write-ports.d.ts.map +0 -1
  293. package/dist/backend/services/catalog-write-ports.js.map +0 -1
  294. package/dist/backend/services/category-admin.service.d.ts.map +0 -1
  295. package/dist/backend/services/category-admin.service.js.map +0 -1
  296. package/dist/backend/services/channel-url-facts.d.ts.map +0 -1
  297. package/dist/backend/services/channel-url-facts.js.map +0 -1
  298. package/dist/backend/services/content-attribute-rules.d.ts.map +0 -1
  299. package/dist/backend/services/content-attribute-rules.js.map +0 -1
  300. package/dist/backend/services/effective-value.sql.d.ts.map +0 -1
  301. package/dist/backend/services/effective-value.sql.js.map +0 -1
  302. package/dist/backend/services/gallery-scopes.d.ts.map +0 -1
  303. package/dist/backend/services/gallery-scopes.js.map +0 -1
  304. package/dist/backend/services/gallery.service.d.ts.map +0 -1
  305. package/dist/backend/services/gallery.service.js.map +0 -1
  306. package/dist/backend/services/grouped.service.d.ts.map +0 -1
  307. package/dist/backend/services/grouped.service.js.map +0 -1
  308. package/dist/backend/services/label-resolver.d.ts.map +0 -1
  309. package/dist/backend/services/label-resolver.js.map +0 -1
  310. package/dist/backend/services/linkable-asset.d.ts.map +0 -1
  311. package/dist/backend/services/linkable-asset.js.map +0 -1
  312. package/dist/backend/services/packaging-unit.service.d.ts.map +0 -1
  313. package/dist/backend/services/packaging-unit.service.js.map +0 -1
  314. package/dist/backend/services/page-builder-content.d.ts.map +0 -1
  315. package/dist/backend/services/page-builder-content.js.map +0 -1
  316. package/dist/backend/services/primary-asset-url.d.ts.map +0 -1
  317. package/dist/backend/services/primary-asset-url.js.map +0 -1
  318. package/dist/backend/services/product-availability.service.d.ts.map +0 -1
  319. package/dist/backend/services/product-availability.service.js.map +0 -1
  320. package/dist/backend/services/product-availability.sql.d.ts.map +0 -1
  321. package/dist/backend/services/product-availability.sql.js.map +0 -1
  322. package/dist/backend/services/product-content.service.d.ts.map +0 -1
  323. package/dist/backend/services/product-content.service.js.map +0 -1
  324. package/dist/backend/services/product-editor-preferences.service.d.ts.map +0 -1
  325. package/dist/backend/services/product-editor-preferences.service.js.map +0 -1
  326. package/dist/backend/services/product-global-field-rules.d.ts.map +0 -1
  327. package/dist/backend/services/product-global-field-rules.js.map +0 -1
  328. package/dist/backend/services/product-link.service.d.ts.map +0 -1
  329. package/dist/backend/services/product-link.service.js.map +0 -1
  330. package/dist/backend/services/product-list-view-service.d.ts.map +0 -1
  331. package/dist/backend/services/product-list-view-service.js.map +0 -1
  332. package/dist/backend/services/product-page-revalidation.d.ts.map +0 -1
  333. package/dist/backend/services/product-page-revalidation.js.map +0 -1
  334. package/dist/backend/services/product-scopes.service.d.ts.map +0 -1
  335. package/dist/backend/services/product-scopes.service.js.map +0 -1
  336. package/dist/backend/services/product-summary-text.d.ts.map +0 -1
  337. package/dist/backend/services/product-summary-text.js.map +0 -1
  338. package/dist/backend/services/product-type-validations.d.ts.map +0 -1
  339. package/dist/backend/services/product-type-validations.js.map +0 -1
  340. package/dist/backend/services/product-value-resolver.service.d.ts.map +0 -1
  341. package/dist/backend/services/product-value-resolver.service.js.map +0 -1
  342. package/dist/backend/services/publication-window-sweep.d.ts.map +0 -1
  343. package/dist/backend/services/publication-window-sweep.js.map +0 -1
  344. package/dist/backend/services/scheduled-work-probe.d.ts.map +0 -1
  345. package/dist/backend/services/scheduled-work-probe.js.map +0 -1
  346. package/dist/backend/services/scope-completeness.d.ts.map +0 -1
  347. package/dist/backend/services/scope-completeness.js.map +0 -1
  348. package/dist/backend/services/scope-overview.service.d.ts.map +0 -1
  349. package/dist/backend/services/scope-overview.service.js.map +0 -1
  350. package/dist/backend/services/scoped-store-adapters.d.ts.map +0 -1
  351. package/dist/backend/services/scoped-store-adapters.js.map +0 -1
  352. package/dist/backend/services/scoped-values-global-only.d.ts.map +0 -1
  353. package/dist/backend/services/scoped-values-global-only.js.map +0 -1
  354. package/dist/backend/services/scoped-values-import.d.ts.map +0 -1
  355. package/dist/backend/services/scoped-values-import.js.map +0 -1
  356. package/dist/backend/services/scoped-values-read.service.d.ts.map +0 -1
  357. package/dist/backend/services/scoped-values-read.service.js.map +0 -1
  358. package/dist/backend/services/scoped-values-save.service.d.ts.map +0 -1
  359. package/dist/backend/services/scoped-values-save.service.js.map +0 -1
  360. package/dist/backend/services/scoped-values-state.d.ts.map +0 -1
  361. package/dist/backend/services/scoped-values-state.js.map +0 -1
  362. package/dist/backend/services/scoped-values.service.d.ts.map +0 -1
  363. package/dist/backend/services/scoped-values.service.js.map +0 -1
  364. package/dist/backend/services/sql-id-arrays.d.ts.map +0 -1
  365. package/dist/backend/services/sql-id-arrays.js.map +0 -1
  366. package/dist/backend/services/storefront-value-overrides.d.ts.map +0 -1
  367. package/dist/backend/services/storefront-value-overrides.js.map +0 -1
  368. package/dist/backend/services/system-attribute-scopes.d.ts.map +0 -1
  369. package/dist/backend/services/system-attribute-scopes.js.map +0 -1
  370. package/dist/backend/services/url-key-resolution.service.d.ts.map +0 -1
  371. package/dist/backend/services/url-key-resolution.service.js.map +0 -1
  372. package/dist/backend/services/url-key.service.d.ts.map +0 -1
  373. package/dist/backend/services/url-key.service.js.map +0 -1
  374. package/dist/backend/services/viewer-organization.d.ts.map +0 -1
  375. package/dist/backend/services/viewer-organization.js.map +0 -1
  376. package/dist/manifest.d.ts.map +0 -1
  377. package/dist/manifest.js.map +0 -1
  378. package/dist/migrations/20260429T064146_catalog_attribute_sets_init.d.ts.map +0 -1
  379. package/dist/migrations/20260429T064146_catalog_attribute_sets_init.js.map +0 -1
  380. package/dist/migrations/20260429T070004_catalog_product_attribute_extensions.d.ts.map +0 -1
  381. package/dist/migrations/20260429T070004_catalog_product_attribute_extensions.js.map +0 -1
  382. package/dist/migrations/20260429T102322_catalog_product_type_and_virtual_fields.d.ts.map +0 -1
  383. package/dist/migrations/20260429T102322_catalog_product_type_and_virtual_fields.js.map +0 -1
  384. package/dist/migrations/20260429T111839_catalog_gallery_items_and_labels.d.ts.map +0 -1
  385. package/dist/migrations/20260429T111839_catalog_gallery_items_and_labels.js.map +0 -1
  386. package/dist/migrations/20260429T112543_catalog_product_attachments.d.ts.map +0 -1
  387. package/dist/migrations/20260429T112543_catalog_product_attachments.js.map +0 -1
  388. package/dist/migrations/20260429T123726_catalog_product_links.d.ts.map +0 -1
  389. package/dist/migrations/20260429T123726_catalog_product_links.js.map +0 -1
  390. package/dist/migrations/20260429T130803_catalog_grouped_and_bundle.d.ts.map +0 -1
  391. package/dist/migrations/20260429T130803_catalog_grouped_and_bundle.js.map +0 -1
  392. package/dist/migrations/20260501T185835_catalog_product_attribute_is_comparable.d.ts.map +0 -1
  393. package/dist/migrations/20260501T185835_catalog_product_attribute_is_comparable.js.map +0 -1
  394. package/dist/migrations/20260505T060113_catalog_attribute_options_and_flags.d.ts.map +0 -1
  395. package/dist/migrations/20260505T060113_catalog_attribute_options_and_flags.js.map +0 -1
  396. package/dist/migrations/20260515T082629_catalog_attribute_mass_editable.d.ts.map +0 -1
  397. package/dist/migrations/20260515T082629_catalog_attribute_mass_editable.js.map +0 -1
  398. package/dist/migrations/20260526T124736_catalog_product_status_inactive.d.ts.map +0 -1
  399. package/dist/migrations/20260526T124736_catalog_product_status_inactive.js.map +0 -1
  400. package/dist/migrations/20260611T140346_catalog_product_value_overrides_init.d.ts.map +0 -1
  401. package/dist/migrations/20260611T140346_catalog_product_value_overrides_init.js.map +0 -1
  402. package/dist/migrations/20260611T140400_catalog_attribute_quick_searchable.d.ts.map +0 -1
  403. package/dist/migrations/20260611T140400_catalog_attribute_quick_searchable.js.map +0 -1
  404. package/dist/migrations/20260611T140407_catalog_bulk_operations.d.ts.map +0 -1
  405. package/dist/migrations/20260611T140407_catalog_bulk_operations.js.map +0 -1
  406. package/dist/migrations/20260611T140408_catalog_bulk_operation_logs.d.ts.map +0 -1
  407. package/dist/migrations/20260611T140408_catalog_bulk_operation_logs.js.map +0 -1
  408. package/dist/migrations/20260611T140412_catalog_product_packaging_units.d.ts.map +0 -1
  409. package/dist/migrations/20260611T140412_catalog_product_packaging_units.js.map +0 -1
  410. package/dist/migrations/20260718T060659_catalog_bulk_operation_revert_state.d.ts.map +0 -1
  411. package/dist/migrations/20260718T060659_catalog_bulk_operation_revert_state.js.map +0 -1
  412. package/dist/migrations/20260718T200343_catalog_category_custom_field_values.d.ts.map +0 -1
  413. package/dist/migrations/20260718T200343_catalog_category_custom_field_values.js.map +0 -1
  414. package/dist/migrations/20260723T230401_catalog_attributes_on_custom_fields.d.ts.map +0 -1
  415. package/dist/migrations/20260723T230401_catalog_attributes_on_custom_fields.js.map +0 -1
  416. package/dist/migrations/20260804T152604_catalog_widen_product_sku.d.ts.map +0 -1
  417. package/dist/migrations/20260804T152604_catalog_widen_product_sku.js.map +0 -1
  418. package/dist/migrations/20260804T160244_catalog_category_activation.d.ts.map +0 -1
  419. package/dist/migrations/20260804T160244_catalog_category_activation.js.map +0 -1
  420. package/dist/migrations/20260912T094557_catalog_sales_channel_products.d.ts.map +0 -1
  421. package/dist/migrations/20260912T094557_catalog_sales_channel_products.js.map +0 -1
  422. package/dist/migrations/20260912T094623_catalog_sales_channel_categories.d.ts.map +0 -1
  423. package/dist/migrations/20260912T094623_catalog_sales_channel_categories.js.map +0 -1
  424. package/dist/migrations/20260925T125527_catalog_inventory_columns.d.ts.map +0 -1
  425. package/dist/migrations/20260925T125527_catalog_inventory_columns.js.map +0 -1
  426. package/dist/migrations/20261008T080839_catalog_product_attribute_is_price_rule.d.ts.map +0 -1
  427. package/dist/migrations/20261008T080839_catalog_product_attribute_is_price_rule.js.map +0 -1
  428. package/dist/migrations/20261008T092714_catalog_category_content.d.ts.map +0 -1
  429. package/dist/migrations/20261008T092714_catalog_category_content.js.map +0 -1
  430. package/dist/migrations/20261014T170531_catalog_product_list_saved_views.d.ts.map +0 -1
  431. package/dist/migrations/20261014T170531_catalog_product_list_saved_views.js.map +0 -1
  432. package/dist/migrations/20261016T082008_catalog_order_rules.d.ts.map +0 -1
  433. package/dist/migrations/20261016T082008_catalog_order_rules.js.map +0 -1
  434. package/dist/migrations/20261022T035133_catalog_product_scopes.d.ts.map +0 -1
  435. package/dist/migrations/20261022T035133_catalog_product_scopes.js.map +0 -1
  436. package/dist/migrations/20261022T054223_catalog_product_url_keys.d.ts.map +0 -1
  437. package/dist/migrations/20261022T054223_catalog_product_url_keys.js.map +0 -1
  438. package/dist/migrations/20261022T111811_catalog_price_fields_removed.d.ts.map +0 -1
  439. package/dist/migrations/20261022T111811_catalog_price_fields_removed.js.map +0 -1
  440. package/dist/migrations/20261022T182523_catalog_admin_name_keys.d.ts.map +0 -1
  441. package/dist/migrations/20261022T182523_catalog_admin_name_keys.js.map +0 -1
  442. package/dist/migrations/20261025T222634_catalog_product_status_drop_draft.d.ts.map +0 -1
  443. package/dist/migrations/20261025T222634_catalog_product_status_drop_draft.js.map +0 -1
  444. package/dist/migrations/20261026T033453_catalog_product_media_scopes.d.ts.map +0 -1
  445. package/dist/migrations/20261026T033453_catalog_product_media_scopes.js.map +0 -1
  446. package/dist/migrations/20261026T084533_catalog_attachment_packaging_translations.d.ts.map +0 -1
  447. package/dist/migrations/20261026T084533_catalog_attachment_packaging_translations.js.map +0 -1
  448. package/dist/migrations/20261030T113855_catalog_scope_model_texts.d.ts.map +0 -1
  449. package/dist/migrations/20261030T113855_catalog_scope_model_texts.js.map +0 -1
  450. package/dist/migrations/20261030T113859_catalog_scope_model_order_rules.d.ts.map +0 -1
  451. package/dist/migrations/20261030T113859_catalog_scope_model_order_rules.js.map +0 -1
  452. package/dist/migrations/20261030T113904_catalog_scope_model_url_keys.d.ts.map +0 -1
  453. package/dist/migrations/20261030T113904_catalog_scope_model_url_keys.js.map +0 -1
  454. package/dist/migrations/20261030T113908_catalog_scope_model_media.d.ts.map +0 -1
  455. package/dist/migrations/20261030T113908_catalog_scope_model_media.js.map +0 -1
  456. package/dist/migrations/20261104T121504_catalog_product_content_values.d.ts.map +0 -1
  457. package/dist/migrations/20261104T121504_catalog_product_content_values.js.map +0 -1
  458. package/dist/migrations/20261107T093126_catalog_sku_unique_among_live.d.ts.map +0 -1
  459. package/dist/migrations/20261107T093126_catalog_sku_unique_among_live.js.map +0 -1
  460. package/dist/migrations/20261107T120008_catalog_product_created_at_milliseconds.d.ts.map +0 -1
  461. package/dist/migrations/20261107T120008_catalog_product_created_at_milliseconds.js.map +0 -1
  462. package/dist/migrations/index.d.ts.map +0 -1
  463. package/dist/migrations/index.js.map +0 -1
  464. package/dist/ports/index.d.ts.map +0 -1
  465. package/dist/ports/index.js.map +0 -1
@@ -15,16 +15,26 @@ import { readAttributeUsage } from '../services/attribute-usage.js';
15
15
  * published guard over the published code union, so the narrowing is structural
16
16
  * and the class stops crossing the boundary.
17
17
  */
18
- function toCatalogHttpError(err, keyForMessage) {
18
+ function toCatalogHttpError(err, attributeKey, option) {
19
19
  if (isCustomFieldDefinitionFailure(err)) {
20
20
  switch (err.code) {
21
+ // Issue #624 (#86) — the three refusals the stored state makes have codes
22
+ // of their own; the published failure carries no values, so the attribute
23
+ // (and the option) the Command already holds fill `details`.
21
24
  case 'duplicate_key':
22
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, `Attribute key "${keyForMessage ?? ''}" already exists.`);
25
+ throw new HttpError(409, ERROR_CODES.ATTRIBUTE_KEY_TAKEN, `Attribute key "${attributeKey}" already exists.`, {
26
+ attributeKey,
27
+ });
23
28
  case 'not_found':
24
29
  throw new HttpError(404, ERROR_CODES.NOT_FOUND, err.message);
25
30
  case 'value_type_locked':
31
+ throw new HttpError(409, ERROR_CODES.ATTRIBUTE_VALUE_TYPE_LOCKED, err.message, { attributeKey });
26
32
  case 'option_in_use':
27
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, err.message);
33
+ // The custom-fields probe, behind catalog's own count: no count to name.
34
+ throw new HttpError(409, ERROR_CODES.ATTRIBUTE_OPTION_IN_USE, err.message, {
35
+ attributeKey,
36
+ ...(option ? { value: option.value } : {}),
37
+ });
28
38
  // Feature 172 — a value type the host does not offer: a malformed request.
29
39
  case 'value_type_unsupported':
30
40
  throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, err.message);
@@ -137,6 +147,9 @@ export function createAttributeCommand(deps, req, input) {
137
147
  sortOrder: input.sortOrder,
138
148
  config: {},
139
149
  options,
150
+ // Feature 175 (FR-036) — the admin panel's affordance; the apply
151
+ // seam refuses a required attribute that is not `edit` (SD-2).
152
+ ...(req.adminAccess !== undefined ? { adminAccess: req.adminAccess } : {}),
140
153
  });
141
154
  definitionId = def.id;
142
155
  // The extension references the definition by plain uuid (no ORM
@@ -248,14 +261,17 @@ export function updateAttributeCommand(deps, extensionId, req) {
248
261
  currentLegacyType !== 'number' &&
249
262
  currentLegacyType !== 'price' &&
250
263
  currentLegacyType !== 'page_builder') {
251
- throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, `displayAsSlider is only valid for valueType="number" or "price"; got "${currentLegacyType}".`);
264
+ // Issue #624 (#86) — the stored type refuses it, so a code of its own;
265
+ // on create the same rule judges the request alone and stays
266
+ // `VALIDATION_FAILED`.
267
+ throw new HttpError(400, ERROR_CODES.ATTRIBUTE_SLIDER_NOT_SUPPORTED, `displayAsSlider is only valid for valueType="number" or "price"; got "${currentLegacyType}".`, { attributeKey: def.key, valueType: currentLegacyType });
252
268
  }
253
269
  ext.displayAsSlider = req.displayAsSlider;
254
270
  }
255
271
  // Feature 172 (research R-6) — the type never moves to or from
256
272
  // `page_builder` (FR-005), and a content attribute is judged on its
257
273
  // **effective** flags: the stored ones with this patch applied.
258
- assertTypeChangeAllowed(currentLegacyType, newLegacyType);
274
+ assertTypeChangeAllowed(currentLegacyType, newLegacyType, def.key);
259
275
  if (newLegacyType === 'page_builder') {
260
276
  assertContentAttributeShape({
261
277
  isSearchable: ext.isSearchable,
@@ -270,7 +286,9 @@ export function updateAttributeCommand(deps, extensionId, req) {
270
286
  isRequired: req.isRequired ?? def.required,
271
287
  isVisibleOnProductPage: ext.isVisibleOnProductPage,
272
288
  scopable: ext.scopable,
273
- });
289
+ },
290
+ // Issue #1218 (#86) — the stored type refuses the flag: a code of its own.
291
+ { attributeKey: def.key });
274
292
  }
275
293
  const triple = legacyToCfType(newLegacyType);
276
294
  ext.selectDisplay = triple.selectDisplay;
@@ -283,6 +301,8 @@ export function updateAttributeCommand(deps, extensionId, req) {
283
301
  patch['labelDefault'] = req.labelDefault;
284
302
  if (req.isRequired !== undefined)
285
303
  patch['required'] = req.isRequired;
304
+ if (req.adminAccess !== undefined)
305
+ patch['adminAccess'] = req.adminAccess;
286
306
  if (triple.cfValueType !== def.valueType)
287
307
  patch['valueType'] = triple.cfValueType;
288
308
  if (Object.keys(patch).length > 0) {
@@ -329,13 +349,13 @@ export function deleteAttributeCommand(deps, target) {
329
349
  // (issue #200).
330
350
  const usage = await readAttributeUsage(em, target);
331
351
  if (usage.attributeSetCount > 0) {
332
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, `Attribute is still referenced by ${usage.attributeSetCount} attribute set(s); remove from sets first.`);
352
+ throw new HttpError(409, ERROR_CODES.ATTRIBUTE_IN_USE, `Attribute is still referenced by ${usage.attributeSetCount} attribute set(s); remove from sets first.`, { code: 'attribute_sets', attributeKey: target.key, attributeSetCount: usage.attributeSetCount });
333
353
  }
334
354
  // A baseline value, a per-channel override or a variant value on a
335
355
  // product that is not soft-deleted. Operator data is never erased by side
336
356
  // effect (feature 012 FR-006); a soft-deleted product no longer blocks.
337
357
  if (usage.productValueCount > 0) {
338
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, `Attribute is still referenced by ${usage.productValueCount} product(s); clear values first.`);
358
+ throw new HttpError(409, ERROR_CODES.ATTRIBUTE_IN_USE, `Attribute is still referenced by ${usage.productValueCount} product(s); clear values first.`, { code: 'products', attributeKey: target.key, productCount: usage.productValueCount });
339
359
  }
340
360
  // Page Builder content goes with its attribute (FR-007) — every row,
341
361
  // a soft-deleted product's too; the FK cascade is the backstop. The audit
@@ -386,6 +406,33 @@ function optionResult(attr, option) {
386
406
  updatedAt: option.updatedAt,
387
407
  };
388
408
  }
409
+ /**
410
+ * An option write the attribute's **stored** options or type refuse (issue
411
+ * #624, #86): a value the attribute already has, a second default where one
412
+ * default is allowed, options on a type that takes none. A malformed value in
413
+ * the request stays `VALIDATION_FAILED`. `value` is the option being written.
414
+ */
415
+ function optionListRefusal(error, attr, value) {
416
+ switch (error.code) {
417
+ case 'duplicate_value':
418
+ return new HttpError(409, ERROR_CODES.ATTRIBUTE_OPTION_VALUE_TAKEN, error.message, {
419
+ attributeKey: attr.key,
420
+ value: error.value ?? value,
421
+ });
422
+ case 'default_option_ambiguous':
423
+ return new HttpError(409, ERROR_CODES.ATTRIBUTE_DEFAULT_OPTION_TAKEN, error.message, {
424
+ attributeKey: attr.key,
425
+ value,
426
+ });
427
+ case 'attribute_type_unsupported':
428
+ return new HttpError(400, ERROR_CODES.ATTRIBUTE_OPTIONS_NOT_SUPPORTED, error.message, {
429
+ attributeKey: attr.key,
430
+ valueType: attr.valueType,
431
+ });
432
+ case 'invalid_option_value':
433
+ return new HttpError(400, ERROR_CODES.VALIDATION_FAILED, error.message);
434
+ }
435
+ }
389
436
  export function createAttributeOptionCommand(deps, attr, input) {
390
437
  return {
391
438
  action: 'catalog.attribute_option.create',
@@ -409,8 +456,7 @@ export function createAttributeOptionCommand(deps, attr, input) {
409
456
  candidate,
410
457
  ], attr.valueType);
411
458
  if (!result.ok) {
412
- const first = result.errors[0];
413
- throw new HttpError(first.code === 'attribute_type_unsupported' ? 400 : 409, ERROR_CODES.VALIDATION_FAILED, first.message);
459
+ throw optionListRefusal(result.errors[0], attr, input.value);
414
460
  }
415
461
  const sortOrder = input.sortOrder ??
416
462
  (attr.options.length > 0
@@ -461,7 +507,7 @@ export function updateAttributeOptionCommand(deps, attr, optionId, input) {
461
507
  }));
462
508
  const result = validateOptionList(reslist, attr.valueType);
463
509
  if (!result.ok) {
464
- throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, result.errors[0].message);
510
+ throw optionListRefusal(result.errors[0], attr, existing.value);
465
511
  }
466
512
  }
467
513
  try {
@@ -531,14 +577,14 @@ export function deleteAttributeOptionCommand(deps, attr, optionId) {
531
577
  ]));
532
578
  const productCount = Number(refs[0]?.count ?? '0');
533
579
  if (productCount > 0) {
534
- throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, `option_in_use: ${productCount} product(s) still carry value '${existing.value}'.`);
580
+ throw new HttpError(409, ERROR_CODES.ATTRIBUTE_OPTION_IN_USE, `${productCount} product(s) still carry the value '${existing.value}'.`, { code: 'products', attributeKey: attr.key, value: existing.value, productCount });
535
581
  }
536
582
  try {
537
583
  await deps.apply.applyDeleteOption(em, attr.definitionId, optionId);
538
584
  await em.flush();
539
585
  }
540
586
  catch (err) {
541
- toCatalogHttpError(err, attr.key);
587
+ toCatalogHttpError(err, attr.key, { value: existing.value });
542
588
  }
543
589
  return {
544
590
  result: undefined,
@@ -41,6 +41,7 @@ import { catalogModule, type CatalogModuleOptions } from './plugin.js';
41
41
  import type { CustomFieldDefinitionApplyApi } from './commands/attribute-commands.js';
42
42
  import { CatalogAdminService } from './services/catalog-admin.service.js';
43
43
  import { ProductPageRevalidation } from './services/product-page-revalidation.js';
44
+ import { type TableMaintenanceProducer } from './services/table-maintenance-queue.js';
44
45
  import { CategoryAdminService } from './services/category-admin.service.js';
45
46
  import { AttributeSetService } from './services/attribute-set.service.js';
46
47
  import { GalleryService } from './services/gallery.service.js';
@@ -112,6 +113,8 @@ export interface CatalogCradle {
112
113
  * server says no and drives the publication-window sweep directly.
113
114
  */
114
115
  readonly processRunsWorkers: boolean;
116
+ /** Issue #409 — the `catalog.table-maintenance` producer; a recorder in a test that asks. */
117
+ readonly catalogTableMaintenance: TableMaintenanceProducer;
115
118
  /**
116
119
  * The process connection, distinct from `moduleQueueRedis`: the assistant's
117
120
  * bulk tools delegate over the same queue in both compositions, which is a
@@ -42,6 +42,7 @@ import { ProductUrlKeyReadService } from './services/url-key-resolution.service.
42
42
  import { PRODUCT_PAGE_CHANGE_EVENTS, ProductPageRevalidation, productPageChangeHandler, } from './services/product-page-revalidation.js';
43
43
  import { UrlKeyService } from './services/url-key.service.js';
44
44
  import { PublicationWindowSweep, startPublicationWindowSweep, } from './services/publication-window-sweep.js';
45
+ import { createTableMaintenanceProducer, startTableMaintenanceWorker, } from './services/table-maintenance-queue.js';
45
46
  import { CategoryAdminService } from './services/category-admin.service.js';
46
47
  import { AttributeSetService } from './services/attribute-set.service.js';
47
48
  import { GalleryService } from './services/gallery.service.js';
@@ -214,6 +215,12 @@ export function registerModule(ctx) {
214
215
  * the shape a module writes for itself.
215
216
  */
216
217
  ctx.di.register({
218
+ catalogTableMaintenance: ctx
219
+ .asFunction(({ moduleQueueRedis }) => createTableMaintenanceProducer({
220
+ redis: moduleQueueRedis,
221
+ onError: (err) => ctx.log.warn({ err }, 'catalog: could not ask for the vacuum after an import; autovacuum remains the fallback'),
222
+ }))
223
+ .singleton(),
217
224
  /**
218
225
  * The availability band the external catalog namespace decorates a product
219
226
  * with. D-61: `catalog` declares `inventory` `degrades-without`, and the
@@ -562,7 +569,7 @@ export function registerModule(ctx) {
562
569
  * module's tables and in nobody else's.
563
570
  */
564
571
  ctx.di.providePort('catalogBulkImportPort', ctx
565
- .asFunction(({ commandBus, emFactory, eventBus }) => {
572
+ .asFunction(({ commandBus, emFactory, eventBus, catalogTableMaintenance }) => {
566
573
  const membership = lazyPort(ctx, 'salesChannelMembershipPort');
567
574
  const attributes = lazyPort(ctx, 'catalogAttributeReadPort');
568
575
  const urlKeys = new UrlKeyService(emFactory, membership, commandBus);
@@ -571,6 +578,8 @@ export function registerModule(ctx) {
571
578
  eventBus,
572
579
  // Feature 174 (T084) — each product row through the scoped import's planner and writers.
573
580
  importDeps: { membership, listAttributes: () => attributes.listAll(), urlKeys: () => urlKeys },
581
+ // Issue #409 — a products import that wrote asks for the vacuum of the tables it rewrote.
582
+ requestTableMaintenance: () => catalogTableMaintenance.request(),
574
583
  },
575
584
  // Feature 172 (FR-041) — which keys are Page Builder content attributes.
576
585
  attributes);
@@ -866,6 +875,16 @@ export function registerModule(ctx) {
866
875
  app.addHook('onClose', close);
867
876
  },
868
877
  });
878
+ // Issue #409 — `VACUUM (ANALYZE)` of `products` / `product_variants` after
879
+ // an import, on a connection outside any transaction; same gating.
880
+ app.addHook('onClose', () => c.catalogTableMaintenance.close());
881
+ startTableMaintenanceWorker({
882
+ processRunsWorkers: c.processRunsWorkers,
883
+ moduleQueueRedis: c.moduleQueueRedis,
884
+ connection: () => c.emFactory().getConnection(),
885
+ log: ctx.log,
886
+ attach: (worker) => ctx.worker(worker, { logger: app.log }),
887
+ });
869
888
  });
870
889
  /**
871
890
  * What an audit row about a product is called, and where the admin app shows it
@@ -244,7 +244,8 @@ export async function registerCatalogAdminRoutes(app, deps) {
244
244
  // Feature 054 (US2) — undo a reversible bulk edit. Restores every affected
245
245
  // product whose current state still matches the operation, reports the rest
246
246
  // as conflicts (never clobbered), and audits the undo. 404 when unknown,
247
- // 409 when not reversible / already reverted.
247
+ // 409 when still running, already reverted or not reversible — one code each
248
+ // (issue #501; they all answered `VERSION_CONFLICT` before).
248
249
  app.post('/api/v1/admin/catalog/bulk-operations/:id/undo', { preHandler: requireAdmin('catalog:write') }, async (request) => {
249
250
  const { id } = request.params;
250
251
  const outcome = await bulkOperationService.undo(id);
@@ -252,9 +253,13 @@ export async function registerCatalogAdminRoutes(app, deps) {
252
253
  if (outcome.code === 'NOT_FOUND') {
253
254
  throw new HttpError(404, ERROR_CODES.NOT_FOUND, `bulk operation ${id} not found`);
254
255
  }
255
- throw new HttpError(409, ERROR_CODES.VERSION_CONFLICT, outcome.code === 'ALREADY_REVERTED'
256
- ? 'This bulk operation has already been undone.'
257
- : 'This bulk operation cannot be undone.');
256
+ if (outcome.code === 'RUNNING') {
257
+ throw new HttpError(409, ERROR_CODES.BULK_OPERATION_RUNNING, 'This bulk operation is still running. Undo it once it has finished.');
258
+ }
259
+ if (outcome.code === 'ALREADY_REVERTED') {
260
+ throw new HttpError(409, ERROR_CODES.BULK_OPERATION_ALREADY_REVERTED, 'This bulk operation has already been undone.');
261
+ }
262
+ throw new HttpError(409, ERROR_CODES.BULK_OPERATION_NOT_REVERSIBLE, 'This bulk operation cannot be undone.');
258
263
  }
259
264
  return {
260
265
  data: {
@@ -664,6 +669,7 @@ export async function registerCatalogAdminRoutes(app, deps) {
664
669
  // Feature 012 / US4 — option-list CRUD per contracts/attribute-options.contract.md.
665
670
  // Backed by `custom_field_options` since feature 061; `attributeId` stays the
666
671
  // attribute (extension) id the admin API has always exposed.
672
+ /** The published `attributeOptionSchema` (issue #599). */
667
673
  function serializeOption(o) {
668
674
  return {
669
675
  id: o.id,
@@ -1292,6 +1298,8 @@ function serializeAdminAttribute(a, optionValues = null) {
1292
1298
  // Feature 174 (R15) — the scope flag the attribute editor edits and the levels it derives.
1293
1299
  scopable: a.scopable,
1294
1300
  scopeLevels: [...a.scopeLevels],
1301
+ // Feature 175 (FR-036) — the backing definition's admin access.
1302
+ adminAccess: a.adminAccess ?? 'edit',
1295
1303
  createdAt: a.createdAt.toISOString(),
1296
1304
  updatedAt: a.updatedAt.toISOString(),
1297
1305
  };
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { catalogBulkPriceRequestSchema, ERROR_CODES, } from '@endora-commerce/contracts';
2
+ import { catalogBulkPriceRequestSchema, ERROR_CODES, requestScopeLanguage, } from '@endora-commerce/contracts';
3
3
  import { HttpError } from '@endora-commerce/platform/http';
4
4
  import { getResolvedChannel } from '@endora-commerce/platform/kernel';
5
5
  import { productAudienceOf } from '@endora-commerce/platform/http';
@@ -100,8 +100,9 @@ function boundOrganizationId(request) {
100
100
  }
101
101
  function readContext(request) {
102
102
  const channel = getResolvedChannel(request);
103
+ // Issue #397 — resolved as the public catalogue resolves it (`readContext` there).
103
104
  const acceptLanguage = request.headers['accept-language'];
104
- const preferredLanguage = typeof acceptLanguage === 'string' ? acceptLanguage.split(',')[0]?.trim() : undefined;
105
+ const preferredLanguage = typeof acceptLanguage === 'string' ? requestScopeLanguage(channel, acceptLanguage) : undefined;
105
106
  return {
106
107
  resolvedChannel: {
107
108
  id: channel.id,
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ERROR_CODES, isAttributeKey, isPriceSort, listingCurrencyQuerySchema, listingPriceChannelContext, productLinkKindSchema, productListIdsSchema, productDetailQuerySchema, productListSortSchema, resolveListingCurrency, validateBundleConfigurationRequestSchema, } from '@endora-commerce/contracts';
2
+ import { ERROR_CODES, isAttributeKey, isPriceSort, listingCurrencyQuerySchema, listingPriceChannelContext, productLinkKindSchema, productListIdsSchema, productDetailQuerySchema, productListSortSchema, requestScopeLanguage, resolveListingCurrency, validateBundleConfigurationRequestSchema, } from '@endora-commerce/contracts';
3
3
  import { HttpError } from '@endora-commerce/platform/http';
4
4
  import { effectiveState, rethrowIfModuleDisabled } from '@endora-commerce/platform/kernel';
5
5
  import { getResolvedChannel } from '@endora-commerce/platform/kernel';
@@ -138,9 +138,10 @@ export async function registerCatalogPublicRoutes(app, deps) {
138
138
  return {
139
139
  available: false,
140
140
  reason: 'Prices are not displayed on this page, so the catalogue cannot be ordered or filtered by price.',
141
+ mode,
141
142
  };
142
143
  }
143
- return { available: true };
144
+ return { available: true, mode };
144
145
  }
145
146
  // GET /api/v1/catalog/products
146
147
  app.get('/api/v1/catalog/products', async (request, reply) => {
@@ -232,7 +233,9 @@ export async function registerCatalogPublicRoutes(app, deps) {
232
233
  }
233
234
  request.log.warn({ err: outcome.reason }, 'meilisearch unavailable; falling back to postgres');
234
235
  }
235
- const result = await queryService.listProducts({ q, ids, limit, cursor, sort, categorySlug, attributeFilters, changedSince, minPrice, maxPrice }, ctx);
236
+ // Issue #420 — the service refuses a price control on a page that hides
237
+ // prices by itself; handing it the mode resolved above spares it asking twice.
238
+ const result = await queryService.listProducts({ q, ids, limit, cursor, sort, categorySlug, attributeFilters, changedSince, minPrice, maxPrice }, priceControls.mode !== undefined ? { ...ctx, pageDisplayMode: priceControls.mode } : ctx);
236
239
  reply.header('x-search-backend', 'postgres');
237
240
  const page = await withListPlaceholder(result, ctx.resolvedChannel.code);
238
241
  return { ...page, data: await withVatRates(page.data, ctx, request.log), capabilities };
@@ -338,8 +341,10 @@ export function readContext(request) {
338
341
  // back to its default — see `resolveListingCurrency`.
339
342
  const requestedCurrency = request.query?.['currency'];
340
343
  const currency = resolveListingCurrency(requestedCurrency === undefined ? undefined : listingCurrencyQuerySchema.parse(requestedCurrency), ch);
344
+ // Issue #397 — the request language is the channel's language the header asks
345
+ // for: q-weighted, matched exactly then by base language, else the default.
341
346
  const acceptLanguage = acceptLanguageHeaderSchema.parse(request.headers['accept-language']);
342
- const preferredLanguage = acceptLanguage ? acceptLanguage.split(',')[0]?.trim() : undefined;
347
+ const preferredLanguage = acceptLanguage ? requestScopeLanguage(ch, acceptLanguage) : undefined;
343
348
  return {
344
349
  resolvedChannel: {
345
350
  id: ch.id,
@@ -206,7 +206,7 @@ export type UndoOutcome = {
206
206
  undoStatus: 'reverted' | 'partially_reverted' | 'none';
207
207
  } | {
208
208
  ok: false;
209
- code: 'NOT_FOUND' | 'NOT_REVERSIBLE' | 'ALREADY_REVERTED';
209
+ code: 'NOT_FOUND' | 'RUNNING' | 'NOT_REVERSIBLE' | 'ALREADY_REVERTED';
210
210
  };
211
211
  /**
212
212
  * The trail is stored and read later by administrators in languages of their
@@ -453,6 +453,10 @@ export class BulkOperationService {
453
453
  const op = await em.findOne(BulkOperation, { id: operationId });
454
454
  if (!op)
455
455
  return { ok: false, code: 'NOT_FOUND' };
456
+ // Issue #501 — an operation still in flight is its own refusal, not "cannot be undone":
457
+ // the admin hides Undo until completion, and the API says why when it is reached anyway.
458
+ if (op.status === 'pending' || op.status === 'running')
459
+ return { ok: false, code: 'RUNNING' };
456
460
  if (op.status !== 'completed' || !op.reversible || !op.revertState || op.revertState.length === 0) {
457
461
  return { ok: false, code: 'NOT_REVERSIBLE' };
458
462
  }
@@ -525,9 +525,12 @@ export class CatalogAdminService {
525
525
  // Feature 025 — SKUs share a global namespace with variants (see createVariant).
526
526
  const holder = await findSkuHolder(em, product.id, trimmed);
527
527
  if (holder) {
528
- throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, 'productId' in holder
529
- ? `sku_in_use { conflictingProductId: ${holder.productId}, conflictingSku: ${trimmed} }`
530
- : `sku_in_use { conflictingVariantId: ${holder.variantId}, conflictingSku: ${trimmed} }`);
528
+ // Issue #624 (#86) — create's code and status for the same refusal;
529
+ // the token says which kind of row holds the SKU. The SKU travels as
530
+ // `sku`: `details.code` is the envelope's token slot.
531
+ throw new HttpError(409, ERROR_CODES.SKU_ALREADY_EXISTS, `SKU "${trimmed}" is already used by another ${'productId' in holder ? 'product' : 'variant'}.`, 'productId' in holder
532
+ ? { code: 'held_by_product', sku: trimmed, conflictingProductId: holder.productId }
533
+ : { code: 'held_by_variant', sku: trimmed, conflictingVariantId: holder.variantId });
531
534
  }
532
535
  product.sku = trimmed;
533
536
  changedFields.push('sku');
@@ -1688,7 +1691,9 @@ export class CatalogAdminService {
1688
1691
  throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${parentProductId} not found.`);
1689
1692
  }
1690
1693
  if (parent.type !== 'configurable') {
1691
- throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, `Variants can only be added to configurable Products; this Product is ${parent.type}.`);
1694
+ // Issue #624 (#86) — the stored product type refuses it: the module's
1695
+ // type-mismatch code, the token naming the rule.
1696
+ throw new HttpError(400, ERROR_CODES.PRODUCT_TYPE_MISMATCH, `Variants can only be added to configurable Products; this Product is ${parent.type}.`, { code: 'variants_need_configurable', productId: parentProductId, productType: parent.type });
1692
1697
  }
1693
1698
  // SKU uniqueness MUST hold across both products and variants — among live
1694
1699
  // rows: a deleted product does not hold its SKU (issue #693).
@@ -1849,7 +1854,10 @@ export class CatalogAdminService {
1849
1854
  .map((r) => viewByDefinitionId.get(r.custom_field_definition_id))
1850
1855
  .filter((v) => v !== undefined), mergedAttributeValues);
1851
1856
  if (missing.length > 0) {
1852
- throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, `missing_required_attribute_values: ${missing.join(', ')}`);
1857
+ // Issue #624 (#86) — "required" is the attribute's configuration, and the
1858
+ // values are the stored ones merged with the patch: a refusal of its own.
1859
+ // The keys travel joined, because only a scalar fills a placeholder.
1860
+ throw new HttpError(400, ERROR_CODES.ATTRIBUTE_VALUES_REQUIRED, `Required attributes have no value: ${missing.join(', ')}.`, { attributeKeys: missing.join(', ') });
1853
1861
  }
1854
1862
  }
1855
1863
  /**
@@ -1948,9 +1956,11 @@ export class CatalogAdminService {
1948
1956
  /**
1949
1957
  * Feature 155 (FR-001, threat F5, D5) — a pieces minimum is an integer in
1950
1958
  * 1…1 000 000 and only a `simple` or `configurable` product may carry one;
1951
- * `null` (clear) and an absent key are always allowed. Refused
1952
- * `422 VALIDATION_FAILED` with `details.field`, the answer an in-process caller
1953
- * gets where no route schema stood in front of it.
1959
+ * `null` (clear) and an absent key are always allowed. Refused with
1960
+ * `details.field`, the answer an in-process caller gets where no route schema
1961
+ * stood in front of it: a value out of range is `422 VALIDATION_FAILED`, a type
1962
+ * that takes no minimum `422 MIN_ORDER_QUANTITY_NOT_SUPPORTED_FOR_TYPE` (issue
1963
+ * #624, #86 — the product's type refuses it, not the value).
1954
1964
  */
1955
1965
  function assertOrderMinimumAllowed(type, value) {
1956
1966
  if (value === undefined || value === null)
@@ -1959,7 +1969,7 @@ function assertOrderMinimumAllowed(type, value) {
1959
1969
  throw new HttpError(422, ERROR_CODES.VALIDATION_FAILED, 'The minimum order quantity must be a whole number from 1 to 1000000.', { field: 'minOrderQuantity' });
1960
1970
  }
1961
1971
  if (!isOrderMinimumEligibleType(type)) {
1962
- throw new HttpError(422, ERROR_CODES.VALIDATION_FAILED, `A minimum order quantity applies to simple or configurable products only; got "${type}".`, { field: 'minOrderQuantity' });
1972
+ throw new HttpError(422, ERROR_CODES.MIN_ORDER_QUANTITY_NOT_SUPPORTED_FOR_TYPE, `A minimum order quantity applies to simple or configurable products only; got "${type}".`, { field: 'minOrderQuantity', productType: type });
1963
1973
  }
1964
1974
  }
1965
1975
  //# sourceMappingURL=catalog-admin.service.js.map
@@ -174,6 +174,8 @@ export class CatalogAttributeReadService {
174
174
  labelDefault: definition.labelDefault,
175
175
  valueType,
176
176
  isRequired: definition.required,
177
+ // Feature 175 — `?? 'edit'`: a definition published before the attribute existed.
178
+ adminAccess: definition.adminAccess ?? 'edit',
177
179
  options: options.map((o) => ({
178
180
  id: o.id,
179
181
  value: o.value,
@@ -52,6 +52,12 @@ export declare class CatalogBulkImportService implements CatalogBulkImportPort {
52
52
  eventBus?: Pick<EventBus, "emit">;
53
53
  /** Feature 174 (T084) — the scoped import's planner deps (`scoped-values-import.ts`). */
54
54
  importDeps?: ScopedImportDeps;
55
+ /**
56
+ * Issue #409 — ask for `VACUUM (ANALYZE)` of `products` / `product_variants`
57
+ * once a products import wrote (the `catalog.table-maintenance` queue).
58
+ * Never throws; absent in a composition with no queue.
59
+ */
60
+ requestTableMaintenance?: () => Promise<unknown>;
55
61
  } | undefined,
56
62
  /**
57
63
  * Feature 172 (FR-041) — the attribute read that says which keys are Page
@@ -200,6 +200,8 @@ export class CatalogBulkImportService {
200
200
  errors.push({ index, reason: `${error.code}: ${error.message}` });
201
201
  }
202
202
  }
203
+ if (!options.dryRun && imported > 0)
204
+ await this.scoped?.requestTableMaintenance?.();
203
205
  return { imported, errors, ...(fieldErrors.length > 0 ? { fieldErrors } : {}) };
204
206
  }
205
207
  /**
@@ -3,7 +3,7 @@ import { Product } from '../entities/product.entity.js';
3
3
  import type { CatalogAttributeReadService, CatalogAttributeView } from './catalog-attribute-read.service.js';
4
4
  import type { ProductLinkService } from './product-link.service.js';
5
5
  import { type ChannelScopeRows } from './product-availability.service.js';
6
- import { type AssetReadPort, type CategoryNode, type CategoryPageContent, type CustomFieldDefinitionReadPort, type FilterDefinition, type ListingPriceOrderPort, type ListingPriceDetailPort, type OrganizationDetailsPort, type OverrideRow, type ProductAudience, type ProductDetail, type ProductPageContentAttribute, type ProductListSort, type ProductSummary, type SeoProductMetaValues } from '@endora-commerce/contracts';
6
+ import { type DisplayMode, type AssetReadPort, type CategoryNode, type CategoryPageContent, type CustomFieldDefinitionReadPort, type FilterDefinition, type ListingPriceOrderPort, type ListingPriceDetailPort, type OrganizationDetailsPort, type OverrideRow, type ProductAudience, type ProductDetail, type ProductPageContentAttribute, type ProductListSort, type ProductSummary, type SeoProductMetaValues } from '@endora-commerce/contracts';
7
7
  import type { SalesChannelMembershipPort } from '@endora-commerce/platform/kernel';
8
8
  /**
9
9
  * Moved to `page-builder-content.ts` by feature 172, with the rest of the Page
@@ -83,6 +83,15 @@ export interface CatalogQueryContext {
83
83
  * so a page cannot be priced in one currency and ordered in another.
84
84
  */
85
85
  currency?: string | undefined;
86
+ /**
87
+ * Issue #420 — the page-level display mode the caller has **already**
88
+ * resolved for this viewer, when it has one. The public listing route asks
89
+ * it to decide whether to offer the price controls at all and hands the
90
+ * answer on, so a price request does not resolve it twice. Absent, the
91
+ * service resolves it itself before a price sort or a price range — the
92
+ * refusal never depends on a caller remembering to ask.
93
+ */
94
+ pageDisplayMode?: DisplayMode | undefined;
86
95
  }
87
96
  /**
88
97
  * The two reads a listing card needs beyond the product row and its price:
@@ -444,6 +444,26 @@ export class CatalogQueryService {
444
444
  }
445
445
  return this.listingPriceOrder;
446
446
  }
447
+ /**
448
+ * Issue #420 — a price sort or a price range on a page whose display mode is
449
+ * `none` for this viewer is a `400 PRICE_ORDERING_UNAVAILABLE`, here and not
450
+ * only at the public route (feature 086, FR-016). The route asks the same
451
+ * question to decide whether to offer the controls at all; this is the
452
+ * defence in depth that keeps a caller which skips the route — an internal
453
+ * one, a future one — from narrowing a range step by step until it has
454
+ * inferred the prices the page withholds. Resolved for the viewer the page's
455
+ * prices and order are resolved for ({@link #viewerPricingContext}).
456
+ */
457
+ async #refusePriceControlsWherePricesHidden(ctx) {
458
+ const mode = ctx.pageDisplayMode ??
459
+ (await this.#requireListingPriceOrder().pageDisplayMode({
460
+ context: await this.#viewerPricingContext(ctx),
461
+ }));
462
+ if (mode === 'none') {
463
+ throw new HttpError(400, ERROR_CODES.PRICE_ORDERING_UNAVAILABLE, 'Prices are not displayed on this page, so the catalogue cannot be ordered or filtered by price.');
464
+ }
465
+ return ctx.pageDisplayMode === mode ? ctx : { ...ctx, pageDisplayMode: mode };
466
+ }
447
467
  #requireOrganizationDetails() {
448
468
  if (!this.organizationDetails) {
449
469
  throw new Error('CatalogQueryService: the organization read port is not wired — a signed-in buyer cannot be priced.');
@@ -624,6 +644,12 @@ export class CatalogQueryService {
624
644
  // Products
625
645
  // ------------------------------------------------------------------
626
646
  async listProducts(params, ctx) {
647
+ // Issue #420 — refused before anything is read, the cursor included. The
648
+ // answer travels on with the context, so a walk that re-enters this method
649
+ // (`#listUnordered`) does not resolve it again.
650
+ if (isPriceSort(params.sort) || params.minPrice !== undefined || params.maxPrice !== undefined) {
651
+ ctx = await this.#refusePriceControlsWherePricesHidden(ctx);
652
+ }
627
653
  // A price walk that began in the default order, for want of a price order,
628
654
  // continues in it to its end — the default listing's page, so nothing the
629
655
  // price path would read first is read (review 2, finding 7).
@@ -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
  });
@@ -221,7 +231,10 @@ export class CategoryAdminService {
221
231
  }
222
232
  catch (err) {
223
233
  if (err instanceof UniqueConstraintViolationException) {
224
- 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
+ });
225
238
  }
226
239
  throw err;
227
240
  }
@@ -251,7 +264,7 @@ export class CategoryAdminService {
251
264
  throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Category not found.');
252
265
  const childCount = await em.count(Category, { parentCategoryId: id, deletedAt: null });
253
266
  if (childCount > 0) {
254
- 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 });
255
268
  }
256
269
  cat.deletedAt = new Date();
257
270
  return { result: cat, before: { name: cat.name, slug: cat.slug }, after: { deletedAt: cat.deletedAt } };
@@ -341,7 +354,10 @@ export class CategoryAdminService {
341
354
  const seen = new Set();
342
355
  while (cursor) {
343
356
  if (cursor === movedId) {
344
- 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
+ });
345
361
  }
346
362
  if (seen.has(cursor))
347
363
  break; // defensive guard against pre-existing cycles