@sonicjs-cms/core 2.18.1 → 3.0.0-beta.10

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 (232) hide show
  1. package/README.md +52 -52
  2. package/dist/admin-documents-form.template-DDSH6ROU.js +6 -0
  3. package/dist/{admin-layout-catalyst.template-UMTIN66R.js.map → admin-documents-form.template-DDSH6ROU.js.map} +1 -1
  4. package/dist/admin-documents-form.template-LSZKGA5J.cjs +19 -0
  5. package/dist/{admin-layout-catalyst.template-HFD37TY5.cjs.map → admin-documents-form.template-LSZKGA5J.cjs.map} +1 -1
  6. package/dist/{filter-bar.template-DlVYMk-T.d.cts → admin-layout-catalyst.template-DrwDUfsE.d.cts} +25 -1
  7. package/dist/{filter-bar.template-DlVYMk-T.d.ts → admin-layout-catalyst.template-DrwDUfsE.d.ts} +25 -1
  8. package/dist/admin-layout-catalyst.template-KDHKVLXR.cjs +21 -0
  9. package/dist/admin-layout-catalyst.template-KDHKVLXR.cjs.map +1 -0
  10. package/dist/admin-layout-catalyst.template-YQ4EMF2J.js +7 -0
  11. package/dist/admin-layout-catalyst.template-YQ4EMF2J.js.map +1 -0
  12. package/dist/app-Bo0X1OWX.d.ts +1268 -0
  13. package/dist/app-Do66yCcV.d.cts +1268 -0
  14. package/dist/cache-DDARE4QE.js +4 -0
  15. package/dist/cache-DDARE4QE.js.map +1 -0
  16. package/dist/cache-LVYS4BPL.cjs +33 -0
  17. package/dist/cache-LVYS4BPL.cjs.map +1 -0
  18. package/dist/chunk-2CB4KY7I.cjs +771 -0
  19. package/dist/chunk-2CB4KY7I.cjs.map +1 -0
  20. package/dist/{chunk-ABB34XUS.cjs → chunk-3KYKEXV7.cjs} +667 -19
  21. package/dist/chunk-3KYKEXV7.cjs.map +1 -0
  22. package/dist/chunk-4BTBSXMR.cjs +912 -0
  23. package/dist/chunk-4BTBSXMR.cjs.map +1 -0
  24. package/dist/{chunk-55RDMDOP.js → chunk-5V62WT6M.js} +181 -57
  25. package/dist/chunk-5V62WT6M.js.map +1 -0
  26. package/dist/{chunk-XXDFQERJ.js → chunk-6OC6MF3C.js} +7192 -9806
  27. package/dist/chunk-6OC6MF3C.js.map +1 -0
  28. package/dist/chunk-AI663NBO.js +821 -0
  29. package/dist/chunk-AI663NBO.js.map +1 -0
  30. package/dist/chunk-ALDRXTUO.js +273 -0
  31. package/dist/chunk-ALDRXTUO.js.map +1 -0
  32. package/dist/{chunk-TFNTM3OA.js → chunk-ATUPB6MN.js} +645 -15
  33. package/dist/chunk-ATUPB6MN.js.map +1 -0
  34. package/dist/chunk-BLMTL57B.js +767 -0
  35. package/dist/chunk-BLMTL57B.js.map +1 -0
  36. package/dist/{chunk-4ZSNJDLS.cjs → chunk-CRGUD4KC.cjs} +9 -9
  37. package/dist/chunk-CRGUD4KC.cjs.map +1 -0
  38. package/dist/chunk-F67UK75A.cjs +158 -0
  39. package/dist/chunk-F67UK75A.cjs.map +1 -0
  40. package/dist/chunk-GCDZZNIN.js +192 -0
  41. package/dist/chunk-GCDZZNIN.js.map +1 -0
  42. package/dist/chunk-HIKBY7MS.cjs +70 -0
  43. package/dist/chunk-HIKBY7MS.cjs.map +1 -0
  44. package/dist/chunk-IDCZBF35.js +1186 -0
  45. package/dist/chunk-IDCZBF35.js.map +1 -0
  46. package/dist/chunk-IESEVHXL.js +66 -0
  47. package/dist/chunk-IESEVHXL.js.map +1 -0
  48. package/dist/chunk-IGADDMXH.js +387 -0
  49. package/dist/chunk-IGADDMXH.js.map +1 -0
  50. package/dist/chunk-IHTXB7AT.cjs +276 -0
  51. package/dist/chunk-IHTXB7AT.cjs.map +1 -0
  52. package/dist/chunk-IVPRUGTY.js +242 -0
  53. package/dist/chunk-IVPRUGTY.js.map +1 -0
  54. package/dist/{chunk-SQ6FNXU2.cjs → chunk-IXUHXTHW.cjs} +2 -151
  55. package/dist/chunk-IXUHXTHW.cjs.map +1 -0
  56. package/dist/chunk-J6JTWD2A.cjs +100 -0
  57. package/dist/chunk-J6JTWD2A.cjs.map +1 -0
  58. package/dist/chunk-JEQ7FLOD.cjs +199 -0
  59. package/dist/chunk-JEQ7FLOD.cjs.map +1 -0
  60. package/dist/{chunk-ON5ZMSU4.js → chunk-JQISFW6U.js} +3 -3
  61. package/dist/chunk-JQISFW6U.js.map +1 -0
  62. package/dist/chunk-K25XHMM3.js +566 -0
  63. package/dist/chunk-K25XHMM3.js.map +1 -0
  64. package/dist/{chunk-UYJ6TJHX.cjs → chunk-K623Q6WD.cjs} +181 -56
  65. package/dist/chunk-K623Q6WD.cjs.map +1 -0
  66. package/dist/chunk-MUNO67TT.cjs +1219 -0
  67. package/dist/chunk-MUNO67TT.cjs.map +1 -0
  68. package/dist/chunk-N32OWET6.cjs +327 -0
  69. package/dist/chunk-N32OWET6.cjs.map +1 -0
  70. package/dist/chunk-NUKJ54GA.cjs +245 -0
  71. package/dist/chunk-NUKJ54GA.cjs.map +1 -0
  72. package/dist/{chunk-XWIA3HVX.js → chunk-OBA2RYZN.js} +6 -1249
  73. package/dist/chunk-OBA2RYZN.js.map +1 -0
  74. package/dist/chunk-PMGOBS6X.cjs +408 -0
  75. package/dist/chunk-PMGOBS6X.cjs.map +1 -0
  76. package/dist/{chunk-OHYBNCVL.cjs → chunk-PXNTCCPE.cjs} +10 -1256
  77. package/dist/chunk-PXNTCCPE.cjs.map +1 -0
  78. package/dist/chunk-PYVFXCSD.js +1828 -0
  79. package/dist/chunk-PYVFXCSD.js.map +1 -0
  80. package/dist/{chunk-MGFRZO24.js → chunk-QZGABF2M.js} +3 -149
  81. package/dist/chunk-QZGABF2M.js.map +1 -0
  82. package/dist/{chunk-T3Q5V33G.cjs → chunk-R4ILO3W6.cjs} +876 -829
  83. package/dist/chunk-R4ILO3W6.cjs.map +1 -0
  84. package/dist/chunk-RMRJGMDE.js +323 -0
  85. package/dist/chunk-RMRJGMDE.js.map +1 -0
  86. package/dist/chunk-RNZFGN4R.js +88 -0
  87. package/dist/chunk-RNZFGN4R.js.map +1 -0
  88. package/dist/chunk-RQ6N3FTV.js +900 -0
  89. package/dist/chunk-RQ6N3FTV.js.map +1 -0
  90. package/dist/{chunk-SXXTQETM.cjs → chunk-TO6EY4P7.cjs} +8722 -11323
  91. package/dist/chunk-TO6EY4P7.cjs.map +1 -0
  92. package/dist/chunk-V464XBYS.js +154 -0
  93. package/dist/chunk-V464XBYS.js.map +1 -0
  94. package/dist/chunk-YA3TJ65D.cjs +575 -0
  95. package/dist/chunk-YA3TJ65D.cjs.map +1 -0
  96. package/dist/chunk-YP7GW2G5.cjs +866 -0
  97. package/dist/chunk-YP7GW2G5.cjs.map +1 -0
  98. package/dist/{collection-config-B4PG-AaF.d.cts → collection-config-JgHOpFCG.d.cts} +30 -2
  99. package/dist/{collection-config-B4PG-AaF.d.ts → collection-config-JgHOpFCG.d.ts} +30 -2
  100. package/dist/config-HFXANXCC.js +6 -0
  101. package/dist/config-HFXANXCC.js.map +1 -0
  102. package/dist/config-ON6FNMYX.cjs +19 -0
  103. package/dist/config-ON6FNMYX.cjs.map +1 -0
  104. package/dist/define-plugin-BzNHc1ZI.d.ts +1321 -0
  105. package/dist/define-plugin-IWDKYaVm.d.cts +1321 -0
  106. package/dist/document-projection-TDWRJX3Z.cjs +13 -0
  107. package/dist/document-projection-TDWRJX3Z.cjs.map +1 -0
  108. package/dist/document-projection-YYMC6I4U.js +4 -0
  109. package/dist/document-projection-YYMC6I4U.js.map +1 -0
  110. package/dist/index.cjs +13737 -4327
  111. package/dist/index.cjs.map +1 -1
  112. package/dist/index.d.cts +331 -493
  113. package/dist/index.d.ts +331 -493
  114. package/dist/index.js +13456 -4068
  115. package/dist/index.js.map +1 -1
  116. package/dist/middleware.cjs +38 -32
  117. package/dist/middleware.d.cts +69 -7
  118. package/dist/middleware.d.ts +69 -7
  119. package/dist/middleware.js +9 -3
  120. package/dist/migrations-2XHQEGOQ.cjs +13 -0
  121. package/dist/{migrations-IYNTWDC6.cjs.map → migrations-2XHQEGOQ.cjs.map} +1 -1
  122. package/dist/migrations-PE3CDVSM.js +4 -0
  123. package/dist/{migrations-R337UD46.js.map → migrations-PE3CDVSM.js.map} +1 -1
  124. package/dist/{plugin-bootstrap-DfVerYV4.d.cts → plugin-bootstrap-B8ThJU21.d.cts} +4315 -1661
  125. package/dist/{plugin-bootstrap-P_ciLp_C.d.ts → plugin-bootstrap-qu8hJgUt.d.ts} +4315 -1661
  126. package/dist/plugins.cjs +171 -12
  127. package/dist/plugins.d.cts +36 -2
  128. package/dist/plugins.d.ts +36 -2
  129. package/dist/plugins.js +5 -2
  130. package/dist/rbac-O73MFKDA.js +5 -0
  131. package/dist/rbac-O73MFKDA.js.map +1 -0
  132. package/dist/rbac-VONLJJKB.cjs +14 -0
  133. package/dist/rbac-VONLJJKB.cjs.map +1 -0
  134. package/dist/routes.cjs +42 -46
  135. package/dist/routes.d.cts +56 -146
  136. package/dist/routes.d.ts +56 -146
  137. package/dist/routes.js +18 -10
  138. package/dist/services.cjs +43 -76
  139. package/dist/services.d.cts +93 -55
  140. package/dist/services.d.ts +93 -55
  141. package/dist/services.js +6 -3
  142. package/dist/{telemetry-B9vIV4wh.d.cts → telemetry-Cku1ax74.d.cts} +1 -1
  143. package/dist/{telemetry-B9vIV4wh.d.ts → telemetry-Cku1ax74.d.ts} +1 -1
  144. package/dist/templates.cjs +17 -29
  145. package/dist/templates.d.cts +2 -89
  146. package/dist/templates.d.ts +2 -89
  147. package/dist/templates.js +3 -3
  148. package/dist/types-Dea1eNxU.d.cts +286 -0
  149. package/dist/types-Dea1eNxU.d.ts +286 -0
  150. package/dist/types.d.cts +2 -2
  151. package/dist/types.d.ts +2 -2
  152. package/dist/utils.cjs +21 -20
  153. package/dist/utils.d.cts +2 -2
  154. package/dist/utils.d.ts +2 -2
  155. package/dist/utils.js +3 -2
  156. package/migrations/0001_core.sql +184 -0
  157. package/migrations/0002_documents.sql +163 -0
  158. package/package.json +12 -7
  159. package/dist/admin-layout-catalyst.template-HFD37TY5.cjs +0 -17
  160. package/dist/admin-layout-catalyst.template-UMTIN66R.js +0 -7
  161. package/dist/app-C9esKLmh.d.cts +0 -112
  162. package/dist/app-C9esKLmh.d.ts +0 -112
  163. package/dist/chunk-4R3NOOL3.js +0 -2217
  164. package/dist/chunk-4R3NOOL3.js.map +0 -1
  165. package/dist/chunk-4ZSNJDLS.cjs.map +0 -1
  166. package/dist/chunk-55RDMDOP.js.map +0 -1
  167. package/dist/chunk-635JAMSE.cjs +0 -653
  168. package/dist/chunk-635JAMSE.cjs.map +0 -1
  169. package/dist/chunk-ABB34XUS.cjs.map +0 -1
  170. package/dist/chunk-C54YUA23.cjs +0 -2219
  171. package/dist/chunk-C54YUA23.cjs.map +0 -1
  172. package/dist/chunk-DSUJ5YQH.cjs +0 -722
  173. package/dist/chunk-DSUJ5YQH.cjs.map +0 -1
  174. package/dist/chunk-EW5NOBVU.js +0 -1783
  175. package/dist/chunk-EW5NOBVU.js.map +0 -1
  176. package/dist/chunk-EXNEW5US.js +0 -648
  177. package/dist/chunk-EXNEW5US.js.map +0 -1
  178. package/dist/chunk-I2H5NGJQ.js +0 -692
  179. package/dist/chunk-I2H5NGJQ.js.map +0 -1
  180. package/dist/chunk-MGFRZO24.js.map +0 -1
  181. package/dist/chunk-OHYBNCVL.cjs.map +0 -1
  182. package/dist/chunk-ON5ZMSU4.js.map +0 -1
  183. package/dist/chunk-QFWHAFEO.js +0 -1843
  184. package/dist/chunk-QFWHAFEO.js.map +0 -1
  185. package/dist/chunk-SQ6FNXU2.cjs.map +0 -1
  186. package/dist/chunk-SXXTQETM.cjs.map +0 -1
  187. package/dist/chunk-T3Q5V33G.cjs.map +0 -1
  188. package/dist/chunk-TFNTM3OA.js.map +0 -1
  189. package/dist/chunk-UYJ6TJHX.cjs.map +0 -1
  190. package/dist/chunk-WAEQXGCX.cjs +0 -1898
  191. package/dist/chunk-WAEQXGCX.cjs.map +0 -1
  192. package/dist/chunk-XWIA3HVX.js.map +0 -1
  193. package/dist/chunk-XXDFQERJ.js.map +0 -1
  194. package/dist/migrations-IYNTWDC6.cjs +0 -13
  195. package/dist/migrations-R337UD46.js +0 -4
  196. package/dist/plugin-manager-BoM3Q7o7.d.cts +0 -328
  197. package/dist/plugin-manager-Efx9RyDX.d.ts +0 -328
  198. package/migrations/001_initial_schema.sql +0 -170
  199. package/migrations/002_faq_plugin.sql +0 -86
  200. package/migrations/003_stage5_enhancements.sql +0 -121
  201. package/migrations/004_stage6_user_management.sql +0 -183
  202. package/migrations/005_stage7_workflow_automation.sql +0 -294
  203. package/migrations/006_plugin_system.sql +0 -155
  204. package/migrations/007_demo_login_plugin.sql +0 -23
  205. package/migrations/008_fix_slug_validation.sql +0 -22
  206. package/migrations/009_system_logging.sql +0 -57
  207. package/migrations/011_config_managed_collections.sql +0 -15
  208. package/migrations/012_testimonials_plugin.sql +0 -80
  209. package/migrations/013_code_examples_plugin.sql +0 -177
  210. package/migrations/014_fix_plugin_registry.sql +0 -88
  211. package/migrations/015_add_remaining_plugins.sql +0 -89
  212. package/migrations/016_remove_duplicate_cache_plugin.sql +0 -17
  213. package/migrations/017_auth_configurable_fields.sql +0 -49
  214. package/migrations/018_settings_table.sql +0 -23
  215. package/migrations/019_remove_blog_posts_collection.sql +0 -15
  216. package/migrations/020_add_email_plugin.sql +0 -22
  217. package/migrations/021_add_magic_link_auth_plugin.sql +0 -42
  218. package/migrations/022_add_tinymce_plugin.sql +0 -25
  219. package/migrations/023_add_easy_mdx_plugin.sql +0 -25
  220. package/migrations/024_add_quill_editor_plugin.sql +0 -25
  221. package/migrations/025_add_easymde_plugin.sql +0 -25
  222. package/migrations/026_add_otp_login.sql +0 -42
  223. package/migrations/027_fix_slug_field_type.sql +0 -18
  224. package/migrations/028_fix_slug_field_type_in_schemas.sql +0 -30
  225. package/migrations/029_add_forms_system.sql +0 -184
  226. package/migrations/030_add_turnstile_to_forms.sql +0 -14
  227. package/migrations/031_ai_search_plugin.sql +0 -45
  228. package/migrations/032_user_profiles.sql +0 -37
  229. package/migrations/033_form_content_integration.sql +0 -19
  230. package/migrations/034_security_audit_plugin.sql +0 -27
  231. package/migrations/035_user_profiles_data_column.sql +0 -16
  232. package/migrations/036_analytics_events.sql +0 -22
package/dist/index.d.ts CHANGED
@@ -1,521 +1,361 @@
1
- export { B as Bindings, a as SonicJSApp, S as SonicJSConfig, V as Variables, c as createSonicJSApp, s as setupCoreMiddleware, b as setupCoreRoutes } from './app-C9esKLmh.js';
2
- import { B as schema } from './plugin-bootstrap-P_ciLp_C.js';
3
- export { D as Collection, E as Content, C as CorePlugin, F as DbPlugin, G as DbPluginHook, L as LogCategory, H as LogConfig, a as LogEntry, b as LogFilter, c as LogLevel, d as Logger, I as Media, M as Migration, e as MigrationService, f as MigrationStatus, N as NewCollection, J as NewContent, K as NewLogConfig, O as NewMedia, Q as NewPlugin, R as NewPluginActivityLog, S as NewPluginAsset, T as NewPluginHook, U as NewPluginRoute, V as NewSystemLog, W as NewUser, X as NewWorkflowHistory, Y as PluginActivityLog, Z as PluginAsset, P as PluginBootstrapService, _ as PluginRoute, g as PluginServiceClass, $ as SystemLog, a0 as User, a1 as WorkflowHistory, a2 as apiTokens, h as backfillFormSubmissions, i as cleanupRemovedCollections, a3 as collections, a4 as content, a5 as contentVersions, j as createContentFromSubmission, k as deriveCollectionSchemaFromFormio, l as deriveSubmissionTitle, m as fullCollectionSync, n as getAvailableCollectionNames, o as getLogger, p as getManagedCollections, q as initLogger, a6 as insertCollectionSchema, a7 as insertContentSchema, a8 as insertLogConfigSchema, a9 as insertMediaSchema, aa as insertPluginActivityLogSchema, ab as insertPluginAssetSchema, ac as insertPluginHookSchema, ad as insertPluginRouteSchema, ae as insertPluginSchema, af as insertSystemLogSchema, ag as insertUserSchema, ah as insertWorkflowHistorySchema, r as isCollectionManaged, s as loadCollectionConfig, t as loadCollectionConfigs, ai as logConfig, u as mapFormStatusToContentStatus, aj as media, ak as pluginActivityLog, al as pluginAssets, am as pluginHooks, an as pluginRoutes, ao as plugins, v as registerCollections, ap as selectCollectionSchema, aq as selectContentSchema, ar as selectLogConfigSchema, as as selectMediaSchema, at as selectPluginActivityLogSchema, au as selectPluginAssetSchema, av as selectPluginHookSchema, aw as selectPluginRouteSchema, ax as selectPluginSchema, ay as selectSystemLogSchema, az as selectUserSchema, aA as selectWorkflowHistorySchema, w as syncAllFormCollections, x as syncCollection, y as syncCollections, z as syncFormCollection, aB as systemLogs, aC as users, A as validateCollectionConfig, aD as workflowHistory } from './plugin-bootstrap-P_ciLp_C.js';
1
+ export { B as Bindings, a as BootIsolateFn, b as SonicJSApp, S as SonicJSConfig, V as Variables, c as createSonicJSApp, s as setupCoreMiddleware, d as setupCoreRoutes } from './app-Bo0X1OWX.js';
2
+ import { o as DefinedPlugin } from './define-plugin-BzNHc1ZI.js';
3
+ export { B as BooleanField, e as ConfigSchema, f as ConfigSchemaField, h as CronContext, i as CronDeclaration, j as CronDispatchResult, k as CronTickEvent, l as CronablePlugin, H as HookSystemImpl, r as HookUtils, N as NumberField, P as ParsedField, v as PluginManagerClass, an as PluginMenuEntry, x as PluginRegistryImpl, y as PluginValidatorClass, z as PluginsRegistry, A as RegisterPluginsError, G as RegisterPluginsErrorReason, I as RegisterPluginsHostContext, J as RegisterablePlugin, K as RegistryEntry, ao as ResolvedPluginMenuEntry, L as ScopedHookSystemClass, O as SelectField, Q as SettingsFor, U as StringField, Y as applySchemaDefaults, _ as collectCronSchedules, $ as collectCrons, a2 as createScheduledHandler, a3 as definePlugin, a4 as dispatchCronTick, a5 as getHookSystem, ap as getPluginMenu, a6 as getTypedHooks, a8 as hasHookSystem, a9 as isDefinedPlugin, ae as parseConfigSchema, af as parseFormDataToSettings, ah as registerPlugins, ai as renderSchemaFields, aj as resetHookSystem, aq as resetPluginMenu, ar as resolvePluginMenuItems, ak as setHookSystem, as as setPluginMenu } from './define-plugin-BzNHc1ZI.js';
4
+ import { D1Database as D1Database$1 } from '@cloudflare/workers-types';
5
+ import { E as EmailProvider, N as NormalizedEmailMessage, q as SendResult } from './types-Dea1eNxU.js';
6
+ export { s as EmailLogRow } from './types-Dea1eNxU.js';
7
+ import { s as schema } from './plugin-bootstrap-qu8hJgUt.js';
8
+ export { m as Content, C as CorePlugin, n as DbPlugin, o as DbPluginHook, L as LogCategory, p as LogConfig, a as LogEntry, b as LogFilter, c as LogLevel, d as Logger, q as Media, M as Migration, e as MigrationService, f as MigrationStatus, N as NewContent, t as NewLogConfig, u as NewMedia, w as NewPlugin, x as NewPluginActivityLog, y as NewPluginAsset, z as NewPluginHook, A as NewPluginRoute, B as NewSystemLog, D as NewUser, E as NewWorkflowHistory, F as PluginActivityLog, G as PluginAsset, P as PluginBootstrapService, H as PluginRoute, g as PluginServiceClass, S as SystemLog, U as User, W as WorkflowHistory, I as apiTokens, J as content, K as contentVersions, h as getAvailableCollectionNames, i as getLogger, j as initLogger, O as insertContentSchema, Q as insertLogConfigSchema, R as insertMediaSchema, T as insertPluginActivityLogSchema, V as insertPluginAssetSchema, X as insertPluginHookSchema, Y as insertPluginRouteSchema, Z as insertPluginSchema, _ as insertSystemLogSchema, $ as insertUserSchema, a0 as insertWorkflowHistorySchema, l as loadCollectionConfig, k as loadCollectionConfigs, a1 as logConfig, a2 as media, a3 as pluginActivityLog, a4 as pluginAssets, a5 as pluginHooks, a6 as pluginRoutes, a7 as plugins, r as registerCollections, a8 as selectContentSchema, a9 as selectLogConfigSchema, aa as selectMediaSchema, ab as selectPluginActivityLogSchema, ac as selectPluginAssetSchema, ad as selectPluginHookSchema, ae as selectPluginRouteSchema, af as selectPluginSchema, ag as selectSystemLogSchema, ah as selectUserSchema, ai as selectWorkflowHistorySchema, aj as systemLogs, ak as users, v as validateCollectionConfig, al as workflowHistory } from './plugin-bootstrap-qu8hJgUt.js';
9
+ import { e as FieldType } from './collection-config-JgHOpFCG.js';
10
+ export { C as CollectionConfig, b as CollectionConfigModule, c as CollectionSchema, d as CollectionSyncResult, F as FieldConfig } from './collection-config-JgHOpFCG.js';
4
11
  export { AuthManager, Permission, PermissionManager, UserPermissions, bootstrapMiddleware, cacheHeaders, compressionMiddleware, detailedLoggingMiddleware, getActivePlugins, isPluginActive, logActivity, loggingMiddleware, optionalAuth, performanceLoggingMiddleware, requireActivePlugin, requireActivePlugins, requireAnyPermission, requireAuth, requirePermission, requireRole, securityHeaders, securityLoggingMiddleware } from './middleware.js';
5
- export { H as HookSystemImpl, a as HookUtils, P as PluginManagerClass, b as PluginRegistryImpl, c as PluginValidatorClass, S as ScopedHookSystemClass } from './plugin-manager-Efx9RyDX.js';
6
- export { ROUTES_INFO, adminApiRoutes, adminCheckboxRoutes, adminCodeExamplesRoutes, adminCollectionsRoutes, adminContentRoutes, adminDashboardRoutes, adminDesignRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, adminTestimonialsRoutes, adminUsersRoutes, apiContentCrudRoutes, apiMediaRoutes, apiRoutes, apiSystemRoutes, authRoutes } from './routes.js';
7
- export { A as AlertData, C as ConfirmationDialogOptions, F as Filter, a as FilterBarData, b as FilterOption, c as FormData, d as FormField, P as PaginationData, T as TableColumn, e as TableData, g as getConfirmationDialogScript, r as renderAlert, f as renderConfirmationDialog, h as renderFilterBar, i as renderForm, j as renderFormField, k as renderPagination, l as renderTable } from './filter-bar.template-DlVYMk-T.js';
8
- import { e as FieldType } from './collection-config-B4PG-AaF.js';
9
- export { C as CollectionConfig, b as CollectionConfigModule, c as CollectionSchema, d as CollectionSyncResult, F as FieldConfig } from './collection-config-B4PG-AaF.js';
12
+ export { ROUTES_INFO, adminApiRoutes, adminCheckboxRoutes, adminCollectionsRoutes, adminContentRoutes, adminDashboardRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, adminUsersRoutes, apiContentCrudRoutes, apiMediaRoutes, apiRoutes, apiSystemRoutes, authRoutes } from './routes.js';
13
+ export { A as AdminLayoutCatalystData, a as AlertData, C as ConfirmationDialogOptions, F as Filter, b as FilterBarData, c as FilterOption, d as FormData, e as FormField, P as PaginationData, T as TableColumn, f as TableData, g as getConfirmationDialogScript, r as renderAdminLayoutCatalyst, h as renderAlert, i as renderConfirmationDialog, j as renderFilterBar, k as renderForm, l as renderFormField, m as renderPagination, n as renderTable } from './admin-layout-catalyst.template-DrwDUfsE.js';
10
14
  export { A as AuthService, C as ContentService, H as HOOKS, a as HookContext, b as HookHandler, c as HookName, d as HookSystem, M as MediaService, P as Plugin, f as PluginAdminPage, g as PluginBuilderOptions, h as PluginComponent, i as PluginConfig, j as PluginContext, k as PluginHook, l as PluginLogger, m as PluginManager, n as PluginMenuItem, o as PluginMiddleware, p as PluginModel, q as PluginRegistry, r as PluginRoutes, s as PluginService, t as PluginStatus, u as PluginValidationResult, v as PluginValidator, S as ScopedHookSystem } from './plugin-DDYetMF-.js';
11
15
  export { P as PluginManifest } from './plugin-manifest-Dpy8wxIB.js';
12
16
  export { F as FilterCondition, a as FilterGroup, b as FilterOperator, Q as QueryFilter, c as QueryFilterBuilder, d as QueryResult, S as SONICJS_VERSION, T as TemplateRenderer, e as buildQuery, f as escapeHtml, g as getCoreVersion, m as metricsTracker, r as renderTemplate, s as sanitizeInput, h as sanitizeObject, t as templateRenderer } from './version-DFTyGfIH.js';
13
17
  import * as drizzle_orm_d1 from 'drizzle-orm/d1';
14
- import { Hono, MiddlewareHandler, Context } from 'hono';
15
- import { z } from 'zod';
16
- import { D1Database as D1Database$1, KVNamespace, R2Bucket } from '@cloudflare/workers-types';
18
+ import 'better-auth/client';
19
+ import 'better-auth/plugins/email-otp';
20
+ import 'better-auth';
21
+ import 'better-auth/plugins/magic-link';
22
+ import 'better-call';
23
+ import 'zod/v4/core';
24
+ import 'zod';
25
+ import 'hono';
17
26
  import 'drizzle-zod';
18
27
  import 'drizzle-orm/sqlite-core';
19
28
  import 'hono/types';
29
+ import 'hono/utils/html';
20
30
 
21
31
  /**
22
- * SonicJS Plugin System Types
32
+ * Wrangler.toml [triggers] cron codegen
23
33
  *
24
- * Defines the core interfaces and types for the plugin system
34
+ * Cloudflare Workers cron triggers are deploy-time static they must be listed
35
+ * in `wrangler.toml` at deploy time and cannot be changed at runtime. This module
36
+ * provides utilities to generate and validate the `[triggers]` section from the
37
+ * plugin list, so the file stays in sync with declared plugin crons.
38
+ *
39
+ * Usage in a codegen script:
40
+ *
41
+ * const schedules = collectCronSchedules(allPlugins)
42
+ * const updated = updateWranglerTriggers(tomlContent, schedules)
43
+ * writeFileSync('wrangler.toml', updated, 'utf8')
44
+ *
45
+ * Usage in a CI guard test:
46
+ *
47
+ * const actual = parseCronTriggers(tomlContent)
48
+ * const expected = collectCronSchedules(allPlugins)
49
+ * expect(actual).toEqual(expected.sort())
25
50
  */
26
51
 
27
- interface Plugin {
28
- /** Unique plugin identifier */
29
- name: string;
30
- /** Plugin version (semantic versioning) */
31
- version: string;
32
- /** Human-readable description */
33
- description?: string;
34
- /** Plugin author information */
35
- author?: {
36
- name: string;
37
- email?: string;
38
- url?: string;
39
- };
40
- /** Plugin dependencies (other plugins required) */
41
- dependencies?: string[];
42
- /** SonicJS version compatibility */
43
- compatibility?: string;
44
- /** Plugin license */
45
- license?: string;
46
- routes?: PluginRoutes[];
47
- middleware?: PluginMiddleware[];
48
- models?: PluginModel[];
49
- services?: PluginService[];
50
- adminPages?: PluginAdminPage[];
51
- adminComponents?: PluginComponent[];
52
- menuItems?: PluginMenuItem[];
53
- hooks?: PluginHook[];
54
- install?: (context: PluginContext) => Promise<void>;
55
- uninstall?: (context: PluginContext) => Promise<void>;
56
- activate?: (context: PluginContext) => Promise<void>;
57
- deactivate?: (context: PluginContext) => Promise<void>;
58
- configure?: (config: PluginConfig) => Promise<void>;
59
- }
60
- interface PluginContext {
61
- /** Database instance */
62
- db: D1Database$1;
63
- /** Key-value storage */
64
- kv: KVNamespace;
65
- /** R2 storage bucket */
66
- r2?: R2Bucket;
67
- /** Plugin configuration */
68
- config: PluginConfig;
69
- /** Core SonicJS services */
70
- services: {
71
- auth: AuthService;
72
- content: ContentService;
73
- media: MediaService;
74
- };
75
- /** Hook system for inter-plugin communication */
76
- hooks: HookSystem | ScopedHookSystem;
77
- /** Logging utilities */
78
- logger: PluginLogger;
79
- }
80
- interface PluginConfig {
81
- /** Plugin-specific configuration */
82
- [key: string]: any;
83
- /** Whether plugin is enabled */
84
- enabled: boolean;
85
- /** Plugin installation timestamp */
86
- installedAt?: number;
87
- /** Plugin last update timestamp */
88
- updatedAt?: number;
89
- }
90
- interface PluginRoutes {
91
- /** Route path prefix */
92
- path: string;
93
- /** Hono route handler */
94
- handler: Hono;
95
- /** Route description */
96
- description?: string;
97
- /** Whether route requires authentication */
98
- requiresAuth?: boolean;
99
- /** Required roles for access */
100
- roles?: string[];
101
- /** Route priority (for ordering) */
102
- priority?: number;
103
- }
104
- interface PluginMiddleware {
105
- /** Middleware name */
106
- name: string;
107
- /** Middleware handler function */
108
- handler: MiddlewareHandler;
109
- /** Middleware description */
110
- description?: string;
111
- /** Middleware priority (lower = earlier) */
112
- priority?: number;
113
- /** Routes to apply middleware to */
114
- routes?: string[];
115
- /** Whether to apply globally */
116
- global?: boolean;
117
- }
118
- interface PluginModel {
119
- /** Model name */
120
- name: string;
121
- /** Database table name */
122
- tableName: string;
123
- /** Zod schema for validation */
124
- schema: z.ZodSchema;
125
- /** Database migrations */
126
- migrations: string[];
127
- /** Model relationships */
128
- relationships?: ModelRelationship[];
129
- /** Whether model extends core content */
130
- extendsContent?: boolean;
131
- }
132
- interface ModelRelationship {
133
- type: 'oneToOne' | 'oneToMany' | 'manyToMany';
134
- target: string;
135
- foreignKey?: string;
136
- joinTable?: string;
52
+ /**
53
+ * Parse the cron trigger expressions from a `wrangler.toml` file.
54
+ * Returns an array of cron strings found under `[triggers]`, sorted.
55
+ */
56
+ declare function parseCronTriggers(tomlContent: string): string[];
57
+ /**
58
+ * Update the `[triggers] crons` section in a wrangler.toml string.
59
+ *
60
+ * If the `[triggers]` section exists, replaces its `crons` line.
61
+ * If it does not exist and schedules is non-empty, appends it.
62
+ * If schedules is empty, removes the section entirely.
63
+ *
64
+ * Returns the updated toml content.
65
+ */
66
+ declare function updateWranglerTriggers(tomlContent: string, schedules: string[]): string;
67
+ /**
68
+ * Generate a wrangler.toml cron trigger comment block for documentation.
69
+ */
70
+ declare function generateTriggersComment(schedules: string[]): string;
71
+
72
+ /**
73
+ * Dependency-aware plugin ordering (topo-sort + cycle detection).
74
+ *
75
+ * Plugins declare `dependencies: ['other-plugin-id']`. This module produces a
76
+ * dependency-first order — so a plugin that depends on another is mounted and
77
+ * wired AFTER the dependency, not before. Today the `dependencies` field is
78
+ * inert (plugins are mounted/wired in declaration order). This makes it real.
79
+ *
80
+ * Reference: Infowall `register-plugins.ts` `topoSort`. The algorithm is the
81
+ * same iterative DFS with a `visiting` stack that Infowall uses, adapted to
82
+ * the structural plugin shape used here.
83
+ */
84
+ /** Thrown when `topoSort` detects a dependency cycle. */
85
+ declare class PluginDependencyCycleError extends Error {
86
+ readonly cycle: string[];
87
+ constructor(pluginId: string, visitStack: string[]);
137
88
  }
138
- interface PluginService {
139
- /** Service name */
140
- name: string;
141
- /** Service implementation */
142
- implementation: any;
143
- /** Service description */
144
- description?: string;
145
- /** Service dependencies */
89
+ /** Minimal structural shape this module needs from a plugin. */
90
+ interface SortablePlugin {
91
+ /** Stable unique identifier. Falls back to `name` when `id` is absent. */
92
+ id?: string;
93
+ name?: string;
94
+ /** IDs of plugins that must be mounted/wired before this one. */
146
95
  dependencies?: string[];
147
- /** Whether service is singleton */
148
- singleton?: boolean;
149
96
  }
150
- interface PluginAdminPage {
151
- /** Page path (relative to /admin) */
152
- path: string;
153
- /** Page title */
154
- title: string;
155
- /** Page component/template */
156
- component: string;
157
- /** Page description */
158
- description?: string;
159
- /** Required permissions */
160
- permissions?: string[];
161
- /** Menu item configuration */
162
- menuItem?: PluginMenuItem;
163
- /** Page icon */
164
- icon?: string;
97
+ interface TopoSortOptions {
98
+ /**
99
+ * When true, an unknown dependency id → throw. When false (default), emit a
100
+ * console.warn and skip the dependency (graceful degradation).
101
+ */
102
+ strict?: boolean;
165
103
  }
166
- interface PluginComponent {
167
- /** Component name */
104
+ /**
105
+ * Sort `plugins` into dependency-first order.
106
+ *
107
+ * Plugins with no `dependencies` field (old-style PluginBuilder plugins) sort
108
+ * at the front in their original declaration order, before any v3 plugins that
109
+ * might depend on them — this preserves backwards compatibility.
110
+ *
111
+ * @throws {PluginDependencyCycleError} if a dependency cycle is detected.
112
+ */
113
+ declare function topoSort<T extends SortablePlugin>(plugins: ReadonlyArray<T>, options?: TopoSortOptions): T[];
114
+
115
+ interface RbacRole {
116
+ id: string;
168
117
  name: string;
169
- /** Component template function */
170
- template: (props: any) => string;
171
- /** Component description */
172
- description?: string;
173
- /** Component props schema */
174
- propsSchema?: z.ZodSchema;
118
+ display_name: string;
119
+ description: string | null;
120
+ is_system: number;
175
121
  }
176
- interface PluginMenuItem {
177
- /** Menu item label */
178
- label: string;
179
- /** Menu item path */
180
- path: string;
181
- /** Menu item icon */
182
- icon?: string;
183
- /** Menu item order */
184
- order?: number;
185
- /** Parent menu item */
186
- parent?: string;
187
- /** Required permissions */
188
- permissions?: string[];
189
- /** Whether item is active */
190
- active?: boolean;
191
- }
192
- interface PluginHook {
193
- /** Hook name */
122
+ interface RbacVerb {
123
+ id: string;
194
124
  name: string;
195
- /** Hook handler function */
196
- handler: HookHandler;
197
- /** Hook priority */
198
- priority?: number;
199
- /** Hook description */
200
- description?: string;
201
- }
202
- type HookHandler = (data: any, context: HookContext) => Promise<any>;
203
- interface HookContext {
204
- /** Plugin that registered the hook */
205
- plugin: string;
206
- /** Hook execution context */
207
- context: PluginContext;
208
- /** Cancel hook execution */
209
- cancel?: () => void;
210
- }
211
- interface HookSystem {
212
- /** Register a hook handler */
213
- register(hookName: string, handler: HookHandler, priority?: number): void;
214
- /** Execute all handlers for a hook */
215
- execute(hookName: string, data: any, context?: any): Promise<any>;
216
- /** Remove a hook handler */
217
- unregister(hookName: string, handler: HookHandler): void;
218
- /** Get all registered hooks */
219
- getHooks(hookName: string): PluginHook[];
220
- /** Create a scoped hook system (optional) */
221
- createScope?(pluginName: string): ScopedHookSystem;
222
- }
223
- interface ScopedHookSystem {
224
- /** Register a hook handler */
225
- register(hookName: string, handler: HookHandler, priority?: number): void;
226
- /** Execute all handlers for a hook */
227
- execute(hookName: string, data: any, context?: any): Promise<any>;
228
- /** Remove a hook handler */
229
- unregister(hookName: string, handler: HookHandler): void;
230
- /** Remove all hooks for this scope */
231
- unregisterAll(): void;
232
- }
233
- interface AuthService {
234
- /** Generate JWT token for a user */
235
- generateToken(userId: string, email: string, role: string): Promise<string>;
236
- /** Verify and decode JWT token */
237
- verifyToken(token: string): Promise<any>;
238
- /** Set authentication cookie (useful for alternative auth methods) */
239
- setAuthCookie(context: Context, token: string, options?: {
240
- maxAge?: number;
241
- secure?: boolean;
242
- httpOnly?: boolean;
243
- sameSite?: 'Strict' | 'Lax' | 'None';
244
- }): void;
245
- /** Hash password */
246
- hashPassword(password: string): Promise<string>;
247
- /** Verify password against hash */
248
- verifyPassword(password: string, hash: string): Promise<boolean>;
249
- }
250
- interface AuthService {
251
- /** Verify user permissions */
252
- hasPermission(userId: string, permission: string): Promise<boolean>;
253
- /** Get current user */
254
- getCurrentUser(context: Context): Promise<any>;
255
- /** Create authentication middleware */
256
- createMiddleware(options?: any): MiddlewareHandler;
125
+ description: string | null;
126
+ is_system: number;
127
+ sort_order: number;
257
128
  }
258
- interface ContentService {
259
- /** Get content by ID */
260
- getById(id: string): Promise<any>;
261
- /** Create new content */
262
- create(data: any): Promise<any>;
263
- /** Update content */
264
- update(id: string, data: any): Promise<any>;
265
- /** Delete content */
266
- delete(id: string): Promise<void>;
267
- /** Search content */
268
- search(query: string, options?: any): Promise<any[]>;
269
- }
270
- interface MediaService {
271
- /** Upload file */
272
- upload(file: File, options?: any): Promise<any>;
273
- /** Get media by ID */
274
- getById(id: string): Promise<any>;
275
- /** Delete media */
276
- delete(id: string): Promise<void>;
277
- /** Transform image */
278
- transform(id: string, options: any): Promise<string>;
129
+ interface RbacResource {
130
+ key: string;
131
+ label: string;
132
+ group: 'system' | 'document_type';
279
133
  }
280
- interface PluginLogger {
281
- debug(message: string, data?: any): void;
282
- info(message: string, data?: any): void;
283
- warn(message: string, data?: any): void;
284
- error(message: string, error?: Error, data?: any): void;
134
+ type PermissionScope = 'none' | 'own' | 'any';
135
+ interface Grant {
136
+ role_id: string;
137
+ resource: string;
138
+ verb: string;
139
+ scope: Exclude<PermissionScope, 'none'>;
285
140
  }
286
- interface PluginBuilderOptions {
287
- name: string;
288
- version: string;
289
- description?: string;
290
- author?: Plugin['author'];
291
- dependencies?: string[];
141
+ declare class RbacService {
142
+ private db;
143
+ private kv?;
144
+ private static readonly LEGACY_ROLE_PRECEDENCE;
145
+ private _docs?;
146
+ constructor(db: D1Database, kv?: KVNamespace | undefined);
147
+ private docs;
148
+ private parse;
149
+ private listDocs;
150
+ private getDoc;
151
+ private upsertDoc;
152
+ private deleteDoc;
153
+ private roleToRow;
154
+ getRoles(): Promise<RbacRole[]>;
155
+ getVerbs(): Promise<RbacVerb[]>;
156
+ /** System resources + one `document_type:<name>` per active document type. */
157
+ getResources(): Promise<RbacResource[]>;
158
+ getGrants(): Promise<Grant[]>;
159
+ getRolesForUser(userId: string): Promise<RbacRole[]>;
160
+ /** Grants attached to a set of role ids (from the embedded role grants). */
161
+ private grantsForRoleIds;
162
+ /** Does a single grant row satisfy the requested (resource, verb)? */
163
+ private grantMatches;
164
+ private strongestScope;
165
+ /** Can the user perform `verb` on `resource`? Reads the live grant matrix. */
166
+ can(userId: string, resource: string, verb: string): Promise<boolean>;
167
+ /** Highest scope granted to the user for `resource:verb`. */
168
+ getPermissionScope(userId: string, resource: string, verb: string): Promise<PermissionScope>;
169
+ /** Flattened, human-readable permission list for a user. Cached in KV for 60 s. */
170
+ permissionsForUser(userId: string): Promise<string[]>;
171
+ createRole(name: string, displayName: string, description?: string): Promise<void>;
172
+ deleteRole(roleId: string): Promise<void>;
173
+ /**
174
+ * Update a role's display name and description. The `name` (slug) can only be
175
+ * changed for custom roles — system role names are referenced by the legacy
176
+ * mapping, so they stay fixed.
177
+ */
178
+ updateRole(roleId: string, displayName: string, description?: string, name?: string): Promise<void>;
179
+ /** Update displayName + portal access in a single write to avoid double-saveDraft FK issues. */
180
+ updateRoleAndPortalAccess(roleId: string, displayName: string, name: string | undefined, portalEnabled: boolean, description?: string): Promise<void>;
181
+ createVerb(name: string, description?: string): Promise<void>;
182
+ deleteVerb(verbId: string): Promise<void>;
183
+ /** Replace all grants for one role with the supplied (resource, verb, scope) rows. */
184
+ setRoleGrants(roleId: string, pairs: Array<{
185
+ resource: string;
186
+ verb: string;
187
+ scope?: Exclude<PermissionScope, 'none'>;
188
+ }>): Promise<void>;
189
+ /**
190
+ * Count active users (optionally excluding one) who hold BOTH an effective
191
+ * portal:access grant and an effective rbac:manage grant — the users who could
192
+ * recover from a permission lockout. Powers the self-lockout guard.
193
+ */
194
+ countPortalAdmins(excludeUserId?: string): Promise<number>;
195
+ /**
196
+ * Replace a user's RBAC role assignments. The `rbac_user_roles` document is the
197
+ * single source of truth for authorization; the legacy `auth_user.role` column
198
+ * is kept as a derived projection (highest-precedence system role, else
199
+ * 'viewer') so the two never diverge.
200
+ */
201
+ setUserRoles(userId: string, roleIds: string[]): Promise<void>;
202
+ setRolePortalAccess(roleId: string, enabled: boolean): Promise<void>;
203
+ /**
204
+ * Seed the system roles, verbs, and their grants as documents. Idempotent —
205
+ * existing roles/verbs (by slug) are left untouched. Replaces the INSERT OR
206
+ * IGNORE seeds that lived in migration 0001. Call at bootstrap, after the rbac
207
+ * document types are registered.
208
+ */
209
+ ensureSystemRbacSeed(): Promise<void>;
210
+ /** Assign a role to a user by role name (e.g. 'admin'), preserving existing roles. */
211
+ addUserRoleByName(userId: string, roleName: string): Promise<void>;
292
212
  }
293
213
 
294
- declare function createDb(d1: D1Database): drizzle_orm_d1.DrizzleD1Database<typeof schema> & {
295
- $client: D1Database;
296
- };
214
+ declare function bootstrapDocumentTypes(db: D1Database$1): Promise<void>;
297
215
 
298
216
  /**
299
- * Plugin Builder SDK
217
+ * Cloudflare Email binding provider (MailChannels / send_email binding)
300
218
  *
301
- * Provides a fluent API for building SonicJS plugins
219
+ * Sends email through a Cloudflare `send_email` Workers binding.
220
+ * Configure via `wrangler.toml`:
302
221
  *
303
- * @packageDocumentation
304
- */
305
-
306
- /**
307
- * Fluent builder for creating SonicJS plugins.
308
- *
309
- * @beta This API is in beta and may change in future releases.
222
+ * [[send_email]]
223
+ * name = "SEND_EMAIL"
224
+ * destination_address = "you@yourdomain.com" # optional allowlist
310
225
  *
311
- * @example
312
- * ```typescript
313
- * import { PluginBuilder } from '@sonicjs-cms/core'
226
+ * Then pass `SEND_EMAIL` as the `binding` when constructing:
227
+ * new CloudflareEmailProvider({ binding: env.SEND_EMAIL, defaultFrom: 'no-reply@example.com' })
314
228
  *
315
- * const plugin = PluginBuilder.create({
316
- * name: 'my-plugin',
317
- * version: '1.0.0',
318
- * description: 'My custom plugin'
319
- * })
320
- * .addRoute('/api/my-plugin', routes)
321
- * .addHook('content:save', handler)
322
- * .lifecycle({ activate: async () => console.log('Activated!') })
323
- * .build()
324
- * ```
229
+ * Note: delivery state tracking is not available through the MailChannels API;
230
+ * the `reconcile()` method is a no-op for this provider. Production delivery
231
+ * monitoring should use Cloudflare Email Event Notifications (separate webhook).
325
232
  */
326
- declare class PluginBuilder {
327
- private plugin;
328
- constructor(options: PluginBuilderOptions);
329
- /**
330
- * Create a new plugin builder
331
- */
332
- static create(options: PluginBuilderOptions): PluginBuilder;
333
- /**
334
- * Add metadata to the plugin
335
- */
336
- metadata(metadata: {
337
- description?: string;
338
- author?: Plugin['author'];
339
- license?: string;
340
- compatibility?: string;
341
- dependencies?: string[];
342
- }): PluginBuilder;
343
- /**
344
- * Add routes to plugin
345
- */
346
- addRoutes(routes: PluginRoutes[]): PluginBuilder;
347
- /**
348
- * Add a single route to plugin
349
- */
350
- addRoute(path: string, handler: Hono, options?: {
351
- description?: string;
352
- requiresAuth?: boolean;
353
- roles?: string[];
354
- priority?: number;
355
- }): PluginBuilder;
356
- /**
357
- * Add middleware to plugin
358
- */
359
- addMiddleware(middleware: PluginMiddleware[]): PluginBuilder;
360
- /**
361
- * Add a single middleware to plugin
362
- */
363
- addSingleMiddleware(name: string, handler: any, options?: {
364
- description?: string;
365
- priority?: number;
366
- routes?: string[];
367
- global?: boolean;
368
- }): PluginBuilder;
369
- /**
370
- * Add models to plugin
371
- */
372
- addModels(models: PluginModel[]): PluginBuilder;
373
- /**
374
- * Add a single model to plugin
375
- */
376
- addModel(name: string, options: {
377
- tableName: string;
378
- schema: z.ZodSchema;
379
- migrations: string[];
380
- relationships?: PluginModel['relationships'];
381
- extendsContent?: boolean;
382
- }): PluginBuilder;
383
- /**
384
- * Add services to plugin
385
- */
386
- addServices(services: PluginService[]): PluginBuilder;
387
- /**
388
- * Add a single service to plugin
389
- */
390
- addService(name: string, implementation: any, options?: {
391
- description?: string;
392
- dependencies?: string[];
393
- singleton?: boolean;
394
- }): PluginBuilder;
395
- /**
396
- * Add admin pages to plugin
397
- */
398
- addAdminPages(pages: PluginAdminPage[]): PluginBuilder;
399
- /**
400
- * Add a single admin page to plugin
401
- */
402
- addAdminPage(path: string, title: string, component: string, options?: {
403
- description?: string;
404
- permissions?: string[];
405
- icon?: string;
406
- menuItem?: PluginMenuItem;
407
- }): PluginBuilder;
408
- /**
409
- * Add admin components to plugin
410
- */
411
- addComponents(components: PluginComponent[]): PluginBuilder;
412
- /**
413
- * Add a single admin component to plugin
414
- */
415
- addComponent(name: string, template: (props: any) => string, options?: {
416
- description?: string;
417
- propsSchema?: z.ZodSchema;
418
- }): PluginBuilder;
419
- /**
420
- * Add menu items to plugin
421
- */
422
- addMenuItems(items: PluginMenuItem[]): PluginBuilder;
423
- /**
424
- * Add a single menu item to plugin
425
- */
426
- addMenuItem(label: string, path: string, options?: {
427
- icon?: string;
428
- order?: number;
429
- parent?: string;
430
- permissions?: string[];
431
- }): PluginBuilder;
432
- /**
433
- * Add hooks to plugin
434
- */
435
- addHooks(hooks: PluginHook[]): PluginBuilder;
436
- /**
437
- * Add a single hook to plugin
438
- */
439
- addHook(name: string, handler: any, options?: {
440
- priority?: number;
441
- description?: string;
442
- }): PluginBuilder;
443
- /**
444
- * Add lifecycle hooks
445
- */
446
- lifecycle(hooks: {
447
- install?: Plugin['install'];
448
- uninstall?: Plugin['uninstall'];
449
- activate?: Plugin['activate'];
450
- deactivate?: Plugin['deactivate'];
451
- configure?: Plugin['configure'];
452
- }): PluginBuilder;
453
- /**
454
- * Build the plugin
455
- */
456
- build(): Plugin;
233
+
234
+ /** Minimal shape of the Cloudflare `send_email` binding object. */
235
+ interface CFSendEmailBinding {
236
+ /** Send an RFC-2822 formatted email. */
237
+ send(message: {
238
+ from: string;
239
+ to: string[];
240
+ subject: string;
241
+ html?: string;
242
+ text?: string;
243
+ reply_to?: string;
244
+ }): Promise<void>;
245
+ }
246
+ interface CloudflareEmailProviderOptions {
247
+ /** The `send_email` binding from `env`. */
248
+ binding: CFSendEmailBinding;
249
+ /** Default from-address (must be verified on your Cloudflare account). */
250
+ defaultFrom?: string;
457
251
  }
252
+ declare class CloudflareEmailProvider implements EmailProvider {
253
+ readonly name = "cloudflare-email";
254
+ private readonly binding;
255
+ private readonly defaultFrom;
256
+ constructor(options: CloudflareEmailProviderOptions);
257
+ isConfigured(): boolean;
258
+ send(message: NormalizedEmailMessage): Promise<SendResult>;
259
+ }
260
+
261
+ declare const emailReconciliationPlugin: DefinedPlugin;
262
+
263
+ declare const redirectPlugin: DefinedPlugin;
264
+ declare function createRedirectPlugin(): DefinedPlugin;
265
+
458
266
  /**
459
- * Helper functions for common plugin patterns.
267
+ * Site Settings Collection
460
268
  *
461
- * @beta This API is in beta and may change in future releases.
269
+ * Stores site-wide configuration settings (general, security, etc.) as singleton documents.
270
+ * Each settings group is stored as a separate document with a fixed slug.
462
271
  */
463
- declare class PluginHelpers {
464
- /**
465
- * Create a REST API route for a model.
466
- *
467
- * @experimental This method returns placeholder routes. Full implementation coming soon.
468
- */
469
- static createModelAPI(modelName: string, options?: {
470
- basePath?: string;
471
- permissions?: {
472
- read?: string[];
473
- write?: string[];
474
- delete?: string[];
272
+ declare const _default: {
273
+ name: string;
274
+ displayName: string;
275
+ description: string;
276
+ icon: string;
277
+ color: string;
278
+ internal: true;
279
+ schema: {
280
+ type: "object";
281
+ properties: {
282
+ siteName: {
283
+ type: "string";
284
+ title: string;
285
+ description: string;
286
+ required: true;
287
+ maxLength: number;
288
+ placeholder: string;
289
+ };
290
+ siteDescription: {
291
+ type: "string";
292
+ title: string;
293
+ description: string;
294
+ required: true;
295
+ maxLength: number;
296
+ placeholder: string;
297
+ };
298
+ adminEmail: {
299
+ type: "email";
300
+ title: string;
301
+ description: string;
302
+ required: true;
303
+ placeholder: string;
304
+ };
305
+ timezone: {
306
+ type: "select";
307
+ title: string;
308
+ description: string;
309
+ enum: string[];
310
+ default: string;
311
+ required: true;
312
+ };
313
+ language: {
314
+ type: "select";
315
+ title: string;
316
+ description: string;
317
+ enum: string[];
318
+ enumLabels: string[];
319
+ default: string;
320
+ required: true;
321
+ };
322
+ maintenanceMode: {
323
+ type: "checkbox";
324
+ title: string;
325
+ description: string;
326
+ default: boolean;
327
+ };
328
+ jwtExpiresIn: {
329
+ type: "string";
330
+ title: string;
331
+ description: string;
332
+ required: false;
333
+ maxLength: number;
334
+ placeholder: string;
335
+ };
336
+ jwtRefreshGraceSeconds: {
337
+ type: "number";
338
+ title: string;
339
+ description: string;
340
+ required: false;
341
+ min: number;
342
+ max: number;
343
+ };
475
344
  };
476
- }): Hono;
477
- /**
478
- * Create an admin CRUD interface for a model.
479
- *
480
- * @experimental This method generates basic admin page structures. Full implementation coming soon.
481
- */
482
- static createAdminInterface(modelName: string, options?: {
483
- icon?: string;
484
- permissions?: string[];
485
- fields?: Array<{
486
- name: string;
487
- type: string;
488
- label: string;
489
- required?: boolean;
490
- }>;
491
- }): {
492
- pages: PluginAdminPage[];
493
- menuItems: PluginMenuItem[];
345
+ required: string[];
494
346
  };
495
- /**
496
- * Create a database migration for a model
497
- */
498
- static createMigration(tableName: string, fields: Array<{
499
- name: string;
500
- type: 'TEXT' | 'INTEGER' | 'REAL' | 'BLOB';
501
- nullable?: boolean;
502
- primaryKey?: boolean;
503
- unique?: boolean;
504
- defaultValue?: string;
505
- }>): string;
506
- /**
507
- * Create a Zod schema for a model
508
- */
509
- static createSchema(fields: Array<{
510
- name: string;
511
- type: 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object';
512
- optional?: boolean;
513
- required?: boolean;
514
- validation?: any;
515
- items?: any;
516
- properties?: Record<string, any>;
517
- }>): z.ZodSchema;
518
- }
347
+ managed: true;
348
+ isActive: true;
349
+ metadata: {
350
+ purpose: string;
351
+ version: string;
352
+ singletonGroups: string[];
353
+ };
354
+ };
355
+
356
+ declare function createDb(d1: D1Database): drizzle_orm_d1.DrizzleD1Database<typeof schema> & {
357
+ $client: D1Database;
358
+ };
519
359
 
520
360
  /**
521
361
  * OAuth Providers Plugin
@@ -530,9 +370,8 @@ declare class PluginHelpers {
530
370
  * POST /auth/oauth/unlink → Unlink OAuth provider from account
531
371
  * GET /auth/oauth/accounts → List linked OAuth accounts for current user
532
372
  */
533
-
534
- declare function createOAuthProvidersPlugin(): Plugin;
535
- declare const oauthProvidersPlugin: Plugin;
373
+ declare const oauthProvidersPlugin: DefinedPlugin;
374
+ declare function createOAuthProvidersPlugin(): DefinedPlugin;
536
375
 
537
376
  /**
538
377
  * OAuth Service
@@ -669,20 +508,19 @@ declare function defineUserProfile(config: UserProfileConfig): void;
669
508
  declare function getUserProfileConfig(): UserProfileConfig | null;
670
509
 
671
510
  /**
672
- * User Profiles Plugin
511
+ * User Profiles Plugin — Payload-shaped port.
673
512
  *
674
- * Configurable custom profile fields for users.
675
- * Developers call defineUserProfile() at app boot to declare custom fields
676
- * that are stored as JSON in user_profiles.data and rendered in the admin UI.
513
+ * Configurable custom profile fields for users. defineUserProfile() at app
514
+ * boot declares custom fields stored as JSON in auth_user_profiles.data and
515
+ * rendered in the admin UI.
677
516
  *
678
517
  * API Routes:
679
518
  * GET /api/user-profiles/schema → Public field definitions
680
- * GET /api/user-profiles/:userId → Get custom data for a user (auth required)
681
- * PUT /api/user-profiles/:userId → Update custom data for a user (auth required)
519
+ * GET /api/user-profiles/:userId → Get custom data for a user
520
+ * PUT /api/user-profiles/:userId → Update custom data for a user
682
521
  */
683
-
684
- declare function createUserProfilesPlugin(): Plugin;
685
- declare const userProfilesPlugin: Plugin;
522
+ declare const userProfilesPlugin: DefinedPlugin;
523
+ declare function createUserProfilesPlugin(): DefinedPlugin;
686
524
 
687
525
  /**
688
526
  * @sonicjs/core - Main Entry Point
@@ -704,4 +542,4 @@ declare const userProfilesPlugin: Plugin;
704
542
 
705
543
  declare const VERSION: string;
706
544
 
707
- export { BUILT_IN_PROVIDERS, FieldType, OAuthService, PluginBuilder, PluginHelpers, type ProfileFieldDefinition, type UserProfileConfig, VERSION, createDb, createOAuthProvidersPlugin, createUserProfilesPlugin, defineUserProfile, getUserProfileConfig, oauthProvidersPlugin, userProfilesPlugin };
545
+ export { BUILT_IN_PROVIDERS, type CFSendEmailBinding, CloudflareEmailProvider, type CloudflareEmailProviderOptions, FieldType, OAuthService, PluginDependencyCycleError, type ProfileFieldDefinition, RbacService, type SortablePlugin, type TopoSortOptions, type UserProfileConfig, VERSION, bootstrapDocumentTypes, createDb, createOAuthProvidersPlugin, createRedirectPlugin, createUserProfilesPlugin, defineUserProfile, emailReconciliationPlugin, generateTriggersComment, getUserProfileConfig, oauthProvidersPlugin, parseCronTriggers, redirectPlugin, _default as siteSettingsCollection, topoSort, updateWranglerTriggers, userProfilesPlugin };