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