@sonicjs-cms/core 2.0.0-alpha.1 → 2.0.0-alpha.11

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 (98) hide show
  1. package/dist/chunk-3MNMOLSA.js +133 -0
  2. package/dist/chunk-3MNMOLSA.js.map +1 -0
  3. package/dist/{chunk-BRC3F4CG.cjs → chunk-6BHDKYLU.cjs} +8 -2
  4. package/dist/{chunk-KRJMGD4E.js.map → chunk-6BHDKYLU.cjs.map} +1 -1
  5. package/dist/{chunk-CXZDAR6S.js → chunk-7N3HK7ZK.js} +3 -3
  6. package/dist/{chunk-CXZDAR6S.js.map → chunk-7N3HK7ZK.js.map} +1 -1
  7. package/dist/chunk-AGOE25LF.cjs +137 -0
  8. package/dist/chunk-AGOE25LF.cjs.map +1 -0
  9. package/dist/{chunk-NRSL6BQI.js → chunk-BITQ4MFX.js} +3 -3
  10. package/dist/{chunk-NRSL6BQI.js.map → chunk-BITQ4MFX.js.map} +1 -1
  11. package/dist/{chunk-24PWAFUT.cjs → chunk-BUKT6HP5.cjs} +13 -13
  12. package/dist/{chunk-24PWAFUT.cjs.map → chunk-BUKT6HP5.cjs.map} +1 -1
  13. package/dist/chunk-DG4INX36.cjs +14246 -0
  14. package/dist/chunk-DG4INX36.cjs.map +1 -0
  15. package/dist/chunk-FDUDHGI6.js +14233 -0
  16. package/dist/chunk-FDUDHGI6.js.map +1 -0
  17. package/dist/{chunk-L3NXO7Y4.cjs → chunk-FVMV5DKA.cjs} +49 -49
  18. package/dist/{chunk-L3NXO7Y4.cjs.map → chunk-FVMV5DKA.cjs.map} +1 -1
  19. package/dist/{chunk-KRJMGD4E.js → chunk-FZYF43TN.js} +8 -2
  20. package/dist/chunk-FZYF43TN.js.map +1 -0
  21. package/dist/chunk-G4JGVZAF.js +1337 -0
  22. package/dist/chunk-G4JGVZAF.js.map +1 -0
  23. package/dist/{chunk-EMMSS5I5.cjs → chunk-IGJUBJBW.cjs} +8 -2
  24. package/dist/{chunk-ALTMI5Y2.cjs.map → chunk-IGJUBJBW.cjs.map} +1 -1
  25. package/dist/chunk-LEGKJ5DI.cjs +1344 -0
  26. package/dist/chunk-LEGKJ5DI.cjs.map +1 -0
  27. package/dist/{chunk-WJ7QYVR2.cjs → chunk-RNR4HA23.cjs} +4 -4
  28. package/dist/{chunk-WJ7QYVR2.cjs.map → chunk-RNR4HA23.cjs.map} +1 -1
  29. package/dist/{chunk-G3PMV62Z.js → chunk-V4OQ3NZ2.js} +7 -3
  30. package/dist/{chunk-G3PMV62Z.js.map → chunk-V4OQ3NZ2.js.map} +1 -1
  31. package/dist/{chunk-PTQZ5FEI.js → chunk-WESS2U3K.js} +3 -3
  32. package/dist/{chunk-PTQZ5FEI.js.map → chunk-WESS2U3K.js.map} +1 -1
  33. package/dist/index.cjs +147 -101
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.ts +5 -135
  36. package/dist/index.js +24 -9
  37. package/dist/index.js.map +1 -1
  38. package/dist/middleware.cjs +23 -23
  39. package/dist/middleware.d.ts +2 -206
  40. package/dist/middleware.js +3 -3
  41. package/dist/plugins.cjs +8 -8
  42. package/dist/plugins.d.ts +2 -330
  43. package/dist/plugins.js +2 -2
  44. package/dist/routes.cjs +52 -3
  45. package/dist/routes.d.ts +2 -17
  46. package/dist/routes.js +7 -2
  47. package/dist/services.cjs +31 -19
  48. package/dist/services.d.ts +2 -5
  49. package/dist/services.js +3 -3
  50. package/dist/templates.cjs +23 -10
  51. package/dist/templates.d.ts +2 -140
  52. package/dist/templates.js +3 -2
  53. package/dist/types.cjs +1 -1
  54. package/dist/types.d.ts +2 -41
  55. package/dist/types.js +1 -1
  56. package/dist/utils.cjs +1 -1
  57. package/dist/utils.d.ts +2 -184
  58. package/dist/utils.js +1 -1
  59. package/migrations/001_initial_schema.sql +198 -0
  60. package/migrations/002_faq_plugin.sql +86 -0
  61. package/migrations/003_stage5_enhancements.sql +121 -0
  62. package/migrations/004_stage6_user_management.sql +183 -0
  63. package/migrations/005_stage7_workflow_automation.sql +294 -0
  64. package/migrations/006_plugin_system.sql +155 -0
  65. package/migrations/007_demo_login_plugin.sql +23 -0
  66. package/migrations/008_fix_slug_validation.sql +22 -0
  67. package/migrations/009_system_logging.sql +57 -0
  68. package/migrations/011_config_managed_collections.sql +14 -0
  69. package/migrations/012_testimonials_plugin.sql +80 -0
  70. package/migrations/013_code_examples_plugin.sql +177 -0
  71. package/migrations/014_fix_plugin_registry.sql +88 -0
  72. package/migrations/015_add_remaining_plugins.sql +89 -0
  73. package/migrations/016_remove_duplicate_cache_plugin.sql +17 -0
  74. package/migrations/017_auth_configurable_fields.sql +49 -0
  75. package/package.json +2 -2
  76. package/dist/chunk-4URGXJP7.js +0 -3
  77. package/dist/chunk-4URGXJP7.js.map +0 -1
  78. package/dist/chunk-ALTMI5Y2.cjs +0 -4
  79. package/dist/chunk-BOLQHE4J.cjs +0 -11
  80. package/dist/chunk-BOLQHE4J.cjs.map +0 -1
  81. package/dist/chunk-BRC3F4CG.cjs.map +0 -1
  82. package/dist/chunk-EMMSS5I5.cjs.map +0 -1
  83. package/dist/chunk-HD7R6T6I.js +0 -9
  84. package/dist/chunk-HD7R6T6I.js.map +0 -1
  85. package/dist/collection-config-FLlGtsh9.d.cts +0 -107
  86. package/dist/collection-config-FLlGtsh9.d.ts +0 -107
  87. package/dist/index-BlsY5XNH.d.ts +0 -8333
  88. package/dist/index-D45jaIlr.d.cts +0 -8333
  89. package/dist/index.d.cts +0 -136
  90. package/dist/middleware.d.cts +0 -206
  91. package/dist/plugin-UzmDImQc.d.cts +0 -357
  92. package/dist/plugin-UzmDImQc.d.ts +0 -357
  93. package/dist/plugins.d.cts +0 -330
  94. package/dist/routes.d.cts +0 -17
  95. package/dist/services.d.cts +0 -5
  96. package/dist/templates.d.cts +0 -140
  97. package/dist/types.d.cts +0 -41
  98. package/dist/utils.d.cts +0 -184
@@ -1,357 +0,0 @@
1
- import { Context, MiddlewareHandler, Hono } from 'hono';
2
- import { z } from 'zod';
3
- import { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types';
4
-
5
- /**
6
- * SonicJS Plugin System Types
7
- *
8
- * Defines the core interfaces and types for the plugin system
9
- */
10
-
11
- interface Plugin {
12
- /** Unique plugin identifier */
13
- name: string;
14
- /** Plugin version (semantic versioning) */
15
- version: string;
16
- /** Human-readable description */
17
- description?: string;
18
- /** Plugin author information */
19
- author?: {
20
- name: string;
21
- email?: string;
22
- url?: string;
23
- };
24
- /** Plugin dependencies (other plugins required) */
25
- dependencies?: string[];
26
- /** SonicJS version compatibility */
27
- compatibility?: string;
28
- /** Plugin license */
29
- license?: string;
30
- routes?: PluginRoutes[];
31
- middleware?: PluginMiddleware[];
32
- models?: PluginModel[];
33
- services?: PluginService[];
34
- adminPages?: PluginAdminPage[];
35
- adminComponents?: PluginComponent[];
36
- menuItems?: PluginMenuItem[];
37
- hooks?: PluginHook[];
38
- install?: (context: PluginContext) => Promise<void>;
39
- uninstall?: (context: PluginContext) => Promise<void>;
40
- activate?: (context: PluginContext) => Promise<void>;
41
- deactivate?: (context: PluginContext) => Promise<void>;
42
- configure?: (config: PluginConfig) => Promise<void>;
43
- }
44
- interface PluginContext {
45
- /** Database instance */
46
- db: D1Database;
47
- /** Key-value storage */
48
- kv: KVNamespace;
49
- /** R2 storage bucket */
50
- r2?: R2Bucket;
51
- /** Plugin configuration */
52
- config: PluginConfig;
53
- /** Core SonicJS services */
54
- services: {
55
- auth: AuthService;
56
- content: ContentService;
57
- media: MediaService;
58
- };
59
- /** Hook system for inter-plugin communication */
60
- hooks: HookSystem | ScopedHookSystem;
61
- /** Logging utilities */
62
- logger: PluginLogger;
63
- }
64
- interface PluginConfig {
65
- /** Plugin-specific configuration */
66
- [key: string]: any;
67
- /** Whether plugin is enabled */
68
- enabled: boolean;
69
- /** Plugin installation timestamp */
70
- installedAt?: number;
71
- /** Plugin last update timestamp */
72
- updatedAt?: number;
73
- }
74
- interface PluginRoutes {
75
- /** Route path prefix */
76
- path: string;
77
- /** Hono route handler */
78
- handler: Hono;
79
- /** Route description */
80
- description?: string;
81
- /** Whether route requires authentication */
82
- requiresAuth?: boolean;
83
- /** Required roles for access */
84
- roles?: string[];
85
- /** Route priority (for ordering) */
86
- priority?: number;
87
- }
88
- interface PluginMiddleware {
89
- /** Middleware name */
90
- name: string;
91
- /** Middleware handler function */
92
- handler: MiddlewareHandler;
93
- /** Middleware description */
94
- description?: string;
95
- /** Middleware priority (lower = earlier) */
96
- priority?: number;
97
- /** Routes to apply middleware to */
98
- routes?: string[];
99
- /** Whether to apply globally */
100
- global?: boolean;
101
- }
102
- interface PluginModel {
103
- /** Model name */
104
- name: string;
105
- /** Database table name */
106
- tableName: string;
107
- /** Zod schema for validation */
108
- schema: z.ZodSchema;
109
- /** Database migrations */
110
- migrations: string[];
111
- /** Model relationships */
112
- relationships?: ModelRelationship[];
113
- /** Whether model extends core content */
114
- extendsContent?: boolean;
115
- }
116
- interface ModelRelationship {
117
- type: 'oneToOne' | 'oneToMany' | 'manyToMany';
118
- target: string;
119
- foreignKey?: string;
120
- joinTable?: string;
121
- }
122
- interface PluginService {
123
- /** Service name */
124
- name: string;
125
- /** Service implementation */
126
- implementation: any;
127
- /** Service description */
128
- description?: string;
129
- /** Service dependencies */
130
- dependencies?: string[];
131
- /** Whether service is singleton */
132
- singleton?: boolean;
133
- }
134
- interface PluginAdminPage {
135
- /** Page path (relative to /admin) */
136
- path: string;
137
- /** Page title */
138
- title: string;
139
- /** Page component/template */
140
- component: string;
141
- /** Page description */
142
- description?: string;
143
- /** Required permissions */
144
- permissions?: string[];
145
- /** Menu item configuration */
146
- menuItem?: PluginMenuItem;
147
- /** Page icon */
148
- icon?: string;
149
- }
150
- interface PluginComponent {
151
- /** Component name */
152
- name: string;
153
- /** Component template function */
154
- template: (props: any) => string;
155
- /** Component description */
156
- description?: string;
157
- /** Component props schema */
158
- propsSchema?: z.ZodSchema;
159
- }
160
- interface PluginMenuItem {
161
- /** Menu item label */
162
- label: string;
163
- /** Menu item path */
164
- path: string;
165
- /** Menu item icon */
166
- icon?: string;
167
- /** Menu item order */
168
- order?: number;
169
- /** Parent menu item */
170
- parent?: string;
171
- /** Required permissions */
172
- permissions?: string[];
173
- /** Whether item is active */
174
- active?: boolean;
175
- }
176
- interface PluginHook {
177
- /** Hook name */
178
- name: string;
179
- /** Hook handler function */
180
- handler: HookHandler;
181
- /** Hook priority */
182
- priority?: number;
183
- /** Hook description */
184
- description?: string;
185
- }
186
- type HookHandler = (data: any, context: HookContext) => Promise<any>;
187
- interface HookContext {
188
- /** Plugin that registered the hook */
189
- plugin: string;
190
- /** Hook execution context */
191
- context: PluginContext;
192
- /** Cancel hook execution */
193
- cancel?: () => void;
194
- }
195
- interface HookSystem {
196
- /** Register a hook handler */
197
- register(hookName: string, handler: HookHandler, priority?: number): void;
198
- /** Execute all handlers for a hook */
199
- execute(hookName: string, data: any, context?: any): Promise<any>;
200
- /** Remove a hook handler */
201
- unregister(hookName: string, handler: HookHandler): void;
202
- /** Get all registered hooks */
203
- getHooks(hookName: string): PluginHook[];
204
- /** Create a scoped hook system (optional) */
205
- createScope?(pluginName: string): ScopedHookSystem;
206
- }
207
- interface ScopedHookSystem {
208
- /** Register a hook handler */
209
- register(hookName: string, handler: HookHandler, priority?: number): void;
210
- /** Execute all handlers for a hook */
211
- execute(hookName: string, data: any, context?: any): Promise<any>;
212
- /** Remove a hook handler */
213
- unregister(hookName: string, handler: HookHandler): void;
214
- /** Remove all hooks for this scope */
215
- unregisterAll(): void;
216
- }
217
- interface PluginRegistry {
218
- /** Get plugin by name */
219
- get(name: string): Plugin | undefined;
220
- /** Get all registered plugins */
221
- getAll(): Plugin[];
222
- /** Get active plugins */
223
- getActive(): Plugin[];
224
- /** Register a plugin */
225
- register(plugin: Plugin): Promise<void>;
226
- /** Unregister a plugin */
227
- unregister(name: string): Promise<void>;
228
- /** Check if plugin is registered */
229
- has(name: string): boolean;
230
- /** Activate a plugin */
231
- activate(name: string): Promise<void>;
232
- /** Deactivate a plugin */
233
- deactivate(name: string): Promise<void>;
234
- /** Get plugin configuration */
235
- getConfig(name: string): PluginConfig | undefined;
236
- /** Set plugin configuration */
237
- setConfig(name: string, config: PluginConfig): void;
238
- /** Get plugin status */
239
- getStatus(name: string): PluginStatus | undefined;
240
- /** Get all plugin statuses */
241
- getAllStatuses(): Map<string, PluginStatus>;
242
- /** Resolve plugin load order based on dependencies */
243
- resolveLoadOrder(): string[];
244
- }
245
- interface PluginManager {
246
- /** Plugin registry */
247
- registry: PluginRegistry;
248
- /** Hook system */
249
- hooks: HookSystem;
250
- /** Initialize plugin system */
251
- initialize(context: PluginContext): Promise<void>;
252
- /** Load plugins from configuration */
253
- loadPlugins(config: PluginConfig[]): Promise<void>;
254
- /** Install a plugin */
255
- install(plugin: Plugin, config?: PluginConfig): Promise<void>;
256
- /** Uninstall a plugin */
257
- uninstall(name: string): Promise<void>;
258
- /** Get plugin status */
259
- getStatus(name: string): PluginStatus;
260
- }
261
- interface PluginStatus {
262
- name: string;
263
- version: string;
264
- active: boolean;
265
- installed: boolean;
266
- hasErrors: boolean;
267
- errors?: string[];
268
- lastError?: string;
269
- }
270
- interface AuthService {
271
- /** Verify user permissions */
272
- hasPermission(userId: string, permission: string): Promise<boolean>;
273
- /** Get current user */
274
- getCurrentUser(context: Context): Promise<any>;
275
- /** Create authentication middleware */
276
- createMiddleware(options?: any): MiddlewareHandler;
277
- }
278
- interface ContentService {
279
- /** Get content by ID */
280
- getById(id: string): Promise<any>;
281
- /** Create new content */
282
- create(data: any): Promise<any>;
283
- /** Update content */
284
- update(id: string, data: any): Promise<any>;
285
- /** Delete content */
286
- delete(id: string): Promise<void>;
287
- /** Search content */
288
- search(query: string, options?: any): Promise<any[]>;
289
- }
290
- interface MediaService {
291
- /** Upload file */
292
- upload(file: File, options?: any): Promise<any>;
293
- /** Get media by ID */
294
- getById(id: string): Promise<any>;
295
- /** Delete media */
296
- delete(id: string): Promise<void>;
297
- /** Transform image */
298
- transform(id: string, options: any): Promise<string>;
299
- }
300
- interface PluginLogger {
301
- debug(message: string, data?: any): void;
302
- info(message: string, data?: any): void;
303
- warn(message: string, data?: any): void;
304
- error(message: string, error?: Error, data?: any): void;
305
- }
306
- interface PluginBuilderOptions {
307
- name: string;
308
- version: string;
309
- description?: string;
310
- author?: Plugin['author'];
311
- dependencies?: string[];
312
- }
313
- interface PluginValidator {
314
- /** Validate plugin definition */
315
- validate(plugin: Plugin): PluginValidationResult;
316
- /** Validate plugin dependencies */
317
- validateDependencies(plugin: Plugin, registry: PluginRegistry): PluginValidationResult;
318
- /** Validate plugin compatibility */
319
- validateCompatibility(plugin: Plugin, version: string): PluginValidationResult;
320
- }
321
- interface PluginValidationResult {
322
- valid: boolean;
323
- errors: string[];
324
- warnings: string[];
325
- }
326
- declare const HOOKS: {
327
- readonly APP_INIT: "app:init";
328
- readonly APP_READY: "app:ready";
329
- readonly APP_SHUTDOWN: "app:shutdown";
330
- readonly REQUEST_START: "request:start";
331
- readonly REQUEST_END: "request:end";
332
- readonly REQUEST_ERROR: "request:error";
333
- readonly AUTH_LOGIN: "auth:login";
334
- readonly AUTH_LOGOUT: "auth:logout";
335
- readonly AUTH_REGISTER: "auth:register";
336
- readonly USER_LOGIN: "user:login";
337
- readonly USER_LOGOUT: "user:logout";
338
- readonly CONTENT_CREATE: "content:create";
339
- readonly CONTENT_UPDATE: "content:update";
340
- readonly CONTENT_DELETE: "content:delete";
341
- readonly CONTENT_PUBLISH: "content:publish";
342
- readonly CONTENT_SAVE: "content:save";
343
- readonly MEDIA_UPLOAD: "media:upload";
344
- readonly MEDIA_DELETE: "media:delete";
345
- readonly MEDIA_TRANSFORM: "media:transform";
346
- readonly PLUGIN_INSTALL: "plugin:install";
347
- readonly PLUGIN_UNINSTALL: "plugin:uninstall";
348
- readonly PLUGIN_ACTIVATE: "plugin:activate";
349
- readonly PLUGIN_DEACTIVATE: "plugin:deactivate";
350
- readonly ADMIN_MENU_RENDER: "admin:menu:render";
351
- readonly ADMIN_PAGE_RENDER: "admin:page:render";
352
- readonly DB_MIGRATE: "db:migrate";
353
- readonly DB_SEED: "db:seed";
354
- };
355
- type HookName = typeof HOOKS[keyof typeof HOOKS];
356
-
357
- export { type AuthService as A, type ContentService as C, type HookHandler as H, type MediaService as M, type Plugin as P, type ScopedHookSystem as S, type PluginContext as a, type PluginConfig as b, type PluginRoutes as c, type PluginMiddleware as d, type PluginModel as e, type PluginService as f, type PluginAdminPage as g, type PluginComponent as h, type PluginMenuItem as i, type PluginHook as j, type HookContext as k, type HookSystem as l, type PluginRegistry as m, type PluginManager as n, type PluginStatus as o, type PluginLogger as p, type PluginBuilderOptions as q, type PluginValidator as r, type PluginValidationResult as s, type HookName as t, HOOKS as u, type ModelRelationship as v };
@@ -1,330 +0,0 @@
1
- import { l as HookSystem, H as HookHandler, j as PluginHook, r as PluginValidator$1, P as Plugin, s as PluginValidationResult, m as PluginRegistry, b as PluginConfig, o as PluginStatus, n as PluginManager$1, a as PluginContext } from './plugin-UzmDImQc.cjs';
2
- import { Hono } from 'hono';
3
- import 'zod';
4
- import '@cloudflare/workers-types';
5
-
6
- /**
7
- * Hook System Implementation
8
- *
9
- * Provides event-driven extensibility for plugins
10
- */
11
-
12
- declare class HookSystemImpl implements HookSystem {
13
- private hooks;
14
- private executing;
15
- /**
16
- * Register a hook handler
17
- */
18
- register(hookName: string, handler: HookHandler, priority?: number): void;
19
- /**
20
- * Execute all handlers for a hook
21
- */
22
- execute(hookName: string, data: any, context?: any): Promise<any>;
23
- /**
24
- * Remove a hook handler
25
- */
26
- unregister(hookName: string, handler: HookHandler): void;
27
- /**
28
- * Get all registered hooks for a name
29
- */
30
- getHooks(hookName: string): PluginHook[];
31
- /**
32
- * Get all registered hook names
33
- */
34
- getHookNames(): string[];
35
- /**
36
- * Get hook statistics
37
- */
38
- getStats(): {
39
- hookName: string;
40
- handlerCount: number;
41
- }[];
42
- /**
43
- * Clear all hooks (useful for testing)
44
- */
45
- clear(): void;
46
- /**
47
- * Create a scoped hook system for a plugin
48
- */
49
- createScope(_pluginName: string): ScopedHookSystem;
50
- }
51
- /**
52
- * Scoped hook system for individual plugins
53
- */
54
- declare class ScopedHookSystem {
55
- private parent;
56
- private registeredHooks;
57
- constructor(parent: HookSystemImpl);
58
- /**
59
- * Register a hook (scoped to this plugin)
60
- */
61
- register(hookName: string, handler: HookHandler, priority?: number): void;
62
- /**
63
- * Execute a hook
64
- */
65
- execute(hookName: string, data: any, context?: any): Promise<any>;
66
- /**
67
- * Unregister a specific hook
68
- */
69
- unregister(hookName: string, handler: HookHandler): void;
70
- /**
71
- * Unregister all hooks for this plugin
72
- */
73
- unregisterAll(): void;
74
- /**
75
- * Get hooks registered by this plugin
76
- */
77
- getRegisteredHooks(): {
78
- hookName: string;
79
- handler: HookHandler;
80
- }[];
81
- }
82
- /**
83
- * Hook utilities
84
- */
85
- declare class HookUtils {
86
- /**
87
- * Create a hook name with namespace
88
- */
89
- static createHookName(namespace: string, event: string): string;
90
- /**
91
- * Parse a hook name to extract namespace and event
92
- */
93
- static parseHookName(hookName: string): {
94
- namespace: string;
95
- event: string;
96
- };
97
- /**
98
- * Create a middleware that executes hooks
99
- */
100
- static createHookMiddleware(hookSystem: HookSystem, beforeHook?: string, afterHook?: string): (c: any, next: any) => Promise<void>;
101
- /**
102
- * Create a debounced hook handler
103
- */
104
- static debounce(handler: HookHandler, delay: number): HookHandler;
105
- /**
106
- * Create a throttled hook handler
107
- */
108
- static throttle(handler: HookHandler, limit: number): HookHandler;
109
- }
110
-
111
- /**
112
- * Plugin Validator
113
- *
114
- * Validates plugin definitions, dependencies, and compatibility
115
- */
116
-
117
- declare class PluginValidator implements PluginValidator$1 {
118
- private static readonly RESERVED_NAMES;
119
- private static readonly RESERVED_PATHS;
120
- /**
121
- * Validate plugin definition
122
- */
123
- validate(plugin: Plugin): PluginValidationResult;
124
- /**
125
- * Validate plugin dependencies
126
- */
127
- validateDependencies(plugin: Plugin, registry: PluginRegistry): PluginValidationResult;
128
- /**
129
- * Validate plugin compatibility with SonicJS version
130
- */
131
- validateCompatibility(plugin: Plugin, sonicVersion: string): PluginValidationResult;
132
- /**
133
- * Check if two version ranges are compatible
134
- */
135
- private isCompatible;
136
- /**
137
- * Validate plugin security constraints
138
- */
139
- validateSecurity(plugin: Plugin): PluginValidationResult;
140
- }
141
-
142
- /**
143
- * Plugin Registry Implementation
144
- *
145
- * Manages plugin registration, activation, and lifecycle
146
- */
147
-
148
- declare class PluginRegistryImpl implements PluginRegistry {
149
- private plugins;
150
- private configs;
151
- private statuses;
152
- private validator;
153
- constructor(validator?: PluginValidator);
154
- /**
155
- * Get plugin by name
156
- */
157
- get(name: string): Plugin | undefined;
158
- /**
159
- * Get all registered plugins
160
- */
161
- getAll(): Plugin[];
162
- /**
163
- * Get active plugins
164
- */
165
- getActive(): Plugin[];
166
- /**
167
- * Register a plugin
168
- */
169
- register(plugin: Plugin): Promise<void>;
170
- /**
171
- * Unregister a plugin
172
- */
173
- unregister(name: string): Promise<void>;
174
- /**
175
- * Check if plugin is registered
176
- */
177
- has(name: string): boolean;
178
- /**
179
- * Activate a plugin
180
- */
181
- activate(name: string): Promise<void>;
182
- /**
183
- * Deactivate a plugin
184
- */
185
- deactivate(name: string): Promise<void>;
186
- /**
187
- * Get plugin configuration
188
- */
189
- getConfig(name: string): PluginConfig | undefined;
190
- /**
191
- * Set plugin configuration
192
- */
193
- setConfig(name: string, config: PluginConfig): void;
194
- /**
195
- * Get plugin status
196
- */
197
- getStatus(name: string): PluginStatus | undefined;
198
- /**
199
- * Get all plugin statuses
200
- */
201
- getAllStatuses(): Map<string, PluginStatus>;
202
- /**
203
- * Update plugin status
204
- */
205
- private updateStatus;
206
- /**
207
- * Get plugins that depend on the specified plugin
208
- */
209
- private getDependents;
210
- /**
211
- * Get dependency graph
212
- */
213
- getDependencyGraph(): Map<string, string[]>;
214
- /**
215
- * Resolve plugin load order based on dependencies
216
- */
217
- resolveLoadOrder(): string[];
218
- /**
219
- * Export plugin configuration
220
- */
221
- exportConfig(): {
222
- plugins: PluginConfig[];
223
- };
224
- /**
225
- * Import plugin configuration
226
- */
227
- importConfig(config: {
228
- plugins: PluginConfig[];
229
- }): void;
230
- /**
231
- * Clear all plugins (useful for testing)
232
- */
233
- clear(): void;
234
- /**
235
- * Get registry statistics
236
- */
237
- getStats(): {
238
- total: number;
239
- active: number;
240
- inactive: number;
241
- withErrors: number;
242
- };
243
- }
244
-
245
- /**
246
- * Plugin Manager
247
- *
248
- * Central orchestrator for the plugin system
249
- */
250
-
251
- declare class PluginManager implements PluginManager$1 {
252
- readonly registry: PluginRegistry;
253
- readonly hooks: HookSystem;
254
- private validator;
255
- private context?;
256
- private scopedHooks;
257
- private pluginRoutes;
258
- constructor();
259
- /**
260
- * Initialize plugin system
261
- */
262
- initialize(context: PluginContext): Promise<void>;
263
- /**
264
- * Load plugins from configuration
265
- */
266
- loadPlugins(configs: PluginConfig[]): Promise<void>;
267
- /**
268
- * Install a plugin
269
- */
270
- install(plugin: Plugin, config?: PluginConfig): Promise<void>;
271
- /**
272
- * Uninstall a plugin
273
- */
274
- uninstall(name: string): Promise<void>;
275
- /**
276
- * Get plugin status
277
- */
278
- getStatus(name: string): PluginStatus;
279
- /**
280
- * Get all plugin statuses
281
- */
282
- getAllStatuses(): PluginStatus[];
283
- /**
284
- * Register plugin extensions (routes, middleware, etc.)
285
- */
286
- private registerPluginExtensions;
287
- /**
288
- * Unregister plugin extensions
289
- */
290
- private unregisterPluginExtensions;
291
- /**
292
- * Update plugin status
293
- */
294
- private updatePluginStatus;
295
- /**
296
- * Create a logger for a plugin
297
- */
298
- private createLogger;
299
- /**
300
- * Get plugin routes for mounting in main app
301
- */
302
- getPluginRoutes(): Map<string, Hono>;
303
- /**
304
- * Get plugin middleware for main app
305
- */
306
- getPluginMiddleware(): Array<{
307
- name: string;
308
- handler: any;
309
- priority: number;
310
- global: boolean;
311
- }>;
312
- /**
313
- * Execute shutdown procedures
314
- */
315
- shutdown(): Promise<void>;
316
- /**
317
- * Get plugin system statistics
318
- */
319
- getStats(): {
320
- registry: ReturnType<PluginRegistryImpl['getStats']>;
321
- hooks: Array<{
322
- hookName: string;
323
- handlerCount: number;
324
- }>;
325
- routes: number;
326
- middleware: number;
327
- };
328
- }
329
-
330
- export { HookSystemImpl, HookUtils, PluginManager, PluginRegistryImpl, PluginValidator, ScopedHookSystem };
package/dist/routes.d.cts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * Routes Module Exports
3
- *
4
- * Note: HTTP routes are application-specific and should be implemented
5
- * in the consuming application rather than in the core package.
6
- *
7
- * The core package provides the building blocks (middleware, services, types)
8
- * but each application should define its own routes based on its specific needs.
9
- *
10
- * For reference implementations, see the main SonicJS repository.
11
- */
12
- declare const ROUTES_INFO: {
13
- readonly message: "Routes are application-specific - implement in your application";
14
- readonly reference: "https://github.com/sonicjs/sonicjs";
15
- };
16
-
17
- export { ROUTES_INFO };
@@ -1,5 +0,0 @@
1
- export { C as CorePlugin, p as LogCategory, q as LogEntry, r as LogFilter, o as LogLevel, L as Logger, m as Migration, M as MigrationService, n as MigrationStatus, k as PluginBootstrapService, P as PluginService, e as cleanupRemovedCollections, f as fullCollectionSync, g as getAvailableCollectionNames, h as getLogger, d as getManagedCollections, j as initLogger, i as isCollectionManaged, a as loadCollectionConfig, l as loadCollectionConfigs, c as syncCollection, b as syncCollections, v as validateCollectionConfig } from './index-D45jaIlr.cjs';
2
- import './collection-config-FLlGtsh9.cjs';
3
- import '@cloudflare/workers-types';
4
- import 'drizzle-zod';
5
- import 'drizzle-orm/sqlite-core';