@processfocus/runtime-local 0.1.0-next.1 → 0.1.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/README.md +48 -253
  2. package/dist/authentication-server.mjs +52 -84
  3. package/dist/{chunk-fn7b5pxw.js → chunk-04r0t2mb.js} +19364 -34104
  4. package/dist/chunk-727y6qkb.js +156 -0
  5. package/dist/chunk-bg5r4wpv.js +4755 -0
  6. package/dist/chunk-cbd36jq1.js +512 -0
  7. package/dist/chunk-d4ctj079.js +241 -0
  8. package/dist/{chunk-cq9xscgb.js → chunk-r5s2v669.js} +49079 -33564
  9. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
  10. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
  11. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
  12. package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
  13. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
  14. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
  15. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
  16. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
  17. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
  18. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
  19. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
  20. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
  21. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
  22. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
  23. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
  24. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
  25. package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
  26. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
  27. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
  28. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
  29. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +153 -16
  30. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +10 -2
  31. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +29 -13
  32. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
  33. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
  34. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
  35. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
  36. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
  37. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
  38. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
  39. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
  40. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
  41. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
  42. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
  43. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
  44. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
  45. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
  46. package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
  47. package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
  48. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
  49. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
  50. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
  51. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
  52. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
  53. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
  54. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
  55. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
  56. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
  57. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
  58. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
  59. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
  60. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
  61. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
  62. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
  63. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
  64. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
  65. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
  66. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
  67. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
  68. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
  69. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
  70. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
  71. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
  72. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
  73. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
  74. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
  75. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
  76. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
  77. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
  78. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
  79. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
  80. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
  81. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
  82. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
  83. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
  84. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
  85. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
  86. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
  87. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
  88. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
  89. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
  90. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
  91. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
  92. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
  93. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
  94. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
  95. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
  96. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
  97. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
  98. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
  99. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
  100. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
  101. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
  102. package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
  103. package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
  104. package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
  105. package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
  106. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
  107. package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
  108. package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
  109. package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
  110. package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
  111. package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
  112. package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
  113. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
  114. package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
  115. package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +11 -4
  116. package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
  117. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
  118. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
  119. package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
  120. package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
  121. package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
  122. package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +47 -0
  123. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
  124. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
  125. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
  126. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
  127. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
  128. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
  129. package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
  130. package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
  131. package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
  132. package/dist/dashboard-source/apps/frontend/components/Header.tsx +4 -8
  133. package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
  134. package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
  135. package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
  136. package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
  137. package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
  138. package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
  139. package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
  140. package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
  141. package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
  142. package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
  143. package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
  144. package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
  145. package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
  146. package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
  147. package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
  148. package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
  149. package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
  150. package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
  151. package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
  152. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
  153. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
  154. package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
  155. package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
  156. package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
  157. package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
  158. package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
  159. package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
  160. package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
  161. package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
  162. package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
  163. package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
  164. package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
  165. package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
  166. package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
  167. package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
  168. package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +112 -21
  169. package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
  170. package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
  171. package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
  172. package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
  173. package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
  174. package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
  175. package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
  176. package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
  177. package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
  178. package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
  179. package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
  180. package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
  181. package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
  182. package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
  183. package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
  184. package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
  185. package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
  186. package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
  187. package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
  188. package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
  189. package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
  190. package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
  191. package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +169 -30
  192. package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
  193. package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
  194. package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
  195. package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +38 -29
  196. package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
  197. package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
  198. package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
  199. package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
  200. package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
  201. package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
  202. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
  203. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
  204. package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
  205. package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
  206. package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
  207. package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
  208. package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +900 -0
  209. package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +42 -0
  210. package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
  211. package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
  212. package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
  213. package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
  214. package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +193 -0
  215. package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +237 -0
  216. package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
  217. package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
  218. package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
  219. package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
  220. package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
  221. package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
  222. package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
  223. package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
  224. package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
  225. package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
  226. package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
  227. package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
  228. package/dist/dashboard-source/apps/frontend/package.json +48 -47
  229. package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
  230. package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
  231. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
  232. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
  233. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
  234. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
  235. package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
  236. package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
  237. package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
  238. package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
  239. package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
  240. package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
  241. package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
  242. package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
  243. package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
  244. package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
  245. package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
  246. package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
  247. package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
  248. package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
  249. package/dist/dashboard-source/modules/form/src/index.ts +1 -10
  250. package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
  251. package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
  252. package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
  253. package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
  254. package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
  255. package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
  256. package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
  257. package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
  258. package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
  259. package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
  260. package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
  261. package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
  262. package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
  263. package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
  264. package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
  265. package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
  266. package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
  267. package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
  268. package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
  269. package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
  270. package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
  271. package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
  272. package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
  273. package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
  274. package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
  275. package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
  276. package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
  277. package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
  278. package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
  279. package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
  280. package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
  281. package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
  282. package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
  283. package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
  284. package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
  285. package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
  286. package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
  287. package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
  288. package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
  289. package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
  290. package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
  291. package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
  292. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
  293. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
  294. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +272 -0
  295. package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
  296. package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
  297. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
  298. package/dist/dashboard-source.json +48 -47
  299. package/dist/graphql-server.mjs +245 -200
  300. package/dist/job-worker-supervisor.mjs +262 -0
  301. package/dist/job-worker.mjs +234 -133
  302. package/dist/main.mjs +23 -4
  303. package/dist/prepare-dashboard.mjs +8 -8
  304. package/dist/resources/cedar/policies.cedar +80 -38
  305. package/dist/resources/cedar/schema.cedarschema +39 -21
  306. package/dist/resources/graphql-schema/rxdb.graphql +2 -0
  307. package/dist/resources/graphql-schema/system.graphql +204 -51
  308. package/package.json +64 -62
  309. package/dist/chunk-6b6t8tyq.js +0 -85
  310. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
  311. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
  312. package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
  313. package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
  314. package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
  315. package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
  316. package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
  317. package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
  318. package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
  319. package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
  320. package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
  321. package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
  322. package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
  323. package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
  324. package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
  325. package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
  326. package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
@@ -0,0 +1,72 @@
1
+ "use client"
2
+
3
+ import { usePathname, useSearchParams } from "next/navigation"
4
+ import { useMemo, useState } from "react"
5
+ import { parseListReturnDestination } from "./list-refresh.ts"
6
+ import { useReturnToList } from "./list-refresh-provider.tsx"
7
+ import StartProcessModalClient from "@/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client"
8
+
9
+ const startPrefix = "/processes/start/"
10
+
11
+ /** The retained List reads its own URL state while the form owns the address bar. */
12
+ export function useListSearchParams() {
13
+ const pathname = usePathname()
14
+ const params = useSearchParams()
15
+ return useMemo(() => {
16
+ const destination = pathname.startsWith(startPrefix)
17
+ ? parseListReturnDestination(params.get("returnTo"), "http://localhost")
18
+ : null
19
+ return destination
20
+ ? new URL(destination.href, "http://localhost").searchParams
21
+ : params
22
+ }, [pathname, params])
23
+ }
24
+
25
+ /** Also mounted by the hard-navigation start page, using the same List server page. */
26
+ export function ListProcessDialog({ listPath }: { readonly listPath: string }) {
27
+ const pathname = usePathname()
28
+ const params = useSearchParams()
29
+ const destination = parseListReturnDestination(
30
+ params.get("returnTo"),
31
+ "http://localhost",
32
+ )
33
+ if (!pathname.startsWith(startPrefix) || destination?.listPath !== listPath)
34
+ return null
35
+ return (
36
+ <RetainedListProcessDialog
37
+ key={pathname}
38
+ startStepPath={`/${decodeURIComponent(pathname.slice(startPrefix.length))}`}
39
+ sourceRecordId={params.get("sourceRecordId")}
40
+ />
41
+ )
42
+ }
43
+
44
+ function RetainedListProcessDialog({
45
+ startStepPath,
46
+ sourceRecordId,
47
+ }: {
48
+ readonly startStepPath: string
49
+ readonly sourceRecordId: string | null
50
+ }) {
51
+ const returnToList = useReturnToList(true)
52
+ const [initiator] = useState(() =>
53
+ typeof document === "undefined" ? null : document.activeElement,
54
+ )
55
+ return (
56
+ <StartProcessModalClient
57
+ startStepPath={startStepPath}
58
+ description={
59
+ sourceRecordId
60
+ ? `Start a process for List record ${sourceRecordId}`
61
+ : "Start a process"
62
+ }
63
+ onClose={returnToList}
64
+ onCloseAutoFocus={(event) => {
65
+ event.preventDefault()
66
+ if (initiator instanceof HTMLElement && initiator.isConnected) {
67
+ initiator.focus()
68
+ }
69
+ }}
70
+ />
71
+ )
72
+ }
@@ -0,0 +1,65 @@
1
+ "use client"
2
+
3
+ import { useRouter, useSearchParams } from "next/navigation"
4
+ import { type ReactNode, createContext, useContext, useState } from "react"
5
+ import { ListRefreshState, parseListReturnDestination } from "./list-refresh.ts"
6
+ import { useSession } from "@/components/auth-provider"
7
+ import { useRuntimeConfig } from "@/components/config-provider"
8
+ import { getSessionCacheScope } from "@/lib/auth/session-cache-scope"
9
+
10
+ const ListRefreshContext = createContext<ListRefreshState | null>(null)
11
+
12
+ export function ListRefreshProvider({ children }: { children: ReactNode }) {
13
+ const session = useSession()
14
+ const { orgId, graphqlEndpoint } = useRuntimeConfig()
15
+ const scope = JSON.stringify([
16
+ orgId,
17
+ graphqlEndpoint,
18
+ getSessionCacheScope(session),
19
+ ])
20
+ return (
21
+ <ScopedListRefreshProvider key={scope}>
22
+ {children}
23
+ </ScopedListRefreshProvider>
24
+ )
25
+ }
26
+
27
+ function ScopedListRefreshProvider({ children }: { children: ReactNode }) {
28
+ const [state] = useState(() => new ListRefreshState())
29
+ return (
30
+ <ListRefreshContext.Provider value={state}>
31
+ {children}
32
+ </ListRefreshContext.Provider>
33
+ )
34
+ }
35
+
36
+ export function useListRefresh(): ListRefreshState {
37
+ const state = useContext(ListRefreshContext)
38
+ if (!state) throw new Error("ListRefreshProvider is required")
39
+ return state
40
+ }
41
+
42
+ /** Both process routes share the success/cancellation and warm-history contract. */
43
+ export function useReturnToList(retainList = false) {
44
+ const router = useRouter()
45
+ const params = useSearchParams()
46
+ const state = useListRefresh()
47
+ return (result: "submitted" | "cancelled"): boolean => {
48
+ const destination = parseListReturnDestination(
49
+ params.get("returnTo"),
50
+ window.location.origin,
51
+ )
52
+ if (!destination) return false
53
+ const { href, listPath } = destination
54
+ if (result === "submitted") state.invalidate(listPath)
55
+ if (state.canReturn(params.get("listReturn"), href)) {
56
+ router.back()
57
+ } else if (retainList) {
58
+ window.history.replaceState(null, "", href)
59
+ } else {
60
+ // A direct/reloaded form has no retained shell. Load the normal SSR route.
61
+ router.push(href)
62
+ }
63
+ return true
64
+ }
65
+ }
@@ -1,26 +1,172 @@
1
- "use client"
1
+ import type {
2
+ ListDataResult,
3
+ ListQueryVariables,
4
+ } from "@/lib/graphql/list-queries"
2
5
 
3
- const staleListKeyPrefix = "pf:list-stale:"
6
+ type RefreshResult =
7
+ | { readonly kind: "loading" }
8
+ | { readonly kind: "error" }
9
+ | { readonly kind: "ready"; readonly data: ListDataResult }
4
10
 
5
- // Full-page item routes unmount the list before router.refresh() can repaint it.
6
- // Marking the list stale lets the next list mount request fresh server data.
7
- export function markListStale(listPath: string): void {
8
- try {
9
- window.sessionStorage.setItem(`${staleListKeyPrefix}${listPath}`, "1")
10
- } catch {
11
- // Ignore storage failures; direct router.refresh() still handles current routes.
11
+ type RefreshEntry = {
12
+ version: number
13
+ sources: ReadonlySet<ListDataResult>
14
+ result: RefreshResult
15
+ }
16
+
17
+ type ListRefreshSnapshot = {
18
+ readonly versions: ReadonlyMap<string, number>
19
+ readonly results: ReadonlyMap<string, RefreshEntry>
20
+ }
21
+
22
+ /** Owned by one authenticated shell, never persisted across logout/reload. */
23
+ export class ListRefreshState {
24
+ private versions = new Map<string, number>()
25
+ private results = new Map<string, RefreshEntry>()
26
+ private returns = new Map<string, string>()
27
+ private listeners = new Set<() => void>()
28
+ private current: ListRefreshSnapshot = {
29
+ versions: new Map(),
30
+ results: new Map(),
31
+ }
32
+ private initial = this.current
33
+
34
+ subscribe = (listener: () => void) => {
35
+ this.listeners.add(listener)
36
+ return () => {
37
+ this.listeners.delete(listener)
38
+ }
39
+ }
40
+ snapshot = () => this.current
41
+ serverSnapshot = () => this.initial
42
+ private emit() {
43
+ this.current = {
44
+ versions: new Map(this.versions),
45
+ results: new Map(this.results),
46
+ }
47
+ for (const listener of this.listeners) listener()
48
+ }
49
+
50
+ rememberReturn(destination: string): string {
51
+ const token = crypto.randomUUID()
52
+ this.returns.set(token, destination)
53
+ return token
54
+ }
55
+
56
+ canReturn(token: string | null, destination: string): boolean {
57
+ return token !== null && this.returns.get(token) === destination
58
+ }
59
+
60
+ invalidate(path: string): void {
61
+ this.versions.set(path, (this.versions.get(path) ?? 0) + 1)
62
+ this.emit()
63
+ }
64
+
65
+ private key(path: string, variables: ListQueryVariables): string {
66
+ return JSON.stringify([
67
+ path,
68
+ variables.page,
69
+ variables.limit,
70
+ variables.filter,
71
+ variables.sort ?? null,
72
+ ])
73
+ }
74
+
75
+ read(
76
+ path: string,
77
+ variables: ListQueryVariables,
78
+ initial: ListDataResult,
79
+ snapshot = this.current,
80
+ ): RefreshResult {
81
+ const version = snapshot.versions.get(path) ?? 0
82
+ if (version === 0) return { kind: "ready", data: initial }
83
+ const entry = snapshot.results.get(this.key(path, variables))
84
+ return entry?.version === version && entry.sources.has(initial)
85
+ ? entry.result
86
+ : { kind: "loading" }
87
+ }
88
+
89
+ async refresh(
90
+ path: string,
91
+ variables: ListQueryVariables,
92
+ initial: ListDataResult,
93
+ fetch: (variables: ListQueryVariables) => Promise<ListDataResult>,
94
+ snapshot = this.current,
95
+ ): Promise<void> {
96
+ const version = snapshot.versions.get(path) ?? 0
97
+ if ((this.versions.get(path) ?? 0) !== version) return
98
+ const key = this.key(path, variables)
99
+ const previous = this.results.get(key)
100
+ if (previous?.version === version && previous.sources.has(initial)) return
101
+ const sources = new Set(previous?.sources)
102
+ sources.add(initial)
103
+ const pending: RefreshEntry = {
104
+ version,
105
+ sources,
106
+ result: { kind: "loading" },
107
+ }
108
+ if (version === 0) {
109
+ this.results.set(key, {
110
+ ...pending,
111
+ result: { kind: "ready", data: initial },
112
+ })
113
+ this.emit()
114
+ return
115
+ }
116
+ // A new RSC payload can follow a write outside this List. Revalidate it
117
+ // rather than masking it with cached rows or trusting an older prefetch.
118
+ // Previously seen payloads (Back/Forward) keep the latest refreshed rows.
119
+ this.results.set(key, pending)
120
+ this.emit()
121
+ try {
122
+ const data = await fetch(variables)
123
+ if (
124
+ this.versions.get(path) !== version ||
125
+ this.results.get(key) !== pending
126
+ )
127
+ return
128
+ this.results.set(key, {
129
+ version,
130
+ sources,
131
+ result: { kind: "ready", data },
132
+ })
133
+ if (data.page !== variables.page) {
134
+ this.results.set(this.key(path, { ...variables, page: data.page }), {
135
+ version,
136
+ sources,
137
+ result: { kind: "ready", data },
138
+ })
139
+ }
140
+ } catch {
141
+ if (
142
+ this.versions.get(path) !== version ||
143
+ this.results.get(key) !== pending
144
+ )
145
+ return
146
+ this.results.set(key, { version, sources, result: { kind: "error" } })
147
+ }
148
+ this.emit()
12
149
  }
13
150
  }
14
151
 
15
- export function consumeListStale(listPath: string): boolean {
152
+ /** Parse untrusted return URLs before navigating or invalidating List state. */
153
+ export function parseListReturnDestination(
154
+ returnTo: string | null,
155
+ origin: string,
156
+ ) {
157
+ if (!returnTo?.startsWith("/lists/")) return null
16
158
  try {
17
- const key = `${staleListKeyPrefix}${listPath}`
18
- const isStale = window.sessionStorage.getItem(key) === "1"
19
- if (isStale) {
20
- window.sessionStorage.removeItem(key)
159
+ const destination = new URL(returnTo, origin)
160
+ if (
161
+ destination.origin !== origin ||
162
+ !destination.pathname.startsWith("/lists/")
163
+ )
164
+ return null
165
+ return {
166
+ href: `${destination.pathname}${destination.search}`,
167
+ listPath: decodeURIComponent(destination.pathname).slice("/lists".length),
21
168
  }
22
- return isStale
23
169
  } catch {
24
- return false
170
+ return null
25
171
  }
26
172
  }
@@ -0,0 +1,19 @@
1
+ import { DateTimeDisplay } from "../../../../../modules/shadcn-components/src/lib/date-time-display.tsx"
2
+
3
+ /** ISO 8601 date pattern */
4
+ const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/
5
+
6
+ /**
7
+ * Format a cell value for display.
8
+ * ISO calendar dates retain their day; ISO date/times represent instants.
9
+ */
10
+ export function formatCellValue(value: unknown) {
11
+ if (value == null) return ""
12
+ if (typeof value === "string" && ISO_DATE_PATTERN.test(value)) {
13
+ return <DateTimeDisplay kind="timestamp" value={value} />
14
+ }
15
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
16
+ return <DateTimeDisplay kind="calendar-date" value={value} />
17
+ }
18
+ return String(value)
19
+ }
@@ -7,13 +7,14 @@ import { flattenOrgUnits } from "@/lib/org-chart-data"
7
7
  import { getDepthConfig } from "@/lib/org-chart-depth-config"
8
8
  import { layoutOrgChart } from "@/lib/org-chart-layout"
9
9
 
10
+ // The authenticated layout can omit this page while checking the session.
11
+ export const instant = false
12
+
10
13
  const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
11
14
  // Fetch data with error handling - return empty state on error
12
15
  const data = yield* fetchOrgChartDataEffect().pipe(
13
- Effect.catchAll((error) => {
14
- // Log error for debugging
16
+ Effect.catch((error) => {
15
17
  console.error("Failed to fetch org chart data:", error.message)
16
- // Return empty data structure for graceful degradation
17
18
  return Effect.succeed({
18
19
  orgLevels: [],
19
20
  org: {
@@ -26,7 +27,6 @@ const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
26
27
  }),
27
28
  )
28
29
 
29
- // Handle empty data case
30
30
  if (data.orgLevels.length === 0) {
31
31
  return (
32
32
  <div className="flex h-full flex-col">
@@ -45,21 +45,17 @@ const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
45
45
  )
46
46
  }
47
47
 
48
- // Create mapping from level name to depth (maxDepth)
49
48
  const levelToDepth = new Map(
50
49
  data.orgLevels.map((level) => [level.level, level.maxDepth]),
51
50
  )
52
51
 
53
- // Flatten nested structure to flat array with parentId
54
52
  // Type assertion is safe because the GraphQL type is structurally compatible with RecursiveOrgUnit
55
53
  const flatOrgUnits = flattenOrgUnits(
56
54
  data.org as Parameters<typeof flattenOrgUnits>[0],
57
55
  )
58
56
 
59
- // Layout the org chart
60
57
  const { nodes, edges } = layoutOrgChart(flatOrgUnits)
61
58
 
62
- // Enrich nodes with depth information from levelToDepth mapping
63
59
  const enrichedNodes = nodes.map((node) => ({
64
60
  ...node,
65
61
  data: {
@@ -68,7 +64,6 @@ const OrgChartPage = Effect.fn("OrgChartPage")(function* () {
68
64
  },
69
65
  }))
70
66
 
71
- // Create legend items from actual org levels
72
67
  const legendItems = data.orgLevels
73
68
  .sort((a, b) => a.maxDepth - b.maxDepth)
74
69
  .map((level) => {
@@ -2,6 +2,10 @@ import ClientPage from "./client.tsx"
2
2
  import { ExecutionCollectionProvider } from "@/lib/collections/execution-collection-provider"
3
3
  import { ProcessCollectionProvider } from "@/lib/collections/process-collection-provider"
4
4
 
5
+ // The authenticated layout can omit children while redirecting or reissuing a
6
+ // session, so this page is not rendered in every instant-validation pass.
7
+ export const instant = false
8
+
5
9
  export default function Page() {
6
10
  return (
7
11
  <ProcessCollectionProvider>
@@ -1,11 +1,7 @@
1
1
  "use server"
2
2
 
3
- import {
4
- FetchHttpClient,
5
- HttpClient,
6
- HttpClientRequest,
7
- } from "@effect/platform"
8
- import { Effect, Either, Schema } from "effect"
3
+ import { Effect, Exit, Schema } from "effect"
4
+ import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http"
9
5
  import { getIssuerUrl } from "@/lib/auth/issuer"
10
6
  import {
11
7
  PasskeyEnrollmentOptions,
@@ -54,7 +50,7 @@ function requestPasskeys<
54
50
  }: {
55
51
  method: "GET" | "PATCH" | "POST" | "DELETE"
56
52
  body?: unknown
57
- schema: Schema.Schema<A, I>
53
+ schema: Schema.Codec<A, I>
58
54
  kind: K
59
55
  message: string
60
56
  statuses?: Readonly<Record<number, Failure | NoInfer<Extra>>>
@@ -73,12 +69,13 @@ function requestPasskeys<
73
69
  if (response.status < 200 || response.status >= 300)
74
70
  return statuses[response.status] ?? { kind: "error" as const, message }
75
71
  const data = yield* response.json.pipe(
76
- Effect.flatMap(Schema.decodeUnknown(schema)),
72
+ Effect.flatMap(Schema.decodeUnknownEffect(schema)),
77
73
  )
78
74
  return { kind, ...data }
79
75
  }).pipe(
80
- Effect.catchAll(() => Effect.succeed({ kind: "error" as const, message })),
76
+ Effect.catch(() => Effect.succeed({ kind: "error" as const, message })),
81
77
  Effect.provide(FetchHttpClient.layer),
78
+ Effect.provideService(FetchHttpClient.Fetch, globalThis.fetch),
82
79
  Effect.provideService(FetchHttpClient.RequestInit, {
83
80
  cache: "no-store",
84
81
  redirect: "error",
@@ -101,15 +98,15 @@ export async function listPasskeys(): Promise<Listed | Failure> {
101
98
  }
102
99
 
103
100
  export async function renamePasskey(input: unknown): Promise<Listed | Failure> {
104
- const parsed = Schema.decodeUnknownEither(RenamePasskey)(input)
105
- if (Either.isLeft(parsed)) return { kind: "error", message: nameError }
101
+ const parsed = Schema.decodeUnknownExit(RenamePasskey)(input)
102
+ if (Exit.isFailure(parsed)) return { kind: "error", message: nameError }
106
103
  return requestPasskeys<
107
104
  typeof PasskeyList.Type,
108
105
  typeof PasskeyList.Encoded,
109
106
  "success"
110
107
  >({
111
108
  method: "PATCH",
112
- body: parsed.right,
109
+ body: parsed.value,
113
110
  schema: PasskeyList,
114
111
  kind: "success",
115
112
  message: "Unable to rename this Passkey.",
@@ -120,15 +117,15 @@ export async function renamePasskey(input: unknown): Promise<Listed | Failure> {
120
117
  export async function startPasskeyEnrollment(
121
118
  input: unknown,
122
119
  ): Promise<Enrollment | Failure> {
123
- const parsed = Schema.decodeUnknownEither(StartPasskeyEnrollment)(input)
124
- if (Either.isLeft(parsed)) return { kind: "error", message: nameError }
120
+ const parsed = Schema.decodeUnknownExit(StartPasskeyEnrollment)(input)
121
+ if (Exit.isFailure(parsed)) return { kind: "error", message: nameError }
125
122
  return requestPasskeys<
126
123
  typeof PasskeyEnrollmentOptions.Type,
127
124
  typeof PasskeyEnrollmentOptions.Encoded,
128
125
  "options"
129
126
  >({
130
127
  method: "POST",
131
- body: parsed.right,
128
+ body: parsed.value,
132
129
  schema: PasskeyEnrollmentOptions,
133
130
  kind: "options",
134
131
  message: "Unable to start Passkey registration.",
@@ -165,8 +162,8 @@ export async function verifyPasskeyEnrollment(
165
162
  }
166
163
 
167
164
  export async function removePasskey(input: unknown): Promise<Listed | Failure> {
168
- const parsed = Schema.decodeUnknownEither(RemovePasskey)(input)
169
- if (Either.isLeft(parsed))
165
+ const parsed = Schema.decodeUnknownExit(RemovePasskey)(input)
166
+ if (Exit.isFailure(parsed))
170
167
  return { kind: "error", message: "Unable to remove this Passkey." }
171
168
  return requestPasskeys<
172
169
  typeof PasskeyList.Type,
@@ -174,7 +171,7 @@ export async function removePasskey(input: unknown): Promise<Listed | Failure> {
174
171
  "success"
175
172
  >({
176
173
  method: "DELETE",
177
- body: parsed.right,
174
+ body: parsed.value,
178
175
  schema: PasskeyList,
179
176
  kind: "success",
180
177
  message: "Unable to remove this Passkey.",
@@ -1,8 +1,12 @@
1
1
  import { Effect } from "effect"
2
+ import { DateTimeDisplayProvider } from "../../../../../modules/shadcn-components/src/lib/date-time-display.tsx"
2
3
  import { listPasskeys } from "./actions.ts"
3
4
  import { PasskeysClient } from "./passkeys-client.tsx"
4
5
  import { BasePage } from "@/lib/effect/runtime"
5
6
 
7
+ // The authenticated layout can omit this page while checking the session.
8
+ export const instant = false
9
+
6
10
  const Passkeys = BasePage.build(() =>
7
11
  Effect.gen(function* () {
8
12
  const result = yield* Effect.promise(() => listPasskeys())
@@ -18,12 +22,14 @@ const Passkeys = BasePage.build(() =>
18
22
  {result.kind !== "success" ? (
19
23
  <p role="alert">{result.message}</p>
20
24
  ) : (
21
- <PasskeysClient
22
- key={result.account.userId}
23
- organisationName={result.organisation.name}
24
- account={result.account}
25
- initialCredentials={result.credentials}
26
- />
25
+ <DateTimeDisplayProvider initialNow={Date.now()}>
26
+ <PasskeysClient
27
+ key={result.account.userId}
28
+ organisationName={result.organisation.name}
29
+ account={result.account}
30
+ initialCredentials={result.credentials}
31
+ />
32
+ </DateTimeDisplayProvider>
27
33
  )}
28
34
  </div>
29
35
  )
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { startRegistration } from "@simplewebauthn/browser"
4
4
  import { useState, useTransition } from "react"
5
- import { Button } from "../../../../../modules/shadcn-components/src/index.ts"
5
+ import { Button, DateTimeDisplay } from "../../../../../modules/shadcn-components/src/index.ts"
6
6
  import {
7
7
  listPasskeys,
8
8
  removePasskey,
@@ -27,19 +27,6 @@ function displayName(name: string | null): string {
27
27
  return trimmed === "" ? unnamedLabel : trimmed
28
28
  }
29
29
 
30
- function AddedOn({ value }: { value: string }) {
31
- return (
32
- <time dateTime={value}>
33
- {new Intl.DateTimeFormat("en", {
34
- dateStyle: "medium",
35
- timeStyle: "short",
36
- timeZone: "UTC",
37
- }).format(new Date(value))}{" "}
38
- UTC
39
- </time>
40
- )
41
- }
42
-
43
30
  const isAlreadyRegisteredError = (error: unknown): boolean => {
44
31
  if (
45
32
  error !== null &&
@@ -192,7 +179,8 @@ export function PasskeysClient({
192
179
  {displayName(credential.name)}
193
180
  </h3>
194
181
  <p className="text-sm text-muted-foreground">
195
- Date added: <AddedOn value={credential.createdAt} />
182
+ Date added:{" "}
183
+ <DateTimeDisplay kind="timestamp" value={credential.createdAt} />
196
184
  </p>
197
185
  <p
198
186
  className="text-sm text-muted-foreground"
@@ -200,7 +188,10 @@ export function PasskeysClient({
200
188
  >
201
189
  Last used:{" "}
202
190
  {credential.lastUsedAt ? (
203
- <AddedOn value={credential.lastUsedAt} />
191
+ <DateTimeDisplay
192
+ kind="timestamp"
193
+ value={credential.lastUsedAt}
194
+ />
204
195
  ) : (
205
196
  "Unknown"
206
197
  )}