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

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 (225) hide show
  1. package/README.md +4 -3
  2. package/dist/admin-documents-form.template-KN7JF66Q.cjs +19 -0
  3. package/dist/{admin-layout-catalyst.template-UMTIN66R.js.map → admin-documents-form.template-KN7JF66Q.cjs.map} +1 -1
  4. package/dist/admin-documents-form.template-NLSI6Z42.js +6 -0
  5. package/dist/{admin-layout-catalyst.template-HFD37TY5.cjs.map → admin-documents-form.template-NLSI6Z42.js.map} +1 -1
  6. package/dist/admin-layout-catalyst.template-WHJGSWWD.js +7 -0
  7. package/dist/admin-layout-catalyst.template-WHJGSWWD.js.map +1 -0
  8. package/dist/admin-layout-catalyst.template-ZK5HD545.cjs +17 -0
  9. package/dist/admin-layout-catalyst.template-ZK5HD545.cjs.map +1 -0
  10. package/dist/app-Bo0X1OWX.d.ts +1268 -0
  11. package/dist/app-Do66yCcV.d.cts +1268 -0
  12. package/dist/cache-DDARE4QE.js +4 -0
  13. package/dist/cache-DDARE4QE.js.map +1 -0
  14. package/dist/cache-LVYS4BPL.cjs +33 -0
  15. package/dist/cache-LVYS4BPL.cjs.map +1 -0
  16. package/dist/chunk-2CB4KY7I.cjs +771 -0
  17. package/dist/chunk-2CB4KY7I.cjs.map +1 -0
  18. package/dist/{chunk-55RDMDOP.js → chunk-3TB6AT6X.js} +148 -55
  19. package/dist/chunk-3TB6AT6X.js.map +1 -0
  20. package/dist/{chunk-ON5ZMSU4.js → chunk-6JQOUUOB.js} +3 -3
  21. package/dist/chunk-6JQOUUOB.js.map +1 -0
  22. package/dist/chunk-6OUHGKFD.js +387 -0
  23. package/dist/chunk-6OUHGKFD.js.map +1 -0
  24. package/dist/{chunk-DSUJ5YQH.cjs → chunk-AAWNRBRB.cjs} +537 -92
  25. package/dist/chunk-AAWNRBRB.cjs.map +1 -0
  26. package/dist/chunk-AI663NBO.js +821 -0
  27. package/dist/chunk-AI663NBO.js.map +1 -0
  28. package/dist/chunk-BDDABDAB.cjs +1149 -0
  29. package/dist/chunk-BDDABDAB.cjs.map +1 -0
  30. package/dist/chunk-BLMTL57B.js +767 -0
  31. package/dist/chunk-BLMTL57B.js.map +1 -0
  32. package/dist/chunk-DNQCEKUK.cjs +327 -0
  33. package/dist/chunk-DNQCEKUK.cjs.map +1 -0
  34. package/dist/chunk-DSA4UX5B.cjs +276 -0
  35. package/dist/chunk-DSA4UX5B.cjs.map +1 -0
  36. package/dist/chunk-EF2NQUIQ.js +323 -0
  37. package/dist/chunk-EF2NQUIQ.js.map +1 -0
  38. package/dist/chunk-GCDZZNIN.js +192 -0
  39. package/dist/chunk-GCDZZNIN.js.map +1 -0
  40. package/dist/{chunk-ABB34XUS.cjs → chunk-H2AXVCLS.cjs} +667 -19
  41. package/dist/chunk-H2AXVCLS.cjs.map +1 -0
  42. package/dist/{chunk-XWIA3HVX.js → chunk-HDWE5FRJ.js} +6 -1249
  43. package/dist/chunk-HDWE5FRJ.js.map +1 -0
  44. package/dist/chunk-HIKBY7MS.cjs +70 -0
  45. package/dist/chunk-HIKBY7MS.cjs.map +1 -0
  46. package/dist/chunk-IESEVHXL.js +66 -0
  47. package/dist/chunk-IESEVHXL.js.map +1 -0
  48. package/dist/chunk-IVPRUGTY.js +242 -0
  49. package/dist/chunk-IVPRUGTY.js.map +1 -0
  50. package/dist/{chunk-SQ6FNXU2.cjs → chunk-IXUHXTHW.cjs} +2 -151
  51. package/dist/chunk-IXUHXTHW.cjs.map +1 -0
  52. package/dist/chunk-J6JTWD2A.cjs +100 -0
  53. package/dist/chunk-J6JTWD2A.cjs.map +1 -0
  54. package/dist/chunk-JEQ7FLOD.cjs +199 -0
  55. package/dist/chunk-JEQ7FLOD.cjs.map +1 -0
  56. package/dist/chunk-K25XHMM3.js +566 -0
  57. package/dist/chunk-K25XHMM3.js.map +1 -0
  58. package/dist/chunk-LRZIAW7U.cjs +158 -0
  59. package/dist/chunk-LRZIAW7U.cjs.map +1 -0
  60. package/dist/{chunk-OHYBNCVL.cjs → chunk-MVIZJOO5.cjs} +10 -1256
  61. package/dist/chunk-MVIZJOO5.cjs.map +1 -0
  62. package/dist/{chunk-UYJ6TJHX.cjs → chunk-NAVPFIG5.cjs} +148 -55
  63. package/dist/chunk-NAVPFIG5.cjs.map +1 -0
  64. package/dist/chunk-NLJVSER2.js +273 -0
  65. package/dist/chunk-NLJVSER2.js.map +1 -0
  66. package/dist/chunk-NMPEMSU4.js +154 -0
  67. package/dist/chunk-NMPEMSU4.js.map +1 -0
  68. package/dist/chunk-NUKJ54GA.cjs +245 -0
  69. package/dist/chunk-NUKJ54GA.cjs.map +1 -0
  70. package/dist/{chunk-T3Q5V33G.cjs → chunk-QAYFOER6.cjs} +621 -829
  71. package/dist/chunk-QAYFOER6.cjs.map +1 -0
  72. package/dist/{chunk-MGFRZO24.js → chunk-QZGABF2M.js} +3 -149
  73. package/dist/chunk-QZGABF2M.js.map +1 -0
  74. package/dist/chunk-RNZFGN4R.js +88 -0
  75. package/dist/chunk-RNZFGN4R.js.map +1 -0
  76. package/dist/chunk-RZ6H7OZK.js +1134 -0
  77. package/dist/chunk-RZ6H7OZK.js.map +1 -0
  78. package/dist/{chunk-XXDFQERJ.js → chunk-VD2EA3WT.js} +7192 -9806
  79. package/dist/chunk-VD2EA3WT.js.map +1 -0
  80. package/dist/{chunk-SXXTQETM.cjs → chunk-VXE42MYF.cjs} +8722 -11323
  81. package/dist/chunk-VXE42MYF.cjs.map +1 -0
  82. package/dist/{chunk-4ZSNJDLS.cjs → chunk-WULONYGB.cjs} +9 -9
  83. package/dist/chunk-WULONYGB.cjs.map +1 -0
  84. package/dist/chunk-XW56B23A.cjs +408 -0
  85. package/dist/chunk-XW56B23A.cjs.map +1 -0
  86. package/dist/chunk-YA3TJ65D.cjs +575 -0
  87. package/dist/chunk-YA3TJ65D.cjs.map +1 -0
  88. package/dist/{chunk-TFNTM3OA.js → chunk-YHSQVQXX.js} +645 -15
  89. package/dist/chunk-YHSQVQXX.js.map +1 -0
  90. package/dist/chunk-YP7GW2G5.cjs +866 -0
  91. package/dist/chunk-YP7GW2G5.cjs.map +1 -0
  92. package/dist/{chunk-QFWHAFEO.js → chunk-ZEZ245PW.js} +148 -858
  93. package/dist/chunk-ZEZ245PW.js.map +1 -0
  94. package/dist/{chunk-EW5NOBVU.js → chunk-ZGGXCFR6.js} +611 -817
  95. package/dist/chunk-ZGGXCFR6.js.map +1 -0
  96. package/dist/{collection-config-B4PG-AaF.d.cts → collection-config-JgHOpFCG.d.cts} +30 -2
  97. package/dist/{collection-config-B4PG-AaF.d.ts → collection-config-JgHOpFCG.d.ts} +30 -2
  98. package/dist/config-HFXANXCC.js +6 -0
  99. package/dist/config-HFXANXCC.js.map +1 -0
  100. package/dist/config-ON6FNMYX.cjs +19 -0
  101. package/dist/config-ON6FNMYX.cjs.map +1 -0
  102. package/dist/define-plugin-BzNHc1ZI.d.ts +1321 -0
  103. package/dist/define-plugin-IWDKYaVm.d.cts +1321 -0
  104. package/dist/document-projection-TDWRJX3Z.cjs +13 -0
  105. package/dist/document-projection-TDWRJX3Z.cjs.map +1 -0
  106. package/dist/document-projection-YYMC6I4U.js +4 -0
  107. package/dist/document-projection-YYMC6I4U.js.map +1 -0
  108. package/dist/index.cjs +13735 -4329
  109. package/dist/index.cjs.map +1 -1
  110. package/dist/index.d.cts +329 -492
  111. package/dist/index.d.ts +329 -492
  112. package/dist/index.js +13386 -3999
  113. package/dist/index.js.map +1 -1
  114. package/dist/middleware.cjs +36 -32
  115. package/dist/middleware.d.cts +69 -7
  116. package/dist/middleware.d.ts +69 -7
  117. package/dist/middleware.js +7 -3
  118. package/dist/migrations-NJJWQUKK.cjs +13 -0
  119. package/dist/{migrations-IYNTWDC6.cjs.map → migrations-NJJWQUKK.cjs.map} +1 -1
  120. package/dist/migrations-WCAVBD7C.js +4 -0
  121. package/dist/{migrations-R337UD46.js.map → migrations-WCAVBD7C.js.map} +1 -1
  122. package/dist/{plugin-bootstrap-DfVerYV4.d.cts → plugin-bootstrap-B8ThJU21.d.cts} +4315 -1661
  123. package/dist/{plugin-bootstrap-P_ciLp_C.d.ts → plugin-bootstrap-qu8hJgUt.d.ts} +4315 -1661
  124. package/dist/plugins.cjs +171 -12
  125. package/dist/plugins.d.cts +36 -2
  126. package/dist/plugins.d.ts +36 -2
  127. package/dist/plugins.js +5 -2
  128. package/dist/rbac-O73MFKDA.js +5 -0
  129. package/dist/rbac-O73MFKDA.js.map +1 -0
  130. package/dist/rbac-VONLJJKB.cjs +14 -0
  131. package/dist/rbac-VONLJJKB.cjs.map +1 -0
  132. package/dist/routes.cjs +41 -45
  133. package/dist/routes.d.cts +56 -146
  134. package/dist/routes.d.ts +56 -146
  135. package/dist/routes.js +17 -9
  136. package/dist/services.cjs +39 -72
  137. package/dist/services.d.cts +79 -54
  138. package/dist/services.d.ts +79 -54
  139. package/dist/services.js +6 -3
  140. package/dist/templates.cjs +17 -29
  141. package/dist/templates.d.cts +1 -66
  142. package/dist/templates.d.ts +1 -66
  143. package/dist/templates.js +3 -3
  144. package/dist/types-Dea1eNxU.d.cts +286 -0
  145. package/dist/types-Dea1eNxU.d.ts +286 -0
  146. package/dist/types.d.cts +1 -1
  147. package/dist/types.d.ts +1 -1
  148. package/dist/utils.cjs +18 -17
  149. package/dist/utils.d.cts +1 -1
  150. package/dist/utils.d.ts +1 -1
  151. package/dist/utils.js +2 -1
  152. package/migrations/0001_core.sql +184 -0
  153. package/migrations/0002_documents.sql +163 -0
  154. package/package.json +12 -7
  155. package/dist/admin-layout-catalyst.template-HFD37TY5.cjs +0 -17
  156. package/dist/admin-layout-catalyst.template-UMTIN66R.js +0 -7
  157. package/dist/app-C9esKLmh.d.cts +0 -112
  158. package/dist/app-C9esKLmh.d.ts +0 -112
  159. package/dist/chunk-4R3NOOL3.js +0 -2217
  160. package/dist/chunk-4R3NOOL3.js.map +0 -1
  161. package/dist/chunk-4ZSNJDLS.cjs.map +0 -1
  162. package/dist/chunk-55RDMDOP.js.map +0 -1
  163. package/dist/chunk-635JAMSE.cjs +0 -653
  164. package/dist/chunk-635JAMSE.cjs.map +0 -1
  165. package/dist/chunk-ABB34XUS.cjs.map +0 -1
  166. package/dist/chunk-C54YUA23.cjs +0 -2219
  167. package/dist/chunk-C54YUA23.cjs.map +0 -1
  168. package/dist/chunk-DSUJ5YQH.cjs.map +0 -1
  169. package/dist/chunk-EW5NOBVU.js.map +0 -1
  170. package/dist/chunk-EXNEW5US.js +0 -648
  171. package/dist/chunk-EXNEW5US.js.map +0 -1
  172. package/dist/chunk-I2H5NGJQ.js +0 -692
  173. package/dist/chunk-I2H5NGJQ.js.map +0 -1
  174. package/dist/chunk-MGFRZO24.js.map +0 -1
  175. package/dist/chunk-OHYBNCVL.cjs.map +0 -1
  176. package/dist/chunk-ON5ZMSU4.js.map +0 -1
  177. package/dist/chunk-QFWHAFEO.js.map +0 -1
  178. package/dist/chunk-SQ6FNXU2.cjs.map +0 -1
  179. package/dist/chunk-SXXTQETM.cjs.map +0 -1
  180. package/dist/chunk-T3Q5V33G.cjs.map +0 -1
  181. package/dist/chunk-TFNTM3OA.js.map +0 -1
  182. package/dist/chunk-UYJ6TJHX.cjs.map +0 -1
  183. package/dist/chunk-WAEQXGCX.cjs +0 -1898
  184. package/dist/chunk-WAEQXGCX.cjs.map +0 -1
  185. package/dist/chunk-XWIA3HVX.js.map +0 -1
  186. package/dist/chunk-XXDFQERJ.js.map +0 -1
  187. package/dist/migrations-IYNTWDC6.cjs +0 -13
  188. package/dist/migrations-R337UD46.js +0 -4
  189. package/dist/plugin-manager-BoM3Q7o7.d.cts +0 -328
  190. package/dist/plugin-manager-Efx9RyDX.d.ts +0 -328
  191. package/migrations/001_initial_schema.sql +0 -170
  192. package/migrations/002_faq_plugin.sql +0 -86
  193. package/migrations/003_stage5_enhancements.sql +0 -121
  194. package/migrations/004_stage6_user_management.sql +0 -183
  195. package/migrations/005_stage7_workflow_automation.sql +0 -294
  196. package/migrations/006_plugin_system.sql +0 -155
  197. package/migrations/007_demo_login_plugin.sql +0 -23
  198. package/migrations/008_fix_slug_validation.sql +0 -22
  199. package/migrations/009_system_logging.sql +0 -57
  200. package/migrations/011_config_managed_collections.sql +0 -15
  201. package/migrations/012_testimonials_plugin.sql +0 -80
  202. package/migrations/013_code_examples_plugin.sql +0 -177
  203. package/migrations/014_fix_plugin_registry.sql +0 -88
  204. package/migrations/015_add_remaining_plugins.sql +0 -89
  205. package/migrations/016_remove_duplicate_cache_plugin.sql +0 -17
  206. package/migrations/017_auth_configurable_fields.sql +0 -49
  207. package/migrations/018_settings_table.sql +0 -23
  208. package/migrations/019_remove_blog_posts_collection.sql +0 -15
  209. package/migrations/020_add_email_plugin.sql +0 -22
  210. package/migrations/021_add_magic_link_auth_plugin.sql +0 -42
  211. package/migrations/022_add_tinymce_plugin.sql +0 -25
  212. package/migrations/023_add_easy_mdx_plugin.sql +0 -25
  213. package/migrations/024_add_quill_editor_plugin.sql +0 -25
  214. package/migrations/025_add_easymde_plugin.sql +0 -25
  215. package/migrations/026_add_otp_login.sql +0 -42
  216. package/migrations/027_fix_slug_field_type.sql +0 -18
  217. package/migrations/028_fix_slug_field_type_in_schemas.sql +0 -30
  218. package/migrations/029_add_forms_system.sql +0 -184
  219. package/migrations/030_add_turnstile_to_forms.sql +0 -14
  220. package/migrations/031_ai_search_plugin.sql +0 -45
  221. package/migrations/032_user_profiles.sql +0 -37
  222. package/migrations/033_form_content_integration.sql +0 -19
  223. package/migrations/034_security_audit_plugin.sql +0 -27
  224. package/migrations/035_user_profiles_data_column.sql +0 -16
  225. package/migrations/036_analytics_events.sql +0 -22
package/dist/index.d.cts CHANGED
@@ -1,521 +1,360 @@
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.cjs';
2
- import { B as schema } from './plugin-bootstrap-DfVerYV4.cjs';
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-DfVerYV4.cjs';
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-Do66yCcV.cjs';
2
+ import { o as DefinedPlugin } from './define-plugin-IWDKYaVm.cjs';
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-IWDKYaVm.cjs';
4
+ import { D1Database as D1Database$1 } from '@cloudflare/workers-types';
5
+ import { E as EmailProvider, N as NormalizedEmailMessage, q as SendResult } from './types-Dea1eNxU.cjs';
6
+ export { s as EmailLogRow } from './types-Dea1eNxU.cjs';
7
+ import { s as schema } from './plugin-bootstrap-B8ThJU21.cjs';
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-B8ThJU21.cjs';
9
+ import { e as FieldType } from './collection-config-JgHOpFCG.cjs';
10
+ export { C as CollectionConfig, b as CollectionConfigModule, c as CollectionSchema, d as CollectionSyncResult, F as FieldConfig } from './collection-config-JgHOpFCG.cjs';
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.cjs';
5
- export { H as HookSystemImpl, a as HookUtils, P as PluginManagerClass, b as PluginRegistryImpl, c as PluginValidatorClass, S as ScopedHookSystemClass } from './plugin-manager-BoM3Q7o7.cjs';
6
- export { ROUTES_INFO, adminApiRoutes, adminCheckboxRoutes, adminCodeExamplesRoutes, adminCollectionsRoutes, adminContentRoutes, adminDashboardRoutes, adminDesignRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, adminTestimonialsRoutes, adminUsersRoutes, apiContentCrudRoutes, apiMediaRoutes, apiRoutes, apiSystemRoutes, authRoutes } from './routes.cjs';
12
+ export { ROUTES_INFO, adminApiRoutes, adminCheckboxRoutes, adminCollectionsRoutes, adminContentRoutes, adminDashboardRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, adminUsersRoutes, apiContentCrudRoutes, apiMediaRoutes, apiRoutes, apiSystemRoutes, authRoutes } from './routes.cjs';
7
13
  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.cjs';
8
- import { e as FieldType } from './collection-config-B4PG-AaF.cjs';
9
- export { C as CollectionConfig, b as CollectionConfigModule, c as CollectionSchema, d as CollectionSyncResult, F as FieldConfig } from './collection-config-B4PG-AaF.cjs';
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-.cjs';
11
15
  export { P as PluginManifest } from './plugin-manifest-Dpy8wxIB.cjs';
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.cjs';
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';
20
29
 
21
30
  /**
22
- * SonicJS Plugin System Types
31
+ * Wrangler.toml [triggers] cron codegen
23
32
  *
24
- * Defines the core interfaces and types for the plugin system
33
+ * Cloudflare Workers cron triggers are deploy-time static they must be listed
34
+ * in `wrangler.toml` at deploy time and cannot be changed at runtime. This module
35
+ * provides utilities to generate and validate the `[triggers]` section from the
36
+ * plugin list, so the file stays in sync with declared plugin crons.
37
+ *
38
+ * Usage in a codegen script:
39
+ *
40
+ * const schedules = collectCronSchedules(allPlugins)
41
+ * const updated = updateWranglerTriggers(tomlContent, schedules)
42
+ * writeFileSync('wrangler.toml', updated, 'utf8')
43
+ *
44
+ * Usage in a CI guard test:
45
+ *
46
+ * const actual = parseCronTriggers(tomlContent)
47
+ * const expected = collectCronSchedules(allPlugins)
48
+ * expect(actual).toEqual(expected.sort())
25
49
  */
26
50
 
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;
51
+ /**
52
+ * Parse the cron trigger expressions from a `wrangler.toml` file.
53
+ * Returns an array of cron strings found under `[triggers]`, sorted.
54
+ */
55
+ declare function parseCronTriggers(tomlContent: string): string[];
56
+ /**
57
+ * Update the `[triggers] crons` section in a wrangler.toml string.
58
+ *
59
+ * If the `[triggers]` section exists, replaces its `crons` line.
60
+ * If it does not exist and schedules is non-empty, appends it.
61
+ * If schedules is empty, removes the section entirely.
62
+ *
63
+ * Returns the updated toml content.
64
+ */
65
+ declare function updateWranglerTriggers(tomlContent: string, schedules: string[]): string;
66
+ /**
67
+ * Generate a wrangler.toml cron trigger comment block for documentation.
68
+ */
69
+ declare function generateTriggersComment(schedules: string[]): string;
70
+
71
+ /**
72
+ * Dependency-aware plugin ordering (topo-sort + cycle detection).
73
+ *
74
+ * Plugins declare `dependencies: ['other-plugin-id']`. This module produces a
75
+ * dependency-first order — so a plugin that depends on another is mounted and
76
+ * wired AFTER the dependency, not before. Today the `dependencies` field is
77
+ * inert (plugins are mounted/wired in declaration order). This makes it real.
78
+ *
79
+ * Reference: Infowall `register-plugins.ts` `topoSort`. The algorithm is the
80
+ * same iterative DFS with a `visiting` stack that Infowall uses, adapted to
81
+ * the structural plugin shape used here.
82
+ */
83
+ /** Thrown when `topoSort` detects a dependency cycle. */
84
+ declare class PluginDependencyCycleError extends Error {
85
+ readonly cycle: string[];
86
+ constructor(pluginId: string, visitStack: string[]);
137
87
  }
138
- interface PluginService {
139
- /** Service name */
140
- name: string;
141
- /** Service implementation */
142
- implementation: any;
143
- /** Service description */
144
- description?: string;
145
- /** Service dependencies */
88
+ /** Minimal structural shape this module needs from a plugin. */
89
+ interface SortablePlugin {
90
+ /** Stable unique identifier. Falls back to `name` when `id` is absent. */
91
+ id?: string;
92
+ name?: string;
93
+ /** IDs of plugins that must be mounted/wired before this one. */
146
94
  dependencies?: string[];
147
- /** Whether service is singleton */
148
- singleton?: boolean;
149
95
  }
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;
96
+ interface TopoSortOptions {
97
+ /**
98
+ * When true, an unknown dependency id → throw. When false (default), emit a
99
+ * console.warn and skip the dependency (graceful degradation).
100
+ */
101
+ strict?: boolean;
165
102
  }
166
- interface PluginComponent {
167
- /** Component name */
103
+ /**
104
+ * Sort `plugins` into dependency-first order.
105
+ *
106
+ * Plugins with no `dependencies` field (old-style PluginBuilder plugins) sort
107
+ * at the front in their original declaration order, before any v3 plugins that
108
+ * might depend on them — this preserves backwards compatibility.
109
+ *
110
+ * @throws {PluginDependencyCycleError} if a dependency cycle is detected.
111
+ */
112
+ declare function topoSort<T extends SortablePlugin>(plugins: ReadonlyArray<T>, options?: TopoSortOptions): T[];
113
+
114
+ interface RbacRole {
115
+ id: string;
168
116
  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;
117
+ display_name: string;
118
+ description: string | null;
119
+ is_system: number;
175
120
  }
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 */
121
+ interface RbacVerb {
122
+ id: string;
194
123
  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;
124
+ description: string | null;
125
+ is_system: number;
126
+ sort_order: number;
257
127
  }
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>;
128
+ interface RbacResource {
129
+ key: string;
130
+ label: string;
131
+ group: 'system' | 'document_type';
279
132
  }
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;
133
+ type PermissionScope = 'none' | 'own' | 'any';
134
+ interface Grant {
135
+ role_id: string;
136
+ resource: string;
137
+ verb: string;
138
+ scope: Exclude<PermissionScope, 'none'>;
285
139
  }
286
- interface PluginBuilderOptions {
287
- name: string;
288
- version: string;
289
- description?: string;
290
- author?: Plugin['author'];
291
- dependencies?: string[];
140
+ declare class RbacService {
141
+ private db;
142
+ private kv?;
143
+ private static readonly LEGACY_ROLE_PRECEDENCE;
144
+ private _docs?;
145
+ constructor(db: D1Database, kv?: KVNamespace | undefined);
146
+ private docs;
147
+ private parse;
148
+ private listDocs;
149
+ private getDoc;
150
+ private upsertDoc;
151
+ private deleteDoc;
152
+ private roleToRow;
153
+ getRoles(): Promise<RbacRole[]>;
154
+ getVerbs(): Promise<RbacVerb[]>;
155
+ /** System resources + one `document_type:<name>` per active document type. */
156
+ getResources(): Promise<RbacResource[]>;
157
+ getGrants(): Promise<Grant[]>;
158
+ getRolesForUser(userId: string): Promise<RbacRole[]>;
159
+ /** Grants attached to a set of role ids (from the embedded role grants). */
160
+ private grantsForRoleIds;
161
+ /** Does a single grant row satisfy the requested (resource, verb)? */
162
+ private grantMatches;
163
+ private strongestScope;
164
+ /** Can the user perform `verb` on `resource`? Reads the live grant matrix. */
165
+ can(userId: string, resource: string, verb: string): Promise<boolean>;
166
+ /** Highest scope granted to the user for `resource:verb`. */
167
+ getPermissionScope(userId: string, resource: string, verb: string): Promise<PermissionScope>;
168
+ /** Flattened, human-readable permission list for a user. Cached in KV for 60 s. */
169
+ permissionsForUser(userId: string): Promise<string[]>;
170
+ createRole(name: string, displayName: string, description?: string): Promise<void>;
171
+ deleteRole(roleId: string): Promise<void>;
172
+ /**
173
+ * Update a role's display name and description. The `name` (slug) can only be
174
+ * changed for custom roles — system role names are referenced by the legacy
175
+ * mapping, so they stay fixed.
176
+ */
177
+ updateRole(roleId: string, displayName: string, description?: string, name?: string): Promise<void>;
178
+ /** Update displayName + portal access in a single write to avoid double-saveDraft FK issues. */
179
+ updateRoleAndPortalAccess(roleId: string, displayName: string, name: string | undefined, portalEnabled: boolean, description?: string): Promise<void>;
180
+ createVerb(name: string, description?: string): Promise<void>;
181
+ deleteVerb(verbId: string): Promise<void>;
182
+ /** Replace all grants for one role with the supplied (resource, verb, scope) rows. */
183
+ setRoleGrants(roleId: string, pairs: Array<{
184
+ resource: string;
185
+ verb: string;
186
+ scope?: Exclude<PermissionScope, 'none'>;
187
+ }>): Promise<void>;
188
+ /**
189
+ * Count active users (optionally excluding one) who hold BOTH an effective
190
+ * portal:access grant and an effective rbac:manage grant — the users who could
191
+ * recover from a permission lockout. Powers the self-lockout guard.
192
+ */
193
+ countPortalAdmins(excludeUserId?: string): Promise<number>;
194
+ /**
195
+ * Replace a user's RBAC role assignments. The `rbac_user_roles` document is the
196
+ * single source of truth for authorization; the legacy `auth_user.role` column
197
+ * is kept as a derived projection (highest-precedence system role, else
198
+ * 'viewer') so the two never diverge.
199
+ */
200
+ setUserRoles(userId: string, roleIds: string[]): Promise<void>;
201
+ setRolePortalAccess(roleId: string, enabled: boolean): Promise<void>;
202
+ /**
203
+ * Seed the system roles, verbs, and their grants as documents. Idempotent —
204
+ * existing roles/verbs (by slug) are left untouched. Replaces the INSERT OR
205
+ * IGNORE seeds that lived in migration 0001. Call at bootstrap, after the rbac
206
+ * document types are registered.
207
+ */
208
+ ensureSystemRbacSeed(): Promise<void>;
209
+ /** Assign a role to a user by role name (e.g. 'admin'), preserving existing roles. */
210
+ addUserRoleByName(userId: string, roleName: string): Promise<void>;
292
211
  }
293
212
 
294
- declare function createDb(d1: D1Database): drizzle_orm_d1.DrizzleD1Database<typeof schema> & {
295
- $client: D1Database;
296
- };
213
+ declare function bootstrapDocumentTypes(db: D1Database$1): Promise<void>;
297
214
 
298
215
  /**
299
- * Plugin Builder SDK
216
+ * Cloudflare Email binding provider (MailChannels / send_email binding)
300
217
  *
301
- * Provides a fluent API for building SonicJS plugins
218
+ * Sends email through a Cloudflare `send_email` Workers binding.
219
+ * Configure via `wrangler.toml`:
302
220
  *
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.
221
+ * [[send_email]]
222
+ * name = "SEND_EMAIL"
223
+ * destination_address = "you@yourdomain.com" # optional allowlist
310
224
  *
311
- * @example
312
- * ```typescript
313
- * import { PluginBuilder } from '@sonicjs-cms/core'
225
+ * Then pass `SEND_EMAIL` as the `binding` when constructing:
226
+ * new CloudflareEmailProvider({ binding: env.SEND_EMAIL, defaultFrom: 'no-reply@example.com' })
314
227
  *
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
- * ```
228
+ * Note: delivery state tracking is not available through the MailChannels API;
229
+ * the `reconcile()` method is a no-op for this provider. Production delivery
230
+ * monitoring should use Cloudflare Email Event Notifications (separate webhook).
325
231
  */
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;
232
+
233
+ /** Minimal shape of the Cloudflare `send_email` binding object. */
234
+ interface CFSendEmailBinding {
235
+ /** Send an RFC-2822 formatted email. */
236
+ send(message: {
237
+ from: string;
238
+ to: string[];
239
+ subject: string;
240
+ html?: string;
241
+ text?: string;
242
+ reply_to?: string;
243
+ }): Promise<void>;
244
+ }
245
+ interface CloudflareEmailProviderOptions {
246
+ /** The `send_email` binding from `env`. */
247
+ binding: CFSendEmailBinding;
248
+ /** Default from-address (must be verified on your Cloudflare account). */
249
+ defaultFrom?: string;
457
250
  }
251
+ declare class CloudflareEmailProvider implements EmailProvider {
252
+ readonly name = "cloudflare-email";
253
+ private readonly binding;
254
+ private readonly defaultFrom;
255
+ constructor(options: CloudflareEmailProviderOptions);
256
+ isConfigured(): boolean;
257
+ send(message: NormalizedEmailMessage): Promise<SendResult>;
258
+ }
259
+
260
+ declare const emailReconciliationPlugin: DefinedPlugin;
261
+
262
+ declare const redirectPlugin: DefinedPlugin;
263
+ declare function createRedirectPlugin(): DefinedPlugin;
264
+
458
265
  /**
459
- * Helper functions for common plugin patterns.
266
+ * Site Settings Collection
460
267
  *
461
- * @beta This API is in beta and may change in future releases.
268
+ * Stores site-wide configuration settings (general, security, etc.) as singleton documents.
269
+ * Each settings group is stored as a separate document with a fixed slug.
462
270
  */
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[];
271
+ declare const _default: {
272
+ name: string;
273
+ displayName: string;
274
+ description: string;
275
+ icon: string;
276
+ color: string;
277
+ internal: true;
278
+ schema: {
279
+ type: "object";
280
+ properties: {
281
+ siteName: {
282
+ type: "string";
283
+ title: string;
284
+ description: string;
285
+ required: true;
286
+ maxLength: number;
287
+ placeholder: string;
288
+ };
289
+ siteDescription: {
290
+ type: "string";
291
+ title: string;
292
+ description: string;
293
+ required: true;
294
+ maxLength: number;
295
+ placeholder: string;
296
+ };
297
+ adminEmail: {
298
+ type: "email";
299
+ title: string;
300
+ description: string;
301
+ required: true;
302
+ placeholder: string;
303
+ };
304
+ timezone: {
305
+ type: "select";
306
+ title: string;
307
+ description: string;
308
+ enum: string[];
309
+ default: string;
310
+ required: true;
311
+ };
312
+ language: {
313
+ type: "select";
314
+ title: string;
315
+ description: string;
316
+ enum: string[];
317
+ enumLabels: string[];
318
+ default: string;
319
+ required: true;
320
+ };
321
+ maintenanceMode: {
322
+ type: "checkbox";
323
+ title: string;
324
+ description: string;
325
+ default: boolean;
326
+ };
327
+ jwtExpiresIn: {
328
+ type: "string";
329
+ title: string;
330
+ description: string;
331
+ required: false;
332
+ maxLength: number;
333
+ placeholder: string;
334
+ };
335
+ jwtRefreshGraceSeconds: {
336
+ type: "number";
337
+ title: string;
338
+ description: string;
339
+ required: false;
340
+ min: number;
341
+ max: number;
342
+ };
475
343
  };
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[];
344
+ required: string[];
494
345
  };
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
- }
346
+ managed: true;
347
+ isActive: true;
348
+ metadata: {
349
+ purpose: string;
350
+ version: string;
351
+ singletonGroups: string[];
352
+ };
353
+ };
354
+
355
+ declare function createDb(d1: D1Database): drizzle_orm_d1.DrizzleD1Database<typeof schema> & {
356
+ $client: D1Database;
357
+ };
519
358
 
520
359
  /**
521
360
  * OAuth Providers Plugin
@@ -530,9 +369,8 @@ declare class PluginHelpers {
530
369
  * POST /auth/oauth/unlink → Unlink OAuth provider from account
531
370
  * GET /auth/oauth/accounts → List linked OAuth accounts for current user
532
371
  */
533
-
534
- declare function createOAuthProvidersPlugin(): Plugin;
535
- declare const oauthProvidersPlugin: Plugin;
372
+ declare const oauthProvidersPlugin: DefinedPlugin;
373
+ declare function createOAuthProvidersPlugin(): DefinedPlugin;
536
374
 
537
375
  /**
538
376
  * OAuth Service
@@ -669,20 +507,19 @@ declare function defineUserProfile(config: UserProfileConfig): void;
669
507
  declare function getUserProfileConfig(): UserProfileConfig | null;
670
508
 
671
509
  /**
672
- * User Profiles Plugin
510
+ * User Profiles Plugin — Payload-shaped port.
673
511
  *
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.
512
+ * Configurable custom profile fields for users. defineUserProfile() at app
513
+ * boot declares custom fields stored as JSON in auth_user_profiles.data and
514
+ * rendered in the admin UI.
677
515
  *
678
516
  * API Routes:
679
517
  * 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)
518
+ * GET /api/user-profiles/:userId → Get custom data for a user
519
+ * PUT /api/user-profiles/:userId → Update custom data for a user
682
520
  */
683
-
684
- declare function createUserProfilesPlugin(): Plugin;
685
- declare const userProfilesPlugin: Plugin;
521
+ declare const userProfilesPlugin: DefinedPlugin;
522
+ declare function createUserProfilesPlugin(): DefinedPlugin;
686
523
 
687
524
  /**
688
525
  * @sonicjs/core - Main Entry Point
@@ -704,4 +541,4 @@ declare const userProfilesPlugin: Plugin;
704
541
 
705
542
  declare const VERSION: string;
706
543
 
707
- export { BUILT_IN_PROVIDERS, FieldType, OAuthService, PluginBuilder, PluginHelpers, type ProfileFieldDefinition, type UserProfileConfig, VERSION, createDb, createOAuthProvidersPlugin, createUserProfilesPlugin, defineUserProfile, getUserProfileConfig, oauthProvidersPlugin, userProfilesPlugin };
544
+ 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 };