@processfocus/runtime-local 0.1.0-next.0
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/LICENSE.md +28 -0
- package/README.md +290 -0
- package/dist/authentication-server.mjs +188 -0
- package/dist/chunk-2sb4v2sx.js +70 -0
- package/dist/chunk-9weqs8n8.js +56031 -0
- package/dist/chunk-mvkr77wp.js +54113 -0
- package/dist/chunk-tkn4cnc8.js +453 -0
- package/dist/chunk-vpsm84e8.js +85 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/app-icons/[...path]/route.ts +63 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/health/page.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/public-form-branding/[...path]/route.ts +95 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +248 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +751 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +375 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +73 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +11 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/abandon-execution-dialog.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/execution-card-menu.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +1549 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-dialog.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-modal-client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-route-fallback.tsx +18 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/restart-execution-feedback.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +215 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +678 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +228 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +147 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +246 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +71 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +315 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +259 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-detail-title.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/loading.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/org-chart-client.tsx +74 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +188 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +320 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +152 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +105 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-submit-button.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +282 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/mobile-process-catalog.ts +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/start-process-actions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +504 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +153 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/loading.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/process-documentation.tsx +209 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/use-workflow-auto-refresh.ts +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/loading.tsx +1 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/access-handbook.tsx +110 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-loading.tsx +25 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-tabs.tsx +47 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-helpers.ts +17 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-source.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/evaluate-cedar.ts +43 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +526 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-cedar.ts +174 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +390 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/org-data.ts +70 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +594 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-skeleton.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +186 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +69 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers-table.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles-table.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +244 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +329 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/error.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/not-found.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/stats-data-fetcher.tsx +93 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +143 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +50 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +50 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +58 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +154 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +1317 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +259 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +127 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +33 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-options/route.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-verify/route.ts +142 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register/route.ts +103 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register-verify/route.ts +136 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/registration-session/route.ts +129 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +153 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +122 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +177 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-completed/route.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +38 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +266 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +118 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/test-host/route.ts +125 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/calendar-slots/route.ts +44 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/complete/route.ts +56 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/request-fresh-link/route.ts +41 -0
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +393 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/loading.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +51 -0
- package/dist/dashboard-source/apps/frontend/app/embed/embedded.css +48 -0
- package/dist/dashboard-source/apps/frontend/app/embed/layout.tsx +15 -0
- package/dist/dashboard-source/apps/frontend/app/global.css +13 -0
- package/dist/dashboard-source/apps/frontend/app/layout.tsx +102 -0
- package/dist/dashboard-source/apps/frontend/app/login/layout.tsx +9 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-button.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form-content.tsx +117 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +52 -0
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +226 -0
- package/dist/dashboard-source/apps/frontend/app/login/secret-login-form.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/manifest.ts +7 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/error.tsx +63 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/layout.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/page.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-card.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-context.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-html.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +553 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-state-content.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +33 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/layout.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/page.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +292 -0
- package/dist/dashboard-source/apps/frontend/app/theme.css +117 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +693 -0
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +481 -0
- package/dist/dashboard-source/apps/frontend/components/OrgUnitNode.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +245 -0
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +158 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-card.tsx +218 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-header-row.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/copy-button.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-activity.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-skeleton.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/components/feature-permissions-provider.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +66 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-host.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-identify.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-provider.tsx +55 -0
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +378 -0
- package/dist/dashboard-source/apps/frontend/components/mobile-home-switchboard.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/components/mocks-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/components/org-settings-provider.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/components/process-workflow-link.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/components/session-reissue.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +89 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-stats-views.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/components/theme-provider.tsx +132 -0
- package/dist/dashboard-source/apps/frontend/components/todo-count-badge.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +304 -0
- package/dist/dashboard-source/apps/frontend/components/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dialog.tsx +142 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dropdown-menu.tsx +256 -0
- package/dist/dashboard-source/apps/frontend/components/ui/input.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/components/ui/pagination.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sheet.tsx +138 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +741 -0
- package/dist/dashboard-source/apps/frontend/components/ui/skeleton.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/components/ui/table.tsx +115 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tooltip.tsx +60 -0
- package/dist/dashboard-source/apps/frontend/components/without-waiting-badge.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +116 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/swimlane-node.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +189 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +79 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +74 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-mobile.ts +27 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-notification-preference.ts +246 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +56 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +101 -0
- package/dist/dashboard-source/apps/frontend/index.d.ts +12 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.node.ts +25 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/app-icons-metadata.ts +66 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +128 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +355 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/config.ts +18 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/reconnect-registry.ts +34 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/act-on-behalf-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/callback-error.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +32 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client.ts +46 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/config.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/issuer.ts +164 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/jwt.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +117 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +52 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/redirect.ts +105 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/secret-login-presentation.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-cache-scope.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-role.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +277 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +95 -0
- package/dist/dashboard-source/apps/frontend/lib/authorization-tabs.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/cedar-highlight.ts +116 -0
- package/dist/dashboard-source/apps/frontend/lib/client-plugin-error-reporting.ts +28 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +1119 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-scope.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/database-error-ui.tsx +61 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution-collection-provider.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +161 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution-collection-provider.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +215 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +394 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-registry.ts +196 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-database-name.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-lifecycle.ts +368 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-provider.tsx +577 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +133 -0
- package/dist/dashboard-source/apps/frontend/lib/current-provider-user.ts +30 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/frontend-port-file.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-events.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/error-boundary.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/index.ts +31 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +168 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +206 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +36 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +94 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/index.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest-store.ts +20 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +152 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-request-origin.ts +39 -0
- package/dist/dashboard-source/apps/frontend/lib/errors/get-display-error-message.ts +22 -0
- package/dist/dashboard-source/apps/frontend/lib/execution-menu-actions-registry.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/feature-permissions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-boot-health.tsx +161 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-client-plugin-registry.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest-store.ts +214 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-plugin-loaders.ts +191 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/fragment-masking.ts +87 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +292 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +443 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-consumer.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-error-reporting.ts +268 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-provider.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dashboard-activity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +78 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/endpoint.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/execution-queries.ts +70 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/file-upload-provider.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/graphql-identifiers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +327 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +63 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-queries.ts +67 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/provider-user-queries.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +80 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +15 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +634 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views-server.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +138 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-home-view-model.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-shell-policy.ts +124 -0
- package/dist/dashboard-source/apps/frontend/lib/mock-data.ts +364 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +251 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +178 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notifications-runtime.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/use-todo-notifications.tsx +103 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-depth-config.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-layout.ts +149 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-types.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-loaders.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-preparation.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins-client.tsx +99 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-graphql-errors.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +200 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +209 -0
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/restart-execution-action.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/runtime-config.ts +23 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/constants.ts +5 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/otlp-config.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/register-otel.ts +308 -0
- package/dist/dashboard-source/apps/frontend/lib/theme.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-types.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +144 -0
- package/dist/dashboard-source/apps/frontend/lib/types/org-identity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/utils.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/constants.ts +118 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/edge-routing.ts +195 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/form-preview.ts +8 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +878 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/types.ts +63 -0
- package/dist/dashboard-source/apps/frontend/next.config.ts +238 -0
- package/dist/dashboard-source/apps/frontend/package.json +71 -0
- package/dist/dashboard-source/apps/frontend/postcss.config.mjs +5 -0
- package/dist/dashboard-source/apps/frontend/proxy.ts +293 -0
- package/dist/dashboard-source/apps/frontend/public/.gitkeep +0 -0
- package/dist/dashboard-source/apps/frontend/public/favicon.ico +0 -0
- package/dist/dashboard-source/apps/frontend/public/processfocus-embed.js +553 -0
- package/dist/dashboard-source/apps/frontend/tsconfig.json +35 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +7 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +1397 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +18 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +346 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +172 -0
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +263 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +34 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/errors.ts +47 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +595 -0
- package/dist/dashboard-source/modules/auth-session/src/index.ts +22 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/issuer-url.ts +192 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +76 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/session-cache-scope.ts +24 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +54 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/url.ts +2 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +3 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/acm.ts +50 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/otlp-config.ts +66 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/runtime-ssm.ts +28 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/index.ts +1 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +65 -0
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +78 -0
- package/dist/dashboard-source/modules/form/src/index.ts +20 -0
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +152 -0
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +1421 -0
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +85 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +58 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +34 -0
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +1554 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +440 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +13 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +336 -0
- package/dist/dashboard-source/modules/form-rule/src/index.ts +21 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +531 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +102 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +121 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +8 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +44 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/deferred-value.ts +21 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +50 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +82 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +58 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +975 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +60 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +45 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/endpoint.ts +137 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/index.ts +11 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/port-files.ts +219 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/index.ts +2 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +201 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +408 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/index.ts +29 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +288 -0
- package/dist/dashboard-source/modules/openauth/src/client.ts +1045 -0
- package/dist/dashboard-source/modules/openauth/src/error.ts +140 -0
- package/dist/dashboard-source/modules/openauth/src/pkce.ts +40 -0
- package/dist/dashboard-source/modules/openauth/src/random.ts +24 -0
- package/dist/dashboard-source/modules/openauth/src/subject.ts +132 -0
- package/dist/dashboard-source/modules/openauth/src/util.ts +13 -0
- package/dist/dashboard-source/modules/request-time/src/index.ts +1 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +30 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/draft-process-execution-schema.json +45 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +217 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/process-schema.json +77 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/todo-schema.json +94 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/index.ts +2 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +181 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +166 -0
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +60 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/boolean-field.tsx +73 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/calendar-slot-field.tsx +808 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +127 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/field-set.tsx +14 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-field.tsx +321 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-upload-context.tsx +45 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/form-context.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +394 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/radio-field.tsx +96 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/select-field.tsx +106 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/text-field.tsx +245 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/button.tsx +63 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/command.tsx +101 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/field.tsx +275 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/input.tsx +29 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/label.tsx +23 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/separator.tsx +27 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/textarea.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/utils/utils.ts +4 -0
- package/dist/dashboard-source.json +70 -0
- package/dist/graphql-server.mjs +1319 -0
- package/dist/job-worker.mjs +989 -0
- package/dist/main.mjs +495 -0
- package/dist/prepare-dashboard.mjs +35 -0
- package/dist/resources/cedar/policies.cedar +315 -0
- package/dist/resources/cedar/schema.cedarschema +276 -0
- package/dist/resources/graphql-schema/rxdb.graphql +401 -0
- package/dist/resources/graphql-schema/system.graphql +1200 -0
- package/package.json +98 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GetParameterCommand, SSMClient } from "@aws-sdk/client-ssm"
|
|
2
|
+
import { type OtlpExportConfig, resolveOtlpSsmConfig } from "../../../../modules/aws-common/src/index.ts"
|
|
3
|
+
|
|
4
|
+
export function resolveOtlpConfig(): Promise<OtlpExportConfig | undefined> {
|
|
5
|
+
const client = new SSMClient({})
|
|
6
|
+
return resolveOtlpSsmConfig({
|
|
7
|
+
env: process.env,
|
|
8
|
+
getParameter: async (name) => {
|
|
9
|
+
const response = await client.send(
|
|
10
|
+
new GetParameterCommand({ Name: name, WithDecryption: true }),
|
|
11
|
+
)
|
|
12
|
+
return response.Parameter?.Value
|
|
13
|
+
},
|
|
14
|
+
warn: console.warn,
|
|
15
|
+
}).finally(() => client.destroy())
|
|
16
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DiagLogLevel,
|
|
3
|
+
type DiagLogger,
|
|
4
|
+
context,
|
|
5
|
+
diag,
|
|
6
|
+
metrics,
|
|
7
|
+
propagation,
|
|
8
|
+
trace,
|
|
9
|
+
} from "@opentelemetry/api"
|
|
10
|
+
import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks"
|
|
11
|
+
import {
|
|
12
|
+
ExportResultCode,
|
|
13
|
+
W3CTraceContextPropagator,
|
|
14
|
+
} from "@opentelemetry/core"
|
|
15
|
+
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http"
|
|
16
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"
|
|
17
|
+
import { resourceFromAttributes } from "@opentelemetry/resources"
|
|
18
|
+
import {
|
|
19
|
+
MeterProvider,
|
|
20
|
+
PeriodicExportingMetricReader,
|
|
21
|
+
type PushMetricExporter,
|
|
22
|
+
type ResourceMetrics,
|
|
23
|
+
} from "@opentelemetry/sdk-metrics"
|
|
24
|
+
import {
|
|
25
|
+
BasicTracerProvider,
|
|
26
|
+
BatchSpanProcessor,
|
|
27
|
+
type ReadableSpan,
|
|
28
|
+
type SpanExporter,
|
|
29
|
+
} from "@opentelemetry/sdk-trace-base"
|
|
30
|
+
import { otlpSignalUrls } from "../../../../modules/aws-common/src/index.ts"
|
|
31
|
+
import { SERVICE_NAME } from "./constants.ts"
|
|
32
|
+
import { resolveOtlpConfig } from "./otlp-config.ts"
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Register the global OTEL TracerProvider and MeterProvider.
|
|
36
|
+
* Must be called once at server startup before any requests are handled.
|
|
37
|
+
*
|
|
38
|
+
* The global TracerProvider is picked up by:
|
|
39
|
+
* - Next.js built-in tracing (page loads, route handling)
|
|
40
|
+
* - @effect/opentelemetry's OtelTracer.layerGlobal (Effect.withSpan)
|
|
41
|
+
*/
|
|
42
|
+
// Module-level flag won't work across separately bundled chunks that each get
|
|
43
|
+
// their own copy. Use a globalThis sentinel instead so the guard survives
|
|
44
|
+
// chunk boundaries within the same process.
|
|
45
|
+
const OTEL_REGISTERED_KEY = "__pf_otel_registered__" as const
|
|
46
|
+
const METRIC_FAILURE_LOG_INTERVAL_MS = 60_000
|
|
47
|
+
|
|
48
|
+
export const readPfScopeFromEnv = (env: NodeJS.ProcessEnv = process.env) => {
|
|
49
|
+
const pfProject = env["PF_PROJECT"] ?? "unknown"
|
|
50
|
+
const pfEnv = env["PF_ENV"] ?? "unknown"
|
|
51
|
+
const pfScope = env["PF_SCOPE"] ?? `pf-${pfProject}-${pfEnv}`
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
pfProject,
|
|
55
|
+
pfEnv,
|
|
56
|
+
pfScope,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const createOtelDiagLogger = (): DiagLogger => ({
|
|
61
|
+
error: (...args: unknown[]) => console.warn(...args),
|
|
62
|
+
warn: (...args: unknown[]) => console.warn(...args),
|
|
63
|
+
info: (...args: unknown[]) => console.info(...args),
|
|
64
|
+
debug: (...args: unknown[]) => console.debug(...args),
|
|
65
|
+
verbose: (...args: unknown[]) => console.debug(...args),
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const formatExportError = (error?: Error) =>
|
|
69
|
+
error ? `${error.name}: ${error.message}` : "unknown"
|
|
70
|
+
|
|
71
|
+
const createLoggingTraceExporter = (
|
|
72
|
+
delegate: SpanExporter,
|
|
73
|
+
options: {
|
|
74
|
+
readonly tracesUrl: string
|
|
75
|
+
readonly pfProject: string
|
|
76
|
+
readonly pfEnv: string
|
|
77
|
+
readonly pfScope: string
|
|
78
|
+
},
|
|
79
|
+
): SpanExporter => {
|
|
80
|
+
let loggedSuccess = false
|
|
81
|
+
const forceFlush = delegate.forceFlush?.bind(delegate)
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
export: (spans: ReadableSpan[], resultCallback) => {
|
|
85
|
+
delegate.export(spans, (result) => {
|
|
86
|
+
if (result.code === ExportResultCode.SUCCESS) {
|
|
87
|
+
if (!loggedSuccess) {
|
|
88
|
+
loggedSuccess = true
|
|
89
|
+
console.log(
|
|
90
|
+
`[OTEL] Trace export succeeded: endpoint=${options.tracesUrl} pfProject=${options.pfProject} pfEnv=${options.pfEnv} pfScope=${options.pfScope} spanCount=${spans.length}`,
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
console.warn(
|
|
95
|
+
`[OTEL] Trace export failed: endpoint=${options.tracesUrl} pfProject=${options.pfProject} pfEnv=${options.pfEnv} pfScope=${options.pfScope} spanCount=${spans.length} error=${formatExportError(result.error)}`,
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
resultCallback(result)
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
shutdown: () => delegate.shutdown(),
|
|
103
|
+
...(forceFlush && {
|
|
104
|
+
forceFlush,
|
|
105
|
+
}),
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const countMetricInstruments = (metrics: ResourceMetrics) =>
|
|
110
|
+
metrics.scopeMetrics.reduce(
|
|
111
|
+
(total, scopeMetrics) => total + scopeMetrics.metrics.length,
|
|
112
|
+
0,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
const createLoggingMetricExporter = (
|
|
116
|
+
delegate: PushMetricExporter,
|
|
117
|
+
options: {
|
|
118
|
+
readonly metricsUrl: string
|
|
119
|
+
readonly pfProject: string
|
|
120
|
+
readonly pfEnv: string
|
|
121
|
+
readonly pfScope: string
|
|
122
|
+
},
|
|
123
|
+
): PushMetricExporter => {
|
|
124
|
+
let loggedSuccess = false
|
|
125
|
+
let lastFailureLoggedAt = 0
|
|
126
|
+
let suppressedFailureCount = 0
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
export: (metrics: ResourceMetrics, resultCallback) => {
|
|
130
|
+
const metricInstrumentCount = countMetricInstruments(metrics)
|
|
131
|
+
|
|
132
|
+
delegate.export(metrics, (result) => {
|
|
133
|
+
if (result.code === ExportResultCode.SUCCESS) {
|
|
134
|
+
lastFailureLoggedAt = 0
|
|
135
|
+
suppressedFailureCount = 0
|
|
136
|
+
if (!loggedSuccess) {
|
|
137
|
+
loggedSuccess = true
|
|
138
|
+
console.log(
|
|
139
|
+
`[OTEL] Metric export succeeded: endpoint=${options.metricsUrl} pfProject=${options.pfProject} pfEnv=${options.pfEnv} pfScope=${options.pfScope} metricInstrumentCount=${metricInstrumentCount}`,
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
const now = Date.now()
|
|
144
|
+
if (
|
|
145
|
+
lastFailureLoggedAt === 0 ||
|
|
146
|
+
now - lastFailureLoggedAt >= METRIC_FAILURE_LOG_INTERVAL_MS
|
|
147
|
+
) {
|
|
148
|
+
const suppressedText =
|
|
149
|
+
suppressedFailureCount > 0
|
|
150
|
+
? ` suppressedFailureCount=${suppressedFailureCount}`
|
|
151
|
+
: ""
|
|
152
|
+
console.error(
|
|
153
|
+
`[OTEL] Metric export failed: endpoint=${options.metricsUrl} pfProject=${options.pfProject} pfEnv=${options.pfEnv} pfScope=${options.pfScope} metricInstrumentCount=${metricInstrumentCount} error=${formatExportError(result.error)}${suppressedText}`,
|
|
154
|
+
)
|
|
155
|
+
lastFailureLoggedAt = now
|
|
156
|
+
suppressedFailureCount = 0
|
|
157
|
+
} else {
|
|
158
|
+
suppressedFailureCount += 1
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
resultCallback(result)
|
|
163
|
+
})
|
|
164
|
+
},
|
|
165
|
+
forceFlush: () => delegate.forceFlush(),
|
|
166
|
+
shutdown: () => delegate.shutdown(),
|
|
167
|
+
...(delegate.selectAggregation && {
|
|
168
|
+
selectAggregation: delegate.selectAggregation.bind(delegate),
|
|
169
|
+
}),
|
|
170
|
+
...(delegate.selectAggregationTemporality && {
|
|
171
|
+
selectAggregationTemporality:
|
|
172
|
+
delegate.selectAggregationTemporality.bind(delegate),
|
|
173
|
+
}),
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async function registerOtelOnce(): Promise<void> {
|
|
178
|
+
const isLambda = !!process.env["AWS_LAMBDA_FUNCTION_NAME"]
|
|
179
|
+
const config = isLambda ? await resolveOtlpConfig() : undefined
|
|
180
|
+
const { pfProject, pfEnv, pfScope } = readPfScopeFromEnv()
|
|
181
|
+
if (isLambda && !config) return
|
|
182
|
+
const grafanaToken = isLambda ? undefined : process.env["GRAFANA_TOKEN"]
|
|
183
|
+
const otlpEndpoint = isLambda ? undefined : process.env["OTLP_ENDPOINT"]
|
|
184
|
+
|
|
185
|
+
// Enable OTEL diagnostic logging in Lambda so export errors are visible
|
|
186
|
+
if (isLambda) {
|
|
187
|
+
diag.setLogger(createOtelDiagLogger(), DiagLogLevel.WARN)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
console.log(
|
|
191
|
+
`[OTEL] Initializing: endpoint=${config?.tracesUrl ?? otlpEndpoint ?? "(local collector)"}, hasToken=${!!config || !!grafanaToken}, pfProject=${pfProject}, pfEnv=${pfEnv}, pfScope=${pfScope}`,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
let tracesUrl: string
|
|
195
|
+
let metricsUrl: string
|
|
196
|
+
let headers: Record<string, string> | undefined
|
|
197
|
+
|
|
198
|
+
if (config) {
|
|
199
|
+
tracesUrl = config.tracesUrl
|
|
200
|
+
metricsUrl = config.metricsUrl
|
|
201
|
+
headers = config.headers
|
|
202
|
+
} else if (otlpEndpoint) {
|
|
203
|
+
;({ tracesUrl, metricsUrl } = otlpSignalUrls(otlpEndpoint))
|
|
204
|
+
if (grafanaToken) {
|
|
205
|
+
headers = { Authorization: `Basic ${grafanaToken}` }
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
// Local development — use local collector or custom URLs
|
|
209
|
+
tracesUrl =
|
|
210
|
+
process.env["OTLP_TRACES_URL"] ?? "http://localhost:4318/v1/traces"
|
|
211
|
+
metricsUrl =
|
|
212
|
+
process.env["OTLP_METRICS_URL"] ?? "http://localhost:4318/v1/metrics"
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const resource = resourceFromAttributes({
|
|
216
|
+
"service.name": SERVICE_NAME,
|
|
217
|
+
"pf.project": pfProject,
|
|
218
|
+
"pf.env": pfEnv,
|
|
219
|
+
"pf.scope": pfScope,
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
const exporterConfig = headers
|
|
223
|
+
? { url: tracesUrl, headers }
|
|
224
|
+
: { url: tracesUrl }
|
|
225
|
+
|
|
226
|
+
const traceExporter = createLoggingTraceExporter(
|
|
227
|
+
new OTLPTraceExporter(exporterConfig),
|
|
228
|
+
{
|
|
229
|
+
tracesUrl,
|
|
230
|
+
pfProject,
|
|
231
|
+
pfEnv,
|
|
232
|
+
pfScope,
|
|
233
|
+
},
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
// Keep OTLP export out of Next's render/prerender path. SimpleSpanProcessor
|
|
237
|
+
// exports synchronously on span end, and the OTLP exporter touches timers and
|
|
238
|
+
// current time, which Next 16 can treat as a prerender bailout and surface as
|
|
239
|
+
// a 500. Losing a serverless span is better than failing the page render.
|
|
240
|
+
const spanProcessor = new BatchSpanProcessor(
|
|
241
|
+
traceExporter,
|
|
242
|
+
isLambda
|
|
243
|
+
? {
|
|
244
|
+
scheduledDelayMillis: 1_000,
|
|
245
|
+
exportTimeoutMillis: 5_000,
|
|
246
|
+
}
|
|
247
|
+
: undefined,
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
const tracerProvider = new BasicTracerProvider({
|
|
251
|
+
resource,
|
|
252
|
+
spanProcessors: [spanProcessor],
|
|
253
|
+
})
|
|
254
|
+
trace.setGlobalTracerProvider(tracerProvider)
|
|
255
|
+
|
|
256
|
+
console.log(
|
|
257
|
+
`[OTEL] TracerProvider registered: processor=Batch, tracesUrl=${tracesUrl}`,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
// Enable context propagation for connecting spans across async boundaries
|
|
261
|
+
const contextManager = new AsyncLocalStorageContextManager()
|
|
262
|
+
contextManager.enable()
|
|
263
|
+
context.setGlobalContextManager(contextManager)
|
|
264
|
+
|
|
265
|
+
// Enable W3C trace context propagation for distributed tracing
|
|
266
|
+
propagation.setGlobalPropagator(new W3CTraceContextPropagator())
|
|
267
|
+
|
|
268
|
+
const metricExporterConfig = headers
|
|
269
|
+
? { url: metricsUrl, headers }
|
|
270
|
+
: { url: metricsUrl }
|
|
271
|
+
|
|
272
|
+
const metricExporter = createLoggingMetricExporter(
|
|
273
|
+
new OTLPMetricExporter(metricExporterConfig),
|
|
274
|
+
{
|
|
275
|
+
metricsUrl,
|
|
276
|
+
pfProject,
|
|
277
|
+
pfEnv,
|
|
278
|
+
pfScope,
|
|
279
|
+
},
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
const meterProvider = new MeterProvider({
|
|
283
|
+
resource,
|
|
284
|
+
readers: [
|
|
285
|
+
new PeriodicExportingMetricReader({
|
|
286
|
+
exporter: metricExporter,
|
|
287
|
+
exportIntervalMillis: 30000, // 30s for serverless/Lambda environments
|
|
288
|
+
}),
|
|
289
|
+
],
|
|
290
|
+
})
|
|
291
|
+
metrics.setGlobalMeterProvider(meterProvider)
|
|
292
|
+
|
|
293
|
+
console.log(
|
|
294
|
+
`[OTEL] Fully initialized: traces=${tracesUrl}, metrics=${metricsUrl}`,
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function registerOtel(): Promise<void> {
|
|
299
|
+
const globals = globalThis as Record<string, unknown>
|
|
300
|
+
const existingRegistration = globals[OTEL_REGISTERED_KEY]
|
|
301
|
+
if (existingRegistration instanceof Promise) {
|
|
302
|
+
return existingRegistration.then(() => undefined)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const registration = registerOtelOnce()
|
|
306
|
+
globals[OTEL_REGISTERED_KEY] = registration
|
|
307
|
+
return registration
|
|
308
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type Theme = "light" | "dark" | "system"
|
|
2
|
+
export type ResolvedTheme = "light" | "dark"
|
|
3
|
+
|
|
4
|
+
export const THEME_STORAGE_KEY = "theme"
|
|
5
|
+
export const THEME_QUERY = "(prefers-color-scheme: dark)"
|
|
6
|
+
export const THEMES = ["light", "dark", "system"] as const
|
|
7
|
+
|
|
8
|
+
export const isTheme = (theme: string | null): theme is Theme =>
|
|
9
|
+
theme === "light" || theme === "dark" || theme === "system"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { TaskPriority } from "../../../modules/rxdb-collections/src/index.ts"
|
|
2
|
+
|
|
3
|
+
export type TaskStatus =
|
|
4
|
+
| "Active"
|
|
5
|
+
| "Completed"
|
|
6
|
+
| "Upcoming"
|
|
7
|
+
| "Draft"
|
|
8
|
+
| "Overdue"
|
|
9
|
+
| "Correction Required"
|
|
10
|
+
|
|
11
|
+
export type PersistedTaskStatus = Extract<
|
|
12
|
+
TaskStatus,
|
|
13
|
+
"Active" | "Completed" | "Correction Required"
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
export const todoStatusSortOrder: Record<TaskStatus, number> = {
|
|
17
|
+
Overdue: 0,
|
|
18
|
+
"Correction Required": 1,
|
|
19
|
+
Active: 2,
|
|
20
|
+
Upcoming: 3,
|
|
21
|
+
Draft: 4,
|
|
22
|
+
Completed: 5,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SavedView {
|
|
26
|
+
id: string
|
|
27
|
+
name: string
|
|
28
|
+
statuses: TaskStatus[]
|
|
29
|
+
priorities: TaskPriority[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const taskSavedViews: SavedView[] = [
|
|
33
|
+
{ id: "all", name: "All Tasks", statuses: [], priorities: [] },
|
|
34
|
+
{
|
|
35
|
+
id: "overdue",
|
|
36
|
+
name: "Overdue",
|
|
37
|
+
statuses: ["Overdue"],
|
|
38
|
+
priorities: [],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "urgent",
|
|
42
|
+
name: "Urgent",
|
|
43
|
+
statuses: ["Active", "Overdue"],
|
|
44
|
+
priorities: ["High"],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "corrections",
|
|
48
|
+
name: "Corrections",
|
|
49
|
+
statuses: ["Correction Required"],
|
|
50
|
+
priorities: [],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "drafts",
|
|
54
|
+
name: "Drafts",
|
|
55
|
+
statuses: ["Draft"],
|
|
56
|
+
priorities: [],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "upcoming",
|
|
60
|
+
name: "Upcoming",
|
|
61
|
+
statuses: ["Upcoming"],
|
|
62
|
+
priorities: [],
|
|
63
|
+
},
|
|
64
|
+
]
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { differenceInHours, formatDistanceToNow, isPast } from "date-fns"
|
|
2
|
+
import { useEffect, useState } from "react"
|
|
3
|
+
import type { PersistedTaskStatus, TaskStatus } from "./todo-types.ts"
|
|
4
|
+
|
|
5
|
+
const ONE_HOUR_MS = 60 * 60 * 1000
|
|
6
|
+
const ONE_MINUTE_MS = 60 * 1000
|
|
7
|
+
const ONE_DAY_MS = 24 * ONE_HOUR_MS
|
|
8
|
+
const ONE_WEEK_MS = 7 * ONE_DAY_MS
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Computes the display status used by Todo views.
|
|
12
|
+
*
|
|
13
|
+
* Stored terminal/correction states win over due-date derivation. Draft and
|
|
14
|
+
* upcoming are frontend-only display states supplied by callers/tests; active
|
|
15
|
+
* persisted Todos become overdue only when their due date is in the past.
|
|
16
|
+
*/
|
|
17
|
+
export function computeTodoStatus(
|
|
18
|
+
dueAt: string | null | undefined,
|
|
19
|
+
storedStatus?: PersistedTaskStatus | null,
|
|
20
|
+
): TaskStatus {
|
|
21
|
+
// Stored Todo status is intentionally small. Draft/upcoming are derived
|
|
22
|
+
// frontend concepts; terminal/correction states must override due-date status.
|
|
23
|
+
if (storedStatus === "Correction Required") return "Correction Required"
|
|
24
|
+
if (storedStatus === "Completed") return "Completed"
|
|
25
|
+
if (!dueAt) return "Active"
|
|
26
|
+
return isPast(new Date(dueAt)) ? "Overdue" : "Active"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function formatDueStatus(
|
|
30
|
+
dueAt: string | null | undefined,
|
|
31
|
+
): string | null {
|
|
32
|
+
if (!dueAt) return null
|
|
33
|
+
const dueDate = new Date(dueAt)
|
|
34
|
+
if (isPast(dueDate)) {
|
|
35
|
+
const hours = differenceInHours(new Date(), dueDate)
|
|
36
|
+
if (hours < 1) return "Overdue by less than an hour"
|
|
37
|
+
if (hours < 24) return `Overdue by ${hours} hour${hours !== 1 ? "s" : ""}`
|
|
38
|
+
const days = Math.floor(hours / 24)
|
|
39
|
+
return `Overdue by ${days} day${days !== 1 ? "s" : ""}`
|
|
40
|
+
}
|
|
41
|
+
return `Due ${formatDistanceToNow(dueDate, { addSuffix: true })}`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function formatAssignedAtLabel(assignedAt: string): string {
|
|
45
|
+
const assignedDate = new Date(assignedAt)
|
|
46
|
+
const assignedTime = assignedDate.getTime()
|
|
47
|
+
if (!Number.isFinite(assignedTime)) return "Assigned at unknown time"
|
|
48
|
+
|
|
49
|
+
const now = Date.now()
|
|
50
|
+
const diffMs = Math.max(0, now - assignedTime)
|
|
51
|
+
const diffDays = Math.floor(diffMs / ONE_DAY_MS)
|
|
52
|
+
|
|
53
|
+
if (diffMs < ONE_MINUTE_MS) return "Assigned just now"
|
|
54
|
+
if (diffDays === 0) {
|
|
55
|
+
const hours = Math.floor(diffMs / ONE_HOUR_MS)
|
|
56
|
+
if (hours > 0) return `Assigned ${hours} hour${hours === 1 ? "" : "s"} ago`
|
|
57
|
+
|
|
58
|
+
const minutes = Math.floor(diffMs / ONE_MINUTE_MS)
|
|
59
|
+
return `Assigned ${minutes} minute${minutes === 1 ? "" : "s"} ago`
|
|
60
|
+
}
|
|
61
|
+
if (diffDays === 1) return "Assigned yesterday"
|
|
62
|
+
if (diffDays < 7) return `Assigned ${diffDays} days ago`
|
|
63
|
+
|
|
64
|
+
return `Assigned ${assignedDate.toLocaleDateString("en-US", {
|
|
65
|
+
month: "short",
|
|
66
|
+
day: "numeric",
|
|
67
|
+
year: "numeric",
|
|
68
|
+
})}`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function formatAssignedAtExact(assignedAt: string): string {
|
|
72
|
+
const assignedDate = new Date(assignedAt)
|
|
73
|
+
if (!Number.isFinite(assignedDate.getTime()))
|
|
74
|
+
return "Assigned at unknown time"
|
|
75
|
+
|
|
76
|
+
return `Assigned ${assignedDate.toLocaleString("en-US", {
|
|
77
|
+
month: "short",
|
|
78
|
+
day: "numeric",
|
|
79
|
+
year: "numeric",
|
|
80
|
+
hour: "numeric",
|
|
81
|
+
minute: "2-digit",
|
|
82
|
+
})}`
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function assignedAtRefreshDelay(assignedAt: string): number | null {
|
|
86
|
+
const assignedTime = new Date(assignedAt).getTime()
|
|
87
|
+
if (!Number.isFinite(assignedTime)) return null
|
|
88
|
+
|
|
89
|
+
const diffMs = Math.max(0, Date.now() - assignedTime)
|
|
90
|
+
if (diffMs >= ONE_WEEK_MS) return null
|
|
91
|
+
|
|
92
|
+
const intervalMs =
|
|
93
|
+
diffMs < ONE_HOUR_MS
|
|
94
|
+
? ONE_MINUTE_MS
|
|
95
|
+
: diffMs < ONE_DAY_MS
|
|
96
|
+
? ONE_HOUR_MS
|
|
97
|
+
: ONE_DAY_MS
|
|
98
|
+
// Add a one-second buffer so the next render lands after the label boundary.
|
|
99
|
+
return intervalMs - (diffMs % intervalMs) + 1000
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function isDueWithin24Hours(dueAt: string | null | undefined): boolean {
|
|
103
|
+
if (!dueAt) return false
|
|
104
|
+
const dueDate = new Date(dueAt)
|
|
105
|
+
if (isPast(dueDate)) return false
|
|
106
|
+
const hours = differenceInHours(dueDate, new Date())
|
|
107
|
+
return hours >= 0 && hours < 24
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Hook that triggers a re-render when the next todo becomes overdue.
|
|
112
|
+
* Caps at 1 hour to handle very distant due dates.
|
|
113
|
+
* Timer resets when due-time contents change, keyed by value rather than array
|
|
114
|
+
* identity.
|
|
115
|
+
*/
|
|
116
|
+
export function useOverdueRefresh(dueTimes: (string | null | undefined)[]) {
|
|
117
|
+
const [, forceRender] = useState(0)
|
|
118
|
+
// ISO due-time strings cannot contain NUL, so this gives a collision-free,
|
|
119
|
+
// intentionally order-sensitive key without depending on array identity.
|
|
120
|
+
const dueTimesKey = dueTimes.map((time) => time ?? "").join("\0")
|
|
121
|
+
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const now = Date.now()
|
|
124
|
+
// Reconstruct from the primitive key so equal due-time contents do not reset
|
|
125
|
+
// the timer.
|
|
126
|
+
const futureDueTimes = dueTimesKey
|
|
127
|
+
.split("\0")
|
|
128
|
+
.filter((t) => t.length > 0)
|
|
129
|
+
.map((t) => new Date(t).getTime())
|
|
130
|
+
.filter((time) => time > now)
|
|
131
|
+
|
|
132
|
+
if (futureDueTimes.length === 0) {
|
|
133
|
+
// Nothing due in future - re-check in 1 hour as safety net
|
|
134
|
+
const id = setTimeout(() => forceRender((n) => n + 1), ONE_HOUR_MS)
|
|
135
|
+
return () => clearTimeout(id)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const nextDue = Math.min(...futureDueTimes)
|
|
139
|
+
const delay = Math.min(nextDue - now + 1000, ONE_HOUR_MS) // +1s buffer, cap at 1 hour
|
|
140
|
+
|
|
141
|
+
const id = setTimeout(() => forceRender((n) => n + 1), delay)
|
|
142
|
+
return () => clearTimeout(id)
|
|
143
|
+
}, [dueTimesKey])
|
|
144
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OrgIdentityQuery } from "@/lib/generated/gql/graphql"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Organization identity type derived from GraphQL OrgIdentityQuery.
|
|
5
|
+
* Used throughout the app for displaying org info in sidebar, etc.
|
|
6
|
+
*/
|
|
7
|
+
export type OrgIdentity = NonNullable<OrgIdentityQuery["org"]>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ClassValue, clsx } from "clsx"
|
|
2
|
+
import { twMerge } from "tailwind-merge"
|
|
3
|
+
|
|
4
|
+
export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs))
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Strips the leading slash from a path, converting from database format to URL format.
|
|
8
|
+
* Database paths always have a leading slash (e.g., "/enrolment-enquiry/Contact parent"),
|
|
9
|
+
* but URLs should not have a double slash after the base path.
|
|
10
|
+
*
|
|
11
|
+
* @param path - Path like "/enrolment-enquiry/Contact parent" or "enrolment-enquiry/Contact parent"
|
|
12
|
+
* @returns Path without leading slash like "enrolment-enquiry/Contact parent"
|
|
13
|
+
*/
|
|
14
|
+
export const toUrlPath = (path: string): string => {
|
|
15
|
+
return path.startsWith("/") ? path.slice(1) : path
|
|
16
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared layout constants for workflow visualization.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/** Width of the role label column on the left side of swimlanes */
|
|
6
|
+
export const ROLE_LABEL_WIDTH = 200
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Phase color scheme for workflow visualization.
|
|
10
|
+
* Colors are assigned based on phase index (order of appearance).
|
|
11
|
+
*/
|
|
12
|
+
interface PhaseColors {
|
|
13
|
+
/** Background color for step cards */
|
|
14
|
+
cardClass: string
|
|
15
|
+
/** Badge background and text colors */
|
|
16
|
+
badgeClass: string
|
|
17
|
+
/** Accent color for legend dots and minimap */
|
|
18
|
+
accent: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Color palette for phases, cycled through based on phase index.
|
|
23
|
+
* Matches the mock design color scheme.
|
|
24
|
+
*/
|
|
25
|
+
const PHASE_COLOR_PALETTE: readonly PhaseColors[] = [
|
|
26
|
+
{
|
|
27
|
+
// Indigo - first phase
|
|
28
|
+
cardClass:
|
|
29
|
+
"bg-indigo-50/80 border-indigo-200/70 dark:bg-indigo-950/40 dark:border-indigo-500/40",
|
|
30
|
+
badgeClass:
|
|
31
|
+
"bg-indigo-100/80 text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-100",
|
|
32
|
+
accent: "#818cf8",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
// Amber - second phase
|
|
36
|
+
cardClass:
|
|
37
|
+
"bg-amber-50/80 border-amber-200/70 dark:bg-amber-950/40 dark:border-amber-500/40",
|
|
38
|
+
badgeClass:
|
|
39
|
+
"bg-amber-100/90 text-amber-700 dark:bg-amber-500/20 dark:text-amber-100",
|
|
40
|
+
accent: "#f59e0b",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
// Sky - third phase
|
|
44
|
+
cardClass:
|
|
45
|
+
"bg-sky-50/80 border-sky-200/70 dark:bg-sky-950/40 dark:border-sky-500/40",
|
|
46
|
+
badgeClass:
|
|
47
|
+
"bg-sky-100/90 text-sky-700 dark:bg-sky-500/20 dark:text-sky-100",
|
|
48
|
+
accent: "#0ea5e9",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
// Emerald - fourth phase
|
|
52
|
+
cardClass:
|
|
53
|
+
"bg-emerald-50/80 border-emerald-200/70 dark:bg-emerald-950/40 dark:border-emerald-500/40",
|
|
54
|
+
badgeClass:
|
|
55
|
+
"bg-emerald-100/90 text-emerald-700 dark:bg-emerald-500/20 dark:text-emerald-100",
|
|
56
|
+
accent: "#10b981",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
// Violet - fifth phase
|
|
60
|
+
cardClass:
|
|
61
|
+
"bg-violet-50/80 border-violet-200/70 dark:bg-violet-950/40 dark:border-violet-500/40",
|
|
62
|
+
badgeClass:
|
|
63
|
+
"bg-violet-100/90 text-violet-700 dark:bg-violet-500/20 dark:text-violet-100",
|
|
64
|
+
accent: "#8b5cf6",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
// Rose - sixth phase (for additional phases)
|
|
68
|
+
cardClass:
|
|
69
|
+
"bg-rose-50/80 border-rose-200/70 dark:bg-rose-950/40 dark:border-rose-500/40",
|
|
70
|
+
badgeClass:
|
|
71
|
+
"bg-rose-100/90 text-rose-700 dark:bg-rose-500/20 dark:text-rose-100",
|
|
72
|
+
accent: "#f43f5e",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
// Teal - seventh phase
|
|
76
|
+
cardClass:
|
|
77
|
+
"bg-teal-50/80 border-teal-200/70 dark:bg-teal-950/40 dark:border-teal-500/40",
|
|
78
|
+
badgeClass:
|
|
79
|
+
"bg-teal-100/90 text-teal-700 dark:bg-teal-500/20 dark:text-teal-100",
|
|
80
|
+
accent: "#14b8a6",
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Default colors for steps without a phase.
|
|
86
|
+
*/
|
|
87
|
+
export const DEFAULT_STEP_COLORS: PhaseColors = {
|
|
88
|
+
cardClass:
|
|
89
|
+
"bg-slate-50/80 border-slate-200/70 dark:bg-slate-950/40 dark:border-slate-500/40",
|
|
90
|
+
badgeClass:
|
|
91
|
+
"bg-slate-100/90 text-slate-700 dark:bg-slate-500/20 dark:text-slate-100",
|
|
92
|
+
accent: "#64748b",
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Colors for system steps (NodeSteps) in the SYSTEM swimlane.
|
|
97
|
+
* Distinct zinc/gray palette to distinguish from user tasks.
|
|
98
|
+
*/
|
|
99
|
+
export const SYSTEM_STEP_COLORS: PhaseColors = {
|
|
100
|
+
cardClass:
|
|
101
|
+
"bg-zinc-100/80 border-zinc-300/80 dark:bg-zinc-900/50 dark:border-zinc-600/50",
|
|
102
|
+
badgeClass:
|
|
103
|
+
"bg-zinc-200/90 text-zinc-700 dark:bg-zinc-600/30 dark:text-zinc-300",
|
|
104
|
+
accent: "#a1a1aa",
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get phase colors by index (cycles through palette).
|
|
109
|
+
*/
|
|
110
|
+
export function getPhaseColors(phaseIndex: number): PhaseColors {
|
|
111
|
+
const index = phaseIndex % PHASE_COLOR_PALETTE.length
|
|
112
|
+
const colors = PHASE_COLOR_PALETTE[index]
|
|
113
|
+
// Palette is non-empty and index is always valid due to modulo
|
|
114
|
+
if (!colors) {
|
|
115
|
+
return DEFAULT_STEP_COLORS
|
|
116
|
+
}
|
|
117
|
+
return colors
|
|
118
|
+
}
|