@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
package/dist/main.mjs
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
|
|
4
|
+
// src/main.ts
|
|
5
|
+
import { randomBytes } from "crypto";
|
|
6
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
7
|
+
import { dirname as dirname3, resolve as resolve3 } from "path";
|
|
8
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
9
|
+
import { parseArgs } from "util";
|
|
10
|
+
import { Schema as Schema2 } from "effect";
|
|
11
|
+
|
|
12
|
+
// src/dashboard-build.ts
|
|
13
|
+
import { createHash } from "crypto";
|
|
14
|
+
import {
|
|
15
|
+
cpSync,
|
|
16
|
+
existsSync as existsSync2,
|
|
17
|
+
mkdirSync,
|
|
18
|
+
readFileSync as readFileSync2,
|
|
19
|
+
readdirSync as readdirSync2,
|
|
20
|
+
rmSync,
|
|
21
|
+
symlinkSync,
|
|
22
|
+
writeFileSync as writeFileSync2
|
|
23
|
+
} from "fs";
|
|
24
|
+
import { dirname as dirname2, relative, resolve as resolve2 } from "path";
|
|
25
|
+
import { fileURLToPath } from "url";
|
|
26
|
+
import { Schema } from "effect";
|
|
27
|
+
|
|
28
|
+
// src/dashboard-styles.ts
|
|
29
|
+
import {
|
|
30
|
+
existsSync,
|
|
31
|
+
readFileSync,
|
|
32
|
+
readdirSync,
|
|
33
|
+
statSync,
|
|
34
|
+
writeFileSync
|
|
35
|
+
} from "fs";
|
|
36
|
+
import { dirname, extname, resolve } from "path";
|
|
37
|
+
import { Scanner } from "@tailwindcss/oxide";
|
|
38
|
+
var prepareDashboardStyles = (root) => {
|
|
39
|
+
const files = [];
|
|
40
|
+
const walk = (directory) => {
|
|
41
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
42
|
+
if (entry.name === "node_modules")
|
|
43
|
+
continue;
|
|
44
|
+
const path = resolve(directory, entry.name);
|
|
45
|
+
if (entry.isDirectory())
|
|
46
|
+
walk(path);
|
|
47
|
+
else if (entry.name.endsWith(".css"))
|
|
48
|
+
files.push(path);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
walk(root);
|
|
52
|
+
for (const stylesheet of files) {
|
|
53
|
+
const content = readFileSync(stylesheet, "utf8");
|
|
54
|
+
const prepared = content.replace(/@source\s+["']([^"']+)["'];/g, (_directive, pattern) => {
|
|
55
|
+
const source = resolve(dirname(stylesheet), pattern);
|
|
56
|
+
const paths = existsSync(source) && statSync(source).isFile() ? [source] : [
|
|
57
|
+
...new Bun.Glob(existsSync(source) ? `${source}/**/*` : source).scanSync({ onlyFiles: true, dot: true })
|
|
58
|
+
];
|
|
59
|
+
const candidates = new Scanner({}).scanFiles(paths.map((path) => ({
|
|
60
|
+
content: readFileSync(path, "utf8"),
|
|
61
|
+
extension: extname(path).slice(1)
|
|
62
|
+
})));
|
|
63
|
+
return `@source inline(${JSON.stringify(candidates.join(" "))});`;
|
|
64
|
+
});
|
|
65
|
+
writeFileSync(stylesheet, prepared);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/dashboard-build.ts
|
|
70
|
+
var SourceManifest = Schema.Struct({
|
|
71
|
+
format: Schema.Literal(1),
|
|
72
|
+
sha256: Schema.String,
|
|
73
|
+
dependencies: Schema.Record({ key: Schema.String, value: Schema.String })
|
|
74
|
+
});
|
|
75
|
+
var BuildManifest = Schema.Struct({
|
|
76
|
+
format: Schema.Literal(1),
|
|
77
|
+
source: Schema.String,
|
|
78
|
+
lock: Schema.String,
|
|
79
|
+
org: Schema.String,
|
|
80
|
+
organisationInputs: Schema.String,
|
|
81
|
+
auth: Schema.String,
|
|
82
|
+
graphql: Schema.String,
|
|
83
|
+
dashboard: Schema.String
|
|
84
|
+
});
|
|
85
|
+
var dashboardDirectory = (root) => resolve2(root, ".processfocus/dashboard/apps/frontend");
|
|
86
|
+
var distribution = () => dirname2(fileURLToPath(import.meta.url));
|
|
87
|
+
var sourceManifest = () => Schema.decodeUnknownSync(SourceManifest)(JSON.parse(readFileSync2(resolve2(distribution(), "dashboard-source.json"), "utf8")));
|
|
88
|
+
var LoginMetadata = Schema.Struct({
|
|
89
|
+
providers_supported: Schema.optional(Schema.Array(Schema.String)),
|
|
90
|
+
passkey_open_registration: Schema.optional(Schema.Boolean)
|
|
91
|
+
});
|
|
92
|
+
var dashboardOrganisationInputs = async ({
|
|
93
|
+
orgPath,
|
|
94
|
+
authUrl
|
|
95
|
+
}) => {
|
|
96
|
+
const hash = createHash("sha256");
|
|
97
|
+
const dist = resolve2(orgPath, "dist");
|
|
98
|
+
const addFile = (path) => {
|
|
99
|
+
hash.update(JSON.stringify([
|
|
100
|
+
relative(dist, path),
|
|
101
|
+
createHash("sha256").update(readFileSync2(path)).digest("hex")
|
|
102
|
+
]));
|
|
103
|
+
};
|
|
104
|
+
const addDirectory = (directory) => {
|
|
105
|
+
for (const entry of readdirSync2(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
106
|
+
const path = resolve2(directory, entry.name);
|
|
107
|
+
if (entry.isDirectory())
|
|
108
|
+
addDirectory(path);
|
|
109
|
+
else
|
|
110
|
+
addFile(path);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
for (const file of ["frontend-manifest.json", "browser-plugins.json"])
|
|
114
|
+
addFile(resolve2(dist, file));
|
|
115
|
+
for (const directory of [
|
|
116
|
+
"browser-plugins",
|
|
117
|
+
"docs",
|
|
118
|
+
"_pf/app-icons",
|
|
119
|
+
"_pf/public-form-branding"
|
|
120
|
+
]) {
|
|
121
|
+
const path = resolve2(dist, directory);
|
|
122
|
+
if (existsSync2(path))
|
|
123
|
+
addDirectory(path);
|
|
124
|
+
}
|
|
125
|
+
const response = await fetch(new URL("/.well-known/oauth-authorization-server", authUrl), { signal: AbortSignal.timeout(2000) });
|
|
126
|
+
if (!response.ok)
|
|
127
|
+
throw new Error("Could not read Dashboard login metadata");
|
|
128
|
+
const metadata = Schema.decodeUnknownSync(LoginMetadata)(await response.json());
|
|
129
|
+
const providers = metadata.providers_supported ?? [];
|
|
130
|
+
hash.update(JSON.stringify({
|
|
131
|
+
providers,
|
|
132
|
+
passkeyOpenRegistration: providers.includes("passkey") && metadata.passkey_open_registration === true
|
|
133
|
+
}));
|
|
134
|
+
return hash.digest("hex");
|
|
135
|
+
};
|
|
136
|
+
var buildIdentity = async (env) => {
|
|
137
|
+
const root = env["PF_RUNTIME_ROOT"] ?? process.cwd();
|
|
138
|
+
const hash = createHash("sha256");
|
|
139
|
+
for (const name of [
|
|
140
|
+
"package.json",
|
|
141
|
+
"bun.lock",
|
|
142
|
+
"bun.lockb",
|
|
143
|
+
"package-lock.json",
|
|
144
|
+
"pnpm-lock.yaml",
|
|
145
|
+
"yarn.lock"
|
|
146
|
+
]) {
|
|
147
|
+
const path = resolve2(root, name);
|
|
148
|
+
if (existsSync2(path))
|
|
149
|
+
hash.update(name).update(readFileSync2(path));
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
format: 1,
|
|
153
|
+
source: sourceManifest().sha256,
|
|
154
|
+
lock: hash.digest("hex"),
|
|
155
|
+
org: env["PF_ORG"] ?? "",
|
|
156
|
+
organisationInputs: await dashboardOrganisationInputs({
|
|
157
|
+
orgPath: env["PF_ORG"] ?? root,
|
|
158
|
+
authUrl: env["OAUTH_ISSUER_URL"] ?? ""
|
|
159
|
+
}),
|
|
160
|
+
auth: env["OAUTH_ISSUER_URL"] ?? "",
|
|
161
|
+
graphql: env["GRAPHQL_ENDPOINT"] ?? "",
|
|
162
|
+
dashboard: env["FRONTEND_BASE_URL"] ?? ""
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
var assertDashboardBuild = async (env) => {
|
|
166
|
+
const directory = dashboardDirectory(env["PF_RUNTIME_ROOT"] ?? process.cwd());
|
|
167
|
+
const guidance = "Run pf-runtime-local --build --org <organisation> with the same ports before starting.";
|
|
168
|
+
try {
|
|
169
|
+
const built = Schema.decodeUnknownSync(BuildManifest)(JSON.parse(readFileSync2(resolve2(directory, "build.json"), "utf8")));
|
|
170
|
+
if (!existsSync2(resolve2(directory, ".next/BUILD_ID")) || JSON.stringify(built) !== JSON.stringify(await buildIdentity(env)))
|
|
171
|
+
throw new Error("incompatible");
|
|
172
|
+
} catch {
|
|
173
|
+
throw new Error(`Dashboard build is missing or incompatible with this runtime, project dependencies, organisation, or ports. ${guidance}`);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
var dashboardEnvironment = (env) => ({
|
|
177
|
+
...env,
|
|
178
|
+
NODE_ENV: "production",
|
|
179
|
+
PF_DASHBOARD_SOURCE_ROOT: resolve2(env["PF_RUNTIME_ROOT"] ?? process.cwd(), ".processfocus/dashboard"),
|
|
180
|
+
PF_DASHBOARD_PROJECT_BUILD: "1"
|
|
181
|
+
});
|
|
182
|
+
var prepareDashboardBuild = (env) => {
|
|
183
|
+
const root = env["PF_RUNTIME_ROOT"] ?? process.cwd();
|
|
184
|
+
const output = resolve2(root, ".processfocus");
|
|
185
|
+
mkdirSync(output, { recursive: true, mode: 448 });
|
|
186
|
+
writeFileSync2(resolve2(output, ".gitignore"), `*
|
|
187
|
+
`);
|
|
188
|
+
const stage = resolve2(output, "dashboard");
|
|
189
|
+
rmSync(stage, { recursive: true, force: true });
|
|
190
|
+
cpSync(resolve2(distribution(), "dashboard-source"), stage, {
|
|
191
|
+
recursive: true
|
|
192
|
+
});
|
|
193
|
+
for (const name of Object.keys(sourceManifest().dependencies)) {
|
|
194
|
+
let resolved;
|
|
195
|
+
try {
|
|
196
|
+
resolved = Bun.resolveSync(`${name}/package.json`, distribution());
|
|
197
|
+
} catch {
|
|
198
|
+
resolved = Bun.resolveSync(name, distribution());
|
|
199
|
+
}
|
|
200
|
+
let packageRoot = dirname2(resolved);
|
|
201
|
+
while (!existsSync2(resolve2(packageRoot, "package.json")) || JSON.parse(readFileSync2(resolve2(packageRoot, "package.json"), "utf8")).name !== name) {
|
|
202
|
+
const parent = dirname2(packageRoot);
|
|
203
|
+
if (parent === packageRoot)
|
|
204
|
+
throw new Error(`Cannot locate installed Dashboard dependency ${name}`);
|
|
205
|
+
packageRoot = parent;
|
|
206
|
+
}
|
|
207
|
+
const target = resolve2(stage, "node_modules", name);
|
|
208
|
+
mkdirSync(dirname2(target), { recursive: true });
|
|
209
|
+
symlinkSync(packageRoot, target, "dir");
|
|
210
|
+
}
|
|
211
|
+
const app = dashboardDirectory(root);
|
|
212
|
+
const orgDist = resolve2(env["PF_ORG"] ?? root, "dist");
|
|
213
|
+
for (const [source, target] of [
|
|
214
|
+
["frontend-manifest.json", "lib/generated/frontend-manifest.json"],
|
|
215
|
+
["docs", "lib/generated/docs"],
|
|
216
|
+
["_pf/app-icons", "public/_pf/app-icons"],
|
|
217
|
+
["_pf/public-form-branding", "public/_pf/public-form-branding"]
|
|
218
|
+
]) {
|
|
219
|
+
if (existsSync2(resolve2(orgDist, source))) {
|
|
220
|
+
mkdirSync(dirname2(resolve2(app, target)), { recursive: true });
|
|
221
|
+
cpSync(resolve2(orgDist, source), resolve2(app, target), {
|
|
222
|
+
recursive: true
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const prepared = Bun.spawnSync([
|
|
227
|
+
process.execPath,
|
|
228
|
+
resolve2(distribution(), "prepare-dashboard.mjs"),
|
|
229
|
+
resolve2(orgDist, "frontend-manifest.json"),
|
|
230
|
+
resolve2(app, "lib/generated/organisation-plugin-loaders.tsx"),
|
|
231
|
+
resolve2(app, "lib/generated/organisation-plugin-preparation.ts"),
|
|
232
|
+
resolve2(app, "lib/generated/organisation-plugin-composition.json")
|
|
233
|
+
], { cwd: root, env, stdout: "inherit", stderr: "inherit" });
|
|
234
|
+
if (prepared.exitCode !== 0)
|
|
235
|
+
throw new Error("Dashboard organisation preparation failed");
|
|
236
|
+
prepareDashboardStyles(stage);
|
|
237
|
+
return app;
|
|
238
|
+
};
|
|
239
|
+
var recordDashboardBuild = async (env) => {
|
|
240
|
+
writeFileSync2(resolve2(dashboardDirectory(env["PF_RUNTIME_ROOT"] ?? process.cwd()), "build.json"), JSON.stringify(await buildIdentity(env)), { mode: 384 });
|
|
241
|
+
};
|
|
242
|
+
var nextCommand = () => Bun.resolveSync("next/dist/bin/next", distribution());
|
|
243
|
+
|
|
244
|
+
// src/main.ts
|
|
245
|
+
var CliPackageJson = Schema2.Struct({
|
|
246
|
+
bin: Schema2.Struct({ pfcli: Schema2.String })
|
|
247
|
+
});
|
|
248
|
+
var resolveCli = () => {
|
|
249
|
+
const manifestPath = fileURLToPath2(import.meta.resolve("@processfocus/cli/package.json"));
|
|
250
|
+
const manifest = JSON.parse(readFileSync3(manifestPath, "utf8"));
|
|
251
|
+
const { bin } = Schema2.decodeUnknownSync(CliPackageJson)(manifest);
|
|
252
|
+
return resolve3(dirname3(manifestPath), bin.pfcli);
|
|
253
|
+
};
|
|
254
|
+
var runCli = (cli, args, env) => {
|
|
255
|
+
const result = Bun.spawnSync([process.execPath, cli, ...args], {
|
|
256
|
+
cwd: env["PF_RUNTIME_ROOT"],
|
|
257
|
+
env,
|
|
258
|
+
stderr: "pipe",
|
|
259
|
+
stdout: "pipe"
|
|
260
|
+
});
|
|
261
|
+
const stdout = result.stdout.toString().trim();
|
|
262
|
+
if (result.exitCode !== 0) {
|
|
263
|
+
const detail = result.stderr.toString().trim() || stdout;
|
|
264
|
+
throw new Error(`pfcli ${args[0] ?? ""} failed: ${detail}`);
|
|
265
|
+
}
|
|
266
|
+
return stdout;
|
|
267
|
+
};
|
|
268
|
+
var waitForHttp = async (url, init) => {
|
|
269
|
+
for (let attempt = 0;attempt < 150; attempt += 1) {
|
|
270
|
+
try {
|
|
271
|
+
const response = await fetch(url, {
|
|
272
|
+
...init,
|
|
273
|
+
signal: AbortSignal.timeout(2000)
|
|
274
|
+
});
|
|
275
|
+
if (response.ok) {
|
|
276
|
+
if (init?.method !== "POST")
|
|
277
|
+
return;
|
|
278
|
+
const body = await response.json();
|
|
279
|
+
if (typeof body === "object" && body !== null && "data" in body && !("errors" in body))
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
} catch {}
|
|
283
|
+
await Bun.sleep(100);
|
|
284
|
+
}
|
|
285
|
+
throw new Error(`Timed out waiting for ${url}`);
|
|
286
|
+
};
|
|
287
|
+
var startLocalRuntime = async (options) => {
|
|
288
|
+
const runtimeRoot = resolve3(options.runtimeRoot ?? process.env["PF_RUNTIME_ROOT"] ?? process.cwd());
|
|
289
|
+
const orgPath = resolve3(runtimeRoot, options.orgPath);
|
|
290
|
+
const authPort = options.authPort ?? 4020;
|
|
291
|
+
const graphqlPort = options.graphqlPort ?? 4000;
|
|
292
|
+
const dashboardPort = options.dashboardPort ?? 3000;
|
|
293
|
+
let authUrl = `http://localhost:${authPort}`;
|
|
294
|
+
let graphqlUrl = `http://localhost:${graphqlPort}/graphql`;
|
|
295
|
+
const dashboardUrl = `http://localhost:${dashboardPort}`;
|
|
296
|
+
const cli = resolveCli();
|
|
297
|
+
const env = {
|
|
298
|
+
...process.env,
|
|
299
|
+
NODE_ENV: process.env["NODE_ENV"] ?? "development",
|
|
300
|
+
PF_ORG: orgPath,
|
|
301
|
+
PF_RUNTIME_ROOT: runtimeRoot,
|
|
302
|
+
PF_CEDAR_ROOT: fileURLToPath2(new URL("./resources/cedar", import.meta.url)),
|
|
303
|
+
PF_GRAPHQL_SCHEMA_ROOT: fileURLToPath2(new URL("./resources/graphql-schema", import.meta.url)),
|
|
304
|
+
BASE_URL: undefined,
|
|
305
|
+
FRONTEND_BASE_URL: dashboardUrl,
|
|
306
|
+
PF_LOCAL_FRONTEND_ORIGIN: dashboardUrl,
|
|
307
|
+
AUTH_URL: authUrl,
|
|
308
|
+
GRAPHQL_ENDPOINT: graphqlUrl,
|
|
309
|
+
OAUTH_ISSUER_URL: authUrl,
|
|
310
|
+
JWKS_URI: `${authUrl}/.well-known/jwks.json`,
|
|
311
|
+
INTERNAL_API_SECRET: process.env["INTERNAL_API_SECRET"] ?? randomBytes(32).toString("hex")
|
|
312
|
+
};
|
|
313
|
+
console.log(`Importing ${orgPath}`);
|
|
314
|
+
runCli(cli, ["import", orgPath], env);
|
|
315
|
+
const children = [];
|
|
316
|
+
const spawn = ({
|
|
317
|
+
entry,
|
|
318
|
+
args = [],
|
|
319
|
+
cwd = runtimeRoot,
|
|
320
|
+
childEnv = env,
|
|
321
|
+
executable = process.execPath
|
|
322
|
+
}) => {
|
|
323
|
+
const child = Bun.spawn([executable, entry, ...args], {
|
|
324
|
+
cwd,
|
|
325
|
+
env: childEnv,
|
|
326
|
+
stdin: "inherit",
|
|
327
|
+
stdout: "inherit",
|
|
328
|
+
stderr: "inherit"
|
|
329
|
+
});
|
|
330
|
+
children.push(child);
|
|
331
|
+
return child;
|
|
332
|
+
};
|
|
333
|
+
let stopping = false;
|
|
334
|
+
const stop = () => {
|
|
335
|
+
stopping = true;
|
|
336
|
+
for (const child of children)
|
|
337
|
+
child.kill("SIGTERM");
|
|
338
|
+
};
|
|
339
|
+
const waitForPort = async (file, child) => {
|
|
340
|
+
const schema = Schema2.Struct({
|
|
341
|
+
port: Schema2.Number.pipe(Schema2.int(), Schema2.between(1, 65535))
|
|
342
|
+
});
|
|
343
|
+
for (let attempt = 0;attempt < 150; attempt += 1) {
|
|
344
|
+
if (stopping || child.exitCode !== null)
|
|
345
|
+
throw new Error(`Service exited before writing ${file}`);
|
|
346
|
+
const path = resolve3(runtimeRoot, file);
|
|
347
|
+
if (existsSync3(path))
|
|
348
|
+
return Schema2.decodeUnknownSync(schema)(JSON.parse(readFileSync3(path, "utf8"))).port;
|
|
349
|
+
await Bun.sleep(100);
|
|
350
|
+
}
|
|
351
|
+
throw new Error(`Timed out waiting for ${file}`);
|
|
352
|
+
};
|
|
353
|
+
process.once("SIGINT", stop);
|
|
354
|
+
process.once("SIGTERM", stop);
|
|
355
|
+
try {
|
|
356
|
+
rmSync2(resolve3(runtimeRoot, ".auth-port.json"), { force: true });
|
|
357
|
+
const auth = spawn({
|
|
358
|
+
entry: fileURLToPath2(new URL("./authentication-server.mjs", import.meta.url)),
|
|
359
|
+
args: options.authPort === undefined ? [] : ["--port", String(authPort)]
|
|
360
|
+
});
|
|
361
|
+
authUrl = `http://localhost:${options.authPort ?? await waitForPort(".auth-port.json", auth)}`;
|
|
362
|
+
env["OAUTH_ISSUER_URL"] = authUrl;
|
|
363
|
+
env["AUTH_URL"] = authUrl;
|
|
364
|
+
env["JWKS_URI"] = `${authUrl}/.well-known/jwks.json`;
|
|
365
|
+
await waitForHttp(env["JWKS_URI"]);
|
|
366
|
+
writeFileSync3(resolve3(runtimeRoot, ".auth-port.json"), JSON.stringify({ port: Number(new URL(authUrl).port) }));
|
|
367
|
+
runCli(cli, ["refresh-frontend-jwt", orgPath], env);
|
|
368
|
+
env["FRONTEND_JWT_TOKEN"] = runCli(cli, ["get-frontend-jwt", orgPath], env);
|
|
369
|
+
rmSync2(resolve3(runtimeRoot, ".graphql-port.json"), { force: true });
|
|
370
|
+
const graphql = spawn({
|
|
371
|
+
entry: fileURLToPath2(new URL("./graphql-server.mjs", import.meta.url)),
|
|
372
|
+
args: [
|
|
373
|
+
...options.graphqlPort === undefined ? [] : ["--port", String(graphqlPort)],
|
|
374
|
+
"--org",
|
|
375
|
+
orgPath
|
|
376
|
+
]
|
|
377
|
+
});
|
|
378
|
+
graphqlUrl = `http://localhost:${options.graphqlPort ?? await waitForPort(".graphql-port.json", graphql)}/graphql`;
|
|
379
|
+
env["GRAPHQL_ENDPOINT"] = graphqlUrl;
|
|
380
|
+
await waitForHttp(graphqlUrl, {
|
|
381
|
+
method: "POST",
|
|
382
|
+
headers: {
|
|
383
|
+
authorization: `Bearer ${env["FRONTEND_JWT_TOKEN"]}`,
|
|
384
|
+
"content-type": "application/json"
|
|
385
|
+
},
|
|
386
|
+
body: JSON.stringify({ query: "query RuntimeReadiness { __typename }" })
|
|
387
|
+
});
|
|
388
|
+
writeFileSync3(resolve3(runtimeRoot, ".graphql-port.json"), JSON.stringify({ port: Number(new URL(graphqlUrl).port) }));
|
|
389
|
+
if (options.build) {
|
|
390
|
+
const app = prepareDashboardBuild(env);
|
|
391
|
+
const build = spawn({
|
|
392
|
+
entry: nextCommand(),
|
|
393
|
+
args: ["build"],
|
|
394
|
+
cwd: app,
|
|
395
|
+
childEnv: dashboardEnvironment(env),
|
|
396
|
+
executable: "node"
|
|
397
|
+
});
|
|
398
|
+
const result = await Promise.race(children.map(async (child) => ({ child, code: await child.exited })));
|
|
399
|
+
if (result.child !== build || result.code !== 0)
|
|
400
|
+
throw new Error("Dashboard build or supporting service failed; see output above");
|
|
401
|
+
await recordDashboardBuild(env);
|
|
402
|
+
console.log(`Dashboard built in ${app}`);
|
|
403
|
+
return 0;
|
|
404
|
+
}
|
|
405
|
+
spawn({
|
|
406
|
+
entry: fileURLToPath2(new URL("./job-worker.mjs", import.meta.url)),
|
|
407
|
+
args: ["--org", orgPath]
|
|
408
|
+
});
|
|
409
|
+
spawn({
|
|
410
|
+
entry: cli,
|
|
411
|
+
args: ["import", "--watch", "--watch-skip-initial", orgPath]
|
|
412
|
+
});
|
|
413
|
+
if (options.dashboard !== false) {
|
|
414
|
+
await assertDashboardBuild(env);
|
|
415
|
+
env["PORT"] = String(dashboardPort);
|
|
416
|
+
env["HOSTNAME"] = "127.0.0.1";
|
|
417
|
+
writeFileSync3(resolve3(runtimeRoot, ".frontend-port.json"), `${JSON.stringify({ port: dashboardPort })}
|
|
418
|
+
`);
|
|
419
|
+
spawn({
|
|
420
|
+
entry: nextCommand(),
|
|
421
|
+
args: [
|
|
422
|
+
"start",
|
|
423
|
+
"--port",
|
|
424
|
+
String(dashboardPort),
|
|
425
|
+
"--hostname",
|
|
426
|
+
"127.0.0.1"
|
|
427
|
+
],
|
|
428
|
+
cwd: dashboardDirectory(runtimeRoot),
|
|
429
|
+
childEnv: dashboardEnvironment(env),
|
|
430
|
+
executable: "node"
|
|
431
|
+
});
|
|
432
|
+
await waitForHttp(`${dashboardUrl}/_pf/health`);
|
|
433
|
+
}
|
|
434
|
+
console.log(options.dashboard === false ? "Process Focus local runtime services are ready" : `Process Focus local runtime is ready at ${dashboardUrl}`);
|
|
435
|
+
return await Promise.race(children.map((child) => child.exited));
|
|
436
|
+
} finally {
|
|
437
|
+
stop();
|
|
438
|
+
const killTimer = setTimeout(() => {
|
|
439
|
+
for (const child of children)
|
|
440
|
+
if (child.exitCode === null)
|
|
441
|
+
child.kill("SIGKILL");
|
|
442
|
+
}, 5000);
|
|
443
|
+
await Promise.all(children.map((child) => child.exited));
|
|
444
|
+
clearTimeout(killTimer);
|
|
445
|
+
process.off("SIGINT", stop);
|
|
446
|
+
process.off("SIGTERM", stop);
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
if (import.meta.main) {
|
|
450
|
+
try {
|
|
451
|
+
const parsed = parseArgs({
|
|
452
|
+
args: process.argv.slice(2),
|
|
453
|
+
options: {
|
|
454
|
+
org: { type: "string", short: "o" },
|
|
455
|
+
"auth-port": { type: "string" },
|
|
456
|
+
"graphql-port": { type: "string" },
|
|
457
|
+
"dashboard-port": { type: "string" },
|
|
458
|
+
"no-dashboard": { type: "boolean" },
|
|
459
|
+
build: { type: "boolean" }
|
|
460
|
+
},
|
|
461
|
+
strict: true,
|
|
462
|
+
allowPositionals: false
|
|
463
|
+
});
|
|
464
|
+
const orgPath = parsed.values.org ?? process.env["PF_ORG"];
|
|
465
|
+
if (!orgPath)
|
|
466
|
+
throw new Error("--org is required (or set PF_ORG)");
|
|
467
|
+
const port = (name) => {
|
|
468
|
+
const value = parsed.values[name];
|
|
469
|
+
if (value === undefined)
|
|
470
|
+
return;
|
|
471
|
+
const parsedPort = Number(value);
|
|
472
|
+
if (!Number.isInteger(parsedPort) || parsedPort < 1 || parsedPort > 65535) {
|
|
473
|
+
throw new Error(`--${name} must be a valid port`);
|
|
474
|
+
}
|
|
475
|
+
return parsedPort;
|
|
476
|
+
};
|
|
477
|
+
const authPort = port("auth-port");
|
|
478
|
+
const graphqlPort = port("graphql-port");
|
|
479
|
+
const dashboardPort = port("dashboard-port");
|
|
480
|
+
process.exitCode = await startLocalRuntime({
|
|
481
|
+
orgPath,
|
|
482
|
+
...authPort === undefined ? {} : { authPort },
|
|
483
|
+
...graphqlPort === undefined ? {} : { graphqlPort },
|
|
484
|
+
...dashboardPort === undefined ? {} : { dashboardPort },
|
|
485
|
+
build: parsed.values.build === true,
|
|
486
|
+
dashboard: parsed.values["no-dashboard"] !== true
|
|
487
|
+
});
|
|
488
|
+
} catch (error) {
|
|
489
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
490
|
+
process.exitCode = 1;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
export {
|
|
494
|
+
startLocalRuntime
|
|
495
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{createHash as D}from"crypto";import{copyFileSync as G,existsSync as P,mkdirSync as V,readFileSync as R,realpathSync as w,rmSync as q,statSync as L,writeFileSync as m}from"fs";import{dirname as F,relative as H,resolve as c,sep as f}from"path";var A="browser-plugins.json",O=["analytics","formComponents"],_=(n)=>O.some((t)=>n===t),y=(n,t)=>{if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`${t} must be an object`);return{...n}},g=(n,t)=>{if(typeof n!=="string"||n.trim().length===0)throw Error(`${t} must be a non-empty string`);return n.trim()},C=(n,t)=>{if(!_(n)){let r=O.map((e)=>JSON.stringify(e)).join(" or ");throw Error(`${t} must be ${r}`)}return n},b=(n,t,r="path")=>{let e=g(n,`browser plugin "${t}" ${r}`),i=e.split("/");if(e.startsWith("/")||e.includes("\\")||i.some((a)=>a===""||a==="."||a===".."))throw Error(`browser plugin "${t}" ${r} must stay within the artifact root: ${e}`);return e},k=(n,t)=>{let r=y(n,`browser plugin "${t}" preparation`);if(r.kind!=="stylesheet")throw Error(`browser plugin "${t}" preparation.kind must be "stylesheet"`);let e=g(r.sha256,`browser plugin "${t}" preparation.sha256`);if(!/^[0-9a-f]{64}$/.test(e))throw Error(`browser plugin "${t}" preparation.sha256 must be a 64-character hex string`);return{kind:"stylesheet",path:b(r.path,t,"preparation.path"),sha256:e}},B=(n,t)=>{let r=`browser plugin artifact manifest.plugins[${t}]`,e=y(n,r),i=g(e.identity,`${r}.identity`),a=e.hostInterfaceVersion;if(typeof a!=="number"||!Number.isInteger(a)||a<1)throw Error(`browser plugin "${i}" hostInterfaceVersion must be a positive integer`);let s=g(e.sha256,`browser plugin "${i}" sha256`);if(!/^[0-9a-f]{64}$/.test(s))throw Error(`browser plugin "${i}" sha256 must be a 64-character hex string`);return{identity:i,category:C(e.category,`browser plugin "${i}" category`),hostInterfaceVersion:a,path:b(e.path,i),sha256:s,...e.preparation!==void 0&&{preparation:k(e.preparation,i)}}},I=(n)=>{let t=y(n,"browser plugin artifact manifest");if(t.format!=="processfocus/browser-plugins")throw Error("browser plugin artifact manifest format must be processfocus/browser-plugins");if(t.version!==1)throw Error(`browser plugin artifact manifest version must be ${String(1)}`);if(!Array.isArray(t.plugins))throw Error("browser plugin artifact manifest.plugins must be an array");let r=t.plugins.map(B),e=new Set;for(let i of r){if(e.has(i.identity))throw Error(`browser plugin artifact manifest has duplicate identity "${i.identity}"`);e.add(i.identity)}return{format:"processfocus/browser-plugins",version:1,plugins:r}};var p=1;var h=(n,t)=>{if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`${t} must be an object`);return n},S=(n,t)=>{if(typeof n!=="string"||n.trim()==="")throw Error(`${t} must be a non-empty string`);return n},v=(n)=>{let r=h(JSON.parse(R(n,"utf8")),n).plugins;if(r===void 0)return[];let e=h(r,`${n}.plugins`);return["analytics","formComponents"].flatMap((i)=>{let a=e[i]??[];if(!Array.isArray(a))throw Error(`${n}.plugins.${i} must be an array`);return a.map((s,l)=>{let o=`${n}.plugins.${i}[${l}]`,d=h(s,o);return{category:i,module:S(d.module,`${o}.module`),type:S(d.type,`${o}.type`)}})})},N=(n)=>{for(let t of n.selections)if(!n.artifactIdentities.has(t.type))throw Error(`browser plugin "${t.type}" requires an organisation artifact entry in ${n.artifactManifestPath}`)},M=(n)=>{let t=c(n.artifactRoot,n.artifactPath);if(!t.startsWith(`${n.artifactRoot}${f}`))throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} escapes the artifact root: ${n.artifactPath}`);if(!P(t)){let a=n.artifactPathField==="path"?"file":"preparation file";throw Error(`browser plugin "${n.identity}" ${a} is missing: ${n.artifactPath}`)}let r=w(t);if(!r.startsWith(`${n.realArtifactRoot}${f}`))throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} escapes the artifact root through a symbolic link: ${n.artifactPath}`);if(!L(r).isFile())throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} is not a file: ${n.artifactPath}`);let e=D("sha256").update(R(r)).digest("hex");if(e!==n.expectedSha256){let a=n.artifactPathField==="path"?"":"preparation ";throw Error(`browser plugin "${n.identity}" ${a}integrity mismatch for ${n.artifactPath}: expected ${n.expectedSha256}, got ${e}`)}V(n.outputDirectory,{recursive:!0});let i=c(n.outputDirectory,`${n.expectedSha256}${n.stagedExtension}`);return G(r,i),i},j=(n)=>{let t=F(n.manifestPath),r=c(t,A),e=c(F(n.outputModulePath),"browser-plugins");q(e,{recursive:!0,force:!0});let i=w(t);for(let o of[n.manifestPath,r])if(P(o)&&!w(o).startsWith(`${i}${f}`))throw Error(`plugin manifest escapes the selected organisation artifact root: ${o}`);if(!P(r))return N({selections:n.selections,artifactIdentities:new Set,artifactManifestPath:r}),[];let a;try{a=I(JSON.parse(R(r,"utf8")))}catch(o){throw Error(`browser plugin artifact manifest at ${r} is invalid: ${o instanceof Error?o.message:String(o)}`,{cause:o})}let s=new Map;for(let o of n.selections){if(s.has(o.type))throw Error(`frontend manifest has duplicate browser plugin identity "${o.type}"`);s.set(o.type,o)}N({selections:n.selections,artifactIdentities:new Set(a.plugins.map((o)=>o.identity)),artifactManifestPath:r});let l=c(t);return a.plugins.map((o)=>{let d=s.get(o.identity);if(!d)throw Error(`browser plugin "${o.identity}" has no matching frontend manifest selection`);if(d.category!==o.category)throw Error(`browser plugin "${o.identity}" declares category "${o.category}" but its frontend manifest selection is "${d.category}"`);if(o.hostInterfaceVersion!==p)throw Error(`browser plugin "${o.identity}" requires host interface version ${o.hostInterfaceVersion}, but the Dashboard provides ${p}`);let E=M({identity:o.identity,artifactPath:o.path,artifactPathField:"path",artifactRoot:l,expectedSha256:o.sha256,outputDirectory:e,realArtifactRoot:i,stagedExtension:".js"}),u=o.preparation;if(u===void 0)return{...o,stagedPath:E};let T=M({identity:o.identity,artifactPath:u.path,artifactPathField:"preparation.path",artifactRoot:l,expectedSha256:u.sha256,outputDirectory:e,realArtifactRoot:i,stagedExtension:".css"});return{...o,stagedPath:E,preparation:{...u,stagedPath:T}}})},x=(n,t)=>{let r=H(F(n),t).split(f).join("/");return r.startsWith(".")?r:`./${r}`},W=(n,t)=>{let r=n.map((s,l)=>{let o=JSON.stringify(x(t,s.stagedPath)),d=JSON.stringify(s.identity);return`const artifactLoader${l} = Object.assign(
|
|
3
|
+
async (): Promise<boolean> => {
|
|
4
|
+
const artifact = await import(${o})
|
|
5
|
+
await host.activate(${d}, artifact.plugin)
|
|
6
|
+
return true
|
|
7
|
+
}, {
|
|
8
|
+
shouldActivate: async (config?: unknown) => {
|
|
9
|
+
const artifact = await import(${o})
|
|
10
|
+
return artifact.shouldActivate(config, process.env["NODE_ENV"])
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
)`}),e=n.map((s,l)=>` ${JSON.stringify(s.identity)}: artifactLoader${l},`).join(`
|
|
14
|
+
`),i=r,a=e;return`// Generated by prepare-build-inputs. Do not edit.
|
|
15
|
+
import type { FrontendPluginLoaderMap } from "../frontend-plugin-loaders"
|
|
16
|
+
import type { OrganisationFrontendPluginHost } from "../organisation-plugin-loaders"
|
|
17
|
+
|
|
18
|
+
export const createOrganisationFrontendPluginLoaders = (
|
|
19
|
+
host: OrganisationFrontendPluginHost,
|
|
20
|
+
): FrontendPluginLoaderMap => {
|
|
21
|
+
${i.map((s)=>` ${s.replaceAll(`
|
|
22
|
+
`,`
|
|
23
|
+
`)}`).join(`
|
|
24
|
+
|
|
25
|
+
`)}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
${a}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`},J=(n,t)=>{let e=n.flatMap((i)=>i.preparation===void 0?[]:[`import ${JSON.stringify(x(t,i.preparation.stagedPath))}`]).join(`
|
|
32
|
+
`);return`// Generated by prepare-build-inputs. Do not edit.
|
|
33
|
+
${e}${e?`
|
|
34
|
+
`:""}`},U=(n)=>{let t=v(n.manifestPath),r=j({manifestPath:n.manifestPath,selections:t,outputModulePath:n.outputModulePath});m(n.outputModulePath,W(r,n.outputModulePath)),m(n.outputPreparationModulePath,J(r,n.outputPreparationModulePath)),m(n.outputReportPath,`${JSON.stringify({version:1,active:[...r.map((e)=>({source:"organisation-artifact",category:e.category,type:e.identity,path:e.path,sha256:e.sha256,hostInterfaceVersion:e.hostInterfaceVersion}))]},null,2)}
|
|
35
|
+
`)};if(import.meta.main){let[n,t,r,e]=process.argv.slice(2);if(!n||!t||!r||!e)throw Error("usage: generate-organisation-plugin-composition <manifest> <output-module> <output-preparation-module> <output-report>");U({manifestPath:n,outputModulePath:t,outputPreparationModulePath:r,outputReportPath:e})}export{U as generateOrganisationFrontendPluginComposition};
|