@sonicjs-cms/core 2.0.0-alpha.9 → 2.0.0-beta.1
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-4XI3YBKU.cjs +266 -0
- package/dist/chunk-4XI3YBKU.cjs.map +1 -0
- package/dist/chunk-ET5I4GBD.cjs +3515 -0
- package/dist/chunk-ET5I4GBD.cjs.map +1 -0
- package/dist/{chunk-N7EIZ74L.js → chunk-JETM2U2D.js} +3479 -1328
- package/dist/chunk-JETM2U2D.js.map +1 -0
- package/dist/chunk-LU6J53IX.js +262 -0
- package/dist/chunk-LU6J53IX.js.map +1 -0
- package/dist/chunk-P3VS4DV3.js +3498 -0
- package/dist/chunk-P3VS4DV3.js.map +1 -0
- package/dist/{chunk-H6E2I5GW.cjs → chunk-QUMBDPNJ.cjs} +3522 -1365
- package/dist/chunk-QUMBDPNJ.cjs.map +1 -0
- package/dist/index.cjs +97 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts +2 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/routes.cjs +37 -12
- package/dist/routes.d.ts +2 -0
- package/dist/routes.js +2 -1
- package/dist/services.d.ts +2 -0
- package/dist/templates.cjs +45 -12
- package/dist/templates.d.ts +2 -0
- package/dist/templates.js +2 -1
- package/dist/types.d.ts +2 -0
- package/dist/utils.d.ts +2 -0
- package/package.json +2 -2
- package/dist/chunk-BRC3F4CG.cjs +0 -792
- package/dist/chunk-BRC3F4CG.cjs.map +0 -1
- package/dist/chunk-H6E2I5GW.cjs.map +0 -1
- package/dist/chunk-KRJMGD4E.js +0 -783
- package/dist/chunk-KRJMGD4E.js.map +0 -1
- package/dist/chunk-N7EIZ74L.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQUMBDPNJ_cjs = require('./chunk-QUMBDPNJ.cjs');
|
|
4
4
|
require('./chunk-AGOE25LF.cjs');
|
|
5
5
|
var chunkBUKT6HP5_cjs = require('./chunk-BUKT6HP5.cjs');
|
|
6
6
|
var chunkRNR4HA23_cjs = require('./chunk-RNR4HA23.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunk4XI3YBKU_cjs = require('./chunk-4XI3YBKU.cjs');
|
|
8
|
+
var chunkET5I4GBD_cjs = require('./chunk-ET5I4GBD.cjs');
|
|
8
9
|
var chunkFVMV5DKA_cjs = require('./chunk-FVMV5DKA.cjs');
|
|
9
10
|
var chunkRGCQSFKC_cjs = require('./chunk-RGCQSFKC.cjs');
|
|
10
11
|
var chunkKYGRJCZM_cjs = require('./chunk-KYGRJCZM.cjs');
|
|
@@ -39,15 +40,16 @@ function createSonicJSApp(config = {}) {
|
|
|
39
40
|
app.use("*", middleware);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
app.route("/api",
|
|
43
|
-
app.route("/api/media",
|
|
44
|
-
app.route("/api/system",
|
|
45
|
-
app.route("/admin/api",
|
|
46
|
-
app.route("/admin/content",
|
|
47
|
-
app.route("/admin/media",
|
|
48
|
-
app.route("/admin/plugins",
|
|
49
|
-
app.route("/admin",
|
|
50
|
-
app.route("/
|
|
43
|
+
app.route("/api", chunkQUMBDPNJ_cjs.api_default);
|
|
44
|
+
app.route("/api/media", chunkQUMBDPNJ_cjs.api_media_default);
|
|
45
|
+
app.route("/api/system", chunkQUMBDPNJ_cjs.api_system_default);
|
|
46
|
+
app.route("/admin/api", chunkQUMBDPNJ_cjs.admin_api_default);
|
|
47
|
+
app.route("/admin/content", chunkQUMBDPNJ_cjs.admin_content_default);
|
|
48
|
+
app.route("/admin/media", chunkQUMBDPNJ_cjs.adminMediaRoutes);
|
|
49
|
+
app.route("/admin/plugins", chunkQUMBDPNJ_cjs.adminPluginRoutes);
|
|
50
|
+
app.route("/admin/logs", chunkQUMBDPNJ_cjs.adminLogsRoutes);
|
|
51
|
+
app.route("/admin", chunkQUMBDPNJ_cjs.userRoutes);
|
|
52
|
+
app.route("/auth", chunkQUMBDPNJ_cjs.auth_default);
|
|
51
53
|
if (config.routes) {
|
|
52
54
|
for (const route of config.routes) {
|
|
53
55
|
app.route(route.path, route.handler);
|
|
@@ -83,12 +85,80 @@ function createDb(d1$1) {
|
|
|
83
85
|
return d1.drizzle(d1$1, { schema: chunkRNR4HA23_cjs.schema_exports });
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
// package.json
|
|
89
|
+
var package_default = {
|
|
90
|
+
version: "2.0.0-beta.1"};
|
|
91
|
+
|
|
86
92
|
// src/index.ts
|
|
87
|
-
var VERSION =
|
|
93
|
+
var VERSION = package_default.version;
|
|
88
94
|
|
|
89
95
|
Object.defineProperty(exports, "ROUTES_INFO", {
|
|
90
96
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkQUMBDPNJ_cjs.ROUTES_INFO; }
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(exports, "adminApiRoutes", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_api_default; }
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "adminCheckboxRoutes", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminCheckboxRoutes; }
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(exports, "adminCodeExamplesRoutes", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_code_examples_default; }
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(exports, "adminContentRoutes", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_content_default; }
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(exports, "adminDesignRoutes", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminDesignRoutes; }
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(exports, "adminFAQRoutes", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_faq_default; }
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(exports, "adminLogsRoutes", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminLogsRoutes; }
|
|
126
|
+
});
|
|
127
|
+
Object.defineProperty(exports, "adminMediaRoutes", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminMediaRoutes; }
|
|
130
|
+
});
|
|
131
|
+
Object.defineProperty(exports, "adminPluginRoutes", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminPluginRoutes; }
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, "adminTestimonialsRoutes", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_testimonials_default; }
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(exports, "adminUsersRoutes", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function () { return chunkQUMBDPNJ_cjs.userRoutes; }
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(exports, "apiContentCrudRoutes", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_content_crud_default; }
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(exports, "apiMediaRoutes", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_media_default; }
|
|
150
|
+
});
|
|
151
|
+
Object.defineProperty(exports, "apiRoutes", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_default; }
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(exports, "apiSystemRoutes", {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_system_default; }
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, "authRoutes", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () { return chunkQUMBDPNJ_cjs.auth_default; }
|
|
92
162
|
});
|
|
93
163
|
Object.defineProperty(exports, "AuthManager", {
|
|
94
164
|
enumerable: true,
|
|
@@ -386,37 +456,37 @@ Object.defineProperty(exports, "workflowHistory", {
|
|
|
386
456
|
enumerable: true,
|
|
387
457
|
get: function () { return chunkRNR4HA23_cjs.workflowHistory; }
|
|
388
458
|
});
|
|
389
|
-
Object.defineProperty(exports, "
|
|
459
|
+
Object.defineProperty(exports, "renderFilterBar", {
|
|
390
460
|
enumerable: true,
|
|
391
|
-
get: function () { return
|
|
461
|
+
get: function () { return chunk4XI3YBKU_cjs.renderFilterBar; }
|
|
392
462
|
});
|
|
393
|
-
Object.defineProperty(exports, "
|
|
463
|
+
Object.defineProperty(exports, "renderForm", {
|
|
394
464
|
enumerable: true,
|
|
395
|
-
get: function () { return
|
|
465
|
+
get: function () { return chunk4XI3YBKU_cjs.renderForm; }
|
|
396
466
|
});
|
|
397
|
-
Object.defineProperty(exports, "
|
|
467
|
+
Object.defineProperty(exports, "renderFormField", {
|
|
398
468
|
enumerable: true,
|
|
399
|
-
get: function () { return
|
|
469
|
+
get: function () { return chunk4XI3YBKU_cjs.renderFormField; }
|
|
400
470
|
});
|
|
401
|
-
Object.defineProperty(exports, "
|
|
471
|
+
Object.defineProperty(exports, "getConfirmationDialogScript", {
|
|
402
472
|
enumerable: true,
|
|
403
|
-
get: function () { return
|
|
473
|
+
get: function () { return chunkET5I4GBD_cjs.getConfirmationDialogScript; }
|
|
404
474
|
});
|
|
405
|
-
Object.defineProperty(exports, "
|
|
475
|
+
Object.defineProperty(exports, "renderAlert", {
|
|
406
476
|
enumerable: true,
|
|
407
|
-
get: function () { return
|
|
477
|
+
get: function () { return chunkET5I4GBD_cjs.renderAlert; }
|
|
408
478
|
});
|
|
409
|
-
Object.defineProperty(exports, "
|
|
479
|
+
Object.defineProperty(exports, "renderConfirmationDialog", {
|
|
410
480
|
enumerable: true,
|
|
411
|
-
get: function () { return
|
|
481
|
+
get: function () { return chunkET5I4GBD_cjs.renderConfirmationDialog; }
|
|
412
482
|
});
|
|
413
483
|
Object.defineProperty(exports, "renderPagination", {
|
|
414
484
|
enumerable: true,
|
|
415
|
-
get: function () { return
|
|
485
|
+
get: function () { return chunkET5I4GBD_cjs.renderPagination; }
|
|
416
486
|
});
|
|
417
487
|
Object.defineProperty(exports, "renderTable", {
|
|
418
488
|
enumerable: true,
|
|
419
|
-
get: function () { return
|
|
489
|
+
get: function () { return chunkET5I4GBD_cjs.renderTable; }
|
|
420
490
|
});
|
|
421
491
|
Object.defineProperty(exports, "HookSystemImpl", {
|
|
422
492
|
enumerable: true,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/app.ts","../src/db/index.ts","../src/index.ts"],"names":["Hono","api_default","api_media_default","api_system_default","admin_api_default","admin_content_default","adminMediaRoutes","adminPluginRoutes","userRoutes","auth_default","d1","drizzle","schema_exports"],"mappings":";;;;;;;;;;;;;;AAqGO,SAAS,gBAAA,CAAiB,MAAA,GAAwB,EAAC,EAAe;AACvE,EAAA,MAAM,GAAA,GAAM,IAAIA,SAAA,EAAmD;AAGnE,EAAA,MAAM,UAAA,GAAa,OAAO,OAAA,IAAW,OAAA;AACrC,EAAA,MAAM,OAAA,GAAU,OAAO,IAAA,IAAQ,SAAA;AAG/B,EAAA,GAAA,CAAI,GAAA,CAAI,GAAA,EAAK,OAAO,CAAA,EAAG,IAAA,KAAS;AAC9B,IAAA,CAAA,CAAE,GAAA,CAAI,cAAc,UAAU,CAAA;AAC9B,IAAA,MAAM,IAAA,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AA,CAAQ,KAAK,oEAAoE,CAAA;AAEnF;AAQO,SAAS,gBAAgB,IAAA,EAAwB;AACtD,EAAA,OAAA,CAAQ,KAAK,gEAAgE,CAAA;AAE/E;ACtNO,SAAS,SAASC,IAAA,EAAgB;AACvC,EAAA,OAAOC,UAAA,CAAQD,IAAA,EAAI,EAAE,MAAA,EAAAE,gCAAA,EAAQ,CAAA;AAC/B;;;ACoRO,IAAM,OAAA,GAAU","file":"index.cjs","sourcesContent":["/**\n * Main Application Factory\n *\n * Creates a configured SonicJS application with all core functionality\n */\n\nimport { Hono } from 'hono'\nimport type { Context } from 'hono'\nimport type { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types'\nimport { apiRoutes, apiMediaRoutes, apiSystemRoutes, adminApiRoutes, authRoutes, adminContentRoutes, adminUsersRoutes, adminMediaRoutes, adminPluginRoutes } from './routes'\n\n// ============================================================================\n// Type Definitions\n// ============================================================================\n\nexport interface Bindings {\n DB: D1Database\n CACHE_KV: KVNamespace\n MEDIA_BUCKET: R2Bucket\n ASSETS: Fetcher\n EMAIL_QUEUE?: Queue\n SENDGRID_API_KEY?: string\n DEFAULT_FROM_EMAIL?: string\n IMAGES_ACCOUNT_ID?: string\n IMAGES_API_TOKEN?: string\n ENVIRONMENT?: string\n}\n\nexport interface Variables {\n user?: {\n userId: string\n email: string\n role: string\n exp: number\n iat: number\n }\n requestId?: string\n startTime?: number\n appVersion?: string\n}\n\nexport interface SonicJSConfig {\n // Collections configuration\n collections?: {\n directory?: string\n autoSync?: boolean\n }\n\n // Plugins configuration\n plugins?: {\n directory?: string\n autoLoad?: boolean\n }\n\n // Custom routes\n routes?: Array<{\n path: string\n handler: Hono\n }>\n\n // Custom middleware\n middleware?: {\n beforeAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n afterAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n }\n\n // App metadata\n version?: string\n name?: string\n}\n\nexport type SonicJSApp = Hono<{ Bindings: Bindings; Variables: Variables }>\n\n// ============================================================================\n// Application Factory\n// ============================================================================\n\n/**\n * Create a SonicJS application with core functionality\n *\n * @param config - Application configuration\n * @returns Configured Hono application\n *\n * @example\n * ```typescript\n * import { createSonicJSApp } from '@sonicjs/core'\n *\n * const app = createSonicJSApp({\n * collections: {\n * directory: './src/collections',\n * autoSync: true\n * },\n * plugins: {\n * directory: './src/plugins',\n * autoLoad: true\n * }\n * })\n *\n * export default app\n * ```\n */\nexport function createSonicJSApp(config: SonicJSConfig = {}): SonicJSApp {\n const app = new Hono<{ Bindings: Bindings; Variables: Variables }>()\n\n // Set app metadata\n const appVersion = config.version || '1.0.0'\n const appName = config.name || 'SonicJS'\n\n // App version middleware\n app.use('*', async (c, next) => {\n c.set('appVersion', appVersion)\n await next()\n })\n\n // Bootstrap middleware\n // Note: Implementation will be imported from middleware/bootstrap\n // This is a placeholder for the factory pattern\n app.use('*', async (_c, next) => {\n // Bootstrap logic here (migrations, collections, plugins)\n await next()\n })\n\n // Custom middleware - before auth\n if (config.middleware?.beforeAuth) {\n for (const middleware of config.middleware.beforeAuth) {\n app.use('*', middleware)\n }\n }\n\n // Logging middleware\n app.use('*', async (_c, next) => {\n // Logging logic here\n await next()\n })\n\n // Security middleware\n app.use('*', async (_c, next) => {\n // Security headers, CORS, etc.\n await next()\n })\n\n // Custom middleware - after auth\n if (config.middleware?.afterAuth) {\n for (const middleware of config.middleware.afterAuth) {\n app.use('*', middleware)\n }\n }\n\n // Core routes\n // Routes are being imported incrementally from routes/*\n // Each route is tested and migrated one-by-one\n app.route('/api', apiRoutes)\n app.route('/api/media', apiMediaRoutes)\n app.route('/api/system', apiSystemRoutes)\n app.route('/admin/api', adminApiRoutes)\n app.route('/admin/content', adminContentRoutes)\n app.route('/admin/media', adminMediaRoutes)\n app.route('/admin/plugins', adminPluginRoutes)\n app.route('/admin', adminUsersRoutes)\n app.route('/auth', authRoutes)\n\n // Custom routes - User-defined routes\n if (config.routes) {\n for (const route of config.routes) {\n app.route(route.path, route.handler)\n }\n }\n\n // Root redirect to login\n app.get('/', (c) => {\n return c.redirect('/auth/login')\n })\n\n // Health check\n app.get('/health', (c) => {\n return c.json({\n name: appName,\n version: appVersion,\n status: 'running',\n timestamp: new Date().toISOString()\n })\n })\n\n // 404 handler\n app.notFound((c) => {\n return c.json({ error: 'Not Found', status: 404 }, 404)\n })\n\n // Error handler\n app.onError((err, c) => {\n console.error(err)\n return c.json({ error: 'Internal Server Error', status: 500 }, 500)\n })\n\n return app\n}\n\n/**\n * Setup core middleware (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreMiddleware(_app: SonicJSApp): void {\n console.warn('setupCoreMiddleware is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n\n/**\n * Setup core routes (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreRoutes(_app: SonicJSApp): void {\n console.warn('setupCoreRoutes is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n","import { drizzle } from 'drizzle-orm/d1';\nimport * as schema from './schema';\n\nexport function createDb(d1: D1Database) {\n return drizzle(d1, { schema });\n}\n\nexport * from './schema';","/**\n * @sonicjs/core - Main Entry Point\n *\n * Core framework for SonicJS headless CMS\n * Built for Cloudflare's edge platform with TypeScript\n *\n * Phase 2 Migration Status:\n * - Week 1: Types, Utils, Database (COMPLETED ✓)\n * - Week 2: Services, Middleware, Plugins (COMPLETED ✓)\n * - Week 3: Routes, Templates (COMPLETED ✓)\n * - Week 4: Integration & Testing (COMPLETED ✓)\n *\n * Test Coverage:\n * - Utilities: 48 tests (sanitize, query-filter, metrics)\n * - Middleware: 51 tests (auth, logging, security, performance)\n * - Total: 99 tests passing\n */\n\n// ============================================================================\n// Main Application API (Phase 2 Week 1)\n// ============================================================================\n\nexport { createSonicJSApp, setupCoreMiddleware, setupCoreRoutes } from './app'\nexport type { SonicJSConfig, SonicJSApp, Bindings, Variables } from './app'\n\n// ============================================================================\n// Placeholders - To be populated in Phase 2\n// ============================================================================\n\n// Services - Week 2 (COMPLETED)\nexport {\n // Collection Management\n loadCollectionConfigs,\n loadCollectionConfig,\n getAvailableCollectionNames,\n validateCollectionConfig,\n syncCollections,\n syncCollection,\n isCollectionManaged,\n getManagedCollections,\n cleanupRemovedCollections,\n fullCollectionSync,\n // Database Migrations\n MigrationService,\n // Logging\n Logger,\n getLogger,\n initLogger,\n // Plugin Services - Class implementations\n PluginService as PluginServiceClass,\n PluginBootstrapService,\n} from './services'\n\nexport type { Migration, MigrationStatus, LogLevel, LogCategory, LogEntry, LogFilter, CorePlugin } from './services'\n\n// Middleware - Week 2 (COMPLETED)\nexport {\n // Authentication\n AuthManager,\n requireAuth,\n requireRole,\n optionalAuth,\n // Logging\n loggingMiddleware,\n detailedLoggingMiddleware,\n securityLoggingMiddleware,\n performanceLoggingMiddleware,\n // Performance\n cacheHeaders,\n compressionMiddleware,\n securityHeaders,\n // Permissions\n PermissionManager,\n requirePermission,\n requireAnyPermission,\n logActivity,\n // Plugin middleware\n requireActivePlugin,\n requireActivePlugins,\n getActivePlugins,\n isPluginActive,\n // Bootstrap\n bootstrapMiddleware,\n} from './middleware'\n\nexport type { Permission, UserPermissions } from './middleware'\n\n// Plugins - Week 2 (COMPLETED)\nexport {\n // Hook System - Class implementations\n HookSystemImpl,\n ScopedHookSystem as ScopedHookSystemClass,\n HookUtils,\n // Plugin Registry\n PluginRegistryImpl,\n // Plugin Manager - Class implementation\n PluginManager as PluginManagerClass,\n // Plugin Validator - Class implementation\n PluginValidator as PluginValidatorClass,\n} from './plugins'\n\n// Routes - Week 3 (COMPLETED)\nexport { ROUTES_INFO } from './routes'\n\n// Templates - Week 3 (COMPLETED)\nexport {\n // Form templates\n renderForm,\n renderFormField,\n // Table templates\n renderTable,\n // Pagination templates\n renderPagination,\n // Alert templates\n renderAlert,\n // Confirmation dialog templates\n renderConfirmationDialog,\n getConfirmationDialogScript,\n // Filter bar templates\n renderFilterBar,\n} from './templates'\n\nexport type {\n FormField,\n FormData,\n TableColumn,\n TableData,\n PaginationData,\n AlertData,\n ConfirmationDialogOptions,\n FilterBarData,\n Filter,\n FilterOption,\n} from './templates'\n\n// Types - Week 1 (COMPLETED)\nexport type {\n // Collection types\n FieldType,\n FieldConfig,\n CollectionSchema,\n CollectionConfig,\n CollectionConfigModule,\n CollectionSyncResult,\n // Plugin types\n Plugin,\n PluginContext,\n PluginConfig,\n PluginRoutes,\n PluginMiddleware,\n PluginModel,\n PluginService,\n PluginAdminPage,\n PluginComponent,\n PluginMenuItem,\n PluginHook,\n HookHandler,\n HookContext,\n HookSystem,\n ScopedHookSystem,\n PluginRegistry,\n PluginManager,\n PluginStatus,\n AuthService,\n ContentService,\n MediaService,\n PluginLogger,\n PluginBuilderOptions,\n PluginValidator,\n PluginValidationResult,\n HookName,\n // Plugin manifest\n PluginManifest,\n} from './types'\n\nexport { HOOKS } from './types'\n\n// Utils - Week 1 (COMPLETED)\nexport {\n // Sanitization\n escapeHtml,\n sanitizeInput,\n sanitizeObject,\n // Template rendering\n TemplateRenderer,\n templateRenderer,\n renderTemplate,\n // Query filtering\n QueryFilterBuilder,\n buildQuery,\n // Metrics\n metricsTracker,\n} from './utils'\n\nexport type {\n FilterOperator,\n FilterCondition,\n FilterGroup,\n QueryFilter,\n QueryResult,\n} from './utils'\n\n// Database - Week 1 (COMPLETED)\nexport {\n createDb,\n // Schema exports\n users,\n collections,\n content,\n contentVersions,\n media,\n apiTokens,\n workflowHistory,\n plugins,\n pluginHooks,\n pluginRoutes,\n pluginAssets,\n pluginActivityLog,\n systemLogs,\n logConfig,\n // Zod validation schemas\n insertUserSchema,\n selectUserSchema,\n insertCollectionSchema,\n selectCollectionSchema,\n insertContentSchema,\n selectContentSchema,\n insertMediaSchema,\n selectMediaSchema,\n insertWorkflowHistorySchema,\n selectWorkflowHistorySchema,\n insertPluginSchema,\n selectPluginSchema,\n insertPluginHookSchema,\n selectPluginHookSchema,\n insertPluginRouteSchema,\n selectPluginRouteSchema,\n insertPluginAssetSchema,\n selectPluginAssetSchema,\n insertPluginActivityLogSchema,\n selectPluginActivityLogSchema,\n insertSystemLogSchema,\n selectSystemLogSchema,\n insertLogConfigSchema,\n selectLogConfigSchema,\n} from './db'\n\nexport type {\n User,\n NewUser,\n Collection,\n NewCollection,\n Content,\n NewContent,\n Media,\n NewMedia,\n WorkflowHistory,\n NewWorkflowHistory,\n Plugin as DbPlugin,\n NewPlugin,\n PluginHook as DbPluginHook,\n NewPluginHook,\n PluginRoute,\n NewPluginRoute,\n PluginAsset,\n NewPluginAsset,\n PluginActivityLog,\n NewPluginActivityLog,\n SystemLog,\n NewSystemLog,\n LogConfig,\n NewLogConfig,\n} from './db'\n\n// Plugins - Week 2\n// export { PluginBuilder, HookSystem } from './plugins/sdk'\n\n// ============================================================================\n// Version\n// ============================================================================\n\nexport const VERSION = '2.0.0-alpha.3'\n\n// ============================================================================\n// Phase 2 Migration Notes\n// ============================================================================\n\n/**\n * This is a work-in-progress package being extracted from the main SonicJS codebase.\n *\n * Current Phase: 2 (Core Module Migration)\n * Current Week: 1 (Types, Utils, Database)\n *\n * Expected completion: 4 weeks from 2025-01-17\n *\n * DO NOT USE IN PRODUCTION - Alpha release for development only\n */\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/app.ts","../src/db/index.ts","../package.json","../src/index.ts"],"names":["Hono","api_default","api_media_default","api_system_default","admin_api_default","admin_content_default","adminMediaRoutes","adminPluginRoutes","adminLogsRoutes","userRoutes","auth_default","d1","drizzle","schema_exports"],"mappings":";;;;;;;;;;;;;;;AAsGO,SAAS,gBAAA,CAAiB,MAAA,GAAwB,EAAC,EAAe;AACvE,EAAA,MAAM,GAAA,GAAM,IAAIA,SAAA,EAAmD;AAGnE,EAAA,MAAM,UAAA,GAAa,OAAO,OAAA,IAAW,OAAA;AACrC,EAAA,MAAM,OAAA,GAAU,OAAO,IAAA,IAAQ,SAAA;AAG/B,EAAA,GAAA,CAAI,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A,OAAO,CAAA,CAAE,KAAK,EAAE,KAAA,EAAO,yBAAyB,MAAA,EAAQ,GAAA,IAAO,GAAG,CAAA;AAAA,EACpE,CAAC,CAAA;AAED,EAAA,OAAO,GAAA;AACT;AAQO,SAAS,oBAAoB,IAAA,EAAwB;AAC1D,EAAA,OAAA,CAAQ,KAAK,oEAAoE,CAAA;AAEnF;AAQO,SAAS,gBAAgB,IAAA,EAAwB;AACtD,EAAA,OAAA,CAAQ,KAAK,gEAAgE,CAAA;AAE/E;ACxNO,SAAS,SAASC,IAAA,EAAgB;AACvC,EAAA,OAAOC,UAAA,CAAQD,IAAA,EAAI,EAAE,MAAA,EAAAE,gCAAA,EAAQ,CAAA;AAC/B;;;ACLA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,cAgIb,CAAA;;;AC2KO,IAAM,UAAU,eAAA,CAAY","file":"index.cjs","sourcesContent":["/**\n * Main Application Factory\n *\n * Creates a configured SonicJS application with all core functionality\n */\n\nimport { Hono } from 'hono'\nimport type { Context } from 'hono'\nimport type { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types'\nimport { apiRoutes, apiMediaRoutes, apiSystemRoutes, adminApiRoutes, authRoutes, adminContentRoutes, adminUsersRoutes, adminMediaRoutes, adminPluginRoutes, adminLogsRoutes } from './routes'\n\n// ============================================================================\n// Type Definitions\n// ============================================================================\n\nexport interface Bindings {\n DB: D1Database\n CACHE_KV: KVNamespace\n MEDIA_BUCKET: R2Bucket\n ASSETS: Fetcher\n EMAIL_QUEUE?: Queue\n SENDGRID_API_KEY?: string\n DEFAULT_FROM_EMAIL?: string\n IMAGES_ACCOUNT_ID?: string\n IMAGES_API_TOKEN?: string\n ENVIRONMENT?: string\n BUCKET_NAME?: string\n}\n\nexport interface Variables {\n user?: {\n userId: string\n email: string\n role: string\n exp: number\n iat: number\n }\n requestId?: string\n startTime?: number\n appVersion?: string\n}\n\nexport interface SonicJSConfig {\n // Collections configuration\n collections?: {\n directory?: string\n autoSync?: boolean\n }\n\n // Plugins configuration\n plugins?: {\n directory?: string\n autoLoad?: boolean\n }\n\n // Custom routes\n routes?: Array<{\n path: string\n handler: Hono\n }>\n\n // Custom middleware\n middleware?: {\n beforeAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n afterAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n }\n\n // App metadata\n version?: string\n name?: string\n}\n\nexport type SonicJSApp = Hono<{ Bindings: Bindings; Variables: Variables }>\n\n// ============================================================================\n// Application Factory\n// ============================================================================\n\n/**\n * Create a SonicJS application with core functionality\n *\n * @param config - Application configuration\n * @returns Configured Hono application\n *\n * @example\n * ```typescript\n * import { createSonicJSApp } from '@sonicjs/core'\n *\n * const app = createSonicJSApp({\n * collections: {\n * directory: './src/collections',\n * autoSync: true\n * },\n * plugins: {\n * directory: './src/plugins',\n * autoLoad: true\n * }\n * })\n *\n * export default app\n * ```\n */\nexport function createSonicJSApp(config: SonicJSConfig = {}): SonicJSApp {\n const app = new Hono<{ Bindings: Bindings; Variables: Variables }>()\n\n // Set app metadata\n const appVersion = config.version || '1.0.0'\n const appName = config.name || 'SonicJS'\n\n // App version middleware\n app.use('*', async (c, next) => {\n c.set('appVersion', appVersion)\n await next()\n })\n\n // Bootstrap middleware\n // Note: Implementation will be imported from middleware/bootstrap\n // This is a placeholder for the factory pattern\n app.use('*', async (_c, next) => {\n // Bootstrap logic here (migrations, collections, plugins)\n await next()\n })\n\n // Custom middleware - before auth\n if (config.middleware?.beforeAuth) {\n for (const middleware of config.middleware.beforeAuth) {\n app.use('*', middleware)\n }\n }\n\n // Logging middleware\n app.use('*', async (_c, next) => {\n // Logging logic here\n await next()\n })\n\n // Security middleware\n app.use('*', async (_c, next) => {\n // Security headers, CORS, etc.\n await next()\n })\n\n // Custom middleware - after auth\n if (config.middleware?.afterAuth) {\n for (const middleware of config.middleware.afterAuth) {\n app.use('*', middleware)\n }\n }\n\n // Core routes\n // Routes are being imported incrementally from routes/*\n // Each route is tested and migrated one-by-one\n app.route('/api', apiRoutes)\n app.route('/api/media', apiMediaRoutes)\n app.route('/api/system', apiSystemRoutes)\n app.route('/admin/api', adminApiRoutes)\n app.route('/admin/content', adminContentRoutes)\n app.route('/admin/media', adminMediaRoutes)\n app.route('/admin/plugins', adminPluginRoutes)\n app.route('/admin/logs', adminLogsRoutes)\n app.route('/admin', adminUsersRoutes)\n app.route('/auth', authRoutes)\n\n // Custom routes - User-defined routes\n if (config.routes) {\n for (const route of config.routes) {\n app.route(route.path, route.handler)\n }\n }\n\n // Root redirect to login\n app.get('/', (c) => {\n return c.redirect('/auth/login')\n })\n\n // Health check\n app.get('/health', (c) => {\n return c.json({\n name: appName,\n version: appVersion,\n status: 'running',\n timestamp: new Date().toISOString()\n })\n })\n\n // 404 handler\n app.notFound((c) => {\n return c.json({ error: 'Not Found', status: 404 }, 404)\n })\n\n // Error handler\n app.onError((err, c) => {\n console.error(err)\n return c.json({ error: 'Internal Server Error', status: 500 }, 500)\n })\n\n return app\n}\n\n/**\n * Setup core middleware (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreMiddleware(_app: SonicJSApp): void {\n console.warn('setupCoreMiddleware is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n\n/**\n * Setup core routes (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreRoutes(_app: SonicJSApp): void {\n console.warn('setupCoreRoutes is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n","import { drizzle } from 'drizzle-orm/d1';\nimport * as schema from './schema';\n\nexport function createDb(d1: D1Database) {\n return drizzle(d1, { schema });\n}\n\nexport * from './schema';","{\n \"name\": \"@sonicjs-cms/core\",\n \"version\": \"2.0.0-beta.1\",\n \"description\": \"Core framework for SonicJS headless CMS - Edge-first, TypeScript-native CMS built for Cloudflare Workers\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./services\": {\n \"types\": \"./dist/services.d.ts\",\n \"import\": \"./dist/services.js\",\n \"require\": \"./dist/services.cjs\"\n },\n \"./middleware\": {\n \"types\": \"./dist/middleware.d.ts\",\n \"import\": \"./dist/middleware.js\",\n \"require\": \"./dist/middleware.cjs\"\n },\n \"./routes\": {\n \"types\": \"./dist/routes.d.ts\",\n \"import\": \"./dist/routes.js\",\n \"require\": \"./dist/routes.cjs\"\n },\n \"./templates\": {\n \"types\": \"./dist/templates.d.ts\",\n \"import\": \"./dist/templates.js\",\n \"require\": \"./dist/templates.cjs\"\n },\n \"./plugins\": {\n \"types\": \"./dist/plugins.d.ts\",\n \"import\": \"./dist/plugins.js\",\n \"require\": \"./dist/plugins.cjs\"\n },\n \"./utils\": {\n \"types\": \"./dist/utils.d.ts\",\n \"import\": \"./dist/utils.js\",\n \"require\": \"./dist/utils.cjs\"\n },\n \"./types\": {\n \"types\": \"./dist/types.d.ts\",\n \"import\": \"./dist/types.js\",\n \"require\": \"./dist/types.cjs\"\n }\n },\n \"files\": [\n \"dist\",\n \"migrations\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"type-check\": \"tsc --noEmit\",\n \"test\": \"vitest --run\",\n \"test:watch\": \"vitest\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"keywords\": [\n \"cms\",\n \"headless-cms\",\n \"cloudflare\",\n \"workers\",\n \"edge\",\n \"typescript\",\n \"hono\",\n \"content-management\",\n \"api\",\n \"sonicjs\"\n ],\n \"author\": \"SonicJS Team\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sonicjs/sonicjs.git\",\n \"directory\": \"packages/core\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/sonicjs/sonicjs/issues\"\n },\n \"homepage\": \"https://sonicjs.com\",\n \"peerDependencies\": {\n \"@cloudflare/workers-types\": \"^4.0.0\",\n \"hono\": \"^4.0.0\",\n \"drizzle-orm\": \"^0.44.0\",\n \"zod\": \"^3.0.0\"\n },\n \"peerDependenciesMeta\": {\n \"@cloudflare/workers-types\": {\n \"optional\": false\n },\n \"hono\": {\n \"optional\": false\n },\n \"drizzle-orm\": {\n \"optional\": false\n },\n \"zod\": {\n \"optional\": false\n }\n },\n \"dependencies\": {\n \"drizzle-zod\": \"^0.8.2\",\n \"marked\": \"^15.0.12\",\n \"highlight.js\": \"^11.11.1\",\n \"semver\": \"^7.7.2\"\n },\n \"devDependencies\": {\n \"@cloudflare/workers-types\": \"^4.20250620.0\",\n \"@types/node\": \"^20.19.1\",\n \"drizzle-orm\": \"^0.44.2\",\n \"hono\": \"^4.10.1\",\n \"tsup\": \"^8.0.0\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^2.1.8\",\n \"zod\": \"^3.25.67\"\n },\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","/**\n * @sonicjs/core - Main Entry Point\n *\n * Core framework for SonicJS headless CMS\n * Built for Cloudflare's edge platform with TypeScript\n *\n * Phase 2 Migration Status:\n * - Week 1: Types, Utils, Database (COMPLETED ✓)\n * - Week 2: Services, Middleware, Plugins (COMPLETED ✓)\n * - Week 3: Routes, Templates (COMPLETED ✓)\n * - Week 4: Integration & Testing (COMPLETED ✓)\n *\n * Test Coverage:\n * - Utilities: 48 tests (sanitize, query-filter, metrics)\n * - Middleware: 51 tests (auth, logging, security, performance)\n * - Total: 99 tests passing\n */\n\n// ============================================================================\n// Main Application API (Phase 2 Week 1)\n// ============================================================================\n\nexport { createSonicJSApp, setupCoreMiddleware, setupCoreRoutes } from './app'\nexport type { SonicJSConfig, SonicJSApp, Bindings, Variables } from './app'\n\n// ============================================================================\n// Placeholders - To be populated in Phase 2\n// ============================================================================\n\n// Services - Week 2 (COMPLETED)\nexport {\n // Collection Management\n loadCollectionConfigs,\n loadCollectionConfig,\n getAvailableCollectionNames,\n validateCollectionConfig,\n syncCollections,\n syncCollection,\n isCollectionManaged,\n getManagedCollections,\n cleanupRemovedCollections,\n fullCollectionSync,\n // Database Migrations\n MigrationService,\n // Logging\n Logger,\n getLogger,\n initLogger,\n // Plugin Services - Class implementations\n PluginService as PluginServiceClass,\n PluginBootstrapService,\n} from './services'\n\nexport type { Migration, MigrationStatus, LogLevel, LogCategory, LogEntry, LogFilter, CorePlugin } from './services'\n\n// Middleware - Week 2 (COMPLETED)\nexport {\n // Authentication\n AuthManager,\n requireAuth,\n requireRole,\n optionalAuth,\n // Logging\n loggingMiddleware,\n detailedLoggingMiddleware,\n securityLoggingMiddleware,\n performanceLoggingMiddleware,\n // Performance\n cacheHeaders,\n compressionMiddleware,\n securityHeaders,\n // Permissions\n PermissionManager,\n requirePermission,\n requireAnyPermission,\n logActivity,\n // Plugin middleware\n requireActivePlugin,\n requireActivePlugins,\n getActivePlugins,\n isPluginActive,\n // Bootstrap\n bootstrapMiddleware,\n} from './middleware'\n\nexport type { Permission, UserPermissions } from './middleware'\n\n// Plugins - Week 2 (COMPLETED)\nexport {\n // Hook System - Class implementations\n HookSystemImpl,\n ScopedHookSystem as ScopedHookSystemClass,\n HookUtils,\n // Plugin Registry\n PluginRegistryImpl,\n // Plugin Manager - Class implementation\n PluginManager as PluginManagerClass,\n // Plugin Validator - Class implementation\n PluginValidator as PluginValidatorClass,\n} from './plugins'\n\n// Routes - Week 3 (COMPLETED)\nexport {\n ROUTES_INFO,\n apiRoutes,\n apiContentCrudRoutes,\n apiMediaRoutes,\n apiSystemRoutes,\n adminApiRoutes,\n authRoutes,\n adminContentRoutes,\n adminUsersRoutes,\n adminMediaRoutes,\n adminLogsRoutes,\n adminPluginRoutes,\n adminDesignRoutes,\n adminCheckboxRoutes,\n adminFAQRoutes,\n adminTestimonialsRoutes,\n adminCodeExamplesRoutes,\n} from './routes'\n\n// Templates - Week 3 (COMPLETED)\nexport {\n // Form templates\n renderForm,\n renderFormField,\n // Table templates\n renderTable,\n // Pagination templates\n renderPagination,\n // Alert templates\n renderAlert,\n // Confirmation dialog templates\n renderConfirmationDialog,\n getConfirmationDialogScript,\n // Filter bar templates\n renderFilterBar,\n} from './templates'\n\nexport type {\n FormField,\n FormData,\n TableColumn,\n TableData,\n PaginationData,\n AlertData,\n ConfirmationDialogOptions,\n FilterBarData,\n Filter,\n FilterOption,\n} from './templates'\n\n// Types - Week 1 (COMPLETED)\nexport type {\n // Collection types\n FieldType,\n FieldConfig,\n CollectionSchema,\n CollectionConfig,\n CollectionConfigModule,\n CollectionSyncResult,\n // Plugin types\n Plugin,\n PluginContext,\n PluginConfig,\n PluginRoutes,\n PluginMiddleware,\n PluginModel,\n PluginService,\n PluginAdminPage,\n PluginComponent,\n PluginMenuItem,\n PluginHook,\n HookHandler,\n HookContext,\n HookSystem,\n ScopedHookSystem,\n PluginRegistry,\n PluginManager,\n PluginStatus,\n AuthService,\n ContentService,\n MediaService,\n PluginLogger,\n PluginBuilderOptions,\n PluginValidator,\n PluginValidationResult,\n HookName,\n // Plugin manifest\n PluginManifest,\n} from './types'\n\nexport { HOOKS } from './types'\n\n// Utils - Week 1 (COMPLETED)\nexport {\n // Sanitization\n escapeHtml,\n sanitizeInput,\n sanitizeObject,\n // Template rendering\n TemplateRenderer,\n templateRenderer,\n renderTemplate,\n // Query filtering\n QueryFilterBuilder,\n buildQuery,\n // Metrics\n metricsTracker,\n} from './utils'\n\nexport type {\n FilterOperator,\n FilterCondition,\n FilterGroup,\n QueryFilter,\n QueryResult,\n} from './utils'\n\n// Database - Week 1 (COMPLETED)\nexport {\n createDb,\n // Schema exports\n users,\n collections,\n content,\n contentVersions,\n media,\n apiTokens,\n workflowHistory,\n plugins,\n pluginHooks,\n pluginRoutes,\n pluginAssets,\n pluginActivityLog,\n systemLogs,\n logConfig,\n // Zod validation schemas\n insertUserSchema,\n selectUserSchema,\n insertCollectionSchema,\n selectCollectionSchema,\n insertContentSchema,\n selectContentSchema,\n insertMediaSchema,\n selectMediaSchema,\n insertWorkflowHistorySchema,\n selectWorkflowHistorySchema,\n insertPluginSchema,\n selectPluginSchema,\n insertPluginHookSchema,\n selectPluginHookSchema,\n insertPluginRouteSchema,\n selectPluginRouteSchema,\n insertPluginAssetSchema,\n selectPluginAssetSchema,\n insertPluginActivityLogSchema,\n selectPluginActivityLogSchema,\n insertSystemLogSchema,\n selectSystemLogSchema,\n insertLogConfigSchema,\n selectLogConfigSchema,\n} from './db'\n\nexport type {\n User,\n NewUser,\n Collection,\n NewCollection,\n Content,\n NewContent,\n Media,\n NewMedia,\n WorkflowHistory,\n NewWorkflowHistory,\n Plugin as DbPlugin,\n NewPlugin,\n PluginHook as DbPluginHook,\n NewPluginHook,\n PluginRoute,\n NewPluginRoute,\n PluginAsset,\n NewPluginAsset,\n PluginActivityLog,\n NewPluginActivityLog,\n SystemLog,\n NewSystemLog,\n LogConfig,\n NewLogConfig,\n} from './db'\n\n// Plugins - Week 2\n// export { PluginBuilder, HookSystem } from './plugins/sdk'\n\n// ============================================================================\n// Version\n// ============================================================================\n\n// Import version from package.json\nimport packageJson from '../package.json'\nexport const VERSION = packageJson.version\n\n// ============================================================================\n// Phase 2 Migration Notes\n// ============================================================================\n\n/**\n * This is a work-in-progress package being extracted from the main SonicJS codebase.\n *\n * Current Phase: 2 (Core Module Migration)\n * Current Week: 1 (Types, Utils, Database)\n *\n * Expected completion: 4 weeks from 2025-01-17\n *\n * DO NOT USE IN PRODUCTION - Alpha release for development only\n */\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Main exports from @sonicjs-cms/core package
|
|
2
|
+
export * from '../src/index'
|
|
3
|
+
|
|
4
|
+
// Explicitly re-export key types and classes
|
|
5
|
+
export type { Plugin, PluginContext } from '../src/types/index'
|
|
6
|
+
export { TemplateRenderer, templateRenderer, renderTemplate } from '../src/utils/template-renderer'
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { api_default, api_media_default, api_system_default, admin_api_default, admin_content_default, adminMediaRoutes, adminPluginRoutes, userRoutes, auth_default } from './chunk-
|
|
2
|
-
export { ROUTES_INFO } from './chunk-
|
|
1
|
+
import { api_default, api_media_default, api_system_default, admin_api_default, admin_content_default, adminMediaRoutes, adminPluginRoutes, adminLogsRoutes, userRoutes, auth_default } from './chunk-JETM2U2D.js';
|
|
2
|
+
export { ROUTES_INFO, admin_api_default as adminApiRoutes, adminCheckboxRoutes, admin_code_examples_default as adminCodeExamplesRoutes, admin_content_default as adminContentRoutes, adminDesignRoutes, admin_faq_default as adminFAQRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, admin_testimonials_default as adminTestimonialsRoutes, 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 } from './chunk-JETM2U2D.js';
|
|
3
3
|
import './chunk-3MNMOLSA.js';
|
|
4
4
|
export { AuthManager, PermissionManager, bootstrapMiddleware, cacheHeaders, compressionMiddleware, detailedLoggingMiddleware, getActivePlugins, isPluginActive, logActivity, loggingMiddleware, optionalAuth, performanceLoggingMiddleware, requireActivePlugin, requireActivePlugins, requireAnyPermission, requireAuth, requirePermission, requireRole, securityHeaders, securityLoggingMiddleware } from './chunk-WESS2U3K.js';
|
|
5
5
|
import { schema_exports } from './chunk-7N3HK7ZK.js';
|
|
6
6
|
export { Logger, MigrationService, PluginBootstrapService, PluginService as PluginServiceClass, apiTokens, cleanupRemovedCollections, collections, content, contentVersions, fullCollectionSync, getAvailableCollectionNames, getLogger, getManagedCollections, initLogger, insertCollectionSchema, insertContentSchema, insertLogConfigSchema, insertMediaSchema, insertPluginActivityLogSchema, insertPluginAssetSchema, insertPluginHookSchema, insertPluginRouteSchema, insertPluginSchema, insertSystemLogSchema, insertUserSchema, insertWorkflowHistorySchema, isCollectionManaged, loadCollectionConfig, loadCollectionConfigs, logConfig, media, pluginActivityLog, pluginAssets, pluginHooks, pluginRoutes, plugins, selectCollectionSchema, selectContentSchema, selectLogConfigSchema, selectMediaSchema, selectPluginActivityLogSchema, selectPluginAssetSchema, selectPluginHookSchema, selectPluginRouteSchema, selectPluginSchema, selectSystemLogSchema, selectUserSchema, selectWorkflowHistorySchema, syncCollection, syncCollections, systemLogs, users, validateCollectionConfig, workflowHistory } from './chunk-7N3HK7ZK.js';
|
|
7
|
-
export {
|
|
7
|
+
export { renderFilterBar, renderForm, renderFormField } from './chunk-LU6J53IX.js';
|
|
8
|
+
export { getConfirmationDialogScript, renderAlert, renderConfirmationDialog, renderPagination, renderTable } from './chunk-P3VS4DV3.js';
|
|
8
9
|
export { HookSystemImpl, HookUtils, PluginManager as PluginManagerClass, PluginRegistryImpl, PluginValidator as PluginValidatorClass, ScopedHookSystem as ScopedHookSystemClass } from './chunk-BITQ4MFX.js';
|
|
9
10
|
export { QueryFilterBuilder, TemplateRenderer, buildQuery, escapeHtml, metricsTracker, renderTemplate, sanitizeInput, sanitizeObject, templateRenderer } from './chunk-JIINOD2W.js';
|
|
10
11
|
export { HOOKS } from './chunk-LOUJRBXV.js';
|
|
@@ -46,6 +47,7 @@ function createSonicJSApp(config = {}) {
|
|
|
46
47
|
app.route("/admin/content", admin_content_default);
|
|
47
48
|
app.route("/admin/media", adminMediaRoutes);
|
|
48
49
|
app.route("/admin/plugins", adminPluginRoutes);
|
|
50
|
+
app.route("/admin/logs", adminLogsRoutes);
|
|
49
51
|
app.route("/admin", userRoutes);
|
|
50
52
|
app.route("/auth", auth_default);
|
|
51
53
|
if (config.routes) {
|
|
@@ -83,8 +85,12 @@ function createDb(d1) {
|
|
|
83
85
|
return drizzle(d1, { schema: schema_exports });
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
// package.json
|
|
89
|
+
var package_default = {
|
|
90
|
+
version: "2.0.0-beta.1"};
|
|
91
|
+
|
|
86
92
|
// src/index.ts
|
|
87
|
-
var VERSION =
|
|
93
|
+
var VERSION = package_default.version;
|
|
88
94
|
|
|
89
95
|
export { VERSION, createDb, createSonicJSApp, setupCoreMiddleware, setupCoreRoutes };
|
|
90
96
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/app.ts","../src/db/index.ts","../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAqGO,SAAS,gBAAA,CAAiB,MAAA,GAAwB,EAAC,EAAe;AACvE,EAAA,MAAM,GAAA,GAAM,IAAI,IAAA,EAAmD;AAGnE,EAAA,MAAM,UAAA,GAAa,OAAO,OAAA,IAAW,OAAA;AACrC,EAAA,MAAM,OAAA,GAAU,OAAO,IAAA,IAAQ,SAAA;AAG/B,EAAA,GAAA,CAAI,GAAA,CAAI,GAAA,EAAK,OAAO,CAAA,EAAG,IAAA,KAAS;AAC9B,IAAA,CAAA,CAAE,GAAA,CAAI,cAAc,UAAU,CAAA;AAC9B,IAAA,MAAM,IAAA,EAAK;AAAA,EACb,CAAC,CAAA;AAKD,EAAA,GAAA,CAAI,GAAA,CAAI,GAAA,EAAK,OAAO,EAAA,EAAI,IAAA,KAAS;AAE/B,IAAA,MAAM,IAAA,EAAK;AAAA,EACb,CAAC,CAAA;AAGD,EAAA,IAAI,MAAA,CAAO,YAAY,UAAA,EAAY;AACjC,IAAA,KAAA,MAAW,UAAA,IAAc,MAAA,CAAO,UAAA,CAAW,UAAA,EAAY;AACrD,MAAA,GAAA,CAAI,GAAA,CAAI,KAAK,UAAU,CAAA;AAAA,IACzB;AAAA,EACF;AAGA,EAAA,GAAA,CAAI,GAAA,CAAI,GAAA,EAAK,OAAO,EAAA,EAAI,IAAA,KAAS;AAE/B,IAAA,MAAM,IAAA,EAAK;AAAA,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I,SAAA,EAAW,CAAC,CAAA,KAAM;AACxB,IAAA,OAAO,EAAE,IAAA,CAAK;AAAA,MACZ,IAAA,EAAM,OAAA;AAAA,MACN,OAAA,EAAS,UAAA;AAAA,MACT,MAAA,EAAQ,SAAA;AAAA,MACR,SAAA,EAAA,iBAAW,IAAI,IAAA,EAAK,EAAE,WAAA;AAAY,KACnC,CAAA;AAAA,EACH,CAAC,CAAA;AAGD,EAAA,GAAA,CAAI,QAAA,CAAS,CAAC,CAAA,KAAM;AAClB,IAAA,OAAO,CAAA,CAAE,KAAK,EAAE,KAAA,EAAO,aAAa,MAAA,EAAQ,GAAA,IAAO,GAAG,CAAA;AAAA,EACxD,CAAC,CAAA;AAGD,EAAA,GAAA,CAAI,OAAA,CAAQ,CAAC,GAAA,EAAK,CAAA,KAAM;AACtB,IAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AACjB,IAAA,OAAO,CAAA,CAAE,KAAK,EAAE,KAAA,EAAO,yBAAyB,MAAA,EAAQ,GAAA,IAAO,GAAG,CAAA;AAAA,EACpE,CAAC,CAAA;AAED,EAAA,OAAO,GAAA;AACT;AAQO,SAAS,oBAAoB,IAAA,EAAwB;AAC1D,EAAA,OAAA,CAAQ,KAAK,oEAAoE,CAAA;AAEnF;AAQO,SAAS,gBAAgB,IAAA,EAAwB;AACtD,EAAA,OAAA,CAAQ,KAAK,gEAAgE,CAAA;AAE/E;ACtNO,SAAS,SAAS,EAAA,EAAgB;AACvC,EAAA,OAAO,OAAA,CAAQ,EAAA,EAAI,EAAE,MAAA,EAAA,cAAA,EAAQ,CAAA;AAC/B;;;ACoRO,IAAM,OAAA,GAAU","file":"index.js","sourcesContent":["/**\n * Main Application Factory\n *\n * Creates a configured SonicJS application with all core functionality\n */\n\nimport { Hono } from 'hono'\nimport type { Context } from 'hono'\nimport type { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types'\nimport { apiRoutes, apiMediaRoutes, apiSystemRoutes, adminApiRoutes, authRoutes, adminContentRoutes, adminUsersRoutes, adminMediaRoutes, adminPluginRoutes } from './routes'\n\n// ============================================================================\n// Type Definitions\n// ============================================================================\n\nexport interface Bindings {\n DB: D1Database\n CACHE_KV: KVNamespace\n MEDIA_BUCKET: R2Bucket\n ASSETS: Fetcher\n EMAIL_QUEUE?: Queue\n SENDGRID_API_KEY?: string\n DEFAULT_FROM_EMAIL?: string\n IMAGES_ACCOUNT_ID?: string\n IMAGES_API_TOKEN?: string\n ENVIRONMENT?: string\n}\n\nexport interface Variables {\n user?: {\n userId: string\n email: string\n role: string\n exp: number\n iat: number\n }\n requestId?: string\n startTime?: number\n appVersion?: string\n}\n\nexport interface SonicJSConfig {\n // Collections configuration\n collections?: {\n directory?: string\n autoSync?: boolean\n }\n\n // Plugins configuration\n plugins?: {\n directory?: string\n autoLoad?: boolean\n }\n\n // Custom routes\n routes?: Array<{\n path: string\n handler: Hono\n }>\n\n // Custom middleware\n middleware?: {\n beforeAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n afterAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n }\n\n // App metadata\n version?: string\n name?: string\n}\n\nexport type SonicJSApp = Hono<{ Bindings: Bindings; Variables: Variables }>\n\n// ============================================================================\n// Application Factory\n// ============================================================================\n\n/**\n * Create a SonicJS application with core functionality\n *\n * @param config - Application configuration\n * @returns Configured Hono application\n *\n * @example\n * ```typescript\n * import { createSonicJSApp } from '@sonicjs/core'\n *\n * const app = createSonicJSApp({\n * collections: {\n * directory: './src/collections',\n * autoSync: true\n * },\n * plugins: {\n * directory: './src/plugins',\n * autoLoad: true\n * }\n * })\n *\n * export default app\n * ```\n */\nexport function createSonicJSApp(config: SonicJSConfig = {}): SonicJSApp {\n const app = new Hono<{ Bindings: Bindings; Variables: Variables }>()\n\n // Set app metadata\n const appVersion = config.version || '1.0.0'\n const appName = config.name || 'SonicJS'\n\n // App version middleware\n app.use('*', async (c, next) => {\n c.set('appVersion', appVersion)\n await next()\n })\n\n // Bootstrap middleware\n // Note: Implementation will be imported from middleware/bootstrap\n // This is a placeholder for the factory pattern\n app.use('*', async (_c, next) => {\n // Bootstrap logic here (migrations, collections, plugins)\n await next()\n })\n\n // Custom middleware - before auth\n if (config.middleware?.beforeAuth) {\n for (const middleware of config.middleware.beforeAuth) {\n app.use('*', middleware)\n }\n }\n\n // Logging middleware\n app.use('*', async (_c, next) => {\n // Logging logic here\n await next()\n })\n\n // Security middleware\n app.use('*', async (_c, next) => {\n // Security headers, CORS, etc.\n await next()\n })\n\n // Custom middleware - after auth\n if (config.middleware?.afterAuth) {\n for (const middleware of config.middleware.afterAuth) {\n app.use('*', middleware)\n }\n }\n\n // Core routes\n // Routes are being imported incrementally from routes/*\n // Each route is tested and migrated one-by-one\n app.route('/api', apiRoutes)\n app.route('/api/media', apiMediaRoutes)\n app.route('/api/system', apiSystemRoutes)\n app.route('/admin/api', adminApiRoutes)\n app.route('/admin/content', adminContentRoutes)\n app.route('/admin/media', adminMediaRoutes)\n app.route('/admin/plugins', adminPluginRoutes)\n app.route('/admin', adminUsersRoutes)\n app.route('/auth', authRoutes)\n\n // Custom routes - User-defined routes\n if (config.routes) {\n for (const route of config.routes) {\n app.route(route.path, route.handler)\n }\n }\n\n // Root redirect to login\n app.get('/', (c) => {\n return c.redirect('/auth/login')\n })\n\n // Health check\n app.get('/health', (c) => {\n return c.json({\n name: appName,\n version: appVersion,\n status: 'running',\n timestamp: new Date().toISOString()\n })\n })\n\n // 404 handler\n app.notFound((c) => {\n return c.json({ error: 'Not Found', status: 404 }, 404)\n })\n\n // Error handler\n app.onError((err, c) => {\n console.error(err)\n return c.json({ error: 'Internal Server Error', status: 500 }, 500)\n })\n\n return app\n}\n\n/**\n * Setup core middleware (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreMiddleware(_app: SonicJSApp): void {\n console.warn('setupCoreMiddleware is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n\n/**\n * Setup core routes (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreRoutes(_app: SonicJSApp): void {\n console.warn('setupCoreRoutes is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n","import { drizzle } from 'drizzle-orm/d1';\nimport * as schema from './schema';\n\nexport function createDb(d1: D1Database) {\n return drizzle(d1, { schema });\n}\n\nexport * from './schema';","/**\n * @sonicjs/core - Main Entry Point\n *\n * Core framework for SonicJS headless CMS\n * Built for Cloudflare's edge platform with TypeScript\n *\n * Phase 2 Migration Status:\n * - Week 1: Types, Utils, Database (COMPLETED ✓)\n * - Week 2: Services, Middleware, Plugins (COMPLETED ✓)\n * - Week 3: Routes, Templates (COMPLETED ✓)\n * - Week 4: Integration & Testing (COMPLETED ✓)\n *\n * Test Coverage:\n * - Utilities: 48 tests (sanitize, query-filter, metrics)\n * - Middleware: 51 tests (auth, logging, security, performance)\n * - Total: 99 tests passing\n */\n\n// ============================================================================\n// Main Application API (Phase 2 Week 1)\n// ============================================================================\n\nexport { createSonicJSApp, setupCoreMiddleware, setupCoreRoutes } from './app'\nexport type { SonicJSConfig, SonicJSApp, Bindings, Variables } from './app'\n\n// ============================================================================\n// Placeholders - To be populated in Phase 2\n// ============================================================================\n\n// Services - Week 2 (COMPLETED)\nexport {\n // Collection Management\n loadCollectionConfigs,\n loadCollectionConfig,\n getAvailableCollectionNames,\n validateCollectionConfig,\n syncCollections,\n syncCollection,\n isCollectionManaged,\n getManagedCollections,\n cleanupRemovedCollections,\n fullCollectionSync,\n // Database Migrations\n MigrationService,\n // Logging\n Logger,\n getLogger,\n initLogger,\n // Plugin Services - Class implementations\n PluginService as PluginServiceClass,\n PluginBootstrapService,\n} from './services'\n\nexport type { Migration, MigrationStatus, LogLevel, LogCategory, LogEntry, LogFilter, CorePlugin } from './services'\n\n// Middleware - Week 2 (COMPLETED)\nexport {\n // Authentication\n AuthManager,\n requireAuth,\n requireRole,\n optionalAuth,\n // Logging\n loggingMiddleware,\n detailedLoggingMiddleware,\n securityLoggingMiddleware,\n performanceLoggingMiddleware,\n // Performance\n cacheHeaders,\n compressionMiddleware,\n securityHeaders,\n // Permissions\n PermissionManager,\n requirePermission,\n requireAnyPermission,\n logActivity,\n // Plugin middleware\n requireActivePlugin,\n requireActivePlugins,\n getActivePlugins,\n isPluginActive,\n // Bootstrap\n bootstrapMiddleware,\n} from './middleware'\n\nexport type { Permission, UserPermissions } from './middleware'\n\n// Plugins - Week 2 (COMPLETED)\nexport {\n // Hook System - Class implementations\n HookSystemImpl,\n ScopedHookSystem as ScopedHookSystemClass,\n HookUtils,\n // Plugin Registry\n PluginRegistryImpl,\n // Plugin Manager - Class implementation\n PluginManager as PluginManagerClass,\n // Plugin Validator - Class implementation\n PluginValidator as PluginValidatorClass,\n} from './plugins'\n\n// Routes - Week 3 (COMPLETED)\nexport { ROUTES_INFO } from './routes'\n\n// Templates - Week 3 (COMPLETED)\nexport {\n // Form templates\n renderForm,\n renderFormField,\n // Table templates\n renderTable,\n // Pagination templates\n renderPagination,\n // Alert templates\n renderAlert,\n // Confirmation dialog templates\n renderConfirmationDialog,\n getConfirmationDialogScript,\n // Filter bar templates\n renderFilterBar,\n} from './templates'\n\nexport type {\n FormField,\n FormData,\n TableColumn,\n TableData,\n PaginationData,\n AlertData,\n ConfirmationDialogOptions,\n FilterBarData,\n Filter,\n FilterOption,\n} from './templates'\n\n// Types - Week 1 (COMPLETED)\nexport type {\n // Collection types\n FieldType,\n FieldConfig,\n CollectionSchema,\n CollectionConfig,\n CollectionConfigModule,\n CollectionSyncResult,\n // Plugin types\n Plugin,\n PluginContext,\n PluginConfig,\n PluginRoutes,\n PluginMiddleware,\n PluginModel,\n PluginService,\n PluginAdminPage,\n PluginComponent,\n PluginMenuItem,\n PluginHook,\n HookHandler,\n HookContext,\n HookSystem,\n ScopedHookSystem,\n PluginRegistry,\n PluginManager,\n PluginStatus,\n AuthService,\n ContentService,\n MediaService,\n PluginLogger,\n PluginBuilderOptions,\n PluginValidator,\n PluginValidationResult,\n HookName,\n // Plugin manifest\n PluginManifest,\n} from './types'\n\nexport { HOOKS } from './types'\n\n// Utils - Week 1 (COMPLETED)\nexport {\n // Sanitization\n escapeHtml,\n sanitizeInput,\n sanitizeObject,\n // Template rendering\n TemplateRenderer,\n templateRenderer,\n renderTemplate,\n // Query filtering\n QueryFilterBuilder,\n buildQuery,\n // Metrics\n metricsTracker,\n} from './utils'\n\nexport type {\n FilterOperator,\n FilterCondition,\n FilterGroup,\n QueryFilter,\n QueryResult,\n} from './utils'\n\n// Database - Week 1 (COMPLETED)\nexport {\n createDb,\n // Schema exports\n users,\n collections,\n content,\n contentVersions,\n media,\n apiTokens,\n workflowHistory,\n plugins,\n pluginHooks,\n pluginRoutes,\n pluginAssets,\n pluginActivityLog,\n systemLogs,\n logConfig,\n // Zod validation schemas\n insertUserSchema,\n selectUserSchema,\n insertCollectionSchema,\n selectCollectionSchema,\n insertContentSchema,\n selectContentSchema,\n insertMediaSchema,\n selectMediaSchema,\n insertWorkflowHistorySchema,\n selectWorkflowHistorySchema,\n insertPluginSchema,\n selectPluginSchema,\n insertPluginHookSchema,\n selectPluginHookSchema,\n insertPluginRouteSchema,\n selectPluginRouteSchema,\n insertPluginAssetSchema,\n selectPluginAssetSchema,\n insertPluginActivityLogSchema,\n selectPluginActivityLogSchema,\n insertSystemLogSchema,\n selectSystemLogSchema,\n insertLogConfigSchema,\n selectLogConfigSchema,\n} from './db'\n\nexport type {\n User,\n NewUser,\n Collection,\n NewCollection,\n Content,\n NewContent,\n Media,\n NewMedia,\n WorkflowHistory,\n NewWorkflowHistory,\n Plugin as DbPlugin,\n NewPlugin,\n PluginHook as DbPluginHook,\n NewPluginHook,\n PluginRoute,\n NewPluginRoute,\n PluginAsset,\n NewPluginAsset,\n PluginActivityLog,\n NewPluginActivityLog,\n SystemLog,\n NewSystemLog,\n LogConfig,\n NewLogConfig,\n} from './db'\n\n// Plugins - Week 2\n// export { PluginBuilder, HookSystem } from './plugins/sdk'\n\n// ============================================================================\n// Version\n// ============================================================================\n\nexport const VERSION = '2.0.0-alpha.3'\n\n// ============================================================================\n// Phase 2 Migration Notes\n// ============================================================================\n\n/**\n * This is a work-in-progress package being extracted from the main SonicJS codebase.\n *\n * Current Phase: 2 (Core Module Migration)\n * Current Week: 1 (Types, Utils, Database)\n *\n * Expected completion: 4 weeks from 2025-01-17\n *\n * DO NOT USE IN PRODUCTION - Alpha release for development only\n */\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/app.ts","../src/db/index.ts","../package.json","../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsGO,SAAS,gBAAA,CAAiB,MAAA,GAAwB,EAAC,EAAe;AACvE,EAAA,MAAM,GAAA,GAAM,IAAI,IAAA,EAAmD;AAGnE,EAAA,MAAM,UAAA,GAAa,OAAO,OAAA,IAAW,OAAA;AACrC,EAAA,MAAM,OAAA,GAAU,OAAO,IAAA,IAAQ,SAAA;AAG/B,EAAA,GAAA,CAAI,GAAA,CAAI,GAAA,EAAK,OAAO,CAAA,EAAG,IAAA,KAAS;AAC9B,IAAA,CAAA,CAAE,GAAA,CAAI,cAAc,UAAU,CAAA;AAC9B,IAAA,MAAM,IAAA,EAAK;AAAA,EACb,CAAC,CAAA;AAKD,EAAA,GAAA,CAAI,GAAA,CAAI,GAAA,EAAK,OAAO,EAAA,EAAI,IAAA,KAAS;AAE/B,IAAA,MAAM,IAAA,EAAK;AAAA,EACb,CAAC,CAAA;AAGD,EAAA,IAAI,MAAA,CAAO,YAAY,UAAA,EAAY;AACjC,IAAA,KAAA,MAAW,UAAA,IAAc,MAAA,CAAO,UAAA,CAAW,UAAA,EAAY;AACrD,MAAA,GAAA,CAAI,GAAA,CAAI,KAAK,UAAU,CAAA;AAAA,IACzB;AAAA,EACF;AAGA,EAAA,GAAA,CAAI,GAAA,CAAI,GAAA,EAAK,OAAO,EAAA,EAAI,IAAA,KAAS;AAE/B,IAAA,MAAM,IAAA,EAA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AAA;AAAA,EACjC,CAAC,CAAA;AAGD,EAAA,GAAA,CAAI,GAAA,CAAI,SAAA,EAAW,CAAC,CAAA,KAAM;AACxB,IAAA,OAAO,EAAE,IAAA,CAAK;AAAA,MACZ,IAAA,EAAM,OAAA;AAAA,MACN,OAAA,EAAS,UAAA;AAAA,MACT,MAAA,EAAQ,SAAA;AAAA,MACR,SAAA,EAAA,iBAAW,IAAI,IAAA,EAAK,EAAE,WAAA;AAAY,KACnC,CAAA;AAAA,EACH,CAAC,CAAA;AAGD,EAAA,GAAA,CAAI,QAAA,CAAS,CAAC,CAAA,KAAM;AAClB,IAAA,OAAO,CAAA,CAAE,KAAK,EAAE,KAAA,EAAO,aAAa,MAAA,EAAQ,GAAA,IAAO,GAAG,CAAA;AAAA,EACxD,CAAC,CAAA;AAGD,EAAA,GAAA,CAAI,OAAA,CAAQ,CAAC,GAAA,EAAK,CAAA,KAAM;AACtB,IAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AACjB,IAAA,OAAO,CAAA,CAAE,KAAK,EAAE,KAAA,EAAO,yBAAyB,MAAA,EAAQ,GAAA,IAAO,GAAG,CAAA;AAAA,EACpE,CAAC,CAAA;AAED,EAAA,OAAO,GAAA;AACT;AAQO,SAAS,oBAAoB,IAAA,EAAwB;AAC1D,EAAA,OAAA,CAAQ,KAAK,oEAAoE,CAAA;AAEnF;AAQO,SAAS,gBAAgB,IAAA,EAAwB;AACtD,EAAA,OAAA,CAAQ,KAAK,gEAAgE,CAAA;AAE/E;ACxNO,SAAS,SAAS,EAAA,EAAgB;AACvC,EAAA,OAAO,OAAA,CAAQ,EAAA,EAAI,EAAE,MAAA,EAAA,cAAA,EAAQ,CAAA;AAC/B;;;ACLA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,cAgIb,CAAA;;;AC2KO,IAAM,UAAU,eAAA,CAAY","file":"index.js","sourcesContent":["/**\n * Main Application Factory\n *\n * Creates a configured SonicJS application with all core functionality\n */\n\nimport { Hono } from 'hono'\nimport type { Context } from 'hono'\nimport type { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types'\nimport { apiRoutes, apiMediaRoutes, apiSystemRoutes, adminApiRoutes, authRoutes, adminContentRoutes, adminUsersRoutes, adminMediaRoutes, adminPluginRoutes, adminLogsRoutes } from './routes'\n\n// ============================================================================\n// Type Definitions\n// ============================================================================\n\nexport interface Bindings {\n DB: D1Database\n CACHE_KV: KVNamespace\n MEDIA_BUCKET: R2Bucket\n ASSETS: Fetcher\n EMAIL_QUEUE?: Queue\n SENDGRID_API_KEY?: string\n DEFAULT_FROM_EMAIL?: string\n IMAGES_ACCOUNT_ID?: string\n IMAGES_API_TOKEN?: string\n ENVIRONMENT?: string\n BUCKET_NAME?: string\n}\n\nexport interface Variables {\n user?: {\n userId: string\n email: string\n role: string\n exp: number\n iat: number\n }\n requestId?: string\n startTime?: number\n appVersion?: string\n}\n\nexport interface SonicJSConfig {\n // Collections configuration\n collections?: {\n directory?: string\n autoSync?: boolean\n }\n\n // Plugins configuration\n plugins?: {\n directory?: string\n autoLoad?: boolean\n }\n\n // Custom routes\n routes?: Array<{\n path: string\n handler: Hono\n }>\n\n // Custom middleware\n middleware?: {\n beforeAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n afterAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>\n }\n\n // App metadata\n version?: string\n name?: string\n}\n\nexport type SonicJSApp = Hono<{ Bindings: Bindings; Variables: Variables }>\n\n// ============================================================================\n// Application Factory\n// ============================================================================\n\n/**\n * Create a SonicJS application with core functionality\n *\n * @param config - Application configuration\n * @returns Configured Hono application\n *\n * @example\n * ```typescript\n * import { createSonicJSApp } from '@sonicjs/core'\n *\n * const app = createSonicJSApp({\n * collections: {\n * directory: './src/collections',\n * autoSync: true\n * },\n * plugins: {\n * directory: './src/plugins',\n * autoLoad: true\n * }\n * })\n *\n * export default app\n * ```\n */\nexport function createSonicJSApp(config: SonicJSConfig = {}): SonicJSApp {\n const app = new Hono<{ Bindings: Bindings; Variables: Variables }>()\n\n // Set app metadata\n const appVersion = config.version || '1.0.0'\n const appName = config.name || 'SonicJS'\n\n // App version middleware\n app.use('*', async (c, next) => {\n c.set('appVersion', appVersion)\n await next()\n })\n\n // Bootstrap middleware\n // Note: Implementation will be imported from middleware/bootstrap\n // This is a placeholder for the factory pattern\n app.use('*', async (_c, next) => {\n // Bootstrap logic here (migrations, collections, plugins)\n await next()\n })\n\n // Custom middleware - before auth\n if (config.middleware?.beforeAuth) {\n for (const middleware of config.middleware.beforeAuth) {\n app.use('*', middleware)\n }\n }\n\n // Logging middleware\n app.use('*', async (_c, next) => {\n // Logging logic here\n await next()\n })\n\n // Security middleware\n app.use('*', async (_c, next) => {\n // Security headers, CORS, etc.\n await next()\n })\n\n // Custom middleware - after auth\n if (config.middleware?.afterAuth) {\n for (const middleware of config.middleware.afterAuth) {\n app.use('*', middleware)\n }\n }\n\n // Core routes\n // Routes are being imported incrementally from routes/*\n // Each route is tested and migrated one-by-one\n app.route('/api', apiRoutes)\n app.route('/api/media', apiMediaRoutes)\n app.route('/api/system', apiSystemRoutes)\n app.route('/admin/api', adminApiRoutes)\n app.route('/admin/content', adminContentRoutes)\n app.route('/admin/media', adminMediaRoutes)\n app.route('/admin/plugins', adminPluginRoutes)\n app.route('/admin/logs', adminLogsRoutes)\n app.route('/admin', adminUsersRoutes)\n app.route('/auth', authRoutes)\n\n // Custom routes - User-defined routes\n if (config.routes) {\n for (const route of config.routes) {\n app.route(route.path, route.handler)\n }\n }\n\n // Root redirect to login\n app.get('/', (c) => {\n return c.redirect('/auth/login')\n })\n\n // Health check\n app.get('/health', (c) => {\n return c.json({\n name: appName,\n version: appVersion,\n status: 'running',\n timestamp: new Date().toISOString()\n })\n })\n\n // 404 handler\n app.notFound((c) => {\n return c.json({ error: 'Not Found', status: 404 }, 404)\n })\n\n // Error handler\n app.onError((err, c) => {\n console.error(err)\n return c.json({ error: 'Internal Server Error', status: 500 }, 500)\n })\n\n return app\n}\n\n/**\n * Setup core middleware (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreMiddleware(_app: SonicJSApp): void {\n console.warn('setupCoreMiddleware is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n\n/**\n * Setup core routes (backward compatibility)\n *\n * @param _app - Hono application\n * @deprecated Use createSonicJSApp() instead\n */\nexport function setupCoreRoutes(_app: SonicJSApp): void {\n console.warn('setupCoreRoutes is deprecated. Use createSonicJSApp() instead.')\n // Backward compatibility implementation\n}\n","import { drizzle } from 'drizzle-orm/d1';\nimport * as schema from './schema';\n\nexport function createDb(d1: D1Database) {\n return drizzle(d1, { schema });\n}\n\nexport * from './schema';","{\n \"name\": \"@sonicjs-cms/core\",\n \"version\": \"2.0.0-beta.1\",\n \"description\": \"Core framework for SonicJS headless CMS - Edge-first, TypeScript-native CMS built for Cloudflare Workers\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./services\": {\n \"types\": \"./dist/services.d.ts\",\n \"import\": \"./dist/services.js\",\n \"require\": \"./dist/services.cjs\"\n },\n \"./middleware\": {\n \"types\": \"./dist/middleware.d.ts\",\n \"import\": \"./dist/middleware.js\",\n \"require\": \"./dist/middleware.cjs\"\n },\n \"./routes\": {\n \"types\": \"./dist/routes.d.ts\",\n \"import\": \"./dist/routes.js\",\n \"require\": \"./dist/routes.cjs\"\n },\n \"./templates\": {\n \"types\": \"./dist/templates.d.ts\",\n \"import\": \"./dist/templates.js\",\n \"require\": \"./dist/templates.cjs\"\n },\n \"./plugins\": {\n \"types\": \"./dist/plugins.d.ts\",\n \"import\": \"./dist/plugins.js\",\n \"require\": \"./dist/plugins.cjs\"\n },\n \"./utils\": {\n \"types\": \"./dist/utils.d.ts\",\n \"import\": \"./dist/utils.js\",\n \"require\": \"./dist/utils.cjs\"\n },\n \"./types\": {\n \"types\": \"./dist/types.d.ts\",\n \"import\": \"./dist/types.js\",\n \"require\": \"./dist/types.cjs\"\n }\n },\n \"files\": [\n \"dist\",\n \"migrations\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"type-check\": \"tsc --noEmit\",\n \"test\": \"vitest --run\",\n \"test:watch\": \"vitest\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"keywords\": [\n \"cms\",\n \"headless-cms\",\n \"cloudflare\",\n \"workers\",\n \"edge\",\n \"typescript\",\n \"hono\",\n \"content-management\",\n \"api\",\n \"sonicjs\"\n ],\n \"author\": \"SonicJS Team\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/sonicjs/sonicjs.git\",\n \"directory\": \"packages/core\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/sonicjs/sonicjs/issues\"\n },\n \"homepage\": \"https://sonicjs.com\",\n \"peerDependencies\": {\n \"@cloudflare/workers-types\": \"^4.0.0\",\n \"hono\": \"^4.0.0\",\n \"drizzle-orm\": \"^0.44.0\",\n \"zod\": \"^3.0.0\"\n },\n \"peerDependenciesMeta\": {\n \"@cloudflare/workers-types\": {\n \"optional\": false\n },\n \"hono\": {\n \"optional\": false\n },\n \"drizzle-orm\": {\n \"optional\": false\n },\n \"zod\": {\n \"optional\": false\n }\n },\n \"dependencies\": {\n \"drizzle-zod\": \"^0.8.2\",\n \"marked\": \"^15.0.12\",\n \"highlight.js\": \"^11.11.1\",\n \"semver\": \"^7.7.2\"\n },\n \"devDependencies\": {\n \"@cloudflare/workers-types\": \"^4.20250620.0\",\n \"@types/node\": \"^20.19.1\",\n \"drizzle-orm\": \"^0.44.2\",\n \"hono\": \"^4.10.1\",\n \"tsup\": \"^8.0.0\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^2.1.8\",\n \"zod\": \"^3.25.67\"\n },\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","/**\n * @sonicjs/core - Main Entry Point\n *\n * Core framework for SonicJS headless CMS\n * Built for Cloudflare's edge platform with TypeScript\n *\n * Phase 2 Migration Status:\n * - Week 1: Types, Utils, Database (COMPLETED ✓)\n * - Week 2: Services, Middleware, Plugins (COMPLETED ✓)\n * - Week 3: Routes, Templates (COMPLETED ✓)\n * - Week 4: Integration & Testing (COMPLETED ✓)\n *\n * Test Coverage:\n * - Utilities: 48 tests (sanitize, query-filter, metrics)\n * - Middleware: 51 tests (auth, logging, security, performance)\n * - Total: 99 tests passing\n */\n\n// ============================================================================\n// Main Application API (Phase 2 Week 1)\n// ============================================================================\n\nexport { createSonicJSApp, setupCoreMiddleware, setupCoreRoutes } from './app'\nexport type { SonicJSConfig, SonicJSApp, Bindings, Variables } from './app'\n\n// ============================================================================\n// Placeholders - To be populated in Phase 2\n// ============================================================================\n\n// Services - Week 2 (COMPLETED)\nexport {\n // Collection Management\n loadCollectionConfigs,\n loadCollectionConfig,\n getAvailableCollectionNames,\n validateCollectionConfig,\n syncCollections,\n syncCollection,\n isCollectionManaged,\n getManagedCollections,\n cleanupRemovedCollections,\n fullCollectionSync,\n // Database Migrations\n MigrationService,\n // Logging\n Logger,\n getLogger,\n initLogger,\n // Plugin Services - Class implementations\n PluginService as PluginServiceClass,\n PluginBootstrapService,\n} from './services'\n\nexport type { Migration, MigrationStatus, LogLevel, LogCategory, LogEntry, LogFilter, CorePlugin } from './services'\n\n// Middleware - Week 2 (COMPLETED)\nexport {\n // Authentication\n AuthManager,\n requireAuth,\n requireRole,\n optionalAuth,\n // Logging\n loggingMiddleware,\n detailedLoggingMiddleware,\n securityLoggingMiddleware,\n performanceLoggingMiddleware,\n // Performance\n cacheHeaders,\n compressionMiddleware,\n securityHeaders,\n // Permissions\n PermissionManager,\n requirePermission,\n requireAnyPermission,\n logActivity,\n // Plugin middleware\n requireActivePlugin,\n requireActivePlugins,\n getActivePlugins,\n isPluginActive,\n // Bootstrap\n bootstrapMiddleware,\n} from './middleware'\n\nexport type { Permission, UserPermissions } from './middleware'\n\n// Plugins - Week 2 (COMPLETED)\nexport {\n // Hook System - Class implementations\n HookSystemImpl,\n ScopedHookSystem as ScopedHookSystemClass,\n HookUtils,\n // Plugin Registry\n PluginRegistryImpl,\n // Plugin Manager - Class implementation\n PluginManager as PluginManagerClass,\n // Plugin Validator - Class implementation\n PluginValidator as PluginValidatorClass,\n} from './plugins'\n\n// Routes - Week 3 (COMPLETED)\nexport {\n ROUTES_INFO,\n apiRoutes,\n apiContentCrudRoutes,\n apiMediaRoutes,\n apiSystemRoutes,\n adminApiRoutes,\n authRoutes,\n adminContentRoutes,\n adminUsersRoutes,\n adminMediaRoutes,\n adminLogsRoutes,\n adminPluginRoutes,\n adminDesignRoutes,\n adminCheckboxRoutes,\n adminFAQRoutes,\n adminTestimonialsRoutes,\n adminCodeExamplesRoutes,\n} from './routes'\n\n// Templates - Week 3 (COMPLETED)\nexport {\n // Form templates\n renderForm,\n renderFormField,\n // Table templates\n renderTable,\n // Pagination templates\n renderPagination,\n // Alert templates\n renderAlert,\n // Confirmation dialog templates\n renderConfirmationDialog,\n getConfirmationDialogScript,\n // Filter bar templates\n renderFilterBar,\n} from './templates'\n\nexport type {\n FormField,\n FormData,\n TableColumn,\n TableData,\n PaginationData,\n AlertData,\n ConfirmationDialogOptions,\n FilterBarData,\n Filter,\n FilterOption,\n} from './templates'\n\n// Types - Week 1 (COMPLETED)\nexport type {\n // Collection types\n FieldType,\n FieldConfig,\n CollectionSchema,\n CollectionConfig,\n CollectionConfigModule,\n CollectionSyncResult,\n // Plugin types\n Plugin,\n PluginContext,\n PluginConfig,\n PluginRoutes,\n PluginMiddleware,\n PluginModel,\n PluginService,\n PluginAdminPage,\n PluginComponent,\n PluginMenuItem,\n PluginHook,\n HookHandler,\n HookContext,\n HookSystem,\n ScopedHookSystem,\n PluginRegistry,\n PluginManager,\n PluginStatus,\n AuthService,\n ContentService,\n MediaService,\n PluginLogger,\n PluginBuilderOptions,\n PluginValidator,\n PluginValidationResult,\n HookName,\n // Plugin manifest\n PluginManifest,\n} from './types'\n\nexport { HOOKS } from './types'\n\n// Utils - Week 1 (COMPLETED)\nexport {\n // Sanitization\n escapeHtml,\n sanitizeInput,\n sanitizeObject,\n // Template rendering\n TemplateRenderer,\n templateRenderer,\n renderTemplate,\n // Query filtering\n QueryFilterBuilder,\n buildQuery,\n // Metrics\n metricsTracker,\n} from './utils'\n\nexport type {\n FilterOperator,\n FilterCondition,\n FilterGroup,\n QueryFilter,\n QueryResult,\n} from './utils'\n\n// Database - Week 1 (COMPLETED)\nexport {\n createDb,\n // Schema exports\n users,\n collections,\n content,\n contentVersions,\n media,\n apiTokens,\n workflowHistory,\n plugins,\n pluginHooks,\n pluginRoutes,\n pluginAssets,\n pluginActivityLog,\n systemLogs,\n logConfig,\n // Zod validation schemas\n insertUserSchema,\n selectUserSchema,\n insertCollectionSchema,\n selectCollectionSchema,\n insertContentSchema,\n selectContentSchema,\n insertMediaSchema,\n selectMediaSchema,\n insertWorkflowHistorySchema,\n selectWorkflowHistorySchema,\n insertPluginSchema,\n selectPluginSchema,\n insertPluginHookSchema,\n selectPluginHookSchema,\n insertPluginRouteSchema,\n selectPluginRouteSchema,\n insertPluginAssetSchema,\n selectPluginAssetSchema,\n insertPluginActivityLogSchema,\n selectPluginActivityLogSchema,\n insertSystemLogSchema,\n selectSystemLogSchema,\n insertLogConfigSchema,\n selectLogConfigSchema,\n} from './db'\n\nexport type {\n User,\n NewUser,\n Collection,\n NewCollection,\n Content,\n NewContent,\n Media,\n NewMedia,\n WorkflowHistory,\n NewWorkflowHistory,\n Plugin as DbPlugin,\n NewPlugin,\n PluginHook as DbPluginHook,\n NewPluginHook,\n PluginRoute,\n NewPluginRoute,\n PluginAsset,\n NewPluginAsset,\n PluginActivityLog,\n NewPluginActivityLog,\n SystemLog,\n NewSystemLog,\n LogConfig,\n NewLogConfig,\n} from './db'\n\n// Plugins - Week 2\n// export { PluginBuilder, HookSystem } from './plugins/sdk'\n\n// ============================================================================\n// Version\n// ============================================================================\n\n// Import version from package.json\nimport packageJson from '../package.json'\nexport const VERSION = packageJson.version\n\n// ============================================================================\n// Phase 2 Migration Notes\n// ============================================================================\n\n/**\n * This is a work-in-progress package being extracted from the main SonicJS codebase.\n *\n * Current Phase: 2 (Core Module Migration)\n * Current Week: 1 (Types, Utils, Database)\n *\n * Expected completion: 4 weeks from 2025-01-17\n *\n * DO NOT USE IN PRODUCTION - Alpha release for development only\n */\n"]}
|
package/dist/routes.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQUMBDPNJ_cjs = require('./chunk-QUMBDPNJ.cjs');
|
|
4
4
|
require('./chunk-AGOE25LF.cjs');
|
|
5
5
|
require('./chunk-BUKT6HP5.cjs');
|
|
6
6
|
require('./chunk-RNR4HA23.cjs');
|
|
7
|
+
require('./chunk-ET5I4GBD.cjs');
|
|
7
8
|
require('./chunk-RGCQSFKC.cjs');
|
|
8
9
|
require('./chunk-IGJUBJBW.cjs');
|
|
9
10
|
|
|
@@ -11,47 +12,71 @@ require('./chunk-IGJUBJBW.cjs');
|
|
|
11
12
|
|
|
12
13
|
Object.defineProperty(exports, "ROUTES_INFO", {
|
|
13
14
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkQUMBDPNJ_cjs.ROUTES_INFO; }
|
|
15
16
|
});
|
|
16
17
|
Object.defineProperty(exports, "adminApiRoutes", {
|
|
17
18
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_api_default; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "adminCheckboxRoutes", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminCheckboxRoutes; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "adminCodeExamplesRoutes", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_code_examples_default; }
|
|
19
28
|
});
|
|
20
29
|
Object.defineProperty(exports, "adminContentRoutes", {
|
|
21
30
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_content_default; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "adminDesignRoutes", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminDesignRoutes; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "adminFAQRoutes", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_faq_default; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "adminLogsRoutes", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminLogsRoutes; }
|
|
23
44
|
});
|
|
24
45
|
Object.defineProperty(exports, "adminMediaRoutes", {
|
|
25
46
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminMediaRoutes; }
|
|
27
48
|
});
|
|
28
49
|
Object.defineProperty(exports, "adminPluginRoutes", {
|
|
29
50
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkQUMBDPNJ_cjs.adminPluginRoutes; }
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "adminTestimonialsRoutes", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return chunkQUMBDPNJ_cjs.admin_testimonials_default; }
|
|
31
56
|
});
|
|
32
57
|
Object.defineProperty(exports, "adminUsersRoutes", {
|
|
33
58
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkQUMBDPNJ_cjs.userRoutes; }
|
|
35
60
|
});
|
|
36
61
|
Object.defineProperty(exports, "apiContentCrudRoutes", {
|
|
37
62
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_content_crud_default; }
|
|
39
64
|
});
|
|
40
65
|
Object.defineProperty(exports, "apiMediaRoutes", {
|
|
41
66
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_media_default; }
|
|
43
68
|
});
|
|
44
69
|
Object.defineProperty(exports, "apiRoutes", {
|
|
45
70
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_default; }
|
|
47
72
|
});
|
|
48
73
|
Object.defineProperty(exports, "apiSystemRoutes", {
|
|
49
74
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkQUMBDPNJ_cjs.api_system_default; }
|
|
51
76
|
});
|
|
52
77
|
Object.defineProperty(exports, "authRoutes", {
|
|
53
78
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkQUMBDPNJ_cjs.auth_default; }
|
|
55
80
|
});
|
|
56
81
|
//# sourceMappingURL=routes.cjs.map
|
|
57
82
|
//# sourceMappingURL=routes.cjs.map
|
package/dist/routes.d.ts
ADDED
package/dist/routes.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { ROUTES_INFO, admin_api_default as adminApiRoutes, admin_content_default as adminContentRoutes, adminMediaRoutes, adminPluginRoutes, 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 } from './chunk-
|
|
1
|
+
export { ROUTES_INFO, admin_api_default as adminApiRoutes, adminCheckboxRoutes, admin_code_examples_default as adminCodeExamplesRoutes, admin_content_default as adminContentRoutes, adminDesignRoutes, admin_faq_default as adminFAQRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, admin_testimonials_default as adminTestimonialsRoutes, 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 } from './chunk-JETM2U2D.js';
|
|
2
2
|
import './chunk-3MNMOLSA.js';
|
|
3
3
|
import './chunk-WESS2U3K.js';
|
|
4
4
|
import './chunk-7N3HK7ZK.js';
|
|
5
|
+
import './chunk-P3VS4DV3.js';
|
|
5
6
|
import './chunk-JIINOD2W.js';
|
|
6
7
|
import './chunk-V4OQ3NZ2.js';
|
|
7
8
|
//# sourceMappingURL=routes.js.map
|
package/dist/templates.cjs
CHANGED
|
@@ -1,41 +1,74 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4XI3YBKU_cjs = require('./chunk-4XI3YBKU.cjs');
|
|
4
|
+
var chunkET5I4GBD_cjs = require('./chunk-ET5I4GBD.cjs');
|
|
4
5
|
require('./chunk-IGJUBJBW.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
Object.defineProperty(exports, "renderFilterBar", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunk4XI3YBKU_cjs.renderFilterBar; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "renderForm", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunk4XI3YBKU_cjs.renderForm; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "renderFormField", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunk4XI3YBKU_cjs.renderFormField; }
|
|
20
|
+
});
|
|
8
21
|
Object.defineProperty(exports, "getConfirmationDialogScript", {
|
|
9
22
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkET5I4GBD_cjs.getConfirmationDialogScript; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "renderAdminLayout", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkET5I4GBD_cjs.renderAdminLayout; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkET5I4GBD_cjs.renderAdminLayoutCatalyst; }
|
|
11
32
|
});
|
|
12
33
|
Object.defineProperty(exports, "renderAlert", {
|
|
13
34
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkET5I4GBD_cjs.renderAlert; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "renderCheckboxPage", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkET5I4GBD_cjs.renderCheckboxPage; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "renderCodeExamplesList", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkET5I4GBD_cjs.renderCodeExamplesList; }
|
|
15
44
|
});
|
|
16
45
|
Object.defineProperty(exports, "renderConfirmationDialog", {
|
|
17
46
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkET5I4GBD_cjs.renderConfirmationDialog; }
|
|
19
48
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "renderDesignPage", {
|
|
21
50
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkET5I4GBD_cjs.renderDesignPage; }
|
|
23
52
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
53
|
+
Object.defineProperty(exports, "renderFAQList", {
|
|
25
54
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkET5I4GBD_cjs.renderFAQList; }
|
|
27
56
|
});
|
|
28
|
-
Object.defineProperty(exports, "
|
|
57
|
+
Object.defineProperty(exports, "renderLogo", {
|
|
29
58
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkET5I4GBD_cjs.renderLogo; }
|
|
31
60
|
});
|
|
32
61
|
Object.defineProperty(exports, "renderPagination", {
|
|
33
62
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkET5I4GBD_cjs.renderPagination; }
|
|
35
64
|
});
|
|
36
65
|
Object.defineProperty(exports, "renderTable", {
|
|
37
66
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkET5I4GBD_cjs.renderTable; }
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "renderTestimonialsList", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () { return chunkET5I4GBD_cjs.renderTestimonialsList; }
|
|
39
72
|
});
|
|
40
73
|
//# sourceMappingURL=templates.cjs.map
|
|
41
74
|
//# sourceMappingURL=templates.cjs.map
|