@sonicjs-cms/core 2.4.0 → 2.5.0
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/dist/{chunk-CPXAVWCU.js → chunk-3YUHXWSG.js} +278 -3
- package/dist/chunk-3YUHXWSG.js.map +1 -0
- package/dist/chunk-AI2JJIJX.cjs +211 -0
- package/dist/chunk-AI2JJIJX.cjs.map +1 -0
- package/dist/{chunk-VNCYCH3H.js → chunk-BHNDALCA.js} +56 -4
- package/dist/chunk-BHNDALCA.js.map +1 -0
- package/dist/{chunk-2MI3LZFH.cjs → chunk-I4V3VZWF.cjs} +46 -2
- package/dist/chunk-I4V3VZWF.cjs.map +1 -0
- package/dist/{chunk-DTLB6UIH.cjs → chunk-LWG2MWDA.cjs} +280 -2
- package/dist/chunk-LWG2MWDA.cjs.map +1 -0
- package/dist/{chunk-FT6NBHNX.js → chunk-OJZ45OJD.js} +507 -275
- package/dist/chunk-OJZ45OJD.js.map +1 -0
- package/dist/chunk-QDBNW7KQ.js +209 -0
- package/dist/chunk-QDBNW7KQ.js.map +1 -0
- package/dist/{chunk-DXM575E2.js → chunk-TJTWRO4G.js} +5 -5
- package/dist/chunk-TJTWRO4G.js.map +1 -0
- package/dist/{chunk-A4SVOGG6.cjs → chunk-UAQL2VWX.cjs} +591 -360
- package/dist/chunk-UAQL2VWX.cjs.map +1 -0
- package/dist/{chunk-D2NLCPO2.js → chunk-VEL7QRYI.js} +46 -2
- package/dist/chunk-VEL7QRYI.js.map +1 -0
- package/dist/{chunk-7I5INVNR.cjs → chunk-YYV3XQOQ.cjs} +6 -6
- package/dist/chunk-YYV3XQOQ.cjs.map +1 -0
- package/dist/{chunk-FYEDK7K7.cjs → chunk-ZWV3EBZ7.cjs} +58 -3
- package/dist/chunk-ZWV3EBZ7.cjs.map +1 -0
- package/dist/{collection-config-FLlGtsh9.d.cts → collection-config-B6gMPunn.d.cts} +9 -1
- package/dist/{collection-config-FLlGtsh9.d.ts → collection-config-B6gMPunn.d.ts} +9 -1
- package/dist/index.cjs +90 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +23 -23
- package/dist/middleware.js +2 -2
- package/dist/migrations-NIEUFG44.cjs +13 -0
- package/dist/{migrations-32QAYLWJ.cjs.map → migrations-NIEUFG44.cjs.map} +1 -1
- package/dist/migrations-TGZKJKV4.js +4 -0
- package/dist/{migrations-57ZHBQ4X.js.map → migrations-TGZKJKV4.js.map} +1 -1
- package/dist/{plugin-bootstrap-C0E3jdz-.d.cts → plugin-bootstrap-SHsdjE6X.d.cts} +1 -1
- package/dist/{plugin-bootstrap-CDh0JHtW.d.ts → plugin-bootstrap-dYhD9fQR.d.ts} +1 -1
- package/dist/plugin-manager-Baa6xXqB.d.ts +328 -0
- package/dist/plugin-manager-vBal9Zip.d.cts +328 -0
- package/dist/plugins.cjs +20 -7
- package/dist/plugins.d.cts +53 -310
- package/dist/plugins.d.ts +53 -310
- package/dist/plugins.js +2 -1
- package/dist/routes.cjs +25 -24
- package/dist/routes.js +5 -4
- package/dist/services.cjs +2 -2
- package/dist/services.d.cts +2 -2
- package/dist/services.d.ts +2 -2
- package/dist/services.js +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.cjs +23 -11
- package/dist/utils.d.cts +38 -1
- package/dist/utils.d.ts +38 -1
- package/dist/utils.js +1 -1
- package/migrations/027_fix_slug_field_type.sql +18 -0
- package/migrations/028_fix_slug_field_type_in_schemas.sql +30 -0
- package/package.json +2 -1
- package/dist/chunk-2MI3LZFH.cjs.map +0 -1
- package/dist/chunk-7I5INVNR.cjs.map +0 -1
- package/dist/chunk-A4SVOGG6.cjs.map +0 -1
- package/dist/chunk-CPXAVWCU.js.map +0 -1
- package/dist/chunk-D2NLCPO2.js.map +0 -1
- package/dist/chunk-DTLB6UIH.cjs.map +0 -1
- package/dist/chunk-DXM575E2.js.map +0 -1
- package/dist/chunk-FT6NBHNX.js.map +0 -1
- package/dist/chunk-FYEDK7K7.cjs.map +0 -1
- package/dist/chunk-VNCYCH3H.js.map +0 -1
- package/dist/migrations-32QAYLWJ.cjs +0 -13
- package/dist/migrations-57ZHBQ4X.js +0 -4
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { l as HookSystem, H as HookHandler, j as PluginHook, s as PluginValidator$1, P as Plugin, t as PluginValidationResult, m as PluginRegistry, b as PluginConfig, o as PluginStatus, n as PluginManager$1, a as PluginContext } from './plugin-zvZpaiP5.cjs';
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hook System Implementation
|
|
6
|
+
*
|
|
7
|
+
* Provides event-driven extensibility for plugins
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare class HookSystemImpl implements HookSystem {
|
|
11
|
+
private hooks;
|
|
12
|
+
private executing;
|
|
13
|
+
/**
|
|
14
|
+
* Register a hook handler
|
|
15
|
+
*/
|
|
16
|
+
register(hookName: string, handler: HookHandler, priority?: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Execute all handlers for a hook
|
|
19
|
+
*/
|
|
20
|
+
execute(hookName: string, data: any, context?: any): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Remove a hook handler
|
|
23
|
+
*/
|
|
24
|
+
unregister(hookName: string, handler: HookHandler): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get all registered hooks for a name
|
|
27
|
+
*/
|
|
28
|
+
getHooks(hookName: string): PluginHook[];
|
|
29
|
+
/**
|
|
30
|
+
* Get all registered hook names
|
|
31
|
+
*/
|
|
32
|
+
getHookNames(): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Get hook statistics
|
|
35
|
+
*/
|
|
36
|
+
getStats(): {
|
|
37
|
+
hookName: string;
|
|
38
|
+
handlerCount: number;
|
|
39
|
+
}[];
|
|
40
|
+
/**
|
|
41
|
+
* Clear all hooks (useful for testing)
|
|
42
|
+
*/
|
|
43
|
+
clear(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Create a scoped hook system for a plugin
|
|
46
|
+
*/
|
|
47
|
+
createScope(_pluginName: string): ScopedHookSystem;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Scoped hook system for individual plugins
|
|
51
|
+
*/
|
|
52
|
+
declare class ScopedHookSystem {
|
|
53
|
+
private parent;
|
|
54
|
+
private registeredHooks;
|
|
55
|
+
constructor(parent: HookSystemImpl);
|
|
56
|
+
/**
|
|
57
|
+
* Register a hook (scoped to this plugin)
|
|
58
|
+
*/
|
|
59
|
+
register(hookName: string, handler: HookHandler, priority?: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Execute a hook
|
|
62
|
+
*/
|
|
63
|
+
execute(hookName: string, data: any, context?: any): Promise<any>;
|
|
64
|
+
/**
|
|
65
|
+
* Unregister a specific hook
|
|
66
|
+
*/
|
|
67
|
+
unregister(hookName: string, handler: HookHandler): void;
|
|
68
|
+
/**
|
|
69
|
+
* Unregister all hooks for this plugin
|
|
70
|
+
*/
|
|
71
|
+
unregisterAll(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Get hooks registered by this plugin
|
|
74
|
+
*/
|
|
75
|
+
getRegisteredHooks(): {
|
|
76
|
+
hookName: string;
|
|
77
|
+
handler: HookHandler;
|
|
78
|
+
}[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Hook utilities
|
|
82
|
+
*/
|
|
83
|
+
declare class HookUtils {
|
|
84
|
+
/**
|
|
85
|
+
* Create a hook name with namespace
|
|
86
|
+
*/
|
|
87
|
+
static createHookName(namespace: string, event: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Parse a hook name to extract namespace and event
|
|
90
|
+
*/
|
|
91
|
+
static parseHookName(hookName: string): {
|
|
92
|
+
namespace: string;
|
|
93
|
+
event: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Create a middleware that executes hooks
|
|
97
|
+
*/
|
|
98
|
+
static createHookMiddleware(hookSystem: HookSystem, beforeHook?: string, afterHook?: string): (c: any, next: any) => Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Create a debounced hook handler
|
|
101
|
+
*/
|
|
102
|
+
static debounce(handler: HookHandler, delay: number): HookHandler;
|
|
103
|
+
/**
|
|
104
|
+
* Create a throttled hook handler
|
|
105
|
+
*/
|
|
106
|
+
static throttle(handler: HookHandler, limit: number): HookHandler;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Plugin Validator
|
|
111
|
+
*
|
|
112
|
+
* Validates plugin definitions, dependencies, and compatibility
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
declare class PluginValidator implements PluginValidator$1 {
|
|
116
|
+
private static readonly RESERVED_NAMES;
|
|
117
|
+
private static readonly RESERVED_PATHS;
|
|
118
|
+
/**
|
|
119
|
+
* Validate plugin definition
|
|
120
|
+
*/
|
|
121
|
+
validate(plugin: Plugin): PluginValidationResult;
|
|
122
|
+
/**
|
|
123
|
+
* Validate plugin dependencies
|
|
124
|
+
*/
|
|
125
|
+
validateDependencies(plugin: Plugin, registry: PluginRegistry): PluginValidationResult;
|
|
126
|
+
/**
|
|
127
|
+
* Validate plugin compatibility with SonicJS version
|
|
128
|
+
*/
|
|
129
|
+
validateCompatibility(plugin: Plugin, sonicVersion: string): PluginValidationResult;
|
|
130
|
+
/**
|
|
131
|
+
* Check if two version ranges are compatible
|
|
132
|
+
*/
|
|
133
|
+
private isCompatible;
|
|
134
|
+
/**
|
|
135
|
+
* Validate plugin security constraints
|
|
136
|
+
*/
|
|
137
|
+
validateSecurity(plugin: Plugin): PluginValidationResult;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Plugin Registry Implementation
|
|
142
|
+
*
|
|
143
|
+
* Manages plugin registration, activation, and lifecycle
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
declare class PluginRegistryImpl implements PluginRegistry {
|
|
147
|
+
private plugins;
|
|
148
|
+
private configs;
|
|
149
|
+
private statuses;
|
|
150
|
+
private validator;
|
|
151
|
+
constructor(validator?: PluginValidator);
|
|
152
|
+
/**
|
|
153
|
+
* Get plugin by name
|
|
154
|
+
*/
|
|
155
|
+
get(name: string): Plugin | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Get all registered plugins
|
|
158
|
+
*/
|
|
159
|
+
getAll(): Plugin[];
|
|
160
|
+
/**
|
|
161
|
+
* Get active plugins
|
|
162
|
+
*/
|
|
163
|
+
getActive(): Plugin[];
|
|
164
|
+
/**
|
|
165
|
+
* Register a plugin
|
|
166
|
+
*/
|
|
167
|
+
register(plugin: Plugin): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Unregister a plugin
|
|
170
|
+
*/
|
|
171
|
+
unregister(name: string): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Check if plugin is registered
|
|
174
|
+
*/
|
|
175
|
+
has(name: string): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Activate a plugin
|
|
178
|
+
*/
|
|
179
|
+
activate(name: string): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Deactivate a plugin
|
|
182
|
+
*/
|
|
183
|
+
deactivate(name: string): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Get plugin configuration
|
|
186
|
+
*/
|
|
187
|
+
getConfig(name: string): PluginConfig | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Set plugin configuration
|
|
190
|
+
*/
|
|
191
|
+
setConfig(name: string, config: PluginConfig): void;
|
|
192
|
+
/**
|
|
193
|
+
* Get plugin status
|
|
194
|
+
*/
|
|
195
|
+
getStatus(name: string): PluginStatus | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Get all plugin statuses
|
|
198
|
+
*/
|
|
199
|
+
getAllStatuses(): Map<string, PluginStatus>;
|
|
200
|
+
/**
|
|
201
|
+
* Update plugin status
|
|
202
|
+
*/
|
|
203
|
+
private updateStatus;
|
|
204
|
+
/**
|
|
205
|
+
* Get plugins that depend on the specified plugin
|
|
206
|
+
*/
|
|
207
|
+
private getDependents;
|
|
208
|
+
/**
|
|
209
|
+
* Get dependency graph
|
|
210
|
+
*/
|
|
211
|
+
getDependencyGraph(): Map<string, string[]>;
|
|
212
|
+
/**
|
|
213
|
+
* Resolve plugin load order based on dependencies
|
|
214
|
+
*/
|
|
215
|
+
resolveLoadOrder(): string[];
|
|
216
|
+
/**
|
|
217
|
+
* Export plugin configuration
|
|
218
|
+
*/
|
|
219
|
+
exportConfig(): {
|
|
220
|
+
plugins: PluginConfig[];
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Import plugin configuration
|
|
224
|
+
*/
|
|
225
|
+
importConfig(config: {
|
|
226
|
+
plugins: PluginConfig[];
|
|
227
|
+
}): void;
|
|
228
|
+
/**
|
|
229
|
+
* Clear all plugins (useful for testing)
|
|
230
|
+
*/
|
|
231
|
+
clear(): void;
|
|
232
|
+
/**
|
|
233
|
+
* Get registry statistics
|
|
234
|
+
*/
|
|
235
|
+
getStats(): {
|
|
236
|
+
total: number;
|
|
237
|
+
active: number;
|
|
238
|
+
inactive: number;
|
|
239
|
+
withErrors: number;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Plugin Manager
|
|
245
|
+
*
|
|
246
|
+
* Central orchestrator for the plugin system
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
declare class PluginManager implements PluginManager$1 {
|
|
250
|
+
readonly registry: PluginRegistry;
|
|
251
|
+
readonly hooks: HookSystem;
|
|
252
|
+
private validator;
|
|
253
|
+
private context?;
|
|
254
|
+
private scopedHooks;
|
|
255
|
+
private pluginRoutes;
|
|
256
|
+
constructor();
|
|
257
|
+
/**
|
|
258
|
+
* Initialize plugin system
|
|
259
|
+
*/
|
|
260
|
+
initialize(context: PluginContext): Promise<void>;
|
|
261
|
+
/**
|
|
262
|
+
* Load plugins from configuration
|
|
263
|
+
*/
|
|
264
|
+
loadPlugins(configs: PluginConfig[]): Promise<void>;
|
|
265
|
+
/**
|
|
266
|
+
* Install a plugin
|
|
267
|
+
*/
|
|
268
|
+
install(plugin: Plugin, config?: PluginConfig): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Uninstall a plugin
|
|
271
|
+
*/
|
|
272
|
+
uninstall(name: string): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Get plugin status
|
|
275
|
+
*/
|
|
276
|
+
getStatus(name: string): PluginStatus;
|
|
277
|
+
/**
|
|
278
|
+
* Get all plugin statuses
|
|
279
|
+
*/
|
|
280
|
+
getAllStatuses(): PluginStatus[];
|
|
281
|
+
/**
|
|
282
|
+
* Register plugin extensions (routes, middleware, etc.)
|
|
283
|
+
*/
|
|
284
|
+
private registerPluginExtensions;
|
|
285
|
+
/**
|
|
286
|
+
* Unregister plugin extensions
|
|
287
|
+
*/
|
|
288
|
+
private unregisterPluginExtensions;
|
|
289
|
+
/**
|
|
290
|
+
* Update plugin status
|
|
291
|
+
*/
|
|
292
|
+
private updatePluginStatus;
|
|
293
|
+
/**
|
|
294
|
+
* Create a logger for a plugin
|
|
295
|
+
*/
|
|
296
|
+
private createLogger;
|
|
297
|
+
/**
|
|
298
|
+
* Get plugin routes for mounting in main app
|
|
299
|
+
*/
|
|
300
|
+
getPluginRoutes(): Map<string, Hono>;
|
|
301
|
+
/**
|
|
302
|
+
* Get plugin middleware for main app
|
|
303
|
+
*/
|
|
304
|
+
getPluginMiddleware(): Array<{
|
|
305
|
+
name: string;
|
|
306
|
+
handler: any;
|
|
307
|
+
priority: number;
|
|
308
|
+
global: boolean;
|
|
309
|
+
}>;
|
|
310
|
+
/**
|
|
311
|
+
* Execute shutdown procedures
|
|
312
|
+
*/
|
|
313
|
+
shutdown(): Promise<void>;
|
|
314
|
+
/**
|
|
315
|
+
* Get plugin system statistics
|
|
316
|
+
*/
|
|
317
|
+
getStats(): {
|
|
318
|
+
registry: ReturnType<PluginRegistryImpl['getStats']>;
|
|
319
|
+
hooks: Array<{
|
|
320
|
+
hookName: string;
|
|
321
|
+
handlerCount: number;
|
|
322
|
+
}>;
|
|
323
|
+
routes: number;
|
|
324
|
+
middleware: number;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export { HookSystemImpl as H, PluginRegistryImpl as P, ScopedHookSystem as S, HookUtils as a, PluginManager as b, PluginValidator as c };
|
package/dist/plugins.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLWG2MWDA_cjs = require('./chunk-LWG2MWDA.cjs');
|
|
4
|
+
require('./chunk-AI2JJIJX.cjs');
|
|
4
5
|
require('./chunk-KYGRJCZM.cjs');
|
|
5
6
|
require('./chunk-IGJUBJBW.cjs');
|
|
6
7
|
|
|
@@ -8,27 +9,39 @@ require('./chunk-IGJUBJBW.cjs');
|
|
|
8
9
|
|
|
9
10
|
Object.defineProperty(exports, "HookSystemImpl", {
|
|
10
11
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkLWG2MWDA_cjs.HookSystemImpl; }
|
|
12
13
|
});
|
|
13
14
|
Object.defineProperty(exports, "HookUtils", {
|
|
14
15
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkLWG2MWDA_cjs.HookUtils; }
|
|
16
17
|
});
|
|
17
18
|
Object.defineProperty(exports, "PluginManager", {
|
|
18
19
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkLWG2MWDA_cjs.PluginManager; }
|
|
20
21
|
});
|
|
21
22
|
Object.defineProperty(exports, "PluginRegistryImpl", {
|
|
22
23
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkLWG2MWDA_cjs.PluginRegistryImpl; }
|
|
24
25
|
});
|
|
25
26
|
Object.defineProperty(exports, "PluginValidator", {
|
|
26
27
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkLWG2MWDA_cjs.PluginValidator; }
|
|
28
29
|
});
|
|
29
30
|
Object.defineProperty(exports, "ScopedHookSystem", {
|
|
30
31
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkLWG2MWDA_cjs.ScopedHookSystem; }
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "TurnstileService", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return chunkLWG2MWDA_cjs.TurnstileService; }
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "createTurnstileMiddleware", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () { return chunkLWG2MWDA_cjs.createTurnstileMiddleware; }
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "verifyTurnstile", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return chunkLWG2MWDA_cjs.verifyTurnstile; }
|
|
32
45
|
});
|
|
33
46
|
//# sourceMappingURL=plugins.cjs.map
|
|
34
47
|
//# sourceMappingURL=plugins.cjs.map
|