@baseplate-dev/plugin-auth 0.6.17 → 0.6.19

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 (294) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +74 -0
  3. package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +74 -0
  4. package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +37 -0
  5. package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +37 -0
  6. package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.js +1 -2
  7. package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.tsx +1 -1
  8. package/dist/better-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +74 -0
  9. package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +74 -0
  10. package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +37 -0
  11. package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +74 -0
  12. package/dist/better-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.js +1 -2
  13. package/dist/better-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.tsx +1 -1
  14. package/dist/better-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +37 -0
  15. package/dist/better-auth/core/node.js +7 -8
  16. package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/index.d.ts +1 -0
  17. package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/ts-import-providers.d.ts +1 -0
  18. package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/ts-import-providers.js +1 -0
  19. package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.d.ts +20 -3
  20. package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.js +5 -24
  21. package/dist/better-auth/generators/fastify/better-auth-module/generated/index.d.ts +40 -2
  22. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.d.ts +19 -1
  23. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.js +6 -2
  24. package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.d.ts +1 -0
  25. package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.js +1 -0
  26. package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.d.ts +20 -1
  27. package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.js +4 -1
  28. package/dist/better-auth/generators/fastify/better-auth-module/templates/module/services/auth.ts +16 -8
  29. package/dist/better-auth/generators/react/better-auth-hooks/better-auth-hooks.generator.d.ts +1 -1
  30. package/dist/better-auth/generators/react/better-auth-hooks/generated/index.d.ts +5 -4
  31. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.d.ts +1 -1
  32. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.js +1 -1
  33. package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.d.ts +2 -1
  34. package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.js +2 -1
  35. package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.d.ts +6 -6
  36. package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.js +13 -13
  37. package/dist/better-auth/generators/react/better-auth-hooks/templates/src/hooks/{use-required-user-id.ts → use-user-id-or-throw.ts} +1 -1
  38. package/dist/better-auth/generators/react/better-auth-pages/better-auth-pages.generator.d.ts +37 -0
  39. package/dist/better-auth/generators/react/better-auth-pages/generated/index.d.ts +222 -0
  40. package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.d.ts +37 -0
  41. package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.d.ts +370 -0
  42. package/dist/better-auth/generators/react/better-auth-pages/templates/routes/forgot-password.tsx +1 -4
  43. package/dist/better-auth/generators/react/react-better-auth/generated/index.d.ts +77 -2
  44. package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.d.ts +38 -1
  45. package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.d.ts +1 -0
  46. package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.js +1 -0
  47. package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.d.ts +38 -1
  48. package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.d.ts +38 -1
  49. package/dist/better-auth/generators/react/react-better-auth/templates/src/app/auth-loaded-gate.tsx +12 -3
  50. package/dist/local-auth/admin/common.js +6 -0
  51. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.d.ts +593 -0
  52. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.js +119 -0
  53. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.d.ts +602 -0
  54. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.js +11 -0
  55. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.d.ts +12 -0
  56. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.js +24 -0
  57. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.d.ts +307 -0
  58. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.js +45 -0
  59. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.d.ts +294 -0
  60. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.js +21 -0
  61. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.d.ts +2 -0
  62. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.js +2 -0
  63. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.d.ts +21 -0
  64. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.js +68 -0
  65. package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.tsx +122 -0
  66. package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +74 -0
  67. package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +74 -0
  68. package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +37 -0
  69. package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +37 -0
  70. package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.js +1 -2
  71. package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.tsx +1 -1
  72. package/dist/local-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +74 -0
  73. package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +74 -0
  74. package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +37 -0
  75. package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +74 -0
  76. package/dist/local-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.js +1 -2
  77. package/dist/local-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.tsx +1 -1
  78. package/dist/local-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +37 -0
  79. package/dist/local-auth/admin/node.js +13 -0
  80. package/dist/local-auth/admin/schema/invite-user-action.d.ts +12 -0
  81. package/dist/local-auth/admin/schema/invite-user-action.js +6 -0
  82. package/dist/local-auth/admin/web.js +8 -0
  83. package/dist/local-auth/core/common.js +7 -2
  84. package/dist/local-auth/core/components/local-auth-definition-editor.js +2 -1
  85. package/dist/local-auth/core/components/local-auth-web-app-settings-form.d.ts +9 -0
  86. package/dist/local-auth/core/components/local-auth-web-app-settings-form.js +11 -0
  87. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +16 -7
  88. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js +73 -16
  89. package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +222 -7
  90. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts +5 -0
  91. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js +5 -0
  92. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts +27 -0
  93. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js +71 -4
  94. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.d.ts +1 -3
  95. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.js +1 -2
  96. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +226 -10
  97. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +91 -7
  98. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.d.ts +19 -0
  99. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.js +20 -0
  100. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.ts +22 -0
  101. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts +12 -0
  102. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js +12 -0
  103. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.ts +14 -0
  104. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.d.ts +2 -0
  105. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.js +30 -0
  106. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.ts +38 -0
  107. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.d.ts +2 -0
  108. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.js +42 -0
  109. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.ts +54 -0
  110. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.js +2 -19
  111. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.ts +1 -22
  112. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.d.ts +37 -0
  113. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.js +225 -0
  114. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.ts +333 -0
  115. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.js +2 -3
  116. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.ts +5 -3
  117. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.d.ts +39 -0
  118. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.js +142 -0
  119. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.ts +221 -0
  120. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +5 -6
  121. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +8 -5
  122. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts +3 -1
  123. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js +18 -3
  124. package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts +40 -0
  125. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts +2 -0
  126. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js +2 -0
  127. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts +6 -0
  128. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js +20 -0
  129. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts +40 -0
  130. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js +24 -0
  131. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.d.ts +3 -0
  132. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.js +18 -0
  133. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.tsx +57 -0
  134. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.d.ts +3 -0
  135. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.js +14 -0
  136. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.tsx +47 -0
  137. package/dist/local-auth/core/generators/auth-hooks/auth-hooks.generator.d.ts +272 -1
  138. package/dist/local-auth/core/generators/auth-hooks/generated/index.d.ts +547 -4
  139. package/dist/local-auth/core/generators/auth-hooks/generated/template-paths.d.ts +1 -1
  140. package/dist/local-auth/core/generators/auth-hooks/generated/template-paths.js +1 -1
  141. package/dist/local-auth/core/generators/auth-hooks/generated/template-renderers.d.ts +271 -0
  142. package/dist/local-auth/core/generators/auth-hooks/generated/template-renderers.js +4 -2
  143. package/dist/local-auth/core/generators/auth-hooks/generated/ts-import-providers.d.ts +2 -1
  144. package/dist/local-auth/core/generators/auth-hooks/generated/ts-import-providers.js +2 -1
  145. package/dist/local-auth/core/generators/auth-hooks/generated/typed-templates.d.ts +548 -6
  146. package/dist/local-auth/core/generators/auth-hooks/generated/typed-templates.js +15 -14
  147. package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-log-out.js +1 -1
  148. package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-log-out.ts +1 -1
  149. package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-session.d.ts +7 -0
  150. package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-session.ts +7 -0
  151. package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +23 -7
  152. package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +7 -26
  153. package/dist/local-auth/core/generators/auth-module/generated/index.d.ts +65 -4
  154. package/dist/local-auth/core/generators/auth-module/generated/template-paths.d.ts +1 -1
  155. package/dist/local-auth/core/generators/auth-module/generated/template-paths.js +1 -1
  156. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts +22 -1
  157. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.js +19 -2
  158. package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.d.ts +10 -0
  159. package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.js +7 -0
  160. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts +42 -4
  161. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.js +24 -13
  162. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.d.ts +4 -0
  163. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.js +1 -1
  164. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.ts +1 -1
  165. package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.d.ts +67 -0
  166. package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.js +140 -0
  167. package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.ts +191 -0
  168. package/dist/local-auth/core/generators/auth-module/templates/module/services/user-session.service.js +8 -9
  169. package/dist/local-auth/core/generators/auth-module/templates/module/services/user-session.service.ts +10 -11
  170. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.d.ts +39 -0
  171. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js +38 -5
  172. package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts +1089 -268
  173. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts +3 -0
  174. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js +3 -0
  175. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts +49 -0
  176. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js +51 -0
  177. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.d.ts +1 -0
  178. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.js +1 -0
  179. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts +918 -283
  180. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js +69 -23
  181. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.d.ts +9 -0
  182. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.js +10 -0
  183. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.ts +11 -0
  184. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.d.ts +7 -0
  185. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.js +155 -0
  186. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.tsx +274 -0
  187. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.js +1 -2
  188. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.tsx +1 -1
  189. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.d.ts +7 -0
  190. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.js +184 -0
  191. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.tsx +312 -0
  192. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +5 -5
  193. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +6 -12
  194. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js +4 -4
  195. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.tsx +4 -3
  196. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js +1 -2
  197. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.tsx +1 -1
  198. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.js +1 -2
  199. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.tsx +1 -1
  200. package/dist/local-auth/core/generators/react-session/generated/index.d.ts +90 -7
  201. package/dist/local-auth/core/generators/react-session/generated/template-renderers.d.ts +38 -1
  202. package/dist/local-auth/core/generators/react-session/generated/ts-import-providers.d.ts +1 -0
  203. package/dist/local-auth/core/generators/react-session/generated/ts-import-providers.js +1 -0
  204. package/dist/local-auth/core/generators/react-session/generated/typed-templates.d.ts +102 -12
  205. package/dist/local-auth/core/generators/react-session/generated/typed-templates.js +5 -2
  206. package/dist/local-auth/core/generators/react-session/react-session.generator.d.ts +54 -1
  207. package/dist/local-auth/core/generators/react-session/react-session.generator.js +35 -1
  208. package/dist/local-auth/core/generators/react-session/templates/src/app/user-session-provider.js +17 -44
  209. package/dist/local-auth/core/generators/react-session/templates/src/app/user-session-provider.tsx +21 -49
  210. package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.d.ts +43 -34
  211. package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.js +96 -80
  212. package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.ts +148 -82
  213. package/dist/local-auth/core/generators/seed-initial-user/generated/index.d.ts +0 -2
  214. package/dist/local-auth/core/generators/seed-initial-user/generated/template-renderers.d.ts +0 -1
  215. package/dist/local-auth/core/generators/seed-initial-user/generated/typed-templates.d.ts +0 -1
  216. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.d.ts +0 -1
  217. package/dist/local-auth/core/node.js +30 -12
  218. package/dist/local-auth/core/schema/migrations.d.ts +3 -0
  219. package/dist/local-auth/core/schema/migrations.js +36 -0
  220. package/dist/local-auth/core/schema/models.js +8 -0
  221. package/dist/local-auth/core/schema/plugin-definition.d.ts +1 -0
  222. package/dist/local-auth/core/schema/plugin-definition.js +1 -0
  223. package/dist/local-auth/core/schema/web-app-schema.d.ts +15 -0
  224. package/dist/local-auth/core/schema/web-app-schema.js +16 -0
  225. package/dist/local-auth/core/web.js +8 -1
  226. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/index.d.ts +4 -3
  227. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/template-paths.d.ts +1 -1
  228. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/template-paths.js +1 -1
  229. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/ts-import-providers.d.ts +2 -1
  230. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/ts-import-providers.js +2 -1
  231. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/typed-templates.d.ts +4 -4
  232. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/typed-templates.js +13 -13
  233. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/placeholder-auth-hooks.generator.d.ts +1 -1
  234. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/templates/src/hooks/use-session.d.ts +1 -0
  235. package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/templates/src/hooks/use-session.ts +2 -0
  236. package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/index.d.ts +1 -2
  237. package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/template-renderers.d.ts +0 -1
  238. package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/ts-import-providers.d.ts +1 -0
  239. package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/ts-import-providers.js +1 -0
  240. package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/typed-templates.d.ts +0 -1
  241. package/dist/placeholder-auth/core/generators/placeholder-auth-module/placeholder-auth-module.generator.d.ts +0 -1
  242. package/dist/web/assets/{_virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth-ChkXxpXe.js → _virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth__mf_owner__1-DUupKqD4.js} +42 -34
  243. package/dist/web/assets/{dist-DY7ZXvq4.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-DE4rTqEA.js} +16857 -381
  244. package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-37vlYRxk.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-mszeXpf-.js} +90 -38
  245. package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-DRSNXPPo.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-CtIleM_e.js} +4095 -2399
  246. package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-DfiQqvVC.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-BckLhSjF.js} +212 -57
  247. package/dist/web/assets/auth-DR6QxrAW.js +1 -0
  248. package/dist/web/assets/{common-iHaemino.js → common-BsyRiQi3.js} +6 -6
  249. package/dist/web/assets/{common-TDf_PrjX.js → common-CRwNlCMn.js} +10 -10
  250. package/dist/web/assets/{common-ByxS61u8.js → common-CvqlRZC9.js} +12 -12
  251. package/dist/web/assets/common-D3atSs7O.js +70 -0
  252. package/dist/web/assets/common-DuFyXa6l.js +36 -0
  253. package/dist/web/assets/common-islduJTj.js +43 -0
  254. package/dist/web/assets/{dist-CrLSslv6.js → dist-DQd1TAJX.js} +273 -132
  255. package/dist/web/assets/{get-auth-plugin-definition-kDCtXq_6.js → get-auth-plugin-definition-BgWWHl_Y.js} +3 -3
  256. package/dist/web/assets/{hostInit-Cruek6c6.js → hostInit-DNA4kLRY.js} +32 -5
  257. package/dist/web/assets/{mf-entry-bootstrap-0-dfed0275.js → mf-entry-bootstrap-0-ea77c09b.js} +2 -1
  258. package/dist/web/assets/{mf-entry-bootstrap-1-5275674a.js → mf-entry-bootstrap-1-9dee3d8d.js} +3 -2
  259. package/dist/web/assets/{mf-entry-bootstrap-2-39fb9255.js → mf-entry-bootstrap-2-3179040b.js} +3 -2
  260. package/dist/web/assets/{mf-entry-bootstrap-3-49e64336.js → mf-entry-bootstrap-3-370d200d.js} +3 -2
  261. package/dist/web/assets/{models-DSvs_3bA.js → models-BOeSYfRn.js} +4 -5
  262. package/dist/web/assets/{models-BZmCbizK.js → models-DF6DoXt6.js} +11 -6
  263. package/dist/web/assets/{plugin-definition-CYj29S3q.js → plugin-definition--k0VAeK3.js} +9 -10
  264. package/dist/web/assets/plugin-definition-CMwSlxsJ.js +10 -0
  265. package/dist/web/assets/{styles-yjbHBTlw.js → styles-BQEcQHoR.js} +9 -10
  266. package/dist/web/assets/{virtualExposes-CbPBmicF.js → virtualExposes-C7fDiAmS.js} +1 -1
  267. package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-BZBRyml2.js +747 -0
  268. package/dist/web/assets/{virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-B6BXIeF1.js → virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-6SjVUCs8.js} +13 -13
  269. package/dist/web/assets/web-8wz0ad-V.js +59 -0
  270. package/dist/web/assets/{web-CXAHKjIY.js → web-BGixH_gT.js} +27 -27
  271. package/dist/web/assets/{web-1eTcxMhf.js → web-BxIwkN3O.js} +6 -6
  272. package/dist/web/assets/{web-VqBA3jxZ.js → web-CQMfABjr.js} +24 -24
  273. package/dist/web/assets/{web-CDAKPPK9.js → web-CcNpItSu.js} +22 -22
  274. package/dist/web/assets/web-CypPeiVv.js +148 -0
  275. package/dist/web/assets/{web-D0MSKfyv.js → web-CzK_la2_.js} +53 -53
  276. package/dist/web/index.html +5 -5
  277. package/dist/web/remoteEntry.js +1 -1
  278. package/package.json +14 -14
  279. package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.d.ts +0 -38
  280. package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.js +0 -71
  281. package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.ts +0 -77
  282. package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-CO5Pvo0y.js +0 -384
  283. package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.js-BEZ7A-cz.js +0 -13566
  284. package/dist/web/assets/auth-BxAE0rgh.js +0 -1
  285. package/dist/web/assets/common-CKl_XlvH.js +0 -37
  286. package/dist/web/assets/common-UpVCKZeW.js +0 -41
  287. package/dist/web/assets/common-crSwCD36.js +0 -37
  288. package/dist/web/assets/model-utils-C0WDb_Ec.js +0 -1599
  289. package/dist/web/assets/plugin-definition-DOMmPL2Z.js +0 -11
  290. package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-XM6iYVxf.js +0 -259
  291. package/dist/web/assets/virtual_mf-exposes-ssr___mfe_internal__plugin-auth__remoteEntry_js-DGjg7Brm.js +0 -129
  292. package/dist/web/assets/web-DbeAaDTV.js +0 -118
  293. package/dist/web/assets/web-miDovYk_.js +0 -46
  294. package/dist/web/remoteEntry.ssr.js +0 -43
@@ -1,1599 +0,0 @@
1
- import { n as __mf_0 } from "./_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.js-BEZ7A-cz.js";
2
- //#region ../../packages/project-builder-lib/dist/plugins/spec/types.js
3
- /**
4
- * Creates a plugin spec with init and use phases.
5
- *
6
- * @example
7
- * ```typescript
8
- * const mySpec = createPluginSpec('core/my-spec', {
9
- * initializer: () => {
10
- * const items = new Map<string, Item>();
11
- * return {
12
- * init: {
13
- * register: (item: Item) => items.set(item.name, item),
14
- * },
15
- * use: () => ({
16
- * get: (name: string) => items.get(name),
17
- * getAll: () => [...items.values()],
18
- * }),
19
- * };
20
- * },
21
- * });
22
- * ```
23
- *
24
- * @param name - Unique identifier for the spec (e.g., 'core/my-spec')
25
- * @param options - Options including the initializer function
26
- * @returns A plugin spec that can be used with SpecStore
27
- */
28
- function createPluginSpec(name, options) {
29
- const { initializer } = options;
30
- return {
31
- type: "plugin-spec",
32
- name,
33
- initializer
34
- };
35
- }
36
- //#endregion
37
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/_internal/compareValues.mjs
38
- function nullishRank(value) {
39
- if (value === null) return 1;
40
- if (value === void 0) return 2;
41
- return 0;
42
- }
43
- function compareAscending(a, b) {
44
- const aRank = nullishRank(a);
45
- const bRank = nullishRank(b);
46
- if (aRank < bRank) return -1;
47
- if (aRank > bRank) return 1;
48
- if (aRank !== 0) return 0;
49
- if (a < b) return -1;
50
- if (a > b) return 1;
51
- return 0;
52
- }
53
- function compareValues(a, b, order) {
54
- return order === "asc" ? compareAscending(a, b) : compareAscending(b, a);
55
- }
56
- //#endregion
57
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/array/orderBy.mjs
58
- /**
59
- * Sorts an array of objects based on the given `criteria` and their corresponding order directions.
60
- *
61
- * - If you provide keys, it sorts the objects by the values of those keys.
62
- * - If you provide functions, it sorts based on the values returned by those functions.
63
- *
64
- * The function returns the array of objects sorted in corresponding order directions.
65
- * If two objects have the same value for the current criterion, it uses the next criterion to determine their order.
66
- * If the number of orders is less than the number of criteria, it uses the last order for the rest of the criteria.
67
- *
68
- * @template T - The type of elements in the array.
69
- * @param arr - The array of objects to be sorted.
70
- * @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting.
71
- * @param orders - An array of order directions ('asc' for ascending or 'desc' for descending).
72
- * @returns The sorted array.
73
- *
74
- * @example
75
- * // Sort an array of objects by 'user' in ascending order and 'age' in descending order.
76
- * const users = [
77
- * { user: 'fred', age: 48 },
78
- * { user: 'barney', age: 34 },
79
- * { user: 'fred', age: 40 },
80
- * { user: 'barney', age: 36 },
81
- * ];
82
- *
83
- * const result = orderBy(users, [obj => obj.user, 'age'], ['asc', 'desc']);
84
- * // result will be:
85
- * // [
86
- * // { user: 'barney', age: 36 },
87
- * // { user: 'barney', age: 34 },
88
- * // { user: 'fred', age: 48 },
89
- * // { user: 'fred', age: 40 },
90
- * // ]
91
- */
92
- function orderBy(arr, criteria, orders) {
93
- return arr.slice().sort((a, b) => {
94
- const ordersLength = orders.length;
95
- for (let i = 0; i < criteria.length; i++) {
96
- const order = ordersLength > i ? orders[i] : orders[ordersLength - 1];
97
- const criterion = criteria[i];
98
- const criterionIsFunction = typeof criterion === "function";
99
- const result = compareValues(criterionIsFunction ? criterion(a) : a[criterion], criterionIsFunction ? criterion(b) : b[criterion], order);
100
- if (result !== 0) return result;
101
- }
102
- return 0;
103
- });
104
- }
105
- //#endregion
106
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/array/sortBy.mjs
107
- /**
108
- * Sorts an array of objects based on the given `criteria`.
109
- *
110
- * - If you provide keys, it sorts the objects by the values of those keys.
111
- * - If you provide functions, it sorts based on the values returned by those functions.
112
- *
113
- * The function returns the array of objects sorted in ascending order.
114
- * If two objects have the same value for the current criterion, it uses the next criterion to determine their order.
115
- *
116
- * @template T - The type of the objects in the array.
117
- * @param arr - The array of objects to be sorted.
118
- * @param criteria - The criteria for sorting. This can be an array of object keys or functions that return values used for sorting.
119
- * @returns The sorted array.
120
- *
121
- * @example
122
- * const users = [
123
- * { user: 'foo', age: 24 },
124
- * { user: 'bar', age: 7 },
125
- * { user: 'foo', age: 8 },
126
- * { user: 'bar', age: 29 },
127
- * ];
128
- *
129
- * sortBy(users, ['user', 'age']);
130
- * sortBy(users, [obj => obj.user, 'age']);
131
- * // results will be:
132
- * // [
133
- * // { user : 'bar', age: 7 },
134
- * // { user : 'bar', age: 29 },
135
- * // { user : 'foo', age: 8 },
136
- * // { user : 'foo', age: 24 },
137
- * // ]
138
- */
139
- function sortBy(arr, criteria) {
140
- return orderBy(arr, criteria, ["asc"]);
141
- }
142
- //#endregion
143
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/_internal/globalThis.mjs
144
- var globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() {
145
- return this;
146
- })();
147
- //#endregion
148
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/function/noop.mjs
149
- /**
150
- * A no-operation function that does nothing.
151
- * This can be used as a placeholder or default function.
152
- *
153
- * @example
154
- * noop(); // Does nothing
155
- *
156
- * @returns This function does not return anything.
157
- */
158
- function noop() {}
159
- //#endregion
160
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isBuffer.mjs
161
- /**
162
- * Checks if the given value is a Buffer instance.
163
- *
164
- * This function tests whether the provided value is an instance of Buffer.
165
- * It returns `true` if the value is a Buffer, and `false` otherwise.
166
- *
167
- * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
168
- *
169
- * @param x - The value to check if it is a Buffer.
170
- * @returns Returns `true` if `x` is a Buffer, else `false`.
171
- *
172
- * @example
173
- * const buffer = Buffer.from("test");
174
- * console.log(isBuffer(buffer)); // true
175
- *
176
- * const notBuffer = "not a buffer";
177
- * console.log(isBuffer(notBuffer)); // false
178
- */
179
- function isBuffer(x) {
180
- return typeof globalThis_.Buffer !== "undefined" && globalThis_.Buffer.isBuffer(x);
181
- }
182
- //#endregion
183
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
184
- function getSymbols(object) {
185
- return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
186
- }
187
- //#endregion
188
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
189
- /**
190
- * Gets the `toStringTag` of `value`.
191
- *
192
- * @private
193
- * @param {T} value The value to query.
194
- * @returns {string} Returns the `Object.prototype.toString.call` result.
195
- */
196
- function getTag(value) {
197
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
198
- return Object.prototype.toString.call(value);
199
- }
200
- //#endregion
201
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
202
- var regexpTag = "[object RegExp]";
203
- var stringTag = "[object String]";
204
- var numberTag = "[object Number]";
205
- var booleanTag = "[object Boolean]";
206
- var argumentsTag = "[object Arguments]";
207
- var symbolTag = "[object Symbol]";
208
- var dateTag = "[object Date]";
209
- var mapTag = "[object Map]";
210
- var setTag = "[object Set]";
211
- var arrayTag = "[object Array]";
212
- var functionTag = "[object Function]";
213
- var arrayBufferTag = "[object ArrayBuffer]";
214
- var objectTag = "[object Object]";
215
- var errorTag = "[object Error]";
216
- var dataViewTag = "[object DataView]";
217
- var uint8ArrayTag = "[object Uint8Array]";
218
- var uint8ClampedArrayTag = "[object Uint8ClampedArray]";
219
- var uint16ArrayTag = "[object Uint16Array]";
220
- var uint32ArrayTag = "[object Uint32Array]";
221
- var bigUint64ArrayTag = "[object BigUint64Array]";
222
- var int8ArrayTag = "[object Int8Array]";
223
- var int16ArrayTag = "[object Int16Array]";
224
- var int32ArrayTag = "[object Int32Array]";
225
- var bigInt64ArrayTag = "[object BigInt64Array]";
226
- var float32ArrayTag = "[object Float32Array]";
227
- var float64ArrayTag = "[object Float64Array]";
228
- //#endregion
229
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
230
- /**
231
- * Checks if a given value is a plain object.
232
- *
233
- * @param value - The value to check.
234
- * @returns True if the value is a plain object, otherwise false.
235
- *
236
- * @example
237
- * ```typescript
238
- * // ✅👇 True
239
- *
240
- * isPlainObject({ }); // ✅
241
- * isPlainObject({ key: 'value' }); // ✅
242
- * isPlainObject({ key: new Date() }); // ✅
243
- * isPlainObject(new Object()); // ✅
244
- * isPlainObject(Object.create(null)); // ✅
245
- * isPlainObject({ nested: { key: true} }); // ✅
246
- * isPlainObject(new Proxy({}, {})); // ✅
247
- * isPlainObject({ [Symbol('tag')]: 'A' }); // ✅
248
- *
249
- * // ✅👇 (cross-realms, node context, workers, ...)
250
- * const runInNewContext = await import('node:vm').then(
251
- * (mod) => mod.runInNewContext
252
- * );
253
- * isPlainObject(runInNewContext('({})')); // ✅
254
- *
255
- * // ❌👇 False
256
- *
257
- * class Test { };
258
- * isPlainObject(new Test()) // ❌
259
- * isPlainObject(10); // ❌
260
- * isPlainObject(null); // ❌
261
- * isPlainObject('hello'); // ❌
262
- * isPlainObject([]); // ❌
263
- * isPlainObject(new Date()); // ❌
264
- * isPlainObject(new Uint8Array([1])); // ❌
265
- * isPlainObject(Buffer.from('ABC')); // ❌
266
- * isPlainObject(Promise.resolve({})); // ❌
267
- * isPlainObject(Object.create({})); // ❌
268
- * isPlainObject(new (class Cls {})); // ❌
269
- * isPlainObject(globalThis); // ❌,
270
- * ```
271
- */
272
- function isPlainObject(value) {
273
- if (!value || typeof value !== "object") return false;
274
- const proto = Object.getPrototypeOf(value);
275
- if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
276
- return Object.prototype.toString.call(value) === "[object Object]";
277
- }
278
- //#endregion
279
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/util/eq.mjs
280
- /**
281
- * Performs a `SameValueZero` comparison between two values to determine if they are equivalent.
282
- *
283
- * @param value The value to compare.
284
- * @param other The other value to compare.
285
- * @returns Returns `true` if the values are equivalent, else `false`.
286
- *
287
- * @example
288
- * eq(1, 1); // true
289
- * eq(0, -0); // true
290
- * eq(NaN, NaN); // true
291
- * eq('a', Object('a')); // false
292
- */
293
- function eq(value, other) {
294
- return value === other || Number.isNaN(value) && Number.isNaN(other);
295
- }
296
- //#endregion
297
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
298
- /**
299
- * Compares two values for equality using a custom comparison function.
300
- *
301
- * The custom function allows for fine-tuned control over the comparison process. If it returns a boolean, that result determines the equality. If it returns undefined, the function falls back to the default equality comparison.
302
- *
303
- * This function also uses the custom equality function to compare values inside objects,
304
- * arrays, maps, sets, and other complex structures, ensuring a deep comparison.
305
- *
306
- * This approach provides flexibility in handling complex comparisons while maintaining efficient default behavior for simpler cases.
307
- *
308
- * The custom comparison function can take up to six parameters:
309
- * - `x`: The value from the first object `a`.
310
- * - `y`: The value from the second object `b`.
311
- * - `property`: The property key used to get `x` and `y`.
312
- * - `xParent`: The parent of the first value `x`.
313
- * - `yParent`: The parent of the second value `y`.
314
- * - `stack`: An internal stack (Map) to handle circular references.
315
- *
316
- * @param a - The first value to compare.
317
- * @param b - The second value to compare.
318
- * @param areValuesEqual - A function to customize the comparison.
319
- * If it returns a boolean, that result will be used. If it returns undefined,
320
- * the default equality comparison will be used.
321
- * @returns `true` if the values are equal according to the customizer, otherwise `false`.
322
- *
323
- * @example
324
- * const customizer = (a, b) => {
325
- * if (typeof a === 'string' && typeof b === 'string') {
326
- * return a.toLowerCase() === b.toLowerCase();
327
- * }
328
- * };
329
- * isEqualWith('Hello', 'hello', customizer); // true
330
- * isEqualWith({ a: 'Hello' }, { a: 'hello' }, customizer); // true
331
- * isEqualWith([1, 2, 3], [1, 2, 3], customizer); // true
332
- */
333
- function isEqualWith(a, b, areValuesEqual) {
334
- return isEqualWithImpl(a, b, void 0, void 0, void 0, void 0, areValuesEqual);
335
- }
336
- function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
337
- const result = areValuesEqual(a, b, property, aParent, bParent, stack);
338
- if (result !== void 0) return result;
339
- if (typeof a === typeof b) switch (typeof a) {
340
- case "bigint":
341
- case "string":
342
- case "boolean":
343
- case "symbol":
344
- case "undefined": return a === b;
345
- case "number": return a === b || Object.is(a, b);
346
- case "function": return a === b;
347
- case "object": return areObjectsEqual(a, b, stack, areValuesEqual);
348
- }
349
- return areObjectsEqual(a, b, stack, areValuesEqual);
350
- }
351
- function areObjectsEqual(a, b, stack, areValuesEqual) {
352
- if (Object.is(a, b)) return true;
353
- let aTag = getTag(a);
354
- let bTag = getTag(b);
355
- if (aTag === "[object Arguments]") aTag = objectTag;
356
- if (bTag === "[object Arguments]") bTag = objectTag;
357
- if (aTag !== bTag) return false;
358
- switch (aTag) {
359
- case stringTag: return a.toString() === b.toString();
360
- case numberTag: return eq(a.valueOf(), b.valueOf());
361
- case booleanTag:
362
- case dateTag:
363
- case symbolTag: return Object.is(a.valueOf(), b.valueOf());
364
- case regexpTag: return a.source === b.source && a.flags === b.flags;
365
- case functionTag: return a === b;
366
- }
367
- stack = stack ?? /* @__PURE__ */ new Map();
368
- const aStack = stack.get(a);
369
- const bStack = stack.get(b);
370
- if (aStack != null && bStack != null) return aStack === b;
371
- stack.set(a, b);
372
- stack.set(b, a);
373
- try {
374
- switch (aTag) {
375
- case mapTag:
376
- if (a.size !== b.size) return false;
377
- for (const [key, value] of a.entries()) if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) return false;
378
- return true;
379
- case setTag: {
380
- if (a.size !== b.size) return false;
381
- const aValues = Array.from(a.values());
382
- const bValues = Array.from(b.values());
383
- for (let i = 0; i < aValues.length; i++) {
384
- const aValue = aValues[i];
385
- const index = bValues.findIndex((bValue) => {
386
- return isEqualWithImpl(aValue, bValue, void 0, a, b, stack, areValuesEqual);
387
- });
388
- if (index === -1) return false;
389
- bValues.splice(index, 1);
390
- }
391
- return true;
392
- }
393
- case arrayTag:
394
- case uint8ArrayTag:
395
- case uint8ClampedArrayTag:
396
- case uint16ArrayTag:
397
- case uint32ArrayTag:
398
- case bigUint64ArrayTag:
399
- case int8ArrayTag:
400
- case int16ArrayTag:
401
- case int32ArrayTag:
402
- case bigInt64ArrayTag:
403
- case float32ArrayTag:
404
- case float64ArrayTag:
405
- if (isBuffer(a) !== isBuffer(b)) return false;
406
- if (a.length !== b.length) return false;
407
- for (let i = 0; i < a.length; i++) if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) return false;
408
- return true;
409
- case arrayBufferTag:
410
- if (a.byteLength !== b.byteLength) return false;
411
- return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
412
- case dataViewTag:
413
- if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) return false;
414
- return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
415
- case errorTag: return a.name === b.name && a.message === b.message;
416
- case objectTag: {
417
- if (!(areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) || isPlainObject(a) && isPlainObject(b))) return false;
418
- const aKeys = [...Object.keys(a), ...getSymbols(a)];
419
- const bKeys = [...Object.keys(b), ...getSymbols(b)];
420
- if (aKeys.length !== bKeys.length) return false;
421
- for (let i = 0; i < aKeys.length; i++) {
422
- const propKey = aKeys[i];
423
- const aProp = a[propKey];
424
- if (!Object.hasOwn(b, propKey)) return false;
425
- const bProp = b[propKey];
426
- if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) return false;
427
- }
428
- return true;
429
- }
430
- default: return false;
431
- }
432
- } finally {
433
- stack.delete(a);
434
- stack.delete(b);
435
- }
436
- }
437
- //#endregion
438
- //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isEqual.mjs
439
- /**
440
- * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.
441
- *
442
- * @param a - The first value to compare.
443
- * @param b - The second value to compare.
444
- * @returns `true` if the values are equal, otherwise `false`.
445
- *
446
- * @example
447
- * isEqual(1, 1); // true
448
- * isEqual({ a: 1 }, { a: 1 }); // true
449
- * isEqual(/abc/g, /abc/g); // true
450
- * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true
451
- * isEqual([1, 2, 3], [1, 2, 3]); // true
452
- */
453
- function isEqual(a, b) {
454
- return isEqualWith(a, b, noop);
455
- }
456
- //#endregion
457
- //#region ../../packages/utils/dist/field-map/field-map.js
458
- /**
459
- * Field container for a single value that cannot be overridden once set
460
- */
461
- var ScalarContainer = class {
462
- _value;
463
- defaultValue;
464
- isSet = false;
465
- setBySource;
466
- getDynamicSource;
467
- constructor(defaultValue, options) {
468
- this.defaultValue = defaultValue;
469
- this.getDynamicSource = options?.getDynamicSource;
470
- }
471
- getValue() {
472
- return this._value === void 0 ? this.defaultValue : this._value;
473
- }
474
- set(value, source) {
475
- const setBySource = source ?? this.getDynamicSource?.() ?? "unknown";
476
- if (this.isSet) throw new Error(`Value has already been set by ${this.setBySource} and cannot be overwritten by ${setBySource}`);
477
- this._value = value;
478
- this.isSet = true;
479
- this.setBySource = setBySource;
480
- }
481
- };
482
- var ArrayContainer = class {
483
- _stripDuplicates;
484
- _value;
485
- constructor(initialValue, options) {
486
- this._stripDuplicates = options?.stripDuplicates ?? false;
487
- this._value = initialValue ?? [];
488
- }
489
- push(...items) {
490
- let currentValue = this._value;
491
- if (this._stripDuplicates) currentValue = [.../* @__PURE__ */ new Set([...currentValue, ...items])];
492
- else currentValue = [...currentValue, ...items];
493
- this._value = currentValue;
494
- }
495
- getValue() {
496
- return this._value;
497
- }
498
- };
499
- var ObjectContainer = class {
500
- map;
501
- getDynamicSource;
502
- constructor(initialValue, options) {
503
- this.getDynamicSource = options?.getDynamicSource;
504
- this.map = new Map(Object.entries(initialValue).map(([key, value]) => [key, {
505
- value,
506
- setBySource: this.getDynamicSource?.()
507
- }]));
508
- }
509
- set(key, value, source) {
510
- const existingValue = this.map.get(key);
511
- const setBySource = source ?? this.getDynamicSource?.() ?? "unknown";
512
- if (existingValue?.setBySource) throw new Error(`Value for key ${key} has already been set by ${existingValue.setBySource} and cannot be overwritten by ${setBySource}`);
513
- this.map.set(key, {
514
- value,
515
- setBySource
516
- });
517
- }
518
- merge(value, source) {
519
- const mergeSource = source ?? this.getDynamicSource?.();
520
- for (const [key, val] of Object.entries(value)) this.set(key, val, mergeSource);
521
- }
522
- getValue() {
523
- return Object.fromEntries([...this.map.entries()].map(([key, value]) => [key, value.value]));
524
- }
525
- };
526
- var MapContainer = class {
527
- _value;
528
- getDynamicSource;
529
- constructor(initialValue, options) {
530
- this.getDynamicSource = options?.getDynamicSource;
531
- const initialMap = initialValue ?? /* @__PURE__ */ new Map();
532
- this._value = new Map([...initialMap.entries()].map(([key, value]) => [key, {
533
- value,
534
- setBySource: this.getDynamicSource?.()
535
- }]));
536
- }
537
- set(key, value, source) {
538
- const existingValue = this._value.get(key);
539
- const setBySource = source ?? this.getDynamicSource?.() ?? "unknown";
540
- if (existingValue?.setBySource) throw new Error(`Value for key ${key} has already been set by ${existingValue.setBySource} and cannot be overwritten by ${setBySource}`);
541
- this._value.set(key, {
542
- value,
543
- setBySource
544
- });
545
- }
546
- merge(value, source) {
547
- const mergeSource = source ?? this.getDynamicSource?.();
548
- for (const [key, val] of value.entries()) this.set(key, val, mergeSource);
549
- }
550
- mergeObj(value, source) {
551
- const mergeSource = source ?? this.getDynamicSource?.();
552
- for (const [key, val] of Object.entries(value)) this.set(key, val, mergeSource);
553
- }
554
- getValue() {
555
- return new Map([...this._value.entries()].map(([key, value]) => [key, value.value]));
556
- }
557
- };
558
- /**
559
- * Named field container
560
- *
561
- * This container stores objects that contains a name field that can be used for
562
- * detecting duplicate names.
563
- */
564
- var NamedArrayFieldContainer = class {
565
- _value;
566
- getDynamicSource;
567
- constructor(initialValue, options) {
568
- this.getDynamicSource = options?.getDynamicSource;
569
- const value = initialValue ?? [];
570
- this._value = new Map(value.map((val) => [val.name, {
571
- value: val,
572
- setBySource: this.getDynamicSource?.()
573
- }]));
574
- }
575
- add(value, source) {
576
- const existingValue = this._value.get(value.name);
577
- const setBySource = source ?? this.getDynamicSource?.() ?? "unknown";
578
- if (existingValue?.setBySource) throw new Error(`Value for name ${value.name} has already been set by ${existingValue.setBySource} and cannot be overwritten by ${setBySource}`);
579
- this._value.set(value.name, {
580
- value,
581
- setBySource
582
- });
583
- }
584
- addMany(values, source) {
585
- for (const value of values) this.add(value, source);
586
- }
587
- getValue() {
588
- return sortBy([...this._value.values()].map((value) => value.value), [(v) => v.name]);
589
- }
590
- };
591
- /**
592
- * Named array field container that returns a map of names to values
593
- */
594
- var NamedArrayToMapFieldContainer = class {
595
- _namedFieldContainer;
596
- constructor(initialValue, options) {
597
- this._namedFieldContainer = new NamedArrayFieldContainer(initialValue, options);
598
- }
599
- add(value, source) {
600
- this._namedFieldContainer.add(value, source);
601
- }
602
- addMany(values, source) {
603
- this._namedFieldContainer.addMany(values, source);
604
- }
605
- getValue() {
606
- return new Map(this._namedFieldContainer.getValue().map((value) => [value.name, value]));
607
- }
608
- };
609
- var MapOfMapsContainer = class {
610
- _value;
611
- getDynamicSource;
612
- constructor(initialValue, options) {
613
- this.getDynamicSource = options?.getDynamicSource;
614
- const initialMap = initialValue ?? /* @__PURE__ */ new Map();
615
- this._value = new Map([...initialMap.entries()].map(([key1, innerMap]) => [key1, {
616
- value: new Map([...innerMap.entries()].map(([key2, value]) => [key2, {
617
- value,
618
- setBySource: this.getDynamicSource?.()
619
- }])),
620
- setBySource: this.getDynamicSource?.()
621
- }]));
622
- }
623
- set(key1, key2, value, source) {
624
- const existingOuterValue = this._value.get(key1);
625
- const setBySource = source ?? this.getDynamicSource?.() ?? "unknown";
626
- if (!existingOuterValue) {
627
- const newInnerMap = /* @__PURE__ */ new Map([[key2, {
628
- value,
629
- setBySource
630
- }]]);
631
- this._value.set(key1, {
632
- value: newInnerMap,
633
- setBySource
634
- });
635
- return;
636
- }
637
- const existingInnerValue = existingOuterValue.value.get(key2);
638
- if (existingInnerValue?.setBySource) throw new Error(`Value for keys ${key1}+${key2} has already been set by ${existingInnerValue.setBySource} and cannot be overwritten by ${setBySource}`);
639
- existingOuterValue.value.set(key2, {
640
- value,
641
- setBySource
642
- });
643
- }
644
- merge(key1, value, source) {
645
- const mergeSource = source ?? this.getDynamicSource?.() ?? "unknown";
646
- for (const [key2, val] of value.entries()) this.set(key1, key2, val, mergeSource);
647
- }
648
- mergeObj(key1, value, source) {
649
- const mergeSource = source ?? this.getDynamicSource?.() ?? "unknown";
650
- for (const [key2, val] of Object.entries(value)) this.set(key1, key2, val, mergeSource);
651
- }
652
- getValue() {
653
- return new Map([...this._value.entries()].map(([key1, outerValue]) => [key1, new Map([...outerValue.value.entries()].map(([key2, innerValue]) => [key2, innerValue.value]))]));
654
- }
655
- };
656
- var FieldMapSchemaBuilder = class {
657
- options;
658
- constructor(options) {
659
- this.options = options;
660
- }
661
- scalar(defaultValue) {
662
- return new ScalarContainer(defaultValue, this.options);
663
- }
664
- string(defaultValue) {
665
- return new ScalarContainer(defaultValue, this.options);
666
- }
667
- number(defaultValue) {
668
- return new ScalarContainer(defaultValue, this.options);
669
- }
670
- boolean(defaultValue) {
671
- return new ScalarContainer(defaultValue, this.options);
672
- }
673
- array(initialValue, options) {
674
- return new ArrayContainer(initialValue, options);
675
- }
676
- object(defaultValue) {
677
- return new ObjectContainer(defaultValue, this.options);
678
- }
679
- map(initialValue) {
680
- return new MapContainer(initialValue ?? /* @__PURE__ */ new Map(), this.options);
681
- }
682
- mapFromObj(initialValue) {
683
- return new MapContainer(new Map(Object.entries(initialValue ?? {})), this.options);
684
- }
685
- namedArray(initialValue) {
686
- return new NamedArrayFieldContainer(initialValue, this.options);
687
- }
688
- namedArrayToMap(initialValue) {
689
- return new NamedArrayToMapFieldContainer(initialValue, this.options);
690
- }
691
- mapOfMaps(initialValue) {
692
- return new MapOfMapsContainer(initialValue ?? /* @__PURE__ */ new Map(), this.options);
693
- }
694
- mapOfMapsFromObj(initialValue) {
695
- const map = /* @__PURE__ */ new Map();
696
- if (initialValue) for (const [key1, innerObj] of Object.entries(initialValue)) map.set(key1, new Map(Object.entries(innerObj)));
697
- return new MapOfMapsContainer(map, this.options);
698
- }
699
- };
700
- /**
701
- * Creates a field map with type-safe field definitions
702
- */
703
- function createFieldMap(schemaBuilder, options) {
704
- const schema = schemaBuilder(new FieldMapSchemaBuilder(options));
705
- return {
706
- ...schema,
707
- getValues: () => {
708
- const values = {};
709
- for (const [key, container] of Object.entries(schema)) values[key] = container.getValue();
710
- return values;
711
- }
712
- };
713
- }
714
- //#endregion
715
- //#region ../../node_modules/.pnpm/nanoid@6.0.0/node_modules/nanoid/index.browser.js
716
- var random = (bytes) => crypto.getRandomValues(new Uint8Array(bytes));
717
- var customRandom = (alphabet, defaultSize, getRandom) => {
718
- let safeByteCutoff = 256 - 256 % alphabet.length;
719
- if (safeByteCutoff === 256) {
720
- let mask = alphabet.length - 1;
721
- return (size = defaultSize) => {
722
- if (!size) return "";
723
- let id = "";
724
- while (true) {
725
- let bytes = getRandom(size);
726
- let j = size;
727
- while (j--) {
728
- id += alphabet[bytes[j] & mask];
729
- if (id.length >= size) return id;
730
- }
731
- }
732
- };
733
- }
734
- let step = Math.ceil(409.6 * defaultSize / safeByteCutoff);
735
- return (size = defaultSize) => {
736
- if (!size) return "";
737
- let id = "";
738
- while (true) {
739
- let bytes = getRandom(step);
740
- let j = step;
741
- while (j--) if (bytes[j] < safeByteCutoff) {
742
- id += alphabet[bytes[j] % alphabet.length];
743
- if (id.length >= size) return id;
744
- }
745
- }
746
- };
747
- };
748
- var customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size | 0, random);
749
- //#endregion
750
- //#region ../../packages/utils/dist/string/random-key.js
751
- /**
752
- * Use custom ID generator for characters that be easily selected
753
- */
754
- var customNanoid = customAlphabet(`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_`, 12);
755
- /**
756
- * Generate a random key string made up of numbers, lowercase, and uppercase letters
757
- * @returns A random key string
758
- */
759
- function randomKey(length = 12) {
760
- return customNanoid(length);
761
- }
762
- //#endregion
763
- //#region ../../packages/utils/dist/validators/validation-hint-registry.js
764
- /**
765
- * Registry that stores human-readable validation hints on Zod schema instances.
766
- *
767
- * Used by `buildTsDescriptionRegistry` to annotate TypeScript type output with
768
- * validation constraints (e.g., "camelCase", "CONSTANT_CASE") as JSDoc comments.
769
- *
770
- * Validators register hints at module load time. The registry is consumed
771
- * during schema-to-TypeScript conversion to produce annotated output.
772
- */
773
- var validationHintRegistry = __mf_0.registry();
774
- //#endregion
775
- //#region ../../packages/utils/dist/validators/case-validators.js
776
- /**
777
- * Regex for validating kebab case, e.g. "my-project".
778
- */
779
- var KEBAB_CASE_REGEX = /^[a-z0-9-]+$/;
780
- /**
781
- * Regex for validating pascal case, e.g. "MyProject".
782
- */
783
- var PASCAL_CASE_REGEX = /^[A-Z][a-zA-Z0-9]*$/;
784
- var CASE_VALIDATORS = {
785
- /**
786
- * Zod validator for validating kebab case, e.g. "my-project".
787
- */
788
- KEBAB_CASE: __mf_0.string().regex(KEBAB_CASE_REGEX, { message: "Must be kebab case (e.g. \"my-project\")" }).register(validationHintRegistry, { description: "kebab-case (e.g. \"my-project\")" }),
789
- /**
790
- * Zod validator for validating pascal case, e.g. "MyProject".
791
- */
792
- PASCAL_CASE: __mf_0.string().regex(PASCAL_CASE_REGEX, { message: "Must be pascal case (e.g. \"MyProject\")" }).register(validationHintRegistry, { description: "PascalCase (e.g. \"MyProject\")" }),
793
- /**
794
- * Zod validator for validating camel case, e.g. "myProject".
795
- */
796
- CAMEL_CASE: __mf_0.string().regex(/^[a-z][a-zA-Z0-9]*$/, { message: "Must be camel case (e.g. \"myProject\")" }).register(validationHintRegistry, { description: "camelCase (e.g. \"myProject\")" }),
797
- /**
798
- * Zod validator for validating constant case, e.g. "MY_PROJECT".
799
- */
800
- CONSTANT_CASE: __mf_0.string().regex(/^[A-Z][A-Z0-9_]*$/, { message: "Must be constant case (e.g. \"MY_PROJECT\")" }).register(validationHintRegistry, { description: "CONSTANT_CASE (e.g. \"MY_PROJECT\")" })
801
- };
802
- //#endregion
803
- //#region ../../packages/project-builder-lib/dist/plugins/context/plugin-context.js
804
- /**
805
- * Plugin context module for tracking the current plugin being initialized.
806
- *
807
- * Uses a simple synchronous context that works on both Node and browser platforms.
808
- * This is safe because plugin initialization is synchronous and single-threaded.
809
- */
810
- var currentPluginContext;
811
- /**
812
- * Runs a function within a plugin context.
813
- *
814
- * This sets the current plugin context for the duration of the function execution,
815
- * allowing nested functions to access the plugin key via `getPluginContext()`.
816
- *
817
- * @param context - The plugin context to set
818
- * @param fn - The function to run within the context
819
- * @returns The result of the function
820
- */
821
- function runInPluginContext(context, fn) {
822
- const prev = currentPluginContext;
823
- currentPluginContext = context;
824
- try {
825
- return fn();
826
- } finally {
827
- currentPluginContext = prev;
828
- }
829
- }
830
- /**
831
- * Gets the current plugin context if one exists.
832
- *
833
- * @returns The current plugin context, or undefined if not in a plugin context
834
- */
835
- function getPluginContext() {
836
- return currentPluginContext;
837
- }
838
- //#endregion
839
- //#region ../../packages/project-builder-lib/dist/plugins/utils/create-plugin-field-map.js
840
- /**
841
- * Creates a field map that automatically tracks which plugin registered each value.
842
- *
843
- * Similar to `createConfigFieldMap` in the sync package, this utility uses the
844
- * current plugin context to track the source of registrations. This enables
845
- * clear error messages when registration conflicts occur.
846
- *
847
- * @example
848
- * ```typescript
849
- * const fieldMap = createPluginFieldMap((t) => ({
850
- * transformers: t.map<string, Transformer>(),
851
- * }));
852
- *
853
- * // When a plugin tries to overwrite a value:
854
- * // Error: Value for key 'myTransformer' has already been set by plugin-auth
855
- * // and cannot be overwritten by plugin-storage
856
- * ```
857
- *
858
- * @param schemaBuilder - A function that builds the field map schema
859
- * @returns A field map with automatic source tracking
860
- */
861
- function createPluginFieldMap(schemaBuilder) {
862
- return createFieldMap(schemaBuilder, { getDynamicSource: () => getPluginContext()?.pluginKey });
863
- }
864
- //#endregion
865
- //#region ../../packages/project-builder-lib/dist/plugins/utils/create-field-map-spec.js
866
- /**
867
- * Creates a plugin spec backed by a FieldMap for automatic source tracking.
868
- *
869
- * @param name - Unique identifier for the spec
870
- * @param schemaBuilder - Function that builds the field map schema
871
- * @param options - Optional configuration including custom use interface
872
- */
873
- function createFieldMapSpec(name, schemaBuilder, options) {
874
- return createPluginSpec(name, { initializer: () => {
875
- const fieldMap = createPluginFieldMap(schemaBuilder);
876
- return {
877
- init: fieldMap,
878
- use: () => {
879
- const values = fieldMap.getValues();
880
- if (options?.use) return options.use(values);
881
- return values;
882
- }
883
- };
884
- } });
885
- }
886
- //#endregion
887
- //#region ../../packages/project-builder-lib/dist/references/definition-ref-registry.js
888
- /**
889
- * Global registry that stores Baseplate metadata on Zod schema instances.
890
- *
891
- * Uses a plain WeakMap to avoid Zod's `$replace<Meta, S>` type substitution
892
- * which causes "type instantiation excessively deep" errors with complex unions.
893
- *
894
- * Stores an array of metadata per schema to support schemas that carry multiple
895
- * annotations (e.g. a schema that is both an `entity` and a `ref-context`).
896
- *
897
- * Used by `withEnt`, `withRef`, `withExpression`, and `refContext` to attach
898
- * metadata to schema nodes. The parallel schema+data walker reads this registry
899
- * to extract entity/reference/expression information after validation.
900
- */
901
- var definitionRefRegistry = (() => {
902
- const map = /* @__PURE__ */ new WeakMap();
903
- return {
904
- add(schema, meta) {
905
- const existing = map.get(schema);
906
- if (existing) {
907
- if ((meta.kind === "entity" || meta.kind === "reference") && existing.some((e) => e.kind === meta.kind && e.type === meta.type)) throw new Error(`Duplicate definition ref metadata kind "${meta.kind}" for type "${meta.type.name}" on the same schema instance. This usually means a shared/module-level schema was passed to withEnt/withRef multiple times. Create a fresh schema instance instead.`);
908
- existing.push(meta);
909
- } else map.set(schema, [meta]);
910
- },
911
- getAll(schema) {
912
- return map.get(schema) ?? [];
913
- },
914
- has(schema) {
915
- return map.has(schema);
916
- }
917
- };
918
- })();
919
- //#endregion
920
- //#region ../../packages/project-builder-lib/dist/references/expression-parser-spec.js
921
- /**
922
- * Plugin spec for registering expression parsers.
923
- *
924
- * Expression parsers handle parsing, validation, and rename detection
925
- * for expression fields in the project definition (e.g., authorizer
926
- * role expressions).
927
- *
928
- * Built-in parsers (authorizer expressions) are registered by core modules.
929
- * Plugins can register additional parsers during initialization.
930
- *
931
- * @example
932
- * ```typescript
933
- * createPluginModule({
934
- * dependencies: { expressionParsers: expressionParserSpec },
935
- * initialize: ({ expressionParsers }) => {
936
- * expressionParsers.parsers.set('my-expression', myParser);
937
- * },
938
- * });
939
- * ```
940
- */
941
- var expressionParserSpec = createFieldMapSpec("core/expression-parsers", (t) => ({ parsers: t.map() }), { use: (values) => ({ getParser: (name) => values.parsers.get(name) }) });
942
- //#endregion
943
- //#region ../../packages/project-builder-lib/dist/references/expression-types.js
944
- /**
945
- * A pluggable parser for ref expressions.
946
- *
947
- * The parser is format-agnostic - the core references system
948
- * doesn't know or care what format the expressions are in. The parser
949
- * handles all parsing, validation, and rename handling.
950
- *
951
- * Parsers can declare required slots via the TRequiredSlots generic parameter.
952
- * When a parser requires slots, TypeScript enforces that they are provided
953
- * when calling `withExpression()`.
954
- *
955
- * @typeParam TValue - The type of the raw expression value (e.g., string for TS expressions)
956
- * @typeParam TParseResult - The type of the parsed result (e.g., AST for TS expressions)
957
- * @typeParam TRequiredSlots - Record of required slot names to entity types
958
- *
959
- * @example
960
- * ```typescript
961
- * // A simple parser with no required slots
962
- * class StubParser extends RefExpressionParser<string, undefined> {
963
- * readonly name = 'stub';
964
- * parse(): undefined { return undefined; }
965
- * getWarnings(): [] { return []; }
966
- * getReferencedEntities(): [] { return []; }
967
- * }
968
- *
969
- * // A parser that requires a model slot
970
- * class AuthorizerParser extends RefExpressionParser<
971
- * string,
972
- * TsAst,
973
- * { model: typeof modelEntityType }
974
- * > {
975
- * readonly name = 'authorizer';
976
- * // TypeScript enforces slot requirement in withExpression()
977
- * }
978
- * ```
979
- */
980
- var RefExpressionParser = class {
981
- /**
982
- * One-line summary of the expression language, surfaced to MCP consumers by
983
- * `get-entity-schema` so an agent editing this field knows it is a DSL rather
984
- * than free-form text. Point at fuller docs rather than restating the grammar.
985
- */
986
- description;
987
- /**
988
- * Convenience method that combines parse() and getWarnings() into a single call.
989
- * Parses the expression and returns all validation warnings (including parse errors).
990
- *
991
- * @param value - The raw expression value
992
- * @param projectDef - The project definition for context
993
- * @param context - Validation context with project definition and plugin store
994
- * @param resolvedSlots - The resolved slot paths for this expression
995
- * @returns Array of warnings (empty if valid)
996
- */
997
- validate(value, projectDef, context, resolvedSlots) {
998
- const parseResult = this.parse(value, projectDef);
999
- if (!parseResult.success) return [{ message: parseResult.error }];
1000
- return this.getWarnings(parseResult.value, context, resolvedSlots);
1001
- }
1002
- /**
1003
- * Phantom property for TRequiredSlots type inference.
1004
- * This is never actually used at runtime.
1005
- * @internal
1006
- */
1007
- _requiredSlots;
1008
- };
1009
- //#endregion
1010
- //#region ../../packages/project-builder-lib/dist/references/ref-context-slot.js
1011
- /**
1012
- * Creates a new ref context slot for the given entity type.
1013
- * Each call creates a unique slot, even for the same entity type.
1014
- *
1015
- * @param name - A descriptive name for debugging (shows in Symbol description)
1016
- * @param entityType - The entity type this slot will be associated with
1017
- * @returns A new unique RefContextSlot instance
1018
- *
1019
- * @example
1020
- * ```typescript
1021
- * const modelSlot = createRefContextSlot('modelSlot', modelEntityType);
1022
- * const anotherModelSlot = createRefContextSlot('anotherModelSlot', modelEntityType);
1023
- *
1024
- * // These are different slots despite same entity type
1025
- * modelSlot.id !== anotherModelSlot.id
1026
- * // modelSlot.id.toString() === 'Symbol(modelSlot)'
1027
- * ```
1028
- */
1029
- function createRefContextSlot(name, entityType) {
1030
- return {
1031
- entityType,
1032
- id: Symbol(name)
1033
- };
1034
- }
1035
- /**
1036
- * Creates a RefContextSlotMap from a slot definition.
1037
- * Used internally by ctx.refContext().
1038
- *
1039
- * @param slotDefinition - Map of slot names to entity types
1040
- * @returns Map of slot names to RefContextSlot instances
1041
- */
1042
- function createRefContextSlotMap(slotDefinition) {
1043
- return Object.fromEntries(Object.entries(slotDefinition).map(([key, entityType]) => [key, createRefContextSlot(key, entityType)]));
1044
- }
1045
- //#endregion
1046
- //#region ../../packages/project-builder-lib/dist/references/extend-parser-context-with-refs.js
1047
- /**
1048
- * Creates a string schema annotated as a reference to another entity.
1049
- *
1050
- * Can be used standalone:
1051
- * ```typescript
1052
- * withRef({ type: modelEnumEntityType, onDelete: 'RESTRICT' })
1053
- * ```
1054
- *
1055
- * Or on the parser context:
1056
- * ```typescript
1057
- * ctx.withRef({ type: modelEnumEntityType, onDelete: 'RESTRICT' })
1058
- * ```
1059
- */
1060
- function withRef(reference) {
1061
- const schema = __mf_0.string().min(1);
1062
- definitionRefRegistry.add(schema, {
1063
- kind: "reference",
1064
- type: reference.type,
1065
- onDelete: reference.onDelete,
1066
- parentSlot: reference.parentSlot,
1067
- provides: reference.provides
1068
- });
1069
- return schema;
1070
- }
1071
- /**
1072
- * Creates a schema decorator that marks a schema as defining an entity.
1073
- *
1074
- * Can be used with `.apply()`:
1075
- * ```typescript
1076
- * schema.apply(withEnt({ type: modelEntityType, provides: modelSlot }))
1077
- * ```
1078
- *
1079
- * Or via the parser context (2-arg legacy form):
1080
- * ```typescript
1081
- * ctx.withEnt(schema, { type: modelEntityType, provides: modelSlot })
1082
- * ```
1083
- *
1084
- * @param entity - The entity definition input
1085
- * @returns A function that decorates a schema with entity metadata
1086
- */
1087
- function withEnt(entity) {
1088
- return (schema) => {
1089
- const idPath = entity.idPath ?? ["id"];
1090
- definitionRefRegistry.add(schema, {
1091
- kind: "entity",
1092
- type: entity.type,
1093
- idPath,
1094
- getNameResolver: entity.getNameResolver,
1095
- parentSlot: entity.parentSlot,
1096
- provides: entity.provides,
1097
- sortByName: entity.sortByName
1098
- });
1099
- return schema;
1100
- };
1101
- }
1102
- /**
1103
- * Creates ref context slots for use within a schema definition.
1104
- * Slots provide type-safe context for parent-child entity relationships.
1105
- *
1106
- * @example
1107
- * ```typescript
1108
- * ctx.refContext(
1109
- * { modelSlot: modelEntityType },
1110
- * ({ modelSlot }) =>
1111
- * ctx.withEnt(schema, {
1112
- * type: modelEntityType,
1113
- * provides: modelSlot,
1114
- * }),
1115
- * );
1116
- * ```
1117
- */
1118
- function refContext(slotDefinition, schemaBuilder) {
1119
- const slots = createRefContextSlotMap(slotDefinition);
1120
- const schema = schemaBuilder(slots);
1121
- definitionRefRegistry.add(schema, {
1122
- kind: "ref-context",
1123
- slots: Object.values(slots)
1124
- });
1125
- return schema;
1126
- }
1127
- /**
1128
- * Wraps a value with a ref expression parser for deferred validation.
1129
- * The parser handles all parsing, validation, and rename handling.
1130
- *
1131
- * If the parser declares required slots (via TRequiredSlots), they must be
1132
- * provided as the second argument. TypeScript enforces this at compile time.
1133
- *
1134
- * The parser's `createSchema()` method is called to get a fresh schema
1135
- * instance per call site, allowing per-call metadata to be registered
1136
- * independently in the Baseplate registry.
1137
- *
1138
- * @example
1139
- * ```typescript
1140
- * // Parser without required slots
1141
- * const expressionSchema = ctx.withExpression(simpleParser);
1142
- *
1143
- * // Parser with required slots (TypeScript enforces the second argument)
1144
- * ctx.refContext(
1145
- * { modelSlot: modelEntityType },
1146
- * ({ modelSlot }) =>
1147
- * z.object({
1148
- * condition: ctx.withExpression(authorizerParser, { model: modelSlot }),
1149
- * })
1150
- * );
1151
- * ```
1152
- */
1153
- /**
1154
- * Creates a `withExpression` function that resolves parser refs eagerly
1155
- * from the plugin spec store at schema construction time.
1156
- */
1157
- function createWithExpression(plugins) {
1158
- function withExpression(parserOrRef, slots) {
1159
- let parser;
1160
- if (parserOrRef instanceof RefExpressionParser) parser = parserOrRef;
1161
- else {
1162
- if (!plugins) throw new Error(`PluginSpecStore is required to resolve expression parser ref "${parserOrRef.name}". Ensure plugins are provided to createDefinitionSchemaParserContext.`);
1163
- const resolved = plugins.use(expressionParserSpec).getParser(parserOrRef.name);
1164
- if (!resolved) throw new Error(`Expression parser "${parserOrRef.name}" not found in expressionParserSpec. Ensure it is registered via a core module or plugin.`);
1165
- parser = resolved;
1166
- }
1167
- const schema = parser.createSchema();
1168
- definitionRefRegistry.add(schema, {
1169
- kind: "expression",
1170
- parser,
1171
- slots
1172
- });
1173
- return schema;
1174
- }
1175
- return withExpression;
1176
- }
1177
- function extendParserContextWithRefs(plugins) {
1178
- return {
1179
- withRef,
1180
- withEnt(schema, entity) {
1181
- return schema.apply(withEnt(entity));
1182
- },
1183
- refContext,
1184
- withExpression: createWithExpression(plugins)
1185
- };
1186
- }
1187
- //#endregion
1188
- //#region ../../packages/project-builder-lib/dist/schema/creator/definition-default-registry.js
1189
- /**
1190
- * Registry that stores default-value metadata on Zod schema instances.
1191
- *
1192
- * Uses a WeakMap to avoid interfering with Zod's type system.
1193
- * Annotated by `withDefault()`; read by `cleanDefaultValues()`.
1194
- */
1195
- var definitionDefaultRegistry = (() => {
1196
- const map = /* @__PURE__ */ new WeakMap();
1197
- return {
1198
- set(schema, meta) {
1199
- map.set(schema, meta);
1200
- },
1201
- get(schema) {
1202
- return map.get(schema);
1203
- }
1204
- };
1205
- })();
1206
- //#endregion
1207
- //#region ../../packages/project-builder-lib/dist/schema/creator/extend-parser-context-with-defaults.js
1208
- /**
1209
- * Creates a schema decorator that applies a default value.
1210
- *
1211
- * Uses `prefault` to ensure defaults are populated during Zod parse, and
1212
- * registers the default value in the registry so `cleanDefaultValues()` can
1213
- * strip matching values during serialization.
1214
- *
1215
- * Can be used standalone with `.apply()`:
1216
- * ```typescript
1217
- * z.boolean().apply(withDefault(false))
1218
- * ```
1219
- *
1220
- * @param defaultValue - The default value to apply
1221
- * @returns A function that decorates a schema with the default value
1222
- */
1223
- function withDefault(defaultValue) {
1224
- return (schema) => {
1225
- const result = schema.prefault(defaultValue);
1226
- definitionDefaultRegistry.set(result, { defaultValue });
1227
- return result;
1228
- };
1229
- }
1230
- /**
1231
- * Extends the parser context with default value handling functionality.
1232
- *
1233
- * @returns An object containing the withDefault method
1234
- */
1235
- function extendParserContextWithDefaults() {
1236
- return { withDefault: (schema, defaultValue) => withDefault(defaultValue)(schema) };
1237
- }
1238
- //#endregion
1239
- //#region ../../packages/project-builder-lib/dist/schema/creator/schema-creator.js
1240
- var contextCache = /* @__PURE__ */ new WeakMap();
1241
- function createDefinitionSchemaParserContext(options) {
1242
- const cached = contextCache.get(options.plugins);
1243
- if (cached) return cached;
1244
- const context = {
1245
- ...options,
1246
- ...extendParserContextWithRefs(options.plugins),
1247
- ...extendParserContextWithDefaults()
1248
- };
1249
- contextCache.set(options.plugins, context);
1250
- return context;
1251
- }
1252
- function definitionSchema(creator) {
1253
- const cache = /* @__PURE__ */ new WeakMap();
1254
- return (context) => {
1255
- const cached = cache.get(context);
1256
- if (cached) return cached;
1257
- const result = creator(context);
1258
- cache.set(context, result);
1259
- return result;
1260
- };
1261
- }
1262
- /**
1263
- * Creates a schema that requires slots to be passed from parent schemas.
1264
- * Used when a schema needs to reference entities from a parent context.
1265
- *
1266
- * @example
1267
- * ```typescript
1268
- * // Child schema requiring modelSlot from parent
1269
- * export const createModelScalarFieldSchema = definitionSchemaWithSlots(
1270
- * { modelSlot: modelEntityType },
1271
- * (ctx, { modelSlot }) =>
1272
- * ctx.withEnt(schema, {
1273
- * type: modelScalarFieldEntityType,
1274
- * parentSlot: modelSlot,
1275
- * }),
1276
- * );
1277
- *
1278
- * // Called from parent:
1279
- * createModelScalarFieldSchema(ctx, { modelSlot: parentModelSlot })
1280
- * ```
1281
- */
1282
- function definitionSchemaWithSlots(slotDefinition, creator) {
1283
- const creatorWithSlots = (context, slots) => creator(context, slots);
1284
- creatorWithSlots.slotDefinition = slotDefinition;
1285
- return creatorWithSlots;
1286
- }
1287
- /**
1288
- * Wraps a schema creator that requires slots with placeholder slots,
1289
- * producing a simple schema creator that can be used for validation-only
1290
- * contexts (e.g., React Hook Form).
1291
- *
1292
- * The placeholder slots allow the schema to parse without actual parent context,
1293
- * which is useful when you only need schema validation without ref extraction.
1294
- *
1295
- * @example
1296
- * ```typescript
1297
- * // Schema that normally requires modelSlot from parent
1298
- * const createModelScalarFieldSchema = definitionSchemaWithSlots(
1299
- * { modelSlot: modelEntityType },
1300
- * (ctx, { modelSlot }) => ctx.withEnt(schema, { parentSlot: modelSlot }),
1301
- * );
1302
- *
1303
- * // For React Hook Form validation, wrap with placeholder slots
1304
- * const fieldSchema = withPlaceholderSlots(createModelScalarFieldSchema);
1305
- * const zodSchema = fieldSchema(ctx); // No slots needed
1306
- * ```
1307
- */
1308
- function withPlaceholderSlots(schemaCreator) {
1309
- return (ctx) => {
1310
- return schemaCreator(ctx, createRefContextSlotMap(schemaCreator.slotDefinition));
1311
- };
1312
- }
1313
- //#endregion
1314
- //#region ../../packages/project-builder-lib/dist/references/types.js
1315
- /**
1316
- * Definition of an entity type.
1317
- */
1318
- var DefinitionEntityType = class {
1319
- prefix;
1320
- name;
1321
- parentType;
1322
- /**
1323
- * Creates a new entity type.
1324
- *
1325
- * @param name - The name of the entity type.
1326
- * @param prefix - The prefix of the entity type to use in the ID, defaults to the name.
1327
- * @param parentType - The type of the parent entity if any
1328
- */
1329
- constructor(name, prefix, parentType) {
1330
- this.name = name;
1331
- this.parentType = parentType;
1332
- this.prefix = prefix ?? name.split("/").pop() ?? name;
1333
- }
1334
- /**
1335
- * Generates a new ID for the entity type.
1336
- *
1337
- * @returns The new ID.
1338
- */
1339
- generateNewId() {
1340
- return `${this.prefix}:${randomKey()}`;
1341
- }
1342
- idFromKey(key) {
1343
- if (!key) return;
1344
- return `${this.prefix}:${key}`;
1345
- }
1346
- keyFromId(id) {
1347
- const key = id.split(":")[1];
1348
- if (key === void 0) throw new Error(`Invalid ${this.prefix} id: ${id}`);
1349
- return key;
1350
- }
1351
- isId(id) {
1352
- return id.startsWith(`${this.prefix}:`);
1353
- }
1354
- };
1355
- function createEntityType(name, options) {
1356
- const { parentType, prefix } = options ?? {};
1357
- return new DefinitionEntityType(name, prefix, parentType);
1358
- }
1359
- //#endregion
1360
- //#region ../../packages/project-builder-lib/dist/schema/features/feature.js
1361
- var featureEntityType = createEntityType("feature");
1362
- var featureNameSchema = CASE_VALIDATORS.KEBAB_CASE;
1363
- var createFeatureSchema = definitionSchema((ctx) => ctx.withEnt(__mf_0.object({
1364
- id: __mf_0.string(),
1365
- name: __mf_0.string().min(1).refine((name) => name.split("/").every((part) => featureNameSchema.safeParse(part).success), { message: "Feature name must be lowercase and contain only letters, numbers, and dashes" }),
1366
- parentRef: ctx.withRef({
1367
- type: featureEntityType,
1368
- onDelete: "DELETE_PARENT"
1369
- }).optional()
1370
- }), {
1371
- type: featureEntityType,
1372
- sortByName: true
1373
- }));
1374
- var createFeaturesSchema = definitionSchema((ctx) => __mf_0.array(createFeatureSchema(ctx)).default([]));
1375
- //#endregion
1376
- //#region ../../packages/project-builder-lib/dist/definition/feature/feature-utils.js
1377
- function getRootFeatures(projectDefinition) {
1378
- return projectDefinition.features.filter((f) => !f.parentRef);
1379
- }
1380
- function getFeatureById(projectDefinition, featureId) {
1381
- return projectDefinition.features.find((f) => f.id === featureId);
1382
- }
1383
- function getFeatureByIdOrThrow(projectDefinition, featureId) {
1384
- const feature = getFeatureById(projectDefinition, featureId);
1385
- if (!feature) throw new Error(`Could not find feature with ID ${featureId}`);
1386
- return feature;
1387
- }
1388
- function getFeatureChildren(projectDefinition, featureId) {
1389
- return projectDefinition.features.filter((f) => f.parentRef === featureId);
1390
- }
1391
- function getFeatureName(featureConfig) {
1392
- return featureConfig.name.split("/").pop() ?? "";
1393
- }
1394
- function getFeatureNameById(projectDefinition, featureId) {
1395
- return getFeatureName(getFeatureByIdOrThrow(projectDefinition, featureId));
1396
- }
1397
- function getFeaturePathByIdOrThrow(projectDefinition, featureId) {
1398
- return getFeatureByIdOrThrow(projectDefinition, featureId).name;
1399
- }
1400
- function validateFeatureName(name) {
1401
- return name.split("/").every((part) => featureNameSchema.safeParse(part).success);
1402
- }
1403
- function ensureFeatureByNameRecursively(projectDefinition, nameOrId) {
1404
- if (featureEntityType.isId(nameOrId)) return nameOrId;
1405
- const nameParts = nameOrId.split("/");
1406
- let lastName = "";
1407
- let parentRef = void 0;
1408
- for (const part of nameParts) {
1409
- const name = [lastName, part].filter(Boolean).join("/");
1410
- const feature = projectDefinition.features.find((f) => f.name === name && f.parentRef === parentRef);
1411
- if (feature) parentRef = feature.id;
1412
- else {
1413
- const newFeature = {
1414
- id: featureEntityType.generateNewId(),
1415
- name,
1416
- parentRef
1417
- };
1418
- projectDefinition.features.push(newFeature);
1419
- parentRef = newFeature.id;
1420
- }
1421
- lastName = name;
1422
- }
1423
- if (!parentRef) throw new Error("Failed to create feature");
1424
- return parentRef;
1425
- }
1426
- function createPartialFeatures(nameOrPath) {
1427
- if (!nameOrPath) return [];
1428
- const parts = nameOrPath.split("/");
1429
- return parts.map((_, i) => {
1430
- return {
1431
- name: parts.slice(0, i + 1).join("/"),
1432
- parentRef: i > 0 ? parts.slice(0, i).join("/") : void 0
1433
- };
1434
- });
1435
- }
1436
- function getFeatureByName(projectDefinition, name) {
1437
- return projectDefinition.features.find((f) => f.name === name);
1438
- }
1439
- function getFeatureIdByNameOrThrow(projectDefinition, name) {
1440
- const feature = getFeatureByName(projectDefinition, name);
1441
- if (!feature) throw new Error(`Could not find feature with name ${name}`);
1442
- return feature.id;
1443
- }
1444
- function getFeatureIdByNameOrDefault(projectDefinition, name) {
1445
- return getFeatureByName(projectDefinition, name)?.id ?? name;
1446
- }
1447
- function resolveFeatureName(projectDefinition, featureRef) {
1448
- if (!featureRef) return "";
1449
- if (featureEntityType.isId(featureRef)) return getFeaturePathByIdOrThrow(projectDefinition, featureRef);
1450
- return featureRef;
1451
- }
1452
- var FeatureUtils = {
1453
- getRootFeatures,
1454
- getFeatureById,
1455
- getFeatureByIdOrThrow,
1456
- getFeatureChildren,
1457
- getFeatureName,
1458
- getFeatureNameById,
1459
- getFeaturePathByIdOrThrow,
1460
- validateFeatureName,
1461
- ensureFeatureByNameRecursively,
1462
- createPartialFeatures,
1463
- getFeatureByName,
1464
- getFeatureIdByNameOrThrow,
1465
- getFeatureIdByNameOrDefault,
1466
- resolveFeatureName
1467
- };
1468
- //#endregion
1469
- //#region ../../packages/project-builder-lib/dist/definition/model/model-utils.js
1470
- function byId(projectDefinition, id) {
1471
- return projectDefinition.models.find((m) => m.id === id);
1472
- }
1473
- function byIdOrThrow(projectDefinition, id) {
1474
- const model = byId(projectDefinition, id);
1475
- if (!model) throw new Error(`Could not find model with ID ${id}`);
1476
- return model;
1477
- }
1478
- function byName(projectDefinition, name) {
1479
- return projectDefinition.models.find((m) => m.name === name);
1480
- }
1481
- function byNameOrThrow(projectDefinition, name) {
1482
- const model = byName(projectDefinition, name);
1483
- if (!model) throw new Error(`Could not find model with name ${name}`);
1484
- return model;
1485
- }
1486
- function getScalarFieldById(model, id) {
1487
- const field = model.model.fields.find((f) => f.id === id);
1488
- if (!field) throw new Error(`Could not find field with ID ${id}`);
1489
- return field;
1490
- }
1491
- function getRelationsToModel(projectDefinition, modelId) {
1492
- return projectDefinition.models.flatMap((m) => m.model.relations.filter((r) => r.modelRef === modelId).map((r) => ({
1493
- model: m,
1494
- relation: r
1495
- })));
1496
- }
1497
- function getModelsForFeature(projectDefinition, featureId) {
1498
- return projectDefinition.models.filter((m) => m.featureRef === featureId);
1499
- }
1500
- function getModelIdFields(model) {
1501
- return model.model.primaryKeyFieldRefs;
1502
- }
1503
- function hasService(model) {
1504
- return model.service.create.enabled || model.service.update.enabled || model.service.delete.enabled || model.service.transformers.length > 0;
1505
- }
1506
- function validateModelName(name) {
1507
- return PASCAL_CASE_REGEX.test(name);
1508
- }
1509
- /**
1510
- * Returns the ID of a model by name, or the name if no model is found.
1511
- * @param projectDefinition - The project definition.
1512
- * @param name - The name of the model.
1513
- * @returns The ID of the model, or the name if no model is found.
1514
- */
1515
- function getModelIdByNameOrDefault(projectDefinition, name) {
1516
- return projectDefinition.models.find((m) => m.name === name)?.id ?? name;
1517
- }
1518
- function getPrimaryKeyFields(model) {
1519
- return model.model.primaryKeyFieldRefs.map((id) => getScalarFieldById(model, id));
1520
- }
1521
- /**
1522
- * Whether a field with the given read-role restriction is safe to expose as
1523
- * a where-filter operand on a query with the given read-role restriction.
1524
- *
1525
- * A field is safe to filter on only if every principal who can call the
1526
- * query can also read the field's value — i.e. the field's own restriction
1527
- * (if any) is no narrower than the query's. Role lists are OR'd (holding
1528
- * *any* listed role grants access), and an EMPTY role list means
1529
- * "unrestricted" (everyone), not "no one" — the widest grant, not the
1530
- * narrowest. So:
1531
- * - field unrestricted (empty) -> always safe, regardless of the query.
1532
- * - query unrestricted (empty) but field restricted -> never safe (the
1533
- * query admits everyone; the field doesn't).
1534
- * - both restricted -> safe only if every query role is also a field role
1535
- * (the query's role set is a SUBSET of the field's), so no principal can
1536
- * pass the query's gate without also passing the field's.
1537
- *
1538
- * @param field - The field's `globalRoles`/`instanceRoles` restriction.
1539
- * @param query - The query's `globalRoles`/`instanceRoles` restriction.
1540
- * @returns Whether the field is safe to filter on given the query's gate.
1541
- */
1542
- function isFieldSafeToFilter(field, query) {
1543
- if (!(field.globalRoles.length > 0 || field.instanceRoles.length > 0)) return true;
1544
- if (!(query.globalRoles.length > 0 || query.instanceRoles.length > 0)) return false;
1545
- const isSubset = (subset, superset) => subset.every((role) => superset.includes(role));
1546
- return isSubset(query.globalRoles, field.globalRoles) && isSubset(query.instanceRoles, field.instanceRoles);
1547
- }
1548
- /**
1549
- * Returns the IDs of models that need an `OrderByInput` GraphQL type because
1550
- * some *other* model exposes a list relation to them marked `orderable`.
1551
- *
1552
- * The `orderable` flag lives on the *referenced* model's foreign relation
1553
- * entry (e.g. `User.todoLists`), but the input type belongs to the model the
1554
- * relation is declared on (`TodoList`, whose `owner` relation carries the
1555
- * matching globally-unique `foreignId`) — that is the model whose rows are
1556
- * being sorted.
1557
- *
1558
- * @param projectDefinition - The project definition.
1559
- * @returns The set of model IDs requiring an `OrderByInput` type.
1560
- */
1561
- function getModelIdsRequiringOrderByInput(projectDefinition) {
1562
- const orderableForeignIds = new Set(projectDefinition.models.filter((m) => m.graphql.objectType.enabled).flatMap((m) => m.graphql.objectType.foreignRelations.filter((entry) => entry.orderable).map((entry) => entry.ref)));
1563
- return new Set(projectDefinition.models.filter((m) => m.model.relations.some((relation) => orderableForeignIds.has(relation.foreignId))).map((m) => m.id));
1564
- }
1565
- /**
1566
- * Whether the model exposes any root query returning a list of its rows.
1567
- *
1568
- * Offset and cursor pagination are independent surfaces, but both read through
1569
- * the same object type, `where`/`orderBy` inputs, and role checks — so either
1570
- * one alone requires all of them. Gate shared generation on this rather than on
1571
- * a single surface's flag.
1572
- *
1573
- * @param queries - The model's `graphql.queries` config.
1574
- * @returns Whether a list-returning root query is enabled.
1575
- */
1576
- function hasListSurface(queries) {
1577
- return queries.list.enabled || queries.connection.enabled;
1578
- }
1579
- var ModelUtils = {
1580
- byId,
1581
- hasListSurface,
1582
- byIdOrThrow,
1583
- byName,
1584
- byNameOrThrow,
1585
- getScalarFieldById,
1586
- getRelationsToModel,
1587
- getModelIdsRequiringOrderByInput,
1588
- getModelsForFeature,
1589
- getModelIdFields,
1590
- hasService,
1591
- validateModelName,
1592
- getModelIdByNameOrDefault,
1593
- getPrimaryKeyFields,
1594
- isFieldSafeToFilter
1595
- };
1596
- //#endregion
1597
- export { getTag as $, isPlainObject as A, int32ArrayTag as B, createPluginFieldMap as C, validationHintRegistry as D, CASE_VALIDATORS as E, dataViewTag as F, regexpTag as G, mapTag as H, dateTag as I, symbolTag as J, setTag as K, float32ArrayTag as L, arrayBufferTag as M, arrayTag as N, isEqual as O, booleanTag as P, uint8ClampedArrayTag as Q, float64ArrayTag as R, createFieldMapSpec as S, runInPluginContext as T, numberTag as U, int8ArrayTag as V, objectTag as W, uint32ArrayTag as X, uint16ArrayTag as Y, uint8ArrayTag as Z, createRefContextSlot as _, featureEntityType as a, expressionParserSpec as b, createEntityType as c, definitionSchemaWithSlots as d, getSymbols as et, withPlaceholderSlots as f, withRef as g, withEnt as h, createFeaturesSchema as i, argumentsTag as j, eq as k, createDefinitionSchemaParserContext as l, definitionDefaultRegistry as m, FeatureUtils as n, sortBy as nt, featureNameSchema as o, withDefault as p, stringTag as q, createFeatureSchema as r, createPluginSpec as rt, DefinitionEntityType as s, ModelUtils as t, isBuffer as tt, definitionSchema as u, createRefContextSlotMap as v, getPluginContext as w, definitionRefRegistry as x, RefExpressionParser as y, int16ArrayTag as z };
1598
-
1599
- //# sourceMappingURL=model-utils-C0WDb_Ec.js.map