@antelopejs/dms 0.20.2 → 0.20.4
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 +49 -0
- package/README.md +1 -1
- package/dist/config/internal/state.d.ts +5 -3
- package/dist/config/internal/state.js +9 -1
- package/dist/config/internal/state.js.map +1 -1
- package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
- package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
- package/dist/implementations/dms-builder/engine/connection-targets.d.ts +2 -0
- package/dist/implementations/dms-builder/engine/connection-targets.js +276 -0
- package/dist/implementations/dms-builder/engine/connection-targets.js.map +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.js +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.js.map +1 -1
- package/dist/implementations/dms-builder/engine/driver-packages.js +16 -4
- package/dist/implementations/dms-builder/engine/driver-packages.js.map +1 -1
- package/dist/implementations/dms-builder/engine/index.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/index.js +1 -0
- package/dist/implementations/dms-builder/engine/index.js.map +1 -1
- package/dist/implementations/dms-builder/engine/theme-scaffold.js +1 -1
- package/dist/implementations/dms-html-render/index.js +5 -2
- package/dist/implementations/dms-html-render/index.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +1 -0
- package/dist/mcp/page-verify/index.js +1 -0
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/redact-report.d.ts +2 -0
- package/dist/mcp/page-verify/redact-report.js +120 -0
- package/dist/mcp/page-verify/redact-report.js.map +1 -0
- package/dist/mcp/page-verify/render.js +4 -1
- package/dist/mcp/page-verify/render.js.map +1 -1
- package/dist/mcp/redact.d.ts +87 -0
- package/dist/mcp/redact.js +139 -0
- package/dist/mcp/redact.js.map +1 -0
- package/dist/mcp/tools/builder-compose.js +11 -2
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-project.js +59 -26
- package/dist/mcp/tools/builder-project.js.map +1 -1
- package/dist/mcp/tools/builder-queries.js +41 -4
- package/dist/mcp/tools/builder-queries.js.map +1 -1
- package/dist/mcp/tools/builder-shared.d.ts +3 -1
- package/dist/mcp/tools/builder-shared.js +5 -0
- package/dist/mcp/tools/builder-shared.js.map +1 -1
- package/dist/mcp/tools/database.js +3 -2
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/page-verify.js +3 -2
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/frontend-vue/dms.frontend.ts +6 -2
- package/frontend-vue/eslint-globals.generated.mjs +259 -942
- package/frontend-vue/layers/dms-auth/app/build/composables/useAuthFormError.ts +5 -3
- package/frontend-vue/layers/dms-auth/app/composables/useOAuthErrorToast.ts +6 -4
- package/frontend-vue/layers/dms-auth/app/composables/usePostLoginRedirect.ts +3 -2
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +12 -4
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +12 -6
- package/frontend-vue/layers/dms-auth/app/middleware/auth.ts +4 -2
- package/frontend-vue/layers/dms-auth/server/oauth.ts +13 -7
- package/frontend-vue/layers/dms-auth/server/session.ts +37 -6
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
- package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
- package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
- package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
- package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
- package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
- package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
- package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
- package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
- package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
- package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
- package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
- package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
- package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
- package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
- package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
- package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
- package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
- package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
- package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
- package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
- package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
- package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
- package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
- package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
- package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
- package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
- package/frontend-vue/layers/dms-layout/app/build/branding/BrandingColorPair.vue +5 -2
- package/frontend-vue/layers/dms-layout/app/build/branding/device-draft.ts +2 -1
- package/frontend-vue/layers/dms-layout/app/build/branding/logos.ts +11 -13
- package/frontend-vue/layers/dms-layout/app/build/branding/model.ts +6 -2
- package/frontend-vue/layers/dms-layout/app/build/branding/preview-style.ts +12 -10
- package/frontend-vue/layers/dms-layout/app/build/branding/raster.ts +7 -4
- package/frontend-vue/layers/dms-layout/app/build/branding/useBrandingEditor.ts +59 -31
- package/frontend-vue/layers/dms-layout/app/build/branding/values.ts +2 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +1 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +37 -24
- package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +2 -4
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/profile/ProfileSummaryRow.vue +2 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecuritySessions.vue +35 -10
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/theme/CssVariablesList.vue +2 -2
- package/frontend-vue/layers/dms-layout/app/build/composables/dev-reload/useDevReloadHolder.ts +4 -4
- package/frontend-vue/layers/dms-layout/app/build/composables/navigation/useVisitNavBadges.ts +26 -4
- package/frontend-vue/layers/dms-layout/app/build/composables/security/useSessionHandoff.ts +3 -6
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useAccountData.ts +16 -12
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +12 -9
- package/frontend-vue/layers/dms-layout/app/build/mockup/header-action.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/build/utils/modules-catalog.ts +13 -6
- package/frontend-vue/layers/dms-layout/app/build/utils/notificationPayload.ts +81 -0
- package/frontend-vue/layers/dms-layout/app/build/utils/submittedUrl.ts +14 -0
- package/frontend-vue/layers/dms-layout/app/components/AppWidgetsDock.vue +3 -1
- package/frontend-vue/layers/dms-layout/app/composables/general/useSystemState.ts +4 -5
- package/frontend-vue/layers/dms-layout/app/composables/layout/useServedHeaderActions.ts +7 -5
- package/frontend-vue/layers/dms-layout/app/composables/notification/useNotifications.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +1 -1
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStore.ts +3 -3
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStoreActions.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/page/useModulesListing.ts +17 -4
- package/frontend-vue/layers/dms-layout/app/composables/page/usePageComponentPreload.ts +15 -7
- package/frontend-vue/layers/dms-layout/app/composables/page/usePageRecordDeletion.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/profile/useUserLanguage.ts +3 -2
- package/frontend-vue/layers/dms-layout/app/composables/useCommandPaletteSources.ts +20 -2
- package/frontend-vue/layers/dms-layout/app/custom-pages/settings/roles.vue +5 -1
- package/frontend-vue/layers/dms-layout/app/custom-pages/settings/shortcuts.vue +4 -1
- package/frontend-vue/layers/dms-layout/app/pages/[...slug].vue +13 -5
- package/frontend-vue/layers/dms-layout/app/plugins/command-palette-session.client.ts +8 -8
- package/frontend-vue/layers/dms-layout/app/plugins/dms-dev-reload.client.ts +1 -1
- package/frontend-vue/layers/dms-layout/app/plugins/dms-mcp-navigate.client.ts +4 -2
- package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +3 -3
- package/frontend-vue/layers/dms-layout/app/plugins/notification-stream.client.ts +47 -40
- package/frontend-vue/layers/dms-layout/app/plugins/permission-preview.client.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/plugins/profile-sync.client.ts +3 -10
- package/frontend-vue/layers/dms-layout/app/plugins/seo.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +3 -2
- package/frontend-vue/layers/dms-layout/server/html-render.ts +5 -1
- package/frontend-vue/layers/dms-layout/server/render-token.ts +3 -2
- package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +1 -1
- package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +1 -1
- package/frontend-vue/layers/dms-onboarding/app/custom-pages/onboarding.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
- package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
- package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetActions.ts +24 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetConfirmation.ts +53 -30
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetHandlers.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +8 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetTypes.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/rowNavigation.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/useActionTargets.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +156 -99
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +194 -161
- package/frontend-vue/layers/dms-ui/app/build/composables/blocks/blockDataState.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/blocks/useGuard.ts +38 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexRawOptions.ts +34 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexSeriesStyle.ts +32 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexTheme.ts +13 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/useActionConfirm.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/cellHelpers.ts +23 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultChoiceTypes.ts +11 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDateCells.ts +7 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +22 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultMediaTypes.ts +5 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +10 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultRelationTypes.ts +8 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/metricCells.ts +12 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/numberSuffix.ts +4 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationRows.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationValue.ts +10 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/twoLineCell.ts +21 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +6 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/detach.ts +9 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/files/useFileMetadata.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldComponentProps.ts +38 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldSaved.ts +6 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +19 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentCancel.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentErrors.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentRealtime.ts +28 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentValidation.ts +5 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formState.ts +15 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formValidation.ts +12 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/form/registerFormFunctions.ts +7 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/stringSet.ts +6 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useFormModel.ts +60 -16
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +5 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/instant-save/useInstantSave.ts +13 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/layout/rowSidePanel.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/live/liveCadence.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/live/missedTally.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +3 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/navigation/useNavBadges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/period/periodQuery.ts +42 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts +63 -46
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionSizing.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnStructure.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useRelationFilterLabels.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTable.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableConfigClipboard.ts +71 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableStates.ts +6 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table/utils/rowId.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/registerDefaultFunctions.ts +21 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionBulkRequests.ts +3 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionContainers.ts +1 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionNavigation.ts +12 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +25 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewArrival.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewCounts.ts +4 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplayContext.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplays.ts +18 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewEvents.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewLive.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickActions.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickFilters.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewTabs.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useCardFields.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useExpandedRowDetails.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +7 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/usePersistedPagination.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useReorderHandles.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTablePreferences.ts +19 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRecordLink.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableReorder.ts +7 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableViewRowActions.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/bulkActions.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +14 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +38 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/expandedRows.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +12 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/reorder.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/sortableColumns.ts +38 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableCounts.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +14 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/formValue.ts +22 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/registry.ts +27 -6
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
- package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
- package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
- package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
- package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
- package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
- package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
- package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
- package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
- package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
- package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
- package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
- package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
- package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
- package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
- package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
- package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
- package/frontend-vue/lazy-plugin.ts +1 -1
- package/frontend-vue/package.json +5 -4
- package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
- package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
- package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
- package/frontend-vue/scripts/check-dms-components.mjs +152 -246
- package/frontend-vue/scripts/check-invariants.mjs +100 -42
- package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
- package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
- package/frontend-vue/scripts/dms-components-script.mjs +375 -0
- package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
- package/frontend-vue/scripts/jsconfig.json +10 -0
- package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
- package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
- package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
- package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
- package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
- package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
- package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
- package/frontend-vue/scripts/test-dms-components.mjs +70 -5
- package/frontend-vue/server/request-body.ts +29 -5
- package/package.json +5 -3
- package/frontend-vue/eslint-test-quality.mjs +0 -62
|
@@ -183,12 +183,11 @@ export function quickActionKey(action: {
|
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* What `applyPreviewLocks` reads from a menu entry. Children are walked as
|
|
186
|
-
* entries of the same kind
|
|
187
|
-
* same `fullId` at runtime).
|
|
186
|
+
* entries of the same kind, `Child`.
|
|
188
187
|
*/
|
|
189
|
-
export interface PreviewLockableEntry {
|
|
188
|
+
export interface PreviewLockableEntry<Child = object> {
|
|
190
189
|
fullId?: string;
|
|
191
|
-
children?: readonly
|
|
190
|
+
children?: readonly Child[];
|
|
192
191
|
}
|
|
193
192
|
|
|
194
193
|
/**
|
|
@@ -196,7 +195,7 @@ export interface PreviewLockableEntry {
|
|
|
196
195
|
* pass each entry the preview locks to `lock`. Labels, collapsed groups and
|
|
197
196
|
* nested entries are all visited; an entry without a `fullId` is left as is.
|
|
198
197
|
*/
|
|
199
|
-
export function applyPreviewLocks<T extends PreviewLockableEntry
|
|
198
|
+
export function applyPreviewLocks<T extends PreviewLockableEntry<T>>(
|
|
200
199
|
items: readonly T[],
|
|
201
200
|
isLocked: (fullId: string | undefined) => boolean,
|
|
202
201
|
lock: (item: T) => T,
|
|
@@ -212,18 +211,14 @@ export function applyPreviewLocks<T extends PreviewLockableEntry>(
|
|
|
212
211
|
* Walk a menu like `applyPreviewLocks`, passing each entry with a preview
|
|
213
212
|
* state (refused or partial) to `decorate` along with that state.
|
|
214
213
|
*/
|
|
215
|
-
export function applyPreviewEntryStates<T extends PreviewLockableEntry
|
|
214
|
+
export function applyPreviewEntryStates<T extends PreviewLockableEntry<T>>(
|
|
216
215
|
items: readonly T[],
|
|
217
216
|
stateOf: (fullId: string | undefined) => PreviewEntryState | null,
|
|
218
217
|
decorate: (item: T, state: PreviewEntryState) => T,
|
|
219
218
|
): T[] {
|
|
220
219
|
return items.map((item) => {
|
|
221
220
|
const children = item.children
|
|
222
|
-
? applyPreviewEntryStates(
|
|
223
|
-
item.children as readonly T[],
|
|
224
|
-
stateOf,
|
|
225
|
-
decorate,
|
|
226
|
-
)
|
|
221
|
+
? applyPreviewEntryStates(item.children, stateOf, decorate)
|
|
227
222
|
: undefined;
|
|
228
223
|
const visited = children ? { ...item, children } : item;
|
|
229
224
|
const state = stateOf(item.fullId);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type SseEventHandler,
|
|
5
5
|
type SseStreamHandle,
|
|
6
6
|
} from "../../composables/realtime/useSseStream";
|
|
7
|
-
import { isString } from "../../utils/type-check";
|
|
7
|
+
import { isString, isUndefined } from "../../utils/type-check";
|
|
8
8
|
import {
|
|
9
9
|
browserCrossTabEnvironment,
|
|
10
10
|
type CrossTabEnvironment,
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
tabLockName,
|
|
16
16
|
whenReleased,
|
|
17
17
|
} from "./crossTab";
|
|
18
|
+
import { isRecord } from "./record";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* The realtime connection one browser shares between its tabs: the elected tab
|
|
@@ -77,6 +78,33 @@ type HubMessage =
|
|
|
77
78
|
| SessionMessage
|
|
78
79
|
| ReopenMessage;
|
|
79
80
|
|
|
81
|
+
/** Whether `value` is a message of the hub, with the fields its `kind` has. */
|
|
82
|
+
function isHubMessage(value: unknown): value is HubMessage {
|
|
83
|
+
if (!isRecord(value)) return false;
|
|
84
|
+
switch (value.kind) {
|
|
85
|
+
case "query":
|
|
86
|
+
return true;
|
|
87
|
+
case "connection":
|
|
88
|
+
return value.connectionId === null || isString(value.connectionId);
|
|
89
|
+
case "reopen":
|
|
90
|
+
return isString(value.connectionId);
|
|
91
|
+
case "session":
|
|
92
|
+
return (
|
|
93
|
+
isString(value.connectionId) &&
|
|
94
|
+
isString(value.sessionId) &&
|
|
95
|
+
isString(value.tabId)
|
|
96
|
+
);
|
|
97
|
+
case "frame":
|
|
98
|
+
return (
|
|
99
|
+
isString(value.connectionId) &&
|
|
100
|
+
isString(value.event) &&
|
|
101
|
+
(isUndefined(value.sessionId) || isString(value.sessionId))
|
|
102
|
+
);
|
|
103
|
+
default:
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
80
108
|
export interface StreamRecovery {
|
|
81
109
|
refreshSession: () => Promise<boolean>;
|
|
82
110
|
redirectToAuth: () => Promise<void>;
|
|
@@ -159,13 +187,12 @@ export const recoverFromError = (
|
|
|
159
187
|
retry();
|
|
160
188
|
return;
|
|
161
189
|
}
|
|
162
|
-
void recovery
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}, retry);
|
|
190
|
+
void recovery
|
|
191
|
+
.refreshSession()
|
|
192
|
+
.then(
|
|
193
|
+
(isRefreshed) => (isRefreshed ? retry() : recovery.redirectToAuth()),
|
|
194
|
+
retry,
|
|
195
|
+
);
|
|
169
196
|
};
|
|
170
197
|
|
|
171
198
|
interface StreamCallbacks extends StreamRecovery {
|
|
@@ -237,17 +264,11 @@ const connectWithBackoff = (
|
|
|
237
264
|
const readConnectionId = (
|
|
238
265
|
data: Parameters<SseEventHandler>[1],
|
|
239
266
|
): string | null => {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
267
|
+
return isRecord(data) && isString(data.connectionId)
|
|
268
|
+
? data.connectionId
|
|
269
|
+
: null;
|
|
243
270
|
};
|
|
244
271
|
|
|
245
|
-
interface SessionFrame {
|
|
246
|
-
sessionId?: unknown;
|
|
247
|
-
event?: unknown;
|
|
248
|
-
data?: unknown;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
272
|
interface LeaderContext {
|
|
252
273
|
options: SharedRealtimeConnectionOptions;
|
|
253
274
|
environment: CrossTabEnvironment;
|
|
@@ -309,8 +330,8 @@ const lead = ({ options, environment, bus, tabId }: LeaderContext) => {
|
|
|
309
330
|
);
|
|
310
331
|
};
|
|
311
332
|
|
|
312
|
-
const unlisten = bus.listen((
|
|
313
|
-
|
|
333
|
+
const unlisten = bus.listen((message) => {
|
|
334
|
+
if (!isHubMessage(message)) return;
|
|
314
335
|
if (message.kind === "query")
|
|
315
336
|
bus.post({ kind: "connection", connectionId });
|
|
316
337
|
if (message.kind === "session") watchSession(message);
|
|
@@ -336,15 +357,15 @@ const lead = ({ options, environment, bus, tabId }: LeaderContext) => {
|
|
|
336
357
|
bus.post({ kind: "frame", connectionId, event: eventName, data });
|
|
337
358
|
return;
|
|
338
359
|
}
|
|
339
|
-
|
|
340
|
-
if (!isString(
|
|
341
|
-
if (!isString(
|
|
360
|
+
if (!isRecord(data)) return;
|
|
361
|
+
if (!isString(data.sessionId)) return;
|
|
362
|
+
if (!isString(data.event)) return;
|
|
342
363
|
bus.post({
|
|
343
364
|
kind: "frame",
|
|
344
365
|
connectionId,
|
|
345
|
-
sessionId:
|
|
346
|
-
event:
|
|
347
|
-
data:
|
|
366
|
+
sessionId: data.sessionId,
|
|
367
|
+
event: data.event,
|
|
368
|
+
data: data.data,
|
|
348
369
|
});
|
|
349
370
|
},
|
|
350
371
|
onDisconnected: () => publish(null),
|
|
@@ -378,8 +399,8 @@ export function joinSharedRealtimeConnection(
|
|
|
378
399
|
const tabLock = holdLock(tabLockName(options.name, tabId), environment);
|
|
379
400
|
let connectionId: string | undefined;
|
|
380
401
|
|
|
381
|
-
const unlisten = bus.listen((
|
|
382
|
-
|
|
402
|
+
const unlisten = bus.listen((message) => {
|
|
403
|
+
if (!isHubMessage(message)) return;
|
|
383
404
|
if (message.kind === "connection") {
|
|
384
405
|
const next = message.connectionId ?? undefined;
|
|
385
406
|
if (next === connectionId) return;
|
|
@@ -398,15 +419,14 @@ export function joinSharedRealtimeConnection(
|
|
|
398
419
|
bus.post({ kind: "query" });
|
|
399
420
|
|
|
400
421
|
return {
|
|
401
|
-
announceSession: (sessionConnectionId, sessionId) => {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
);
|
|
422
|
+
announceSession: async (sessionConnectionId, sessionId) => {
|
|
423
|
+
await tabLock.held;
|
|
424
|
+
bus.post({
|
|
425
|
+
kind: "session",
|
|
426
|
+
connectionId: sessionConnectionId,
|
|
427
|
+
sessionId,
|
|
428
|
+
tabId,
|
|
429
|
+
});
|
|
410
430
|
},
|
|
411
431
|
reopen: (reopenedConnectionId) =>
|
|
412
432
|
bus.post({ kind: "reopen", connectionId: reopenedConnectionId }),
|
|
@@ -144,7 +144,7 @@ function followLivePause<
|
|
|
144
144
|
>(result: R, options: PolledReadOptions | undefined): R {
|
|
145
145
|
if (typeof window === "undefined" || !isGatedPolling(options)) return result;
|
|
146
146
|
let pausedAt = 0;
|
|
147
|
-
watch(useLivePauseSource(), (isPaused) => {
|
|
147
|
+
watch(useLivePauseSource(), async (isPaused) => {
|
|
148
148
|
if (isPaused) {
|
|
149
149
|
pausedAt = Date.now();
|
|
150
150
|
return;
|
|
@@ -153,7 +153,7 @@ function followLivePause<
|
|
|
153
153
|
if (!period || period <= 0 || Date.now() - pausedAt < period) return;
|
|
154
154
|
|
|
155
155
|
if (result.status.value === "idle" && options.immediate === false) return;
|
|
156
|
-
|
|
156
|
+
await result.refresh({ dedupe: "defer" });
|
|
157
157
|
});
|
|
158
158
|
return result;
|
|
159
159
|
}
|
|
@@ -30,7 +30,12 @@ function withRetryHeader(
|
|
|
30
30
|
return merged;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
/** A failed request the backend answered with a 401. */
|
|
34
|
+
interface UnauthorizedError {
|
|
35
|
+
response: { status: typeof HTTP_UNAUTHORIZED };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isUnauthorized(error: unknown): error is UnauthorizedError {
|
|
34
39
|
if (!isObject(error) || error === null) return false;
|
|
35
40
|
const { response } = error;
|
|
36
41
|
return (
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
* profile edit propagates immediately without re-logging in.
|
|
9
9
|
*/
|
|
10
10
|
export function useCurrentUser() {
|
|
11
|
-
const
|
|
11
|
+
const userSession = useDmsUserSession<User>();
|
|
12
|
+
const { user } = userSession;
|
|
12
13
|
const { syncActiveAccount } = useMultiAccount();
|
|
13
14
|
|
|
14
15
|
async function refresh(): Promise<void> {
|
|
15
|
-
await
|
|
16
|
+
await userSession.fetch();
|
|
16
17
|
syncActiveAccount();
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -13,7 +13,8 @@ const FALLBACK_AUTH_ROUTE = "/auth";
|
|
|
13
13
|
* Any "Preview as role" state goes too.
|
|
14
14
|
*/
|
|
15
15
|
export function useLogout() {
|
|
16
|
-
const
|
|
16
|
+
const userSession = useDmsUserSession<User>();
|
|
17
|
+
const { user } = userSession;
|
|
17
18
|
const { accounts, removeAccount } = useMultiAccount();
|
|
18
19
|
const { purge: purgePermissionPreviews } = usePermissionPreview();
|
|
19
20
|
|
|
@@ -21,7 +22,7 @@ export function useLogout() {
|
|
|
21
22
|
const userId = user.value?._id;
|
|
22
23
|
|
|
23
24
|
purgePermissionPreviews();
|
|
24
|
-
await
|
|
25
|
+
await userSession.clear();
|
|
25
26
|
if (userId) {
|
|
26
27
|
await removeAccount(userId);
|
|
27
28
|
}
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
ValidateAccountResponse,
|
|
6
6
|
} from "../../types/auth";
|
|
7
7
|
import { uniqueAccounts, withAccount } from "../../build/utils/storedAccounts";
|
|
8
|
+
import { isNumber } from "../../utils/type-check";
|
|
8
9
|
|
|
9
10
|
const STORAGE_KEY = "antelopejs-accounts";
|
|
10
11
|
const SWITCH_ACCOUNT_ENDPOINT = "/auth/switch-account";
|
|
@@ -59,16 +60,18 @@ interface BrowserSession {
|
|
|
59
60
|
|
|
60
61
|
const TOKEN_REJECTION_STATUSES = new Set([400, 401, 403]);
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
statusCode?: number;
|
|
65
|
-
}
|
|
63
|
+
/** A thrown value whose upstream status, `statusCode` or else `status`, is a number. */
|
|
64
|
+
type UpstreamError = { statusCode: number } | { status: number };
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
/** Whether `error` is the backend refusing the account's tokens: a 400, 401 or 403. */
|
|
67
|
+
function isTokenRejection(error: unknown): error is UpstreamError {
|
|
68
|
+
if (typeof error !== "object" && typeof error !== "function") return false;
|
|
69
|
+
if (error === null) return false;
|
|
70
|
+
const statusCode = "statusCode" in error ? error.statusCode : undefined;
|
|
71
|
+
const upstreamStatus =
|
|
72
|
+
statusCode ?? ("status" in error ? error.status : undefined);
|
|
70
73
|
return (
|
|
71
|
-
upstreamStatus
|
|
74
|
+
isNumber(upstreamStatus) && TOKEN_REJECTION_STATUSES.has(upstreamStatus)
|
|
72
75
|
);
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -122,7 +125,7 @@ async function requestAccountSwitch(account: StoredAccount) {
|
|
|
122
125
|
* @internal
|
|
123
126
|
*/
|
|
124
127
|
export async function refreshSessionSurfaces(
|
|
125
|
-
refreshUser: () => Promise<
|
|
128
|
+
refreshUser: () => Promise<any>,
|
|
126
129
|
): Promise<void> {
|
|
127
130
|
await refreshUser();
|
|
128
131
|
|
|
@@ -192,11 +195,9 @@ function createValidateAllAccounts(
|
|
|
192
195
|
|
|
193
196
|
export function useMultiAccount() {
|
|
194
197
|
const accounts = useAccountsStorage();
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
fetch: refreshUser,
|
|
199
|
-
} = useDmsUserSession<User, BrowserSession>();
|
|
198
|
+
const userSession = useDmsUserSession<User, BrowserSession>();
|
|
199
|
+
const { user, session } = userSession;
|
|
200
|
+
const refreshUser = () => userSession.fetch();
|
|
200
201
|
|
|
201
202
|
const getActiveAccount = (): StoredAccount | undefined =>
|
|
202
203
|
buildActiveAccount(user.value, session.value?.accountId);
|
|
@@ -3,20 +3,33 @@ import { runDeduped } from "../../utils/dedupedRefresh";
|
|
|
3
3
|
const AUTH_PATH = "/auth";
|
|
4
4
|
const IN_FLIGHT_REFRESH_KEY = "__dmsAuthInFlightRefresh";
|
|
5
5
|
|
|
6
|
+
type DmsApp = ReturnType<typeof useDmsApp>;
|
|
7
|
+
type RefreshHolder = Parameters<typeof runDeduped<boolean>>[0];
|
|
8
|
+
|
|
9
|
+
/** Per app, the holder `runDeduped` keeps its in-flight session refresh in. */
|
|
10
|
+
const refreshHolders = new WeakMap<DmsApp, RefreshHolder>();
|
|
11
|
+
|
|
12
|
+
function refreshHolderOf(app: DmsApp): RefreshHolder {
|
|
13
|
+
const known = refreshHolders.get(app);
|
|
14
|
+
if (known) return known;
|
|
15
|
+
const holder = {};
|
|
16
|
+
refreshHolders.set(app, holder);
|
|
17
|
+
return holder;
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
export const useSessionRecovery = () => {
|
|
7
21
|
const dmsApp = useDmsApp();
|
|
8
|
-
const
|
|
22
|
+
const userSession = useDmsUserSession();
|
|
23
|
+
const { loggedIn } = userSession;
|
|
9
24
|
|
|
10
25
|
const router = useDmsRouter();
|
|
11
26
|
|
|
12
27
|
function refreshSession(): Promise<boolean> {
|
|
13
|
-
return runDeduped(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.then(() => true)
|
|
19
|
-
.catch(() => false),
|
|
28
|
+
return runDeduped(refreshHolderOf(dmsApp), IN_FLIGHT_REFRESH_KEY, () =>
|
|
29
|
+
userSession
|
|
30
|
+
.fetch()
|
|
31
|
+
.then(() => true)
|
|
32
|
+
.catch(() => false),
|
|
20
33
|
);
|
|
21
34
|
}
|
|
22
35
|
|
|
@@ -76,15 +76,15 @@ export interface DataType {
|
|
|
76
76
|
) => DataTypeSelectSource | undefined;
|
|
77
77
|
displayComponent?: Component;
|
|
78
78
|
}
|
|
79
|
-
const dataTypes
|
|
79
|
+
const dataTypes = new Map<string, DataType>();
|
|
80
80
|
|
|
81
81
|
export const useDataTypes = () => {
|
|
82
82
|
function registerDataType(dataType: DataType) {
|
|
83
|
-
dataTypes
|
|
83
|
+
dataTypes.set(dataType.id, dataType);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function getDataType(id: string) {
|
|
87
|
-
return dataTypes
|
|
87
|
+
return dataTypes.get(id);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
return {
|
|
@@ -55,24 +55,24 @@ const occurrenceKey = (name: string, occurrence: number): string =>
|
|
|
55
55
|
`${name}${OCCURRENCE_KEY_SEPARATOR}${occurrence}`;
|
|
56
56
|
|
|
57
57
|
function countByName(names: string[]) {
|
|
58
|
-
const totals
|
|
58
|
+
const totals = new Map<string, number>();
|
|
59
59
|
for (const name of names) {
|
|
60
|
-
totals
|
|
60
|
+
totals.set(name, (totals.get(name) ?? 0) + 1);
|
|
61
61
|
}
|
|
62
62
|
return totals;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function buildParamBag(names: string[], values: string[]) {
|
|
66
66
|
const totals = countByName(names);
|
|
67
|
-
const seen
|
|
67
|
+
const seen = new Map<string, number>();
|
|
68
68
|
const params: Record<string, string> = {};
|
|
69
69
|
|
|
70
70
|
names.forEach((name, index) => {
|
|
71
71
|
const value = values[index]!;
|
|
72
|
-
const occurrence = (seen
|
|
73
|
-
seen
|
|
72
|
+
const occurrence = (seen.get(name) ?? 0) + 1;
|
|
73
|
+
seen.set(name, occurrence);
|
|
74
74
|
params[name] = value;
|
|
75
|
-
if (totals
|
|
75
|
+
if (totals.get(name)! > 1) {
|
|
76
76
|
params[occurrenceKey(name, occurrence)] = value;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
@@ -205,11 +205,13 @@ const useSiteLayoutRequests = () => {
|
|
|
205
205
|
const { pageLayoutPromises, loadingPromise } =
|
|
206
206
|
useSiteLayoutRequestsInFlight();
|
|
207
207
|
|
|
208
|
-
const
|
|
208
|
+
const errorPresenter = useApiErrorPresenter();
|
|
209
209
|
const HTTP_INTERNAL_ERROR = 500;
|
|
210
210
|
|
|
211
|
-
const handleSiteLayoutError = (
|
|
212
|
-
|
|
211
|
+
const handleSiteLayoutError = (
|
|
212
|
+
error: Parameters<typeof errorPresenter.resolveError>[0],
|
|
213
|
+
) => {
|
|
214
|
+
const errorMessage = errorPresenter.resolveError(error, {
|
|
213
215
|
fallbackKey: "error.500.description",
|
|
214
216
|
})?.message;
|
|
215
217
|
if (!errorMessage) return;
|
|
@@ -33,7 +33,7 @@ export function periodQueryKeys(id?: string): PeriodQueryKeys {
|
|
|
33
33
|
function firstText(
|
|
34
34
|
value: Parameters<typeof withPeriodQuery>[1][string],
|
|
35
35
|
): string | undefined {
|
|
36
|
-
const text = Array.isArray(value) ? value[0] : value;
|
|
36
|
+
const text: unknown = Array.isArray(value) ? value[0] : value;
|
|
37
37
|
return isString(text) && text ? text : undefined;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,7 +51,8 @@ export function withPeriodQuery(
|
|
|
51
51
|
const [beforeFragment = "", ...fragment] = link.split(FRAGMENT_SEPARATOR);
|
|
52
52
|
const [path = "", ...search] = beforeFragment.split(QUERY_SEPARATOR);
|
|
53
53
|
const params = new URLSearchParams(search.join(QUERY_SEPARATOR));
|
|
54
|
-
|
|
54
|
+
const keys: Record<keyof PeriodQueryKeys, string> = periodQueryKeys(id);
|
|
55
|
+
for (const key of Object.values(keys)) {
|
|
55
56
|
const value = firstText(query[key]);
|
|
56
57
|
if (value && !params.has(key)) params.set(key, value);
|
|
57
58
|
}
|
|
@@ -136,12 +136,12 @@ function buildKey(state: Omit<PeriodState, "key">): string {
|
|
|
136
136
|
].join("|");
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
type PeriodRefs = {
|
|
140
140
|
preset: Ref<PeriodPreset>;
|
|
141
141
|
comparison: Ref<PeriodComparison>;
|
|
142
142
|
customRange: Ref<PeriodRange | null>;
|
|
143
143
|
customCompareRange: Ref<PeriodRange | null>;
|
|
144
|
-
}
|
|
144
|
+
};
|
|
145
145
|
|
|
146
146
|
function buildState(refs: PeriodRefs, now: Date): PeriodState {
|
|
147
147
|
const fallback = refs.customRange.value ?? defaultFallbackRange(now);
|
|
@@ -27,8 +27,15 @@ interface PageClaim {
|
|
|
27
27
|
*/
|
|
28
28
|
const pageClaims: PageClaim[] = [];
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Moves the session to the latest claimed page, in the background. A failed
|
|
32
|
+
* page call leaves the page drawn as it is and is logged: the page is not
|
|
33
|
+
* marked applied, so the next reconcile subscribes it again.
|
|
34
|
+
*/
|
|
30
35
|
const applyLatestClaim = (user: UserRealtimeApi): void => {
|
|
31
|
-
|
|
36
|
+
user.setPage(pageClaims.at(-1)?.pageId ?? null).catch((error: unknown) => {
|
|
37
|
+
console.error("[dms] page realtime subscription failed", error);
|
|
38
|
+
});
|
|
32
39
|
};
|
|
33
40
|
|
|
34
41
|
const raiseClaim = (claim: PageClaim): void => {
|
|
@@ -49,7 +56,7 @@ export function usePageRealtime(
|
|
|
49
56
|
const resolvedPageId = computed(() => toValue(pageId) || undefined);
|
|
50
57
|
|
|
51
58
|
if (import.meta.env.SSR) {
|
|
52
|
-
|
|
59
|
+
user.setPage(resolvedPageId.value ?? null).catch(() => {});
|
|
53
60
|
} else {
|
|
54
61
|
const claim: PageClaim = { pageId: undefined };
|
|
55
62
|
watch(
|
|
@@ -68,7 +75,7 @@ export function usePageRealtime(
|
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
return {
|
|
71
|
-
subscribe: user.subscribe,
|
|
78
|
+
subscribe: (topic, handler) => user.subscribe(topic, handler),
|
|
72
79
|
sessionId: user.sessionId,
|
|
73
80
|
pageId: resolvedPageId,
|
|
74
81
|
pageTopics: user.pageTopics,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HTTP_UNAUTHORIZED } from "../../utils/http-status";
|
|
2
2
|
import { isObject } from "../../utils/type-check";
|
|
3
|
+
import { isJsonValue } from "../../build/utils/json";
|
|
3
4
|
|
|
4
5
|
/** Receives decoded data and the frame's id (null if absent, empty if reset). */
|
|
5
6
|
export type SseEventHandler = (
|
|
@@ -17,7 +18,7 @@ export interface SseStreamOptions {
|
|
|
17
18
|
headers?: () => Record<string, string>;
|
|
18
19
|
onEvent: SseEventHandler;
|
|
19
20
|
onOpen?: () => void;
|
|
20
|
-
onError?: (error:
|
|
21
|
+
onError?: (error: Parameters<typeof isUnauthorizedStreamError>[0]) => void;
|
|
21
22
|
/** Called once after cleanup; errors call onError first. Retry on only one callback. */
|
|
22
23
|
onClose?: (reason: SseCloseReason) => void;
|
|
23
24
|
}
|
|
@@ -68,7 +69,8 @@ function parseFrame(frame: string): ParsedFrame | null {
|
|
|
68
69
|
|
|
69
70
|
function decodeData(data: string): Parameters<SseEventHandler>[1] {
|
|
70
71
|
try {
|
|
71
|
-
|
|
72
|
+
const parsed: unknown = JSON.parse(data);
|
|
73
|
+
return isJsonValue(parsed) ? parsed : data;
|
|
72
74
|
} catch {
|
|
73
75
|
return data;
|
|
74
76
|
}
|
|
@@ -146,10 +148,15 @@ async function connect(
|
|
|
146
148
|
await readStream(response.body.getReader(), options, signal);
|
|
147
149
|
}
|
|
148
150
|
|
|
151
|
+
/** A stream error that carries HTTP 401. */
|
|
152
|
+
interface UnauthorizedStreamError {
|
|
153
|
+
status: typeof HTTP_UNAUTHORIZED;
|
|
154
|
+
}
|
|
155
|
+
|
|
149
156
|
/** Whether a stream error carries HTTP 401 and may need session recovery. */
|
|
150
157
|
export function isUnauthorizedStreamError(
|
|
151
|
-
error:
|
|
152
|
-
):
|
|
158
|
+
error: unknown,
|
|
159
|
+
): error is UnauthorizedStreamError {
|
|
153
160
|
return (
|
|
154
161
|
isObject(error) && error !== null && error.status === HTTP_UNAUTHORIZED
|
|
155
162
|
);
|
|
@@ -158,17 +165,16 @@ export function isUnauthorizedStreamError(
|
|
|
158
165
|
/** Opens one SSE request. EOF is not business completion; no retry is implicit. */
|
|
159
166
|
export function openSseStream(options: SseStreamOptions): SseStreamHandle {
|
|
160
167
|
const controller = new AbortController();
|
|
161
|
-
void (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
})();
|
|
168
|
+
void connect(options, controller.signal).then(
|
|
169
|
+
() => options.onClose?.(controller.signal.aborted ? "aborted" : "eof"),
|
|
170
|
+
(error: unknown) => {
|
|
171
|
+
const reason = controller.signal.aborted ? "aborted" : "error";
|
|
172
|
+
try {
|
|
173
|
+
if (reason === "error") options.onError?.(error);
|
|
174
|
+
} finally {
|
|
175
|
+
options.onClose?.(reason);
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
);
|
|
173
179
|
return { close: () => controller.abort() };
|
|
174
180
|
}
|