@sonicjs-cms/core 2.19.0 → 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.
- package/README.md +4 -3
- package/dist/admin-documents-form.template-KN7JF66Q.cjs +19 -0
- package/dist/{admin-layout-catalyst.template-UMTIN66R.js.map → admin-documents-form.template-KN7JF66Q.cjs.map} +1 -1
- package/dist/admin-documents-form.template-NLSI6Z42.js +6 -0
- package/dist/{admin-layout-catalyst.template-HFD37TY5.cjs.map → admin-documents-form.template-NLSI6Z42.js.map} +1 -1
- package/dist/admin-layout-catalyst.template-WHJGSWWD.js +7 -0
- package/dist/admin-layout-catalyst.template-WHJGSWWD.js.map +1 -0
- package/dist/admin-layout-catalyst.template-ZK5HD545.cjs +17 -0
- package/dist/admin-layout-catalyst.template-ZK5HD545.cjs.map +1 -0
- package/dist/app-Bo0X1OWX.d.ts +1268 -0
- package/dist/app-Do66yCcV.d.cts +1268 -0
- package/dist/cache-DDARE4QE.js +4 -0
- package/dist/cache-DDARE4QE.js.map +1 -0
- package/dist/cache-LVYS4BPL.cjs +33 -0
- package/dist/cache-LVYS4BPL.cjs.map +1 -0
- package/dist/chunk-2CB4KY7I.cjs +771 -0
- package/dist/chunk-2CB4KY7I.cjs.map +1 -0
- package/dist/{chunk-55RDMDOP.js → chunk-3TB6AT6X.js} +148 -55
- package/dist/chunk-3TB6AT6X.js.map +1 -0
- package/dist/{chunk-ON5ZMSU4.js → chunk-6JQOUUOB.js} +3 -3
- package/dist/chunk-6JQOUUOB.js.map +1 -0
- package/dist/chunk-6OUHGKFD.js +387 -0
- package/dist/chunk-6OUHGKFD.js.map +1 -0
- package/dist/{chunk-7A4CB7T3.cjs → chunk-AAWNRBRB.cjs} +509 -91
- package/dist/chunk-AAWNRBRB.cjs.map +1 -0
- package/dist/chunk-AI663NBO.js +821 -0
- package/dist/chunk-AI663NBO.js.map +1 -0
- package/dist/chunk-BDDABDAB.cjs +1149 -0
- package/dist/chunk-BDDABDAB.cjs.map +1 -0
- package/dist/chunk-BLMTL57B.js +767 -0
- package/dist/chunk-BLMTL57B.js.map +1 -0
- package/dist/chunk-DNQCEKUK.cjs +327 -0
- package/dist/chunk-DNQCEKUK.cjs.map +1 -0
- package/dist/chunk-DSA4UX5B.cjs +276 -0
- package/dist/chunk-DSA4UX5B.cjs.map +1 -0
- package/dist/chunk-EF2NQUIQ.js +323 -0
- package/dist/chunk-EF2NQUIQ.js.map +1 -0
- package/dist/chunk-GCDZZNIN.js +192 -0
- package/dist/chunk-GCDZZNIN.js.map +1 -0
- package/dist/{chunk-ABB34XUS.cjs → chunk-H2AXVCLS.cjs} +667 -19
- package/dist/chunk-H2AXVCLS.cjs.map +1 -0
- package/dist/{chunk-XWIA3HVX.js → chunk-HDWE5FRJ.js} +6 -1249
- package/dist/chunk-HDWE5FRJ.js.map +1 -0
- package/dist/chunk-HIKBY7MS.cjs +70 -0
- package/dist/chunk-HIKBY7MS.cjs.map +1 -0
- package/dist/chunk-IESEVHXL.js +66 -0
- package/dist/chunk-IESEVHXL.js.map +1 -0
- package/dist/chunk-IVPRUGTY.js +242 -0
- package/dist/chunk-IVPRUGTY.js.map +1 -0
- package/dist/{chunk-JZVHLLSI.cjs → chunk-IXUHXTHW.cjs} +2 -151
- package/dist/chunk-IXUHXTHW.cjs.map +1 -0
- package/dist/chunk-J6JTWD2A.cjs +100 -0
- package/dist/chunk-J6JTWD2A.cjs.map +1 -0
- package/dist/chunk-JEQ7FLOD.cjs +199 -0
- package/dist/chunk-JEQ7FLOD.cjs.map +1 -0
- package/dist/chunk-K25XHMM3.js +566 -0
- package/dist/chunk-K25XHMM3.js.map +1 -0
- package/dist/chunk-LRZIAW7U.cjs +158 -0
- package/dist/chunk-LRZIAW7U.cjs.map +1 -0
- package/dist/{chunk-OHYBNCVL.cjs → chunk-MVIZJOO5.cjs} +10 -1256
- package/dist/chunk-MVIZJOO5.cjs.map +1 -0
- package/dist/{chunk-UYJ6TJHX.cjs → chunk-NAVPFIG5.cjs} +148 -55
- package/dist/chunk-NAVPFIG5.cjs.map +1 -0
- package/dist/chunk-NLJVSER2.js +273 -0
- package/dist/chunk-NLJVSER2.js.map +1 -0
- package/dist/chunk-NMPEMSU4.js +154 -0
- package/dist/chunk-NMPEMSU4.js.map +1 -0
- package/dist/chunk-NUKJ54GA.cjs +245 -0
- package/dist/chunk-NUKJ54GA.cjs.map +1 -0
- package/dist/{chunk-E4YFJBM2.cjs → chunk-QAYFOER6.cjs} +621 -829
- package/dist/chunk-QAYFOER6.cjs.map +1 -0
- package/dist/{chunk-BU7SFHGP.js → chunk-QZGABF2M.js} +3 -149
- package/dist/chunk-QZGABF2M.js.map +1 -0
- package/dist/chunk-RNZFGN4R.js +88 -0
- package/dist/chunk-RNZFGN4R.js.map +1 -0
- package/dist/{chunk-4NPCDK6B.js → chunk-RZ6H7OZK.js} +505 -90
- package/dist/chunk-RZ6H7OZK.js.map +1 -0
- package/dist/{chunk-OCL3HMEG.js → chunk-VD2EA3WT.js} +7004 -9807
- package/dist/chunk-VD2EA3WT.js.map +1 -0
- package/dist/{chunk-R4FOLLFB.cjs → chunk-VXE42MYF.cjs} +8730 -11520
- package/dist/chunk-VXE42MYF.cjs.map +1 -0
- package/dist/{chunk-4ZSNJDLS.cjs → chunk-WULONYGB.cjs} +9 -9
- package/dist/chunk-WULONYGB.cjs.map +1 -0
- package/dist/chunk-XW56B23A.cjs +408 -0
- package/dist/chunk-XW56B23A.cjs.map +1 -0
- package/dist/chunk-YA3TJ65D.cjs +575 -0
- package/dist/chunk-YA3TJ65D.cjs.map +1 -0
- package/dist/{chunk-TFNTM3OA.js → chunk-YHSQVQXX.js} +645 -15
- package/dist/chunk-YHSQVQXX.js.map +1 -0
- package/dist/chunk-YP7GW2G5.cjs +866 -0
- package/dist/chunk-YP7GW2G5.cjs.map +1 -0
- package/dist/{chunk-QFWHAFEO.js → chunk-ZEZ245PW.js} +148 -858
- package/dist/chunk-ZEZ245PW.js.map +1 -0
- package/dist/{chunk-JZV22DEV.js → chunk-ZGGXCFR6.js} +611 -817
- package/dist/chunk-ZGGXCFR6.js.map +1 -0
- package/dist/{collection-config-B4PG-AaF.d.cts → collection-config-JgHOpFCG.d.cts} +30 -2
- package/dist/{collection-config-B4PG-AaF.d.ts → collection-config-JgHOpFCG.d.ts} +30 -2
- package/dist/config-HFXANXCC.js +6 -0
- package/dist/config-HFXANXCC.js.map +1 -0
- package/dist/config-ON6FNMYX.cjs +19 -0
- package/dist/config-ON6FNMYX.cjs.map +1 -0
- package/dist/define-plugin-BzNHc1ZI.d.ts +1321 -0
- package/dist/define-plugin-IWDKYaVm.d.cts +1321 -0
- package/dist/document-projection-TDWRJX3Z.cjs +13 -0
- package/dist/document-projection-TDWRJX3Z.cjs.map +1 -0
- package/dist/document-projection-YYMC6I4U.js +4 -0
- package/dist/document-projection-YYMC6I4U.js.map +1 -0
- package/dist/index.cjs +13734 -4328
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +329 -492
- package/dist/index.d.ts +329 -492
- package/dist/index.js +13385 -3998
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +36 -32
- package/dist/middleware.d.cts +50 -7
- package/dist/middleware.d.ts +50 -7
- package/dist/middleware.js +7 -3
- package/dist/migrations-NJJWQUKK.cjs +13 -0
- package/dist/{migrations-566IIPS2.cjs.map → migrations-NJJWQUKK.cjs.map} +1 -1
- package/dist/migrations-WCAVBD7C.js +4 -0
- package/dist/{migrations-H5IXZNCO.js.map → migrations-WCAVBD7C.js.map} +1 -1
- package/dist/{plugin-bootstrap-DfVerYV4.d.cts → plugin-bootstrap-B8ThJU21.d.cts} +4315 -1661
- package/dist/{plugin-bootstrap-P_ciLp_C.d.ts → plugin-bootstrap-qu8hJgUt.d.ts} +4315 -1661
- package/dist/plugins.cjs +171 -12
- package/dist/plugins.d.cts +36 -2
- package/dist/plugins.d.ts +36 -2
- package/dist/plugins.js +5 -2
- package/dist/rbac-O73MFKDA.js +5 -0
- package/dist/rbac-O73MFKDA.js.map +1 -0
- package/dist/rbac-VONLJJKB.cjs +14 -0
- package/dist/rbac-VONLJJKB.cjs.map +1 -0
- package/dist/routes.cjs +41 -45
- package/dist/routes.d.cts +56 -146
- package/dist/routes.d.ts +56 -146
- package/dist/routes.js +17 -9
- package/dist/services.cjs +39 -72
- package/dist/services.d.cts +79 -54
- package/dist/services.d.ts +79 -54
- package/dist/services.js +6 -3
- package/dist/templates.cjs +17 -29
- package/dist/templates.d.cts +1 -66
- package/dist/templates.d.ts +1 -66
- package/dist/templates.js +3 -3
- package/dist/types-Dea1eNxU.d.cts +286 -0
- package/dist/types-Dea1eNxU.d.ts +286 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.cjs +18 -17
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -1
- package/migrations/0001_core.sql +184 -0
- package/migrations/0002_documents.sql +163 -0
- package/package.json +12 -7
- package/dist/admin-layout-catalyst.template-HFD37TY5.cjs +0 -17
- package/dist/admin-layout-catalyst.template-UMTIN66R.js +0 -7
- package/dist/app-C9esKLmh.d.cts +0 -112
- package/dist/app-C9esKLmh.d.ts +0 -112
- package/dist/chunk-4NPCDK6B.js.map +0 -1
- package/dist/chunk-4ZSNJDLS.cjs.map +0 -1
- package/dist/chunk-55RDMDOP.js.map +0 -1
- package/dist/chunk-635JAMSE.cjs +0 -653
- package/dist/chunk-635JAMSE.cjs.map +0 -1
- package/dist/chunk-7A4CB7T3.cjs.map +0 -1
- package/dist/chunk-ABB34XUS.cjs.map +0 -1
- package/dist/chunk-BU7SFHGP.js.map +0 -1
- package/dist/chunk-E4YFJBM2.cjs.map +0 -1
- package/dist/chunk-EXNEW5US.js +0 -648
- package/dist/chunk-EXNEW5US.js.map +0 -1
- package/dist/chunk-JZV22DEV.js.map +0 -1
- package/dist/chunk-JZVHLLSI.cjs.map +0 -1
- package/dist/chunk-OCL3HMEG.js.map +0 -1
- package/dist/chunk-OHYBNCVL.cjs.map +0 -1
- package/dist/chunk-ON5ZMSU4.js.map +0 -1
- package/dist/chunk-QFWHAFEO.js.map +0 -1
- package/dist/chunk-R4FOLLFB.cjs.map +0 -1
- package/dist/chunk-RLMUFFUD.cjs +0 -2219
- package/dist/chunk-RLMUFFUD.cjs.map +0 -1
- package/dist/chunk-TFNTM3OA.js.map +0 -1
- package/dist/chunk-UYJ6TJHX.cjs.map +0 -1
- package/dist/chunk-WAEQXGCX.cjs +0 -1898
- package/dist/chunk-WAEQXGCX.cjs.map +0 -1
- package/dist/chunk-XWIA3HVX.js.map +0 -1
- package/dist/chunk-ZYAYUIZE.js +0 -2217
- package/dist/chunk-ZYAYUIZE.js.map +0 -1
- package/dist/migrations-566IIPS2.cjs +0 -13
- package/dist/migrations-H5IXZNCO.js +0 -4
- package/dist/plugin-manager-BoM3Q7o7.d.cts +0 -328
- package/dist/plugin-manager-Efx9RyDX.d.ts +0 -328
- package/migrations/001_initial_schema.sql +0 -170
- package/migrations/002_faq_plugin.sql +0 -86
- package/migrations/003_stage5_enhancements.sql +0 -121
- package/migrations/004_stage6_user_management.sql +0 -183
- package/migrations/005_stage7_workflow_automation.sql +0 -294
- package/migrations/006_plugin_system.sql +0 -155
- package/migrations/007_demo_login_plugin.sql +0 -23
- package/migrations/008_fix_slug_validation.sql +0 -22
- package/migrations/009_system_logging.sql +0 -57
- package/migrations/011_config_managed_collections.sql +0 -15
- package/migrations/012_testimonials_plugin.sql +0 -80
- package/migrations/013_code_examples_plugin.sql +0 -177
- package/migrations/014_fix_plugin_registry.sql +0 -88
- package/migrations/015_add_remaining_plugins.sql +0 -89
- package/migrations/016_remove_duplicate_cache_plugin.sql +0 -17
- package/migrations/017_auth_configurable_fields.sql +0 -49
- package/migrations/018_settings_table.sql +0 -23
- package/migrations/019_remove_blog_posts_collection.sql +0 -15
- package/migrations/020_add_email_plugin.sql +0 -22
- package/migrations/021_add_magic_link_auth_plugin.sql +0 -42
- package/migrations/022_add_tinymce_plugin.sql +0 -25
- package/migrations/023_add_easy_mdx_plugin.sql +0 -25
- package/migrations/024_add_quill_editor_plugin.sql +0 -25
- package/migrations/025_add_easymde_plugin.sql +0 -25
- package/migrations/026_add_otp_login.sql +0 -42
- package/migrations/027_fix_slug_field_type.sql +0 -18
- package/migrations/028_fix_slug_field_type_in_schemas.sql +0 -30
- package/migrations/029_add_forms_system.sql +0 -184
- package/migrations/030_add_turnstile_to_forms.sql +0 -14
- package/migrations/031_ai_search_plugin.sql +0 -45
- package/migrations/032_user_profiles.sql +0 -37
- package/migrations/033_form_content_integration.sql +0 -19
- package/migrations/034_security_audit_plugin.sql +0 -27
- package/migrations/035_user_profiles_data_column.sql +0 -16
- package/migrations/036_analytics_events.sql +0 -22
package/dist/index.d.ts
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,
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
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 {
|
|
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';
|
|
12
|
+
export { ROUTES_INFO, adminApiRoutes, adminCheckboxRoutes, adminCollectionsRoutes, adminContentRoutes, adminDashboardRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, adminUsersRoutes, apiContentCrudRoutes, apiMediaRoutes, apiRoutes, apiSystemRoutes, authRoutes } from './routes.js';
|
|
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.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';
|
|
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
|
|
15
|
-
import
|
|
16
|
-
import
|
|
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
|
-
*
|
|
31
|
+
* Wrangler.toml [triggers] cron codegen
|
|
23
32
|
*
|
|
24
|
-
*
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
name
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/**
|
|
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
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
167
|
-
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
|
177
|
-
|
|
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
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
|
295
|
-
$client: D1Database;
|
|
296
|
-
};
|
|
213
|
+
declare function bootstrapDocumentTypes(db: D1Database$1): Promise<void>;
|
|
297
214
|
|
|
298
215
|
/**
|
|
299
|
-
*
|
|
216
|
+
* Cloudflare Email binding provider (MailChannels / send_email binding)
|
|
300
217
|
*
|
|
301
|
-
*
|
|
218
|
+
* Sends email through a Cloudflare `send_email` Workers binding.
|
|
219
|
+
* Configure via `wrangler.toml`:
|
|
302
220
|
*
|
|
303
|
-
*
|
|
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
|
-
*
|
|
312
|
-
*
|
|
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
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
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
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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
|
-
*
|
|
266
|
+
* Site Settings Collection
|
|
460
267
|
*
|
|
461
|
-
*
|
|
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
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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
|
-
|
|
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
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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():
|
|
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
|
-
*
|
|
676
|
-
*
|
|
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
|
|
681
|
-
* PUT /api/user-profiles/:userId → Update custom data for a user
|
|
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():
|
|
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,
|
|
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 };
|