@antelopejs/dms 0.25.8-next.1175.g5f8cc4d → 0.25.8
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/CHANGELOG.md +48 -0
- package/README.md +2 -2
- package/data/mockup-example/spec.json +0 -11
- package/data/mockup-spec.schema.json +16 -399
- package/dist/e2e/index.d.mts +1 -2
- package/dist/implementations/dms-builder/engine/table-view-settings.js +33 -9
- package/dist/implementations/dms-builder/engine/table-view-settings.js.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +0 -2
- package/dist/mcp/index.js +0 -9
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +0 -15
- package/dist/mcp/page-verify/index.js +6 -16
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/mockup.d.ts +1 -3
- package/dist/mcp/page-verify/mockup.js +1 -5
- package/dist/mcp/page-verify/mockup.js.map +1 -1
- package/dist/mcp/page-verify/page-probe.d.ts +0 -5
- package/dist/mcp/page-verify/page-probe.js +0 -2
- package/dist/mcp/page-verify/page-probe.js.map +1 -1
- package/dist/mcp/page-verify/playwright.d.ts +4 -22
- package/dist/mcp/page-verify/playwright.js.map +1 -1
- package/dist/mcp/page-verify/report.d.ts +0 -1
- package/dist/mcp/tools/mockup-read-spec.js +3 -2
- package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
- package/dist/mcp/tools/mockup.js +0 -4
- package/dist/mcp/tools/mockup.js.map +1 -1
- package/dist/mcp/tools/page-verify.d.ts +0 -1
- package/dist/mcp/tools/page-verify.js +2 -6
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/dist/mockup/annotations.js +2 -2
- package/dist/mockup/annotations.js.map +1 -1
- package/dist/mockup/apply-notes.js +1 -1
- package/dist/mockup/apply-notes.js.map +1 -1
- package/dist/mockup/compile.d.ts +10 -6
- package/dist/mockup/compile.js +290 -31
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/files.d.ts +1 -2
- package/dist/mockup/files.js +1 -2
- package/dist/mockup/files.js.map +1 -1
- package/dist/mockup/fixture-answers.d.ts +0 -1
- package/dist/mockup/fixture-answers.js +1 -1
- package/dist/mockup/fixture-answers.js.map +1 -1
- package/dist/mockup/fixtures.d.ts +27 -0
- package/dist/mockup/fixtures.js +111 -0
- package/dist/mockup/fixtures.js.map +1 -1
- package/dist/mockup/from-page.js +9 -2
- package/dist/mockup/from-page.js.map +1 -1
- package/dist/mockup/generate.js +1 -4
- package/dist/mockup/generate.js.map +1 -1
- package/dist/mockup/history-routes.d.ts +4 -2
- package/dist/mockup/history-routes.js +36 -27
- package/dist/mockup/history-routes.js.map +1 -1
- package/dist/mockup/history.js +1 -2
- package/dist/mockup/history.js.map +1 -1
- package/dist/mockup/index.d.ts +0 -10
- package/dist/mockup/index.js +0 -10
- package/dist/mockup/index.js.map +1 -1
- package/dist/mockup/json-schema-layout.d.ts +0 -1
- package/dist/mockup/json-schema-layout.js +2 -95
- package/dist/mockup/json-schema-layout.js.map +1 -1
- package/dist/mockup/json-schema.js +19 -40
- package/dist/mockup/json-schema.js.map +1 -1
- package/dist/mockup/manage-routes.d.ts +1 -3
- package/dist/mockup/manage-routes.js +1 -38
- package/dist/mockup/manage-routes.js.map +1 -1
- package/dist/mockup/manage.js +1 -1
- package/dist/mockup/manage.js.map +1 -1
- package/dist/mockup/model.d.ts +100 -137
- package/dist/mockup/model.js +86 -102
- package/dist/mockup/model.js.map +1 -1
- package/dist/mockup/modules.d.ts +9 -6
- package/dist/mockup/modules.js +24 -105
- package/dist/mockup/modules.js.map +1 -1
- package/dist/mockup/presence-board.js +1 -1
- package/dist/mockup/presence-board.js.map +1 -1
- package/dist/mockup/presence-routes.js +2 -2
- package/dist/mockup/presence-routes.js.map +1 -1
- package/dist/mockup/refusals.d.ts +0 -5
- package/dist/mockup/refusals.js +0 -16
- package/dist/mockup/refusals.js.map +1 -1
- package/dist/mockup/routes.d.ts +5 -3
- package/dist/mockup/routes.js +162 -19
- package/dist/mockup/routes.js.map +1 -1
- package/dist/mockup/row-filters.d.ts +8 -0
- package/dist/mockup/row-filters.js +107 -0
- package/dist/mockup/row-filters.js.map +1 -0
- package/dist/mockup/sketch-limits.d.ts +0 -1
- package/dist/mockup/sketch-limits.js +1 -2
- package/dist/mockup/sketch-limits.js.map +1 -1
- package/dist/mockup/sketch.d.ts +2 -2
- package/dist/mockup/sketch.js +1 -2
- package/dist/mockup/sketch.js.map +1 -1
- package/dist/mockup/source-routes.d.ts +4 -5
- package/dist/mockup/source-routes.js +17 -26
- package/dist/mockup/source-routes.js.map +1 -1
- package/dist/mockup/source.js +1 -2
- package/dist/mockup/source.js.map +1 -1
- package/dist/mockup/store.d.ts +37 -16
- package/dist/mockup/store.js +200 -85
- package/dist/mockup/store.js.map +1 -1
- package/dist/mockup/table-archive.d.ts +1 -0
- package/dist/mockup/table-archive.js +16 -0
- package/dist/mockup/table-archive.js.map +1 -1
- package/e2e/index.mjs +2 -3
- package/frontend-vue/eslint-globals.generated.mjs +38 -40
- package/frontend-vue/layers/dms-core/app/build/utils/asyncDataScope.ts +31 -3
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +2 -8
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +0 -3
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +0 -3
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +30 -110
- package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +6 -21
- package/frontend-vue/layers/dms-layout/app/build/components/layout/SidebarUserMenu.vue +7 -19
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +9 -79
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsNav.vue +4 -17
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +0 -12
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/useSettingsNavigation.ts +0 -39
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-mockups.ts +2 -12
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-toast.ts +1 -9
- package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +6 -53
- package/frontend-vue/layers/dms-layout/app/theme/actions.ts +7 -11
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +5 -31
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupCanvasChrome.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +47 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +33 -59
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +12 -58
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/{MockupZoomControls.vue → MockupOverviewZoom.vue} +15 -23
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPagesList.vue +0 -21
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinCard.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinLayer.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTopBar.vue +9 -77
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +45 -130
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +3 -70
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +4 -44
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockInspector.ts +2 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +36 -256
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +1 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameSize.ts +5 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +23 -50
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +29 -82
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPins.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRealData.ts +3 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +14 -60
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +3 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupToolModes.ts +7 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +8 -29
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +2 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +10 -39
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +0 -41
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +3 -37
- package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +1 -20
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +8 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +103 -167
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +0 -22
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +173 -75
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +9 -118
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +8 -123
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +3 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPageTree.ts +0 -15
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPins.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupRealData.ts +5 -18
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +6 -17
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +2 -17
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupVersions.ts +7 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +0 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +6 -108
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +1 -5
- package/frontend-vue/layers/dms-ui/app/build/utils/sketch.ts +10 -40
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +6 -23
- package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +0 -2
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +4 -53
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +4 -53
- package/frontend-vue/package.json +2 -2
- package/package.json +5 -6
- package/E2E.md +0 -138
- package/dist/mcp/mockup-export/capture.d.ts +0 -19
- package/dist/mcp/mockup-export/capture.js +0 -99
- package/dist/mcp/mockup-export/capture.js.map +0 -1
- package/dist/mcp/mockup-export/document.d.ts +0 -4
- package/dist/mcp/mockup-export/document.js +0 -199
- package/dist/mcp/mockup-export/document.js.map +0 -1
- package/dist/mcp/mockup-export/index.d.ts +0 -20
- package/dist/mcp/mockup-export/index.js +0 -110
- package/dist/mcp/mockup-export/index.js.map +0 -1
- package/dist/mcp/mockup-export/jobs.d.ts +0 -32
- package/dist/mcp/mockup-export/jobs.js +0 -49
- package/dist/mcp/mockup-export/jobs.js.map +0 -1
- package/dist/mcp/mockup-export/plan.d.ts +0 -78
- package/dist/mcp/mockup-export/plan.js +0 -292
- package/dist/mcp/mockup-export/plan.js.map +0 -1
- package/dist/mcp/mockup-export/route.d.ts +0 -23
- package/dist/mcp/mockup-export/route.js +0 -91
- package/dist/mcp/mockup-export/route.js.map +0 -1
- package/dist/mcp/page-verify/modules.d.ts +0 -8
- package/dist/mcp/page-verify/modules.js +0 -49
- package/dist/mcp/page-verify/modules.js.map +0 -1
- package/dist/mcp/tools/mockup-export-pdf.d.ts +0 -1
- package/dist/mcp/tools/mockup-export-pdf.js +0 -69
- package/dist/mcp/tools/mockup-export-pdf.js.map +0 -1
- package/dist/mcp/tools/mockup-module-catalog.d.ts +0 -1
- package/dist/mcp/tools/mockup-module-catalog.js +0 -36
- package/dist/mcp/tools/mockup-module-catalog.js.map +0 -1
- package/dist/mockup/compile-layouts.d.ts +0 -5
- package/dist/mockup/compile-layouts.js +0 -74
- package/dist/mockup/compile-layouts.js.map +0 -1
- package/dist/mockup/compile-nodes.d.ts +0 -11
- package/dist/mockup/compile-nodes.js +0 -119
- package/dist/mockup/compile-nodes.js.map +0 -1
- package/dist/mockup/compile-pages.d.ts +0 -18
- package/dist/mockup/compile-pages.js +0 -189
- package/dist/mockup/compile-pages.js.map +0 -1
- package/dist/mockup/create.d.ts +0 -16
- package/dist/mockup/create.js +0 -78
- package/dist/mockup/create.js.map +0 -1
- package/dist/mockup/created-watch.d.ts +0 -18
- package/dist/mockup/created-watch.js +0 -110
- package/dist/mockup/created-watch.js.map +0 -1
- package/dist/mockup/entities.d.ts +0 -20
- package/dist/mockup/entities.js +0 -213
- package/dist/mockup/entities.js.map +0 -1
- package/dist/mockup/etag.d.ts +0 -1
- package/dist/mockup/etag.js +0 -10
- package/dist/mockup/etag.js.map +0 -1
- package/dist/mockup/extensions.d.ts +0 -18
- package/dist/mockup/extensions.js +0 -61
- package/dist/mockup/extensions.js.map +0 -1
- package/dist/mockup/fixture-batch.d.ts +0 -21
- package/dist/mockup/fixture-batch.js +0 -111
- package/dist/mockup/fixture-batch.js.map +0 -1
- package/dist/mockup/fixture-routes.d.ts +0 -21
- package/dist/mockup/fixture-routes.js +0 -136
- package/dist/mockup/fixture-routes.js.map +0 -1
- package/dist/mockup/json-schema-entities.d.ts +0 -5
- package/dist/mockup/json-schema-entities.js +0 -141
- package/dist/mockup/json-schema-entities.js.map +0 -1
- package/dist/mockup/json.d.ts +0 -8
- package/dist/mockup/json.js +0 -20
- package/dist/mockup/json.js.map +0 -1
- package/dist/mockup/layout-model.d.ts +0 -156
- package/dist/mockup/layout-model.js +0 -96
- package/dist/mockup/layout-model.js.map +0 -1
- package/dist/mockup/layouts.d.ts +0 -9
- package/dist/mockup/layouts.js +0 -40
- package/dist/mockup/layouts.js.map +0 -1
- package/dist/mockup/module-manifests.d.ts +0 -99
- package/dist/mockup/module-manifests.js +0 -95
- package/dist/mockup/module-manifests.js.map +0 -1
- package/dist/mockup/module-states.d.ts +0 -10
- package/dist/mockup/module-states.js +0 -85
- package/dist/mockup/module-states.js.map +0 -1
- package/dist/mockup/modules-schema.d.ts +0 -2
- package/dist/mockup/modules-schema.js +0 -39
- package/dist/mockup/modules-schema.js.map +0 -1
- package/dist/mockup/page-capture-routes.d.ts +0 -19
- package/dist/mockup/page-capture-routes.js +0 -92
- package/dist/mockup/page-capture-routes.js.map +0 -1
- package/dist/mockup/page-captures.d.ts +0 -61
- package/dist/mockup/page-captures.js +0 -252
- package/dist/mockup/page-captures.js.map +0 -1
- package/dist/mockup/parse-spec.d.ts +0 -10
- package/dist/mockup/parse-spec.js +0 -62
- package/dist/mockup/parse-spec.js.map +0 -1
- package/dist/mockup/places.d.ts +0 -17
- package/dist/mockup/places.js +0 -75
- package/dist/mockup/places.js.map +0 -1
- package/dist/mockup/slug.d.ts +0 -3
- package/dist/mockup/slug.js +0 -7
- package/dist/mockup/slug.js.map +0 -1
- package/dist/mockup/state-patch.d.ts +0 -22
- package/dist/mockup/state-patch.js +0 -75
- package/dist/mockup/state-patch.js.map +0 -1
- package/dist/mockup/state.d.ts +0 -112
- package/dist/mockup/state.js +0 -22
- package/dist/mockup/state.js.map +0 -1
- package/dist/mockup/store-list.d.ts +0 -28
- package/dist/mockup/store-list.js +0 -89
- package/dist/mockup/store-list.js.map +0 -1
- package/dist/mockup/tenancy.d.ts +0 -19
- package/dist/mockup/tenancy.js +0 -73
- package/dist/mockup/tenancy.js.map +0 -1
- package/dist/mockup/tenant-rows.d.ts +0 -4
- package/dist/mockup/tenant-rows.js +0 -19
- package/dist/mockup/tenant-rows.js.map +0 -1
- package/frontend-vue/layers/dms-core/app/utils/localFetchAnswers.ts +0 -124
- package/frontend-vue/layers/dms-core/app/utils/textDigest.ts +0 -29
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupWidgets.ts +0 -65
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +0 -153
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEmptyState.vue +0 -23
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModuleStore.vue +0 -164
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSectionLabel.vue +0 -51
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupReconnecting.vue +0 -17
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTenantBanner.vue +0 -48
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +0 -142
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useFixtureBatches.ts +0 -154
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupActivation.ts +0 -157
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +0 -165
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameRender.ts +0 -126
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageZoom.ts +0 -138
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +0 -124
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +0 -37
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerActivation.ts +0 -56
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerExport.ts +0 -46
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePersistedCaptures.ts +0 -151
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCreateModal.vue +0 -130
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +0 -332
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupActivation.ts +0 -100
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupAnnotations.ts +0 -146
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +0 -80
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModuleNavigation.ts +0 -171
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModules.ts +0 -138
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverviewSections.ts +0 -66
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +0 -177
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStatePatch.ts +0 -179
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +0 -143
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +0 -23
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixtureAnswers.ts +0 -156
- package/frontend-vue/layers/dms-ui/app/build/utils/previewRows.ts +0 -400
- package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +0 -15
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupModuleStore.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupTenantBanner.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useFixtureBatches.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupActivation.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupOverview.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupPdfExport.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupRoutePage.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupSession.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupTenancy.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePersistedCaptures.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/json.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupActivation.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupAnnotations.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupModuleNavigation.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupOverviewSections.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupStatePatch.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenancy.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenants.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewFixtureAnswers.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewRows.ts +0 -1
|
@@ -16,7 +16,6 @@ exports.registerSpecRoutes = registerSpecRoutes;
|
|
|
16
16
|
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
17
|
const block_types_1 = require("@antelopejs/interface-dms/base/block-types");
|
|
18
18
|
const zod_1 = require("zod");
|
|
19
|
-
const etag_1 = require("./etag");
|
|
20
19
|
const fixtures_1 = require("./fixtures");
|
|
21
20
|
const model_1 = require("./model");
|
|
22
21
|
const owner_controller_1 = require("./owner-controller");
|
|
@@ -24,8 +23,6 @@ const refusals_1 = require("./refusals");
|
|
|
24
23
|
const anchor_1 = require("./anchor");
|
|
25
24
|
const presence_1 = require("./presence");
|
|
26
25
|
const source_1 = require("./source");
|
|
27
|
-
const HTTP_OK = 200;
|
|
28
|
-
const HTTP_NOT_MODIFIED = 304;
|
|
29
26
|
const HTTP_BAD_REQUEST = 400;
|
|
30
27
|
const HTTP_CONFLICT = 409;
|
|
31
28
|
const writeBodySchema = zod_1.z
|
|
@@ -35,15 +32,6 @@ const writeBodySchema = zod_1.z
|
|
|
35
32
|
viewer: presence_1.viewerIdSchema.optional(),
|
|
36
33
|
})
|
|
37
34
|
.strict();
|
|
38
|
-
function specAnswer(text, digest, writtenBy) {
|
|
39
|
-
const spec = (0, source_1.parseSpecObject)(text);
|
|
40
|
-
if (!spec) {
|
|
41
|
-
throw new interface_api_1.HTTPResult(HTTP_CONFLICT, {
|
|
42
|
-
message: "$dms.refusals.mockup.spec_not_object",
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return { spec, digest, ...(writtenBy && { writtenBy }) };
|
|
46
|
-
}
|
|
47
35
|
function registerSpecRoutes(mockupsDir, presence) {
|
|
48
36
|
function nameOf(raw) {
|
|
49
37
|
const name = (0, model_1.parseMockupName)(raw);
|
|
@@ -56,21 +44,25 @@ function registerSpecRoutes(mockupsDir, presence) {
|
|
|
56
44
|
await this.assertOwner();
|
|
57
45
|
return { blocks: (0, block_types_1.ListBlockTypes)() };
|
|
58
46
|
}
|
|
59
|
-
async source(rawName
|
|
47
|
+
async source(rawName) {
|
|
60
48
|
await this.assertOwner();
|
|
61
49
|
const name = nameOf(rawName);
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
50
|
+
const source = await (0, source_1.readSpecSource)(mockupsDir, name);
|
|
51
|
+
if (!source)
|
|
64
52
|
throw (0, refusals_1.notFound)("mockup");
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
53
|
+
if (!source.spec) {
|
|
54
|
+
throw new interface_api_1.HTTPResult(HTTP_CONFLICT, {
|
|
55
|
+
message: "$dms.refusals.mockup.spec_not_object",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const answer = {
|
|
59
|
+
spec: source.spec,
|
|
60
|
+
digest: source.digest,
|
|
61
|
+
};
|
|
62
|
+
const writtenBy = presence.writtenBy(name, source.digest);
|
|
63
|
+
if (writtenBy)
|
|
64
|
+
answer.writtenBy = writtenBy;
|
|
65
|
+
return answer;
|
|
74
66
|
}
|
|
75
67
|
async write(rawName, body) {
|
|
76
68
|
const owner = await this.owner();
|
|
@@ -117,9 +109,8 @@ function registerSpecRoutes(mockupsDir, presence) {
|
|
|
117
109
|
__decorate([
|
|
118
110
|
(0, interface_api_1.Get)(":name/spec"),
|
|
119
111
|
__param(0, (0, interface_api_1.Parameter)("name")),
|
|
120
|
-
__param(1, (0, interface_api_1.Context)()),
|
|
121
112
|
__metadata("design:type", Function),
|
|
122
|
-
__metadata("design:paramtypes", [String
|
|
113
|
+
__metadata("design:paramtypes", [String]),
|
|
123
114
|
__metadata("design:returntype", Promise)
|
|
124
115
|
], MockupSourceController.prototype, "source", null);
|
|
125
116
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-routes.js","sourceRoot":"","sources":["../../src/mockup/source-routes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"source-routes.js","sourceRoot":"","sources":["../../src/mockup/source-routes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,4EAGoD;AACpD,6BAAwB;AACxB,yCAAwC;AACxC,mCAA6E;AAC7E,yDAA2D;AAC3D,yCAAsC;AACtC,qCAAkC;AAElC,yCAA4C;AAC5C,qCAKkB;AAElB,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,MAAM,eAAe,GAAG,OAAC;KACtB,MAAM,CAAC;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|
10
10
|
const promises_1 = require("node:fs/promises");
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
12
|
const compile_1 = require("./compile");
|
|
13
|
-
const parse_spec_1 = require("./parse-spec");
|
|
14
13
|
const files_1 = require("./files");
|
|
15
14
|
const history_1 = require("./history");
|
|
16
15
|
const model_1 = require("./model");
|
|
@@ -87,7 +86,7 @@ function laidOutAs(text, spec) {
|
|
|
87
86
|
}
|
|
88
87
|
function writeNow(mockupsDir, name) {
|
|
89
88
|
return async (spec, meta) => {
|
|
90
|
-
const read = (0,
|
|
89
|
+
const read = (0, compile_1.parseSpec)(JSON.stringify(spec));
|
|
91
90
|
const { issues, warnings } = read.ok
|
|
92
91
|
? (0, compile_1.compileSpec)(name, read.spec)
|
|
93
92
|
: { issues: read.issues, warnings: [] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/mockup/source.ts"],"names":[],"mappings":";;;;;;;;AAAA,6CAAyC;AACzC,+CAAmD;AACnD,yCAAiC;AAEjC,
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/mockup/source.ts"],"names":[],"mappings":";;;;;;;;AAAA,6CAAyC;AACzC,+CAAmD;AACnD,yCAAiC;AAEjC,uCAAmD;AACnD,mCAMiB;AACjB,uCAMmB;AAQnB,mCAAsE;AAEtE,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,EAAE,GAAG,IAAI,CAAC;AAChB,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,aAAa,GAAG,EAAE,CAAC;AAsBzB,kBAAyB,IAAY;IACnC,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC;SACZ,MAAM,CAAC,KAAK,CAAC;SACb,K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AgB;IAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,wBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,KAAK,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,MAAM,EAAE,CAAC;YAC1C,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC,IAAA,oBAAY,EAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,IAAI,YAAY,CAAC,CAAC;YACxE,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;QACD,MAAM,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACvD,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,GAAG,EAAE,CAC9B,IAAA,qBAAW,EAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAC5C,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AASD,mBACE,UAAkB,EAClB,IAAgB,EAChB,IAAuB,EACvB,IAAmB;IAEnB,OAAO,YAAY,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
package/dist/mockup/store.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { type MockupAnnotation } from "./annotations";
|
|
2
|
-
import type
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { type Clock } from "./generate";
|
|
6
|
-
import type { Json, MockupName, MockupState } from "./model";
|
|
2
|
+
import { type BuiltPageSync, type PageReader } from "./built-sync";
|
|
3
|
+
import type { Clock } from "./generate";
|
|
4
|
+
import type { Json, MockupName, MockupSource, MockupState } from "./model";
|
|
7
5
|
import type { PresenceSnapshot } from "./presence";
|
|
8
|
-
import { type MockupStatePatch } from "./state-patch";
|
|
9
|
-
import { type MockupSummary } from "./store-list";
|
|
10
6
|
export type MockupEvent = {
|
|
11
7
|
event: "state";
|
|
12
8
|
data: MockupState;
|
|
13
|
-
} | {
|
|
14
|
-
event: "patch";
|
|
15
|
-
data: MockupStatePatch;
|
|
16
9
|
} | {
|
|
17
10
|
event: "annotations";
|
|
18
11
|
data: {
|
|
@@ -23,8 +16,30 @@ export type MockupEvent = {
|
|
|
23
16
|
data: PresenceSnapshot;
|
|
24
17
|
};
|
|
25
18
|
export type MockupListener = (event: MockupEvent) => void;
|
|
26
|
-
export
|
|
27
|
-
|
|
19
|
+
export interface MockupCreated {
|
|
20
|
+
name: MockupName;
|
|
21
|
+
title?: string;
|
|
22
|
+
}
|
|
23
|
+
export type MockupCreatedListener = (created: MockupCreated) => void;
|
|
24
|
+
interface MockupSummaryBase {
|
|
25
|
+
name: MockupName;
|
|
26
|
+
title?: string;
|
|
27
|
+
pages: number;
|
|
28
|
+
openComments: number;
|
|
29
|
+
source?: MockupSource;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
capturedAt?: string;
|
|
32
|
+
}
|
|
33
|
+
export type MockupSummary = MockupSummaryBase & ({
|
|
34
|
+
status: "draft";
|
|
35
|
+
} | {
|
|
36
|
+
status: "built";
|
|
37
|
+
builtAt: string;
|
|
38
|
+
builtPages: Array<{
|
|
39
|
+
path: string;
|
|
40
|
+
title: string;
|
|
41
|
+
} & BuiltPageSync>;
|
|
42
|
+
});
|
|
28
43
|
export declare class MockupStore {
|
|
29
44
|
readonly mockupsDir: string;
|
|
30
45
|
private readonly livePages?;
|
|
@@ -32,14 +47,20 @@ export declare class MockupStore {
|
|
|
32
47
|
private readonly entries;
|
|
33
48
|
private readonly watches;
|
|
34
49
|
private watcher;
|
|
35
|
-
private
|
|
50
|
+
private created;
|
|
36
51
|
constructor(mockupsDir: string, livePages?: PageReader | undefined, clock?: Clock);
|
|
37
52
|
list(): Promise<MockupSummary[]>;
|
|
53
|
+
private summary;
|
|
54
|
+
private openComments;
|
|
55
|
+
private specFile;
|
|
38
56
|
state(name: MockupName): Promise<MockupState | undefined>;
|
|
39
|
-
fixture(name: MockupName, pageId: string, key: string
|
|
40
|
-
fixtureBatch(name: MockupName, pageId: string, tenant?: string): Promise<FixtureBatchAnswer | undefined>;
|
|
57
|
+
fixture(name: MockupName, pageId: string, key: string): Promise<Json | undefined>;
|
|
41
58
|
subscribe(name: MockupName, listener: MockupListener): Promise<(() => void) | undefined>;
|
|
42
59
|
subscribeCreated(listener: MockupCreatedListener): Promise<() => void>;
|
|
60
|
+
private startCreatedWatch;
|
|
61
|
+
private stopCreatedWatch;
|
|
62
|
+
private specNames;
|
|
63
|
+
private scanCreated;
|
|
43
64
|
isWatching(): boolean;
|
|
44
65
|
close(): void;
|
|
45
66
|
private current;
|
|
@@ -48,7 +69,6 @@ export declare class MockupStore {
|
|
|
48
69
|
private load;
|
|
49
70
|
private toState;
|
|
50
71
|
private specEvent;
|
|
51
|
-
private deliver;
|
|
52
72
|
private annotationsEvent;
|
|
53
73
|
private readonly fileEvents;
|
|
54
74
|
private startWatch;
|
|
@@ -59,3 +79,4 @@ export declare class MockupStore {
|
|
|
59
79
|
private flush;
|
|
60
80
|
private stopWatch;
|
|
61
81
|
}
|
|
82
|
+
export {};
|
package/dist/mockup/store.js
CHANGED
|
@@ -6,43 +6,31 @@ const promises_1 = require("node:fs/promises");
|
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
7
|
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
8
8
|
const annotations_1 = require("./annotations");
|
|
9
|
+
const built_sync_1 = require("./built-sync");
|
|
10
|
+
const capture_1 = require("./capture");
|
|
9
11
|
const compile_1 = require("./compile");
|
|
10
|
-
const created_watch_1 = require("./created-watch");
|
|
11
|
-
const fixture_batch_1 = require("./fixture-batch");
|
|
12
|
-
const parse_spec_1 = require("./parse-spec");
|
|
13
|
-
const generate_1 = require("./generate");
|
|
14
12
|
const history_1 = require("./history");
|
|
15
13
|
const files_1 = require("./files");
|
|
16
14
|
const model_1 = require("./model");
|
|
17
15
|
const source_1 = require("./source");
|
|
18
|
-
const
|
|
19
|
-
const store_list_1 = require("./store-list");
|
|
16
|
+
const summary_fields_1 = require("./summary-fields");
|
|
20
17
|
const WATCH_DEBOUNCE_MS = 40;
|
|
18
|
+
const CREATED_POLL_MS = 500;
|
|
21
19
|
const MISSING_SPEC = {
|
|
22
20
|
path: "",
|
|
23
21
|
message: `${files_1.SPEC_FILE} is missing`,
|
|
24
22
|
};
|
|
25
|
-
function
|
|
26
|
-
return { ...entry, pages: (0, fixture_batch_1.withBatchRoutes)({ name }, entry, entry.pages) };
|
|
27
|
-
}
|
|
28
|
-
function lastGood(previous, revision, issues, textHash, day) {
|
|
23
|
+
function lastGood(previous, revision, issues) {
|
|
29
24
|
return {
|
|
30
25
|
revision,
|
|
31
|
-
textHash,
|
|
32
|
-
day,
|
|
33
26
|
title: previous?.title,
|
|
34
27
|
categories: previous?.categories,
|
|
35
28
|
sidebar: previous?.sidebar,
|
|
36
29
|
modules: previous?.modules,
|
|
37
|
-
entities: previous?.entities,
|
|
38
|
-
tenants: previous?.tenants,
|
|
39
|
-
connection: previous?.connection,
|
|
40
30
|
pages: previous?.pages ?? [],
|
|
41
31
|
fixtures: previous?.fixtures ?? new Map(),
|
|
42
|
-
tenantFixtures: previous?.tenantFixtures ?? new Map(),
|
|
43
32
|
issues,
|
|
44
33
|
warnings: [],
|
|
45
|
-
batches: new Map(),
|
|
46
34
|
};
|
|
47
35
|
}
|
|
48
36
|
class MockupStore {
|
|
@@ -57,45 +45,188 @@ class MockupStore {
|
|
|
57
45
|
this.mockupsDir = mockupsDir;
|
|
58
46
|
this.livePages = livePages;
|
|
59
47
|
this.clock = clock;
|
|
60
|
-
this.created = new created_watch_1.CreatedWatcher(mockupsDir, (name) => this.readSpec(name));
|
|
61
48
|
}
|
|
62
|
-
list() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
async list() {
|
|
50
|
+
let names;
|
|
51
|
+
try {
|
|
52
|
+
names = await (0, promises_1.readdir)(this.mockupsDir);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
56
|
+
return [];
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
const reads = this.livePages && new built_sync_1.BuilderReads(this.livePages);
|
|
60
|
+
const summaries = await Promise.all(names.map(async (raw) => {
|
|
61
|
+
const name = (0, model_1.parseMockupName)(raw);
|
|
62
|
+
return name ? this.summary(name, reads) : undefined;
|
|
63
|
+
}));
|
|
64
|
+
return summaries
|
|
65
|
+
.flatMap((summary) => summary ?? [])
|
|
66
|
+
.sort((left, right) => right.updatedAt.localeCompare(left.updatedAt) ||
|
|
67
|
+
left.name.localeCompare(right.name));
|
|
68
|
+
}
|
|
69
|
+
async summary(name, reads) {
|
|
70
|
+
const file = await this.specFile(name);
|
|
71
|
+
if (!file)
|
|
72
|
+
return undefined;
|
|
73
|
+
const { title, pages, source, built } = (0, summary_fields_1.readSummaryFields)(file.text);
|
|
74
|
+
const base = {
|
|
75
|
+
name,
|
|
76
|
+
pages: pages.length,
|
|
77
|
+
openComments: await this.openComments(name),
|
|
78
|
+
updatedAt: file.updatedAt,
|
|
79
|
+
};
|
|
80
|
+
const capturedAt = await (0, capture_1.captureUpdatedAt)(this.mockupsDir, name);
|
|
81
|
+
if (capturedAt)
|
|
82
|
+
base.capturedAt = capturedAt.toISOString();
|
|
83
|
+
if (title !== undefined)
|
|
84
|
+
base.title = title;
|
|
85
|
+
if (source !== undefined)
|
|
86
|
+
base.source = source;
|
|
87
|
+
if (!built)
|
|
88
|
+
return { ...base, status: "draft" };
|
|
89
|
+
return {
|
|
90
|
+
...base,
|
|
91
|
+
status: "built",
|
|
92
|
+
builtAt: built.at,
|
|
93
|
+
builtPages: await Promise.all(built.pages.map(async (page) => ({
|
|
94
|
+
path: page.path,
|
|
95
|
+
title: page.title?.trim() || page.path,
|
|
96
|
+
...(await (0, built_sync_1.builtPageSync)(page.path, pages, reads)),
|
|
97
|
+
}))),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async openComments(name) {
|
|
101
|
+
try {
|
|
102
|
+
const annotations = await (0, annotations_1.listAnnotations)(name, this.mockupsDir);
|
|
103
|
+
return (annotations?.filter((annotation) => annotation.status === "open")
|
|
104
|
+
.length ?? 0);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
logging_1.Logging.Warn(`[DMS] mockup "${name}": annotations cannot be read`, error);
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async specFile(name) {
|
|
112
|
+
const text = await this.readSpec(name);
|
|
113
|
+
if (text === undefined)
|
|
114
|
+
return undefined;
|
|
115
|
+
try {
|
|
116
|
+
const { mtime } = await (0, promises_1.stat)((0, node_path_1.join)((0, files_1.mockupDirectory)(this.mockupsDir, name), files_1.SPEC_FILE));
|
|
117
|
+
return { text, updatedAt: mtime.toISOString() };
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
121
|
+
return undefined;
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
68
124
|
}
|
|
69
125
|
async state(name) {
|
|
70
126
|
const entry = await this.current(name);
|
|
71
127
|
return entry && this.toState(name, entry);
|
|
72
128
|
}
|
|
73
|
-
async fixture(name, pageId, key
|
|
74
|
-
const
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
async fixtureBatch(name, pageId, tenant) {
|
|
78
|
-
const entry = await this.current(name);
|
|
79
|
-
const page = entry?.pages.find((candidate) => candidate.id === pageId);
|
|
80
|
-
return entry && page && (0, fixture_batch_1.batchOf)({ name }, entry, page, tenant);
|
|
129
|
+
async fixture(name, pageId, key) {
|
|
130
|
+
const fixtures = (await this.current(name))?.fixtures.get(pageId);
|
|
131
|
+
return fixtures && Object.hasOwn(fixtures, key) ? fixtures[key] : undefined;
|
|
81
132
|
}
|
|
82
133
|
async subscribe(name, listener) {
|
|
83
134
|
const entry = await this.current(name);
|
|
84
135
|
if (!entry)
|
|
85
136
|
return undefined;
|
|
86
137
|
const watched = this.watches.get(name) ?? this.startWatch(name);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
watched.subscribers.add(subscriber);
|
|
90
|
-
listener({ event: "state", data: state });
|
|
138
|
+
watched.listeners.add(listener);
|
|
139
|
+
listener({ event: "state", data: this.toState(name, entry) });
|
|
91
140
|
return () => {
|
|
92
|
-
watched.
|
|
93
|
-
if (!watched.
|
|
141
|
+
watched.listeners.delete(listener);
|
|
142
|
+
if (!watched.listeners.size)
|
|
94
143
|
this.stopWatch(name);
|
|
95
144
|
};
|
|
96
145
|
}
|
|
97
|
-
subscribeCreated(listener) {
|
|
98
|
-
|
|
146
|
+
async subscribeCreated(listener) {
|
|
147
|
+
const watched = this.created ?? (await this.startCreatedWatch());
|
|
148
|
+
watched.listeners.add(listener);
|
|
149
|
+
return () => {
|
|
150
|
+
watched.listeners.delete(listener);
|
|
151
|
+
if (!watched.listeners.size)
|
|
152
|
+
this.stopCreatedWatch(watched);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
async startCreatedWatch() {
|
|
156
|
+
const known = new Set(await this.specNames());
|
|
157
|
+
if (this.created)
|
|
158
|
+
return this.created;
|
|
159
|
+
const watched = {
|
|
160
|
+
listeners: new Set(),
|
|
161
|
+
known,
|
|
162
|
+
scanning: false,
|
|
163
|
+
timer: setInterval(() => void this.scanCreated(watched), CREATED_POLL_MS),
|
|
164
|
+
};
|
|
165
|
+
watched.timer.unref();
|
|
166
|
+
this.created = watched;
|
|
167
|
+
return watched;
|
|
168
|
+
}
|
|
169
|
+
stopCreatedWatch(watched) {
|
|
170
|
+
clearInterval(watched.timer);
|
|
171
|
+
if (this.created === watched)
|
|
172
|
+
this.created = undefined;
|
|
173
|
+
}
|
|
174
|
+
async specNames() {
|
|
175
|
+
let entries;
|
|
176
|
+
try {
|
|
177
|
+
entries = await (0, promises_1.readdir)(this.mockupsDir);
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
181
|
+
return [];
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
const names = await Promise.all(entries.map(async (entry) => {
|
|
185
|
+
const name = (0, model_1.parseMockupName)(entry);
|
|
186
|
+
if (!name)
|
|
187
|
+
return undefined;
|
|
188
|
+
try {
|
|
189
|
+
await (0, promises_1.stat)((0, node_path_1.join)((0, files_1.mockupDirectory)(this.mockupsDir, name), files_1.SPEC_FILE));
|
|
190
|
+
return name;
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
194
|
+
return undefined;
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}));
|
|
198
|
+
return names.flatMap((name) => name ?? []);
|
|
199
|
+
}
|
|
200
|
+
async scanCreated(watched) {
|
|
201
|
+
if (watched.scanning)
|
|
202
|
+
return;
|
|
203
|
+
watched.scanning = true;
|
|
204
|
+
try {
|
|
205
|
+
const names = await this.specNames();
|
|
206
|
+
const present = new Set(names);
|
|
207
|
+
for (const name of watched.known) {
|
|
208
|
+
if (!present.has(name))
|
|
209
|
+
watched.known.delete(name);
|
|
210
|
+
}
|
|
211
|
+
for (const name of names) {
|
|
212
|
+
if (watched.known.has(name))
|
|
213
|
+
continue;
|
|
214
|
+
const text = await this.readSpec(name);
|
|
215
|
+
watched.known.add(name);
|
|
216
|
+
const created = { name };
|
|
217
|
+
const title = text === undefined ? "" : (0, summary_fields_1.readSummaryFields)(text).title;
|
|
218
|
+
if (title)
|
|
219
|
+
created.title = title;
|
|
220
|
+
for (const listener of watched.listeners)
|
|
221
|
+
listener(created);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
logging_1.Logging.Warn("[DMS] the mockups directory could not be read", error);
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
watched.scanning = false;
|
|
229
|
+
}
|
|
99
230
|
}
|
|
100
231
|
isWatching() {
|
|
101
232
|
return this.watcher !== undefined;
|
|
@@ -103,18 +234,14 @@ class MockupStore {
|
|
|
103
234
|
close() {
|
|
104
235
|
for (const name of this.watches.keys())
|
|
105
236
|
this.stopWatch(name);
|
|
106
|
-
this.created
|
|
237
|
+
if (this.created)
|
|
238
|
+
this.stopCreatedWatch(this.created);
|
|
107
239
|
}
|
|
108
240
|
async current(name) {
|
|
109
|
-
const today = (0, generate_1.startOfDay)(this.clock());
|
|
110
241
|
const cached = this.entries.get(name);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const text = await this.readSpec(name);
|
|
115
|
-
if (text === undefined)
|
|
116
|
-
return undefined;
|
|
117
|
-
return kept?.textHash === (0, source_1.digestOf)(text) ? kept : this.load(name, text);
|
|
242
|
+
if (cached && this.watches.has(name))
|
|
243
|
+
return cached;
|
|
244
|
+
return this.load(name);
|
|
118
245
|
}
|
|
119
246
|
async readSpec(name) {
|
|
120
247
|
try {
|
|
@@ -134,61 +261,46 @@ class MockupStore {
|
|
|
134
261
|
}
|
|
135
262
|
}));
|
|
136
263
|
}
|
|
137
|
-
async load(name
|
|
264
|
+
async load(name) {
|
|
265
|
+
const text = await this.readSpec(name);
|
|
266
|
+
if (text === undefined)
|
|
267
|
+
return undefined;
|
|
138
268
|
await this.observeDisk(name);
|
|
139
269
|
const previous = this.entries.get(name);
|
|
140
270
|
const revision = (previous?.revision ?? 0) + 1;
|
|
141
|
-
const
|
|
142
|
-
const read = (0, parse_spec_1.parseSpec)(text);
|
|
143
|
-
const now = this.clock();
|
|
144
|
-
const day = (0, generate_1.startOfDay)(now);
|
|
271
|
+
const read = (0, compile_1.parseSpec)(text);
|
|
145
272
|
const entry = read.ok
|
|
146
|
-
?
|
|
147
|
-
|
|
148
|
-
textHash,
|
|
149
|
-
day,
|
|
150
|
-
...(0, compile_1.compileSpec)(name, read.spec, now),
|
|
151
|
-
batches: new Map(),
|
|
152
|
-
})
|
|
153
|
-
: lastGood(previous, revision, read.issues, textHash, day);
|
|
273
|
+
? { revision, ...(0, compile_1.compileSpec)(name, read.spec, this.clock()) }
|
|
274
|
+
: lastGood(previous, revision, read.issues);
|
|
154
275
|
this.entries.set(name, entry);
|
|
155
276
|
return entry;
|
|
156
277
|
}
|
|
157
278
|
toState(name, entry) {
|
|
158
|
-
|
|
279
|
+
const state = {
|
|
159
280
|
name,
|
|
160
281
|
revision: entry.revision,
|
|
161
282
|
pages: entry.pages,
|
|
162
283
|
issues: entry.issues,
|
|
163
|
-
...(0, model_1.stateParts)(entry),
|
|
164
284
|
warnings: entry.warnings,
|
|
165
285
|
};
|
|
166
|
-
|
|
286
|
+
if (entry.title !== undefined)
|
|
287
|
+
state.title = entry.title;
|
|
288
|
+
if (entry.categories !== undefined)
|
|
289
|
+
state.categories = entry.categories;
|
|
290
|
+
if (entry.sidebar !== undefined)
|
|
291
|
+
state.sidebar = entry.sidebar;
|
|
292
|
+
if (entry.modules !== undefined)
|
|
293
|
+
state.modules = entry.modules;
|
|
294
|
+
return state;
|
|
167
295
|
}
|
|
168
296
|
async specEvent(name) {
|
|
169
|
-
const
|
|
170
|
-
const entry = text === undefined ? undefined : await this.load(name, text);
|
|
297
|
+
const entry = await this.load(name);
|
|
171
298
|
if (entry)
|
|
172
299
|
return { event: "state", data: this.toState(name, entry) };
|
|
173
300
|
const previous = this.entries.get(name);
|
|
174
|
-
const
|
|
175
|
-
const missing = lastGood(previous, revision, [MISSING_SPEC], "", (0, generate_1.startOfDay)(this.clock()));
|
|
301
|
+
const missing = lastGood(previous, previous?.revision ?? 0, [MISSING_SPEC]);
|
|
176
302
|
return { event: "state", data: this.toState(name, missing) };
|
|
177
303
|
}
|
|
178
|
-
deliver(name, event) {
|
|
179
|
-
const subscribers = this.watches.get(name)?.subscribers ?? [];
|
|
180
|
-
if (event.event !== "state") {
|
|
181
|
-
for (const { listener } of subscribers)
|
|
182
|
-
listener(event);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const next = (0, state_patch_1.stateDigestOf)(event.data);
|
|
186
|
-
for (const subscriber of subscribers) {
|
|
187
|
-
const data = (0, state_patch_1.diffState)(subscriber.sent, next);
|
|
188
|
-
subscriber.sent = next;
|
|
189
|
-
subscriber.listener({ event: "patch", data });
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
304
|
async annotationsEvent(name) {
|
|
193
305
|
const annotations = await (0, annotations_1.listAnnotations)(name, this.mockupsDir);
|
|
194
306
|
return { event: "annotations", data: { annotations: annotations ?? [] } };
|
|
@@ -202,7 +314,7 @@ class MockupStore {
|
|
|
202
314
|
]);
|
|
203
315
|
startWatch(name) {
|
|
204
316
|
this.watcher ??= this.watchDirectory(this.mockupsDir, (filename) => this.directoryChanged(filename));
|
|
205
|
-
const watched = {
|
|
317
|
+
const watched = { listeners: new Set(), timers: new Map() };
|
|
206
318
|
this.watches.set(name, watched);
|
|
207
319
|
this.armMockup(name, watched);
|
|
208
320
|
return watched;
|
|
@@ -257,7 +369,10 @@ class MockupStore {
|
|
|
257
369
|
this.watches.get(name)?.timers.delete(file);
|
|
258
370
|
for (const read of reads) {
|
|
259
371
|
try {
|
|
260
|
-
|
|
372
|
+
const event = await read(name);
|
|
373
|
+
for (const listener of this.watches.get(name)?.listeners ?? []) {
|
|
374
|
+
listener(event);
|
|
375
|
+
}
|
|
261
376
|
}
|
|
262
377
|
catch (error) {
|
|
263
378
|
logging_1.Logging.Warn(`[DMS] mockup "${name}": ${file} could not be read`, error);
|