@processfocus/runtime-local 0.1.0-next.1 → 0.1.0-next.3
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 +48 -253
- package/dist/authentication-server.mjs +52 -84
- package/dist/{chunk-fn7b5pxw.js → chunk-04r0t2mb.js} +19364 -34104
- package/dist/chunk-727y6qkb.js +156 -0
- package/dist/chunk-bg5r4wpv.js +4755 -0
- package/dist/chunk-cbd36jq1.js +512 -0
- package/dist/chunk-d4ctj079.js +241 -0
- package/dist/{chunk-cq9xscgb.js → chunk-r5s2v669.js} +49079 -33564
- 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)/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 +153 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +10 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +29 -13
- 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/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 +11 -4
- 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 +47 -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 +4 -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 +112 -21
- 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/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/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 +169 -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 +38 -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 +900 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +42 -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 +193 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +237 -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 +48 -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 +272 -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 +48 -47
- package/dist/graphql-server.mjs +245 -200
- package/dist/job-worker-supervisor.mjs +262 -0
- package/dist/job-worker.mjs +234 -133
- package/dist/main.mjs +23 -4
- 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 +204 -51
- package/package.json +64 -62
- package/dist/chunk-6b6t8tyq.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
|
@@ -13,23 +13,24 @@ import {
|
|
|
13
13
|
getLoginErrorForAuthCallback,
|
|
14
14
|
} from "@/lib/auth/callback-error"
|
|
15
15
|
import { getAuthClient } from "@/lib/auth/client"
|
|
16
|
+
import { googleSso, readGoogleAttempt } from "@/lib/auth/google-revalidation"
|
|
16
17
|
import { readReauthenticationState } from "@/lib/auth/reauthentication-state"
|
|
17
|
-
import { validateRedirect } from "@/lib/auth/redirect"
|
|
18
|
+
import { getValidRedirect, validateRedirect } from "@/lib/auth/redirect"
|
|
18
19
|
import { getCookieNamesFromHost, setSessionCookies } from "@/lib/auth/session"
|
|
19
20
|
import { admitsNewSession } from "@/lib/auth/session-admission"
|
|
20
21
|
import { environmentUnavailableMessage } from "@/lib/auth/session-admission-message"
|
|
21
22
|
import { runEffect } from "@/lib/effect/run-effect"
|
|
22
23
|
import { CedarAuthorizationLayer } from "@/lib/effect/services"
|
|
24
|
+
import { finishMcpLogin } from "@/lib/mcp/oauth"
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Constant-time string comparison to prevent timing attacks
|
|
26
28
|
* Used for comparing security-sensitive values like CSRF tokens
|
|
27
29
|
*/
|
|
28
30
|
const constantTimeEqual = (a: string, b: string): boolean => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return timingSafeEqual(Buffer.from(a), Buffer.from(b))
|
|
31
|
+
const first = Buffer.from(a)
|
|
32
|
+
const second = Buffer.from(b)
|
|
33
|
+
return first.length === second.length && timingSafeEqual(first, second)
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export const GET = async (request: NextRequest) => {
|
|
@@ -38,8 +39,45 @@ export const GET = async (request: NextRequest) => {
|
|
|
38
39
|
const error = searchParams.get("error")
|
|
39
40
|
const errorDescription = searchParams.get("error_description")
|
|
40
41
|
const returnedState = searchParams.get("state")
|
|
42
|
+
const { oauthState: OS } = getCookieNamesFromHost(
|
|
43
|
+
request.headers.get("host") ?? "",
|
|
44
|
+
)
|
|
45
|
+
const stateCookie = request.cookies.get(OS)?.value
|
|
46
|
+
const googleAttempt = readGoogleAttempt(stateCookie)
|
|
47
|
+
const reauthentication = readReauthenticationState(stateCookie)
|
|
48
|
+
const storedState =
|
|
49
|
+
googleAttempt === undefined
|
|
50
|
+
? (reauthentication?.state ?? stateCookie)
|
|
51
|
+
: googleAttempt?.state
|
|
52
|
+
const validState =
|
|
53
|
+
returnedState &&
|
|
54
|
+
storedState &&
|
|
55
|
+
constantTimeEqual(returnedState, storedState)
|
|
56
|
+
|
|
57
|
+
const returnToLogin = (loginError?: string) => {
|
|
58
|
+
const loginUrl = new URL("/login", request.url)
|
|
59
|
+
if (loginError) loginUrl.searchParams.set("error", loginError)
|
|
60
|
+
if (googleAttempt) {
|
|
61
|
+
loginUrl.searchParams.set(
|
|
62
|
+
"redirect",
|
|
63
|
+
getValidRedirect(googleAttempt.destination),
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
const response = NextResponse.redirect(loginUrl)
|
|
67
|
+
if (googleAttempt) {
|
|
68
|
+
response.headers.set("cache-control", "no-store")
|
|
69
|
+
response.cookies.delete({ name: OS, path: "/api/auth/callback" })
|
|
70
|
+
}
|
|
71
|
+
return response
|
|
72
|
+
}
|
|
41
73
|
|
|
42
74
|
if (error || !code) {
|
|
75
|
+
if (googleAttempt) {
|
|
76
|
+
if (!validState) return returnToLogin("invalid_state")
|
|
77
|
+
return returnToLogin(
|
|
78
|
+
error === "interaction_required" ? undefined : "auth_failed",
|
|
79
|
+
)
|
|
80
|
+
}
|
|
43
81
|
console.error({
|
|
44
82
|
message: "Authentication failed",
|
|
45
83
|
error,
|
|
@@ -60,57 +98,34 @@ export const GET = async (request: NextRequest) => {
|
|
|
60
98
|
}
|
|
61
99
|
|
|
62
100
|
// CSRF Protection: Validate state parameter
|
|
63
|
-
|
|
64
|
-
request.headers.get("host") ?? "",
|
|
65
|
-
)
|
|
66
|
-
const stateCookie = request.cookies.get(OS)?.value
|
|
67
|
-
const reauthentication = readReauthenticationState(stateCookie)
|
|
68
|
-
const storedState = reauthentication?.state ?? stateCookie
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
!returnedState ||
|
|
72
|
-
!storedState ||
|
|
73
|
-
!constantTimeEqual(returnedState, storedState)
|
|
74
|
-
) {
|
|
101
|
+
if (!validState) {
|
|
75
102
|
console.warn({
|
|
76
103
|
message: "OAuth state mismatch - possible CSRF attack",
|
|
77
104
|
returnedState: returnedState ? "[present]" : "[missing]",
|
|
78
105
|
storedState: storedState ? "[present]" : "[missing]",
|
|
79
|
-
matches:
|
|
80
|
-
returnedState && storedState
|
|
81
|
-
? constantTimeEqual(returnedState, storedState)
|
|
82
|
-
: false,
|
|
106
|
+
matches: false,
|
|
83
107
|
})
|
|
84
|
-
return
|
|
85
|
-
new URL("/login?error=invalid_state", request.url),
|
|
86
|
-
)
|
|
108
|
+
return returnToLogin("invalid_state")
|
|
87
109
|
}
|
|
88
110
|
|
|
89
111
|
// Build the redirect URI exactly as it was during authorization
|
|
90
112
|
// Must include query params (like ?redirect=...) for OAuth exchange to match
|
|
91
113
|
const url = new URL(request.url)
|
|
92
114
|
const callbackUrl = new URL(`${url.protocol}//${url.host}/api/auth/callback`)
|
|
93
|
-
const redirectParam =
|
|
94
|
-
|
|
115
|
+
const redirectParam =
|
|
116
|
+
googleAttempt?.destination ?? searchParams.get("redirect")
|
|
117
|
+
if (redirectParam && !googleAttempt) {
|
|
95
118
|
callbackUrl.searchParams.set("redirect", redirectParam)
|
|
96
119
|
}
|
|
97
120
|
const redirectURI = callbackUrl.toString()
|
|
98
121
|
|
|
99
|
-
const authClient = getAuthClient()
|
|
100
|
-
const exchanged = await authClient.exchange(code, redirectURI)
|
|
101
|
-
|
|
102
|
-
if (exchanged.err) {
|
|
103
|
-
console.error({
|
|
104
|
-
message: "Exchange failed",
|
|
105
|
-
exchanged,
|
|
106
|
-
})
|
|
107
|
-
return NextResponse.redirect(
|
|
108
|
-
new URL("/login?error=exchange_failed", request.url),
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
122
|
try {
|
|
113
|
-
|
|
123
|
+
const authClient = getAuthClient()
|
|
124
|
+
const exchanged = await authClient.exchange(code, redirectURI)
|
|
125
|
+
if (exchanged.err) {
|
|
126
|
+
console.error({ message: "Exchange failed", exchanged })
|
|
127
|
+
return returnToLogin("exchange_failed")
|
|
128
|
+
}
|
|
114
129
|
const verified = await authClient.verify(
|
|
115
130
|
subjects,
|
|
116
131
|
exchanged.tokens.access,
|
|
@@ -131,17 +146,15 @@ export const GET = async (request: NextRequest) => {
|
|
|
131
146
|
? verified.err.url
|
|
132
147
|
: undefined,
|
|
133
148
|
})
|
|
134
|
-
return
|
|
135
|
-
new URL("/login?error=verification_failed", request.url),
|
|
136
|
-
)
|
|
149
|
+
return returnToLogin("verification_failed")
|
|
137
150
|
}
|
|
138
151
|
|
|
139
152
|
const session = verified.subject.properties
|
|
140
|
-
if ("delegation" in session)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
153
|
+
if ("delegation" in session) return returnToLogin("not_authorized")
|
|
154
|
+
// Independently bind the issued session to the signed Dashboard context.
|
|
155
|
+
// Authorization request parameters alone are not identity evidence.
|
|
156
|
+
if (googleAttempt && googleSso(session)?.subject !== googleAttempt.subject)
|
|
157
|
+
return returnToLogin("auth_failed")
|
|
145
158
|
|
|
146
159
|
if (reauthentication !== null) {
|
|
147
160
|
const prior = await authClient.verify(
|
|
@@ -169,7 +182,6 @@ export const GET = async (request: NextRequest) => {
|
|
|
169
182
|
}
|
|
170
183
|
}
|
|
171
184
|
|
|
172
|
-
// Check authorization using Cedar policies
|
|
173
185
|
const isProviderUser = "email" in session
|
|
174
186
|
const allowLogin = Effect.gen(function* () {
|
|
175
187
|
const auth = yield* AuthorizationService
|
|
@@ -184,7 +196,6 @@ export const GET = async (request: NextRequest) => {
|
|
|
184
196
|
},
|
|
185
197
|
)
|
|
186
198
|
|
|
187
|
-
// Check if user can login to frontend application
|
|
188
199
|
const canLogin = yield* auth.canLogin(
|
|
189
200
|
principal,
|
|
190
201
|
new Application("frontend"),
|
|
@@ -201,20 +212,24 @@ export const GET = async (request: NextRequest) => {
|
|
|
201
212
|
console.error({
|
|
202
213
|
message: "Authorization check failed",
|
|
203
214
|
error,
|
|
215
|
+
userId: session.userId,
|
|
216
|
+
email: isProviderUser ? session.email : undefined,
|
|
217
|
+
roles: session.roles,
|
|
204
218
|
})
|
|
205
|
-
return
|
|
219
|
+
return undefined
|
|
206
220
|
})
|
|
207
221
|
|
|
208
|
-
if (
|
|
222
|
+
if (authResult === false) {
|
|
209
223
|
console.warn({
|
|
210
224
|
message: "User denied access - no roles assigned",
|
|
211
225
|
userId: session.userId,
|
|
212
226
|
email: isProviderUser ? session.email : undefined,
|
|
213
227
|
roles: session.roles,
|
|
214
228
|
})
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (!authResult) {
|
|
232
|
+
return returnToLogin("not_authorized")
|
|
218
233
|
}
|
|
219
234
|
|
|
220
235
|
if (!(await admitsNewSession())) {
|
|
@@ -226,13 +241,9 @@ export const GET = async (request: NextRequest) => {
|
|
|
226
241
|
},
|
|
227
242
|
{ status: 503, headers: { "cache-control": "no-store" } },
|
|
228
243
|
)
|
|
229
|
-
return
|
|
230
|
-
new URL("/login?error=environment_unavailable", request.url),
|
|
231
|
-
)
|
|
244
|
+
return returnToLogin("environment_unavailable")
|
|
232
245
|
}
|
|
233
246
|
|
|
234
|
-
await setSessionCookies(exchanged.tokens)
|
|
235
|
-
|
|
236
247
|
// Get redirect URL from query params (passed through OAuth flow)
|
|
237
248
|
// redirectParam was already extracted above for OAuth exchange
|
|
238
249
|
const { url: redirect, rejected, reason } = validateRedirect(redirectParam)
|
|
@@ -246,15 +257,22 @@ export const GET = async (request: NextRequest) => {
|
|
|
246
257
|
})
|
|
247
258
|
}
|
|
248
259
|
|
|
260
|
+
const mcp =
|
|
261
|
+
reauthentication === null && !googleAttempt
|
|
262
|
+
? await finishMcpLogin(request, redirect, exchanged.tokens)
|
|
263
|
+
: undefined
|
|
264
|
+
if (!mcp) await setSessionCookies(exchanged.tokens, session)
|
|
265
|
+
|
|
249
266
|
// Clear the OAuth state cookie after successful validation
|
|
250
267
|
const response =
|
|
251
|
-
|
|
268
|
+
mcp ??
|
|
269
|
+
(reauthentication !== null &&
|
|
252
270
|
request.headers.get("accept") === "application/json"
|
|
253
271
|
? NextResponse.json(
|
|
254
272
|
{ success: true },
|
|
255
273
|
{ headers: { "cache-control": "no-store" } },
|
|
256
274
|
)
|
|
257
|
-
: NextResponse.redirect(new URL(redirect, request.url))
|
|
275
|
+
: NextResponse.redirect(new URL(redirect, request.url)))
|
|
258
276
|
response.cookies.delete({
|
|
259
277
|
name: OS,
|
|
260
278
|
path: "/api/auth/callback",
|
|
@@ -268,8 +286,6 @@ export const GET = async (request: NextRequest) => {
|
|
|
268
286
|
errorName: error instanceof Error ? error.name : undefined,
|
|
269
287
|
errorMessage: error instanceof Error ? error.message : String(error),
|
|
270
288
|
})
|
|
271
|
-
return
|
|
272
|
-
new URL("/login?error=verification_failed", request.url),
|
|
273
|
-
)
|
|
289
|
+
return returnToLogin("verification_failed")
|
|
274
290
|
}
|
|
275
291
|
}
|
|
@@ -9,8 +9,14 @@ import { admitsNewSession } from "@/lib/auth/session-admission"
|
|
|
9
9
|
const Tokens = Schema.Struct({
|
|
10
10
|
access_token: Schema.NonEmptyString,
|
|
11
11
|
refresh_token: Schema.NonEmptyString,
|
|
12
|
-
expires_in: Schema.Number.pipe(
|
|
13
|
-
|
|
12
|
+
expires_in: Schema.Number.pipe(
|
|
13
|
+
Schema.check(Schema.isGreaterThan(0)),
|
|
14
|
+
Schema.check(Schema.isFinite()),
|
|
15
|
+
),
|
|
16
|
+
refresh_expires_in: Schema.Number.pipe(
|
|
17
|
+
Schema.check(Schema.isGreaterThan(0)),
|
|
18
|
+
Schema.check(Schema.isFinite()),
|
|
19
|
+
),
|
|
14
20
|
})
|
|
15
21
|
const respond = (success: boolean, status: number) =>
|
|
16
22
|
Response.json(
|
|
@@ -9,7 +9,6 @@ import { getCookieNamesFromHost } from "@/lib/auth/session"
|
|
|
9
9
|
export const POST = async (request: NextRequest) => {
|
|
10
10
|
const url = new URL(request.url)
|
|
11
11
|
|
|
12
|
-
// Extract provider and redirect from request body
|
|
13
12
|
const body = (await request.json().catch(() => ({}))) as {
|
|
14
13
|
provider?: string
|
|
15
14
|
redirect?: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cookies, headers } from "next/headers"
|
|
2
2
|
import { type NextRequest, NextResponse } from "next/server"
|
|
3
|
-
import {
|
|
3
|
+
import { getIssuerUrl } from "@/lib/auth/client"
|
|
4
4
|
import { clearSession, getCookieNamesFromHost } from "@/lib/auth/session"
|
|
5
5
|
|
|
6
6
|
const performLogout = async () => {
|
|
@@ -10,10 +10,15 @@ const performLogout = async () => {
|
|
|
10
10
|
const refreshToken = cookieStore.get(RT)?.value
|
|
11
11
|
|
|
12
12
|
if (refreshToken) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
try {
|
|
14
|
+
const response = await fetch(`${getIssuerUrl()}/oauth/logout`, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
body: new URLSearchParams({ token: refreshToken }),
|
|
17
|
+
})
|
|
18
|
+
if (!response.ok) console.error("Server logout request failed")
|
|
19
|
+
} catch {
|
|
20
|
+
console.error("Server logout request failed")
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
await clearSession()
|
|
@@ -46,11 +46,10 @@ export const POST = async (request: NextRequest) => {
|
|
|
46
46
|
try {
|
|
47
47
|
const url = new URL(request.url)
|
|
48
48
|
|
|
49
|
-
// Extract redirect from request body
|
|
50
49
|
const body = Schema.decodeUnknownSync(
|
|
51
50
|
Schema.Struct({
|
|
52
51
|
redirect: Schema.optional(Schema.String),
|
|
53
|
-
purpose: Schema.optional(Schema.
|
|
52
|
+
purpose: Schema.optional(Schema.Literals(["signin", "reauthenticate"])),
|
|
54
53
|
}),
|
|
55
54
|
)(await request.json())
|
|
56
55
|
const prior =
|
|
@@ -98,7 +97,6 @@ export const POST = async (request: NextRequest) => {
|
|
|
98
97
|
redirect: "manual", // Don't follow redirects - we just want the cookies
|
|
99
98
|
})
|
|
100
99
|
|
|
101
|
-
// Create response
|
|
102
100
|
const response = NextResponse.json({ success: true })
|
|
103
101
|
const { oauthState: OS, passkeyAuthCookies: PAC } = getCookieNamesFromHost(
|
|
104
102
|
request.headers.get("host") ?? "",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type NextRequest, NextResponse } from "next/server"
|
|
2
|
+
import { getAuthClient } from "@/lib/auth/client"
|
|
3
|
+
import {
|
|
4
|
+
expiredGoogleIdentity,
|
|
5
|
+
googleRevalidationAttemptMaxAge,
|
|
6
|
+
isDocumentNavigation,
|
|
7
|
+
sealGoogleAttempt,
|
|
8
|
+
} from "@/lib/auth/google-revalidation"
|
|
9
|
+
import { getValidRedirect } from "@/lib/auth/redirect"
|
|
10
|
+
import {
|
|
11
|
+
getCookieNamesFromHost,
|
|
12
|
+
getRefreshTokenCookieOptions,
|
|
13
|
+
} from "@/lib/auth/session"
|
|
14
|
+
|
|
15
|
+
export async function GET(request: NextRequest): Promise<NextResponse> {
|
|
16
|
+
const destination = getValidRedirect(
|
|
17
|
+
request.nextUrl.searchParams.get("redirect"),
|
|
18
|
+
)
|
|
19
|
+
const login = new URL("/login", request.url)
|
|
20
|
+
login.searchParams.set("redirect", destination)
|
|
21
|
+
const headers = {
|
|
22
|
+
"cache-control": "no-store",
|
|
23
|
+
"referrer-policy": "no-referrer",
|
|
24
|
+
}
|
|
25
|
+
if (!isDocumentNavigation(request))
|
|
26
|
+
return new NextResponse(null, { status: 400, headers })
|
|
27
|
+
|
|
28
|
+
const names = getCookieNamesFromHost(request.headers.get("host") ?? "")
|
|
29
|
+
const prior = expiredGoogleIdentity(
|
|
30
|
+
request.cookies.get(names.googleRevalidation)?.value,
|
|
31
|
+
)
|
|
32
|
+
if (!prior) return NextResponse.redirect(login, { headers })
|
|
33
|
+
|
|
34
|
+
let response: NextResponse
|
|
35
|
+
try {
|
|
36
|
+
const callback = new URL("/api/auth/callback", request.url)
|
|
37
|
+
const { url, challenge } = await getAuthClient().authorize(
|
|
38
|
+
callback.toString(),
|
|
39
|
+
"code",
|
|
40
|
+
{
|
|
41
|
+
pkce: false,
|
|
42
|
+
provider: "google",
|
|
43
|
+
googleRevalidationSubject: prior.subject,
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
response = NextResponse.redirect(url, { headers })
|
|
47
|
+
response.cookies.set(
|
|
48
|
+
names.oauthState,
|
|
49
|
+
sealGoogleAttempt({
|
|
50
|
+
subject: prior.subject,
|
|
51
|
+
state: challenge.state,
|
|
52
|
+
destination,
|
|
53
|
+
}),
|
|
54
|
+
{
|
|
55
|
+
...getRefreshTokenCookieOptions(googleRevalidationAttemptMaxAge),
|
|
56
|
+
path: callback.pathname,
|
|
57
|
+
},
|
|
58
|
+
)
|
|
59
|
+
} catch {
|
|
60
|
+
login.searchParams.set("error", "auth_failed")
|
|
61
|
+
response = NextResponse.redirect(login, { headers })
|
|
62
|
+
}
|
|
63
|
+
// Consume the hint before leaving PF, so an error or Back cannot start a loop.
|
|
64
|
+
response.cookies.delete(names.googleRevalidation)
|
|
65
|
+
response.cookies.delete(names.accessToken)
|
|
66
|
+
response.cookies.delete(names.refreshToken)
|
|
67
|
+
return response
|
|
68
|
+
}
|
|
@@ -143,12 +143,11 @@ export async function POST(
|
|
|
143
143
|
})
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
// Update cookies with new tokens
|
|
147
146
|
await setTokenCookies(
|
|
148
147
|
cookieStore,
|
|
149
148
|
{
|
|
150
149
|
access: result.tokens.access,
|
|
151
|
-
refresh: result.tokens.refresh,
|
|
150
|
+
...(result.tokens.refresh ? { refresh: result.tokens.refresh } : {}),
|
|
152
151
|
expiresIn: result.tokens.expiresIn,
|
|
153
152
|
...(result.tokens.refreshExpiresIn !== undefined && {
|
|
154
153
|
refreshExpiresIn: result.tokens.refreshExpiresIn,
|
|
@@ -157,7 +156,6 @@ export async function POST(
|
|
|
157
156
|
cookieNames,
|
|
158
157
|
)
|
|
159
158
|
|
|
160
|
-
// Calculate expiry timestamp
|
|
161
159
|
const expiresAt = Math.floor(Date.now() / 1000) + result.tokens.expiresIn
|
|
162
160
|
|
|
163
161
|
return NextResponse.json(
|
|
@@ -2,7 +2,6 @@ import { ClientError } from "graphql-request"
|
|
|
2
2
|
import { type NextRequest, NextResponse } from "next/server"
|
|
3
3
|
import { getFrontendJwt } from "../../../../../../modules/auth-session/src/index.ts"
|
|
4
4
|
import type { CalendarSlotItem, LookupSuggestion } from "../../../../../../modules/form/src/index.ts"
|
|
5
|
-
import { FormComponentType } from "../../../../../../modules/form-client-representation/src/lib/types.ts"
|
|
6
5
|
import {
|
|
7
6
|
findEmbedLookupDefinitionByField,
|
|
8
7
|
findEmbedLookupDefinitionByQueryName,
|
|
@@ -19,6 +18,7 @@ interface EmbedLookupBody {
|
|
|
19
18
|
readonly limit?: unknown
|
|
20
19
|
readonly queryName?: unknown
|
|
21
20
|
readonly input?: unknown
|
|
21
|
+
readonly selectedValue?: unknown
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const LOOKUP_SUGGESTIONS_QUERY = `
|
|
@@ -26,6 +26,7 @@ const LOOKUP_SUGGESTIONS_QUERY = `
|
|
|
26
26
|
lookupSuggestions(stepPath: $stepPath, field: $field, filter: $filter, limit: $limit) {
|
|
27
27
|
value
|
|
28
28
|
label
|
|
29
|
+
searchText
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
`
|
|
@@ -41,6 +42,12 @@ const CALENDAR_SLOTS_QUERY = `
|
|
|
41
42
|
}
|
|
42
43
|
`
|
|
43
44
|
|
|
45
|
+
const LOOKUP_SELECTION_QUERY = `
|
|
46
|
+
query LookupSelection($stepPath: String!, $field: String!, $value: String!) {
|
|
47
|
+
lookupSelection(stepPath: $stepPath, field: $field, value: $value) { value label }
|
|
48
|
+
}
|
|
49
|
+
`
|
|
50
|
+
|
|
44
51
|
const DEFAULT_LOOKUP_LIMIT = 20
|
|
45
52
|
const MAX_LOOKUP_LIMIT = 100
|
|
46
53
|
const LOOKUP_FAILURE_MESSAGE =
|
|
@@ -98,6 +105,7 @@ const buildDependentLookupQuery = (
|
|
|
98
105
|
${queryName}(input: { ${inputFields} }, limit: $limit) {
|
|
99
106
|
value
|
|
100
107
|
label
|
|
108
|
+
searchText
|
|
101
109
|
}
|
|
102
110
|
}
|
|
103
111
|
`
|
|
@@ -147,10 +155,7 @@ export const POST = async (request: NextRequest): Promise<Response> => {
|
|
|
147
155
|
try {
|
|
148
156
|
if (typeof body?.field === "string") {
|
|
149
157
|
const filter = typeof body?.filter === "string" ? body.filter : ""
|
|
150
|
-
const lookup = findEmbedLookupDefinitionByField(
|
|
151
|
-
entry.formDefinition,
|
|
152
|
-
body.field,
|
|
153
|
-
)
|
|
158
|
+
const lookup = findEmbedLookupDefinitionByField(entry.lookups, body.field)
|
|
154
159
|
|
|
155
160
|
if (!lookup) {
|
|
156
161
|
return NextResponse.json(
|
|
@@ -159,7 +164,7 @@ export const POST = async (request: NextRequest): Promise<Response> => {
|
|
|
159
164
|
)
|
|
160
165
|
}
|
|
161
166
|
|
|
162
|
-
if (lookup.type ===
|
|
167
|
+
if (lookup.type === "calendarSlot") {
|
|
163
168
|
const data = await client.request<{
|
|
164
169
|
calendarSlots: CalendarSlotItem[]
|
|
165
170
|
}>(CALENDAR_SLOTS_QUERY, {
|
|
@@ -170,6 +175,19 @@ export const POST = async (request: NextRequest): Promise<Response> => {
|
|
|
170
175
|
return NextResponse.json({ items: data.calendarSlots })
|
|
171
176
|
}
|
|
172
177
|
|
|
178
|
+
if (typeof body.selectedValue === "string") {
|
|
179
|
+
const data = await client.request<{
|
|
180
|
+
lookupSelection: LookupSuggestion | null
|
|
181
|
+
}>(LOOKUP_SELECTION_QUERY, {
|
|
182
|
+
stepPath,
|
|
183
|
+
field: body.field,
|
|
184
|
+
value: body.selectedValue,
|
|
185
|
+
})
|
|
186
|
+
return NextResponse.json({
|
|
187
|
+
items: data.lookupSelection ? [data.lookupSelection] : [],
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
|
|
173
191
|
const data = await client.request<{
|
|
174
192
|
lookupSuggestions: LookupSuggestion[]
|
|
175
193
|
}>(LOOKUP_SUGGESTIONS_QUERY, {
|
|
@@ -190,7 +208,7 @@ export const POST = async (request: NextRequest): Promise<Response> => {
|
|
|
190
208
|
}
|
|
191
209
|
|
|
192
210
|
const lookup = findEmbedLookupDefinitionByQueryName(
|
|
193
|
-
entry.
|
|
211
|
+
entry.lookups,
|
|
194
212
|
body.queryName,
|
|
195
213
|
)
|
|
196
214
|
if (!lookup) {
|
|
@@ -61,8 +61,7 @@ export const POST = async (request: NextRequest) => {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const client = createServerGraphqlClient(frontendJwt)
|
|
64
|
-
const hasInput =
|
|
65
|
-
entry.inputTypeName.length > 0 && Object.keys(values).length > 0
|
|
64
|
+
const hasInput = entry.inputTypeName.length > 0
|
|
66
65
|
const mutation = hasInput
|
|
67
66
|
? `
|
|
68
67
|
mutation SubmitEmbeddedForm($input: ${entry.inputTypeName}!) {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { NextResponse } from "next/server"
|
|
2
|
+
import {
|
|
3
|
+
lookupAnonymousPage,
|
|
4
|
+
submitAnonymousPage,
|
|
5
|
+
} from "@/lib/anonymous-page-server"
|
|
6
|
+
import { publicTodoFieldErrorsFromGraphqlError } from "@/lib/public-todo-server"
|
|
7
|
+
|
|
8
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
9
|
+
typeof value === "object" && value !== null && !Array.isArray(value)
|
|
10
|
+
|
|
11
|
+
export async function POST(
|
|
12
|
+
request: Request,
|
|
13
|
+
context: { params: Promise<{ address: string }> },
|
|
14
|
+
): Promise<Response> {
|
|
15
|
+
const { address } = await context.params
|
|
16
|
+
const body: unknown = await request.json().catch(() => null)
|
|
17
|
+
if (!isRecord(body))
|
|
18
|
+
return NextResponse.json({ error: "Invalid request." }, { status: 400 })
|
|
19
|
+
try {
|
|
20
|
+
if (body["action"] === "lookup" && typeof body["field"] === "string") {
|
|
21
|
+
const items = await lookupAnonymousPage({
|
|
22
|
+
address,
|
|
23
|
+
field: body["field"],
|
|
24
|
+
...(typeof body["selectedValue"] === "string" && {
|
|
25
|
+
selectedValue: body["selectedValue"],
|
|
26
|
+
}),
|
|
27
|
+
filter: typeof body["filter"] === "string" ? body["filter"] : "",
|
|
28
|
+
limit:
|
|
29
|
+
typeof body["limit"] === "number" && Number.isFinite(body["limit"])
|
|
30
|
+
? Math.trunc(body["limit"])
|
|
31
|
+
: 20,
|
|
32
|
+
})
|
|
33
|
+
return NextResponse.json({ items })
|
|
34
|
+
}
|
|
35
|
+
if (body["action"] === "submit" && isRecord(body["values"])) {
|
|
36
|
+
await submitAnonymousPage(address, body["values"])
|
|
37
|
+
return NextResponse.json({ submitted: true })
|
|
38
|
+
}
|
|
39
|
+
return NextResponse.json({ error: "Invalid request." }, { status: 400 })
|
|
40
|
+
} catch (error) {
|
|
41
|
+
const errors = publicTodoFieldErrorsFromGraphqlError(error)
|
|
42
|
+
return NextResponse.json(
|
|
43
|
+
errors
|
|
44
|
+
? { errors }
|
|
45
|
+
: { error: "Unable to use this form. Please try again." },
|
|
46
|
+
{ status: 400 },
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -17,18 +17,18 @@ export async function POST(request: Request): Promise<NextResponse> {
|
|
|
17
17
|
)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const { token, field, filter, limit } = payload
|
|
20
|
+
const { token, field, filter, limit, selectedValue } = payload
|
|
21
21
|
if (
|
|
22
22
|
typeof token !== "string" ||
|
|
23
23
|
typeof field !== "string" ||
|
|
24
|
+
(selectedValue !== undefined && typeof selectedValue !== "string") ||
|
|
24
25
|
(filter !== undefined && filter !== null && typeof filter !== "string") ||
|
|
25
26
|
(limit !== undefined &&
|
|
26
27
|
limit !== null &&
|
|
27
28
|
(typeof limit !== "number" ||
|
|
28
29
|
!Number.isFinite(limit) ||
|
|
29
30
|
!Number.isInteger(limit) ||
|
|
30
|
-
limit < 0
|
|
31
|
-
limit > 100))
|
|
31
|
+
limit < 0))
|
|
32
32
|
) {
|
|
33
33
|
return NextResponse.json(
|
|
34
34
|
{ error: "Invalid public form lookup payload." },
|
|
@@ -41,6 +41,7 @@ export async function POST(request: Request): Promise<NextResponse> {
|
|
|
41
41
|
field,
|
|
42
42
|
filter ?? null,
|
|
43
43
|
limit ?? null,
|
|
44
|
+
selectedValue,
|
|
44
45
|
)
|
|
45
46
|
|
|
46
47
|
return NextResponse.json({ items })
|
|
@@ -2,7 +2,7 @@ import { revalidatePath, revalidateTag } from "next/cache"
|
|
|
2
2
|
import { type NextRequest, NextResponse } from "next/server"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* On-demand revalidation for the local Next.js runtime.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
* POST /api/revalidate
|
|
@@ -11,6 +11,7 @@ import { type NextRequest, NextResponse } from "next/server"
|
|
|
11
11
|
* Body: { path: "/login", tag: "login-page", secret: "your-secret" }
|
|
12
12
|
*
|
|
13
13
|
* REVALIDATE_SECRET must be configured; requests are rejected when it is absent.
|
|
14
|
+
* Hosted OpenNext disables tag/path invalidation and returns 501 after auth.
|
|
14
15
|
*/
|
|
15
16
|
export const POST = async (request: NextRequest) => {
|
|
16
17
|
try {
|
|
@@ -29,7 +30,6 @@ export const POST = async (request: NextRequest) => {
|
|
|
29
30
|
return NextResponse.json({ message: "Invalid secret" }, { status: 401 })
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
// Validate that at least one of path or tag is provided
|
|
33
33
|
const hasPath = path && typeof path === "string"
|
|
34
34
|
const hasTag = tag && typeof tag === "string"
|
|
35
35
|
if (!hasPath && !hasTag) {
|
|
@@ -39,8 +39,19 @@ export const POST = async (request: NextRequest) => {
|
|
|
39
39
|
)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if (process.env["AWS_LAMBDA_FUNCTION_NAME"]) {
|
|
43
|
+
return NextResponse.json(
|
|
44
|
+
{
|
|
45
|
+
revalidated: false,
|
|
46
|
+
message:
|
|
47
|
+
"On-demand revalidation is unavailable in the hosted runtime",
|
|
48
|
+
},
|
|
49
|
+
{ status: 501 },
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Local Cedar hot reload must expire the old policy on the next request.
|
|
54
|
+
if (hasTag) revalidateTag(tag, { expire: 0 })
|
|
44
55
|
if (hasPath) revalidatePath(path)
|
|
45
56
|
|
|
46
57
|
return NextResponse.json({
|