@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
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
require_assertString,
|
|
4
|
+
require_checkHost,
|
|
5
|
+
require_merge,
|
|
6
|
+
require_isFQDN,
|
|
7
|
+
require_isIP,
|
|
8
|
+
require_isEmail
|
|
9
|
+
} from "./chunk-wvbz0nmd.js";
|
|
10
|
+
import {
|
|
11
|
+
__toESM,
|
|
12
|
+
__commonJS
|
|
13
|
+
} from "./chunk-2sb4v2sx.js";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var require_includesString = __commonJS(function(exports, module) {
|
|
17
|
+
Object.defineProperty(exports, "__esModule", {
|
|
18
|
+
value: true
|
|
19
|
+
});
|
|
20
|
+
exports.default = undefined;
|
|
21
|
+
var includes = function includes(str, val) {
|
|
22
|
+
return str.indexOf(val) !== -1;
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = includes;
|
|
25
|
+
module.exports = exports.default;
|
|
26
|
+
module.exports.default = exports.default;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var require_isURL = __commonJS(function(exports, module) {
|
|
31
|
+
Object.defineProperty(exports, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
});
|
|
34
|
+
exports.default = isURL;
|
|
35
|
+
var _assertString = _interopRequireDefault(require_assertString());
|
|
36
|
+
var _checkHost = _interopRequireDefault(require_checkHost());
|
|
37
|
+
var _includesString = _interopRequireDefault(require_includesString());
|
|
38
|
+
var _isFQDN = _interopRequireDefault(require_isFQDN());
|
|
39
|
+
var _isIP = _interopRequireDefault(require_isIP());
|
|
40
|
+
var _merge = _interopRequireDefault(require_merge());
|
|
41
|
+
function _interopRequireDefault(e) {
|
|
42
|
+
return e && e.__esModule ? e : { default: e };
|
|
43
|
+
}
|
|
44
|
+
function _slicedToArray(r, e) {
|
|
45
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
46
|
+
}
|
|
47
|
+
function _nonIterableRest() {
|
|
48
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
49
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
50
|
+
}
|
|
51
|
+
function _unsupportedIterableToArray(r, a) {
|
|
52
|
+
if (r) {
|
|
53
|
+
if (typeof r == "string")
|
|
54
|
+
return _arrayLikeToArray(r, a);
|
|
55
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
56
|
+
return t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set" ? Array.from(r) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function _arrayLikeToArray(r, a) {
|
|
60
|
+
(a == null || a > r.length) && (a = r.length);
|
|
61
|
+
for (var e = 0, n = Array(a);e < a; e++)
|
|
62
|
+
n[e] = r[e];
|
|
63
|
+
return n;
|
|
64
|
+
}
|
|
65
|
+
function _iterableToArrayLimit(r, l) {
|
|
66
|
+
var t = r == null ? null : typeof Symbol != "undefined" && r[Symbol.iterator] || r["@@iterator"];
|
|
67
|
+
if (t != null) {
|
|
68
|
+
var e, n, i, u, a = [], f = true, o = false;
|
|
69
|
+
try {
|
|
70
|
+
if (i = (t = t.call(r)).next, l === 0) {
|
|
71
|
+
if (Object(t) !== t)
|
|
72
|
+
return;
|
|
73
|
+
f = false;
|
|
74
|
+
} else
|
|
75
|
+
for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true)
|
|
76
|
+
;
|
|
77
|
+
} catch (r) {
|
|
78
|
+
o = true, n = r;
|
|
79
|
+
} finally {
|
|
80
|
+
try {
|
|
81
|
+
if (!f && t.return != null && (u = t.return(), Object(u) !== u))
|
|
82
|
+
return;
|
|
83
|
+
} finally {
|
|
84
|
+
if (o)
|
|
85
|
+
throw n;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return a;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function _arrayWithHoles(r) {
|
|
92
|
+
if (Array.isArray(r))
|
|
93
|
+
return r;
|
|
94
|
+
}
|
|
95
|
+
var default_url_options = {
|
|
96
|
+
protocols: ["http", "https", "ftp"],
|
|
97
|
+
require_tld: true,
|
|
98
|
+
require_protocol: false,
|
|
99
|
+
require_host: true,
|
|
100
|
+
require_port: false,
|
|
101
|
+
require_valid_protocol: true,
|
|
102
|
+
allow_underscores: false,
|
|
103
|
+
allow_trailing_dot: false,
|
|
104
|
+
allow_protocol_relative_urls: false,
|
|
105
|
+
allow_fragments: true,
|
|
106
|
+
allow_query_components: true,
|
|
107
|
+
validate_length: true,
|
|
108
|
+
max_allowed_length: 2084
|
|
109
|
+
};
|
|
110
|
+
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
|
|
111
|
+
function isURL(url, options) {
|
|
112
|
+
(0, _assertString.default)(url);
|
|
113
|
+
if (!url || /[\s<>]/.test(url)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (url.indexOf("mailto:") === 0) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
options = (0, _merge.default)(options, default_url_options);
|
|
120
|
+
if (options.validate_length && url.length > options.max_allowed_length) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
if (!options.allow_fragments && (0, _includesString.default)(url, "#")) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
if (!options.allow_query_components && ((0, _includesString.default)(url, "?") || (0, _includesString.default)(url, "&"))) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
var protocol, auth, host, hostname, port, port_str, split, ipv6;
|
|
130
|
+
split = url.split("#");
|
|
131
|
+
url = split.shift();
|
|
132
|
+
split = url.split("?");
|
|
133
|
+
url = split.shift();
|
|
134
|
+
var protocol_match = url.match(/^([a-z][a-z0-9+\-.]*):/i);
|
|
135
|
+
var had_explicit_protocol = false;
|
|
136
|
+
var cleanUpProtocol = function cleanUpProtocol(potential_protocol) {
|
|
137
|
+
had_explicit_protocol = true;
|
|
138
|
+
protocol = potential_protocol.toLowerCase();
|
|
139
|
+
if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return url.substring(protocol_match[0].length);
|
|
143
|
+
};
|
|
144
|
+
if (protocol_match) {
|
|
145
|
+
var potential_protocol = protocol_match[1];
|
|
146
|
+
var after_colon = url.substring(protocol_match[0].length);
|
|
147
|
+
var starts_with_slashes = after_colon.slice(0, 2) === "//";
|
|
148
|
+
if (!starts_with_slashes) {
|
|
149
|
+
var first_slash_position = after_colon.indexOf("/");
|
|
150
|
+
var before_slash = first_slash_position === -1 ? after_colon : after_colon.substring(0, first_slash_position);
|
|
151
|
+
var at_position = before_slash.indexOf("@");
|
|
152
|
+
if (at_position !== -1) {
|
|
153
|
+
var before_at = before_slash.substring(0, at_position);
|
|
154
|
+
var valid_auth_regex = /^[a-zA-Z0-9\-_.%:]*$/;
|
|
155
|
+
var is_valid_auth = valid_auth_regex.test(before_at);
|
|
156
|
+
var has_encoded_content = /%[0-9a-fA-F]{2}/.test(before_at);
|
|
157
|
+
if (is_valid_auth && !has_encoded_content) {
|
|
158
|
+
if (options.require_protocol) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
url = cleanUpProtocol(potential_protocol);
|
|
163
|
+
if (url === false) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
var looks_like_port = /^[0-9]/.test(after_colon);
|
|
169
|
+
if (looks_like_port) {
|
|
170
|
+
if (options.require_protocol) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
url = cleanUpProtocol(potential_protocol);
|
|
175
|
+
if (url === false) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
url = cleanUpProtocol(potential_protocol);
|
|
182
|
+
if (url === false) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} else if (options.require_protocol) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
if (url.slice(0, 2) === "//") {
|
|
190
|
+
if (!had_explicit_protocol && !options.allow_protocol_relative_urls) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
url = url.slice(2);
|
|
194
|
+
}
|
|
195
|
+
if (url === "") {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
split = url.split("/");
|
|
199
|
+
url = split.shift();
|
|
200
|
+
if (url === "" && !options.require_host) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
split = url.split("@");
|
|
204
|
+
if (split.length > 1) {
|
|
205
|
+
if (options.disallow_auth) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
if (split[0] === "") {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
auth = split.shift();
|
|
212
|
+
if (auth.indexOf(":") >= 0 && auth.split(":").length > 2) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
var _auth$split = auth.split(":"), _auth$split2 = _slicedToArray(_auth$split, 2), user = _auth$split2[0], password = _auth$split2[1];
|
|
216
|
+
if (user === "" && password === "") {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
hostname = split.join("@");
|
|
221
|
+
port_str = null;
|
|
222
|
+
ipv6 = null;
|
|
223
|
+
var ipv6_match = hostname.match(wrapped_ipv6);
|
|
224
|
+
if (ipv6_match) {
|
|
225
|
+
host = "";
|
|
226
|
+
ipv6 = ipv6_match[1];
|
|
227
|
+
port_str = ipv6_match[2] || null;
|
|
228
|
+
} else {
|
|
229
|
+
split = hostname.split(":");
|
|
230
|
+
host = split.shift();
|
|
231
|
+
if (split.length) {
|
|
232
|
+
port_str = split.join(":");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (port_str !== null && port_str.length > 0) {
|
|
236
|
+
port = parseInt(port_str, 10);
|
|
237
|
+
if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
} else if (options.require_port) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
if (options.host_whitelist) {
|
|
244
|
+
return (0, _checkHost.default)(host, options.host_whitelist);
|
|
245
|
+
}
|
|
246
|
+
if (host === "" && !options.require_host) {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
host = host || ipv6;
|
|
253
|
+
if (options.host_blacklist && (0, _checkHost.default)(host, options.host_blacklist)) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
module.exports = exports.default;
|
|
259
|
+
module.exports.default = exports.default;
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
var FormLabel = Symbol.for("pf/form/annotation/Label");
|
|
264
|
+
var FormDescription = Symbol.for("pf/form/annotation/Description");
|
|
265
|
+
var FormReadOnly = Symbol.for("pf/form/annotation/ReadOnly");
|
|
266
|
+
var FormDefault = Symbol.for("pf/form/annotation/Default");
|
|
267
|
+
var FormPermission = Symbol.for("pf/form/annotation/Permission");
|
|
268
|
+
var FormRequired = Symbol.for("pf/form/annotation/Required");
|
|
269
|
+
var FormMessage = Symbol.for("pf/form/annotation/Message");
|
|
270
|
+
var FormAutoComplete = Symbol.for("pf/form/annotation/AutoComplete");
|
|
271
|
+
var FormAutoFocus = Symbol.for("pf/form/annotation/AutoFocus");
|
|
272
|
+
var FormNumberInput = Symbol.for("pf/form/annotation/NumberInput");
|
|
273
|
+
var FormDateInput = Symbol.for("pf/form/annotation/DateInput");
|
|
274
|
+
var FormLocalDateTimeInput = Symbol.for("pf/form/annotation/LocalDateTimeInput");
|
|
275
|
+
var FormEmailInput = Symbol.for("pf/form/annotation/EmailInput");
|
|
276
|
+
var FormPhoneInput = Symbol.for("pf/form/annotation/PhoneInput");
|
|
277
|
+
var FormTextAreaInput = Symbol.for("pf/form/annotation/TextAreaInput");
|
|
278
|
+
var FormTableInput = Symbol.for("pf/form/annotation/TableInput");
|
|
279
|
+
var FormListInput = Symbol.for("pf/form/annotation/ListInput");
|
|
280
|
+
var FormFileInput = Symbol.for("pf/form/annotation/FileInput");
|
|
281
|
+
var FormLookupInput = Symbol.for("pf/form/annotation/LookupInput");
|
|
282
|
+
var FormRadioInput = Symbol.for("pf/form/annotation/RadioInput");
|
|
283
|
+
var FormCheckboxGroupInput = Symbol.for("pf/form/annotation/CheckboxGroupInput");
|
|
284
|
+
var FormSuggestionInput = Symbol.for("pf/form/annotation/SuggestionInput");
|
|
285
|
+
var FormCalendarSlotInput = Symbol.for("pf/form/annotation/CalendarSlotInput");
|
|
286
|
+
var FormProviderUserInput = Symbol.for("pf/form/annotation/ProviderUserInput");
|
|
287
|
+
var FormStaticText = Symbol.for("pf/form/annotation/StaticText");
|
|
288
|
+
var FormComponentPluginType = Symbol.for("pf/form/annotation/ComponentPluginType");
|
|
289
|
+
var FormPluginData = Symbol.for("pf/form/annotation/PluginData");
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
var import_isURL = __toESM(require_isURL(), 1);
|
|
293
|
+
import { Schema } from "effect";
|
|
294
|
+
var FLATTEN_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/flatten");
|
|
295
|
+
var STRUCTURAL_ONLY_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/structural-only");
|
|
296
|
+
var STRUCTURAL_TYPE_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/structural-type");
|
|
297
|
+
var TEXTBLOCK_CONTENT_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/textblock-content");
|
|
298
|
+
var TEXTBLOCK_DYNAMIC_CONTENT_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/textblock-dynamic-content");
|
|
299
|
+
var METRIC_BREAKDOWN_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/metric-breakdown");
|
|
300
|
+
var LINK_URL_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/link-url");
|
|
301
|
+
var LINK_TEXT_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/link-text");
|
|
302
|
+
var LINK_DISPLAY_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/link-display");
|
|
303
|
+
var LINK_COLOR_SYMBOL = Symbol.for("processfocus:internal-tag/form-schema/link-color");
|
|
304
|
+
var CurrentProviderUser = Symbol.for("processfocus:internal-tag/form-schema/current-provider-user");
|
|
305
|
+
var structuralElement = (type, data) => Schema.make(Schema.optionalKey(Schema.Undefined).ast).annotate({
|
|
306
|
+
[STRUCTURAL_ONLY_SYMBOL]: true,
|
|
307
|
+
[STRUCTURAL_TYPE_SYMBOL]: type,
|
|
308
|
+
...data
|
|
309
|
+
});
|
|
310
|
+
var StructuralOnly = structuralElement("structural");
|
|
311
|
+
var Divider = structuralElement("divider");
|
|
312
|
+
var isFieldPermissionMetadata = (value) => typeof value === "object" && value !== null && ("modify" in value) && typeof value.modify === "object" && value.modify !== null && ("node" in value.modify) && typeof value.modify.node === "object" && value.modify.node !== null && ("path" in value.modify.node) && typeof value.modify.node.path === "string";
|
|
313
|
+
var applyFieldAnnotations = (schema, options) => {
|
|
314
|
+
if (!options)
|
|
315
|
+
return schema;
|
|
316
|
+
const annotations = {};
|
|
317
|
+
if (options.label !== undefined) {
|
|
318
|
+
annotations[FormLabel] = options.label;
|
|
319
|
+
}
|
|
320
|
+
if (options.description !== undefined) {
|
|
321
|
+
annotations[FormDescription] = options.description;
|
|
322
|
+
}
|
|
323
|
+
if (options.autoComplete !== undefined) {
|
|
324
|
+
annotations[FormAutoComplete] = options.autoComplete;
|
|
325
|
+
}
|
|
326
|
+
if (options.readOnly !== undefined) {
|
|
327
|
+
annotations[FormReadOnly] = options.readOnly;
|
|
328
|
+
}
|
|
329
|
+
if (isFieldPermissionMetadata(options.permission)) {
|
|
330
|
+
annotations[FormPermission] = options.permission;
|
|
331
|
+
}
|
|
332
|
+
if (options.default !== undefined) {
|
|
333
|
+
annotations[FormDefault] = options.default;
|
|
334
|
+
}
|
|
335
|
+
return Object.getOwnPropertySymbols(annotations).length > 0 ? schema.annotate(annotations) : schema;
|
|
336
|
+
};
|
|
337
|
+
var isHttpsUrl = (value) => import_isURL.default(value, {
|
|
338
|
+
protocols: ["https"],
|
|
339
|
+
require_protocol: true,
|
|
340
|
+
require_tld: true
|
|
341
|
+
});
|
|
342
|
+
var httpsUrlSchema = Schema.String.pipe(Schema.check(Schema.makeFilter(isHttpsUrl, {
|
|
343
|
+
message: "Must be a valid HTTPS URL (e.g. https://example.com/path)",
|
|
344
|
+
arbitraryConstraint: {
|
|
345
|
+
patterns: [
|
|
346
|
+
{ source: "^https://[a-z]{3,12}\\.example\\.com$", flags: "" }
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
})));
|
|
350
|
+
var requiredBooleanSchema = Schema.Boolean.pipe(Schema.check(Schema.makeFilter((b) => b === true, {
|
|
351
|
+
message: "This field is required",
|
|
352
|
+
toJsonSchema: () => ({ type: "boolean", enum: [true] }),
|
|
353
|
+
[FormRequired]: true
|
|
354
|
+
})));
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
var fieldAnnotation = (ast, key) => {
|
|
358
|
+
const direct = Reflect.get(ast.context?.annotations ?? {}, key) ?? ast.checks?.toReversed().map((check) => Reflect.get(check.annotations ?? {}, key)).find((value) => value !== undefined) ?? Reflect.get(ast.annotations ?? {}, key);
|
|
359
|
+
if (direct !== undefined)
|
|
360
|
+
return direct;
|
|
361
|
+
if (ast.encoding) {
|
|
362
|
+
for (const link of ast.encoding) {
|
|
363
|
+
const value = fieldAnnotation(link.to, key);
|
|
364
|
+
if (value !== undefined)
|
|
365
|
+
return value;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (ast._tag === "Union") {
|
|
369
|
+
for (const type of ast.types) {
|
|
370
|
+
const value = fieldAnnotation(type, key);
|
|
371
|
+
if (value !== undefined)
|
|
372
|
+
return value;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
};
|
|
377
|
+
var fieldInputAst = (field) => field.ast;
|
|
378
|
+
var hasStructuralOnlyAnnotation = (field) => fieldAnnotation(fieldInputAst(field), STRUCTURAL_ONLY_SYMBOL) !== undefined;
|
|
379
|
+
var hasFlattenAnnotation = (field) => fieldAnnotation(fieldInputAst(field), FLATTEN_SYMBOL) !== undefined;
|
|
380
|
+
var isReadOnlyField = (field) => fieldAnnotation(fieldInputAst(field), FormReadOnly) === true;
|
|
381
|
+
|
|
382
|
+
var DeferredValueTypeId = Symbol.for("pf/form/deferred-value");
|
|
383
|
+
var FormDeferredContent = Symbol.for("pf/form/deferred-content");
|
|
384
|
+
|
|
385
|
+
var import_isEmail = __toESM(require_isEmail(), 1);
|
|
386
|
+
import { Schema as Schema2 } from "effect";
|
|
387
|
+
var Email = Schema2.Trim.pipe(Schema2.check(Schema2.makeFilter((s) => import_isEmail.default(s, {
|
|
388
|
+
require_tld: false,
|
|
389
|
+
allow_utf8_local_part: true,
|
|
390
|
+
allow_ip_domain: true
|
|
391
|
+
}), { message: "must be a valid email address" })), Schema2.annotate({
|
|
392
|
+
identifier: "Email",
|
|
393
|
+
title: "Email address",
|
|
394
|
+
description: "A valid email address",
|
|
395
|
+
format: "email",
|
|
396
|
+
[FormEmailInput]: true
|
|
397
|
+
}));
|
|
398
|
+
var EmailField = (options) => applyFieldAnnotations(Email, {
|
|
399
|
+
autoComplete: options?.autoComplete ?? "email",
|
|
400
|
+
...options
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
import { Result, Schema as Schema3, SchemaIssue } from "effect";
|
|
404
|
+
var isKeyObject = (segment) => typeof segment === "object" && segment !== null && ("key" in segment) && typeof segment.key !== "undefined";
|
|
405
|
+
var extractKey = (segment) => {
|
|
406
|
+
if (segment === undefined)
|
|
407
|
+
return;
|
|
408
|
+
return isKeyObject(segment) ? segment.key : segment;
|
|
409
|
+
};
|
|
410
|
+
var countInvalidFields = (schema, data) => {
|
|
411
|
+
const contextFreeSchema = schema;
|
|
412
|
+
const result = Schema3.decodeUnknownResult(contextFreeSchema)(data, {
|
|
413
|
+
errors: "all",
|
|
414
|
+
onExcessProperty: "ignore"
|
|
415
|
+
});
|
|
416
|
+
if (Result.isSuccess(result)) {
|
|
417
|
+
return 0;
|
|
418
|
+
}
|
|
419
|
+
const issues = SchemaIssue.makeFormatterStandardSchemaV1()(result.failure.issue).issues;
|
|
420
|
+
const fieldsWithErrors = new Set(issues.map((issue) => extractKey(issue.path?.[0])).filter((key) => key !== undefined));
|
|
421
|
+
return fieldsWithErrors.size;
|
|
422
|
+
};
|
|
423
|
+
var countTotalFields = (schema) => {
|
|
424
|
+
return Object.keys(schema.fields).length;
|
|
425
|
+
};
|
|
426
|
+
var calculateFieldCompletion = (schema, data) => {
|
|
427
|
+
const totalFields = countTotalFields(schema);
|
|
428
|
+
const invalidFields = countInvalidFields(schema, data);
|
|
429
|
+
const fieldsCompleted = totalFields - invalidFields;
|
|
430
|
+
return { fieldsCompleted, totalFields };
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
import { Schema as Schema4 } from "effect";
|
|
434
|
+
var FormPresentation = Schema4.Struct({
|
|
435
|
+
label: Schema4.optional(Schema4.String),
|
|
436
|
+
description: Schema4.optional(Schema4.String),
|
|
437
|
+
text: Schema4.optional(Schema4.String),
|
|
438
|
+
href: Schema4.optional(Schema4.String)
|
|
439
|
+
});
|
|
440
|
+
var FormRequestData = Schema4.Struct({
|
|
441
|
+
presentation: Schema4.Record(Schema4.String, FormPresentation),
|
|
442
|
+
inaccessible: Schema4.Array(Schema4.String),
|
|
443
|
+
originalValues: Schema4.Record(Schema4.String, Schema4.Unknown),
|
|
444
|
+
lookups: Schema4.optional(Schema4.Record(Schema4.String, Schema4.Struct({
|
|
445
|
+
dependencies: Schema4.Array(Schema4.String),
|
|
446
|
+
queryName: Schema4.String
|
|
447
|
+
}))),
|
|
448
|
+
prefill: Schema4.optional(Schema4.Struct({
|
|
449
|
+
dependency: Schema4.String,
|
|
450
|
+
fields: Schema4.Array(Schema4.String),
|
|
451
|
+
concealed: Schema4.Array(Schema4.String),
|
|
452
|
+
queryName: Schema4.String
|
|
453
|
+
}))
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
import {
|
|
457
|
+
Effect,
|
|
458
|
+
Number as EffectNumber,
|
|
459
|
+
Option,
|
|
460
|
+
Schema as Schema5,
|
|
461
|
+
SchemaGetter,
|
|
462
|
+
SchemaIssue as SchemaIssue2
|
|
463
|
+
} from "effect";
|
|
464
|
+
var NumberFromString = Schema5.String.pipe(Schema5.decodeTo(Schema5.Number, {
|
|
465
|
+
decode: SchemaGetter.transformEffect((value) => {
|
|
466
|
+
const parsed = EffectNumber.parse(value);
|
|
467
|
+
return Option.isSome(parsed) ? Effect.succeed(parsed.value) : Effect.fail(new SchemaIssue2.InvalidValue({ message: "Must be a numeric string" }, value));
|
|
468
|
+
}),
|
|
469
|
+
encode: SchemaGetter.transform(String)
|
|
470
|
+
}));
|
|
471
|
+
|
|
472
|
+
import { Schema as Schema6 } from "effect";
|
|
473
|
+
var VALID_PHONE_CHARS = /^\+?[\d\s\-()]+$/;
|
|
474
|
+
var countDigits = (s) => {
|
|
475
|
+
return (s.match(/\d/g) || []).length;
|
|
476
|
+
};
|
|
477
|
+
var isPhoneNumber = (s) => {
|
|
478
|
+
if (!VALID_PHONE_CHARS.test(s)) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
const digitCount = countDigits(s);
|
|
482
|
+
return digitCount >= 7 && digitCount <= 15;
|
|
483
|
+
};
|
|
484
|
+
var Phone = Schema6.Trim.pipe(Schema6.check(Schema6.makeFilter((s) => isPhoneNumber(s), {
|
|
485
|
+
message: "must be a valid phone number (7-15 digits)"
|
|
486
|
+
})), Schema6.annotate({
|
|
487
|
+
identifier: "Phone",
|
|
488
|
+
title: "Phone number",
|
|
489
|
+
description: "A valid phone number",
|
|
490
|
+
format: "phone",
|
|
491
|
+
[FormPhoneInput]: true
|
|
492
|
+
}));
|
|
493
|
+
|
|
494
|
+
import { Schema as Schema7 } from "effect";
|
|
495
|
+
var publicCompletionCorrectionForm = Schema7.Struct({
|
|
496
|
+
correctedEmail: EmailField({ label: "Corrected email" })
|
|
497
|
+
});
|
|
498
|
+
// src/services/port-file.ts
|
|
499
|
+
import { Schema as Schema8 } from "effect";
|
|
500
|
+
var DEFAULT_GRAPHQL_PORT = 4000;
|
|
501
|
+
var GRAPHQL_PORT_FILE = ".graphql-port.json";
|
|
502
|
+
var PortFileContentStruct = Schema8.Struct({ port: Schema8.Number });
|
|
503
|
+
var PortFileContentJson = Schema8.fromJsonString(PortFileContentStruct);
|
|
504
|
+
var decodePortFromFileContent = (content) => {
|
|
505
|
+
try {
|
|
506
|
+
return Schema8.decodeUnknownSync(PortFileContentJson)(content).port;
|
|
507
|
+
} catch {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
export { FormLabel, FormDescription, FormReadOnly, FormDefault, FormPermission, FormRequired, FormAutoComplete, FormFileInput, FormLookupInput, FormRadioInput, FormCheckboxGroupInput, FormSuggestionInput, FormCalendarSlotInput, FormProviderUserInput, FormComponentPluginType, FLATTEN_SYMBOL, STRUCTURAL_ONLY_SYMBOL, CurrentProviderUser, isFieldPermissionMetadata, fieldAnnotation, fieldInputAst, hasStructuralOnlyAnnotation, hasFlattenAnnotation, isReadOnlyField, Email, calculateFieldCompletion, FormRequestData, NumberFromString, publicCompletionCorrectionForm, DEFAULT_GRAPHQL_PORT, GRAPHQL_PORT_FILE, PortFileContentJson, decodePortFromFileContent };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
AuditPersistence,
|
|
4
|
+
Audit,
|
|
5
|
+
makeAudit,
|
|
6
|
+
DatabasePathConfig,
|
|
7
|
+
PolicyRevisionUnavailable,
|
|
8
|
+
PolicyRevisionPublisher,
|
|
9
|
+
policyRevisionFromFile,
|
|
10
|
+
TypedSqliteDrizzleLayer,
|
|
11
|
+
SqliteAuditPersistenceLive,
|
|
12
|
+
makeLocalSqlClientLayer
|
|
13
|
+
} from "./chunk-wvbz0nmd.js";
|
|
14
|
+
import {
|
|
15
|
+
PortFileContentJson,
|
|
16
|
+
decodePortFromFileContent
|
|
17
|
+
} from "./chunk-5kjvzbwr.js";
|
|
18
|
+
// src/server-utils.ts
|
|
19
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
20
|
+
import { Data, Effect, Schema } from "effect";
|
|
21
|
+
class NoAvailablePortError extends Data.TaggedError("NoAvailablePortError") {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class PortInUseError extends Data.TaggedError("PortInUseError") {
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class ServerStartError extends Data.TaggedError("ServerStartError") {
|
|
28
|
+
}
|
|
29
|
+
var isPortInUseError = (error) => error instanceof Error && ("code" in error) && error.code === "EADDRINUSE";
|
|
30
|
+
|
|
31
|
+
class PortBindError extends Data.TaggedError("PortBindError") {
|
|
32
|
+
}
|
|
33
|
+
var tryServeOnPort = (serverOptions, port) => Effect.try({
|
|
34
|
+
try: () => Bun.serve({
|
|
35
|
+
...serverOptions,
|
|
36
|
+
port,
|
|
37
|
+
reusePort: false
|
|
38
|
+
}),
|
|
39
|
+
catch: (cause) => new PortBindError({ port, cause })
|
|
40
|
+
});
|
|
41
|
+
var serveOnExactPort = (port, serverOptions) => tryServeOnPort(serverOptions, port).pipe(Effect.mapError((err) => {
|
|
42
|
+
if (isPortInUseError(err.cause)) {
|
|
43
|
+
return new PortInUseError({ port });
|
|
44
|
+
}
|
|
45
|
+
return new ServerStartError({ port, cause: err.cause });
|
|
46
|
+
}), Effect.map((server) => server));
|
|
47
|
+
var serveWithPortFallback = (basePort, serverOptions, maxAttempts = 10) => Effect.gen(function* () {
|
|
48
|
+
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
49
|
+
const port = basePort + attempt;
|
|
50
|
+
const result = yield* tryServeOnPort(serverOptions, port).pipe(Effect.matchEffect({
|
|
51
|
+
onSuccess: (server) => Effect.succeed({ _tag: "success", server }),
|
|
52
|
+
onFailure: (err) => {
|
|
53
|
+
if (isPortInUseError(err.cause)) {
|
|
54
|
+
return Effect.succeed({ _tag: "port-in-use" });
|
|
55
|
+
}
|
|
56
|
+
return Effect.fail(new ServerStartError({ port, cause: err.cause }));
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
if (result._tag === "success") {
|
|
60
|
+
if (attempt > 0) {
|
|
61
|
+
yield* Effect.logWarning(`Port ${basePort} was in use, using port ${port} instead`);
|
|
62
|
+
}
|
|
63
|
+
return result.server;
|
|
64
|
+
}
|
|
65
|
+
if (attempt < maxAttempts - 1) {
|
|
66
|
+
yield* Effect.logDebug(`Port ${port} in use, trying ${port + 1}...`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return yield* new NoAvailablePortError({
|
|
70
|
+
startPort: basePort,
|
|
71
|
+
endPort: basePort + maxAttempts - 1
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
class PortFileWriteError extends Data.TaggedError("PortFileWriteError") {
|
|
76
|
+
}
|
|
77
|
+
var readCurrentPort = (filename) => {
|
|
78
|
+
try {
|
|
79
|
+
return decodePortFromFileContent(readFileSync(filename, "utf-8"));
|
|
80
|
+
} catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var writePortFile = (filename, port) => Effect.sync(() => readCurrentPort(filename)).pipe(Effect.flatMap((currentPort) => {
|
|
85
|
+
if (currentPort === port) {
|
|
86
|
+
return Effect.logDebug(`Port file ${filename} already contains ${port}, skipping write`);
|
|
87
|
+
}
|
|
88
|
+
const content = { port };
|
|
89
|
+
return Schema.encodeEffect(PortFileContentJson)(content).pipe(Effect.mapError((cause) => new PortFileWriteError({ filename, port, cause })), Effect.flatMap((encodedContent) => Effect.try({
|
|
90
|
+
try: () => writeFileSync(filename, `${encodedContent}
|
|
91
|
+
`, "utf-8"),
|
|
92
|
+
catch: (cause) => new PortFileWriteError({ filename, port, cause })
|
|
93
|
+
})), Effect.tap(() => Effect.logDebug(`Wrote port ${port} to ${filename}`)));
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
// src/services/audit.ts
|
|
97
|
+
import { Layer as Layer2 } from "effect";
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
import { Clock, Context, Data as Data2, Effect as Effect2, Layer } from "effect";
|
|
101
|
+
import { SqlClient } from "effect/sql";
|
|
102
|
+
class AuditDeliveryTimeout extends Data2.TaggedError("AuditDeliveryTimeout") {
|
|
103
|
+
}
|
|
104
|
+
var LocalAuditLive = Layer.effect(Audit, Effect2.gen(function* () {
|
|
105
|
+
const persistence = yield* AuditPersistence;
|
|
106
|
+
const sql = yield* SqlClient.SqlClient;
|
|
107
|
+
return makeAudit((event) => Effect2.gen(function* () {
|
|
108
|
+
const started = yield* Clock.currentTimeMillis;
|
|
109
|
+
const checkBudget = Effect2.gen(function* () {
|
|
110
|
+
if ((yield* Clock.currentTimeMillis) - started >= 250)
|
|
111
|
+
return yield* new AuditDeliveryTimeout;
|
|
112
|
+
});
|
|
113
|
+
return yield* sql.withTransaction(Effect2.gen(function* () {
|
|
114
|
+
yield* checkBudget;
|
|
115
|
+
yield* persistence.insert(event);
|
|
116
|
+
yield* checkBudget;
|
|
117
|
+
})).pipe(Effect2.updateContext((context) => Context.omit(sql.transactionService)(context)), Effect2.uninterruptible);
|
|
118
|
+
}));
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
// src/services/audit.ts
|
|
122
|
+
var LocalRuntimeAuditLive = LocalAuditLive.pipe(Layer2.provideMerge(SqliteAuditPersistenceLive), Layer2.provide(TypedSqliteDrizzleLayer.pipe(Layer2.fresh, Layer2.provideMerge(makeLocalSqlClientLayer({
|
|
123
|
+
busy_timeout: 25,
|
|
124
|
+
defaultQueryTimeout: 100
|
|
125
|
+
})))));
|
|
126
|
+
|
|
127
|
+
// src/services/policy-revision.ts
|
|
128
|
+
import { createHash, randomUUID } from "crypto";
|
|
129
|
+
import { mkdir, rename, rm, writeFile } from "fs/promises";
|
|
130
|
+
import { dirname, join, resolve } from "path";
|
|
131
|
+
import { Config, Effect as Effect3, Layer as Layer3 } from "effect";
|
|
132
|
+
var revisionPath = Effect3.gen(function* () {
|
|
133
|
+
const root = resolve(yield* Config.String("PF_RUNTIME_ROOT").pipe(Config.withDefault(process.cwd())));
|
|
134
|
+
const environment = yield* Config.String("PF_ENV").pipe(Config.withDefault(""));
|
|
135
|
+
const database = yield* DatabasePathConfig;
|
|
136
|
+
const scope = createHash("sha256").update(JSON.stringify([root, environment, database])).digest("hex");
|
|
137
|
+
return join(root, ".policy-revisions", scope);
|
|
138
|
+
});
|
|
139
|
+
var LocalPolicyRevisionLive = Layer3.unwrap(Effect3.map(revisionPath, policyRevisionFromFile));
|
|
140
|
+
var LocalPolicyRevisionPublisherLive = Layer3.unwrap(Effect3.map(revisionPath, (path) => Layer3.succeed(PolicyRevisionPublisher, {
|
|
141
|
+
publish: (revision) => Effect3.tryPromise({
|
|
142
|
+
try: async () => {
|
|
143
|
+
await mkdir(dirname(path), { recursive: true });
|
|
144
|
+
const temporary = `${path}.${randomUUID()}`;
|
|
145
|
+
try {
|
|
146
|
+
await writeFile(temporary, revision, { mode: 384 });
|
|
147
|
+
await rename(temporary, path);
|
|
148
|
+
} finally {
|
|
149
|
+
await rm(temporary, { force: true });
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
catch: () => new PolicyRevisionUnavailable
|
|
153
|
+
})
|
|
154
|
+
})));
|
|
155
|
+
|
|
156
|
+
export { serveOnExactPort, serveWithPortFallback, writePortFile, LocalRuntimeAuditLive, LocalPolicyRevisionLive, LocalPolicyRevisionPublisherLive };
|