@baseplate-dev/plugin-auth 4.0.3 → 5.0.1

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 (449) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +3 -3
  3. package/dist/auth/core/node.d.ts.map +1 -1
  4. package/dist/auth/core/node.js +2 -1
  5. package/dist/auth/core/node.js.map +1 -1
  6. package/dist/auth/core/schema/plugin-definition.d.ts +2 -12
  7. package/dist/auth/core/schema/plugin-definition.d.ts.map +1 -1
  8. package/dist/auth/core/schema/roles/schema.d.ts +2 -12
  9. package/dist/auth/core/schema/roles/schema.d.ts.map +1 -1
  10. package/dist/auth/core/schema/roles/schema.js +10 -17
  11. package/dist/auth/core/schema/roles/schema.js.map +1 -1
  12. package/dist/auth/plugin.json +1 -1
  13. package/dist/better-auth/constants/model-names.d.ts +8 -0
  14. package/dist/better-auth/constants/model-names.d.ts.map +1 -0
  15. package/dist/better-auth/constants/model-names.js +8 -0
  16. package/dist/better-auth/constants/model-names.js.map +1 -0
  17. package/dist/better-auth/constants/packages.d.ts +4 -0
  18. package/dist/better-auth/constants/packages.d.ts.map +1 -0
  19. package/dist/better-auth/constants/packages.js +4 -0
  20. package/dist/better-auth/constants/packages.js.map +1 -0
  21. package/dist/better-auth/core/common.d.ts.map +1 -0
  22. package/dist/better-auth/core/common.js +17 -0
  23. package/dist/better-auth/core/common.js.map +1 -0
  24. package/dist/better-auth/core/components/better-auth-definition-editor.d.ts +5 -0
  25. package/dist/better-auth/core/components/better-auth-definition-editor.d.ts.map +1 -0
  26. package/dist/{auth0/core/components/auth0-definition-editor.js → better-auth/core/components/better-auth-definition-editor.js} +17 -17
  27. package/dist/better-auth/core/components/better-auth-definition-editor.js.map +1 -0
  28. package/dist/better-auth/core/index.d.ts +2 -0
  29. package/dist/better-auth/core/index.d.ts.map +1 -0
  30. package/dist/better-auth/core/index.js +2 -0
  31. package/dist/better-auth/core/index.js.map +1 -0
  32. package/dist/better-auth/core/node.d.ts.map +1 -0
  33. package/dist/{auth0 → better-auth}/core/node.js +16 -14
  34. package/dist/better-auth/core/node.js.map +1 -0
  35. package/dist/better-auth/core/schema/models.d.ts +3 -0
  36. package/dist/better-auth/core/schema/models.d.ts.map +1 -0
  37. package/dist/better-auth/core/schema/models.js +278 -0
  38. package/dist/better-auth/core/schema/models.js.map +1 -0
  39. package/dist/better-auth/core/schema/plugin-definition.d.ts +5 -0
  40. package/dist/better-auth/core/schema/plugin-definition.d.ts.map +1 -0
  41. package/dist/better-auth/core/schema/plugin-definition.js +4 -0
  42. package/dist/better-auth/core/schema/plugin-definition.js.map +1 -0
  43. package/dist/better-auth/core/web.d.ts.map +1 -0
  44. package/dist/{auth0 → better-auth}/core/web.js +2 -2
  45. package/dist/better-auth/core/web.js.map +1 -0
  46. package/dist/{auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts → better-auth/generators/fastify/better-auth-module/better-auth-module.generator.d.ts} +20 -26
  47. package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.d.ts.map +1 -0
  48. package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.js +75 -0
  49. package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.js.map +1 -0
  50. package/dist/{auth0/generators/fastify/auth0-module → better-auth/generators/fastify/better-auth-module}/generated/index.d.ts +41 -26
  51. package/dist/better-auth/generators/fastify/better-auth-module/generated/index.d.ts.map +1 -0
  52. package/dist/better-auth/generators/fastify/better-auth-module/generated/index.js +11 -0
  53. package/dist/better-auth/generators/fastify/better-auth-module/generated/index.js.map +1 -0
  54. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-paths.d.ts +16 -0
  55. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-paths.d.ts.map +1 -0
  56. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-paths.js +28 -0
  57. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-paths.js.map +1 -0
  58. package/dist/{auth0/generators/fastify/auth0-module → better-auth/generators/fastify/better-auth-module}/generated/template-renderers.d.ts +16 -10
  59. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.d.ts.map +1 -0
  60. package/dist/{auth0/generators/fastify/auth0-module → better-auth/generators/fastify/better-auth-module}/generated/template-renderers.js +35 -16
  61. package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.js.map +1 -0
  62. package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.d.ts +30 -0
  63. package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.d.ts.map +1 -0
  64. package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.js +37 -0
  65. package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.js.map +1 -0
  66. package/dist/{auth0/generators/fastify/auth0-module → better-auth/generators/fastify/better-auth-module}/generated/typed-templates.d.ts +29 -20
  67. package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.d.ts.map +1 -0
  68. package/dist/{auth0/generators/fastify/auth0-module → better-auth/generators/fastify/better-auth-module}/generated/typed-templates.js +37 -9
  69. package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.js.map +1 -0
  70. package/dist/better-auth/generators/fastify/better-auth-module/index.d.ts +4 -0
  71. package/dist/better-auth/generators/fastify/better-auth-module/index.d.ts.map +1 -0
  72. package/dist/better-auth/generators/fastify/better-auth-module/index.js +3 -0
  73. package/dist/better-auth/generators/fastify/better-auth-module/index.js.map +1 -0
  74. package/dist/better-auth/generators/fastify/better-auth-module/templates/module/plugins/better-auth.plugin.ts +31 -0
  75. package/dist/{auth0/generators/fastify/auth0-module → better-auth/generators/fastify/better-auth-module}/templates/module/schema/user-session.queries.ts +1 -1
  76. package/dist/better-auth/generators/fastify/better-auth-module/templates/module/services/auth.ts +62 -0
  77. package/dist/better-auth/generators/fastify/better-auth-module/templates/module/services/user-session.service.ts +72 -0
  78. package/dist/better-auth/generators/fastify/better-auth-module/templates/module/utils/headers.utils.ts +21 -0
  79. package/dist/better-auth/generators/fastify/index.d.ts +2 -0
  80. package/dist/better-auth/generators/fastify/index.d.ts.map +1 -0
  81. package/dist/better-auth/generators/fastify/index.js +2 -0
  82. package/dist/better-auth/generators/fastify/index.js.map +1 -0
  83. package/dist/better-auth/generators/index.d.ts.map +1 -0
  84. package/dist/better-auth/generators/index.js.map +1 -0
  85. package/dist/{auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts → better-auth/generators/react/better-auth-hooks/better-auth-hooks.generator.d.ts} +11 -7
  86. package/dist/better-auth/generators/react/better-auth-hooks/better-auth-hooks.generator.d.ts.map +1 -0
  87. package/dist/{auth0/generators/react/auth0-hooks/auth0-hooks.generator.js → better-auth/generators/react/better-auth-hooks/better-auth-hooks.generator.js} +8 -8
  88. package/dist/better-auth/generators/react/better-auth-hooks/better-auth-hooks.generator.js.map +1 -0
  89. package/dist/{auth0/generators/react/auth0-hooks → better-auth/generators/react/better-auth-hooks}/generated/index.d.ts +21 -8
  90. package/dist/better-auth/generators/react/better-auth-hooks/generated/index.d.ts.map +1 -0
  91. package/dist/better-auth/generators/react/better-auth-hooks/generated/index.js +11 -0
  92. package/dist/better-auth/generators/react/better-auth-hooks/generated/index.js.map +1 -0
  93. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.d.ts +14 -0
  94. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.d.ts.map +1 -0
  95. package/dist/{auth0/generators/react/auth0-hooks → better-auth/generators/react/better-auth-hooks}/generated/template-paths.js +9 -7
  96. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.js.map +1 -0
  97. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-renderers.d.ts +27 -0
  98. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-renderers.d.ts.map +1 -0
  99. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-renderers.js +43 -0
  100. package/dist/better-auth/generators/react/better-auth-hooks/generated/template-renderers.js.map +1 -0
  101. package/dist/{auth0/generators/react/auth0-hooks → better-auth/generators/react/better-auth-hooks}/generated/ts-import-providers.d.ts +2 -2
  102. package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.d.ts.map +1 -0
  103. package/dist/{auth0/generators/react/auth0-hooks → better-auth/generators/react/better-auth-hooks}/generated/ts-import-providers.js +5 -5
  104. package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.js.map +1 -0
  105. package/dist/{auth0/generators/react/auth0-hooks → better-auth/generators/react/better-auth-hooks}/generated/typed-templates.d.ts +21 -3
  106. package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.d.ts.map +1 -0
  107. package/dist/{auth0/generators/react/auth0-hooks → better-auth/generators/react/better-auth-hooks}/generated/typed-templates.js +7 -3
  108. package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.js.map +1 -0
  109. package/dist/better-auth/generators/react/better-auth-hooks/index.d.ts +2 -0
  110. package/dist/better-auth/generators/react/better-auth-hooks/index.d.ts.map +1 -0
  111. package/dist/better-auth/generators/react/better-auth-hooks/index.js +2 -0
  112. package/dist/better-auth/generators/react/better-auth-hooks/index.js.map +1 -0
  113. package/dist/better-auth/generators/react/better-auth-hooks/templates/src/hooks/use-log-out.ts +18 -0
  114. package/dist/better-auth/generators/react/better-auth-hooks/templates/src/hooks/use-session.ts +30 -0
  115. package/dist/{auth0/generators/react/auth0-pages/auth0-pages.generator.d.ts → better-auth/generators/react/better-auth-pages/better-auth-pages.generator.d.ts} +15 -6
  116. package/dist/better-auth/generators/react/better-auth-pages/better-auth-pages.generator.d.ts.map +1 -0
  117. package/dist/{auth0/generators/react/auth0-pages/auth0-pages.generator.js → better-auth/generators/react/better-auth-pages/better-auth-pages.generator.js} +7 -7
  118. package/dist/better-auth/generators/react/better-auth-pages/better-auth-pages.generator.js.map +1 -0
  119. package/dist/{auth0/generators/react/auth0-pages → better-auth/generators/react/better-auth-pages}/generated/index.d.ts +246 -6
  120. package/dist/{auth0/generators/react/auth0-pages → better-auth/generators/react/better-auth-pages}/generated/index.d.ts.map +1 -1
  121. package/dist/better-auth/generators/react/better-auth-pages/generated/index.js +9 -0
  122. package/dist/better-auth/generators/react/better-auth-pages/generated/index.js.map +1 -0
  123. package/dist/better-auth/generators/react/better-auth-pages/generated/template-paths.d.ts +13 -0
  124. package/dist/better-auth/generators/react/better-auth-pages/generated/template-paths.d.ts.map +1 -0
  125. package/dist/better-auth/generators/react/better-auth-pages/generated/template-paths.js +25 -0
  126. package/dist/better-auth/generators/react/better-auth-pages/generated/template-paths.js.map +1 -0
  127. package/dist/{auth0/generators/react/react-auth0 → better-auth/generators/react/better-auth-pages}/generated/template-renderers.d.ts +13 -9
  128. package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.d.ts.map +1 -0
  129. package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.js +44 -0
  130. package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.js.map +1 -0
  131. package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.d.ts +895 -0
  132. package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.d.ts.map +1 -0
  133. package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.js +35 -0
  134. package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.js.map +1 -0
  135. package/dist/better-auth/generators/react/better-auth-pages/index.d.ts +2 -0
  136. package/dist/better-auth/generators/react/better-auth-pages/index.d.ts.map +1 -0
  137. package/dist/better-auth/generators/react/better-auth-pages/index.js +2 -0
  138. package/dist/better-auth/generators/react/better-auth-pages/index.js.map +1 -0
  139. package/dist/better-auth/generators/react/better-auth-pages/templates/routes/auth/login.tsx +146 -0
  140. package/dist/better-auth/generators/react/better-auth-pages/templates/routes/auth/register.tsx +162 -0
  141. package/dist/better-auth/generators/react/index.d.ts +4 -0
  142. package/dist/better-auth/generators/react/index.d.ts.map +1 -0
  143. package/dist/better-auth/generators/react/index.js +4 -0
  144. package/dist/better-auth/generators/react/index.js.map +1 -0
  145. package/dist/{auth0/generators/react/react-auth0 → better-auth/generators/react/react-better-auth}/generated/index.d.ts +42 -7
  146. package/dist/{auth0/generators/react/react-auth0 → better-auth/generators/react/react-better-auth}/generated/index.d.ts.map +1 -1
  147. package/dist/better-auth/generators/react/react-better-auth/generated/index.js +11 -0
  148. package/dist/better-auth/generators/react/react-better-auth/generated/index.js.map +1 -0
  149. package/dist/better-auth/generators/react/react-better-auth/generated/template-paths.d.ts +13 -0
  150. package/dist/better-auth/generators/react/react-better-auth/generated/template-paths.d.ts.map +1 -0
  151. package/dist/better-auth/generators/react/react-better-auth/generated/template-paths.js +25 -0
  152. package/dist/better-auth/generators/react/react-better-auth/generated/template-paths.js.map +1 -0
  153. package/dist/{auth0/generators/react/auth0-pages → better-auth/generators/react/react-better-auth}/generated/template-renderers.d.ts +28 -9
  154. package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.d.ts.map +1 -0
  155. package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.js +51 -0
  156. package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.js.map +1 -0
  157. package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.d.ts +21 -0
  158. package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.d.ts.map +1 -0
  159. package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.js +30 -0
  160. package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.js.map +1 -0
  161. package/dist/{auth0/generators/react/react-auth0 → better-auth/generators/react/react-better-auth}/generated/typed-templates.d.ts +16 -2
  162. package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.d.ts.map +1 -0
  163. package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.js +33 -0
  164. package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.js.map +1 -0
  165. package/dist/better-auth/generators/react/react-better-auth/index.d.ts +4 -0
  166. package/dist/better-auth/generators/react/react-better-auth/index.d.ts.map +1 -0
  167. package/dist/better-auth/generators/react/react-better-auth/index.js +3 -0
  168. package/dist/better-auth/generators/react/react-better-auth/index.js.map +1 -0
  169. package/dist/{auth0/generators/react/react-auth0/react-auth0.generator.d.ts → better-auth/generators/react/react-better-auth/react-better-auth.generator.d.ts} +28 -25
  170. package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.d.ts.map +1 -0
  171. package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.js +74 -0
  172. package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.js.map +1 -0
  173. package/dist/better-auth/generators/react/react-better-auth/templates/src/app/auth-loaded-gate.tsx +58 -0
  174. package/dist/better-auth/generators/react/react-better-auth/templates/src/services/auth-client.ts +15 -0
  175. package/dist/better-auth/index.d.ts +3 -0
  176. package/dist/better-auth/index.d.ts.map +1 -0
  177. package/dist/better-auth/index.js +2 -0
  178. package/dist/better-auth/index.js.map +1 -0
  179. package/dist/better-auth/plugin.json +9 -0
  180. package/dist/better-auth/static/icon.svg +10 -0
  181. package/dist/index.d.ts +1 -0
  182. package/dist/local-auth/core/components/local-auth-definition-editor.d.ts.map +1 -1
  183. package/dist/local-auth/core/components/local-auth-definition-editor.js +11 -11
  184. package/dist/local-auth/core/components/local-auth-definition-editor.js.map +1 -1
  185. package/dist/local-auth/core/generators/auth-apollo/auth-apollo.generator.d.ts +2 -2
  186. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +4 -4
  187. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.js +1 -1
  188. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.js.map +1 -1
  189. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.ts +1 -1
  190. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.d.ts +3 -1
  191. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.d.ts.map +1 -1
  192. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +6 -1
  193. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js.map +1 -1
  194. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +8 -2
  195. package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +1 -0
  196. package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts.map +1 -1
  197. package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +14 -3
  198. package/dist/local-auth/core/generators/auth-module/auth-module.generator.js.map +1 -1
  199. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +1 -1
  200. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js.map +1 -1
  201. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +1 -1
  202. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js +1 -1
  203. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js.map +1 -1
  204. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.tsx +1 -1
  205. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js +34 -15
  206. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js.map +1 -1
  207. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.tsx +58 -15
  208. package/dist/local-auth/core/node.d.ts.map +1 -1
  209. package/dist/local-auth/core/node.js +8 -6
  210. package/dist/local-auth/core/node.js.map +1 -1
  211. package/dist/local-auth/core/schema/models.d.ts +2 -4
  212. package/dist/local-auth/core/schema/models.d.ts.map +1 -1
  213. package/dist/local-auth/core/schema/models.js +254 -252
  214. package/dist/local-auth/core/schema/models.js.map +1 -1
  215. package/dist/local-auth/core/schema/plugin-definition.d.ts +2 -2
  216. package/dist/placeholder-auth/core/components/placeholder-auth-definition-editor.d.ts.map +1 -1
  217. package/dist/placeholder-auth/core/components/placeholder-auth-definition-editor.js +11 -11
  218. package/dist/placeholder-auth/core/components/placeholder-auth-definition-editor.js.map +1 -1
  219. package/dist/placeholder-auth/core/schema/models.d.ts +2 -4
  220. package/dist/placeholder-auth/core/schema/models.d.ts.map +1 -1
  221. package/dist/placeholder-auth/core/schema/models.js +30 -28
  222. package/dist/placeholder-auth/core/schema/models.js.map +1 -1
  223. package/dist/web/assets/{__federation_expose_authCoreCommon-Bg2mzE9K.js → __federation_expose_authCoreCommon-CIVhaGqo.js} +3 -3
  224. package/dist/web/assets/{__federation_expose_authCoreCommon-Bg2mzE9K.js.map → __federation_expose_authCoreCommon-CIVhaGqo.js.map} +1 -1
  225. package/dist/web/assets/{__federation_expose_authCoreWeb-DrOVHmj4.js → __federation_expose_authCoreWeb-N-mh42Bs.js} +6 -6
  226. package/dist/web/assets/{__federation_expose_authCoreWeb-DrOVHmj4.js.map → __federation_expose_authCoreWeb-N-mh42Bs.js.map} +1 -1
  227. package/dist/web/assets/__federation_expose_better-authCoreCommon-BIU3Fg7K.js +20 -0
  228. package/dist/web/assets/__federation_expose_better-authCoreCommon-BIU3Fg7K.js.map +1 -0
  229. package/dist/web/assets/__federation_expose_better-authCoreWeb-CMhPrXPA.js +402 -0
  230. package/dist/web/assets/__federation_expose_better-authCoreWeb-CMhPrXPA.js.map +1 -0
  231. package/dist/web/assets/{__federation_expose_local-authAdminCommon-Bzb0P17-.js → __federation_expose_local-authAdminCommon-DvHe9w29.js} +2 -2
  232. package/dist/web/assets/{__federation_expose_local-authAdminCommon-Bzb0P17-.js.map → __federation_expose_local-authAdminCommon-DvHe9w29.js.map} +1 -1
  233. package/dist/web/assets/{__federation_expose_local-authAdminWeb-D_LWcl7j.js → __federation_expose_local-authAdminWeb-CLU9aEy9.js} +2 -2
  234. package/dist/web/assets/{__federation_expose_local-authAdminWeb-D_LWcl7j.js.map → __federation_expose_local-authAdminWeb-CLU9aEy9.js.map} +1 -1
  235. package/dist/web/assets/{__federation_expose_local-authCoreCommon-D6OG-Rz6.js → __federation_expose_local-authCoreCommon-DbuvGG7o.js} +3 -3
  236. package/dist/web/assets/{__federation_expose_local-authCoreCommon-D6OG-Rz6.js.map → __federation_expose_local-authCoreCommon-DbuvGG7o.js.map} +1 -1
  237. package/dist/web/assets/__federation_expose_local-authCoreWeb-BY-mP3uS.js +432 -0
  238. package/dist/web/assets/__federation_expose_local-authCoreWeb-BY-mP3uS.js.map +1 -0
  239. package/dist/web/assets/{__federation_expose_placeholder-authCoreCommon-D7b3GEPP.js → __federation_expose_placeholder-authCoreCommon-BJBCuZvU.js} +3 -3
  240. package/dist/web/assets/{__federation_expose_placeholder-authCoreCommon-D7b3GEPP.js.map → __federation_expose_placeholder-authCoreCommon-BJBCuZvU.js.map} +1 -1
  241. package/dist/web/assets/{__federation_expose_placeholder-authCoreWeb-VZzvid5j.js → __federation_expose_placeholder-authCoreWeb-BaV-Ko2C.js} +61 -53
  242. package/dist/web/assets/__federation_expose_placeholder-authCoreWeb-BaV-Ko2C.js.map +1 -0
  243. package/dist/web/assets/{__federation_fn_import-DfNliZHH.js → __federation_fn_import-BLFDCY-V.js} +2 -2
  244. package/dist/web/assets/{__federation_fn_import-DfNliZHH.js.map → __federation_fn_import-BLFDCY-V.js.map} +1 -1
  245. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/{web-BqJ1vSYx.js → web-bRU6KpPk.js} +48 -26
  246. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-bRU6KpPk.js.map +1 -0
  247. package/dist/web/assets/__federation_shared_@baseplate-dev/{project-builder-lib-qf98MMJC.js → project-builder-lib-CQKLkNsU.js} +5705 -1957
  248. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-CQKLkNsU.js.map +1 -0
  249. package/dist/web/assets/__federation_shared_@baseplate-dev/{ui-components-DFkMnXmX.js → ui-components-DhyoEUTy.js} +5886 -1191
  250. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-DhyoEUTy.js.map +1 -0
  251. package/dist/web/assets/__federation_shared_@baseplate-dev/{utils-CApJheqk.js → utils-9w-0yxVZ.js} +64 -45
  252. package/dist/web/assets/__federation_shared_@baseplate-dev/utils-9w-0yxVZ.js.map +1 -0
  253. package/dist/web/assets/__federation_shared_@tanstack/{react-router-YQslfDyE.js → react-router-CbExBaoL.js} +2 -2
  254. package/dist/web/assets/__federation_shared_@tanstack/{react-router-YQslfDyE.js.map → react-router-CbExBaoL.js.map} +1 -1
  255. package/dist/web/assets/{__federation_shared_zod-B6wbpZ4f.js → __federation_shared_zod-Do7Aa1b5.js} +3431 -2188
  256. package/dist/web/assets/__federation_shared_zod-Do7Aa1b5.js.map +1 -0
  257. package/dist/web/assets/{get-auth-plugin-definition-CVuj_mvy.js → get-auth-plugin-definition-BL50g0cJ.js} +2 -2
  258. package/dist/web/assets/{get-auth-plugin-definition-CVuj_mvy.js.map → get-auth-plugin-definition-BL50g0cJ.js.map} +1 -1
  259. package/dist/web/assets/{index-B00D4irM.js → index-B_A3cgiy.js} +2 -2
  260. package/dist/web/assets/{index-B00D4irM.js.map → index-B_A3cgiy.js.map} +1 -1
  261. package/dist/web/assets/{index.esm-1qBxxnfu.js → index.esm-BraHxHLB.js} +338 -231
  262. package/dist/web/assets/index.esm-BraHxHLB.js.map +1 -0
  263. package/dist/web/assets/{isEqual-BQtm2LNT.js → isEqual-tnzoadW8.js} +18 -18
  264. package/dist/web/assets/isEqual-tnzoadW8.js.map +1 -0
  265. package/dist/web/assets/mergeWith-VagwCqUi.js +76 -0
  266. package/dist/web/assets/mergeWith-VagwCqUi.js.map +1 -0
  267. package/dist/web/assets/model-utils-BfcjfzCn.js +694 -0
  268. package/dist/web/assets/model-utils-BfcjfzCn.js.map +1 -0
  269. package/dist/web/assets/plugin-definition-CXnKUJ1l.js +20 -0
  270. package/dist/web/assets/plugin-definition-CXnKUJ1l.js.map +1 -0
  271. package/dist/web/assets/{plugin-definition-CcdhC0td.js → plugin-definition-Ckl5hjD1.js} +2 -2
  272. package/dist/web/assets/{plugin-definition-CcdhC0td.js.map → plugin-definition-Ckl5hjD1.js.map} +1 -1
  273. package/dist/web/assets/{plugin-definition-B_hlyPlm.js → plugin-definition-D26rR8AB.js} +2 -2
  274. package/dist/web/assets/{plugin-definition-B_hlyPlm.js.map → plugin-definition-D26rR8AB.js.map} +1 -1
  275. package/dist/web/assets/{plugin-definition-BKCeZ0Ni.js → plugin-definition-DJzXScRp.js} +12 -19
  276. package/dist/web/assets/plugin-definition-DJzXScRp.js.map +1 -0
  277. package/dist/web/assets/{react-Df9ccuow.js → react-CL9M_wyN.js} +2 -2
  278. package/dist/web/assets/{react-Df9ccuow.js.map → react-CL9M_wyN.js.map} +1 -1
  279. package/dist/web/assets/{registries-19UehlAo.js → registries-Tz_dluz3.js} +51 -13
  280. package/dist/web/assets/registries-Tz_dluz3.js.map +1 -0
  281. package/dist/web/assets/remoteEntry.js +14 -14
  282. package/dist/web/assets/{styles-CbPVroCT.js → styles-tkrWV-ZE.js} +4 -4
  283. package/dist/web/assets/{styles-CbPVroCT.js.map → styles-tkrWV-ZE.js.map} +1 -1
  284. package/package.json +17 -17
  285. package/dist/auth0/constants/model-names.d.ts +0 -4
  286. package/dist/auth0/constants/model-names.d.ts.map +0 -1
  287. package/dist/auth0/constants/model-names.js +0 -4
  288. package/dist/auth0/constants/model-names.js.map +0 -1
  289. package/dist/auth0/constants/packages.d.ts +0 -6
  290. package/dist/auth0/constants/packages.d.ts.map +0 -1
  291. package/dist/auth0/constants/packages.js +0 -6
  292. package/dist/auth0/constants/packages.js.map +0 -1
  293. package/dist/auth0/core/common.d.ts.map +0 -1
  294. package/dist/auth0/core/common.js +0 -19
  295. package/dist/auth0/core/common.js.map +0 -1
  296. package/dist/auth0/core/components/auth0-definition-editor.d.ts +0 -5
  297. package/dist/auth0/core/components/auth0-definition-editor.d.ts.map +0 -1
  298. package/dist/auth0/core/components/auth0-definition-editor.js.map +0 -1
  299. package/dist/auth0/core/node.d.ts.map +0 -1
  300. package/dist/auth0/core/node.js.map +0 -1
  301. package/dist/auth0/core/schema/migrations.d.ts +0 -3
  302. package/dist/auth0/core/schema/migrations.d.ts.map +0 -1
  303. package/dist/auth0/core/schema/migrations.js +0 -19
  304. package/dist/auth0/core/schema/migrations.js.map +0 -1
  305. package/dist/auth0/core/schema/models.d.ts +0 -5
  306. package/dist/auth0/core/schema/models.d.ts.map +0 -1
  307. package/dist/auth0/core/schema/models.js +0 -40
  308. package/dist/auth0/core/schema/models.js.map +0 -1
  309. package/dist/auth0/core/schema/plugin-definition.d.ts +0 -5
  310. package/dist/auth0/core/schema/plugin-definition.d.ts.map +0 -1
  311. package/dist/auth0/core/schema/plugin-definition.js +0 -4
  312. package/dist/auth0/core/schema/plugin-definition.js.map +0 -1
  313. package/dist/auth0/core/web.d.ts.map +0 -1
  314. package/dist/auth0/core/web.js.map +0 -1
  315. package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts.map +0 -1
  316. package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js +0 -114
  317. package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js.map +0 -1
  318. package/dist/auth0/generators/fastify/auth0-module/generated/index.d.ts.map +0 -1
  319. package/dist/auth0/generators/fastify/auth0-module/generated/index.js +0 -11
  320. package/dist/auth0/generators/fastify/auth0-module/generated/index.js.map +0 -1
  321. package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.d.ts +0 -14
  322. package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.d.ts.map +0 -1
  323. package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.js +0 -24
  324. package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.js.map +0 -1
  325. package/dist/auth0/generators/fastify/auth0-module/generated/template-renderers.d.ts.map +0 -1
  326. package/dist/auth0/generators/fastify/auth0-module/generated/template-renderers.js.map +0 -1
  327. package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.d.ts +0 -10
  328. package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.d.ts.map +0 -1
  329. package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.js +0 -23
  330. package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.js.map +0 -1
  331. package/dist/auth0/generators/fastify/auth0-module/generated/typed-templates.d.ts.map +0 -1
  332. package/dist/auth0/generators/fastify/auth0-module/generated/typed-templates.js.map +0 -1
  333. package/dist/auth0/generators/fastify/auth0-module/index.d.ts +0 -2
  334. package/dist/auth0/generators/fastify/auth0-module/index.d.ts.map +0 -1
  335. package/dist/auth0/generators/fastify/auth0-module/index.js +0 -2
  336. package/dist/auth0/generators/fastify/auth0-module/index.js.map +0 -1
  337. package/dist/auth0/generators/fastify/auth0-module/templates/module/services/management.ts +0 -22
  338. package/dist/auth0/generators/fastify/auth0-module/templates/module/services/user-session.service.ts +0 -101
  339. package/dist/auth0/generators/fastify/index.d.ts +0 -2
  340. package/dist/auth0/generators/fastify/index.d.ts.map +0 -1
  341. package/dist/auth0/generators/fastify/index.js +0 -2
  342. package/dist/auth0/generators/fastify/index.js.map +0 -1
  343. package/dist/auth0/generators/index.d.ts.map +0 -1
  344. package/dist/auth0/generators/index.js.map +0 -1
  345. package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.d.ts +0 -10
  346. package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.d.ts.map +0 -1
  347. package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.js +0 -41
  348. package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.js.map +0 -1
  349. package/dist/auth0/generators/react/auth0-apollo/index.d.ts +0 -2
  350. package/dist/auth0/generators/react/auth0-apollo/index.d.ts.map +0 -1
  351. package/dist/auth0/generators/react/auth0-apollo/index.js +0 -2
  352. package/dist/auth0/generators/react/auth0-apollo/index.js.map +0 -1
  353. package/dist/auth0/generators/react/auth0-apollo/templates/auth-link.ts +0 -11
  354. package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts.map +0 -1
  355. package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js.map +0 -1
  356. package/dist/auth0/generators/react/auth0-hooks/generated/index.d.ts.map +0 -1
  357. package/dist/auth0/generators/react/auth0-hooks/generated/index.js +0 -11
  358. package/dist/auth0/generators/react/auth0-hooks/generated/index.js.map +0 -1
  359. package/dist/auth0/generators/react/auth0-hooks/generated/template-paths.d.ts +0 -14
  360. package/dist/auth0/generators/react/auth0-hooks/generated/template-paths.d.ts.map +0 -1
  361. package/dist/auth0/generators/react/auth0-hooks/generated/template-paths.js.map +0 -1
  362. package/dist/auth0/generators/react/auth0-hooks/generated/template-renderers.d.ts +0 -23
  363. package/dist/auth0/generators/react/auth0-hooks/generated/template-renderers.d.ts.map +0 -1
  364. package/dist/auth0/generators/react/auth0-hooks/generated/template-renderers.js +0 -38
  365. package/dist/auth0/generators/react/auth0-hooks/generated/template-renderers.js.map +0 -1
  366. package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-providers.d.ts.map +0 -1
  367. package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-providers.js.map +0 -1
  368. package/dist/auth0/generators/react/auth0-hooks/generated/typed-templates.d.ts.map +0 -1
  369. package/dist/auth0/generators/react/auth0-hooks/generated/typed-templates.js.map +0 -1
  370. package/dist/auth0/generators/react/auth0-hooks/index.d.ts +0 -2
  371. package/dist/auth0/generators/react/auth0-hooks/index.d.ts.map +0 -1
  372. package/dist/auth0/generators/react/auth0-hooks/index.js +0 -2
  373. package/dist/auth0/generators/react/auth0-hooks/index.js.map +0 -1
  374. package/dist/auth0/generators/react/auth0-hooks/templates/src/hooks/use-log-out.ts +0 -14
  375. package/dist/auth0/generators/react/auth0-hooks/templates/src/hooks/use-session.ts +0 -36
  376. package/dist/auth0/generators/react/auth0-pages/auth0-pages.generator.d.ts.map +0 -1
  377. package/dist/auth0/generators/react/auth0-pages/auth0-pages.generator.js.map +0 -1
  378. package/dist/auth0/generators/react/auth0-pages/generated/index.js +0 -9
  379. package/dist/auth0/generators/react/auth0-pages/generated/index.js.map +0 -1
  380. package/dist/auth0/generators/react/auth0-pages/generated/template-paths.d.ts +0 -12
  381. package/dist/auth0/generators/react/auth0-pages/generated/template-paths.d.ts.map +0 -1
  382. package/dist/auth0/generators/react/auth0-pages/generated/template-paths.js +0 -20
  383. package/dist/auth0/generators/react/auth0-pages/generated/template-paths.js.map +0 -1
  384. package/dist/auth0/generators/react/auth0-pages/generated/template-renderers.d.ts.map +0 -1
  385. package/dist/auth0/generators/react/auth0-pages/generated/template-renderers.js +0 -37
  386. package/dist/auth0/generators/react/auth0-pages/generated/template-renderers.js.map +0 -1
  387. package/dist/auth0/generators/react/auth0-pages/generated/typed-templates.d.ts +0 -433
  388. package/dist/auth0/generators/react/auth0-pages/generated/typed-templates.d.ts.map +0 -1
  389. package/dist/auth0/generators/react/auth0-pages/generated/typed-templates.js +0 -18
  390. package/dist/auth0/generators/react/auth0-pages/generated/typed-templates.js.map +0 -1
  391. package/dist/auth0/generators/react/auth0-pages/index.d.ts +0 -2
  392. package/dist/auth0/generators/react/auth0-pages/index.d.ts.map +0 -1
  393. package/dist/auth0/generators/react/auth0-pages/index.js +0 -2
  394. package/dist/auth0/generators/react/auth0-pages/index.js.map +0 -1
  395. package/dist/auth0/generators/react/auth0-pages/templates/routes/login.tsx +0 -31
  396. package/dist/auth0/generators/react/index.d.ts +0 -5
  397. package/dist/auth0/generators/react/index.d.ts.map +0 -1
  398. package/dist/auth0/generators/react/index.js +0 -5
  399. package/dist/auth0/generators/react/index.js.map +0 -1
  400. package/dist/auth0/generators/react/react-auth0/generated/index.js +0 -9
  401. package/dist/auth0/generators/react/react-auth0/generated/index.js.map +0 -1
  402. package/dist/auth0/generators/react/react-auth0/generated/template-paths.d.ts +0 -12
  403. package/dist/auth0/generators/react/react-auth0/generated/template-paths.d.ts.map +0 -1
  404. package/dist/auth0/generators/react/react-auth0/generated/template-paths.js +0 -22
  405. package/dist/auth0/generators/react/react-auth0/generated/template-paths.js.map +0 -1
  406. package/dist/auth0/generators/react/react-auth0/generated/template-renderers.d.ts.map +0 -1
  407. package/dist/auth0/generators/react/react-auth0/generated/template-renderers.js +0 -39
  408. package/dist/auth0/generators/react/react-auth0/generated/template-renderers.js.map +0 -1
  409. package/dist/auth0/generators/react/react-auth0/generated/typed-templates.d.ts.map +0 -1
  410. package/dist/auth0/generators/react/react-auth0/generated/typed-templates.js +0 -17
  411. package/dist/auth0/generators/react/react-auth0/generated/typed-templates.js.map +0 -1
  412. package/dist/auth0/generators/react/react-auth0/index.d.ts +0 -2
  413. package/dist/auth0/generators/react/react-auth0/index.d.ts.map +0 -1
  414. package/dist/auth0/generators/react/react-auth0/index.js +0 -2
  415. package/dist/auth0/generators/react/react-auth0/index.js.map +0 -1
  416. package/dist/auth0/generators/react/react-auth0/react-auth0.generator.d.ts.map +0 -1
  417. package/dist/auth0/generators/react/react-auth0/react-auth0.generator.js +0 -107
  418. package/dist/auth0/generators/react/react-auth0/react-auth0.generator.js.map +0 -1
  419. package/dist/auth0/generators/react/react-auth0/templates/src/app/auth-loaded-gate.tsx +0 -78
  420. package/dist/auth0/plugin.json +0 -9
  421. package/dist/auth0/static/icon.svg +0 -7
  422. package/dist/web/assets/__federation_expose_auth0CoreCommon-e_GtBIIm.js +0 -40
  423. package/dist/web/assets/__federation_expose_auth0CoreCommon-e_GtBIIm.js.map +0 -1
  424. package/dist/web/assets/__federation_expose_auth0CoreWeb-CTfPylMw.js +0 -158
  425. package/dist/web/assets/__federation_expose_auth0CoreWeb-CTfPylMw.js.map +0 -1
  426. package/dist/web/assets/__federation_expose_local-authCoreWeb-CaR8fx1f.js +0 -424
  427. package/dist/web/assets/__federation_expose_local-authCoreWeb-CaR8fx1f.js.map +0 -1
  428. package/dist/web/assets/__federation_expose_placeholder-authCoreWeb-VZzvid5j.js.map +0 -1
  429. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-BqJ1vSYx.js.map +0 -1
  430. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-qf98MMJC.js.map +0 -1
  431. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-DFkMnXmX.js.map +0 -1
  432. package/dist/web/assets/__federation_shared_@baseplate-dev/utils-CApJheqk.js.map +0 -1
  433. package/dist/web/assets/__federation_shared_zod-B6wbpZ4f.js.map +0 -1
  434. package/dist/web/assets/index.esm-1qBxxnfu.js.map +0 -1
  435. package/dist/web/assets/isEqual-BQtm2LNT.js.map +0 -1
  436. package/dist/web/assets/model-merger-59HLmy_J.js +0 -1705
  437. package/dist/web/assets/model-merger-59HLmy_J.js.map +0 -1
  438. package/dist/web/assets/plugin-definition-BKCeZ0Ni.js.map +0 -1
  439. package/dist/web/assets/plugin-definition-Bkx-a_wA.js +0 -16
  440. package/dist/web/assets/plugin-definition-Bkx-a_wA.js.map +0 -1
  441. package/dist/web/assets/registries-19UehlAo.js.map +0 -1
  442. package/dist/web/assets/sortBy-BPH_zRB8.js +0 -34
  443. package/dist/web/assets/sortBy-BPH_zRB8.js.map +0 -1
  444. /package/dist/{auth0 → better-auth}/core/common.d.ts +0 -0
  445. /package/dist/{auth0 → better-auth}/core/node.d.ts +0 -0
  446. /package/dist/{auth0 → better-auth}/core/web.d.ts +0 -0
  447. /package/dist/{auth0 → better-auth}/generators/index.d.ts +0 -0
  448. /package/dist/{auth0 → better-auth}/generators/index.js +0 -0
  449. /package/dist/{auth0/generators/react/auth0-hooks → better-auth/generators/react/better-auth-hooks}/templates/src/hooks/use-required-user-id.ts +0 -0
@@ -0,0 +1,694 @@
1
+ import { importShared } from './__federation_fn_import-BLFDCY-V.js';
2
+
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
+
37
+ /**
38
+ * Plugin context module for tracking the current plugin being initialized.
39
+ *
40
+ * Uses a simple synchronous context that works on both Node and browser platforms.
41
+ * This is safe because plugin initialization is synchronous and single-threaded.
42
+ */
43
+ // Simple synchronous context - works on both Node and browser
44
+ // Safe because plugin initialization is synchronous and single-threaded
45
+ let currentPluginContext;
46
+ /**
47
+ * Runs a function within a plugin context.
48
+ *
49
+ * This sets the current plugin context for the duration of the function execution,
50
+ * allowing nested functions to access the plugin key via `getPluginContext()`.
51
+ *
52
+ * @param context - The plugin context to set
53
+ * @param fn - The function to run within the context
54
+ * @returns The result of the function
55
+ */
56
+ function runInPluginContext(context, fn) {
57
+ const prev = currentPluginContext;
58
+ currentPluginContext = context;
59
+ try {
60
+ return fn();
61
+ }
62
+ finally {
63
+ currentPluginContext = prev;
64
+ }
65
+ }
66
+ /**
67
+ * Gets the current plugin context if one exists.
68
+ *
69
+ * @returns The current plugin context, or undefined if not in a plugin context
70
+ */
71
+ function getPluginContext() {
72
+ return currentPluginContext;
73
+ }
74
+
75
+ const {createFieldMap} = await importShared('@baseplate-dev/utils');
76
+ /**
77
+ * Creates a field map that automatically tracks which plugin registered each value.
78
+ *
79
+ * Similar to `createConfigFieldMap` in the sync package, this utility uses the
80
+ * current plugin context to track the source of registrations. This enables
81
+ * clear error messages when registration conflicts occur.
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const fieldMap = createPluginFieldMap((t) => ({
86
+ * transformers: t.map<string, Transformer>(),
87
+ * }));
88
+ *
89
+ * // When a plugin tries to overwrite a value:
90
+ * // Error: Value for key 'myTransformer' has already been set by plugin-auth
91
+ * // and cannot be overwritten by plugin-storage
92
+ * ```
93
+ *
94
+ * @param schemaBuilder - A function that builds the field map schema
95
+ * @returns A field map with automatic source tracking
96
+ */
97
+ function createPluginFieldMap(schemaBuilder) {
98
+ return createFieldMap(schemaBuilder, {
99
+ getDynamicSource: () => getPluginContext()?.pluginKey,
100
+ });
101
+ }
102
+
103
+ /**
104
+ * Creates a plugin spec backed by a FieldMap for automatic source tracking.
105
+ *
106
+ * @param name - Unique identifier for the spec
107
+ * @param schemaBuilder - Function that builds the field map schema
108
+ * @param options - Optional configuration including custom use interface
109
+ */
110
+ function createFieldMapSpec(name, schemaBuilder, options) {
111
+ return createPluginSpec(name, {
112
+ initializer: () => {
113
+ const fieldMap = createPluginFieldMap(schemaBuilder);
114
+ return {
115
+ init: fieldMap,
116
+ use: () => {
117
+ const values = fieldMap.getValues();
118
+ if (options?.use) {
119
+ return options.use(values);
120
+ }
121
+ return values;
122
+ },
123
+ };
124
+ },
125
+ });
126
+ }
127
+
128
+ /**
129
+ * Global registry that stores Baseplate metadata on Zod schema instances.
130
+ *
131
+ * Uses a plain WeakMap to avoid Zod's `$replace<Meta, S>` type substitution
132
+ * which causes "type instantiation excessively deep" errors with complex unions.
133
+ *
134
+ * Stores an array of metadata per schema to support schemas that carry multiple
135
+ * annotations (e.g. a schema that is both an `entity` and a `ref-context`).
136
+ *
137
+ * Used by `withEnt`, `withRef`, `withExpression`, and `refContext` to attach
138
+ * metadata to schema nodes. The parallel schema+data walker reads this registry
139
+ * to extract entity/reference/expression information after validation.
140
+ */
141
+ const definitionRefRegistry = (() => {
142
+ const map = new WeakMap();
143
+ return {
144
+ add(schema, meta) {
145
+ const existing = map.get(schema);
146
+ if (existing) {
147
+ if ((meta.kind === 'entity' || meta.kind === 'reference') &&
148
+ existing.some((e) => e.kind === meta.kind && e.type === meta.type)) {
149
+ throw new Error(`Duplicate definition ref metadata kind "${meta.kind}" for type "${meta.type.name}" on the same schema instance. ` +
150
+ `This usually means a shared/module-level schema was passed to withEnt/withRef multiple times. ` +
151
+ `Create a fresh schema instance instead.`);
152
+ }
153
+ existing.push(meta);
154
+ }
155
+ else {
156
+ map.set(schema, [meta]);
157
+ }
158
+ },
159
+ getAll(schema) {
160
+ return map.get(schema) ?? [];
161
+ },
162
+ has(schema) {
163
+ return map.has(schema);
164
+ },
165
+ };
166
+ })();
167
+
168
+ /**
169
+ * Creates a new ref context slot for the given entity type.
170
+ * Each call creates a unique slot, even for the same entity type.
171
+ *
172
+ * @param name - A descriptive name for debugging (shows in Symbol description)
173
+ * @param entityType - The entity type this slot will be associated with
174
+ * @returns A new unique RefContextSlot instance
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * const modelSlot = createRefContextSlot('modelSlot', modelEntityType);
179
+ * const anotherModelSlot = createRefContextSlot('anotherModelSlot', modelEntityType);
180
+ *
181
+ * // These are different slots despite same entity type
182
+ * modelSlot.id !== anotherModelSlot.id
183
+ * // modelSlot.id.toString() === 'Symbol(modelSlot)'
184
+ * ```
185
+ */
186
+ function createRefContextSlot(name, entityType) {
187
+ return {
188
+ entityType,
189
+ id: Symbol(name),
190
+ };
191
+ }
192
+ /**
193
+ * Creates a RefContextSlotMap from a slot definition.
194
+ * Used internally by ctx.refContext().
195
+ *
196
+ * @param slotDefinition - Map of slot names to entity types
197
+ * @returns Map of slot names to RefContextSlot instances
198
+ */
199
+ function createRefContextSlotMap(slotDefinition) {
200
+ return Object.fromEntries(Object.entries(slotDefinition).map(([key, entityType]) => [
201
+ key,
202
+ createRefContextSlot(key, entityType),
203
+ ]));
204
+ }
205
+
206
+ const {z: z$1} = await importShared('zod');
207
+ /**
208
+ * Creates a string schema annotated as a reference to another entity.
209
+ *
210
+ * Can be used standalone:
211
+ * ```typescript
212
+ * withRef({ type: modelEnumEntityType, onDelete: 'RESTRICT' })
213
+ * ```
214
+ *
215
+ * Or on the parser context:
216
+ * ```typescript
217
+ * ctx.withRef({ type: modelEnumEntityType, onDelete: 'RESTRICT' })
218
+ * ```
219
+ */
220
+ function withRef(reference) {
221
+ const schema = z$1.string().min(1);
222
+ definitionRefRegistry.add(schema, {
223
+ kind: 'reference',
224
+ type: reference.type,
225
+ onDelete: reference.onDelete,
226
+ parentSlot: reference.parentSlot,
227
+ provides: reference.provides,
228
+ });
229
+ return schema;
230
+ }
231
+ /**
232
+ * Creates a schema decorator that marks a schema as defining an entity.
233
+ *
234
+ * Can be used with `.apply()`:
235
+ * ```typescript
236
+ * schema.apply(withEnt({ type: modelEntityType, provides: modelSlot }))
237
+ * ```
238
+ *
239
+ * Or via the parser context (2-arg legacy form):
240
+ * ```typescript
241
+ * ctx.withEnt(schema, { type: modelEntityType, provides: modelSlot })
242
+ * ```
243
+ *
244
+ * @param entity - The entity definition input
245
+ * @returns A function that decorates a schema with entity metadata
246
+ */
247
+ function withEnt(entity) {
248
+ return (schema) => {
249
+ const idPath = entity.idPath ?? ['id'];
250
+ definitionRefRegistry.add(schema, {
251
+ kind: 'entity',
252
+ type: entity.type,
253
+ idPath,
254
+ getNameResolver: entity.getNameResolver,
255
+ parentSlot: entity.parentSlot,
256
+ provides: entity.provides,
257
+ });
258
+ return schema;
259
+ };
260
+ }
261
+ /**
262
+ * Creates ref context slots for use within a schema definition.
263
+ * Slots provide type-safe context for parent-child entity relationships.
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * ctx.refContext(
268
+ * { modelSlot: modelEntityType },
269
+ * ({ modelSlot }) =>
270
+ * ctx.withEnt(schema, {
271
+ * type: modelEntityType,
272
+ * provides: modelSlot,
273
+ * }),
274
+ * );
275
+ * ```
276
+ */
277
+ function refContext(slotDefinition, schemaBuilder) {
278
+ const slots = createRefContextSlotMap(slotDefinition);
279
+ const schema = schemaBuilder(slots);
280
+ definitionRefRegistry.add(schema, {
281
+ kind: 'ref-context',
282
+ slots: Object.values(slots),
283
+ });
284
+ return schema;
285
+ }
286
+ /**
287
+ * Wraps a value with a ref expression parser for deferred validation.
288
+ * The parser handles all parsing, validation, and rename handling.
289
+ *
290
+ * If the parser declares required slots (via TRequiredSlots), they must be
291
+ * provided as the second argument. TypeScript enforces this at compile time.
292
+ *
293
+ * The parser's `createSchema()` method is called to get a fresh schema
294
+ * instance per call site, allowing per-call metadata to be registered
295
+ * independently in the Baseplate registry.
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * // Parser without required slots
300
+ * const expressionSchema = ctx.withExpression(simpleParser);
301
+ *
302
+ * // Parser with required slots (TypeScript enforces the second argument)
303
+ * ctx.refContext(
304
+ * { modelSlot: modelEntityType },
305
+ * ({ modelSlot }) =>
306
+ * z.object({
307
+ * condition: ctx.withExpression(authorizerParser, { model: modelSlot }),
308
+ * })
309
+ * );
310
+ * ```
311
+ */
312
+ function withExpression(parser, slots) {
313
+ // createSchema() returns a fresh instance per call, allowing per-call
314
+ // metadata to be registered without conflicting across call sites.
315
+ const schema = parser.createSchema();
316
+ definitionRefRegistry.add(schema, {
317
+ kind: 'expression',
318
+ parser,
319
+ slots,
320
+ });
321
+ return schema;
322
+ }
323
+ function extendParserContextWithRefs() {
324
+ return {
325
+ withRef,
326
+ // Legacy 2-arg API that delegates to the standalone withEnt decorator.
327
+ // Uses a cast because the standalone accepts DefinitionEntityInput<unknown, ...>
328
+ // while this 2-arg form infers the full z.output<TType> for type-safe idPath.
329
+ withEnt(schema, entity) {
330
+ return schema.apply(withEnt(entity));
331
+ },
332
+ refContext,
333
+ withExpression,
334
+ };
335
+ }
336
+
337
+ /**
338
+ * Registry that stores default-value metadata on Zod schema instances.
339
+ *
340
+ * Uses a WeakMap to avoid interfering with Zod's type system.
341
+ * Annotated by `withDefault()`; read by `cleanDefaultValues()`.
342
+ */
343
+ const definitionDefaultRegistry = (() => {
344
+ const map = new WeakMap();
345
+ return {
346
+ set(schema, meta) {
347
+ map.set(schema, meta);
348
+ },
349
+ get(schema) {
350
+ return map.get(schema);
351
+ },
352
+ };
353
+ })();
354
+
355
+ /**
356
+ * Creates a schema decorator that applies a default value.
357
+ *
358
+ * Uses `prefault` to ensure defaults are populated during Zod parse, and
359
+ * registers the default value in the registry so `cleanDefaultValues()` can
360
+ * strip matching values during serialization.
361
+ *
362
+ * Can be used standalone with `.apply()`:
363
+ * ```typescript
364
+ * z.boolean().apply(withDefault(false))
365
+ * ```
366
+ *
367
+ * @param defaultValue - The default value to apply
368
+ * @returns A function that decorates a schema with the default value
369
+ */
370
+ function withDefault(defaultValue) {
371
+ return (schema) => {
372
+ const result = schema.prefault(defaultValue);
373
+ definitionDefaultRegistry.set(result, { defaultValue });
374
+ return result;
375
+ };
376
+ }
377
+ /**
378
+ * Extends the parser context with default value handling functionality.
379
+ *
380
+ * @returns An object containing the withDefault method
381
+ */
382
+ function extendParserContextWithDefaults() {
383
+ return {
384
+ withDefault: (schema, defaultValue) => withDefault(defaultValue)(schema),
385
+ };
386
+ }
387
+
388
+ const contextCache = new WeakMap();
389
+ function createDefinitionSchemaParserContext(options) {
390
+ const cached = contextCache.get(options.plugins);
391
+ if (cached)
392
+ return cached;
393
+ const context = {
394
+ ...options,
395
+ ...extendParserContextWithRefs(),
396
+ ...extendParserContextWithDefaults(),
397
+ };
398
+ contextCache.set(options.plugins, context);
399
+ return context;
400
+ }
401
+ function definitionSchema(creator) {
402
+ const cache = new WeakMap();
403
+ return (context) => {
404
+ const cached = cache.get(context);
405
+ if (cached)
406
+ return cached;
407
+ const result = creator(context);
408
+ cache.set(context, result);
409
+ return result;
410
+ };
411
+ }
412
+ /**
413
+ * Creates a schema that requires slots to be passed from parent schemas.
414
+ * Used when a schema needs to reference entities from a parent context.
415
+ *
416
+ * @example
417
+ * ```typescript
418
+ * // Child schema requiring modelSlot from parent
419
+ * export const createModelScalarFieldSchema = definitionSchemaWithSlots(
420
+ * { modelSlot: modelEntityType },
421
+ * (ctx, { modelSlot }) =>
422
+ * ctx.withEnt(schema, {
423
+ * type: modelScalarFieldEntityType,
424
+ * parentSlot: modelSlot,
425
+ * }),
426
+ * );
427
+ *
428
+ * // Called from parent:
429
+ * createModelScalarFieldSchema(ctx, { modelSlot: parentModelSlot })
430
+ * ```
431
+ */
432
+ function definitionSchemaWithSlots(slotDefinition, creator) {
433
+ const creatorWithSlots = (context, slots) => creator(context, slots);
434
+ creatorWithSlots.slotDefinition = slotDefinition;
435
+ return creatorWithSlots;
436
+ }
437
+ /**
438
+ * Wraps a schema creator that requires slots with placeholder slots,
439
+ * producing a simple schema creator that can be used for validation-only
440
+ * contexts (e.g., React Hook Form).
441
+ *
442
+ * The placeholder slots allow the schema to parse without actual parent context,
443
+ * which is useful when you only need schema validation without ref extraction.
444
+ *
445
+ * @example
446
+ * ```typescript
447
+ * // Schema that normally requires modelSlot from parent
448
+ * const createModelScalarFieldSchema = definitionSchemaWithSlots(
449
+ * { modelSlot: modelEntityType },
450
+ * (ctx, { modelSlot }) => ctx.withEnt(schema, { parentSlot: modelSlot }),
451
+ * );
452
+ *
453
+ * // For React Hook Form validation, wrap with placeholder slots
454
+ * const fieldSchema = withPlaceholderSlots(createModelScalarFieldSchema);
455
+ * const zodSchema = fieldSchema(ctx); // No slots needed
456
+ * ```
457
+ */
458
+ function withPlaceholderSlots(schemaCreator) {
459
+ return (ctx) => {
460
+ const placeholderSlots = createRefContextSlotMap(schemaCreator.slotDefinition);
461
+ return schemaCreator(ctx, placeholderSlots);
462
+ };
463
+ }
464
+
465
+ const {randomKey} = await importShared('@baseplate-dev/utils');
466
+
467
+ /**
468
+ * Definition of an entity type.
469
+ */
470
+ class DefinitionEntityType {
471
+ prefix;
472
+ name;
473
+ parentType;
474
+ /**
475
+ * Creates a new entity type.
476
+ *
477
+ * @param name - The name of the entity type.
478
+ * @param prefix - The prefix of the entity type to use in the ID, defaults to the name.
479
+ * @param parentType - The type of the parent entity if any
480
+ */
481
+ constructor(name, prefix, parentType) {
482
+ this.name = name;
483
+ this.parentType = parentType;
484
+ this.prefix = prefix ?? name.split('/').pop() ?? name;
485
+ }
486
+ /**
487
+ * Generates a new ID for the entity type.
488
+ *
489
+ * @returns The new ID.
490
+ */
491
+ generateNewId() {
492
+ return `${this.prefix}:${randomKey()}`;
493
+ }
494
+ idFromKey(key) {
495
+ if (!key) {
496
+ return undefined;
497
+ }
498
+ return `${this.prefix}:${key}`;
499
+ }
500
+ keyFromId(id) {
501
+ return id.split(':')[1];
502
+ }
503
+ isId(id) {
504
+ return id.startsWith(`${this.prefix}:`);
505
+ }
506
+ }
507
+ function createEntityType(name, options) {
508
+ const { parentType, prefix } = options ?? {};
509
+ return new DefinitionEntityType(name, prefix, parentType);
510
+ }
511
+
512
+ const {CASE_VALIDATORS} = await importShared('@baseplate-dev/utils');
513
+
514
+ const {z} = await importShared('zod');
515
+ const featureEntityType = createEntityType('feature');
516
+ const featureNameSchema = CASE_VALIDATORS.KEBAB_CASE;
517
+ const createFeatureSchema = definitionSchema((ctx) => ctx.withEnt(z.object({
518
+ id: z.string(),
519
+ name: z
520
+ .string()
521
+ .min(1)
522
+ .refine((name) => name
523
+ .split('/')
524
+ .every((part) => featureNameSchema.safeParse(part).success), {
525
+ message: 'Feature name must be lowercase and contain only letters, numbers, and dashes',
526
+ }),
527
+ parentRef: ctx
528
+ .withRef({
529
+ type: featureEntityType,
530
+ onDelete: 'DELETE_PARENT',
531
+ })
532
+ .optional(),
533
+ }), { type: featureEntityType }));
534
+ const createFeaturesSchema = definitionSchema((ctx) => z.array(createFeatureSchema(ctx)).default([]));
535
+
536
+ function getRootFeatures(projectDefinition) {
537
+ return projectDefinition.features.filter((f) => !f.parentRef);
538
+ }
539
+ function getFeatureById(projectDefinition, featureId) {
540
+ return projectDefinition.features.find((f) => f.id === featureId);
541
+ }
542
+ function getFeatureByIdOrThrow(projectDefinition, featureId) {
543
+ const feature = getFeatureById(projectDefinition, featureId);
544
+ if (!feature) {
545
+ throw new Error(`Could not find feature with ID ${featureId}`);
546
+ }
547
+ return feature;
548
+ }
549
+ function getFeatureChildren(projectDefinition, featureId) {
550
+ return projectDefinition.features.filter((f) => f.parentRef === featureId);
551
+ }
552
+ function getFeatureName(featureConfig) {
553
+ return featureConfig.name.split('/').pop() ?? '';
554
+ }
555
+ function getFeatureNameById(projectDefinition, featureId) {
556
+ const feature = getFeatureByIdOrThrow(projectDefinition, featureId);
557
+ return getFeatureName(feature);
558
+ }
559
+ function getFeaturePathById(projectDefinition, featureId) {
560
+ const feature = getFeatureByIdOrThrow(projectDefinition, featureId);
561
+ return feature.name;
562
+ }
563
+ function validateFeatureName(name) {
564
+ const nameParts = name.split('/');
565
+ return nameParts.every((part) => featureNameSchema.safeParse(part).success);
566
+ }
567
+ function ensureFeatureByNameRecursively(projectDefinition, nameOrId) {
568
+ if (featureEntityType.isId(nameOrId)) {
569
+ return nameOrId;
570
+ }
571
+ const nameParts = nameOrId.split('/');
572
+ let lastName = '';
573
+ let parentRef = undefined;
574
+ for (const part of nameParts) {
575
+ const feature = projectDefinition.features.find((f) => f.name === part && f.parentRef === parentRef);
576
+ const name = [lastName, part].filter(Boolean).join('/');
577
+ if (feature) {
578
+ parentRef = feature.id;
579
+ }
580
+ else {
581
+ const newFeature = {
582
+ id: featureEntityType.generateNewId(),
583
+ name,
584
+ parentRef,
585
+ };
586
+ projectDefinition.features.push(newFeature);
587
+ parentRef = newFeature.id;
588
+ }
589
+ lastName = name;
590
+ }
591
+ if (!parentRef) {
592
+ throw new Error('Failed to create feature');
593
+ }
594
+ return parentRef;
595
+ }
596
+ function getFeatureByName(projectDefinition, name) {
597
+ return projectDefinition.features.find((f) => f.name === name);
598
+ }
599
+ function getFeatureIdByNameOrDefault(projectDefinition, name) {
600
+ return getFeatureByName(projectDefinition, name)?.id ?? name;
601
+ }
602
+ const FeatureUtils = {
603
+ getRootFeatures,
604
+ getFeatureById,
605
+ getFeatureByIdOrThrow,
606
+ getFeatureChildren,
607
+ getFeatureName,
608
+ getFeatureNameById,
609
+ getFeaturePathById,
610
+ validateFeatureName,
611
+ ensureFeatureByNameRecursively,
612
+ getFeatureByName,
613
+ getFeatureIdByNameOrDefault,
614
+ };
615
+
616
+ const {PASCAL_CASE_REGEX} = await importShared('@baseplate-dev/utils');
617
+
618
+ function byId(projectDefinition, id) {
619
+ return projectDefinition.models.find((m) => m.id === id);
620
+ }
621
+ function byIdOrThrow(projectDefinition, id) {
622
+ const model = byId(projectDefinition, id);
623
+ if (!model) {
624
+ throw new Error(`Could not find model with ID ${id}`);
625
+ }
626
+ return model;
627
+ }
628
+ function byName(projectDefinition, name) {
629
+ return projectDefinition.models.find((m) => m.name === name);
630
+ }
631
+ function byNameOrThrow(projectDefinition, name) {
632
+ const model = byName(projectDefinition, name);
633
+ if (!model) {
634
+ throw new Error(`Could not find model with name ${name}`);
635
+ }
636
+ return model;
637
+ }
638
+ function getScalarFieldById(model, id) {
639
+ const field = model.model.fields.find((f) => f.id === id);
640
+ if (!field) {
641
+ throw new Error(`Could not find field with ID ${id}`);
642
+ }
643
+ return field;
644
+ }
645
+ function getRelationsToModel(projectDefinition, modelId) {
646
+ return projectDefinition.models.flatMap((m) => m.model.relations
647
+ .filter((r) => r.modelRef === modelId)
648
+ .map((r) => ({ model: m, relation: r })));
649
+ }
650
+ function getModelsForFeature(projectDefinition, featureId) {
651
+ return projectDefinition.models.filter((m) => m.featureRef === featureId);
652
+ }
653
+ function getModelIdFields(model) {
654
+ return model.model.primaryKeyFieldRefs;
655
+ }
656
+ function hasService(model) {
657
+ return (model.service.create.enabled ||
658
+ model.service.update.enabled ||
659
+ model.service.delete.enabled ||
660
+ model.service.transformers.length > 0);
661
+ }
662
+ function validateModelName(name) {
663
+ return PASCAL_CASE_REGEX.test(name);
664
+ }
665
+ /**
666
+ * Returns the ID of a model by name, or the name if no model is found.
667
+ * @param projectDefinition - The project definition.
668
+ * @param name - The name of the model.
669
+ * @returns The ID of the model, or the name if no model is found.
670
+ */
671
+ function getModelIdByNameOrDefault(projectDefinition, name) {
672
+ return projectDefinition.models.find((m) => m.name === name)?.id ?? name;
673
+ }
674
+ function getPrimaryKeyFields(model) {
675
+ const primaryKeyFields = model.model.primaryKeyFieldRefs;
676
+ return primaryKeyFields.map((id) => getScalarFieldById(model, id));
677
+ }
678
+ const ModelUtils = {
679
+ byId,
680
+ byIdOrThrow,
681
+ byName,
682
+ byNameOrThrow,
683
+ getScalarFieldById,
684
+ getRelationsToModel,
685
+ getModelsForFeature,
686
+ getModelIdFields,
687
+ hasService,
688
+ validateModelName,
689
+ getModelIdByNameOrDefault,
690
+ getPrimaryKeyFields,
691
+ };
692
+
693
+ export { DefinitionEntityType as D, FeatureUtils as F, ModelUtils as M, createEntityType as a, definitionRefRegistry as b, createFieldMapSpec as c, definitionSchemaWithSlots as d, definitionDefaultRegistry as e, definitionSchema as f, featureEntityType as g, createFeaturesSchema as h, createDefinitionSchemaParserContext as i, createFeatureSchema as j, createPluginFieldMap as k, createPluginSpec as l, createRefContextSlot as m, createRefContextSlotMap as n, featureNameSchema as o, getPluginContext as p, withEnt as q, runInPluginContext as r, withPlaceholderSlots as s, withRef as t, withDefault as w };
694
+ //# sourceMappingURL=model-utils-BfcjfzCn.js.map