@sonicjs-cms/core 3.0.0-beta.20 → 3.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-DSXEVMOM.js → chunk-2FCKKOA5.js} +2 -2
- package/dist/{chunk-DSXEVMOM.js.map → chunk-2FCKKOA5.js.map} +1 -1
- package/dist/{chunk-TQG5FNNR.cjs → chunk-3CT3SUR4.cjs} +2 -2
- package/dist/{chunk-TQG5FNNR.cjs.map → chunk-3CT3SUR4.cjs.map} +1 -1
- package/dist/{chunk-5UCMLBRQ.js → chunk-6KNTZ67K.js} +121 -17
- package/dist/chunk-6KNTZ67K.js.map +1 -0
- package/dist/{chunk-W53J3BJ2.js → chunk-73O4GPJ6.js} +3 -3
- package/dist/{chunk-W53J3BJ2.js.map → chunk-73O4GPJ6.js.map} +1 -1
- package/dist/{chunk-WCA4VENG.js → chunk-CHWT5KBK.js} +5 -5
- package/dist/{chunk-WCA4VENG.js.map → chunk-CHWT5KBK.js.map} +1 -1
- package/dist/{chunk-RDH6PUOP.js → chunk-DOMXI5PM.js} +2 -2
- package/dist/{chunk-RDH6PUOP.js.map → chunk-DOMXI5PM.js.map} +1 -1
- package/dist/{chunk-5RSB5SEK.cjs → chunk-EUJAEB6W.cjs} +4 -4
- package/dist/{chunk-5RSB5SEK.cjs.map → chunk-EUJAEB6W.cjs.map} +1 -1
- package/dist/{chunk-4SHNHNRP.cjs → chunk-FTXGZ3BF.cjs} +15 -15
- package/dist/{chunk-4SHNHNRP.cjs.map → chunk-FTXGZ3BF.cjs.map} +1 -1
- package/dist/{chunk-MYQ7KZUQ.js → chunk-GB2Q2DNK.js} +4 -4
- package/dist/{chunk-MYQ7KZUQ.js.map → chunk-GB2Q2DNK.js.map} +1 -1
- package/dist/{chunk-GMZ5TGYP.js → chunk-I2DM27HP.js} +3 -3
- package/dist/{chunk-GMZ5TGYP.js.map → chunk-I2DM27HP.js.map} +1 -1
- package/dist/{chunk-3E7IROND.cjs → chunk-JFLZHOQP.cjs} +314 -210
- package/dist/chunk-JFLZHOQP.cjs.map +1 -0
- package/dist/{chunk-DTGCXWWM.cjs → chunk-MGHHPNJN.cjs} +10 -10
- package/dist/{chunk-DTGCXWWM.cjs.map → chunk-MGHHPNJN.cjs.map} +1 -1
- package/dist/{chunk-5ARIHAGN.cjs → chunk-PYZYU7EK.cjs} +2 -2
- package/dist/{chunk-5ARIHAGN.cjs.map → chunk-PYZYU7EK.cjs.map} +1 -1
- package/dist/{chunk-AQJEMVAY.cjs → chunk-QWSR4THH.cjs} +3 -3
- package/dist/{chunk-AQJEMVAY.cjs.map → chunk-QWSR4THH.cjs.map} +1 -1
- package/dist/index.cjs +499 -327
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +253 -81
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +33 -33
- package/dist/middleware.js +4 -4
- package/dist/migrations-HLK2QF4T.js +4 -0
- package/dist/{migrations-HZJ6U6SX.js.map → migrations-HLK2QF4T.js.map} +1 -1
- package/dist/migrations-UIMA6ZL6.cjs +13 -0
- package/dist/{migrations-VQAFXMU7.cjs.map → migrations-UIMA6ZL6.cjs.map} +1 -1
- package/dist/plugins.cjs +40 -40
- package/dist/plugins.js +3 -3
- package/dist/routes.cjs +26 -26
- package/dist/routes.js +6 -6
- package/dist/services.cjs +18 -18
- package/dist/services.js +2 -2
- package/dist/utils.cjs +3 -3
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3E7IROND.cjs.map +0 -1
- package/dist/chunk-5UCMLBRQ.js.map +0 -1
- package/dist/migrations-HZJ6U6SX.js +0 -4
- package/dist/migrations-VQAFXMU7.cjs +0 -13
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkGMMCCIQO_cjs = require('./chunk-GMMCCIQO.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkJFLZHOQP_cjs = require('./chunk-JFLZHOQP.cjs');
|
|
5
5
|
require('./chunk-XWVDSM2L.cjs');
|
|
6
6
|
require('./chunk-N32OWET6.cjs');
|
|
7
7
|
var chunk36Z3AKX3_cjs = require('./chunk-36Z3AKX3.cjs');
|
|
8
8
|
var chunkYA3TJ65D_cjs = require('./chunk-YA3TJ65D.cjs');
|
|
9
9
|
var chunkYP7GW2G5_cjs = require('./chunk-YP7GW2G5.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkFTXGZ3BF_cjs = require('./chunk-FTXGZ3BF.cjs');
|
|
11
11
|
var chunkLTZ5WYOK_cjs = require('./chunk-LTZ5WYOK.cjs');
|
|
12
12
|
var chunkKIGVVO6N_cjs = require('./chunk-KIGVVO6N.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var chunkPYZYU7EK_cjs = require('./chunk-PYZYU7EK.cjs');
|
|
14
|
+
var chunk3CT3SUR4_cjs = require('./chunk-3CT3SUR4.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 chunkMGHHPNJN_cjs = require('./chunk-MGHHPNJN.cjs');
|
|
19
|
+
var chunkEUJAEB6W_cjs = require('./chunk-EUJAEB6W.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 chunkQWSR4THH_cjs = require('./chunk-QWSR4THH.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');
|
|
@@ -182,9 +182,9 @@ var DatabaseToolsService = class {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
|
-
* Get table data with optional pagination and
|
|
185
|
+
* Get table data with optional pagination, sorting, and search
|
|
186
186
|
*/
|
|
187
|
-
async getTableData(tableName, limit = 100, offset = 0, sortColumn, sortDirection = "asc") {
|
|
187
|
+
async getTableData(tableName, limit = 100, offset = 0, sortColumn, sortDirection = "asc", search) {
|
|
188
188
|
try {
|
|
189
189
|
const tables = await this.getTables();
|
|
190
190
|
if (!tables.includes(tableName)) {
|
|
@@ -195,14 +195,26 @@ var DatabaseToolsService = class {
|
|
|
195
195
|
if (sortColumn && !columns.includes(sortColumn)) {
|
|
196
196
|
sortColumn = void 0;
|
|
197
197
|
}
|
|
198
|
-
const
|
|
198
|
+
const searchTerm = search?.trim();
|
|
199
|
+
let whereClause = "";
|
|
200
|
+
let bindings = [];
|
|
201
|
+
if (searchTerm) {
|
|
202
|
+
const conditions = columns.map(() => `CAST(? AS TEXT) IS NOT NULL AND CAST(? AS TEXT) LIKE ?`).join(" OR ");
|
|
203
|
+
const colConditions = columns.map((col) => `CAST("${col}" AS TEXT) LIKE ?`).join(" OR ");
|
|
204
|
+
whereClause = ` WHERE (${colConditions})`;
|
|
205
|
+
bindings = columns.map(() => `%${searchTerm}%`);
|
|
206
|
+
}
|
|
207
|
+
const countQuery = `SELECT COUNT(*) as count FROM "${tableName}"${whereClause}`;
|
|
208
|
+
const countStmt = this.db.prepare(countQuery);
|
|
209
|
+
const countResult = bindings.length > 0 ? await countStmt.bind(...bindings).first() : await countStmt.first();
|
|
199
210
|
const totalRows = countResult?.count || 0;
|
|
200
|
-
let query = `SELECT * FROM ${tableName}`;
|
|
211
|
+
let query = `SELECT * FROM "${tableName}"${whereClause}`;
|
|
201
212
|
if (sortColumn) {
|
|
202
|
-
query += ` ORDER BY ${sortColumn} ${sortDirection.toUpperCase()}`;
|
|
213
|
+
query += ` ORDER BY "${sortColumn}" ${sortDirection.toUpperCase()}`;
|
|
203
214
|
}
|
|
204
215
|
query += ` LIMIT ${limit} OFFSET ${offset}`;
|
|
205
|
-
const
|
|
216
|
+
const dataStmt = this.db.prepare(query);
|
|
217
|
+
const dataResult = bindings.length > 0 ? await dataStmt.bind(...bindings).all() : await dataStmt.all();
|
|
206
218
|
return {
|
|
207
219
|
tableName,
|
|
208
220
|
columns,
|
|
@@ -306,6 +318,43 @@ function renderDatabaseTablePage(data) {
|
|
|
306
318
|
</div>
|
|
307
319
|
</div>
|
|
308
320
|
|
|
321
|
+
<!-- Search bar -->
|
|
322
|
+
<div class="flex items-center gap-3">
|
|
323
|
+
<div class="relative flex-1 max-w-xl">
|
|
324
|
+
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
|
325
|
+
<svg class="h-4 w-4 text-zinc-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
326
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0"/>
|
|
327
|
+
</svg>
|
|
328
|
+
</div>
|
|
329
|
+
<input
|
|
330
|
+
id="searchInput"
|
|
331
|
+
type="text"
|
|
332
|
+
placeholder="Search all columns including JSON data..."
|
|
333
|
+
value="${escapeHtml2(data.search || "")}"
|
|
334
|
+
class="block w-full rounded-lg border-0 py-2.5 pl-10 pr-10 text-sm text-zinc-900 dark:text-white bg-white dark:bg-zinc-800 ring-1 ring-inset ring-zinc-300 dark:ring-zinc-700 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600"
|
|
335
|
+
onkeydown="if(event.key==='Enter') doSearch()"
|
|
336
|
+
/>
|
|
337
|
+
${data.search ? `
|
|
338
|
+
<button
|
|
339
|
+
onclick="clearSearch()"
|
|
340
|
+
class="absolute inset-y-0 right-0 flex items-center pr-3 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200"
|
|
341
|
+
title="Clear search"
|
|
342
|
+
>
|
|
343
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
344
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
|
345
|
+
</svg>
|
|
346
|
+
</button>
|
|
347
|
+
` : ""}
|
|
348
|
+
</div>
|
|
349
|
+
<button
|
|
350
|
+
onclick="doSearch()"
|
|
351
|
+
class="inline-flex items-center justify-center rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-indigo-500 transition-colors shadow-sm"
|
|
352
|
+
>
|
|
353
|
+
Search
|
|
354
|
+
</button>
|
|
355
|
+
${data.search ? `<span class="text-sm text-zinc-500 dark:text-zinc-400">Filtered: <strong class="text-zinc-900 dark:text-white">${escapeHtml2(data.search)}</strong></span>` : ""}
|
|
356
|
+
</div>
|
|
357
|
+
|
|
309
358
|
<!-- Table Card -->
|
|
310
359
|
<div class="rounded-xl bg-white dark:bg-zinc-900 shadow-sm ring-1 ring-zinc-950/5 dark:ring-white/10 overflow-hidden">
|
|
311
360
|
<!-- Table -->
|
|
@@ -340,7 +389,7 @@ function renderDatabaseTablePage(data) {
|
|
|
340
389
|
<tr class="${idx % 2 === 0 ? "bg-white dark:bg-zinc-900" : "bg-zinc-50 dark:bg-zinc-900/50"}">
|
|
341
390
|
${data.columns.map((col) => `
|
|
342
391
|
<td class="px-4 py-3 text-sm text-zinc-700 dark:text-zinc-300 whitespace-nowrap max-w-xs overflow-hidden text-ellipsis" title="${escapeHtml2(String(row[col] ?? ""))}">
|
|
343
|
-
${formatCellValue(row[col])}
|
|
392
|
+
${formatCellValue(row[col], col)}
|
|
344
393
|
</td>
|
|
345
394
|
`).join("")}
|
|
346
395
|
</tr>
|
|
@@ -416,79 +465,143 @@ function renderDatabaseTablePage(data) {
|
|
|
416
465
|
</div>
|
|
417
466
|
</div>
|
|
418
467
|
|
|
468
|
+
<!-- JSON Viewer Modal -->
|
|
469
|
+
<div id="jsonModal" class="fixed inset-0 z-50 hidden" role="dialog" aria-modal="true">
|
|
470
|
+
<div class="fixed inset-0 bg-black/60 backdrop-blur-sm" onclick="closeJsonModal()"></div>
|
|
471
|
+
<div class="fixed inset-0 flex items-center justify-center p-4 pointer-events-none">
|
|
472
|
+
<div class="pointer-events-auto relative w-full max-w-4xl max-h-[85vh] flex flex-col rounded-xl bg-white dark:bg-zinc-900 shadow-2xl ring-1 ring-zinc-950/10 dark:ring-white/10">
|
|
473
|
+
<div class="flex items-center justify-between px-6 py-4 border-b border-zinc-200 dark:border-zinc-700">
|
|
474
|
+
<div>
|
|
475
|
+
<h3 id="jsonModalTitle" class="text-base font-semibold text-zinc-900 dark:text-white">Field Value</h3>
|
|
476
|
+
<p id="jsonModalSubtitle" class="text-xs text-zinc-500 dark:text-zinc-400 mt-0.5"></p>
|
|
477
|
+
</div>
|
|
478
|
+
<div class="flex items-center gap-2">
|
|
479
|
+
<button onclick="copyJsonValue()" class="inline-flex items-center gap-1.5 rounded-lg bg-zinc-100 dark:bg-zinc-800 px-3 py-1.5 text-xs font-medium text-zinc-700 dark:text-zinc-300 hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors">
|
|
480
|
+
<svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
481
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
|
482
|
+
</svg>
|
|
483
|
+
Copy
|
|
484
|
+
</button>
|
|
485
|
+
<button onclick="closeJsonModal()" class="rounded-lg p-1.5 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors">
|
|
486
|
+
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
487
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
|
488
|
+
</svg>
|
|
489
|
+
</button>
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
<div class="flex-1 overflow-auto p-6">
|
|
493
|
+
<pre id="jsonModalContent" class="text-sm font-mono text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words leading-relaxed"></pre>
|
|
494
|
+
</div>
|
|
495
|
+
</div>
|
|
496
|
+
</div>
|
|
497
|
+
</div>
|
|
498
|
+
|
|
419
499
|
<script>
|
|
420
500
|
const currentTableName = '${data.tableName}';
|
|
421
501
|
let currentPage = ${data.currentPage};
|
|
422
502
|
let currentPageSize = ${data.pageSize};
|
|
423
503
|
let currentSort = '${data.sortColumn || ""}';
|
|
424
504
|
let currentSortDir = '${data.sortDirection || "asc"}';
|
|
505
|
+
let currentSearch = ${JSON.stringify(data.search || "")};
|
|
506
|
+
|
|
507
|
+
function buildParams(overrides = {}) {
|
|
508
|
+
const params = new URLSearchParams();
|
|
509
|
+
const p = { page: currentPage, pageSize: currentPageSize, sort: currentSort, dir: currentSortDir, search: currentSearch, ...overrides };
|
|
510
|
+
if (p.page) params.set('page', p.page);
|
|
511
|
+
if (p.pageSize) params.set('pageSize', p.pageSize);
|
|
512
|
+
if (p.sort) { params.set('sort', p.sort); params.set('dir', p.dir || 'asc'); }
|
|
513
|
+
if (p.search) params.set('search', p.search);
|
|
514
|
+
return params;
|
|
515
|
+
}
|
|
425
516
|
|
|
426
517
|
function goToPage(page) {
|
|
427
518
|
if (page < 1 || page > ${totalPages}) return;
|
|
428
|
-
|
|
429
|
-
params.set('page', page);
|
|
430
|
-
params.set('pageSize', currentPageSize);
|
|
431
|
-
if (currentSort) {
|
|
432
|
-
params.set('sort', currentSort);
|
|
433
|
-
params.set('dir', currentSortDir);
|
|
434
|
-
}
|
|
435
|
-
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${params}\`;
|
|
519
|
+
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page })}\`;
|
|
436
520
|
}
|
|
437
521
|
|
|
438
522
|
function sortTable(column) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
newDir = 'desc';
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
const params = new URLSearchParams();
|
|
445
|
-
params.set('page', '1');
|
|
446
|
-
params.set('pageSize', currentPageSize);
|
|
447
|
-
params.set('sort', column);
|
|
448
|
-
params.set('dir', newDir);
|
|
449
|
-
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${params}\`;
|
|
523
|
+
const newDir = (currentSort === column && currentSortDir === 'asc') ? 'desc' : 'asc';
|
|
524
|
+
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, sort: column, dir: newDir })}\`;
|
|
450
525
|
}
|
|
451
526
|
|
|
452
527
|
function changePageSize(newSize) {
|
|
453
|
-
|
|
454
|
-
params.set('page', '1');
|
|
455
|
-
params.set('pageSize', newSize);
|
|
456
|
-
if (currentSort) {
|
|
457
|
-
params.set('sort', currentSort);
|
|
458
|
-
params.set('dir', currentSortDir);
|
|
459
|
-
}
|
|
460
|
-
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${params}\`;
|
|
528
|
+
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, pageSize: newSize })}\`;
|
|
461
529
|
}
|
|
462
530
|
|
|
463
531
|
function refreshTableData() {
|
|
464
532
|
window.location.reload();
|
|
465
533
|
}
|
|
466
534
|
|
|
467
|
-
function
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
535
|
+
function doSearch() {
|
|
536
|
+
const val = document.getElementById('searchInput').value.trim();
|
|
537
|
+
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, search: val })}\`;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function clearSearch() {
|
|
541
|
+
window.location.href = \`/admin/database-tools/tables/\${currentTableName}?\${buildParams({ page: 1, search: '' })}\`;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// JSON viewer modal
|
|
545
|
+
let _jsonModalValue = '';
|
|
546
|
+
|
|
547
|
+
function openJsonModal(rawValue, colName) {
|
|
548
|
+
// rawValue comes from dataset \u2014 browser already decoded HTML entities, so it's the original string
|
|
549
|
+
_jsonModalValue = rawValue;
|
|
550
|
+
document.getElementById('jsonModalTitle').textContent = colName;
|
|
551
|
+
const el = document.getElementById('jsonModalContent');
|
|
552
|
+
const subtitle = document.getElementById('jsonModalSubtitle');
|
|
553
|
+
try {
|
|
554
|
+
const parsed = JSON.parse(rawValue);
|
|
555
|
+
const pretty = JSON.stringify(parsed, null, 2);
|
|
556
|
+
subtitle.textContent = 'JSON \u2022 ' + rawValue.length + ' chars';
|
|
557
|
+
el.innerHTML = syntaxHighlight(pretty);
|
|
558
|
+
} catch {
|
|
559
|
+
el.textContent = rawValue;
|
|
560
|
+
subtitle.textContent = rawValue.length + ' chars';
|
|
480
561
|
}
|
|
481
|
-
|
|
562
|
+
document.getElementById('jsonModal').classList.remove('hidden');
|
|
563
|
+
document.body.style.overflow = 'hidden';
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function closeJsonModal() {
|
|
567
|
+
document.getElementById('jsonModal').classList.add('hidden');
|
|
568
|
+
document.body.style.overflow = '';
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function copyJsonValue() {
|
|
572
|
+
navigator.clipboard.writeText(_jsonModalValue).then(() => {
|
|
573
|
+
const btn = event.currentTarget;
|
|
574
|
+
const orig = btn.innerHTML;
|
|
575
|
+
btn.textContent = 'Copied!';
|
|
576
|
+
setTimeout(() => { btn.innerHTML = orig; }, 1500);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function syntaxHighlight(json) {
|
|
581
|
+
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
582
|
+
return json.replace(/("(\\\\u[a-zA-Z0-9]{4}|\\\\[^u]|[^\\\\"])*"(\\s*:)?|\\b(true|false|null)\\b|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)/g, function(match) {
|
|
583
|
+
let cls = 'text-purple-600 dark:text-purple-400'; // number
|
|
584
|
+
if (/^"/.test(match)) {
|
|
585
|
+
if (/:$/.test(match)) {
|
|
586
|
+
cls = 'text-blue-600 dark:text-blue-400 font-medium'; // key
|
|
587
|
+
} else {
|
|
588
|
+
cls = 'text-green-700 dark:text-green-400'; // string value
|
|
589
|
+
}
|
|
590
|
+
} else if (/true|false/.test(match)) {
|
|
591
|
+
cls = 'text-orange-600 dark:text-orange-400';
|
|
592
|
+
} else if (/null/.test(match)) {
|
|
593
|
+
cls = 'text-zinc-400 italic';
|
|
594
|
+
}
|
|
595
|
+
return \`<span class="\${cls}">\${match}</span>\`;
|
|
596
|
+
});
|
|
482
597
|
}
|
|
483
598
|
|
|
599
|
+
document.addEventListener('keydown', (e) => {
|
|
600
|
+
if (e.key === 'Escape') closeJsonModal();
|
|
601
|
+
});
|
|
602
|
+
|
|
484
603
|
function escapeHtml(text) {
|
|
485
|
-
const map = {
|
|
486
|
-
'&': '&',
|
|
487
|
-
'<': '<',
|
|
488
|
-
'>': '>',
|
|
489
|
-
'"': '"',
|
|
490
|
-
"'": '''
|
|
491
|
-
};
|
|
604
|
+
const map = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' };
|
|
492
605
|
return String(text).replace(/[&<>"']/g, m => map[m]);
|
|
493
606
|
}
|
|
494
607
|
</script>
|
|
@@ -555,7 +668,16 @@ function escapeHtml2(text) {
|
|
|
555
668
|
};
|
|
556
669
|
return String(text).replace(/[&<>"']/g, (m) => map[m] || m);
|
|
557
670
|
}
|
|
558
|
-
function
|
|
671
|
+
function isJsonString(str2) {
|
|
672
|
+
const s = str2.trim();
|
|
673
|
+
return (s.startsWith("{") || s.startsWith("[")) && (s.endsWith("}") || s.endsWith("]"));
|
|
674
|
+
}
|
|
675
|
+
function jsonButton(raw, colName) {
|
|
676
|
+
const preview = raw.length > 60 ? escapeHtml2(raw.substring(0, 60)) + "\u2026" : escapeHtml2(raw);
|
|
677
|
+
return `<button data-json-val="${escapeHtml2(raw)}" data-col-name="${escapeHtml2(colName)}" onclick="openJsonModal(this.dataset.jsonVal, this.dataset.colName)" class="text-left text-xs font-mono text-indigo-600 dark:text-indigo-400 hover:underline">${preview}</button>`;
|
|
678
|
+
}
|
|
679
|
+
function formatCellValue(value, colName) {
|
|
680
|
+
const col = colName || "value";
|
|
559
681
|
if (value === null || value === void 0) {
|
|
560
682
|
return '<span class="text-zinc-400 dark:text-zinc-500 italic">null</span>';
|
|
561
683
|
}
|
|
@@ -563,11 +685,15 @@ function formatCellValue(value) {
|
|
|
563
685
|
return `<span class="px-2 py-0.5 rounded text-xs font-medium ${value ? "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" : "bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-400"}">${value}</span>`;
|
|
564
686
|
}
|
|
565
687
|
if (typeof value === "object") {
|
|
566
|
-
return
|
|
688
|
+
return jsonButton(JSON.stringify(value), col);
|
|
567
689
|
}
|
|
568
690
|
const str2 = String(value);
|
|
569
|
-
if (str2
|
|
570
|
-
return
|
|
691
|
+
if (isJsonString(str2)) {
|
|
692
|
+
return jsonButton(str2, col);
|
|
693
|
+
}
|
|
694
|
+
if (str2.length > 120) {
|
|
695
|
+
const preview = escapeHtml2(str2.substring(0, 120)) + "\u2026";
|
|
696
|
+
return `<button data-json-val="${escapeHtml2(str2)}" data-col-name="${escapeHtml2(col)}" onclick="openJsonModal(this.dataset.jsonVal, this.dataset.colName)" class="text-left text-sm text-zinc-700 dark:text-zinc-300 hover:underline">${preview}</button>`;
|
|
571
697
|
}
|
|
572
698
|
return escapeHtml2(str2);
|
|
573
699
|
}
|
|
@@ -575,7 +701,7 @@ function formatCellValue(value) {
|
|
|
575
701
|
// src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
|
|
576
702
|
function createDatabaseToolsAdminRoutes() {
|
|
577
703
|
const router3 = new hono.Hono();
|
|
578
|
-
router3.use("*",
|
|
704
|
+
router3.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
579
705
|
router3.get("/api/stats", async (c) => {
|
|
580
706
|
try {
|
|
581
707
|
const user = c.get("user");
|
|
@@ -702,9 +828,10 @@ function createDatabaseToolsAdminRoutes() {
|
|
|
702
828
|
const offset = parseInt(c.req.query("offset") || "0");
|
|
703
829
|
const sortColumn = c.req.query("sort");
|
|
704
830
|
const sortDirection = c.req.query("dir") || "asc";
|
|
831
|
+
const search = c.req.query("search");
|
|
705
832
|
const db = c.env.DB;
|
|
706
833
|
const service = new DatabaseToolsService(db);
|
|
707
|
-
const tableData = await service.getTableData(tableName, limit, offset, sortColumn, sortDirection);
|
|
834
|
+
const tableData = await service.getTableData(tableName, limit, offset, sortColumn, sortDirection, search);
|
|
708
835
|
return c.json({
|
|
709
836
|
success: true,
|
|
710
837
|
data: tableData
|
|
@@ -728,10 +855,11 @@ function createDatabaseToolsAdminRoutes() {
|
|
|
728
855
|
const pageSize = parseInt(c.req.query("pageSize") || "20");
|
|
729
856
|
const sortColumn = c.req.query("sort");
|
|
730
857
|
const sortDirection = c.req.query("dir") || "asc";
|
|
858
|
+
const search = c.req.query("search");
|
|
731
859
|
const offset = (page - 1) * pageSize;
|
|
732
860
|
const db = c.env.DB;
|
|
733
861
|
const service = new DatabaseToolsService(db);
|
|
734
|
-
const tableData = await service.getTableData(tableName, pageSize, offset, sortColumn, sortDirection);
|
|
862
|
+
const tableData = await service.getTableData(tableName, pageSize, offset, sortColumn, sortDirection, search);
|
|
735
863
|
const pageData = {
|
|
736
864
|
user: {
|
|
737
865
|
name: user.email.split("@")[0] || "Unknown",
|
|
@@ -745,7 +873,8 @@ function createDatabaseToolsAdminRoutes() {
|
|
|
745
873
|
currentPage: page,
|
|
746
874
|
pageSize,
|
|
747
875
|
sortColumn,
|
|
748
|
-
sortDirection
|
|
876
|
+
sortDirection,
|
|
877
|
+
search
|
|
749
878
|
};
|
|
750
879
|
return c.html(renderDatabaseTablePage(pageData));
|
|
751
880
|
} catch (error) {
|
|
@@ -981,7 +1110,7 @@ var SiteConfigService = class {
|
|
|
981
1110
|
|
|
982
1111
|
// src/plugins/core-plugins/email-plugin/routes/admin.ts
|
|
983
1112
|
var adminRoutes = new hono.Hono();
|
|
984
|
-
adminRoutes.use("*",
|
|
1113
|
+
adminRoutes.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
985
1114
|
adminRoutes.post("/settings", async (c) => {
|
|
986
1115
|
if (c.get("user")?.role !== "admin") {
|
|
987
1116
|
return c.json({ error: "admin role required" }, 403);
|
|
@@ -1019,7 +1148,7 @@ adminRoutes.post("/test", async (c) => {
|
|
|
1019
1148
|
const { subject, html: html4, text } = renderTestEmail({ siteName });
|
|
1020
1149
|
try {
|
|
1021
1150
|
const settingsLoaded = await settings.load();
|
|
1022
|
-
const result = await
|
|
1151
|
+
const result = await chunkJFLZHOQP_cjs.getEmailService().send({
|
|
1023
1152
|
to,
|
|
1024
1153
|
subject,
|
|
1025
1154
|
html: html4,
|
|
@@ -1101,7 +1230,7 @@ function makeOnRegistrationCompleted(env) {
|
|
|
1101
1230
|
siteName,
|
|
1102
1231
|
loginUrl: siteConfig.buildLoginUrl(siteUrl)
|
|
1103
1232
|
});
|
|
1104
|
-
const result = await
|
|
1233
|
+
const result = await chunkJFLZHOQP_cjs.getEmailService().send({
|
|
1105
1234
|
to: user.email,
|
|
1106
1235
|
subject,
|
|
1107
1236
|
html: html4,
|
|
@@ -1175,7 +1304,7 @@ function makeOnPasswordResetRequested(env) {
|
|
|
1175
1304
|
expiresAt: Date.now() + DEFAULT_EXPIRY_MS,
|
|
1176
1305
|
siteName
|
|
1177
1306
|
});
|
|
1178
|
-
const result = await
|
|
1307
|
+
const result = await chunkJFLZHOQP_cjs.getEmailService().send({
|
|
1179
1308
|
to: user.email,
|
|
1180
1309
|
subject,
|
|
1181
1310
|
html: html4,
|
|
@@ -1243,7 +1372,7 @@ function makeOnPasswordResetCompleted(env) {
|
|
|
1243
1372
|
supportEmail,
|
|
1244
1373
|
when: Date.now()
|
|
1245
1374
|
});
|
|
1246
|
-
const result = await
|
|
1375
|
+
const result = await chunkJFLZHOQP_cjs.getEmailService().send({
|
|
1247
1376
|
to: user.email,
|
|
1248
1377
|
subject,
|
|
1249
1378
|
html: html4,
|
|
@@ -1984,7 +2113,7 @@ var CloudflareEmailProvider = class {
|
|
|
1984
2113
|
}
|
|
1985
2114
|
}
|
|
1986
2115
|
};
|
|
1987
|
-
var emailPluginV3 =
|
|
2116
|
+
var emailPluginV3 = chunkEUJAEB6W_cjs.definePlugin({
|
|
1988
2117
|
id: "email",
|
|
1989
2118
|
version: "1.0.0",
|
|
1990
2119
|
name: "Email",
|
|
@@ -1998,7 +2127,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
1998
2127
|
const db = env.DB;
|
|
1999
2128
|
if (db) {
|
|
2000
2129
|
try {
|
|
2001
|
-
const typeRegistry = new
|
|
2130
|
+
const typeRegistry = new chunkFTXGZ3BF_cjs.DocumentTypeRegistry(db);
|
|
2002
2131
|
await typeRegistry.register({
|
|
2003
2132
|
id: "email_log",
|
|
2004
2133
|
name: "email_log",
|
|
@@ -2013,7 +2142,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
2013
2142
|
} catch {
|
|
2014
2143
|
}
|
|
2015
2144
|
}
|
|
2016
|
-
if (!
|
|
2145
|
+
if (!chunkJFLZHOQP_cjs.hasEmailService()) {
|
|
2017
2146
|
const settings = db ? await new EmailSettingsService(db).load() : {};
|
|
2018
2147
|
const envResendKey = typeof env.RESEND_API_KEY === "string" && env.RESEND_API_KEY ? env.RESEND_API_KEY : void 0;
|
|
2019
2148
|
const cfEmailBinding = env.EMAIL;
|
|
@@ -2031,7 +2160,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
2031
2160
|
} else {
|
|
2032
2161
|
provider = resolveEmailProvider({ env });
|
|
2033
2162
|
}
|
|
2034
|
-
|
|
2163
|
+
chunkJFLZHOQP_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
|
|
2035
2164
|
}
|
|
2036
2165
|
ctx.hooks.on("auth:registration:completed", makeOnRegistrationCompleted(env));
|
|
2037
2166
|
ctx.hooks.on("auth:password-reset:requested", makeOnPasswordResetRequested(env));
|
|
@@ -2042,7 +2171,7 @@ var emailPluginV3 = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
2042
2171
|
var BATCH_SIZE = 100;
|
|
2043
2172
|
({
|
|
2044
2173
|
schema: zod.z.record(zod.z.string(), zod.z.unknown())});
|
|
2045
|
-
var emailReconciliationPlugin =
|
|
2174
|
+
var emailReconciliationPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
2046
2175
|
id: "email-reconciliation",
|
|
2047
2176
|
version: "1.0.0",
|
|
2048
2177
|
description: "Hourly cron that backfills email delivery state from provider status APIs. Only active for providers that implement EmailProvider.reconcile().",
|
|
@@ -2063,11 +2192,11 @@ var emailReconciliationPlugin = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
2063
2192
|
console.warn("[email-reconciliation] No DB binding in cron env \u2014 skipping.");
|
|
2064
2193
|
return;
|
|
2065
2194
|
}
|
|
2066
|
-
if (!
|
|
2195
|
+
if (!chunkJFLZHOQP_cjs.hasEmailService()) {
|
|
2067
2196
|
console.warn("[email-reconciliation] EmailService not initialized \u2014 skipping.");
|
|
2068
2197
|
return;
|
|
2069
2198
|
}
|
|
2070
|
-
const emailService =
|
|
2199
|
+
const emailService = chunkJFLZHOQP_cjs.getEmailService();
|
|
2071
2200
|
let rows = [];
|
|
2072
2201
|
try {
|
|
2073
2202
|
const result = await db.prepare(
|
|
@@ -2554,8 +2683,8 @@ function buildOtpApi() {
|
|
|
2554
2683
|
loginUrl: settings.loginUrl || "",
|
|
2555
2684
|
loginButtonText: settings.loginButtonText || ""
|
|
2556
2685
|
});
|
|
2557
|
-
if (
|
|
2558
|
-
const sent = await
|
|
2686
|
+
if (chunkJFLZHOQP_cjs.hasEmailService()) {
|
|
2687
|
+
const sent = await chunkJFLZHOQP_cjs.getEmailService().send({
|
|
2559
2688
|
to: normalizedEmail,
|
|
2560
2689
|
subject: `Your login code for ${siteName}`,
|
|
2561
2690
|
flow: "otp",
|
|
@@ -2657,21 +2786,21 @@ function buildOtpApi() {
|
|
|
2657
2786
|
error: "Account is deactivated"
|
|
2658
2787
|
}, 403);
|
|
2659
2788
|
}
|
|
2660
|
-
const tokenTtl = await
|
|
2661
|
-
const token = await
|
|
2789
|
+
const tokenTtl = await chunkFTXGZ3BF_cjs.getJwtExpirySecondsFromDb(db, c.env);
|
|
2790
|
+
const token = await chunkFTXGZ3BF_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
|
|
2662
2791
|
cookie.setCookie(c, "auth_token", token, {
|
|
2663
2792
|
httpOnly: true,
|
|
2664
2793
|
secure: true,
|
|
2665
2794
|
sameSite: "Strict",
|
|
2666
2795
|
maxAge: tokenTtl
|
|
2667
2796
|
});
|
|
2668
|
-
|
|
2797
|
+
chunkJFLZHOQP_cjs.dispatchHookEvent(
|
|
2669
2798
|
c,
|
|
2670
2799
|
"auth:otp:verified",
|
|
2671
2800
|
{ user: { id: user.id, email: user.email, role: user.role } },
|
|
2672
2801
|
"fire-and-forget"
|
|
2673
2802
|
);
|
|
2674
|
-
const customData = await
|
|
2803
|
+
const customData = await chunkJFLZHOQP_cjs.getCustomData(db, user.id);
|
|
2675
2804
|
const { is_active: _isActive, ...publicUser } = user;
|
|
2676
2805
|
return c.json({
|
|
2677
2806
|
success: true,
|
|
@@ -2716,7 +2845,7 @@ function buildOtpApi() {
|
|
|
2716
2845
|
});
|
|
2717
2846
|
return otpAPI;
|
|
2718
2847
|
}
|
|
2719
|
-
var otpLoginPlugin =
|
|
2848
|
+
var otpLoginPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
2720
2849
|
id: "otp-login",
|
|
2721
2850
|
version: "1.0.0",
|
|
2722
2851
|
name: "OTP Login",
|
|
@@ -3114,15 +3243,15 @@ function buildOauthApi() {
|
|
|
3114
3243
|
if (!user || !user.is_active) {
|
|
3115
3244
|
return c.redirect("/auth/login?error=Account is deactivated");
|
|
3116
3245
|
}
|
|
3117
|
-
const tokenTtl2 = await
|
|
3118
|
-
const jwt2 = await
|
|
3246
|
+
const tokenTtl2 = await chunkFTXGZ3BF_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
3247
|
+
const jwt2 = await chunkFTXGZ3BF_cjs.AuthManager.generateToken(
|
|
3119
3248
|
user.id,
|
|
3120
3249
|
user.email,
|
|
3121
3250
|
user.role,
|
|
3122
3251
|
c.env.JWT_SECRET,
|
|
3123
3252
|
tokenTtl2
|
|
3124
3253
|
);
|
|
3125
|
-
|
|
3254
|
+
chunkFTXGZ3BF_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
|
|
3126
3255
|
return c.redirect("/admin");
|
|
3127
3256
|
}
|
|
3128
3257
|
const existingUser = await oauthService.findUserByEmail(profile.email);
|
|
@@ -3139,15 +3268,15 @@ function buildOauthApi() {
|
|
|
3139
3268
|
tokenExpiresAt: tokenExpiresAt ?? void 0,
|
|
3140
3269
|
profileData: JSON.stringify(profile)
|
|
3141
3270
|
});
|
|
3142
|
-
const tokenTtl2 = await
|
|
3143
|
-
const jwt2 = await
|
|
3271
|
+
const tokenTtl2 = await chunkFTXGZ3BF_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
3272
|
+
const jwt2 = await chunkFTXGZ3BF_cjs.AuthManager.generateToken(
|
|
3144
3273
|
existingUser.id,
|
|
3145
3274
|
existingUser.email,
|
|
3146
3275
|
existingUser.role,
|
|
3147
3276
|
c.env.JWT_SECRET,
|
|
3148
3277
|
tokenTtl2
|
|
3149
3278
|
);
|
|
3150
|
-
|
|
3279
|
+
chunkFTXGZ3BF_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
|
|
3151
3280
|
return c.redirect("/admin");
|
|
3152
3281
|
}
|
|
3153
3282
|
const newUserId = await oauthService.createUserFromOAuth(profile);
|
|
@@ -3160,15 +3289,15 @@ function buildOauthApi() {
|
|
|
3160
3289
|
tokenExpiresAt: tokenExpiresAt ?? void 0,
|
|
3161
3290
|
profileData: JSON.stringify(profile)
|
|
3162
3291
|
});
|
|
3163
|
-
const tokenTtl = await
|
|
3164
|
-
const jwt = await
|
|
3292
|
+
const tokenTtl = await chunkFTXGZ3BF_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
3293
|
+
const jwt = await chunkFTXGZ3BF_cjs.AuthManager.generateToken(
|
|
3165
3294
|
newUserId,
|
|
3166
3295
|
profile.email.toLowerCase(),
|
|
3167
3296
|
"viewer",
|
|
3168
3297
|
c.env.JWT_SECRET,
|
|
3169
3298
|
tokenTtl
|
|
3170
3299
|
);
|
|
3171
|
-
|
|
3300
|
+
chunkFTXGZ3BF_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
|
|
3172
3301
|
return c.redirect("/admin");
|
|
3173
3302
|
} catch (error) {
|
|
3174
3303
|
console.error("OAuth callback error:", error);
|
|
@@ -3263,7 +3392,7 @@ function buildOauthApi() {
|
|
|
3263
3392
|
});
|
|
3264
3393
|
return oauthAPI;
|
|
3265
3394
|
}
|
|
3266
|
-
var oauthProvidersPlugin =
|
|
3395
|
+
var oauthProvidersPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
3267
3396
|
id: "oauth-providers",
|
|
3268
3397
|
version: "1.0.0",
|
|
3269
3398
|
name: "OAuth Providers",
|
|
@@ -3847,7 +3976,7 @@ var AISearchService = class {
|
|
|
3847
3976
|
*/
|
|
3848
3977
|
async detectNewCollections() {
|
|
3849
3978
|
try {
|
|
3850
|
-
const allCollections =
|
|
3979
|
+
const allCollections = chunkPYZYU7EK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
|
|
3851
3980
|
id: r.id,
|
|
3852
3981
|
name: r.name,
|
|
3853
3982
|
display_name: r.displayName,
|
|
@@ -3899,7 +4028,7 @@ var AISearchService = class {
|
|
|
3899
4028
|
*/
|
|
3900
4029
|
async getAllCollections() {
|
|
3901
4030
|
try {
|
|
3902
|
-
const allCollections =
|
|
4031
|
+
const allCollections = chunkPYZYU7EK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
|
|
3903
4032
|
id: r.id,
|
|
3904
4033
|
name: r.name,
|
|
3905
4034
|
display_name: r.displayName,
|
|
@@ -4238,7 +4367,7 @@ var IndexManager = class {
|
|
|
4238
4367
|
*/
|
|
4239
4368
|
async indexCollection(collectionId) {
|
|
4240
4369
|
try {
|
|
4241
|
-
const registry =
|
|
4370
|
+
const registry = chunkPYZYU7EK_cjs.getCollectionRegistry();
|
|
4242
4371
|
const record = registry.getById(collectionId) ?? registry.getByName(collectionId);
|
|
4243
4372
|
if (!record) {
|
|
4244
4373
|
throw new Error(`Collection ${collectionId} not found`);
|
|
@@ -4865,7 +4994,7 @@ function renderSettingsPage(data) {
|
|
|
4865
4994
|
|
|
4866
4995
|
// src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
|
|
4867
4996
|
var adminRoutes2 = new hono.Hono();
|
|
4868
|
-
adminRoutes2.use("*",
|
|
4997
|
+
adminRoutes2.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
4869
4998
|
adminRoutes2.get("/", async (c) => {
|
|
4870
4999
|
try {
|
|
4871
5000
|
const user = c.get("user");
|
|
@@ -5106,7 +5235,7 @@ var manifest_default = {
|
|
|
5106
5235
|
author: "SonicJS"};
|
|
5107
5236
|
|
|
5108
5237
|
// src/plugins/core-plugins/ai-search-plugin/index.ts
|
|
5109
|
-
var aiSearchPlugin =
|
|
5238
|
+
var aiSearchPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
5110
5239
|
id: manifest_default.id,
|
|
5111
5240
|
version: manifest_default.version,
|
|
5112
5241
|
name: manifest_default.name,
|
|
@@ -5979,7 +6108,7 @@ function renderSecuritySettingsPage(data) {
|
|
|
5979
6108
|
|
|
5980
6109
|
// src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
|
|
5981
6110
|
var adminRoutes3 = new hono.Hono();
|
|
5982
|
-
adminRoutes3.use("*",
|
|
6111
|
+
adminRoutes3.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
5983
6112
|
adminRoutes3.use("*", async (c, next) => {
|
|
5984
6113
|
const user = c.get("user");
|
|
5985
6114
|
if (user?.role !== "admin") {
|
|
@@ -5989,7 +6118,7 @@ adminRoutes3.use("*", async (c, next) => {
|
|
|
5989
6118
|
});
|
|
5990
6119
|
async function getSettings(db) {
|
|
5991
6120
|
try {
|
|
5992
|
-
const pluginService = new
|
|
6121
|
+
const pluginService = new chunkPYZYU7EK_cjs.PluginService(db);
|
|
5993
6122
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
5994
6123
|
if (plugin2?.settings) {
|
|
5995
6124
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6094,7 +6223,7 @@ adminRoutes3.post("/settings", async (c) => {
|
|
|
6094
6223
|
autoPurge: body["retention.autoPurge"] === "true"
|
|
6095
6224
|
}
|
|
6096
6225
|
};
|
|
6097
|
-
const pluginService = new
|
|
6226
|
+
const pluginService = new chunkPYZYU7EK_cjs.PluginService(db);
|
|
6098
6227
|
await pluginService.updatePluginSettings("security-audit", settings);
|
|
6099
6228
|
if (c.req.header("HX-Request")) {
|
|
6100
6229
|
return c.json({ success: true });
|
|
@@ -6256,7 +6385,7 @@ var BruteForceDetector = class {
|
|
|
6256
6385
|
|
|
6257
6386
|
// src/plugins/core-plugins/security-audit-plugin/routes/api.ts
|
|
6258
6387
|
var apiRoutes2 = new hono.Hono();
|
|
6259
|
-
apiRoutes2.use("*",
|
|
6388
|
+
apiRoutes2.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
6260
6389
|
apiRoutes2.use("*", async (c, next) => {
|
|
6261
6390
|
const user = c.get("user");
|
|
6262
6391
|
if (user?.role !== "admin") {
|
|
@@ -6266,7 +6395,7 @@ apiRoutes2.use("*", async (c, next) => {
|
|
|
6266
6395
|
});
|
|
6267
6396
|
async function getSettings2(db) {
|
|
6268
6397
|
try {
|
|
6269
|
-
const pluginService = new
|
|
6398
|
+
const pluginService = new chunkPYZYU7EK_cjs.PluginService(db);
|
|
6270
6399
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
6271
6400
|
if (plugin2?.settings) {
|
|
6272
6401
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6414,7 +6543,7 @@ function generateFingerprint(ip, userAgent) {
|
|
|
6414
6543
|
}
|
|
6415
6544
|
async function getPluginSettings(db) {
|
|
6416
6545
|
try {
|
|
6417
|
-
const pluginService = new
|
|
6546
|
+
const pluginService = new chunkPYZYU7EK_cjs.PluginService(db);
|
|
6418
6547
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
6419
6548
|
if (plugin2?.settings) {
|
|
6420
6549
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6645,7 +6774,7 @@ async function logAuthEvent(c, db, settings, ip, userAgent, countryCode, fingerp
|
|
|
6645
6774
|
|
|
6646
6775
|
// src/plugins/core-plugins/security-audit-plugin/index.ts
|
|
6647
6776
|
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>`;
|
|
6648
|
-
var securityAuditPlugin =
|
|
6777
|
+
var securityAuditPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
6649
6778
|
id: "security-audit",
|
|
6650
6779
|
version: "1.0.0",
|
|
6651
6780
|
name: "Security Audit",
|
|
@@ -6721,7 +6850,7 @@ var ApiKeyService = class {
|
|
|
6721
6850
|
const prefix = secret.slice(0, DISPLAY_PREFIX_LEN);
|
|
6722
6851
|
const expiresAt = input.expiresAt ?? null;
|
|
6723
6852
|
const doc = await this.docService().create(
|
|
6724
|
-
|
|
6853
|
+
chunkJFLZHOQP_cjs.createDocumentSchema.parse({
|
|
6725
6854
|
typeId: "api_key",
|
|
6726
6855
|
tenantId: this.tenantId,
|
|
6727
6856
|
title: name,
|
|
@@ -6866,14 +6995,18 @@ function renderApiKeysPage(data) {
|
|
|
6866
6995
|
|
|
6867
6996
|
<!-- Newly-created secret banner (populated by JS, shown once) -->
|
|
6868
6997
|
<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">
|
|
6869
|
-
<
|
|
6870
|
-
|
|
6871
|
-
|
|
6998
|
+
<div class="flex items-start justify-between mb-2">
|
|
6999
|
+
<p class="text-sm font-medium text-emerald-800 dark:text-emerald-300">
|
|
7000
|
+
Copy your new key now \u2014 it will not be shown again.
|
|
7001
|
+
</p>
|
|
7002
|
+
<button type="button" onclick="document.getElementById('new-key-banner').classList.add('hidden')"
|
|
7003
|
+
class="ml-4 text-emerald-600 dark:text-emerald-400 hover:text-emerald-800 dark:hover:text-emerald-200 text-lg leading-none">×</button>
|
|
7004
|
+
</div>
|
|
6872
7005
|
<div class="flex items-center gap-2">
|
|
6873
7006
|
<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>
|
|
6874
7007
|
<button type="button" onclick="copyNewKey()"
|
|
6875
7008
|
class="rounded-lg bg-emerald-600 px-3 py-2 text-sm font-semibold text-white hover:bg-emerald-500 transition-colors">
|
|
6876
|
-
Copy
|
|
7009
|
+
Copy & dismiss
|
|
6877
7010
|
</button>
|
|
6878
7011
|
</div>
|
|
6879
7012
|
</div>
|
|
@@ -6945,11 +7078,50 @@ function renderApiKeysPage(data) {
|
|
|
6945
7078
|
document.getElementById('create-key-modal').classList.add('hidden')
|
|
6946
7079
|
document.getElementById('new-key-value').textContent = apiKey.key
|
|
6947
7080
|
document.getElementById('new-key-banner').classList.remove('hidden')
|
|
6948
|
-
|
|
7081
|
+
// Add new key row to table immediately so user can see it without reloading
|
|
7082
|
+
const tbody = document.getElementById('keys-tbody')
|
|
7083
|
+
const emptyRow = tbody.querySelector('td[colspan]')
|
|
7084
|
+
if (emptyRow) emptyRow.closest('tr').remove()
|
|
7085
|
+
const tr = document.createElement('tr')
|
|
7086
|
+
tr.className = 'border-t border-zinc-950/5 dark:border-white/10'
|
|
7087
|
+
tr.setAttribute('data-key-id', apiKey.id)
|
|
7088
|
+
const prefix = apiKey.prefix
|
|
7089
|
+
const today = new Date().toISOString().slice(0, 10)
|
|
7090
|
+
const expires = apiKey.expiresAt ? new Date(apiKey.expiresAt).toISOString().slice(0, 10) : 'Never'
|
|
7091
|
+
// Build row using DOM methods to avoid nested template-literal escaping issues
|
|
7092
|
+
const nameTd = document.createElement('td')
|
|
7093
|
+
nameTd.className = 'py-3 pr-4 text-sm font-medium text-zinc-950 dark:text-white'
|
|
7094
|
+
nameTd.textContent = apiKey.name
|
|
7095
|
+
const prefixTd = document.createElement('td')
|
|
7096
|
+
prefixTd.className = 'py-3 pr-4 text-sm font-mono text-zinc-500 dark:text-zinc-400'
|
|
7097
|
+
prefixTd.textContent = prefix + '\u2026'
|
|
7098
|
+
const createdTd = document.createElement('td')
|
|
7099
|
+
createdTd.className = 'py-3 pr-4 text-sm text-zinc-500 dark:text-zinc-400'
|
|
7100
|
+
createdTd.textContent = today
|
|
7101
|
+
const lastUsedTd = document.createElement('td')
|
|
7102
|
+
lastUsedTd.className = 'py-3 pr-4 text-sm text-zinc-500 dark:text-zinc-400'
|
|
7103
|
+
lastUsedTd.textContent = 'Never'
|
|
7104
|
+
const expiresTd = document.createElement('td')
|
|
7105
|
+
expiresTd.className = 'py-3 pr-4 text-sm text-zinc-500 dark:text-zinc-400'
|
|
7106
|
+
expiresTd.textContent = expires
|
|
7107
|
+
const actionsTd = document.createElement('td')
|
|
7108
|
+
actionsTd.className = 'py-3 text-right'
|
|
7109
|
+
const revokeBtn = document.createElement('button')
|
|
7110
|
+
revokeBtn.type = 'button'
|
|
7111
|
+
revokeBtn.className = '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'
|
|
7112
|
+
revokeBtn.textContent = 'Revoke'
|
|
7113
|
+
revokeBtn.addEventListener('click', () => revokeApiKey(apiKey.id, apiKey.name))
|
|
7114
|
+
actionsTd.appendChild(revokeBtn)
|
|
7115
|
+
tr.appendChild(nameTd); tr.appendChild(prefixTd); tr.appendChild(createdTd)
|
|
7116
|
+
tr.appendChild(lastUsedTd); tr.appendChild(expiresTd); tr.appendChild(actionsTd)
|
|
7117
|
+
tbody.appendChild(tr)
|
|
6949
7118
|
}
|
|
6950
7119
|
function copyNewKey() {
|
|
6951
7120
|
const v = document.getElementById('new-key-value').textContent
|
|
6952
|
-
navigator.clipboard.writeText(v).then(() =>
|
|
7121
|
+
navigator.clipboard.writeText(v).then(() => {
|
|
7122
|
+
window.showNotification && window.showNotification('Copied to clipboard', 'success')
|
|
7123
|
+
document.getElementById('new-key-banner').classList.add('hidden')
|
|
7124
|
+
})
|
|
6953
7125
|
}
|
|
6954
7126
|
async function revokeApiKey(id, name) {
|
|
6955
7127
|
if (!confirm('Revoke "' + name + '"? This cannot be undone and will break any client using it.')) return
|
|
@@ -6991,7 +7163,7 @@ var createSchema = zod.z.object({
|
|
|
6991
7163
|
});
|
|
6992
7164
|
async function getSettings3(db) {
|
|
6993
7165
|
try {
|
|
6994
|
-
const plugin2 = await new
|
|
7166
|
+
const plugin2 = await new chunkPYZYU7EK_cjs.PluginService(db).getPlugin("api-keys");
|
|
6995
7167
|
if (plugin2?.settings) {
|
|
6996
7168
|
const s = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
6997
7169
|
return { ...DEFAULT_SETTINGS3, ...s };
|
|
@@ -7000,7 +7172,7 @@ async function getSettings3(db) {
|
|
|
7000
7172
|
}
|
|
7001
7173
|
return DEFAULT_SETTINGS3;
|
|
7002
7174
|
}
|
|
7003
|
-
adminRoutes4.use("*",
|
|
7175
|
+
adminRoutes4.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
7004
7176
|
adminRoutes4.use("*", async (c, next) => {
|
|
7005
7177
|
const user = c.get("user");
|
|
7006
7178
|
if (user?.role !== "admin") {
|
|
@@ -7085,7 +7257,7 @@ function apiKeyAuthMiddleware() {
|
|
|
7085
7257
|
|
|
7086
7258
|
// src/plugins/core-plugins/api-keys-plugin/index.ts
|
|
7087
7259
|
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>`;
|
|
7088
|
-
var apiKeysPlugin =
|
|
7260
|
+
var apiKeysPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
7089
7261
|
id: "api-keys",
|
|
7090
7262
|
version: "1.0.0-beta.1",
|
|
7091
7263
|
name: "API Keys",
|
|
@@ -7856,7 +8028,7 @@ var DEFAULT_SETTINGS4 = {
|
|
|
7856
8028
|
|
|
7857
8029
|
// src/plugins/core-plugins/stripe-plugin/routes/admin.ts
|
|
7858
8030
|
var adminRoutes5 = new hono.Hono();
|
|
7859
|
-
adminRoutes5.use("*",
|
|
8031
|
+
adminRoutes5.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
7860
8032
|
adminRoutes5.use("*", async (c, next) => {
|
|
7861
8033
|
const user = c.get("user");
|
|
7862
8034
|
if (user?.role !== "admin") {
|
|
@@ -7866,7 +8038,7 @@ adminRoutes5.use("*", async (c, next) => {
|
|
|
7866
8038
|
});
|
|
7867
8039
|
async function getSettings4(db) {
|
|
7868
8040
|
try {
|
|
7869
|
-
const pluginService = new
|
|
8041
|
+
const pluginService = new chunkPYZYU7EK_cjs.PluginService(db);
|
|
7870
8042
|
const plugin2 = await pluginService.getPlugin("stripe");
|
|
7871
8043
|
if (plugin2?.settings) {
|
|
7872
8044
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -8189,7 +8361,7 @@ function timingSafeEqual(a, b) {
|
|
|
8189
8361
|
var apiRoutes3 = new hono.Hono();
|
|
8190
8362
|
async function getSettings5(db) {
|
|
8191
8363
|
try {
|
|
8192
|
-
const pluginService = new
|
|
8364
|
+
const pluginService = new chunkPYZYU7EK_cjs.PluginService(db);
|
|
8193
8365
|
const plugin2 = await pluginService.getPlugin("stripe");
|
|
8194
8366
|
if (plugin2?.settings) {
|
|
8195
8367
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -8340,7 +8512,7 @@ apiRoutes3.post("/webhook", async (c) => {
|
|
|
8340
8512
|
}
|
|
8341
8513
|
return c.json({ received: true });
|
|
8342
8514
|
});
|
|
8343
|
-
apiRoutes3.post("/create-checkout-session",
|
|
8515
|
+
apiRoutes3.post("/create-checkout-session", chunkFTXGZ3BF_cjs.requireAuth(), async (c) => {
|
|
8344
8516
|
const db = c.env.DB;
|
|
8345
8517
|
const user = c.get("user");
|
|
8346
8518
|
if (!user) return c.json({ error: "Unauthorized" }, 401);
|
|
@@ -8380,7 +8552,7 @@ apiRoutes3.post("/create-checkout-session", chunk4SHNHNRP_cjs.requireAuth(), asy
|
|
|
8380
8552
|
});
|
|
8381
8553
|
return c.json({ sessionId: session.id, url: session.url });
|
|
8382
8554
|
});
|
|
8383
|
-
apiRoutes3.get("/subscription",
|
|
8555
|
+
apiRoutes3.get("/subscription", chunkFTXGZ3BF_cjs.requireAuth(), async (c) => {
|
|
8384
8556
|
const user = c.get("user");
|
|
8385
8557
|
if (!user) return c.json({ error: "Unauthorized" }, 401);
|
|
8386
8558
|
const db = c.env.DB;
|
|
@@ -8392,7 +8564,7 @@ apiRoutes3.get("/subscription", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
|
|
|
8392
8564
|
}
|
|
8393
8565
|
return c.json({ subscription });
|
|
8394
8566
|
});
|
|
8395
|
-
apiRoutes3.get("/subscriptions",
|
|
8567
|
+
apiRoutes3.get("/subscriptions", chunkFTXGZ3BF_cjs.requireAuth(), async (c) => {
|
|
8396
8568
|
const user = c.get("user");
|
|
8397
8569
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
8398
8570
|
const db = c.env.DB;
|
|
@@ -8408,7 +8580,7 @@ apiRoutes3.get("/subscriptions", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
|
|
|
8408
8580
|
const result = await subscriptionService.list(filters);
|
|
8409
8581
|
return c.json(result);
|
|
8410
8582
|
});
|
|
8411
|
-
apiRoutes3.get("/stats",
|
|
8583
|
+
apiRoutes3.get("/stats", chunkFTXGZ3BF_cjs.requireAuth(), async (c) => {
|
|
8412
8584
|
const user = c.get("user");
|
|
8413
8585
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
8414
8586
|
const db = c.env.DB;
|
|
@@ -8417,7 +8589,7 @@ apiRoutes3.get("/stats", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
|
|
|
8417
8589
|
const stats = await subscriptionService.getStats();
|
|
8418
8590
|
return c.json(stats);
|
|
8419
8591
|
});
|
|
8420
|
-
apiRoutes3.post("/sync-subscriptions",
|
|
8592
|
+
apiRoutes3.post("/sync-subscriptions", chunkFTXGZ3BF_cjs.requireAuth(), async (c) => {
|
|
8421
8593
|
const user = c.get("user");
|
|
8422
8594
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
8423
8595
|
const db = c.env.DB;
|
|
@@ -8465,7 +8637,7 @@ apiRoutes3.post("/sync-subscriptions", chunk4SHNHNRP_cjs.requireAuth(), async (c
|
|
|
8465
8637
|
}, 500);
|
|
8466
8638
|
}
|
|
8467
8639
|
});
|
|
8468
|
-
apiRoutes3.get("/events",
|
|
8640
|
+
apiRoutes3.get("/events", chunkFTXGZ3BF_cjs.requireAuth(), async (c) => {
|
|
8469
8641
|
const user = c.get("user");
|
|
8470
8642
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
8471
8643
|
const db = c.env.DB;
|
|
@@ -8488,7 +8660,7 @@ apiRoutes3.get("/events", chunk4SHNHNRP_cjs.requireAuth(), async (c) => {
|
|
|
8488
8660
|
|
|
8489
8661
|
// src/plugins/core-plugins/stripe-plugin/index.ts
|
|
8490
8662
|
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>`;
|
|
8491
|
-
var stripePlugin =
|
|
8663
|
+
var stripePlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
8492
8664
|
id: "stripe",
|
|
8493
8665
|
version: "1.0.0",
|
|
8494
8666
|
name: "Stripe",
|
|
@@ -8761,7 +8933,7 @@ function renderFormsListPage(data) {
|
|
|
8761
8933
|
|
|
8762
8934
|
<!-- Forms Table -->
|
|
8763
8935
|
<div class="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-950/5 dark:border-white/10 overflow-hidden">
|
|
8764
|
-
${
|
|
8936
|
+
${chunkJFLZHOQP_cjs.renderTable(tableData)}
|
|
8765
8937
|
</div>
|
|
8766
8938
|
</div>
|
|
8767
8939
|
`;
|
|
@@ -10191,7 +10363,7 @@ function renderFormCreatePage(data) {
|
|
|
10191
10363
|
// src/routes/admin-forms.ts
|
|
10192
10364
|
var isTableMissing = (err) => String(err?.message ?? err?.cause?.message ?? "").includes("no such table: forms");
|
|
10193
10365
|
var adminFormsRoutes = new hono.Hono();
|
|
10194
|
-
adminFormsRoutes.use("*",
|
|
10366
|
+
adminFormsRoutes.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
10195
10367
|
adminFormsRoutes.get("/", async (c) => {
|
|
10196
10368
|
try {
|
|
10197
10369
|
const user = c.get("user");
|
|
@@ -10364,7 +10536,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
|
|
|
10364
10536
|
if (!form) {
|
|
10365
10537
|
return c.html("<p>Form not found</p>", 404);
|
|
10366
10538
|
}
|
|
10367
|
-
const turnstileService = new
|
|
10539
|
+
const turnstileService = new chunkMGHHPNJN_cjs.TurnstileService(db);
|
|
10368
10540
|
const turnstileSettings = await turnstileService.getSettings();
|
|
10369
10541
|
const pageData = {
|
|
10370
10542
|
id: form.id,
|
|
@@ -10533,7 +10705,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
|
|
|
10533
10705
|
if (!form) {
|
|
10534
10706
|
return c.json({ error: "Form not found" }, 404);
|
|
10535
10707
|
}
|
|
10536
|
-
const turnstileService = new
|
|
10708
|
+
const turnstileService = new chunkMGHHPNJN_cjs.TurnstileService(db);
|
|
10537
10709
|
const globalSettings = await turnstileService.getSettings();
|
|
10538
10710
|
const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
10539
10711
|
const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
|
|
@@ -10963,7 +11135,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
10963
11135
|
const turnstileEnabled = form.turnstile_enabled === 1;
|
|
10964
11136
|
const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
10965
11137
|
if (turnstileEnabled || turnstileSettings.inherit) {
|
|
10966
|
-
const turnstileService = new
|
|
11138
|
+
const turnstileService = new chunkMGHHPNJN_cjs.TurnstileService(db);
|
|
10967
11139
|
const globalEnabled = await turnstileService.isEnabled();
|
|
10968
11140
|
if (globalEnabled || turnstileEnabled) {
|
|
10969
11141
|
const turnstileToken = body.data?.turnstile || body.turnstile;
|
|
@@ -11025,7 +11197,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
11025
11197
|
});
|
|
11026
11198
|
|
|
11027
11199
|
// src/plugins/core-plugins/forms-plugin/index.ts
|
|
11028
|
-
var formsPlugin =
|
|
11200
|
+
var formsPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
11029
11201
|
id: "forms",
|
|
11030
11202
|
version: "1.0.0",
|
|
11031
11203
|
name: "Forms",
|
|
@@ -11045,7 +11217,7 @@ var formsPlugin = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
11045
11217
|
});
|
|
11046
11218
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
11047
11219
|
var adminRbacRoutes = new hono.Hono();
|
|
11048
|
-
adminRbacRoutes.use("*",
|
|
11220
|
+
adminRbacRoutes.use("*", chunkFTXGZ3BF_cjs.requireRbac("rbac", "manage"));
|
|
11049
11221
|
var esc = (s) => String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
11050
11222
|
var TABS2 = `
|
|
11051
11223
|
<div class="border-b border-zinc-950/10 dark:border-white/10 mb-6">
|
|
@@ -11353,7 +11525,7 @@ adminRbacRoutes.get("/", async (c) => {
|
|
|
11353
11525
|
title: "Roles & Permissions",
|
|
11354
11526
|
pageTitle: "Roles & Permissions",
|
|
11355
11527
|
currentPath: "/admin/users",
|
|
11356
|
-
version:
|
|
11528
|
+
version: chunkQWSR4THH_cjs.getCoreVersion(),
|
|
11357
11529
|
user: u ? { name: u.email || "Admin", email: u.email || "", role: u.role || "admin" } : void 0,
|
|
11358
11530
|
content: content2
|
|
11359
11531
|
})
|
|
@@ -11490,7 +11662,7 @@ adminRbacRoutes.get("/check", async (c) => {
|
|
|
11490
11662
|
});
|
|
11491
11663
|
|
|
11492
11664
|
// src/middleware/plugin-menu.ts
|
|
11493
|
-
var REGISTRY_MENU_PLUGINS = Object.values(
|
|
11665
|
+
var REGISTRY_MENU_PLUGINS = Object.values(chunkPYZYU7EK_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
|
|
11494
11666
|
id: p.id,
|
|
11495
11667
|
label: p.adminMenu.label,
|
|
11496
11668
|
path: p.adminMenu.path,
|
|
@@ -11569,7 +11741,7 @@ function pluginMenuMiddleware() {
|
|
|
11569
11741
|
} catch {
|
|
11570
11742
|
}
|
|
11571
11743
|
const user = c.get("user");
|
|
11572
|
-
const singletonItems =
|
|
11744
|
+
const singletonItems = chunkMGHHPNJN_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
|
|
11573
11745
|
const existingPaths = new Set(activeMenuItems.map((i) => i.path));
|
|
11574
11746
|
for (const item of singletonItems) {
|
|
11575
11747
|
if (!existingPaths.has(item.path)) {
|
|
@@ -11596,7 +11768,7 @@ function pluginMenuMiddleware() {
|
|
|
11596
11768
|
}
|
|
11597
11769
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
11598
11770
|
var adminRoutes6 = new hono.Hono();
|
|
11599
|
-
adminRoutes6.use("*",
|
|
11771
|
+
adminRoutes6.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
11600
11772
|
adminRoutes6.use("*", async (c, next) => {
|
|
11601
11773
|
const user = c.get("user");
|
|
11602
11774
|
if (user?.role !== "admin") {
|
|
@@ -11952,7 +12124,7 @@ apiRoutes4.get("/stats", async (c) => {
|
|
|
11952
12124
|
});
|
|
11953
12125
|
|
|
11954
12126
|
// src/plugins/core-plugins/analytics/index.ts
|
|
11955
|
-
var analyticsPlugin =
|
|
12127
|
+
var analyticsPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
11956
12128
|
id: "core-analytics",
|
|
11957
12129
|
version: "1.0.0",
|
|
11958
12130
|
name: "Analytics",
|
|
@@ -12099,7 +12271,7 @@ function esc2(s) {
|
|
|
12099
12271
|
return (s || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
12100
12272
|
}
|
|
12101
12273
|
async function getVariablesMap(db) {
|
|
12102
|
-
let variables =
|
|
12274
|
+
let variables = chunkJFLZHOQP_cjs.getVariablesCached();
|
|
12103
12275
|
if (variables) return variables;
|
|
12104
12276
|
try {
|
|
12105
12277
|
const { results } = await db.prepare(
|
|
@@ -12109,7 +12281,7 @@ async function getVariablesMap(db) {
|
|
|
12109
12281
|
for (const row of results || []) {
|
|
12110
12282
|
variables.set(row.key, row.value);
|
|
12111
12283
|
}
|
|
12112
|
-
|
|
12284
|
+
chunkJFLZHOQP_cjs.setVariablesCache(variables);
|
|
12113
12285
|
return variables;
|
|
12114
12286
|
} catch {
|
|
12115
12287
|
return /* @__PURE__ */ new Map();
|
|
@@ -12178,7 +12350,7 @@ apiRoutes5.post("/", async (c) => {
|
|
|
12178
12350
|
await db.prepare(
|
|
12179
12351
|
"INSERT INTO global_variables (key, value, description, category, is_active) VALUES (?, ?, ?, ?, ?)"
|
|
12180
12352
|
).bind(key, value || "", description || "", category || "general", isActive !== false ? 1 : 0).run();
|
|
12181
|
-
|
|
12353
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12182
12354
|
const created = await db.prepare("SELECT * FROM global_variables WHERE key = ?").bind(key).first();
|
|
12183
12355
|
return c.json({ success: true, data: formatVariable(created) }, 201);
|
|
12184
12356
|
} catch {
|
|
@@ -12223,7 +12395,7 @@ apiRoutes5.put("/:id", async (c) => {
|
|
|
12223
12395
|
updates.push("updated_at = strftime('%s', 'now')");
|
|
12224
12396
|
params.push(id);
|
|
12225
12397
|
await db.prepare(`UPDATE global_variables SET ${updates.join(", ")} WHERE id = ?`).bind(...params).run();
|
|
12226
|
-
|
|
12398
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12227
12399
|
const updated = await db.prepare("SELECT * FROM global_variables WHERE id = ?").bind(id).first();
|
|
12228
12400
|
return c.json({ success: true, data: formatVariable(updated) });
|
|
12229
12401
|
} catch {
|
|
@@ -12237,7 +12409,7 @@ apiRoutes5.delete("/:id", async (c) => {
|
|
|
12237
12409
|
const existing = await db.prepare("SELECT id FROM global_variables WHERE id = ?").bind(id).first();
|
|
12238
12410
|
if (!existing) return c.json({ error: "Variable not found" }, 404);
|
|
12239
12411
|
await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(id).run();
|
|
12240
|
-
|
|
12412
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12241
12413
|
return c.json({ success: true });
|
|
12242
12414
|
} catch {
|
|
12243
12415
|
return c.json({ success: false, error: "Failed to delete variable" }, 500);
|
|
@@ -12297,7 +12469,7 @@ adminRoutes7.put("/:id", async (c) => {
|
|
|
12297
12469
|
const value = body.value;
|
|
12298
12470
|
if (value !== void 0) {
|
|
12299
12471
|
await db.prepare("UPDATE global_variables SET value = ?, updated_at = strftime('%s', 'now') WHERE id = ?").bind(value, id).run();
|
|
12300
|
-
|
|
12472
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12301
12473
|
}
|
|
12302
12474
|
return c.html('<span class="text-green-400 text-xs">Saved</span>');
|
|
12303
12475
|
});
|
|
@@ -12305,7 +12477,7 @@ adminRoutes7.post("/:id/toggle", async (c) => {
|
|
|
12305
12477
|
const db = c.env.DB;
|
|
12306
12478
|
const id = c.req.param("id");
|
|
12307
12479
|
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();
|
|
12308
|
-
|
|
12480
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12309
12481
|
c.header("HX-Redirect", "/admin/global-variables");
|
|
12310
12482
|
return c.body(null, 204);
|
|
12311
12483
|
});
|
|
@@ -12326,7 +12498,7 @@ adminRoutes7.post("/", async (c) => {
|
|
|
12326
12498
|
await db.prepare(
|
|
12327
12499
|
"INSERT INTO global_variables (key, value, description, category) VALUES (?, ?, ?, ?)"
|
|
12328
12500
|
).bind(key, value, description, category).run();
|
|
12329
|
-
|
|
12501
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12330
12502
|
c.header("HX-Redirect", "/admin/global-variables");
|
|
12331
12503
|
return c.body(null, 204);
|
|
12332
12504
|
});
|
|
@@ -12345,7 +12517,7 @@ adminRoutes7.post("/settings/editor-integration", async (c) => {
|
|
|
12345
12517
|
adminRoutes7.delete("/:id", async (c) => {
|
|
12346
12518
|
const db = c.env.DB;
|
|
12347
12519
|
await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(c.req.param("id")).run();
|
|
12348
|
-
|
|
12520
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12349
12521
|
return c.html("");
|
|
12350
12522
|
});
|
|
12351
12523
|
function renderAdminPage(variables, editorStatus = { editorActive: false, activeEditorName: "", enableEditorIntegration: true }) {
|
|
@@ -12663,7 +12835,7 @@ function renderAdminPage(variables, editorStatus = { editorActive: false, active
|
|
|
12663
12835
|
</div>
|
|
12664
12836
|
` });
|
|
12665
12837
|
}
|
|
12666
|
-
var globalVariablesPlugin =
|
|
12838
|
+
var globalVariablesPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
12667
12839
|
id: "global-variables",
|
|
12668
12840
|
version: "1.1.0",
|
|
12669
12841
|
name: "Global Variables",
|
|
@@ -12686,7 +12858,7 @@ var globalVariablesPlugin = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
12686
12858
|
if (!db || !data) return data;
|
|
12687
12859
|
const variables = await getVariablesMap(db);
|
|
12688
12860
|
if (variables.size === 0) return data;
|
|
12689
|
-
return
|
|
12861
|
+
return chunkJFLZHOQP_cjs.resolveVariablesInObject(data, variables);
|
|
12690
12862
|
} catch {
|
|
12691
12863
|
return data;
|
|
12692
12864
|
}
|
|
@@ -12704,7 +12876,7 @@ var globalVariablesPlugin = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
12704
12876
|
},
|
|
12705
12877
|
activate: async () => console.info("[GlobalVariables] Plugin activated"),
|
|
12706
12878
|
deactivate: async () => {
|
|
12707
|
-
|
|
12879
|
+
chunkJFLZHOQP_cjs.invalidateVariablesCache();
|
|
12708
12880
|
console.info("[GlobalVariables] Plugin deactivated, cache cleared");
|
|
12709
12881
|
},
|
|
12710
12882
|
uninstall: async (ctx) => {
|
|
@@ -13270,7 +13442,7 @@ function renderAdminPage2(shortcodes, editorStatus = { editorActive: false, acti
|
|
|
13270
13442
|
</div>
|
|
13271
13443
|
` });
|
|
13272
13444
|
}
|
|
13273
|
-
var shortcodesPlugin =
|
|
13445
|
+
var shortcodesPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
13274
13446
|
id: "shortcodes",
|
|
13275
13447
|
version: "1.0.0",
|
|
13276
13448
|
name: "Shortcodes",
|
|
@@ -13354,7 +13526,7 @@ helloWorldRoutes.get("/", async (c) => {
|
|
|
13354
13526
|
</html>
|
|
13355
13527
|
`);
|
|
13356
13528
|
});
|
|
13357
|
-
var helloWorldPlugin =
|
|
13529
|
+
var helloWorldPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
13358
13530
|
id: "hello-world",
|
|
13359
13531
|
version: "1.0.0",
|
|
13360
13532
|
name: "Hello World",
|
|
@@ -13585,7 +13757,7 @@ function renderTenantForm(data) {
|
|
|
13585
13757
|
// src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-members.template.ts
|
|
13586
13758
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
13587
13759
|
function roleOptions(selected) {
|
|
13588
|
-
return
|
|
13760
|
+
return chunkJFLZHOQP_cjs.VALID_MEMBER_ROLES.map(
|
|
13589
13761
|
(r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
|
|
13590
13762
|
).join("");
|
|
13591
13763
|
}
|
|
@@ -13647,7 +13819,7 @@ function renderInvitations(slug, invitations) {
|
|
|
13647
13819
|
<div>
|
|
13648
13820
|
<label for="invite-role" class="mb-1 block text-xs font-medium text-zinc-500 dark:text-zinc-400">Role</label>
|
|
13649
13821
|
<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">
|
|
13650
|
-
${
|
|
13822
|
+
${chunkJFLZHOQP_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
|
|
13651
13823
|
</select>
|
|
13652
13824
|
</div>
|
|
13653
13825
|
<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>
|
|
@@ -13743,7 +13915,7 @@ function renderTenantMembers(data) {
|
|
|
13743
13915
|
// src/plugins/core-plugins/multi-tenant-plugin/templates/user-memberships.template.ts
|
|
13744
13916
|
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
13745
13917
|
function roleOptions2(selected) {
|
|
13746
|
-
return
|
|
13918
|
+
return chunkJFLZHOQP_cjs.VALID_MEMBER_ROLES.map(
|
|
13747
13919
|
(r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
|
|
13748
13920
|
).join("");
|
|
13749
13921
|
}
|
|
@@ -13905,7 +14077,7 @@ function zodToFieldErrors(error) {
|
|
|
13905
14077
|
}
|
|
13906
14078
|
async function isMultiTenantActive(db) {
|
|
13907
14079
|
try {
|
|
13908
|
-
const plugin2 = await new
|
|
14080
|
+
const plugin2 = await new chunkPYZYU7EK_cjs.PluginService(db).getPlugin(chunkPYZYU7EK_cjs.MULTI_TENANT_PLUGIN_ID);
|
|
13909
14081
|
return plugin2?.status === "active";
|
|
13910
14082
|
} catch {
|
|
13911
14083
|
return false;
|
|
@@ -13913,7 +14085,7 @@ async function isMultiTenantActive(db) {
|
|
|
13913
14085
|
}
|
|
13914
14086
|
function createTenantAdminRoutes() {
|
|
13915
14087
|
const routes2 = new hono.Hono();
|
|
13916
|
-
routes2.use("*",
|
|
14088
|
+
routes2.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
13917
14089
|
routes2.use("*", async (c, next) => {
|
|
13918
14090
|
const user = c.get("user");
|
|
13919
14091
|
if (user?.role !== "admin") {
|
|
@@ -13927,7 +14099,7 @@ function createTenantAdminRoutes() {
|
|
|
13927
14099
|
const form = await c.req.formData();
|
|
13928
14100
|
const slug = String(form.get("tenant") ?? "").trim().toLowerCase();
|
|
13929
14101
|
const redirect = String(form.get("redirect") ?? "");
|
|
13930
|
-
const svc = new
|
|
14102
|
+
const svc = new chunkJFLZHOQP_cjs.TenantService(db);
|
|
13931
14103
|
const tenant = await svc.getTenantBySlug(slug);
|
|
13932
14104
|
if (!tenant || tenant.status !== "active") {
|
|
13933
14105
|
return c.json({ error: "Unknown or inactive tenant" }, 400);
|
|
@@ -13937,7 +14109,7 @@ function createTenantAdminRoutes() {
|
|
|
13937
14109
|
if (!user.isSuperAdmin && !await svc.isMember(user.userId, slug)) {
|
|
13938
14110
|
return c.json({ error: "You are not a member of this tenant" }, 403);
|
|
13939
14111
|
}
|
|
13940
|
-
cookie.setCookie(c,
|
|
14112
|
+
cookie.setCookie(c, chunkPYZYU7EK_cjs.TENANT_COOKIE, slug, {
|
|
13941
14113
|
path: "/",
|
|
13942
14114
|
httpOnly: true,
|
|
13943
14115
|
sameSite: "Lax",
|
|
@@ -13954,7 +14126,7 @@ function createTenantAdminRoutes() {
|
|
|
13954
14126
|
if (!user) return c.redirect("/auth/login");
|
|
13955
14127
|
const token = c.req.query("token") ?? "";
|
|
13956
14128
|
try {
|
|
13957
|
-
const { slug } = await new
|
|
14129
|
+
const { slug } = await new chunkJFLZHOQP_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
|
|
13958
14130
|
return c.redirect(`/admin/tenants/${slug}/members?message=Invitation accepted`);
|
|
13959
14131
|
} catch (error) {
|
|
13960
14132
|
const message = error instanceof Error ? error.message : "Failed to accept invitation";
|
|
@@ -13982,7 +14154,7 @@ function createTenantAdminRoutes() {
|
|
|
13982
14154
|
const userId = c.req.param("userId");
|
|
13983
14155
|
const target = await db.prepare("SELECT id, email FROM auth_user WHERE id = ?").bind(userId).first();
|
|
13984
14156
|
if (!target?.id) return c.redirect("/admin/users?message=User not found&type=error");
|
|
13985
|
-
const svc = new
|
|
14157
|
+
const svc = new chunkJFLZHOQP_cjs.TenantService(db);
|
|
13986
14158
|
const [memberships, allTenants] = await Promise.all([svc.listUserMemberships(userId), svc.listTenants()]);
|
|
13987
14159
|
const memberSlugs = new Set(memberships.map((m) => m.slug));
|
|
13988
14160
|
const availableTenants = allTenants.filter((t) => t.status === "active" && !memberSlugs.has(t.slug)).map((t) => ({ slug: t.slug, name: t.name }));
|
|
@@ -14007,10 +14179,10 @@ function createTenantAdminRoutes() {
|
|
|
14007
14179
|
const slug = String(form.get("slug") ?? "").trim().toLowerCase();
|
|
14008
14180
|
const role = String(form.get("role") ?? "viewer");
|
|
14009
14181
|
const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
|
|
14010
|
-
if (!
|
|
14182
|
+
if (!chunkJFLZHOQP_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
|
|
14011
14183
|
const target = await db.prepare("SELECT email FROM auth_user WHERE id = ?").bind(userId).first();
|
|
14012
14184
|
if (!target) throw new Error("User not found");
|
|
14013
|
-
const svc = new
|
|
14185
|
+
const svc = new chunkJFLZHOQP_cjs.TenantService(db);
|
|
14014
14186
|
if (!await svc.getTenantBySlug(slug)) throw new Error("Tenant not found");
|
|
14015
14187
|
if (await svc.isMember(userId, slug)) throw new Error(`Already a member of '${slug}'`);
|
|
14016
14188
|
await svc.addMember(slug, userId, role, target.email ?? null);
|
|
@@ -14029,7 +14201,7 @@ function createTenantAdminRoutes() {
|
|
|
14029
14201
|
const form = await c.req.formData();
|
|
14030
14202
|
const role = String(form.get("role") ?? "");
|
|
14031
14203
|
const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
|
|
14032
|
-
await new
|
|
14204
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).setMemberRole(slug, userId, role);
|
|
14033
14205
|
return c.redirect(`${redirectTo}?message=Role updated`);
|
|
14034
14206
|
} catch (error) {
|
|
14035
14207
|
const message = error instanceof Error ? error.message : "Failed to update role";
|
|
@@ -14044,7 +14216,7 @@ function createTenantAdminRoutes() {
|
|
|
14044
14216
|
try {
|
|
14045
14217
|
const form = await c.req.formData();
|
|
14046
14218
|
const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
|
|
14047
|
-
await new
|
|
14219
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).removeMember(slug, userId);
|
|
14048
14220
|
return c.redirect(`${redirectTo}?message=Removed from ${encodeURIComponent(slug)}`);
|
|
14049
14221
|
} catch (error) {
|
|
14050
14222
|
const message = error instanceof Error ? error.message : "Failed to remove membership";
|
|
@@ -14059,7 +14231,7 @@ function createTenantAdminRoutes() {
|
|
|
14059
14231
|
return c.html(renderTenantsInactive({ user: userShape(cur), version }));
|
|
14060
14232
|
}
|
|
14061
14233
|
const roleName = c.req.param("roleName");
|
|
14062
|
-
const assignments = await new
|
|
14234
|
+
const assignments = await new chunkJFLZHOQP_cjs.TenantService(db).listAssignmentsByRole(roleName);
|
|
14063
14235
|
return c.html(renderRoleUsage({ roleName, assignments, user: userShape(cur), version }));
|
|
14064
14236
|
});
|
|
14065
14237
|
routes2.get("/", async (c) => {
|
|
@@ -14069,7 +14241,7 @@ function createTenantAdminRoutes() {
|
|
|
14069
14241
|
if (!await isMultiTenantActive(db)) {
|
|
14070
14242
|
return c.html(renderTenantsInactive({ user: userShape(user), version }));
|
|
14071
14243
|
}
|
|
14072
|
-
const svc = new
|
|
14244
|
+
const svc = new chunkJFLZHOQP_cjs.TenantService(db);
|
|
14073
14245
|
await svc.ensureDefaultTenant();
|
|
14074
14246
|
const tenants = await svc.listTenants();
|
|
14075
14247
|
const [docRes, memberRes] = await db.batch([
|
|
@@ -14108,7 +14280,7 @@ function createTenantAdminRoutes() {
|
|
|
14108
14280
|
formEntries = Object.fromEntries(form.entries());
|
|
14109
14281
|
const validated = tenantFormSchema.parse(formEntries);
|
|
14110
14282
|
if (!validated.slug) throw new zod.z.ZodError([{ code: "custom", message: "Slug is required", path: ["slug"] }]);
|
|
14111
|
-
const svc = new
|
|
14283
|
+
const svc = new chunkJFLZHOQP_cjs.TenantService(db);
|
|
14112
14284
|
await svc.createTenant({
|
|
14113
14285
|
name: validated.name,
|
|
14114
14286
|
slug: validated.slug,
|
|
@@ -14133,7 +14305,7 @@ function createTenantAdminRoutes() {
|
|
|
14133
14305
|
if (!await isMultiTenantActive(db)) {
|
|
14134
14306
|
return c.html(renderTenantsInactive({ user: userShape(user), version }));
|
|
14135
14307
|
}
|
|
14136
|
-
const tenant = await new
|
|
14308
|
+
const tenant = await new chunkJFLZHOQP_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
|
|
14137
14309
|
if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
|
|
14138
14310
|
return c.html(renderTenantForm({ tenant, isEdit: true, user: userShape(user), version }));
|
|
14139
14311
|
});
|
|
@@ -14143,7 +14315,7 @@ function createTenantAdminRoutes() {
|
|
|
14143
14315
|
const version = c.get("appVersion");
|
|
14144
14316
|
const slug = c.req.param("slug");
|
|
14145
14317
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
14146
|
-
const svc = new
|
|
14318
|
+
const svc = new chunkJFLZHOQP_cjs.TenantService(db);
|
|
14147
14319
|
try {
|
|
14148
14320
|
const form = await c.req.formData();
|
|
14149
14321
|
const validated = tenantFormSchema.parse(Object.fromEntries(form.entries()));
|
|
@@ -14168,7 +14340,7 @@ function createTenantAdminRoutes() {
|
|
|
14168
14340
|
const slug = c.req.param("slug");
|
|
14169
14341
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
14170
14342
|
try {
|
|
14171
|
-
await new
|
|
14343
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).deleteTenant(slug);
|
|
14172
14344
|
return c.redirect("/admin/tenants?message=Tenant deleted successfully");
|
|
14173
14345
|
} catch (error) {
|
|
14174
14346
|
const message = error instanceof Error ? error.message : "Failed to delete tenant";
|
|
@@ -14183,7 +14355,7 @@ function createTenantAdminRoutes() {
|
|
|
14183
14355
|
return c.html(renderTenantsInactive({ user: userShape(user), version }));
|
|
14184
14356
|
}
|
|
14185
14357
|
const slug = c.req.param("slug");
|
|
14186
|
-
const svc = new
|
|
14358
|
+
const svc = new chunkJFLZHOQP_cjs.TenantService(db);
|
|
14187
14359
|
const tenant = await svc.getTenantBySlug(slug);
|
|
14188
14360
|
if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
|
|
14189
14361
|
const [members, invitations] = await Promise.all([svc.listMembers(slug), svc.listInvitations(slug)]);
|
|
@@ -14209,7 +14381,7 @@ function createTenantAdminRoutes() {
|
|
|
14209
14381
|
const form = await c.req.formData();
|
|
14210
14382
|
const email = String(form.get("email") ?? "");
|
|
14211
14383
|
const role = String(form.get("role") ?? "viewer");
|
|
14212
|
-
await new
|
|
14384
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).addMemberByEmail(slug, email, role);
|
|
14213
14385
|
return c.redirect(`/admin/tenants/${slug}/members?message=Member added`);
|
|
14214
14386
|
} catch (error) {
|
|
14215
14387
|
const message = error instanceof Error ? error.message : "Failed to add member";
|
|
@@ -14224,7 +14396,7 @@ function createTenantAdminRoutes() {
|
|
|
14224
14396
|
try {
|
|
14225
14397
|
const form = await c.req.formData();
|
|
14226
14398
|
const role = String(form.get("role") ?? "");
|
|
14227
|
-
await new
|
|
14399
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).setMemberRole(slug, userId, role);
|
|
14228
14400
|
return c.redirect(`/admin/tenants/${slug}/members?message=Role updated`);
|
|
14229
14401
|
} catch (error) {
|
|
14230
14402
|
const message = error instanceof Error ? error.message : "Failed to update role";
|
|
@@ -14237,7 +14409,7 @@ function createTenantAdminRoutes() {
|
|
|
14237
14409
|
const userId = c.req.param("userId");
|
|
14238
14410
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
14239
14411
|
try {
|
|
14240
|
-
await new
|
|
14412
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).removeMember(slug, userId);
|
|
14241
14413
|
return c.redirect(`/admin/tenants/${slug}/members?message=Member removed`);
|
|
14242
14414
|
} catch (error) {
|
|
14243
14415
|
const message = error instanceof Error ? error.message : "Failed to remove member";
|
|
@@ -14253,12 +14425,12 @@ function createTenantAdminRoutes() {
|
|
|
14253
14425
|
const form = await c.req.formData();
|
|
14254
14426
|
const email = String(form.get("email") ?? "");
|
|
14255
14427
|
const role = String(form.get("role") ?? "viewer");
|
|
14256
|
-
const token = await new
|
|
14428
|
+
const token = await new chunkJFLZHOQP_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
|
|
14257
14429
|
const origin = c.req.header("origin") || new URL(c.req.url).origin;
|
|
14258
14430
|
const acceptUrl = `${origin}/join/invite?token=${encodeURIComponent(token)}`;
|
|
14259
14431
|
let note;
|
|
14260
14432
|
let noteType = "";
|
|
14261
|
-
const svc2 =
|
|
14433
|
+
const svc2 = chunkJFLZHOQP_cjs.hasEmailService() ? chunkJFLZHOQP_cjs.getEmailService() : null;
|
|
14262
14434
|
const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
|
|
14263
14435
|
if (hasRealProvider) {
|
|
14264
14436
|
const result = await svc2.send({
|
|
@@ -14299,7 +14471,7 @@ function createTenantAdminRoutes() {
|
|
|
14299
14471
|
WHERE i.id = ? AND t.slug = ? AND i.status = 'pending'`
|
|
14300
14472
|
).bind(id, slug).first();
|
|
14301
14473
|
if (!inv) throw new Error("Invitation not found or already used");
|
|
14302
|
-
const svc2 =
|
|
14474
|
+
const svc2 = chunkJFLZHOQP_cjs.hasEmailService() ? chunkJFLZHOQP_cjs.getEmailService() : null;
|
|
14303
14475
|
const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
|
|
14304
14476
|
if (!hasRealProvider) throw new Error("No email plugin active");
|
|
14305
14477
|
const origin = c.req.header("origin") || new URL(c.req.url).origin;
|
|
@@ -14324,7 +14496,7 @@ function createTenantAdminRoutes() {
|
|
|
14324
14496
|
const id = c.req.param("id");
|
|
14325
14497
|
if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
|
|
14326
14498
|
try {
|
|
14327
|
-
await new
|
|
14499
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).revokeInvitation(slug, id);
|
|
14328
14500
|
return c.redirect(`/admin/tenants/${slug}/members?message=Invitation revoked`);
|
|
14329
14501
|
} catch (error) {
|
|
14330
14502
|
const message = error instanceof Error ? error.message : "Failed to revoke invitation";
|
|
@@ -14554,7 +14726,7 @@ function createJoinRoutes() {
|
|
|
14554
14726
|
if (existing) return rerender("An account with this email already exists. Please sign in instead.");
|
|
14555
14727
|
try {
|
|
14556
14728
|
const userId = crypto.randomUUID();
|
|
14557
|
-
const passwordHash = await
|
|
14729
|
+
const passwordHash = await chunkFTXGZ3BF_cjs.AuthManager.hashPassword(password);
|
|
14558
14730
|
const now = Date.now();
|
|
14559
14731
|
const nowSec = Math.floor(now / 1e3);
|
|
14560
14732
|
await db.batch([
|
|
@@ -14567,7 +14739,7 @@ function createJoinRoutes() {
|
|
|
14567
14739
|
VALUES (?, ?, ?, 'credential', ?, ?, ?)`
|
|
14568
14740
|
).bind(`cred-${userId}`, userId, userId, passwordHash, nowSec, nowSec)
|
|
14569
14741
|
]);
|
|
14570
|
-
await new
|
|
14742
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
|
|
14571
14743
|
const auth = chunkGMMCCIQO_cjs.createAuth(c.env);
|
|
14572
14744
|
const origin = new URL(c.req.url).origin;
|
|
14573
14745
|
const baReq = new Request(`${origin}/auth/sign-in/email`, {
|
|
@@ -14635,7 +14807,7 @@ function createJoinRoutes() {
|
|
|
14635
14807
|
const baBody = await baRes.json();
|
|
14636
14808
|
const userId = baBody?.user?.id;
|
|
14637
14809
|
if (!userId) return rerender("Sign-in succeeded but could not read user ID.");
|
|
14638
|
-
await new
|
|
14810
|
+
await new chunkJFLZHOQP_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
|
|
14639
14811
|
const headers = new Headers({ Location: "/admin?message=Welcome! You have joined " + encodeURIComponent(inv.tenantName) });
|
|
14640
14812
|
copyBaCookies(baRes, headers);
|
|
14641
14813
|
return new Response(null, { status: 302, headers });
|
|
@@ -14649,7 +14821,7 @@ function createJoinRoutes() {
|
|
|
14649
14821
|
|
|
14650
14822
|
// src/plugins/core-plugins/multi-tenant-plugin/index.ts
|
|
14651
14823
|
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>`;
|
|
14652
|
-
var multiTenantPlugin =
|
|
14824
|
+
var multiTenantPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
14653
14825
|
id: manifest_default2.id,
|
|
14654
14826
|
version: "1.0.0",
|
|
14655
14827
|
name: manifest_default2.name,
|
|
@@ -14664,30 +14836,30 @@ var multiTenantPlugin = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
14664
14836
|
{ label: "Tenants", path: "/admin/tenants", icon: TENANT_ICON, order: 80 }
|
|
14665
14837
|
],
|
|
14666
14838
|
activate: async () => {
|
|
14667
|
-
|
|
14839
|
+
chunkPYZYU7EK_cjs.invalidateTenantCache();
|
|
14668
14840
|
console.info("\u2705 Multi-Tenant plugin activated");
|
|
14669
14841
|
},
|
|
14670
14842
|
deactivate: async () => {
|
|
14671
|
-
|
|
14843
|
+
chunkPYZYU7EK_cjs.invalidateTenantCache();
|
|
14672
14844
|
console.info("\u274C Multi-Tenant plugin deactivated");
|
|
14673
14845
|
}
|
|
14674
14846
|
});
|
|
14675
14847
|
var routes = new hono.Hono();
|
|
14676
|
-
routes.use("*",
|
|
14677
|
-
routes.use("*",
|
|
14848
|
+
routes.use("*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
14849
|
+
routes.use("*", chunkFTXGZ3BF_cjs.requireRole(["admin", "editor"]));
|
|
14678
14850
|
routes.get("/:rootId", async (c) => {
|
|
14679
14851
|
const { rootId } = c.req.param();
|
|
14680
14852
|
const db = c.env.DB;
|
|
14681
|
-
const scope = await
|
|
14853
|
+
const scope = await chunkJFLZHOQP_cjs.resolveDocScope(c, db, { rootId });
|
|
14682
14854
|
if (!scope) {
|
|
14683
14855
|
return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Document not found.</p>', 404);
|
|
14684
14856
|
}
|
|
14685
14857
|
if (!scope.docType?.settings?.versioning) {
|
|
14686
14858
|
return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Versioning not enabled for this type.</p>', 404);
|
|
14687
14859
|
}
|
|
14688
|
-
const denied = await
|
|
14860
|
+
const denied = await chunkJFLZHOQP_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
|
|
14689
14861
|
if (denied) return denied;
|
|
14690
|
-
const repo = new
|
|
14862
|
+
const repo = new chunkJFLZHOQP_cjs.DocumentRepository(db, scope.tenantId);
|
|
14691
14863
|
const versions = await repo.getVersionHistory(rootId);
|
|
14692
14864
|
const safeRootIdAttr = chunkMNWKYY5E_cjs.escapeHtml(rootId);
|
|
14693
14865
|
const rows = versions.map((v) => {
|
|
@@ -14780,14 +14952,14 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
|
|
|
14780
14952
|
const { rootId, versionNumber } = c.req.param();
|
|
14781
14953
|
const db = c.env.DB;
|
|
14782
14954
|
const user = c.get("user");
|
|
14783
|
-
const scope = await
|
|
14955
|
+
const scope = await chunkJFLZHOQP_cjs.resolveDocScope(c, db, { rootId });
|
|
14784
14956
|
if (!scope) {
|
|
14785
14957
|
return c.json({ error: "Document not found" }, 404);
|
|
14786
14958
|
}
|
|
14787
14959
|
if (!scope.docType?.settings?.versioning) {
|
|
14788
14960
|
return c.json({ error: "Versioning not enabled for this type" }, 404);
|
|
14789
14961
|
}
|
|
14790
|
-
const denied = await
|
|
14962
|
+
const denied = await chunkJFLZHOQP_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
|
|
14791
14963
|
if (denied) return denied;
|
|
14792
14964
|
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();
|
|
14793
14965
|
if (!row) {
|
|
@@ -14810,7 +14982,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
|
|
|
14810
14982
|
var routes_default = routes;
|
|
14811
14983
|
|
|
14812
14984
|
// src/plugins/core-plugins/versioning-plugin/index.ts
|
|
14813
|
-
var versioningPlugin =
|
|
14985
|
+
var versioningPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
14814
14986
|
id: "versioning",
|
|
14815
14987
|
version: "1.0.0",
|
|
14816
14988
|
name: "Versioning",
|
|
@@ -14887,8 +15059,8 @@ function createMagicLinkAuthPlugin() {
|
|
|
14887
15059
|
const baseUrl = new URL(c.req.url).origin;
|
|
14888
15060
|
const magicLink = `${baseUrl}/auth/magic-link/verify?token=${token}`;
|
|
14889
15061
|
try {
|
|
14890
|
-
if (
|
|
14891
|
-
await
|
|
15062
|
+
if (chunkJFLZHOQP_cjs.hasEmailService()) {
|
|
15063
|
+
await chunkJFLZHOQP_cjs.getEmailService().send({
|
|
14892
15064
|
to: normalizedEmail,
|
|
14893
15065
|
subject: "Your Magic Link to Sign In",
|
|
14894
15066
|
flow: "magic-link",
|
|
@@ -14965,19 +15137,19 @@ function createMagicLinkAuthPlugin() {
|
|
|
14965
15137
|
SET used = 1, used_at = ?
|
|
14966
15138
|
WHERE id = ?
|
|
14967
15139
|
`).bind(Date.now(), magicLink.id).run();
|
|
14968
|
-
const tokenTtl = await
|
|
14969
|
-
const jwtToken = await
|
|
15140
|
+
const tokenTtl = await chunkFTXGZ3BF_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
|
|
15141
|
+
const jwtToken = await chunkFTXGZ3BF_cjs.AuthManager.generateToken(
|
|
14970
15142
|
user.id,
|
|
14971
15143
|
user.email,
|
|
14972
15144
|
user.role,
|
|
14973
15145
|
c.env.JWT_SECRET,
|
|
14974
15146
|
tokenTtl
|
|
14975
15147
|
);
|
|
14976
|
-
|
|
15148
|
+
chunkFTXGZ3BF_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
|
|
14977
15149
|
await db.prepare(`
|
|
14978
15150
|
UPDATE auth_user SET last_login_at = ? WHERE id = ?
|
|
14979
15151
|
`).bind(Date.now(), user.id).run();
|
|
14980
|
-
|
|
15152
|
+
chunkJFLZHOQP_cjs.dispatchHookEvent(
|
|
14981
15153
|
c,
|
|
14982
15154
|
"auth:magic-link:consumed",
|
|
14983
15155
|
{ user: { id: user.id, email: user.email, role: user.role } },
|
|
@@ -15462,7 +15634,7 @@ async function warmCollections(db) {
|
|
|
15462
15634
|
const collectionCache = chunkYA3TJ65D_cjs.getCacheService(config);
|
|
15463
15635
|
let count = 0;
|
|
15464
15636
|
try {
|
|
15465
|
-
const results =
|
|
15637
|
+
const results = chunkPYZYU7EK_cjs.getCollectionRegistry().listActive().map(chunkPYZYU7EK_cjs.collectionRecordToRow);
|
|
15466
15638
|
for (const collection of results) {
|
|
15467
15639
|
const key = collectionCache.generateKey("item", collection.id);
|
|
15468
15640
|
await collectionCache.set(key, collection);
|
|
@@ -15733,7 +15905,7 @@ function renderCacheDashboard(data) {
|
|
|
15733
15905
|
</script>
|
|
15734
15906
|
|
|
15735
15907
|
<!-- Confirmation Dialogs -->
|
|
15736
|
-
${
|
|
15908
|
+
${chunkJFLZHOQP_cjs.renderConfirmationDialog({
|
|
15737
15909
|
id: "clear-all-cache-confirm",
|
|
15738
15910
|
title: "Clear All Cache",
|
|
15739
15911
|
message: "Are you sure you want to clear all cache entries? This cannot be undone.",
|
|
@@ -15744,7 +15916,7 @@ function renderCacheDashboard(data) {
|
|
|
15744
15916
|
onConfirm: "performClearAllCaches()"
|
|
15745
15917
|
})}
|
|
15746
15918
|
|
|
15747
|
-
${
|
|
15919
|
+
${chunkJFLZHOQP_cjs.renderConfirmationDialog({
|
|
15748
15920
|
id: "clear-namespace-cache-confirm",
|
|
15749
15921
|
title: "Clear Namespace Cache",
|
|
15750
15922
|
message: "Clear cache for this namespace?",
|
|
@@ -15755,7 +15927,7 @@ function renderCacheDashboard(data) {
|
|
|
15755
15927
|
onConfirm: "performClearNamespaceCache()"
|
|
15756
15928
|
})}
|
|
15757
15929
|
|
|
15758
|
-
${
|
|
15930
|
+
${chunkJFLZHOQP_cjs.getConfirmationDialogScript()}
|
|
15759
15931
|
`;
|
|
15760
15932
|
const layoutData = {
|
|
15761
15933
|
title: "Cache System",
|
|
@@ -16021,7 +16193,7 @@ app.get("/", async (c) => {
|
|
|
16021
16193
|
const totalRequests = totalHits + totalMisses;
|
|
16022
16194
|
const overallHitRate = totalRequests > 0 ? totalHits / totalRequests * 100 : 0;
|
|
16023
16195
|
const DEFAULT_TTL = chunkYA3TJ65D_cjs.CACHE_CONFIGS.api?.ttl ?? 300;
|
|
16024
|
-
const collections =
|
|
16196
|
+
const collections = chunkPYZYU7EK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
|
|
16025
16197
|
const cacheOverride = r.cache;
|
|
16026
16198
|
const cacheEnabled = cacheOverride?.enabled !== false;
|
|
16027
16199
|
const hasCustomTtl = typeof cacheOverride?.ttl === "number";
|
|
@@ -16558,9 +16730,9 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
|
16558
16730
|
// src/app.ts
|
|
16559
16731
|
function createSonicJSApp(config = {}) {
|
|
16560
16732
|
const app2 = new hono.Hono();
|
|
16561
|
-
const appVersion = config.version ||
|
|
16733
|
+
const appVersion = config.version || chunkQWSR4THH_cjs.getCoreVersion();
|
|
16562
16734
|
const appName = config.name || "SonicJS AI";
|
|
16563
|
-
const hookSystem = new
|
|
16735
|
+
const hookSystem = new chunkMGHHPNJN_cjs.HookSystemImpl();
|
|
16564
16736
|
chunkJ6JTWD2A_cjs.setHookSystem(hookSystem);
|
|
16565
16737
|
const magicLinkPlugin = createMagicLinkAuthPlugin();
|
|
16566
16738
|
const corePluginsBeforeCatchAll = [
|
|
@@ -16568,7 +16740,7 @@ function createSonicJSApp(config = {}) {
|
|
|
16568
16740
|
apiKeysPlugin,
|
|
16569
16741
|
aiSearchPlugin,
|
|
16570
16742
|
oauthProvidersPlugin,
|
|
16571
|
-
|
|
16743
|
+
chunkJFLZHOQP_cjs.userProfilesPlugin,
|
|
16572
16744
|
otpLoginPlugin,
|
|
16573
16745
|
analyticsPlugin,
|
|
16574
16746
|
stripePlugin,
|
|
@@ -16578,23 +16750,23 @@ function createSonicJSApp(config = {}) {
|
|
|
16578
16750
|
shortcodesPlugin,
|
|
16579
16751
|
helloWorldPlugin,
|
|
16580
16752
|
multiTenantPlugin,
|
|
16581
|
-
|
|
16753
|
+
chunkJFLZHOQP_cjs.lexicalEditorPlugin,
|
|
16582
16754
|
versioningPlugin
|
|
16583
16755
|
];
|
|
16584
16756
|
const corePluginsAfterCatchAll = [emailPluginV3, magicLinkPlugin, emailReconciliationPlugin];
|
|
16585
|
-
const wirePlugins =
|
|
16757
|
+
const wirePlugins = chunkMGHHPNJN_cjs.createPluginWirer(
|
|
16586
16758
|
() => [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []],
|
|
16587
16759
|
// The capability-gated `ctx.cap.email` resolves to the app EmailService, which
|
|
16588
16760
|
// is initialized (below) just before wiring on the first request.
|
|
16589
16761
|
() => ({
|
|
16590
16762
|
hooks: hookSystem,
|
|
16591
16763
|
env: firstRequestEnv,
|
|
16592
|
-
providers: { email: () =>
|
|
16764
|
+
providers: { email: () => chunkJFLZHOQP_cjs.getEmailService() }
|
|
16593
16765
|
})
|
|
16594
16766
|
);
|
|
16595
16767
|
let firstRequestEnv;
|
|
16596
16768
|
const initEmailService = async (env = {}) => {
|
|
16597
|
-
if (
|
|
16769
|
+
if (chunkJFLZHOQP_cjs.hasEmailService()) return;
|
|
16598
16770
|
let provider;
|
|
16599
16771
|
let defaultFrom = config.email?.from;
|
|
16600
16772
|
let defaultReplyTo;
|
|
@@ -16629,14 +16801,14 @@ function createSonicJSApp(config = {}) {
|
|
|
16629
16801
|
}
|
|
16630
16802
|
}
|
|
16631
16803
|
defaultFrom = defaultFrom || env.DEFAULT_FROM_EMAIL || "noreply@sonicjs.local";
|
|
16632
|
-
|
|
16804
|
+
chunkJFLZHOQP_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
|
|
16633
16805
|
};
|
|
16634
16806
|
app2.use("*", async (c, next) => {
|
|
16635
16807
|
c.set("appVersion", appVersion);
|
|
16636
16808
|
await next();
|
|
16637
16809
|
});
|
|
16638
|
-
app2.use("*",
|
|
16639
|
-
app2.use("*",
|
|
16810
|
+
app2.use("*", chunkFTXGZ3BF_cjs.metricsMiddleware());
|
|
16811
|
+
app2.use("*", chunkFTXGZ3BF_cjs.bootstrapMiddleware(config));
|
|
16640
16812
|
const boot = async (env) => {
|
|
16641
16813
|
if (config.plugins?.disableAll) return;
|
|
16642
16814
|
firstRequestEnv = env;
|
|
@@ -16674,8 +16846,8 @@ function createSonicJSApp(config = {}) {
|
|
|
16674
16846
|
allowHeaders: ["Content-Type", "Authorization", "X-API-Key"],
|
|
16675
16847
|
credentials: true
|
|
16676
16848
|
}));
|
|
16677
|
-
app2.use("*",
|
|
16678
|
-
app2.use("*",
|
|
16849
|
+
app2.use("*", chunkFTXGZ3BF_cjs.securityHeadersMiddleware());
|
|
16850
|
+
app2.use("*", chunkFTXGZ3BF_cjs.csrfProtection());
|
|
16679
16851
|
app2.use("*", async (c, next) => {
|
|
16680
16852
|
try {
|
|
16681
16853
|
const reqUrl = new URL(c.req.url);
|
|
@@ -16713,9 +16885,9 @@ function createSonicJSApp(config = {}) {
|
|
|
16713
16885
|
app2.use("*", middleware);
|
|
16714
16886
|
}
|
|
16715
16887
|
}
|
|
16716
|
-
app2.use("*",
|
|
16717
|
-
app2.use("/admin/*",
|
|
16718
|
-
app2.use("/admin/*",
|
|
16888
|
+
app2.use("*", chunkPYZYU7EK_cjs.tenantMiddleware());
|
|
16889
|
+
app2.use("/admin/*", chunkFTXGZ3BF_cjs.requireAuth());
|
|
16890
|
+
app2.use("/admin/*", chunkFTXGZ3BF_cjs.requireRbac("portal", "access"));
|
|
16719
16891
|
app2.use("/admin/*", pluginMenuMiddleware());
|
|
16720
16892
|
const NAV_LANDING = [
|
|
16721
16893
|
{ path: "/admin/content", perm: "content:read" },
|
|
@@ -16761,43 +16933,43 @@ function createSonicJSApp(config = {}) {
|
|
|
16761
16933
|
});
|
|
16762
16934
|
app2.route("/api/security-audit", apiRoutes2);
|
|
16763
16935
|
app2.route("/admin/plugins/security-audit", adminRoutes3);
|
|
16764
|
-
app2.route("/api/media",
|
|
16765
|
-
app2.route("/api/system",
|
|
16766
|
-
app2.route("/api/documents",
|
|
16767
|
-
app2.route("/api",
|
|
16768
|
-
app2.route("/admin/documents",
|
|
16769
|
-
|
|
16770
|
-
app2.route("/admin/api",
|
|
16771
|
-
app2.route("/admin/collections",
|
|
16772
|
-
app2.route("/admin/settings",
|
|
16773
|
-
app2.route("/admin/api-reference",
|
|
16936
|
+
app2.route("/api/media", chunkJFLZHOQP_cjs.api_media_default);
|
|
16937
|
+
app2.route("/api/system", chunkJFLZHOQP_cjs.api_system_default);
|
|
16938
|
+
app2.route("/api/documents", chunkJFLZHOQP_cjs.apiDocumentsRoutes);
|
|
16939
|
+
app2.route("/api", chunkJFLZHOQP_cjs.api_default);
|
|
16940
|
+
app2.route("/admin/documents", chunkJFLZHOQP_cjs.adminDocumentsRoutes);
|
|
16941
|
+
chunkMGHHPNJN_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
|
|
16942
|
+
app2.route("/admin/api", chunkJFLZHOQP_cjs.admin_api_default);
|
|
16943
|
+
app2.route("/admin/collections", chunkJFLZHOQP_cjs.adminCollectionsRoutes);
|
|
16944
|
+
app2.route("/admin/settings", chunkJFLZHOQP_cjs.adminSettingsRoutes);
|
|
16945
|
+
app2.route("/admin/api-reference", chunkJFLZHOQP_cjs.router2);
|
|
16774
16946
|
app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
|
|
16775
|
-
app2.route("/admin/content",
|
|
16776
|
-
app2.route("/admin/media",
|
|
16947
|
+
app2.route("/admin/content", chunkJFLZHOQP_cjs.admin_content_default);
|
|
16948
|
+
app2.route("/admin/media", chunkJFLZHOQP_cjs.adminMediaRoutes);
|
|
16777
16949
|
app2.use("/auth/*", securityAuditMiddleware());
|
|
16778
16950
|
if (!config.plugins?.disableAll) {
|
|
16779
|
-
|
|
16951
|
+
chunkMGHHPNJN_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
|
|
16780
16952
|
app2.route("/admin/cache", cache_default.getRoutes());
|
|
16781
16953
|
if (config.plugins?.register && config.plugins.register.length > 0) {
|
|
16782
|
-
|
|
16954
|
+
chunkMGHHPNJN_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
|
|
16783
16955
|
}
|
|
16784
16956
|
}
|
|
16785
16957
|
app2.route("/api/events", apiRoutes4);
|
|
16786
|
-
app2.route("/admin/dashboard",
|
|
16787
|
-
app2.route("/admin/plugins",
|
|
16788
|
-
app2.route("/admin/logs",
|
|
16958
|
+
app2.route("/admin/dashboard", chunkJFLZHOQP_cjs.router);
|
|
16959
|
+
app2.route("/admin/plugins", chunkJFLZHOQP_cjs.adminPluginRoutes);
|
|
16960
|
+
app2.route("/admin/logs", chunkJFLZHOQP_cjs.adminLogsRoutes);
|
|
16789
16961
|
app2.route("/admin/rbac", adminRbacRoutes);
|
|
16790
|
-
app2.route("/admin",
|
|
16791
|
-
app2.route("/auth",
|
|
16962
|
+
app2.route("/admin", chunkJFLZHOQP_cjs.userRoutes);
|
|
16963
|
+
app2.route("/auth", chunkJFLZHOQP_cjs.auth_default);
|
|
16792
16964
|
app2.on(["GET", "POST"], "/auth/*", (c) => {
|
|
16793
16965
|
const reqUrl = new URL(c.req.url);
|
|
16794
16966
|
const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
|
|
16795
16967
|
const auth = chunkGMMCCIQO_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
|
|
16796
16968
|
return auth.handler(c.req.raw);
|
|
16797
16969
|
});
|
|
16798
|
-
app2.route("/",
|
|
16970
|
+
app2.route("/", chunkJFLZHOQP_cjs.test_cleanup_default);
|
|
16799
16971
|
if (!config.plugins?.disableAll) {
|
|
16800
|
-
|
|
16972
|
+
chunkMGHHPNJN_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
|
|
16801
16973
|
}
|
|
16802
16974
|
if (!config.plugins?.disableAll) {
|
|
16803
16975
|
const allMountedPlugins = [
|
|
@@ -16807,10 +16979,10 @@ function createSonicJSApp(config = {}) {
|
|
|
16807
16979
|
...config.plugins?.register ?? []
|
|
16808
16980
|
];
|
|
16809
16981
|
const userPlugins = (config.plugins?.register ?? []).filter(
|
|
16810
|
-
(p) => !
|
|
16982
|
+
(p) => !chunkPYZYU7EK_cjs.PLUGIN_REGISTRY[p.id]
|
|
16811
16983
|
);
|
|
16812
|
-
|
|
16813
|
-
|
|
16984
|
+
chunkMGHHPNJN_cjs.setPluginMenu(userPlugins.flatMap((p) => p.menu ?? []));
|
|
16985
|
+
chunkEUJAEB6W_cjs.setPluginDefinitions(allMountedPlugins);
|
|
16814
16986
|
}
|
|
16815
16987
|
app2.get("/favicon.svg", (c) => {
|
|
16816
16988
|
return new Response(faviconSvg, {
|
|
@@ -20304,7 +20476,7 @@ function createRedirectApiRoutes() {
|
|
|
20304
20476
|
});
|
|
20305
20477
|
return api;
|
|
20306
20478
|
}
|
|
20307
|
-
var redirectPlugin =
|
|
20479
|
+
var redirectPlugin = chunkEUJAEB6W_cjs.definePlugin({
|
|
20308
20480
|
id: manifest_default3.id,
|
|
20309
20481
|
version: manifest_default3.version,
|
|
20310
20482
|
name: manifest_default3.name,
|
|
@@ -20322,7 +20494,7 @@ var redirectPlugin = chunk5RSB5SEK_cjs.definePlugin({
|
|
|
20322
20494
|
async onBoot(ctx) {
|
|
20323
20495
|
const db = ctx.env?.DB;
|
|
20324
20496
|
if (!db) return;
|
|
20325
|
-
const registry = new
|
|
20497
|
+
const registry = new chunkFTXGZ3BF_cjs.DocumentTypeRegistry(db);
|
|
20326
20498
|
await registry.register({
|
|
20327
20499
|
id: "redirect",
|
|
20328
20500
|
name: "redirect",
|
|
@@ -20438,91 +20610,91 @@ function createDb(d1$1) {
|
|
|
20438
20610
|
}
|
|
20439
20611
|
|
|
20440
20612
|
// src/index.ts
|
|
20441
|
-
var VERSION =
|
|
20613
|
+
var VERSION = chunkQWSR4THH_cjs.package_default.version;
|
|
20442
20614
|
|
|
20443
20615
|
Object.defineProperty(exports, "DocumentRepository", {
|
|
20444
20616
|
enumerable: true,
|
|
20445
|
-
get: function () { return
|
|
20617
|
+
get: function () { return chunkJFLZHOQP_cjs.DocumentRepository; }
|
|
20446
20618
|
});
|
|
20447
20619
|
Object.defineProperty(exports, "ROUTES_INFO", {
|
|
20448
20620
|
enumerable: true,
|
|
20449
|
-
get: function () { return
|
|
20621
|
+
get: function () { return chunkJFLZHOQP_cjs.ROUTES_INFO; }
|
|
20450
20622
|
});
|
|
20451
20623
|
Object.defineProperty(exports, "adminApiRoutes", {
|
|
20452
20624
|
enumerable: true,
|
|
20453
|
-
get: function () { return
|
|
20625
|
+
get: function () { return chunkJFLZHOQP_cjs.admin_api_default; }
|
|
20454
20626
|
});
|
|
20455
20627
|
Object.defineProperty(exports, "adminCheckboxRoutes", {
|
|
20456
20628
|
enumerable: true,
|
|
20457
|
-
get: function () { return
|
|
20629
|
+
get: function () { return chunkJFLZHOQP_cjs.adminCheckboxRoutes; }
|
|
20458
20630
|
});
|
|
20459
20631
|
Object.defineProperty(exports, "adminCollectionsRoutes", {
|
|
20460
20632
|
enumerable: true,
|
|
20461
|
-
get: function () { return
|
|
20633
|
+
get: function () { return chunkJFLZHOQP_cjs.adminCollectionsRoutes; }
|
|
20462
20634
|
});
|
|
20463
20635
|
Object.defineProperty(exports, "adminContentRoutes", {
|
|
20464
20636
|
enumerable: true,
|
|
20465
|
-
get: function () { return
|
|
20637
|
+
get: function () { return chunkJFLZHOQP_cjs.admin_content_default; }
|
|
20466
20638
|
});
|
|
20467
20639
|
Object.defineProperty(exports, "adminDashboardRoutes", {
|
|
20468
20640
|
enumerable: true,
|
|
20469
|
-
get: function () { return
|
|
20641
|
+
get: function () { return chunkJFLZHOQP_cjs.router; }
|
|
20470
20642
|
});
|
|
20471
20643
|
Object.defineProperty(exports, "adminLogsRoutes", {
|
|
20472
20644
|
enumerable: true,
|
|
20473
|
-
get: function () { return
|
|
20645
|
+
get: function () { return chunkJFLZHOQP_cjs.adminLogsRoutes; }
|
|
20474
20646
|
});
|
|
20475
20647
|
Object.defineProperty(exports, "adminMediaRoutes", {
|
|
20476
20648
|
enumerable: true,
|
|
20477
|
-
get: function () { return
|
|
20649
|
+
get: function () { return chunkJFLZHOQP_cjs.adminMediaRoutes; }
|
|
20478
20650
|
});
|
|
20479
20651
|
Object.defineProperty(exports, "adminPluginRoutes", {
|
|
20480
20652
|
enumerable: true,
|
|
20481
|
-
get: function () { return
|
|
20653
|
+
get: function () { return chunkJFLZHOQP_cjs.adminPluginRoutes; }
|
|
20482
20654
|
});
|
|
20483
20655
|
Object.defineProperty(exports, "adminSettingsRoutes", {
|
|
20484
20656
|
enumerable: true,
|
|
20485
|
-
get: function () { return
|
|
20657
|
+
get: function () { return chunkJFLZHOQP_cjs.adminSettingsRoutes; }
|
|
20486
20658
|
});
|
|
20487
20659
|
Object.defineProperty(exports, "adminUsersRoutes", {
|
|
20488
20660
|
enumerable: true,
|
|
20489
|
-
get: function () { return
|
|
20661
|
+
get: function () { return chunkJFLZHOQP_cjs.userRoutes; }
|
|
20490
20662
|
});
|
|
20491
20663
|
Object.defineProperty(exports, "apiContentCrudRoutes", {
|
|
20492
20664
|
enumerable: true,
|
|
20493
|
-
get: function () { return
|
|
20665
|
+
get: function () { return chunkJFLZHOQP_cjs.api_content_crud_default; }
|
|
20494
20666
|
});
|
|
20495
20667
|
Object.defineProperty(exports, "apiMediaRoutes", {
|
|
20496
20668
|
enumerable: true,
|
|
20497
|
-
get: function () { return
|
|
20669
|
+
get: function () { return chunkJFLZHOQP_cjs.api_media_default; }
|
|
20498
20670
|
});
|
|
20499
20671
|
Object.defineProperty(exports, "apiRoutes", {
|
|
20500
20672
|
enumerable: true,
|
|
20501
|
-
get: function () { return
|
|
20673
|
+
get: function () { return chunkJFLZHOQP_cjs.api_default; }
|
|
20502
20674
|
});
|
|
20503
20675
|
Object.defineProperty(exports, "apiSystemRoutes", {
|
|
20504
20676
|
enumerable: true,
|
|
20505
|
-
get: function () { return
|
|
20677
|
+
get: function () { return chunkJFLZHOQP_cjs.api_system_default; }
|
|
20506
20678
|
});
|
|
20507
20679
|
Object.defineProperty(exports, "authRoutes", {
|
|
20508
20680
|
enumerable: true,
|
|
20509
|
-
get: function () { return
|
|
20681
|
+
get: function () { return chunkJFLZHOQP_cjs.auth_default; }
|
|
20510
20682
|
});
|
|
20511
20683
|
Object.defineProperty(exports, "createUserProfilesPlugin", {
|
|
20512
20684
|
enumerable: true,
|
|
20513
|
-
get: function () { return
|
|
20685
|
+
get: function () { return chunkJFLZHOQP_cjs.createUserProfilesPlugin; }
|
|
20514
20686
|
});
|
|
20515
20687
|
Object.defineProperty(exports, "defineUserProfile", {
|
|
20516
20688
|
enumerable: true,
|
|
20517
|
-
get: function () { return
|
|
20689
|
+
get: function () { return chunkJFLZHOQP_cjs.defineUserProfile; }
|
|
20518
20690
|
});
|
|
20519
20691
|
Object.defineProperty(exports, "getUserProfileConfig", {
|
|
20520
20692
|
enumerable: true,
|
|
20521
|
-
get: function () { return
|
|
20693
|
+
get: function () { return chunkJFLZHOQP_cjs.getUserProfileConfig; }
|
|
20522
20694
|
});
|
|
20523
20695
|
Object.defineProperty(exports, "userProfilesPlugin", {
|
|
20524
20696
|
enumerable: true,
|
|
20525
|
-
get: function () { return
|
|
20697
|
+
get: function () { return chunkJFLZHOQP_cjs.userProfilesPlugin; }
|
|
20526
20698
|
});
|
|
20527
20699
|
Object.defineProperty(exports, "Logger", {
|
|
20528
20700
|
enumerable: true,
|
|
@@ -20678,87 +20850,87 @@ Object.defineProperty(exports, "workflowHistory", {
|
|
|
20678
20850
|
});
|
|
20679
20851
|
Object.defineProperty(exports, "AuthManager", {
|
|
20680
20852
|
enumerable: true,
|
|
20681
|
-
get: function () { return
|
|
20853
|
+
get: function () { return chunkFTXGZ3BF_cjs.AuthManager; }
|
|
20682
20854
|
});
|
|
20683
20855
|
Object.defineProperty(exports, "PermissionManager", {
|
|
20684
20856
|
enumerable: true,
|
|
20685
|
-
get: function () { return
|
|
20857
|
+
get: function () { return chunkFTXGZ3BF_cjs.PermissionManager; }
|
|
20686
20858
|
});
|
|
20687
20859
|
Object.defineProperty(exports, "bootstrapDocumentTypes", {
|
|
20688
20860
|
enumerable: true,
|
|
20689
|
-
get: function () { return
|
|
20861
|
+
get: function () { return chunkFTXGZ3BF_cjs.bootstrapDocumentTypes; }
|
|
20690
20862
|
});
|
|
20691
20863
|
Object.defineProperty(exports, "bootstrapMiddleware", {
|
|
20692
20864
|
enumerable: true,
|
|
20693
|
-
get: function () { return
|
|
20865
|
+
get: function () { return chunkFTXGZ3BF_cjs.bootstrapMiddleware; }
|
|
20694
20866
|
});
|
|
20695
20867
|
Object.defineProperty(exports, "cacheHeaders", {
|
|
20696
20868
|
enumerable: true,
|
|
20697
|
-
get: function () { return
|
|
20869
|
+
get: function () { return chunkFTXGZ3BF_cjs.cacheHeaders; }
|
|
20698
20870
|
});
|
|
20699
20871
|
Object.defineProperty(exports, "compressionMiddleware", {
|
|
20700
20872
|
enumerable: true,
|
|
20701
|
-
get: function () { return
|
|
20873
|
+
get: function () { return chunkFTXGZ3BF_cjs.compressionMiddleware; }
|
|
20702
20874
|
});
|
|
20703
20875
|
Object.defineProperty(exports, "detailedLoggingMiddleware", {
|
|
20704
20876
|
enumerable: true,
|
|
20705
|
-
get: function () { return
|
|
20877
|
+
get: function () { return chunkFTXGZ3BF_cjs.detailedLoggingMiddleware; }
|
|
20706
20878
|
});
|
|
20707
20879
|
Object.defineProperty(exports, "getActivePlugins", {
|
|
20708
20880
|
enumerable: true,
|
|
20709
|
-
get: function () { return
|
|
20881
|
+
get: function () { return chunkFTXGZ3BF_cjs.getActivePlugins; }
|
|
20710
20882
|
});
|
|
20711
20883
|
Object.defineProperty(exports, "isPluginActive", {
|
|
20712
20884
|
enumerable: true,
|
|
20713
|
-
get: function () { return
|
|
20885
|
+
get: function () { return chunkFTXGZ3BF_cjs.isPluginActive; }
|
|
20714
20886
|
});
|
|
20715
20887
|
Object.defineProperty(exports, "logActivity", {
|
|
20716
20888
|
enumerable: true,
|
|
20717
|
-
get: function () { return
|
|
20889
|
+
get: function () { return chunkFTXGZ3BF_cjs.logActivity; }
|
|
20718
20890
|
});
|
|
20719
20891
|
Object.defineProperty(exports, "loggingMiddleware", {
|
|
20720
20892
|
enumerable: true,
|
|
20721
|
-
get: function () { return
|
|
20893
|
+
get: function () { return chunkFTXGZ3BF_cjs.loggingMiddleware; }
|
|
20722
20894
|
});
|
|
20723
20895
|
Object.defineProperty(exports, "optionalAuth", {
|
|
20724
20896
|
enumerable: true,
|
|
20725
|
-
get: function () { return
|
|
20897
|
+
get: function () { return chunkFTXGZ3BF_cjs.optionalAuth; }
|
|
20726
20898
|
});
|
|
20727
20899
|
Object.defineProperty(exports, "performanceLoggingMiddleware", {
|
|
20728
20900
|
enumerable: true,
|
|
20729
|
-
get: function () { return
|
|
20901
|
+
get: function () { return chunkFTXGZ3BF_cjs.performanceLoggingMiddleware; }
|
|
20730
20902
|
});
|
|
20731
20903
|
Object.defineProperty(exports, "requireActivePlugin", {
|
|
20732
20904
|
enumerable: true,
|
|
20733
|
-
get: function () { return
|
|
20905
|
+
get: function () { return chunkFTXGZ3BF_cjs.requireActivePlugin; }
|
|
20734
20906
|
});
|
|
20735
20907
|
Object.defineProperty(exports, "requireActivePlugins", {
|
|
20736
20908
|
enumerable: true,
|
|
20737
|
-
get: function () { return
|
|
20909
|
+
get: function () { return chunkFTXGZ3BF_cjs.requireActivePlugins; }
|
|
20738
20910
|
});
|
|
20739
20911
|
Object.defineProperty(exports, "requireAnyPermission", {
|
|
20740
20912
|
enumerable: true,
|
|
20741
|
-
get: function () { return
|
|
20913
|
+
get: function () { return chunkFTXGZ3BF_cjs.requireAnyPermission; }
|
|
20742
20914
|
});
|
|
20743
20915
|
Object.defineProperty(exports, "requireAuth", {
|
|
20744
20916
|
enumerable: true,
|
|
20745
|
-
get: function () { return
|
|
20917
|
+
get: function () { return chunkFTXGZ3BF_cjs.requireAuth; }
|
|
20746
20918
|
});
|
|
20747
20919
|
Object.defineProperty(exports, "requirePermission", {
|
|
20748
20920
|
enumerable: true,
|
|
20749
|
-
get: function () { return
|
|
20921
|
+
get: function () { return chunkFTXGZ3BF_cjs.requirePermission; }
|
|
20750
20922
|
});
|
|
20751
20923
|
Object.defineProperty(exports, "requireRole", {
|
|
20752
20924
|
enumerable: true,
|
|
20753
|
-
get: function () { return
|
|
20925
|
+
get: function () { return chunkFTXGZ3BF_cjs.requireRole; }
|
|
20754
20926
|
});
|
|
20755
20927
|
Object.defineProperty(exports, "securityHeaders", {
|
|
20756
20928
|
enumerable: true,
|
|
20757
|
-
get: function () { return
|
|
20929
|
+
get: function () { return chunkFTXGZ3BF_cjs.securityHeadersMiddleware; }
|
|
20758
20930
|
});
|
|
20759
20931
|
Object.defineProperty(exports, "securityLoggingMiddleware", {
|
|
20760
20932
|
enumerable: true,
|
|
20761
|
-
get: function () { return
|
|
20933
|
+
get: function () { return chunkFTXGZ3BF_cjs.securityLoggingMiddleware; }
|
|
20762
20934
|
});
|
|
20763
20935
|
Object.defineProperty(exports, "DocumentsService", {
|
|
20764
20936
|
enumerable: true,
|
|
@@ -20770,35 +20942,35 @@ Object.defineProperty(exports, "RbacService", {
|
|
|
20770
20942
|
});
|
|
20771
20943
|
Object.defineProperty(exports, "PluginBootstrapService", {
|
|
20772
20944
|
enumerable: true,
|
|
20773
|
-
get: function () { return
|
|
20945
|
+
get: function () { return chunkPYZYU7EK_cjs.PluginBootstrapService; }
|
|
20774
20946
|
});
|
|
20775
20947
|
Object.defineProperty(exports, "PluginServiceClass", {
|
|
20776
20948
|
enumerable: true,
|
|
20777
|
-
get: function () { return
|
|
20949
|
+
get: function () { return chunkPYZYU7EK_cjs.PluginService; }
|
|
20778
20950
|
});
|
|
20779
20951
|
Object.defineProperty(exports, "getAvailableCollectionNames", {
|
|
20780
20952
|
enumerable: true,
|
|
20781
|
-
get: function () { return
|
|
20953
|
+
get: function () { return chunkPYZYU7EK_cjs.getAvailableCollectionNames; }
|
|
20782
20954
|
});
|
|
20783
20955
|
Object.defineProperty(exports, "loadCollectionConfig", {
|
|
20784
20956
|
enumerable: true,
|
|
20785
|
-
get: function () { return
|
|
20957
|
+
get: function () { return chunkPYZYU7EK_cjs.loadCollectionConfig; }
|
|
20786
20958
|
});
|
|
20787
20959
|
Object.defineProperty(exports, "loadCollectionConfigs", {
|
|
20788
20960
|
enumerable: true,
|
|
20789
|
-
get: function () { return
|
|
20961
|
+
get: function () { return chunkPYZYU7EK_cjs.loadCollectionConfigs; }
|
|
20790
20962
|
});
|
|
20791
20963
|
Object.defineProperty(exports, "registerCollections", {
|
|
20792
20964
|
enumerable: true,
|
|
20793
|
-
get: function () { return
|
|
20965
|
+
get: function () { return chunkPYZYU7EK_cjs.registerCollections; }
|
|
20794
20966
|
});
|
|
20795
20967
|
Object.defineProperty(exports, "validateCollectionConfig", {
|
|
20796
20968
|
enumerable: true,
|
|
20797
|
-
get: function () { return
|
|
20969
|
+
get: function () { return chunkPYZYU7EK_cjs.validateCollectionConfig; }
|
|
20798
20970
|
});
|
|
20799
20971
|
Object.defineProperty(exports, "MigrationService", {
|
|
20800
20972
|
enumerable: true,
|
|
20801
|
-
get: function () { return
|
|
20973
|
+
get: function () { return chunk3CT3SUR4_cjs.MigrationService; }
|
|
20802
20974
|
});
|
|
20803
20975
|
Object.defineProperty(exports, "renderFilterBar", {
|
|
20804
20976
|
enumerable: true,
|
|
@@ -20838,99 +21010,99 @@ Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
|
|
|
20838
21010
|
});
|
|
20839
21011
|
Object.defineProperty(exports, "HookSystemImpl", {
|
|
20840
21012
|
enumerable: true,
|
|
20841
|
-
get: function () { return
|
|
21013
|
+
get: function () { return chunkMGHHPNJN_cjs.HookSystemImpl; }
|
|
20842
21014
|
});
|
|
20843
21015
|
Object.defineProperty(exports, "HookUtils", {
|
|
20844
21016
|
enumerable: true,
|
|
20845
|
-
get: function () { return
|
|
21017
|
+
get: function () { return chunkMGHHPNJN_cjs.HookUtils; }
|
|
20846
21018
|
});
|
|
20847
21019
|
Object.defineProperty(exports, "PluginDependencyCycleError", {
|
|
20848
21020
|
enumerable: true,
|
|
20849
|
-
get: function () { return
|
|
21021
|
+
get: function () { return chunkMGHHPNJN_cjs.PluginDependencyCycleError; }
|
|
20850
21022
|
});
|
|
20851
21023
|
Object.defineProperty(exports, "PluginManagerClass", {
|
|
20852
21024
|
enumerable: true,
|
|
20853
|
-
get: function () { return
|
|
21025
|
+
get: function () { return chunkMGHHPNJN_cjs.PluginManager; }
|
|
20854
21026
|
});
|
|
20855
21027
|
Object.defineProperty(exports, "PluginRegistryImpl", {
|
|
20856
21028
|
enumerable: true,
|
|
20857
|
-
get: function () { return
|
|
21029
|
+
get: function () { return chunkMGHHPNJN_cjs.PluginRegistryImpl; }
|
|
20858
21030
|
});
|
|
20859
21031
|
Object.defineProperty(exports, "PluginValidatorClass", {
|
|
20860
21032
|
enumerable: true,
|
|
20861
|
-
get: function () { return
|
|
21033
|
+
get: function () { return chunkMGHHPNJN_cjs.PluginValidator; }
|
|
20862
21034
|
});
|
|
20863
21035
|
Object.defineProperty(exports, "RegisterPluginsError", {
|
|
20864
21036
|
enumerable: true,
|
|
20865
|
-
get: function () { return
|
|
21037
|
+
get: function () { return chunkMGHHPNJN_cjs.RegisterPluginsError; }
|
|
20866
21038
|
});
|
|
20867
21039
|
Object.defineProperty(exports, "ScopedHookSystemClass", {
|
|
20868
21040
|
enumerable: true,
|
|
20869
|
-
get: function () { return
|
|
21041
|
+
get: function () { return chunkMGHHPNJN_cjs.ScopedHookSystem; }
|
|
20870
21042
|
});
|
|
20871
21043
|
Object.defineProperty(exports, "collectCronSchedules", {
|
|
20872
21044
|
enumerable: true,
|
|
20873
|
-
get: function () { return
|
|
21045
|
+
get: function () { return chunkMGHHPNJN_cjs.collectCronSchedules; }
|
|
20874
21046
|
});
|
|
20875
21047
|
Object.defineProperty(exports, "collectCrons", {
|
|
20876
21048
|
enumerable: true,
|
|
20877
|
-
get: function () { return
|
|
21049
|
+
get: function () { return chunkMGHHPNJN_cjs.collectCrons; }
|
|
20878
21050
|
});
|
|
20879
21051
|
Object.defineProperty(exports, "createScheduledHandler", {
|
|
20880
21052
|
enumerable: true,
|
|
20881
|
-
get: function () { return
|
|
21053
|
+
get: function () { return chunkMGHHPNJN_cjs.createScheduledHandler; }
|
|
20882
21054
|
});
|
|
20883
21055
|
Object.defineProperty(exports, "dispatchCronTick", {
|
|
20884
21056
|
enumerable: true,
|
|
20885
|
-
get: function () { return
|
|
21057
|
+
get: function () { return chunkMGHHPNJN_cjs.dispatchCronTick; }
|
|
20886
21058
|
});
|
|
20887
21059
|
Object.defineProperty(exports, "getPluginMenu", {
|
|
20888
21060
|
enumerable: true,
|
|
20889
|
-
get: function () { return
|
|
21061
|
+
get: function () { return chunkMGHHPNJN_cjs.getPluginMenu; }
|
|
20890
21062
|
});
|
|
20891
21063
|
Object.defineProperty(exports, "registerPlugins", {
|
|
20892
21064
|
enumerable: true,
|
|
20893
|
-
get: function () { return
|
|
21065
|
+
get: function () { return chunkMGHHPNJN_cjs.registerPlugins; }
|
|
20894
21066
|
});
|
|
20895
21067
|
Object.defineProperty(exports, "resetPluginMenu", {
|
|
20896
21068
|
enumerable: true,
|
|
20897
|
-
get: function () { return
|
|
21069
|
+
get: function () { return chunkMGHHPNJN_cjs.resetPluginMenu; }
|
|
20898
21070
|
});
|
|
20899
21071
|
Object.defineProperty(exports, "resolvePluginMenuItems", {
|
|
20900
21072
|
enumerable: true,
|
|
20901
|
-
get: function () { return
|
|
21073
|
+
get: function () { return chunkMGHHPNJN_cjs.resolvePluginMenuItems; }
|
|
20902
21074
|
});
|
|
20903
21075
|
Object.defineProperty(exports, "setPluginMenu", {
|
|
20904
21076
|
enumerable: true,
|
|
20905
|
-
get: function () { return
|
|
21077
|
+
get: function () { return chunkMGHHPNJN_cjs.setPluginMenu; }
|
|
20906
21078
|
});
|
|
20907
21079
|
Object.defineProperty(exports, "topoSort", {
|
|
20908
21080
|
enumerable: true,
|
|
20909
|
-
get: function () { return
|
|
21081
|
+
get: function () { return chunkMGHHPNJN_cjs.topoSort; }
|
|
20910
21082
|
});
|
|
20911
21083
|
Object.defineProperty(exports, "applySchemaDefaults", {
|
|
20912
21084
|
enumerable: true,
|
|
20913
|
-
get: function () { return
|
|
21085
|
+
get: function () { return chunkEUJAEB6W_cjs.applySchemaDefaults; }
|
|
20914
21086
|
});
|
|
20915
21087
|
Object.defineProperty(exports, "definePlugin", {
|
|
20916
21088
|
enumerable: true,
|
|
20917
|
-
get: function () { return
|
|
21089
|
+
get: function () { return chunkEUJAEB6W_cjs.definePlugin; }
|
|
20918
21090
|
});
|
|
20919
21091
|
Object.defineProperty(exports, "isDefinedPlugin", {
|
|
20920
21092
|
enumerable: true,
|
|
20921
|
-
get: function () { return
|
|
21093
|
+
get: function () { return chunkEUJAEB6W_cjs.isDefinedPlugin; }
|
|
20922
21094
|
});
|
|
20923
21095
|
Object.defineProperty(exports, "parseConfigSchema", {
|
|
20924
21096
|
enumerable: true,
|
|
20925
|
-
get: function () { return
|
|
21097
|
+
get: function () { return chunkEUJAEB6W_cjs.parseConfigSchema; }
|
|
20926
21098
|
});
|
|
20927
21099
|
Object.defineProperty(exports, "parseFormDataToSettings", {
|
|
20928
21100
|
enumerable: true,
|
|
20929
|
-
get: function () { return
|
|
21101
|
+
get: function () { return chunkEUJAEB6W_cjs.parseFormDataToSettings; }
|
|
20930
21102
|
});
|
|
20931
21103
|
Object.defineProperty(exports, "renderSchemaFields", {
|
|
20932
21104
|
enumerable: true,
|
|
20933
|
-
get: function () { return
|
|
21105
|
+
get: function () { return chunkEUJAEB6W_cjs.renderSchemaFields; }
|
|
20934
21106
|
});
|
|
20935
21107
|
Object.defineProperty(exports, "getHookSystem", {
|
|
20936
21108
|
enumerable: true,
|
|
@@ -20978,11 +21150,11 @@ Object.defineProperty(exports, "metricsTracker", {
|
|
|
20978
21150
|
});
|
|
20979
21151
|
Object.defineProperty(exports, "SONICJS_VERSION", {
|
|
20980
21152
|
enumerable: true,
|
|
20981
|
-
get: function () { return
|
|
21153
|
+
get: function () { return chunkQWSR4THH_cjs.SONICJS_VERSION; }
|
|
20982
21154
|
});
|
|
20983
21155
|
Object.defineProperty(exports, "getCoreVersion", {
|
|
20984
21156
|
enumerable: true,
|
|
20985
|
-
get: function () { return
|
|
21157
|
+
get: function () { return chunkQWSR4THH_cjs.getCoreVersion; }
|
|
20986
21158
|
});
|
|
20987
21159
|
Object.defineProperty(exports, "escapeHtml", {
|
|
20988
21160
|
enumerable: true,
|