@sonicjs-cms/core 3.0.0-beta.25 → 3.0.0-beta.26
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/{app-01M0dIwt.d.ts → app-BP5IlK94.d.ts} +7 -7
- package/dist/{app-aj39TGHB.d.cts → app-fdq4K3vw.d.cts} +7 -7
- package/dist/catalog-56DR6OXI.cjs +41 -0
- package/dist/catalog-56DR6OXI.cjs.map +1 -0
- package/dist/catalog-6MB37KY7.js +4 -0
- package/dist/catalog-6MB37KY7.js.map +1 -0
- package/dist/{chunk-YAURVGUK.cjs → chunk-4DHPR7KR.cjs} +77 -17
- package/dist/chunk-4DHPR7KR.cjs.map +1 -0
- package/dist/{chunk-D7RLBBHE.js → chunk-5YSFQO7X.js} +40 -13
- package/dist/chunk-5YSFQO7X.js.map +1 -0
- package/dist/{chunk-RSBZITK3.cjs → chunk-6UAI4SGN.cjs} +3 -3
- package/dist/{chunk-RSBZITK3.cjs.map → chunk-6UAI4SGN.cjs.map} +1 -1
- package/dist/{chunk-2XAQTPAE.js → chunk-6X22VFEV.js} +8 -2
- package/dist/chunk-6X22VFEV.js.map +1 -0
- package/dist/{chunk-I7MIRRFJ.cjs → chunk-A22RBHO7.cjs} +11 -11
- package/dist/{chunk-I7MIRRFJ.cjs.map → chunk-A22RBHO7.cjs.map} +1 -1
- package/dist/{chunk-FVAK4C6L.js → chunk-AMP4BSJE.js} +3 -3
- package/dist/{chunk-FVAK4C6L.js.map → chunk-AMP4BSJE.js.map} +1 -1
- package/dist/{chunk-E7E3NL3Y.cjs → chunk-BRKXMRMB.cjs} +93 -93
- package/dist/chunk-BRKXMRMB.cjs.map +1 -0
- package/dist/{chunk-36Z3AKX3.cjs → chunk-C5LDQ3SH.cjs} +8 -2
- package/dist/chunk-C5LDQ3SH.cjs.map +1 -0
- package/dist/{chunk-2OXFMMA3.js → chunk-EEA476CJ.js} +84 -80
- package/dist/chunk-EEA476CJ.js.map +1 -0
- package/dist/chunk-F6BTBE4S.js +119 -0
- package/dist/chunk-F6BTBE4S.js.map +1 -0
- package/dist/chunk-FZGIU5AZ.cjs +128 -0
- package/dist/chunk-FZGIU5AZ.cjs.map +1 -0
- package/dist/{chunk-C54MH5UI.js → chunk-JD7BZU3A.js} +3 -3
- package/dist/{chunk-C54MH5UI.js.map → chunk-JD7BZU3A.js.map} +1 -1
- package/dist/{chunk-3KGY4IBW.js → chunk-JG5J434C.js} +3 -3
- package/dist/{chunk-3KGY4IBW.js.map → chunk-JG5J434C.js.map} +1 -1
- package/dist/{chunk-D6FWEYQE.cjs → chunk-KWQNB6UM.cjs} +4 -4
- package/dist/{chunk-D6FWEYQE.cjs.map → chunk-KWQNB6UM.cjs.map} +1 -1
- package/dist/{chunk-7P5OCUPS.js → chunk-OJFIQGZB.js} +107 -29
- package/dist/chunk-OJFIQGZB.js.map +1 -0
- package/dist/{chunk-JCBDXEY2.cjs → chunk-OLEOKHDX.cjs} +9 -2
- package/dist/chunk-OLEOKHDX.cjs.map +1 -0
- package/dist/{chunk-MOGK3U4A.cjs → chunk-PAS7GZBS.cjs} +40 -13
- package/dist/chunk-PAS7GZBS.cjs.map +1 -0
- package/dist/{chunk-2D3A4X52.js → chunk-RVOX2WH2.js} +74 -18
- package/dist/chunk-RVOX2WH2.js.map +1 -0
- package/dist/{chunk-BDQ55MWV.js → chunk-RXLI3ADU.js} +9 -2
- package/dist/chunk-RXLI3ADU.js.map +1 -0
- package/dist/{chunk-6OA77UM7.cjs → chunk-S2QN4LFD.cjs} +386 -306
- package/dist/chunk-S2QN4LFD.cjs.map +1 -0
- package/dist/{chunk-DLTT7QZU.cjs → chunk-SFGYZUWU.cjs} +3 -3
- package/dist/{chunk-DLTT7QZU.cjs.map → chunk-SFGYZUWU.cjs.map} +1 -1
- package/dist/{chunk-CWIGQYRR.js → chunk-UB5QSRO7.js} +5 -5
- package/dist/chunk-UB5QSRO7.js.map +1 -0
- package/dist/{chunk-F26HP3B6.js → chunk-UKIDWRA3.js} +4 -4
- package/dist/{chunk-F26HP3B6.js.map → chunk-UKIDWRA3.js.map} +1 -1
- package/dist/{chunk-BJ6NJL2E.cjs → chunk-XZUEGFXE.cjs} +5 -5
- package/dist/chunk-XZUEGFXE.cjs.map +1 -0
- package/dist/{collection-config-BTzAvKt2.d.cts → collection-config-U2dydD_O.d.cts} +14 -0
- package/dist/{collection-config-BTzAvKt2.d.ts → collection-config-U2dydD_O.d.ts} +14 -0
- package/dist/config-DOAWXZBG.js +6 -0
- package/dist/{config-4TIHSNW6.js.map → config-DOAWXZBG.js.map} +1 -1
- package/dist/{config-XN2ETAJ3.cjs → config-VLU73ZW7.cjs} +5 -5
- package/dist/{config-XN2ETAJ3.cjs.map → config-VLU73ZW7.cjs.map} +1 -1
- package/dist/index.cjs +600 -332
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -10
- package/dist/index.d.ts +17 -10
- package/dist/index.js +292 -25
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +46 -46
- package/dist/middleware.d.cts +6 -9
- package/dist/middleware.d.ts +6 -9
- package/dist/middleware.js +5 -5
- package/dist/migrations-6M6772UC.cjs +13 -0
- package/dist/{migrations-KU4V6T73.cjs.map → migrations-6M6772UC.cjs.map} +1 -1
- package/dist/migrations-GZ2HIB4I.js +4 -0
- package/dist/{migrations-JAHMI5MK.js.map → migrations-GZ2HIB4I.js.map} +1 -1
- package/dist/{plugin-bootstrap-BHWQ2df8.d.cts → plugin-bootstrap-CfVILQeP.d.ts} +1 -1
- package/dist/{plugin-bootstrap-Bj4fxX1q.d.ts → plugin-bootstrap-RY5pkoOT.d.cts} +1 -1
- package/dist/plugins.cjs +40 -40
- package/dist/plugins.js +3 -3
- package/dist/rbac-TFUOYIVN.cjs +14 -0
- package/dist/{rbac-AORZ6O3N.cjs.map → rbac-TFUOYIVN.cjs.map} +1 -1
- package/dist/rbac-XSNP76CV.js +5 -0
- package/dist/{rbac-P44772FP.js.map → rbac-XSNP76CV.js.map} +1 -1
- package/dist/routes.cjs +31 -30
- package/dist/routes.d.cts +3 -5
- package/dist/routes.d.ts +3 -5
- package/dist/routes.js +11 -10
- package/dist/services.cjs +30 -30
- package/dist/services.d.cts +9 -2
- package/dist/services.d.ts +9 -2
- package/dist/services.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.cjs +12 -12
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-2D3A4X52.js.map +0 -1
- package/dist/chunk-2OXFMMA3.js.map +0 -1
- package/dist/chunk-2XAQTPAE.js.map +0 -1
- package/dist/chunk-36Z3AKX3.cjs.map +0 -1
- package/dist/chunk-6OA77UM7.cjs.map +0 -1
- package/dist/chunk-7P5OCUPS.js.map +0 -1
- package/dist/chunk-BDQ55MWV.js.map +0 -1
- package/dist/chunk-BJ6NJL2E.cjs.map +0 -1
- package/dist/chunk-CWIGQYRR.js.map +0 -1
- package/dist/chunk-D7RLBBHE.js.map +0 -1
- package/dist/chunk-E7E3NL3Y.cjs.map +0 -1
- package/dist/chunk-JCBDXEY2.cjs.map +0 -1
- package/dist/chunk-MOGK3U4A.cjs.map +0 -1
- package/dist/chunk-YAURVGUK.cjs.map +0 -1
- package/dist/config-4TIHSNW6.js +0 -6
- package/dist/migrations-JAHMI5MK.js +0 -4
- package/dist/migrations-KU4V6T73.cjs +0 -13
- package/dist/rbac-AORZ6O3N.cjs +0 -14
- package/dist/rbac-P44772FP.js +0 -5
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import * as better_auth_client from 'better-auth/client';
|
|
2
|
-
import * as better_auth_plugins_email_otp from 'better-auth/plugins/email-otp';
|
|
3
1
|
import * as better_auth from 'better-auth';
|
|
4
|
-
import * as
|
|
5
|
-
import * as better_call from 'better-call';
|
|
2
|
+
import * as better_auth_plugins from 'better-auth/plugins';
|
|
6
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
7
4
|
import * as zod from 'zod';
|
|
8
5
|
import { z } from 'zod';
|
|
6
|
+
import * as better_call from 'better-call';
|
|
9
7
|
import { i as HookSystemLike, E as EmailProvider } from './types-DT7XN5TX.js';
|
|
10
8
|
import { Hono, MiddlewareHandler, Context } from 'hono';
|
|
11
9
|
import { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types';
|
|
@@ -22,6 +20,7 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
22
20
|
signInMagicLink: better_call.StrictEndpoint<"/sign-in/magic-link", {
|
|
23
21
|
method: "POST";
|
|
24
22
|
requireHeaders: true;
|
|
23
|
+
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<void>)[];
|
|
25
24
|
body: zod.ZodObject<{
|
|
26
25
|
email: zod.ZodEmail;
|
|
27
26
|
name: zod.ZodOptional<zod.ZodString>;
|
|
@@ -120,7 +119,7 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
120
119
|
window: number;
|
|
121
120
|
max: number;
|
|
122
121
|
}[];
|
|
123
|
-
options:
|
|
122
|
+
options: better_auth_plugins.MagicLinkOptions;
|
|
124
123
|
} | {
|
|
125
124
|
id: "email-otp";
|
|
126
125
|
version: string;
|
|
@@ -138,6 +137,7 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
138
137
|
endpoints: {
|
|
139
138
|
sendVerificationOTP: better_call.StrictEndpoint<"/email-otp/send-verification-otp", {
|
|
140
139
|
method: "POST";
|
|
140
|
+
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<void>)[];
|
|
141
141
|
body: zod.ZodObject<{
|
|
142
142
|
email: zod.ZodString;
|
|
143
143
|
type: zod.ZodEnum<{
|
|
@@ -646,13 +646,13 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
646
646
|
window: number;
|
|
647
647
|
max: number;
|
|
648
648
|
})[];
|
|
649
|
-
options:
|
|
649
|
+
options: better_auth_plugins.EmailOTPOptions;
|
|
650
650
|
$ERROR_CODES: {
|
|
651
651
|
OTP_EXPIRED: better_auth.RawError<"OTP_EXPIRED">;
|
|
652
652
|
INVALID_OTP: better_auth.RawError<"INVALID_OTP">;
|
|
653
653
|
TOO_MANY_ATTEMPTS: better_auth.RawError<"TOO_MANY_ATTEMPTS">;
|
|
654
654
|
};
|
|
655
|
-
} |
|
|
655
|
+
} | better_auth_plugins.DefaultOrganizationPlugin<{
|
|
656
656
|
schema: {
|
|
657
657
|
organization: {
|
|
658
658
|
modelName: string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import * as better_auth_client from 'better-auth/client';
|
|
2
|
-
import * as better_auth_plugins_email_otp from 'better-auth/plugins/email-otp';
|
|
3
1
|
import * as better_auth from 'better-auth';
|
|
4
|
-
import * as
|
|
5
|
-
import * as better_call from 'better-call';
|
|
2
|
+
import * as better_auth_plugins from 'better-auth/plugins';
|
|
6
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
7
4
|
import * as zod from 'zod';
|
|
8
5
|
import { z } from 'zod';
|
|
6
|
+
import * as better_call from 'better-call';
|
|
9
7
|
import { i as HookSystemLike, E as EmailProvider } from './types-DT7XN5TX.cjs';
|
|
10
8
|
import { Hono, MiddlewareHandler, Context } from 'hono';
|
|
11
9
|
import { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types';
|
|
@@ -22,6 +20,7 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
22
20
|
signInMagicLink: better_call.StrictEndpoint<"/sign-in/magic-link", {
|
|
23
21
|
method: "POST";
|
|
24
22
|
requireHeaders: true;
|
|
23
|
+
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<void>)[];
|
|
25
24
|
body: zod.ZodObject<{
|
|
26
25
|
email: zod.ZodEmail;
|
|
27
26
|
name: zod.ZodOptional<zod.ZodString>;
|
|
@@ -120,7 +119,7 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
120
119
|
window: number;
|
|
121
120
|
max: number;
|
|
122
121
|
}[];
|
|
123
|
-
options:
|
|
122
|
+
options: better_auth_plugins.MagicLinkOptions;
|
|
124
123
|
} | {
|
|
125
124
|
id: "email-otp";
|
|
126
125
|
version: string;
|
|
@@ -138,6 +137,7 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
138
137
|
endpoints: {
|
|
139
138
|
sendVerificationOTP: better_call.StrictEndpoint<"/email-otp/send-verification-otp", {
|
|
140
139
|
method: "POST";
|
|
140
|
+
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<void>)[];
|
|
141
141
|
body: zod.ZodObject<{
|
|
142
142
|
email: zod.ZodString;
|
|
143
143
|
type: zod.ZodEnum<{
|
|
@@ -646,13 +646,13 @@ declare function getDefaultAuthOptions(env: Bindings, requestBaseURL?: string):
|
|
|
646
646
|
window: number;
|
|
647
647
|
max: number;
|
|
648
648
|
})[];
|
|
649
|
-
options:
|
|
649
|
+
options: better_auth_plugins.EmailOTPOptions;
|
|
650
650
|
$ERROR_CODES: {
|
|
651
651
|
OTP_EXPIRED: better_auth.RawError<"OTP_EXPIRED">;
|
|
652
652
|
INVALID_OTP: better_auth.RawError<"INVALID_OTP">;
|
|
653
653
|
TOO_MANY_ATTEMPTS: better_auth.RawError<"TOO_MANY_ATTEMPTS">;
|
|
654
654
|
};
|
|
655
|
-
} |
|
|
655
|
+
} | better_auth_plugins.DefaultOrganizationPlugin<{
|
|
656
656
|
schema: {
|
|
657
657
|
organization: {
|
|
658
658
|
modelName: string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkFZGIU5AZ_cjs = require('./chunk-FZGIU5AZ.cjs');
|
|
4
|
+
require('./chunk-IGJUBJBW.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "clearCatalog", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkFZGIU5AZ_cjs.clearCatalog; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "clearKvCatalog", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkFZGIU5AZ_cjs.clearKvCatalog; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "getCatalog", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkFZGIU5AZ_cjs.getCatalog; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "getCatalogStats", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkFZGIU5AZ_cjs.getCatalogStats; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "loadKvCatalog", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkFZGIU5AZ_cjs.loadKvCatalog; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "recordCatalogRequest", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkFZGIU5AZ_cjs.recordCatalogRequest; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "scheduleKvWrite", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunkFZGIU5AZ_cjs.scheduleKvWrite; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "setGlobalCatalogKv", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunkFZGIU5AZ_cjs.setGlobalCatalogKv; }
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=catalog-56DR6OXI.cjs.map
|
|
41
|
+
//# sourceMappingURL=catalog-56DR6OXI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"catalog-56DR6OXI.cjs"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { clearCatalog, clearKvCatalog, getCatalog, getCatalogStats, loadKvCatalog, recordCatalogRequest, scheduleKvWrite, setGlobalCatalogKv } from './chunk-F6BTBE4S.js';
|
|
2
|
+
import './chunk-V4OQ3NZ2.js';
|
|
3
|
+
//# sourceMappingURL=catalog-6MB37KY7.js.map
|
|
4
|
+
//# sourceMappingURL=catalog-6MB37KY7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"catalog-6MB37KY7.js"}
|
|
@@ -249,6 +249,58 @@ function validateCollectionConfig(config) {
|
|
|
249
249
|
errors
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
+
|
|
253
|
+
// src/middleware/plugin-middleware.ts
|
|
254
|
+
var _pluginStatusCache = /* @__PURE__ */ new Map();
|
|
255
|
+
function invalidatePluginStatusCache(pluginId) {
|
|
256
|
+
if (pluginId) {
|
|
257
|
+
_pluginStatusCache.delete(pluginId);
|
|
258
|
+
} else {
|
|
259
|
+
_pluginStatusCache.clear();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async function isPluginActive(db, pluginId) {
|
|
263
|
+
if (_pluginStatusCache.has(pluginId)) {
|
|
264
|
+
return _pluginStatusCache.get(pluginId);
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
const docResult = await db.prepare(
|
|
268
|
+
`SELECT json_extract(data, '$.status') as status FROM documents
|
|
269
|
+
WHERE slug = ? AND type_id = 'plugin' AND tenant_id = 'default'
|
|
270
|
+
AND is_current_draft = 1 AND deleted_at IS NULL`
|
|
271
|
+
).bind(pluginId).first();
|
|
272
|
+
const active = docResult?.status === "active";
|
|
273
|
+
_pluginStatusCache.set(pluginId, active);
|
|
274
|
+
return active;
|
|
275
|
+
} catch (error) {
|
|
276
|
+
console.error(`[isPluginActive] Error checking plugin status for ${pluginId}:`, error);
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async function requireActivePlugin(db, pluginId) {
|
|
281
|
+
const isActive = await isPluginActive(db, pluginId);
|
|
282
|
+
if (!isActive) {
|
|
283
|
+
throw new Error(`Plugin '${pluginId}' is required but is not active`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
async function requireActivePlugins(db, pluginIds) {
|
|
287
|
+
for (const pluginId of pluginIds) {
|
|
288
|
+
await requireActivePlugin(db, pluginId);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function getActivePlugins(db) {
|
|
292
|
+
try {
|
|
293
|
+
const { results } = await db.prepare(
|
|
294
|
+
`SELECT slug as id, json_extract(data, '$.status') as status, data FROM documents
|
|
295
|
+
WHERE type_id = 'plugin' AND tenant_id = 'default'
|
|
296
|
+
AND q_plugin_status = 'active' AND is_current_draft = 1 AND deleted_at IS NULL`
|
|
297
|
+
).all();
|
|
298
|
+
return results || [];
|
|
299
|
+
} catch (error) {
|
|
300
|
+
console.error("[getActivePlugins] Error fetching active plugins:", error);
|
|
301
|
+
return [];
|
|
302
|
+
}
|
|
303
|
+
}
|
|
252
304
|
var TENANT_COOKIE = "sonicjs-tenant";
|
|
253
305
|
var TENANT_SWITCHER_MARKER = "<!-- TENANT_SWITCHER -->";
|
|
254
306
|
var MULTI_TENANT_PLUGIN_ID = "multi-tenant";
|
|
@@ -557,6 +609,7 @@ var PluginService = class {
|
|
|
557
609
|
await this.db.prepare(`UPDATE plugins SET status = 'active' WHERE id = ?`).bind(pluginId).run().catch(() => {
|
|
558
610
|
});
|
|
559
611
|
invalidateTenantCache();
|
|
612
|
+
invalidatePluginStatusCache(pluginId);
|
|
560
613
|
await this.logActivity(pluginId, "activated", null);
|
|
561
614
|
}
|
|
562
615
|
async deactivatePlugin(pluginId) {
|
|
@@ -573,6 +626,7 @@ var PluginService = class {
|
|
|
573
626
|
await this.db.prepare(`UPDATE plugins SET status = 'inactive' WHERE id = ?`).bind(pluginId).run().catch(() => {
|
|
574
627
|
});
|
|
575
628
|
invalidateTenantCache();
|
|
629
|
+
invalidatePluginStatusCache(pluginId);
|
|
576
630
|
await this.logActivity(pluginId, "deactivated", null);
|
|
577
631
|
}
|
|
578
632
|
async updatePluginSettings(pluginId, settings) {
|
|
@@ -1574,9 +1628,9 @@ var PluginBootstrapService = class {
|
|
|
1574
1628
|
);
|
|
1575
1629
|
await this.updatePlugin(plugin);
|
|
1576
1630
|
}
|
|
1577
|
-
if (
|
|
1631
|
+
if (existingPlugin.status !== "active") {
|
|
1578
1632
|
console.log(
|
|
1579
|
-
`[PluginBootstrap]
|
|
1633
|
+
`[PluginBootstrap] Activating bootstrapped plugin: ${plugin.display_name}`
|
|
1580
1634
|
);
|
|
1581
1635
|
await this.pluginService.activatePlugin(plugin.id);
|
|
1582
1636
|
}
|
|
@@ -1616,20 +1670,22 @@ var PluginBootstrapService = class {
|
|
|
1616
1670
|
*/
|
|
1617
1671
|
async isBootstrapNeeded() {
|
|
1618
1672
|
try {
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
)
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1673
|
+
const corePlugins = this.CORE_PLUGINS.filter((p) => p.name.startsWith("core-"));
|
|
1674
|
+
if (!corePlugins.length) return false;
|
|
1675
|
+
const slugs = corePlugins.map((p) => `'${p.id.replace(/'/g, "''")}'`).join(",");
|
|
1676
|
+
const res = await this.db.prepare(
|
|
1677
|
+
`SELECT
|
|
1678
|
+
COUNT(DISTINCT slug) AS installed,
|
|
1679
|
+
COUNT(DISTINCT CASE WHEN json_extract(data, '$.status') = 'active' THEN slug END) AS active
|
|
1680
|
+
FROM documents
|
|
1681
|
+
WHERE slug IN (${slugs}) AND type_id = 'plugin'
|
|
1682
|
+
AND tenant_id = 'default' AND is_current_draft = 1 AND deleted_at IS NULL`
|
|
1683
|
+
).first();
|
|
1684
|
+
const installed = res?.installed ?? 0;
|
|
1685
|
+
const active = res?.active ?? 0;
|
|
1686
|
+
return installed < corePlugins.length || active < installed;
|
|
1628
1687
|
} catch (error) {
|
|
1629
|
-
console.error(
|
|
1630
|
-
"[PluginBootstrap] Error checking bootstrap status:",
|
|
1631
|
-
error
|
|
1632
|
-
);
|
|
1688
|
+
console.error("[PluginBootstrap] Error checking bootstrap status:", error);
|
|
1633
1689
|
return true;
|
|
1634
1690
|
}
|
|
1635
1691
|
}
|
|
@@ -1896,6 +1952,7 @@ exports.TelemetryService = TelemetryService;
|
|
|
1896
1952
|
exports.collectionRecordToRow = collectionRecordToRow;
|
|
1897
1953
|
exports.createInstallationIdentity = createInstallationIdentity;
|
|
1898
1954
|
exports.findPluginByCodeName = findPluginByCodeName;
|
|
1955
|
+
exports.getActivePlugins = getActivePlugins;
|
|
1899
1956
|
exports.getAvailableCollectionNames = getAvailableCollectionNames;
|
|
1900
1957
|
exports.getCollectionRegistry = getCollectionRegistry;
|
|
1901
1958
|
exports.getTelemetryService = getTelemetryService;
|
|
@@ -1904,11 +1961,14 @@ exports.initTelemetry = initTelemetry;
|
|
|
1904
1961
|
exports.invalidateTenantCache = invalidateTenantCache;
|
|
1905
1962
|
exports.isCodeCollectionInternal = isCodeCollectionInternal;
|
|
1906
1963
|
exports.isDbDocTypeInternal = isDbDocTypeInternal;
|
|
1964
|
+
exports.isPluginActive = isPluginActive;
|
|
1907
1965
|
exports.loadCollectionConfig = loadCollectionConfig;
|
|
1908
1966
|
exports.loadCollectionConfigs = loadCollectionConfigs;
|
|
1909
1967
|
exports.registerCollections = registerCollections;
|
|
1968
|
+
exports.requireActivePlugin = requireActivePlugin;
|
|
1969
|
+
exports.requireActivePlugins = requireActivePlugins;
|
|
1910
1970
|
exports.resetCollectionRegistry = resetCollectionRegistry;
|
|
1911
1971
|
exports.tenantMiddleware = tenantMiddleware;
|
|
1912
1972
|
exports.validateCollectionConfig = validateCollectionConfig;
|
|
1913
|
-
//# sourceMappingURL=chunk-
|
|
1914
|
-
//# sourceMappingURL=chunk-
|
|
1973
|
+
//# sourceMappingURL=chunk-4DHPR7KR.cjs.map
|
|
1974
|
+
//# sourceMappingURL=chunk-4DHPR7KR.cjs.map
|