@sonicjs-cms/core 3.0.0-beta.24 → 3.0.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/db-reset.js +39 -22
- package/dist/admin-documents-form.template-JWV5GITD.js +6 -0
- package/dist/{admin-documents-form.template-55V2ZGWT.js.map → admin-documents-form.template-JWV5GITD.js.map} +1 -1
- package/dist/admin-documents-form.template-UWKGVAMW.cjs +19 -0
- package/dist/{admin-layout-catalyst.template-6UQGLCKI.js.map → admin-documents-form.template-UWKGVAMW.cjs.map} +1 -1
- package/dist/admin-layout-catalyst.template-MOQ3BBXA.cjs +21 -0
- package/dist/{admin-layout-catalyst.template-3XZXDGF7.cjs.map → admin-layout-catalyst.template-MOQ3BBXA.cjs.map} +1 -1
- package/dist/admin-layout-catalyst.template-WCYMQVTZ.js +7 -0
- package/dist/{admin-documents-form.template-YNAVMJCV.cjs.map → admin-layout-catalyst.template-WCYMQVTZ.js.map} +1 -1
- package/dist/{app-01M0dIwt.d.ts → app-BP5IlK94.d.ts} +7 -7
- package/dist/{app-aj39TGHB.d.cts → app-fdq4K3vw.d.cts} +7 -7
- package/dist/catalog-56DR6OXI.cjs +41 -0
- package/dist/catalog-56DR6OXI.cjs.map +1 -0
- package/dist/catalog-6MB37KY7.js +4 -0
- package/dist/catalog-6MB37KY7.js.map +1 -0
- package/dist/{chunk-QCJHCSOK.cjs → chunk-4DHPR7KR.cjs} +77 -17
- package/dist/chunk-4DHPR7KR.cjs.map +1 -0
- package/dist/{chunk-UIHIXTIS.js → chunk-5YSFQO7X.js} +40 -13
- package/dist/chunk-5YSFQO7X.js.map +1 -0
- package/dist/{chunk-GMMCCIQO.cjs → chunk-6UAI4SGN.cjs} +3 -3
- package/dist/{chunk-GMMCCIQO.cjs.map → chunk-6UAI4SGN.cjs.map} +1 -1
- package/dist/{chunk-2XAQTPAE.js → chunk-6X22VFEV.js} +8 -2
- package/dist/chunk-6X22VFEV.js.map +1 -0
- package/dist/{chunk-URIBTX27.js → chunk-73RTFFMX.js} +3 -3
- package/dist/{chunk-URIBTX27.js.map → chunk-73RTFFMX.js.map} +1 -1
- package/dist/{chunk-QJUJNTIU.cjs → chunk-A22RBHO7.cjs} +43 -12
- package/dist/chunk-A22RBHO7.cjs.map +1 -0
- package/dist/{chunk-QZGABF2M.js → chunk-AMP4BSJE.js} +18 -7
- package/dist/chunk-AMP4BSJE.js.map +1 -0
- package/dist/{chunk-37V3RET3.cjs → chunk-BRKXMRMB.cjs} +99 -98
- package/dist/chunk-BRKXMRMB.cjs.map +1 -0
- package/dist/{chunk-36Z3AKX3.cjs → chunk-C5LDQ3SH.cjs} +8 -2
- package/dist/chunk-C5LDQ3SH.cjs.map +1 -0
- package/dist/{chunk-BBEKHLTW.cjs → chunk-CN3T3TDI.cjs} +9 -9
- package/dist/{chunk-BBEKHLTW.cjs.map → chunk-CN3T3TDI.cjs.map} +1 -1
- package/dist/{chunk-BHND5PEV.js → chunk-E3TQG7AA.js} +3 -3
- package/dist/{chunk-BHND5PEV.js.map → chunk-E3TQG7AA.js.map} +1 -1
- package/dist/{chunk-FHPEM77Y.js → chunk-EEA476CJ.js} +88 -83
- package/dist/chunk-EEA476CJ.js.map +1 -0
- package/dist/chunk-F6BTBE4S.js +119 -0
- package/dist/chunk-F6BTBE4S.js.map +1 -0
- package/dist/chunk-FZGIU5AZ.cjs +128 -0
- package/dist/chunk-FZGIU5AZ.cjs.map +1 -0
- package/dist/{chunk-BJROXF4N.js → chunk-HSDJDWLV.js} +19 -4
- package/dist/chunk-HSDJDWLV.js.map +1 -0
- package/dist/{chunk-VGEZNFWH.js → chunk-JD7BZU3A.js} +5 -4
- package/dist/chunk-JD7BZU3A.js.map +1 -0
- package/dist/{chunk-SOZUG52O.js → chunk-JG5J434C.js} +3 -3
- package/dist/{chunk-SOZUG52O.js.map → chunk-JG5J434C.js.map} +1 -1
- package/dist/{chunk-BP52BFIV.cjs → chunk-KWQNB6UM.cjs} +6 -5
- package/dist/chunk-KWQNB6UM.cjs.map +1 -0
- package/dist/{chunk-UYJQDDEE.cjs → chunk-MI2YXCK4.cjs} +14 -8
- package/dist/chunk-MI2YXCK4.cjs.map +1 -0
- package/dist/{chunk-VC5XVPLM.js → chunk-OJFIQGZB.js} +512 -148
- package/dist/chunk-OJFIQGZB.js.map +1 -0
- package/dist/{chunk-LTZ5WYOK.cjs → chunk-OLEOKHDX.cjs} +25 -2
- package/dist/chunk-OLEOKHDX.cjs.map +1 -0
- package/dist/{chunk-E66UVONV.cjs → chunk-OUBUS74I.cjs} +24 -9
- package/dist/chunk-OUBUS74I.cjs.map +1 -0
- package/dist/{chunk-A2SN3RVL.cjs → chunk-PAS7GZBS.cjs} +40 -13
- package/dist/chunk-PAS7GZBS.cjs.map +1 -0
- package/dist/{chunk-RJ2O5IIE.js → chunk-RVOX2WH2.js} +74 -18
- package/dist/chunk-RVOX2WH2.js.map +1 -0
- package/dist/{chunk-3TMTYJAJ.js → chunk-RXLI3ADU.js} +25 -2
- package/dist/chunk-RXLI3ADU.js.map +1 -0
- package/dist/{chunk-I767LVN7.cjs → chunk-S2QN4LFD.cjs} +881 -515
- package/dist/chunk-S2QN4LFD.cjs.map +1 -0
- package/dist/{chunk-IXUHXTHW.cjs → chunk-SFGYZUWU.cjs} +18 -7
- package/dist/chunk-SFGYZUWU.cjs.map +1 -0
- package/dist/{chunk-THFZSDIU.js → chunk-SXC4HPK6.js} +14 -8
- package/dist/chunk-SXC4HPK6.js.map +1 -0
- package/dist/{chunk-JMJM7DMM.cjs → chunk-TT3TQSCZ.cjs} +5 -5
- package/dist/{chunk-JMJM7DMM.cjs.map → chunk-TT3TQSCZ.cjs.map} +1 -1
- package/dist/{chunk-LNI3FYSI.js → chunk-UB5QSRO7.js} +9 -14
- package/dist/chunk-UB5QSRO7.js.map +1 -0
- package/dist/{chunk-VYQVDL2M.js → chunk-UKIDWRA3.js} +36 -5
- package/dist/chunk-UKIDWRA3.js.map +1 -0
- package/dist/{chunk-KKNEYIZJ.cjs → chunk-XZUEGFXE.cjs} +9 -14
- package/dist/chunk-XZUEGFXE.cjs.map +1 -0
- package/dist/{collection-config-BTzAvKt2.d.cts → collection-config-U2dydD_O.d.cts} +14 -0
- package/dist/{collection-config-BTzAvKt2.d.ts → collection-config-U2dydD_O.d.ts} +14 -0
- package/dist/config-DOAWXZBG.js +6 -0
- package/dist/{config-6FB2BXMP.js.map → config-DOAWXZBG.js.map} +1 -1
- package/dist/{config-OCH7S4WK.cjs → config-VLU73ZW7.cjs} +5 -5
- package/dist/{config-OCH7S4WK.cjs.map → config-VLU73ZW7.cjs.map} +1 -1
- package/dist/{define-plugin-D_6D9vVZ.d.ts → define-plugin-DDe8a_bh.d.ts} +3 -0
- package/dist/{define-plugin-DMcvEy_C.d.cts → define-plugin-rjXmGOgu.d.cts} +3 -0
- package/dist/index.cjs +698 -392
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -12
- package/dist/index.d.ts +27 -12
- package/dist/index.js +340 -35
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +47 -47
- package/dist/middleware.d.cts +10 -10
- package/dist/middleware.d.ts +10 -10
- package/dist/middleware.js +6 -6
- package/dist/migrations-6M6772UC.cjs +13 -0
- package/dist/{migrations-FGXZPKDC.cjs.map → migrations-6M6772UC.cjs.map} +1 -1
- package/dist/migrations-GZ2HIB4I.js +4 -0
- package/dist/{migrations-Z6D27NAW.js.map → migrations-GZ2HIB4I.js.map} +1 -1
- package/dist/{plugin-bootstrap-BHWQ2df8.d.cts → plugin-bootstrap-CfVILQeP.d.ts} +1 -1
- package/dist/{plugin-bootstrap-Bj4fxX1q.d.ts → plugin-bootstrap-RY5pkoOT.d.cts} +1 -1
- package/dist/plugins.cjs +40 -40
- package/dist/plugins.d.cts +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +3 -3
- package/dist/rbac-TFUOYIVN.cjs +14 -0
- package/dist/{rbac-7QZ4JZ2E.cjs.map → rbac-TFUOYIVN.cjs.map} +1 -1
- package/dist/rbac-XSNP76CV.js +5 -0
- package/dist/{rbac-Y43IEQOP.js.map → rbac-XSNP76CV.js.map} +1 -1
- package/dist/routes.cjs +33 -32
- package/dist/routes.d.cts +3 -5
- package/dist/routes.d.ts +3 -5
- package/dist/routes.js +13 -12
- package/dist/services.cjs +30 -30
- package/dist/services.d.cts +10 -3
- package/dist/services.d.ts +10 -3
- package/dist/services.js +3 -3
- package/dist/{telemetry-Cku1ax74.d.cts → telemetry-QFlTv9f8.d.cts} +1 -1
- package/dist/{telemetry-Cku1ax74.d.ts → telemetry-QFlTv9f8.d.ts} +1 -1
- package/dist/templates.cjs +17 -17
- package/dist/templates.js +3 -3
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/utils.cjs +12 -12
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -2
- package/package.json +7 -12
- package/dist/admin-documents-form.template-55V2ZGWT.js +0 -6
- package/dist/admin-documents-form.template-YNAVMJCV.cjs +0 -19
- package/dist/admin-layout-catalyst.template-3XZXDGF7.cjs +0 -21
- package/dist/admin-layout-catalyst.template-6UQGLCKI.js +0 -7
- package/dist/chunk-2XAQTPAE.js.map +0 -1
- package/dist/chunk-36Z3AKX3.cjs.map +0 -1
- package/dist/chunk-37V3RET3.cjs.map +0 -1
- package/dist/chunk-3TMTYJAJ.js.map +0 -1
- package/dist/chunk-A2SN3RVL.cjs.map +0 -1
- package/dist/chunk-BJROXF4N.js.map +0 -1
- package/dist/chunk-BP52BFIV.cjs.map +0 -1
- package/dist/chunk-E66UVONV.cjs.map +0 -1
- package/dist/chunk-FHPEM77Y.js.map +0 -1
- package/dist/chunk-I767LVN7.cjs.map +0 -1
- package/dist/chunk-IXUHXTHW.cjs.map +0 -1
- package/dist/chunk-KKNEYIZJ.cjs.map +0 -1
- package/dist/chunk-LNI3FYSI.js.map +0 -1
- package/dist/chunk-LTZ5WYOK.cjs.map +0 -1
- package/dist/chunk-QCJHCSOK.cjs.map +0 -1
- package/dist/chunk-QJUJNTIU.cjs.map +0 -1
- package/dist/chunk-QZGABF2M.js.map +0 -1
- package/dist/chunk-RJ2O5IIE.js.map +0 -1
- package/dist/chunk-THFZSDIU.js.map +0 -1
- package/dist/chunk-UIHIXTIS.js.map +0 -1
- package/dist/chunk-UYJQDDEE.cjs.map +0 -1
- package/dist/chunk-VC5XVPLM.js.map +0 -1
- package/dist/chunk-VGEZNFWH.js.map +0 -1
- package/dist/chunk-VYQVDL2M.js.map +0 -1
- package/dist/config-6FB2BXMP.js +0 -6
- package/dist/migrations-FGXZPKDC.cjs +0 -13
- package/dist/migrations-Z6D27NAW.js +0 -4
- package/dist/rbac-7QZ4JZ2E.cjs +0 -14
- package/dist/rbac-Y43IEQOP.js +0 -5
package/dist/index.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { createAuth } from './chunk-
|
|
2
|
-
import { getEmailService, hasEmailService, setEmailService, reconcileMenuFromPlugins, invalidateVariablesCache, resolveVariablesInObject, resolveDocScope, denyIfNotAllowed, DocumentRepository, dispatchHookEvent, getCustomData, createDocumentSchema, renderTable, getVariablesCached, setVariablesCache, TenantService, isValidMemberRole, renderConfirmationDialog, getConfirmationDialogScript, VALID_MEMBER_ROLES, userProfilesPlugin, lexicalEditorPlugin, api_media_default, api_system_default, apiDocumentsRoutes, api_default, adminDocumentsRoutes, admin_api_default, adminCollectionsRoutes, adminSettingsRoutes, router2, admin_content_default, adminMediaRoutes, router, adminPluginRoutes, adminLogsRoutes, userRoutes, auth_default, test_cleanup_default, getDocumentRequestContext, updateDocumentSchema, effectiveTenantForType } from './chunk-
|
|
3
|
-
export { DocumentRepository, ROUTES_INFO, admin_api_default as adminApiRoutes, adminCheckboxRoutes, adminCollectionsRoutes, admin_content_default as adminContentRoutes, router as adminDashboardRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, userRoutes as adminUsersRoutes, api_content_crud_default as apiContentCrudRoutes, api_media_default as apiMediaRoutes, api_default as apiRoutes, api_system_default as apiSystemRoutes, auth_default as authRoutes, createUserProfilesPlugin, defineUserProfile, getUserProfileConfig, userProfilesPlugin } from './chunk-
|
|
1
|
+
import { createAuth } from './chunk-JG5J434C.js';
|
|
2
|
+
import { getEmailService, hasEmailService, setEmailService, reconcileMenuFromPlugins, invalidateVariablesCache, resolveVariablesInObject, resolveDocScope, denyIfNotAllowed, DocumentRepository, swrStats, setDemoModeActive, dispatchHookEvent, getCustomData, createDocumentSchema, renderTable, getVariablesCached, setVariablesCache, TenantService, isValidMemberRole, renderConfirmationDialog, getConfirmationDialogScript, VALID_MEMBER_ROLES, userProfilesPlugin, lexicalEditorPlugin, api_media_default, api_system_default, apiDocumentsRoutes, api_default, adminDocumentsRoutes, admin_api_default, adminCollectionsRoutes, adminSettingsRoutes, router2, admin_content_default, adminMediaRoutes, router, adminPluginRoutes, adminLogsRoutes, userRoutes, auth_default, test_cleanup_default, getDocumentRequestContext, updateDocumentSchema, effectiveTenantForType } from './chunk-OJFIQGZB.js';
|
|
3
|
+
export { DocumentRepository, ROUTES_INFO, admin_api_default as adminApiRoutes, adminCheckboxRoutes, adminCollectionsRoutes, admin_content_default as adminContentRoutes, router as adminDashboardRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, userRoutes as adminUsersRoutes, api_content_crud_default as apiContentCrudRoutes, api_media_default as apiMediaRoutes, api_default as apiRoutes, api_system_default as apiSystemRoutes, auth_default as authRoutes, createUserProfilesPlugin, defineUserProfile, getUserProfileConfig, userProfilesPlugin } from './chunk-OJFIQGZB.js';
|
|
4
|
+
import './chunk-E3TQG7AA.js';
|
|
5
|
+
import { loadKvCatalog, getCatalog, getCatalogStats, clearCatalog, clearKvCatalog } from './chunk-F6BTBE4S.js';
|
|
4
6
|
import './chunk-VVYVFCML.js';
|
|
5
|
-
import './chunk-
|
|
6
|
-
|
|
7
|
-
export { Logger, getLogger, initLogger } from './chunk-2XAQTPAE.js';
|
|
7
|
+
import { SettingsService, setAppInstance } from './chunk-6X22VFEV.js';
|
|
8
|
+
export { Logger, getLogger, initLogger } from './chunk-6X22VFEV.js';
|
|
8
9
|
import { getAllCacheStats, CACHE_CONFIGS, getCacheService, clearAllCaches, parseCacheKey } from './chunk-K25XHMM3.js';
|
|
9
10
|
import { schema_exports } from './chunk-AI663NBO.js';
|
|
10
11
|
export { apiTokens, content, contentVersions, insertContentSchema, insertLogConfigSchema, insertMediaSchema, insertPluginActivityLogSchema, insertPluginAssetSchema, insertPluginHookSchema, insertPluginRouteSchema, insertPluginSchema, insertSystemLogSchema, insertUserSchema, insertWorkflowHistorySchema, logConfig, media, pluginActivityLog, pluginAssets, pluginHooks, pluginRoutes, plugins, selectContentSchema, selectLogConfigSchema, selectMediaSchema, selectPluginActivityLogSchema, selectPluginAssetSchema, selectPluginHookSchema, selectPluginRouteSchema, selectPluginSchema, selectSystemLogSchema, selectUserSchema, selectWorkflowHistorySchema, systemLogs, users, workflowHistory } from './chunk-AI663NBO.js';
|
|
11
|
-
import { requireAuth, DocumentTypeRegistry, requireRbac, requireRole, getJwtExpirySecondsFromDb, AuthManager, metricsMiddleware, bootstrapMiddleware, securityHeadersMiddleware, csrfProtection } from './chunk-
|
|
12
|
-
export { AuthManager, PermissionManager, bootstrapDocumentTypes, bootstrapMiddleware, cacheHeaders, compressionMiddleware, detailedLoggingMiddleware,
|
|
13
|
-
import { RbacService, DocumentsService } from './chunk-
|
|
14
|
-
export { DocumentsService, RbacService } from './chunk-
|
|
12
|
+
import { requireAuth, DocumentTypeRegistry, requireRbac, requireRole, getJwtExpirySecondsFromDb, AuthManager, metricsMiddleware, bootstrapMiddleware, securityHeadersMiddleware, csrfProtection } from './chunk-EEA476CJ.js';
|
|
13
|
+
export { AuthManager, PermissionManager, bootstrapDocumentTypes, bootstrapMiddleware, cacheHeaders, compressionMiddleware, detailedLoggingMiddleware, logActivity, loggingMiddleware, optionalAuth, performanceLoggingMiddleware, requireAnyPermission, requireAuth, requirePermission, requireRole, securityHeadersMiddleware as securityHeaders, securityLoggingMiddleware } from './chunk-EEA476CJ.js';
|
|
14
|
+
import { RbacService, DocumentsService } from './chunk-RXLI3ADU.js';
|
|
15
|
+
export { DocumentsService, RbacService } from './chunk-RXLI3ADU.js';
|
|
15
16
|
import { nanoid } from './chunk-UWUP2VMT.js';
|
|
16
|
-
import { PluginService, PLUGIN_REGISTRY, invalidateTenantCache, getCollectionRegistry, TENANT_COOKIE, MULTI_TENANT_PLUGIN_ID, collectionRecordToRow, tenantMiddleware } from './chunk-
|
|
17
|
-
export { PluginBootstrapService, PluginService as PluginServiceClass, getAvailableCollectionNames, loadCollectionConfig, loadCollectionConfigs, registerCollections, validateCollectionConfig } from './chunk-
|
|
18
|
-
export { MigrationService } from './chunk-
|
|
19
|
-
export { renderFilterBar } from './chunk-
|
|
20
|
-
import { renderAdminLayout } from './chunk-
|
|
21
|
-
export { getConfirmationDialogScript, renderAlert, renderConfirmationDialog, renderForm, renderFormField, renderPagination, renderTable } from './chunk-
|
|
22
|
-
import { init_admin_layout_catalyst_template, renderAdminLayoutCatalyst } from './chunk-
|
|
23
|
-
export { renderAdminLayoutCatalyst } from './chunk-
|
|
24
|
-
import { TurnstileService, HookSystemImpl, createPluginWirer, registerPluginRoutes } from './chunk-
|
|
25
|
-
export { HookSystemImpl, HookUtils, PluginDependencyCycleError, PluginManager as PluginManagerClass, PluginRegistryImpl, PluginValidator as PluginValidatorClass, RegisterPluginsError, ScopedHookSystem as ScopedHookSystemClass, collectCronSchedules, collectCrons, createScheduledHandler, dispatchCronTick, registerPlugins, topoSort } from './chunk-
|
|
26
|
-
import { definePlugin, setPluginMenu, setPluginDefinitions, resolvePluginMenuItems } from './chunk-
|
|
27
|
-
export { applySchemaDefaults, definePlugin, getPluginMenu, isDefinedPlugin, parseConfigSchema, parseFormDataToSettings, renderSchemaFields, resetPluginMenu, resolvePluginMenuItems, setPluginMenu } from './chunk-
|
|
17
|
+
import { PluginService, PLUGIN_REGISTRY, invalidateTenantCache, getCollectionRegistry, TENANT_COOKIE, MULTI_TENANT_PLUGIN_ID, collectionRecordToRow, tenantMiddleware } from './chunk-RVOX2WH2.js';
|
|
18
|
+
export { PluginBootstrapService, PluginService as PluginServiceClass, getActivePlugins, getAvailableCollectionNames, isPluginActive, loadCollectionConfig, loadCollectionConfigs, registerCollections, requireActivePlugin, requireActivePlugins, validateCollectionConfig } from './chunk-RVOX2WH2.js';
|
|
19
|
+
export { MigrationService } from './chunk-5YSFQO7X.js';
|
|
20
|
+
export { renderFilterBar } from './chunk-73RTFFMX.js';
|
|
21
|
+
import { renderAdminLayout } from './chunk-HSDJDWLV.js';
|
|
22
|
+
export { getConfirmationDialogScript, renderAlert, renderConfirmationDialog, renderForm, renderFormField, renderPagination, renderTable } from './chunk-HSDJDWLV.js';
|
|
23
|
+
import { init_admin_layout_catalyst_template, renderAdminLayoutCatalyst } from './chunk-SXC4HPK6.js';
|
|
24
|
+
export { renderAdminLayoutCatalyst } from './chunk-SXC4HPK6.js';
|
|
25
|
+
import { TurnstileService, HookSystemImpl, createPluginWirer, registerPluginRoutes } from './chunk-UKIDWRA3.js';
|
|
26
|
+
export { HookSystemImpl, HookUtils, PluginDependencyCycleError, PluginManager as PluginManagerClass, PluginRegistryImpl, PluginValidator as PluginValidatorClass, RegisterPluginsError, ScopedHookSystem as ScopedHookSystemClass, collectCronSchedules, collectCrons, createScheduledHandler, dispatchCronTick, registerPlugins, topoSort } from './chunk-UKIDWRA3.js';
|
|
27
|
+
import { definePlugin, setPluginMenu, setPluginDefinitions, resolvePluginMenuItems } from './chunk-JD7BZU3A.js';
|
|
28
|
+
export { applySchemaDefaults, definePlugin, getPluginMenu, isDefinedPlugin, parseConfigSchema, parseFormDataToSettings, renderSchemaFields, resetPluginMenu, resolvePluginMenuItems, setPluginMenu } from './chunk-JD7BZU3A.js';
|
|
28
29
|
import { setHookSystem } from './chunk-RNZFGN4R.js';
|
|
29
30
|
export { getHookSystem, getTypedHooks, hasHookSystem, resetHookSystem, setHookSystem } from './chunk-RNZFGN4R.js';
|
|
30
|
-
export { QueryFilterBuilder, TemplateRenderer, buildQuery, renderTemplate, templateRenderer } from './chunk-
|
|
31
|
+
export { QueryFilterBuilder, TemplateRenderer, buildQuery, renderTemplate, templateRenderer } from './chunk-AMP4BSJE.js';
|
|
31
32
|
export { metricsTracker } from './chunk-FICTAGD4.js';
|
|
32
33
|
import './chunk-X7ZAEI5S.js';
|
|
33
|
-
import { getCoreVersion, package_default } from './chunk-
|
|
34
|
-
export { SONICJS_VERSION, getCoreVersion } from './chunk-
|
|
34
|
+
import { getCoreVersion, package_default } from './chunk-UB5QSRO7.js';
|
|
35
|
+
export { SONICJS_VERSION, getCoreVersion } from './chunk-UB5QSRO7.js';
|
|
35
36
|
import { escapeHtml, sanitizeInput } from './chunk-TQABQWOP.js';
|
|
36
37
|
export { escapeHtml, sanitizeInput, sanitizeObject } from './chunk-TQABQWOP.js';
|
|
37
38
|
export { HOOKS } from './chunk-QXOZI5Q2.js';
|
|
@@ -8112,7 +8113,7 @@ adminRoutes5.get("/settings", async (c) => {
|
|
|
8112
8113
|
const db = c.env.DB;
|
|
8113
8114
|
const user = c.get("user");
|
|
8114
8115
|
const settings = await getSettings4(db);
|
|
8115
|
-
const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-
|
|
8116
|
+
const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-WCYMQVTZ.js');
|
|
8116
8117
|
const content2 = `
|
|
8117
8118
|
<div>
|
|
8118
8119
|
<div class="mb-6">
|
|
@@ -11727,9 +11728,9 @@ function pluginMenuMiddleware() {
|
|
|
11727
11728
|
if (!path.startsWith("/admin")) {
|
|
11728
11729
|
return next();
|
|
11729
11730
|
}
|
|
11731
|
+
const db = c.env.DB;
|
|
11730
11732
|
let activeMenuItems = [];
|
|
11731
11733
|
try {
|
|
11732
|
-
const db = c.env.DB;
|
|
11733
11734
|
const pluginIds = REGISTRY_MENU_PLUGINS.map((p) => p.id);
|
|
11734
11735
|
if (pluginIds.length > 0) {
|
|
11735
11736
|
const placeholders = pluginIds.map(() => "?").join(",");
|
|
@@ -11753,9 +11754,24 @@ function pluginMenuMiddleware() {
|
|
|
11753
11754
|
}
|
|
11754
11755
|
const user = c.get("user");
|
|
11755
11756
|
const singletonItems = resolvePluginMenuItems(user ? { role: user.role } : void 0);
|
|
11757
|
+
const singletonPluginIds = [...new Set(
|
|
11758
|
+
singletonItems.map((i) => i.pluginId).filter((id) => !!id)
|
|
11759
|
+
)];
|
|
11760
|
+
let activeSingletonIds = /* @__PURE__ */ new Set();
|
|
11761
|
+
try {
|
|
11762
|
+
if (singletonPluginIds.length > 0) {
|
|
11763
|
+
const ph = singletonPluginIds.map(() => "?").join(",");
|
|
11764
|
+
const result = await db.prepare(
|
|
11765
|
+
`SELECT slug FROM documents WHERE type_id = 'plugin' AND tenant_id = 'default' AND slug IN (${ph}) AND q_plugin_status = 'active' AND is_current_draft = 1 AND deleted_at IS NULL`
|
|
11766
|
+
).bind(...singletonPluginIds).all();
|
|
11767
|
+
activeSingletonIds = new Set((result.results || []).map((r) => r.slug));
|
|
11768
|
+
}
|
|
11769
|
+
} catch {
|
|
11770
|
+
}
|
|
11756
11771
|
const existingPaths = new Set(activeMenuItems.map((i) => i.path));
|
|
11757
11772
|
for (const item of singletonItems) {
|
|
11758
|
-
|
|
11773
|
+
const isActive = !item.pluginId || activeSingletonIds.has(item.pluginId);
|
|
11774
|
+
if (isActive && !existingPaths.has(item.path)) {
|
|
11759
11775
|
activeMenuItems.push({ label: item.label, path: item.path, icon: item.icon, order: item.order });
|
|
11760
11776
|
}
|
|
11761
11777
|
}
|
|
@@ -17193,6 +17209,14 @@ function renderCacheDashboard(data) {
|
|
|
17193
17209
|
>
|
|
17194
17210
|
Collection Settings
|
|
17195
17211
|
</button>
|
|
17212
|
+
<button
|
|
17213
|
+
onclick="switchTab('url-catalog')"
|
|
17214
|
+
id="tab-url-catalog"
|
|
17215
|
+
class="cache-tab border-b-2 border-transparent py-3 px-1 text-sm font-medium text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 hover:border-zinc-300 dark:hover:border-zinc-600 whitespace-nowrap"
|
|
17216
|
+
>
|
|
17217
|
+
URL Catalog
|
|
17218
|
+
${data.catalog.stats.totalEntries > 0 ? `<span class="ml-1.5 inline-flex items-center rounded-full px-1.5 py-0.5 text-xs font-medium bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-300">${data.catalog.stats.totalEntries}</span>` : ""}
|
|
17219
|
+
</button>
|
|
17196
17220
|
</nav>
|
|
17197
17221
|
</div>
|
|
17198
17222
|
|
|
@@ -17273,10 +17297,18 @@ function renderCacheDashboard(data) {
|
|
|
17273
17297
|
<div id="tab-panel-collection-settings" class="hidden space-y-6">
|
|
17274
17298
|
${renderCollectionSettingsTab(data.collections)}
|
|
17275
17299
|
</div>
|
|
17300
|
+
|
|
17301
|
+
<!-- Tab: URL Catalog -->
|
|
17302
|
+
<div id="tab-panel-url-catalog" class="hidden space-y-6">
|
|
17303
|
+
${renderUrlCatalogTab(data.catalog)}
|
|
17304
|
+
</div>
|
|
17276
17305
|
</div>
|
|
17277
17306
|
|
|
17278
17307
|
<script>
|
|
17279
|
-
|
|
17308
|
+
const VALID_TABS = ['overview', 'collection-settings', 'url-catalog']
|
|
17309
|
+
|
|
17310
|
+
function switchTab(tab, pushHash) {
|
|
17311
|
+
if (!VALID_TABS.includes(tab)) tab = 'overview'
|
|
17280
17312
|
// Update tab button styles
|
|
17281
17313
|
document.querySelectorAll('.cache-tab').forEach(btn => {
|
|
17282
17314
|
btn.classList.remove('border-zinc-950', 'dark:border-white', 'text-zinc-950', 'dark:text-white')
|
|
@@ -17294,8 +17326,21 @@ function renderCacheDashboard(data) {
|
|
|
17294
17326
|
})
|
|
17295
17327
|
const activePanel = document.getElementById('tab-panel-' + tab)
|
|
17296
17328
|
if (activePanel) activePanel.classList.remove('hidden')
|
|
17329
|
+
|
|
17330
|
+
// Sync URL hash (pushHash=false when called from hashchange to avoid loop)
|
|
17331
|
+
if (pushHash !== false) location.hash = tab
|
|
17297
17332
|
}
|
|
17298
17333
|
|
|
17334
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
17335
|
+
const hash = location.hash.slice(1)
|
|
17336
|
+
switchTab(VALID_TABS.includes(hash) ? hash : 'overview', false)
|
|
17337
|
+
})
|
|
17338
|
+
|
|
17339
|
+
window.addEventListener('hashchange', function () {
|
|
17340
|
+
const hash = location.hash.slice(1)
|
|
17341
|
+
switchTab(VALID_TABS.includes(hash) ? hash : 'overview', false)
|
|
17342
|
+
})
|
|
17343
|
+
|
|
17299
17344
|
async function refreshStats() {
|
|
17300
17345
|
window.location.reload()
|
|
17301
17346
|
}
|
|
@@ -17319,6 +17364,21 @@ function renderCacheDashboard(data) {
|
|
|
17319
17364
|
}
|
|
17320
17365
|
}
|
|
17321
17366
|
|
|
17367
|
+
async function clearUrlCatalog() {
|
|
17368
|
+
try {
|
|
17369
|
+
const response = await fetch('/admin/cache/catalog/clear', { method: 'POST' })
|
|
17370
|
+
const result = await response.json()
|
|
17371
|
+
if (result.success) {
|
|
17372
|
+
alert('URL catalog cleared')
|
|
17373
|
+
window.location.reload()
|
|
17374
|
+
} else {
|
|
17375
|
+
alert('Error: ' + result.error)
|
|
17376
|
+
}
|
|
17377
|
+
} catch (error) {
|
|
17378
|
+
alert('Error: ' + error.message)
|
|
17379
|
+
}
|
|
17380
|
+
}
|
|
17381
|
+
|
|
17322
17382
|
let namespaceToDelete = null
|
|
17323
17383
|
|
|
17324
17384
|
async function clearNamespaceCache(namespace) {
|
|
@@ -17380,6 +17440,130 @@ function renderCacheDashboard(data) {
|
|
|
17380
17440
|
};
|
|
17381
17441
|
return renderAdminLayoutCatalyst(layoutData);
|
|
17382
17442
|
}
|
|
17443
|
+
function renderUrlCatalogTab(catalog) {
|
|
17444
|
+
const { entries, stats, swrPending } = catalog;
|
|
17445
|
+
const statCards = `
|
|
17446
|
+
<div class="grid grid-cols-2 gap-4 sm:grid-cols-4">
|
|
17447
|
+
${renderMiniStatCard("Tracked URLs", stats.totalEntries.toLocaleString(), "sky")}
|
|
17448
|
+
${renderMiniStatCard("Cache Hits", stats.totalHits.toLocaleString(), "lime")}
|
|
17449
|
+
${renderMiniStatCard("Cache Misses", stats.totalMisses.toLocaleString(), "amber")}
|
|
17450
|
+
${renderMiniStatCard("Stale Serves", stats.totalStale.toLocaleString(), "purple")}
|
|
17451
|
+
</div>
|
|
17452
|
+
`;
|
|
17453
|
+
const swrBadge = swrPending > 0 ? `<span class="ml-2 inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-300">${swrPending} stale pending</span>` : "";
|
|
17454
|
+
if (entries.length === 0) {
|
|
17455
|
+
return `
|
|
17456
|
+
${statCards}
|
|
17457
|
+
<div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
|
|
17458
|
+
<div class="p-12 text-center">
|
|
17459
|
+
<svg class="mx-auto h-8 w-8 text-zinc-400 dark:text-zinc-500 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
17460
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
|
|
17461
|
+
</svg>
|
|
17462
|
+
<p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">No entries yet</p>
|
|
17463
|
+
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Cache-eligible API requests will appear here after the first page load.</p>
|
|
17464
|
+
</div>
|
|
17465
|
+
</div>
|
|
17466
|
+
`;
|
|
17467
|
+
}
|
|
17468
|
+
const rows = entries.map((entry) => {
|
|
17469
|
+
const totalReqs = entry.hits + entry.misses + entry.staleServes;
|
|
17470
|
+
const hitRate = totalReqs > 0 ? Math.round(entry.hits / totalReqs * 100) : 0;
|
|
17471
|
+
const hitRateColor = hitRate > 70 ? "text-lime-600 dark:text-lime-400" : hitRate > 40 ? "text-amber-600 dark:text-amber-400" : "text-red-600 dark:text-red-400";
|
|
17472
|
+
const pathDisplay = entry.queryString ? `${entry.path}?${entry.queryString}` : entry.path;
|
|
17473
|
+
const truncatedPath = pathDisplay.length > 80 ? pathDisplay.slice(0, 77) + "\u2026" : pathDisplay;
|
|
17474
|
+
const collBadge = entry.collection ? `<span class="inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium bg-sky-50 dark:bg-sky-500/10 text-sky-700 dark:text-sky-400 ring-1 ring-inset ring-sky-600/20">${entry.collection}</span>` : `<span class="text-xs text-zinc-400 dark:text-zinc-600">\u2014</span>`;
|
|
17475
|
+
const timeAgo = formatTimeAgo(entry.lastSeen);
|
|
17476
|
+
return `
|
|
17477
|
+
<tr class="hover:bg-zinc-50 dark:hover:bg-zinc-800/50">
|
|
17478
|
+
<td class="px-4 py-3 max-w-xs">
|
|
17479
|
+
<code class="text-xs text-zinc-700 dark:text-zinc-300 break-all" title="${pathDisplay}">${truncatedPath}</code>
|
|
17480
|
+
</td>
|
|
17481
|
+
<td class="px-4 py-3 whitespace-nowrap">${collBadge}</td>
|
|
17482
|
+
<td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-900 dark:text-zinc-100 text-right">${totalReqs.toLocaleString()}</td>
|
|
17483
|
+
<td class="px-4 py-3 whitespace-nowrap text-right">
|
|
17484
|
+
<span class="text-sm font-medium ${hitRateColor}">${hitRate}%</span>
|
|
17485
|
+
</td>
|
|
17486
|
+
<td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-600 dark:text-zinc-400 text-right">${entry.hits.toLocaleString()}</td>
|
|
17487
|
+
<td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-600 dark:text-zinc-400 text-right">${entry.misses.toLocaleString()}</td>
|
|
17488
|
+
<td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-500 dark:text-zinc-500 text-right">${entry.staleServes > 0 ? entry.staleServes.toLocaleString() : "\u2014"}</td>
|
|
17489
|
+
<td class="px-4 py-3 whitespace-nowrap text-xs text-zinc-400 dark:text-zinc-500 text-right">${timeAgo}</td>
|
|
17490
|
+
</tr>
|
|
17491
|
+
`;
|
|
17492
|
+
}).join("");
|
|
17493
|
+
return `
|
|
17494
|
+
${statCards}
|
|
17495
|
+
|
|
17496
|
+
<div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
|
|
17497
|
+
<div class="px-6 py-4 border-b border-zinc-950/5 dark:border-white/10 flex items-center justify-between">
|
|
17498
|
+
<div>
|
|
17499
|
+
<h2 class="text-lg font-semibold text-zinc-950 dark:text-white">
|
|
17500
|
+
Cache-Eligible API URLs${swrBadge}
|
|
17501
|
+
</h2>
|
|
17502
|
+
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">
|
|
17503
|
+
Ranked by total requests. Resets on isolate eviction. Scoped to public/privileged (non-ACL) requests only.
|
|
17504
|
+
</p>
|
|
17505
|
+
</div>
|
|
17506
|
+
<button
|
|
17507
|
+
onclick="clearUrlCatalog()"
|
|
17508
|
+
class="inline-flex items-center gap-2 rounded-lg bg-white dark:bg-zinc-900 px-3 py-1.5 text-sm font-medium text-zinc-700 dark:text-zinc-300 ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-800"
|
|
17509
|
+
>
|
|
17510
|
+
Clear
|
|
17511
|
+
</button>
|
|
17512
|
+
</div>
|
|
17513
|
+
<div class="overflow-x-auto">
|
|
17514
|
+
<table class="min-w-full divide-y divide-zinc-950/5 dark:divide-white/10">
|
|
17515
|
+
<thead class="bg-zinc-50 dark:bg-zinc-800/50">
|
|
17516
|
+
<tr>
|
|
17517
|
+
<th class="px-4 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">URL</th>
|
|
17518
|
+
<th class="px-4 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Collection</th>
|
|
17519
|
+
<th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Requests</th>
|
|
17520
|
+
<th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Hit Rate</th>
|
|
17521
|
+
<th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Hits</th>
|
|
17522
|
+
<th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Misses</th>
|
|
17523
|
+
<th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Stale</th>
|
|
17524
|
+
<th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Last Seen</th>
|
|
17525
|
+
</tr>
|
|
17526
|
+
</thead>
|
|
17527
|
+
<tbody class="divide-y divide-zinc-950/5 dark:divide-white/10">
|
|
17528
|
+
${rows}
|
|
17529
|
+
</tbody>
|
|
17530
|
+
</table>
|
|
17531
|
+
</div>
|
|
17532
|
+
</div>
|
|
17533
|
+
|
|
17534
|
+
<div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
|
|
17535
|
+
<div class="px-6 py-5">
|
|
17536
|
+
<h3 class="text-sm font-semibold text-zinc-950 dark:text-white mb-2">About this catalog</h3>
|
|
17537
|
+
<ul class="text-sm text-zinc-600 dark:text-zinc-400 space-y-1 list-disc list-inside">
|
|
17538
|
+
<li><strong>Phase 1 (done):</strong> Collection-scoped cache invalidation \u2014 content changes only purge the affected collection's keys.</li>
|
|
17539
|
+
<li><strong>Phase 2 (this view):</strong> URL catalog tracks every cache-eligible API request. Use to identify hot URLs for targeted pre-warming.</li>
|
|
17540
|
+
<li><strong>Phase 3 (SWR):</strong> Stale-While-Revalidate \u2014 on invalidation, the previous response is kept for 30 s so the first post-edit request is served from cache instantly. Stale serves are counted above.</li>
|
|
17541
|
+
<li>Catalog is per-isolate and resets on cold start. For persistent tracking, sink data to Analytics Engine.</li>
|
|
17542
|
+
</ul>
|
|
17543
|
+
</div>
|
|
17544
|
+
</div>
|
|
17545
|
+
`;
|
|
17546
|
+
}
|
|
17547
|
+
function renderMiniStatCard(label, value, color) {
|
|
17548
|
+
const colorClasses = {
|
|
17549
|
+
sky: "bg-sky-50 dark:bg-sky-500/10 text-sky-600 dark:text-sky-400",
|
|
17550
|
+
lime: "bg-lime-50 dark:bg-lime-500/10 text-lime-600 dark:text-lime-400",
|
|
17551
|
+
amber: "bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
17552
|
+
purple: "bg-purple-50 dark:bg-purple-500/10 text-purple-600 dark:text-purple-400"
|
|
17553
|
+
};
|
|
17554
|
+
return `
|
|
17555
|
+
<div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10 p-4">
|
|
17556
|
+
<p class="text-xs text-zinc-500 dark:text-zinc-400">${label}</p>
|
|
17557
|
+
<p class="mt-1 text-xl font-semibold ${colorClasses[color] ?? colorClasses.sky}">${value}</p>
|
|
17558
|
+
</div>
|
|
17559
|
+
`;
|
|
17560
|
+
}
|
|
17561
|
+
function formatTimeAgo(ts) {
|
|
17562
|
+
const secs = Math.floor((Date.now() - ts) / 1e3);
|
|
17563
|
+
if (secs < 60) return `${secs}s ago`;
|
|
17564
|
+
if (secs < 3600) return `${Math.floor(secs / 60)}m ago`;
|
|
17565
|
+
return `${Math.floor(secs / 3600)}h ago`;
|
|
17566
|
+
}
|
|
17383
17567
|
function renderCollectionSettingsTab(collections) {
|
|
17384
17568
|
if (collections.length === 0) {
|
|
17385
17569
|
return `
|
|
@@ -17647,6 +17831,9 @@ app.get("/", async (c) => {
|
|
|
17647
17831
|
ttlSource: hasCustomTtl ? "collection" : "default"
|
|
17648
17832
|
};
|
|
17649
17833
|
});
|
|
17834
|
+
await loadKvCatalog();
|
|
17835
|
+
const catalogEntries = getCatalog({ limit: 100 });
|
|
17836
|
+
const catalogSummary = getCatalogStats();
|
|
17650
17837
|
const dashboardData = {
|
|
17651
17838
|
stats,
|
|
17652
17839
|
totals: {
|
|
@@ -17659,6 +17846,11 @@ app.get("/", async (c) => {
|
|
|
17659
17846
|
},
|
|
17660
17847
|
namespaces: Object.keys(stats),
|
|
17661
17848
|
collections,
|
|
17849
|
+
catalog: {
|
|
17850
|
+
entries: catalogEntries,
|
|
17851
|
+
stats: catalogSummary,
|
|
17852
|
+
swrPending: swrStats().count
|
|
17853
|
+
},
|
|
17662
17854
|
user: user ? {
|
|
17663
17855
|
name: user.email,
|
|
17664
17856
|
email: user.email,
|
|
@@ -18005,6 +18197,24 @@ app.post("/warm/:namespace", async (c) => {
|
|
|
18005
18197
|
}, 500);
|
|
18006
18198
|
}
|
|
18007
18199
|
});
|
|
18200
|
+
app.get("/catalog", async (c) => {
|
|
18201
|
+
const collection = c.req.query("collection") || void 0;
|
|
18202
|
+
const sortBy = c.req.query("sort") || "requests";
|
|
18203
|
+
const limit = parseInt(c.req.query("limit") || "100");
|
|
18204
|
+
await loadKvCatalog();
|
|
18205
|
+
const entries = getCatalog({ collection, sortBy, limit });
|
|
18206
|
+
const stats = getCatalogStats();
|
|
18207
|
+
return c.json({
|
|
18208
|
+
success: true,
|
|
18209
|
+
data: { entries, stats, swrPending: swrStats().count },
|
|
18210
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
18211
|
+
});
|
|
18212
|
+
});
|
|
18213
|
+
app.post("/catalog/clear", async (_c) => {
|
|
18214
|
+
clearCatalog();
|
|
18215
|
+
await clearKvCatalog();
|
|
18216
|
+
return _c.json({ success: true, message: "URL catalog cleared", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
18217
|
+
});
|
|
18008
18218
|
var routes_default2 = app;
|
|
18009
18219
|
|
|
18010
18220
|
// src/plugins/cache/index.ts
|
|
@@ -18250,7 +18460,7 @@ function createSonicJSApp(config = {}) {
|
|
|
18250
18460
|
await next();
|
|
18251
18461
|
});
|
|
18252
18462
|
app2.use("*", metricsMiddleware());
|
|
18253
|
-
app2.use("*", bootstrapMiddleware(config));
|
|
18463
|
+
app2.use("*", bootstrapMiddleware(config, [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []]));
|
|
18254
18464
|
const boot = async (env) => {
|
|
18255
18465
|
if (config.plugins?.disableAll) return;
|
|
18256
18466
|
firstRequestEnv = env;
|
|
@@ -18282,10 +18492,19 @@ function createSonicJSApp(config = {}) {
|
|
|
18282
18492
|
const allowed = c.env?.CORS_ORIGINS;
|
|
18283
18493
|
if (!allowed) return null;
|
|
18284
18494
|
const list = allowed.split(",").map((s) => s.trim());
|
|
18285
|
-
|
|
18495
|
+
const match = list.some((pattern) => {
|
|
18496
|
+
if (pattern === origin) return true;
|
|
18497
|
+
if (pattern.startsWith("*.")) {
|
|
18498
|
+
const suffix = pattern.slice(1);
|
|
18499
|
+
return origin.endsWith(suffix);
|
|
18500
|
+
}
|
|
18501
|
+
return false;
|
|
18502
|
+
});
|
|
18503
|
+
return match ? origin : null;
|
|
18286
18504
|
},
|
|
18287
18505
|
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
18288
|
-
allowHeaders: ["Content-Type", "Authorization", "X-API-Key"],
|
|
18506
|
+
allowHeaders: ["Content-Type", "Authorization", "X-API-Key", "Cache-Control"],
|
|
18507
|
+
exposeHeaders: ["X-Cache-Status", "X-Cache-Source", "X-Cache-TTL", "X-Response-Time"],
|
|
18289
18508
|
credentials: true
|
|
18290
18509
|
}));
|
|
18291
18510
|
app2.use("*", securityHeadersMiddleware());
|
|
@@ -18322,6 +18541,29 @@ function createSonicJSApp(config = {}) {
|
|
|
18322
18541
|
await next();
|
|
18323
18542
|
});
|
|
18324
18543
|
app2.use("*", apiKeyAuthMiddleware());
|
|
18544
|
+
app2.use("*", async (c, next) => {
|
|
18545
|
+
if (!c.get("user")) {
|
|
18546
|
+
const authHeader = c.req.header("Authorization");
|
|
18547
|
+
if (authHeader?.startsWith("Bearer ") && !authHeader.startsWith("Bearer sk_")) {
|
|
18548
|
+
const token = authHeader.slice(7);
|
|
18549
|
+
try {
|
|
18550
|
+
const secret = c.env?.JWT_SECRET;
|
|
18551
|
+
const payload = await AuthManager.verifyToken(token, secret);
|
|
18552
|
+
if (payload) {
|
|
18553
|
+
c.set("user", {
|
|
18554
|
+
userId: payload.userId,
|
|
18555
|
+
email: payload.email,
|
|
18556
|
+
role: payload.role,
|
|
18557
|
+
exp: payload.exp,
|
|
18558
|
+
iat: payload.iat
|
|
18559
|
+
});
|
|
18560
|
+
}
|
|
18561
|
+
} catch {
|
|
18562
|
+
}
|
|
18563
|
+
}
|
|
18564
|
+
}
|
|
18565
|
+
await next();
|
|
18566
|
+
});
|
|
18325
18567
|
if (config.middleware?.afterAuth) {
|
|
18326
18568
|
for (const middleware of config.middleware.afterAuth) {
|
|
18327
18569
|
app2.use("*", middleware);
|
|
@@ -18347,7 +18589,7 @@ function createSonicJSApp(config = {}) {
|
|
|
18347
18589
|
if (!user?.userId) return next();
|
|
18348
18590
|
let perms = [];
|
|
18349
18591
|
try {
|
|
18350
|
-
const { RbacService: RbacService2 } = await import('./rbac-
|
|
18592
|
+
const { RbacService: RbacService2 } = await import('./rbac-XSNP76CV.js');
|
|
18351
18593
|
perms = await new RbacService2(c.env.DB, c.env.CACHE_KV).permissionsForUser(user.userId);
|
|
18352
18594
|
} catch {
|
|
18353
18595
|
return next();
|
|
@@ -18424,7 +18666,7 @@ function createSonicJSApp(config = {}) {
|
|
|
18424
18666
|
const userPlugins = (config.plugins?.register ?? []).filter(
|
|
18425
18667
|
(p) => !PLUGIN_REGISTRY[p.id]
|
|
18426
18668
|
);
|
|
18427
|
-
setPluginMenu(userPlugins.flatMap((p) => p.menu ?? []));
|
|
18669
|
+
setPluginMenu(userPlugins.flatMap((p) => (p.menu ?? []).map((m) => ({ ...m, pluginId: p.id }))));
|
|
18428
18670
|
setPluginDefinitions(allMountedPlugins);
|
|
18429
18671
|
}
|
|
18430
18672
|
app2.get("/favicon.svg", (c) => {
|
|
@@ -21961,6 +22203,69 @@ function createRedirectPlugin() {
|
|
|
21961
22203
|
return redirectPlugin;
|
|
21962
22204
|
}
|
|
21963
22205
|
|
|
22206
|
+
// src/plugins/core-plugins/demo-login/index.ts
|
|
22207
|
+
var demoLoginJs = `
|
|
22208
|
+
// Demo Login Prefill Script
|
|
22209
|
+
(function() {
|
|
22210
|
+
'use strict';
|
|
22211
|
+
|
|
22212
|
+
function prefillLoginForm() {
|
|
22213
|
+
const emailInput = document.getElementById('email');
|
|
22214
|
+
const passwordInput = document.getElementById('password');
|
|
22215
|
+
|
|
22216
|
+
if (emailInput && passwordInput) {
|
|
22217
|
+
emailInput.value = 'admin@sonicjs.com';
|
|
22218
|
+
passwordInput.value = 'sonicjs!';
|
|
22219
|
+
|
|
22220
|
+
const form = emailInput.closest('form');
|
|
22221
|
+
if (form) {
|
|
22222
|
+
const notice = document.createElement('div');
|
|
22223
|
+
notice.className = 'mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg text-blue-800 text-sm';
|
|
22224
|
+
notice.innerHTML = '\u{1F3AF} <strong>Demo Mode:</strong> Login form prefilled with demo credentials';
|
|
22225
|
+
form.insertBefore(notice, form.firstChild);
|
|
22226
|
+
}
|
|
22227
|
+
}
|
|
22228
|
+
}
|
|
22229
|
+
|
|
22230
|
+
if (document.readyState === 'loading') {
|
|
22231
|
+
document.addEventListener('DOMContentLoaded', prefillLoginForm);
|
|
22232
|
+
} else {
|
|
22233
|
+
prefillLoginForm();
|
|
22234
|
+
}
|
|
22235
|
+
|
|
22236
|
+
document.addEventListener('htmx:afterSwap', function(event) {
|
|
22237
|
+
if (event.detail.target.id === 'main-content' ||
|
|
22238
|
+
document.getElementById('email')) {
|
|
22239
|
+
setTimeout(prefillLoginForm, 100);
|
|
22240
|
+
}
|
|
22241
|
+
});
|
|
22242
|
+
})();
|
|
22243
|
+
`;
|
|
22244
|
+
var loginPrefillHandler = async (data) => {
|
|
22245
|
+
if (data.pageType === "auth-login" || data.template?.includes("login")) {
|
|
22246
|
+
data.scripts = data.scripts ?? [];
|
|
22247
|
+
data.inlineScripts = data.inlineScripts ?? [];
|
|
22248
|
+
data.inlineScripts.push(demoLoginJs);
|
|
22249
|
+
}
|
|
22250
|
+
return data;
|
|
22251
|
+
};
|
|
22252
|
+
var demoLoginPlugin = definePlugin({
|
|
22253
|
+
id: "demo-login-plugin",
|
|
22254
|
+
version: "1.0.0",
|
|
22255
|
+
name: "Demo Login",
|
|
22256
|
+
description: "Prefills login form with demo credentials (admin@sonicjs.com/sonicjs!) for easy site demonstration.",
|
|
22257
|
+
sonicjsVersionRange: "^3.0.0",
|
|
22258
|
+
author: { name: "SonicJS" },
|
|
22259
|
+
async onBoot(ctx) {
|
|
22260
|
+
setDemoModeActive();
|
|
22261
|
+
const hooks = ctx.raw?.hooks;
|
|
22262
|
+
if (hooks?.register) {
|
|
22263
|
+
hooks.register("template:render", loginPrefillHandler);
|
|
22264
|
+
hooks.register("page:before-render", loginPrefillHandler);
|
|
22265
|
+
}
|
|
22266
|
+
}
|
|
22267
|
+
});
|
|
22268
|
+
|
|
21964
22269
|
// src/collections/site-settings.collection.ts
|
|
21965
22270
|
var site_settings_collection_default = {
|
|
21966
22271
|
name: "site_settings",
|
|
@@ -22882,6 +23187,6 @@ function createMcpPlugin(options) {
|
|
|
22882
23187
|
// src/index.ts
|
|
22883
23188
|
var VERSION = package_default.version;
|
|
22884
23189
|
|
|
22885
|
-
export { BUILT_IN_PROVIDERS, CloudflareEmailProvider2 as CloudflareEmailProvider, OAuthService, VERSION, createDb, createHelloWorldPlugin, createMcpPlugin, createOAuthProvidersPlugin, createRedirectPlugin, createSonicJSApp, emailReconciliationPlugin, generateTriggersComment, helloWorldPlugin, mcpPlugin, oauthProvidersPlugin, parseCronTriggers, redirectPlugin, setupCoreMiddleware, setupCoreRoutes, site_settings_collection_default as siteSettingsCollection, updateWranglerTriggers };
|
|
23190
|
+
export { BUILT_IN_PROVIDERS, CloudflareEmailProvider2 as CloudflareEmailProvider, OAuthService, VERSION, createDb, createHelloWorldPlugin, createMcpPlugin, createOAuthProvidersPlugin, createRedirectPlugin, createSonicJSApp, demoLoginPlugin, emailReconciliationPlugin, generateTriggersComment, helloWorldPlugin, mcpPlugin, oauthProvidersPlugin, parseCronTriggers, redirectPlugin, setupCoreMiddleware, setupCoreRoutes, site_settings_collection_default as siteSettingsCollection, updateWranglerTriggers };
|
|
22886
23191
|
//# sourceMappingURL=index.js.map
|
|
22887
23192
|
//# sourceMappingURL=index.js.map
|