@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.
- package/dist/admin/components/CopyToChannelsDialog.d.ts +37 -0
- package/dist/admin/components/CopyToChannelsDialog.js +83 -0
- package/dist/admin/components/PackagingUnitsEditor.d.ts +13 -4
- package/dist/admin/components/PackagingUnitsEditor.js +21 -85
- package/dist/admin/components/ProductAttachmentsSection.d.ts +1 -3
- package/dist/admin/components/ProductAttachmentsSection.js +59 -98
- package/dist/admin/components/ProductAttributesTab.d.ts +1 -11
- package/dist/admin/components/ProductAttributesTab.js +128 -119
- package/dist/admin/components/ProductContentCard.d.ts +41 -0
- package/dist/admin/components/ProductContentCard.js +28 -0
- package/dist/admin/components/ProductEditorSaveAction.d.ts +22 -0
- package/dist/admin/components/ProductEditorSaveAction.js +23 -0
- package/dist/admin/components/ProductGallerySection.d.ts +2 -13
- package/dist/admin/components/ProductGallerySection.js +98 -354
- package/dist/admin/components/ProductInventoryTab.d.ts +12 -1
- package/dist/admin/components/ProductInventoryTab.js +52 -115
- package/dist/admin/components/ProductOrderRulesCard.d.ts +11 -15
- package/dist/admin/components/ProductOrderRulesCard.js +15 -268
- package/dist/admin/components/ProductScopeBar.d.ts +34 -0
- package/dist/admin/components/ProductScopeBar.js +70 -0
- package/dist/admin/components/ProductScopeOverview.d.ts +13 -1
- package/dist/admin/components/ProductScopeOverview.js +56 -37
- package/dist/admin/components/ProductUrlRedirects.d.ts +15 -0
- package/dist/admin/components/ProductUrlRedirects.js +70 -0
- package/dist/admin/components/ProductsBulkEditDialog.js +4 -3
- package/dist/admin/components/editor/DetailsTab.d.ts +30 -0
- package/dist/admin/components/editor/DetailsTab.js +60 -0
- package/dist/admin/components/editor/SectionHeading.d.ts +22 -0
- package/dist/admin/components/editor/SectionHeading.js +19 -0
- package/dist/admin/components/editor/confirm-removal.d.ts +13 -0
- package/dist/admin/components/editor/confirm-removal.js +33 -0
- package/dist/admin/components/editor/editor-context.d.ts +55 -0
- package/dist/admin/components/editor/editor-context.js +88 -0
- package/dist/admin/components/editor/scoped-controls.d.ts +46 -0
- package/dist/admin/components/editor/scoped-controls.js +64 -0
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +11 -0
- package/dist/admin/lib/attribute-scope.d.ts +17 -14
- package/dist/admin/lib/attribute-scope.js +12 -9
- package/dist/admin/lib/bulk-result-outcome.d.ts +14 -0
- package/dist/admin/lib/bulk-result-outcome.js +13 -0
- package/dist/admin/lib/editor-scope.d.ts +35 -0
- package/dist/admin/lib/editor-scope.js +114 -0
- package/dist/admin/lib/order-minimum-input.d.ts +13 -0
- package/dist/admin/lib/order-minimum-input.js +16 -0
- package/dist/admin/lib/product-labels.d.ts +0 -2
- package/dist/admin/lib/product-labels.js +1 -5
- package/dist/admin/lib/product-scopes-api.d.ts +5 -22
- package/dist/admin/lib/product-scopes-api.js +4 -48
- package/dist/admin/lib/product-url-keys-api.d.ts +4 -27
- package/dist/admin/lib/product-url-keys-api.js +1 -50
- package/dist/admin/lib/scope-overview.d.ts +13 -14
- package/dist/admin/lib/scope-overview.js +36 -31
- package/dist/admin/lib/scoped-editor-store.d.ts +81 -0
- package/dist/admin/lib/scoped-editor-store.js +198 -0
- package/dist/admin/lib/scoped-values-api.d.ts +14 -0
- package/dist/admin/lib/scoped-values-api.js +55 -0
- package/dist/admin/pages/AttachmentTypesPage.js +14 -4
- package/dist/admin/pages/AttributeSetsPage.js +11 -4
- package/dist/admin/pages/AttributesManager.js +130 -40
- package/dist/admin/pages/BulkOperationDetailPage.js +11 -4
- package/dist/admin/pages/CategoriesTree.d.ts +5 -0
- package/dist/admin/pages/CategoriesTree.js +226 -40
- package/dist/admin/pages/ProductContentPage.d.ts +27 -0
- package/dist/admin/pages/ProductContentPage.js +161 -0
- package/dist/admin/pages/ProductCreateForm.d.ts +3 -0
- package/dist/admin/pages/ProductCreateForm.js +87 -0
- package/dist/admin/pages/ProductEditor.js +938 -458
- package/dist/admin/pages/ProductsList.js +33 -38
- package/dist/backend/admin-search-provider.d.ts +2 -1
- package/dist/backend/admin-search-provider.js +1 -1
- package/dist/backend/commands/attribute-commands.d.ts +4 -3
- package/dist/backend/commands/attribute-commands.js +137 -30
- package/dist/backend/commands/product-content-commands.d.ts +31 -0
- package/dist/backend/commands/product-content-commands.js +70 -0
- package/dist/backend/commands/scoped-values.commands.d.ts +95 -0
- package/dist/backend/commands/scoped-values.commands.js +235 -0
- package/dist/backend/demo/reset.js +2 -1
- package/dist/backend/demo/rows.d.ts +18 -0
- package/dist/backend/demo/rows.js +18 -0
- package/dist/backend/demo/seed.d.ts +2 -1
- package/dist/backend/demo/seed.js +20 -6
- package/dist/backend/entities/gallery-item-scope-override.entity.d.ts +30 -0
- package/dist/backend/entities/gallery-item-scope-override.entity.js +80 -0
- package/dist/backend/entities/gallery-item.entity.d.ts +7 -6
- package/dist/backend/entities/gallery-item.entity.js +11 -6
- package/dist/backend/entities/gallery-role-scope-override.entity.d.ts +28 -0
- package/dist/backend/entities/gallery-role-scope-override.entity.js +75 -0
- package/dist/backend/entities/product-attachment-scope-override.entity.d.ts +30 -0
- package/dist/backend/entities/product-attachment-scope-override.entity.js +80 -0
- package/dist/backend/entities/product-attachment.entity.d.ts +4 -6
- package/dist/backend/entities/product-attachment.entity.js +6 -12
- package/dist/backend/entities/product-attribute.entity.d.ts +5 -9
- package/dist/backend/entities/product-attribute.entity.js +5 -13
- package/dist/backend/entities/product-channel-scope.entity.d.ts +7 -2
- package/dist/backend/entities/product-channel-scope.entity.js +10 -1
- package/dist/backend/entities/product-content-value.entity.d.ts +39 -0
- package/dist/backend/entities/product-content-value.entity.js +81 -0
- package/dist/backend/entities/product-packaging-unit-scope-override.entity.d.ts +30 -0
- package/dist/backend/entities/product-packaging-unit-scope-override.entity.js +80 -0
- package/dist/backend/entities/product-packaging-unit.entity.d.ts +1 -7
- package/dist/backend/entities/product-packaging-unit.entity.js +0 -10
- package/dist/backend/entities/product-url-key.entity.d.ts +14 -19
- package/dist/backend/entities/product-url-key.entity.js +17 -22
- package/dist/backend/entities/product-url-redirect.entity.d.ts +8 -13
- package/dist/backend/entities/product-url-redirect.entity.js +13 -14
- package/dist/backend/entities/product-variant.entity.d.ts +8 -1
- package/dist/backend/entities/product-variant.entity.js +13 -2
- package/dist/backend/entities/product.entity.d.ts +31 -14
- package/dist/backend/entities/product.entity.js +41 -34
- package/dist/backend/index.d.ts +11 -3
- package/dist/backend/index.js +155 -49
- package/dist/backend/plugin.d.ts +36 -6
- package/dist/backend/plugin.js +36 -13
- package/dist/backend/prompt-tools.d.ts +3 -2
- package/dist/backend/prompt-tools.js +18 -7
- package/dist/backend/routes.admin.d.ts +15 -16
- package/dist/backend/routes.admin.js +122 -103
- package/dist/backend/routes.api-key.js +4 -2
- package/dist/backend/routes.external.js +3 -2
- package/dist/backend/routes.public.d.ts +8 -1
- package/dist/backend/routes.public.js +68 -11
- package/dist/backend/services/asset-references.d.ts +12 -1
- package/dist/backend/services/asset-references.js +42 -2
- package/dist/backend/services/attachment-packaging-scopes.d.ts +38 -20
- package/dist/backend/services/attachment-packaging-scopes.js +58 -75
- package/dist/backend/services/attachment.service.d.ts +4 -8
- package/dist/backend/services/attachment.service.js +35 -49
- package/dist/backend/services/attribute-filter-match.d.ts +14 -0
- package/dist/backend/services/attribute-filter-match.js +19 -0
- package/dist/backend/services/attribute-scope-preview.d.ts +17 -7
- package/dist/backend/services/attribute-scope-preview.js +30 -20
- package/dist/backend/services/attribute-set.service.d.ts +10 -1
- package/dist/backend/services/attribute-set.service.js +30 -4
- package/dist/backend/services/attribute-type-mapping.d.ts +2 -2
- package/dist/backend/services/attribute-type-mapping.js +6 -0
- package/dist/backend/services/attribute-usage.d.ts +31 -0
- package/dist/backend/services/attribute-usage.js +29 -0
- package/dist/backend/services/bulk-operation.service.d.ts +1 -1
- package/dist/backend/services/bulk-operation.service.js +16 -6
- package/dist/backend/services/bundle.service.js +19 -1
- package/dist/backend/services/catalog-admin-search.service.d.ts +3 -2
- package/dist/backend/services/catalog-admin-search.service.js +6 -6
- package/dist/backend/services/catalog-admin.service.d.ts +63 -12
- package/dist/backend/services/catalog-admin.service.js +368 -195
- package/dist/backend/services/catalog-attribute-read.service.d.ts +14 -0
- package/dist/backend/services/catalog-attribute-read.service.js +9 -19
- package/dist/backend/services/catalog-bulk-import.service.d.ts +58 -5
- package/dist/backend/services/catalog-bulk-import.service.js +192 -142
- package/dist/backend/services/catalog-bulk-update.service.d.ts +5 -3
- package/dist/backend/services/catalog-bulk-update.service.js +21 -8
- package/dist/backend/services/catalog-product-read.service.d.ts +11 -1
- package/dist/backend/services/catalog-product-read.service.js +37 -17
- package/dist/backend/services/catalog-query.service.d.ts +48 -8
- package/dist/backend/services/catalog-query.service.js +180 -116
- package/dist/backend/services/catalog-quick-search.service.js +5 -5
- package/dist/backend/services/catalog-write-ports.d.ts +14 -16
- package/dist/backend/services/catalog-write-ports.js +11 -70
- package/dist/backend/services/category-admin.service.js +29 -5
- package/dist/backend/services/content-attribute-rules.d.ts +61 -0
- package/dist/backend/services/content-attribute-rules.js +102 -0
- package/dist/backend/services/effective-value.sql.d.ts +24 -38
- package/dist/backend/services/effective-value.sql.js +37 -87
- package/dist/backend/services/gallery-scopes.d.ts +45 -22
- package/dist/backend/services/gallery-scopes.js +116 -109
- package/dist/backend/services/gallery.service.d.ts +13 -27
- package/dist/backend/services/gallery.service.js +75 -199
- package/dist/backend/services/grouped.service.js +20 -3
- package/dist/backend/services/packaging-unit.service.js +7 -12
- package/dist/backend/services/page-builder-content.d.ts +64 -0
- package/dist/backend/services/page-builder-content.js +113 -0
- package/dist/backend/services/primary-asset-url.d.ts +6 -1
- package/dist/backend/services/primary-asset-url.js +9 -4
- package/dist/backend/services/product-availability.service.d.ts +16 -3
- package/dist/backend/services/product-availability.service.js +58 -21
- package/dist/backend/services/product-content.service.d.ts +62 -0
- package/dist/backend/services/product-content.service.js +122 -0
- package/dist/backend/services/product-editor-preferences.service.d.ts +6 -0
- package/dist/backend/services/product-editor-preferences.service.js +12 -0
- package/dist/backend/services/product-global-field-rules.d.ts +39 -0
- package/dist/backend/services/product-global-field-rules.js +84 -0
- package/dist/backend/services/product-link.service.js +14 -16
- package/dist/backend/services/product-list-view-service.js +5 -8
- package/dist/backend/services/product-page-revalidation.d.ts +9 -0
- package/dist/backend/services/product-page-revalidation.js +19 -0
- package/dist/backend/services/product-scopes.service.d.ts +18 -8
- package/dist/backend/services/product-scopes.service.js +91 -36
- package/dist/backend/services/product-value-resolver.service.d.ts +2 -2
- package/dist/backend/services/product-value-resolver.service.js +4 -7
- package/dist/backend/services/publication-window-sweep.d.ts +61 -7
- package/dist/backend/services/publication-window-sweep.js +106 -19
- package/dist/backend/services/scheduled-work-probe.d.ts +34 -0
- package/dist/backend/services/scheduled-work-probe.js +30 -0
- package/dist/backend/services/scope-completeness.d.ts +11 -11
- package/dist/backend/services/scope-completeness.js +26 -33
- package/dist/backend/services/scope-overview.service.d.ts +24 -24
- package/dist/backend/services/scope-overview.service.js +33 -76
- package/dist/backend/services/scoped-store-adapters.d.ts +58 -0
- package/dist/backend/services/scoped-store-adapters.js +92 -0
- package/dist/backend/services/scoped-values-global-only.d.ts +36 -0
- package/dist/backend/services/scoped-values-global-only.js +92 -0
- package/dist/backend/services/scoped-values-import.d.ts +86 -0
- package/dist/backend/services/scoped-values-import.js +320 -0
- package/dist/backend/services/scoped-values-read.service.d.ts +56 -0
- package/dist/backend/services/scoped-values-read.service.js +289 -0
- package/dist/backend/services/scoped-values-save.service.d.ts +79 -0
- package/dist/backend/services/scoped-values-save.service.js +675 -0
- package/dist/backend/services/scoped-values-state.d.ts +94 -0
- package/dist/backend/services/scoped-values-state.js +159 -0
- package/dist/backend/services/scoped-values.service.d.ts +36 -0
- package/dist/backend/services/scoped-values.service.js +92 -0
- package/dist/backend/services/storefront-value-overrides.d.ts +7 -8
- package/dist/backend/services/storefront-value-overrides.js +11 -14
- package/dist/backend/services/table-maintenance-queue.d.ts +78 -0
- package/dist/backend/services/table-maintenance-queue.js +97 -0
- package/dist/backend/services/url-key-resolution.service.d.ts +12 -18
- package/dist/backend/services/url-key-resolution.service.js +43 -43
- package/dist/backend/services/url-key.service.d.ts +87 -135
- package/dist/backend/services/url-key.service.js +447 -619
- package/dist/manifest.d.ts +51 -1
- package/dist/manifest.js +111 -7
- package/dist/migrations/20261030T113855_catalog_scope_model_texts.d.ts +36 -0
- package/dist/migrations/20261030T113855_catalog_scope_model_texts.js +225 -0
- package/dist/migrations/20261030T113859_catalog_scope_model_order_rules.d.ts +18 -0
- package/dist/migrations/20261030T113859_catalog_scope_model_order_rules.js +39 -0
- package/dist/migrations/20261030T113904_catalog_scope_model_url_keys.d.ts +6 -0
- package/dist/migrations/20261030T113904_catalog_scope_model_url_keys.js +119 -0
- package/dist/migrations/20261030T113908_catalog_scope_model_media.d.ts +6 -0
- package/dist/migrations/20261030T113908_catalog_scope_model_media.js +185 -0
- package/dist/migrations/20261104T121504_catalog_product_content_values.d.ts +36 -0
- package/dist/migrations/20261104T121504_catalog_product_content_values.js +53 -0
- package/dist/migrations/20261107T093126_catalog_sku_unique_among_live.d.ts +33 -0
- package/dist/migrations/20261107T093126_catalog_sku_unique_among_live.js +58 -0
- package/dist/migrations/20261107T120008_catalog_product_created_at_milliseconds.d.ts +36 -0
- package/dist/migrations/20261107T120008_catalog_product_created_at_milliseconds.js +40 -0
- package/dist/migrations/20261114T000706_catalog_category_main_image.d.ts +37 -0
- package/dist/migrations/20261114T000706_catalog_category_main_image.js +56 -0
- package/dist/migrations/index.d.ts +9 -1
- package/dist/migrations/index.js +17 -1
- package/docs/catalog/attachments.md +53 -43
- package/docs/catalog/attribute-sets.md +3 -2
- package/docs/catalog/attributes.md +99 -25
- package/docs/catalog/category-content.md +9 -3
- package/docs/catalog/composite-products.md +5 -3
- package/docs/catalog/editing-a-product-at-a-scope.md +151 -0
- package/docs/catalog/gallery-and-labels.md +61 -60
- package/docs/catalog/packaging-units.md +43 -34
- package/docs/catalog/per-channel-per-language-overrides.md +83 -410
- package/docs/catalog/product-content.md +184 -0
- package/docs/catalog/product-links.md +2 -2
- package/docs/catalog/url-keys-and-redirects.md +79 -79
- package/docs/catalog.md +113 -31
- package/i18n/en.json +317 -274
- package/i18n/pl.json +319 -276
- package/package.json +13 -12
- package/dist/admin/components/AttachmentScopesDialog.d.ts +0 -22
- package/dist/admin/components/AttachmentScopesDialog.d.ts.map +0 -1
- package/dist/admin/components/AttachmentScopesDialog.js +0 -70
- package/dist/admin/components/AttachmentScopesDialog.js.map +0 -1
- package/dist/admin/components/PackagingUnitsEditor.d.ts.map +0 -1
- package/dist/admin/components/PackagingUnitsEditor.js.map +0 -1
- package/dist/admin/components/ProductAttachmentsSection.d.ts.map +0 -1
- package/dist/admin/components/ProductAttachmentsSection.js.map +0 -1
- package/dist/admin/components/ProductAttributesTab.d.ts.map +0 -1
- package/dist/admin/components/ProductAttributesTab.js.map +0 -1
- package/dist/admin/components/ProductGallerySection.d.ts.map +0 -1
- package/dist/admin/components/ProductGallerySection.js.map +0 -1
- package/dist/admin/components/ProductInventoryTab.d.ts.map +0 -1
- package/dist/admin/components/ProductInventoryTab.js.map +0 -1
- package/dist/admin/components/ProductOrderRulesCard.d.ts.map +0 -1
- package/dist/admin/components/ProductOrderRulesCard.js.map +0 -1
- package/dist/admin/components/ProductScopeControls.d.ts +0 -31
- package/dist/admin/components/ProductScopeControls.d.ts.map +0 -1
- package/dist/admin/components/ProductScopeControls.js +0 -243
- package/dist/admin/components/ProductScopeControls.js.map +0 -1
- package/dist/admin/components/ProductScopeEditor.d.ts +0 -88
- package/dist/admin/components/ProductScopeEditor.d.ts.map +0 -1
- package/dist/admin/components/ProductScopeEditor.js +0 -396
- package/dist/admin/components/ProductScopeEditor.js.map +0 -1
- package/dist/admin/components/ProductScopeOverview.d.ts.map +0 -1
- package/dist/admin/components/ProductScopeOverview.js.map +0 -1
- package/dist/admin/components/ProductStatusPills.d.ts.map +0 -1
- package/dist/admin/components/ProductStatusPills.js.map +0 -1
- package/dist/admin/components/ProductUrlKeysPanel.d.ts +0 -17
- package/dist/admin/components/ProductUrlKeysPanel.d.ts.map +0 -1
- package/dist/admin/components/ProductUrlKeysPanel.js +0 -215
- package/dist/admin/components/ProductUrlKeysPanel.js.map +0 -1
- package/dist/admin/components/ProductsBulkEditDialog.d.ts.map +0 -1
- package/dist/admin/components/ProductsBulkEditDialog.js.map +0 -1
- package/dist/admin/components/ScopedDialogParts.d.ts +0 -23
- package/dist/admin/components/ScopedDialogParts.d.ts.map +0 -1
- package/dist/admin/components/ScopedDialogParts.js +0 -16
- package/dist/admin/components/ScopedDialogParts.js.map +0 -1
- package/dist/admin/index.d.ts.map +0 -1
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/lib/attribute-scope.d.ts.map +0 -1
- package/dist/admin/lib/attribute-scope.js.map +0 -1
- package/dist/admin/lib/bulk-operation-log-text.d.ts.map +0 -1
- package/dist/admin/lib/bulk-operation-log-text.js.map +0 -1
- package/dist/admin/lib/media-scopes.d.ts +0 -41
- package/dist/admin/lib/media-scopes.d.ts.map +0 -1
- package/dist/admin/lib/media-scopes.js +0 -66
- package/dist/admin/lib/media-scopes.js.map +0 -1
- package/dist/admin/lib/product-labels.d.ts.map +0 -1
- package/dist/admin/lib/product-labels.js.map +0 -1
- package/dist/admin/lib/product-scope-drafts.d.ts +0 -77
- package/dist/admin/lib/product-scope-drafts.d.ts.map +0 -1
- package/dist/admin/lib/product-scope-drafts.js +0 -133
- package/dist/admin/lib/product-scope-drafts.js.map +0 -1
- package/dist/admin/lib/product-scopes-api.d.ts.map +0 -1
- package/dist/admin/lib/product-scopes-api.js.map +0 -1
- package/dist/admin/lib/product-url-keys-api.d.ts.map +0 -1
- package/dist/admin/lib/product-url-keys-api.js.map +0 -1
- package/dist/admin/lib/resolve-product-selection.d.ts.map +0 -1
- package/dist/admin/lib/resolve-product-selection.js.map +0 -1
- package/dist/admin/lib/scope-overview.d.ts.map +0 -1
- package/dist/admin/lib/scope-overview.js.map +0 -1
- package/dist/admin/pages/AttachmentTypesPage.d.ts.map +0 -1
- package/dist/admin/pages/AttachmentTypesPage.js.map +0 -1
- package/dist/admin/pages/AttributeSetsPage.d.ts.map +0 -1
- package/dist/admin/pages/AttributeSetsPage.js.map +0 -1
- package/dist/admin/pages/AttributesManager.d.ts.map +0 -1
- package/dist/admin/pages/AttributesManager.js.map +0 -1
- package/dist/admin/pages/BulkOperationDetailPage.d.ts.map +0 -1
- package/dist/admin/pages/BulkOperationDetailPage.js.map +0 -1
- package/dist/admin/pages/BulkOperationsPage.d.ts.map +0 -1
- package/dist/admin/pages/BulkOperationsPage.js.map +0 -1
- package/dist/admin/pages/CategoriesTree.d.ts.map +0 -1
- package/dist/admin/pages/CategoriesTree.js.map +0 -1
- package/dist/admin/pages/CategoryContentPage.d.ts.map +0 -1
- package/dist/admin/pages/CategoryContentPage.js.map +0 -1
- package/dist/admin/pages/ProductEditor.d.ts.map +0 -1
- package/dist/admin/pages/ProductEditor.js.map +0 -1
- package/dist/admin/pages/ProductsList.d.ts.map +0 -1
- package/dist/admin/pages/ProductsList.js.map +0 -1
- package/dist/backend/admin-search-provider.d.ts.map +0 -1
- package/dist/backend/admin-search-provider.js.map +0 -1
- package/dist/backend/commands/attribute-commands.d.ts.map +0 -1
- package/dist/backend/commands/attribute-commands.js.map +0 -1
- package/dist/backend/demo/reset.d.ts.map +0 -1
- package/dist/backend/demo/reset.js.map +0 -1
- package/dist/backend/demo/rows.d.ts.map +0 -1
- package/dist/backend/demo/rows.js.map +0 -1
- package/dist/backend/demo/seed.d.ts.map +0 -1
- package/dist/backend/demo/seed.js.map +0 -1
- package/dist/backend/entities/attachment-type.entity.d.ts.map +0 -1
- package/dist/backend/entities/attachment-type.entity.js.map +0 -1
- package/dist/backend/entities/attribute-set-attribute.entity.d.ts.map +0 -1
- package/dist/backend/entities/attribute-set-attribute.entity.js.map +0 -1
- package/dist/backend/entities/attribute-set.entity.d.ts.map +0 -1
- package/dist/backend/entities/attribute-set.entity.js.map +0 -1
- package/dist/backend/entities/bulk-operation.entity.d.ts.map +0 -1
- package/dist/backend/entities/bulk-operation.entity.js.map +0 -1
- package/dist/backend/entities/bundle-slot-option.entity.d.ts.map +0 -1
- package/dist/backend/entities/bundle-slot-option.entity.js.map +0 -1
- package/dist/backend/entities/bundle-slot.entity.d.ts.map +0 -1
- package/dist/backend/entities/bundle-slot.entity.js.map +0 -1
- package/dist/backend/entities/category.entity.d.ts.map +0 -1
- package/dist/backend/entities/category.entity.js.map +0 -1
- package/dist/backend/entities/gallery-item-channel-hidden.entity.d.ts +0 -14
- package/dist/backend/entities/gallery-item-channel-hidden.entity.d.ts.map +0 -1
- package/dist/backend/entities/gallery-item-channel-hidden.entity.js +0 -42
- package/dist/backend/entities/gallery-item-channel-hidden.entity.js.map +0 -1
- package/dist/backend/entities/gallery-item-channel-label.entity.d.ts +0 -18
- package/dist/backend/entities/gallery-item-channel-label.entity.d.ts.map +0 -1
- package/dist/backend/entities/gallery-item-channel-label.entity.js +0 -49
- package/dist/backend/entities/gallery-item-channel-label.entity.js.map +0 -1
- package/dist/backend/entities/gallery-item-label.entity.d.ts.map +0 -1
- package/dist/backend/entities/gallery-item-label.entity.js.map +0 -1
- package/dist/backend/entities/gallery-item.entity.d.ts.map +0 -1
- package/dist/backend/entities/gallery-item.entity.js.map +0 -1
- package/dist/backend/entities/grouped-item.entity.d.ts.map +0 -1
- package/dist/backend/entities/grouped-item.entity.js.map +0 -1
- package/dist/backend/entities/product-attachment-channel-hidden.entity.d.ts +0 -13
- package/dist/backend/entities/product-attachment-channel-hidden.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-attachment-channel-hidden.entity.js +0 -41
- package/dist/backend/entities/product-attachment-channel-hidden.entity.js.map +0 -1
- package/dist/backend/entities/product-attachment.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-attachment.entity.js.map +0 -1
- package/dist/backend/entities/product-attribute.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-attribute.entity.js.map +0 -1
- package/dist/backend/entities/product-channel-language-scope.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-channel-language-scope.entity.js.map +0 -1
- package/dist/backend/entities/product-channel-scope.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-channel-scope.entity.js.map +0 -1
- package/dist/backend/entities/product-editor-preference.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-editor-preference.entity.js.map +0 -1
- package/dist/backend/entities/product-link.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-link.entity.js.map +0 -1
- package/dist/backend/entities/product-list-saved-view.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-list-saved-view.entity.js.map +0 -1
- package/dist/backend/entities/product-packaging-unit.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-packaging-unit.entity.js.map +0 -1
- package/dist/backend/entities/product-url-key.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-url-key.entity.js.map +0 -1
- package/dist/backend/entities/product-url-redirect.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-url-redirect.entity.js.map +0 -1
- package/dist/backend/entities/product-value-override.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-value-override.entity.js.map +0 -1
- package/dist/backend/entities/product-variant.entity.d.ts.map +0 -1
- package/dist/backend/entities/product-variant.entity.js.map +0 -1
- package/dist/backend/entities/product.entity.d.ts.map +0 -1
- package/dist/backend/entities/product.entity.js.map +0 -1
- package/dist/backend/index.d.ts.map +0 -1
- package/dist/backend/index.js.map +0 -1
- package/dist/backend/plugin.d.ts.map +0 -1
- package/dist/backend/plugin.js.map +0 -1
- package/dist/backend/prompt-tools.d.ts.map +0 -1
- package/dist/backend/prompt-tools.js.map +0 -1
- package/dist/backend/routes.admin.d.ts.map +0 -1
- package/dist/backend/routes.admin.js.map +0 -1
- package/dist/backend/routes.admin.url-keys.d.ts.map +0 -1
- package/dist/backend/routes.admin.url-keys.js.map +0 -1
- package/dist/backend/routes.api-key.d.ts.map +0 -1
- package/dist/backend/routes.api-key.js.map +0 -1
- package/dist/backend/routes.external.d.ts.map +0 -1
- package/dist/backend/routes.external.js.map +0 -1
- package/dist/backend/routes.public.d.ts.map +0 -1
- package/dist/backend/routes.public.js.map +0 -1
- package/dist/backend/routes.public.url-keys.d.ts.map +0 -1
- package/dist/backend/routes.public.url-keys.js.map +0 -1
- package/dist/backend/saved-view-actor.d.ts.map +0 -1
- package/dist/backend/saved-view-actor.js.map +0 -1
- package/dist/backend/services/asset-references.d.ts.map +0 -1
- package/dist/backend/services/asset-references.js.map +0 -1
- package/dist/backend/services/attachment-packaging-scopes.d.ts.map +0 -1
- package/dist/backend/services/attachment-packaging-scopes.js.map +0 -1
- package/dist/backend/services/attachment.service.d.ts.map +0 -1
- package/dist/backend/services/attachment.service.js.map +0 -1
- package/dist/backend/services/attribute-option-validator.d.ts.map +0 -1
- package/dist/backend/services/attribute-option-validator.js.map +0 -1
- package/dist/backend/services/attribute-scope-preview.d.ts.map +0 -1
- package/dist/backend/services/attribute-scope-preview.js.map +0 -1
- package/dist/backend/services/attribute-set-validations.d.ts.map +0 -1
- package/dist/backend/services/attribute-set-validations.js.map +0 -1
- package/dist/backend/services/attribute-set.service.d.ts.map +0 -1
- package/dist/backend/services/attribute-set.service.js.map +0 -1
- package/dist/backend/services/attribute-type-mapping.d.ts.map +0 -1
- package/dist/backend/services/attribute-type-mapping.js.map +0 -1
- package/dist/backend/services/attribute-value-key.service.d.ts.map +0 -1
- package/dist/backend/services/attribute-value-key.service.js.map +0 -1
- package/dist/backend/services/audit-references.d.ts.map +0 -1
- package/dist/backend/services/audit-references.js.map +0 -1
- package/dist/backend/services/bulk-operation-queue.d.ts.map +0 -1
- package/dist/backend/services/bulk-operation-queue.js.map +0 -1
- package/dist/backend/services/bulk-operation.service.d.ts.map +0 -1
- package/dist/backend/services/bulk-operation.service.js.map +0 -1
- package/dist/backend/services/bundle.service.d.ts.map +0 -1
- package/dist/backend/services/bundle.service.js.map +0 -1
- package/dist/backend/services/catalog-admin-search.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-admin-search.service.js.map +0 -1
- package/dist/backend/services/catalog-admin.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-admin.service.js.map +0 -1
- package/dist/backend/services/catalog-attribute-read.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-attribute-read.service.js.map +0 -1
- package/dist/backend/services/catalog-bulk-import.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-bulk-import.service.js.map +0 -1
- package/dist/backend/services/catalog-bulk-update.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-bulk-update.service.js.map +0 -1
- package/dist/backend/services/catalog-category-read.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-category-read.service.js.map +0 -1
- package/dist/backend/services/catalog-org-price-decorator.d.ts.map +0 -1
- package/dist/backend/services/catalog-org-price-decorator.js.map +0 -1
- package/dist/backend/services/catalog-product-filter.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-product-filter.service.js.map +0 -1
- package/dist/backend/services/catalog-product-read.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-product-read.service.js.map +0 -1
- package/dist/backend/services/catalog-query.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-query.service.js.map +0 -1
- package/dist/backend/services/catalog-quick-search.service.d.ts.map +0 -1
- package/dist/backend/services/catalog-quick-search.service.js.map +0 -1
- package/dist/backend/services/catalog-write-ports.d.ts.map +0 -1
- package/dist/backend/services/catalog-write-ports.js.map +0 -1
- package/dist/backend/services/category-admin.service.d.ts.map +0 -1
- package/dist/backend/services/category-admin.service.js.map +0 -1
- package/dist/backend/services/channel-url-facts.d.ts.map +0 -1
- package/dist/backend/services/channel-url-facts.js.map +0 -1
- package/dist/backend/services/effective-value.sql.d.ts.map +0 -1
- package/dist/backend/services/effective-value.sql.js.map +0 -1
- package/dist/backend/services/gallery-scopes.d.ts.map +0 -1
- package/dist/backend/services/gallery-scopes.js.map +0 -1
- package/dist/backend/services/gallery.service.d.ts.map +0 -1
- package/dist/backend/services/gallery.service.js.map +0 -1
- package/dist/backend/services/grouped.service.d.ts.map +0 -1
- package/dist/backend/services/grouped.service.js.map +0 -1
- package/dist/backend/services/label-resolver.d.ts.map +0 -1
- package/dist/backend/services/label-resolver.js.map +0 -1
- package/dist/backend/services/linkable-asset.d.ts.map +0 -1
- package/dist/backend/services/linkable-asset.js.map +0 -1
- package/dist/backend/services/packaging-unit.service.d.ts.map +0 -1
- package/dist/backend/services/packaging-unit.service.js.map +0 -1
- package/dist/backend/services/primary-asset-url.d.ts.map +0 -1
- package/dist/backend/services/primary-asset-url.js.map +0 -1
- package/dist/backend/services/product-availability.service.d.ts.map +0 -1
- package/dist/backend/services/product-availability.service.js.map +0 -1
- package/dist/backend/services/product-availability.sql.d.ts.map +0 -1
- package/dist/backend/services/product-availability.sql.js.map +0 -1
- package/dist/backend/services/product-editor-preferences.service.d.ts.map +0 -1
- package/dist/backend/services/product-editor-preferences.service.js.map +0 -1
- package/dist/backend/services/product-link.service.d.ts.map +0 -1
- package/dist/backend/services/product-link.service.js.map +0 -1
- package/dist/backend/services/product-list-view-service.d.ts.map +0 -1
- package/dist/backend/services/product-list-view-service.js.map +0 -1
- package/dist/backend/services/product-overrides.service.d.ts +0 -84
- package/dist/backend/services/product-overrides.service.d.ts.map +0 -1
- package/dist/backend/services/product-overrides.service.js +0 -211
- package/dist/backend/services/product-overrides.service.js.map +0 -1
- package/dist/backend/services/product-page-revalidation.d.ts.map +0 -1
- package/dist/backend/services/product-page-revalidation.js.map +0 -1
- package/dist/backend/services/product-scope-context.service.d.ts +0 -36
- package/dist/backend/services/product-scope-context.service.d.ts.map +0 -1
- package/dist/backend/services/product-scope-context.service.js +0 -107
- package/dist/backend/services/product-scope-context.service.js.map +0 -1
- package/dist/backend/services/product-scopes.service.d.ts.map +0 -1
- package/dist/backend/services/product-scopes.service.js.map +0 -1
- package/dist/backend/services/product-summary-text.d.ts.map +0 -1
- package/dist/backend/services/product-summary-text.js.map +0 -1
- package/dist/backend/services/product-type-validations.d.ts.map +0 -1
- package/dist/backend/services/product-type-validations.js.map +0 -1
- package/dist/backend/services/product-value-resolver.service.d.ts.map +0 -1
- package/dist/backend/services/product-value-resolver.service.js.map +0 -1
- package/dist/backend/services/publication-window-sweep.d.ts.map +0 -1
- package/dist/backend/services/publication-window-sweep.js.map +0 -1
- package/dist/backend/services/scope-completeness.d.ts.map +0 -1
- package/dist/backend/services/scope-completeness.js.map +0 -1
- package/dist/backend/services/scope-overview.service.d.ts.map +0 -1
- package/dist/backend/services/scope-overview.service.js.map +0 -1
- package/dist/backend/services/sql-id-arrays.d.ts.map +0 -1
- package/dist/backend/services/sql-id-arrays.js.map +0 -1
- package/dist/backend/services/storefront-value-overrides.d.ts.map +0 -1
- package/dist/backend/services/storefront-value-overrides.js.map +0 -1
- package/dist/backend/services/system-attribute-scopes.d.ts.map +0 -1
- package/dist/backend/services/system-attribute-scopes.js.map +0 -1
- package/dist/backend/services/url-key-resolution.service.d.ts.map +0 -1
- package/dist/backend/services/url-key-resolution.service.js.map +0 -1
- package/dist/backend/services/url-key.service.d.ts.map +0 -1
- package/dist/backend/services/url-key.service.js.map +0 -1
- package/dist/backend/services/viewer-organization.d.ts.map +0 -1
- package/dist/backend/services/viewer-organization.js.map +0 -1
- package/dist/manifest.d.ts.map +0 -1
- package/dist/manifest.js.map +0 -1
- package/dist/migrations/20260429T064146_catalog_attribute_sets_init.d.ts.map +0 -1
- package/dist/migrations/20260429T064146_catalog_attribute_sets_init.js.map +0 -1
- package/dist/migrations/20260429T070004_catalog_product_attribute_extensions.d.ts.map +0 -1
- package/dist/migrations/20260429T070004_catalog_product_attribute_extensions.js.map +0 -1
- package/dist/migrations/20260429T102322_catalog_product_type_and_virtual_fields.d.ts.map +0 -1
- package/dist/migrations/20260429T102322_catalog_product_type_and_virtual_fields.js.map +0 -1
- package/dist/migrations/20260429T111839_catalog_gallery_items_and_labels.d.ts.map +0 -1
- package/dist/migrations/20260429T111839_catalog_gallery_items_and_labels.js.map +0 -1
- package/dist/migrations/20260429T112543_catalog_product_attachments.d.ts.map +0 -1
- package/dist/migrations/20260429T112543_catalog_product_attachments.js.map +0 -1
- package/dist/migrations/20260429T123726_catalog_product_links.d.ts.map +0 -1
- package/dist/migrations/20260429T123726_catalog_product_links.js.map +0 -1
- package/dist/migrations/20260429T130803_catalog_grouped_and_bundle.d.ts.map +0 -1
- package/dist/migrations/20260429T130803_catalog_grouped_and_bundle.js.map +0 -1
- package/dist/migrations/20260501T185835_catalog_product_attribute_is_comparable.d.ts.map +0 -1
- package/dist/migrations/20260501T185835_catalog_product_attribute_is_comparable.js.map +0 -1
- package/dist/migrations/20260505T060113_catalog_attribute_options_and_flags.d.ts.map +0 -1
- package/dist/migrations/20260505T060113_catalog_attribute_options_and_flags.js.map +0 -1
- package/dist/migrations/20260515T082629_catalog_attribute_mass_editable.d.ts.map +0 -1
- package/dist/migrations/20260515T082629_catalog_attribute_mass_editable.js.map +0 -1
- package/dist/migrations/20260526T124736_catalog_product_status_inactive.d.ts.map +0 -1
- package/dist/migrations/20260526T124736_catalog_product_status_inactive.js.map +0 -1
- package/dist/migrations/20260611T140346_catalog_product_value_overrides_init.d.ts.map +0 -1
- package/dist/migrations/20260611T140346_catalog_product_value_overrides_init.js.map +0 -1
- package/dist/migrations/20260611T140400_catalog_attribute_quick_searchable.d.ts.map +0 -1
- package/dist/migrations/20260611T140400_catalog_attribute_quick_searchable.js.map +0 -1
- package/dist/migrations/20260611T140407_catalog_bulk_operations.d.ts.map +0 -1
- package/dist/migrations/20260611T140407_catalog_bulk_operations.js.map +0 -1
- package/dist/migrations/20260611T140408_catalog_bulk_operation_logs.d.ts.map +0 -1
- package/dist/migrations/20260611T140408_catalog_bulk_operation_logs.js.map +0 -1
- package/dist/migrations/20260611T140412_catalog_product_packaging_units.d.ts.map +0 -1
- package/dist/migrations/20260611T140412_catalog_product_packaging_units.js.map +0 -1
- package/dist/migrations/20260718T060659_catalog_bulk_operation_revert_state.d.ts.map +0 -1
- package/dist/migrations/20260718T060659_catalog_bulk_operation_revert_state.js.map +0 -1
- package/dist/migrations/20260718T200343_catalog_category_custom_field_values.d.ts.map +0 -1
- package/dist/migrations/20260718T200343_catalog_category_custom_field_values.js.map +0 -1
- package/dist/migrations/20260723T230401_catalog_attributes_on_custom_fields.d.ts.map +0 -1
- package/dist/migrations/20260723T230401_catalog_attributes_on_custom_fields.js.map +0 -1
- package/dist/migrations/20260804T152604_catalog_widen_product_sku.d.ts.map +0 -1
- package/dist/migrations/20260804T152604_catalog_widen_product_sku.js.map +0 -1
- package/dist/migrations/20260804T160244_catalog_category_activation.d.ts.map +0 -1
- package/dist/migrations/20260804T160244_catalog_category_activation.js.map +0 -1
- package/dist/migrations/20260912T094557_catalog_sales_channel_products.d.ts.map +0 -1
- package/dist/migrations/20260912T094557_catalog_sales_channel_products.js.map +0 -1
- package/dist/migrations/20260912T094623_catalog_sales_channel_categories.d.ts.map +0 -1
- package/dist/migrations/20260912T094623_catalog_sales_channel_categories.js.map +0 -1
- package/dist/migrations/20260925T125527_catalog_inventory_columns.d.ts.map +0 -1
- package/dist/migrations/20260925T125527_catalog_inventory_columns.js.map +0 -1
- package/dist/migrations/20261008T080839_catalog_product_attribute_is_price_rule.d.ts.map +0 -1
- package/dist/migrations/20261008T080839_catalog_product_attribute_is_price_rule.js.map +0 -1
- package/dist/migrations/20261008T092714_catalog_category_content.d.ts.map +0 -1
- package/dist/migrations/20261008T092714_catalog_category_content.js.map +0 -1
- package/dist/migrations/20261014T170531_catalog_product_list_saved_views.d.ts.map +0 -1
- package/dist/migrations/20261014T170531_catalog_product_list_saved_views.js.map +0 -1
- package/dist/migrations/20261016T082008_catalog_order_rules.d.ts.map +0 -1
- package/dist/migrations/20261016T082008_catalog_order_rules.js.map +0 -1
- package/dist/migrations/20261022T035133_catalog_product_scopes.d.ts.map +0 -1
- package/dist/migrations/20261022T035133_catalog_product_scopes.js.map +0 -1
- package/dist/migrations/20261022T054223_catalog_product_url_keys.d.ts.map +0 -1
- package/dist/migrations/20261022T054223_catalog_product_url_keys.js.map +0 -1
- package/dist/migrations/20261022T111811_catalog_price_fields_removed.d.ts.map +0 -1
- package/dist/migrations/20261022T111811_catalog_price_fields_removed.js.map +0 -1
- package/dist/migrations/20261022T182523_catalog_admin_name_keys.d.ts.map +0 -1
- package/dist/migrations/20261022T182523_catalog_admin_name_keys.js.map +0 -1
- package/dist/migrations/20261025T222634_catalog_product_status_drop_draft.d.ts.map +0 -1
- package/dist/migrations/20261025T222634_catalog_product_status_drop_draft.js.map +0 -1
- package/dist/migrations/20261026T033453_catalog_product_media_scopes.d.ts.map +0 -1
- package/dist/migrations/20261026T033453_catalog_product_media_scopes.js.map +0 -1
- package/dist/migrations/20261026T084533_catalog_attachment_packaging_translations.d.ts.map +0 -1
- package/dist/migrations/20261026T084533_catalog_attachment_packaging_translations.js.map +0 -1
- package/dist/migrations/index.d.ts.map +0 -1
- package/dist/migrations/index.js.map +0 -1
- package/dist/ports/index.d.ts.map +0 -1
- package/dist/ports/index.js.map +0 -1
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { randomUUID } from 'node:crypto';
|
|
12
12
|
import { LockMode, UniqueConstraintViolationException } from '@mikro-orm/core';
|
|
13
|
-
import { ERROR_CODES,
|
|
13
|
+
import { ERROR_CODES, isUuidShape, } from '@endora-commerce/contracts';
|
|
14
14
|
import { HttpError } from '@endora-commerce/platform/http';
|
|
15
|
-
import { assertProductChannelMembers, loadHiddenChannelsByAttachment, mirrorTranslationRemovals, sortedTranslations, writeAttachmentHiddenChannels, } from './attachment-packaging-scopes.js';
|
|
16
15
|
import { Product } from '../entities/product.entity.js';
|
|
17
16
|
import { AttachmentType } from '../entities/attachment-type.entity.js';
|
|
18
17
|
import { ProductAttachment } from '../entities/product-attachment.entity.js';
|
|
@@ -22,7 +21,6 @@ export class AttachmentService {
|
|
|
22
21
|
emFactory;
|
|
23
22
|
commandBus;
|
|
24
23
|
assets;
|
|
25
|
-
membership;
|
|
26
24
|
constructor(emFactory,
|
|
27
25
|
/** Feature 054 — audits attachment writes co-transactionally when provided. */
|
|
28
26
|
commandBus,
|
|
@@ -34,14 +32,14 @@ export class AttachmentService {
|
|
|
34
32
|
*/
|
|
35
33
|
assets,
|
|
36
34
|
/**
|
|
37
|
-
* Feature 163 (FR-014) — which channels the product is a member of
|
|
38
|
-
*
|
|
35
|
+
* Feature 163 (FR-014) — which channels the product is a member of. Unused since feature 174
|
|
36
|
+
* retired the per-channel attachment writes on this route; kept so the composition root's
|
|
37
|
+
* signature does not move before T041 rewrites the service.
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
_membership) {
|
|
41
40
|
this.emFactory = emFactory;
|
|
42
41
|
this.commandBus = commandBus;
|
|
43
42
|
this.assets = assets;
|
|
44
|
-
this.membership = membership;
|
|
45
43
|
}
|
|
46
44
|
#requireAssets() {
|
|
47
45
|
if (!this.assets) {
|
|
@@ -108,6 +106,9 @@ export class AttachmentService {
|
|
|
108
106
|
}
|
|
109
107
|
async updateType(id, req) {
|
|
110
108
|
const t = await this.#audited('attachment_type.update', 'attachment_type', id, async (em) => {
|
|
109
|
+
if (!isUuidShape(id)) {
|
|
110
|
+
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${id} not found.`);
|
|
111
|
+
}
|
|
111
112
|
const row = await em.findOne(AttachmentType, { id });
|
|
112
113
|
if (!row) {
|
|
113
114
|
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${id} not found.`);
|
|
@@ -143,6 +144,9 @@ export class AttachmentService {
|
|
|
143
144
|
}
|
|
144
145
|
async deleteType(id) {
|
|
145
146
|
await this.#audited('attachment_type.delete', 'attachment_type', id, async (em) => {
|
|
147
|
+
if (!isUuidShape(id)) {
|
|
148
|
+
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${id} not found.`);
|
|
149
|
+
}
|
|
146
150
|
const t = await em.findOne(AttachmentType, { id });
|
|
147
151
|
if (!t) {
|
|
148
152
|
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${id} not found.`);
|
|
@@ -161,8 +165,7 @@ export class AttachmentService {
|
|
|
161
165
|
const em = this.emFactory();
|
|
162
166
|
await this.#assertProductExists(em, productId);
|
|
163
167
|
const items = await em.find(ProductAttachment, { productId }, { orderBy: { position: 'asc', id: 'asc' } });
|
|
164
|
-
|
|
165
|
-
return items.map((i) => this.#attachmentDto(i, hidden.get(i.id) ?? []));
|
|
168
|
+
return items.map((i) => this.#attachmentDto(i));
|
|
166
169
|
}
|
|
167
170
|
async createAttachment(productId, req) {
|
|
168
171
|
const em = this.emFactory();
|
|
@@ -172,13 +175,14 @@ export class AttachmentService {
|
|
|
172
175
|
if (!ASSET_KINDS_ATTACHMENT.has(asset.kind)) {
|
|
173
176
|
throw new HttpError(400, ERROR_CODES.ASSET_KIND_NOT_SUPPORTED, `Attachments require asset.kind ∈ {pdf, certificate, other}; got "${asset.kind}".`);
|
|
174
177
|
}
|
|
178
|
+
if (!isUuidShape(req.attachmentTypeId)) {
|
|
179
|
+
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${req.attachmentTypeId} not found.`);
|
|
180
|
+
}
|
|
175
181
|
const type = await em.findOne(AttachmentType, { id: req.attachmentTypeId });
|
|
176
182
|
if (!type) {
|
|
177
183
|
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${req.attachmentTypeId} not found.`);
|
|
178
184
|
}
|
|
179
185
|
const position = req.position ?? (await this.#nextPosition(em, productId));
|
|
180
|
-
const hiddenInChannels = [...new Set(req.hiddenInChannels ?? [])].sort();
|
|
181
|
-
await assertProductChannelMembers(this.membership, productId, hiddenInChannels);
|
|
182
186
|
const id = randomUUID();
|
|
183
187
|
// Feature 163 (FR-080) — one audit entry per request, the Command's; the route
|
|
184
188
|
// writes none of its own. `product.updated.v1` `['attachments']` after commit.
|
|
@@ -191,23 +195,20 @@ export class AttachmentService {
|
|
|
191
195
|
name: req.name,
|
|
192
196
|
description: req.description ?? null,
|
|
193
197
|
position,
|
|
194
|
-
nameTranslations: applyTranslationPatch({}, req.nameTranslations ?? {}),
|
|
195
|
-
descriptionTranslations: applyTranslationPatch({}, req.descriptionTranslations ?? {}),
|
|
196
198
|
});
|
|
197
199
|
await cem.flush();
|
|
198
|
-
if (hiddenInChannels.length > 0) {
|
|
199
|
-
await writeAttachmentHiddenChannels(cem, productId, id, hiddenInChannels);
|
|
200
|
-
}
|
|
201
200
|
return {
|
|
202
201
|
result: created,
|
|
203
202
|
before: null,
|
|
204
|
-
after: { ...attachmentProjection(created
|
|
203
|
+
after: { ...attachmentProjection(created), assetId: req.assetId },
|
|
205
204
|
};
|
|
206
205
|
});
|
|
207
|
-
return this.#attachmentDto(attachment
|
|
206
|
+
return this.#attachmentDto(attachment);
|
|
208
207
|
}
|
|
209
208
|
async updateAttachment(productId, attachmentId, req) {
|
|
210
|
-
|
|
209
|
+
if (!isUuidShape(attachmentId) || !isUuidShape(productId)) {
|
|
210
|
+
throw new HttpError(404, ERROR_CODES.ATTACHMENT_NOT_FOUND, `Attachment ${attachmentId} not found under Product ${productId}.`);
|
|
211
|
+
}
|
|
211
212
|
const a = await this.#runAttachmentCommand('product_attachment.update', attachmentId, productId, async (em) => {
|
|
212
213
|
// Locked, so concurrent writes on one attachment serialise and each audit
|
|
213
214
|
// `before` is its true predecessor (FR-081).
|
|
@@ -215,46 +216,33 @@ export class AttachmentService {
|
|
|
215
216
|
if (!row) {
|
|
216
217
|
throw new HttpError(404, ERROR_CODES.ATTACHMENT_NOT_FOUND, `Attachment ${attachmentId} not found under Product ${productId}.`);
|
|
217
218
|
}
|
|
218
|
-
const
|
|
219
|
-
const before = attachmentProjection(row, hiddenBefore);
|
|
220
|
-
hiddenAfter =
|
|
221
|
-
req.hiddenInChannels === undefined ? hiddenBefore : [...new Set(req.hiddenInChannels)].sort();
|
|
222
|
-
// FR-014 / FR-015 — only a channel the write adds must be a member one.
|
|
223
|
-
await assertProductChannelMembers(this.membership, productId, hiddenAfter.filter((channelId) => !hiddenBefore.includes(channelId)));
|
|
219
|
+
const before = attachmentProjection(row);
|
|
224
220
|
if (req.attachmentTypeId !== undefined) {
|
|
221
|
+
if (!isUuidShape(req.attachmentTypeId)) {
|
|
222
|
+
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${req.attachmentTypeId} not found.`);
|
|
223
|
+
}
|
|
225
224
|
const type = await em.findOne(AttachmentType, { id: req.attachmentTypeId });
|
|
226
225
|
if (!type) {
|
|
227
226
|
throw new HttpError(404, ERROR_CODES.ATTACHMENT_TYPE_NOT_FOUND, `AttachmentType ${req.attachmentTypeId} not found.`);
|
|
228
227
|
}
|
|
229
228
|
row.attachmentTypeId = req.attachmentTypeId;
|
|
230
229
|
}
|
|
231
|
-
if (req.name !== undefined)
|
|
232
|
-
row.name = req.name;
|
|
233
|
-
if (req.description !== undefined)
|
|
234
|
-
row.description = req.description;
|
|
235
230
|
if (req.position !== undefined)
|
|
236
231
|
row.position = req.position;
|
|
237
|
-
|
|
238
|
-
row.nameTranslations = applyTranslationPatch(row.nameTranslations, req.nameTranslations);
|
|
239
|
-
}
|
|
240
|
-
if (req.descriptionTranslations !== undefined) {
|
|
241
|
-
row.descriptionTranslations = applyTranslationPatch(row.descriptionTranslations, req.descriptionTranslations);
|
|
242
|
-
}
|
|
243
|
-
const after = attachmentProjection(row, hiddenAfter);
|
|
232
|
+
const after = attachmentProjection(row);
|
|
244
233
|
// A request that changes nothing writes and announces nothing.
|
|
245
234
|
if (JSON.stringify(before) === JSON.stringify(after))
|
|
246
235
|
return { result: row, unchanged: true };
|
|
247
|
-
mirrorTranslationRemovals(before, after, ['nameTranslations', 'descriptionTranslations']);
|
|
248
|
-
if (req.hiddenInChannels !== undefined) {
|
|
249
|
-
await writeAttachmentHiddenChannels(em, productId, attachmentId, hiddenAfter);
|
|
250
|
-
}
|
|
251
236
|
await em.flush();
|
|
252
237
|
return { result: row, before, after };
|
|
253
238
|
});
|
|
254
|
-
return this.#attachmentDto(a
|
|
239
|
+
return this.#attachmentDto(a);
|
|
255
240
|
}
|
|
256
241
|
async deleteAttachment(productId, attachmentId) {
|
|
257
242
|
await this.#audited('product_attachment.delete', 'product_attachment', attachmentId, async (em) => {
|
|
243
|
+
if (!isUuidShape(attachmentId) || !isUuidShape(productId)) {
|
|
244
|
+
throw new HttpError(404, ERROR_CODES.ATTACHMENT_NOT_FOUND, `Attachment ${attachmentId} not found under Product ${productId}.`);
|
|
245
|
+
}
|
|
258
246
|
const a = await em.findOne(ProductAttachment, { id: attachmentId, productId });
|
|
259
247
|
if (!a) {
|
|
260
248
|
throw new HttpError(404, ERROR_CODES.ATTACHMENT_NOT_FOUND, `Attachment ${attachmentId} not found under Product ${productId}.`);
|
|
@@ -311,6 +299,9 @@ export class AttachmentService {
|
|
|
311
299
|
});
|
|
312
300
|
}
|
|
313
301
|
async #assertProductExists(em, productId) {
|
|
302
|
+
if (!isUuidShape(productId)) {
|
|
303
|
+
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
304
|
+
}
|
|
314
305
|
const product = await em.findOne(Product, { id: productId });
|
|
315
306
|
if (!product) {
|
|
316
307
|
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
@@ -330,7 +321,7 @@ export class AttachmentService {
|
|
|
330
321
|
const rows = (await em.execute(`select coalesce(max(position), -1) + 1 as next_position from product_attachments where product_id = ?`, [productId]));
|
|
331
322
|
return rows[0]?.next_position ?? 0;
|
|
332
323
|
}
|
|
333
|
-
#attachmentDto(a
|
|
324
|
+
#attachmentDto(a) {
|
|
334
325
|
return {
|
|
335
326
|
id: a.id,
|
|
336
327
|
productId: a.productId,
|
|
@@ -339,9 +330,7 @@ export class AttachmentService {
|
|
|
339
330
|
name: a.name,
|
|
340
331
|
description: a.description ?? null,
|
|
341
332
|
position: a.position,
|
|
342
|
-
|
|
343
|
-
descriptionTranslations: { ...(a.descriptionTranslations ?? {}) },
|
|
344
|
-
hiddenInChannels: [...hiddenInChannels],
|
|
333
|
+
hidden: a.hidden,
|
|
345
334
|
createdAt: a.createdAt.toISOString(),
|
|
346
335
|
updatedAt: a.updatedAt.toISOString(),
|
|
347
336
|
};
|
|
@@ -351,16 +340,13 @@ export class AttachmentService {
|
|
|
351
340
|
* The audit projection of one attachment write (FR-080): every field the PATCH accepts
|
|
352
341
|
* plus the product, so re-sending it (minus `productId`) restores the row (FR-081).
|
|
353
342
|
*/
|
|
354
|
-
function attachmentProjection(row
|
|
343
|
+
function attachmentProjection(row) {
|
|
355
344
|
return {
|
|
356
345
|
productId: row.productId,
|
|
357
346
|
attachmentTypeId: row.attachmentTypeId,
|
|
358
347
|
name: row.name,
|
|
359
348
|
description: row.description ?? null,
|
|
360
349
|
position: row.position,
|
|
361
|
-
nameTranslations: sortedTranslations(row.nameTranslations),
|
|
362
|
-
descriptionTranslations: sortedTranslations(row.descriptionTranslations),
|
|
363
|
-
hiddenInChannels: [...hiddenInChannels].sort(),
|
|
364
350
|
};
|
|
365
351
|
}
|
|
366
352
|
//# sourceMappingURL=attachment.service.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one `filter[attr.<key>]` means for one product value (issue #684): the
|
|
3
|
+
* value, rendered as `String` renders it, is one of the requested values — and
|
|
4
|
+
* a multiselect matches when **any** of its options does, each option rendered
|
|
5
|
+
* the same way. An empty multiselect matches nothing, and so does a key the
|
|
6
|
+
* product does not carry (`undefined`).
|
|
7
|
+
*
|
|
8
|
+
* This is the page-side half of the listing's attribute filter. The statement
|
|
9
|
+
* half is `CatalogQueryService#attributeCondition`, which restates this rule in
|
|
10
|
+
* SQL; `backend/test/contract/catalog/products-list-filtered-paging.test.ts`
|
|
11
|
+
* holds the two together. Change one, change the other.
|
|
12
|
+
*/
|
|
13
|
+
export declare function attributeFilterMatches(value: unknown, wanted: readonly string[]): boolean;
|
|
14
|
+
//# sourceMappingURL=attribute-filter-match.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one `filter[attr.<key>]` means for one product value (issue #684): the
|
|
3
|
+
* value, rendered as `String` renders it, is one of the requested values — and
|
|
4
|
+
* a multiselect matches when **any** of its options does, each option rendered
|
|
5
|
+
* the same way. An empty multiselect matches nothing, and so does a key the
|
|
6
|
+
* product does not carry (`undefined`).
|
|
7
|
+
*
|
|
8
|
+
* This is the page-side half of the listing's attribute filter. The statement
|
|
9
|
+
* half is `CatalogQueryService#attributeCondition`, which restates this rule in
|
|
10
|
+
* SQL; `backend/test/contract/catalog/products-list-filtered-paging.test.ts`
|
|
11
|
+
* holds the two together. Change one, change the other.
|
|
12
|
+
*/
|
|
13
|
+
export function attributeFilterMatches(value, wanted) {
|
|
14
|
+
if (value === undefined)
|
|
15
|
+
return false;
|
|
16
|
+
const rendered = Array.isArray(value) ? value.map((option) => String(option)) : [String(value)];
|
|
17
|
+
return rendered.some((text) => wanted.includes(text));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=attribute-filter-match.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { EntityManager } from '@mikro-orm/postgresql';
|
|
2
|
-
import { type
|
|
2
|
+
import { type AttributeScopeChangePreviewResponse, type AttributeValueType, type ScopeLevel } from '@endora-commerce/contracts';
|
|
3
3
|
import type { CatalogAttributeReadService } from './catalog-attribute-read.service.js';
|
|
4
4
|
/**
|
|
5
5
|
* Feature 163 (`specs/163-product-data-scopes/`) — the FR-090 preview of a change to a
|
|
6
|
-
* user-defined attribute's scope
|
|
7
|
-
* `GET /api/v1/admin/catalog/attributes/:idOrKey/scope-change-preview
|
|
8
|
-
* (`contracts/admin-scopes-api.md` §6, research R27).
|
|
6
|
+
* user-defined attribute's scope, on feature 174's one flag and its value type (R15, FR-012):
|
|
7
|
+
* `GET /api/v1/admin/catalog/attributes/:idOrKey/scope-change-preview?scopable=&valueType=`
|
|
8
|
+
* (`contracts/admin-scopes-api.md` §6, research R27). The scope set is derived from both — a
|
|
9
|
+
* scopable text attribute {G, C, C×L}, a scopable non-text one {G, C}, a non-scopable one {G} —
|
|
10
|
+
* so scopable → not scopable orphans every override and text → non-text the C×L ones.
|
|
9
11
|
*
|
|
10
12
|
* A read only. The attribute update itself is unchanged and keeps every
|
|
11
13
|
* `product_value_overrides` row; the resolver skips the ones the new flags no longer
|
|
@@ -26,9 +28,17 @@ export interface OrphanedSlots {
|
|
|
26
28
|
channelLanguage: boolean;
|
|
27
29
|
}
|
|
28
30
|
/** The slots readable under `current` and not under `next`. */
|
|
29
|
-
export declare function slotsOrphanedByScopeChange(current:
|
|
30
|
-
/**
|
|
31
|
-
export
|
|
31
|
+
export declare function slotsOrphanedByScopeChange(current: readonly ScopeLevel[], next: readonly ScopeLevel[]): OrphanedSlots;
|
|
32
|
+
/** What the scope set is derived from (feature 174, `attributeScopeSet`). */
|
|
33
|
+
export interface AttributeScopeInput {
|
|
34
|
+
scopable: boolean;
|
|
35
|
+
valueType: AttributeValueType;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The requested scope: `scopable` `"true"` / `"false"` and `valueType` one of the attribute value
|
|
39
|
+
* types; an absent parameter keeps the attribute's current one.
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseScopeChangeQuery(query: Record<string, unknown>, current: AttributeScopeInput): AttributeScopeInput;
|
|
32
42
|
export declare class AttributeScopePreviewService {
|
|
33
43
|
private readonly emFactory;
|
|
34
44
|
private readonly attributeRead;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ERROR_CODES, } from '@endora-commerce/contracts';
|
|
1
|
+
import { ERROR_CODES, attributeScopeSet, attributeValueTypeSchema, } from '@endora-commerce/contracts';
|
|
2
2
|
import { HttpError } from '@endora-commerce/platform/http';
|
|
3
|
-
/** The resolver's
|
|
4
|
-
function readable(
|
|
5
|
-
return { channel:
|
|
3
|
+
/** The slots the resolver reads for an attribute's scope set (feature 174, `attributeScopeSet`). */
|
|
4
|
+
function readable(levels) {
|
|
5
|
+
return { channel: levels.includes('C'), channelLanguage: levels.includes('CL') };
|
|
6
6
|
}
|
|
7
7
|
/** The slots readable under `current` and not under `next`. */
|
|
8
8
|
export function slotsOrphanedByScopeChange(current, next) {
|
|
@@ -13,21 +13,30 @@ export function slotsOrphanedByScopeChange(current, next) {
|
|
|
13
13
|
channelLanguage: before.channelLanguage && !after.channelLanguage,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return true;
|
|
21
|
-
if (raw === 'false')
|
|
22
|
-
return false;
|
|
23
|
-
throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, `"${field}" must be "true" or "false".`, { field });
|
|
24
|
-
}
|
|
25
|
-
/** The requested flags: `"true"` / `"false"`; an absent one keeps the attribute's current flag. */
|
|
16
|
+
/**
|
|
17
|
+
* The requested scope: `scopable` `"true"` / `"false"` and `valueType` one of the attribute value
|
|
18
|
+
* types; an absent parameter keeps the attribute's current one.
|
|
19
|
+
*/
|
|
26
20
|
export function parseScopeChangeQuery(query, current) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const rawScopable = query['scopable'];
|
|
22
|
+
let scopable = current.scopable;
|
|
23
|
+
if (rawScopable === 'true')
|
|
24
|
+
scopable = true;
|
|
25
|
+
else if (rawScopable === 'false')
|
|
26
|
+
scopable = false;
|
|
27
|
+
else if (rawScopable !== undefined) {
|
|
28
|
+
throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, '"scopable" must be "true" or "false".', { field: 'scopable' });
|
|
29
|
+
}
|
|
30
|
+
const rawType = query['valueType'];
|
|
31
|
+
let valueType = current.valueType;
|
|
32
|
+
if (rawType !== undefined) {
|
|
33
|
+
const parsed = attributeValueTypeSchema.safeParse(rawType);
|
|
34
|
+
if (!parsed.success) {
|
|
35
|
+
throw new HttpError(400, ERROR_CODES.VALIDATION_FAILED, '"valueType" is not an attribute value type.', { field: 'valueType' });
|
|
36
|
+
}
|
|
37
|
+
valueType = parsed.data;
|
|
38
|
+
}
|
|
39
|
+
return { scopable, valueType };
|
|
31
40
|
}
|
|
32
41
|
export class AttributeScopePreviewService {
|
|
33
42
|
emFactory;
|
|
@@ -42,8 +51,9 @@ export class AttributeScopePreviewService {
|
|
|
42
51
|
const attribute = await this.attributeRead.getByIdOrKey(idOrKey);
|
|
43
52
|
if (!attribute)
|
|
44
53
|
throw new HttpError(404, ERROR_CODES.NOT_FOUND, `Attribute "${idOrKey}" not found.`);
|
|
45
|
-
const current = {
|
|
46
|
-
const
|
|
54
|
+
const current = { scopable: attribute.scopable, valueType: attribute.valueType };
|
|
55
|
+
const next = parseScopeChangeQuery(query, current);
|
|
56
|
+
const slots = slotsOrphanedByScopeChange(attributeScopeSet(current), attributeScopeSet(next));
|
|
47
57
|
if (!slots.channel && !slots.channelLanguage)
|
|
48
58
|
return { orphanedOverrides: 0, byChannel: [] };
|
|
49
59
|
const slotCondition = slots.channel && slots.channelLanguage
|
|
@@ -35,7 +35,16 @@ export declare class AttributeSetService {
|
|
|
35
35
|
*/
|
|
36
36
|
attributeRead?: CatalogAttributeReadService | undefined);
|
|
37
37
|
listSets(): Promise<AttributeSetDto[]>;
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* One set with its members. `includeContent: false` (feature 172, FR-042)
|
|
40
|
+
* leaves out the Page Builder content attributes: the integration-facing
|
|
41
|
+
* read offers a connector what it can map, and a document is not a value a
|
|
42
|
+
* connector maps. The admin read keeps them — the product form lays its
|
|
43
|
+
* content cards out from it (OR-2).
|
|
44
|
+
*/
|
|
45
|
+
getSetDetail(id: string, options?: {
|
|
46
|
+
includeContent?: boolean;
|
|
47
|
+
}): Promise<AttributeSetDetailDto>;
|
|
39
48
|
createSet(input: CreateAttributeSetRequest): Promise<AttributeSetDetailDto>;
|
|
40
49
|
updateSet(id: string, input: UpdateAttributeSetRequest): Promise<AttributeSetDto>;
|
|
41
50
|
deleteSet(id: string): Promise<void>;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { randomUUID } from 'node:crypto';
|
|
13
13
|
import { UniqueConstraintViolationException } from '@mikro-orm/core';
|
|
14
|
-
import { ERROR_CODES, } from '@endora-commerce/contracts';
|
|
14
|
+
import { ERROR_CODES, isUuidShape, } from '@endora-commerce/contracts';
|
|
15
15
|
import { HttpError } from '@endora-commerce/platform/http';
|
|
16
16
|
import { AttributeSet } from '../entities/attribute-set.entity.js';
|
|
17
17
|
import { assertCodeNotImmutable, assertNotInUse, AttributeSetValidationError, } from './attribute-set-validations.js';
|
|
@@ -93,13 +93,26 @@ export class AttributeSetService {
|
|
|
93
93
|
updatedAt: new Date(r.updated_at).toISOString(),
|
|
94
94
|
}));
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
/**
|
|
97
|
+
* One set with its members. `includeContent: false` (feature 172, FR-042)
|
|
98
|
+
* leaves out the Page Builder content attributes: the integration-facing
|
|
99
|
+
* read offers a connector what it can map, and a document is not a value a
|
|
100
|
+
* connector maps. The admin read keeps them — the product form lays its
|
|
101
|
+
* content cards out from it (OR-2).
|
|
102
|
+
*/
|
|
103
|
+
async getSetDetail(id, options = {}) {
|
|
97
104
|
const em = this.emFactory();
|
|
105
|
+
if (!isUuidShape(id)) {
|
|
106
|
+
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
107
|
+
}
|
|
98
108
|
const set = await em.findOne(AttributeSet, { id });
|
|
99
109
|
if (!set) {
|
|
100
110
|
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
101
111
|
}
|
|
102
|
-
const
|
|
112
|
+
const assigned = await this.#listAssignedAttributes(em, id);
|
|
113
|
+
const attrs = options.includeContent === false
|
|
114
|
+
? assigned.filter((attribute) => attribute.valueType !== 'page_builder')
|
|
115
|
+
: assigned;
|
|
103
116
|
const counts = await this.#computeCounts(em, id);
|
|
104
117
|
return this.#toDetailDto(set, attrs, counts);
|
|
105
118
|
}
|
|
@@ -164,6 +177,9 @@ export class AttributeSetService {
|
|
|
164
177
|
}
|
|
165
178
|
async updateSet(id, input) {
|
|
166
179
|
const set = await this.#audited('attribute_set.update', id, async (em) => {
|
|
180
|
+
if (!isUuidShape(id)) {
|
|
181
|
+
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
182
|
+
}
|
|
167
183
|
const s = await em.findOne(AttributeSet, { id });
|
|
168
184
|
if (!s) {
|
|
169
185
|
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
@@ -216,6 +232,9 @@ export class AttributeSetService {
|
|
|
216
232
|
}
|
|
217
233
|
async deleteSet(id) {
|
|
218
234
|
await this.#audited('attribute_set.delete', id, async (em) => {
|
|
235
|
+
if (!isUuidShape(id)) {
|
|
236
|
+
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
237
|
+
}
|
|
219
238
|
const set = await em.findOne(AttributeSet, { id });
|
|
220
239
|
if (!set) {
|
|
221
240
|
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
@@ -245,6 +264,9 @@ export class AttributeSetService {
|
|
|
245
264
|
}
|
|
246
265
|
async assignAttributes(id, input) {
|
|
247
266
|
const readEm = this.emFactory();
|
|
267
|
+
if (!isUuidShape(id)) {
|
|
268
|
+
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
269
|
+
}
|
|
248
270
|
const set = await readEm.findOne(AttributeSet, { id });
|
|
249
271
|
if (!set) {
|
|
250
272
|
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
@@ -296,6 +318,9 @@ export class AttributeSetService {
|
|
|
296
318
|
}
|
|
297
319
|
async unassignAttribute(id, attributeId) {
|
|
298
320
|
const readEm = this.emFactory();
|
|
321
|
+
if (!isUuidShape(id)) {
|
|
322
|
+
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
323
|
+
}
|
|
299
324
|
const set = await readEm.findOne(AttributeSet, { id });
|
|
300
325
|
if (!set) {
|
|
301
326
|
throw new HttpError(404, ERROR_CODES.ATTRIBUTE_SET_NOT_FOUND, `Attribute Set ${id} not found.`);
|
|
@@ -342,7 +367,8 @@ export class AttributeSetService {
|
|
|
342
367
|
label: view.label,
|
|
343
368
|
valueType: view.valueType,
|
|
344
369
|
position: r.position,
|
|
345
|
-
|
|
370
|
+
scopable: view.scopable,
|
|
371
|
+
scopeLevels: [...view.scopeLevels],
|
|
346
372
|
};
|
|
347
373
|
})
|
|
348
374
|
.filter((a) => a !== undefined);
|
|
@@ -10,11 +10,11 @@ import { type ApiAttributeType as ContractApiAttributeType, type AttributeValueT
|
|
|
10
10
|
* - specs/061-attributes-on-custom-fields/research.md §R7 (CF triple map)
|
|
11
11
|
*/
|
|
12
12
|
/** Legacy DB-level types — superset of foundation 001's `attributeValueTypeSchema`. */
|
|
13
|
-
export type DbAttributeValueType = 'string' | 'number' | 'boolean' | 'enum' | 'date' | 'multiselect' | 'price';
|
|
13
|
+
export type DbAttributeValueType = 'string' | 'number' | 'boolean' | 'enum' | 'date' | 'multiselect' | 'price' | 'page_builder';
|
|
14
14
|
/** The legacy persisted form (pre-061 `product_attributes.value_type`). */
|
|
15
15
|
export type LegacyAttributeValueType = DbAttributeValueType | 'select';
|
|
16
16
|
/** Generic Custom Fields value types the product host maps onto. */
|
|
17
|
-
export type CfAttributeValueType = 'text' | 'number' | 'boolean' | 'date' | 'select' | 'multiselect';
|
|
17
|
+
export type CfAttributeValueType = 'text' | 'number' | 'boolean' | 'date' | 'select' | 'multiselect' | 'page_builder';
|
|
18
18
|
/** Extension refinement: how a cf `select` renders (legacy `enum` vs `select`). */
|
|
19
19
|
export type SelectDisplay = 'pill' | 'dropdown';
|
|
20
20
|
/** Extension refinement: which numeric semantics back a cf `number`. */
|
|
@@ -22,6 +22,8 @@ export function legacyToCfType(valueType) {
|
|
|
22
22
|
return { cfValueType: 'select', selectDisplay: 'dropdown', numericKind: null };
|
|
23
23
|
case 'multiselect':
|
|
24
24
|
return { cfValueType: 'multiselect', selectDisplay: null, numericKind: null };
|
|
25
|
+
case 'page_builder':
|
|
26
|
+
return { cfValueType: 'page_builder', selectDisplay: null, numericKind: null };
|
|
25
27
|
default: {
|
|
26
28
|
const _exhaustive = valueType;
|
|
27
29
|
throw new InvalidAttributeMappingError(`Unsupported legacy attribute valueType: ${String(_exhaustive)}`, 'INVALID_DB_TYPE');
|
|
@@ -47,6 +49,8 @@ export function cfToLegacyValueType(cfValueType, selectDisplay, numericKind) {
|
|
|
47
49
|
return selectDisplay === 'pill' ? 'enum' : 'select';
|
|
48
50
|
case 'multiselect':
|
|
49
51
|
return 'multiselect';
|
|
52
|
+
case 'page_builder':
|
|
53
|
+
return 'page_builder';
|
|
50
54
|
default:
|
|
51
55
|
throw new InvalidAttributeMappingError(`Unsupported cf attribute valueType: ${cfValueType}`, 'INVALID_DB_TYPE');
|
|
52
56
|
}
|
|
@@ -82,6 +86,8 @@ export function resolveAttributeApiType(req) {
|
|
|
82
86
|
return { valueType: 'multiselect', displayAsSlider: false };
|
|
83
87
|
case 'price':
|
|
84
88
|
return { valueType: 'price', displayAsSlider: req.displayAsSlider ?? false };
|
|
89
|
+
case 'page_builder':
|
|
90
|
+
return { valueType: 'page_builder', displayAsSlider: false };
|
|
85
91
|
case 'slider': {
|
|
86
92
|
// Zod refine catches the missing-numericKind path; this is a
|
|
87
93
|
// belt-and-braces guard for direct service callers (seeders, etc).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { EntityManager } from '@mikro-orm/postgresql';
|
|
2
|
+
import type { AdminAttributeUsage } from '@endora-commerce/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Feature 172 (`specs/172-product-content-attributes/`, FR-007 – FR-009, owner
|
|
5
|
+
* ruling OR-5, research R-21) — what deleting an attribute would meet.
|
|
6
|
+
*
|
|
7
|
+
* **One query for the dialog and the guard.** `GET …/attributes/:idOrKey/usage`
|
|
8
|
+
* and `catalog.attribute.delete` both call {@link readAttributeUsage}, so the
|
|
9
|
+
* count an operator is shown before confirming is the count the Command refuses
|
|
10
|
+
* on — the two cannot disagree.
|
|
11
|
+
*
|
|
12
|
+
* - `attributeSetCount` — set memberships of the definition (refuses).
|
|
13
|
+
* - `productValueCount` — distinct **non-deleted** products holding a value for
|
|
14
|
+
* the key: a baseline value (`products.attribute_values`), a per-channel
|
|
15
|
+
* override (`product_value_overrides`) or a variant value
|
|
16
|
+
* (`product_variants.variant_attribute_values`) (refuses). A soft-deleted
|
|
17
|
+
* product does not count: nothing purges or restores one, so it would block
|
|
18
|
+
* the attribute for ever with nothing the operator could clear (R-21).
|
|
19
|
+
* - `productContentCount` — Page Builder content rows of the attribute whose
|
|
20
|
+
* product is not soft-deleted (deleted with the attribute). Always `0` for a
|
|
21
|
+
* non-content attribute, whose extension id no content row carries.
|
|
22
|
+
*/
|
|
23
|
+
export interface AttributeUsageTarget {
|
|
24
|
+
definitionId: string;
|
|
25
|
+
extensionId: string;
|
|
26
|
+
key: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function readAttributeUsage(
|
|
29
|
+
/** A Command's EntityManager (the delete guard), or a fresh one (the usage read). */
|
|
30
|
+
em: EntityManager, target: AttributeUsageTarget): Promise<AdminAttributeUsage>;
|
|
31
|
+
//# sourceMappingURL=attribute-usage.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export async function readAttributeUsage(
|
|
2
|
+
/** A Command's EntityManager (the delete guard), or a fresh one (the usage read). */
|
|
3
|
+
em, target) {
|
|
4
|
+
// `em.execute`, never `em.getConnection().execute`: inside a Command this
|
|
5
|
+
// must read the state of the transaction whose write it guards (issue #200).
|
|
6
|
+
// The JSONB key operator is escaped (`\\?`), because a bare `?` is a binding.
|
|
7
|
+
const rows = (await em.execute(`select
|
|
8
|
+
(select count(*)::int from attribute_set_attributes where custom_field_definition_id = ?) as attribute_set_count,
|
|
9
|
+
(select count(*)::int
|
|
10
|
+
from products p
|
|
11
|
+
where p.deleted_at is null
|
|
12
|
+
and (p.attribute_values \\? ?
|
|
13
|
+
or exists (select 1 from product_value_overrides o
|
|
14
|
+
where o.product_id = p.id and o.attribute_key = ?)
|
|
15
|
+
or exists (select 1 from product_variants v
|
|
16
|
+
where v.parent_product_id = p.id and v.variant_attribute_values \\? ?))
|
|
17
|
+
) as product_value_count,
|
|
18
|
+
(select count(*)::int
|
|
19
|
+
from product_content_values pcv
|
|
20
|
+
join products p on p.id = pcv.product_id
|
|
21
|
+
where pcv.product_attribute_id = ? and p.deleted_at is null) as product_content_count`, [target.definitionId, target.key, target.key, target.key, target.extensionId]));
|
|
22
|
+
const row = rows[0];
|
|
23
|
+
return {
|
|
24
|
+
attributeSetCount: Number(row?.attribute_set_count ?? 0),
|
|
25
|
+
productValueCount: Number(row?.product_value_count ?? 0),
|
|
26
|
+
productContentCount: Number(row?.product_content_count ?? 0),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=attribute-usage.js.map
|
|
@@ -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
|