@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
|
@@ -12,10 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { randomUUID } from 'node:crypto';
|
|
14
14
|
import { LockMode } from '@mikro-orm/core';
|
|
15
|
-
import { ERROR_CODES,
|
|
15
|
+
import { ERROR_CODES, isUuidShape, } from '@endora-commerce/contracts';
|
|
16
16
|
import { HttpError } from '@endora-commerce/platform/http';
|
|
17
|
-
import { loadChannelRoles, loadHiddenChannelsByItem, writeGalleryChannelRole, writeGalleryHiddenChannels, } from './gallery-scopes.js';
|
|
18
|
-
import { assertProductChannelMembers } from './attachment-packaging-scopes.js';
|
|
19
17
|
import { requireLinkableAsset } from './linkable-asset.js';
|
|
20
18
|
import { Product } from '../entities/product.entity.js';
|
|
21
19
|
import { GalleryItem } from '../entities/gallery-item.entity.js';
|
|
@@ -30,7 +28,6 @@ export class GalleryService {
|
|
|
30
28
|
emFactory;
|
|
31
29
|
commandBus;
|
|
32
30
|
assets;
|
|
33
|
-
membership;
|
|
34
31
|
constructor(emFactory,
|
|
35
32
|
/** Feature 054 — audits gallery-item writes co-transactionally when provided. */
|
|
36
33
|
commandBus,
|
|
@@ -42,14 +39,14 @@ export class GalleryService {
|
|
|
42
39
|
*/
|
|
43
40
|
assets,
|
|
44
41
|
/**
|
|
45
|
-
* Feature 163 (FR-014) — which channels the product is a member of
|
|
46
|
-
*
|
|
42
|
+
* Feature 163 (FR-014) — which channels the product is a member of. Unused since feature 174
|
|
43
|
+
* retired the per-channel media writes on this route; kept so the composition root's
|
|
44
|
+
* signature does not move before T041 rewrites the service.
|
|
47
45
|
*/
|
|
48
|
-
|
|
46
|
+
_membership) {
|
|
49
47
|
this.emFactory = emFactory;
|
|
50
48
|
this.commandBus = commandBus;
|
|
51
49
|
this.assets = assets;
|
|
52
|
-
this.membership = membership;
|
|
53
50
|
}
|
|
54
51
|
#requireAssets() {
|
|
55
52
|
if (!this.assets) {
|
|
@@ -77,64 +74,8 @@ export class GalleryService {
|
|
|
77
74
|
await this.#assertProductExists(em, productId);
|
|
78
75
|
return this.#fetchAllForProduct(em, productId);
|
|
79
76
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
* override for the product, sorted by channel id; a role without one is `null`.
|
|
83
|
-
*/
|
|
84
|
-
async listChannelRoles(productId) {
|
|
85
|
-
const em = this.emFactory();
|
|
86
|
-
await this.#assertProductExists(em, productId);
|
|
87
|
-
const byChannel = await loadChannelRoles(em, productId);
|
|
88
|
-
return [...byChannel].map(([channelId, roles]) => channelRolesDto(channelId, roles));
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Feature 163 (FR-076, `contracts/seo-media-attachments.md` §2) — `PUT
|
|
92
|
-
* …/gallery/channel-roles`: the Command `product.media.update`. A role named with an
|
|
93
|
-
* item moves to it in the channel (the item must be the product's, the channel one
|
|
94
|
-
* the product is a member of); `null` returns the role to the global holder (always
|
|
95
|
-
* allowed, FR-015); an absent role is untouched. One audit entry with the channel's
|
|
96
|
-
* three roles before and after; `product.updated.v1` `['media']` after commit; a
|
|
97
|
-
* request that changes nothing writes and announces nothing.
|
|
98
|
-
*/
|
|
99
|
-
async putChannelRoles(productId, req) {
|
|
100
|
-
const channelId = req.channelId;
|
|
101
|
-
const requested = ROLE_KEYS.flatMap(([key, label]) => {
|
|
102
|
-
const itemId = req.roles[key];
|
|
103
|
-
return itemId === undefined ? [] : [[label, itemId]];
|
|
104
|
-
});
|
|
105
|
-
await this.#runMediaCommand(productId, async (em) => {
|
|
106
|
-
const current = (await loadChannelRoles(em, productId)).get(channelId) ?? new Map();
|
|
107
|
-
const before = channelRolesDto(channelId, current);
|
|
108
|
-
const next = new Map(current);
|
|
109
|
-
for (const [label, itemId] of requested) {
|
|
110
|
-
if (itemId === null)
|
|
111
|
-
next.delete(label);
|
|
112
|
-
else
|
|
113
|
-
next.set(label, itemId);
|
|
114
|
-
}
|
|
115
|
-
const after = channelRolesDto(channelId, next);
|
|
116
|
-
if (sameRoles(before.roles, after.roles))
|
|
117
|
-
return null;
|
|
118
|
-
const named = requested.flatMap(([, itemId]) => (itemId === null ? [] : [itemId]));
|
|
119
|
-
if (named.length > 0) {
|
|
120
|
-
await this.#assertMembers(productId, [channelId]);
|
|
121
|
-
const owned = await em.find(GalleryItem, { id: { $in: named }, productId });
|
|
122
|
-
const ownedIds = new Set(owned.map((item) => item.id));
|
|
123
|
-
const foreign = named.find((itemId) => !ownedIds.has(itemId));
|
|
124
|
-
if (foreign !== undefined) {
|
|
125
|
-
throw new HttpError(404, ERROR_CODES.GALLERY_ITEM_NOT_FOUND, `Gallery item ${foreign} not found under Product ${productId}.`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
for (const [label, itemId] of requested) {
|
|
129
|
-
if ((current.get(label) ?? null) === itemId)
|
|
130
|
-
continue;
|
|
131
|
-
await writeGalleryChannelRole(em, productId, channelId, label, itemId);
|
|
132
|
-
}
|
|
133
|
-
return { before, after };
|
|
134
|
-
});
|
|
135
|
-
const roles = (await loadChannelRoles(this.emFactory(), productId)).get(channelId) ?? new Map();
|
|
136
|
-
return channelRolesDto(channelId, roles);
|
|
137
|
-
}
|
|
77
|
+
// Feature 174 (`contracts/scoped-values-api.md` §6) — 163's `GET` / `PUT …/gallery/channel-roles`
|
|
78
|
+
// are retired: a role at C or C×L is the scoped field `galleryRole:<label>` of the save Command.
|
|
138
79
|
/**
|
|
139
80
|
* Feature 075 / D-87 — the batch half of {@link list}, for the callers that
|
|
140
81
|
* walk a page or a whole sellable catalogue.
|
|
@@ -153,16 +94,11 @@ export class GalleryService {
|
|
|
153
94
|
* Feature 163 (FR-076, owner decision MED-1 = A) — `channelId` is the feed's channel:
|
|
154
95
|
* an item hidden there is left out, in the same statement. `null` = the global gallery.
|
|
155
96
|
*/
|
|
156
|
-
async listForProducts(productIds, channelId) {
|
|
97
|
+
async listForProducts(productIds, channelId, languageCode = null) {
|
|
157
98
|
if (productIds.length === 0)
|
|
158
99
|
return [];
|
|
159
100
|
const ids = [...new Set(productIds)];
|
|
160
|
-
const
|
|
161
|
-
? ''
|
|
162
|
-
: `and not exists (
|
|
163
|
-
select 1 from gallery_item_channel_hidden h
|
|
164
|
-
where h.gallery_item_id = gi.id and h.sales_channel_id = ?
|
|
165
|
-
)`;
|
|
101
|
+
const hidden = effectiveHiddenSql('gi.id', 'gi.hidden', channelId);
|
|
166
102
|
// `em.execute`, not `em.getConnection().execute`, so a caller that opens a
|
|
167
103
|
// transaction around this read sees its own uncommitted writes (issue #200).
|
|
168
104
|
const rows = await this.emFactory().execute(`select gi.product_id::text as product_id,
|
|
@@ -170,8 +106,8 @@ export class GalleryService {
|
|
|
170
106
|
gi.position
|
|
171
107
|
from gallery_items gi
|
|
172
108
|
where gi.product_id in (${ids.map(() => '?').join(',')})
|
|
173
|
-
${
|
|
174
|
-
order by gi.product_id, gi.position asc, gi.id asc`,
|
|
109
|
+
and not ${hidden.sql}
|
|
110
|
+
order by gi.product_id, gi.position asc, gi.id asc`, [...ids, ...hidden.params(channelId, languageCode)]);
|
|
175
111
|
return rows.map((row) => ({
|
|
176
112
|
productId: row.product_id,
|
|
177
113
|
assetId: row.asset_id,
|
|
@@ -204,7 +140,7 @@ export class GalleryService {
|
|
|
204
140
|
* holder is hidden there (`effectiveGallery`'s rule, in one statement). `null` = the
|
|
205
141
|
* global holder.
|
|
206
142
|
*/
|
|
207
|
-
async baseImageUrls(productIds, channelId) {
|
|
143
|
+
async baseImageUrls(productIds, channelId, languageCode = null) {
|
|
208
144
|
const urlByProduct = new Map();
|
|
209
145
|
for (const id of productIds)
|
|
210
146
|
urlByProduct.set(id, null);
|
|
@@ -212,32 +148,37 @@ export class GalleryService {
|
|
|
212
148
|
return urlByProduct;
|
|
213
149
|
const ids = [...urlByProduct.keys()];
|
|
214
150
|
const placeholders = ids.map(() => '?').join(',');
|
|
151
|
+
const hidden = effectiveHiddenSql('gi.id', 'gi.hidden', channelId);
|
|
152
|
+
// Feature 174 (`data-model.md` §6b) — the holder at (C, L): the C×L row, else the C row
|
|
153
|
+
// (an override with `gallery_item_id null` = no image holds the role), else the Global
|
|
154
|
+
// label; then none when that holder is effectively hidden there.
|
|
215
155
|
const rows = await this.emFactory().execute(channelId === null
|
|
216
156
|
? `select gil.product_id::text as product_id, gi.asset_id::text as asset_id
|
|
217
157
|
from gallery_item_labels gil
|
|
218
158
|
join gallery_items gi on gi.id = gil.gallery_item_id
|
|
219
159
|
where gil.label = 'base_image'
|
|
220
|
-
and gil.product_id in (${placeholders})
|
|
160
|
+
and gil.product_id in (${placeholders})
|
|
161
|
+
and not ${hidden.sql}`
|
|
221
162
|
: `select holder.product_id::text as product_id, gi.asset_id::text as asset_id
|
|
222
163
|
from (
|
|
223
164
|
select p.id as product_id,
|
|
224
|
-
|
|
225
|
-
(select cl.gallery_item_id
|
|
226
|
-
from gallery_item_channel_labels cl
|
|
227
|
-
join gallery_items ci on ci.id = cl.gallery_item_id and ci.product_id = cl.product_id
|
|
228
|
-
where cl.product_id = p.id and cl.sales_channel_id = ? and cl.label = 'base_image'),
|
|
229
|
-
(select gil.gallery_item_id
|
|
230
|
-
from gallery_item_labels gil
|
|
231
|
-
where gil.product_id = p.id and gil.label = 'base_image')
|
|
232
|
-
) as gallery_item_id
|
|
165
|
+
case when ov.found then ov.gallery_item_id else gil.gallery_item_id end as gallery_item_id
|
|
233
166
|
from products p
|
|
167
|
+
left join lateral (
|
|
168
|
+
select r.gallery_item_id, true as found
|
|
169
|
+
from gallery_role_scope_overrides r
|
|
170
|
+
where r.product_id = p.id and r.label = 'base_image' and r.sales_channel_id = ?
|
|
171
|
+
and (r.language_code is null or lower(r.language_code) = lower(?::text))
|
|
172
|
+
order by (r.language_code is null) asc
|
|
173
|
+
limit 1
|
|
174
|
+
) ov on true
|
|
175
|
+
left join gallery_item_labels gil on gil.product_id = p.id and gil.label = 'base_image'
|
|
234
176
|
where p.id in (${placeholders})
|
|
235
177
|
) holder
|
|
236
|
-
join gallery_items gi on gi.id = holder.gallery_item_id
|
|
237
|
-
where not
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
)`, channelId === null ? ids : [channelId, ...ids, channelId]);
|
|
178
|
+
join gallery_items gi on gi.id = holder.gallery_item_id and gi.product_id = holder.product_id
|
|
179
|
+
where not ${hidden.sql}`, channelId === null
|
|
180
|
+
? [...ids, ...hidden.params(null, null)]
|
|
181
|
+
: [channelId, languageCode, ...ids, ...hidden.params(channelId, languageCode)]);
|
|
241
182
|
if (rows.length === 0)
|
|
242
183
|
return urlByProduct;
|
|
243
184
|
// One call to the owner for every base image in the batch. `assets_library`
|
|
@@ -283,67 +224,20 @@ export class GalleryService {
|
|
|
283
224
|
}
|
|
284
225
|
return (await this.#fetchOne(em, id));
|
|
285
226
|
}
|
|
286
|
-
async update(productId, itemId, req, options) {
|
|
287
|
-
if (req.altText !== undefined || req.hiddenInChannels !== undefined || req.labels !== undefined) {
|
|
288
|
-
await this.#updateScoped(productId, itemId, req, options);
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
await this.#updatePosition(productId, itemId, req);
|
|
292
|
-
}
|
|
293
|
-
return (await this.#fetchOne(this.emFactory(), itemId));
|
|
294
|
-
}
|
|
295
227
|
/**
|
|
296
|
-
* Feature
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* `product.updated.v1` `['media']` after commit. A new hidden channel must be one the
|
|
300
|
-
* product is a member of (FR-014); removing one never asks (FR-015).
|
|
301
|
-
*
|
|
302
|
-
* Checkpoint F (B-1) — the labels are replaced on the Command's own `em`, under the
|
|
303
|
-
* product row lock and in its transaction, so a label conflict rolls the whole write
|
|
304
|
-
* back. With `?replace=true` a label taken from another item is that item's loss: the
|
|
305
|
-
* entry restores this item, not the other one's label.
|
|
228
|
+
* Feature 174 (`contracts/scoped-values-api.md` §6) — a collection operation: the item's
|
|
229
|
+
* position (`gallery_item.update`, one audit entry). Roles, alt text and the hidden flag are
|
|
230
|
+
* scoped fields of `PUT …/products/:id/scoped-values`.
|
|
306
231
|
*/
|
|
307
|
-
async
|
|
308
|
-
|
|
309
|
-
await this.#
|
|
310
|
-
const item = await em.findOne(GalleryItem, { id: itemId, productId });
|
|
311
|
-
if (!item) {
|
|
312
|
-
throw new HttpError(404, ERROR_CODES.GALLERY_ITEM_NOT_FOUND, `Gallery item ${itemId} not found under Product ${productId}.`);
|
|
313
|
-
}
|
|
314
|
-
const hiddenBefore = (await loadHiddenChannelsByItem(em, [itemId])).get(itemId) ?? [];
|
|
315
|
-
const labelsBefore = (await em.find(GalleryItemLabel, { galleryItemId: itemId })).map((l) => l.label);
|
|
316
|
-
const labelsAfter = requestedLabels ?? labelsBefore;
|
|
317
|
-
const before = itemProjection(item, hiddenBefore, labelsBefore);
|
|
318
|
-
const hiddenAfter = req.hiddenInChannels === undefined ? hiddenBefore : [...new Set(req.hiddenInChannels)].sort();
|
|
319
|
-
const added = hiddenAfter.filter((channelId) => !hiddenBefore.includes(channelId));
|
|
320
|
-
if (added.length > 0)
|
|
321
|
-
await this.#assertMembers(productId, added);
|
|
322
|
-
if (req.position !== undefined)
|
|
323
|
-
item.position = req.position;
|
|
324
|
-
if (req.altText !== undefined)
|
|
325
|
-
item.altText = applyTranslationPatch(item.altText, req.altText);
|
|
326
|
-
const after = itemProjection(item, hiddenAfter, labelsAfter);
|
|
327
|
-
if (JSON.stringify(before) === JSON.stringify(after))
|
|
328
|
-
return null;
|
|
329
|
-
// Re-sending `before` through the PATCH restores the item exactly (FR-081): a
|
|
330
|
-
// language the write added reads `''` there, which removes it again.
|
|
331
|
-
withRemovals(before, after);
|
|
332
|
-
if (req.hiddenInChannels !== undefined) {
|
|
333
|
-
await writeGalleryHiddenChannels(em, productId, itemId, hiddenAfter);
|
|
334
|
-
}
|
|
335
|
-
if (requestedLabels !== undefined && JSON.stringify(before['labels']) !== JSON.stringify(after['labels'])) {
|
|
336
|
-
await em.execute(`delete from gallery_item_labels where gallery_item_id = ?`, [itemId]);
|
|
337
|
-
if (requestedLabels.length > 0) {
|
|
338
|
-
await this.#applyLabels(em, productId, itemId, requestedLabels, options);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
await em.flush();
|
|
342
|
-
return { before, after };
|
|
343
|
-
});
|
|
232
|
+
async update(productId, itemId, req) {
|
|
233
|
+
await this.#updatePosition(productId, itemId, req);
|
|
234
|
+
return (await this.#fetchOne(this.emFactory(), itemId));
|
|
344
235
|
}
|
|
345
236
|
async #updatePosition(productId, itemId, req) {
|
|
346
237
|
await this.#audited('gallery_item.update', itemId, async (em) => {
|
|
238
|
+
if (!isUuidShape(itemId) || !isUuidShape(productId)) {
|
|
239
|
+
throw new HttpError(404, ERROR_CODES.GALLERY_ITEM_NOT_FOUND, `Gallery item ${itemId} not found under Product ${productId}.`);
|
|
240
|
+
}
|
|
347
241
|
const item = await em.findOne(GalleryItem, { id: itemId, productId });
|
|
348
242
|
if (!item) {
|
|
349
243
|
throw new HttpError(404, ERROR_CODES.GALLERY_ITEM_NOT_FOUND, `Gallery item ${itemId} not found under Product ${productId}.`);
|
|
@@ -356,6 +250,9 @@ export class GalleryService {
|
|
|
356
250
|
}
|
|
357
251
|
async delete(productId, itemId) {
|
|
358
252
|
await this.#audited('gallery_item.delete', itemId, async (em) => {
|
|
253
|
+
if (!isUuidShape(itemId) || !isUuidShape(productId)) {
|
|
254
|
+
throw new HttpError(404, ERROR_CODES.GALLERY_ITEM_NOT_FOUND, `Gallery item ${itemId} not found under Product ${productId}.`);
|
|
255
|
+
}
|
|
359
256
|
const item = await em.findOne(GalleryItem, { id: itemId, productId });
|
|
360
257
|
if (!item) {
|
|
361
258
|
throw new HttpError(404, ERROR_CODES.GALLERY_ITEM_NOT_FOUND, `Gallery item ${itemId} not found under Product ${productId}.`);
|
|
@@ -404,6 +301,9 @@ export class GalleryService {
|
|
|
404
301
|
objectType: 'product',
|
|
405
302
|
objectId: productId,
|
|
406
303
|
run: async ({ em }) => {
|
|
304
|
+
if (!isUuidShape(productId)) {
|
|
305
|
+
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
306
|
+
}
|
|
407
307
|
const product = await em.findOne(Product, { id: productId }, { lockMode: LockMode.PESSIMISTIC_WRITE });
|
|
408
308
|
if (!product) {
|
|
409
309
|
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
@@ -440,11 +340,10 @@ export class GalleryService {
|
|
|
440
340
|
});
|
|
441
341
|
});
|
|
442
342
|
}
|
|
443
|
-
/** FR-014 — every channel in `channelIds` is one the product is a member of, else `422 SCOPE_INVALID`. */
|
|
444
|
-
async #assertMembers(productId, channelIds) {
|
|
445
|
-
await assertProductChannelMembers(this.membership, productId, channelIds);
|
|
446
|
-
}
|
|
447
343
|
async #assertProductExists(em, productId) {
|
|
344
|
+
if (!isUuidShape(productId)) {
|
|
345
|
+
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
346
|
+
}
|
|
448
347
|
const product = await em.findOne(Product, { id: productId });
|
|
449
348
|
if (!product) {
|
|
450
349
|
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
@@ -510,79 +409,56 @@ export class GalleryService {
|
|
|
510
409
|
if (items.length === 0)
|
|
511
410
|
return [];
|
|
512
411
|
const labels = await em.find(GalleryItemLabel, { productId });
|
|
513
|
-
const hidden = await loadHiddenChannelsByItem(em, items.map((i) => i.id));
|
|
514
412
|
const labelsByItem = new Map();
|
|
515
413
|
for (const l of labels) {
|
|
516
414
|
const existing = labelsByItem.get(l.galleryItemId) ?? [];
|
|
517
415
|
existing.push(l.label);
|
|
518
416
|
labelsByItem.set(l.galleryItemId, existing);
|
|
519
417
|
}
|
|
520
|
-
return items.map((i) => this.#toDto(i, labelsByItem.get(i.id) ?? []
|
|
418
|
+
return items.map((i) => this.#toDto(i, labelsByItem.get(i.id) ?? []));
|
|
521
419
|
}
|
|
522
420
|
async #fetchOne(em, itemId) {
|
|
421
|
+
if (!isUuidShape(itemId))
|
|
422
|
+
return null;
|
|
523
423
|
const item = await em.findOne(GalleryItem, { id: itemId });
|
|
524
424
|
if (!item)
|
|
525
425
|
return null;
|
|
526
426
|
const labels = await em.find(GalleryItemLabel, { galleryItemId: itemId });
|
|
527
|
-
|
|
528
|
-
return this.#toDto(item, labels.map((l) => l.label), hidden);
|
|
427
|
+
return this.#toDto(item, labels.map((l) => l.label));
|
|
529
428
|
}
|
|
530
|
-
#toDto(item, labels
|
|
429
|
+
#toDto(item, labels) {
|
|
531
430
|
return {
|
|
532
431
|
id: item.id,
|
|
533
432
|
productId: item.productId,
|
|
534
433
|
assetId: item.assetId,
|
|
535
434
|
position: item.position,
|
|
536
435
|
labels: [...labels].sort(),
|
|
537
|
-
altText:
|
|
538
|
-
|
|
436
|
+
altText: item.altText,
|
|
437
|
+
hidden: item.hidden,
|
|
539
438
|
createdAt: item.createdAt.toISOString(),
|
|
540
439
|
updatedAt: item.updatedAt.toISOString(),
|
|
541
440
|
};
|
|
542
441
|
}
|
|
543
442
|
}
|
|
544
|
-
/** The API key of each gallery role, beside the stored label it names (Principle VI: camelCase keys). */
|
|
545
|
-
const ROLE_KEYS = [
|
|
546
|
-
['baseImage', 'base_image'],
|
|
547
|
-
['smallImage', 'small_image'],
|
|
548
|
-
['thumbnail', 'thumbnail'],
|
|
549
|
-
];
|
|
550
|
-
function channelRolesDto(channelId, roles) {
|
|
551
|
-
return {
|
|
552
|
-
channelId,
|
|
553
|
-
roles: {
|
|
554
|
-
baseImage: roles.get('base_image') ?? null,
|
|
555
|
-
smallImage: roles.get('small_image') ?? null,
|
|
556
|
-
thumbnail: roles.get('thumbnail') ?? null,
|
|
557
|
-
},
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
function sameRoles(a, b) {
|
|
561
|
-
return ROLE_KEYS.every(([key]) => a[key] === b[key]);
|
|
562
|
-
}
|
|
563
|
-
/** The audit projection of one item's scoped media write (FR-080): enough to restore it by re-sending. */
|
|
564
|
-
function itemProjection(item, hiddenInChannels, labels) {
|
|
565
|
-
const altText = Object.fromEntries(Object.entries(item.altText ?? {}).sort(([a], [b]) => a.localeCompare(b)));
|
|
566
|
-
return {
|
|
567
|
-
itemId: item.id,
|
|
568
|
-
position: item.position,
|
|
569
|
-
altText,
|
|
570
|
-
hiddenInChannels: [...hiddenInChannels].sort(),
|
|
571
|
-
labels: [...labels].sort(),
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
443
|
/**
|
|
575
|
-
*
|
|
576
|
-
*
|
|
444
|
+
* Feature 174 (`data-model.md` §6a) — a gallery item's effective `hidden` at (C, L) as one SQL
|
|
445
|
+
* boolean: the C×L override, else the C override, else the Global column. With no channel, the
|
|
446
|
+
* Global column alone. Languages compare case-insensitively (a caller's tag against the stored
|
|
447
|
+
* channel spelling).
|
|
577
448
|
*/
|
|
578
|
-
function
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
449
|
+
function effectiveHiddenSql(itemId, globalHidden, channelId) {
|
|
450
|
+
if (channelId === null)
|
|
451
|
+
return { sql: `coalesce(${globalHidden}, false)`, params: () => [] };
|
|
452
|
+
return {
|
|
453
|
+
sql: `coalesce(
|
|
454
|
+
(select (o.value ->> 'v')::boolean
|
|
455
|
+
from gallery_item_scope_overrides o
|
|
456
|
+
where o.gallery_item_id = ${itemId} and o.field = 'hidden' and o.sales_channel_id = ?
|
|
457
|
+
and (o.language_code is null or lower(o.language_code) = lower(?::text))
|
|
458
|
+
order by (o.language_code is null) asc
|
|
459
|
+
limit 1),
|
|
460
|
+
${globalHidden}, false)`,
|
|
461
|
+
params: (channel, languageCode) => [channel, languageCode],
|
|
462
|
+
};
|
|
587
463
|
}
|
|
588
464
|
//# sourceMappingURL=gallery.service.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { ERROR_CODES } from '@endora-commerce/contracts';
|
|
2
|
+
import { ERROR_CODES, isUuidShape } from '@endora-commerce/contracts';
|
|
3
3
|
import { HttpError } from '@endora-commerce/platform/http';
|
|
4
4
|
import { Product } from '../entities/product.entity.js';
|
|
5
5
|
import { GroupedItem } from '../entities/grouped-item.entity.js';
|
|
@@ -32,7 +32,15 @@ export class GroupedService {
|
|
|
32
32
|
const em = this.emFactory();
|
|
33
33
|
await this.assertGroupedParent(em, parentProductId);
|
|
34
34
|
if (input.childProductId === parentProductId) {
|
|
35
|
-
|
|
35
|
+
// Issue #624 (#86) — the product links' self-reference code, the token
|
|
36
|
+
// choosing the grouped product's sentence.
|
|
37
|
+
throw new HttpError(400, ERROR_CODES.SELF_LINK_NOT_ALLOWED, 'A grouped product cannot include itself as a child.', {
|
|
38
|
+
code: 'grouped',
|
|
39
|
+
productId: parentProductId,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (!isUuidShape(input.childProductId)) {
|
|
43
|
+
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Child product "${input.childProductId}" not found.`);
|
|
36
44
|
}
|
|
37
45
|
const child = await em.findOne(Product, { id: input.childProductId });
|
|
38
46
|
if (!child || child.deletedAt) {
|
|
@@ -64,7 +72,7 @@ export class GroupedService {
|
|
|
64
72
|
}
|
|
65
73
|
catch (err) {
|
|
66
74
|
if (err instanceof Error && /uniq_grouped_items_parent_child/.test(err.message)) {
|
|
67
|
-
throw new HttpError(409, ERROR_CODES.
|
|
75
|
+
throw new HttpError(409, ERROR_CODES.GROUPED_ITEM_ALREADY_EXISTS, `Child product "${input.childProductId}" is already in this group.`, { parentProductId, childProductId: input.childProductId, childSku: child.sku });
|
|
68
76
|
}
|
|
69
77
|
throw err;
|
|
70
78
|
}
|
|
@@ -84,6 +92,9 @@ export class GroupedService {
|
|
|
84
92
|
async updateItem(parentProductId, itemId, input) {
|
|
85
93
|
const row = await this.#audited('grouped_item.update', itemId, async (em) => {
|
|
86
94
|
await this.assertGroupedParent(em, parentProductId);
|
|
95
|
+
if (!isUuidShape(itemId) || !isUuidShape(parentProductId)) {
|
|
96
|
+
throw new HttpError(404, ERROR_CODES.GROUPED_ITEM_NOT_FOUND, `Grouped item "${itemId}" not found on parent ${parentProductId}.`);
|
|
97
|
+
}
|
|
87
98
|
const r = await em.findOne(GroupedItem, { id: itemId, parentProductId });
|
|
88
99
|
if (!r) {
|
|
89
100
|
throw new HttpError(404, ERROR_CODES.GROUPED_ITEM_NOT_FOUND, `Grouped item "${itemId}" not found on parent ${parentProductId}.`);
|
|
@@ -104,6 +115,9 @@ export class GroupedService {
|
|
|
104
115
|
async removeItem(parentProductId, itemId) {
|
|
105
116
|
await this.#audited('grouped_item.delete', itemId, async (em) => {
|
|
106
117
|
await this.assertGroupedParent(em, parentProductId);
|
|
118
|
+
if (!isUuidShape(itemId) || !isUuidShape(parentProductId)) {
|
|
119
|
+
throw new HttpError(404, ERROR_CODES.GROUPED_ITEM_NOT_FOUND, `Grouped item "${itemId}" not found on parent ${parentProductId}.`);
|
|
120
|
+
}
|
|
107
121
|
const row = await em.findOne(GroupedItem, { id: itemId, parentProductId });
|
|
108
122
|
if (!row) {
|
|
109
123
|
throw new HttpError(404, ERROR_CODES.GROUPED_ITEM_NOT_FOUND, `Grouped item "${itemId}" not found on parent ${parentProductId}.`);
|
|
@@ -114,6 +128,9 @@ export class GroupedService {
|
|
|
114
128
|
});
|
|
115
129
|
}
|
|
116
130
|
async assertGroupedParent(em, parentProductId) {
|
|
131
|
+
if (!isUuidShape(parentProductId)) {
|
|
132
|
+
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product "${parentProductId}" not found.`);
|
|
133
|
+
}
|
|
117
134
|
const parent = await em.findOne(Product, { id: parentProductId });
|
|
118
135
|
if (!parent || parent.deletedAt) {
|
|
119
136
|
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product "${parentProductId}" not found.`);
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { randomUUID } from 'node:crypto';
|
|
12
12
|
import { UniqueConstraintViolationException } from '@mikro-orm/core';
|
|
13
|
-
import { ERROR_CODES,
|
|
13
|
+
import { ERROR_CODES, isValidOrderMinimum, isUuidShape, } from '@endora-commerce/contracts';
|
|
14
14
|
import { HttpError } from '@endora-commerce/platform/http';
|
|
15
|
-
import { mirrorTranslationRemovals, sortedTranslations } from './attachment-packaging-scopes.js';
|
|
16
15
|
import { Product } from '../entities/product.entity.js';
|
|
17
16
|
import { ProductPackagingUnit } from '../entities/product-packaging-unit.entity.js';
|
|
18
17
|
const ELIGIBLE_TYPES = new Set(['simple', 'configurable']);
|
|
@@ -90,7 +89,6 @@ export class PackagingUnitService {
|
|
|
90
89
|
isDefault: req.isDefault ?? false,
|
|
91
90
|
minOrderUnits: req.minOrderUnits ?? null,
|
|
92
91
|
// Feature 163 (FR-079) — the name per language.
|
|
93
|
-
nameTranslations: applyTranslationPatch({}, req.nameTranslations ?? {}),
|
|
94
92
|
});
|
|
95
93
|
try {
|
|
96
94
|
await em.flush();
|
|
@@ -109,8 +107,6 @@ export class PackagingUnitService {
|
|
|
109
107
|
const unit = await this.#audited('packaging_unit.update', unitId, async (em) => {
|
|
110
108
|
const u = await this.#findOwned(em, productId, unitId);
|
|
111
109
|
const before = unitProjection(u);
|
|
112
|
-
if (req.name !== undefined)
|
|
113
|
-
u.name = req.name.trim();
|
|
114
110
|
if (req.baseQuantity !== undefined)
|
|
115
111
|
u.baseQuantity = req.baseQuantity;
|
|
116
112
|
if (req.position !== undefined)
|
|
@@ -119,16 +115,11 @@ export class PackagingUnitService {
|
|
|
119
115
|
u.isDefault = req.isDefault;
|
|
120
116
|
if (req.minOrderUnits !== undefined)
|
|
121
117
|
u.minOrderUnits = req.minOrderUnits;
|
|
122
|
-
// Feature 163 (FR-079) — the named languages set, `''` removes one.
|
|
123
|
-
if (req.nameTranslations !== undefined) {
|
|
124
|
-
u.nameTranslations = applyTranslationPatch(u.nameTranslations, req.nameTranslations);
|
|
125
|
-
}
|
|
126
118
|
const after = unitProjection(u);
|
|
127
119
|
// A request that changes nothing writes and announces nothing (FR-080).
|
|
128
120
|
if (JSON.stringify(before) === JSON.stringify(after) && req.position === undefined) {
|
|
129
121
|
return { result: u, before, after, unchanged: true };
|
|
130
122
|
}
|
|
131
|
-
mirrorTranslationRemovals(before, after, ['nameTranslations']);
|
|
132
123
|
try {
|
|
133
124
|
await em.flush();
|
|
134
125
|
}
|
|
@@ -168,6 +159,9 @@ export class PackagingUnitService {
|
|
|
168
159
|
}
|
|
169
160
|
// -- INTERNALS ------------------------------------------------------------
|
|
170
161
|
async #assertProductExists(em, productId) {
|
|
162
|
+
if (!isUuidShape(productId)) {
|
|
163
|
+
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
164
|
+
}
|
|
171
165
|
const product = await em.findOne(Product, { id: productId });
|
|
172
166
|
if (!product) {
|
|
173
167
|
throw new HttpError(404, ERROR_CODES.PRODUCT_NOT_FOUND, `Product ${productId} not found.`);
|
|
@@ -181,6 +175,9 @@ export class PackagingUnitService {
|
|
|
181
175
|
}
|
|
182
176
|
}
|
|
183
177
|
async #findOwned(em, productId, unitId) {
|
|
178
|
+
if (!isUuidShape(unitId) || !isUuidShape(productId)) {
|
|
179
|
+
throw new HttpError(404, ERROR_CODES.PACKAGING_UNIT_NOT_FOUND, `Packaging unit ${unitId} not found under Product ${productId}.`);
|
|
180
|
+
}
|
|
184
181
|
const unit = await em.findOne(ProductPackagingUnit, { id: unitId, productId });
|
|
185
182
|
if (!unit) {
|
|
186
183
|
throw new HttpError(404, ERROR_CODES.PACKAGING_UNIT_NOT_FOUND, `Packaging unit ${unitId} not found under Product ${productId}.`);
|
|
@@ -222,7 +219,6 @@ export class PackagingUnitService {
|
|
|
222
219
|
id: u.id,
|
|
223
220
|
productId: u.productId,
|
|
224
221
|
name: u.name,
|
|
225
|
-
nameTranslations: { ...(u.nameTranslations ?? {}) },
|
|
226
222
|
baseQuantity: u.baseQuantity,
|
|
227
223
|
position: u.position,
|
|
228
224
|
isDefault: u.isDefault,
|
|
@@ -241,7 +237,6 @@ function unitProjection(u) {
|
|
|
241
237
|
return {
|
|
242
238
|
productId: u.productId,
|
|
243
239
|
name: u.name,
|
|
244
|
-
nameTranslations: sortedTranslations(u.nameTranslations),
|
|
245
240
|
baseQuantity: u.baseQuantity,
|
|
246
241
|
isDefault: u.isDefault,
|
|
247
242
|
minOrderUnits: u.minOrderUnits ?? null,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pure Page Builder helpers the catalogue's content shares between
|
|
3
|
+
* category content (feature `fcf6daa76`) and product content attributes
|
|
4
|
+
* (`specs/172-product-content-attributes/`, research R-2, R-3, R-12).
|
|
5
|
+
*
|
|
6
|
+
* No I/O and no entity: every function here takes plain JSON and answers
|
|
7
|
+
* plain JSON, so the rule each one states has exactly one home.
|
|
8
|
+
*/
|
|
9
|
+
/** One language's Page Builder document — opaque beyond being a JSON object. */
|
|
10
|
+
export type PageBuilderDocument = Record<string, unknown>;
|
|
11
|
+
/** The stored envelope: one document per language code. */
|
|
12
|
+
export interface PageBuilderEnvelope {
|
|
13
|
+
languages: Record<string, PageBuilderDocument>;
|
|
14
|
+
}
|
|
15
|
+
/** What the product form's card shows of one language, instead of the document (R-3). */
|
|
16
|
+
export interface PageBuilderDocumentSummary {
|
|
17
|
+
/** Top-level blocks. */
|
|
18
|
+
blocks: number;
|
|
19
|
+
/** The first text a block carries, tags stripped, whitespace folded, at most {@link EXCERPT_MAX_LENGTH} characters. */
|
|
20
|
+
excerpt: string | null;
|
|
21
|
+
}
|
|
22
|
+
/** The ceiling on a summary's excerpt, in characters. */
|
|
23
|
+
export declare const EXCERPT_MAX_LENGTH = 120;
|
|
24
|
+
/**
|
|
25
|
+
* Whether a Page Builder document would render anything: a block at the top
|
|
26
|
+
* level, or in a legacy `zones` bucket. An editor that was opened and saved
|
|
27
|
+
* untouched stores a document with neither.
|
|
28
|
+
*/
|
|
29
|
+
export declare function hasPageBuilderBlocks(tree: PageBuilderDocument): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The envelope as it is stored (FR-013, R-2): a language whose document holds
|
|
32
|
+
* no block is dropped, and an envelope with no language left is `null` — "no
|
|
33
|
+
* value". Normalising once on write means every reader (the card, the delete
|
|
34
|
+
* count, the product page) reads one fact rather than re-deriving it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalisePageBuilderEnvelope(envelope: PageBuilderEnvelope | null): PageBuilderEnvelope | null;
|
|
37
|
+
/**
|
|
38
|
+
* One language's summary (R-3): the top-level block count, and the first text
|
|
39
|
+
* a top-level block carries. The "first text" rule is per block shape, which
|
|
40
|
+
* is why it lives here and not in a jsonpath.
|
|
41
|
+
*/
|
|
42
|
+
export declare function summarisePageBuilderDocument(document: PageBuilderDocument): PageBuilderDocumentSummary;
|
|
43
|
+
/** The UTF-8 byte length of the envelope's JSON — what the 1 MiB ceiling is measured in (FR-012). */
|
|
44
|
+
export declare function pageBuilderEnvelopeBytes(envelope: PageBuilderEnvelope): number;
|
|
45
|
+
/** The part of a read's context the language walk reads. */
|
|
46
|
+
export interface PageBuilderLanguageContext {
|
|
47
|
+
preferredLanguage?: string | null | undefined;
|
|
48
|
+
resolvedChannel: {
|
|
49
|
+
defaultLanguage?: string | null | undefined;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The language a reader is shown (FR-033, R-12), shared by category and product
|
|
54
|
+
* content: the caller's, then the channel's default, then `en-US`, then `en`,
|
|
55
|
+
* then any stored language. A language whose document holds no block is
|
|
56
|
+
* skipped, because an operator who saved the Polish tab empty did not ask for
|
|
57
|
+
* the English text to disappear from the Polish storefront. `null` when no
|
|
58
|
+
* language holds a block.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolvePageBuilderLanguage(languages: Readonly<Record<string, PageBuilderDocument>>, ctx: PageBuilderLanguageContext): {
|
|
61
|
+
language: string;
|
|
62
|
+
document: PageBuilderDocument;
|
|
63
|
+
} | null;
|
|
64
|
+
//# sourceMappingURL=page-builder-content.d.ts.map
|