@sonicjs-cms/core 3.0.0-beta.14 → 3.0.0-beta.15
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-Bo0X1OWX.d.ts → app-01M0dIwt.d.ts} +1 -1
- package/dist/{app-Do66yCcV.d.cts → app-aj39TGHB.d.cts} +1 -1
- package/dist/{chunk-H5FB6GKR.cjs → chunk-4AB3PQHF.cjs} +2 -2
- package/dist/{chunk-H5FB6GKR.cjs.map → chunk-4AB3PQHF.cjs.map} +1 -1
- package/dist/{chunk-INE5E3SL.js → chunk-4ENXIP4M.js} +27 -2
- package/dist/chunk-4ENXIP4M.js.map +1 -0
- package/dist/{chunk-5L6EMI7A.js → chunk-75WXXLAU.js} +4 -4
- package/dist/{chunk-5L6EMI7A.js.map → chunk-75WXXLAU.js.map} +1 -1
- package/dist/{chunk-SSOP7G4R.cjs → chunk-BDQOPRA3.cjs} +220 -219
- package/dist/chunk-BDQOPRA3.cjs.map +1 -0
- package/dist/{chunk-U7T5EOHJ.js → chunk-CE6POA7A.js} +4 -4
- package/dist/{chunk-U7T5EOHJ.js.map → chunk-CE6POA7A.js.map} +1 -1
- package/dist/{chunk-G5LC7MYH.cjs → chunk-FVI3H6RG.cjs} +10 -10
- package/dist/{chunk-G5LC7MYH.cjs.map → chunk-FVI3H6RG.cjs.map} +1 -1
- package/dist/{chunk-WIV3R2MJ.cjs → chunk-FXZSZ7C7.cjs} +27 -2
- package/dist/chunk-FXZSZ7C7.cjs.map +1 -0
- package/dist/{chunk-O32IZ6JS.js → chunk-GQXVDFIG.js} +43 -5
- package/dist/chunk-GQXVDFIG.js.map +1 -0
- package/dist/{chunk-75JKPNUZ.js → chunk-IQZA2OY5.js} +3 -3
- package/dist/{chunk-75JKPNUZ.js.map → chunk-IQZA2OY5.js.map} +1 -1
- package/dist/{chunk-QNPT6BQP.js → chunk-JRLADH5B.js} +3 -3
- package/dist/{chunk-QNPT6BQP.js.map → chunk-JRLADH5B.js.map} +1 -1
- package/dist/{chunk-ZTEJHSYS.cjs → chunk-KMCLNO4K.cjs} +5 -5
- package/dist/{chunk-ZTEJHSYS.cjs.map → chunk-KMCLNO4K.cjs.map} +1 -1
- package/dist/{chunk-HNUGMALL.js → chunk-L3VIH6U4.js} +15 -15
- package/dist/chunk-L3VIH6U4.js.map +1 -0
- package/dist/{chunk-SIPBHWMG.cjs → chunk-PK3ODTAL.cjs} +4 -4
- package/dist/{chunk-SIPBHWMG.cjs.map → chunk-PK3ODTAL.cjs.map} +1 -1
- package/dist/{chunk-4YRYGDCQ.cjs → chunk-PTTFLUEX.cjs} +4 -4
- package/dist/{chunk-4YRYGDCQ.cjs.map → chunk-PTTFLUEX.cjs.map} +1 -1
- package/dist/{chunk-32SDMKZ7.js → chunk-VOAP3KFU.js} +2 -2
- package/dist/{chunk-32SDMKZ7.js.map → chunk-VOAP3KFU.js.map} +1 -1
- package/dist/{chunk-IESEVHXL.js → chunk-VVYVFCML.js} +12 -3
- package/dist/chunk-VVYVFCML.js.map +1 -0
- package/dist/{chunk-HIKBY7MS.cjs → chunk-XWVDSM2L.cjs} +12 -3
- package/dist/chunk-XWVDSM2L.cjs.map +1 -0
- package/dist/{chunk-L3KHLEHL.cjs → chunk-ZBDDZYA3.cjs} +53 -15
- package/dist/chunk-ZBDDZYA3.cjs.map +1 -0
- package/dist/config-SM2UWSDN.js +6 -0
- package/dist/{config-PLJTDINX.js.map → config-SM2UWSDN.js.map} +1 -1
- package/dist/config-YCRSU7ZP.cjs +19 -0
- package/dist/{config-FLOUCYHH.cjs.map → config-YCRSU7ZP.cjs.map} +1 -1
- package/dist/{define-plugin-BzNHc1ZI.d.ts → define-plugin-BYIey6sp.d.ts} +1 -1
- package/dist/{define-plugin-IWDKYaVm.d.cts → define-plugin-DsKiGu1q.d.cts} +1 -1
- package/dist/index.cjs +754 -296
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +512 -56
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +33 -33
- package/dist/middleware.d.cts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +4 -4
- package/dist/migrations-6R2N6G2P.js +4 -0
- package/dist/{migrations-DOPZXFK3.js.map → migrations-6R2N6G2P.js.map} +1 -1
- package/dist/migrations-X3UX24QG.cjs +13 -0
- package/dist/{migrations-TYYC66P4.cjs.map → migrations-X3UX24QG.cjs.map} +1 -1
- package/dist/plugins.cjs +40 -40
- package/dist/plugins.d.cts +2 -2
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.js +3 -3
- package/dist/routes.cjs +27 -27
- package/dist/routes.d.cts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +7 -7
- package/dist/services.cjs +18 -18
- package/dist/services.js +2 -2
- package/dist/{types-Dea1eNxU.d.cts → types-DT7XN5TX.d.cts} +1 -1
- package/dist/{types-Dea1eNxU.d.ts → types-DT7XN5TX.d.ts} +1 -1
- package/dist/utils.cjs +3 -3
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-HIKBY7MS.cjs.map +0 -1
- package/dist/chunk-HNUGMALL.js.map +0 -1
- package/dist/chunk-IESEVHXL.js.map +0 -1
- package/dist/chunk-INE5E3SL.js.map +0 -1
- package/dist/chunk-L3KHLEHL.cjs.map +0 -1
- package/dist/chunk-O32IZ6JS.js.map +0 -1
- package/dist/chunk-SSOP7G4R.cjs.map +0 -1
- package/dist/chunk-WIV3R2MJ.cjs.map +0 -1
- package/dist/config-FLOUCYHH.cjs +0 -19
- package/dist/config-PLJTDINX.js +0 -6
- package/dist/migrations-DOPZXFK3.js +0 -4
- package/dist/migrations-TYYC66P4.cjs +0 -13
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkKMCLNO4K_cjs = require('./chunk-KMCLNO4K.cjs');
|
|
4
|
+
var chunkBDQOPRA3_cjs = require('./chunk-BDQOPRA3.cjs');
|
|
5
|
+
require('./chunk-XWVDSM2L.cjs');
|
|
6
6
|
require('./chunk-N32OWET6.cjs');
|
|
7
7
|
var chunk4BTBSXMR_cjs = require('./chunk-4BTBSXMR.cjs');
|
|
8
8
|
var chunkYA3TJ65D_cjs = require('./chunk-YA3TJ65D.cjs');
|
|
9
9
|
var chunkYP7GW2G5_cjs = require('./chunk-YP7GW2G5.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkZBDDZYA3_cjs = require('./chunk-ZBDDZYA3.cjs');
|
|
11
11
|
var chunkW36OZTJ5_cjs = require('./chunk-W36OZTJ5.cjs');
|
|
12
12
|
var chunkJEQ7FLOD_cjs = require('./chunk-JEQ7FLOD.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var chunkFXZSZ7C7_cjs = require('./chunk-FXZSZ7C7.cjs');
|
|
14
|
+
var chunk4AB3PQHF_cjs = require('./chunk-4AB3PQHF.cjs');
|
|
15
15
|
var chunkCRGUD4KC_cjs = require('./chunk-CRGUD4KC.cjs');
|
|
16
16
|
var chunkPXNTCCPE_cjs = require('./chunk-PXNTCCPE.cjs');
|
|
17
17
|
var chunkK623Q6WD_cjs = require('./chunk-K623Q6WD.cjs');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var chunkFVI3H6RG_cjs = require('./chunk-FVI3H6RG.cjs');
|
|
19
|
+
var chunkPTTFLUEX_cjs = require('./chunk-PTTFLUEX.cjs');
|
|
20
20
|
var chunkJ6JTWD2A_cjs = require('./chunk-J6JTWD2A.cjs');
|
|
21
21
|
var chunkIXUHXTHW_cjs = require('./chunk-IXUHXTHW.cjs');
|
|
22
22
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
23
23
|
require('./chunk-P3XDZL6Q.cjs');
|
|
24
|
-
var
|
|
24
|
+
var chunkPK3ODTAL_cjs = require('./chunk-PK3ODTAL.cjs');
|
|
25
25
|
var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
|
|
26
26
|
var chunkQTFKZBLC_cjs = require('./chunk-QTFKZBLC.cjs');
|
|
27
27
|
require('./chunk-IGJUBJBW.cjs');
|
|
@@ -574,7 +574,7 @@ function formatCellValue(value) {
|
|
|
574
574
|
// src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
|
|
575
575
|
function createDatabaseToolsAdminRoutes() {
|
|
576
576
|
const router3 = new hono.Hono();
|
|
577
|
-
router3.use("*",
|
|
577
|
+
router3.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
578
578
|
router3.get("/api/stats", async (c) => {
|
|
579
579
|
try {
|
|
580
580
|
const user = c.get("user");
|
|
@@ -977,7 +977,7 @@ var SiteConfigService = class {
|
|
|
977
977
|
|
|
978
978
|
// src/plugins/core-plugins/email-plugin/routes/admin.ts
|
|
979
979
|
var adminRoutes = new hono.Hono();
|
|
980
|
-
adminRoutes.use("*",
|
|
980
|
+
adminRoutes.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
981
981
|
adminRoutes.post("/settings", async (c) => {
|
|
982
982
|
if (c.get("user")?.role !== "admin") {
|
|
983
983
|
return c.json({ error: "admin role required" }, 403);
|
|
@@ -1015,7 +1015,7 @@ adminRoutes.post("/test", async (c) => {
|
|
|
1015
1015
|
const { subject, html: html4, text } = renderTestEmail({ siteName });
|
|
1016
1016
|
try {
|
|
1017
1017
|
const settingsLoaded = await settings.load();
|
|
1018
|
-
const result = await
|
|
1018
|
+
const result = await chunkBDQOPRA3_cjs.getEmailService().send({
|
|
1019
1019
|
to,
|
|
1020
1020
|
subject,
|
|
1021
1021
|
html: html4,
|
|
@@ -1097,7 +1097,7 @@ function makeOnRegistrationCompleted(env) {
|
|
|
1097
1097
|
siteName,
|
|
1098
1098
|
loginUrl: siteConfig.buildLoginUrl(siteUrl)
|
|
1099
1099
|
});
|
|
1100
|
-
const result = await
|
|
1100
|
+
const result = await chunkBDQOPRA3_cjs.getEmailService().send({
|
|
1101
1101
|
to: user.email,
|
|
1102
1102
|
subject,
|
|
1103
1103
|
html: html4,
|
|
@@ -1171,7 +1171,7 @@ function makeOnPasswordResetRequested(env) {
|
|
|
1171
1171
|
expiresAt: Date.now() + DEFAULT_EXPIRY_MS,
|
|
1172
1172
|
siteName
|
|
1173
1173
|
});
|
|
1174
|
-
const result = await
|
|
1174
|
+
const result = await chunkBDQOPRA3_cjs.getEmailService().send({
|
|
1175
1175
|
to: user.email,
|
|
1176
1176
|
subject,
|
|
1177
1177
|
html: html4,
|
|
@@ -1239,7 +1239,7 @@ function makeOnPasswordResetCompleted(env) {
|
|
|
1239
1239
|
supportEmail,
|
|
1240
1240
|
when: Date.now()
|
|
1241
1241
|
});
|
|
1242
|
-
const result = await
|
|
1242
|
+
const result = await chunkBDQOPRA3_cjs.getEmailService().send({
|
|
1243
1243
|
to: user.email,
|
|
1244
1244
|
subject,
|
|
1245
1245
|
html: html4,
|
|
@@ -1971,7 +1971,7 @@ var CloudflareEmailProvider = class {
|
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
1973
|
};
|
|
1974
|
-
var emailPluginV3 =
|
|
1974
|
+
var emailPluginV3 = chunkPTTFLUEX_cjs.definePlugin({
|
|
1975
1975
|
id: "email",
|
|
1976
1976
|
version: "1.0.0",
|
|
1977
1977
|
name: "Email",
|
|
@@ -1985,7 +1985,7 @@ var emailPluginV3 = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
1985
1985
|
const db = env.DB;
|
|
1986
1986
|
if (db) {
|
|
1987
1987
|
try {
|
|
1988
|
-
const typeRegistry = new
|
|
1988
|
+
const typeRegistry = new chunkZBDDZYA3_cjs.DocumentTypeRegistry(db);
|
|
1989
1989
|
await typeRegistry.register({
|
|
1990
1990
|
id: "email_log",
|
|
1991
1991
|
name: "email_log",
|
|
@@ -2000,7 +2000,7 @@ var emailPluginV3 = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
2000
2000
|
} catch {
|
|
2001
2001
|
}
|
|
2002
2002
|
}
|
|
2003
|
-
if (!
|
|
2003
|
+
if (!chunkBDQOPRA3_cjs.hasEmailService()) {
|
|
2004
2004
|
const settings = db ? await new EmailSettingsService(db).load() : {};
|
|
2005
2005
|
const envResendKey = typeof env.RESEND_API_KEY === "string" && env.RESEND_API_KEY ? env.RESEND_API_KEY : void 0;
|
|
2006
2006
|
const cfEmailBinding = env.EMAIL;
|
|
@@ -2018,7 +2018,7 @@ var emailPluginV3 = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
2018
2018
|
} else {
|
|
2019
2019
|
provider = resolveEmailProvider({ env });
|
|
2020
2020
|
}
|
|
2021
|
-
|
|
2021
|
+
chunkBDQOPRA3_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
|
|
2022
2022
|
}
|
|
2023
2023
|
ctx.hooks.on("auth:registration:completed", makeOnRegistrationCompleted(env));
|
|
2024
2024
|
ctx.hooks.on("auth:password-reset:requested", makeOnPasswordResetRequested(env));
|
|
@@ -2029,7 +2029,7 @@ var emailPluginV3 = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
2029
2029
|
var BATCH_SIZE = 100;
|
|
2030
2030
|
({
|
|
2031
2031
|
schema: zod.z.record(zod.z.string(), zod.z.unknown())});
|
|
2032
|
-
var emailReconciliationPlugin =
|
|
2032
|
+
var emailReconciliationPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
2033
2033
|
id: "email-reconciliation",
|
|
2034
2034
|
version: "1.0.0",
|
|
2035
2035
|
description: "Hourly cron that backfills email delivery state from provider status APIs. Only active for providers that implement EmailProvider.reconcile().",
|
|
@@ -2050,11 +2050,11 @@ var emailReconciliationPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
2050
2050
|
console.warn("[email-reconciliation] No DB binding in cron env \u2014 skipping.");
|
|
2051
2051
|
return;
|
|
2052
2052
|
}
|
|
2053
|
-
if (!
|
|
2053
|
+
if (!chunkBDQOPRA3_cjs.hasEmailService()) {
|
|
2054
2054
|
console.warn("[email-reconciliation] EmailService not initialized \u2014 skipping.");
|
|
2055
2055
|
return;
|
|
2056
2056
|
}
|
|
2057
|
-
const emailService =
|
|
2057
|
+
const emailService = chunkBDQOPRA3_cjs.getEmailService();
|
|
2058
2058
|
let rows = [];
|
|
2059
2059
|
try {
|
|
2060
2060
|
const result = await db.prepare(
|
|
@@ -2540,8 +2540,8 @@ function buildOtpApi() {
|
|
|
2540
2540
|
loginUrl: settings.loginUrl || "",
|
|
2541
2541
|
loginButtonText: settings.loginButtonText || ""
|
|
2542
2542
|
});
|
|
2543
|
-
if (
|
|
2544
|
-
const sent = await
|
|
2543
|
+
if (chunkBDQOPRA3_cjs.hasEmailService()) {
|
|
2544
|
+
const sent = await chunkBDQOPRA3_cjs.getEmailService().send({
|
|
2545
2545
|
to: normalizedEmail,
|
|
2546
2546
|
subject: `Your login code for ${siteName}`,
|
|
2547
2547
|
flow: "otp",
|
|
@@ -2643,21 +2643,21 @@ function buildOtpApi() {
|
|
|
2643
2643
|
error: "Account is deactivated"
|
|
2644
2644
|
}, 403);
|
|
2645
2645
|
}
|
|
2646
|
-
const tokenTtl = await
|
|
2647
|
-
const token = await
|
|
2646
|
+
const tokenTtl = await chunkZBDDZYA3_cjs.getJwtExpirySecondsFromDb(db, c.env);
|
|
2647
|
+
const token = await chunkZBDDZYA3_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
|
|
2648
2648
|
cookie.setCookie(c, "auth_token", token, {
|
|
2649
2649
|
httpOnly: true,
|
|
2650
2650
|
secure: true,
|
|
2651
2651
|
sameSite: "Strict",
|
|
2652
2652
|
maxAge: tokenTtl
|
|
2653
2653
|
});
|
|
2654
|
-
|
|
2654
|
+
chunkBDQOPRA3_cjs.dispatchHookEvent(
|
|
2655
2655
|
c,
|
|
2656
2656
|
"auth:otp:verified",
|
|
2657
2657
|
{ user: { id: user.id, email: user.email, role: user.role } },
|
|
2658
2658
|
"fire-and-forget"
|
|
2659
2659
|
);
|
|
2660
|
-
const customData = await
|
|
2660
|
+
const customData = await chunkBDQOPRA3_cjs.getCustomData(db, user.id);
|
|
2661
2661
|
const { is_active: _isActive, ...publicUser } = user;
|
|
2662
2662
|
return c.json({
|
|
2663
2663
|
success: true,
|
|
@@ -2702,7 +2702,7 @@ function buildOtpApi() {
|
|
|
2702
2702
|
});
|
|
2703
2703
|
return otpAPI;
|
|
2704
2704
|
}
|
|
2705
|
-
var otpLoginPlugin =
|
|
2705
|
+
var otpLoginPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
2706
2706
|
id: "otp-login",
|
|
2707
2707
|
version: "1.0.0",
|
|
2708
2708
|
name: "OTP Login",
|
|
@@ -3099,15 +3099,15 @@ function buildOauthApi() {
|
|
|
3099
3099
|
if (!user || !user.is_active) {
|
|
3100
3100
|
return c.redirect("/auth/login?error=Account is deactivated");
|
|
3101
3101
|
}
|
|
3102
|
-
const tokenTtl2 = await
|
|
3103
|
-
const jwt2 = await
|
|
3102
|
+
const tokenTtl2 = await chunkZBDDZYA3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
3103
|
+
const jwt2 = await chunkZBDDZYA3_cjs.AuthManager.generateToken(
|
|
3104
3104
|
user.id,
|
|
3105
3105
|
user.email,
|
|
3106
3106
|
user.role,
|
|
3107
3107
|
c.env.JWT_SECRET,
|
|
3108
3108
|
tokenTtl2
|
|
3109
3109
|
);
|
|
3110
|
-
|
|
3110
|
+
chunkZBDDZYA3_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
|
|
3111
3111
|
return c.redirect("/admin");
|
|
3112
3112
|
}
|
|
3113
3113
|
const existingUser = await oauthService.findUserByEmail(profile.email);
|
|
@@ -3124,15 +3124,15 @@ function buildOauthApi() {
|
|
|
3124
3124
|
tokenExpiresAt: tokenExpiresAt ?? void 0,
|
|
3125
3125
|
profileData: JSON.stringify(profile)
|
|
3126
3126
|
});
|
|
3127
|
-
const tokenTtl2 = await
|
|
3128
|
-
const jwt2 = await
|
|
3127
|
+
const tokenTtl2 = await chunkZBDDZYA3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
3128
|
+
const jwt2 = await chunkZBDDZYA3_cjs.AuthManager.generateToken(
|
|
3129
3129
|
existingUser.id,
|
|
3130
3130
|
existingUser.email,
|
|
3131
3131
|
existingUser.role,
|
|
3132
3132
|
c.env.JWT_SECRET,
|
|
3133
3133
|
tokenTtl2
|
|
3134
3134
|
);
|
|
3135
|
-
|
|
3135
|
+
chunkZBDDZYA3_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
|
|
3136
3136
|
return c.redirect("/admin");
|
|
3137
3137
|
}
|
|
3138
3138
|
const newUserId = await oauthService.createUserFromOAuth(profile);
|
|
@@ -3145,15 +3145,15 @@ function buildOauthApi() {
|
|
|
3145
3145
|
tokenExpiresAt: tokenExpiresAt ?? void 0,
|
|
3146
3146
|
profileData: JSON.stringify(profile)
|
|
3147
3147
|
});
|
|
3148
|
-
const tokenTtl = await
|
|
3149
|
-
const jwt = await
|
|
3148
|
+
const tokenTtl = await chunkZBDDZYA3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
3149
|
+
const jwt = await chunkZBDDZYA3_cjs.AuthManager.generateToken(
|
|
3150
3150
|
newUserId,
|
|
3151
3151
|
profile.email.toLowerCase(),
|
|
3152
3152
|
"viewer",
|
|
3153
3153
|
c.env.JWT_SECRET,
|
|
3154
3154
|
tokenTtl
|
|
3155
3155
|
);
|
|
3156
|
-
|
|
3156
|
+
chunkZBDDZYA3_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
|
|
3157
3157
|
return c.redirect("/admin");
|
|
3158
3158
|
} catch (error) {
|
|
3159
3159
|
console.error("OAuth callback error:", error);
|
|
@@ -3248,7 +3248,7 @@ function buildOauthApi() {
|
|
|
3248
3248
|
});
|
|
3249
3249
|
return oauthAPI;
|
|
3250
3250
|
}
|
|
3251
|
-
var oauthProvidersPlugin =
|
|
3251
|
+
var oauthProvidersPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
3252
3252
|
id: "oauth-providers",
|
|
3253
3253
|
version: "1.0.0",
|
|
3254
3254
|
name: "OAuth Providers",
|
|
@@ -3825,7 +3825,7 @@ var AISearchService = class {
|
|
|
3825
3825
|
*/
|
|
3826
3826
|
async detectNewCollections() {
|
|
3827
3827
|
try {
|
|
3828
|
-
const allCollections =
|
|
3828
|
+
const allCollections = chunkFXZSZ7C7_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
|
|
3829
3829
|
id: r.id,
|
|
3830
3830
|
name: r.name,
|
|
3831
3831
|
display_name: r.displayName,
|
|
@@ -3877,7 +3877,7 @@ var AISearchService = class {
|
|
|
3877
3877
|
*/
|
|
3878
3878
|
async getAllCollections() {
|
|
3879
3879
|
try {
|
|
3880
|
-
const allCollections =
|
|
3880
|
+
const allCollections = chunkFXZSZ7C7_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
|
|
3881
3881
|
id: r.id,
|
|
3882
3882
|
name: r.name,
|
|
3883
3883
|
display_name: r.displayName,
|
|
@@ -4213,7 +4213,7 @@ var IndexManager = class {
|
|
|
4213
4213
|
*/
|
|
4214
4214
|
async indexCollection(collectionId) {
|
|
4215
4215
|
try {
|
|
4216
|
-
const registry =
|
|
4216
|
+
const registry = chunkFXZSZ7C7_cjs.getCollectionRegistry();
|
|
4217
4217
|
const record = registry.getById(collectionId) ?? registry.getByName(collectionId);
|
|
4218
4218
|
if (!record) {
|
|
4219
4219
|
throw new Error(`Collection ${collectionId} not found`);
|
|
@@ -4840,7 +4840,7 @@ function renderSettingsPage(data) {
|
|
|
4840
4840
|
|
|
4841
4841
|
// src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
|
|
4842
4842
|
var adminRoutes2 = new hono.Hono();
|
|
4843
|
-
adminRoutes2.use("*",
|
|
4843
|
+
adminRoutes2.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
4844
4844
|
adminRoutes2.get("/", async (c) => {
|
|
4845
4845
|
try {
|
|
4846
4846
|
const user = c.get("user");
|
|
@@ -5081,7 +5081,7 @@ var manifest_default = {
|
|
|
5081
5081
|
author: "SonicJS"};
|
|
5082
5082
|
|
|
5083
5083
|
// src/plugins/core-plugins/ai-search-plugin/index.ts
|
|
5084
|
-
var aiSearchPlugin =
|
|
5084
|
+
var aiSearchPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
5085
5085
|
id: manifest_default.id,
|
|
5086
5086
|
version: manifest_default.version,
|
|
5087
5087
|
name: manifest_default.name,
|
|
@@ -5952,7 +5952,7 @@ function renderSecuritySettingsPage(data) {
|
|
|
5952
5952
|
|
|
5953
5953
|
// src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
|
|
5954
5954
|
var adminRoutes3 = new hono.Hono();
|
|
5955
|
-
adminRoutes3.use("*",
|
|
5955
|
+
adminRoutes3.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
5956
5956
|
adminRoutes3.use("*", async (c, next) => {
|
|
5957
5957
|
const user = c.get("user");
|
|
5958
5958
|
if (user?.role !== "admin") {
|
|
@@ -5962,7 +5962,7 @@ adminRoutes3.use("*", async (c, next) => {
|
|
|
5962
5962
|
});
|
|
5963
5963
|
async function getSettings(db) {
|
|
5964
5964
|
try {
|
|
5965
|
-
const pluginService = new
|
|
5965
|
+
const pluginService = new chunkFXZSZ7C7_cjs.PluginService(db);
|
|
5966
5966
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
5967
5967
|
if (plugin2?.settings) {
|
|
5968
5968
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6067,7 +6067,7 @@ adminRoutes3.post("/settings", async (c) => {
|
|
|
6067
6067
|
autoPurge: body["retention.autoPurge"] === "true"
|
|
6068
6068
|
}
|
|
6069
6069
|
};
|
|
6070
|
-
const pluginService = new
|
|
6070
|
+
const pluginService = new chunkFXZSZ7C7_cjs.PluginService(db);
|
|
6071
6071
|
await pluginService.updatePluginSettings("security-audit", settings);
|
|
6072
6072
|
if (c.req.header("HX-Request")) {
|
|
6073
6073
|
return c.json({ success: true });
|
|
@@ -6228,7 +6228,7 @@ var BruteForceDetector = class {
|
|
|
6228
6228
|
|
|
6229
6229
|
// src/plugins/core-plugins/security-audit-plugin/routes/api.ts
|
|
6230
6230
|
var apiRoutes2 = new hono.Hono();
|
|
6231
|
-
apiRoutes2.use("*",
|
|
6231
|
+
apiRoutes2.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
6232
6232
|
apiRoutes2.use("*", async (c, next) => {
|
|
6233
6233
|
const user = c.get("user");
|
|
6234
6234
|
if (user?.role !== "admin") {
|
|
@@ -6238,7 +6238,7 @@ apiRoutes2.use("*", async (c, next) => {
|
|
|
6238
6238
|
});
|
|
6239
6239
|
async function getSettings2(db) {
|
|
6240
6240
|
try {
|
|
6241
|
-
const pluginService = new
|
|
6241
|
+
const pluginService = new chunkFXZSZ7C7_cjs.PluginService(db);
|
|
6242
6242
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
6243
6243
|
if (plugin2?.settings) {
|
|
6244
6244
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6386,7 +6386,7 @@ function generateFingerprint(ip, userAgent) {
|
|
|
6386
6386
|
}
|
|
6387
6387
|
async function getPluginSettings(db) {
|
|
6388
6388
|
try {
|
|
6389
|
-
const pluginService = new
|
|
6389
|
+
const pluginService = new chunkFXZSZ7C7_cjs.PluginService(db);
|
|
6390
6390
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
6391
6391
|
if (plugin2?.settings) {
|
|
6392
6392
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6617,7 +6617,7 @@ async function logAuthEvent(c, db, settings, ip, userAgent, countryCode, fingerp
|
|
|
6617
6617
|
|
|
6618
6618
|
// src/plugins/core-plugins/security-audit-plugin/index.ts
|
|
6619
6619
|
var SECURITY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/></svg>`;
|
|
6620
|
-
var securityAuditPlugin =
|
|
6620
|
+
var securityAuditPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
6621
6621
|
id: "security-audit",
|
|
6622
6622
|
version: "1.0.0",
|
|
6623
6623
|
name: "Security Audit",
|
|
@@ -6635,6 +6635,457 @@ var securityAuditPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
6635
6635
|
deactivate: async () => console.log("[SecurityAudit] Plugin deactivated")
|
|
6636
6636
|
});
|
|
6637
6637
|
|
|
6638
|
+
// src/plugins/core-plugins/api-keys-plugin/services/api-key-service.ts
|
|
6639
|
+
var API_KEY_QUERYABLE = [
|
|
6640
|
+
{ name: "keyHash", kind: "scalar", type: "text", column: "q_apikey_hash" },
|
|
6641
|
+
{ name: "userId", kind: "scalar", type: "text", column: "q_apikey_user_id" },
|
|
6642
|
+
{ name: "revoked", kind: "scalar", type: "integer", column: "q_apikey_revoked" }
|
|
6643
|
+
];
|
|
6644
|
+
var KEY_PREFIX = "sk_";
|
|
6645
|
+
var KEY_BYTES = 24;
|
|
6646
|
+
var DISPLAY_PREFIX_LEN = KEY_PREFIX.length + 8;
|
|
6647
|
+
function generateApiKeySecret() {
|
|
6648
|
+
const bytes = new Uint8Array(KEY_BYTES);
|
|
6649
|
+
crypto.getRandomValues(bytes);
|
|
6650
|
+
let hex = "";
|
|
6651
|
+
for (const b of bytes) hex += b.toString(16).padStart(2, "0");
|
|
6652
|
+
return KEY_PREFIX + hex;
|
|
6653
|
+
}
|
|
6654
|
+
async function hashApiKey(secret) {
|
|
6655
|
+
const data = new TextEncoder().encode(secret);
|
|
6656
|
+
const digest = await crypto.subtle.digest("SHA-256", data);
|
|
6657
|
+
const view = new Uint8Array(digest);
|
|
6658
|
+
let hex = "";
|
|
6659
|
+
for (const b of view) hex += b.toString(16).padStart(2, "0");
|
|
6660
|
+
return hex;
|
|
6661
|
+
}
|
|
6662
|
+
var ApiKeyService = class {
|
|
6663
|
+
constructor(db, tenantId = "default") {
|
|
6664
|
+
this.db = db;
|
|
6665
|
+
this.tenantId = tenantId;
|
|
6666
|
+
}
|
|
6667
|
+
docService() {
|
|
6668
|
+
return new chunkW36OZTJ5_cjs.DocumentsService(this.db, {
|
|
6669
|
+
queryableFields: API_KEY_QUERYABLE,
|
|
6670
|
+
tenantId: this.tenantId,
|
|
6671
|
+
maxVersionsPerRoot: 1
|
|
6672
|
+
});
|
|
6673
|
+
}
|
|
6674
|
+
/** Count a user's active (non-revoked) keys — used to enforce the per-user cap. */
|
|
6675
|
+
async countForUser(userId) {
|
|
6676
|
+
const row = await this.db.prepare(
|
|
6677
|
+
`SELECT COUNT(*) AS c FROM documents
|
|
6678
|
+
WHERE type_id = 'api_key' AND tenant_id = ? AND is_current_draft = 1
|
|
6679
|
+
AND deleted_at IS NULL AND q_apikey_user_id = ? AND q_apikey_revoked = 0`
|
|
6680
|
+
).bind(this.tenantId, userId).first();
|
|
6681
|
+
return row?.c ?? 0;
|
|
6682
|
+
}
|
|
6683
|
+
/**
|
|
6684
|
+
* Mint a new key for a user. The returned `key` is the only time the plaintext
|
|
6685
|
+
* exists outside the caller — it is hashed before storage.
|
|
6686
|
+
*/
|
|
6687
|
+
async create(input) {
|
|
6688
|
+
const name = input.name.trim() || "API Key";
|
|
6689
|
+
const secret = generateApiKeySecret();
|
|
6690
|
+
const keyHash = await hashApiKey(secret);
|
|
6691
|
+
const prefix = secret.slice(0, DISPLAY_PREFIX_LEN);
|
|
6692
|
+
const expiresAt = input.expiresAt ?? null;
|
|
6693
|
+
const doc = await this.docService().create(
|
|
6694
|
+
chunkBDQOPRA3_cjs.createDocumentSchema.parse({
|
|
6695
|
+
typeId: "api_key",
|
|
6696
|
+
tenantId: this.tenantId,
|
|
6697
|
+
title: name,
|
|
6698
|
+
ownerId: input.userId,
|
|
6699
|
+
publishOnCreate: true,
|
|
6700
|
+
data: {
|
|
6701
|
+
name,
|
|
6702
|
+
userId: input.userId,
|
|
6703
|
+
keyHash,
|
|
6704
|
+
keyPrefix: prefix,
|
|
6705
|
+
revoked: 0,
|
|
6706
|
+
lastUsedAt: null,
|
|
6707
|
+
expiresAt
|
|
6708
|
+
}
|
|
6709
|
+
}),
|
|
6710
|
+
input.userId
|
|
6711
|
+
);
|
|
6712
|
+
return { id: doc.rootId, key: secret, name, prefix, expiresAt };
|
|
6713
|
+
}
|
|
6714
|
+
/** List a user's non-revoked keys (metadata only — never the secret or hash). */
|
|
6715
|
+
async list(userId) {
|
|
6716
|
+
const res = await this.db.prepare(
|
|
6717
|
+
`SELECT root_id, data, created_at FROM documents
|
|
6718
|
+
WHERE type_id = 'api_key' AND tenant_id = ? AND is_current_draft = 1
|
|
6719
|
+
AND deleted_at IS NULL AND q_apikey_user_id = ? AND q_apikey_revoked = 0
|
|
6720
|
+
ORDER BY created_at DESC`
|
|
6721
|
+
).bind(this.tenantId, userId).all();
|
|
6722
|
+
return (res.results ?? []).map((row) => {
|
|
6723
|
+
const d = JSON.parse(row.data);
|
|
6724
|
+
return {
|
|
6725
|
+
id: row.root_id,
|
|
6726
|
+
name: d.name ?? "API Key",
|
|
6727
|
+
prefix: d.keyPrefix ?? "",
|
|
6728
|
+
createdAt: row.created_at,
|
|
6729
|
+
lastUsedAt: d.lastUsedAt ?? null,
|
|
6730
|
+
expiresAt: d.expiresAt ?? null
|
|
6731
|
+
};
|
|
6732
|
+
});
|
|
6733
|
+
}
|
|
6734
|
+
/**
|
|
6735
|
+
* Revoke (hard-delete) a key owned by `userId`. Credentials are erased, not
|
|
6736
|
+
* soft-flagged. Returns false if the key does not exist or is not owned by
|
|
6737
|
+
* the caller (no information leak about other users' keys).
|
|
6738
|
+
*/
|
|
6739
|
+
async revoke(rootId, userId) {
|
|
6740
|
+
const row = await this.db.prepare(
|
|
6741
|
+
`SELECT q_apikey_user_id AS owner FROM documents
|
|
6742
|
+
WHERE root_id = ? AND tenant_id = ? AND type_id = 'api_key' AND is_current_draft = 1 AND deleted_at IS NULL`
|
|
6743
|
+
).bind(rootId, this.tenantId).first();
|
|
6744
|
+
if (!row || row.owner !== userId) return false;
|
|
6745
|
+
await this.docService().erase(rootId, this.tenantId);
|
|
6746
|
+
return true;
|
|
6747
|
+
}
|
|
6748
|
+
/**
|
|
6749
|
+
* Resolve a presented secret to its owning user, or null. Rejects unknown,
|
|
6750
|
+
* revoked, expired keys and inactive users. Best-effort updates lastUsedAt.
|
|
6751
|
+
*/
|
|
6752
|
+
async resolve(secret) {
|
|
6753
|
+
if (!secret || !secret.startsWith(KEY_PREFIX)) return null;
|
|
6754
|
+
const keyHash = await hashApiKey(secret);
|
|
6755
|
+
const keyRow2 = await this.db.prepare(
|
|
6756
|
+
`SELECT root_id, data FROM documents
|
|
6757
|
+
WHERE type_id = 'api_key' AND tenant_id = ? AND is_current_draft = 1 AND deleted_at IS NULL
|
|
6758
|
+
AND q_apikey_hash = ? AND q_apikey_revoked = 0
|
|
6759
|
+
LIMIT 1`
|
|
6760
|
+
).bind(this.tenantId, keyHash).first();
|
|
6761
|
+
if (!keyRow2) return null;
|
|
6762
|
+
const d = JSON.parse(keyRow2.data);
|
|
6763
|
+
if (d.expiresAt != null && Date.now() > Number(d.expiresAt)) return null;
|
|
6764
|
+
const user = await this.db.prepare(`SELECT id, email, role, is_active, is_super_admin FROM auth_user WHERE id = ?`).bind(d.userId).first();
|
|
6765
|
+
if (!user || user.is_active !== 1) return null;
|
|
6766
|
+
try {
|
|
6767
|
+
await this.touchLastUsed(keyRow2.root_id, d);
|
|
6768
|
+
} catch {
|
|
6769
|
+
}
|
|
6770
|
+
return {
|
|
6771
|
+
userId: user.id,
|
|
6772
|
+
email: user.email,
|
|
6773
|
+
role: user.role ?? "viewer",
|
|
6774
|
+
isSuperAdmin: user.is_super_admin === 1
|
|
6775
|
+
};
|
|
6776
|
+
}
|
|
6777
|
+
/** Update lastUsedAt in-place (single-version type, no history churn). */
|
|
6778
|
+
async touchLastUsed(rootId, data) {
|
|
6779
|
+
const next = JSON.stringify({ ...data, lastUsedAt: Date.now() });
|
|
6780
|
+
await this.db.prepare(
|
|
6781
|
+
`UPDATE documents SET data = ? WHERE root_id = ? AND tenant_id = ? AND type_id = 'api_key' AND is_current_draft = 1`
|
|
6782
|
+
).bind(next, rootId, this.tenantId).run();
|
|
6783
|
+
}
|
|
6784
|
+
};
|
|
6785
|
+
|
|
6786
|
+
// src/plugins/core-plugins/api-keys-plugin/components/keys-page.ts
|
|
6787
|
+
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
6788
|
+
function fmtDate(ms) {
|
|
6789
|
+
if (!ms) return "\u2014";
|
|
6790
|
+
try {
|
|
6791
|
+
return new Date(ms).toISOString().slice(0, 10);
|
|
6792
|
+
} catch {
|
|
6793
|
+
return "\u2014";
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
function keyRow(k) {
|
|
6797
|
+
const name = chunkMNWKYY5E_cjs.escapeHtml(k.name);
|
|
6798
|
+
const prefix = chunkMNWKYY5E_cjs.escapeHtml(k.prefix);
|
|
6799
|
+
const id = chunkMNWKYY5E_cjs.escapeHtml(k.id);
|
|
6800
|
+
return `
|
|
6801
|
+
<tr class="border-t border-zinc-950/5 dark:border-white/10" data-key-id="${id}">
|
|
6802
|
+
<td class="py-3 pr-4 text-sm font-medium text-zinc-950 dark:text-white">${name}</td>
|
|
6803
|
+
<td class="py-3 pr-4 text-sm font-mono text-zinc-500 dark:text-zinc-400">${prefix}\u2026</td>
|
|
6804
|
+
<td class="py-3 pr-4 text-sm text-zinc-500 dark:text-zinc-400">${fmtDate(k.createdAt ? k.createdAt * 1e3 : null)}</td>
|
|
6805
|
+
<td class="py-3 pr-4 text-sm text-zinc-500 dark:text-zinc-400">${k.lastUsedAt ? fmtDate(k.lastUsedAt) : "Never"}</td>
|
|
6806
|
+
<td class="py-3 pr-4 text-sm text-zinc-500 dark:text-zinc-400">${k.expiresAt ? fmtDate(k.expiresAt) : "Never"}</td>
|
|
6807
|
+
<td class="py-3 text-right">
|
|
6808
|
+
<button type="button" onclick="revokeApiKey('${id}', '${name.replace(/'/g, "\\'")}')"
|
|
6809
|
+
class="rounded-lg bg-red-50 dark:bg-red-900/20 px-3 py-1.5 text-sm font-medium text-red-700 dark:text-red-400 hover:bg-red-100 dark:hover:bg-red-900/40 ring-1 ring-red-200 dark:ring-red-800 transition-colors">
|
|
6810
|
+
Revoke
|
|
6811
|
+
</button>
|
|
6812
|
+
</td>
|
|
6813
|
+
</tr>`;
|
|
6814
|
+
}
|
|
6815
|
+
function renderApiKeysPage(data) {
|
|
6816
|
+
const { keys, user, version, dynamicMenuItems } = data;
|
|
6817
|
+
const rows = keys.length ? keys.map(keyRow).join("") : `<tr><td colspan="6" class="py-8 text-center text-sm text-zinc-500 dark:text-zinc-400">No API keys yet. Create one to enable programmatic access.</td></tr>`;
|
|
6818
|
+
const content2 = `
|
|
6819
|
+
<div>
|
|
6820
|
+
<div class="sm:flex sm:items-center sm:justify-between mb-6">
|
|
6821
|
+
<div class="sm:flex-auto">
|
|
6822
|
+
<h1 class="text-2xl/8 font-semibold text-zinc-950 dark:text-white sm:text-xl/8">API Keys</h1>
|
|
6823
|
+
<p class="mt-2 text-sm/6 text-zinc-500 dark:text-zinc-400">
|
|
6824
|
+
Long-lived secrets for headless / server-to-server REST access. Send a key as the
|
|
6825
|
+
<code class="font-mono">x-api-key</code> header or <code class="font-mono">Authorization: Bearer <key></code>.
|
|
6826
|
+
The secret is shown once at creation \u2014 store it now.
|
|
6827
|
+
</p>
|
|
6828
|
+
</div>
|
|
6829
|
+
<div class="mt-4 sm:mt-0 sm:ml-16">
|
|
6830
|
+
<button type="button" onclick="document.getElementById('create-key-modal').classList.remove('hidden')"
|
|
6831
|
+
class="inline-flex items-center justify-center rounded-lg bg-cyan-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-cyan-500 transition-colors shadow-sm">
|
|
6832
|
+
Create API key
|
|
6833
|
+
</button>
|
|
6834
|
+
</div>
|
|
6835
|
+
</div>
|
|
6836
|
+
|
|
6837
|
+
<!-- Newly-created secret banner (populated by JS, shown once) -->
|
|
6838
|
+
<div id="new-key-banner" class="hidden mb-6 rounded-xl bg-emerald-50 dark:bg-emerald-900/20 p-4 ring-1 ring-emerald-200 dark:ring-emerald-800">
|
|
6839
|
+
<p class="text-sm font-medium text-emerald-800 dark:text-emerald-300 mb-2">
|
|
6840
|
+
Copy your new key now \u2014 it will not be shown again.
|
|
6841
|
+
</p>
|
|
6842
|
+
<div class="flex items-center gap-2">
|
|
6843
|
+
<code id="new-key-value" class="flex-1 rounded-lg bg-white dark:bg-zinc-900 px-3 py-2 text-sm font-mono text-zinc-950 dark:text-white ring-1 ring-zinc-950/10 dark:ring-white/10 break-all"></code>
|
|
6844
|
+
<button type="button" onclick="copyNewKey()"
|
|
6845
|
+
class="rounded-lg bg-emerald-600 px-3 py-2 text-sm font-semibold text-white hover:bg-emerald-500 transition-colors">
|
|
6846
|
+
Copy
|
|
6847
|
+
</button>
|
|
6848
|
+
</div>
|
|
6849
|
+
</div>
|
|
6850
|
+
|
|
6851
|
+
<div class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl p-6 ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm overflow-x-auto">
|
|
6852
|
+
<table class="w-full text-left">
|
|
6853
|
+
<thead>
|
|
6854
|
+
<tr class="text-xs font-semibold uppercase tracking-wide text-zinc-500 dark:text-zinc-400">
|
|
6855
|
+
<th class="pb-2 pr-4">Name</th>
|
|
6856
|
+
<th class="pb-2 pr-4">Prefix</th>
|
|
6857
|
+
<th class="pb-2 pr-4">Created</th>
|
|
6858
|
+
<th class="pb-2 pr-4">Last used</th>
|
|
6859
|
+
<th class="pb-2 pr-4">Expires</th>
|
|
6860
|
+
<th class="pb-2 text-right">Actions</th>
|
|
6861
|
+
</tr>
|
|
6862
|
+
</thead>
|
|
6863
|
+
<tbody id="keys-tbody">${rows}</tbody>
|
|
6864
|
+
</table>
|
|
6865
|
+
</div>
|
|
6866
|
+
</div>
|
|
6867
|
+
|
|
6868
|
+
<!-- Create modal -->
|
|
6869
|
+
<div id="create-key-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4">
|
|
6870
|
+
<div class="w-full max-w-md rounded-xl bg-white dark:bg-zinc-900 p-6 ring-1 ring-zinc-950/10 dark:ring-white/10 shadow-xl">
|
|
6871
|
+
<h2 class="text-base font-semibold text-zinc-950 dark:text-white mb-4">Create API key</h2>
|
|
6872
|
+
<label class="block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1">Name</label>
|
|
6873
|
+
<input id="new-key-name" type="text" placeholder="e.g. CI deploy token"
|
|
6874
|
+
class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white mb-4 ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10">
|
|
6875
|
+
<label class="block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1">Expires in (days, optional)</label>
|
|
6876
|
+
<input id="new-key-expiry" type="number" min="1" max="3650" placeholder="Never"
|
|
6877
|
+
class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white mb-4 ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10">
|
|
6878
|
+
<div class="flex justify-end gap-2">
|
|
6879
|
+
<button type="button" onclick="document.getElementById('create-key-modal').classList.add('hidden')"
|
|
6880
|
+
class="rounded-lg bg-white dark:bg-zinc-800 px-4 py-2 text-sm font-semibold text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10">
|
|
6881
|
+
Cancel
|
|
6882
|
+
</button>
|
|
6883
|
+
<button type="button" onclick="createApiKey()"
|
|
6884
|
+
class="rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 transition-colors">
|
|
6885
|
+
Create
|
|
6886
|
+
</button>
|
|
6887
|
+
</div>
|
|
6888
|
+
</div>
|
|
6889
|
+
</div>
|
|
6890
|
+
|
|
6891
|
+
<script>
|
|
6892
|
+
// CSRF: the csrf_token cookie is JS-readable (httpOnly:false); echo it back
|
|
6893
|
+
// as X-CSRF-Token on state-changing requests (signed double-submit).
|
|
6894
|
+
function csrfHeader() {
|
|
6895
|
+
const m = document.cookie.match(/(?:^|; )csrf_token=([^;]+)/)
|
|
6896
|
+
return m ? { 'X-CSRF-Token': decodeURIComponent(m[1]) } : {}
|
|
6897
|
+
}
|
|
6898
|
+
async function createApiKey() {
|
|
6899
|
+
const name = document.getElementById('new-key-name').value.trim()
|
|
6900
|
+
if (!name) { window.showNotification && window.showNotification('Name is required', 'error'); return }
|
|
6901
|
+
const expiry = parseInt(document.getElementById('new-key-expiry').value, 10)
|
|
6902
|
+
const body = { name }
|
|
6903
|
+
if (Number.isFinite(expiry) && expiry > 0) body.expiresInDays = expiry
|
|
6904
|
+
const res = await fetch('/admin/plugins/api-keys/api/keys', {
|
|
6905
|
+
method: 'POST',
|
|
6906
|
+
headers: { 'Content-Type': 'application/json', ...csrfHeader() },
|
|
6907
|
+
body: JSON.stringify(body),
|
|
6908
|
+
})
|
|
6909
|
+
if (!res.ok) {
|
|
6910
|
+
const e = await res.json().catch(() => ({}))
|
|
6911
|
+
window.showNotification && window.showNotification(e.error || 'Failed to create key', 'error')
|
|
6912
|
+
return
|
|
6913
|
+
}
|
|
6914
|
+
const { apiKey } = await res.json()
|
|
6915
|
+
document.getElementById('create-key-modal').classList.add('hidden')
|
|
6916
|
+
document.getElementById('new-key-value').textContent = apiKey.key
|
|
6917
|
+
document.getElementById('new-key-banner').classList.remove('hidden')
|
|
6918
|
+
setTimeout(() => location.reload(), 1500)
|
|
6919
|
+
}
|
|
6920
|
+
function copyNewKey() {
|
|
6921
|
+
const v = document.getElementById('new-key-value').textContent
|
|
6922
|
+
navigator.clipboard.writeText(v).then(() => window.showNotification && window.showNotification('Copied', 'success'))
|
|
6923
|
+
}
|
|
6924
|
+
async function revokeApiKey(id, name) {
|
|
6925
|
+
if (!confirm('Revoke "' + name + '"? This cannot be undone and will break any client using it.')) return
|
|
6926
|
+
const res = await fetch('/admin/plugins/api-keys/api/keys/' + id, { method: 'DELETE', headers: { ...csrfHeader() } })
|
|
6927
|
+
if (res.ok) {
|
|
6928
|
+
const row = document.querySelector('[data-key-id="' + id + '"]')
|
|
6929
|
+
if (row) row.remove()
|
|
6930
|
+
window.showNotification && window.showNotification('Key revoked', 'success')
|
|
6931
|
+
} else {
|
|
6932
|
+
window.showNotification && window.showNotification('Failed to revoke', 'error')
|
|
6933
|
+
}
|
|
6934
|
+
}
|
|
6935
|
+
</script>`;
|
|
6936
|
+
const layoutData = {
|
|
6937
|
+
title: "API Keys",
|
|
6938
|
+
pageTitle: "API Keys",
|
|
6939
|
+
currentPath: "/admin/plugins/api-keys",
|
|
6940
|
+
user,
|
|
6941
|
+
content: content2,
|
|
6942
|
+
version,
|
|
6943
|
+
dynamicMenuItems
|
|
6944
|
+
};
|
|
6945
|
+
return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
6946
|
+
}
|
|
6947
|
+
|
|
6948
|
+
// src/plugins/core-plugins/api-keys-plugin/types.ts
|
|
6949
|
+
var DEFAULT_SETTINGS3 = {
|
|
6950
|
+
maxKeysPerUser: 50,
|
|
6951
|
+
defaultExpiryDays: 0
|
|
6952
|
+
};
|
|
6953
|
+
|
|
6954
|
+
// src/plugins/core-plugins/api-keys-plugin/routes/admin.ts
|
|
6955
|
+
var adminRoutes4 = new hono.Hono();
|
|
6956
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
6957
|
+
var createSchema = zod.z.object({
|
|
6958
|
+
name: zod.z.string().min(1).max(100),
|
|
6959
|
+
// Optional lifetime in days; omitted/null → plugin default (which may be "never").
|
|
6960
|
+
expiresInDays: zod.z.number().int().positive().max(3650).nullish()
|
|
6961
|
+
});
|
|
6962
|
+
async function getSettings3(db) {
|
|
6963
|
+
try {
|
|
6964
|
+
const plugin2 = await new chunkFXZSZ7C7_cjs.PluginService(db).getPlugin("api-keys");
|
|
6965
|
+
if (plugin2?.settings) {
|
|
6966
|
+
const s = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
6967
|
+
return { ...DEFAULT_SETTINGS3, ...s };
|
|
6968
|
+
}
|
|
6969
|
+
} catch {
|
|
6970
|
+
}
|
|
6971
|
+
return DEFAULT_SETTINGS3;
|
|
6972
|
+
}
|
|
6973
|
+
adminRoutes4.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
6974
|
+
adminRoutes4.use("*", async (c, next) => {
|
|
6975
|
+
const user = c.get("user");
|
|
6976
|
+
if (user?.role !== "admin") {
|
|
6977
|
+
return c.json({ error: "Access denied" }, 403);
|
|
6978
|
+
}
|
|
6979
|
+
return next();
|
|
6980
|
+
});
|
|
6981
|
+
adminRoutes4.get("/", async (c) => {
|
|
6982
|
+
const user = c.get("user");
|
|
6983
|
+
const tenantId = c.get("tenantId") || "default";
|
|
6984
|
+
const keys = await new ApiKeyService(c.env.DB, tenantId).list(user.userId);
|
|
6985
|
+
return c.html(
|
|
6986
|
+
renderApiKeysPage({
|
|
6987
|
+
keys,
|
|
6988
|
+
user: { name: user.email, email: user.email, role: user.role },
|
|
6989
|
+
version: c.get("appVersion"),
|
|
6990
|
+
dynamicMenuItems: c.get("pluginMenuItems")
|
|
6991
|
+
})
|
|
6992
|
+
);
|
|
6993
|
+
});
|
|
6994
|
+
adminRoutes4.get("/api/keys", async (c) => {
|
|
6995
|
+
const user = c.get("user");
|
|
6996
|
+
const tenantId = c.get("tenantId") || "default";
|
|
6997
|
+
const keys = await new ApiKeyService(c.env.DB, tenantId).list(user.userId);
|
|
6998
|
+
return c.json({ keys });
|
|
6999
|
+
});
|
|
7000
|
+
adminRoutes4.post("/api/keys", async (c) => {
|
|
7001
|
+
const user = c.get("user");
|
|
7002
|
+
const tenantId = c.get("tenantId") || "default";
|
|
7003
|
+
const body = await c.req.json().catch(() => ({}));
|
|
7004
|
+
const parsed = createSchema.safeParse(body);
|
|
7005
|
+
if (!parsed.success) {
|
|
7006
|
+
return c.json({ error: "Invalid request", details: parsed.error.flatten() }, 400);
|
|
7007
|
+
}
|
|
7008
|
+
const settings = await getSettings3(c.env.DB);
|
|
7009
|
+
const svc = new ApiKeyService(c.env.DB, tenantId);
|
|
7010
|
+
if (await svc.countForUser(user.userId) >= settings.maxKeysPerUser) {
|
|
7011
|
+
return c.json({ error: `API key limit reached (max ${settings.maxKeysPerUser})` }, 409);
|
|
7012
|
+
}
|
|
7013
|
+
const days = parsed.data.expiresInDays ?? (settings.defaultExpiryDays > 0 ? settings.defaultExpiryDays : null);
|
|
7014
|
+
const expiresAt = days ? Date.now() + days * DAY_MS : null;
|
|
7015
|
+
const created = await svc.create({ userId: user.userId, name: parsed.data.name, expiresAt });
|
|
7016
|
+
return c.json({ apiKey: created }, 201);
|
|
7017
|
+
});
|
|
7018
|
+
adminRoutes4.delete("/api/keys/:id", async (c) => {
|
|
7019
|
+
const user = c.get("user");
|
|
7020
|
+
const tenantId = c.get("tenantId") || "default";
|
|
7021
|
+
const ok = await new ApiKeyService(c.env.DB, tenantId).revoke(c.req.param("id") ?? "", user.userId);
|
|
7022
|
+
if (!ok) return c.json({ error: "API key not found" }, 404);
|
|
7023
|
+
return c.json({ success: true });
|
|
7024
|
+
});
|
|
7025
|
+
|
|
7026
|
+
// src/plugins/core-plugins/api-keys-plugin/middleware/api-key-auth.ts
|
|
7027
|
+
function apiKeyAuthMiddleware() {
|
|
7028
|
+
return async (c, next) => {
|
|
7029
|
+
if (!c.get("user")) {
|
|
7030
|
+
const authz = c.req.header("authorization") || "";
|
|
7031
|
+
const bearer = authz.toLowerCase().startsWith("bearer ") ? authz.slice(7).trim() : "";
|
|
7032
|
+
const presented = c.req.header("x-api-key") || (bearer.startsWith("sk_") ? bearer : "");
|
|
7033
|
+
if (presented) {
|
|
7034
|
+
try {
|
|
7035
|
+
const tenantId = c.get("tenantId") || "default";
|
|
7036
|
+
const resolved = await new ApiKeyService(c.env.DB, tenantId).resolve(presented);
|
|
7037
|
+
if (resolved) {
|
|
7038
|
+
c.set("user", {
|
|
7039
|
+
userId: resolved.userId,
|
|
7040
|
+
email: resolved.email,
|
|
7041
|
+
role: resolved.role,
|
|
7042
|
+
isSuperAdmin: resolved.isSuperAdmin,
|
|
7043
|
+
// API keys are stateless bearer creds — no session window.
|
|
7044
|
+
exp: 0,
|
|
7045
|
+
iat: 0
|
|
7046
|
+
});
|
|
7047
|
+
}
|
|
7048
|
+
} catch {
|
|
7049
|
+
}
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
await next();
|
|
7053
|
+
};
|
|
7054
|
+
}
|
|
7055
|
+
|
|
7056
|
+
// src/plugins/core-plugins/api-keys-plugin/index.ts
|
|
7057
|
+
var KEY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"/></svg>`;
|
|
7058
|
+
var apiKeysPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
7059
|
+
id: "api-keys",
|
|
7060
|
+
version: "1.0.0-beta.1",
|
|
7061
|
+
name: "API Keys",
|
|
7062
|
+
description: "Programmatic API access keys for headless / server-to-server REST access.",
|
|
7063
|
+
sonicjsVersionRange: "^3.0.0",
|
|
7064
|
+
author: { name: "SonicJS Team" },
|
|
7065
|
+
register(app2) {
|
|
7066
|
+
app2.route("/admin/plugins/api-keys", adminRoutes4);
|
|
7067
|
+
},
|
|
7068
|
+
menu: [
|
|
7069
|
+
{ label: "API Keys", path: "/admin/plugins/api-keys", icon: KEY_ICON, order: 86 }
|
|
7070
|
+
],
|
|
7071
|
+
configSchema: {
|
|
7072
|
+
maxKeysPerUser: {
|
|
7073
|
+
type: "number",
|
|
7074
|
+
label: "Max keys per user",
|
|
7075
|
+
description: "Hard cap on active keys a single user may hold.",
|
|
7076
|
+
default: 50
|
|
7077
|
+
},
|
|
7078
|
+
defaultExpiryDays: {
|
|
7079
|
+
type: "number",
|
|
7080
|
+
label: "Default expiry (days)",
|
|
7081
|
+
description: "Lifetime applied to new keys when no explicit expiry is given. 0 = never expires.",
|
|
7082
|
+
default: 0
|
|
7083
|
+
}
|
|
7084
|
+
},
|
|
7085
|
+
activate: async () => console.log("[ApiKeys] Plugin activated"),
|
|
7086
|
+
deactivate: async () => console.log("[ApiKeys] Plugin deactivated")
|
|
7087
|
+
});
|
|
7088
|
+
|
|
6638
7089
|
// src/plugins/core-plugins/stripe-plugin/services/subscription-service.ts
|
|
6639
7090
|
var SubscriptionService = class {
|
|
6640
7091
|
constructor(db) {
|
|
@@ -7362,7 +7813,7 @@ function renderEventPagination(page, totalPages, type, status) {
|
|
|
7362
7813
|
}
|
|
7363
7814
|
|
|
7364
7815
|
// src/plugins/core-plugins/stripe-plugin/types.ts
|
|
7365
|
-
var
|
|
7816
|
+
var DEFAULT_SETTINGS4 = {
|
|
7366
7817
|
stripePublishableKey: "",
|
|
7367
7818
|
stripeSecretKey: "",
|
|
7368
7819
|
stripeWebhookSecret: "",
|
|
@@ -7372,28 +7823,28 @@ var DEFAULT_SETTINGS3 = {
|
|
|
7372
7823
|
};
|
|
7373
7824
|
|
|
7374
7825
|
// src/plugins/core-plugins/stripe-plugin/routes/admin.ts
|
|
7375
|
-
var
|
|
7376
|
-
|
|
7377
|
-
|
|
7826
|
+
var adminRoutes5 = new hono.Hono();
|
|
7827
|
+
adminRoutes5.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
7828
|
+
adminRoutes5.use("*", async (c, next) => {
|
|
7378
7829
|
const user = c.get("user");
|
|
7379
7830
|
if (user?.role !== "admin") {
|
|
7380
7831
|
return c.text("Access denied", 403);
|
|
7381
7832
|
}
|
|
7382
7833
|
return next();
|
|
7383
7834
|
});
|
|
7384
|
-
async function
|
|
7835
|
+
async function getSettings4(db) {
|
|
7385
7836
|
try {
|
|
7386
|
-
const pluginService = new
|
|
7837
|
+
const pluginService = new chunkFXZSZ7C7_cjs.PluginService(db);
|
|
7387
7838
|
const plugin2 = await pluginService.getPlugin("stripe");
|
|
7388
7839
|
if (plugin2?.settings) {
|
|
7389
7840
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
7390
|
-
return { ...
|
|
7841
|
+
return { ...DEFAULT_SETTINGS4, ...settings };
|
|
7391
7842
|
}
|
|
7392
7843
|
} catch {
|
|
7393
7844
|
}
|
|
7394
|
-
return
|
|
7845
|
+
return DEFAULT_SETTINGS4;
|
|
7395
7846
|
}
|
|
7396
|
-
|
|
7847
|
+
adminRoutes5.get("/", async (c) => {
|
|
7397
7848
|
const db = c.env.DB;
|
|
7398
7849
|
const user = c.get("user");
|
|
7399
7850
|
const subscriptionService = new SubscriptionService(db);
|
|
@@ -7416,7 +7867,7 @@ adminRoutes4.get("/", async (c) => {
|
|
|
7416
7867
|
});
|
|
7417
7868
|
return c.html(html4);
|
|
7418
7869
|
});
|
|
7419
|
-
|
|
7870
|
+
adminRoutes5.get("/events", async (c) => {
|
|
7420
7871
|
const db = c.env.DB;
|
|
7421
7872
|
const user = c.get("user");
|
|
7422
7873
|
const eventService = new StripeEventService(db);
|
|
@@ -7442,10 +7893,10 @@ adminRoutes4.get("/events", async (c) => {
|
|
|
7442
7893
|
});
|
|
7443
7894
|
return c.html(html4);
|
|
7444
7895
|
});
|
|
7445
|
-
|
|
7896
|
+
adminRoutes5.get("/settings", async (c) => {
|
|
7446
7897
|
const db = c.env.DB;
|
|
7447
7898
|
const user = c.get("user");
|
|
7448
|
-
const settings = await
|
|
7899
|
+
const settings = await getSettings4(db);
|
|
7449
7900
|
const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-KDHKVLXR.cjs');
|
|
7450
7901
|
const content2 = `
|
|
7451
7902
|
<div>
|
|
@@ -7552,7 +8003,7 @@ adminRoutes4.get("/settings", async (c) => {
|
|
|
7552
8003
|
dynamicMenuItems: c.get("pluginMenuItems")
|
|
7553
8004
|
}));
|
|
7554
8005
|
});
|
|
7555
|
-
|
|
8006
|
+
adminRoutes5.post("/settings", async (c) => {
|
|
7556
8007
|
try {
|
|
7557
8008
|
const body = await c.req.json();
|
|
7558
8009
|
const db = c.env.DB;
|
|
@@ -7703,17 +8154,17 @@ function timingSafeEqual(a, b) {
|
|
|
7703
8154
|
|
|
7704
8155
|
// src/plugins/core-plugins/stripe-plugin/routes/api.ts
|
|
7705
8156
|
var apiRoutes3 = new hono.Hono();
|
|
7706
|
-
async function
|
|
8157
|
+
async function getSettings5(db) {
|
|
7707
8158
|
try {
|
|
7708
|
-
const pluginService = new
|
|
8159
|
+
const pluginService = new chunkFXZSZ7C7_cjs.PluginService(db);
|
|
7709
8160
|
const plugin2 = await pluginService.getPlugin("stripe");
|
|
7710
8161
|
if (plugin2?.settings) {
|
|
7711
8162
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
7712
|
-
return { ...
|
|
8163
|
+
return { ...DEFAULT_SETTINGS4, ...settings };
|
|
7713
8164
|
}
|
|
7714
8165
|
} catch {
|
|
7715
8166
|
}
|
|
7716
|
-
return
|
|
8167
|
+
return DEFAULT_SETTINGS4;
|
|
7717
8168
|
}
|
|
7718
8169
|
function mapStripeStatus(status) {
|
|
7719
8170
|
const map = {
|
|
@@ -7730,7 +8181,7 @@ function mapStripeStatus(status) {
|
|
|
7730
8181
|
}
|
|
7731
8182
|
apiRoutes3.post("/webhook", async (c) => {
|
|
7732
8183
|
const db = c.env.DB;
|
|
7733
|
-
const settings = await
|
|
8184
|
+
const settings = await getSettings5(db);
|
|
7734
8185
|
if (!settings.stripeWebhookSecret) {
|
|
7735
8186
|
return c.json({ error: "Webhook secret not configured" }, 500);
|
|
7736
8187
|
}
|
|
@@ -7856,11 +8307,11 @@ apiRoutes3.post("/webhook", async (c) => {
|
|
|
7856
8307
|
}
|
|
7857
8308
|
return c.json({ received: true });
|
|
7858
8309
|
});
|
|
7859
|
-
apiRoutes3.post("/create-checkout-session",
|
|
8310
|
+
apiRoutes3.post("/create-checkout-session", chunkZBDDZYA3_cjs.requireAuth(), async (c) => {
|
|
7860
8311
|
const db = c.env.DB;
|
|
7861
8312
|
const user = c.get("user");
|
|
7862
8313
|
if (!user) return c.json({ error: "Unauthorized" }, 401);
|
|
7863
|
-
const settings = await
|
|
8314
|
+
const settings = await getSettings5(db);
|
|
7864
8315
|
if (!settings.stripeSecretKey) {
|
|
7865
8316
|
return c.json({ error: "Stripe not configured" }, 500);
|
|
7866
8317
|
}
|
|
@@ -7896,7 +8347,7 @@ apiRoutes3.post("/create-checkout-session", chunkL3KHLEHL_cjs.requireAuth(), asy
|
|
|
7896
8347
|
});
|
|
7897
8348
|
return c.json({ sessionId: session.id, url: session.url });
|
|
7898
8349
|
});
|
|
7899
|
-
apiRoutes3.get("/subscription",
|
|
8350
|
+
apiRoutes3.get("/subscription", chunkZBDDZYA3_cjs.requireAuth(), async (c) => {
|
|
7900
8351
|
const user = c.get("user");
|
|
7901
8352
|
if (!user) return c.json({ error: "Unauthorized" }, 401);
|
|
7902
8353
|
const db = c.env.DB;
|
|
@@ -7908,7 +8359,7 @@ apiRoutes3.get("/subscription", chunkL3KHLEHL_cjs.requireAuth(), async (c) => {
|
|
|
7908
8359
|
}
|
|
7909
8360
|
return c.json({ subscription });
|
|
7910
8361
|
});
|
|
7911
|
-
apiRoutes3.get("/subscriptions",
|
|
8362
|
+
apiRoutes3.get("/subscriptions", chunkZBDDZYA3_cjs.requireAuth(), async (c) => {
|
|
7912
8363
|
const user = c.get("user");
|
|
7913
8364
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
7914
8365
|
const db = c.env.DB;
|
|
@@ -7924,7 +8375,7 @@ apiRoutes3.get("/subscriptions", chunkL3KHLEHL_cjs.requireAuth(), async (c) => {
|
|
|
7924
8375
|
const result = await subscriptionService.list(filters);
|
|
7925
8376
|
return c.json(result);
|
|
7926
8377
|
});
|
|
7927
|
-
apiRoutes3.get("/stats",
|
|
8378
|
+
apiRoutes3.get("/stats", chunkZBDDZYA3_cjs.requireAuth(), async (c) => {
|
|
7928
8379
|
const user = c.get("user");
|
|
7929
8380
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
7930
8381
|
const db = c.env.DB;
|
|
@@ -7933,11 +8384,11 @@ apiRoutes3.get("/stats", chunkL3KHLEHL_cjs.requireAuth(), async (c) => {
|
|
|
7933
8384
|
const stats = await subscriptionService.getStats();
|
|
7934
8385
|
return c.json(stats);
|
|
7935
8386
|
});
|
|
7936
|
-
apiRoutes3.post("/sync-subscriptions",
|
|
8387
|
+
apiRoutes3.post("/sync-subscriptions", chunkZBDDZYA3_cjs.requireAuth(), async (c) => {
|
|
7937
8388
|
const user = c.get("user");
|
|
7938
8389
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
7939
8390
|
const db = c.env.DB;
|
|
7940
|
-
const settings = await
|
|
8391
|
+
const settings = await getSettings5(db);
|
|
7941
8392
|
if (!settings.stripeSecretKey) {
|
|
7942
8393
|
return c.json({ error: "Stripe secret key not configured" }, 400);
|
|
7943
8394
|
}
|
|
@@ -7981,7 +8432,7 @@ apiRoutes3.post("/sync-subscriptions", chunkL3KHLEHL_cjs.requireAuth(), async (c
|
|
|
7981
8432
|
}, 500);
|
|
7982
8433
|
}
|
|
7983
8434
|
});
|
|
7984
|
-
apiRoutes3.get("/events",
|
|
8435
|
+
apiRoutes3.get("/events", chunkZBDDZYA3_cjs.requireAuth(), async (c) => {
|
|
7985
8436
|
const user = c.get("user");
|
|
7986
8437
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
7987
8438
|
const db = c.env.DB;
|
|
@@ -8004,7 +8455,7 @@ apiRoutes3.get("/events", chunkL3KHLEHL_cjs.requireAuth(), async (c) => {
|
|
|
8004
8455
|
|
|
8005
8456
|
// src/plugins/core-plugins/stripe-plugin/index.ts
|
|
8006
8457
|
var STRIPE_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"/></svg>`;
|
|
8007
|
-
var stripePlugin =
|
|
8458
|
+
var stripePlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
8008
8459
|
id: "stripe",
|
|
8009
8460
|
version: "1.0.0",
|
|
8010
8461
|
name: "Stripe",
|
|
@@ -8012,7 +8463,7 @@ var stripePlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
8012
8463
|
sonicjsVersionRange: "^3.0.0",
|
|
8013
8464
|
author: { name: "SonicJS Team" },
|
|
8014
8465
|
register(app2) {
|
|
8015
|
-
app2.route("/admin/plugins/stripe",
|
|
8466
|
+
app2.route("/admin/plugins/stripe", adminRoutes5);
|
|
8016
8467
|
app2.route("/api/stripe", apiRoutes3);
|
|
8017
8468
|
},
|
|
8018
8469
|
menu: [
|
|
@@ -8277,7 +8728,7 @@ function renderFormsListPage(data) {
|
|
|
8277
8728
|
|
|
8278
8729
|
<!-- Forms Table -->
|
|
8279
8730
|
<div class="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-950/5 dark:border-white/10 overflow-hidden">
|
|
8280
|
-
${
|
|
8731
|
+
${chunkBDQOPRA3_cjs.renderTable(tableData)}
|
|
8281
8732
|
</div>
|
|
8282
8733
|
</div>
|
|
8283
8734
|
`;
|
|
@@ -9707,7 +10158,7 @@ function renderFormCreatePage(data) {
|
|
|
9707
10158
|
// src/routes/admin-forms.ts
|
|
9708
10159
|
var isTableMissing = (err) => String(err?.message ?? err?.cause?.message ?? "").includes("no such table: forms");
|
|
9709
10160
|
var adminFormsRoutes = new hono.Hono();
|
|
9710
|
-
adminFormsRoutes.use("*",
|
|
10161
|
+
adminFormsRoutes.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
9711
10162
|
adminFormsRoutes.get("/", async (c) => {
|
|
9712
10163
|
try {
|
|
9713
10164
|
const user = c.get("user");
|
|
@@ -9880,7 +10331,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
|
|
|
9880
10331
|
if (!form) {
|
|
9881
10332
|
return c.html("<p>Form not found</p>", 404);
|
|
9882
10333
|
}
|
|
9883
|
-
const turnstileService = new
|
|
10334
|
+
const turnstileService = new chunkFVI3H6RG_cjs.TurnstileService(db);
|
|
9884
10335
|
const turnstileSettings = await turnstileService.getSettings();
|
|
9885
10336
|
const pageData = {
|
|
9886
10337
|
id: form.id,
|
|
@@ -10049,7 +10500,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
|
|
|
10049
10500
|
if (!form) {
|
|
10050
10501
|
return c.json({ error: "Form not found" }, 404);
|
|
10051
10502
|
}
|
|
10052
|
-
const turnstileService = new
|
|
10503
|
+
const turnstileService = new chunkFVI3H6RG_cjs.TurnstileService(db);
|
|
10053
10504
|
const globalSettings = await turnstileService.getSettings();
|
|
10054
10505
|
const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
10055
10506
|
const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
|
|
@@ -10479,7 +10930,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
10479
10930
|
const turnstileEnabled = form.turnstile_enabled === 1;
|
|
10480
10931
|
const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
10481
10932
|
if (turnstileEnabled || turnstileSettings.inherit) {
|
|
10482
|
-
const turnstileService = new
|
|
10933
|
+
const turnstileService = new chunkFVI3H6RG_cjs.TurnstileService(db);
|
|
10483
10934
|
const globalEnabled = await turnstileService.isEnabled();
|
|
10484
10935
|
if (globalEnabled || turnstileEnabled) {
|
|
10485
10936
|
const turnstileToken = body.data?.turnstile || body.turnstile;
|
|
@@ -10541,7 +10992,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
10541
10992
|
});
|
|
10542
10993
|
|
|
10543
10994
|
// src/plugins/core-plugins/forms-plugin/index.ts
|
|
10544
|
-
var formsPlugin =
|
|
10995
|
+
var formsPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
10545
10996
|
id: "forms",
|
|
10546
10997
|
version: "1.0.0",
|
|
10547
10998
|
name: "Forms",
|
|
@@ -10561,7 +11012,7 @@ var formsPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
10561
11012
|
});
|
|
10562
11013
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
10563
11014
|
var adminRbacRoutes = new hono.Hono();
|
|
10564
|
-
adminRbacRoutes.use("*",
|
|
11015
|
+
adminRbacRoutes.use("*", chunkZBDDZYA3_cjs.requireRbac("rbac", "manage"));
|
|
10565
11016
|
var esc = (s) => String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
10566
11017
|
var TABS2 = `
|
|
10567
11018
|
<div class="border-b border-zinc-950/10 dark:border-white/10 mb-6">
|
|
@@ -10869,7 +11320,7 @@ adminRbacRoutes.get("/", async (c) => {
|
|
|
10869
11320
|
title: "Roles & Permissions",
|
|
10870
11321
|
pageTitle: "Roles & Permissions",
|
|
10871
11322
|
currentPath: "/admin/users",
|
|
10872
|
-
version:
|
|
11323
|
+
version: chunkPK3ODTAL_cjs.getCoreVersion(),
|
|
10873
11324
|
user: u ? { name: u.email || "Admin", email: u.email || "", role: u.role || "admin" } : void 0,
|
|
10874
11325
|
content: content2
|
|
10875
11326
|
})
|
|
@@ -11006,7 +11457,7 @@ adminRbacRoutes.get("/check", async (c) => {
|
|
|
11006
11457
|
});
|
|
11007
11458
|
|
|
11008
11459
|
// src/middleware/plugin-menu.ts
|
|
11009
|
-
var REGISTRY_MENU_PLUGINS = Object.values(
|
|
11460
|
+
var REGISTRY_MENU_PLUGINS = Object.values(chunkFXZSZ7C7_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
|
|
11010
11461
|
id: p.id,
|
|
11011
11462
|
label: p.adminMenu.label,
|
|
11012
11463
|
path: p.adminMenu.path,
|
|
@@ -11102,16 +11553,16 @@ function pluginMenuMiddleware() {
|
|
|
11102
11553
|
};
|
|
11103
11554
|
}
|
|
11104
11555
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
11105
|
-
var
|
|
11106
|
-
|
|
11107
|
-
|
|
11556
|
+
var adminRoutes6 = new hono.Hono();
|
|
11557
|
+
adminRoutes6.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
11558
|
+
adminRoutes6.use("*", async (c, next) => {
|
|
11108
11559
|
const user = c.get("user");
|
|
11109
11560
|
if (user?.role !== "admin") {
|
|
11110
11561
|
return c.text("Access denied", 403);
|
|
11111
11562
|
}
|
|
11112
11563
|
return next();
|
|
11113
11564
|
});
|
|
11114
|
-
|
|
11565
|
+
adminRoutes6.get("/", async (c) => {
|
|
11115
11566
|
const user = c.get("user");
|
|
11116
11567
|
const db = c.env.DB;
|
|
11117
11568
|
let totalRequests = 0;
|
|
@@ -11458,7 +11909,7 @@ apiRoutes4.get("/stats", async (c) => {
|
|
|
11458
11909
|
});
|
|
11459
11910
|
|
|
11460
11911
|
// src/plugins/core-plugins/analytics/index.ts
|
|
11461
|
-
var analyticsPlugin =
|
|
11912
|
+
var analyticsPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
11462
11913
|
id: "core-analytics",
|
|
11463
11914
|
version: "1.0.0",
|
|
11464
11915
|
name: "Analytics",
|
|
@@ -11467,7 +11918,7 @@ var analyticsPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
11467
11918
|
author: { name: "SonicJS Team", email: "team@sonicjs.com" },
|
|
11468
11919
|
register(app2) {
|
|
11469
11920
|
app2.route("/api/events", apiRoutes4);
|
|
11470
|
-
app2.route("/admin/analytics",
|
|
11921
|
+
app2.route("/admin/analytics", adminRoutes6);
|
|
11471
11922
|
},
|
|
11472
11923
|
menu: [
|
|
11473
11924
|
{
|
|
@@ -11605,7 +12056,7 @@ function esc2(s) {
|
|
|
11605
12056
|
return (s || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
11606
12057
|
}
|
|
11607
12058
|
async function getVariablesMap(db) {
|
|
11608
|
-
let variables =
|
|
12059
|
+
let variables = chunkBDQOPRA3_cjs.getVariablesCached();
|
|
11609
12060
|
if (variables) return variables;
|
|
11610
12061
|
try {
|
|
11611
12062
|
const { results } = await db.prepare(
|
|
@@ -11615,7 +12066,7 @@ async function getVariablesMap(db) {
|
|
|
11615
12066
|
for (const row of results || []) {
|
|
11616
12067
|
variables.set(row.key, row.value);
|
|
11617
12068
|
}
|
|
11618
|
-
|
|
12069
|
+
chunkBDQOPRA3_cjs.setVariablesCache(variables);
|
|
11619
12070
|
return variables;
|
|
11620
12071
|
} catch {
|
|
11621
12072
|
return /* @__PURE__ */ new Map();
|
|
@@ -11684,7 +12135,7 @@ apiRoutes5.post("/", async (c) => {
|
|
|
11684
12135
|
await db.prepare(
|
|
11685
12136
|
"INSERT INTO global_variables (key, value, description, category, is_active) VALUES (?, ?, ?, ?, ?)"
|
|
11686
12137
|
).bind(key, value || "", description || "", category || "general", isActive !== false ? 1 : 0).run();
|
|
11687
|
-
|
|
12138
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
11688
12139
|
const created = await db.prepare("SELECT * FROM global_variables WHERE key = ?").bind(key).first();
|
|
11689
12140
|
return c.json({ success: true, data: formatVariable(created) }, 201);
|
|
11690
12141
|
} catch {
|
|
@@ -11729,7 +12180,7 @@ apiRoutes5.put("/:id", async (c) => {
|
|
|
11729
12180
|
updates.push("updated_at = strftime('%s', 'now')");
|
|
11730
12181
|
params.push(id);
|
|
11731
12182
|
await db.prepare(`UPDATE global_variables SET ${updates.join(", ")} WHERE id = ?`).bind(...params).run();
|
|
11732
|
-
|
|
12183
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
11733
12184
|
const updated = await db.prepare("SELECT * FROM global_variables WHERE id = ?").bind(id).first();
|
|
11734
12185
|
return c.json({ success: true, data: formatVariable(updated) });
|
|
11735
12186
|
} catch {
|
|
@@ -11743,14 +12194,14 @@ apiRoutes5.delete("/:id", async (c) => {
|
|
|
11743
12194
|
const existing = await db.prepare("SELECT id FROM global_variables WHERE id = ?").bind(id).first();
|
|
11744
12195
|
if (!existing) return c.json({ error: "Variable not found" }, 404);
|
|
11745
12196
|
await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(id).run();
|
|
11746
|
-
|
|
12197
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
11747
12198
|
return c.json({ success: true });
|
|
11748
12199
|
} catch {
|
|
11749
12200
|
return c.json({ success: false, error: "Failed to delete variable" }, 500);
|
|
11750
12201
|
}
|
|
11751
12202
|
});
|
|
11752
|
-
var
|
|
11753
|
-
|
|
12203
|
+
var adminRoutes7 = new hono.Hono();
|
|
12204
|
+
adminRoutes7.use("*", async (c, next) => {
|
|
11754
12205
|
try {
|
|
11755
12206
|
const db = c.env?.DB;
|
|
11756
12207
|
if (db) {
|
|
@@ -11761,7 +12212,7 @@ adminRoutes6.use("*", async (c, next) => {
|
|
|
11761
12212
|
}
|
|
11762
12213
|
await next();
|
|
11763
12214
|
});
|
|
11764
|
-
|
|
12215
|
+
adminRoutes7.get("/", async (c) => {
|
|
11765
12216
|
const db = c.env.DB;
|
|
11766
12217
|
let variables = [];
|
|
11767
12218
|
try {
|
|
@@ -11791,7 +12242,7 @@ adminRoutes6.get("/", async (c) => {
|
|
|
11791
12242
|
}
|
|
11792
12243
|
return c.html(renderAdminPage(variables, { editorActive, activeEditorName, enableEditorIntegration }));
|
|
11793
12244
|
});
|
|
11794
|
-
|
|
12245
|
+
adminRoutes7.put("/:id", async (c) => {
|
|
11795
12246
|
const db = c.env.DB;
|
|
11796
12247
|
const id = c.req.param("id");
|
|
11797
12248
|
let body;
|
|
@@ -11803,19 +12254,19 @@ adminRoutes6.put("/:id", async (c) => {
|
|
|
11803
12254
|
const value = body.value;
|
|
11804
12255
|
if (value !== void 0) {
|
|
11805
12256
|
await db.prepare("UPDATE global_variables SET value = ?, updated_at = strftime('%s', 'now') WHERE id = ?").bind(value, id).run();
|
|
11806
|
-
|
|
12257
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
11807
12258
|
}
|
|
11808
12259
|
return c.html('<span class="text-green-400 text-xs">Saved</span>');
|
|
11809
12260
|
});
|
|
11810
|
-
|
|
12261
|
+
adminRoutes7.post("/:id/toggle", async (c) => {
|
|
11811
12262
|
const db = c.env.DB;
|
|
11812
12263
|
const id = c.req.param("id");
|
|
11813
12264
|
await db.prepare("UPDATE global_variables SET is_active = CASE WHEN is_active = 1 THEN 0 ELSE 1 END, updated_at = strftime('%s', 'now') WHERE id = ?").bind(id).run();
|
|
11814
|
-
|
|
12265
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
11815
12266
|
c.header("HX-Redirect", "/admin/global-variables");
|
|
11816
12267
|
return c.body(null, 204);
|
|
11817
12268
|
});
|
|
11818
|
-
|
|
12269
|
+
adminRoutes7.post("/", async (c) => {
|
|
11819
12270
|
const db = c.env.DB;
|
|
11820
12271
|
const form = await c.req.parseBody();
|
|
11821
12272
|
const key = (form.key || "").trim();
|
|
@@ -11832,11 +12283,11 @@ adminRoutes6.post("/", async (c) => {
|
|
|
11832
12283
|
await db.prepare(
|
|
11833
12284
|
"INSERT INTO global_variables (key, value, description, category) VALUES (?, ?, ?, ?)"
|
|
11834
12285
|
).bind(key, value, description, category).run();
|
|
11835
|
-
|
|
12286
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
11836
12287
|
c.header("HX-Redirect", "/admin/global-variables");
|
|
11837
12288
|
return c.body(null, 204);
|
|
11838
12289
|
});
|
|
11839
|
-
|
|
12290
|
+
adminRoutes7.post("/settings/editor-integration", async (c) => {
|
|
11840
12291
|
const db = c.env.DB;
|
|
11841
12292
|
try {
|
|
11842
12293
|
const row = await db.prepare("SELECT settings FROM plugins WHERE id = 'global-variables'").first();
|
|
@@ -11848,10 +12299,10 @@ adminRoutes6.post("/settings/editor-integration", async (c) => {
|
|
|
11848
12299
|
return c.json({ success: false, error: "Failed to update setting" }, 500);
|
|
11849
12300
|
}
|
|
11850
12301
|
});
|
|
11851
|
-
|
|
12302
|
+
adminRoutes7.delete("/:id", async (c) => {
|
|
11852
12303
|
const db = c.env.DB;
|
|
11853
12304
|
await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(c.req.param("id")).run();
|
|
11854
|
-
|
|
12305
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
11855
12306
|
return c.html("");
|
|
11856
12307
|
});
|
|
11857
12308
|
function renderAdminPage(variables, editorStatus = { editorActive: false, activeEditorName: "", enableEditorIntegration: true }) {
|
|
@@ -12169,7 +12620,7 @@ function renderAdminPage(variables, editorStatus = { editorActive: false, active
|
|
|
12169
12620
|
</div>
|
|
12170
12621
|
` });
|
|
12171
12622
|
}
|
|
12172
|
-
var globalVariablesPlugin =
|
|
12623
|
+
var globalVariablesPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
12173
12624
|
id: "global-variables",
|
|
12174
12625
|
version: "1.1.0",
|
|
12175
12626
|
name: "Global Variables",
|
|
@@ -12179,7 +12630,7 @@ var globalVariablesPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
12179
12630
|
capabilities: ["hooks.content:subscribe"],
|
|
12180
12631
|
register(app2) {
|
|
12181
12632
|
app2.route("/api/global-variables", apiRoutes5);
|
|
12182
|
-
app2.route("/admin/global-variables",
|
|
12633
|
+
app2.route("/admin/global-variables", adminRoutes7);
|
|
12183
12634
|
},
|
|
12184
12635
|
menu: [
|
|
12185
12636
|
{ label: "Global Variables", path: "/admin/global-variables", icon: "bolt", order: 45, permissions: ["global-variables:view"] }
|
|
@@ -12192,7 +12643,7 @@ var globalVariablesPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
12192
12643
|
if (!db || !data) return data;
|
|
12193
12644
|
const variables = await getVariablesMap(db);
|
|
12194
12645
|
if (variables.size === 0) return data;
|
|
12195
|
-
return
|
|
12646
|
+
return chunkBDQOPRA3_cjs.resolveVariablesInObject(data, variables);
|
|
12196
12647
|
} catch {
|
|
12197
12648
|
return data;
|
|
12198
12649
|
}
|
|
@@ -12210,7 +12661,7 @@ var globalVariablesPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
12210
12661
|
},
|
|
12211
12662
|
activate: async () => console.info("[GlobalVariables] Plugin activated"),
|
|
12212
12663
|
deactivate: async () => {
|
|
12213
|
-
|
|
12664
|
+
chunkBDQOPRA3_cjs.invalidateVariablesCache();
|
|
12214
12665
|
console.info("[GlobalVariables] Plugin deactivated, cache cleared");
|
|
12215
12666
|
},
|
|
12216
12667
|
uninstall: async (ctx) => {
|
|
@@ -12500,8 +12951,8 @@ apiRoutes6.delete("/:id", async (c) => {
|
|
|
12500
12951
|
return c.json({ success: false, error: "Failed to delete shortcode" }, 500);
|
|
12501
12952
|
}
|
|
12502
12953
|
});
|
|
12503
|
-
var
|
|
12504
|
-
|
|
12954
|
+
var adminRoutes8 = new hono.Hono();
|
|
12955
|
+
adminRoutes8.use("*", async (c, next) => {
|
|
12505
12956
|
try {
|
|
12506
12957
|
const db = c.env?.DB;
|
|
12507
12958
|
if (db) {
|
|
@@ -12512,7 +12963,7 @@ adminRoutes7.use("*", async (c, next) => {
|
|
|
12512
12963
|
}
|
|
12513
12964
|
await next();
|
|
12514
12965
|
});
|
|
12515
|
-
|
|
12966
|
+
adminRoutes8.get("/", async (c) => {
|
|
12516
12967
|
const db = c.env.DB;
|
|
12517
12968
|
let shortcodes = [];
|
|
12518
12969
|
try {
|
|
@@ -12542,7 +12993,7 @@ adminRoutes7.get("/", async (c) => {
|
|
|
12542
12993
|
}
|
|
12543
12994
|
return c.html(renderAdminPage2(shortcodes, { editorActive, activeEditorName, enableEditorIntegration }));
|
|
12544
12995
|
});
|
|
12545
|
-
|
|
12996
|
+
adminRoutes8.post("/", async (c) => {
|
|
12546
12997
|
const db = c.env.DB;
|
|
12547
12998
|
const form = await c.req.parseBody();
|
|
12548
12999
|
const name = (form.name || "").trim();
|
|
@@ -12563,7 +13014,7 @@ adminRoutes7.post("/", async (c) => {
|
|
|
12563
13014
|
c.header("HX-Redirect", "/admin/shortcodes");
|
|
12564
13015
|
return c.body(null, 204);
|
|
12565
13016
|
});
|
|
12566
|
-
|
|
13017
|
+
adminRoutes8.post("/settings/editor-integration", async (c) => {
|
|
12567
13018
|
const db = c.env.DB;
|
|
12568
13019
|
try {
|
|
12569
13020
|
const row = await db.prepare("SELECT settings FROM plugins WHERE id = 'shortcodes'").first();
|
|
@@ -12575,7 +13026,7 @@ adminRoutes7.post("/settings/editor-integration", async (c) => {
|
|
|
12575
13026
|
return c.json({ success: false, error: "Failed to update setting" }, 500);
|
|
12576
13027
|
}
|
|
12577
13028
|
});
|
|
12578
|
-
|
|
13029
|
+
adminRoutes8.delete("/:id", async (c) => {
|
|
12579
13030
|
await c.env.DB.prepare("DELETE FROM shortcodes WHERE id = ?").bind(c.req.param("id")).run();
|
|
12580
13031
|
return c.html("");
|
|
12581
13032
|
});
|
|
@@ -12776,7 +13227,7 @@ function renderAdminPage2(shortcodes, editorStatus = { editorActive: false, acti
|
|
|
12776
13227
|
</div>
|
|
12777
13228
|
` });
|
|
12778
13229
|
}
|
|
12779
|
-
var shortcodesPlugin =
|
|
13230
|
+
var shortcodesPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
12780
13231
|
id: "shortcodes",
|
|
12781
13232
|
version: "1.0.0",
|
|
12782
13233
|
name: "Shortcodes",
|
|
@@ -12786,7 +13237,7 @@ var shortcodesPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
12786
13237
|
capabilities: ["hooks.content:subscribe"],
|
|
12787
13238
|
register(app2) {
|
|
12788
13239
|
app2.route("/api/shortcodes", apiRoutes6);
|
|
12789
|
-
app2.route("/admin/shortcodes",
|
|
13240
|
+
app2.route("/admin/shortcodes", adminRoutes8);
|
|
12790
13241
|
},
|
|
12791
13242
|
menu: [
|
|
12792
13243
|
{ label: "Shortcodes", path: "/admin/shortcodes", icon: "bolt", order: 46, permissions: ["shortcodes:view"] }
|
|
@@ -12860,7 +13311,7 @@ helloWorldRoutes.get("/", async (c) => {
|
|
|
12860
13311
|
</html>
|
|
12861
13312
|
`);
|
|
12862
13313
|
});
|
|
12863
|
-
var helloWorldPlugin =
|
|
13314
|
+
var helloWorldPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
12864
13315
|
id: "hello-world",
|
|
12865
13316
|
version: "1.0.0",
|
|
12866
13317
|
name: "Hello World",
|
|
@@ -12895,6 +13346,9 @@ var helloWorldPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
12895
13346
|
console.info("\u274C Hello World plugin deactivated");
|
|
12896
13347
|
}
|
|
12897
13348
|
});
|
|
13349
|
+
function createHelloWorldPlugin() {
|
|
13350
|
+
return helloWorldPlugin;
|
|
13351
|
+
}
|
|
12898
13352
|
|
|
12899
13353
|
// src/plugins/core-plugins/multi-tenant-plugin/manifest.json
|
|
12900
13354
|
var manifest_default2 = {
|
|
@@ -13088,7 +13542,7 @@ function renderTenantForm(data) {
|
|
|
13088
13542
|
// src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-members.template.ts
|
|
13089
13543
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
13090
13544
|
function roleOptions(selected) {
|
|
13091
|
-
return
|
|
13545
|
+
return chunkBDQOPRA3_cjs.VALID_MEMBER_ROLES.map(
|
|
13092
13546
|
(r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
|
|
13093
13547
|
).join("");
|
|
13094
13548
|
}
|
|
@@ -13150,7 +13604,7 @@ function renderInvitations(slug, invitations) {
|
|
|
13150
13604
|
<div>
|
|
13151
13605
|
<label for="invite-role" class="mb-1 block text-xs font-medium text-zinc-500 dark:text-zinc-400">Role</label>
|
|
13152
13606
|
<select id="invite-role" name="role" class="rounded-lg border border-zinc-950/10 bg-white px-2 py-2 text-sm text-zinc-950 dark:border-white/10 dark:bg-zinc-800 dark:text-white">
|
|
13153
|
-
${
|
|
13607
|
+
${chunkBDQOPRA3_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
|
|
13154
13608
|
</select>
|
|
13155
13609
|
</div>
|
|
13156
13610
|
<button type="submit" data-send-invite class="rounded-lg bg-zinc-950 px-3.5 py-2 text-sm font-semibold text-white hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200">Invite</button>
|
|
@@ -13246,7 +13700,7 @@ function renderTenantMembers(data) {
|
|
|
13246
13700
|
// src/plugins/core-plugins/multi-tenant-plugin/templates/user-memberships.template.ts
|
|
13247
13701
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
13248
13702
|
function roleOptions2(selected) {
|
|
13249
|
-
return
|
|
13703
|
+
return chunkBDQOPRA3_cjs.VALID_MEMBER_ROLES.map(
|
|
13250
13704
|
(r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
|
|
13251
13705
|
).join("");
|
|
13252
13706
|
}
|
|
@@ -13408,7 +13862,7 @@ function zodToFieldErrors(error) {
|
|
|
13408
13862
|
}
|
|
13409
13863
|
async function isMultiTenantActive(db) {
|
|
13410
13864
|
try {
|
|
13411
|
-
const plugin2 = await new
|
|
13865
|
+
const plugin2 = await new chunkFXZSZ7C7_cjs.PluginService(db).getPlugin(chunkFXZSZ7C7_cjs.MULTI_TENANT_PLUGIN_ID);
|
|
13412
13866
|
return plugin2?.status === "active";
|
|
13413
13867
|
} catch {
|
|
13414
13868
|
return false;
|
|
@@ -13416,7 +13870,7 @@ async function isMultiTenantActive(db) {
|
|
|
13416
13870
|
}
|
|
13417
13871
|
function createTenantAdminRoutes() {
|
|
13418
13872
|
const routes2 = new hono.Hono();
|
|
13419
|
-
routes2.use("*",
|
|
13873
|
+
routes2.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
13420
13874
|
routes2.use("*", async (c, next) => {
|
|
13421
13875
|
const user = c.get("user");
|
|
13422
13876
|
if (user?.role !== "admin") {
|
|
@@ -13430,7 +13884,7 @@ function createTenantAdminRoutes() {
|
|
|
13430
13884
|
const form = await c.req.formData();
|
|
13431
13885
|
const slug = String(form.get("tenant") ?? "").trim().toLowerCase();
|
|
13432
13886
|
const redirect = String(form.get("redirect") ?? "");
|
|
13433
|
-
const svc = new
|
|
13887
|
+
const svc = new chunkBDQOPRA3_cjs.TenantService(db);
|
|
13434
13888
|
const tenant = await svc.getTenantBySlug(slug);
|
|
13435
13889
|
if (!tenant || tenant.status !== "active") {
|
|
13436
13890
|
return c.json({ error: "Unknown or inactive tenant" }, 400);
|
|
@@ -13440,7 +13894,7 @@ function createTenantAdminRoutes() {
|
|
|
13440
13894
|
if (!user.isSuperAdmin && !await svc.isMember(user.userId, slug)) {
|
|
13441
13895
|
return c.json({ error: "You are not a member of this tenant" }, 403);
|
|
13442
13896
|
}
|
|
13443
|
-
cookie.setCookie(c,
|
|
13897
|
+
cookie.setCookie(c, chunkFXZSZ7C7_cjs.TENANT_COOKIE, slug, {
|
|
13444
13898
|
path: "/",
|
|
13445
13899
|
httpOnly: true,
|
|
13446
13900
|
sameSite: "Lax",
|
|
@@ -13457,7 +13911,7 @@ function createTenantAdminRoutes() {
|
|
|
13457
13911
|
if (!user) return c.redirect("/auth/login");
|
|
13458
13912
|
const token = c.req.query("token") ?? "";
|
|
13459
13913
|
try {
|
|
13460
|
-
const { slug } = await new
|
|
13914
|
+
const { slug } = await new chunkBDQOPRA3_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
|
|
13461
13915
|
return c.redirect(`/admin/tenants/${slug}/members?message=Invitation accepted`);
|
|
13462
13916
|
} catch (error) {
|
|
13463
13917
|
const message = error instanceof Error ? error.message : "Failed to accept invitation";
|
|
@@ -13485,7 +13939,7 @@ function createTenantAdminRoutes() {
|
|
|
13485
13939
|
const userId = c.req.param("userId");
|
|
13486
13940
|
const target = await db.prepare("SELECT id, email FROM auth_user WHERE id = ?").bind(userId).first();
|
|
13487
13941
|
if (!target?.id) return c.redirect("/admin/users?message=User not found&type=error");
|
|
13488
|
-
const svc = new
|
|
13942
|
+
const svc = new chunkBDQOPRA3_cjs.TenantService(db);
|
|
13489
13943
|
const [memberships, allTenants] = await Promise.all([svc.listUserMemberships(userId), svc.listTenants()]);
|
|
13490
13944
|
const memberSlugs = new Set(memberships.map((m) => m.slug));
|
|
13491
13945
|
const availableTenants = allTenants.filter((t) => t.status === "active" && !memberSlugs.has(t.slug)).map((t) => ({ slug: t.slug, name: t.name }));
|
|
@@ -13510,10 +13964,10 @@ function createTenantAdminRoutes() {
|
|
|
13510
13964
|
const slug = String(form.get("slug") ?? "").trim().toLowerCase();
|
|
13511
13965
|
const role = String(form.get("role") ?? "viewer");
|
|
13512
13966
|
const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
|
|
13513
|
-
if (!
|
|
13967
|
+
if (!chunkBDQOPRA3_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
|
|
13514
13968
|
const target = await db.prepare("SELECT email FROM auth_user WHERE id = ?").bind(userId).first();
|
|
13515
13969
|
if (!target) throw new Error("User not found");
|
|
13516
|
-
const svc = new
|
|
13970
|
+
const svc = new chunkBDQOPRA3_cjs.TenantService(db);
|
|
13517
13971
|
if (!await svc.getTenantBySlug(slug)) throw new Error("Tenant not found");
|
|
13518
13972
|
if (await svc.isMember(userId, slug)) throw new Error(`Already a member of '${slug}'`);
|
|
13519
13973
|
await svc.addMember(slug, userId, role, target.email ?? null);
|
|
@@ -13532,7 +13986,7 @@ function createTenantAdminRoutes() {
|
|
|
13532
13986
|
const form = await c.req.formData();
|
|
13533
13987
|
const role = String(form.get("role") ?? "");
|
|
13534
13988
|
const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
|
|
13535
|
-
await new
|
|
13989
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).setMemberRole(slug, userId, role);
|
|
13536
13990
|
return c.redirect(`${redirectTo}?message=Role updated`);
|
|
13537
13991
|
} catch (error) {
|
|
13538
13992
|
const message = error instanceof Error ? error.message : "Failed to update role";
|
|
@@ -13547,7 +14001,7 @@ function createTenantAdminRoutes() {
|
|
|
13547
14001
|
try {
|
|
13548
14002
|
const form = await c.req.formData();
|
|
13549
14003
|
const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
|
|
13550
|
-
await new
|
|
14004
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).removeMember(slug, userId);
|
|
13551
14005
|
return c.redirect(`${redirectTo}?message=Removed from ${encodeURIComponent(slug)}`);
|
|
13552
14006
|
} catch (error) {
|
|
13553
14007
|
const message = error instanceof Error ? error.message : "Failed to remove membership";
|
|
@@ -13562,7 +14016,7 @@ function createTenantAdminRoutes() {
|
|
|
13562
14016
|
return c.html(renderTenantsInactive({ user: userShape(cur), version }));
|
|
13563
14017
|
}
|
|
13564
14018
|
const roleName = c.req.param("roleName");
|
|
13565
|
-
const assignments = await new
|
|
14019
|
+
const assignments = await new chunkBDQOPRA3_cjs.TenantService(db).listAssignmentsByRole(roleName);
|
|
13566
14020
|
return c.html(renderRoleUsage({ roleName, assignments, user: userShape(cur), version }));
|
|
13567
14021
|
});
|
|
13568
14022
|
routes2.get("/", async (c) => {
|
|
@@ -13572,7 +14026,7 @@ function createTenantAdminRoutes() {
|
|
|
13572
14026
|
if (!await isMultiTenantActive(db)) {
|
|
13573
14027
|
return c.html(renderTenantsInactive({ user: userShape(user), version }));
|
|
13574
14028
|
}
|
|
13575
|
-
const svc = new
|
|
14029
|
+
const svc = new chunkBDQOPRA3_cjs.TenantService(db);
|
|
13576
14030
|
await svc.ensureDefaultTenant();
|
|
13577
14031
|
const tenants = await svc.listTenants();
|
|
13578
14032
|
const [docRes, memberRes] = await db.batch([
|
|
@@ -13611,7 +14065,7 @@ function createTenantAdminRoutes() {
|
|
|
13611
14065
|
formEntries = Object.fromEntries(form.entries());
|
|
13612
14066
|
const validated = tenantFormSchema.parse(formEntries);
|
|
13613
14067
|
if (!validated.slug) throw new zod.z.ZodError([{ code: "custom", message: "Slug is required", path: ["slug"] }]);
|
|
13614
|
-
const svc = new
|
|
14068
|
+
const svc = new chunkBDQOPRA3_cjs.TenantService(db);
|
|
13615
14069
|
await svc.createTenant({
|
|
13616
14070
|
name: validated.name,
|
|
13617
14071
|
slug: validated.slug,
|
|
@@ -13636,7 +14090,7 @@ function createTenantAdminRoutes() {
|
|
|
13636
14090
|
if (!await isMultiTenantActive(db)) {
|
|
13637
14091
|
return c.html(renderTenantsInactive({ user: userShape(user), version }));
|
|
13638
14092
|
}
|
|
13639
|
-
const tenant = await new
|
|
14093
|
+
const tenant = await new chunkBDQOPRA3_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
|
|
13640
14094
|
if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
|
|
13641
14095
|
return c.html(renderTenantForm({ tenant, isEdit: true, user: userShape(user), version }));
|
|
13642
14096
|
});
|
|
@@ -13646,7 +14100,7 @@ function createTenantAdminRoutes() {
|
|
|
13646
14100
|
const version = c.get("appVersion");
|
|
13647
14101
|
const slug = c.req.param("slug");
|
|
13648
14102
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
13649
|
-
const svc = new
|
|
14103
|
+
const svc = new chunkBDQOPRA3_cjs.TenantService(db);
|
|
13650
14104
|
try {
|
|
13651
14105
|
const form = await c.req.formData();
|
|
13652
14106
|
const validated = tenantFormSchema.parse(Object.fromEntries(form.entries()));
|
|
@@ -13671,7 +14125,7 @@ function createTenantAdminRoutes() {
|
|
|
13671
14125
|
const slug = c.req.param("slug");
|
|
13672
14126
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
13673
14127
|
try {
|
|
13674
|
-
await new
|
|
14128
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).deleteTenant(slug);
|
|
13675
14129
|
return c.redirect("/admin/tenants?message=Tenant deleted successfully");
|
|
13676
14130
|
} catch (error) {
|
|
13677
14131
|
const message = error instanceof Error ? error.message : "Failed to delete tenant";
|
|
@@ -13686,7 +14140,7 @@ function createTenantAdminRoutes() {
|
|
|
13686
14140
|
return c.html(renderTenantsInactive({ user: userShape(user), version }));
|
|
13687
14141
|
}
|
|
13688
14142
|
const slug = c.req.param("slug");
|
|
13689
|
-
const svc = new
|
|
14143
|
+
const svc = new chunkBDQOPRA3_cjs.TenantService(db);
|
|
13690
14144
|
const tenant = await svc.getTenantBySlug(slug);
|
|
13691
14145
|
if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
|
|
13692
14146
|
const [members, invitations] = await Promise.all([svc.listMembers(slug), svc.listInvitations(slug)]);
|
|
@@ -13712,7 +14166,7 @@ function createTenantAdminRoutes() {
|
|
|
13712
14166
|
const form = await c.req.formData();
|
|
13713
14167
|
const email = String(form.get("email") ?? "");
|
|
13714
14168
|
const role = String(form.get("role") ?? "viewer");
|
|
13715
|
-
await new
|
|
14169
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).addMemberByEmail(slug, email, role);
|
|
13716
14170
|
return c.redirect(`/admin/tenants/${slug}/members?message=Member added`);
|
|
13717
14171
|
} catch (error) {
|
|
13718
14172
|
const message = error instanceof Error ? error.message : "Failed to add member";
|
|
@@ -13727,7 +14181,7 @@ function createTenantAdminRoutes() {
|
|
|
13727
14181
|
try {
|
|
13728
14182
|
const form = await c.req.formData();
|
|
13729
14183
|
const role = String(form.get("role") ?? "");
|
|
13730
|
-
await new
|
|
14184
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).setMemberRole(slug, userId, role);
|
|
13731
14185
|
return c.redirect(`/admin/tenants/${slug}/members?message=Role updated`);
|
|
13732
14186
|
} catch (error) {
|
|
13733
14187
|
const message = error instanceof Error ? error.message : "Failed to update role";
|
|
@@ -13740,7 +14194,7 @@ function createTenantAdminRoutes() {
|
|
|
13740
14194
|
const userId = c.req.param("userId");
|
|
13741
14195
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
13742
14196
|
try {
|
|
13743
|
-
await new
|
|
14197
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).removeMember(slug, userId);
|
|
13744
14198
|
return c.redirect(`/admin/tenants/${slug}/members?message=Member removed`);
|
|
13745
14199
|
} catch (error) {
|
|
13746
14200
|
const message = error instanceof Error ? error.message : "Failed to remove member";
|
|
@@ -13756,12 +14210,12 @@ function createTenantAdminRoutes() {
|
|
|
13756
14210
|
const form = await c.req.formData();
|
|
13757
14211
|
const email = String(form.get("email") ?? "");
|
|
13758
14212
|
const role = String(form.get("role") ?? "viewer");
|
|
13759
|
-
const token = await new
|
|
14213
|
+
const token = await new chunkBDQOPRA3_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
|
|
13760
14214
|
const origin = c.req.header("origin") || new URL(c.req.url).origin;
|
|
13761
14215
|
const acceptUrl = `${origin}/join/invite?token=${encodeURIComponent(token)}`;
|
|
13762
14216
|
let note;
|
|
13763
14217
|
let noteType = "";
|
|
13764
|
-
const svc2 =
|
|
14218
|
+
const svc2 = chunkBDQOPRA3_cjs.hasEmailService() ? chunkBDQOPRA3_cjs.getEmailService() : null;
|
|
13765
14219
|
const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
|
|
13766
14220
|
if (hasRealProvider) {
|
|
13767
14221
|
const result = await svc2.send({
|
|
@@ -13802,7 +14256,7 @@ function createTenantAdminRoutes() {
|
|
|
13802
14256
|
WHERE i.id = ? AND t.slug = ? AND i.status = 'pending'`
|
|
13803
14257
|
).bind(id, slug).first();
|
|
13804
14258
|
if (!inv) throw new Error("Invitation not found or already used");
|
|
13805
|
-
const svc2 =
|
|
14259
|
+
const svc2 = chunkBDQOPRA3_cjs.hasEmailService() ? chunkBDQOPRA3_cjs.getEmailService() : null;
|
|
13806
14260
|
const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
|
|
13807
14261
|
if (!hasRealProvider) throw new Error("No email plugin active");
|
|
13808
14262
|
const origin = c.req.header("origin") || new URL(c.req.url).origin;
|
|
@@ -13827,7 +14281,7 @@ function createTenantAdminRoutes() {
|
|
|
13827
14281
|
const id = c.req.param("id");
|
|
13828
14282
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
13829
14283
|
try {
|
|
13830
|
-
await new
|
|
14284
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).revokeInvitation(slug, id);
|
|
13831
14285
|
return c.redirect(`/admin/tenants/${slug}/members?message=Invitation revoked`);
|
|
13832
14286
|
} catch (error) {
|
|
13833
14287
|
const message = error instanceof Error ? error.message : "Failed to revoke invitation";
|
|
@@ -14057,7 +14511,7 @@ function createJoinRoutes() {
|
|
|
14057
14511
|
if (existing) return rerender("An account with this email already exists. Please sign in instead.");
|
|
14058
14512
|
try {
|
|
14059
14513
|
const userId = crypto.randomUUID();
|
|
14060
|
-
const passwordHash = await
|
|
14514
|
+
const passwordHash = await chunkZBDDZYA3_cjs.AuthManager.hashPassword(password);
|
|
14061
14515
|
const now = Date.now();
|
|
14062
14516
|
const nowSec = Math.floor(now / 1e3);
|
|
14063
14517
|
await db.batch([
|
|
@@ -14070,8 +14524,8 @@ function createJoinRoutes() {
|
|
|
14070
14524
|
VALUES (?, ?, ?, 'credential', ?, ?, ?)`
|
|
14071
14525
|
).bind(`cred-${userId}`, userId, userId, passwordHash, nowSec, nowSec)
|
|
14072
14526
|
]);
|
|
14073
|
-
await new
|
|
14074
|
-
const auth =
|
|
14527
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
|
|
14528
|
+
const auth = chunkKMCLNO4K_cjs.createAuth(c.env);
|
|
14075
14529
|
const origin = new URL(c.req.url).origin;
|
|
14076
14530
|
const baReq = new Request(`${origin}/auth/sign-in/email`, {
|
|
14077
14531
|
method: "POST",
|
|
@@ -14126,7 +14580,7 @@ function createJoinRoutes() {
|
|
|
14126
14580
|
version
|
|
14127
14581
|
}), 400);
|
|
14128
14582
|
try {
|
|
14129
|
-
const auth =
|
|
14583
|
+
const auth = chunkKMCLNO4K_cjs.createAuth(c.env);
|
|
14130
14584
|
const origin = new URL(c.req.url).origin;
|
|
14131
14585
|
const baReq = new Request(`${origin}/auth/sign-in/email`, {
|
|
14132
14586
|
method: "POST",
|
|
@@ -14138,7 +14592,7 @@ function createJoinRoutes() {
|
|
|
14138
14592
|
const baBody = await baRes.json();
|
|
14139
14593
|
const userId = baBody?.user?.id;
|
|
14140
14594
|
if (!userId) return rerender("Sign-in succeeded but could not read user ID.");
|
|
14141
|
-
await new
|
|
14595
|
+
await new chunkBDQOPRA3_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
|
|
14142
14596
|
const headers = new Headers({ Location: "/admin?message=Welcome! You have joined " + encodeURIComponent(inv.tenantName) });
|
|
14143
14597
|
copyBaCookies(baRes, headers);
|
|
14144
14598
|
return new Response(null, { status: 302, headers });
|
|
@@ -14152,7 +14606,7 @@ function createJoinRoutes() {
|
|
|
14152
14606
|
|
|
14153
14607
|
// src/plugins/core-plugins/multi-tenant-plugin/index.ts
|
|
14154
14608
|
var TENANT_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"/></svg>`;
|
|
14155
|
-
var multiTenantPlugin =
|
|
14609
|
+
var multiTenantPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
14156
14610
|
id: manifest_default2.id,
|
|
14157
14611
|
version: "1.0.0",
|
|
14158
14612
|
name: manifest_default2.name,
|
|
@@ -14167,30 +14621,30 @@ var multiTenantPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
14167
14621
|
{ label: "Tenants", path: "/admin/tenants", icon: TENANT_ICON, order: 80 }
|
|
14168
14622
|
],
|
|
14169
14623
|
activate: async () => {
|
|
14170
|
-
|
|
14624
|
+
chunkFXZSZ7C7_cjs.invalidateTenantCache();
|
|
14171
14625
|
console.info("\u2705 Multi-Tenant plugin activated");
|
|
14172
14626
|
},
|
|
14173
14627
|
deactivate: async () => {
|
|
14174
|
-
|
|
14628
|
+
chunkFXZSZ7C7_cjs.invalidateTenantCache();
|
|
14175
14629
|
console.info("\u274C Multi-Tenant plugin deactivated");
|
|
14176
14630
|
}
|
|
14177
14631
|
});
|
|
14178
14632
|
var routes = new hono.Hono();
|
|
14179
|
-
routes.use("*",
|
|
14180
|
-
routes.use("*",
|
|
14633
|
+
routes.use("*", chunkZBDDZYA3_cjs.requireAuth());
|
|
14634
|
+
routes.use("*", chunkZBDDZYA3_cjs.requireRole(["admin", "editor"]));
|
|
14181
14635
|
routes.get("/:rootId", async (c) => {
|
|
14182
14636
|
const { rootId } = c.req.param();
|
|
14183
14637
|
const db = c.env.DB;
|
|
14184
|
-
const scope = await
|
|
14638
|
+
const scope = await chunkBDQOPRA3_cjs.resolveDocScope(c, db, { rootId });
|
|
14185
14639
|
if (!scope) {
|
|
14186
14640
|
return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Document not found.</p>', 404);
|
|
14187
14641
|
}
|
|
14188
14642
|
if (!scope.docType?.settings?.versioning) {
|
|
14189
14643
|
return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Versioning not enabled for this type.</p>', 404);
|
|
14190
14644
|
}
|
|
14191
|
-
const denied = await
|
|
14645
|
+
const denied = await chunkBDQOPRA3_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
|
|
14192
14646
|
if (denied) return denied;
|
|
14193
|
-
const repo = new
|
|
14647
|
+
const repo = new chunkBDQOPRA3_cjs.DocumentRepository(db, scope.tenantId);
|
|
14194
14648
|
const versions = await repo.getVersionHistory(rootId);
|
|
14195
14649
|
const safeRootIdAttr = chunkMNWKYY5E_cjs.escapeHtml(rootId);
|
|
14196
14650
|
const rows = versions.map((v) => {
|
|
@@ -14283,14 +14737,14 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
|
|
|
14283
14737
|
const { rootId, versionNumber } = c.req.param();
|
|
14284
14738
|
const db = c.env.DB;
|
|
14285
14739
|
const user = c.get("user");
|
|
14286
|
-
const scope = await
|
|
14740
|
+
const scope = await chunkBDQOPRA3_cjs.resolveDocScope(c, db, { rootId });
|
|
14287
14741
|
if (!scope) {
|
|
14288
14742
|
return c.json({ error: "Document not found" }, 404);
|
|
14289
14743
|
}
|
|
14290
14744
|
if (!scope.docType?.settings?.versioning) {
|
|
14291
14745
|
return c.json({ error: "Versioning not enabled for this type" }, 404);
|
|
14292
14746
|
}
|
|
14293
|
-
const denied = await
|
|
14747
|
+
const denied = await chunkBDQOPRA3_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
|
|
14294
14748
|
if (denied) return denied;
|
|
14295
14749
|
const row = await db.prepare("SELECT * FROM documents WHERE root_id = ? AND tenant_id = ? AND version_number = ? LIMIT 1").bind(rootId, scope.tenantId, Number(versionNumber)).first();
|
|
14296
14750
|
if (!row) {
|
|
@@ -14313,7 +14767,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
|
|
|
14313
14767
|
var routes_default = routes;
|
|
14314
14768
|
|
|
14315
14769
|
// src/plugins/core-plugins/versioning-plugin/index.ts
|
|
14316
|
-
var versioningPlugin =
|
|
14770
|
+
var versioningPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
14317
14771
|
id: "versioning",
|
|
14318
14772
|
version: "1.0.0",
|
|
14319
14773
|
name: "Versioning",
|
|
@@ -14390,8 +14844,8 @@ function createMagicLinkAuthPlugin() {
|
|
|
14390
14844
|
const baseUrl = new URL(c.req.url).origin;
|
|
14391
14845
|
const magicLink = `${baseUrl}/auth/magic-link/verify?token=${token}`;
|
|
14392
14846
|
try {
|
|
14393
|
-
if (
|
|
14394
|
-
await
|
|
14847
|
+
if (chunkBDQOPRA3_cjs.hasEmailService()) {
|
|
14848
|
+
await chunkBDQOPRA3_cjs.getEmailService().send({
|
|
14395
14849
|
to: normalizedEmail,
|
|
14396
14850
|
subject: "Your Magic Link to Sign In",
|
|
14397
14851
|
flow: "magic-link",
|
|
@@ -14468,19 +14922,19 @@ function createMagicLinkAuthPlugin() {
|
|
|
14468
14922
|
SET used = 1, used_at = ?
|
|
14469
14923
|
WHERE id = ?
|
|
14470
14924
|
`).bind(Date.now(), magicLink.id).run();
|
|
14471
|
-
const tokenTtl = await
|
|
14472
|
-
const jwtToken = await
|
|
14925
|
+
const tokenTtl = await chunkZBDDZYA3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
14926
|
+
const jwtToken = await chunkZBDDZYA3_cjs.AuthManager.generateToken(
|
|
14473
14927
|
user.id,
|
|
14474
14928
|
user.email,
|
|
14475
14929
|
user.role,
|
|
14476
14930
|
c.env.JWT_SECRET,
|
|
14477
14931
|
tokenTtl
|
|
14478
14932
|
);
|
|
14479
|
-
|
|
14933
|
+
chunkZBDDZYA3_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
|
|
14480
14934
|
await db.prepare(`
|
|
14481
14935
|
UPDATE auth_user SET last_login_at = ? WHERE id = ?
|
|
14482
14936
|
`).bind(Date.now(), user.id).run();
|
|
14483
|
-
|
|
14937
|
+
chunkBDQOPRA3_cjs.dispatchHookEvent(
|
|
14484
14938
|
c,
|
|
14485
14939
|
"auth:magic-link:consumed",
|
|
14486
14940
|
{ user: { id: user.id, email: user.email, role: user.role } },
|
|
@@ -14965,7 +15419,7 @@ async function warmCollections(db) {
|
|
|
14965
15419
|
const collectionCache = chunkYA3TJ65D_cjs.getCacheService(config);
|
|
14966
15420
|
let count = 0;
|
|
14967
15421
|
try {
|
|
14968
|
-
const results =
|
|
15422
|
+
const results = chunkFXZSZ7C7_cjs.getCollectionRegistry().listActive().map(chunkFXZSZ7C7_cjs.collectionRecordToRow);
|
|
14969
15423
|
for (const collection of results) {
|
|
14970
15424
|
const key = collectionCache.generateKey("item", collection.id);
|
|
14971
15425
|
await collectionCache.set(key, collection);
|
|
@@ -15236,7 +15690,7 @@ function renderCacheDashboard(data) {
|
|
|
15236
15690
|
</script>
|
|
15237
15691
|
|
|
15238
15692
|
<!-- Confirmation Dialogs -->
|
|
15239
|
-
${
|
|
15693
|
+
${chunkBDQOPRA3_cjs.renderConfirmationDialog({
|
|
15240
15694
|
id: "clear-all-cache-confirm",
|
|
15241
15695
|
title: "Clear All Cache",
|
|
15242
15696
|
message: "Are you sure you want to clear all cache entries? This cannot be undone.",
|
|
@@ -15247,7 +15701,7 @@ function renderCacheDashboard(data) {
|
|
|
15247
15701
|
onConfirm: "performClearAllCaches()"
|
|
15248
15702
|
})}
|
|
15249
15703
|
|
|
15250
|
-
${
|
|
15704
|
+
${chunkBDQOPRA3_cjs.renderConfirmationDialog({
|
|
15251
15705
|
id: "clear-namespace-cache-confirm",
|
|
15252
15706
|
title: "Clear Namespace Cache",
|
|
15253
15707
|
message: "Clear cache for this namespace?",
|
|
@@ -15258,7 +15712,7 @@ function renderCacheDashboard(data) {
|
|
|
15258
15712
|
onConfirm: "performClearNamespaceCache()"
|
|
15259
15713
|
})}
|
|
15260
15714
|
|
|
15261
|
-
${
|
|
15715
|
+
${chunkBDQOPRA3_cjs.getConfirmationDialogScript()}
|
|
15262
15716
|
`;
|
|
15263
15717
|
const layoutData = {
|
|
15264
15718
|
title: "Cache System",
|
|
@@ -15524,7 +15978,7 @@ app.get("/", async (c) => {
|
|
|
15524
15978
|
const totalRequests = totalHits + totalMisses;
|
|
15525
15979
|
const overallHitRate = totalRequests > 0 ? totalHits / totalRequests * 100 : 0;
|
|
15526
15980
|
const DEFAULT_TTL = chunkYA3TJ65D_cjs.CACHE_CONFIGS.api?.ttl ?? 300;
|
|
15527
|
-
const collections =
|
|
15981
|
+
const collections = chunkFXZSZ7C7_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
|
|
15528
15982
|
const cacheOverride = r.cache;
|
|
15529
15983
|
const cacheEnabled = cacheOverride?.enabled !== false;
|
|
15530
15984
|
const hasCustomTtl = typeof cacheOverride?.ttl === "number";
|
|
@@ -16061,16 +16515,17 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
|
16061
16515
|
// src/app.ts
|
|
16062
16516
|
function createSonicJSApp(config = {}) {
|
|
16063
16517
|
const app2 = new hono.Hono();
|
|
16064
|
-
const appVersion = config.version ||
|
|
16518
|
+
const appVersion = config.version || chunkPK3ODTAL_cjs.getCoreVersion();
|
|
16065
16519
|
const appName = config.name || "SonicJS AI";
|
|
16066
|
-
const hookSystem = new
|
|
16520
|
+
const hookSystem = new chunkFVI3H6RG_cjs.HookSystemImpl();
|
|
16067
16521
|
chunkJ6JTWD2A_cjs.setHookSystem(hookSystem);
|
|
16068
16522
|
const magicLinkPlugin = createMagicLinkAuthPlugin();
|
|
16069
16523
|
const corePluginsBeforeCatchAll = [
|
|
16070
16524
|
securityAuditPlugin,
|
|
16525
|
+
apiKeysPlugin,
|
|
16071
16526
|
aiSearchPlugin,
|
|
16072
16527
|
oauthProvidersPlugin,
|
|
16073
|
-
|
|
16528
|
+
chunkBDQOPRA3_cjs.userProfilesPlugin,
|
|
16074
16529
|
otpLoginPlugin,
|
|
16075
16530
|
analyticsPlugin,
|
|
16076
16531
|
stripePlugin,
|
|
@@ -16080,23 +16535,23 @@ function createSonicJSApp(config = {}) {
|
|
|
16080
16535
|
shortcodesPlugin,
|
|
16081
16536
|
helloWorldPlugin,
|
|
16082
16537
|
multiTenantPlugin,
|
|
16083
|
-
|
|
16538
|
+
chunkBDQOPRA3_cjs.lexicalEditorPlugin,
|
|
16084
16539
|
versioningPlugin
|
|
16085
16540
|
];
|
|
16086
16541
|
const corePluginsAfterCatchAll = [emailPluginV3, magicLinkPlugin, emailReconciliationPlugin];
|
|
16087
|
-
const wirePlugins =
|
|
16542
|
+
const wirePlugins = chunkFVI3H6RG_cjs.createPluginWirer(
|
|
16088
16543
|
() => [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []],
|
|
16089
16544
|
// The capability-gated `ctx.cap.email` resolves to the app EmailService, which
|
|
16090
16545
|
// is initialized (below) just before wiring on the first request.
|
|
16091
16546
|
() => ({
|
|
16092
16547
|
hooks: hookSystem,
|
|
16093
16548
|
env: firstRequestEnv,
|
|
16094
|
-
providers: { email: () =>
|
|
16549
|
+
providers: { email: () => chunkBDQOPRA3_cjs.getEmailService() }
|
|
16095
16550
|
})
|
|
16096
16551
|
);
|
|
16097
16552
|
let firstRequestEnv;
|
|
16098
16553
|
const initEmailService = async (env = {}) => {
|
|
16099
|
-
if (
|
|
16554
|
+
if (chunkBDQOPRA3_cjs.hasEmailService()) return;
|
|
16100
16555
|
let provider;
|
|
16101
16556
|
let defaultFrom = config.email?.from;
|
|
16102
16557
|
let defaultReplyTo;
|
|
@@ -16131,14 +16586,14 @@ function createSonicJSApp(config = {}) {
|
|
|
16131
16586
|
}
|
|
16132
16587
|
}
|
|
16133
16588
|
defaultFrom = defaultFrom || env.DEFAULT_FROM_EMAIL || "noreply@sonicjs.local";
|
|
16134
|
-
|
|
16589
|
+
chunkBDQOPRA3_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
|
|
16135
16590
|
};
|
|
16136
16591
|
app2.use("*", async (c, next) => {
|
|
16137
16592
|
c.set("appVersion", appVersion);
|
|
16138
16593
|
await next();
|
|
16139
16594
|
});
|
|
16140
|
-
app2.use("*",
|
|
16141
|
-
app2.use("*",
|
|
16595
|
+
app2.use("*", chunkZBDDZYA3_cjs.metricsMiddleware());
|
|
16596
|
+
app2.use("*", chunkZBDDZYA3_cjs.bootstrapMiddleware(config));
|
|
16142
16597
|
const boot = async (env) => {
|
|
16143
16598
|
if (config.plugins?.disableAll) return;
|
|
16144
16599
|
firstRequestEnv = env;
|
|
@@ -16176,13 +16631,13 @@ function createSonicJSApp(config = {}) {
|
|
|
16176
16631
|
allowHeaders: ["Content-Type", "Authorization", "X-API-Key"],
|
|
16177
16632
|
credentials: true
|
|
16178
16633
|
}));
|
|
16179
|
-
app2.use("*",
|
|
16180
|
-
app2.use("*",
|
|
16634
|
+
app2.use("*", chunkZBDDZYA3_cjs.securityHeadersMiddleware());
|
|
16635
|
+
app2.use("*", chunkZBDDZYA3_cjs.csrfProtection());
|
|
16181
16636
|
app2.use("*", async (c, next) => {
|
|
16182
16637
|
try {
|
|
16183
16638
|
const reqUrl = new URL(c.req.url);
|
|
16184
16639
|
const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
|
|
16185
|
-
const auth =
|
|
16640
|
+
const auth = chunkKMCLNO4K_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
|
|
16186
16641
|
const session = await auth.api.getSession({ headers: c.req.raw.headers });
|
|
16187
16642
|
if (session?.user) {
|
|
16188
16643
|
const u = session.user;
|
|
@@ -16209,14 +16664,15 @@ function createSonicJSApp(config = {}) {
|
|
|
16209
16664
|
}
|
|
16210
16665
|
await next();
|
|
16211
16666
|
});
|
|
16667
|
+
app2.use("*", apiKeyAuthMiddleware());
|
|
16212
16668
|
if (config.middleware?.afterAuth) {
|
|
16213
16669
|
for (const middleware of config.middleware.afterAuth) {
|
|
16214
16670
|
app2.use("*", middleware);
|
|
16215
16671
|
}
|
|
16216
16672
|
}
|
|
16217
|
-
app2.use("*",
|
|
16218
|
-
app2.use("/admin/*",
|
|
16219
|
-
app2.use("/admin/*",
|
|
16673
|
+
app2.use("*", chunkFXZSZ7C7_cjs.tenantMiddleware());
|
|
16674
|
+
app2.use("/admin/*", chunkZBDDZYA3_cjs.requireAuth());
|
|
16675
|
+
app2.use("/admin/*", chunkZBDDZYA3_cjs.requireRbac("portal", "access"));
|
|
16220
16676
|
app2.use("/admin/*", pluginMenuMiddleware());
|
|
16221
16677
|
const NAV_LANDING = [
|
|
16222
16678
|
{ path: "/admin/content", perm: "content:read" },
|
|
@@ -16262,43 +16718,43 @@ function createSonicJSApp(config = {}) {
|
|
|
16262
16718
|
});
|
|
16263
16719
|
app2.route("/api/security-audit", apiRoutes2);
|
|
16264
16720
|
app2.route("/admin/plugins/security-audit", adminRoutes3);
|
|
16265
|
-
app2.route("/api/media",
|
|
16266
|
-
app2.route("/api/system",
|
|
16267
|
-
app2.route("/api/documents",
|
|
16268
|
-
app2.route("/api",
|
|
16269
|
-
app2.route("/admin/documents",
|
|
16270
|
-
|
|
16271
|
-
app2.route("/admin/api",
|
|
16272
|
-
app2.route("/admin/collections",
|
|
16273
|
-
app2.route("/admin/settings",
|
|
16274
|
-
app2.route("/admin/api-reference",
|
|
16721
|
+
app2.route("/api/media", chunkBDQOPRA3_cjs.api_media_default);
|
|
16722
|
+
app2.route("/api/system", chunkBDQOPRA3_cjs.api_system_default);
|
|
16723
|
+
app2.route("/api/documents", chunkBDQOPRA3_cjs.apiDocumentsRoutes);
|
|
16724
|
+
app2.route("/api", chunkBDQOPRA3_cjs.api_default);
|
|
16725
|
+
app2.route("/admin/documents", chunkBDQOPRA3_cjs.adminDocumentsRoutes);
|
|
16726
|
+
chunkFVI3H6RG_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
|
|
16727
|
+
app2.route("/admin/api", chunkBDQOPRA3_cjs.admin_api_default);
|
|
16728
|
+
app2.route("/admin/collections", chunkBDQOPRA3_cjs.adminCollectionsRoutes);
|
|
16729
|
+
app2.route("/admin/settings", chunkBDQOPRA3_cjs.adminSettingsRoutes);
|
|
16730
|
+
app2.route("/admin/api-reference", chunkBDQOPRA3_cjs.router2);
|
|
16275
16731
|
app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
|
|
16276
|
-
app2.route("/admin/content",
|
|
16277
|
-
app2.route("/admin/media",
|
|
16732
|
+
app2.route("/admin/content", chunkBDQOPRA3_cjs.admin_content_default);
|
|
16733
|
+
app2.route("/admin/media", chunkBDQOPRA3_cjs.adminMediaRoutes);
|
|
16278
16734
|
app2.use("/auth/*", securityAuditMiddleware());
|
|
16279
16735
|
if (!config.plugins?.disableAll) {
|
|
16280
|
-
|
|
16736
|
+
chunkFVI3H6RG_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
|
|
16281
16737
|
app2.route("/admin/cache", cache_default.getRoutes());
|
|
16282
16738
|
if (config.plugins?.register && config.plugins.register.length > 0) {
|
|
16283
|
-
|
|
16739
|
+
chunkFVI3H6RG_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
|
|
16284
16740
|
}
|
|
16285
16741
|
}
|
|
16286
16742
|
app2.route("/api/events", apiRoutes4);
|
|
16287
|
-
app2.route("/admin/dashboard",
|
|
16288
|
-
app2.route("/admin/plugins",
|
|
16289
|
-
app2.route("/admin/logs",
|
|
16743
|
+
app2.route("/admin/dashboard", chunkBDQOPRA3_cjs.router);
|
|
16744
|
+
app2.route("/admin/plugins", chunkBDQOPRA3_cjs.adminPluginRoutes);
|
|
16745
|
+
app2.route("/admin/logs", chunkBDQOPRA3_cjs.adminLogsRoutes);
|
|
16290
16746
|
app2.route("/admin/rbac", adminRbacRoutes);
|
|
16291
|
-
app2.route("/admin",
|
|
16292
|
-
app2.route("/auth",
|
|
16747
|
+
app2.route("/admin", chunkBDQOPRA3_cjs.userRoutes);
|
|
16748
|
+
app2.route("/auth", chunkBDQOPRA3_cjs.auth_default);
|
|
16293
16749
|
app2.on(["GET", "POST"], "/auth/*", (c) => {
|
|
16294
16750
|
const reqUrl = new URL(c.req.url);
|
|
16295
16751
|
const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
|
|
16296
|
-
const auth =
|
|
16752
|
+
const auth = chunkKMCLNO4K_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
|
|
16297
16753
|
return auth.handler(c.req.raw);
|
|
16298
16754
|
});
|
|
16299
|
-
app2.route("/",
|
|
16755
|
+
app2.route("/", chunkBDQOPRA3_cjs.test_cleanup_default);
|
|
16300
16756
|
if (!config.plugins?.disableAll) {
|
|
16301
|
-
|
|
16757
|
+
chunkFVI3H6RG_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
|
|
16302
16758
|
}
|
|
16303
16759
|
if (!config.plugins?.disableAll) {
|
|
16304
16760
|
const allMountedPlugins = [
|
|
@@ -16307,8 +16763,8 @@ function createSonicJSApp(config = {}) {
|
|
|
16307
16763
|
...corePluginsAfterCatchAll,
|
|
16308
16764
|
...config.plugins?.register ?? []
|
|
16309
16765
|
];
|
|
16310
|
-
|
|
16311
|
-
|
|
16766
|
+
chunkFVI3H6RG_cjs.setPluginMenu(allMountedPlugins.flatMap((p) => p.menu ?? []));
|
|
16767
|
+
chunkPTTFLUEX_cjs.setPluginDefinitions(allMountedPlugins);
|
|
16312
16768
|
}
|
|
16313
16769
|
app2.get("/favicon.svg", (c) => {
|
|
16314
16770
|
return new Response(faviconSvg, {
|
|
@@ -19800,7 +20256,7 @@ function createRedirectApiRoutes() {
|
|
|
19800
20256
|
});
|
|
19801
20257
|
return api;
|
|
19802
20258
|
}
|
|
19803
|
-
var redirectPlugin =
|
|
20259
|
+
var redirectPlugin = chunkPTTFLUEX_cjs.definePlugin({
|
|
19804
20260
|
id: manifest_default3.id,
|
|
19805
20261
|
version: manifest_default3.version,
|
|
19806
20262
|
name: manifest_default3.name,
|
|
@@ -19818,7 +20274,7 @@ var redirectPlugin = chunk4YRYGDCQ_cjs.definePlugin({
|
|
|
19818
20274
|
async onBoot(ctx) {
|
|
19819
20275
|
const db = ctx.env?.DB;
|
|
19820
20276
|
if (!db) return;
|
|
19821
|
-
const registry = new
|
|
20277
|
+
const registry = new chunkZBDDZYA3_cjs.DocumentTypeRegistry(db);
|
|
19822
20278
|
await registry.register({
|
|
19823
20279
|
id: "redirect",
|
|
19824
20280
|
name: "redirect",
|
|
@@ -19934,87 +20390,87 @@ function createDb(d1$1) {
|
|
|
19934
20390
|
}
|
|
19935
20391
|
|
|
19936
20392
|
// src/index.ts
|
|
19937
|
-
var VERSION =
|
|
20393
|
+
var VERSION = chunkPK3ODTAL_cjs.package_default.version;
|
|
19938
20394
|
|
|
19939
20395
|
Object.defineProperty(exports, "ROUTES_INFO", {
|
|
19940
20396
|
enumerable: true,
|
|
19941
|
-
get: function () { return
|
|
20397
|
+
get: function () { return chunkBDQOPRA3_cjs.ROUTES_INFO; }
|
|
19942
20398
|
});
|
|
19943
20399
|
Object.defineProperty(exports, "adminApiRoutes", {
|
|
19944
20400
|
enumerable: true,
|
|
19945
|
-
get: function () { return
|
|
20401
|
+
get: function () { return chunkBDQOPRA3_cjs.admin_api_default; }
|
|
19946
20402
|
});
|
|
19947
20403
|
Object.defineProperty(exports, "adminCheckboxRoutes", {
|
|
19948
20404
|
enumerable: true,
|
|
19949
|
-
get: function () { return
|
|
20405
|
+
get: function () { return chunkBDQOPRA3_cjs.adminCheckboxRoutes; }
|
|
19950
20406
|
});
|
|
19951
20407
|
Object.defineProperty(exports, "adminCollectionsRoutes", {
|
|
19952
20408
|
enumerable: true,
|
|
19953
|
-
get: function () { return
|
|
20409
|
+
get: function () { return chunkBDQOPRA3_cjs.adminCollectionsRoutes; }
|
|
19954
20410
|
});
|
|
19955
20411
|
Object.defineProperty(exports, "adminContentRoutes", {
|
|
19956
20412
|
enumerable: true,
|
|
19957
|
-
get: function () { return
|
|
20413
|
+
get: function () { return chunkBDQOPRA3_cjs.admin_content_default; }
|
|
19958
20414
|
});
|
|
19959
20415
|
Object.defineProperty(exports, "adminDashboardRoutes", {
|
|
19960
20416
|
enumerable: true,
|
|
19961
|
-
get: function () { return
|
|
20417
|
+
get: function () { return chunkBDQOPRA3_cjs.router; }
|
|
19962
20418
|
});
|
|
19963
20419
|
Object.defineProperty(exports, "adminLogsRoutes", {
|
|
19964
20420
|
enumerable: true,
|
|
19965
|
-
get: function () { return
|
|
20421
|
+
get: function () { return chunkBDQOPRA3_cjs.adminLogsRoutes; }
|
|
19966
20422
|
});
|
|
19967
20423
|
Object.defineProperty(exports, "adminMediaRoutes", {
|
|
19968
20424
|
enumerable: true,
|
|
19969
|
-
get: function () { return
|
|
20425
|
+
get: function () { return chunkBDQOPRA3_cjs.adminMediaRoutes; }
|
|
19970
20426
|
});
|
|
19971
20427
|
Object.defineProperty(exports, "adminPluginRoutes", {
|
|
19972
20428
|
enumerable: true,
|
|
19973
|
-
get: function () { return
|
|
20429
|
+
get: function () { return chunkBDQOPRA3_cjs.adminPluginRoutes; }
|
|
19974
20430
|
});
|
|
19975
20431
|
Object.defineProperty(exports, "adminSettingsRoutes", {
|
|
19976
20432
|
enumerable: true,
|
|
19977
|
-
get: function () { return
|
|
20433
|
+
get: function () { return chunkBDQOPRA3_cjs.adminSettingsRoutes; }
|
|
19978
20434
|
});
|
|
19979
20435
|
Object.defineProperty(exports, "adminUsersRoutes", {
|
|
19980
20436
|
enumerable: true,
|
|
19981
|
-
get: function () { return
|
|
20437
|
+
get: function () { return chunkBDQOPRA3_cjs.userRoutes; }
|
|
19982
20438
|
});
|
|
19983
20439
|
Object.defineProperty(exports, "apiContentCrudRoutes", {
|
|
19984
20440
|
enumerable: true,
|
|
19985
|
-
get: function () { return
|
|
20441
|
+
get: function () { return chunkBDQOPRA3_cjs.api_content_crud_default; }
|
|
19986
20442
|
});
|
|
19987
20443
|
Object.defineProperty(exports, "apiMediaRoutes", {
|
|
19988
20444
|
enumerable: true,
|
|
19989
|
-
get: function () { return
|
|
20445
|
+
get: function () { return chunkBDQOPRA3_cjs.api_media_default; }
|
|
19990
20446
|
});
|
|
19991
20447
|
Object.defineProperty(exports, "apiRoutes", {
|
|
19992
20448
|
enumerable: true,
|
|
19993
|
-
get: function () { return
|
|
20449
|
+
get: function () { return chunkBDQOPRA3_cjs.api_default; }
|
|
19994
20450
|
});
|
|
19995
20451
|
Object.defineProperty(exports, "apiSystemRoutes", {
|
|
19996
20452
|
enumerable: true,
|
|
19997
|
-
get: function () { return
|
|
20453
|
+
get: function () { return chunkBDQOPRA3_cjs.api_system_default; }
|
|
19998
20454
|
});
|
|
19999
20455
|
Object.defineProperty(exports, "authRoutes", {
|
|
20000
20456
|
enumerable: true,
|
|
20001
|
-
get: function () { return
|
|
20457
|
+
get: function () { return chunkBDQOPRA3_cjs.auth_default; }
|
|
20002
20458
|
});
|
|
20003
20459
|
Object.defineProperty(exports, "createUserProfilesPlugin", {
|
|
20004
20460
|
enumerable: true,
|
|
20005
|
-
get: function () { return
|
|
20461
|
+
get: function () { return chunkBDQOPRA3_cjs.createUserProfilesPlugin; }
|
|
20006
20462
|
});
|
|
20007
20463
|
Object.defineProperty(exports, "defineUserProfile", {
|
|
20008
20464
|
enumerable: true,
|
|
20009
|
-
get: function () { return
|
|
20465
|
+
get: function () { return chunkBDQOPRA3_cjs.defineUserProfile; }
|
|
20010
20466
|
});
|
|
20011
20467
|
Object.defineProperty(exports, "getUserProfileConfig", {
|
|
20012
20468
|
enumerable: true,
|
|
20013
|
-
get: function () { return
|
|
20469
|
+
get: function () { return chunkBDQOPRA3_cjs.getUserProfileConfig; }
|
|
20014
20470
|
});
|
|
20015
20471
|
Object.defineProperty(exports, "userProfilesPlugin", {
|
|
20016
20472
|
enumerable: true,
|
|
20017
|
-
get: function () { return
|
|
20473
|
+
get: function () { return chunkBDQOPRA3_cjs.userProfilesPlugin; }
|
|
20018
20474
|
});
|
|
20019
20475
|
Object.defineProperty(exports, "Logger", {
|
|
20020
20476
|
enumerable: true,
|
|
@@ -20170,87 +20626,87 @@ Object.defineProperty(exports, "workflowHistory", {
|
|
|
20170
20626
|
});
|
|
20171
20627
|
Object.defineProperty(exports, "AuthManager", {
|
|
20172
20628
|
enumerable: true,
|
|
20173
|
-
get: function () { return
|
|
20629
|
+
get: function () { return chunkZBDDZYA3_cjs.AuthManager; }
|
|
20174
20630
|
});
|
|
20175
20631
|
Object.defineProperty(exports, "PermissionManager", {
|
|
20176
20632
|
enumerable: true,
|
|
20177
|
-
get: function () { return
|
|
20633
|
+
get: function () { return chunkZBDDZYA3_cjs.PermissionManager; }
|
|
20178
20634
|
});
|
|
20179
20635
|
Object.defineProperty(exports, "bootstrapDocumentTypes", {
|
|
20180
20636
|
enumerable: true,
|
|
20181
|
-
get: function () { return
|
|
20637
|
+
get: function () { return chunkZBDDZYA3_cjs.bootstrapDocumentTypes; }
|
|
20182
20638
|
});
|
|
20183
20639
|
Object.defineProperty(exports, "bootstrapMiddleware", {
|
|
20184
20640
|
enumerable: true,
|
|
20185
|
-
get: function () { return
|
|
20641
|
+
get: function () { return chunkZBDDZYA3_cjs.bootstrapMiddleware; }
|
|
20186
20642
|
});
|
|
20187
20643
|
Object.defineProperty(exports, "cacheHeaders", {
|
|
20188
20644
|
enumerable: true,
|
|
20189
|
-
get: function () { return
|
|
20645
|
+
get: function () { return chunkZBDDZYA3_cjs.cacheHeaders; }
|
|
20190
20646
|
});
|
|
20191
20647
|
Object.defineProperty(exports, "compressionMiddleware", {
|
|
20192
20648
|
enumerable: true,
|
|
20193
|
-
get: function () { return
|
|
20649
|
+
get: function () { return chunkZBDDZYA3_cjs.compressionMiddleware; }
|
|
20194
20650
|
});
|
|
20195
20651
|
Object.defineProperty(exports, "detailedLoggingMiddleware", {
|
|
20196
20652
|
enumerable: true,
|
|
20197
|
-
get: function () { return
|
|
20653
|
+
get: function () { return chunkZBDDZYA3_cjs.detailedLoggingMiddleware; }
|
|
20198
20654
|
});
|
|
20199
20655
|
Object.defineProperty(exports, "getActivePlugins", {
|
|
20200
20656
|
enumerable: true,
|
|
20201
|
-
get: function () { return
|
|
20657
|
+
get: function () { return chunkZBDDZYA3_cjs.getActivePlugins; }
|
|
20202
20658
|
});
|
|
20203
20659
|
Object.defineProperty(exports, "isPluginActive", {
|
|
20204
20660
|
enumerable: true,
|
|
20205
|
-
get: function () { return
|
|
20661
|
+
get: function () { return chunkZBDDZYA3_cjs.isPluginActive; }
|
|
20206
20662
|
});
|
|
20207
20663
|
Object.defineProperty(exports, "logActivity", {
|
|
20208
20664
|
enumerable: true,
|
|
20209
|
-
get: function () { return
|
|
20665
|
+
get: function () { return chunkZBDDZYA3_cjs.logActivity; }
|
|
20210
20666
|
});
|
|
20211
20667
|
Object.defineProperty(exports, "loggingMiddleware", {
|
|
20212
20668
|
enumerable: true,
|
|
20213
|
-
get: function () { return
|
|
20669
|
+
get: function () { return chunkZBDDZYA3_cjs.loggingMiddleware; }
|
|
20214
20670
|
});
|
|
20215
20671
|
Object.defineProperty(exports, "optionalAuth", {
|
|
20216
20672
|
enumerable: true,
|
|
20217
|
-
get: function () { return
|
|
20673
|
+
get: function () { return chunkZBDDZYA3_cjs.optionalAuth; }
|
|
20218
20674
|
});
|
|
20219
20675
|
Object.defineProperty(exports, "performanceLoggingMiddleware", {
|
|
20220
20676
|
enumerable: true,
|
|
20221
|
-
get: function () { return
|
|
20677
|
+
get: function () { return chunkZBDDZYA3_cjs.performanceLoggingMiddleware; }
|
|
20222
20678
|
});
|
|
20223
20679
|
Object.defineProperty(exports, "requireActivePlugin", {
|
|
20224
20680
|
enumerable: true,
|
|
20225
|
-
get: function () { return
|
|
20681
|
+
get: function () { return chunkZBDDZYA3_cjs.requireActivePlugin; }
|
|
20226
20682
|
});
|
|
20227
20683
|
Object.defineProperty(exports, "requireActivePlugins", {
|
|
20228
20684
|
enumerable: true,
|
|
20229
|
-
get: function () { return
|
|
20685
|
+
get: function () { return chunkZBDDZYA3_cjs.requireActivePlugins; }
|
|
20230
20686
|
});
|
|
20231
20687
|
Object.defineProperty(exports, "requireAnyPermission", {
|
|
20232
20688
|
enumerable: true,
|
|
20233
|
-
get: function () { return
|
|
20689
|
+
get: function () { return chunkZBDDZYA3_cjs.requireAnyPermission; }
|
|
20234
20690
|
});
|
|
20235
20691
|
Object.defineProperty(exports, "requireAuth", {
|
|
20236
20692
|
enumerable: true,
|
|
20237
|
-
get: function () { return
|
|
20693
|
+
get: function () { return chunkZBDDZYA3_cjs.requireAuth; }
|
|
20238
20694
|
});
|
|
20239
20695
|
Object.defineProperty(exports, "requirePermission", {
|
|
20240
20696
|
enumerable: true,
|
|
20241
|
-
get: function () { return
|
|
20697
|
+
get: function () { return chunkZBDDZYA3_cjs.requirePermission; }
|
|
20242
20698
|
});
|
|
20243
20699
|
Object.defineProperty(exports, "requireRole", {
|
|
20244
20700
|
enumerable: true,
|
|
20245
|
-
get: function () { return
|
|
20701
|
+
get: function () { return chunkZBDDZYA3_cjs.requireRole; }
|
|
20246
20702
|
});
|
|
20247
20703
|
Object.defineProperty(exports, "securityHeaders", {
|
|
20248
20704
|
enumerable: true,
|
|
20249
|
-
get: function () { return
|
|
20705
|
+
get: function () { return chunkZBDDZYA3_cjs.securityHeadersMiddleware; }
|
|
20250
20706
|
});
|
|
20251
20707
|
Object.defineProperty(exports, "securityLoggingMiddleware", {
|
|
20252
20708
|
enumerable: true,
|
|
20253
|
-
get: function () { return
|
|
20709
|
+
get: function () { return chunkZBDDZYA3_cjs.securityLoggingMiddleware; }
|
|
20254
20710
|
});
|
|
20255
20711
|
Object.defineProperty(exports, "RbacService", {
|
|
20256
20712
|
enumerable: true,
|
|
@@ -20258,35 +20714,35 @@ Object.defineProperty(exports, "RbacService", {
|
|
|
20258
20714
|
});
|
|
20259
20715
|
Object.defineProperty(exports, "PluginBootstrapService", {
|
|
20260
20716
|
enumerable: true,
|
|
20261
|
-
get: function () { return
|
|
20717
|
+
get: function () { return chunkFXZSZ7C7_cjs.PluginBootstrapService; }
|
|
20262
20718
|
});
|
|
20263
20719
|
Object.defineProperty(exports, "PluginServiceClass", {
|
|
20264
20720
|
enumerable: true,
|
|
20265
|
-
get: function () { return
|
|
20721
|
+
get: function () { return chunkFXZSZ7C7_cjs.PluginService; }
|
|
20266
20722
|
});
|
|
20267
20723
|
Object.defineProperty(exports, "getAvailableCollectionNames", {
|
|
20268
20724
|
enumerable: true,
|
|
20269
|
-
get: function () { return
|
|
20725
|
+
get: function () { return chunkFXZSZ7C7_cjs.getAvailableCollectionNames; }
|
|
20270
20726
|
});
|
|
20271
20727
|
Object.defineProperty(exports, "loadCollectionConfig", {
|
|
20272
20728
|
enumerable: true,
|
|
20273
|
-
get: function () { return
|
|
20729
|
+
get: function () { return chunkFXZSZ7C7_cjs.loadCollectionConfig; }
|
|
20274
20730
|
});
|
|
20275
20731
|
Object.defineProperty(exports, "loadCollectionConfigs", {
|
|
20276
20732
|
enumerable: true,
|
|
20277
|
-
get: function () { return
|
|
20733
|
+
get: function () { return chunkFXZSZ7C7_cjs.loadCollectionConfigs; }
|
|
20278
20734
|
});
|
|
20279
20735
|
Object.defineProperty(exports, "registerCollections", {
|
|
20280
20736
|
enumerable: true,
|
|
20281
|
-
get: function () { return
|
|
20737
|
+
get: function () { return chunkFXZSZ7C7_cjs.registerCollections; }
|
|
20282
20738
|
});
|
|
20283
20739
|
Object.defineProperty(exports, "validateCollectionConfig", {
|
|
20284
20740
|
enumerable: true,
|
|
20285
|
-
get: function () { return
|
|
20741
|
+
get: function () { return chunkFXZSZ7C7_cjs.validateCollectionConfig; }
|
|
20286
20742
|
});
|
|
20287
20743
|
Object.defineProperty(exports, "MigrationService", {
|
|
20288
20744
|
enumerable: true,
|
|
20289
|
-
get: function () { return
|
|
20745
|
+
get: function () { return chunk4AB3PQHF_cjs.MigrationService; }
|
|
20290
20746
|
});
|
|
20291
20747
|
Object.defineProperty(exports, "renderFilterBar", {
|
|
20292
20748
|
enumerable: true,
|
|
@@ -20326,99 +20782,99 @@ Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
|
|
|
20326
20782
|
});
|
|
20327
20783
|
Object.defineProperty(exports, "HookSystemImpl", {
|
|
20328
20784
|
enumerable: true,
|
|
20329
|
-
get: function () { return
|
|
20785
|
+
get: function () { return chunkFVI3H6RG_cjs.HookSystemImpl; }
|
|
20330
20786
|
});
|
|
20331
20787
|
Object.defineProperty(exports, "HookUtils", {
|
|
20332
20788
|
enumerable: true,
|
|
20333
|
-
get: function () { return
|
|
20789
|
+
get: function () { return chunkFVI3H6RG_cjs.HookUtils; }
|
|
20334
20790
|
});
|
|
20335
20791
|
Object.defineProperty(exports, "PluginDependencyCycleError", {
|
|
20336
20792
|
enumerable: true,
|
|
20337
|
-
get: function () { return
|
|
20793
|
+
get: function () { return chunkFVI3H6RG_cjs.PluginDependencyCycleError; }
|
|
20338
20794
|
});
|
|
20339
20795
|
Object.defineProperty(exports, "PluginManagerClass", {
|
|
20340
20796
|
enumerable: true,
|
|
20341
|
-
get: function () { return
|
|
20797
|
+
get: function () { return chunkFVI3H6RG_cjs.PluginManager; }
|
|
20342
20798
|
});
|
|
20343
20799
|
Object.defineProperty(exports, "PluginRegistryImpl", {
|
|
20344
20800
|
enumerable: true,
|
|
20345
|
-
get: function () { return
|
|
20801
|
+
get: function () { return chunkFVI3H6RG_cjs.PluginRegistryImpl; }
|
|
20346
20802
|
});
|
|
20347
20803
|
Object.defineProperty(exports, "PluginValidatorClass", {
|
|
20348
20804
|
enumerable: true,
|
|
20349
|
-
get: function () { return
|
|
20805
|
+
get: function () { return chunkFVI3H6RG_cjs.PluginValidator; }
|
|
20350
20806
|
});
|
|
20351
20807
|
Object.defineProperty(exports, "RegisterPluginsError", {
|
|
20352
20808
|
enumerable: true,
|
|
20353
|
-
get: function () { return
|
|
20809
|
+
get: function () { return chunkFVI3H6RG_cjs.RegisterPluginsError; }
|
|
20354
20810
|
});
|
|
20355
20811
|
Object.defineProperty(exports, "ScopedHookSystemClass", {
|
|
20356
20812
|
enumerable: true,
|
|
20357
|
-
get: function () { return
|
|
20813
|
+
get: function () { return chunkFVI3H6RG_cjs.ScopedHookSystem; }
|
|
20358
20814
|
});
|
|
20359
20815
|
Object.defineProperty(exports, "collectCronSchedules", {
|
|
20360
20816
|
enumerable: true,
|
|
20361
|
-
get: function () { return
|
|
20817
|
+
get: function () { return chunkFVI3H6RG_cjs.collectCronSchedules; }
|
|
20362
20818
|
});
|
|
20363
20819
|
Object.defineProperty(exports, "collectCrons", {
|
|
20364
20820
|
enumerable: true,
|
|
20365
|
-
get: function () { return
|
|
20821
|
+
get: function () { return chunkFVI3H6RG_cjs.collectCrons; }
|
|
20366
20822
|
});
|
|
20367
20823
|
Object.defineProperty(exports, "createScheduledHandler", {
|
|
20368
20824
|
enumerable: true,
|
|
20369
|
-
get: function () { return
|
|
20825
|
+
get: function () { return chunkFVI3H6RG_cjs.createScheduledHandler; }
|
|
20370
20826
|
});
|
|
20371
20827
|
Object.defineProperty(exports, "dispatchCronTick", {
|
|
20372
20828
|
enumerable: true,
|
|
20373
|
-
get: function () { return
|
|
20829
|
+
get: function () { return chunkFVI3H6RG_cjs.dispatchCronTick; }
|
|
20374
20830
|
});
|
|
20375
20831
|
Object.defineProperty(exports, "getPluginMenu", {
|
|
20376
20832
|
enumerable: true,
|
|
20377
|
-
get: function () { return
|
|
20833
|
+
get: function () { return chunkFVI3H6RG_cjs.getPluginMenu; }
|
|
20378
20834
|
});
|
|
20379
20835
|
Object.defineProperty(exports, "registerPlugins", {
|
|
20380
20836
|
enumerable: true,
|
|
20381
|
-
get: function () { return
|
|
20837
|
+
get: function () { return chunkFVI3H6RG_cjs.registerPlugins; }
|
|
20382
20838
|
});
|
|
20383
20839
|
Object.defineProperty(exports, "resetPluginMenu", {
|
|
20384
20840
|
enumerable: true,
|
|
20385
|
-
get: function () { return
|
|
20841
|
+
get: function () { return chunkFVI3H6RG_cjs.resetPluginMenu; }
|
|
20386
20842
|
});
|
|
20387
20843
|
Object.defineProperty(exports, "resolvePluginMenuItems", {
|
|
20388
20844
|
enumerable: true,
|
|
20389
|
-
get: function () { return
|
|
20845
|
+
get: function () { return chunkFVI3H6RG_cjs.resolvePluginMenuItems; }
|
|
20390
20846
|
});
|
|
20391
20847
|
Object.defineProperty(exports, "setPluginMenu", {
|
|
20392
20848
|
enumerable: true,
|
|
20393
|
-
get: function () { return
|
|
20849
|
+
get: function () { return chunkFVI3H6RG_cjs.setPluginMenu; }
|
|
20394
20850
|
});
|
|
20395
20851
|
Object.defineProperty(exports, "topoSort", {
|
|
20396
20852
|
enumerable: true,
|
|
20397
|
-
get: function () { return
|
|
20853
|
+
get: function () { return chunkFVI3H6RG_cjs.topoSort; }
|
|
20398
20854
|
});
|
|
20399
20855
|
Object.defineProperty(exports, "applySchemaDefaults", {
|
|
20400
20856
|
enumerable: true,
|
|
20401
|
-
get: function () { return
|
|
20857
|
+
get: function () { return chunkPTTFLUEX_cjs.applySchemaDefaults; }
|
|
20402
20858
|
});
|
|
20403
20859
|
Object.defineProperty(exports, "definePlugin", {
|
|
20404
20860
|
enumerable: true,
|
|
20405
|
-
get: function () { return
|
|
20861
|
+
get: function () { return chunkPTTFLUEX_cjs.definePlugin; }
|
|
20406
20862
|
});
|
|
20407
20863
|
Object.defineProperty(exports, "isDefinedPlugin", {
|
|
20408
20864
|
enumerable: true,
|
|
20409
|
-
get: function () { return
|
|
20865
|
+
get: function () { return chunkPTTFLUEX_cjs.isDefinedPlugin; }
|
|
20410
20866
|
});
|
|
20411
20867
|
Object.defineProperty(exports, "parseConfigSchema", {
|
|
20412
20868
|
enumerable: true,
|
|
20413
|
-
get: function () { return
|
|
20869
|
+
get: function () { return chunkPTTFLUEX_cjs.parseConfigSchema; }
|
|
20414
20870
|
});
|
|
20415
20871
|
Object.defineProperty(exports, "parseFormDataToSettings", {
|
|
20416
20872
|
enumerable: true,
|
|
20417
|
-
get: function () { return
|
|
20873
|
+
get: function () { return chunkPTTFLUEX_cjs.parseFormDataToSettings; }
|
|
20418
20874
|
});
|
|
20419
20875
|
Object.defineProperty(exports, "renderSchemaFields", {
|
|
20420
20876
|
enumerable: true,
|
|
20421
|
-
get: function () { return
|
|
20877
|
+
get: function () { return chunkPTTFLUEX_cjs.renderSchemaFields; }
|
|
20422
20878
|
});
|
|
20423
20879
|
Object.defineProperty(exports, "getHookSystem", {
|
|
20424
20880
|
enumerable: true,
|
|
@@ -20466,11 +20922,11 @@ Object.defineProperty(exports, "metricsTracker", {
|
|
|
20466
20922
|
});
|
|
20467
20923
|
Object.defineProperty(exports, "SONICJS_VERSION", {
|
|
20468
20924
|
enumerable: true,
|
|
20469
|
-
get: function () { return
|
|
20925
|
+
get: function () { return chunkPK3ODTAL_cjs.SONICJS_VERSION; }
|
|
20470
20926
|
});
|
|
20471
20927
|
Object.defineProperty(exports, "getCoreVersion", {
|
|
20472
20928
|
enumerable: true,
|
|
20473
|
-
get: function () { return
|
|
20929
|
+
get: function () { return chunkPK3ODTAL_cjs.getCoreVersion; }
|
|
20474
20930
|
});
|
|
20475
20931
|
Object.defineProperty(exports, "escapeHtml", {
|
|
20476
20932
|
enumerable: true,
|
|
@@ -20493,11 +20949,13 @@ exports.CloudflareEmailProvider = CloudflareEmailProvider2;
|
|
|
20493
20949
|
exports.OAuthService = OAuthService;
|
|
20494
20950
|
exports.VERSION = VERSION;
|
|
20495
20951
|
exports.createDb = createDb;
|
|
20952
|
+
exports.createHelloWorldPlugin = createHelloWorldPlugin;
|
|
20496
20953
|
exports.createOAuthProvidersPlugin = createOAuthProvidersPlugin;
|
|
20497
20954
|
exports.createRedirectPlugin = createRedirectPlugin;
|
|
20498
20955
|
exports.createSonicJSApp = createSonicJSApp;
|
|
20499
20956
|
exports.emailReconciliationPlugin = emailReconciliationPlugin;
|
|
20500
20957
|
exports.generateTriggersComment = generateTriggersComment;
|
|
20958
|
+
exports.helloWorldPlugin = helloWorldPlugin;
|
|
20501
20959
|
exports.oauthProvidersPlugin = oauthProvidersPlugin;
|
|
20502
20960
|
exports.parseCronTriggers = parseCronTriggers;
|
|
20503
20961
|
exports.redirectPlugin = redirectPlugin;
|