@processfocus/runtime-local 0.1.0-next.0
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/LICENSE.md +28 -0
- package/README.md +290 -0
- package/dist/authentication-server.mjs +188 -0
- package/dist/chunk-2sb4v2sx.js +70 -0
- package/dist/chunk-9weqs8n8.js +56031 -0
- package/dist/chunk-mvkr77wp.js +54113 -0
- package/dist/chunk-tkn4cnc8.js +453 -0
- package/dist/chunk-vpsm84e8.js +85 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/app-icons/[...path]/route.ts +63 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/health/page.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/public-form-branding/[...path]/route.ts +95 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +248 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +751 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +375 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +73 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +22 -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 +11 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/abandon-execution-dialog.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/execution-card-menu.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +1549 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-dialog.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-modal-client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-route-fallback.tsx +18 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/restart-execution-feedback.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +215 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +23 -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 +678 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +228 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +147 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +246 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +71 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +315 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +259 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-detail-title.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/loading.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/org-chart-client.tsx +74 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +188 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +320 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +152 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +105 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-submit-button.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +282 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/mobile-process-catalog.ts +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/start-process-actions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +504 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +153 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/loading.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/process-documentation.tsx +209 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/use-workflow-auto-refresh.ts +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/loading.tsx +1 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/access-handbook.tsx +110 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-loading.tsx +25 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-tabs.tsx +47 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-helpers.ts +17 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-source.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/evaluate-cedar.ts +43 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +526 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-cedar.ts +174 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +390 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/org-data.ts +70 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +594 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-skeleton.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +186 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +69 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers-table.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles-table.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +244 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +329 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/error.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/not-found.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/stats-data-fetcher.tsx +93 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +143 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +50 -0
- 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 +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +50 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +58 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +154 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +1317 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +259 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +127 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +33 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-options/route.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-verify/route.ts +142 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register/route.ts +103 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register-verify/route.ts +136 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/registration-session/route.ts +129 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +153 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +122 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +177 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-completed/route.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +38 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +266 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +118 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/test-host/route.ts +125 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/calendar-slots/route.ts +44 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/complete/route.ts +56 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/request-fresh-link/route.ts +41 -0
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +393 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/loading.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +51 -0
- package/dist/dashboard-source/apps/frontend/app/embed/embedded.css +48 -0
- package/dist/dashboard-source/apps/frontend/app/embed/layout.tsx +15 -0
- package/dist/dashboard-source/apps/frontend/app/global.css +13 -0
- package/dist/dashboard-source/apps/frontend/app/layout.tsx +102 -0
- package/dist/dashboard-source/apps/frontend/app/login/layout.tsx +9 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-button.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form-content.tsx +117 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +52 -0
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +226 -0
- package/dist/dashboard-source/apps/frontend/app/login/secret-login-form.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/manifest.ts +7 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/error.tsx +63 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/layout.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/page.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-card.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-context.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-html.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +553 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-state-content.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +33 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/layout.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/page.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +292 -0
- package/dist/dashboard-source/apps/frontend/app/theme.css +117 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +693 -0
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +481 -0
- package/dist/dashboard-source/apps/frontend/components/OrgUnitNode.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +245 -0
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +158 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-card.tsx +218 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-header-row.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/copy-button.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-activity.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-skeleton.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/components/feature-permissions-provider.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +66 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-host.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-identify.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-provider.tsx +55 -0
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +378 -0
- package/dist/dashboard-source/apps/frontend/components/mobile-home-switchboard.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/components/mocks-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/components/org-settings-provider.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/components/process-workflow-link.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/components/session-reissue.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +89 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-stats-views.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/components/theme-provider.tsx +132 -0
- package/dist/dashboard-source/apps/frontend/components/todo-count-badge.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +304 -0
- package/dist/dashboard-source/apps/frontend/components/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dialog.tsx +142 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dropdown-menu.tsx +256 -0
- package/dist/dashboard-source/apps/frontend/components/ui/input.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/components/ui/pagination.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sheet.tsx +138 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +741 -0
- package/dist/dashboard-source/apps/frontend/components/ui/skeleton.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/components/ui/table.tsx +115 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tooltip.tsx +60 -0
- package/dist/dashboard-source/apps/frontend/components/without-waiting-badge.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +116 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/swimlane-node.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +189 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +79 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +74 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-mobile.ts +27 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-notification-preference.ts +246 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +56 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +101 -0
- package/dist/dashboard-source/apps/frontend/index.d.ts +12 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.node.ts +25 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/app-icons-metadata.ts +66 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +128 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +355 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/config.ts +18 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/reconnect-registry.ts +34 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/act-on-behalf-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/callback-error.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +32 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client.ts +46 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/config.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/issuer.ts +164 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/jwt.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +117 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +52 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/redirect.ts +105 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/secret-login-presentation.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-cache-scope.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-role.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +277 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +95 -0
- package/dist/dashboard-source/apps/frontend/lib/authorization-tabs.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/cedar-highlight.ts +116 -0
- package/dist/dashboard-source/apps/frontend/lib/client-plugin-error-reporting.ts +28 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +1119 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-scope.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/database-error-ui.tsx +61 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution-collection-provider.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +161 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution-collection-provider.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +215 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +394 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-registry.ts +196 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-database-name.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-lifecycle.ts +368 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-provider.tsx +577 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +133 -0
- package/dist/dashboard-source/apps/frontend/lib/current-provider-user.ts +30 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/frontend-port-file.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-events.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/error-boundary.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/index.ts +31 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +168 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +206 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +36 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +94 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/index.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest-store.ts +20 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +152 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-request-origin.ts +39 -0
- package/dist/dashboard-source/apps/frontend/lib/errors/get-display-error-message.ts +22 -0
- package/dist/dashboard-source/apps/frontend/lib/execution-menu-actions-registry.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/feature-permissions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-boot-health.tsx +161 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-client-plugin-registry.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest-store.ts +214 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-plugin-loaders.ts +191 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/fragment-masking.ts +87 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +292 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +443 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-consumer.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-error-reporting.ts +268 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-provider.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dashboard-activity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +78 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/endpoint.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/execution-queries.ts +70 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/file-upload-provider.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/graphql-identifiers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +327 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +63 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-queries.ts +67 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/provider-user-queries.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +80 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +15 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +634 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views-server.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +138 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-home-view-model.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-shell-policy.ts +124 -0
- package/dist/dashboard-source/apps/frontend/lib/mock-data.ts +364 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +251 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +178 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notifications-runtime.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/use-todo-notifications.tsx +103 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-depth-config.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-layout.ts +149 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-types.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-loaders.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-preparation.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins-client.tsx +99 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-graphql-errors.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +200 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +209 -0
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/restart-execution-action.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/runtime-config.ts +23 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/constants.ts +5 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/otlp-config.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/register-otel.ts +308 -0
- package/dist/dashboard-source/apps/frontend/lib/theme.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-types.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +144 -0
- package/dist/dashboard-source/apps/frontend/lib/types/org-identity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/utils.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/constants.ts +118 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/edge-routing.ts +195 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/form-preview.ts +8 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +878 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/types.ts +63 -0
- package/dist/dashboard-source/apps/frontend/next.config.ts +238 -0
- package/dist/dashboard-source/apps/frontend/package.json +71 -0
- package/dist/dashboard-source/apps/frontend/postcss.config.mjs +5 -0
- package/dist/dashboard-source/apps/frontend/proxy.ts +293 -0
- package/dist/dashboard-source/apps/frontend/public/.gitkeep +0 -0
- package/dist/dashboard-source/apps/frontend/public/favicon.ico +0 -0
- package/dist/dashboard-source/apps/frontend/public/processfocus-embed.js +553 -0
- package/dist/dashboard-source/apps/frontend/tsconfig.json +35 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +7 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +1397 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +18 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +346 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +172 -0
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +263 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +34 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/errors.ts +47 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +595 -0
- package/dist/dashboard-source/modules/auth-session/src/index.ts +22 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/issuer-url.ts +192 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +76 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/session-cache-scope.ts +24 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +54 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/url.ts +2 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +3 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/acm.ts +50 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/otlp-config.ts +66 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/runtime-ssm.ts +28 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/index.ts +1 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +65 -0
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +78 -0
- package/dist/dashboard-source/modules/form/src/index.ts +20 -0
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +152 -0
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +1421 -0
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +85 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +58 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +34 -0
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +1554 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +440 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +13 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +336 -0
- package/dist/dashboard-source/modules/form-rule/src/index.ts +21 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +531 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +102 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +121 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +8 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +44 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/deferred-value.ts +21 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +50 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +82 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +58 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +975 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +60 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +45 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/endpoint.ts +137 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/index.ts +11 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/port-files.ts +219 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/index.ts +2 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +201 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +408 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/index.ts +29 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +288 -0
- package/dist/dashboard-source/modules/openauth/src/client.ts +1045 -0
- package/dist/dashboard-source/modules/openauth/src/error.ts +140 -0
- package/dist/dashboard-source/modules/openauth/src/pkce.ts +40 -0
- package/dist/dashboard-source/modules/openauth/src/random.ts +24 -0
- package/dist/dashboard-source/modules/openauth/src/subject.ts +132 -0
- package/dist/dashboard-source/modules/openauth/src/util.ts +13 -0
- package/dist/dashboard-source/modules/request-time/src/index.ts +1 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +30 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/draft-process-execution-schema.json +45 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +217 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/process-schema.json +77 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/todo-schema.json +94 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/index.ts +2 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +181 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +166 -0
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +60 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/boolean-field.tsx +73 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/calendar-slot-field.tsx +808 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +127 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/field-set.tsx +14 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-field.tsx +321 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-upload-context.tsx +45 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/form-context.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +394 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/radio-field.tsx +96 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/select-field.tsx +106 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/text-field.tsx +245 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/button.tsx +63 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/command.tsx +101 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/field.tsx +275 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/input.tsx +29 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/label.tsx +23 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/separator.tsx +27 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/textarea.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/utils/utils.ts +4 -0
- package/dist/dashboard-source.json +70 -0
- package/dist/graphql-server.mjs +1319 -0
- package/dist/job-worker.mjs +989 -0
- package/dist/main.mjs +495 -0
- package/dist/prepare-dashboard.mjs +35 -0
- package/dist/resources/cedar/policies.cedar +315 -0
- package/dist/resources/cedar/schema.cedarschema +276 -0
- package/dist/resources/graphql-schema/rxdb.graphql +401 -0
- package/dist/resources/graphql-schema/system.graphql +1200 -0
- package/package.json +98 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context, Data, Effect, FiberRef, Layer } from "effect"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Authentication error thrown when no access token is available.
|
|
5
|
+
* Pages must handle this to ensure proper authentication.
|
|
6
|
+
*/
|
|
7
|
+
export class GraphQLAuthenticationError extends Data.TaggedError(
|
|
8
|
+
"GraphQLAuthenticationError",
|
|
9
|
+
)<{
|
|
10
|
+
readonly message: string
|
|
11
|
+
}> {}
|
|
12
|
+
|
|
13
|
+
interface AccessTokenValue {
|
|
14
|
+
readonly token: string | null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Service providing a FiberRef with the access token for the current request.
|
|
19
|
+
* The token is set at the start of each page render and inherited by all
|
|
20
|
+
* resolver effects running in child fibers.
|
|
21
|
+
*/
|
|
22
|
+
export class AccessToken extends Context.Tag("processfocus:internal-tag/frontend/AccessToken")<
|
|
23
|
+
AccessToken,
|
|
24
|
+
FiberRef.FiberRef<AccessTokenValue>
|
|
25
|
+
>() {}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Live layer for AccessToken service.
|
|
29
|
+
* Initializes FiberRef with null token - must be set via Effect.locally in page wrapper.
|
|
30
|
+
*/
|
|
31
|
+
export const AccessTokenLive = Layer.succeed(
|
|
32
|
+
AccessToken,
|
|
33
|
+
FiberRef.unsafeMake<AccessTokenValue>({ token: null }),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Helper to get the current access token from the AccessToken FiberRef.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const { token } = yield* getAccessToken()
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export const getAccessToken = (): Effect.Effect<
|
|
45
|
+
AccessTokenValue,
|
|
46
|
+
never,
|
|
47
|
+
AccessToken
|
|
48
|
+
> => Effect.flatMap(AccessToken, FiberRef.get)
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import "server-only"
|
|
2
|
+
|
|
3
|
+
import { FetchHttpClient } from "@effect/platform"
|
|
4
|
+
import { Data, DateTime, Effect, FiberRef, Layer } from "effect"
|
|
5
|
+
import { cacheLife, cacheTag } from "next/cache"
|
|
6
|
+
import {
|
|
7
|
+
LocalCedarAuthorizationLive,
|
|
8
|
+
LocalCedarConfig,
|
|
9
|
+
} from "../../../../../modules/auth-local-cedar/src/index.ts"
|
|
10
|
+
import {
|
|
11
|
+
Application,
|
|
12
|
+
AuthorizationService,
|
|
13
|
+
DelegationPrincipal,
|
|
14
|
+
type FeatureAction,
|
|
15
|
+
ProviderUserPrincipal,
|
|
16
|
+
} from "../../../../../modules/auth-policy/src/index.ts"
|
|
17
|
+
import { type ProviderUserSession, getFrontendJwt } from "../../../../../modules/auth-session/src/index.ts"
|
|
18
|
+
import { RequestTime } from "../../../../../modules/request-time/src/index.ts"
|
|
19
|
+
import {
|
|
20
|
+
type FeaturePermissions,
|
|
21
|
+
noFeaturePermissions,
|
|
22
|
+
} from "@/lib/feature-permissions"
|
|
23
|
+
import { fetchCedarPolicies } from "@/lib/graphql/queries"
|
|
24
|
+
import { createServerGraphqlClient } from "@/lib/graphql/server-client"
|
|
25
|
+
|
|
26
|
+
export class CedarConfigError extends Data.TaggedError("processfocus:internal-tag/CedarConfigError")<{
|
|
27
|
+
readonly message: string
|
|
28
|
+
readonly cause?: unknown
|
|
29
|
+
}> {}
|
|
30
|
+
|
|
31
|
+
const FRONTEND_JWT_TOKEN = getFrontendJwt()
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Fetch Cedar policies. Cached by Next.js — invalidated on deploy or
|
|
35
|
+
* via `revalidateTag("cedar-policies")`.
|
|
36
|
+
*/
|
|
37
|
+
async function getCedarPolicies(): Promise<{
|
|
38
|
+
policiesText: readonly string[]
|
|
39
|
+
schemaText: string
|
|
40
|
+
}> {
|
|
41
|
+
"use cache"
|
|
42
|
+
cacheLife("max")
|
|
43
|
+
cacheTag("cedar-policies")
|
|
44
|
+
|
|
45
|
+
if (!FRONTEND_JWT_TOKEN) {
|
|
46
|
+
throw new CedarConfigError({
|
|
47
|
+
message:
|
|
48
|
+
"FRONTEND_JWT_TOKEN is not configured - authorization is disabled",
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log("[Cedar] Fetching policies from GraphQL cedarPolicies query")
|
|
53
|
+
|
|
54
|
+
const client = createServerGraphqlClient(FRONTEND_JWT_TOKEN)
|
|
55
|
+
const data = await fetchCedarPolicies(client)
|
|
56
|
+
if (!data) {
|
|
57
|
+
throw new Error("GraphQL cedarPolicies query returned no data")
|
|
58
|
+
}
|
|
59
|
+
console.log(`[Cedar] Policies cached: ${data.policies.length} file(s)`)
|
|
60
|
+
return {
|
|
61
|
+
policiesText: data.policies,
|
|
62
|
+
schemaText: data.schema,
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Fetches Cedar policies via the Next.js cache.
|
|
68
|
+
*/
|
|
69
|
+
const fetchCedarPoliciesWithCache = Effect.gen(function* () {
|
|
70
|
+
return yield* Effect.tryPromise({
|
|
71
|
+
try: () => getCedarPolicies(),
|
|
72
|
+
catch: (error) =>
|
|
73
|
+
new CedarConfigError({
|
|
74
|
+
message:
|
|
75
|
+
error instanceof Error
|
|
76
|
+
? error.message
|
|
77
|
+
: "Failed to fetch Cedar policies",
|
|
78
|
+
cause: error,
|
|
79
|
+
}),
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates a Cedar config layer that fetches policies from the GraphQL server.
|
|
85
|
+
*/
|
|
86
|
+
const CedarConfigLayer = Layer.effect(
|
|
87
|
+
LocalCedarConfig,
|
|
88
|
+
fetchCedarPoliciesWithCache,
|
|
89
|
+
).pipe(Layer.provide(FetchHttpClient.layer))
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* RequestTime layer with current timestamp.
|
|
93
|
+
*/
|
|
94
|
+
const RequestTimeLayer = Layer.effect(
|
|
95
|
+
RequestTime,
|
|
96
|
+
Effect.sync(() => FiberRef.unsafeMake(DateTime.unsafeMake(new Date()))),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Complete Cedar authorization layer for SSR pages.
|
|
101
|
+
* Combines Cedar policies, schema, and request time.
|
|
102
|
+
* Provides both AuthorizationService and RequestTime to consumers.
|
|
103
|
+
*/
|
|
104
|
+
export const CedarAuthorizationLayer = Layer.merge(
|
|
105
|
+
Layer.provide(
|
|
106
|
+
LocalCedarAuthorizationLive,
|
|
107
|
+
Layer.merge(CedarConfigLayer, RequestTimeLayer),
|
|
108
|
+
),
|
|
109
|
+
RequestTimeLayer,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
/** Default application ID for feature-based authorization checks */
|
|
113
|
+
const DEFAULT_APPLICATION_ID = "default"
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Check all feature permissions for a provider user session.
|
|
117
|
+
* Returns an object with boolean flags for each feature.
|
|
118
|
+
*
|
|
119
|
+
* If authorization fails (Cedar error), all permissions are denied.
|
|
120
|
+
*/
|
|
121
|
+
export const checkFeaturePermissions = (
|
|
122
|
+
session: ProviderUserSession,
|
|
123
|
+
): Effect.Effect<
|
|
124
|
+
FeaturePermissions,
|
|
125
|
+
never,
|
|
126
|
+
AuthorizationService | RequestTime
|
|
127
|
+
> =>
|
|
128
|
+
Effect.gen(function* () {
|
|
129
|
+
const auth = yield* AuthorizationService
|
|
130
|
+
|
|
131
|
+
const principal = session.delegation
|
|
132
|
+
? new DelegationPrincipal(session.delegation.id, {
|
|
133
|
+
owner: session.email,
|
|
134
|
+
name: session.delegation.name,
|
|
135
|
+
roles: session.roles,
|
|
136
|
+
orgUnitId: session.orgUnitPath,
|
|
137
|
+
})
|
|
138
|
+
: new ProviderUserPrincipal(session.email, {
|
|
139
|
+
roles: session.roles,
|
|
140
|
+
orgUnitId: session.orgUnitPath,
|
|
141
|
+
})
|
|
142
|
+
const app = new Application(DEFAULT_APPLICATION_ID)
|
|
143
|
+
|
|
144
|
+
const checkFeature = (action: FeatureAction) =>
|
|
145
|
+
auth.canAccessFeature(principal, app, action).pipe(
|
|
146
|
+
Effect.catchAll((error) => {
|
|
147
|
+
console.error(
|
|
148
|
+
`[Cedar] Authorization check failed for action "${action}":`,
|
|
149
|
+
error,
|
|
150
|
+
)
|
|
151
|
+
return Effect.succeed(false)
|
|
152
|
+
}),
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
const [
|
|
156
|
+
administerUsers,
|
|
157
|
+
administerOAuthProviders,
|
|
158
|
+
showProcessState,
|
|
159
|
+
viewAuthorization,
|
|
160
|
+
] = yield* Effect.all([
|
|
161
|
+
checkFeature("administerUsers"),
|
|
162
|
+
checkFeature("administerOAuthProviders"),
|
|
163
|
+
checkFeature("showProcessState"),
|
|
164
|
+
checkFeature("viewAuthorization"),
|
|
165
|
+
])
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
administerUsers,
|
|
169
|
+
administerOAuthProviders,
|
|
170
|
+
showProcessState,
|
|
171
|
+
viewAuthorization,
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Check if provider user has any settings-related permissions.
|
|
177
|
+
* Used to determine if the Settings link should be shown in the sidebar.
|
|
178
|
+
*/
|
|
179
|
+
export const hasAnySettingsPermission = (
|
|
180
|
+
permissions: FeaturePermissions,
|
|
181
|
+
): boolean =>
|
|
182
|
+
permissions.administerUsers || permissions.administerOAuthProviders
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get feature permissions for a provider user session.
|
|
186
|
+
* This is a convenience function that runs the Effect with the Cedar layer.
|
|
187
|
+
*
|
|
188
|
+
* Returns default (all false) permissions if Cedar check fails.
|
|
189
|
+
*/
|
|
190
|
+
export const getFeaturePermissions = async (
|
|
191
|
+
session: ProviderUserSession,
|
|
192
|
+
): Promise<FeaturePermissions> => {
|
|
193
|
+
const effect = checkFeaturePermissions(session).pipe(
|
|
194
|
+
Effect.provide(CedarAuthorizationLayer),
|
|
195
|
+
Effect.catchAll(() => Effect.succeed(noFeaturePermissions)),
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
return Effect.runPromise(effect)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Ensure Cedar policies are fetched and cached.
|
|
203
|
+
* Awaitable — safe to call during SSR/prerendering.
|
|
204
|
+
*/
|
|
205
|
+
export const ensureCedarPolicies = (): Promise<void> =>
|
|
206
|
+
getCedarPolicies().then(() => undefined)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Context, Schema as ES, Effect, Layer } from "effect"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Form validation service for validating form data against Effect schemas.
|
|
5
|
+
*/
|
|
6
|
+
export class FormValidationService extends Context.Tag(
|
|
7
|
+
"processfocus:internal-tag/frontend/FormValidationService",
|
|
8
|
+
)<
|
|
9
|
+
FormValidationService,
|
|
10
|
+
{
|
|
11
|
+
readonly validateFormData: <A, I>(
|
|
12
|
+
schema: ES.Schema<A, I>,
|
|
13
|
+
data: unknown,
|
|
14
|
+
) => Effect.Effect<A, Error>
|
|
15
|
+
}
|
|
16
|
+
>() {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Form validation service layer implementation.
|
|
20
|
+
*/
|
|
21
|
+
export const FormValidationServiceLive = Layer.succeed(
|
|
22
|
+
FormValidationService,
|
|
23
|
+
FormValidationService.of({
|
|
24
|
+
validateFormData: <A, I>(schema: ES.Schema<A, I>, data: unknown) =>
|
|
25
|
+
Effect.try({
|
|
26
|
+
try: () => {
|
|
27
|
+
const result = ES.decodeUnknownEither(schema)(data)
|
|
28
|
+
if (result._tag === "Right") {
|
|
29
|
+
return result.right
|
|
30
|
+
}
|
|
31
|
+
throw new Error(result.left.message)
|
|
32
|
+
},
|
|
33
|
+
catch: (error) => new Error(`Form validation failed: ${String(error)}`),
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect"
|
|
2
|
+
import { GraphQLClient, type RequestDocument } from "graphql-request"
|
|
3
|
+
import {
|
|
4
|
+
type AccessToken,
|
|
5
|
+
GraphQLAuthenticationError,
|
|
6
|
+
getAccessToken,
|
|
7
|
+
} from "./access-token.ts"
|
|
8
|
+
import { getGraphqlEndpoint } from "@/lib/graphql/endpoint"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Extract the operation name from a GraphQL query/mutation.
|
|
12
|
+
* Falls back to truncated document if no name found.
|
|
13
|
+
*/
|
|
14
|
+
const getQueryName = (doc: RequestDocument): string => {
|
|
15
|
+
const str = String(doc)
|
|
16
|
+
const match = str.match(/(?:query|mutation|subscription)\s+(\w+)/)
|
|
17
|
+
return match?.[1] ?? str.slice(0, 50)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* GraphQL client service for making GraphQL requests.
|
|
22
|
+
* Wraps graphql-request with Effect error handling and automatic authentication.
|
|
23
|
+
*/
|
|
24
|
+
export class GraphQLService extends Context.Tag("processfocus:internal-tag/frontend/GraphQLService")<
|
|
25
|
+
GraphQLService,
|
|
26
|
+
{
|
|
27
|
+
readonly client: GraphQLClient
|
|
28
|
+
readonly request: <T>(
|
|
29
|
+
query: RequestDocument,
|
|
30
|
+
variables?: Record<string, unknown>,
|
|
31
|
+
headers?: HeadersInit,
|
|
32
|
+
) => Effect.Effect<T, Error | GraphQLAuthenticationError, AccessToken>
|
|
33
|
+
}
|
|
34
|
+
>() {}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates a GraphQL service layer with the configured endpoint.
|
|
38
|
+
* Uses Effect.sync to defer client creation until the layer is actually used.
|
|
39
|
+
*
|
|
40
|
+
* The client is configured with credentials: "include" to send cookies automatically
|
|
41
|
+
* in browser contexts.
|
|
42
|
+
*
|
|
43
|
+
* Authentication is handled automatically via the AccessToken FiberRef - the service
|
|
44
|
+
* will fail with GraphQLAuthenticationError if no token is available. This ensures
|
|
45
|
+
* all GraphQL requests are properly authenticated.
|
|
46
|
+
*
|
|
47
|
+
* Custom headers can still be passed via the headers parameter and will be merged
|
|
48
|
+
* with the automatic Authorization header.
|
|
49
|
+
*/
|
|
50
|
+
export const GraphQLServiceLive = Layer.effect(
|
|
51
|
+
GraphQLService,
|
|
52
|
+
Effect.sync(() => {
|
|
53
|
+
const client = new GraphQLClient(getGraphqlEndpoint(), {
|
|
54
|
+
credentials: "include",
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
return GraphQLService.of({
|
|
58
|
+
client,
|
|
59
|
+
request: <T>(
|
|
60
|
+
query: RequestDocument,
|
|
61
|
+
variables?: Record<string, unknown>,
|
|
62
|
+
headers?: HeadersInit,
|
|
63
|
+
) =>
|
|
64
|
+
Effect.gen(function* () {
|
|
65
|
+
const { token } = yield* getAccessToken()
|
|
66
|
+
|
|
67
|
+
if (!token) {
|
|
68
|
+
return yield* Effect.fail(
|
|
69
|
+
new GraphQLAuthenticationError({
|
|
70
|
+
message:
|
|
71
|
+
"No authentication token available. User must be logged in to make GraphQL requests.",
|
|
72
|
+
}),
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const authHeaders: HeadersInit = { Authorization: `Bearer ${token}` }
|
|
77
|
+
const mergedHeaders = { ...authHeaders, ...headers }
|
|
78
|
+
|
|
79
|
+
return yield* Effect.tryPromise({
|
|
80
|
+
try: () => client.request<T>(query, variables, mergedHeaders),
|
|
81
|
+
catch: (error) =>
|
|
82
|
+
new Error(`GraphQL request failed: ${String(error)}`),
|
|
83
|
+
}).pipe(
|
|
84
|
+
Effect.withSpan("graphql.request", {
|
|
85
|
+
attributes: {
|
|
86
|
+
"graphql.operation": getQueryName(query),
|
|
87
|
+
"graphql.document": String(query).slice(0, 200),
|
|
88
|
+
},
|
|
89
|
+
}),
|
|
90
|
+
)
|
|
91
|
+
}),
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "server-only"
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
AccessToken,
|
|
5
|
+
AccessTokenLive,
|
|
6
|
+
GraphQLAuthenticationError,
|
|
7
|
+
getAccessToken,
|
|
8
|
+
} from "./access-token.ts"
|
|
9
|
+
export {
|
|
10
|
+
CedarAuthorizationLayer,
|
|
11
|
+
checkFeaturePermissions,
|
|
12
|
+
ensureCedarPolicies,
|
|
13
|
+
getFeaturePermissions,
|
|
14
|
+
hasAnySettingsPermission,
|
|
15
|
+
} from "./authorization.ts"
|
|
16
|
+
export {
|
|
17
|
+
FormValidationService,
|
|
18
|
+
FormValidationServiceLive,
|
|
19
|
+
} from "./form-validation.ts"
|
|
20
|
+
export { GraphQLService, GraphQLServiceLive } from "./graphql.ts"
|
|
21
|
+
export type { FeaturePermissions } from "@/lib/feature-permissions"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type EmbedManifestEntry,
|
|
3
|
+
findEmbedManifestEntryForPath,
|
|
4
|
+
} from "./embed-manifest.ts"
|
|
5
|
+
import { getFrontendManifest } from "./frontend-manifest-store.ts"
|
|
6
|
+
|
|
7
|
+
export const getEmbedManifestEntries = (): readonly EmbedManifestEntry[] =>
|
|
8
|
+
getFrontendManifest().embed.entries
|
|
9
|
+
|
|
10
|
+
export const getEmbedManifestEntry = (
|
|
11
|
+
stepPath: string,
|
|
12
|
+
): EmbedManifestEntry | undefined =>
|
|
13
|
+
getFrontendManifest().embed.entries.find(
|
|
14
|
+
(entry) => entry.stepPath === stepPath,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
export const getEmbedManifestEntryForPath = (
|
|
18
|
+
path: string,
|
|
19
|
+
): EmbedManifestEntry | undefined =>
|
|
20
|
+
findEmbedManifestEntryForPath(getFrontendManifest().embed.entries, path)
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { ClientFormDefinition } from "../../../modules/form-client-representation/src/lib/client-form-definition.ts"
|
|
2
|
+
import {
|
|
3
|
+
type FormComponent,
|
|
4
|
+
FormComponentType,
|
|
5
|
+
} from "../../../modules/form-client-representation/src/lib/types.ts"
|
|
6
|
+
|
|
7
|
+
export interface EmbedManifestEntry {
|
|
8
|
+
readonly stepPath: string
|
|
9
|
+
readonly processName: string
|
|
10
|
+
readonly processPath: string
|
|
11
|
+
readonly mutationName: string
|
|
12
|
+
readonly inputTypeName: string
|
|
13
|
+
readonly totalFields: number
|
|
14
|
+
readonly formDefinition: ClientFormDefinition | null
|
|
15
|
+
readonly defaultValues: Record<string, unknown> | null
|
|
16
|
+
readonly jsonSchema: Record<string, unknown> | null
|
|
17
|
+
readonly sites: readonly string[]
|
|
18
|
+
readonly thankYou: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const EMBED_EVENT_SOURCE = "processfocus-embed"
|
|
22
|
+
export const EMBED_EVENT_VERSION = 1
|
|
23
|
+
|
|
24
|
+
export type EmbedHostEventType = "ready" | "resize" | "submitted"
|
|
25
|
+
|
|
26
|
+
export interface EmbedHostEvent {
|
|
27
|
+
readonly source: typeof EMBED_EVENT_SOURCE
|
|
28
|
+
readonly version: typeof EMBED_EVENT_VERSION
|
|
29
|
+
readonly event: EmbedHostEventType
|
|
30
|
+
readonly stepPath: string
|
|
31
|
+
readonly height?: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface EmbedLookupDefinition {
|
|
35
|
+
readonly type: FormComponentType.Lookup | FormComponentType.CalendarSlot
|
|
36
|
+
readonly field: string
|
|
37
|
+
readonly normalizedField: string
|
|
38
|
+
readonly dependencies: readonly string[]
|
|
39
|
+
readonly queryName?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Generic lookup queries receive the leaf field name, so nested field paths are
|
|
43
|
+
// normalized to their last segment before checking the embed manifest allowlist.
|
|
44
|
+
const normalizeEmbedLookupFieldName = (field: string): string =>
|
|
45
|
+
field.split(".").pop() ?? field
|
|
46
|
+
|
|
47
|
+
const collectEmbedLookupDefinitionsFromComponent = (
|
|
48
|
+
component: FormComponent,
|
|
49
|
+
): EmbedLookupDefinition[] => {
|
|
50
|
+
if (component._tag === FormComponentType.Lookup) {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
type: FormComponentType.Lookup,
|
|
54
|
+
field: component.field,
|
|
55
|
+
normalizedField: normalizeEmbedLookupFieldName(component.field),
|
|
56
|
+
dependencies: component.dependencies ?? [],
|
|
57
|
+
...(component.queryName && {
|
|
58
|
+
queryName: component.queryName,
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (component._tag === FormComponentType.CalendarSlot) {
|
|
65
|
+
return [
|
|
66
|
+
{
|
|
67
|
+
type: FormComponentType.CalendarSlot,
|
|
68
|
+
field: component.field,
|
|
69
|
+
normalizedField: normalizeEmbedLookupFieldName(component.field),
|
|
70
|
+
dependencies: [],
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (component._tag === FormComponentType.FieldSet) {
|
|
76
|
+
return Object.values(component.children).flatMap(
|
|
77
|
+
collectEmbedLookupDefinitionsFromComponent,
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (
|
|
82
|
+
component._tag === FormComponentType.List ||
|
|
83
|
+
component._tag === FormComponentType.Table
|
|
84
|
+
) {
|
|
85
|
+
return Object.values(component.itemChildren).flatMap(
|
|
86
|
+
collectEmbedLookupDefinitionsFromComponent,
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return []
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const collectEmbedLookupDefinitions = (
|
|
94
|
+
formDefinition: ClientFormDefinition | null,
|
|
95
|
+
): readonly EmbedLookupDefinition[] => {
|
|
96
|
+
if (!formDefinition) {
|
|
97
|
+
return []
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return Object.values(formDefinition.components).flatMap(
|
|
101
|
+
collectEmbedLookupDefinitionsFromComponent,
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const findEmbedLookupDefinitionByField = (
|
|
106
|
+
formDefinition: ClientFormDefinition | null,
|
|
107
|
+
field: string,
|
|
108
|
+
): EmbedLookupDefinition | undefined =>
|
|
109
|
+
collectEmbedLookupDefinitions(formDefinition).find(
|
|
110
|
+
// Dependent lookups must go through their typed queryName path so callers
|
|
111
|
+
// cannot hit them through the generic field-based lookup endpoint.
|
|
112
|
+
(lookup) =>
|
|
113
|
+
!lookup.queryName &&
|
|
114
|
+
lookup.normalizedField === field &&
|
|
115
|
+
(lookup.type === FormComponentType.Lookup ||
|
|
116
|
+
lookup.type === FormComponentType.CalendarSlot),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
export const findEmbedLookupDefinitionByQueryName = (
|
|
120
|
+
formDefinition: ClientFormDefinition | null,
|
|
121
|
+
queryName: string,
|
|
122
|
+
): EmbedLookupDefinition | undefined =>
|
|
123
|
+
collectEmbedLookupDefinitions(formDefinition).find(
|
|
124
|
+
(lookup) => lookup.queryName === queryName,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
const decodeEmbedSegments = (segments: readonly string[]): string[] =>
|
|
128
|
+
segments.map(decodeURIComponent)
|
|
129
|
+
|
|
130
|
+
export const stepPathFromEmbedSegments = (
|
|
131
|
+
segments: readonly string[],
|
|
132
|
+
): string => `/${decodeEmbedSegments(segments).join("/")}`
|
|
133
|
+
|
|
134
|
+
export const embedSegmentsFromStepPath = (stepPath: string): string[] =>
|
|
135
|
+
stepPath.split("/").filter((segment) => segment.length > 0)
|
|
136
|
+
|
|
137
|
+
export const findEmbedManifestEntryForPath = (
|
|
138
|
+
entries: readonly EmbedManifestEntry[],
|
|
139
|
+
path: string,
|
|
140
|
+
): EmbedManifestEntry | undefined =>
|
|
141
|
+
entries.find((entry) => entry.stepPath === path) ??
|
|
142
|
+
entries.find((entry) => entry.processPath === path)
|
|
143
|
+
|
|
144
|
+
export const getEmbedRoutePath = (path: string): string =>
|
|
145
|
+
`/embed/${embedSegmentsFromStepPath(path).map(encodeURIComponent).join("/")}`
|
|
146
|
+
|
|
147
|
+
export const buildEmbedFrameAncestorsPolicy = (
|
|
148
|
+
entry: EmbedManifestEntry,
|
|
149
|
+
): string => `frame-ancestors ${["'self'", ...entry.sites].join(" ")}`
|
|
150
|
+
|
|
151
|
+
export const buildEmbedStorageKey = (stepPath: string): string =>
|
|
152
|
+
`pf-embed:${stepPath}`
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const parseOrigin = (value: string): string | null => {
|
|
2
|
+
try {
|
|
3
|
+
return new URL(value).origin
|
|
4
|
+
} catch {
|
|
5
|
+
return null
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const getRequestOrigin = (headers: Pick<Headers, "get">): string | null => {
|
|
10
|
+
const originHeader = headers.get("origin")
|
|
11
|
+
if (originHeader) {
|
|
12
|
+
return parseOrigin(originHeader)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const refererHeader = headers.get("referer")
|
|
16
|
+
if (refererHeader) {
|
|
17
|
+
// Browsers send Origin for normal cross-site iframe POSTs. Keep Referer as a
|
|
18
|
+
// fallback for same-origin/dev cases, but treat it only as a best-effort origin.
|
|
19
|
+
return parseOrigin(refererHeader)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const isAllowedEmbedOrigin = (
|
|
26
|
+
headers: Pick<Headers, "get">,
|
|
27
|
+
allowedSites: readonly string[],
|
|
28
|
+
frontendOrigin?: string,
|
|
29
|
+
): boolean => {
|
|
30
|
+
const requestOrigin = getRequestOrigin(headers)
|
|
31
|
+
|
|
32
|
+
if (requestOrigin === null) {
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
requestOrigin === frontendOrigin || allowedSites.includes(requestOrigin)
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ClientError } from "graphql-request"
|
|
2
|
+
|
|
3
|
+
export function getDisplayErrorMessage(
|
|
4
|
+
error: unknown,
|
|
5
|
+
fallback: string,
|
|
6
|
+
): string {
|
|
7
|
+
if (error instanceof ClientError) {
|
|
8
|
+
const gqlError = error.response.errors?.[0]
|
|
9
|
+
const code = gqlError?.extensions?.["code"]
|
|
10
|
+
|
|
11
|
+
if (code === "NotAuthorized") {
|
|
12
|
+
return "You do not have permission to access this form."
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
console.error("GraphQL error shown with fallback message", {
|
|
16
|
+
code,
|
|
17
|
+
message: gqlError?.message,
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return fallback
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type ExecutionMenuActionRegistration,
|
|
5
|
+
type RegistrationDisposer,
|
|
6
|
+
createRegistrationRegistry,
|
|
7
|
+
} from "../../../modules/frontend-plugin-host/src/index.ts"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generic registry for org-owned execution-list menu actions.
|
|
11
|
+
* Frontend stays org-agnostic; packages register actions via frontend plugins.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export type { ExecutionMenuActionRegistration } from "../../../modules/frontend-plugin-host/src/index.ts"
|
|
15
|
+
|
|
16
|
+
const executionMenuActions =
|
|
17
|
+
createRegistrationRegistry<ExecutionMenuActionRegistration>(
|
|
18
|
+
(action) => action.id,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export const registerExecutionMenuAction = (
|
|
22
|
+
action: ExecutionMenuActionRegistration,
|
|
23
|
+
): RegistrationDisposer => executionMenuActions.register(action)
|
|
24
|
+
|
|
25
|
+
export const listExecutionMenuActions =
|
|
26
|
+
(): readonly ExecutionMenuActionRegistration[] => executionMenuActions.list()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface FeaturePermissions {
|
|
2
|
+
readonly administerUsers: boolean
|
|
3
|
+
readonly administerOAuthProviders: boolean
|
|
4
|
+
readonly showProcessState: boolean
|
|
5
|
+
readonly viewAuthorization: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const noFeaturePermissions: FeaturePermissions = {
|
|
9
|
+
administerUsers: false,
|
|
10
|
+
administerOAuthProviders: false,
|
|
11
|
+
showProcessState: false,
|
|
12
|
+
viewAuthorization: false,
|
|
13
|
+
}
|