@processfocus/runtime-local 0.1.0-next.2 → 0.1.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -253
- package/dist/authentication-server.mjs +52 -84
- package/dist/chunk-3wzp2sax.js +4806 -0
- package/dist/chunk-5kjvzbwr.js +512 -0
- package/dist/chunk-egeb4821.js +156 -0
- package/dist/chunk-q5v72erd.js +241 -0
- package/dist/{chunk-yhzbn4vx.js → chunk-wvbz0nmd.js} +19485 -34180
- package/dist/{chunk-352j1ayk.js → chunk-y8fnwbx0.js} +51781 -36259
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/disconnect-form.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/page.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -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 +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -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 +169 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +21 -14
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +36 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
- 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 +2 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +69 -1
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
- package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +14 -6
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
- package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
- package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +44 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +14 -8
- package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
- package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
- package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
- package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +115 -23
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +21 -1
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +66 -9
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +10 -6
- package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
- package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
- package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
- package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +168 -30
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +34 -29
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +889 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +107 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +260 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
- package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
- package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
- package/dist/dashboard-source/apps/frontend/package.json +47 -47
- package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
- package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
- package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
- package/dist/dashboard-source/modules/form/src/index.ts +1 -10
- package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
- package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
- package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
- package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
- package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
- package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
- package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
- package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
- package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
- package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
- package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
- package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +273 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
- package/dist/dashboard-source.json +47 -47
- package/dist/graphql-server.mjs +272 -200
- package/dist/job-worker-supervisor.mjs +262 -0
- package/dist/job-worker.mjs +234 -133
- package/dist/main.mjs +30 -6
- package/dist/prepare-dashboard.mjs +8 -8
- package/dist/resources/cedar/policies.cedar +80 -38
- package/dist/resources/cedar/schema.cedarschema +39 -21
- package/dist/resources/graphql-schema/rxdb.graphql +2 -0
- package/dist/resources/graphql-schema/system.graphql +191 -51
- package/package.json +63 -62
- package/dist/chunk-6ntmymmx.js +0 -85
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
- package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
import { useQueryClient } from "@tanstack/react-query"
|
|
4
4
|
import { AlertCircle, ArrowLeft, Loader2 } from "lucide-react"
|
|
5
5
|
import Link from "next/link"
|
|
6
|
-
import { useRouter } from "next/navigation"
|
|
7
6
|
import { useCallback } from "react"
|
|
8
|
-
import type { JsonSchemaRoot } from "../../../../../../../modules/form/src/index.ts"
|
|
9
7
|
import { Button } from "../../../../../../../modules/shadcn-components/src/index.ts"
|
|
10
8
|
import { ListItemEditForm } from "../../components/list-item-edit-form.tsx"
|
|
9
|
+
import { ListItemLoadError } from "../../components/list-item-load-error.tsx"
|
|
11
10
|
import { useListDeletedCallback } from "../../hooks/use-list-deleted-callback.ts"
|
|
12
11
|
import { useListItemDetail } from "../../hooks/use-list-item-detail.ts"
|
|
13
12
|
import { listDetailTitle } from "../../lib/list-detail-title.ts"
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { formatCellValue } from "../../utils.tsx"
|
|
14
|
+
import { useListRefresh } from "@/app/(protected)/lists/lib/list-refresh-provider"
|
|
16
15
|
|
|
17
16
|
interface ListDetailClientProps {
|
|
18
17
|
listPath: string
|
|
@@ -23,9 +22,9 @@ export default function ListDetailClient({
|
|
|
23
22
|
listPath,
|
|
24
23
|
itemId,
|
|
25
24
|
}: ListDetailClientProps) {
|
|
26
|
-
const
|
|
25
|
+
const refreshState = useListRefresh()
|
|
27
26
|
const queryClient = useQueryClient()
|
|
28
|
-
const { currentList, itemDetail, formMetadata, isLoading, error } =
|
|
27
|
+
const { currentList, itemDetail, formMetadata, isLoading, error, refetch } =
|
|
29
28
|
useListItemDetail(listPath, itemId)
|
|
30
29
|
|
|
31
30
|
const handleClose = useCallback(() => {
|
|
@@ -36,16 +35,14 @@ export default function ListDetailClient({
|
|
|
36
35
|
queryClient.invalidateQueries({
|
|
37
36
|
queryKey: ["listItem", listPath, itemId],
|
|
38
37
|
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, [queryClient, listPath, itemId, router])
|
|
38
|
+
refreshState.invalidate(listPath)
|
|
39
|
+
}, [queryClient, listPath, itemId, refreshState])
|
|
42
40
|
|
|
43
41
|
const handleDeleted = useListDeletedCallback(listPath, itemId)
|
|
44
42
|
|
|
45
43
|
const detailTitle = listDetailTitle(currentList)
|
|
46
44
|
const isAnyLoading = isLoading
|
|
47
45
|
|
|
48
|
-
// Loading state
|
|
49
46
|
if (isAnyLoading) {
|
|
50
47
|
return (
|
|
51
48
|
<div className="flex-1">
|
|
@@ -69,7 +66,7 @@ export default function ListDetailClient({
|
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
// List not found or no item query
|
|
72
|
-
if (!currentList?.itemQueryName) {
|
|
69
|
+
if (!error && !currentList?.itemQueryName) {
|
|
73
70
|
return (
|
|
74
71
|
<div className="flex-1">
|
|
75
72
|
<div className="mx-auto max-w-2xl">
|
|
@@ -99,7 +96,6 @@ export default function ListDetailClient({
|
|
|
99
96
|
)
|
|
100
97
|
}
|
|
101
98
|
|
|
102
|
-
// Error state
|
|
103
99
|
if (error) {
|
|
104
100
|
return (
|
|
105
101
|
<div className="flex-1">
|
|
@@ -111,9 +107,7 @@ export default function ListDetailClient({
|
|
|
111
107
|
<h1 className="text-2xl font-semibold text-rose-900 dark:text-rose-100">
|
|
112
108
|
Error Loading Item
|
|
113
109
|
</h1>
|
|
114
|
-
<
|
|
115
|
-
{String(error)}
|
|
116
|
-
</p>
|
|
110
|
+
<ListItemLoadError error={error} onRetry={refetch} />
|
|
117
111
|
</div>
|
|
118
112
|
</div>
|
|
119
113
|
<Link href={`/lists${listPath}`}>
|
|
@@ -128,7 +122,7 @@ export default function ListDetailClient({
|
|
|
128
122
|
)
|
|
129
123
|
}
|
|
130
124
|
|
|
131
|
-
|
|
125
|
+
if (!currentList) return null
|
|
132
126
|
if (!itemDetail) {
|
|
133
127
|
return (
|
|
134
128
|
<div className="flex-1">
|
|
@@ -174,8 +168,6 @@ export default function ListDetailClient({
|
|
|
174
168
|
),
|
|
175
169
|
)
|
|
176
170
|
: (itemDetail as Record<string, unknown> | null)
|
|
177
|
-
const jsonSchema =
|
|
178
|
-
(formMetadata.jsonSchema as JsonSchemaRoot | null) ?? null
|
|
179
171
|
|
|
180
172
|
return (
|
|
181
173
|
<div className="flex-1">
|
|
@@ -201,8 +193,6 @@ export default function ListDetailClient({
|
|
|
201
193
|
updateInputTypeName={formMetadata.updateInputTypeName ?? null}
|
|
202
194
|
deleteMutationName={formMetadata.deleteMutationName ?? null}
|
|
203
195
|
defaultValues={defaultValues}
|
|
204
|
-
formDefinition={formMetadata.formDefinition}
|
|
205
|
-
jsonSchema={jsonSchema}
|
|
206
196
|
outputFields={currentList.outputColumns.map((c) => c.field)}
|
|
207
197
|
onClose={handleClose}
|
|
208
198
|
onSaved={handleSaved}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { usePathname, useSearchParams } from "next/navigation"
|
|
4
|
+
import { useMemo, useState } from "react"
|
|
5
|
+
import { parseListReturnDestination } from "./list-refresh.ts"
|
|
6
|
+
import { useReturnToList } from "./list-refresh-provider.tsx"
|
|
7
|
+
import StartProcessModalClient from "@/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client"
|
|
8
|
+
|
|
9
|
+
const startPrefix = "/processes/start/"
|
|
10
|
+
|
|
11
|
+
/** The retained List reads its own URL state while the form owns the address bar. */
|
|
12
|
+
export function useListSearchParams() {
|
|
13
|
+
const pathname = usePathname()
|
|
14
|
+
const params = useSearchParams()
|
|
15
|
+
return useMemo(() => {
|
|
16
|
+
const destination = pathname.startsWith(startPrefix)
|
|
17
|
+
? parseListReturnDestination(params.get("returnTo"), "http://localhost")
|
|
18
|
+
: null
|
|
19
|
+
return destination
|
|
20
|
+
? new URL(destination.href, "http://localhost").searchParams
|
|
21
|
+
: params
|
|
22
|
+
}, [pathname, params])
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Also mounted by the hard-navigation start page, using the same List server page. */
|
|
26
|
+
export function ListProcessDialog({ listPath }: { readonly listPath: string }) {
|
|
27
|
+
const pathname = usePathname()
|
|
28
|
+
const params = useSearchParams()
|
|
29
|
+
const destination = parseListReturnDestination(
|
|
30
|
+
params.get("returnTo"),
|
|
31
|
+
"http://localhost",
|
|
32
|
+
)
|
|
33
|
+
if (!pathname.startsWith(startPrefix) || destination?.listPath !== listPath)
|
|
34
|
+
return null
|
|
35
|
+
return (
|
|
36
|
+
<RetainedListProcessDialog
|
|
37
|
+
key={pathname}
|
|
38
|
+
startStepPath={`/${decodeURIComponent(pathname.slice(startPrefix.length))}`}
|
|
39
|
+
sourceRecordId={params.get("sourceRecordId")}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function RetainedListProcessDialog({
|
|
45
|
+
startStepPath,
|
|
46
|
+
sourceRecordId,
|
|
47
|
+
}: {
|
|
48
|
+
readonly startStepPath: string
|
|
49
|
+
readonly sourceRecordId: string | null
|
|
50
|
+
}) {
|
|
51
|
+
const returnToList = useReturnToList(true)
|
|
52
|
+
const [initiator] = useState(() =>
|
|
53
|
+
typeof document === "undefined" ? null : document.activeElement,
|
|
54
|
+
)
|
|
55
|
+
return (
|
|
56
|
+
<StartProcessModalClient
|
|
57
|
+
startStepPath={startStepPath}
|
|
58
|
+
description={
|
|
59
|
+
sourceRecordId
|
|
60
|
+
? `Start a process for List record ${sourceRecordId}`
|
|
61
|
+
: "Start a process"
|
|
62
|
+
}
|
|
63
|
+
onClose={returnToList}
|
|
64
|
+
onCloseAutoFocus={(event) => {
|
|
65
|
+
event.preventDefault()
|
|
66
|
+
if (initiator instanceof HTMLElement && initiator.isConnected) {
|
|
67
|
+
initiator.focus()
|
|
68
|
+
}
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useRouter, useSearchParams } from "next/navigation"
|
|
4
|
+
import { type ReactNode, createContext, useContext, useState } from "react"
|
|
5
|
+
import { ListRefreshState, parseListReturnDestination } from "./list-refresh.ts"
|
|
6
|
+
import { useSession } from "@/components/auth-provider"
|
|
7
|
+
import { useRuntimeConfig } from "@/components/config-provider"
|
|
8
|
+
import { getSessionCacheScope } from "@/lib/auth/session-cache-scope"
|
|
9
|
+
|
|
10
|
+
const ListRefreshContext = createContext<ListRefreshState | null>(null)
|
|
11
|
+
|
|
12
|
+
export function ListRefreshProvider({ children }: { children: ReactNode }) {
|
|
13
|
+
const session = useSession()
|
|
14
|
+
const { orgId, graphqlEndpoint } = useRuntimeConfig()
|
|
15
|
+
const scope = JSON.stringify([
|
|
16
|
+
orgId,
|
|
17
|
+
graphqlEndpoint,
|
|
18
|
+
getSessionCacheScope(session),
|
|
19
|
+
])
|
|
20
|
+
return (
|
|
21
|
+
<ScopedListRefreshProvider key={scope}>
|
|
22
|
+
{children}
|
|
23
|
+
</ScopedListRefreshProvider>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function ScopedListRefreshProvider({ children }: { children: ReactNode }) {
|
|
28
|
+
const [state] = useState(() => new ListRefreshState())
|
|
29
|
+
return (
|
|
30
|
+
<ListRefreshContext.Provider value={state}>
|
|
31
|
+
{children}
|
|
32
|
+
</ListRefreshContext.Provider>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function useListRefresh(): ListRefreshState {
|
|
37
|
+
const state = useContext(ListRefreshContext)
|
|
38
|
+
if (!state) throw new Error("ListRefreshProvider is required")
|
|
39
|
+
return state
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Both process routes share the success/cancellation and warm-history contract. */
|
|
43
|
+
export function useReturnToList(retainList = false) {
|
|
44
|
+
const router = useRouter()
|
|
45
|
+
const params = useSearchParams()
|
|
46
|
+
const state = useListRefresh()
|
|
47
|
+
return (result: "submitted" | "cancelled"): boolean => {
|
|
48
|
+
const destination = parseListReturnDestination(
|
|
49
|
+
params.get("returnTo"),
|
|
50
|
+
window.location.origin,
|
|
51
|
+
)
|
|
52
|
+
if (!destination) return false
|
|
53
|
+
const { href, listPath } = destination
|
|
54
|
+
if (result === "submitted") state.invalidate(listPath)
|
|
55
|
+
if (state.canReturn(params.get("listReturn"), href)) {
|
|
56
|
+
router.back()
|
|
57
|
+
} else if (retainList) {
|
|
58
|
+
window.history.replaceState(null, "", href)
|
|
59
|
+
} else {
|
|
60
|
+
// A direct/reloaded form has no retained shell. Load the normal SSR route.
|
|
61
|
+
router.push(href)
|
|
62
|
+
}
|
|
63
|
+
return true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,26 +1,172 @@
|
|
|
1
|
-
|
|
1
|
+
import type {
|
|
2
|
+
ListDataResult,
|
|
3
|
+
ListQueryVariables,
|
|
4
|
+
} from "@/lib/graphql/list-queries"
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
type RefreshResult =
|
|
7
|
+
| { readonly kind: "loading" }
|
|
8
|
+
| { readonly kind: "error" }
|
|
9
|
+
| { readonly kind: "ready"; readonly data: ListDataResult }
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
type RefreshEntry = {
|
|
12
|
+
version: number
|
|
13
|
+
sources: ReadonlySet<ListDataResult>
|
|
14
|
+
result: RefreshResult
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type ListRefreshSnapshot = {
|
|
18
|
+
readonly versions: ReadonlyMap<string, number>
|
|
19
|
+
readonly results: ReadonlyMap<string, RefreshEntry>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Owned by one authenticated shell, never persisted across logout/reload. */
|
|
23
|
+
export class ListRefreshState {
|
|
24
|
+
private versions = new Map<string, number>()
|
|
25
|
+
private results = new Map<string, RefreshEntry>()
|
|
26
|
+
private returns = new Map<string, string>()
|
|
27
|
+
private listeners = new Set<() => void>()
|
|
28
|
+
private current: ListRefreshSnapshot = {
|
|
29
|
+
versions: new Map(),
|
|
30
|
+
results: new Map(),
|
|
31
|
+
}
|
|
32
|
+
private initial = this.current
|
|
33
|
+
|
|
34
|
+
subscribe = (listener: () => void) => {
|
|
35
|
+
this.listeners.add(listener)
|
|
36
|
+
return () => {
|
|
37
|
+
this.listeners.delete(listener)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
snapshot = () => this.current
|
|
41
|
+
serverSnapshot = () => this.initial
|
|
42
|
+
private emit() {
|
|
43
|
+
this.current = {
|
|
44
|
+
versions: new Map(this.versions),
|
|
45
|
+
results: new Map(this.results),
|
|
46
|
+
}
|
|
47
|
+
for (const listener of this.listeners) listener()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
rememberReturn(destination: string): string {
|
|
51
|
+
const token = crypto.randomUUID()
|
|
52
|
+
this.returns.set(token, destination)
|
|
53
|
+
return token
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
canReturn(token: string | null, destination: string): boolean {
|
|
57
|
+
return token !== null && this.returns.get(token) === destination
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
invalidate(path: string): void {
|
|
61
|
+
this.versions.set(path, (this.versions.get(path) ?? 0) + 1)
|
|
62
|
+
this.emit()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private key(path: string, variables: ListQueryVariables): string {
|
|
66
|
+
return JSON.stringify([
|
|
67
|
+
path,
|
|
68
|
+
variables.page,
|
|
69
|
+
variables.limit,
|
|
70
|
+
variables.filter,
|
|
71
|
+
variables.sort ?? null,
|
|
72
|
+
])
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
read(
|
|
76
|
+
path: string,
|
|
77
|
+
variables: ListQueryVariables,
|
|
78
|
+
initial: ListDataResult,
|
|
79
|
+
snapshot = this.current,
|
|
80
|
+
): RefreshResult {
|
|
81
|
+
const version = snapshot.versions.get(path) ?? 0
|
|
82
|
+
if (version === 0) return { kind: "ready", data: initial }
|
|
83
|
+
const entry = snapshot.results.get(this.key(path, variables))
|
|
84
|
+
return entry?.version === version && entry.sources.has(initial)
|
|
85
|
+
? entry.result
|
|
86
|
+
: { kind: "loading" }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async refresh(
|
|
90
|
+
path: string,
|
|
91
|
+
variables: ListQueryVariables,
|
|
92
|
+
initial: ListDataResult,
|
|
93
|
+
fetch: (variables: ListQueryVariables) => Promise<ListDataResult>,
|
|
94
|
+
snapshot = this.current,
|
|
95
|
+
): Promise<void> {
|
|
96
|
+
const version = snapshot.versions.get(path) ?? 0
|
|
97
|
+
if ((this.versions.get(path) ?? 0) !== version) return
|
|
98
|
+
const key = this.key(path, variables)
|
|
99
|
+
const previous = this.results.get(key)
|
|
100
|
+
if (previous?.version === version && previous.sources.has(initial)) return
|
|
101
|
+
const sources = new Set(previous?.sources)
|
|
102
|
+
sources.add(initial)
|
|
103
|
+
const pending: RefreshEntry = {
|
|
104
|
+
version,
|
|
105
|
+
sources,
|
|
106
|
+
result: { kind: "loading" },
|
|
107
|
+
}
|
|
108
|
+
if (version === 0) {
|
|
109
|
+
this.results.set(key, {
|
|
110
|
+
...pending,
|
|
111
|
+
result: { kind: "ready", data: initial },
|
|
112
|
+
})
|
|
113
|
+
this.emit()
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
// A new RSC payload can follow a write outside this List. Revalidate it
|
|
117
|
+
// rather than masking it with cached rows or trusting an older prefetch.
|
|
118
|
+
// Previously seen payloads (Back/Forward) keep the latest refreshed rows.
|
|
119
|
+
this.results.set(key, pending)
|
|
120
|
+
this.emit()
|
|
121
|
+
try {
|
|
122
|
+
const data = await fetch(variables)
|
|
123
|
+
if (
|
|
124
|
+
this.versions.get(path) !== version ||
|
|
125
|
+
this.results.get(key) !== pending
|
|
126
|
+
)
|
|
127
|
+
return
|
|
128
|
+
this.results.set(key, {
|
|
129
|
+
version,
|
|
130
|
+
sources,
|
|
131
|
+
result: { kind: "ready", data },
|
|
132
|
+
})
|
|
133
|
+
if (data.page !== variables.page) {
|
|
134
|
+
this.results.set(this.key(path, { ...variables, page: data.page }), {
|
|
135
|
+
version,
|
|
136
|
+
sources,
|
|
137
|
+
result: { kind: "ready", data },
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
} catch {
|
|
141
|
+
if (
|
|
142
|
+
this.versions.get(path) !== version ||
|
|
143
|
+
this.results.get(key) !== pending
|
|
144
|
+
)
|
|
145
|
+
return
|
|
146
|
+
this.results.set(key, { version, sources, result: { kind: "error" } })
|
|
147
|
+
}
|
|
148
|
+
this.emit()
|
|
12
149
|
}
|
|
13
150
|
}
|
|
14
151
|
|
|
15
|
-
|
|
152
|
+
/** Parse untrusted return URLs before navigating or invalidating List state. */
|
|
153
|
+
export function parseListReturnDestination(
|
|
154
|
+
returnTo: string | null,
|
|
155
|
+
origin: string,
|
|
156
|
+
) {
|
|
157
|
+
if (!returnTo?.startsWith("/lists/")) return null
|
|
16
158
|
try {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
159
|
+
const destination = new URL(returnTo, origin)
|
|
160
|
+
if (
|
|
161
|
+
destination.origin !== origin ||
|
|
162
|
+
!destination.pathname.startsWith("/lists/")
|
|
163
|
+
)
|
|
164
|
+
return null
|
|
165
|
+
return {
|
|
166
|
+
href: `${destination.pathname}${destination.search}`,
|
|
167
|
+
listPath: decodeURIComponent(destination.pathname).slice("/lists".length),
|
|
21
168
|
}
|
|
22
|
-
return isStale
|
|
23
169
|
} catch {
|
|
24
|
-
return
|
|
170
|
+
return null
|
|
25
171
|
}
|
|
26
172
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DateTimeDisplay } from "../../../../../modules/shadcn-components/src/lib/date-time-display.tsx"
|
|
2
|
+
|
|
3
|
+
/** ISO 8601 date pattern */
|
|
4
|
+
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Format a cell value for display.
|
|
8
|
+
* ISO calendar dates retain their day; ISO date/times represent instants.
|
|
9
|
+
*/
|
|
10
|
+
export function formatCellValue(value: unknown) {
|
|
11
|
+
if (value == null) return ""
|
|
12
|
+
if (typeof value === "string" && ISO_DATE_PATTERN.test(value)) {
|
|
13
|
+
return <DateTimeDisplay kind="timestamp" value={value} />
|
|
14
|
+
}
|
|
15
|
+
if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
16
|
+
return <DateTimeDisplay kind="calendar-date" value={value} />
|
|
17
|
+
}
|
|
18
|
+
return String(value)
|
|
19
|
+
}
|
|
@@ -7,13 +7,14 @@ import { flattenOrgUnits } from "@/lib/org-chart-data"
|
|
|
7
7
|
import { getDepthConfig } from "@/lib/org-chart-depth-config"
|
|
8
8
|
import { layoutOrgChart } from "@/lib/org-chart-layout"
|
|
9
9
|
|
|
10
|
+
// The authenticated layout can omit this page while checking the session.
|
|
11
|
+
export const instant = false
|
|
12
|
+
|
|
10
13
|
const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
|
|
11
14
|
// Fetch data with error handling - return empty state on error
|
|
12
15
|
const data = yield* fetchOrgChartDataEffect().pipe(
|
|
13
|
-
Effect.
|
|
14
|
-
// Log error for debugging
|
|
16
|
+
Effect.catch((error) => {
|
|
15
17
|
console.error("Failed to fetch org chart data:", error.message)
|
|
16
|
-
// Return empty data structure for graceful degradation
|
|
17
18
|
return Effect.succeed({
|
|
18
19
|
orgLevels: [],
|
|
19
20
|
org: {
|
|
@@ -26,7 +27,6 @@ const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
|
|
|
26
27
|
}),
|
|
27
28
|
)
|
|
28
29
|
|
|
29
|
-
// Handle empty data case
|
|
30
30
|
if (data.orgLevels.length === 0) {
|
|
31
31
|
return (
|
|
32
32
|
<div className="flex h-full flex-col">
|
|
@@ -45,21 +45,17 @@ const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
|
|
|
45
45
|
)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// Create mapping from level name to depth (maxDepth)
|
|
49
48
|
const levelToDepth = new Map(
|
|
50
49
|
data.orgLevels.map((level) => [level.level, level.maxDepth]),
|
|
51
50
|
)
|
|
52
51
|
|
|
53
|
-
// Flatten nested structure to flat array with parentId
|
|
54
52
|
// Type assertion is safe because the GraphQL type is structurally compatible with RecursiveOrgUnit
|
|
55
53
|
const flatOrgUnits = flattenOrgUnits(
|
|
56
54
|
data.org as Parameters<typeof flattenOrgUnits>[0],
|
|
57
55
|
)
|
|
58
56
|
|
|
59
|
-
// Layout the org chart
|
|
60
57
|
const { nodes, edges } = layoutOrgChart(flatOrgUnits)
|
|
61
58
|
|
|
62
|
-
// Enrich nodes with depth information from levelToDepth mapping
|
|
63
59
|
const enrichedNodes = nodes.map((node) => ({
|
|
64
60
|
...node,
|
|
65
61
|
data: {
|
|
@@ -68,7 +64,6 @@ const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
|
|
|
68
64
|
},
|
|
69
65
|
}))
|
|
70
66
|
|
|
71
|
-
// Create legend items from actual org levels
|
|
72
67
|
const legendItems = data.orgLevels
|
|
73
68
|
.sort((a, b) => a.maxDepth - b.maxDepth)
|
|
74
69
|
.map((level) => {
|
|
@@ -2,6 +2,10 @@ import ClientPage from "./client.tsx"
|
|
|
2
2
|
import { ExecutionCollectionProvider } from "@/lib/collections/execution-collection-provider"
|
|
3
3
|
import { ProcessCollectionProvider } from "@/lib/collections/process-collection-provider"
|
|
4
4
|
|
|
5
|
+
// The authenticated layout can omit children while redirecting or reissuing a
|
|
6
|
+
// session, so this page is not rendered in every instant-validation pass.
|
|
7
|
+
export const instant = false
|
|
8
|
+
|
|
5
9
|
export default function Page() {
|
|
6
10
|
return (
|
|
7
11
|
<ProcessCollectionProvider>
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use server"
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
HttpClient,
|
|
6
|
-
HttpClientRequest,
|
|
7
|
-
} from "@effect/platform"
|
|
8
|
-
import { Effect, Either, Schema } from "effect"
|
|
3
|
+
import { Effect, Exit, Schema } from "effect"
|
|
4
|
+
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http"
|
|
9
5
|
import { getIssuerUrl } from "@/lib/auth/issuer"
|
|
10
6
|
import {
|
|
11
7
|
PasskeyEnrollmentOptions,
|
|
@@ -54,7 +50,7 @@ function requestPasskeys<
|
|
|
54
50
|
}: {
|
|
55
51
|
method: "GET" | "PATCH" | "POST" | "DELETE"
|
|
56
52
|
body?: unknown
|
|
57
|
-
schema: Schema.
|
|
53
|
+
schema: Schema.Codec<A, I>
|
|
58
54
|
kind: K
|
|
59
55
|
message: string
|
|
60
56
|
statuses?: Readonly<Record<number, Failure | NoInfer<Extra>>>
|
|
@@ -73,12 +69,13 @@ function requestPasskeys<
|
|
|
73
69
|
if (response.status < 200 || response.status >= 300)
|
|
74
70
|
return statuses[response.status] ?? { kind: "error" as const, message }
|
|
75
71
|
const data = yield* response.json.pipe(
|
|
76
|
-
Effect.flatMap(Schema.
|
|
72
|
+
Effect.flatMap(Schema.decodeUnknownEffect(schema)),
|
|
77
73
|
)
|
|
78
74
|
return { kind, ...data }
|
|
79
75
|
}).pipe(
|
|
80
|
-
Effect.
|
|
76
|
+
Effect.catch(() => Effect.succeed({ kind: "error" as const, message })),
|
|
81
77
|
Effect.provide(FetchHttpClient.layer),
|
|
78
|
+
Effect.provideService(FetchHttpClient.Fetch, globalThis.fetch),
|
|
82
79
|
Effect.provideService(FetchHttpClient.RequestInit, {
|
|
83
80
|
cache: "no-store",
|
|
84
81
|
redirect: "error",
|
|
@@ -101,15 +98,15 @@ export async function listPasskeys(): Promise<Listed | Failure> {
|
|
|
101
98
|
}
|
|
102
99
|
|
|
103
100
|
export async function renamePasskey(input: unknown): Promise<Listed | Failure> {
|
|
104
|
-
const parsed = Schema.
|
|
105
|
-
if (
|
|
101
|
+
const parsed = Schema.decodeUnknownExit(RenamePasskey)(input)
|
|
102
|
+
if (Exit.isFailure(parsed)) return { kind: "error", message: nameError }
|
|
106
103
|
return requestPasskeys<
|
|
107
104
|
typeof PasskeyList.Type,
|
|
108
105
|
typeof PasskeyList.Encoded,
|
|
109
106
|
"success"
|
|
110
107
|
>({
|
|
111
108
|
method: "PATCH",
|
|
112
|
-
body: parsed.
|
|
109
|
+
body: parsed.value,
|
|
113
110
|
schema: PasskeyList,
|
|
114
111
|
kind: "success",
|
|
115
112
|
message: "Unable to rename this Passkey.",
|
|
@@ -120,15 +117,15 @@ export async function renamePasskey(input: unknown): Promise<Listed | Failure> {
|
|
|
120
117
|
export async function startPasskeyEnrollment(
|
|
121
118
|
input: unknown,
|
|
122
119
|
): Promise<Enrollment | Failure> {
|
|
123
|
-
const parsed = Schema.
|
|
124
|
-
if (
|
|
120
|
+
const parsed = Schema.decodeUnknownExit(StartPasskeyEnrollment)(input)
|
|
121
|
+
if (Exit.isFailure(parsed)) return { kind: "error", message: nameError }
|
|
125
122
|
return requestPasskeys<
|
|
126
123
|
typeof PasskeyEnrollmentOptions.Type,
|
|
127
124
|
typeof PasskeyEnrollmentOptions.Encoded,
|
|
128
125
|
"options"
|
|
129
126
|
>({
|
|
130
127
|
method: "POST",
|
|
131
|
-
body: parsed.
|
|
128
|
+
body: parsed.value,
|
|
132
129
|
schema: PasskeyEnrollmentOptions,
|
|
133
130
|
kind: "options",
|
|
134
131
|
message: "Unable to start Passkey registration.",
|
|
@@ -165,8 +162,8 @@ export async function verifyPasskeyEnrollment(
|
|
|
165
162
|
}
|
|
166
163
|
|
|
167
164
|
export async function removePasskey(input: unknown): Promise<Listed | Failure> {
|
|
168
|
-
const parsed = Schema.
|
|
169
|
-
if (
|
|
165
|
+
const parsed = Schema.decodeUnknownExit(RemovePasskey)(input)
|
|
166
|
+
if (Exit.isFailure(parsed))
|
|
170
167
|
return { kind: "error", message: "Unable to remove this Passkey." }
|
|
171
168
|
return requestPasskeys<
|
|
172
169
|
typeof PasskeyList.Type,
|
|
@@ -174,7 +171,7 @@ export async function removePasskey(input: unknown): Promise<Listed | Failure> {
|
|
|
174
171
|
"success"
|
|
175
172
|
>({
|
|
176
173
|
method: "DELETE",
|
|
177
|
-
body: parsed.
|
|
174
|
+
body: parsed.value,
|
|
178
175
|
schema: PasskeyList,
|
|
179
176
|
kind: "success",
|
|
180
177
|
message: "Unable to remove this Passkey.",
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Effect } from "effect"
|
|
2
|
+
import { DateTimeDisplayProvider } from "../../../../../modules/shadcn-components/src/lib/date-time-display.tsx"
|
|
2
3
|
import { listPasskeys } from "./actions.ts"
|
|
3
4
|
import { PasskeysClient } from "./passkeys-client.tsx"
|
|
4
5
|
import { BasePage } from "@/lib/effect/runtime"
|
|
5
6
|
|
|
7
|
+
// The authenticated layout can omit this page while checking the session.
|
|
8
|
+
export const instant = false
|
|
9
|
+
|
|
6
10
|
const Passkeys = BasePage.build(() =>
|
|
7
11
|
Effect.gen(function* () {
|
|
8
12
|
const result = yield* Effect.promise(() => listPasskeys())
|
|
@@ -18,12 +22,14 @@ const Passkeys = BasePage.build(() =>
|
|
|
18
22
|
{result.kind !== "success" ? (
|
|
19
23
|
<p role="alert">{result.message}</p>
|
|
20
24
|
) : (
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
<DateTimeDisplayProvider initialNow={Date.now()}>
|
|
26
|
+
<PasskeysClient
|
|
27
|
+
key={result.account.userId}
|
|
28
|
+
organisationName={result.organisation.name}
|
|
29
|
+
account={result.account}
|
|
30
|
+
initialCredentials={result.credentials}
|
|
31
|
+
/>
|
|
32
|
+
</DateTimeDisplayProvider>
|
|
27
33
|
)}
|
|
28
34
|
</div>
|
|
29
35
|
)
|