@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as path from "node:path"
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { Config, Context, Effect, Layer } from "effect"
|
|
2
|
+
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"
|
|
3
|
+
import { Config, Context, Effect, FileSystem, Layer } from "effect"
|
|
5
4
|
import { PolicyLoadError, SchemaLoadError } from "../../../auth-policy/src/index.ts"
|
|
6
5
|
import { PolicyWatcherService, makePolicyWatcherLayer } from "./policy-watcher.ts"
|
|
7
6
|
|
|
@@ -12,15 +11,13 @@ import { PolicyWatcherService, makePolicyWatcherLayer } from "./policy-watcher.t
|
|
|
12
11
|
* policiesText is an array to support merging default policies with
|
|
13
12
|
* custom org-specific policies.
|
|
14
13
|
*/
|
|
15
|
-
export class LocalCedarConfig extends Context.
|
|
16
|
-
"processfocus:internal-tag/auth-local-cedar/LocalCedarConfig",
|
|
17
|
-
)<
|
|
14
|
+
export class LocalCedarConfig extends Context.Service<
|
|
18
15
|
LocalCedarConfig,
|
|
19
16
|
{
|
|
20
17
|
readonly policiesText: readonly string[]
|
|
21
18
|
readonly schemaText: string
|
|
22
19
|
}
|
|
23
|
-
>() {}
|
|
20
|
+
>()("processfocus:internal-tag/auth-local-cedar/LocalCedarConfig") {}
|
|
24
21
|
|
|
25
22
|
/**
|
|
26
23
|
* Resolve the path to a file within a package.
|
|
@@ -29,13 +26,15 @@ export class LocalCedarConfig extends Context.Tag(
|
|
|
29
26
|
* Note: Uses indirect require.resolve via eval to prevent bundlers (Turbopack, etc.)
|
|
30
27
|
* from attempting static analysis on the dynamic package name.
|
|
31
28
|
*/
|
|
32
|
-
const resolvePackagePath = (
|
|
33
|
-
|
|
29
|
+
const resolvePackagePath = (
|
|
30
|
+
packageName: string,
|
|
31
|
+
relativePath: string,
|
|
32
|
+
packagedCedarRoot: string | undefined,
|
|
33
|
+
) => {
|
|
34
34
|
if (packageName === "processfocus:internal-tag/auth-policy" && packagedCedarRoot) {
|
|
35
35
|
return path.join(packagedCedarRoot, path.basename(relativePath))
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// Find the package.json location
|
|
39
38
|
// biome-ignore lint/security/noGlobalEval: Required to hide dynamic require.resolve from bundler static analysis
|
|
40
39
|
const packageJsonPath = eval(
|
|
41
40
|
`require.resolve("${packageName}/package.json")`,
|
|
@@ -57,14 +56,22 @@ export const DEFAULT_SCHEMA_PATH = "cedar/schema.cedarschema"
|
|
|
57
56
|
/**
|
|
58
57
|
* Get the resolved path to the default policies file
|
|
59
58
|
*/
|
|
60
|
-
export const getDefaultPoliciesPath = (
|
|
61
|
-
|
|
59
|
+
export const getDefaultPoliciesPath = (
|
|
60
|
+
packagedCedarRoot = process.env["PF_CEDAR_ROOT"],
|
|
61
|
+
) =>
|
|
62
|
+
resolvePackagePath(
|
|
63
|
+
"processfocus:internal-tag/auth-policy",
|
|
64
|
+
DEFAULT_POLICIES_PATH,
|
|
65
|
+
packagedCedarRoot,
|
|
66
|
+
)
|
|
62
67
|
|
|
63
68
|
/**
|
|
64
69
|
* Get the resolved path to the default schema file
|
|
65
70
|
*/
|
|
66
|
-
export const getDefaultSchemaPath = (
|
|
67
|
-
|
|
71
|
+
export const getDefaultSchemaPath = (
|
|
72
|
+
packagedCedarRoot = process.env["PF_CEDAR_ROOT"],
|
|
73
|
+
) =>
|
|
74
|
+
resolvePackagePath("processfocus:internal-tag/auth-policy", DEFAULT_SCHEMA_PATH, packagedCedarRoot)
|
|
68
75
|
|
|
69
76
|
/**
|
|
70
77
|
* Create a config layer from file paths.
|
|
@@ -112,7 +119,17 @@ export const localCedarConfigFromPaths = (
|
|
|
112
119
|
* which would fail in serverless environments where processfocus:internal-tag/auth-policy package.json isn't available.
|
|
113
120
|
*/
|
|
114
121
|
export const LocalCedarConfigDefault = () =>
|
|
115
|
-
|
|
122
|
+
Layer.unwrap(
|
|
123
|
+
Effect.gen(function* () {
|
|
124
|
+
const root = yield* Config.String("PF_CEDAR_ROOT").pipe(
|
|
125
|
+
Config.withDefault(""),
|
|
126
|
+
)
|
|
127
|
+
return localCedarConfigFromPaths(
|
|
128
|
+
getDefaultPoliciesPath(root),
|
|
129
|
+
getDefaultSchemaPath(root),
|
|
130
|
+
)
|
|
131
|
+
}),
|
|
132
|
+
)
|
|
116
133
|
|
|
117
134
|
/**
|
|
118
135
|
* Configuration layer that reads Cedar policies from a directory.
|
|
@@ -134,10 +151,10 @@ export const LocalCedarConfigFromEnvDir = Layer.provide(
|
|
|
134
151
|
Effect.gen(function* () {
|
|
135
152
|
const fs = yield* FileSystem.FileSystem
|
|
136
153
|
|
|
137
|
-
const policiesDir = yield* Config.
|
|
154
|
+
const policiesDir = yield* Config.String("CEDAR_PATH")
|
|
138
155
|
|
|
139
156
|
// List all .cedar and .cedarschema files in the directory
|
|
140
|
-
const dirEntries = yield* fs.readDirectory(policiesDir)
|
|
157
|
+
const dirEntries = (yield* fs.readDirectory(policiesDir)).sort()
|
|
141
158
|
const cedarFiles = dirEntries.filter((entry) => entry.endsWith(".cedar"))
|
|
142
159
|
const schemaFiles = dirEntries.filter((entry) =>
|
|
143
160
|
entry.endsWith(".cedarschema"),
|
|
@@ -150,7 +167,6 @@ export const LocalCedarConfigFromEnvDir = Layer.provide(
|
|
|
150
167
|
})
|
|
151
168
|
}
|
|
152
169
|
|
|
153
|
-
// Load all policy files
|
|
154
170
|
const policiesText = yield* Effect.forEach(cedarFiles, (file) => {
|
|
155
171
|
const fullPath = path.join(policiesDir, file)
|
|
156
172
|
return fs
|
|
@@ -162,7 +178,6 @@ export const LocalCedarConfigFromEnvDir = Layer.provide(
|
|
|
162
178
|
)
|
|
163
179
|
})
|
|
164
180
|
|
|
165
|
-
// Load all schema files from the same directory
|
|
166
181
|
const schemaTexts = yield* Effect.forEach(schemaFiles, (file) => {
|
|
167
182
|
const fullPath = path.join(policiesDir, file)
|
|
168
183
|
return fs
|
|
@@ -208,28 +223,34 @@ export const LocalCedarConfigStatic = (
|
|
|
208
223
|
LocalCedarConfig,
|
|
209
224
|
Effect.gen(function* () {
|
|
210
225
|
const fs = yield* FileSystem.FileSystem
|
|
226
|
+
const root = yield* Config.String("PF_CEDAR_ROOT").pipe(
|
|
227
|
+
Config.withDefault(""),
|
|
228
|
+
)
|
|
211
229
|
|
|
212
|
-
// Load default policies
|
|
213
230
|
const defaultPoliciesText = yield* fs
|
|
214
|
-
.readFileString(getDefaultPoliciesPath())
|
|
231
|
+
.readFileString(getDefaultPoliciesPath(root))
|
|
215
232
|
.pipe(
|
|
216
233
|
Effect.mapError(
|
|
217
234
|
(cause) =>
|
|
218
|
-
new PolicyLoadError({
|
|
235
|
+
new PolicyLoadError({
|
|
236
|
+
path: getDefaultPoliciesPath(root),
|
|
237
|
+
cause,
|
|
238
|
+
}),
|
|
219
239
|
),
|
|
220
240
|
)
|
|
221
241
|
|
|
222
|
-
// Load default schema
|
|
223
242
|
const defaultSchemaText = yield* fs
|
|
224
|
-
.readFileString(getDefaultSchemaPath())
|
|
243
|
+
.readFileString(getDefaultSchemaPath(root))
|
|
225
244
|
.pipe(
|
|
226
245
|
Effect.mapError(
|
|
227
246
|
(cause) =>
|
|
228
|
-
new SchemaLoadError({
|
|
247
|
+
new SchemaLoadError({
|
|
248
|
+
path: getDefaultSchemaPath(root),
|
|
249
|
+
cause,
|
|
250
|
+
}),
|
|
229
251
|
),
|
|
230
252
|
)
|
|
231
253
|
|
|
232
|
-
// Load custom policies if provided
|
|
233
254
|
const customPoliciesText = customPolicyPaths
|
|
234
255
|
? yield* Effect.forEach(customPolicyPaths, (policyPath) =>
|
|
235
256
|
fs
|
|
@@ -287,60 +308,75 @@ export const LocalCedarConfigHotReload = (
|
|
|
287
308
|
basePath: string,
|
|
288
309
|
customPolicyFiles: readonly string[],
|
|
289
310
|
customSchemaFiles?: readonly string[],
|
|
290
|
-
) =>
|
|
291
|
-
|
|
292
|
-
const resolvedCustomPaths = customPolicyFiles.map((f) =>
|
|
293
|
-
require("node:path").resolve(basePath, f),
|
|
294
|
-
)
|
|
295
|
-
|
|
296
|
-
// Combine default policy path with custom paths - all will be watched
|
|
297
|
-
const allPolicyPaths = [getDefaultPoliciesPath(), ...resolvedCustomPaths]
|
|
298
|
-
|
|
299
|
-
// Create watcher for all policy files (default + custom)
|
|
300
|
-
// Pass "/" as basePath since paths are already absolute
|
|
301
|
-
const policyWatcherLayer = makePolicyWatcherLayer("/", allPolicyPaths)
|
|
302
|
-
|
|
303
|
-
// Create config layer that gets policies from watcher and loads schema
|
|
304
|
-
const configLayer = Layer.effect(
|
|
305
|
-
LocalCedarConfig,
|
|
311
|
+
) =>
|
|
312
|
+
Layer.unwrap(
|
|
306
313
|
Effect.gen(function* () {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
.pipe(
|
|
315
|
-
Effect.mapError(
|
|
316
|
-
(cause) =>
|
|
317
|
-
new SchemaLoadError({ path: getDefaultSchemaPath(), cause }),
|
|
318
|
-
),
|
|
319
|
-
)
|
|
314
|
+
const root = yield* Config.String("PF_CEDAR_ROOT").pipe(
|
|
315
|
+
Config.withDefault(""),
|
|
316
|
+
)
|
|
317
|
+
// Resolve custom policy paths relative to basePath
|
|
318
|
+
const resolvedCustomPaths = customPolicyFiles.map((f) =>
|
|
319
|
+
require("node:path").resolve(basePath, f),
|
|
320
|
+
)
|
|
320
321
|
|
|
321
|
-
//
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
322
|
+
// Combine default policy path with custom paths - all will be watched
|
|
323
|
+
const allPolicyPaths = [
|
|
324
|
+
getDefaultPoliciesPath(root),
|
|
325
|
+
...resolvedCustomPaths,
|
|
326
|
+
]
|
|
327
|
+
|
|
328
|
+
// Create watcher for all policy files (default + custom)
|
|
329
|
+
// Pass "/" as basePath since paths are already absolute
|
|
330
|
+
const policyWatcherLayer = makePolicyWatcherLayer("/", allPolicyPaths)
|
|
331
|
+
|
|
332
|
+
// Create config layer that gets policies from watcher and loads schema
|
|
333
|
+
const configLayer = Layer.effect(
|
|
334
|
+
LocalCedarConfig,
|
|
335
|
+
Effect.gen(function* () {
|
|
336
|
+
const fs = yield* FileSystem.FileSystem
|
|
337
|
+
const watcher = yield* PolicyWatcherService
|
|
338
|
+
const policiesText = yield* watcher.currentPolicies
|
|
339
|
+
|
|
340
|
+
// Load default schema (not watched - schema changes are rare and require restart)
|
|
341
|
+
const defaultSchemaText = yield* fs
|
|
342
|
+
.readFileString(getDefaultSchemaPath(root))
|
|
343
|
+
.pipe(
|
|
344
|
+
Effect.mapError(
|
|
345
|
+
(cause) =>
|
|
346
|
+
new SchemaLoadError({
|
|
347
|
+
path: getDefaultSchemaPath(root),
|
|
348
|
+
cause,
|
|
349
|
+
}),
|
|
330
350
|
),
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
// Load custom schema files and concatenate with default schema
|
|
354
|
+
const customSchemaTexts = customSchemaFiles
|
|
355
|
+
? yield* Effect.forEach(customSchemaFiles, (schemaPath) =>
|
|
356
|
+
fs
|
|
357
|
+
.readFileString(schemaPath)
|
|
358
|
+
.pipe(
|
|
359
|
+
Effect.mapError(
|
|
360
|
+
(cause) =>
|
|
361
|
+
new SchemaLoadError({ path: schemaPath, cause }),
|
|
362
|
+
),
|
|
363
|
+
),
|
|
364
|
+
)
|
|
365
|
+
: []
|
|
366
|
+
|
|
367
|
+
// Concatenate schemas: different namespaces (e.g. PF and Org) can coexist in one string
|
|
368
|
+
const schemaText = [defaultSchemaText, ...customSchemaTexts].join(
|
|
369
|
+
"\n\n",
|
|
331
370
|
)
|
|
332
|
-
: []
|
|
333
371
|
|
|
334
|
-
|
|
335
|
-
|
|
372
|
+
return { policiesText, schemaText }
|
|
373
|
+
}),
|
|
374
|
+
).pipe(Layer.provide(NodeFileSystem.layer))
|
|
336
375
|
|
|
337
|
-
|
|
376
|
+
// Combine: ConfigLayer needs PolicyWatcherService, and we want to provide both
|
|
377
|
+
return Layer.provideMerge(
|
|
378
|
+
Layer.provide(configLayer, policyWatcherLayer),
|
|
379
|
+
policyWatcherLayer,
|
|
380
|
+
)
|
|
338
381
|
}),
|
|
339
|
-
).pipe(Layer.provide(NodeFileSystem.layer))
|
|
340
|
-
|
|
341
|
-
// Combine: ConfigLayer needs PolicyWatcherService, and we want to provide both
|
|
342
|
-
return Layer.provideMerge(
|
|
343
|
-
Layer.provide(configLayer, policyWatcherLayer),
|
|
344
|
-
policyWatcherLayer,
|
|
345
382
|
)
|
|
346
|
-
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { watch as watchFileSystem } from "node:fs"
|
|
2
2
|
import * as path from "node:path"
|
|
3
|
-
import
|
|
4
|
-
import { NodeFileSystem } from "@effect/platform-node"
|
|
3
|
+
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"
|
|
5
4
|
import {
|
|
6
5
|
Context,
|
|
7
6
|
Effect,
|
|
8
|
-
|
|
7
|
+
FileSystem,
|
|
9
8
|
Layer,
|
|
10
9
|
PubSub,
|
|
11
10
|
Ref,
|
|
12
|
-
|
|
11
|
+
Result,
|
|
13
12
|
Stream,
|
|
14
13
|
} from "effect"
|
|
15
14
|
import { PolicyLoadError } from "../../../auth-policy/src/index.ts"
|
|
@@ -34,9 +33,10 @@ export interface PolicyWatcher {
|
|
|
34
33
|
readonly currentPolicies: Effect.Effect<readonly string[]>
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
export class PolicyWatcherService extends Context.
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export class PolicyWatcherService extends Context.Service<
|
|
37
|
+
PolicyWatcherService,
|
|
38
|
+
PolicyWatcher
|
|
39
|
+
>()("processfocus:internal-tag/auth-local-cedar/PolicyWatcherService") {}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Create a layer that watches policy files and provides current policy text.
|
|
@@ -49,14 +49,13 @@ export const makePolicyWatcherLayer = (
|
|
|
49
49
|
policyFiles: readonly string[],
|
|
50
50
|
) =>
|
|
51
51
|
Layer.provide(
|
|
52
|
-
Layer.
|
|
52
|
+
Layer.effect(
|
|
53
53
|
PolicyWatcherService,
|
|
54
54
|
Effect.gen(function* () {
|
|
55
55
|
const fs = yield* FileSystem.FileSystem
|
|
56
56
|
const pubsub = yield* PubSub.unbounded<void>()
|
|
57
|
-
const runtime = yield* Effect.
|
|
57
|
+
const runtime = yield* Effect.context()
|
|
58
58
|
|
|
59
|
-
// Resolve absolute paths
|
|
60
59
|
const absolutePaths = policyFiles.map((f) => path.resolve(basePath, f))
|
|
61
60
|
|
|
62
61
|
// Group watched files by parent directory so file replacement saves
|
|
@@ -70,7 +69,6 @@ export const makePolicyWatcherLayer = (
|
|
|
70
69
|
watchedFilesByDirectory.set(directoryPath, watchedFiles)
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
// Read all policy files
|
|
74
72
|
const readPolicies = Effect.forEach(absolutePaths, (filePath) =>
|
|
75
73
|
fs
|
|
76
74
|
.readFileString(filePath)
|
|
@@ -81,7 +79,6 @@ export const makePolicyWatcherLayer = (
|
|
|
81
79
|
),
|
|
82
80
|
)
|
|
83
81
|
|
|
84
|
-
// Initial read
|
|
85
82
|
const initialPolicies = yield* readPolicies
|
|
86
83
|
const policiesRef = yield* Ref.make<readonly string[]>(initialPolicies)
|
|
87
84
|
|
|
@@ -93,17 +90,16 @@ export const makePolicyWatcherLayer = (
|
|
|
93
90
|
Effect.gen(function* () {
|
|
94
91
|
yield* Effect.log(`Cedar policy file changed: ${changedPath}`)
|
|
95
92
|
|
|
96
|
-
|
|
97
|
-
const reloadResult = yield* Effect.either(readPolicies)
|
|
93
|
+
const reloadResult = yield* Effect.result(readPolicies)
|
|
98
94
|
|
|
99
|
-
yield*
|
|
100
|
-
|
|
95
|
+
yield* Result.match(reloadResult, {
|
|
96
|
+
onSuccess: (policies) =>
|
|
101
97
|
Effect.gen(function* () {
|
|
102
98
|
yield* Ref.set(policiesRef, policies)
|
|
103
99
|
yield* PubSub.publish(pubsub, undefined)
|
|
104
100
|
yield* Effect.log("Cedar policies reloaded")
|
|
105
101
|
}),
|
|
106
|
-
|
|
102
|
+
onFailure: (error) =>
|
|
107
103
|
Effect.logWarning(
|
|
108
104
|
`Failed to reload Cedar policies, keeping previous valid policies: ${error}`,
|
|
109
105
|
),
|
|
@@ -134,7 +130,7 @@ export const makePolicyWatcherLayer = (
|
|
|
134
130
|
// Once the timer fires this reload is intentionally allowed to
|
|
135
131
|
// complete outside the watcher scope; pending timers are cleared
|
|
136
132
|
// by the finalizer before they get this far.
|
|
137
|
-
|
|
133
|
+
Effect.runForkWith(runtime)(reloadPolicies(changedPath))
|
|
138
134
|
}, 100),
|
|
139
135
|
)
|
|
140
136
|
}
|
|
@@ -2,6 +2,8 @@ import { Context, type Effect } from "effect"
|
|
|
2
2
|
import type { RequestTime } from "../../../request-time/src/index.ts"
|
|
3
3
|
import type { AuthorizationError } from "./errors.ts"
|
|
4
4
|
import type {
|
|
5
|
+
CompletionContext,
|
|
6
|
+
CronStartContext,
|
|
5
7
|
DelegationIssuanceContext,
|
|
6
8
|
DelegationPrincipalType,
|
|
7
9
|
ExecutionResource,
|
|
@@ -17,7 +19,6 @@ import type {
|
|
|
17
19
|
ServiceAccountPrincipal,
|
|
18
20
|
ServiceAccountPrincipalType,
|
|
19
21
|
StepResource,
|
|
20
|
-
TodoResource,
|
|
21
22
|
UserPrincipal,
|
|
22
23
|
} from "./types.ts"
|
|
23
24
|
|
|
@@ -26,11 +27,11 @@ import type {
|
|
|
26
27
|
* Provides policy-based access control using Cedar policies.
|
|
27
28
|
* All methods require RequestTime context for audit and time-based policies.
|
|
28
29
|
*/
|
|
29
|
-
export class AuthorizationService extends Context.
|
|
30
|
-
"processfocus:internal-tag/auth-policy/AuthorizationService",
|
|
31
|
-
)<
|
|
30
|
+
export class AuthorizationService extends Context.Service<
|
|
32
31
|
AuthorizationService,
|
|
33
32
|
{
|
|
33
|
+
/** Stable across processes; changes with the active schema/policies. Required for prepared authority. */
|
|
34
|
+
readonly policyVersion: Effect.Effect<string>
|
|
34
35
|
readonly canManageDelegation: (
|
|
35
36
|
principal: UserPrincipal | ServiceAccountPrincipalType,
|
|
36
37
|
delegation: DelegationPrincipalType,
|
|
@@ -55,21 +56,22 @@ export class AuthorizationService extends Context.Tag(
|
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* Check if the principal can complete a step.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
59
|
+
* Both process starts and existing work target their Step. Existing work
|
|
60
|
+
* supplies trusted instance context for assignment and public-link scoping.
|
|
60
61
|
*/
|
|
61
62
|
readonly canCompleteStep: (
|
|
62
|
-
principal:
|
|
63
|
+
principal:
|
|
64
|
+
| UserPrincipal
|
|
65
|
+
| ServiceAccountPrincipal
|
|
66
|
+
| PublicLinkPrincipalType,
|
|
63
67
|
resource: StepResource,
|
|
68
|
+
context?: CompletionContext | CronStartContext,
|
|
64
69
|
) => Effect.Effect<boolean, AuthorizationError, RequestTime>
|
|
65
70
|
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
* step role and direct-assignee context so Cedar owns active-work visibility.
|
|
69
|
-
*/
|
|
70
|
-
readonly canCompleteTodo: (
|
|
71
|
+
/** Read public start-form data without granting access to Todo state. */
|
|
72
|
+
readonly canViewEmbeddedForm: (
|
|
71
73
|
principal: UserPrincipal | ServiceAccountPrincipal,
|
|
72
|
-
resource:
|
|
74
|
+
resource: StepResource,
|
|
73
75
|
) => Effect.Effect<boolean, AuthorizationError, RequestTime>
|
|
74
76
|
|
|
75
77
|
/**
|
|
@@ -78,17 +80,8 @@ export class AuthorizationService extends Context.Tag(
|
|
|
78
80
|
*/
|
|
79
81
|
readonly canCorrectPublicCompletionTodo: (
|
|
80
82
|
principal: UserPrincipal,
|
|
81
|
-
resource:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Public todo capability tokens bind one public-link principal to the same
|
|
86
|
-
* todo resource. The default Cedar check is intentionally a policy-owned
|
|
87
|
-
* hook for future revocation/scoping rather than an extra token gate.
|
|
88
|
-
*/
|
|
89
|
-
readonly canCompletePublicTodo: (
|
|
90
|
-
principal: PublicLinkPrincipalType,
|
|
91
|
-
resource: TodoResource,
|
|
83
|
+
resource: StepResource,
|
|
84
|
+
context: CompletionContext,
|
|
92
85
|
) => Effect.Effect<boolean, AuthorizationError, RequestTime>
|
|
93
86
|
|
|
94
87
|
/**
|
|
@@ -101,16 +94,6 @@ export class AuthorizationService extends Context.Tag(
|
|
|
101
94
|
resource: RoleResource,
|
|
102
95
|
) => Effect.Effect<boolean, AuthorizationError, RequestTime>
|
|
103
96
|
|
|
104
|
-
/**
|
|
105
|
-
* Check if the principal can request permission to impersonate a provider user.
|
|
106
|
-
* Uses Cedar policy: principal == ServiceAccount::"..." and resource is PF::ProviderUser
|
|
107
|
-
* There is no default permit; organisations may explicitly grant access.
|
|
108
|
-
*/
|
|
109
|
-
readonly canRequestProviderUserPermissions: (
|
|
110
|
-
principal: ServiceAccountPrincipalType | DelegationPrincipalType,
|
|
111
|
-
resource: ProviderUserPrincipal,
|
|
112
|
-
) => Effect.Effect<boolean, AuthorizationError, RequestTime>
|
|
113
|
-
|
|
114
97
|
/**
|
|
115
98
|
* Check if the principal can act on behalf of a provider user.
|
|
116
99
|
* Custom policies grant this to selected users or service accounts.
|
|
@@ -124,7 +107,6 @@ export class AuthorizationService extends Context.Tag(
|
|
|
124
107
|
* Check if the principal can view an execution.
|
|
125
108
|
* Uses Cedar policies:
|
|
126
109
|
* - Provider users can view executions they started (principal == resource.startedBy)
|
|
127
|
-
* - Provider users can view executions in their org unit (resource in principal.orgUnit)
|
|
128
110
|
*/
|
|
129
111
|
readonly canViewExecution: (
|
|
130
112
|
principal: UserPrincipal | ServiceAccountPrincipalType,
|
|
@@ -243,7 +225,7 @@ export class AuthorizationService extends Context.Tag(
|
|
|
243
225
|
* File owners can always delete their own files.
|
|
244
226
|
*/
|
|
245
227
|
readonly canDeleteFile: (
|
|
246
|
-
principal: UserPrincipal,
|
|
228
|
+
principal: UserPrincipal | ServiceAccountPrincipalType,
|
|
247
229
|
resource: FileResource,
|
|
248
230
|
) => Effect.Effect<boolean, AuthorizationError, RequestTime>
|
|
249
231
|
|
|
@@ -260,4 +242,4 @@ export class AuthorizationService extends Context.Tag(
|
|
|
260
242
|
action: { type: string; id: string },
|
|
261
243
|
) => Effect.Effect<boolean, AuthorizationError, RequestTime>
|
|
262
244
|
}
|
|
263
|
-
>() {}
|
|
245
|
+
>()("processfocus:internal-tag/auth-policy/AuthorizationService") {}
|
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
import { Context, Effect
|
|
2
|
-
import type {
|
|
1
|
+
import { Context, type Effect } from "effect"
|
|
2
|
+
import type { ServiceAccountPrincipal, UserPrincipal } from "./types.ts"
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
/** Organisation-owned live grant for the project targeted by a deployment execution. */
|
|
5
|
+
export class DeploymentExecutionAccess extends Context.Service<
|
|
6
|
+
DeploymentExecutionAccess,
|
|
7
|
+
{
|
|
8
|
+
readonly permits: (
|
|
9
|
+
executionId: string,
|
|
10
|
+
clientId: string,
|
|
11
|
+
processPath: string,
|
|
12
|
+
) => Effect.Effect<boolean>
|
|
13
|
+
}
|
|
14
|
+
>()("processfocus:internal-tag/auth-policy/DeploymentExecutionAccess") {}
|
|
15
|
+
|
|
16
|
+
/** Live project/environment authorization before handing a workload an upload capability. */
|
|
17
|
+
export class WorkloadDatabaseUploadAccess extends Context.Service<
|
|
18
|
+
WorkloadDatabaseUploadAccess,
|
|
19
|
+
{
|
|
20
|
+
readonly permits: (
|
|
21
|
+
clientId: string,
|
|
22
|
+
project: string,
|
|
23
|
+
environment: string,
|
|
24
|
+
) => Effect.Effect<boolean>
|
|
25
|
+
}
|
|
26
|
+
>()("processfocus:internal-tag/auth-policy/WorkloadDatabaseUploadAccess") {}
|
|
27
|
+
|
|
28
|
+
/** Verified request actor; null represents unauthenticated or background work. */
|
|
29
|
+
export class CurrentPrincipal extends Context.Service<
|
|
30
|
+
CurrentPrincipal,
|
|
31
|
+
UserPrincipal | ServiceAccountPrincipal | null
|
|
32
|
+
>()("processfocus:internal-tag/auth-policy/CurrentPrincipal") {}
|
|
21
33
|
|
|
22
|
-
/**
|
|
23
|
-
* Helper to get the current principal from the FiberRef.
|
|
24
|
-
* Returns `null` for unauthenticated requests or service accounts.
|
|
25
|
-
*/
|
|
26
34
|
export const getCurrentPrincipal = (): Effect.Effect<
|
|
27
|
-
|
|
35
|
+
UserPrincipal | ServiceAccountPrincipal | null,
|
|
28
36
|
never,
|
|
29
37
|
CurrentPrincipal
|
|
30
|
-
> =>
|
|
31
|
-
Effect.gen(function* () {
|
|
32
|
-
const principalRef = yield* CurrentPrincipal
|
|
33
|
-
return yield* FiberRef.get(principalRef)
|
|
34
|
-
})
|
|
38
|
+
> => CurrentPrincipal
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context, Data, type Effect } from "effect"
|
|
2
|
+
|
|
3
|
+
export class PolicyRevisionUnavailable extends Data.TaggedError(
|
|
4
|
+
"PolicyRevisionUnavailable",
|
|
5
|
+
)<Record<never, never>> {}
|
|
6
|
+
|
|
7
|
+
/** Opaque activation identity. Reading it never initializes a policy engine. */
|
|
8
|
+
export class ActivePolicyRevision extends Context.Service<
|
|
9
|
+
ActivePolicyRevision,
|
|
10
|
+
{
|
|
11
|
+
readonly current: Effect.Effect<string, PolicyRevisionUnavailable>
|
|
12
|
+
}
|
|
13
|
+
>()("processfocus:internal-tag/auth-policy/ActivePolicyRevision") {}
|
|
14
|
+
|
|
15
|
+
/** Only the authorization runtime publishes successfully activated revisions. */
|
|
16
|
+
export class PolicyRevisionPublisher extends Context.Service<
|
|
17
|
+
PolicyRevisionPublisher,
|
|
18
|
+
{
|
|
19
|
+
readonly publish: (
|
|
20
|
+
revision: string,
|
|
21
|
+
) => Effect.Effect<void, PolicyRevisionUnavailable>
|
|
22
|
+
}
|
|
23
|
+
>()("processfocus:internal-tag/auth-policy/PolicyRevisionPublisher") {}
|