@antelopejs/dms 0.25.8 → 0.25.9-next.1183.ga9db169
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 +0 -48
- package/E2E.md +138 -0
- package/README.md +2 -2
- package/data/mockup-example/spec.json +13 -0
- package/data/mockup-spec.schema.json +399 -16
- package/dist/e2e/index.d.mts +2 -1
- package/dist/implementations/dms/live-pages.d.ts +6 -0
- package/dist/implementations/dms/live-pages.js +139 -0
- package/dist/implementations/dms/live-pages.js.map +1 -0
- package/dist/implementations/dms/page/notifications.js +2 -0
- package/dist/implementations/dms/page/notifications.js.map +1 -1
- package/dist/implementations/dms/page/registry.js +19 -4
- package/dist/implementations/dms/page/registry.js.map +1 -1
- package/dist/implementations/dms/registry-snapshot.d.ts +32 -0
- package/dist/implementations/dms/registry-snapshot.js +55 -0
- package/dist/implementations/dms/registry-snapshot.js.map +1 -0
- package/dist/implementations/dms/services.d.ts +2 -0
- package/dist/implementations/dms/services.js +2 -0
- package/dist/implementations/dms/services.js.map +1 -1
- package/dist/implementations/dms/tenant-access.d.ts +1 -0
- package/dist/implementations/dms/tenant-access.js +7 -0
- package/dist/implementations/dms/tenant-access.js.map +1 -1
- package/dist/implementations/dms-builder/engine/compose-page.js +1 -1
- package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
- package/dist/implementations/dms-builder/engine/map-resources-pages.js +1 -1
- package/dist/implementations/dms-builder/engine/map-resources-pages.js.map +1 -1
- package/dist/implementations/dms-builder/engine/ops-blocks.d.ts +2 -1
- package/dist/implementations/dms-builder/engine/ops-blocks.js +12 -1
- package/dist/implementations/dms-builder/engine/ops-blocks.js.map +1 -1
- package/dist/implementations/dms-builder/engine/table-view-settings.js +9 -33
- package/dist/implementations/dms-builder/engine/table-view-settings.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +9 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/mockup-export/capture.d.ts +19 -0
- package/dist/mcp/mockup-export/capture.js +99 -0
- package/dist/mcp/mockup-export/capture.js.map +1 -0
- package/dist/mcp/mockup-export/document.d.ts +4 -0
- package/dist/mcp/mockup-export/document.js +199 -0
- package/dist/mcp/mockup-export/document.js.map +1 -0
- package/dist/mcp/mockup-export/index.d.ts +20 -0
- package/dist/mcp/mockup-export/index.js +112 -0
- package/dist/mcp/mockup-export/index.js.map +1 -0
- package/dist/mcp/mockup-export/jobs.d.ts +32 -0
- package/dist/mcp/mockup-export/jobs.js +49 -0
- package/dist/mcp/mockup-export/jobs.js.map +1 -0
- package/dist/mcp/mockup-export/plan.d.ts +78 -0
- package/dist/mcp/mockup-export/plan.js +296 -0
- package/dist/mcp/mockup-export/plan.js.map +1 -0
- package/dist/mcp/mockup-export/route.d.ts +23 -0
- package/dist/mcp/mockup-export/route.js +91 -0
- package/dist/mcp/mockup-export/route.js.map +1 -0
- package/dist/mcp/page-verify/index.d.ts +15 -0
- package/dist/mcp/page-verify/index.js +16 -6
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/mockup.d.ts +3 -1
- package/dist/mcp/page-verify/mockup.js +2 -0
- package/dist/mcp/page-verify/mockup.js.map +1 -1
- package/dist/mcp/page-verify/modules.d.ts +1 -0
- package/dist/mcp/page-verify/modules.js +22 -0
- package/dist/mcp/page-verify/modules.js.map +1 -0
- package/dist/mcp/page-verify/page-probe.d.ts +5 -0
- package/dist/mcp/page-verify/page-probe.js +2 -0
- package/dist/mcp/page-verify/page-probe.js.map +1 -1
- package/dist/mcp/page-verify/playwright.d.ts +22 -4
- package/dist/mcp/page-verify/playwright.js.map +1 -1
- package/dist/mcp/page-verify/report.d.ts +1 -0
- package/dist/mcp/tools/builder-compose.js +4 -1
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-pages.js +1 -1
- package/dist/mcp/tools/builder-pages.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +2 -0
- package/dist/mcp/tools/index.js +6 -1
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/mockup-export-pdf.d.ts +1 -0
- package/dist/mcp/tools/mockup-export-pdf.js +69 -0
- package/dist/mcp/tools/mockup-export-pdf.js.map +1 -0
- package/dist/mcp/tools/mockup-install-modules.d.ts +9 -0
- package/dist/mcp/tools/mockup-install-modules.js +122 -0
- package/dist/mcp/tools/mockup-install-modules.js.map +1 -0
- package/dist/mcp/tools/mockup-module-catalog.d.ts +3 -0
- package/dist/mcp/tools/mockup-module-catalog.js +52 -0
- package/dist/mcp/tools/mockup-module-catalog.js.map +1 -0
- package/dist/mcp/tools/mockup-patch-spec.js +1 -1
- package/dist/mcp/tools/mockup-patch-spec.js.map +1 -1
- package/dist/mcp/tools/mockup-read-spec.js +8 -6
- package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
- package/dist/mcp/tools/mockup-support.js +18 -5
- package/dist/mcp/tools/mockup-support.js.map +1 -1
- package/dist/mcp/tools/mockup-write-spec.js +1 -1
- package/dist/mcp/tools/mockup-write-spec.js.map +1 -1
- package/dist/mcp/tools/mockup.js +6 -0
- package/dist/mcp/tools/mockup.js.map +1 -1
- package/dist/mcp/tools/page-verify.d.ts +1 -0
- package/dist/mcp/tools/page-verify.js +6 -2
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/dist/mcp/tools/pages.d.ts +1 -0
- package/dist/mcp/tools/pages.js +9 -3
- package/dist/mcp/tools/pages.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-layouts.d.ts +5 -0
- package/dist/mockup/compile-layouts.js +74 -0
- package/dist/mockup/compile-layouts.js.map +1 -0
- package/dist/mockup/compile-modules.d.ts +5 -0
- package/dist/mockup/compile-modules.js +40 -0
- package/dist/mockup/compile-modules.js.map +1 -0
- package/dist/mockup/compile-nodes.d.ts +11 -0
- package/dist/mockup/compile-nodes.js +119 -0
- package/dist/mockup/compile-nodes.js.map +1 -0
- package/dist/mockup/compile-pages.d.ts +20 -0
- package/dist/mockup/compile-pages.js +272 -0
- package/dist/mockup/compile-pages.js.map +1 -0
- package/dist/mockup/compile.d.ts +10 -12
- package/dist/mockup/compile.js +36 -292
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/controller-blocks.js +2 -0
- package/dist/mockup/controller-blocks.js.map +1 -1
- package/dist/mockup/create.d.ts +16 -0
- package/dist/mockup/create.js +78 -0
- package/dist/mockup/create.js.map +1 -0
- package/dist/mockup/created-watch.d.ts +18 -0
- package/dist/mockup/created-watch.js +110 -0
- package/dist/mockup/created-watch.js.map +1 -0
- package/dist/mockup/database-routes.d.ts +15 -0
- package/dist/mockup/database-routes.js +58 -0
- package/dist/mockup/database-routes.js.map +1 -0
- package/dist/mockup/database-schema.d.ts +17 -0
- package/dist/mockup/database-schema.js +41 -0
- package/dist/mockup/database-schema.js.map +1 -0
- package/dist/mockup/entities.d.ts +20 -0
- package/dist/mockup/entities.js +213 -0
- package/dist/mockup/entities.js.map +1 -0
- package/dist/mockup/etag.d.ts +1 -0
- package/dist/mockup/etag.js +10 -0
- package/dist/mockup/etag.js.map +1 -0
- package/dist/mockup/extensions.d.ts +34 -0
- package/dist/mockup/extensions.js +107 -0
- package/dist/mockup/extensions.js.map +1 -0
- package/dist/mockup/files.d.ts +2 -1
- package/dist/mockup/files.js +2 -1
- package/dist/mockup/files.js.map +1 -1
- package/dist/mockup/fixture-answers.d.ts +3 -2
- package/dist/mockup/fixture-answers.js +13 -4
- package/dist/mockup/fixture-answers.js.map +1 -1
- package/dist/mockup/fixture-batch.d.ts +21 -0
- package/dist/mockup/fixture-batch.js +111 -0
- package/dist/mockup/fixture-batch.js.map +1 -0
- package/dist/mockup/fixture-routes.d.ts +21 -0
- package/dist/mockup/fixture-routes.js +136 -0
- package/dist/mockup/fixture-routes.js.map +1 -0
- package/dist/mockup/fixtures.d.ts +2 -29
- package/dist/mockup/fixtures.js +0 -111
- package/dist/mockup/fixtures.js.map +1 -1
- package/dist/mockup/from-page.js +2 -9
- package/dist/mockup/from-page.js.map +1 -1
- package/dist/mockup/generate.js +4 -1
- package/dist/mockup/generate.js.map +1 -1
- package/dist/mockup/history-routes.d.ts +2 -4
- package/dist/mockup/history-routes.js +30 -39
- package/dist/mockup/history-routes.js.map +1 -1
- package/dist/mockup/history.js +7 -3
- package/dist/mockup/history.js.map +1 -1
- package/dist/mockup/index.d.ts +14 -0
- package/dist/mockup/index.js +14 -0
- package/dist/mockup/index.js.map +1 -1
- package/dist/mockup/json-schema-entities.d.ts +5 -0
- package/dist/mockup/json-schema-entities.js +141 -0
- package/dist/mockup/json-schema-entities.js.map +1 -0
- package/dist/mockup/json-schema-layout.d.ts +1 -0
- package/dist/mockup/json-schema-layout.js +95 -2
- package/dist/mockup/json-schema-layout.js.map +1 -1
- package/dist/mockup/json-schema.d.ts +1 -1
- package/dist/mockup/json-schema.js +41 -20
- package/dist/mockup/json-schema.js.map +1 -1
- package/dist/mockup/json.d.ts +8 -0
- package/dist/mockup/json.js +20 -0
- package/dist/mockup/json.js.map +1 -0
- package/dist/mockup/layout-model.d.ts +156 -0
- package/dist/mockup/layout-model.js +96 -0
- package/dist/mockup/layout-model.js.map +1 -0
- package/dist/mockup/layouts.d.ts +9 -0
- package/dist/mockup/layouts.js +40 -0
- package/dist/mockup/layouts.js.map +1 -0
- package/dist/mockup/manage-routes.d.ts +3 -1
- package/dist/mockup/manage-routes.js +38 -1
- 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 +145 -99
- package/dist/mockup/model.js +101 -86
- package/dist/mockup/model.js.map +1 -1
- package/dist/mockup/module-context.d.ts +25 -0
- package/dist/mockup/module-context.js +83 -0
- package/dist/mockup/module-context.js.map +1 -0
- package/dist/mockup/module-install.d.ts +22 -0
- package/dist/mockup/module-install.js +71 -0
- package/dist/mockup/module-install.js.map +1 -0
- package/dist/mockup/module-states.d.ts +17 -0
- package/dist/mockup/module-states.js +167 -0
- package/dist/mockup/module-states.js.map +1 -0
- package/dist/mockup/modules-schema.d.ts +2 -0
- package/dist/mockup/modules-schema.js +38 -0
- package/dist/mockup/modules-schema.js.map +1 -0
- package/dist/mockup/modules.d.ts +9 -10
- package/dist/mockup/modules.js +104 -25
- package/dist/mockup/modules.js.map +1 -1
- package/dist/mockup/page-capture-routes.d.ts +19 -0
- package/dist/mockup/page-capture-routes.js +92 -0
- package/dist/mockup/page-capture-routes.js.map +1 -0
- package/dist/mockup/page-captures.d.ts +61 -0
- package/dist/mockup/page-captures.js +252 -0
- package/dist/mockup/page-captures.js.map +1 -0
- package/dist/mockup/page-descriptions.d.ts +2 -0
- package/dist/mockup/page-descriptions.js +18 -0
- package/dist/mockup/page-descriptions.js.map +1 -0
- package/dist/mockup/parse-spec.d.ts +10 -0
- package/dist/mockup/parse-spec.js +62 -0
- package/dist/mockup/parse-spec.js.map +1 -0
- package/dist/mockup/places.d.ts +17 -0
- package/dist/mockup/places.js +75 -0
- package/dist/mockup/places.js.map +1 -0
- 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 +6 -0
- package/dist/mockup/refusals.js +17 -0
- package/dist/mockup/refusals.js.map +1 -1
- package/dist/mockup/routes.d.ts +3 -5
- package/dist/mockup/routes.js +24 -163
- package/dist/mockup/routes.js.map +1 -1
- package/dist/mockup/sketch-limits.d.ts +1 -0
- package/dist/mockup/sketch-limits.js +2 -1
- package/dist/mockup/sketch-limits.js.map +1 -1
- package/dist/mockup/sketch.d.ts +2 -2
- package/dist/mockup/sketch.js +2 -1
- package/dist/mockup/sketch.js.map +1 -1
- package/dist/mockup/slug.d.ts +3 -0
- package/dist/mockup/slug.js +7 -0
- package/dist/mockup/slug.js.map +1 -0
- package/dist/mockup/source-routes.d.ts +5 -4
- package/dist/mockup/source-routes.js +26 -17
- package/dist/mockup/source-routes.js.map +1 -1
- package/dist/mockup/source.d.ts +3 -3
- package/dist/mockup/source.js +4 -3
- package/dist/mockup/source.js.map +1 -1
- package/dist/mockup/state-patch.d.ts +22 -0
- package/dist/mockup/state-patch.js +76 -0
- package/dist/mockup/state-patch.js.map +1 -0
- package/dist/mockup/state.d.ts +163 -0
- package/dist/mockup/state.js +24 -0
- package/dist/mockup/state.js.map +1 -0
- package/dist/mockup/store-list.d.ts +28 -0
- package/dist/mockup/store-list.js +89 -0
- package/dist/mockup/store-list.js.map +1 -0
- package/dist/mockup/store.d.ts +25 -38
- package/dist/mockup/store.js +126 -203
- package/dist/mockup/store.js.map +1 -1
- package/dist/mockup/table-archive.d.ts +0 -1
- package/dist/mockup/table-archive.js +0 -16
- package/dist/mockup/table-archive.js.map +1 -1
- package/dist/mockup/tenancy.d.ts +19 -0
- package/dist/mockup/tenancy.js +73 -0
- package/dist/mockup/tenancy.js.map +1 -0
- package/dist/mockup/tenant-rows.d.ts +4 -0
- package/dist/mockup/tenant-rows.js +19 -0
- package/dist/mockup/tenant-rows.js.map +1 -0
- package/dist/mockup/unknown-keys.d.ts +2 -2
- package/dist/mockup/unknown-keys.js +8 -4
- package/dist/mockup/unknown-keys.js.map +1 -1
- package/dist/mockup/validate.d.ts +2 -2
- package/dist/mockup/validate.js.map +1 -1
- package/dist/store/catalog.d.ts +5 -1
- package/dist/store/catalog.js +12 -1
- package/dist/store/catalog.js.map +1 -1
- package/dist/store/changes.d.ts +3 -0
- package/dist/store/changes.js +22 -0
- package/dist/store/changes.js.map +1 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.js +2 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/listing.js +5 -5
- package/dist/store/listing.js.map +1 -1
- package/dist/store/operations.d.ts +8 -0
- package/dist/store/operations.js +27 -3
- package/dist/store/operations.js.map +1 -1
- package/dist/store/registry.d.ts +1 -0
- package/dist/store/registry.js +9 -0
- package/dist/store/registry.js.map +1 -1
- package/dist/store/types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/live-pages.d.ts +41 -0
- package/dist/types/live-pages.js +3 -0
- package/dist/types/live-pages.js.map +1 -0
- package/dist/validation/store.schema.d.ts +1 -0
- package/dist/validation/store.schema.js +4 -4
- package/dist/validation/store.schema.js.map +1 -1
- package/e2e/index.mjs +3 -2
- package/frontend-vue/build/viewer-chunks.ts +181 -0
- package/frontend-vue/dms.frontend.build.ts +2 -1
- package/frontend-vue/dms.frontend.ts +7 -0
- package/frontend-vue/eslint-globals.generated.mjs +27 -24
- package/frontend-vue/layers/dms-core/app/build/utils/asyncDataScope.ts +3 -31
- package/frontend-vue/layers/dms-core/app/build/utils/previewFrame.ts +6 -1
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +8 -2
- package/frontend-vue/layers/dms-core/app/utils/localFetchAnswers.ts +124 -0
- package/frontend-vue/layers/dms-core/app/utils/textDigest.ts +29 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +4 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +4 -0
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +89 -31
- package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +21 -6
- package/frontend-vue/layers/dms-layout/app/build/components/layout/SidebarUserMenu.vue +61 -8
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +79 -9
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsNav.vue +57 -8
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +12 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/useSettingsNavigation.ts +42 -62
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-mockups.ts +12 -2
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-toast.ts +9 -1
- package/frontend-vue/layers/dms-layout/app/composables/page/useMockupStoreInstaller.ts +85 -0
- package/frontend-vue/layers/dms-layout/app/custom-layouts/MockupLayout.vue +0 -2
- package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +53 -6
- package/frontend-vue/layers/dms-layout/app/plugins/mockup-store-installer.ts +10 -0
- package/frontend-vue/layers/dms-layout/app/plugins/registered-sidebar-widgets.ts +10 -0
- package/frontend-vue/layers/dms-layout/app/plugins/seo.ts +7 -0
- package/frontend-vue/layers/dms-layout/app/theme/actions.ts +11 -7
- package/frontend-vue/layers/dms-onboarding/app/middleware/onboarding.global.ts +3 -3
- package/frontend-vue/layers/dms-onboarding/app/plugins/onboarding-preload.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +31 -5
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupCanvasChrome.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +204 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseData.vue +288 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseDiagram.vue +91 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseRelationEdge.vue +40 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseTableNode.vue +133 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEmptyState.vue +23 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModuleStore.vue +240 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +54 -33
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSectionLabel.vue +52 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +65 -12
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPagesList.vue +21 -0
- 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/MockupReconnecting.vue +17 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTenantBanner.vue +48 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTitle.vue +24 -15
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupToolbar.vue +196 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTopBar.vue +200 -179
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWarningsMenu.vue +59 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +152 -57
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +142 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewAdmission.ts +20 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +71 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +44 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewSwapHold.ts +157 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/registeredSidebarWidgets.ts +20 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/storeModuleInstaller.ts +32 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockInspector.ts +14 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +309 -41
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useFixtureBatches.ts +154 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupActivation.ts +182 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupConnectionTables.ts +80 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +212 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +13 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameRender.ts +126 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameSize.ts +10 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +50 -23
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +103 -29
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageZoom.ts +146 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +124 -0
- 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 +11 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +60 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +36 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupToolModes.ts +5 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerActivation.ts +59 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerExport.ts +46 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +44 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupWarningFocus.ts +145 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +39 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePersistedCaptures.ts +151 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +41 -0
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +37 -3
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCreateModal.vue +130 -0
- package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +20 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +137 -78
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +1 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +165 -103
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +321 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +22 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +112 -175
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupActivation.ts +120 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupAnnotations.ts +146 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +118 -9
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupDiagram.ts +330 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +80 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +123 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +11 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModuleNavigation.ts +215 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModules.ts +240 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +21 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverviewSections.ts +66 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPageTree.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPins.ts +6 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupRealData.ts +23 -5
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupRows.ts +83 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +173 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSettings.ts +218 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +17 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +20 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStatePatch.ts +180 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +17 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +148 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +23 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTitles.ts +33 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupVersions.ts +2 -7
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixtureAnswers.ts +156 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +37 -19
- package/frontend-vue/layers/dms-ui/app/build/utils/previewOptionRules.ts +129 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +108 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/previewRows.ts +400 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/settingsGroups.ts +73 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/sketch.ts +68 -12
- package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +61 -12
- package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +4 -1
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupModuleStore.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupTenantBanner.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/registeredSidebarWidgets.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/storeModuleInstaller.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useFixtureBatches.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupActivation.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupOverview.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupPdfExport.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupRoutePage.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupSession.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupTenancy.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePersistedCaptures.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/blockPreview.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/json.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupActivation.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupAnnotations.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupDiagram.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupModuleNavigation.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupOverviewSections.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupRows.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSettings.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupStatePatch.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenancy.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenants.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTitles.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewFixtureAnswers.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewRows.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/settingsGroups.ts +1 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +85 -7
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +85 -7
- package/frontend-vue/package.json +2 -2
- package/frontend-vue/scripts/test-dms-components.mjs +1 -1
- package/package.json +6 -5
- package/dist/mockup/row-filters.d.ts +0 -8
- package/dist/mockup/row-filters.js +0 -107
- package/dist/mockup/row-filters.js.map +0 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +0 -47
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewZoom.vue +0 -67
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MOCKUP_TEMPLATES = void 0;
|
|
4
|
+
exports.createMockup = createMockup;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const example_1 = require("./example");
|
|
9
|
+
const files_1 = require("./files");
|
|
10
|
+
const model_1 = require("./model");
|
|
11
|
+
const JSON_INDENT = 2;
|
|
12
|
+
const MAX_CREATE_ATTEMPTS = 100;
|
|
13
|
+
const MAX_STEM_LENGTH = 48;
|
|
14
|
+
const FALLBACK_STEM = "mockup";
|
|
15
|
+
const TEMPORARY_SUFFIX = ".tmp";
|
|
16
|
+
const EXISTING_DIRECTORY = "EEXIST";
|
|
17
|
+
exports.MOCKUP_TEMPLATES = ["blank", "example"];
|
|
18
|
+
const TEMPLATES = {
|
|
19
|
+
blank: (title) => Promise.resolve({
|
|
20
|
+
version: 1,
|
|
21
|
+
title,
|
|
22
|
+
pages: [{ id: "home", title: "Home", tree: [] }],
|
|
23
|
+
}),
|
|
24
|
+
example: async (title) => {
|
|
25
|
+
const example = await (0, example_1.readExampleSpec)();
|
|
26
|
+
return example && { ...example, title };
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
function withoutAccents(text) {
|
|
30
|
+
return text.normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
31
|
+
}
|
|
32
|
+
function* candidateNames(title) {
|
|
33
|
+
const stem = (0, model_1.slugOfText)(withoutAccents(title).toLowerCase(), MAX_STEM_LENGTH) ||
|
|
34
|
+
FALLBACK_STEM;
|
|
35
|
+
for (let attempt = 1; attempt <= MAX_CREATE_ATTEMPTS; attempt++) {
|
|
36
|
+
const name = (0, model_1.parseMockupName)(attempt === 1 ? stem : `${stem}-${attempt}`);
|
|
37
|
+
if (name)
|
|
38
|
+
yield name;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function createMockup(mockupsDir, request) {
|
|
42
|
+
const spec = await TEMPLATES[request.template](request.title);
|
|
43
|
+
if (!spec)
|
|
44
|
+
return { kind: "no_template" };
|
|
45
|
+
await (0, promises_1.mkdir)(mockupsDir, { recursive: true });
|
|
46
|
+
const staging = (0, node_path_1.join)(mockupsDir, `.create-${(0, node_crypto_1.randomBytes)(6).toString("hex")}${TEMPORARY_SUFFIX}`);
|
|
47
|
+
const staged = (0, node_path_1.join)(staging, files_1.SPEC_FILE);
|
|
48
|
+
try {
|
|
49
|
+
await (0, promises_1.mkdir)(staging);
|
|
50
|
+
await (0, promises_1.writeFile)(staged, `${JSON.stringify(spec, null, JSON_INDENT)}\n`, "utf8");
|
|
51
|
+
for (const name of candidateNames(request.title)) {
|
|
52
|
+
const directory = (0, files_1.mockupDirectory)(mockupsDir, name);
|
|
53
|
+
try {
|
|
54
|
+
await (0, promises_1.mkdir)(directory);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if ((0, files_1.parseFsError)(error).code === EXISTING_DIRECTORY)
|
|
58
|
+
continue;
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
await (0, promises_1.link)(staged, (0, node_path_1.join)(directory, files_1.SPEC_FILE));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if ((0, files_1.parseFsError)(error).code === EXISTING_DIRECTORY)
|
|
66
|
+
continue;
|
|
67
|
+
await (0, promises_1.rmdir)(directory).catch(() => undefined);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
return { kind: "done", name };
|
|
71
|
+
}
|
|
72
|
+
return { kind: "no_free_name" };
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
await (0, promises_1.rm)(staging, { recursive: true, force: true });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/mockup/create.ts"],"names":[],"mappings":";;;;AAAA,6CAA0C;AAC1C,+CAAqE;AACrE,yCAAiC;AACjC,uCAA4C;AAC5C,mCAAmE;AAEnE,mCAKiB;AAEjB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,aAAa,GAAG,QAAQ,CAAC;AAC/B,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAGvB,QAAA,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AC9D,MAAM,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC9C,MAAM,KAAK,CAAC;YACd,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAChC,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAClC,CAAC;YAAS,CAAC;QACT,MAAM,IAAA,aAAE,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MockupName } from "./model";
|
|
2
|
+
export interface MockupCreated {
|
|
3
|
+
name: MockupName;
|
|
4
|
+
title?: string;
|
|
5
|
+
}
|
|
6
|
+
export type MockupCreatedListener = (created: MockupCreated) => void;
|
|
7
|
+
export declare class CreatedWatcher {
|
|
8
|
+
private readonly mockupsDir;
|
|
9
|
+
private readonly readSpec;
|
|
10
|
+
private watch;
|
|
11
|
+
constructor(mockupsDir: string, readSpec: (name: MockupName) => Promise<string | undefined>);
|
|
12
|
+
subscribe(listener: MockupCreatedListener): Promise<() => void>;
|
|
13
|
+
close(): void;
|
|
14
|
+
private start;
|
|
15
|
+
private stop;
|
|
16
|
+
private specNames;
|
|
17
|
+
private scan;
|
|
18
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreatedWatcher = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
|
+
const files_1 = require("./files");
|
|
8
|
+
const model_1 = require("./model");
|
|
9
|
+
const summary_fields_1 = require("./summary-fields");
|
|
10
|
+
const CREATED_POLL_MS = 500;
|
|
11
|
+
class CreatedWatcher {
|
|
12
|
+
mockupsDir;
|
|
13
|
+
readSpec;
|
|
14
|
+
watch;
|
|
15
|
+
constructor(mockupsDir, readSpec) {
|
|
16
|
+
this.mockupsDir = mockupsDir;
|
|
17
|
+
this.readSpec = readSpec;
|
|
18
|
+
}
|
|
19
|
+
async subscribe(listener) {
|
|
20
|
+
const watched = this.watch ?? (await this.start());
|
|
21
|
+
watched.listeners.add(listener);
|
|
22
|
+
return () => {
|
|
23
|
+
watched.listeners.delete(listener);
|
|
24
|
+
if (!watched.listeners.size)
|
|
25
|
+
this.stop(watched);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
close() {
|
|
29
|
+
if (this.watch)
|
|
30
|
+
this.stop(this.watch);
|
|
31
|
+
}
|
|
32
|
+
async start() {
|
|
33
|
+
const known = new Set(await this.specNames());
|
|
34
|
+
if (this.watch)
|
|
35
|
+
return this.watch;
|
|
36
|
+
const watched = {
|
|
37
|
+
listeners: new Set(),
|
|
38
|
+
known,
|
|
39
|
+
scanning: false,
|
|
40
|
+
timer: setInterval(() => void this.scan(watched), CREATED_POLL_MS),
|
|
41
|
+
};
|
|
42
|
+
watched.timer.unref();
|
|
43
|
+
this.watch = watched;
|
|
44
|
+
return watched;
|
|
45
|
+
}
|
|
46
|
+
stop(watched) {
|
|
47
|
+
clearInterval(watched.timer);
|
|
48
|
+
if (this.watch === watched)
|
|
49
|
+
this.watch = undefined;
|
|
50
|
+
}
|
|
51
|
+
async specNames() {
|
|
52
|
+
let entries;
|
|
53
|
+
try {
|
|
54
|
+
entries = await (0, promises_1.readdir)(this.mockupsDir);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
58
|
+
return [];
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
const names = await Promise.all(entries.map(async (entry) => {
|
|
62
|
+
const name = (0, model_1.parseMockupName)(entry);
|
|
63
|
+
if (!name)
|
|
64
|
+
return undefined;
|
|
65
|
+
try {
|
|
66
|
+
await (0, promises_1.stat)((0, node_path_1.join)((0, files_1.mockupDirectory)(this.mockupsDir, name), files_1.SPEC_FILE));
|
|
67
|
+
return name;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
71
|
+
return undefined;
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
return names.flatMap((name) => name ?? []);
|
|
76
|
+
}
|
|
77
|
+
async scan(watched) {
|
|
78
|
+
if (watched.scanning)
|
|
79
|
+
return;
|
|
80
|
+
watched.scanning = true;
|
|
81
|
+
try {
|
|
82
|
+
const names = await this.specNames();
|
|
83
|
+
const present = new Set(names);
|
|
84
|
+
for (const name of watched.known) {
|
|
85
|
+
if (!present.has(name))
|
|
86
|
+
watched.known.delete(name);
|
|
87
|
+
}
|
|
88
|
+
for (const name of names) {
|
|
89
|
+
if (watched.known.has(name))
|
|
90
|
+
continue;
|
|
91
|
+
const text = await this.readSpec(name);
|
|
92
|
+
watched.known.add(name);
|
|
93
|
+
const created = { name };
|
|
94
|
+
const title = text === undefined ? "" : (0, summary_fields_1.readSummaryFields)(text).title;
|
|
95
|
+
if (title)
|
|
96
|
+
created.title = title;
|
|
97
|
+
for (const listener of watched.listeners)
|
|
98
|
+
listener(created);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
logging_1.Logging.Warn("[DMS] the mockups directory could not be read", error);
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
watched.scanning = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.CreatedWatcher = CreatedWatcher;
|
|
110
|
+
//# sourceMappingURL=created-watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"created-watch.js","sourceRoot":"","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AC;gBAAS,CAAC;YACT,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC3B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ExplorerSchemaAnswer } from "./database-schema";
|
|
2
|
+
import type { MockupStore } from "./store";
|
|
3
|
+
export declare function registerDatabaseRoutes(store: MockupStore): {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
database(rawName: string): Promise<ExplorerSchemaAnswer>;
|
|
6
|
+
requestContext: import("@antelopejs/interface-api").RequestContext;
|
|
7
|
+
roleModel: import("@antelopejs/interface-dms/db").RoleModel;
|
|
8
|
+
memberModel: import("@antelopejs/interface-dms/db").TenantMemberModel;
|
|
9
|
+
user: import("@antelopejs/interface-dms/auth/db").User | undefined;
|
|
10
|
+
assertOwner(): Promise<void>;
|
|
11
|
+
owner(): Promise<import("./presence").Who>;
|
|
12
|
+
};
|
|
13
|
+
extend: <T extends import("@antelopejs/interface-api").ControllerClass>(this: T, location: string) => T;
|
|
14
|
+
location: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.registerDatabaseRoutes = registerDatabaseRoutes;
|
|
16
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
|
+
const catalog_connection_1 = require("../implementations/dms-builder/engine/catalog-connection");
|
|
18
|
+
const database_schema_1 = require("./database-schema");
|
|
19
|
+
const fixtures_1 = require("./fixtures");
|
|
20
|
+
const owner_controller_1 = require("./owner-controller");
|
|
21
|
+
const refusals_1 = require("./refusals");
|
|
22
|
+
const DESCRIBE_BATCH = 20;
|
|
23
|
+
function namesOf(summaries) {
|
|
24
|
+
return summaries.map(({ schema, name }) => `${schema}.${name}`);
|
|
25
|
+
}
|
|
26
|
+
async function describeAll(catalog) {
|
|
27
|
+
const names = namesOf(await catalog.ListRelations());
|
|
28
|
+
const described = [];
|
|
29
|
+
for (let start = 0; start < names.length; start += DESCRIBE_BATCH) {
|
|
30
|
+
described.push(...(await catalog.DescribeRelations(names.slice(start, start + DESCRIBE_BATCH))));
|
|
31
|
+
}
|
|
32
|
+
return described;
|
|
33
|
+
}
|
|
34
|
+
function registerDatabaseRoutes(store) {
|
|
35
|
+
class MockupDatabaseController extends (0, interface_api_1.Controller)(fixtures_1.MOCKUP_API, owner_controller_1.MockupOwnerController) {
|
|
36
|
+
async database(rawName) {
|
|
37
|
+
await this.assertOwner();
|
|
38
|
+
const state = await store.state((0, refusals_1.nameOf)(rawName));
|
|
39
|
+
if (!state)
|
|
40
|
+
throw (0, refusals_1.notFound)("mockup");
|
|
41
|
+
const catalog = state.connection === undefined
|
|
42
|
+
? undefined
|
|
43
|
+
: (0, catalog_connection_1.catalogOf)(state.connection);
|
|
44
|
+
if (!catalog)
|
|
45
|
+
throw (0, refusals_1.notFound)("connection");
|
|
46
|
+
return { tables: (0, database_schema_1.catalogSchema)(await describeAll(catalog)) };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, interface_api_1.Get)(":name/database"),
|
|
51
|
+
__param(0, (0, interface_api_1.Parameter)("name")),
|
|
52
|
+
__metadata("design:type", Function),
|
|
53
|
+
__metadata("design:paramtypes", [String]),
|
|
54
|
+
__metadata("design:returntype", Promise)
|
|
55
|
+
], MockupDatabaseController.prototype, "database", null);
|
|
56
|
+
return MockupDatabaseController;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=database-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-routes.js","sourceRoot":"","sources":["../../src/mockup/database-routes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAuE;AAKvE,iGAAqF;AACrF,uDAA6E;AAC7E,yCAAwC;AACxC,yDAA2D;AAC3D,yCAA8C;AAI9C,MAAM,cAAc,GAAG,EAAE,CAAC;AAG1B,SAAS,OAAO,CAAC,SAAqC;IACpD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC;AAGD,KAAK,UAAU,WAAW,CACxB,OAAkD;IAElD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACrD,MAAM,SAAS,GAA0B,EAAE,CAAC;IAC5C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,cAAc,EAAE,CAAC;QAClE,SAAS,CAAC,IAAI,CACZ,GAAG,CAAC,MAAM,OAAO,CAAC,iBAAiB,CACjC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC,CAC3C,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AASD,gCAAuC,KAAkB;IACvD,MAAM,wBAAyB,SAAQ,IAAA,0BAAU,EAC/C,qBAAU,EACV,wCAAqB,CACtB;QAEO,AAAN,KAAK,CAAC,QAAQ,CACO,OAAe;YAElC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,IAAA,iBAAM,EAAC,OAAO,CAAC,CAAC,CAAC;YACjD,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAA,mBAAQ,EAAC,QAAQ,CAAC,CAAC;YACrC,MAAM,OAAO,GACX,KAAK,CAAC,UAAU,KAAK,SAAS;gBAC5B,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,IAAA,8BAAS,EAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAClC,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAA,mBAAQ,EAAC,YAAY,CAAC,CAAC;YAC3C,OAAO,EAAE,MAAM,EAAE,IAAA,+BAAa,EAAC,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC/D,CAAC;KACF;IAbO;QADL,IAAA,mBAAG,EAAC,gBAAgB,CAAC;QAEnB,WAAA,IAAA,yBAAS,EAAC,MAAM,CAAC,CAAA;;;;4DAWnB;IAEH,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RelationDescription } from "@antelopejs/interface-database-catalog";
|
|
2
|
+
export type ExplorerColumnRole = "key" | "relation" | "plain";
|
|
3
|
+
export interface ExplorerColumn {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
role: ExplorerColumnRole;
|
|
7
|
+
to?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ExplorerTable {
|
|
10
|
+
name: string;
|
|
11
|
+
columns: ExplorerColumn[];
|
|
12
|
+
badges: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ExplorerSchemaAnswer {
|
|
15
|
+
tables: ExplorerTable[];
|
|
16
|
+
}
|
|
17
|
+
export declare function catalogSchema(descriptions: readonly RelationDescription[]): ExplorerTable[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.catalogSchema = catalogSchema;
|
|
4
|
+
function nameOf(relation) {
|
|
5
|
+
return `${relation.schema}.${relation.name}`;
|
|
6
|
+
}
|
|
7
|
+
function targetsOf(description) {
|
|
8
|
+
const targets = new Map();
|
|
9
|
+
for (const reference of description.references) {
|
|
10
|
+
const [column, ...others] = reference.from.columns;
|
|
11
|
+
if (column !== undefined && others.length === 0) {
|
|
12
|
+
targets.set(column, reference.to.relation);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return targets;
|
|
16
|
+
}
|
|
17
|
+
function columnOf(column, keyColumns, targets) {
|
|
18
|
+
const to = targets.get(column.name);
|
|
19
|
+
const role = keyColumns.has(column.name)
|
|
20
|
+
? "key"
|
|
21
|
+
: to === undefined
|
|
22
|
+
? "plain"
|
|
23
|
+
: "relation";
|
|
24
|
+
return to === undefined
|
|
25
|
+
? { name: column.name, type: column.native, role }
|
|
26
|
+
: { name: column.name, type: column.native, role, to };
|
|
27
|
+
}
|
|
28
|
+
function catalogSchema(descriptions) {
|
|
29
|
+
return descriptions
|
|
30
|
+
.map((description) => {
|
|
31
|
+
const keyColumns = new Set(description.key?.columns);
|
|
32
|
+
const targets = targetsOf(description);
|
|
33
|
+
return {
|
|
34
|
+
name: nameOf(description),
|
|
35
|
+
columns: description.columns.map((column) => columnOf(column, keyColumns, targets)),
|
|
36
|
+
badges: [],
|
|
37
|
+
};
|
|
38
|
+
})
|
|
39
|
+
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=database-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-schema.js","sourceRoot":"","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A4C;IAE5C,OAAO,YAAY;SAChB,GAAG,CAAC,CAAC,WAAW,EAAiB,EAAE;QAClC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;QACvC,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC;YACzB,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1C,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CACtC;YACD,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type Json, type JsonObject } from "./json";
|
|
3
|
+
import type { MockupEntityState, MockupIssue, MockupSpec } from "./model";
|
|
4
|
+
export declare const ENTITY_KEY = "entity";
|
|
5
|
+
export declare const entityFixtureSchema: z.ZodObject<{
|
|
6
|
+
entity: z.ZodString;
|
|
7
|
+
rows: z.ZodArray<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export declare function holdsEntity(value: Json): boolean;
|
|
10
|
+
export declare function entityRows(value: Json): JsonObject[] | undefined;
|
|
11
|
+
export interface PointingFixture {
|
|
12
|
+
index: number;
|
|
13
|
+
pageId: string;
|
|
14
|
+
key: string;
|
|
15
|
+
entity: string;
|
|
16
|
+
rows: JsonObject[];
|
|
17
|
+
}
|
|
18
|
+
export declare function pointingFixtures(spec: MockupSpec): PointingFixture[];
|
|
19
|
+
export declare function compileEntities(spec: MockupSpec): MockupEntityState[] | undefined;
|
|
20
|
+
export declare function entityIssues(spec: MockupSpec): MockupIssue[];
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.entityFixtureSchema = exports.ENTITY_KEY = void 0;
|
|
4
|
+
exports.holdsEntity = holdsEntity;
|
|
5
|
+
exports.entityRows = entityRows;
|
|
6
|
+
exports.pointingFixtures = pointingFixtures;
|
|
7
|
+
exports.compileEntities = compileEntities;
|
|
8
|
+
exports.entityIssues = entityIssues;
|
|
9
|
+
const zod_1 = require("zod");
|
|
10
|
+
const json_1 = require("./json");
|
|
11
|
+
const tenant_rows_1 = require("./tenant-rows");
|
|
12
|
+
exports.ENTITY_KEY = "entity";
|
|
13
|
+
const ID_FIELD = "id";
|
|
14
|
+
const IMPLIED_ID = { type: "string" };
|
|
15
|
+
const IMPLIED_TENANT_ID = { type: "string" };
|
|
16
|
+
exports.entityFixtureSchema = zod_1.z
|
|
17
|
+
.object({ [exports.ENTITY_KEY]: zod_1.z.string(), rows: zod_1.z.array(json_1.jsonObjectSchema) })
|
|
18
|
+
.strict();
|
|
19
|
+
const objectSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
|
|
20
|
+
function holdsEntity(value) {
|
|
21
|
+
const object = objectSchema.safeParse(value);
|
|
22
|
+
return (object.success &&
|
|
23
|
+
Object.hasOwn(object.data, exports.ENTITY_KEY) &&
|
|
24
|
+
Object.hasOwn(object.data, "rows"));
|
|
25
|
+
}
|
|
26
|
+
function entityRows(value) {
|
|
27
|
+
const parsed = exports.entityFixtureSchema.safeParse(value);
|
|
28
|
+
return parsed.success ? parsed.data.rows : undefined;
|
|
29
|
+
}
|
|
30
|
+
function pointingFixtures(spec) {
|
|
31
|
+
return spec.pages.flatMap((page, index) => Object.entries(page.fixtures ?? {}).flatMap(([key, value]) => {
|
|
32
|
+
const read = exports.entityFixtureSchema.safeParse(value);
|
|
33
|
+
return read.success
|
|
34
|
+
? [{ index, pageId: page.id, key, ...read.data }]
|
|
35
|
+
: [];
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
function idOf(row) {
|
|
39
|
+
const id = zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).safeParse(row[ID_FIELD]);
|
|
40
|
+
return id.success ? String(id.data) : undefined;
|
|
41
|
+
}
|
|
42
|
+
function fieldOf(name, field) {
|
|
43
|
+
return { name, ...field };
|
|
44
|
+
}
|
|
45
|
+
function fieldsOf({ fields, tenantScoped, }) {
|
|
46
|
+
const { id = IMPLIED_ID, ...declared } = fields;
|
|
47
|
+
const implied = tenantScoped === true && !Object.hasOwn(declared, tenant_rows_1.TENANT_ID_FIELD)
|
|
48
|
+
? [fieldOf(tenant_rows_1.TENANT_ID_FIELD, IMPLIED_TENANT_ID)]
|
|
49
|
+
: [];
|
|
50
|
+
return [
|
|
51
|
+
fieldOf(ID_FIELD, id),
|
|
52
|
+
...implied,
|
|
53
|
+
...Object.entries(declared).map(([name, field]) => fieldOf(name, field)),
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
function dedupedById(rows) {
|
|
57
|
+
const seen = new Set();
|
|
58
|
+
return rows.filter((row) => {
|
|
59
|
+
const id = idOf(row);
|
|
60
|
+
if (id === undefined)
|
|
61
|
+
return true;
|
|
62
|
+
if (seen.has(id))
|
|
63
|
+
return false;
|
|
64
|
+
seen.add(id);
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function compileEntities(spec) {
|
|
69
|
+
const entities = Object.entries(spec.entities ?? {});
|
|
70
|
+
if (entities.length === 0)
|
|
71
|
+
return undefined;
|
|
72
|
+
const fixtures = pointingFixtures(spec);
|
|
73
|
+
return entities.map(([name, entity]) => {
|
|
74
|
+
const pointing = fixtures.filter((fixture) => fixture.entity === name);
|
|
75
|
+
const state = {
|
|
76
|
+
name,
|
|
77
|
+
fields: fieldsOf(entity),
|
|
78
|
+
rows: dedupedById(pointing.flatMap((fixture) => fixture.rows)),
|
|
79
|
+
pages: [...new Set(pointing.map((fixture) => fixture.pageId))],
|
|
80
|
+
};
|
|
81
|
+
if (entity.tenantScoped === true)
|
|
82
|
+
state.tenantScoped = true;
|
|
83
|
+
return state;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const MAX_SHOWN = 60;
|
|
87
|
+
function shown(value) {
|
|
88
|
+
const text = JSON.stringify(value);
|
|
89
|
+
return text.length > MAX_SHOWN ? `${text.slice(0, MAX_SHOWN)}…` : text;
|
|
90
|
+
}
|
|
91
|
+
function refused(issue) {
|
|
92
|
+
return json_1.jsonSchema.parse(issue.input);
|
|
93
|
+
}
|
|
94
|
+
function refusing(what) {
|
|
95
|
+
return {
|
|
96
|
+
error: (issue) => `expected ${what}, got ${shown(refused(issue))}`,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function text(what, accepts = () => true) {
|
|
100
|
+
return zod_1.z.string(refusing(what)).refine(accepts, refusing(what));
|
|
101
|
+
}
|
|
102
|
+
const finiteNumber = () => zod_1.z
|
|
103
|
+
.number(refusing("a finite number"))
|
|
104
|
+
.refine(Number.isFinite, refusing("a finite number"));
|
|
105
|
+
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
106
|
+
const VALUE_SCHEMAS = {
|
|
107
|
+
string: () => text("a string"),
|
|
108
|
+
number: finiteNumber,
|
|
109
|
+
price: finiteNumber,
|
|
110
|
+
boolean: () => zod_1.z.boolean(refusing("true or false")),
|
|
111
|
+
date: () => text("a date string, as Date.parse reads it", (value) => !Number.isNaN(Date.parse(value))),
|
|
112
|
+
email: () => text("an email address", (value) => EMAIL_PATTERN.test(value)),
|
|
113
|
+
url: () => text('an absolute URL, such as "https://example.com"', (value) => URL.canParse(value)),
|
|
114
|
+
enum: ({ values = [] }) => text(`one of ${values.map(shown).join(", ")}`, (value) => values.includes(value)),
|
|
115
|
+
ref: ({ to }, known) => {
|
|
116
|
+
const ids = to === undefined ? undefined : known.get(to);
|
|
117
|
+
return zod_1.z
|
|
118
|
+
.union([zod_1.z.string(), zod_1.z.number()], refusing("a string or number"))
|
|
119
|
+
.refine((id) => !ids || ids.has(String(id)), {
|
|
120
|
+
error: (issue) => `no row of ${to} has the id ${shown(refused(issue))}`,
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
function complaintAbout(value, schema) {
|
|
125
|
+
const read = schema.safeParse(value);
|
|
126
|
+
return read.success ? undefined : read.error.issues.at(0)?.message;
|
|
127
|
+
}
|
|
128
|
+
function knownIds(entities, fixtures) {
|
|
129
|
+
const ids = new Map();
|
|
130
|
+
for (const { entity, rows } of fixtures) {
|
|
131
|
+
if (!entities.has(entity) || rows.length === 0)
|
|
132
|
+
continue;
|
|
133
|
+
const held = ids.get(entity) ?? new Set();
|
|
134
|
+
for (const row of rows) {
|
|
135
|
+
const id = idOf(row);
|
|
136
|
+
if (id !== undefined)
|
|
137
|
+
held.add(id);
|
|
138
|
+
}
|
|
139
|
+
ids.set(entity, held);
|
|
140
|
+
}
|
|
141
|
+
return ids;
|
|
142
|
+
}
|
|
143
|
+
function unknownEntity(name, entities) {
|
|
144
|
+
const known = entities.size
|
|
145
|
+
? `the entities are ${[...entities.keys()].join(", ")}`
|
|
146
|
+
: "the spec has no entities";
|
|
147
|
+
return `no entity is named "${name}": ${known}`;
|
|
148
|
+
}
|
|
149
|
+
function rowIssues(fixture, fields, known) {
|
|
150
|
+
const checks = new Map(fields.map((field) => [
|
|
151
|
+
field.name,
|
|
152
|
+
{ type: field.type, schema: VALUE_SCHEMAS[field.type](field, known) },
|
|
153
|
+
]));
|
|
154
|
+
return fixture.rows.flatMap((row, at) => Object.entries(row).flatMap(([name, value]) => {
|
|
155
|
+
const path = (0, json_1.jsonPointer)([
|
|
156
|
+
"pages",
|
|
157
|
+
fixture.index,
|
|
158
|
+
"fixtures",
|
|
159
|
+
fixture.key,
|
|
160
|
+
"rows",
|
|
161
|
+
at,
|
|
162
|
+
name,
|
|
163
|
+
]);
|
|
164
|
+
const check = checks.get(name);
|
|
165
|
+
if (!check) {
|
|
166
|
+
return [
|
|
167
|
+
{
|
|
168
|
+
path,
|
|
169
|
+
message: `the entity "${fixture.entity}" has no field "${name}": its fields are ${fields.map((declared) => declared.name).join(", ")}`,
|
|
170
|
+
},
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
if (value === null)
|
|
174
|
+
return [];
|
|
175
|
+
const problem = complaintAbout(value, check.schema);
|
|
176
|
+
return problem
|
|
177
|
+
? [{ path, message: `${name} (${check.type}): ${problem}` }]
|
|
178
|
+
: [];
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
function entityIssues(spec) {
|
|
182
|
+
const entities = new Map(Object.entries(spec.entities ?? {}));
|
|
183
|
+
const fixtures = pointingFixtures(spec);
|
|
184
|
+
const known = knownIds(entities, fixtures);
|
|
185
|
+
const refIssues = [...entities].flatMap(([name, entity]) => Object.entries(entity.fields).flatMap(([field, declared]) => declared.type === "ref" && !entities.has(declared.to)
|
|
186
|
+
? [
|
|
187
|
+
{
|
|
188
|
+
path: (0, json_1.jsonPointer)(["entities", name, "fields", field, "to"]),
|
|
189
|
+
message: unknownEntity(declared.to, entities),
|
|
190
|
+
},
|
|
191
|
+
]
|
|
192
|
+
: []));
|
|
193
|
+
const fixtureIssues = fixtures.flatMap((fixture) => {
|
|
194
|
+
const entity = entities.get(fixture.entity);
|
|
195
|
+
if (!entity) {
|
|
196
|
+
return [
|
|
197
|
+
{
|
|
198
|
+
path: (0, json_1.jsonPointer)([
|
|
199
|
+
"pages",
|
|
200
|
+
fixture.index,
|
|
201
|
+
"fixtures",
|
|
202
|
+
fixture.key,
|
|
203
|
+
exports.ENTITY_KEY,
|
|
204
|
+
]),
|
|
205
|
+
message: unknownEntity(fixture.entity, entities),
|
|
206
|
+
},
|
|
207
|
+
];
|
|
208
|
+
}
|
|
209
|
+
return rowIssues(fixture, fieldsOf(entity), known);
|
|
210
|
+
});
|
|
211
|
+
return [...refIssues, ...fixtureIssues];
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/mockup/entities.ts"],"names":[],"mappings":";;;;;;;;AAAA,6BAAwB;AACxB,iCAMgB;AAUhB,+CAAgD;AAGnC,QAAA,UAAU,GAAG,QAAQ,CAAC;AAGnC,MAAM,QAAQ,GAAG,IAAI,CAAC;AAGtB,MAAM,UAAU,GAA0B,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAG7D,MAAM,iBAAiB,GAA0B,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAMvD,QAAA,mBAAmB,GAAG,OAAC;KACjC,MAAM,CAAC,EAAE,CAAC,QAAA,UAAU,CAAC,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,uBAAgB,CAAC,EAAE,CAAC;KACrE,MAAM,EAAE,CAAC;AAEZ,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAOvD,qBAA4B,KAAW;IACrC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7C,OAAO,CACL,MAAM,CAAC,OAAO;QACd,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAA,UAAU,CAAC;QACtC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CACnC,CAAC;AACJ,CAAC;AAGD,oBAA2B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): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.etagMatches = etagMatches;
|
|
4
|
+
function etagMatches(header, etag) {
|
|
5
|
+
return (Array.isArray(header) ? header : [header ?? ""])
|
|
6
|
+
.flatMap((value) => value.split(","))
|
|
7
|
+
.map((value) => value.trim().replace(/^W\//, ""))
|
|
8
|
+
.some((value) => value === "*" || value === etag);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=etag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"etag.js","sourceRoot":"","sources":["../../src/mockup/etag.ts"],"names":[],"mappings":";;;AAKA,qBACE,MAAqC,EACrC,IAAY;IAEZ,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;SACrD,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SAChD,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC;AACtD,CAAC"}
|