@endora-commerce/mod-cms 0.0.0-stage → 0.100.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/LICENSE +21 -0
- package/README.md +65 -2
- package/dist/admin/api/cms-client.d.ts +77 -0
- package/dist/admin/api/cms-client.d.ts.map +1 -0
- package/dist/admin/api/cms-client.js +162 -0
- package/dist/admin/api/cms-client.js.map +1 -0
- package/dist/admin/components/AdminCatalogPreviewProvider.d.ts +6 -0
- package/dist/admin/components/AdminCatalogPreviewProvider.d.ts.map +1 -0
- package/dist/admin/components/AdminCatalogPreviewProvider.js +74 -0
- package/dist/admin/components/AdminCatalogPreviewProvider.js.map +1 -0
- package/dist/admin/components/AdminCmsAssetProvider.d.ts +9 -0
- package/dist/admin/components/AdminCmsAssetProvider.d.ts.map +1 -0
- package/dist/admin/components/AdminCmsAssetProvider.js +50 -0
- package/dist/admin/components/AdminCmsAssetProvider.js.map +1 -0
- package/dist/admin/components/BackgroundFields.d.ts +4 -0
- package/dist/admin/components/BackgroundFields.d.ts.map +1 -0
- package/dist/admin/components/BackgroundFields.js +40 -0
- package/dist/admin/components/BackgroundFields.js.map +1 -0
- package/dist/admin/components/ButtonLinkFields.d.ts +6 -0
- package/dist/admin/components/ButtonLinkFields.d.ts.map +1 -0
- package/dist/admin/components/ButtonLinkFields.js +127 -0
- package/dist/admin/components/ButtonLinkFields.js.map +1 -0
- package/dist/admin/components/CarouselPreviewNav.d.ts +12 -0
- package/dist/admin/components/CarouselPreviewNav.d.ts.map +1 -0
- package/dist/admin/components/CarouselPreviewNav.js +31 -0
- package/dist/admin/components/CarouselPreviewNav.js.map +1 -0
- package/dist/admin/components/CmsContentEditorLayout.d.ts +12 -0
- package/dist/admin/components/CmsContentEditorLayout.d.ts.map +1 -0
- package/dist/admin/components/CmsContentEditorLayout.js +9 -0
- package/dist/admin/components/CmsContentEditorLayout.js.map +1 -0
- package/dist/admin/components/ComponentDragHandle.d.ts +6 -0
- package/dist/admin/components/ComponentDragHandle.d.ts.map +1 -0
- package/dist/admin/components/ComponentDragHandle.js +119 -0
- package/dist/admin/components/ComponentDragHandle.js.map +1 -0
- package/dist/admin/components/ContentSliderActionBarExtras.d.ts +6 -0
- package/dist/admin/components/ContentSliderActionBarExtras.d.ts.map +1 -0
- package/dist/admin/components/ContentSliderActionBarExtras.js +109 -0
- package/dist/admin/components/ContentSliderActionBarExtras.js.map +1 -0
- package/dist/admin/components/HookBlockAttachmentsPanel.d.ts +9 -0
- package/dist/admin/components/HookBlockAttachmentsPanel.d.ts.map +1 -0
- package/dist/admin/components/HookBlockAttachmentsPanel.js +137 -0
- package/dist/admin/components/HookBlockAttachmentsPanel.js.map +1 -0
- package/dist/admin/components/PageBuilderActionBar.d.ts +10 -0
- package/dist/admin/components/PageBuilderActionBar.d.ts.map +1 -0
- package/dist/admin/components/PageBuilderActionBar.js +118 -0
- package/dist/admin/components/PageBuilderActionBar.js.map +1 -0
- package/dist/admin/components/PageBuilderDrawer.d.ts +16 -0
- package/dist/admin/components/PageBuilderDrawer.d.ts.map +1 -0
- package/dist/admin/components/PageBuilderDrawer.js +53 -0
- package/dist/admin/components/PageBuilderDrawer.js.map +1 -0
- package/dist/admin/components/PageBuilderEditor.d.ts +45 -0
- package/dist/admin/components/PageBuilderEditor.d.ts.map +1 -0
- package/dist/admin/components/PageBuilderEditor.js +632 -0
- package/dist/admin/components/PageBuilderEditor.js.map +1 -0
- package/dist/admin/components/PuckActionGuard.d.ts +12 -0
- package/dist/admin/components/PuckActionGuard.d.ts.map +1 -0
- package/dist/admin/components/PuckActionGuard.js +30 -0
- package/dist/admin/components/PuckActionGuard.js.map +1 -0
- package/dist/admin/components/RowLayoutPicker.d.ts +8 -0
- package/dist/admin/components/RowLayoutPicker.d.ts.map +1 -0
- package/dist/admin/components/RowLayoutPicker.js +17 -0
- package/dist/admin/components/RowLayoutPicker.js.map +1 -0
- package/dist/admin/components/SliderPreviewActionBarExtras.d.ts +6 -0
- package/dist/admin/components/SliderPreviewActionBarExtras.d.ts.map +1 -0
- package/dist/admin/components/SliderPreviewActionBarExtras.js +32 -0
- package/dist/admin/components/SliderPreviewActionBarExtras.js.map +1 -0
- package/dist/admin/components/admin-catalog-preview-map.d.ts +17 -0
- package/dist/admin/components/admin-catalog-preview-map.d.ts.map +1 -0
- package/dist/admin/components/admin-catalog-preview-map.js +18 -0
- package/dist/admin/components/admin-catalog-preview-map.js.map +1 -0
- package/dist/admin/components/build-viewports.d.ts +23 -0
- package/dist/admin/components/build-viewports.d.ts.map +1 -0
- package/dist/admin/components/build-viewports.js +23 -0
- package/dist/admin/components/build-viewports.js.map +1 -0
- package/dist/admin/components/cms-template-layout.d.ts +16 -0
- package/dist/admin/components/cms-template-layout.d.ts.map +1 -0
- package/dist/admin/components/cms-template-layout.js +53 -0
- package/dist/admin/components/cms-template-layout.js.map +1 -0
- package/dist/admin/components/page-builder-i18n.d.ts +27 -0
- package/dist/admin/components/page-builder-i18n.d.ts.map +1 -0
- package/dist/admin/components/page-builder-i18n.js +34 -0
- package/dist/admin/components/page-builder-i18n.js.map +1 -0
- package/dist/admin/components/puck-safe.d.ts +10 -0
- package/dist/admin/components/puck-safe.d.ts.map +1 -0
- package/dist/admin/components/puck-safe.js +22 -0
- package/dist/admin/components/puck-safe.js.map +1 -0
- package/dist/admin/components/scope-utils.d.ts +4 -0
- package/dist/admin/components/scope-utils.d.ts.map +1 -0
- package/dist/admin/components/scope-utils.js +7 -0
- package/dist/admin/components/scope-utils.js.map +1 -0
- package/dist/admin/editors/BlockEditor.d.ts +9 -0
- package/dist/admin/editors/BlockEditor.d.ts.map +1 -0
- package/dist/admin/editors/BlockEditor.js +217 -0
- package/dist/admin/editors/BlockEditor.js.map +1 -0
- package/dist/admin/editors/PageEditor.d.ts +9 -0
- package/dist/admin/editors/PageEditor.d.ts.map +1 -0
- package/dist/admin/editors/PageEditor.js +316 -0
- package/dist/admin/editors/PageEditor.js.map +1 -0
- package/dist/admin/editors/TemplateEditor.d.ts +9 -0
- package/dist/admin/editors/TemplateEditor.d.ts.map +1 -0
- package/dist/admin/editors/TemplateEditor.js +180 -0
- package/dist/admin/editors/TemplateEditor.js.map +1 -0
- package/dist/admin/index.d.ts +38 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +144 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/pages/BlocksListPage.d.ts +9 -0
- package/dist/admin/pages/BlocksListPage.d.ts.map +1 -0
- package/dist/admin/pages/BlocksListPage.js +47 -0
- package/dist/admin/pages/BlocksListPage.js.map +1 -0
- package/dist/admin/pages/HooksPage.d.ts +9 -0
- package/dist/admin/pages/HooksPage.d.ts.map +1 -0
- package/dist/admin/pages/HooksPage.js +41 -0
- package/dist/admin/pages/HooksPage.js.map +1 -0
- package/dist/admin/pages/PagesListPage.d.ts +9 -0
- package/dist/admin/pages/PagesListPage.d.ts.map +1 -0
- package/dist/admin/pages/PagesListPage.js +51 -0
- package/dist/admin/pages/PagesListPage.js.map +1 -0
- package/dist/admin/pages/TemplatesListPage.d.ts +9 -0
- package/dist/admin/pages/TemplatesListPage.d.ts.map +1 -0
- package/dist/admin/pages/TemplatesListPage.js +47 -0
- package/dist/admin/pages/TemplatesListPage.js.map +1 -0
- package/dist/admin-ui/index.d.ts +90 -0
- package/dist/admin-ui/index.d.ts.map +1 -0
- package/dist/admin-ui/index.js +89 -0
- package/dist/admin-ui/index.js.map +1 -0
- package/dist/backend/cli/block-names.d.ts +92 -0
- package/dist/backend/cli/block-names.d.ts.map +1 -0
- package/dist/backend/cli/block-names.js +132 -0
- package/dist/backend/cli/block-names.js.map +1 -0
- package/dist/backend/entities/cms-block.entity.d.ts +20 -0
- package/dist/backend/entities/cms-block.entity.d.ts.map +1 -0
- package/dist/backend/entities/cms-block.entity.js +77 -0
- package/dist/backend/entities/cms-block.entity.js.map +1 -0
- package/dist/backend/entities/cms-hook-block-attachment.entity.d.ts +15 -0
- package/dist/backend/entities/cms-hook-block-attachment.entity.d.ts.map +1 -0
- package/dist/backend/entities/cms-hook-block-attachment.entity.js +46 -0
- package/dist/backend/entities/cms-hook-block-attachment.entity.js.map +1 -0
- package/dist/backend/entities/cms-hook.entity.d.ts +20 -0
- package/dist/backend/entities/cms-hook.entity.d.ts.map +1 -0
- package/dist/backend/entities/cms-hook.entity.js +73 -0
- package/dist/backend/entities/cms-hook.entity.js.map +1 -0
- package/dist/backend/entities/cms-page.entity.d.ts +43 -0
- package/dist/backend/entities/cms-page.entity.d.ts.map +1 -0
- package/dist/backend/entities/cms-page.entity.js +140 -0
- package/dist/backend/entities/cms-page.entity.js.map +1 -0
- package/dist/backend/entities/cms-template.entity.d.ts +20 -0
- package/dist/backend/entities/cms-template.entity.d.ts.map +1 -0
- package/dist/backend/entities/cms-template.entity.js +73 -0
- package/dist/backend/entities/cms-template.entity.js.map +1 -0
- package/dist/backend/index.d.ts +157 -0
- package/dist/backend/index.d.ts.map +1 -0
- package/dist/backend/index.js +317 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/plugin.d.ts +81 -0
- package/dist/backend/plugin.d.ts.map +1 -0
- package/dist/backend/plugin.js +81 -0
- package/dist/backend/plugin.js.map +1 -0
- package/dist/backend/routes.admin.d.ts +19 -0
- package/dist/backend/routes.admin.d.ts.map +1 -0
- package/dist/backend/routes.admin.js +164 -0
- package/dist/backend/routes.admin.js.map +1 -0
- package/dist/backend/routes.storefront.d.ts +6 -0
- package/dist/backend/routes.storefront.d.ts.map +1 -0
- package/dist/backend/routes.storefront.js +89 -0
- package/dist/backend/routes.storefront.js.map +1 -0
- package/dist/backend/services/asset-embed-resolver.d.ts +17 -0
- package/dist/backend/services/asset-embed-resolver.d.ts.map +1 -0
- package/dist/backend/services/asset-embed-resolver.js +40 -0
- package/dist/backend/services/asset-embed-resolver.js.map +1 -0
- package/dist/backend/services/asset-references.d.ts +4 -0
- package/dist/backend/services/asset-references.d.ts.map +1 -0
- package/dist/backend/services/asset-references.js +55 -0
- package/dist/backend/services/asset-references.js.map +1 -0
- package/dist/backend/services/cms-block-read-port.d.ts +27 -0
- package/dist/backend/services/cms-block-read-port.d.ts.map +1 -0
- package/dist/backend/services/cms-block-read-port.js +50 -0
- package/dist/backend/services/cms-block-read-port.js.map +1 -0
- package/dist/backend/services/cms-block-seed-port.d.ts +31 -0
- package/dist/backend/services/cms-block-seed-port.d.ts.map +1 -0
- package/dist/backend/services/cms-block-seed-port.js +68 -0
- package/dist/backend/services/cms-block-seed-port.js.map +1 -0
- package/dist/backend/services/cms-block-service.d.ts +38 -0
- package/dist/backend/services/cms-block-service.d.ts.map +1 -0
- package/dist/backend/services/cms-block-service.js +218 -0
- package/dist/backend/services/cms-block-service.js.map +1 -0
- package/dist/backend/services/cms-cache.d.ts +54 -0
- package/dist/backend/services/cms-cache.d.ts.map +1 -0
- package/dist/backend/services/cms-cache.js +113 -0
- package/dist/backend/services/cms-cache.js.map +1 -0
- package/dist/backend/services/cms-hook-service.d.ts +35 -0
- package/dist/backend/services/cms-hook-service.d.ts.map +1 -0
- package/dist/backend/services/cms-hook-service.js +216 -0
- package/dist/backend/services/cms-hook-service.js.map +1 -0
- package/dist/backend/services/cms-language-reference.d.ts +11 -0
- package/dist/backend/services/cms-language-reference.d.ts.map +1 -0
- package/dist/backend/services/cms-language-reference.js +26 -0
- package/dist/backend/services/cms-language-reference.js.map +1 -0
- package/dist/backend/services/cms-page-read-port.d.ts +23 -0
- package/dist/backend/services/cms-page-read-port.d.ts.map +1 -0
- package/dist/backend/services/cms-page-read-port.js +54 -0
- package/dist/backend/services/cms-page-read-port.js.map +1 -0
- package/dist/backend/services/cms-page-service.d.ts +104 -0
- package/dist/backend/services/cms-page-service.d.ts.map +1 -0
- package/dist/backend/services/cms-page-service.js +468 -0
- package/dist/backend/services/cms-page-service.js.map +1 -0
- package/dist/backend/services/cms-reference-registry.d.ts +30 -0
- package/dist/backend/services/cms-reference-registry.d.ts.map +1 -0
- package/dist/backend/services/cms-reference-registry.js +98 -0
- package/dist/backend/services/cms-reference-registry.js.map +1 -0
- package/dist/backend/services/cms-template-service.d.ts +37 -0
- package/dist/backend/services/cms-template-service.d.ts.map +1 -0
- package/dist/backend/services/cms-template-service.js +205 -0
- package/dist/backend/services/cms-template-service.js.map +1 -0
- package/dist/backend/services/content-tree-walker.d.ts +7 -0
- package/dist/backend/services/content-tree-walker.d.ts.map +1 -0
- package/dist/backend/services/content-tree-walker.js +89 -0
- package/dist/backend/services/content-tree-walker.js.map +1 -0
- package/dist/backend/services/page-builder-registry.d.ts +120 -0
- package/dist/backend/services/page-builder-registry.d.ts.map +1 -0
- package/dist/backend/services/page-builder-registry.js +220 -0
- package/dist/backend/services/page-builder-registry.js.map +1 -0
- package/dist/backend/services/seed-hooks.d.ts +22 -0
- package/dist/backend/services/seed-hooks.d.ts.map +1 -0
- package/dist/backend/services/seed-hooks.js +94 -0
- package/dist/backend/services/seed-hooks.js.map +1 -0
- package/dist/backend/services/storefront-resolver.d.ts +71 -0
- package/dist/backend/services/storefront-resolver.d.ts.map +1 -0
- package/dist/backend/services/storefront-resolver.js +329 -0
- package/dist/backend/services/storefront-resolver.js.map +1 -0
- package/dist/manifest.d.ts +225 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +695 -0
- package/dist/manifest.js.map +1 -0
- package/dist/migrations/20260425T162418_cms_pages_init.d.ts +10 -0
- package/dist/migrations/20260425T162418_cms_pages_init.d.ts.map +1 -0
- package/dist/migrations/20260425T162418_cms_pages_init.js +30 -0
- package/dist/migrations/20260425T162418_cms_pages_init.js.map +1 -0
- package/dist/migrations/20260505T130214_cms_init.d.ts +28 -0
- package/dist/migrations/20260505T130214_cms_init.d.ts.map +1 -0
- package/dist/migrations/20260505T130214_cms_init.js +332 -0
- package/dist/migrations/20260505T130214_cms_init.js.map +1 -0
- package/dist/migrations/20260903T101741_cms_namespace_block_names.d.ts +6 -0
- package/dist/migrations/20260903T101741_cms_namespace_block_names.d.ts.map +1 -0
- package/dist/migrations/20260903T101741_cms_namespace_block_names.js +60 -0
- package/dist/migrations/20260903T101741_cms_namespace_block_names.js.map +1 -0
- package/dist/migrations/20260912T094733_cms_sales_channel_cms_pages.d.ts +27 -0
- package/dist/migrations/20260912T094733_cms_sales_channel_cms_pages.d.ts.map +1 -0
- package/dist/migrations/20260912T094733_cms_sales_channel_cms_pages.js +44 -0
- package/dist/migrations/20260912T094733_cms_sales_channel_cms_pages.js.map +1 -0
- package/dist/migrations/20260912T125709_cms_page_body_asset_ref_index.d.ts +32 -0
- package/dist/migrations/20260912T125709_cms_page_body_asset_ref_index.d.ts.map +1 -0
- package/dist/migrations/20260912T125709_cms_page_body_asset_ref_index.js +36 -0
- package/dist/migrations/20260912T125709_cms_page_body_asset_ref_index.js.map +1 -0
- package/dist/migrations/index.d.ts +31 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +37 -0
- package/dist/migrations/index.js.map +1 -0
- package/docs/cms/extending-page-builder.md +256 -0
- package/docs/cms/index.md +233 -0
- package/i18n/en.json +231 -0
- package/i18n/pl.json +231 -0
- package/package.json +125 -3
- package/tailwind.css +16 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplatesListPage.d.ts","sourceRoot":"","sources":["../../../src/admin/pages/TemplatesListPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBzE,wBAAgB,iBAAiB,IAAI,SAAS,CA2F7C;AAED;;;;GAIG;AACH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import { Alert, AlertDescription, Button, Card, CardContent, CardHeader, CardTitle, PageHeader } from '@endora-commerce/admin-kit/ui';
|
|
5
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@endora-commerce/admin-kit/ui';
|
|
6
|
+
import { useAuth } from '@endora-commerce/admin-kit/lib';
|
|
7
|
+
import { useTranslation } from '@endora-commerce/admin-kit/i18n';
|
|
8
|
+
import { cmsClient } from '../api/cms-client.js';
|
|
9
|
+
export function TemplatesListPage() {
|
|
10
|
+
const t = useTranslation('cms');
|
|
11
|
+
const { hasPermission } = useAuth();
|
|
12
|
+
// The create route this screen links to takes the **write** code (feature
|
|
13
|
+
// 091, batch 16), so the button is gated on the same one: a link whose
|
|
14
|
+
// destination the operator's codes cannot open answers the admin's not-found
|
|
15
|
+
// page, which says nothing about permissions at all. That is batch 14's
|
|
16
|
+
// `/sales-channels/new` shape, applied to the five create entry points these
|
|
17
|
+
// two modules have.
|
|
18
|
+
const canWrite = hasPermission('cms.write');
|
|
19
|
+
const [rows, setRows] = useState([]);
|
|
20
|
+
const [loading, setLoading] = useState(true);
|
|
21
|
+
const [error, setError] = useState(null);
|
|
22
|
+
const load = useCallback(async () => {
|
|
23
|
+
setLoading(true);
|
|
24
|
+
setError(null);
|
|
25
|
+
try {
|
|
26
|
+
const out = await cmsClient.listTemplates();
|
|
27
|
+
setRows(out.data);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
setLoading(false);
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
void load();
|
|
38
|
+
}, [load]);
|
|
39
|
+
return (_jsxs("div", { className: "b2b-page b2b-page--wide space-y-4", children: [_jsx(PageHeader, { title: t('templatesList.title'), description: t('templatesList.description'), actions: canWrite ? (_jsx(Button, { asChild: true, children: _jsx(Link, { to: "/cms/templates/new", children: t('templatesList.new') }) })) : null }), error ? (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: error }) })) : null, _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { className: "text-base", children: t('templatesList.cardTitle') }) }), _jsx(CardContent, { children: loading ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('templatesList.loading') })) : rows.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('templatesList.empty') })) : (_jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t('columns.name') }), _jsx(TableHead, { children: t('columns.code') }), _jsx(TableHead, { children: t('columns.languages') })] }) }), _jsx(TableBody, { children: rows.map((template) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsx(Link, { to: `/cms/templates/${template.id}`, className: "font-medium text-primary hover:underline", children: template.name }) }), _jsx(TableCell, { className: "font-mono text-xs", children: template.code }), _jsx(TableCell, { className: "text-xs text-muted-foreground", children: template.languages.join(', ') })] }, template.id))) })] })) })] })] }));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The registry loads a route component through a dynamic-import factory and
|
|
43
|
+
* reads its default export (feature 091, FR-013). The named export stays: it is
|
|
44
|
+
* the spelling this module's own code and its tests use.
|
|
45
|
+
*/
|
|
46
|
+
export default TemplatesListPage;
|
|
47
|
+
//# sourceMappingURL=TemplatesListPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplatesListPage.js","sourceRoot":"","sources":["../../../src/admin/pages/TemplatesListPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACtI,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,GACT,MAAM,+BAA+B,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S,cACP,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACtB,MAAC,QAAQ,eACP,KAAC,SAAS,cACR,KAAC,IAAI,IACH,EAAE,EAAE,kBAAkB,QAAQ,CAAC,EAAE,EAAE,EACnC,SAAS,EAAC,0CAA0C,YAEnD,QAAQ,CAAC,IAAI,GACT,GACG,EACZ,KAAC,SAAS,IAAC,SAAS,EAAC,mBAAmB,YAAE,QAAQ,CAAC,IAAI,GAAa,EACpE,KAAC,SAAS,IAAC,SAAS,EAAC,+BAA+B,YACjD,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GACpB,KAZC,QAAQ,CAAC,EAAE,CAaf,CACZ,CAAC,GACQ,IACN,CACT,GACW,IACT,IACH,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cms`' published component surface — D-191's `./admin-ui` exit, taken for a
|
|
3
|
+
* second time and for a component with an *internal* consumer (feature 091,
|
|
4
|
+
* Phase 4, batch 16; `contracts/admin-component-contribution.md` Z9…Z12).
|
|
5
|
+
*
|
|
6
|
+
* ## What is published, and why it is a component rather than a zone
|
|
7
|
+
*
|
|
8
|
+
* `PageBuilderEditor` is the Puck canvas `cms`' three editors render and that
|
|
9
|
+
* `blog`'s post and category editors render too — the two keys
|
|
10
|
+
* `backend/scripts/ledgers/cross-module-imports/blog.ts` has carried since
|
|
11
|
+
* feature 091's Phase 0. `admin-component-contribution.md` Z1 decides the exit
|
|
12
|
+
* from the **signature** rather than from taste, and this batch re-read it
|
|
13
|
+
* rather than inheriting the shard's answer: the props are
|
|
14
|
+
* `data: Data | null` in and `onChange: (data: Data) => void` back, with
|
|
15
|
+
* `contentKey`, `pageContainer`, `context`, `languages`, `activeLanguage` and
|
|
16
|
+
* four resolver callbacks around them. Value in, value back — Z1 question 1 —
|
|
17
|
+
* so the **consumer** decides that it appears, which is a published component
|
|
18
|
+
* and not something the owner contributes to a place it chose.
|
|
19
|
+
*
|
|
20
|
+
* ## Why not the kit, and why not `@endora-commerce/page-builder-admin`
|
|
21
|
+
*
|
|
22
|
+
* The kit refuses it on R7, exactly as it refused the chrome P5b published: the
|
|
23
|
+
* component is a `@measured/puck` `<Puck>` host, and the kit is what all 66
|
|
24
|
+
* module packages' admin layers compile against, so Puck would sit behind the
|
|
25
|
+
* admin design system for every one of them.
|
|
26
|
+
*
|
|
27
|
+
* The chrome package refuses it on ownership. `@endora-commerce/page-builder-admin`
|
|
28
|
+
* holds the files that name `cms` **nowhere** (D-192, Z1.2); this one names
|
|
29
|
+
* `cms` in three places that are not incidental — it calls `cmsClient` for the
|
|
30
|
+
* extension-component descriptor and for the on-canvas embed preview, it reads
|
|
31
|
+
* `useTranslation('cms')`, and `withCmsPageRoot`/`pageContainer` are the CMS
|
|
32
|
+
* page's own layout. Moving it there would put a module's API client and a
|
|
33
|
+
* module's translation namespace inside the package every builder composes,
|
|
34
|
+
* which is the inversion D-192 refused one hop out.
|
|
35
|
+
*
|
|
36
|
+
* ## Why this file re-exports rather than holding the component
|
|
37
|
+
*
|
|
38
|
+
* `credentials`' `./admin-ui` — the first — keeps its one component's source in
|
|
39
|
+
* this directory, and it can, because that component has exactly one caller and
|
|
40
|
+
* that caller is in another package. This one has **two kinds** of caller:
|
|
41
|
+
* `blog`'s two editors through the subpath, and `cms`' own three editors
|
|
42
|
+
* through a relative import. The component's collaborators are fifteen files
|
|
43
|
+
* under `src/admin/components/` and its `cmsClient` is `src/admin/api/`'s, so
|
|
44
|
+
* moving the source here would either split that cluster across two directories
|
|
45
|
+
* or drag `cms`' own screens' API client into the published layer. Both layers
|
|
46
|
+
* compile in one program and emit into one `dist` (Z9), so the barrel costs
|
|
47
|
+
* nothing and the surface is still exactly what this file lists — which is R2's
|
|
48
|
+
* rule one directory over.
|
|
49
|
+
*
|
|
50
|
+
* ## The reach stays counted (Z11)
|
|
51
|
+
*
|
|
52
|
+
* `check:module-boundary`'s D-171 designation is derived from the artefact — a
|
|
53
|
+
* subpath is contract surface **iff** its emitted module exports no runtime
|
|
54
|
+
* binding — and `dist/admin-ui/index.js` re-exports a React component, so it
|
|
55
|
+
* exports one. `blog`'s two ledger entries are therefore **re-keyed, not
|
|
56
|
+
* retired**: the coupling is real, it now has a supported spelling, and a
|
|
57
|
+
* supported spelling is not an uncounted one. The shard's own retiring
|
|
58
|
+
* condition is unchanged and is not this merge request's — it names D-192's
|
|
59
|
+
* page-builder family growing a home for the whole builder — which is why those
|
|
60
|
+
* two entries survive the move with their reasons intact.
|
|
61
|
+
*
|
|
62
|
+
* ## Presence (Z12), and why the consumer needs no gate of its own
|
|
63
|
+
*
|
|
64
|
+
* A statically imported component is filtered by nothing, and `cms` declares an
|
|
65
|
+
* activation control (`cms.enabled`), so Z12 asks the consumer what happens
|
|
66
|
+
* while the owner is off. `credentials`' answer was a
|
|
67
|
+
* `useSurfaceVisibility()({ module: 'credentials' })` around the button that
|
|
68
|
+
* opens its modal. This one's answer is different and is **derived from the
|
|
69
|
+
* manifests rather than written into a screen**: `blog` declares `cms` in its
|
|
70
|
+
* manifest `dependencies`, and `ModuleGatingGraph`
|
|
71
|
+
* (`packages/platform/src/lifecycle/services/gating-graph.ts`) reads
|
|
72
|
+
* `dependencies` ∪ `acknowledgedDependencies` when deactivating and
|
|
73
|
+
* `dependencies` when activating — so *"`cms` off while `blog` is on"* is a
|
|
74
|
+
* state the platform refuses at the flip, in both directions. A gate in
|
|
75
|
+
* `blog`'s editors would be a second answer to a question the lifecycle has
|
|
76
|
+
* already answered, in a screen, where nothing could see it drift; it would
|
|
77
|
+
* also put a `module-namespace` key in `check:admin-zones`' foreign-id ledger
|
|
78
|
+
* for a branch no operator can reach.
|
|
79
|
+
*
|
|
80
|
+
* Gating here would be the wrong place either way, and for `credentials`'
|
|
81
|
+
* reason: the component cannot know whether its absence should collapse the
|
|
82
|
+
* canvas, the tab or the whole screen.
|
|
83
|
+
*
|
|
84
|
+
* **Un-declare that dependency and this paragraph is false.** `blog`'s manifest
|
|
85
|
+
* is where the answer lives, so a merge request that drops `cms` from it owes
|
|
86
|
+
* this seam a gate.
|
|
87
|
+
*/
|
|
88
|
+
export { PageBuilderEditor } from '../admin/components/PageBuilderEditor.js';
|
|
89
|
+
export type { PageBuilderData } from '../admin/components/PageBuilderEditor.js';
|
|
90
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cms`' published component surface — D-191's `./admin-ui` exit, taken for a
|
|
3
|
+
* second time and for a component with an *internal* consumer (feature 091,
|
|
4
|
+
* Phase 4, batch 16; `contracts/admin-component-contribution.md` Z9…Z12).
|
|
5
|
+
*
|
|
6
|
+
* ## What is published, and why it is a component rather than a zone
|
|
7
|
+
*
|
|
8
|
+
* `PageBuilderEditor` is the Puck canvas `cms`' three editors render and that
|
|
9
|
+
* `blog`'s post and category editors render too — the two keys
|
|
10
|
+
* `backend/scripts/ledgers/cross-module-imports/blog.ts` has carried since
|
|
11
|
+
* feature 091's Phase 0. `admin-component-contribution.md` Z1 decides the exit
|
|
12
|
+
* from the **signature** rather than from taste, and this batch re-read it
|
|
13
|
+
* rather than inheriting the shard's answer: the props are
|
|
14
|
+
* `data: Data | null` in and `onChange: (data: Data) => void` back, with
|
|
15
|
+
* `contentKey`, `pageContainer`, `context`, `languages`, `activeLanguage` and
|
|
16
|
+
* four resolver callbacks around them. Value in, value back — Z1 question 1 —
|
|
17
|
+
* so the **consumer** decides that it appears, which is a published component
|
|
18
|
+
* and not something the owner contributes to a place it chose.
|
|
19
|
+
*
|
|
20
|
+
* ## Why not the kit, and why not `@endora-commerce/page-builder-admin`
|
|
21
|
+
*
|
|
22
|
+
* The kit refuses it on R7, exactly as it refused the chrome P5b published: the
|
|
23
|
+
* component is a `@measured/puck` `<Puck>` host, and the kit is what all 66
|
|
24
|
+
* module packages' admin layers compile against, so Puck would sit behind the
|
|
25
|
+
* admin design system for every one of them.
|
|
26
|
+
*
|
|
27
|
+
* The chrome package refuses it on ownership. `@endora-commerce/page-builder-admin`
|
|
28
|
+
* holds the files that name `cms` **nowhere** (D-192, Z1.2); this one names
|
|
29
|
+
* `cms` in three places that are not incidental — it calls `cmsClient` for the
|
|
30
|
+
* extension-component descriptor and for the on-canvas embed preview, it reads
|
|
31
|
+
* `useTranslation('cms')`, and `withCmsPageRoot`/`pageContainer` are the CMS
|
|
32
|
+
* page's own layout. Moving it there would put a module's API client and a
|
|
33
|
+
* module's translation namespace inside the package every builder composes,
|
|
34
|
+
* which is the inversion D-192 refused one hop out.
|
|
35
|
+
*
|
|
36
|
+
* ## Why this file re-exports rather than holding the component
|
|
37
|
+
*
|
|
38
|
+
* `credentials`' `./admin-ui` — the first — keeps its one component's source in
|
|
39
|
+
* this directory, and it can, because that component has exactly one caller and
|
|
40
|
+
* that caller is in another package. This one has **two kinds** of caller:
|
|
41
|
+
* `blog`'s two editors through the subpath, and `cms`' own three editors
|
|
42
|
+
* through a relative import. The component's collaborators are fifteen files
|
|
43
|
+
* under `src/admin/components/` and its `cmsClient` is `src/admin/api/`'s, so
|
|
44
|
+
* moving the source here would either split that cluster across two directories
|
|
45
|
+
* or drag `cms`' own screens' API client into the published layer. Both layers
|
|
46
|
+
* compile in one program and emit into one `dist` (Z9), so the barrel costs
|
|
47
|
+
* nothing and the surface is still exactly what this file lists — which is R2's
|
|
48
|
+
* rule one directory over.
|
|
49
|
+
*
|
|
50
|
+
* ## The reach stays counted (Z11)
|
|
51
|
+
*
|
|
52
|
+
* `check:module-boundary`'s D-171 designation is derived from the artefact — a
|
|
53
|
+
* subpath is contract surface **iff** its emitted module exports no runtime
|
|
54
|
+
* binding — and `dist/admin-ui/index.js` re-exports a React component, so it
|
|
55
|
+
* exports one. `blog`'s two ledger entries are therefore **re-keyed, not
|
|
56
|
+
* retired**: the coupling is real, it now has a supported spelling, and a
|
|
57
|
+
* supported spelling is not an uncounted one. The shard's own retiring
|
|
58
|
+
* condition is unchanged and is not this merge request's — it names D-192's
|
|
59
|
+
* page-builder family growing a home for the whole builder — which is why those
|
|
60
|
+
* two entries survive the move with their reasons intact.
|
|
61
|
+
*
|
|
62
|
+
* ## Presence (Z12), and why the consumer needs no gate of its own
|
|
63
|
+
*
|
|
64
|
+
* A statically imported component is filtered by nothing, and `cms` declares an
|
|
65
|
+
* activation control (`cms.enabled`), so Z12 asks the consumer what happens
|
|
66
|
+
* while the owner is off. `credentials`' answer was a
|
|
67
|
+
* `useSurfaceVisibility()({ module: 'credentials' })` around the button that
|
|
68
|
+
* opens its modal. This one's answer is different and is **derived from the
|
|
69
|
+
* manifests rather than written into a screen**: `blog` declares `cms` in its
|
|
70
|
+
* manifest `dependencies`, and `ModuleGatingGraph`
|
|
71
|
+
* (`packages/platform/src/lifecycle/services/gating-graph.ts`) reads
|
|
72
|
+
* `dependencies` ∪ `acknowledgedDependencies` when deactivating and
|
|
73
|
+
* `dependencies` when activating — so *"`cms` off while `blog` is on"* is a
|
|
74
|
+
* state the platform refuses at the flip, in both directions. A gate in
|
|
75
|
+
* `blog`'s editors would be a second answer to a question the lifecycle has
|
|
76
|
+
* already answered, in a screen, where nothing could see it drift; it would
|
|
77
|
+
* also put a `module-namespace` key in `check:admin-zones`' foreign-id ledger
|
|
78
|
+
* for a branch no operator can reach.
|
|
79
|
+
*
|
|
80
|
+
* Gating here would be the wrong place either way, and for `credentials`'
|
|
81
|
+
* reason: the component cannot know whether its absence should collapse the
|
|
82
|
+
* canvas, the tab or the whole screen.
|
|
83
|
+
*
|
|
84
|
+
* **Un-declare that dependency and this paragraph is false.** `blog`'s manifest
|
|
85
|
+
* is where the answer lives, so a merge request that drops `cms` from it owes
|
|
86
|
+
* this seam a gate.
|
|
87
|
+
*/
|
|
88
|
+
export { PageBuilderEditor } from '../admin/components/PageBuilderEditor.js';
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cms block-names` — the operator's pre-flight report for the block-name
|
|
3
|
+
* migration (feature 096, T410; `contracts/block-name-migration.md` §7).
|
|
4
|
+
*
|
|
5
|
+
* pnpm --filter backend run cli -- block-names
|
|
6
|
+
*
|
|
7
|
+
* **It writes nothing, and read-only is the whole point**: the operator runs it
|
|
8
|
+
* on a production database *before* they have decided to upgrade. There is no
|
|
9
|
+
* `update`, no `insert` and no ORM flush anywhere below, and the walk it uses is
|
|
10
|
+
* the migration's own — `mapBlockNames` with a visitor that returns `undefined`
|
|
11
|
+
* for every name, which is what makes the read-only property structural rather
|
|
12
|
+
* than a discipline.
|
|
13
|
+
*
|
|
14
|
+
* ## It is the same derivation read twice
|
|
15
|
+
*
|
|
16
|
+
* The same command, the same walk and the same frozen map answer before and
|
|
17
|
+
* after the upgrade. The operator's confidence comes from the **diff** — every
|
|
18
|
+
* *will be renamed* becomes *already namespaced*, and the *unrecognised* set is
|
|
19
|
+
* unchanged in size and membership — not from two programs agreeing. Writing a
|
|
20
|
+
* separate post-migration verifier would be two derivations of one population.
|
|
21
|
+
*
|
|
22
|
+
* ## The classification, and why its order is stated
|
|
23
|
+
*
|
|
24
|
+
* Membership of `FROZEN_BLOCK_RENAMES` first, then `isNamespaced`, otherwise
|
|
25
|
+
* unrecognised. The first two cannot both hold — every key of the map is bare —
|
|
26
|
+
* so the order is a statement about reading rather than a precedence rule.
|
|
27
|
+
* `isNamespaced` is the **strict** test, so a malformed dotted name
|
|
28
|
+
* (`acme.banner`, a fork's own spelling) classifies as *unrecognised* and is
|
|
29
|
+
* named to the operator rather than waved through: that is the ruling of
|
|
30
|
+
* 2026-09-02, and it is why the report, not the migration, is where the grammar
|
|
31
|
+
* is consulted.
|
|
32
|
+
*
|
|
33
|
+
* ## It reads eleven columns across five modules, and that is stated rather
|
|
34
|
+
* than smuggled
|
|
35
|
+
*
|
|
36
|
+
* It is read-only, it is an operator tool rather than a runtime path, and the
|
|
37
|
+
* honest alternative — five separate commands the operator must run and collate
|
|
38
|
+
* — gives five partial answers to one question. The strict-reading alternative,
|
|
39
|
+
* a report **port** each of the five modules provides and `cms` aggregates,
|
|
40
|
+
* costs five port registrations and five manifest edges to produce identical
|
|
41
|
+
* output; it is recorded here so the choice is visible rather than assumed
|
|
42
|
+
* (`contracts/block-name-migration.md` §7).
|
|
43
|
+
*/
|
|
44
|
+
import type { ModuleCliCommandContext } from '@endora-commerce/contracts';
|
|
45
|
+
import type { ModuleContext } from '@endora-commerce/platform/kernel';
|
|
46
|
+
import type { EntityManager } from '@mikro-orm/postgresql';
|
|
47
|
+
/**
|
|
48
|
+
* The eleven columns, with the module that owns each table.
|
|
49
|
+
*
|
|
50
|
+
* Written here rather than derived, and the reason is that there is nothing to
|
|
51
|
+
* derive it *from*: a `jsonb` column carrying a Puck tree is not distinguishable
|
|
52
|
+
* from any other `jsonb` column by the schema, and a heuristic ("every jsonb
|
|
53
|
+
* column named `content`") would answer for whichever columns happen to be
|
|
54
|
+
* named that today. The list is held to the migrations that rewrite the same
|
|
55
|
+
* columns by `backend/test/unit/cms/block-name-report.test.ts`, which reads
|
|
56
|
+
* both and refuses a disagreement in either direction — so a sixth column added
|
|
57
|
+
* to a migration and not here fails, and vice versa.
|
|
58
|
+
*/
|
|
59
|
+
export declare const BLOCK_NAME_COLUMNS: ReadonlyArray<{
|
|
60
|
+
readonly module: string;
|
|
61
|
+
readonly table: string;
|
|
62
|
+
readonly column: string;
|
|
63
|
+
}>;
|
|
64
|
+
export type BlockNameClassification = 'will-be-renamed' | 'already-namespaced' | 'unrecognised';
|
|
65
|
+
export interface BlockNameFinding {
|
|
66
|
+
readonly table: string;
|
|
67
|
+
readonly column: string;
|
|
68
|
+
readonly name: string;
|
|
69
|
+
/** Node occurrences, not rows. */
|
|
70
|
+
readonly occurrences: number;
|
|
71
|
+
readonly rows: number;
|
|
72
|
+
readonly classification: BlockNameClassification;
|
|
73
|
+
/** The name this one becomes, for `will-be-renamed` and nothing else. */
|
|
74
|
+
readonly becomes?: string;
|
|
75
|
+
}
|
|
76
|
+
/** The three-way classification. See the header for why the order is stated. */
|
|
77
|
+
export declare function classifyBlockName(name: string): {
|
|
78
|
+
classification: BlockNameClassification;
|
|
79
|
+
becomes?: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Read one column and classify every distinct block name in it.
|
|
83
|
+
*
|
|
84
|
+
* A missing table answers an empty list rather than throwing: an operator may
|
|
85
|
+
* run this against a deployment that has never installed one of the five
|
|
86
|
+
* modules, and "no rows" is the honest answer for a table that is not there.
|
|
87
|
+
*/
|
|
88
|
+
export declare function scanColumn(em: EntityManager, table: string, column: string): Promise<BlockNameFinding[]>;
|
|
89
|
+
/** Every column, in declaration order. */
|
|
90
|
+
export declare function scanAllColumns(em: EntityManager): Promise<BlockNameFinding[]>;
|
|
91
|
+
export declare function blockNames({ ctx, out, }: ModuleCliCommandContext<ModuleContext>): Promise<number>;
|
|
92
|
+
//# sourceMappingURL=block-names.d.ts.map
|
|
@@ -0,0 +1 @@
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AAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAsC7B;AAED,0CAA0C;AAC1C,wBAAsB,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAMnF;AAMD,wBAAsB,UAAU,CAAC,EAC/B,GAAG,EACH,GAAG,GACJ,EAAE,uBAAuB,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CA2D1D"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { isNamespaced } from '@endora-commerce/page-builder-core/block-name';
|
|
2
|
+
import { FROZEN_BLOCK_RENAMES, countBlockNames, } from '@endora-commerce/page-builder-core/migration';
|
|
3
|
+
/**
|
|
4
|
+
* The eleven columns, with the module that owns each table.
|
|
5
|
+
*
|
|
6
|
+
* Written here rather than derived, and the reason is that there is nothing to
|
|
7
|
+
* derive it *from*: a `jsonb` column carrying a Puck tree is not distinguishable
|
|
8
|
+
* from any other `jsonb` column by the schema, and a heuristic ("every jsonb
|
|
9
|
+
* column named `content`") would answer for whichever columns happen to be
|
|
10
|
+
* named that today. The list is held to the migrations that rewrite the same
|
|
11
|
+
* columns by `backend/test/unit/cms/block-name-report.test.ts`, which reads
|
|
12
|
+
* both and refuses a disagreement in either direction — so a sixth column added
|
|
13
|
+
* to a migration and not here fails, and vice versa.
|
|
14
|
+
*/
|
|
15
|
+
export const BLOCK_NAME_COLUMNS = [
|
|
16
|
+
{ module: 'cms', table: 'cms_pages', column: 'content' },
|
|
17
|
+
{ module: 'cms', table: 'cms_blocks', column: 'content' },
|
|
18
|
+
{ module: 'cms', table: 'cms_templates', column: 'content' },
|
|
19
|
+
{ module: 'blog', table: 'blog_posts', column: 'content' },
|
|
20
|
+
{ module: 'blog', table: 'blog_categories', column: 'description' },
|
|
21
|
+
{ module: 'transactional_emails', table: 'email_templates', column: 'content' },
|
|
22
|
+
{ module: 'transactional_emails', table: 'email_blocks', column: 'content' },
|
|
23
|
+
{ module: 'transactional_emails', table: 'transactional_email_contents', column: 'content' },
|
|
24
|
+
{ module: 'newsletter', table: 'newsletter_campaigns', column: 'content' },
|
|
25
|
+
{ module: 'newsletter', table: 'newsletter_email_blocks', column: 'content' },
|
|
26
|
+
{ module: 'invoices', table: 'invoice_templates', column: 'content' },
|
|
27
|
+
];
|
|
28
|
+
/** The three-way classification. See the header for why the order is stated. */
|
|
29
|
+
export function classifyBlockName(name) {
|
|
30
|
+
const renamed = FROZEN_BLOCK_RENAMES[name];
|
|
31
|
+
if (renamed !== undefined)
|
|
32
|
+
return { classification: 'will-be-renamed', becomes: renamed };
|
|
33
|
+
if (isNamespaced(name))
|
|
34
|
+
return { classification: 'already-namespaced' };
|
|
35
|
+
return { classification: 'unrecognised' };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read one column and classify every distinct block name in it.
|
|
39
|
+
*
|
|
40
|
+
* A missing table answers an empty list rather than throwing: an operator may
|
|
41
|
+
* run this against a deployment that has never installed one of the five
|
|
42
|
+
* modules, and "no rows" is the honest answer for a table that is not there.
|
|
43
|
+
*/
|
|
44
|
+
export async function scanColumn(em, table, column) {
|
|
45
|
+
const exists = await em
|
|
46
|
+
.getConnection()
|
|
47
|
+
.execute(`select to_regclass('public.${table}') is not null as present`);
|
|
48
|
+
if (!exists[0]?.present)
|
|
49
|
+
return [];
|
|
50
|
+
const rows = await em
|
|
51
|
+
.getConnection()
|
|
52
|
+
.execute(`select "${column}" as doc from "${table}" where "${column}" is not null`);
|
|
53
|
+
const occurrences = new Map();
|
|
54
|
+
const affectedRows = new Map();
|
|
55
|
+
for (const row of rows) {
|
|
56
|
+
const counts = countBlockNames(row['doc']);
|
|
57
|
+
for (const [name, count] of counts) {
|
|
58
|
+
occurrences.set(name, (occurrences.get(name) ?? 0) + count);
|
|
59
|
+
affectedRows.set(name, (affectedRows.get(name) ?? 0) + 1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return [...occurrences.entries()]
|
|
63
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
64
|
+
.map(([name, count]) => {
|
|
65
|
+
const { classification, becomes } = classifyBlockName(name);
|
|
66
|
+
return {
|
|
67
|
+
table,
|
|
68
|
+
column,
|
|
69
|
+
name,
|
|
70
|
+
occurrences: count,
|
|
71
|
+
rows: affectedRows.get(name) ?? 0,
|
|
72
|
+
classification,
|
|
73
|
+
...(becomes !== undefined ? { becomes } : {}),
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** Every column, in declaration order. */
|
|
78
|
+
export async function scanAllColumns(em) {
|
|
79
|
+
const out = [];
|
|
80
|
+
for (const { table, column } of BLOCK_NAME_COLUMNS) {
|
|
81
|
+
out.push(...(await scanColumn(em, table, column)));
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
export async function blockNames({ ctx, out, }) {
|
|
86
|
+
const em = ctx.cradle().emFactory();
|
|
87
|
+
const findings = await scanAllColumns(em);
|
|
88
|
+
out('[block-names] Page Builder block names stored in this database.');
|
|
89
|
+
out('');
|
|
90
|
+
let lastColumn = '';
|
|
91
|
+
const totals = {
|
|
92
|
+
'will-be-renamed': 0,
|
|
93
|
+
'already-namespaced': 0,
|
|
94
|
+
unrecognised: 0,
|
|
95
|
+
};
|
|
96
|
+
for (const { table, column } of BLOCK_NAME_COLUMNS) {
|
|
97
|
+
const forColumn = findings.filter((f) => f.table === table && f.column === column);
|
|
98
|
+
const key = `${table}.${column}`;
|
|
99
|
+
if (key !== lastColumn) {
|
|
100
|
+
out(`${key}`);
|
|
101
|
+
lastColumn = key;
|
|
102
|
+
}
|
|
103
|
+
if (forColumn.length === 0) {
|
|
104
|
+
out(' (no block names)');
|
|
105
|
+
out('');
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
for (const finding of forColumn) {
|
|
109
|
+
totals[finding.classification] += 1;
|
|
110
|
+
const arrow = finding.becomes ? ` -> ${finding.becomes}` : '';
|
|
111
|
+
out(` ${finding.name.padEnd(34)} ${String(finding.occurrences).padStart(6)} nodes ` +
|
|
112
|
+
`${String(finding.rows).padStart(5)} rows ${finding.classification}${arrow}`);
|
|
113
|
+
}
|
|
114
|
+
const summary = (kind) => forColumn.filter((f) => f.classification === kind).length;
|
|
115
|
+
out(` -- ${forColumn.length} distinct: ${summary('will-be-renamed')} will be renamed, ` +
|
|
116
|
+
`${summary('already-namespaced')} already namespaced, ` +
|
|
117
|
+
`${summary('unrecognised')} unrecognised`);
|
|
118
|
+
out('');
|
|
119
|
+
}
|
|
120
|
+
out(`[block-names] total distinct (name, column) pairs: ` +
|
|
121
|
+
`${totals['will-be-renamed']} will be renamed, ` +
|
|
122
|
+
`${totals['already-namespaced']} already namespaced, ` +
|
|
123
|
+
`${totals['unrecognised']} unrecognised`);
|
|
124
|
+
if (totals.unrecognised > 0) {
|
|
125
|
+
out('[block-names] An unrecognised name is left byte-identical by the migration and is ' +
|
|
126
|
+
'never a failure. It then renders as the missing-component placeholder in the admin ' +
|
|
127
|
+
'and as nothing on the storefront — resolve it, or accept that degradation, before ' +
|
|
128
|
+
'upgrading.');
|
|
129
|
+
}
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=block-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-names.js","sourceRoot":"","sources":["../../../src/backend/cli/block-names.ts"],"names":[],"mappings":"AA8CA,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,eAAe,GAChB,MAAM,8CAA8C,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAI1B;IACH,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE;IACxD,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAA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CAAC;QAC5D,GAAG,CACD,QAAQ,SAAS,CAAC,MAAM,cAAc,OAAO,CAAC,iBAAiB,CAAC,oBAAoB;YAClF,GAAG,OAAO,CAAC,oBAAoB,CAAC,uBAAuB;YACvD,GAAG,OAAO,CAAC,cAAc,CAAC,eAAe,CAC5C,CAAC;QACF,GAAG,CAAC,EAAE,CAAC,CAAC;IACV,CAAC;IAED,GAAG,CACD,qDAAqD;QACnD,GAAG,MAAM,CAAC,iBAAiB,CAAC,oBAAoB;QAChD,GAAG,MAAM,CAAC,oBAAoB,CAAC,uBAAuB;QACtD,GAAG,MAAM,CAAC,cAAc,CAAC,eAAe,CAC3C,CAAC;IACF,IAAI,MAAM,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;QAC5B,GAAG,CACD,oFAAoF;YAClF,qFAAqF;YACrF,oFAAoF;YACpF,YAAY,CACf,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OptionalProps } from '@mikro-orm/core';
|
|
2
|
+
/**
|
|
3
|
+
* CmsBlock — reusable content fragment authored via the Page Builder.
|
|
4
|
+
* Per-channel-unique `code`. Embeddable in Pages and Templates via the
|
|
5
|
+
* `InsertBlock` component, attachable to Hooks for storefront rendering.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CmsBlock {
|
|
8
|
+
[OptionalProps]?: 'id' | 'createdAt' | 'updatedAt' | 'active' | 'description' | 'content' | 'languages' | 'version';
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
description?: string | null;
|
|
14
|
+
content: Record<string, unknown>;
|
|
15
|
+
languages: string[];
|
|
16
|
+
version: number;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=cms-block.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-block.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/cms-block.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAIrF;;;;GAIG;AACH,qBAEa,QAAQ;IACnB,CAAC,aAAa,CAAC,CAAC,EACZ,IAAI,GACJ,WAAW,GACX,WAAW,GACX,QAAQ,GACR,aAAa,GACb,SAAS,GACT,WAAW,GACX,SAAS,CAAC;IAGd,EAAE,EAAE,MAAM,CAAgB;IAG1B,IAAI,EAAG,MAAM,CAAC;IAId,IAAI,EAAG,MAAM,CAAC;IAGd,MAAM,EAAE,OAAO,CAAQ;IAGvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAqB;IAGrD,SAAS,EAAE,MAAM,EAAE,CAAM;IAGzB,OAAO,EAAE,MAAM,CAAK;IAGpB,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Entity, Index, OptionalProps, PrimaryKey, Property } from '@mikro-orm/core';
|
|
11
|
+
import { GlobalEntity } from '@endora-commerce/platform/tenancy';
|
|
12
|
+
import { randomUUID } from 'crypto';
|
|
13
|
+
/**
|
|
14
|
+
* CmsBlock — reusable content fragment authored via the Page Builder.
|
|
15
|
+
* Per-channel-unique `code`. Embeddable in Pages and Templates via the
|
|
16
|
+
* `InsertBlock` component, attachable to Hooks for storefront rendering.
|
|
17
|
+
*/
|
|
18
|
+
let CmsBlock = class CmsBlock {
|
|
19
|
+
[OptionalProps];
|
|
20
|
+
id = randomUUID();
|
|
21
|
+
name;
|
|
22
|
+
code;
|
|
23
|
+
active = true;
|
|
24
|
+
description;
|
|
25
|
+
content = { languages: {} };
|
|
26
|
+
languages = [];
|
|
27
|
+
version = 1;
|
|
28
|
+
createdAt = new Date();
|
|
29
|
+
updatedAt = new Date();
|
|
30
|
+
};
|
|
31
|
+
__decorate([
|
|
32
|
+
PrimaryKey({ type: 'uuid' }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], CmsBlock.prototype, "id", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
Property({ type: 'string', length: 200 }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], CmsBlock.prototype, "name", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Property({ type: 'string', length: 180 }),
|
|
41
|
+
Index(),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], CmsBlock.prototype, "code", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Property({ type: 'boolean' }),
|
|
46
|
+
__metadata("design:type", Boolean)
|
|
47
|
+
], CmsBlock.prototype, "active", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
Property({ type: 'text', nullable: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], CmsBlock.prototype, "description", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
Property({ type: 'json' }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], CmsBlock.prototype, "content", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
Property({ type: 'json' }),
|
|
58
|
+
__metadata("design:type", Array)
|
|
59
|
+
], CmsBlock.prototype, "languages", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
Property({ type: 'integer' }),
|
|
62
|
+
__metadata("design:type", Number)
|
|
63
|
+
], CmsBlock.prototype, "version", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
Property({ type: 'datetime', onCreate: () => new Date() }),
|
|
66
|
+
__metadata("design:type", Date)
|
|
67
|
+
], CmsBlock.prototype, "createdAt", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Property({ type: 'datetime', onUpdate: () => new Date() }),
|
|
70
|
+
__metadata("design:type", Date)
|
|
71
|
+
], CmsBlock.prototype, "updatedAt", void 0);
|
|
72
|
+
CmsBlock = __decorate([
|
|
73
|
+
GlobalEntity(),
|
|
74
|
+
Entity({ tableName: 'cms_blocks' })
|
|
75
|
+
], CmsBlock);
|
|
76
|
+
export { CmsBlock };
|
|
77
|
+
//# sourceMappingURL=cms-block.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-block.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/cms-block.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;;;GAIG;AAGI,IAAM,QAAQ,GAAd,MAAM,QAAQ;IACnB,CAAC,aAAa,CAAC,CAQD;IAGd,EAAE,GAAW,UAAU,EAAE,CAAC;IAG1B,IAAI,CAAU;IAId,IAAI,CAAU;IAGd,MAAM,GAAY,IAAI,CAAC;IAGvB,WAAW,CAAiB;IAG5B,OAAO,GAA4B,E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@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OptionalProps } from '@mikro-orm/core';
|
|
2
|
+
/**
|
|
3
|
+
* CmsHookBlockAttachment — orderable many-to-many between Hooks and
|
|
4
|
+
* Blocks. The composite PK (hookId, blockId) prevents the same Block
|
|
5
|
+
* from being attached twice to the same Hook; `position` drives the
|
|
6
|
+
* storefront's render order (ASC).
|
|
7
|
+
*/
|
|
8
|
+
export declare class CmsHookBlockAttachment {
|
|
9
|
+
[OptionalProps]?: 'createdAt' | 'position';
|
|
10
|
+
hookId: string;
|
|
11
|
+
blockId: string;
|
|
12
|
+
position: number;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=cms-hook-block-attachment.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-hook-block-attachment.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/cms-hook-block-attachment.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAG9E;;;;;GAKG;AACH,qBAEa,sBAAsB;IACjC,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IAG3C,MAAM,EAAG,MAAM,CAAC;IAGhB,OAAO,EAAG,MAAM,CAAC;IAGjB,QAAQ,EAAE,MAAM,CAAK;IAGrB,SAAS,EAAE,IAAI,CAAc;CAC9B"}
|