@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.
Files changed (367) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +1 -1
  3. package/dist/config/internal/state.d.ts +5 -3
  4. package/dist/config/internal/state.js +9 -1
  5. package/dist/config/internal/state.js.map +1 -1
  6. package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
  7. package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
  8. package/dist/implementations/dms-builder/engine/connection-targets.d.ts +2 -0
  9. package/dist/implementations/dms-builder/engine/connection-targets.js +276 -0
  10. package/dist/implementations/dms-builder/engine/connection-targets.js.map +1 -0
  11. package/dist/implementations/dms-builder/engine/dms-database.d.ts +1 -0
  12. package/dist/implementations/dms-builder/engine/dms-database.js +1 -0
  13. package/dist/implementations/dms-builder/engine/dms-database.js.map +1 -1
  14. package/dist/implementations/dms-builder/engine/driver-packages.js +16 -4
  15. package/dist/implementations/dms-builder/engine/driver-packages.js.map +1 -1
  16. package/dist/implementations/dms-builder/engine/index.d.ts +1 -0
  17. package/dist/implementations/dms-builder/engine/index.js +1 -0
  18. package/dist/implementations/dms-builder/engine/index.js.map +1 -1
  19. package/dist/implementations/dms-builder/engine/theme-scaffold.js +1 -1
  20. package/dist/implementations/dms-html-render/index.js +5 -2
  21. package/dist/implementations/dms-html-render/index.js.map +1 -1
  22. package/dist/mcp/page-verify/index.d.ts +1 -0
  23. package/dist/mcp/page-verify/index.js +1 -0
  24. package/dist/mcp/page-verify/index.js.map +1 -1
  25. package/dist/mcp/page-verify/redact-report.d.ts +2 -0
  26. package/dist/mcp/page-verify/redact-report.js +120 -0
  27. package/dist/mcp/page-verify/redact-report.js.map +1 -0
  28. package/dist/mcp/page-verify/render.js +4 -1
  29. package/dist/mcp/page-verify/render.js.map +1 -1
  30. package/dist/mcp/redact.d.ts +87 -0
  31. package/dist/mcp/redact.js +139 -0
  32. package/dist/mcp/redact.js.map +1 -0
  33. package/dist/mcp/tools/builder-compose.js +11 -2
  34. package/dist/mcp/tools/builder-compose.js.map +1 -1
  35. package/dist/mcp/tools/builder-project.js +59 -26
  36. package/dist/mcp/tools/builder-project.js.map +1 -1
  37. package/dist/mcp/tools/builder-queries.js +41 -4
  38. package/dist/mcp/tools/builder-queries.js.map +1 -1
  39. package/dist/mcp/tools/builder-shared.d.ts +3 -1
  40. package/dist/mcp/tools/builder-shared.js +5 -0
  41. package/dist/mcp/tools/builder-shared.js.map +1 -1
  42. package/dist/mcp/tools/database.js +3 -2
  43. package/dist/mcp/tools/database.js.map +1 -1
  44. package/dist/mcp/tools/page-verify.js +3 -2
  45. package/dist/mcp/tools/page-verify.js.map +1 -1
  46. package/frontend-vue/dms.frontend.ts +6 -2
  47. package/frontend-vue/eslint-globals.generated.mjs +259 -942
  48. package/frontend-vue/layers/dms-auth/app/build/composables/useAuthFormError.ts +5 -3
  49. package/frontend-vue/layers/dms-auth/app/composables/useOAuthErrorToast.ts +6 -4
  50. package/frontend-vue/layers/dms-auth/app/composables/usePostLoginRedirect.ts +3 -2
  51. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +1 -1
  52. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +1 -1
  53. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +12 -4
  54. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +1 -1
  55. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +12 -6
  56. package/frontend-vue/layers/dms-auth/app/middleware/auth.ts +4 -2
  57. package/frontend-vue/layers/dms-auth/server/oauth.ts +13 -7
  58. package/frontend-vue/layers/dms-auth/server/session.ts +37 -6
  59. package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
  60. package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
  61. package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
  62. package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
  63. package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
  64. package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
  65. package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
  66. package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
  67. package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
  68. package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
  69. package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
  70. package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
  71. package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
  72. package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
  73. package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
  74. package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
  75. package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
  76. package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
  77. package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
  78. package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
  79. package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
  80. package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
  81. package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
  82. package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
  83. package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
  84. package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
  85. package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
  86. package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
  87. package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
  88. package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
  89. package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
  90. package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
  91. package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
  92. package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
  93. package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
  94. package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
  95. package/frontend-vue/layers/dms-layout/app/build/branding/BrandingColorPair.vue +5 -2
  96. package/frontend-vue/layers/dms-layout/app/build/branding/device-draft.ts +2 -1
  97. package/frontend-vue/layers/dms-layout/app/build/branding/logos.ts +11 -13
  98. package/frontend-vue/layers/dms-layout/app/build/branding/model.ts +6 -2
  99. package/frontend-vue/layers/dms-layout/app/build/branding/preview-style.ts +12 -10
  100. package/frontend-vue/layers/dms-layout/app/build/branding/raster.ts +7 -4
  101. package/frontend-vue/layers/dms-layout/app/build/branding/useBrandingEditor.ts +59 -31
  102. package/frontend-vue/layers/dms-layout/app/build/branding/values.ts +2 -1
  103. package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +1 -1
  104. package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +37 -24
  105. package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +2 -4
  106. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/profile/ProfileSummaryRow.vue +2 -2
  107. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecuritySessions.vue +35 -10
  108. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/theme/CssVariablesList.vue +2 -2
  109. package/frontend-vue/layers/dms-layout/app/build/composables/dev-reload/useDevReloadHolder.ts +4 -4
  110. package/frontend-vue/layers/dms-layout/app/build/composables/navigation/useVisitNavBadges.ts +26 -4
  111. package/frontend-vue/layers/dms-layout/app/build/composables/security/useSessionHandoff.ts +3 -6
  112. package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useAccountData.ts +16 -12
  113. package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +12 -9
  114. package/frontend-vue/layers/dms-layout/app/build/mockup/header-action.ts +2 -2
  115. package/frontend-vue/layers/dms-layout/app/build/utils/modules-catalog.ts +13 -6
  116. package/frontend-vue/layers/dms-layout/app/build/utils/notificationPayload.ts +81 -0
  117. package/frontend-vue/layers/dms-layout/app/build/utils/submittedUrl.ts +14 -0
  118. package/frontend-vue/layers/dms-layout/app/components/AppWidgetsDock.vue +3 -1
  119. package/frontend-vue/layers/dms-layout/app/composables/general/useSystemState.ts +4 -5
  120. package/frontend-vue/layers/dms-layout/app/composables/layout/useServedHeaderActions.ts +7 -5
  121. package/frontend-vue/layers/dms-layout/app/composables/notification/useNotifications.ts +2 -2
  122. package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +1 -1
  123. package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStore.ts +3 -3
  124. package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStoreActions.ts +2 -2
  125. package/frontend-vue/layers/dms-layout/app/composables/page/useModulesListing.ts +17 -4
  126. package/frontend-vue/layers/dms-layout/app/composables/page/usePageComponentPreload.ts +15 -7
  127. package/frontend-vue/layers/dms-layout/app/composables/page/usePageRecordDeletion.ts +2 -2
  128. package/frontend-vue/layers/dms-layout/app/composables/profile/useUserLanguage.ts +3 -2
  129. package/frontend-vue/layers/dms-layout/app/composables/useCommandPaletteSources.ts +20 -2
  130. package/frontend-vue/layers/dms-layout/app/custom-pages/settings/roles.vue +5 -1
  131. package/frontend-vue/layers/dms-layout/app/custom-pages/settings/shortcuts.vue +4 -1
  132. package/frontend-vue/layers/dms-layout/app/pages/[...slug].vue +13 -5
  133. package/frontend-vue/layers/dms-layout/app/plugins/command-palette-session.client.ts +8 -8
  134. package/frontend-vue/layers/dms-layout/app/plugins/dms-dev-reload.client.ts +1 -1
  135. package/frontend-vue/layers/dms-layout/app/plugins/dms-mcp-navigate.client.ts +4 -2
  136. package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +3 -3
  137. package/frontend-vue/layers/dms-layout/app/plugins/notification-stream.client.ts +47 -40
  138. package/frontend-vue/layers/dms-layout/app/plugins/permission-preview.client.ts +2 -2
  139. package/frontend-vue/layers/dms-layout/app/plugins/profile-sync.client.ts +3 -10
  140. package/frontend-vue/layers/dms-layout/app/plugins/seo.ts +2 -2
  141. package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +3 -2
  142. package/frontend-vue/layers/dms-layout/server/html-render.ts +5 -1
  143. package/frontend-vue/layers/dms-layout/server/render-token.ts +3 -2
  144. package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +1 -1
  145. package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +1 -1
  146. package/frontend-vue/layers/dms-onboarding/app/custom-pages/onboarding.vue +2 -1
  147. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
  148. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
  149. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
  150. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
  151. package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
  152. package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
  153. package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
  154. package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
  155. package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
  156. package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
  157. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
  158. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
  159. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
  160. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
  161. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
  162. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
  163. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
  164. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
  165. package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
  166. package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
  167. package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
  168. package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
  169. package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
  170. package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
  171. package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
  172. package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
  173. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
  174. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
  175. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
  176. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
  177. package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
  178. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetActions.ts +24 -17
  179. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetConfirmation.ts +53 -30
  180. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetHandlers.ts +2 -2
  181. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +2 -2
  182. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +8 -4
  183. package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetTypes.ts +1 -1
  184. package/frontend-vue/layers/dms-ui/app/build/composables/actions/rowNavigation.ts +3 -2
  185. package/frontend-vue/layers/dms-ui/app/build/composables/actions/useActionTargets.ts +9 -2
  186. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +156 -99
  187. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +2 -2
  188. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +194 -161
  189. package/frontend-vue/layers/dms-ui/app/build/composables/blocks/blockDataState.ts +2 -1
  190. package/frontend-vue/layers/dms-ui/app/build/composables/blocks/useGuard.ts +38 -11
  191. package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexRawOptions.ts +34 -5
  192. package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexSeriesStyle.ts +32 -3
  193. package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexTheme.ts +13 -6
  194. package/frontend-vue/layers/dms-ui/app/build/composables/confirm/useActionConfirm.ts +8 -3
  195. package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -4
  196. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/cellHelpers.ts +23 -1
  197. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultChoiceTypes.ts +11 -11
  198. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDateCells.ts +7 -1
  199. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +22 -8
  200. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultMediaTypes.ts +5 -5
  201. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +10 -9
  202. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultRelationTypes.ts +8 -8
  203. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/metricCells.ts +12 -6
  204. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/numberSuffix.ts +4 -6
  205. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationRows.ts +2 -2
  206. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationValue.ts +10 -5
  207. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/twoLineCell.ts +21 -3
  208. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +6 -4
  209. package/frontend-vue/layers/dms-ui/app/build/composables/detach.ts +9 -0
  210. package/frontend-vue/layers/dms-ui/app/build/composables/files/useFileMetadata.ts +1 -1
  211. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldComponentProps.ts +38 -14
  212. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldSaved.ts +6 -8
  213. package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +19 -2
  214. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentCancel.ts +2 -1
  215. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentErrors.ts +3 -2
  216. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentRealtime.ts +28 -8
  217. package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentValidation.ts +5 -6
  218. package/frontend-vue/layers/dms-ui/app/build/composables/form/formState.ts +15 -7
  219. package/frontend-vue/layers/dms-ui/app/build/composables/form/formValidation.ts +12 -3
  220. package/frontend-vue/layers/dms-ui/app/build/composables/form/registerFormFunctions.ts +7 -8
  221. package/frontend-vue/layers/dms-ui/app/build/composables/form/stringSet.ts +6 -0
  222. package/frontend-vue/layers/dms-ui/app/build/composables/form/useFormModel.ts +60 -16
  223. package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +5 -4
  224. package/frontend-vue/layers/dms-ui/app/build/composables/instant-save/useInstantSave.ts +13 -9
  225. package/frontend-vue/layers/dms-ui/app/build/composables/layout/rowSidePanel.ts +2 -1
  226. package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +1 -1
  227. package/frontend-vue/layers/dms-ui/app/build/composables/live/liveCadence.ts +2 -2
  228. package/frontend-vue/layers/dms-ui/app/build/composables/live/missedTally.ts +8 -6
  229. package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +2 -2
  230. package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +3 -3
  231. package/frontend-vue/layers/dms-ui/app/build/composables/navigation/useNavBadges.ts +1 -1
  232. package/frontend-vue/layers/dms-ui/app/build/composables/period/periodQuery.ts +42 -14
  233. package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts +63 -46
  234. package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionSizing.ts +2 -2
  235. package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnStructure.ts +2 -2
  236. package/frontend-vue/layers/dms-ui/app/build/composables/table/useRelationFilterLabels.ts +4 -2
  237. package/frontend-vue/layers/dms-ui/app/build/composables/table/useTable.ts +4 -2
  238. package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableConfigClipboard.ts +71 -9
  239. package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableStates.ts +6 -4
  240. package/frontend-vue/layers/dms-ui/app/build/composables/table/utils/rowId.ts +15 -0
  241. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/registerDefaultFunctions.ts +21 -7
  242. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionBulkRequests.ts +3 -3
  243. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionContainers.ts +1 -17
  244. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionNavigation.ts +12 -7
  245. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +25 -4
  246. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewArrival.ts +8 -5
  247. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewCounts.ts +4 -5
  248. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplayContext.ts +2 -1
  249. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplays.ts +18 -14
  250. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewEvents.ts +4 -3
  251. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +2 -2
  252. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +4 -1
  253. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewLive.ts +4 -1
  254. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickActions.ts +4 -3
  255. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickFilters.ts +4 -2
  256. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +9 -7
  257. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewTabs.ts +4 -4
  258. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useCardFields.ts +1 -1
  259. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useExpandedRowDetails.ts +6 -3
  260. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +7 -7
  261. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/usePersistedPagination.ts +2 -1
  262. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useReorderHandles.ts +9 -2
  263. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +4 -2
  264. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +2 -6
  265. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTablePreferences.ts +19 -12
  266. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRecordLink.ts +6 -3
  267. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableReorder.ts +7 -7
  268. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +4 -2
  269. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableViewRowActions.ts +6 -5
  270. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/bulkActions.ts +3 -1
  271. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +14 -12
  272. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +38 -0
  273. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/expandedRows.ts +4 -2
  274. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +12 -10
  275. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/reorder.ts +6 -5
  276. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/sortableColumns.ts +38 -9
  277. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableCounts.ts +8 -3
  278. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +14 -11
  279. package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/formValue.ts +22 -12
  280. package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/registry.ts +27 -6
  281. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
  282. package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
  283. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
  284. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
  285. package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
  286. package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
  287. package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
  288. package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
  289. package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
  290. package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
  291. package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
  292. package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
  293. package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
  294. package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
  295. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
  296. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
  297. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
  298. package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
  299. package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
  300. package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
  301. package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
  302. package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
  303. package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
  304. package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
  305. package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
  306. package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
  307. package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
  308. package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
  309. package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
  310. package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
  311. package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
  312. package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
  313. package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
  314. package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
  315. package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
  316. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
  317. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
  318. package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
  319. package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
  320. package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
  321. package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
  322. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
  323. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
  324. package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
  325. package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
  326. package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
  327. package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
  328. package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
  329. package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
  330. package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
  331. package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
  332. package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
  333. package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
  334. package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
  335. package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
  336. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
  337. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
  338. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
  339. package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
  340. package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
  341. package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
  342. package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
  343. package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
  344. package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
  345. package/frontend-vue/lazy-plugin.ts +1 -1
  346. package/frontend-vue/package.json +5 -4
  347. package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
  348. package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
  349. package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
  350. package/frontend-vue/scripts/check-dms-components.mjs +152 -246
  351. package/frontend-vue/scripts/check-invariants.mjs +100 -42
  352. package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
  353. package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
  354. package/frontend-vue/scripts/dms-components-script.mjs +375 -0
  355. package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
  356. package/frontend-vue/scripts/jsconfig.json +10 -0
  357. package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
  358. package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
  359. package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
  360. package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
  361. package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
  362. package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
  363. package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
  364. package/frontend-vue/scripts/test-dms-components.mjs +70 -5
  365. package/frontend-vue/server/request-body.ts +29 -5
  366. package/package.json +5 -3
  367. 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 (Nuxt UI types them as child items, which carry the
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 object[];
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);
@@ -0,0 +1,4 @@
1
+ /** Whether `value` is an object other than `null`, whose own keys can be read. */
2
+ export function isRecord(value: unknown): value is Record<string, unknown> {
3
+ return typeof value === "object" && value !== null;
4
+ }
@@ -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.refreshSession().then((isRefreshed) => {
163
- if (isRefreshed) {
164
- retry();
165
- } else {
166
- void recovery.redirectToAuth();
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
- const connectionId = (data as { connectionId?: unknown } | null)
241
- ?.connectionId;
242
- return isString(connectionId) ? connectionId : null;
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((raw) => {
313
- const message = raw as HubMessage;
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
- const frame = data as SessionFrame | null;
340
- if (!isString(frame?.sessionId)) return;
341
- if (!isString(frame.event)) return;
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: frame.sessionId,
346
- event: frame.event,
347
- data: frame.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((raw) => {
382
- const message = raw as HubMessage;
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
- void tabLock.held.then(() =>
403
- bus.post({
404
- kind: "session",
405
- connectionId: sessionConnectionId,
406
- sessionId,
407
- tabId,
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
- void result.refresh({ dedupe: "defer" });
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
- function isUnauthorized(error: unknown): boolean {
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 { user, fetch: refreshSession } = useDmsUserSession<User>();
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 refreshSession();
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 { user, clear: clearSession } = useDmsUserSession<User>();
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 clearSession();
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
- interface UpstreamError {
63
- status?: number;
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
- function isTokenRejection(error: unknown): boolean {
68
- const { status, statusCode } = (error ?? {}) as UpstreamError;
69
- const upstreamStatus = statusCode ?? status;
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 !== undefined && TOKEN_REJECTION_STATUSES.has(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<unknown>,
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
- user,
197
- session,
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 { loggedIn, fetch: fetchSession } = useDmsUserSession();
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
- dmsApp as unknown as Parameters<typeof runDeduped>[0],
15
- IN_FLIGHT_REFRESH_KEY,
16
- () =>
17
- fetchSession()
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: Record<string, DataType> = {};
79
+ const dataTypes = new Map<string, DataType>();
80
80
 
81
81
  export const useDataTypes = () => {
82
82
  function registerDataType(dataType: DataType) {
83
- dataTypes[dataType.id] = dataType;
83
+ dataTypes.set(dataType.id, dataType);
84
84
  }
85
85
 
86
86
  function getDataType(id: string) {
87
- return dataTypes[id];
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: Record<string, number> = {};
58
+ const totals = new Map<string, number>();
59
59
  for (const name of names) {
60
- totals[name] = (totals[name] ?? 0) + 1;
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: Record<string, number> = {};
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[name] ?? 0) + 1;
73
- seen[name] = occurrence;
72
+ const occurrence = (seen.get(name) ?? 0) + 1;
73
+ seen.set(name, occurrence);
74
74
  params[name] = value;
75
- if (totals[name]! > 1) {
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 { resolveError } = useApiErrorPresenter();
208
+ const errorPresenter = useApiErrorPresenter();
209
209
  const HTTP_INTERNAL_ERROR = 500;
210
210
 
211
- const handleSiteLayoutError = (error: unknown) => {
212
- const errorMessage = resolveError(error, {
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
- for (const key of Object.values(periodQueryKeys(id))) {
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
- interface PeriodRefs {
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
- void user.setPage(pageClaims.at(-1)?.pageId ?? null);
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
- void user.setPage(resolvedPageId.value ?? null);
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: unknown) => void;
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
- return JSON.parse(data);
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: Parameters<NonNullable<SseStreamOptions["onError"]>>[0],
152
- ): boolean {
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 (async () => {
162
- let reason: SseCloseReason = "eof";
163
- try {
164
- await connect(options, controller.signal);
165
- if (controller.signal.aborted) reason = "aborted";
166
- } catch (error) {
167
- reason = controller.signal.aborted ? "aborted" : "error";
168
- if (reason === "error") options.onError?.(error);
169
- } finally {
170
- options.onClose?.(reason);
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
  }