@antelopejs/dms 0.25.6 → 0.25.7-next.1111.gaba637e
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 -60
- package/README.md +1 -1
- package/data/mockup-spec.schema.json +223 -303
- package/dist/implementations/dms-auth/account-emails.js +2 -2
- package/dist/implementations/dms-auth/account-emails.js.map +1 -1
- package/dist/implementations/dms-auth/index.js +2 -1
- package/dist/implementations/dms-auth/index.js.map +1 -1
- package/dist/implementations/dms-base/search-route.js +5 -8
- package/dist/implementations/dms-base/search-route.js.map +1 -1
- package/dist/implementations/dms-builder/engine/cell-displays.js +1 -4
- package/dist/implementations/dms-builder/engine/cell-displays.js.map +1 -1
- package/dist/implementations/dms-builder/engine/mapped-displays.js +1 -5
- package/dist/implementations/dms-builder/engine/mapped-displays.js.map +1 -1
- package/dist/implementations/dms-builder/engine/resource-emit.js +0 -4
- package/dist/implementations/dms-builder/engine/resource-emit.js.map +1 -1
- package/dist/implementations/dms-builder/engine/theme-assets.js +17 -5
- package/dist/implementations/dms-builder/engine/theme-assets.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/mockup-export/capture.d.ts +15 -0
- package/dist/mcp/mockup-export/capture.js +97 -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 +23 -0
- package/dist/mcp/mockup-export/index.js +90 -0
- package/dist/mcp/mockup-export/index.js.map +1 -0
- package/dist/mcp/mockup-export/plan.d.ts +78 -0
- package/dist/mcp/mockup-export/plan.js +257 -0
- package/dist/mcp/mockup-export/plan.js.map +1 -0
- package/dist/mcp/mockup-export/route.d.ts +13 -0
- package/dist/mcp/mockup-export/route.js +66 -0
- package/dist/mcp/mockup-export/route.js.map +1 -0
- package/dist/mcp/page-verify/index.d.ts +14 -0
- package/dist/mcp/page-verify/index.js +9 -5
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/mockup.d.ts +2 -1
- package/dist/mcp/page-verify/mockup.js +1 -0
- package/dist/mcp/page-verify/mockup.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/tools/mockup-apply-to-page.js +1 -1
- package/dist/mcp/tools/mockup-apply-to-page.js.map +1 -1
- package/dist/mcp/tools/mockup-export-pdf.d.ts +1 -0
- package/dist/mcp/tools/mockup-export-pdf.js +71 -0
- package/dist/mcp/tools/mockup-export-pdf.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 +10 -3
- package/dist/mcp/tools/mockup-read-spec.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 +2 -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 +5 -1
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/dist/mockup/apply-notes.d.ts +1 -1
- package/dist/mockup/apply-notes.js +1 -2
- package/dist/mockup/apply-notes.js.map +1 -1
- package/dist/mockup/apply-plan.js +0 -3
- package/dist/mockup/apply-plan.js.map +1 -1
- package/dist/mockup/compile.d.ts +6 -1
- package/dist/mockup/compile.js +29 -25
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/controller-blocks.js +10 -62
- package/dist/mockup/controller-blocks.js.map +1 -1
- package/dist/mockup/database-manifest.d.ts +2 -0
- package/dist/mockup/database-manifest.js +75 -0
- package/dist/mockup/database-manifest.js.map +1 -0
- package/dist/mockup/display-values.js +1 -1
- package/dist/mockup/display-values.js.map +1 -1
- 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/files.d.ts +2 -2
- package/dist/mockup/files.js +2 -2
- package/dist/mockup/files.js.map +1 -1
- package/dist/mockup/fixture-answers.d.ts +1 -0
- package/dist/mockup/fixture-answers.js +1 -1
- package/dist/mockup/fixture-answers.js.map +1 -1
- package/dist/mockup/{capture-routes.d.ts → fixture-routes.d.ts} +11 -6
- package/dist/mockup/fixture-routes.js +155 -0
- package/dist/mockup/fixture-routes.js.map +1 -0
- package/dist/mockup/fixtures.d.ts +1 -3
- package/dist/mockup/fixtures.js +2 -25
- package/dist/mockup/fixtures.js.map +1 -1
- package/dist/mockup/form-fields.js +1 -10
- package/dist/mockup/form-fields.js.map +1 -1
- package/dist/mockup/generate.js +4 -1
- package/dist/mockup/generate.js.map +1 -1
- package/dist/mockup/history-routes.js +2 -17
- package/dist/mockup/history-routes.js.map +1 -1
- package/dist/mockup/index.d.ts +3 -0
- package/dist/mockup/index.js +3 -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.js +23 -24
- 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/manage.js +1 -1
- package/dist/mockup/manage.js.map +1 -1
- package/dist/mockup/manifest-blocks.d.ts +19 -0
- package/dist/mockup/manifest-blocks.js +65 -0
- package/dist/mockup/manifest-blocks.js.map +1 -0
- package/dist/mockup/model.d.ts +106 -255
- package/dist/mockup/model.js +86 -82
- package/dist/mockup/model.js.map +1 -1
- package/dist/mockup/module-manifests.d.ts +22 -0
- package/dist/mockup/module-manifests.js +28 -0
- package/dist/mockup/module-manifests.js.map +1 -0
- package/dist/mockup/modules-schema.d.ts +2 -0
- package/dist/mockup/modules-schema.js +42 -0
- package/dist/mockup/modules-schema.js.map +1 -0
- package/dist/mockup/modules.d.ts +20 -9
- package/dist/mockup/modules.js +146 -22
- package/dist/mockup/modules.js.map +1 -1
- package/dist/mockup/page-links.d.ts +1 -2
- package/dist/mockup/page-links.js +3 -14
- package/dist/mockup/page-links.js.map +1 -1
- package/dist/mockup/refusals.d.ts +4 -1
- package/dist/mockup/refusals.js +15 -1
- package/dist/mockup/refusals.js.map +1 -1
- package/dist/mockup/routes.d.ts +1 -5
- package/dist/mockup/routes.js +9 -171
- package/dist/mockup/routes.js.map +1 -1
- package/dist/mockup/saas-manifest.d.ts +2 -0
- package/dist/mockup/saas-manifest.js +496 -0
- package/dist/mockup/saas-manifest.js.map +1 -0
- package/dist/mockup/sample-rows.js +0 -4
- package/dist/mockup/sample-rows.js.map +1 -1
- package/dist/mockup/state.d.ts +76 -0
- package/dist/mockup/state.js +22 -0
- package/dist/mockup/state.js.map +1 -0
- package/dist/mockup/{summary-fields.js → store-summary.js} +1 -1
- package/dist/mockup/store-summary.js.map +1 -0
- package/dist/mockup/store.d.ts +1 -2
- package/dist/mockup/store.js +16 -22
- package/dist/mockup/store.js.map +1 -1
- package/dist/mockup/table-columns.js +3 -9
- package/dist/mockup/table-columns.js.map +1 -1
- package/dist/mockup/table-options.d.ts +1 -4
- package/dist/mockup/table-options.js +2 -40
- package/dist/mockup/table-options.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/validate.d.ts +1 -7
- package/dist/mockup/validate.js +3 -76
- package/dist/mockup/validate.js.map +1 -1
- package/dist/pages/account.d.ts +0 -1
- package/dist/pages/account.js +0 -1
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/settings/overview/account-summary.d.ts +0 -2
- package/dist/pages/settings/overview/account-summary.js +8 -17
- package/dist/pages/settings/overview/account-summary.js.map +1 -1
- package/dist/pages/settings/settings-index.js +1 -2
- package/dist/pages/settings/settings-index.js.map +1 -1
- package/dist/realtime/sse.js +4 -2
- package/dist/realtime/sse.js.map +1 -1
- package/dist/store/internal/frontend/dev-reload.js +1 -7
- package/dist/store/internal/frontend/dev-reload.js.map +1 -1
- package/dist/utils/account-notifications.js +0 -1
- package/dist/utils/account-notifications.js.map +1 -1
- package/dist/utils/email-change-mail.js +2 -2
- package/dist/utils/email-change-mail.js.map +1 -1
- package/dist/utils/export-jobs.js +2 -2
- package/dist/utils/export-jobs.js.map +1 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/validation/index.d.ts +0 -1
- package/dist/validation/index.js +0 -1
- package/dist/validation/index.js.map +1 -1
- package/frontend-vue/eslint-globals.generated.mjs +2 -2
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/2fa.vue +0 -3
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +0 -3
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot-validation.vue +0 -3
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +0 -3
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +1 -4
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +0 -3
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +1 -17
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/validate.vue +0 -3
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-fr-FR.json +10 -10
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +0 -8
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +2 -3
- package/frontend-vue/layers/dms-core/app/composables/translation/useUniqueLocales.ts +5 -23
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +0 -1
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +443 -12
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +0 -8
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +0 -8
- package/frontend-vue/layers/dms-core/shared/types/app-config.ts +0 -2
- package/frontend-vue/layers/dms-layout/app/app.config.ts +0 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardHeader.vue +4 -7
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +29 -14
- package/frontend-vue/layers/dms-layout/app/build/components/layout/LayoutFooter.vue +0 -2
- package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +21 -6
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PreviewPageHeader.vue +3 -19
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +110 -9
- package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +2 -8
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationInboxItem.vue +9 -6
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixCategory.vue +2 -6
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixSubject.vue +22 -27
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationPreferencesForm.vue +10 -8
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/notificationDisplay.ts +3 -39
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +5 -38
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useProfilePreferences.ts +3 -1
- package/frontend-vue/layers/dms-layout/app/build/utils/dev-reload-stream.ts +4 -23
- package/frontend-vue/layers/dms-layout/app/custom-layouts/EmptyLayout.vue +31 -39
- package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +9 -60
- package/frontend-vue/layers/dms-layout/app/error.vue +1 -1
- package/frontend-vue/layers/dms-layout/app/middleware/module-routing.global.ts +1 -7
- package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +1 -14
- package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +0 -13
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-en-GB.json +1 -1
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-fr-FR.json +5 -5
- package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +0 -3
- package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +1 -3
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +165 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupHeaderActions.vue +4 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIssues.vue +1 -22
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +11 -6
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +182 -125
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +12 -114
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinLayer.vue +4 -10
- 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/MockupTopBar.vue +76 -8
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +65 -9
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +142 -0
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/ExpandedRowDetail.vue +6 -26
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +8 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +6 -46
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +175 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +35 -109
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +18 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +76 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +1 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +63 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +1 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +6 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +13 -68
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewLinks.ts +7 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/fetchedConfirmDialog.ts +0 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDisplayComponents.ts +0 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +0 -38
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/registerFieldTypes.ts +3 -69
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +7 -20
- package/frontend-vue/layers/dms-ui/app/build/composables/form/keyValueRows.ts +0 -36
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +0 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +5 -21
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewSorting.ts +0 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +4 -32
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +2 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +6 -68
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +0 -5
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCard.vue +48 -73
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +11 -18
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupThumbnail.vue +125 -34
- package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +3 -7
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +149 -84
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +119 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +72 -43
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +80 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +92 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +1 -35
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +17 -44
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +177 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +14 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +14 -26
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +151 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +23 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +6 -56
- package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +3 -0
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +7 -7
- package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +7 -4
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputPhone.vue +0 -5
- package/frontend-vue/layers/dms-ui/app/components/form/components/KeyValue.vue +20 -2
- package/frontend-vue/layers/dms-ui/app/components/key-value-list/KeyValueList.vue +15 -51
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/config.ts +0 -10
- 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/useMockupPdfExport.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/utils/blockPreview.ts +0 -3
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.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/types/table/query.ts +0 -5
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +28 -2
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +38 -12
- package/frontend-vue/scripts/check-invariants.mjs +0 -101
- package/package.json +5 -5
- package/skills/dms/SKILL.md +2 -4
- package/skills/dms-module/SKILL.md +0 -3
- package/dist/implementations/dms-base/group-order.d.ts +0 -18
- package/dist/implementations/dms-base/group-order.js +0 -66
- package/dist/implementations/dms-base/group-order.js.map +0 -1
- package/dist/mockup/capture-routes.js +0 -101
- package/dist/mockup/capture-routes.js.map +0 -1
- package/dist/mockup/capture.d.ts +0 -10
- package/dist/mockup/capture.js +0 -64
- package/dist/mockup/capture.js.map +0 -1
- package/dist/mockup/header-action.d.ts +0 -47
- package/dist/mockup/header-action.js +0 -46
- package/dist/mockup/header-action.js.map +0 -1
- package/dist/mockup/json-schema-header.d.ts +0 -2
- package/dist/mockup/json-schema-header.js +0 -69
- package/dist/mockup/json-schema-header.js.map +0 -1
- package/dist/mockup/json-schema-layout.d.ts +0 -2
- package/dist/mockup/json-schema-layout.js +0 -61
- package/dist/mockup/json-schema-layout.js.map +0 -1
- package/dist/mockup/summary-fields.js.map +0 -1
- package/dist/mockup/table-param-filters.d.ts +0 -52
- package/dist/mockup/table-param-filters.js +0 -83
- package/dist/mockup/table-param-filters.js.map +0 -1
- package/dist/mockup/table-row-actions.d.ts +0 -2
- package/dist/mockup/table-row-actions.js +0 -85
- package/dist/mockup/table-row-actions.js.map +0 -1
- package/dist/mockup/unknown-keys.d.ts +0 -3
- package/dist/mockup/unknown-keys.js +0 -45
- package/dist/mockup/unknown-keys.js.map +0 -1
- package/dist/utils/email-plain-text.d.ts +0 -1
- package/dist/utils/email-plain-text.js +0 -95
- package/dist/utils/email-plain-text.js.map +0 -1
- package/dist/utils/html-email.d.ts +0 -8
- package/dist/utils/html-email.js +0 -9
- package/dist/utils/html-email.js.map +0 -1
- package/dist/utils/image-signatures.d.ts +0 -3
- package/dist/utils/image-signatures.js +0 -22
- package/dist/utils/image-signatures.js.map +0 -1
- package/dist/utils/sse-keepalive/index.d.ts +0 -3
- package/dist/utils/sse-keepalive/index.js +0 -8
- package/dist/utils/sse-keepalive/index.js.map +0 -1
- package/dist/validation/allowed-keys.d.ts +0 -2
- package/dist/validation/allowed-keys.js +0 -16
- package/dist/validation/allowed-keys.js.map +0 -1
- package/frontend-vue/layers/dms-core/app/build/composables/field-errors.ts +0 -485
- package/frontend-vue/layers/dms-core/app/build/composables/useHydrated.ts +0 -27
- package/frontend-vue/layers/dms-core/app/entries/composables/useHydrated.ts +0 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/EmptyLayoutBrand.vue +0 -49
- package/frontend-vue/layers/dms-layout/app/entries/components/pages/settings/shell/SettingsShell.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewArrows.vue +0 -110
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewFrameImage.vue +0 -75
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewZoom.vue +0 -67
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +0 -247
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCaptureAssets.ts +0 -181
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewRaster.ts +0 -45
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +0 -136
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewCapture.ts +0 -96
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +0 -10
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +0 -61
- package/frontend-vue/layers/dms-ui/app/build/utils/dotGrid.ts +0 -37
- package/frontend-vue/layers/dms-ui/app/build/utils/legalIdentifier.ts +0 -279
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +0 -130
- package/frontend-vue/layers/dms-ui/app/build/utils/previewHeader.ts +0 -154
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +0 -149
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +0 -42
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputIdentifier.vue +0 -90
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/previewCapture.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/previewCaptureAssets.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePreviewFrame.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/table-view/utils/displayOptions.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/mockups/manage.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/legalIdentifier.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupCaptures.ts +0 -1
- /package/dist/mockup/{summary-fields.d.ts → store-summary.d.ts} +0 -0
|
@@ -1,13 +1,444 @@
|
|
|
1
1
|
import { nextTick, reactive } from "vue";
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
fieldErrorMessage,
|
|
6
|
-
resolveFieldErrors,
|
|
7
|
-
type FieldErrorCode,
|
|
8
|
-
} from "../build/composables/field-errors";
|
|
2
|
+
import type { I18nTranslate } from "./translation/useTranslation";
|
|
3
|
+
import { resolveApiErrorMessage } from "./resolveApiError";
|
|
4
|
+
import { isBoolean, isNumber, isObject, isString } from "../utils/type-check";
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
/** An API error tied to one field, before translation. */
|
|
7
|
+
export interface ApiFieldError {
|
|
8
|
+
/** Id of the field, as the form names it (the request body key). */
|
|
9
|
+
field: string;
|
|
10
|
+
/** Server translation key, resolved by the API error presenter. */
|
|
11
|
+
message: string;
|
|
12
|
+
/** Caller key used only when the server's message is not translated. */
|
|
13
|
+
fallbackKey?: string;
|
|
14
|
+
/** The values of the field the error names (addresses of a list…). */
|
|
15
|
+
values?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Values filling the placeholders of the translated message: a body
|
|
18
|
+
* `{ field: "budget", message: "$page.error.budget_max", params: { max: 5000 } }`
|
|
19
|
+
* shows "At most 5000" for a translation `"At most {max}"`.
|
|
20
|
+
*/
|
|
21
|
+
params?: ApiFieldErrorParams;
|
|
22
|
+
/**
|
|
23
|
+
* The part of the field the error names, as a dotted path from the field
|
|
24
|
+
* (`address.streetName`, `title.fr`); absent when it names the field.
|
|
25
|
+
*/
|
|
26
|
+
path?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Placeholder values of a field error's message. */
|
|
30
|
+
export type ApiFieldErrorParams = Record<string, string | number | boolean>;
|
|
31
|
+
|
|
32
|
+
/** A code the API answers with that belongs to a field. */
|
|
33
|
+
export type FieldErrorCode<F extends string = string> =
|
|
34
|
+
| F
|
|
35
|
+
| {
|
|
36
|
+
field: F;
|
|
37
|
+
/** Shown instead of the code's own text. */
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export interface ResolveFieldErrorsOptions<F extends string = string> {
|
|
42
|
+
/**
|
|
43
|
+
* The fields of the form. An error naming another field (or none) is not
|
|
44
|
+
* one the form can show: it stays a toast.
|
|
45
|
+
*/
|
|
46
|
+
fields: readonly F[];
|
|
47
|
+
/** API error codes (`error.xxx`, `$page.…`) that belong to a field. */
|
|
48
|
+
codes?: Readonly<Record<string, FieldErrorCode<NoInfer<F>>>>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface FieldErrorResolution {
|
|
52
|
+
/** Errors to show under their field. */
|
|
53
|
+
fields: ApiFieldError[];
|
|
54
|
+
/**
|
|
55
|
+
* The error also carries something no field of the form can show (a
|
|
56
|
+
* validation issue on an unknown key): a toast tells about it.
|
|
57
|
+
*/
|
|
58
|
+
hasUnmatched: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface FetchErrorLike {
|
|
62
|
+
statusCode?: number;
|
|
63
|
+
status?: number;
|
|
64
|
+
response?: { status?: number };
|
|
65
|
+
data?: unknown;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface FieldErrorBody {
|
|
69
|
+
field?: unknown;
|
|
70
|
+
message?: unknown;
|
|
71
|
+
values?: unknown;
|
|
72
|
+
params?: unknown;
|
|
73
|
+
code?: unknown;
|
|
74
|
+
fields?: unknown;
|
|
75
|
+
issues?: unknown;
|
|
76
|
+
errors?: unknown;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** A zod issue, as the API serializes it or as zod hands it to an error map. */
|
|
80
|
+
export interface ValidationIssue {
|
|
81
|
+
path?: unknown;
|
|
82
|
+
message?: unknown;
|
|
83
|
+
code?: unknown;
|
|
84
|
+
format?: unknown;
|
|
85
|
+
minimum?: unknown;
|
|
86
|
+
origin?: unknown;
|
|
87
|
+
/** zod 3's `origin`, in an issue list a module still on zod 3 sends. */
|
|
88
|
+
type?: unknown;
|
|
89
|
+
/** zod 3's `format`, in an issue list a module still on zod 3 sends. */
|
|
90
|
+
validation?: unknown;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** What a size issue measured, as zod 4 (`origin`) or zod 3 (`type`) names it. */
|
|
94
|
+
function sizeOrigin(issue: ValidationIssue): string | undefined {
|
|
95
|
+
const origin = issue.origin ?? issue.type;
|
|
96
|
+
return origin === undefined ? undefined : String(origin);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const HTTP_BAD_REQUEST = 400;
|
|
100
|
+
const HTTP_CONFLICT = 409;
|
|
101
|
+
const HTTP_UNPROCESSABLE = 422;
|
|
102
|
+
const HTTP_FORBIDDEN = 403;
|
|
103
|
+
const HTTP_TOO_MANY_REQUESTS = 429;
|
|
104
|
+
const HTTP_CLIENT_ERROR_MIN = 400;
|
|
105
|
+
const HTTP_CLIENT_ERROR_MAX = 499;
|
|
106
|
+
|
|
107
|
+
/** Statuses whose body may name the field it refuses. */
|
|
108
|
+
const VALIDATION_STATUSES = new Set([
|
|
109
|
+
HTTP_BAD_REQUEST,
|
|
110
|
+
HTTP_CONFLICT,
|
|
111
|
+
HTTP_UNPROCESSABLE,
|
|
112
|
+
]);
|
|
113
|
+
|
|
114
|
+
/** Never about a field, whatever the body says. */
|
|
115
|
+
const GLOBAL_STATUSES = new Set([HTTP_FORBIDDEN, HTTP_TOO_MANY_REQUESTS]);
|
|
116
|
+
|
|
117
|
+
const FIELD_ERROR_KEYS = {
|
|
118
|
+
required: "$dms.field_errors.required",
|
|
119
|
+
invalid: "$dms.field_errors.invalid",
|
|
120
|
+
invalidEmail: "$dms.field_errors.invalid_email",
|
|
121
|
+
tooLong: "$dms.field_errors.too_long",
|
|
122
|
+
tooShort: "$dms.field_errors.too_short",
|
|
123
|
+
tooSmall: "$dms.field_errors.too_small",
|
|
124
|
+
tooLarge: "$dms.field_errors.too_large",
|
|
125
|
+
} as const;
|
|
126
|
+
|
|
127
|
+
/** Issue origins whose size is a count (characters, items), not a value. */
|
|
128
|
+
const COUNTED_ORIGINS = new Set(["string", "array", "set"]);
|
|
129
|
+
|
|
130
|
+
const DATA_API_CODES: Readonly<
|
|
131
|
+
Record<ReturnType<typeof resolveApiErrorMessage>, ApiFieldError["message"]>
|
|
132
|
+
> = {
|
|
133
|
+
missing_mandatory_fields: FIELD_ERROR_KEYS.required,
|
|
134
|
+
invalid_field_types: FIELD_ERROR_KEYS.invalid,
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const NAMED_FIELD_ERROR_KEYS: Readonly<
|
|
138
|
+
Record<ApiFieldError["message"], Parameters<I18nTranslate>[0]>
|
|
139
|
+
> = {
|
|
140
|
+
[FIELD_ERROR_KEYS.required]: "dms.field_errors.named_required",
|
|
141
|
+
[FIELD_ERROR_KEYS.invalid]: "dms.field_errors.named_invalid",
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const FIELD_PREFIXED_MESSAGE = /^([\w.]+):\s+(\S.*|\s)$/s;
|
|
145
|
+
|
|
146
|
+
const BARE_I18N_KEY = /^\w+(?:\.\w+)+$/;
|
|
147
|
+
|
|
148
|
+
/** The HTTP status of a fetch error; undefined for a network failure. */
|
|
149
|
+
export function apiErrorStatus(
|
|
150
|
+
error: Parameters<typeof resolveApiErrorMessage>[0],
|
|
151
|
+
): number | undefined {
|
|
152
|
+
if (!isObject(error) || error === null) return undefined;
|
|
153
|
+
const { statusCode, status, response }: FetchErrorLike = error;
|
|
154
|
+
return statusCode ?? status ?? response?.status;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The error body, parsed when the server sent JSON as plain text. */
|
|
158
|
+
function bodyOf(
|
|
159
|
+
error: Parameters<typeof resolveApiErrorMessage>[0],
|
|
160
|
+
): FetchErrorLike["data"] {
|
|
161
|
+
if (!isObject(error) || error === null) return undefined;
|
|
162
|
+
const { data } = error;
|
|
163
|
+
if (!isString(data)) return data;
|
|
164
|
+
const text = data.trim();
|
|
165
|
+
if (!text.startsWith("[") && !text.startsWith("{")) return data;
|
|
166
|
+
try {
|
|
167
|
+
return JSON.parse(text);
|
|
168
|
+
} catch {
|
|
169
|
+
return data;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Whether a message is an i18n key rather than (English) prose. */
|
|
174
|
+
function isI18nKey(message: string): boolean {
|
|
175
|
+
return message.startsWith("$") || BARE_I18N_KEY.test(message);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** A zod issue's own message when it is a key, else a generic one. */
|
|
179
|
+
function tooSmallMessage(issue: ValidationIssue): string {
|
|
180
|
+
const origin = sizeOrigin(issue);
|
|
181
|
+
if (origin !== undefined && !COUNTED_ORIGINS.has(origin)) {
|
|
182
|
+
return FIELD_ERROR_KEYS.tooSmall;
|
|
183
|
+
}
|
|
184
|
+
return isNumber(issue.minimum) && issue.minimum <= 1
|
|
185
|
+
? FIELD_ERROR_KEYS.required
|
|
186
|
+
: FIELD_ERROR_KEYS.tooShort;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The message of a zod issue: its own when it is an i18n key, else a generic
|
|
191
|
+
* `$dms.field_errors.*` key by issue code (zod words its own in English).
|
|
192
|
+
*/
|
|
193
|
+
export function validationIssueMessage(issue: ValidationIssue): string {
|
|
194
|
+
if (isString(issue.message) && isI18nKey(issue.message)) {
|
|
195
|
+
return issue.message;
|
|
196
|
+
}
|
|
197
|
+
switch (issue.code) {
|
|
198
|
+
case "too_small":
|
|
199
|
+
return tooSmallMessage(issue);
|
|
200
|
+
case "too_big": {
|
|
201
|
+
const origin = sizeOrigin(issue);
|
|
202
|
+
return origin !== undefined && !COUNTED_ORIGINS.has(origin)
|
|
203
|
+
? FIELD_ERROR_KEYS.tooLarge
|
|
204
|
+
: FIELD_ERROR_KEYS.tooLong;
|
|
205
|
+
}
|
|
206
|
+
case "invalid_format":
|
|
207
|
+
case "invalid_string":
|
|
208
|
+
return (issue.format ?? issue.validation) === "email"
|
|
209
|
+
? FIELD_ERROR_KEYS.invalidEmail
|
|
210
|
+
: FIELD_ERROR_KEYS.invalid;
|
|
211
|
+
default:
|
|
212
|
+
return FIELD_ERROR_KEYS.invalid;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
type PathedIssue = ValidationIssue & { path: unknown[] };
|
|
217
|
+
|
|
218
|
+
function isIssueList(
|
|
219
|
+
body: ReturnType<typeof bodyOf>,
|
|
220
|
+
): body is [PathedIssue, ...PathedIssue[]] {
|
|
221
|
+
return (
|
|
222
|
+
Array.isArray(body) &&
|
|
223
|
+
body.length > 0 &&
|
|
224
|
+
body.every(
|
|
225
|
+
(issue) => isObject(issue) && issue !== null && Array.isArray(issue.path),
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** `field.part.0` for a path reaching into a field, else undefined. */
|
|
231
|
+
function partPath(path: readonly unknown[]): string | undefined {
|
|
232
|
+
if (path.length < 2) return undefined;
|
|
233
|
+
return path.every((step) => isString(step) || isNumber(step))
|
|
234
|
+
? path.join(".")
|
|
235
|
+
: undefined;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function fromIssues(issues: PathedIssue[]): ApiFieldError[] {
|
|
239
|
+
return issues.map((issue) => {
|
|
240
|
+
const path = issue.path;
|
|
241
|
+
const [field] = path;
|
|
242
|
+
const part = partPath(path);
|
|
243
|
+
return {
|
|
244
|
+
field: isString(field) ? field : "",
|
|
245
|
+
message: validationIssueMessage(issue),
|
|
246
|
+
...(part && { path: part }),
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The placeholder values of a body, keeping only the plain ones. */
|
|
252
|
+
function paramsOf(
|
|
253
|
+
params: FieldErrorBody["params"],
|
|
254
|
+
): ApiFieldErrorParams | undefined {
|
|
255
|
+
if (!isObject(params) || params === null || Array.isArray(params)) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
const entries = Object.entries(params).filter(
|
|
259
|
+
(entry): entry is [string, ApiFieldErrorParams[string]] =>
|
|
260
|
+
isString(entry[1]) || isNumber(entry[1]) || isBoolean(entry[1]),
|
|
261
|
+
);
|
|
262
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** `{ field, message, values?, params? }`, the shape the DMS answers with. */
|
|
266
|
+
function fromFieldObject(body: FieldErrorBody): ApiFieldError[] {
|
|
267
|
+
const { field, message, values, params } = body;
|
|
268
|
+
if (!isString(field) || !isString(message)) return [];
|
|
269
|
+
const placeholders = paramsOf(params);
|
|
270
|
+
return [
|
|
271
|
+
{
|
|
272
|
+
field,
|
|
273
|
+
message,
|
|
274
|
+
values: Array.isArray(values) ? values.filter(isString) : undefined,
|
|
275
|
+
...(placeholders && { params: placeholders }),
|
|
276
|
+
},
|
|
277
|
+
];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** `{ code, fields }`, the data API's refusal of a body; undefined otherwise. */
|
|
281
|
+
function fromCodedFields(body: FieldErrorBody): ApiFieldError[] | undefined {
|
|
282
|
+
const { code, fields } = body;
|
|
283
|
+
const message = isString(code) ? DATA_API_CODES[code] : undefined;
|
|
284
|
+
if (!message || !Array.isArray(fields)) return undefined;
|
|
285
|
+
return fields.filter(isString).map((field) => ({ field, message }));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function fromText(text: string): ApiFieldError[] {
|
|
289
|
+
const prefixed = FIELD_PREFIXED_MESSAGE.exec(text);
|
|
290
|
+
if (prefixed) {
|
|
291
|
+
const [, field = "", message = ""] = prefixed;
|
|
292
|
+
const path = field.split(".");
|
|
293
|
+
const part = partPath(path);
|
|
294
|
+
return [
|
|
295
|
+
{
|
|
296
|
+
field: path[0] ?? field,
|
|
297
|
+
message: isI18nKey(message) ? message : FIELD_ERROR_KEYS.invalid,
|
|
298
|
+
...(part && { path: part }),
|
|
299
|
+
},
|
|
300
|
+
];
|
|
301
|
+
}
|
|
302
|
+
return [];
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** The text code of an error body: the body itself or its `message`. */
|
|
306
|
+
function codeOf(body: ReturnType<typeof bodyOf>): string | undefined {
|
|
307
|
+
if (isString(body)) return body;
|
|
308
|
+
if (isObject(body) && body !== null && !Array.isArray(body)) {
|
|
309
|
+
const { message } = body;
|
|
310
|
+
return isString(message) ? message : undefined;
|
|
311
|
+
}
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function lookupCode<F extends string>(
|
|
316
|
+
code: string | undefined,
|
|
317
|
+
codes: Readonly<Record<string, FieldErrorCode<F>>> | undefined,
|
|
318
|
+
): ApiFieldError | undefined {
|
|
319
|
+
if (!code || !codes) return undefined;
|
|
320
|
+
const bare = code.startsWith("$") ? code.slice(1) : code;
|
|
321
|
+
const own = (key: string) =>
|
|
322
|
+
Object.hasOwn(codes, key) ? codes[key] : undefined;
|
|
323
|
+
const entry = own(code) ?? own(bare) ?? own(`$${bare}`);
|
|
324
|
+
if (!entry) return undefined;
|
|
325
|
+
return isString(entry)
|
|
326
|
+
? { field: entry, message: code }
|
|
327
|
+
: { field: entry.field, message: code, fallbackKey: entry.message };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function fromBody(body: ReturnType<typeof bodyOf>): ApiFieldError[] {
|
|
331
|
+
if (isIssueList(body)) return fromIssues(body);
|
|
332
|
+
if (isString(body)) return fromText(body);
|
|
333
|
+
if (!isObject(body) || body === null) return [];
|
|
334
|
+
const record: FieldErrorBody = body;
|
|
335
|
+
if (isIssueList(record.issues)) return fromIssues(record.issues);
|
|
336
|
+
if (isIssueList(record.errors)) return fromIssues(record.errors);
|
|
337
|
+
return fromCodedFields(record) ?? fromFieldObject(record);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function isClientError(status: number | undefined): status is number {
|
|
341
|
+
return (
|
|
342
|
+
status !== undefined &&
|
|
343
|
+
status >= HTTP_CLIENT_ERROR_MIN &&
|
|
344
|
+
status <= HTTP_CLIENT_ERROR_MAX &&
|
|
345
|
+
!GLOBAL_STATUSES.has(status)
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Splits what a request threw into the errors its form shows under fields.
|
|
351
|
+
*
|
|
352
|
+
* Read, in order: a code the form maps to a field (`codes`, for any 4xx), a
|
|
353
|
+
* zod issue list (what `assertValidation` answers), a `{ field, message }`
|
|
354
|
+
* body (with optional `values` and `params`), the data API's
|
|
355
|
+
* `{ code, fields }` and a `field: message` text. A network failure, a 403, a 429
|
|
356
|
+
* or a 5xx never resolves to a field.
|
|
357
|
+
*
|
|
358
|
+
* @returns The field errors, one per field (the first issue wins), and
|
|
359
|
+
* whether part of the error belongs to no field of the form
|
|
360
|
+
*/
|
|
361
|
+
export function resolveFieldErrors<F extends string>(
|
|
362
|
+
error: Parameters<typeof resolveApiErrorMessage>[0],
|
|
363
|
+
options: ResolveFieldErrorsOptions<F>,
|
|
364
|
+
): FieldErrorResolution {
|
|
365
|
+
const status = apiErrorStatus(error);
|
|
366
|
+
if (!isClientError(status)) return { fields: [], hasUnmatched: true };
|
|
367
|
+
const body = bodyOf(error);
|
|
368
|
+
const mapped = lookupCode(codeOf(body), options.codes);
|
|
369
|
+
const candidates = mapped
|
|
370
|
+
? [mapped]
|
|
371
|
+
: VALIDATION_STATUSES.has(status)
|
|
372
|
+
? fromBody(body)
|
|
373
|
+
: [];
|
|
374
|
+
const known = new Set<string>(options.fields);
|
|
375
|
+
const fields: ApiFieldError[] = [];
|
|
376
|
+
let hasUnmatched = candidates.length === 0;
|
|
377
|
+
for (const candidate of candidates) {
|
|
378
|
+
if (!known.has(candidate.field)) {
|
|
379
|
+
hasUnmatched = true;
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
if (fields.some((entry) => entry.field === candidate.field)) continue;
|
|
383
|
+
fields.push(candidate);
|
|
384
|
+
}
|
|
385
|
+
return { fields, hasUnmatched: hasUnmatched || fields.length === 0 };
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* The data API's refusal of a body (`{ code, fields }`) as one sentence per
|
|
390
|
+
* field naming it, translated: "Loss reason is required." Undefined for any
|
|
391
|
+
* other error. `labelOf` gives a field's label, translated; the field's id
|
|
392
|
+
* stands in for one it does not know.
|
|
393
|
+
*/
|
|
394
|
+
export function describeFieldErrors(
|
|
395
|
+
error: Parameters<typeof resolveApiErrorMessage>[0],
|
|
396
|
+
translate: I18nTranslate,
|
|
397
|
+
labelOf: (field: string) => string | undefined,
|
|
398
|
+
): string | undefined {
|
|
399
|
+
const status = apiErrorStatus(error);
|
|
400
|
+
if (status === undefined || !VALIDATION_STATUSES.has(status)) {
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|
|
403
|
+
const body = bodyOf(error);
|
|
404
|
+
if (!isObject(body) || body === null || Array.isArray(body)) {
|
|
405
|
+
return undefined;
|
|
406
|
+
}
|
|
407
|
+
const entries = fromCodedFields(body);
|
|
408
|
+
if (!entries?.length) return undefined;
|
|
409
|
+
return entries
|
|
410
|
+
.map(({ field, message }) =>
|
|
411
|
+
translate(NAMED_FIELD_ERROR_KEYS[message] ?? message, {
|
|
412
|
+
field: labelOf(field) ?? field,
|
|
413
|
+
}),
|
|
414
|
+
)
|
|
415
|
+
.join(" ");
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* The message of an error that belongs to no field, for its toast: the API's
|
|
420
|
+
* message key, the first validation issue's (or a generic one), else the
|
|
421
|
+
* generic server error.
|
|
422
|
+
*/
|
|
423
|
+
export function describeApiError(
|
|
424
|
+
error: Parameters<typeof resolveApiErrorMessage>[0],
|
|
425
|
+
): string {
|
|
426
|
+
return apiErrorText(error) ?? resolveApiErrorMessage(error);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* The message an error body carries (its text, its `message`, or its first
|
|
431
|
+
* validation issue's), or `undefined` when it carries none (a network
|
|
432
|
+
* failure).
|
|
433
|
+
*/
|
|
434
|
+
export function apiErrorText(
|
|
435
|
+
error: Parameters<typeof resolveApiErrorMessage>[0],
|
|
436
|
+
): string | undefined {
|
|
437
|
+
const body = bodyOf(error);
|
|
438
|
+
if (isIssueList(body)) return validationIssueMessage(body[0]);
|
|
439
|
+
const text = codeOf(body);
|
|
440
|
+
return text || undefined;
|
|
441
|
+
}
|
|
11
442
|
|
|
12
443
|
/** Id of the element holding a field's inline error. */
|
|
13
444
|
export function fieldErrorId(controlId: string): string {
|
|
@@ -124,10 +555,10 @@ export function useFieldErrors<F extends string>(
|
|
|
124
555
|
clear();
|
|
125
556
|
for (const entry of fields) {
|
|
126
557
|
if (!isField(entry.field)) continue;
|
|
127
|
-
errors[entry.field] =
|
|
128
|
-
entry,
|
|
129
|
-
|
|
130
|
-
);
|
|
558
|
+
errors[entry.field] = errorPresenter.resolveError(entry.message, {
|
|
559
|
+
fallbackKey: entry.fallbackKey ?? "dms.field_errors.invalid",
|
|
560
|
+
params: entry.params,
|
|
561
|
+
})?.message;
|
|
131
562
|
}
|
|
132
563
|
if (isField(first.field)) await focus(first.field);
|
|
133
564
|
return !hasUnmatched;
|
|
@@ -412,10 +412,6 @@
|
|
|
412
412
|
"invalid": "This value isn’t valid.",
|
|
413
413
|
"invalid_email": "Enter a valid email address.",
|
|
414
414
|
"invalid_phone": "Enter a valid phone number, with its country.",
|
|
415
|
-
"invalid_iban": "Enter a valid IBAN, and check it for a typo.",
|
|
416
|
-
"invalid_bic": "Enter a valid BIC, 8 or 11 letters and digits.",
|
|
417
|
-
"invalid_vat_number": "Enter a valid VAT number, starting with its country code.",
|
|
418
|
-
"invalid_company_number": "Enter a valid company registration number.",
|
|
419
415
|
"too_long": "This value is too long.",
|
|
420
416
|
"too_short": "This value is too short.",
|
|
421
417
|
"too_small": "This value is too small.",
|
|
@@ -709,10 +705,6 @@
|
|
|
709
705
|
"row_not_found": "Row not found",
|
|
710
706
|
"route_not_found": "Route not found",
|
|
711
707
|
"lock_not_found": "Lock not found",
|
|
712
|
-
"capture_not_found": "This mockup has no captured image",
|
|
713
|
-
"capture_not_image": "The body is not a WebP or PNG image",
|
|
714
|
-
"capture_not_first_page": "The image is not of the first page of the mockup",
|
|
715
|
-
"capture_page_missing": "Give the page the image shows in the page query",
|
|
716
708
|
"spec_not_object": "spec.json holds no JSON object",
|
|
717
709
|
"spec_changed": "spec.json changed since it was read",
|
|
718
710
|
"lock_spec_changed": "spec.json changed since it was read, so the pointer may name another block: read it again and retake the lock",
|
|
@@ -412,10 +412,6 @@
|
|
|
412
412
|
"invalid": "Cette valeur n’est pas valide.",
|
|
413
413
|
"invalid_email": "Saisissez une adresse e-mail valide.",
|
|
414
414
|
"invalid_phone": "Saisissez un numéro de téléphone valide, avec son pays.",
|
|
415
|
-
"invalid_iban": "Saisissez un IBAN valide, sans faute de frappe.",
|
|
416
|
-
"invalid_bic": "Saisissez un BIC valide, de 8 ou 11 lettres et chiffres.",
|
|
417
|
-
"invalid_vat_number": "Saisissez un numéro de TVA valide, précédé du code de son pays.",
|
|
418
|
-
"invalid_company_number": "Saisissez un numéro d’entreprise valide.",
|
|
419
415
|
"too_long": "Cette valeur est trop longue.",
|
|
420
416
|
"too_short": "Cette valeur est trop courte.",
|
|
421
417
|
"too_small": "Cette valeur est trop petite.",
|
|
@@ -709,10 +705,6 @@
|
|
|
709
705
|
"row_not_found": "Ligne introuvable",
|
|
710
706
|
"route_not_found": "Route introuvable",
|
|
711
707
|
"lock_not_found": "Verrou introuvable",
|
|
712
|
-
"capture_not_found": "Cette maquette n'a aucune image capturée",
|
|
713
|
-
"capture_not_image": "Le corps n'est pas une image WebP ou PNG",
|
|
714
|
-
"capture_not_first_page": "L'image n'est pas celle de la première page de la maquette",
|
|
715
|
-
"capture_page_missing": "Indiquez la page que montre l'image dans le paramètre page",
|
|
716
708
|
"spec_not_object": "spec.json ne contient aucun objet JSON",
|
|
717
709
|
"spec_changed": "spec.json a changé depuis sa lecture",
|
|
718
710
|
"lock_spec_changed": "spec.json a changé depuis sa lecture, le pointeur peut donc désigner un autre bloc : relisez-le et reprenez le verrou",
|
|
@@ -14,7 +14,6 @@ import { usePageRecordLabel } from "#dms-core/app/composables/page/usePageRecord
|
|
|
14
14
|
import type { CategoryInfo } from "#dms-core/app/types/page";
|
|
15
15
|
import { resolveModuleLandingSlug } from "../../../utils/moduleLanding";
|
|
16
16
|
import {
|
|
17
|
-
crumbLabel,
|
|
18
17
|
foldBreadcrumb,
|
|
19
18
|
isFoldedCrumbs,
|
|
20
19
|
withParentCrumb,
|
|
@@ -182,12 +181,8 @@ const breadcrumb = computed((): BreadcrumbItem[] => {
|
|
|
182
181
|
const to = `/${paths.slice(0, index + 1).join("/")}`;
|
|
183
182
|
|
|
184
183
|
const matchingRoute = siteLayout.findMatchingRouteOrCategory(to);
|
|
185
|
-
const label = crumbLabel(
|
|
186
|
-
matchingRoute?.metadata.displayName,
|
|
187
|
-
processI18n,
|
|
188
|
-
);
|
|
189
184
|
|
|
190
|
-
if (!matchingRoute
|
|
185
|
+
if (!matchingRoute) {
|
|
191
186
|
return null;
|
|
192
187
|
}
|
|
193
188
|
|
|
@@ -200,7 +195,9 @@ const breadcrumb = computed((): BreadcrumbItem[] => {
|
|
|
200
195
|
route.query,
|
|
201
196
|
);
|
|
202
197
|
|
|
203
|
-
const crumb: BreadcrumbItem = {
|
|
198
|
+
const crumb: BreadcrumbItem = {
|
|
199
|
+
label: processI18n(matchingRoute.metadata?.displayName || path),
|
|
200
|
+
};
|
|
204
201
|
if (target) crumb.to = target;
|
|
205
202
|
return crumb;
|
|
206
203
|
})
|
|
@@ -15,16 +15,19 @@ import { useMediaQuery } from "@vueuse/core";
|
|
|
15
15
|
import DmsSidebarUserMenu from "./SidebarUserMenu.vue";
|
|
16
16
|
import MockupSidebarMenu from "./MockupSidebarMenu.vue";
|
|
17
17
|
import BlockPreviewSketch from "#dms-ui/app/entries/components/block-preview/BlockPreviewSketch";
|
|
18
|
+
import MockupWorkspaceSwitcher from "#dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher";
|
|
18
19
|
import { useInstalledModuleCount } from "../../../composables/page/useInstalledModules";
|
|
19
20
|
import type { PreviewNavigation } from "#dms-ui/app/entries/utils/blockPreview";
|
|
20
21
|
import { PREVIEW_NAVIGATION_ATTRIBUTE } from "#dms-ui/app/entries/composables/block-preview/previewNavigation";
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* The dashboard's sidebar: the brand, the sidebar widgets, the search, the
|
|
24
|
-
* menu and the account. Given a mockup's `navigation`,
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* menu and the account. Given a mockup's `navigation`, the app's own menu is
|
|
26
|
+
* drawn first and acts on nothing, then the mockup's menu: its sections and
|
|
27
|
+
* its modules, each a menu root with its sub-sections. The app's favorites
|
|
28
|
+
* stay out, and the mockup's widget sketches follow the app's widgets; in
|
|
29
|
+
* SaaS mode its workspace switcher takes the place of dms-saas's own;
|
|
30
|
+
* everything else is drawn as in the dashboard and acts on nothing. With `lockedCollapsed` it
|
|
28
31
|
* is the real sidebar fixed to its icon rail: no fold control, the size and
|
|
29
32
|
* the mobile menu ignored, and the dashboard's persisted collapsed state read
|
|
30
33
|
* and written by no one.
|
|
@@ -36,6 +39,9 @@ const props = defineProps<{
|
|
|
36
39
|
|
|
37
40
|
const MODULES_PATH = "/modules";
|
|
38
41
|
|
|
42
|
+
/** The sidebar widget of dms-saas a mockup in SaaS mode replaces with its own switcher. */
|
|
43
|
+
const SAAS_SWITCHER_WIDGET = "saas:workspace-switcher";
|
|
44
|
+
|
|
39
45
|
const MODULES_FULL_ID = "modules";
|
|
40
46
|
const MODULES_TREE_KEY = "modules";
|
|
41
47
|
const MODULES_ICON = "i-ph-squares-four-light";
|
|
@@ -140,8 +146,12 @@ const widgetsAtPosition = (position: SidebarWidgetPosition) =>
|
|
|
140
146
|
(widget) => resolveSidebarWidgetPosition(widget) === position,
|
|
141
147
|
),
|
|
142
148
|
);
|
|
143
|
-
const
|
|
144
|
-
|
|
149
|
+
const widgetsAtTop = widgetsAtPosition(SidebarWidgetPosition.ABOVE_SEARCH_BAR);
|
|
150
|
+
const widgetsAboveSearchBar = computed(() =>
|
|
151
|
+
widgetsAtTop.value.filter(
|
|
152
|
+
(widget) =>
|
|
153
|
+
!(props.navigation?.workspace && widget.id === SAAS_SWITCHER_WIDGET),
|
|
154
|
+
),
|
|
145
155
|
);
|
|
146
156
|
const widgetsBelowSearchBar = widgetsAtPosition(
|
|
147
157
|
SidebarWidgetPosition.BELOW_SEARCH_BAR,
|
|
@@ -250,7 +260,7 @@ const moduleCount = isMockup.value
|
|
|
250
260
|
? computed(() => 0)
|
|
251
261
|
: useInstalledModuleCount();
|
|
252
262
|
|
|
253
|
-
/** A mockup's sidebar
|
|
263
|
+
/** A mockup's sidebar draws the app's menu but not its favorites, which belong to the dashboard's user. */
|
|
254
264
|
const shownFavoriteItems = computed(() =>
|
|
255
265
|
isMockup.value ? [] : favoriteItems.value,
|
|
256
266
|
);
|
|
@@ -357,6 +367,11 @@ const footerGroups = computed((): NavigationMenuItem[][] =>
|
|
|
357
367
|
</template>
|
|
358
368
|
|
|
359
369
|
<template #default="{ collapsed: sidebarRail }">
|
|
370
|
+
<MockupWorkspaceSwitcher
|
|
371
|
+
v-if="navigation?.workspace"
|
|
372
|
+
:workspace="navigation.workspace"
|
|
373
|
+
:collapsed="isRail(sidebarRail)"
|
|
374
|
+
/>
|
|
360
375
|
<component
|
|
361
376
|
:is="widget.component"
|
|
362
377
|
v-for="widget in widgetsAboveSearchBar"
|
|
@@ -425,19 +440,19 @@ const footerGroups = computed((): NavigationMenuItem[][] =>
|
|
|
425
440
|
orientation="vertical"
|
|
426
441
|
/>
|
|
427
442
|
|
|
428
|
-
<MockupSidebarMenu
|
|
429
|
-
v-if="navigation"
|
|
430
|
-
v-model:open="openCategories"
|
|
431
|
-
:navigation="navigation"
|
|
432
|
-
:collapsed="isRail(sidebarRail)"
|
|
433
|
-
/>
|
|
434
443
|
<DmsNavigationMenu
|
|
435
|
-
v-else
|
|
436
444
|
v-model="openCategories"
|
|
445
|
+
v-bind="chromeAttrs"
|
|
437
446
|
:collapsed="isRail(sidebarRail)"
|
|
438
447
|
:items="items"
|
|
439
448
|
orientation="vertical"
|
|
440
449
|
/>
|
|
450
|
+
<MockupSidebarMenu
|
|
451
|
+
v-if="navigation"
|
|
452
|
+
v-model:open="openCategories"
|
|
453
|
+
:navigation="navigation"
|
|
454
|
+
:collapsed="isRail(sidebarRail)"
|
|
455
|
+
/>
|
|
441
456
|
</template>
|
|
442
457
|
|
|
443
458
|
<template #footer="{ collapsed: sidebarRail }">
|
|
@@ -17,7 +17,6 @@ const copyright = computed(() =>
|
|
|
17
17
|
? null
|
|
18
18
|
: processI18n(footer.value.copyright ?? DEFAULT_COPYRIGHT),
|
|
19
19
|
);
|
|
20
|
-
const showsGithubStar = computed(() => footer.value.githubStar !== false);
|
|
21
20
|
const showsLocaleSwitcher = computed(
|
|
22
21
|
() => footer.value.localeSwitcher !== false,
|
|
23
22
|
);
|
|
@@ -68,7 +67,6 @@ async function onLocaleChange(code: Parameters<typeof changeLanguage>[0]) {
|
|
|
68
67
|
</template>
|
|
69
68
|
|
|
70
69
|
<a
|
|
71
|
-
v-if="showsGithubStar"
|
|
72
70
|
:href="GITHUB_REPOSITORY_URL"
|
|
73
71
|
target="_blank"
|
|
74
72
|
rel="noopener noreferrer"
|