@nextsparkjs/core 0.1.0-beta.184 → 0.1.0-beta.186

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 (420) hide show
  1. package/dist/components/app/guards/DeveloperGuard.d.ts.map +1 -1
  2. package/dist/components/app/guards/SuperAdminGuard.d.ts.map +1 -1
  3. package/dist/components/app/layouts/PublicFooter.d.ts.map +1 -1
  4. package/dist/components/app/layouts/PublicFooter.js +2 -2
  5. package/dist/components/app/layouts/PublicNavbar.d.ts.map +1 -1
  6. package/dist/components/app/layouts/PublicNavbar.js +2 -2
  7. package/dist/components/app/misc/ThemeToggle.d.ts.map +1 -1
  8. package/dist/components/app/misc/ThemeToggle.js +4 -1
  9. package/dist/components/auth/DevKeyring.d.ts.map +1 -1
  10. package/dist/components/auth/DevKeyring.js +10 -2
  11. package/dist/components/auth/SessionCookieRefresher.d.ts +21 -0
  12. package/dist/components/auth/SessionCookieRefresher.d.ts.map +1 -0
  13. package/dist/components/auth/SessionCookieRefresher.js +11 -0
  14. package/dist/components/auth/forms/LoginForm.d.ts.map +1 -1
  15. package/dist/components/auth/forms/LoginForm.js +300 -6
  16. package/dist/components/auth/index.d.ts +1 -0
  17. package/dist/components/auth/index.d.ts.map +1 -1
  18. package/dist/components/auth/index.js +2 -0
  19. package/dist/components/billing/InvoicesTable.d.ts.map +1 -1
  20. package/dist/components/billing/InvoicesTable.js +4 -3
  21. package/dist/components/dashboard/block-editor/dynamic-form.d.ts.map +1 -1
  22. package/dist/components/dashboard/layouts/AuthGuard.d.ts.map +1 -1
  23. package/dist/components/dashboard/layouts/AuthGuard.js +2 -2
  24. package/dist/components/dashboard/layouts/DashboardAuthLayout.d.ts.map +1 -1
  25. package/dist/components/dashboard/layouts/DashboardAuthLayout.js +2 -2
  26. package/dist/components/dashboard/layouts/DashboardAuthSkeleton.d.ts +17 -0
  27. package/dist/components/dashboard/layouts/DashboardAuthSkeleton.d.ts.map +1 -0
  28. package/dist/components/dashboard/layouts/DashboardAuthSkeleton.js +52 -0
  29. package/dist/components/dashboard/layouts/Sidebar.d.ts.map +1 -1
  30. package/dist/components/dashboard/layouts/Sidebar.js +2 -3
  31. package/dist/components/dashboard/layouts/TopNavbar.js +2 -2
  32. package/dist/components/dashboard/layouts/index.d.ts +1 -0
  33. package/dist/components/dashboard/layouts/index.d.ts.map +1 -1
  34. package/dist/components/dashboard/layouts/index.js +2 -0
  35. package/dist/components/entities/EntityFieldRenderer.d.ts.map +1 -1
  36. package/dist/components/entities/EntityFieldRenderer.js +3 -0
  37. package/dist/components/entities/EntityTable.d.ts.map +1 -1
  38. package/dist/components/entities/EntityTable.js +2 -1
  39. package/dist/components/entities/wrappers/EntityFormWrapper.d.ts.map +1 -1
  40. package/dist/components/entities/wrappers/EntityFormWrapper.js +7 -2
  41. package/dist/components/ui/combobox.d.ts +8 -1
  42. package/dist/components/ui/combobox.d.ts.map +1 -1
  43. package/dist/components/ui/combobox.js +37 -44
  44. package/dist/components/ui/country-select.d.ts +3 -1
  45. package/dist/components/ui/country-select.d.ts.map +1 -1
  46. package/dist/components/ui/country-select.js +3 -1
  47. package/dist/components/ui/currency-select.d.ts +3 -1
  48. package/dist/components/ui/currency-select.d.ts.map +1 -1
  49. package/dist/components/ui/currency-select.js +3 -1
  50. package/dist/components/ui/sheet.d.ts +5 -0
  51. package/dist/components/ui/sheet.d.ts.map +1 -1
  52. package/dist/components/ui/sheet.js +46 -26
  53. package/dist/components/ui/timezone-select.d.ts +3 -1
  54. package/dist/components/ui/timezone-select.d.ts.map +1 -1
  55. package/dist/components/ui/timezone-select.js +3 -1
  56. package/dist/contexts/TeamContext.d.ts +6 -0
  57. package/dist/contexts/TeamContext.d.ts.map +1 -1
  58. package/dist/contexts/TeamContext.js +8 -1
  59. package/dist/emails/otp-verification.d.ts.map +1 -1
  60. package/dist/emails/reset-password.d.ts.map +1 -1
  61. package/dist/emails/team-invitation.d.ts.map +1 -1
  62. package/dist/emails/team-invitation.js +3 -2
  63. package/dist/emails/verify-email.d.ts.map +1 -1
  64. package/dist/hooks/index.d.ts +1 -0
  65. package/dist/hooks/index.d.ts.map +1 -1
  66. package/dist/hooks/index.js +1 -0
  67. package/dist/hooks/useAuth.d.ts +103 -25
  68. package/dist/hooks/useAuth.d.ts.map +1 -1
  69. package/dist/hooks/useAuth.js +24 -0
  70. package/dist/hooks/useEnsureUserMetadata.d.ts +22 -0
  71. package/dist/hooks/useEnsureUserMetadata.d.ts.map +1 -1
  72. package/dist/hooks/useEnsureUserMetadata.js +18 -5
  73. package/dist/hooks/useSessionCookieRefresh.d.ts +35 -0
  74. package/dist/hooks/useSessionCookieRefresh.d.ts.map +1 -0
  75. package/dist/hooks/useSessionCookieRefresh.js +49 -0
  76. package/dist/hooks/useValidationSchemas.d.ts +7 -7
  77. package/dist/lib/api/api-error.d.ts +3 -1
  78. package/dist/lib/api/api-error.d.ts.map +1 -1
  79. package/dist/lib/api/api-error.js +4 -2
  80. package/dist/lib/api/auth/dual-auth.d.ts +45 -3
  81. package/dist/lib/api/auth/dual-auth.d.ts.map +1 -1
  82. package/dist/lib/api/auth/dual-auth.js +42 -7
  83. package/dist/lib/api/auth/permissions.d.ts +7 -2
  84. package/dist/lib/api/auth/permissions.d.ts.map +1 -1
  85. package/dist/lib/api/auth/permissions.js +2 -2
  86. package/dist/lib/api/auth/scope-policy.d.ts +71 -0
  87. package/dist/lib/api/auth/scope-policy.d.ts.map +1 -0
  88. package/dist/lib/api/auth/scope-policy.js +53 -0
  89. package/dist/lib/api/auth.d.ts +35 -3
  90. package/dist/lib/api/auth.d.ts.map +1 -1
  91. package/dist/lib/api/auth.js +54 -23
  92. package/dist/lib/api/entity/audit-log.d.ts +35 -0
  93. package/dist/lib/api/entity/audit-log.d.ts.map +1 -0
  94. package/dist/lib/api/entity/audit-log.js +35 -0
  95. package/dist/lib/api/entity/generic-handler.d.ts.map +1 -1
  96. package/dist/lib/api/entity/generic-handler.js +333 -155
  97. package/dist/lib/api/helpers.d.ts +29 -4
  98. package/dist/lib/api/helpers.d.ts.map +1 -1
  99. package/dist/lib/api/helpers.js +30 -6
  100. package/dist/lib/api/keys.d.ts +16 -0
  101. package/dist/lib/api/keys.d.ts.map +1 -1
  102. package/dist/lib/api/keys.js +19 -1
  103. package/dist/lib/api/routes/patterns-usages.d.ts.map +1 -1
  104. package/dist/lib/api/routes/patterns-usages.js +3 -11
  105. package/dist/lib/auth/auth-methods.d.ts +52 -0
  106. package/dist/lib/auth/auth-methods.d.ts.map +1 -0
  107. package/dist/lib/auth/auth-methods.js +63 -0
  108. package/dist/lib/auth/registration-guard-plugin.d.ts.map +1 -1
  109. package/dist/lib/auth/registration-helpers.d.ts +9 -0
  110. package/dist/lib/auth/registration-helpers.d.ts.map +1 -1
  111. package/dist/lib/auth/registration-helpers.js +8 -2
  112. package/dist/lib/auth/security-notifications/device-fingerprint.d.ts +52 -0
  113. package/dist/lib/auth/security-notifications/device-fingerprint.d.ts.map +1 -0
  114. package/dist/lib/auth/security-notifications/device-fingerprint.js +42 -0
  115. package/dist/lib/auth/security-notifications/dispatcher.d.ts +37 -0
  116. package/dist/lib/auth/security-notifications/dispatcher.d.ts.map +1 -0
  117. package/dist/lib/auth/security-notifications/dispatcher.js +157 -0
  118. package/dist/lib/auth/security-notifications/index.d.ts +20 -0
  119. package/dist/lib/auth/security-notifications/index.d.ts.map +1 -0
  120. package/dist/lib/auth/security-notifications/index.js +22 -0
  121. package/dist/lib/auth/security-notifications/registry.d.ts +36 -0
  122. package/dist/lib/auth/security-notifications/registry.d.ts.map +1 -0
  123. package/dist/lib/auth/security-notifications/registry.js +26 -0
  124. package/dist/lib/auth/security-notifications/templates/email-changed.d.ts +12 -0
  125. package/dist/lib/auth/security-notifications/templates/email-changed.d.ts.map +1 -0
  126. package/dist/lib/auth/security-notifications/templates/email-changed.js +43 -0
  127. package/dist/lib/auth/security-notifications/templates/new-device-login.d.ts +7 -0
  128. package/dist/lib/auth/security-notifications/templates/new-device-login.d.ts.map +1 -0
  129. package/dist/lib/auth/security-notifications/templates/new-device-login.js +46 -0
  130. package/dist/lib/auth/security-notifications/templates/password-changed.d.ts +7 -0
  131. package/dist/lib/auth/security-notifications/templates/password-changed.d.ts.map +1 -0
  132. package/dist/lib/auth/security-notifications/templates/password-changed.js +35 -0
  133. package/dist/lib/auth/security-notifications/templates/shared.d.ts +36 -0
  134. package/dist/lib/auth/security-notifications/templates/shared.d.ts.map +1 -0
  135. package/dist/lib/auth/security-notifications/templates/shared.js +68 -0
  136. package/dist/lib/auth/security-notifications/types.d.ts +74 -0
  137. package/dist/lib/auth/security-notifications/types.d.ts.map +1 -0
  138. package/dist/lib/auth/security-notifications/types.js +0 -0
  139. package/dist/lib/auth/session-config.d.ts +37 -0
  140. package/dist/lib/auth/session-config.d.ts.map +1 -0
  141. package/dist/lib/auth/session-config.js +59 -0
  142. package/dist/lib/auth/session-refresh.d.ts +46 -0
  143. package/dist/lib/auth/session-refresh.d.ts.map +1 -0
  144. package/dist/lib/auth/session-refresh.js +11 -0
  145. package/dist/lib/auth-client.d.ts +1489 -3445
  146. package/dist/lib/auth-client.d.ts.map +1 -1
  147. package/dist/lib/auth-client.js +4 -0
  148. package/dist/lib/auth.d.ts +1 -3057
  149. package/dist/lib/auth.d.ts.map +1 -1
  150. package/dist/lib/auth.js +21 -8
  151. package/dist/lib/billing/gateways/factory.d.ts +8 -3
  152. package/dist/lib/billing/gateways/factory.d.ts.map +1 -1
  153. package/dist/lib/billing/gateways/factory.js +37 -23
  154. package/dist/lib/billing/schema.d.ts +1 -1
  155. package/dist/lib/billing/stripe-webhook.d.ts.map +1 -1
  156. package/dist/lib/billing/stripe-webhook.js +2 -1
  157. package/dist/lib/config/app.config.d.ts.map +1 -1
  158. package/dist/lib/config/app.config.js +71 -0
  159. package/dist/lib/config/config-sync.d.ts +1 -4
  160. package/dist/lib/config/config-sync.d.ts.map +1 -1
  161. package/dist/lib/config/config-sync.js +6 -2
  162. package/dist/lib/config/types.d.ts +130 -0
  163. package/dist/lib/config/types.d.ts.map +1 -1
  164. package/dist/lib/entities/entity-hooks.d.ts +9 -1
  165. package/dist/lib/entities/entity-hooks.d.ts.map +1 -1
  166. package/dist/lib/entities/entity-hooks.js +77 -4
  167. package/dist/lib/entities/schema-generator.d.ts.map +1 -1
  168. package/dist/lib/entities/schema-generator.js +20 -4
  169. package/dist/lib/entities/serialization.d.ts +2 -2
  170. package/dist/lib/entities/serialization.d.ts.map +1 -1
  171. package/dist/lib/entities/serialization.js +3 -2
  172. package/dist/lib/entities/types.d.ts +8 -0
  173. package/dist/lib/entities/types.d.ts.map +1 -1
  174. package/dist/lib/locale.d.ts.map +1 -1
  175. package/dist/lib/locale.js +4 -1
  176. package/dist/lib/mcp/audit.d.ts +21 -0
  177. package/dist/lib/mcp/audit.d.ts.map +1 -0
  178. package/dist/lib/mcp/audit.js +48 -0
  179. package/dist/lib/mcp/engine.d.ts +28 -0
  180. package/dist/lib/mcp/engine.d.ts.map +1 -0
  181. package/dist/lib/mcp/engine.js +158 -0
  182. package/dist/lib/mcp/errors.d.ts +16 -0
  183. package/dist/lib/mcp/errors.d.ts.map +1 -0
  184. package/dist/lib/mcp/errors.js +66 -0
  185. package/dist/lib/mcp/executor.d.ts +15 -0
  186. package/dist/lib/mcp/executor.d.ts.map +1 -0
  187. package/dist/lib/mcp/executor.js +63 -0
  188. package/dist/lib/mcp/index.d.ts +9 -0
  189. package/dist/lib/mcp/index.d.ts.map +1 -0
  190. package/dist/lib/mcp/index.js +32 -0
  191. package/dist/lib/mcp/schema-builder.d.ts +45 -0
  192. package/dist/lib/mcp/schema-builder.d.ts.map +1 -0
  193. package/dist/lib/mcp/schema-builder.js +212 -0
  194. package/dist/lib/mcp/tool-generator.d.ts +31 -0
  195. package/dist/lib/mcp/tool-generator.d.ts.map +1 -0
  196. package/dist/lib/mcp/tool-generator.js +271 -0
  197. package/dist/lib/mcp/transport.d.ts +31 -0
  198. package/dist/lib/mcp/transport.d.ts.map +1 -0
  199. package/dist/lib/mcp/transport.js +58 -0
  200. package/dist/lib/mcp/types.d.ts +184 -0
  201. package/dist/lib/mcp/types.d.ts.map +1 -0
  202. package/dist/lib/mcp/types.js +11 -0
  203. package/dist/lib/plugins/hook-system.d.ts +13 -0
  204. package/dist/lib/plugins/hook-system.d.ts.map +1 -1
  205. package/dist/lib/plugins/hook-system.js +32 -2
  206. package/dist/lib/scheduled-actions/handlers/index.d.ts +1 -0
  207. package/dist/lib/scheduled-actions/handlers/index.d.ts.map +1 -1
  208. package/dist/lib/scheduled-actions/handlers/index.js +3 -1
  209. package/dist/lib/scheduled-actions/handlers/security-notification.d.ts +26 -0
  210. package/dist/lib/scheduled-actions/handlers/security-notification.d.ts.map +1 -0
  211. package/dist/lib/scheduled-actions/handlers/security-notification.js +54 -0
  212. package/dist/lib/selectors/core-selectors.d.ts +12 -0
  213. package/dist/lib/selectors/core-selectors.d.ts.map +1 -1
  214. package/dist/lib/selectors/domains/auth.selectors.d.ts +12 -0
  215. package/dist/lib/selectors/domains/auth.selectors.d.ts.map +1 -1
  216. package/dist/lib/selectors/domains/auth.selectors.js +14 -1
  217. package/dist/lib/selectors/selectors.d.ts +24 -0
  218. package/dist/lib/selectors/selectors.d.ts.map +1 -1
  219. package/dist/lib/services/generic-entity.service.d.ts.map +1 -1
  220. package/dist/lib/services/generic-entity.service.js +16 -32
  221. package/dist/lib/services/membership.service.d.ts +10 -2
  222. package/dist/lib/services/membership.service.d.ts.map +1 -1
  223. package/dist/lib/services/membership.service.js +37 -16
  224. package/dist/lib/services/subscription.service.d.ts.map +1 -1
  225. package/dist/lib/services/subscription.service.js +2 -1
  226. package/dist/lib/services/team-member.service.d.ts +15 -3
  227. package/dist/lib/services/team-member.service.d.ts.map +1 -1
  228. package/dist/lib/services/team-member.service.js +27 -6
  229. package/dist/lib/services/team.service.d.ts.map +1 -1
  230. package/dist/lib/teams/permissions.d.ts +3 -1
  231. package/dist/lib/teams/permissions.d.ts.map +1 -1
  232. package/dist/lib/teams/permissions.js +6 -0
  233. package/dist/lib/teams/schema.d.ts.map +1 -1
  234. package/dist/lib/teams/schema.js +3 -0
  235. package/dist/lib/theme/forced-theme.d.ts +34 -0
  236. package/dist/lib/theme/forced-theme.d.ts.map +1 -0
  237. package/dist/lib/theme/forced-theme.js +27 -0
  238. package/dist/lib/theme/get-default-theme-mode.d.ts +3 -0
  239. package/dist/lib/theme/get-default-theme-mode.d.ts.map +1 -1
  240. package/dist/lib/theme/get-default-theme-mode.js +5 -3
  241. package/dist/messages/de/auth.json +25 -2
  242. package/dist/messages/de/index.d.ts +81 -0
  243. package/dist/messages/de/index.d.ts.map +1 -1
  244. package/dist/messages/de/index.js +2 -0
  245. package/dist/messages/de/index.ts +2 -0
  246. package/dist/messages/en/auth.json +25 -2
  247. package/dist/messages/en/index.d.ts +81 -0
  248. package/dist/messages/en/index.d.ts.map +1 -1
  249. package/dist/messages/en/index.js +2 -0
  250. package/dist/messages/en/index.ts +2 -0
  251. package/dist/messages/es/auth.json +25 -2
  252. package/dist/messages/es/index.d.ts +81 -0
  253. package/dist/messages/es/index.d.ts.map +1 -1
  254. package/dist/messages/es/index.js +2 -0
  255. package/dist/messages/es/index.ts +2 -0
  256. package/dist/messages/fr/auth.json +25 -2
  257. package/dist/messages/fr/index.d.ts +81 -0
  258. package/dist/messages/fr/index.d.ts.map +1 -1
  259. package/dist/messages/fr/index.js +2 -0
  260. package/dist/messages/fr/index.ts +2 -0
  261. package/dist/messages/it/auth.json +25 -2
  262. package/dist/messages/it/index.d.ts +81 -0
  263. package/dist/messages/it/index.d.ts.map +1 -1
  264. package/dist/messages/it/index.js +2 -0
  265. package/dist/messages/it/index.ts +2 -0
  266. package/dist/messages/pt/auth.json +25 -2
  267. package/dist/messages/pt/index.d.ts +81 -0
  268. package/dist/messages/pt/index.d.ts.map +1 -1
  269. package/dist/messages/pt/index.js +2 -0
  270. package/dist/messages/pt/index.ts +2 -0
  271. package/dist/migrations/005_api_audit_log.sql +2 -1
  272. package/dist/migrations/025_api_audit_log_nullable_api_key.sql +12 -0
  273. package/dist/migrations/026_login_events.sql +91 -0
  274. package/dist/migrations/027_rls_bypass_developer_and_system_admin_team.sql +197 -0
  275. package/dist/providers/DashboardProviders.d.ts +12 -3
  276. package/dist/providers/DashboardProviders.d.ts.map +1 -1
  277. package/dist/providers/DashboardProviders.js +6 -2
  278. package/dist/providers/theme-provider.d.ts +19 -2
  279. package/dist/providers/theme-provider.d.ts.map +1 -1
  280. package/dist/providers/theme-provider.js +6 -2
  281. package/dist/templates/app/(auth)/signup/page.tsx +8 -0
  282. package/dist/templates/app/(public)/[...slug]/page.tsx +9 -14
  283. package/dist/templates/app/api/auth/[...all]/route.ts +23 -1
  284. package/dist/templates/app/api/health/route.ts +4 -2
  285. package/dist/templates/app/api/internal/user-metadata/route.ts +5 -3
  286. package/dist/templates/app/api/mcp/route.ts +176 -0
  287. package/dist/templates/app/api/superadmin/subscriptions/route.ts +2 -1
  288. package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +4 -3
  289. package/dist/templates/app/api/superadmin/users/[userId]/route.ts +10 -3
  290. package/dist/templates/app/api/v1/api-keys/[id]/route.ts +50 -71
  291. package/dist/templates/app/api/v1/api-keys/route.ts +35 -45
  292. package/dist/templates/app/api/v1/auth/signup-with-invite/route.ts +14 -14
  293. package/dist/templates/app/api/v1/billing/cancel/route.ts +7 -6
  294. package/dist/templates/app/api/v1/billing/change-plan/route.ts +5 -4
  295. package/dist/templates/app/api/v1/billing/check-action/route.ts +6 -4
  296. package/dist/templates/app/api/v1/billing/checkout/route.ts +7 -5
  297. package/dist/templates/app/api/v1/billing/plans/route.ts +8 -12
  298. package/dist/templates/app/api/v1/billing/portal/route.ts +7 -5
  299. package/dist/templates/app/api/v1/billing/webhooks/polar/route.ts +1 -1
  300. package/dist/templates/app/api/v1/devtools/blocks/route.ts +5 -4
  301. package/dist/templates/app/api/v1/devtools/features/route.ts +5 -4
  302. package/dist/templates/app/api/v1/devtools/flows/route.ts +5 -4
  303. package/dist/templates/app/api/v1/devtools/scheduled-actions/route.ts +9 -7
  304. package/dist/templates/app/api/v1/devtools/scheduled-actions/run/route.ts +5 -4
  305. package/dist/templates/app/api/v1/devtools/testing/route.ts +5 -4
  306. package/dist/templates/app/api/v1/media/[id]/route.ts +13 -25
  307. package/dist/templates/app/api/v1/media/[id]/tags/route.ts +17 -25
  308. package/dist/templates/app/api/v1/media/check-duplicates/route.ts +5 -7
  309. package/dist/templates/app/api/v1/media/route.ts +5 -9
  310. package/dist/templates/app/api/v1/media/upload/route.ts +9 -21
  311. package/dist/templates/app/api/v1/media-tags/route.ts +9 -13
  312. package/dist/templates/app/api/v1/patterns/[id]/usages/route.ts +11 -19
  313. package/dist/templates/app/api/v1/post-categories/[id]/route.ts +9 -7
  314. package/dist/templates/app/api/v1/post-categories/route.ts +5 -4
  315. package/dist/templates/app/api/v1/team-invitations/[token]/accept/route.ts +16 -18
  316. package/dist/templates/app/api/v1/team-invitations/[token]/decline/route.ts +15 -17
  317. package/dist/templates/app/api/v1/team-invitations/[token]/route.ts +8 -8
  318. package/dist/templates/app/api/v1/team-invitations/route.ts +9 -11
  319. package/dist/templates/app/api/v1/teams/[teamId]/invitations/route.ts +41 -32
  320. package/dist/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +15 -16
  321. package/dist/templates/app/api/v1/teams/[teamId]/invoices/route.ts +14 -15
  322. package/dist/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +32 -36
  323. package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +33 -33
  324. package/dist/templates/app/api/v1/teams/[teamId]/route.ts +35 -41
  325. package/dist/templates/app/api/v1/teams/[teamId]/subscription/route.ts +5 -3
  326. package/dist/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +10 -6
  327. package/dist/templates/app/api/v1/teams/route.ts +33 -27
  328. package/dist/templates/app/api/v1/teams/switch/route.ts +11 -13
  329. package/dist/templates/app/api/v1/theme/[...path]/route.ts +23 -2
  330. package/dist/templates/app/api/v1/users/[id]/meta/[key]/route.ts +32 -77
  331. package/dist/templates/app/api/v1/users/[id]/route.ts +35 -68
  332. package/dist/templates/app/api/v1/users/route.ts +21 -25
  333. package/dist/templates/app/dashboard/layout.tsx +2 -6
  334. package/dist/templates/app/layout.ppr.tsx +9 -14
  335. package/dist/templates/app/layout.tsx +39 -19
  336. package/dist/templates/contents/themes/starter/config/app.config.ts +19 -0
  337. package/dist/templates/contents/themes/starter/config/theme.config.ts +6 -0
  338. package/dist/templates/contents/themes/starter/styles/globals.css +6 -2
  339. package/dist/templates/proxy.ts +46 -10
  340. package/dist/templates/tsconfig.json +4 -0
  341. package/dist/types/theme.d.ts +9 -0
  342. package/dist/types/theme.d.ts.map +1 -1
  343. package/migrations/005_api_audit_log.sql +2 -1
  344. package/migrations/025_api_audit_log_nullable_api_key.sql +12 -0
  345. package/migrations/026_login_events.sql +91 -0
  346. package/migrations/027_rls_bypass_developer_and_system_admin_team.sql +197 -0
  347. package/package.json +20 -12
  348. package/scripts/build/registry/__tests__/mcp-registry.test.mjs +64 -0
  349. package/scripts/build/registry/__tests__/scope-registry.test.mjs +106 -0
  350. package/scripts/build/registry/discovery/mcp-overrides.mjs +72 -0
  351. package/scripts/build/registry/discovery/mcp-overrides.test.mjs +86 -0
  352. package/scripts/build/registry/generators/mcp-registry.mjs +61 -0
  353. package/scripts/build/registry/generators/scope-registry.mjs +140 -88
  354. package/scripts/build/registry.mjs +8 -4
  355. package/templates/app/(auth)/signup/page.tsx +8 -0
  356. package/templates/app/(public)/[...slug]/page.tsx +9 -14
  357. package/templates/app/api/auth/[...all]/route.ts +23 -1
  358. package/templates/app/api/health/route.ts +4 -2
  359. package/templates/app/api/internal/user-metadata/route.ts +5 -3
  360. package/templates/app/api/mcp/route.ts +176 -0
  361. package/templates/app/api/superadmin/subscriptions/route.ts +2 -1
  362. package/templates/app/api/superadmin/teams/[teamId]/route.ts +4 -3
  363. package/templates/app/api/superadmin/users/[userId]/route.ts +10 -3
  364. package/templates/app/api/v1/api-keys/[id]/route.ts +50 -71
  365. package/templates/app/api/v1/api-keys/route.ts +35 -45
  366. package/templates/app/api/v1/auth/signup-with-invite/route.ts +14 -14
  367. package/templates/app/api/v1/billing/cancel/route.ts +7 -6
  368. package/templates/app/api/v1/billing/change-plan/route.ts +5 -4
  369. package/templates/app/api/v1/billing/check-action/route.ts +6 -4
  370. package/templates/app/api/v1/billing/checkout/route.ts +7 -5
  371. package/templates/app/api/v1/billing/plans/route.ts +8 -12
  372. package/templates/app/api/v1/billing/portal/route.ts +7 -5
  373. package/templates/app/api/v1/billing/webhooks/polar/route.ts +1 -1
  374. package/templates/app/api/v1/devtools/blocks/route.ts +5 -4
  375. package/templates/app/api/v1/devtools/features/route.ts +5 -4
  376. package/templates/app/api/v1/devtools/flows/route.ts +5 -4
  377. package/templates/app/api/v1/devtools/scheduled-actions/route.ts +9 -7
  378. package/templates/app/api/v1/devtools/scheduled-actions/run/route.ts +5 -4
  379. package/templates/app/api/v1/devtools/testing/route.ts +5 -4
  380. package/templates/app/api/v1/media/[id]/route.ts +13 -25
  381. package/templates/app/api/v1/media/[id]/tags/route.ts +17 -25
  382. package/templates/app/api/v1/media/check-duplicates/route.ts +5 -7
  383. package/templates/app/api/v1/media/route.ts +5 -9
  384. package/templates/app/api/v1/media/upload/route.ts +9 -21
  385. package/templates/app/api/v1/media-tags/route.ts +9 -13
  386. package/templates/app/api/v1/patterns/[id]/usages/route.ts +11 -19
  387. package/templates/app/api/v1/post-categories/[id]/route.ts +9 -7
  388. package/templates/app/api/v1/post-categories/route.ts +5 -4
  389. package/templates/app/api/v1/team-invitations/[token]/accept/route.ts +16 -18
  390. package/templates/app/api/v1/team-invitations/[token]/decline/route.ts +15 -17
  391. package/templates/app/api/v1/team-invitations/[token]/route.ts +8 -8
  392. package/templates/app/api/v1/team-invitations/route.ts +9 -11
  393. package/templates/app/api/v1/teams/[teamId]/invitations/route.ts +41 -32
  394. package/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +15 -16
  395. package/templates/app/api/v1/teams/[teamId]/invoices/route.ts +14 -15
  396. package/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +32 -36
  397. package/templates/app/api/v1/teams/[teamId]/members/route.ts +33 -33
  398. package/templates/app/api/v1/teams/[teamId]/route.ts +35 -41
  399. package/templates/app/api/v1/teams/[teamId]/subscription/route.ts +5 -3
  400. package/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +10 -6
  401. package/templates/app/api/v1/teams/route.ts +33 -27
  402. package/templates/app/api/v1/teams/switch/route.ts +11 -13
  403. package/templates/app/api/v1/theme/[...path]/route.ts +23 -2
  404. package/templates/app/api/v1/users/[id]/meta/[key]/route.ts +32 -77
  405. package/templates/app/api/v1/users/[id]/route.ts +35 -68
  406. package/templates/app/api/v1/users/route.ts +21 -25
  407. package/templates/app/dashboard/layout.tsx +2 -6
  408. package/templates/app/layout.ppr.tsx +9 -14
  409. package/templates/app/layout.tsx +39 -19
  410. package/templates/contents/themes/starter/config/app.config.ts +19 -0
  411. package/templates/contents/themes/starter/config/theme.config.ts +6 -0
  412. package/templates/contents/themes/starter/styles/globals.css +6 -2
  413. package/templates/proxy.ts +46 -10
  414. package/templates/tsconfig.json +4 -0
  415. package/tests/jest/__mocks__/@nextsparkjs/registries/permissions-registry.ts +23 -0
  416. package/tests/jest/__mocks__/@nextsparkjs/registries/scope-registry.ts +56 -6
  417. package/tests/jest/__mocks__/next-server.js +24 -0
  418. package/dist/styles/classes.json +0 -1093
  419. package/dist/styles/ui.css +0 -2
  420. package/scripts/build/build-ui-css.mjs +0 -351
@@ -0,0 +1,271 @@
1
+ import { z } from "zod";
2
+ import { buildEntitySchemas } from "./schema-builder.js";
3
+ import { translateApiError } from "./errors.js";
4
+ import {
5
+ McpToolError
6
+ } from "./types.js";
7
+ function generateEntityTools(entityConfig, operations, override, deps) {
8
+ const schemas = buildEntitySchemas(entityConfig, {
9
+ translateOption: deps.translateOption,
10
+ override
11
+ });
12
+ const slug = entityConfig.slug;
13
+ const singular = toolToken(entityConfig.names.singular);
14
+ const plural = toolToken(slug);
15
+ const entityDescription = buildEntityDescription(entityConfig, override, deps.presets);
16
+ const tools = [];
17
+ const make = (operation, name, title, description, inputSchema, strictSchema, annotations, run) => {
18
+ var _a, _b;
19
+ return {
20
+ name,
21
+ title,
22
+ description: ((_b = (_a = override == null ? void 0 : override.describe) == null ? void 0 : _a.tools) == null ? void 0 : _b[operation]) ?? description,
23
+ inputSchema,
24
+ strictSchema,
25
+ annotations,
26
+ meta: { entitySlug: slug, operation },
27
+ handler: async (rawArgs, ctx) => {
28
+ const parsed = strictSchema.safeParse(rawArgs ?? {});
29
+ if (!parsed.success) {
30
+ return errorResult(
31
+ `Argumentos inv\xE1lidos para ${name}: ${formatZodIssues(parsed.error)}. Revis\xE1 el schema de la tool.`
32
+ );
33
+ }
34
+ try {
35
+ return await run(parsed.data, ctx);
36
+ } catch (error) {
37
+ if (error instanceof McpToolError) return errorResult(error.message);
38
+ console.error(`[mcp] unexpected error in ${name}:`, error);
39
+ return errorResult(
40
+ `Error inesperado ejecutando ${name}: ${error instanceof Error ? error.message : String(error)}`
41
+ );
42
+ }
43
+ }
44
+ };
45
+ };
46
+ const apiError = (result, operation) => errorResult(
47
+ translateApiError(result, { slug, operation, hints: override == null ? void 0 : override.errorHints })
48
+ );
49
+ if (operations.includes("list")) {
50
+ tools.push(
51
+ make(
52
+ "list",
53
+ `${deps.toolPrefix}_list_${plural}`,
54
+ `List ${entityConfig.names.plural}`,
55
+ `Lista ${entityConfig.names.plural} con paginaci\xF3n, orden y filtros. ${entityDescription}${presetExamples(deps.presets, "GET")}`,
56
+ schemas.listShape,
57
+ schemas.listStrict,
58
+ { readOnlyHint: true },
59
+ async (args, ctx) => {
60
+ const query = listArgsToQuery(args);
61
+ const result = await deps.executor({ slug, operation: "list", query }, ctx);
62
+ if (!result.body.success) return apiError(result, "list");
63
+ const data = normalizeOutput(result.body.data);
64
+ const info = result.body.info ?? {};
65
+ const total = info.total ?? (Array.isArray(data) ? data.length : "?");
66
+ const page = info.page ?? 1;
67
+ const totalPages = info.totalPages ?? 1;
68
+ return {
69
+ content: [
70
+ {
71
+ type: "text",
72
+ text: `${String(total)} ${entityConfig.names.plural} (p\xE1gina ${String(page)}/${String(totalPages)})`
73
+ }
74
+ ],
75
+ structuredContent: { data, info }
76
+ };
77
+ }
78
+ )
79
+ );
80
+ }
81
+ if (operations.includes("get")) {
82
+ tools.push(
83
+ make(
84
+ "get",
85
+ `${deps.toolPrefix}_get_${singular}`,
86
+ `Get ${entityConfig.names.singular}`,
87
+ `Obtiene un registro de ${entityConfig.names.singular} por ID. ${entityDescription}`,
88
+ schemas.getShape,
89
+ schemas.getStrict,
90
+ { readOnlyHint: true },
91
+ async (args, ctx) => {
92
+ const result = await deps.executor(
93
+ { slug, operation: "get", id: String(args.id) },
94
+ ctx
95
+ );
96
+ if (!result.body.success) return apiError(result, "get");
97
+ const data = normalizeOutput(result.body.data);
98
+ return {
99
+ content: [{ type: "text", text: `${entityConfig.names.singular} encontrado.` }],
100
+ structuredContent: { data }
101
+ };
102
+ }
103
+ )
104
+ );
105
+ }
106
+ if (operations.includes("create")) {
107
+ tools.push(
108
+ make(
109
+ "create",
110
+ `${deps.toolPrefix}_create_${singular}`,
111
+ `Create ${entityConfig.names.singular}`,
112
+ `Crea un registro de ${entityConfig.names.singular}. ${entityDescription}${presetExamples(deps.presets, "POST")}`,
113
+ schemas.createShape,
114
+ schemas.createStrict,
115
+ {},
116
+ async (args, ctx) => {
117
+ const input = (override == null ? void 0 : override.transformInput) ? await override.transformInput("create", args, ctx) : args;
118
+ const result = await deps.executor({ slug, operation: "create", body: input }, ctx);
119
+ if (!result.body.success) return apiError(result, "create");
120
+ const data = normalizeOutput(result.body.data);
121
+ const id = extractId(data);
122
+ return {
123
+ content: [
124
+ { type: "text", text: `${entityConfig.names.singular} creado${id ? ` (id: ${id})` : ""}.` }
125
+ ],
126
+ structuredContent: { data }
127
+ };
128
+ }
129
+ )
130
+ );
131
+ }
132
+ if (operations.includes("update")) {
133
+ const updateShape = {
134
+ id: z.string().min(1).describe(`ID del registro de ${entityConfig.names.singular} a modificar (uuid)`),
135
+ ...schemas.updateShape
136
+ };
137
+ tools.push(
138
+ make(
139
+ "update",
140
+ `${deps.toolPrefix}_update_${singular}`,
141
+ `Update ${entityConfig.names.singular}`,
142
+ `Modifica campos de un registro de ${entityConfig.names.singular} (PATCH parcial: solo envi\xE1 los campos a cambiar). ${entityDescription}`,
143
+ updateShape,
144
+ z.object(updateShape).strict(),
145
+ { idempotentHint: true },
146
+ async (args, ctx) => {
147
+ const { id, ...fields } = args;
148
+ if (!Object.keys(fields).length) {
149
+ return errorResult("No enviaste ning\xFAn campo a modificar.");
150
+ }
151
+ const input = (override == null ? void 0 : override.transformInput) ? await override.transformInput("update", fields, ctx) : fields;
152
+ const result = await deps.executor(
153
+ { slug, operation: "update", id, body: input },
154
+ ctx
155
+ );
156
+ if (!result.body.success) return apiError(result, "update");
157
+ const data = normalizeOutput(result.body.data);
158
+ return {
159
+ content: [{ type: "text", text: `${entityConfig.names.singular} actualizado.` }],
160
+ structuredContent: { data }
161
+ };
162
+ }
163
+ )
164
+ );
165
+ }
166
+ if (operations.includes("delete")) {
167
+ const deleteShape = {
168
+ id: z.string().min(1).describe(`ID del registro de ${entityConfig.names.singular} a eliminar (uuid)`),
169
+ confirm: z.boolean().describe("true SOLO tras confirmaci\xF3n expl\xEDcita del usuario")
170
+ };
171
+ tools.push(
172
+ make(
173
+ "delete",
174
+ `${deps.toolPrefix}_delete_${singular}`,
175
+ `Delete ${entityConfig.names.singular}`,
176
+ `Elimina un ${entityConfig.names.singular}. DESTRUCTIVO: mostrale al usuario qu\xE9 vas a borrar y pedile confirmaci\xF3n antes.${deleteWarning(override)}`,
177
+ deleteShape,
178
+ z.object(deleteShape).strict(),
179
+ { destructiveHint: true },
180
+ async (args, ctx) => {
181
+ if (args.confirm !== true) {
182
+ return errorResult(
183
+ "Eliminaci\xF3n no confirmada: pedile al usuario confirmaci\xF3n expl\xEDcita y reintent\xE1 con confirm: true."
184
+ );
185
+ }
186
+ const result = await deps.executor(
187
+ { slug, operation: "delete", id: String(args.id) },
188
+ ctx
189
+ );
190
+ if (!result.body.success) return apiError(result, "delete");
191
+ return {
192
+ content: [{ type: "text", text: `${entityConfig.names.singular} eliminado (id: ${String(args.id)}).` }]
193
+ };
194
+ }
195
+ )
196
+ );
197
+ }
198
+ return tools;
199
+ }
200
+ function toolToken(name) {
201
+ return name.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
202
+ }
203
+ function buildEntityDescription(entityConfig, override, presets) {
204
+ var _a;
205
+ if ((_a = override == null ? void 0 : override.describe) == null ? void 0 : _a.entity) return override.describe.entity;
206
+ return (presets == null ? void 0 : presets.summary) ? `${presets.summary}.` : "";
207
+ }
208
+ function presetExamples(presets, method) {
209
+ if (!presets) return "";
210
+ const relevant = presets.presets.filter((p) => (p.method ?? "GET") === method);
211
+ const example = relevant.find((p) => method === "POST" ? p.payload : p.params);
212
+ if (!example) return "";
213
+ const body = method === "POST" ? example.payload : example.params;
214
+ const label = example.description || example.title || example.id;
215
+ return ` Ejemplo (${label}): ${JSON.stringify(body)}`;
216
+ }
217
+ function deleteWarning(override) {
218
+ var _a, _b;
219
+ const hint = (_b = (_a = override == null ? void 0 : override.describe) == null ? void 0 : _a.tools) == null ? void 0 : _b.delete;
220
+ return hint ? ` ${hint}` : "";
221
+ }
222
+ function listArgsToQuery(args) {
223
+ const query = {};
224
+ const { filters, fields, ...rest } = args;
225
+ for (const [key, value] of Object.entries(rest)) {
226
+ if (value === void 0 || value === null || value === "") continue;
227
+ query[key] = String(value);
228
+ }
229
+ for (const [key, value] of Object.entries(filters ?? {})) {
230
+ if (value === void 0 || value === null || value === "") continue;
231
+ query[key] = String(value);
232
+ }
233
+ if (fields == null ? void 0 : fields.length) query.fields = fields.join(",");
234
+ return query;
235
+ }
236
+ function normalizeDateFields(row, dateFields) {
237
+ if (!row || typeof row !== "object" || Array.isArray(row)) return row;
238
+ const record = { ...row };
239
+ for (const field of dateFields) {
240
+ const value = record[field];
241
+ if (typeof value === "string" && value.length >= 10) {
242
+ record[field] = value.slice(0, 10);
243
+ }
244
+ }
245
+ return record;
246
+ }
247
+ function normalizeOutput(data) {
248
+ return data;
249
+ }
250
+ function extractId(data) {
251
+ if (data && typeof data === "object" && "id" in data) {
252
+ return String(data.id);
253
+ }
254
+ return null;
255
+ }
256
+ function errorResult(message) {
257
+ return { content: [{ type: "text", text: message }], isError: true };
258
+ }
259
+ function formatZodIssues(error) {
260
+ return error.issues.slice(0, 6).map((issue) => {
261
+ const path = issue.path.join(".");
262
+ return path ? `${path}: ${issue.message}` : issue.message;
263
+ }).join(" \xB7 ");
264
+ }
265
+ export {
266
+ errorResult,
267
+ generateEntityTools,
268
+ listArgsToQuery,
269
+ normalizeDateFields,
270
+ toolToken
271
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Stateless in-memory Transport for MCP over HTTP (App Router friendly).
3
+ *
4
+ * The official StreamableHTTPServerTransport requires Node's
5
+ * IncomingMessage/ServerResponse, which Next.js App Router does not expose.
6
+ * This transport bypasses HTTP entirely: the route handler parses the
7
+ * JSON-RPC body, feeds each message to an ephemeral McpServer through this
8
+ * transport, and returns the collected responses as plain JSON.
9
+ *
10
+ * Stateless by design: one server + one transport per request, no sessions,
11
+ * no SSE/server-push. Server-originated notifications are dropped.
12
+ */
13
+ import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
14
+ import type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
15
+ export declare class StatelessJsonRpcTransport implements Transport {
16
+ onclose?: () => void;
17
+ onerror?: (error: Error) => void;
18
+ onmessage?: (message: JSONRPCMessage) => void;
19
+ private pending;
20
+ private closed;
21
+ start(): Promise<void>;
22
+ /** Called by the McpServer with responses (and notifications, which we drop). */
23
+ send(message: JSONRPCMessage): Promise<void>;
24
+ close(): Promise<void>;
25
+ /**
26
+ * Feed one client message to the server. Resolves with the server's
27
+ * response for requests, or null for notifications (no response expected).
28
+ */
29
+ handleMessage(message: JSONRPCMessage): Promise<JSONRPCMessage | null>;
30
+ }
31
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/lib/mcp/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAMxE,qBAAa,yBAA0B,YAAW,SAAS;IACzD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAA;IAE7C,OAAO,CAAC,OAAO,CAA8C;IAC7D,OAAO,CAAC,MAAM,CAAQ;IAEhB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,iFAAiF;IAC3E,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAsB7E"}
@@ -0,0 +1,58 @@
1
+ const RESPONSE_TIMEOUT_MS = 3e4;
2
+ class StatelessJsonRpcTransport {
3
+ onclose;
4
+ onerror;
5
+ onmessage;
6
+ pending = /* @__PURE__ */ new Map();
7
+ closed = false;
8
+ async start() {
9
+ }
10
+ /** Called by the McpServer with responses (and notifications, which we drop). */
11
+ async send(message) {
12
+ if (this.closed) return;
13
+ const id = message.id;
14
+ if (id !== void 0 && id !== null && !("method" in message)) {
15
+ const resolve = this.pending.get(id);
16
+ if (resolve) {
17
+ this.pending.delete(id);
18
+ resolve(message);
19
+ return;
20
+ }
21
+ }
22
+ }
23
+ async close() {
24
+ var _a;
25
+ this.closed = true;
26
+ this.pending.clear();
27
+ (_a = this.onclose) == null ? void 0 : _a.call(this);
28
+ }
29
+ /**
30
+ * Feed one client message to the server. Resolves with the server's
31
+ * response for requests, or null for notifications (no response expected).
32
+ */
33
+ async handleMessage(message) {
34
+ if (!this.onmessage) {
35
+ throw new Error("Transport not connected to a server");
36
+ }
37
+ const isRequest = "method" in message && "id" in message && message.id !== null;
38
+ if (!isRequest) {
39
+ this.onmessage(message);
40
+ return null;
41
+ }
42
+ const request = message;
43
+ return new Promise((resolve, reject) => {
44
+ const timer = setTimeout(() => {
45
+ this.pending.delete(request.id);
46
+ reject(new Error(`MCP request ${String(request.id)} timed out`));
47
+ }, RESPONSE_TIMEOUT_MS);
48
+ this.pending.set(request.id, (response) => {
49
+ clearTimeout(timer);
50
+ resolve(response);
51
+ });
52
+ this.onmessage(message);
53
+ });
54
+ }
55
+ }
56
+ export {
57
+ StatelessJsonRpcTransport
58
+ };
@@ -0,0 +1,184 @@
1
+ /**
2
+ * MCP Engine — shared types.
3
+ *
4
+ * The engine is registry-driven: it reads the entity registry passed into
5
+ * createMcpEngine() and never imports theme files directly. Theme extensions
6
+ * (overrides, extra tools, translations) are injected via McpEngineOptions,
7
+ * which the default route template assembles from the generated
8
+ * MCP_OVERRIDES registry.
9
+ */
10
+ import type { z } from 'zod';
11
+ import type { EntityConfig } from '../entities/types';
12
+ export type McpOperation = 'list' | 'get' | 'create' | 'update' | 'delete';
13
+ /**
14
+ * Mutable shape used while building tool input schemas. Assignable to the
15
+ * SDK's ZodRawShape (zod 4 declares it Readonly<Record<string, $ZodType>>).
16
+ */
17
+ export type McpShape = Record<string, z.ZodTypeAny>;
18
+ export declare const MUTATION_OPERATIONS: McpOperation[];
19
+ /** Resolved per-request identity, injected into every tool handler. */
20
+ export interface ToolExecutionContext {
21
+ userId: string;
22
+ userRole: string;
23
+ teamId: string;
24
+ /** Raw Authorization header, forwarded verbatim to in-process handlers. */
25
+ authHeader: string;
26
+ /** api_key.id of the caller — required for audit logging. */
27
+ apiKeyId: string | null;
28
+ scopes: string[];
29
+ }
30
+ export interface McpToolAnnotations {
31
+ readOnlyHint?: boolean;
32
+ destructiveHint?: boolean;
33
+ idempotentHint?: boolean;
34
+ openWorldHint?: boolean;
35
+ }
36
+ export interface McpToolResultContent {
37
+ type: 'text';
38
+ text: string;
39
+ }
40
+ export interface McpToolResult {
41
+ content: McpToolResultContent[];
42
+ structuredContent?: Record<string, unknown>;
43
+ isError?: boolean;
44
+ }
45
+ export interface McpToolDefinition {
46
+ name: string;
47
+ title: string;
48
+ description: string;
49
+ /** Raw shape passed to the SDK for tools/list JSON Schema generation. */
50
+ inputSchema: McpShape;
51
+ /**
52
+ * Strict validator run inside the handler before executing. The SDK builds
53
+ * a non-strict object from inputSchema; this one rejects unknown keys and
54
+ * enforces cross-field rules (e.g. from/to require dateField).
55
+ */
56
+ strictSchema: z.ZodTypeAny;
57
+ annotations?: McpToolAnnotations;
58
+ handler: (args: Record<string, unknown>, ctx: ToolExecutionContext) => Promise<McpToolResult>;
59
+ /** Metadata for audit entries. */
60
+ meta?: {
61
+ entitySlug?: string;
62
+ operation?: McpOperation | 'workflow';
63
+ };
64
+ }
65
+ /** Thrown by overrides/handlers to short-circuit with an actionable message. */
66
+ export declare class McpToolError extends Error {
67
+ constructor(message: string);
68
+ }
69
+ /** Result of an in-process entity API invocation. */
70
+ export interface EntityApiResult {
71
+ status: number;
72
+ body: {
73
+ success: boolean;
74
+ data?: unknown;
75
+ info?: Record<string, unknown>;
76
+ error?: string;
77
+ code?: string;
78
+ details?: unknown;
79
+ };
80
+ }
81
+ export interface ExecuteEntityArgs {
82
+ slug: string;
83
+ operation: McpOperation;
84
+ id?: string;
85
+ query?: Record<string, string>;
86
+ body?: unknown;
87
+ }
88
+ export type EntityExecutor = (args: ExecuteEntityArgs, ctx: ToolExecutionContext) => Promise<EntityApiResult>;
89
+ /**
90
+ * API handed to override extraTools factories.
91
+ *
92
+ * `execute` and `entitySchemas` are the ENGINE's own wired versions: output
93
+ * normalization (dates, transformOutput) and schema context (i18n option
94
+ * labels, overrides) are applied there, so a workflow tool behaves exactly
95
+ * like a generated one. Building schemas or calling handlers directly from an
96
+ * override would silently skip both.
97
+ */
98
+ export interface EngineApi {
99
+ execute: EntityExecutor;
100
+ /** Schemas for an entity, built with the engine's i18n + override context. */
101
+ entitySchemas: (slug: string) => {
102
+ createShape: McpShape;
103
+ updateShape: McpShape;
104
+ };
105
+ toolPrefix: string;
106
+ defaultTimezone: string;
107
+ registry: Record<string, EntityConfig>;
108
+ translateApiError: (result: EntityApiResult, context: {
109
+ slug: string;
110
+ operation: string;
111
+ hints?: string[];
112
+ }) => string;
113
+ }
114
+ export interface McpEntityOverride {
115
+ /** Hide the whole entity from the MCP surface. */
116
+ exclude?: boolean;
117
+ /** Hide specific generated tools. First-class security mechanism. */
118
+ excludeOperations?: McpOperation[];
119
+ /** Field names that become optional in the MCP input schema even if the API requires them (pair with transformInput enforcement). */
120
+ relaxRequired?: string[];
121
+ describe?: {
122
+ entity?: string;
123
+ fields?: Record<string, string>;
124
+ tools?: Partial<Record<McpOperation, string>>;
125
+ };
126
+ /** Appended to 500-with-no-code errors (core swallows CHECK violations). */
127
+ errorHints?: string[];
128
+ /** May throw McpToolError to reject with an actionable message. */
129
+ transformInput?: (operation: McpOperation, input: Record<string, unknown>, ctx: ToolExecutionContext) => Record<string, unknown> | Promise<Record<string, unknown>>;
130
+ transformOutput?: (operation: McpOperation, output: unknown) => unknown;
131
+ extraTools?: (api: EngineApi) => McpToolDefinition[];
132
+ }
133
+ export interface AuditEntry {
134
+ apiKeyId: string | null;
135
+ userId: string;
136
+ tool: string;
137
+ entitySlug?: string;
138
+ operation?: string;
139
+ recordId?: string;
140
+ teamId: string;
141
+ statusCode: number;
142
+ requestSummary: Record<string, unknown>;
143
+ responseTimeMs: number;
144
+ }
145
+ export interface EntityPresetInfo {
146
+ summary?: string;
147
+ presets: Array<{
148
+ id: string;
149
+ title?: string;
150
+ method?: string;
151
+ description?: string;
152
+ params?: Record<string, unknown>;
153
+ payload?: Record<string, unknown>;
154
+ }>;
155
+ }
156
+ export interface McpEngineOptions {
157
+ /** e.g. 'acme' → acme_list_customers. Comes from app/theme config. */
158
+ toolPrefix: string;
159
+ serverInfo?: {
160
+ name: string;
161
+ version: string;
162
+ };
163
+ /** Core/reserved slugs never exposed (e.g. 'patterns'). */
164
+ excludeSlugs?: string[];
165
+ /** Operations generated by default for every entity. */
166
+ defaultOperations?: McpOperation[];
167
+ overrides?: Record<string, McpEntityOverride>;
168
+ /**
169
+ * Per-entity description material harvested from api/presets.ts
170
+ * (summary → entity description, presets → few-shot examples).
171
+ */
172
+ presets?: Record<string, EntityPresetInfo>;
173
+ /** Resolve the localized label of a select option ("dairy" → "Lácteos"). */
174
+ translateOption?: (slug: string, fieldName: string, value: string) => string | undefined;
175
+ /** IANA timezone used to resolve relative dates ("this_week"). */
176
+ defaultTimezone?: string;
177
+ /** Extra tools not attached to an entity (e.g. list_team_members). */
178
+ utilityTools?: (api: EngineApi) => McpToolDefinition[];
179
+ /** Injectable for tests. Defaults to the api_audit_log writer. */
180
+ audit?: (entry: AuditEntry) => Promise<void>;
181
+ /** Injectable for tests. Defaults to the in-process executor. */
182
+ executor?: EntityExecutor;
183
+ }
184
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,YAAY,GAAG,M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AAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;IACxF,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sEAAsE;IACtE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,iBAAiB,EAAE,CAAA;IACtD,kEAAkE;IAClE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,iEAAiE;IACjE,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B"}
@@ -0,0 +1,11 @@
1
+ const MUTATION_OPERATIONS = ["create", "update", "delete"];
2
+ class McpToolError extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "McpToolError";
6
+ }
7
+ }
8
+ export {
9
+ MUTATION_OPERATIONS,
10
+ McpToolError
11
+ };
@@ -21,6 +21,18 @@ export declare class HookSystem {
21
21
  * Apply filter hooks to data
22
22
  */
23
23
  applyFilters<T>(hookName: string, data: T, ...args: unknown[]): Promise<T>;
24
+ /**
25
+ * Apply filter hooks to data, propagating callback errors instead of
26
+ * swallowing them.
27
+ *
28
+ * `applyFilters` isolates each registered callback so one misbehaving
29
+ * plugin can't break the others — the right default for cosmetic /
30
+ * best-effort filters. It is the wrong default for a *validation*
31
+ * filter: a callback that throws to reject a payload must actually stop
32
+ * the pipeline, or the hook can never reject anything. Use this variant
33
+ * for filters where a thrown error is meant to abort the caller.
34
+ */
35
+ applyFiltersStrict<T>(hookName: string, data: T, ...args: unknown[]): Promise<T>;
24
36
  /**
25
37
  * Add an action hook
26
38
  * Actions allow plugins to execute code at specific points
@@ -91,6 +103,7 @@ export declare function createHookSystem(): HookSystem;
91
103
  export declare function getGlobalHooks(): HookSystem;
92
104
  export declare const addFilter: (hookName: string, callback: HookCallback, priority?: number) => void;
93
105
  export declare const applyFilters: <T>(hookName: string, data: T, ...args: unknown[]) => Promise<T>;
106
+ export declare const applyFiltersStrict: <T>(hookName: string, data: T, ...args: unknown[]) => Promise<T>;
94
107
  export declare const addAction: (hookName: string, callback: HookCallbackVoid, priority?: number) => void;
95
108
  export declare const doAction: <T>(hookName: string, data: T, ...args: unknown[]) => Promise<void>;
96
109
  export declare const emit: <T>(eventName: string, data: T, ...args: unknown[]) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"hook-system.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/hook-system.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAChG,KAAK,gBAAgB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAE1G;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,SAAS,CAA0D;IAE3E;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,SAAK,GAAG,IAAI;IAsBxE;;OAEG;IACG,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAuBhF;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,SAAK,GAAG,IAAI;IAqB5E;;OAEG;IACG,QAAQ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