@processfocus/runtime-local 0.1.0-next.1 → 0.1.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -253
- package/dist/authentication-server.mjs +52 -84
- package/dist/{chunk-fn7b5pxw.js → chunk-04r0t2mb.js} +19364 -34104
- package/dist/chunk-727y6qkb.js +156 -0
- package/dist/chunk-bg5r4wpv.js +4755 -0
- package/dist/chunk-cbd36jq1.js +512 -0
- package/dist/chunk-d4ctj079.js +241 -0
- package/dist/{chunk-cq9xscgb.js → chunk-r5s2v669.js} +49079 -33564
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +153 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +10 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +29 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
- package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +11 -4
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
- package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
- package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +47 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +4 -8
- package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
- package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
- package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
- package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +112 -21
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
- package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
- package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
- package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +169 -30
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +38 -29
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +900 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +42 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +193 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +237 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
- package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
- package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
- package/dist/dashboard-source/apps/frontend/package.json +48 -47
- package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
- package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
- package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
- package/dist/dashboard-source/modules/form/src/index.ts +1 -10
- package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
- package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
- package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
- package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
- package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
- package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
- package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
- package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
- package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
- package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
- package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
- package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +272 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
- package/dist/dashboard-source.json +48 -47
- package/dist/graphql-server.mjs +245 -200
- package/dist/job-worker-supervisor.mjs +262 -0
- package/dist/job-worker.mjs +234 -133
- package/dist/main.mjs +23 -4
- package/dist/prepare-dashboard.mjs +8 -8
- package/dist/resources/cedar/policies.cedar +80 -38
- package/dist/resources/cedar/schema.cedarschema +39 -21
- package/dist/resources/graphql-schema/rxdb.graphql +2 -0
- package/dist/resources/graphql-schema/system.graphql +204 -51
- package/package.json +64 -62
- package/dist/chunk-6b6t8tyq.js +0 -85
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
- package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DateTime, Effect } from "effect"
|
|
2
2
|
import { Schema } from "effect"
|
|
3
3
|
import isURL from "validator/lib/isURL"
|
|
4
4
|
import type { DeferredValue, FormValue } from "./deferred-value.ts"
|
|
5
5
|
import {
|
|
6
6
|
FormAutoComplete,
|
|
7
7
|
FormCalendarSlotInput,
|
|
8
|
+
FormCheckboxGroupInput,
|
|
8
9
|
FormDateInput,
|
|
9
10
|
FormDefault,
|
|
10
11
|
FormDescription,
|
|
11
12
|
FormFileInput,
|
|
12
13
|
FormLabel,
|
|
13
14
|
FormListInput,
|
|
15
|
+
FormLocalDateTimeInput,
|
|
14
16
|
FormLookupInput,
|
|
15
17
|
FormNumberInput,
|
|
16
18
|
FormPermission,
|
|
@@ -160,9 +162,9 @@ export type LookupMarker = { readonly __lookup: unique symbol }
|
|
|
160
162
|
export type CalendarSlotMarker = { readonly __calendarSlot: unique symbol }
|
|
161
163
|
/** Preserve read-only classification in downstream process-state inference. */
|
|
162
164
|
export const ReadOnly = <A, I, R>(
|
|
163
|
-
schema: Schema.
|
|
164
|
-
): Schema.
|
|
165
|
-
schema.
|
|
165
|
+
schema: Schema.Codec<A, I, R, R>,
|
|
166
|
+
): Schema.Codec<A, I, R, R> & ReadOnlyMarker =>
|
|
167
|
+
schema.annotate({ [FormReadOnly]: true }) as Schema.Codec<A, I, R, R> &
|
|
166
168
|
ReadOnlyMarker
|
|
167
169
|
|
|
168
170
|
type PresentationOnly<Field> = Field extends StructuralOnlyMarker
|
|
@@ -194,21 +196,28 @@ export type StableFormFields<Fields> = {
|
|
|
194
196
|
// Wrapper function - creates an annotated struct for semantic grouping with flattened type
|
|
195
197
|
export const Wrapper = <Fields extends Schema.Struct.Fields>(
|
|
196
198
|
fields: Fields & StableFormFields<NoInfer<Fields>>,
|
|
199
|
+
options?: { readonly label?: string; readonly description?: string },
|
|
197
200
|
): Schema.Struct<Fields> & FlattenMarker =>
|
|
198
|
-
Schema.Struct<Fields>(fields).
|
|
201
|
+
Schema.Struct<Fields>(fields).annotate({
|
|
199
202
|
[FLATTEN_SYMBOL]: true,
|
|
203
|
+
...(options?.label !== undefined && { [FormLabel]: options.label }),
|
|
204
|
+
...(options?.description !== undefined && {
|
|
205
|
+
[FormDescription]: options.description,
|
|
206
|
+
}),
|
|
200
207
|
}) as Schema.Struct<Fields> & FlattenMarker
|
|
201
208
|
|
|
202
209
|
// Helper to create custom structural-only elements
|
|
203
210
|
const structuralElement = <T extends Record<string, unknown>>(
|
|
204
211
|
type: string,
|
|
205
212
|
data?: T,
|
|
206
|
-
): Schema.
|
|
207
|
-
Schema.
|
|
213
|
+
): Schema.Codec<unknown, unknown> & StructuralOnlyMarker =>
|
|
214
|
+
Schema.make<Schema.Codec<unknown, unknown>>(
|
|
215
|
+
Schema.optionalKey(Schema.Undefined).ast,
|
|
216
|
+
).annotate({
|
|
208
217
|
[STRUCTURAL_ONLY_SYMBOL]: true,
|
|
209
218
|
[STRUCTURAL_TYPE_SYMBOL]: type,
|
|
210
219
|
...data,
|
|
211
|
-
}) as unknown
|
|
220
|
+
}) as Schema.Codec<unknown, unknown> & StructuralOnlyMarker
|
|
212
221
|
|
|
213
222
|
// Generic structural-only marker for custom use cases
|
|
214
223
|
export const StructuralOnly = structuralElement("structural")
|
|
@@ -217,6 +226,12 @@ export const StructuralOnly = structuralElement("structural")
|
|
|
217
226
|
export const Divider = structuralElement("divider")
|
|
218
227
|
export const TextBlock = (text: string) =>
|
|
219
228
|
structuralElement("textblock", { [TEXTBLOCK_CONTENT_SYMBOL]: text })
|
|
229
|
+
/** Display-only list: blank lines separate items; an empty body hides the list. */
|
|
230
|
+
export const TextList = (heading: string) =>
|
|
231
|
+
structuralElement("text-list", {
|
|
232
|
+
[FormLabel]: heading,
|
|
233
|
+
[TEXTBLOCK_CONTENT_SYMBOL]: "",
|
|
234
|
+
})
|
|
220
235
|
export const DynamicTextBlock = (options: DynamicTextBlockOptions) =>
|
|
221
236
|
structuralElement("textblock", {
|
|
222
237
|
[TEXTBLOCK_CONTENT_SYMBOL]: options.text,
|
|
@@ -394,9 +409,9 @@ export const isFieldPermissionMetadata = (
|
|
|
394
409
|
// Note: options type is separate from schema type to allow each field helper
|
|
395
410
|
// to enforce its own type constraint on default values
|
|
396
411
|
export const applyFieldAnnotations = <A, I, R>(
|
|
397
|
-
schema: Schema.
|
|
412
|
+
schema: Schema.Codec<A, I, R, R>,
|
|
398
413
|
options?: FieldOptions<unknown>,
|
|
399
|
-
): Schema.
|
|
414
|
+
): Schema.Codec<A, I, R, R> => {
|
|
400
415
|
if (!options) return schema
|
|
401
416
|
|
|
402
417
|
const annotations: Record<symbol, unknown> = {}
|
|
@@ -420,7 +435,7 @@ export const applyFieldAnnotations = <A, I, R>(
|
|
|
420
435
|
}
|
|
421
436
|
|
|
422
437
|
return Object.getOwnPropertySymbols(annotations).length > 0
|
|
423
|
-
? schema.
|
|
438
|
+
? schema.annotate(annotations)
|
|
424
439
|
: schema
|
|
425
440
|
}
|
|
426
441
|
|
|
@@ -436,27 +451,27 @@ export const applyFieldAnnotations = <A, I, R>(
|
|
|
436
451
|
*/
|
|
437
452
|
export function TextField(
|
|
438
453
|
options: FieldOptions<string> & { readonly readOnly: true },
|
|
439
|
-
): Schema.
|
|
454
|
+
): Schema.Codec<string, string, never, never> & ReadOnlyMarker
|
|
440
455
|
export function TextField(
|
|
441
456
|
options?: FieldOptions<string>,
|
|
442
|
-
): Schema.
|
|
457
|
+
): Schema.Codec<string, string, never, never>
|
|
443
458
|
export function TextField(
|
|
444
459
|
options?: FieldOptions<string>,
|
|
445
|
-
): Schema.
|
|
460
|
+
): Schema.Codec<string, string, never, never> {
|
|
446
461
|
return applyFieldAnnotations(Schema.String, options)
|
|
447
462
|
}
|
|
448
463
|
|
|
449
464
|
export function TextArea(
|
|
450
465
|
options: FieldOptions<string> & { readonly readOnly: true },
|
|
451
|
-
): Schema.
|
|
466
|
+
): Schema.Codec<string, string, never, never> & ReadOnlyMarker
|
|
452
467
|
export function TextArea(
|
|
453
468
|
options?: FieldOptions<string>,
|
|
454
|
-
): Schema.
|
|
469
|
+
): Schema.Codec<string, string, never, never>
|
|
455
470
|
export function TextArea(
|
|
456
471
|
options?: FieldOptions<string>,
|
|
457
|
-
): Schema.
|
|
472
|
+
): Schema.Codec<string, string, never, never> {
|
|
458
473
|
return applyFieldAnnotations(
|
|
459
|
-
Schema.String.
|
|
474
|
+
Schema.String.annotate({ [FormTextAreaInput]: true }),
|
|
460
475
|
options,
|
|
461
476
|
)
|
|
462
477
|
}
|
|
@@ -472,9 +487,9 @@ export function TextArea(
|
|
|
472
487
|
* ```
|
|
473
488
|
*/
|
|
474
489
|
export const TextFieldFrom = <I, R>(
|
|
475
|
-
schema: Schema.
|
|
490
|
+
schema: Schema.Codec<string, I, R, R>,
|
|
476
491
|
options?: FieldOptions<I>,
|
|
477
|
-
): Schema.
|
|
492
|
+
): Schema.Codec<string, I, R, R> => applyFieldAnnotations(schema, options)
|
|
478
493
|
|
|
479
494
|
/**
|
|
480
495
|
* Validate that a string is a well-formed HTTPS URL.
|
|
@@ -495,15 +510,16 @@ export const isHttpsUrl = (value: string): boolean =>
|
|
|
495
510
|
|
|
496
511
|
const httpsUrlSchema = Schema.String.pipe(
|
|
497
512
|
// Strict runtime validation via validator.js.
|
|
498
|
-
Schema.
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
513
|
+
Schema.check(
|
|
514
|
+
Schema.makeFilter(isHttpsUrl, {
|
|
515
|
+
message: "Must be a valid HTTPS URL (e.g. https://example.com/path)",
|
|
516
|
+
arbitraryConstraint: {
|
|
517
|
+
patterns: [
|
|
518
|
+
{ source: "^https://[a-z]{3,12}\\.example\\.com$", flags: "" },
|
|
519
|
+
],
|
|
520
|
+
},
|
|
521
|
+
}),
|
|
522
|
+
),
|
|
507
523
|
)
|
|
508
524
|
|
|
509
525
|
/**
|
|
@@ -523,7 +539,7 @@ const httpsUrlSchema = Schema.String.pipe(
|
|
|
523
539
|
*/
|
|
524
540
|
export const HttpsUrlField = (
|
|
525
541
|
options?: FieldOptions<string>,
|
|
526
|
-
): Schema.
|
|
542
|
+
): Schema.Codec<string, string, never, never> => {
|
|
527
543
|
return applyFieldAnnotations(httpsUrlSchema, options)
|
|
528
544
|
}
|
|
529
545
|
|
|
@@ -539,7 +555,7 @@ export const HttpsUrlField = (
|
|
|
539
555
|
*/
|
|
540
556
|
export const NumberField = (
|
|
541
557
|
options?: FieldOptions<number>,
|
|
542
|
-
): Schema.
|
|
558
|
+
): Schema.Codec<number, number, never, never> =>
|
|
543
559
|
applyFieldAnnotations(Schema.Number, options)
|
|
544
560
|
|
|
545
561
|
/**
|
|
@@ -548,21 +564,31 @@ export const NumberField = (
|
|
|
548
564
|
* @example
|
|
549
565
|
* ```typescript
|
|
550
566
|
* const schema = Schema.Struct({
|
|
551
|
-
* age: NumberFieldFrom(
|
|
567
|
+
* age: NumberFieldFrom(NumberFromString, { label: "Your age" })
|
|
552
568
|
* })
|
|
553
569
|
* ```
|
|
554
570
|
*/
|
|
555
571
|
export const NumberFieldFrom = <I, R>(
|
|
556
|
-
schema: Schema.
|
|
572
|
+
schema: Schema.Codec<number, I, R, R>,
|
|
557
573
|
options?: FieldOptions<I> & { required?: boolean },
|
|
558
|
-
): Schema.
|
|
574
|
+
): Schema.Codec<number, I, R, R> => {
|
|
559
575
|
const base = options?.required
|
|
560
|
-
? schema
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
576
|
+
? schema
|
|
577
|
+
.pipe(
|
|
578
|
+
Schema.encodeTo(
|
|
579
|
+
Schema.toEncoded(schema).check(
|
|
580
|
+
Schema.makeFilter(
|
|
581
|
+
(value) => typeof value !== "string" || value.length > 0,
|
|
582
|
+
{ toJsonSchema: () => ({ minLength: 1 }) },
|
|
583
|
+
),
|
|
584
|
+
),
|
|
585
|
+
),
|
|
586
|
+
)
|
|
587
|
+
.annotate({
|
|
588
|
+
[FormRequired]: true,
|
|
589
|
+
[FormNumberInput]: true,
|
|
590
|
+
})
|
|
591
|
+
: schema.annotate({
|
|
566
592
|
[FormNumberInput]: true,
|
|
567
593
|
})
|
|
568
594
|
return applyFieldAnnotations(base, options)
|
|
@@ -570,18 +596,42 @@ export const NumberFieldFrom = <I, R>(
|
|
|
570
596
|
|
|
571
597
|
export const DateField = (
|
|
572
598
|
options?: FieldOptions<string>,
|
|
573
|
-
): Schema.
|
|
599
|
+
): Schema.Codec<DateTime.Utc, string, never, never> =>
|
|
600
|
+
applyFieldAnnotations(
|
|
601
|
+
Schema.DateTimeUtcFromString.annotate({ [FormDateInput]: true }),
|
|
602
|
+
options,
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
const localDateTimePattern =
|
|
606
|
+
/\d{4}-\d{2}-\d{2} (?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?/
|
|
607
|
+
|
|
608
|
+
/** A wall-clock date and time. The caller interprets it in the intended zone. */
|
|
609
|
+
export const LocalDateTimeField = (
|
|
610
|
+
options?: FieldOptions<string> & { required?: boolean },
|
|
611
|
+
): Schema.Codec<string, string, never, never> =>
|
|
574
612
|
applyFieldAnnotations(
|
|
575
|
-
Schema.
|
|
613
|
+
Schema.String.check(
|
|
614
|
+
Schema.isPattern(
|
|
615
|
+
new RegExp(
|
|
616
|
+
`^(?:${localDateTimePattern.source})${options?.required ? "" : "?"}$`,
|
|
617
|
+
),
|
|
618
|
+
{ message: "Choose a date and enter a time." },
|
|
619
|
+
),
|
|
620
|
+
).annotate({
|
|
621
|
+
[FormLocalDateTimeInput]: true,
|
|
622
|
+
...(options?.required ? { [FormRequired]: true } : {}),
|
|
623
|
+
}),
|
|
576
624
|
options,
|
|
577
625
|
)
|
|
578
626
|
|
|
579
627
|
const requiredBooleanSchema = Schema.Boolean.pipe(
|
|
580
|
-
Schema.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
628
|
+
Schema.check(
|
|
629
|
+
Schema.makeFilter((b): b is boolean => b === true, {
|
|
630
|
+
message: "This field is required",
|
|
631
|
+
toJsonSchema: () => ({ type: "boolean", enum: [true] }),
|
|
632
|
+
[FormRequired]: true,
|
|
633
|
+
}),
|
|
634
|
+
),
|
|
585
635
|
)
|
|
586
636
|
|
|
587
637
|
/**
|
|
@@ -599,7 +649,7 @@ const requiredBooleanSchema = Schema.Boolean.pipe(
|
|
|
599
649
|
*/
|
|
600
650
|
export const BooleanField = (
|
|
601
651
|
options?: FieldOptions<boolean> & { required?: boolean },
|
|
602
|
-
): Schema.
|
|
652
|
+
): Schema.Codec<boolean, boolean, never, never> => {
|
|
603
653
|
const base = options?.required ? requiredBooleanSchema : Schema.Boolean
|
|
604
654
|
return applyFieldAnnotations(base, options)
|
|
605
655
|
}
|
|
@@ -638,7 +688,7 @@ export const FileField = (
|
|
|
638
688
|
accept?: string
|
|
639
689
|
maxSize?: number
|
|
640
690
|
},
|
|
641
|
-
): Schema.
|
|
691
|
+
): Schema.Codec<string, string, never, never> => {
|
|
642
692
|
const storePath = options.documentStore.node.path.startsWith("/")
|
|
643
693
|
? options.documentStore.node.path
|
|
644
694
|
: `/${options.documentStore.node.path}`
|
|
@@ -648,7 +698,7 @@ export const FileField = (
|
|
|
648
698
|
...(options.accept != null && { accept: options.accept }),
|
|
649
699
|
...(options.maxSize != null && { maxSize: options.maxSize }),
|
|
650
700
|
}
|
|
651
|
-
const base = Schema.String.
|
|
701
|
+
const base = Schema.String.annotate({
|
|
652
702
|
[FormFileInput]: metadata,
|
|
653
703
|
})
|
|
654
704
|
return applyFieldAnnotations(base, options)
|
|
@@ -677,7 +727,7 @@ export const ListField = <Fields extends Schema.Struct.Fields>(
|
|
|
677
727
|
const annotatedSchema =
|
|
678
728
|
options?.addButtonLabel === undefined
|
|
679
729
|
? schema
|
|
680
|
-
: schema.
|
|
730
|
+
: schema.annotate({
|
|
681
731
|
[FormListInput]: {
|
|
682
732
|
addButtonLabel: options.addButtonLabel,
|
|
683
733
|
} satisfies ListFieldMetadata,
|
|
@@ -686,10 +736,11 @@ export const ListField = <Fields extends Schema.Struct.Fields>(
|
|
|
686
736
|
return applyFieldAnnotations(
|
|
687
737
|
annotatedSchema,
|
|
688
738
|
options,
|
|
689
|
-
) as unknown as Schema.
|
|
739
|
+
) as unknown as Schema.Codec<
|
|
690
740
|
ReadonlyArray<Schema.Struct.Type<Fields>>,
|
|
691
741
|
ReadonlyArray<Schema.Struct.Encoded<Fields>>,
|
|
692
|
-
Schema.Struct
|
|
742
|
+
Schema.Struct<Fields>["DecodingServices"],
|
|
743
|
+
Schema.Struct<Fields>["DecodingServices"]
|
|
693
744
|
> &
|
|
694
745
|
ListFieldMarker<Fields>
|
|
695
746
|
}
|
|
@@ -714,13 +765,14 @@ export const TableField = <Fields extends Schema.Struct.Fields>(
|
|
|
714
765
|
>,
|
|
715
766
|
) =>
|
|
716
767
|
applyFieldAnnotations(
|
|
717
|
-
Schema.Array(Schema.Struct<Fields>(itemFields)).
|
|
768
|
+
Schema.Array(Schema.Struct<Fields>(itemFields)).annotate({
|
|
718
769
|
[FormTableInput]: true,
|
|
719
770
|
}),
|
|
720
771
|
{ ...options, readOnly: true },
|
|
721
|
-
) as Schema.
|
|
772
|
+
) as Schema.Codec<
|
|
722
773
|
ReadonlyArray<Schema.Schema.Type<Schema.Struct<Fields>>>,
|
|
723
|
-
ReadonlyArray<Schema.
|
|
774
|
+
ReadonlyArray<Schema.Codec.Encoded<Schema.Struct<Fields>>>,
|
|
775
|
+
never,
|
|
724
776
|
never
|
|
725
777
|
> &
|
|
726
778
|
TableFieldMarker &
|
|
@@ -732,6 +784,8 @@ export const TableField = <Fields extends Schema.Struct.Fields>(
|
|
|
732
784
|
export interface LookupItem {
|
|
733
785
|
readonly value: string
|
|
734
786
|
readonly label: string
|
|
787
|
+
/** Additional authored search text; IDs are not implicitly searchable. */
|
|
788
|
+
readonly searchText?: string
|
|
735
789
|
}
|
|
736
790
|
|
|
737
791
|
export interface RadioFieldOption<Value extends string = string> {
|
|
@@ -739,6 +793,31 @@ export interface RadioFieldOption<Value extends string = string> {
|
|
|
739
793
|
readonly label: string
|
|
740
794
|
}
|
|
741
795
|
|
|
796
|
+
export interface CheckboxGroupOption {
|
|
797
|
+
readonly value: string
|
|
798
|
+
readonly label: string
|
|
799
|
+
readonly description?: string
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/** Choices are presentation, not an eligibility constraint: retain unavailable IDs. */
|
|
803
|
+
export const CheckboxGroupField = (
|
|
804
|
+
options: FieldOptions<readonly string[]> & {
|
|
805
|
+
readonly options: readonly CheckboxGroupOption[]
|
|
806
|
+
},
|
|
807
|
+
) =>
|
|
808
|
+
applyFieldAnnotations(
|
|
809
|
+
Schema.Array(Schema.String)
|
|
810
|
+
.check(
|
|
811
|
+
Schema.makeFilter(
|
|
812
|
+
(values) =>
|
|
813
|
+
new Set(values).size === values.length ||
|
|
814
|
+
"Select each value only once.",
|
|
815
|
+
),
|
|
816
|
+
)
|
|
817
|
+
.annotate({ [FormCheckboxGroupInput]: { options: options.options } }),
|
|
818
|
+
options,
|
|
819
|
+
)
|
|
820
|
+
|
|
742
821
|
export interface RadioFieldMetadata<Value extends string = string> {
|
|
743
822
|
readonly options: readonly [
|
|
744
823
|
RadioFieldOption<Value>,
|
|
@@ -764,9 +843,10 @@ export const RadioField = <
|
|
|
764
843
|
options: FieldOptions<RadioOptionValues<Options>> & {
|
|
765
844
|
readonly options: Options
|
|
766
845
|
},
|
|
767
|
-
): Schema.
|
|
846
|
+
): Schema.Codec<
|
|
768
847
|
RadioOptionValues<Options>,
|
|
769
848
|
RadioOptionValues<Options>,
|
|
849
|
+
never,
|
|
770
850
|
never
|
|
771
851
|
> &
|
|
772
852
|
RadioFieldMarker => {
|
|
@@ -779,11 +859,12 @@ export const RadioField = <
|
|
|
779
859
|
}
|
|
780
860
|
|
|
781
861
|
return applyFieldAnnotations(
|
|
782
|
-
Schema.
|
|
862
|
+
Schema.Literals(values).annotate({ [FormRadioInput]: metadata }),
|
|
783
863
|
options,
|
|
784
|
-
) as Schema.
|
|
864
|
+
) as Schema.Codec<
|
|
785
865
|
RadioOptionValues<Options>,
|
|
786
866
|
RadioOptionValues<Options>,
|
|
867
|
+
never,
|
|
787
868
|
never
|
|
788
869
|
> &
|
|
789
870
|
RadioFieldMarker
|
|
@@ -795,7 +876,15 @@ export const RadioField = <
|
|
|
795
876
|
* When no query is provided, the field is still marked as a lookup
|
|
796
877
|
* but the query must be supplied via `Form.lookups.<field>.setQuery()`.
|
|
797
878
|
*/
|
|
798
|
-
export
|
|
879
|
+
export type LookupMode =
|
|
880
|
+
| { readonly mode?: "server"; readonly maxItems?: never }
|
|
881
|
+
| { readonly mode: "local"; readonly maxItems: number }
|
|
882
|
+
|
|
883
|
+
export type LookupFieldMetadata = LookupMode & {
|
|
884
|
+
/** Resolve one currently eligible identity independently of choice loading. */
|
|
885
|
+
readonly resolve?: (
|
|
886
|
+
value: string,
|
|
887
|
+
) => Effect.Effect<LookupItem | null, unknown, unknown>
|
|
799
888
|
readonly query?: (
|
|
800
889
|
filter: string,
|
|
801
890
|
limit: number,
|
|
@@ -872,24 +961,40 @@ export type CalendarSlotFieldOptions = FieldOptions<string> & {
|
|
|
872
961
|
* ```
|
|
873
962
|
*/
|
|
874
963
|
export const LookupField = (
|
|
875
|
-
options: FieldOptions<string> &
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
964
|
+
options: FieldOptions<string> &
|
|
965
|
+
LookupMode & {
|
|
966
|
+
readonly resolve?: LookupFieldMetadata["resolve"]
|
|
967
|
+
query?: QueryValue<
|
|
968
|
+
(
|
|
969
|
+
filter: string,
|
|
970
|
+
limit: number,
|
|
971
|
+
) => Effect.Effect<ReadonlyArray<LookupItem>, unknown, unknown>
|
|
972
|
+
>
|
|
973
|
+
},
|
|
974
|
+
): Schema.Codec<string, string, never, never> & LookupMarker => {
|
|
975
|
+
if (
|
|
976
|
+
options.mode === "local" &&
|
|
977
|
+
(!Number.isSafeInteger(options.maxItems) || options.maxItems < 1)
|
|
978
|
+
)
|
|
979
|
+
throw new Error("Local lookup maxItems must be a positive safe integer")
|
|
884
980
|
const metadata = {
|
|
981
|
+
...(options.resolve != null && { resolve: options.resolve }),
|
|
982
|
+
...(options.mode != null && { mode: options.mode }),
|
|
983
|
+
...(options.mode === "local" && { maxItems: options.maxItems }),
|
|
885
984
|
...(options.query != null && { query: options.query }),
|
|
886
985
|
}
|
|
887
|
-
const
|
|
986
|
+
const value = Schema.String.check(
|
|
987
|
+
Schema.isMinLength(1, {
|
|
988
|
+
message: "Select an option from the suggestions.",
|
|
989
|
+
}),
|
|
990
|
+
)
|
|
991
|
+
const base = value.annotate({
|
|
888
992
|
[FormLookupInput]: metadata,
|
|
889
993
|
})
|
|
890
|
-
return applyFieldAnnotations(base, options) as Schema.
|
|
994
|
+
return applyFieldAnnotations(base, options) as Schema.Codec<
|
|
891
995
|
string,
|
|
892
996
|
string,
|
|
997
|
+
never,
|
|
893
998
|
never
|
|
894
999
|
> &
|
|
895
1000
|
LookupMarker
|
|
@@ -911,17 +1016,18 @@ export const SuggestionField = (
|
|
|
911
1016
|
) => Effect.Effect<ReadonlyArray<LookupItem>, unknown, unknown>
|
|
912
1017
|
>
|
|
913
1018
|
},
|
|
914
|
-
): Schema.
|
|
1019
|
+
): Schema.Codec<string, string, never, never> & LookupMarker => {
|
|
915
1020
|
const metadata = {
|
|
916
1021
|
...(options.query != null && { query: options.query }),
|
|
917
1022
|
}
|
|
918
|
-
const base = Schema.String.
|
|
1023
|
+
const base = Schema.String.annotate({
|
|
919
1024
|
[FormLookupInput]: metadata,
|
|
920
1025
|
[FormSuggestionInput]: true,
|
|
921
1026
|
})
|
|
922
|
-
return applyFieldAnnotations(base, options) as Schema.
|
|
1027
|
+
return applyFieldAnnotations(base, options) as Schema.Codec<
|
|
923
1028
|
string,
|
|
924
1029
|
string,
|
|
1030
|
+
never,
|
|
925
1031
|
never
|
|
926
1032
|
> &
|
|
927
1033
|
LookupMarker
|
|
@@ -929,7 +1035,7 @@ export const SuggestionField = (
|
|
|
929
1035
|
|
|
930
1036
|
export const CalendarSlotField = (
|
|
931
1037
|
options: CalendarSlotFieldOptions,
|
|
932
|
-
): Schema.
|
|
1038
|
+
): Schema.Codec<string, string, never, never> & CalendarSlotMarker => {
|
|
933
1039
|
const metadata = {
|
|
934
1040
|
timeZone: options.timeZone,
|
|
935
1041
|
locale: options.locale ?? "en",
|
|
@@ -943,9 +1049,9 @@ export const CalendarSlotField = (
|
|
|
943
1049
|
}),
|
|
944
1050
|
}
|
|
945
1051
|
return applyFieldAnnotations(
|
|
946
|
-
Schema.String.
|
|
1052
|
+
Schema.String.annotate({ [FormCalendarSlotInput]: metadata }),
|
|
947
1053
|
options,
|
|
948
|
-
) as Schema.
|
|
1054
|
+
) as Schema.Codec<string, string, never, never> & CalendarSlotMarker
|
|
949
1055
|
}
|
|
950
1056
|
|
|
951
1057
|
export type ProviderUserDefault = string | typeof CurrentProviderUser
|
|
@@ -968,8 +1074,8 @@ export type ProviderUserFieldOptions = Omit<
|
|
|
968
1074
|
*/
|
|
969
1075
|
export const ProviderUserField = (
|
|
970
1076
|
options?: ProviderUserFieldOptions,
|
|
971
|
-
): Schema.
|
|
1077
|
+
): Schema.Codec<string, string, never, never> & ProviderUserMarker =>
|
|
972
1078
|
applyFieldAnnotations(
|
|
973
|
-
Schema.String.
|
|
1079
|
+
Schema.String.annotate({ [FormProviderUserInput]: true }),
|
|
974
1080
|
options,
|
|
975
|
-
) as Schema.
|
|
1081
|
+
) as Schema.Codec<string, string, never, never> & ProviderUserMarker
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Effect,
|
|
3
|
+
Number as EffectNumber,
|
|
4
|
+
Option,
|
|
5
|
+
Schema,
|
|
6
|
+
SchemaGetter,
|
|
7
|
+
SchemaIssue,
|
|
8
|
+
} from "effect"
|
|
9
|
+
|
|
10
|
+
/** Preserve the authored numeric-string contract, including explicit non-finite values. */
|
|
11
|
+
export const NumberFromString = Schema.String.pipe(
|
|
12
|
+
Schema.decodeTo(Schema.Number, {
|
|
13
|
+
decode: SchemaGetter.transformEffect((value) => {
|
|
14
|
+
const parsed = EffectNumber.parse(value)
|
|
15
|
+
return Option.isSome(parsed)
|
|
16
|
+
? Effect.succeed(parsed.value)
|
|
17
|
+
: Effect.fail(
|
|
18
|
+
new SchemaIssue.InvalidValue(
|
|
19
|
+
{ message: "Must be a numeric string" },
|
|
20
|
+
value,
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
}),
|
|
24
|
+
encode: SchemaGetter.transform(String),
|
|
25
|
+
}),
|
|
26
|
+
)
|
|
@@ -24,7 +24,6 @@ import { type FieldOptions, applyFieldAnnotations } from "./form-schema.ts"
|
|
|
24
24
|
// Valid characters with an optional leading country-code plus sign.
|
|
25
25
|
const VALID_PHONE_CHARS = /^\+?[\d\s\-()]+$/
|
|
26
26
|
|
|
27
|
-
// Count digits in the string
|
|
28
27
|
const countDigits = (s: string): number => {
|
|
29
28
|
return (s.match(/\d/g) || []).length
|
|
30
29
|
}
|
|
@@ -39,21 +38,23 @@ const isPhoneNumber = (s: string): boolean => {
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
export const Phone = Schema.Trim.pipe(
|
|
42
|
-
Schema.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
Schema.check(
|
|
42
|
+
Schema.makeFilter((s) => isPhoneNumber(s), {
|
|
43
|
+
message: "must be a valid phone number (7-15 digits)",
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
Schema.annotate({
|
|
46
47
|
identifier: "Phone",
|
|
47
48
|
title: "Phone number",
|
|
48
49
|
description: "A valid phone number",
|
|
49
|
-
|
|
50
|
+
format: "phone",
|
|
50
51
|
[FormPhoneInput]: true,
|
|
51
52
|
}),
|
|
52
53
|
)
|
|
53
54
|
|
|
54
55
|
export const PhoneField = (
|
|
55
56
|
options?: FieldOptions<string>,
|
|
56
|
-
): Schema.
|
|
57
|
+
): Schema.Codec<string, string, never, never> =>
|
|
57
58
|
applyFieldAnnotations(Phone, {
|
|
58
59
|
autoComplete: options?.autoComplete ?? "tel",
|
|
59
60
|
...options,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Schema } from "effect"
|
|
2
|
+
import { EmailField } from "./email.ts"
|
|
3
|
+
|
|
4
|
+
/** System-owned correction has its own authorization and submission operation. */
|
|
5
|
+
export const publicCompletionCorrectionForm = Schema.Struct({
|
|
6
|
+
correctedEmail: EmailField({ label: "Corrected email" }),
|
|
7
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { LookupItem } from "./form-schema.ts"
|
|
2
|
+
|
|
3
|
+
const normalize = (text: string): string =>
|
|
4
|
+
text.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().trim()
|
|
5
|
+
|
|
6
|
+
/** Apply the lookup search contract to a complete eligible datasource, before limiting. */
|
|
7
|
+
export function searchLookupItems(
|
|
8
|
+
items: readonly LookupItem[],
|
|
9
|
+
filter: string,
|
|
10
|
+
limit: number,
|
|
11
|
+
): LookupItem[] {
|
|
12
|
+
const query = normalize(filter)
|
|
13
|
+
if (!query) return items.slice(0, limit)
|
|
14
|
+
const words = query.split(/\s+/u)
|
|
15
|
+
const exact: LookupItem[] = []
|
|
16
|
+
const prefix: LookupItem[] = []
|
|
17
|
+
const remaining: LookupItem[] = []
|
|
18
|
+
for (const item of items) {
|
|
19
|
+
const label = normalize(item.label)
|
|
20
|
+
const text = `${label} ${normalize(item.searchText ?? "")}`
|
|
21
|
+
if (!words.every((word) => text.includes(word))) continue
|
|
22
|
+
if (label === query) exact.push(item)
|
|
23
|
+
else if (label.startsWith(query)) prefix.push(item)
|
|
24
|
+
else remaining.push(item)
|
|
25
|
+
}
|
|
26
|
+
return [...exact, ...prefix, ...remaining].slice(0, limit)
|
|
27
|
+
}
|