@sonicjs-cms/core 2.0.0-alpha.2 → 2.0.0-alpha.4

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.
Files changed (63) hide show
  1. package/dist/chunk-3MNMOLSA.js +133 -0
  2. package/dist/chunk-3MNMOLSA.js.map +1 -0
  3. package/dist/chunk-5XKH6PBR.js +7026 -0
  4. package/dist/chunk-5XKH6PBR.js.map +1 -0
  5. package/dist/chunk-AGOE25LF.cjs +137 -0
  6. package/dist/chunk-AGOE25LF.cjs.map +1 -0
  7. package/dist/chunk-B5DU2UAN.cjs +7035 -0
  8. package/dist/chunk-B5DU2UAN.cjs.map +1 -0
  9. package/dist/index.cjs +13 -7
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.js +10 -3
  12. package/dist/index.js.map +1 -1
  13. package/dist/routes.cjs +34 -2
  14. package/dist/routes.js +5 -1
  15. package/dist/services.cjs +13 -1
  16. package/dist/services.js +1 -1
  17. package/migrations/001_initial_schema.sql +198 -0
  18. package/migrations/002_faq_plugin.sql +86 -0
  19. package/migrations/003_stage5_enhancements.sql +121 -0
  20. package/migrations/004_stage6_user_management.sql +183 -0
  21. package/migrations/005_stage7_workflow_automation.sql +294 -0
  22. package/migrations/006_plugin_system.sql +155 -0
  23. package/migrations/007_demo_login_plugin.sql +23 -0
  24. package/migrations/008_fix_slug_validation.sql +22 -0
  25. package/migrations/009_system_logging.sql +57 -0
  26. package/migrations/011_config_managed_collections.sql +14 -0
  27. package/migrations/012_testimonials_plugin.sql +80 -0
  28. package/migrations/013_code_examples_plugin.sql +177 -0
  29. package/migrations/014_fix_plugin_registry.sql +88 -0
  30. package/migrations/015_add_remaining_plugins.sql +89 -0
  31. package/migrations/016_remove_duplicate_cache_plugin.sql +17 -0
  32. package/migrations/017_auth_configurable_fields.sql +49 -0
  33. package/package.json +1 -1
  34. package/dist/chunk-4URGXJP7.js +0 -3
  35. package/dist/chunk-4URGXJP7.js.map +0 -1
  36. package/dist/chunk-ALTMI5Y2.cjs +0 -4
  37. package/dist/chunk-ALTMI5Y2.cjs.map +0 -1
  38. package/dist/chunk-BOLQHE4J.cjs +0 -11
  39. package/dist/chunk-BOLQHE4J.cjs.map +0 -1
  40. package/dist/chunk-HD7R6T6I.js +0 -9
  41. package/dist/chunk-HD7R6T6I.js.map +0 -1
  42. package/dist/collection-config-FLlGtsh9.d.cts +0 -107
  43. package/dist/collection-config-FLlGtsh9.d.ts +0 -107
  44. package/dist/index-BlsY5XNH.d.ts +0 -8333
  45. package/dist/index-D45jaIlr.d.cts +0 -8333
  46. package/dist/index.d.cts +0 -136
  47. package/dist/index.d.ts +0 -136
  48. package/dist/middleware.d.cts +0 -206
  49. package/dist/middleware.d.ts +0 -206
  50. package/dist/plugin-UzmDImQc.d.cts +0 -357
  51. package/dist/plugin-UzmDImQc.d.ts +0 -357
  52. package/dist/plugins.d.cts +0 -330
  53. package/dist/plugins.d.ts +0 -330
  54. package/dist/routes.d.cts +0 -17
  55. package/dist/routes.d.ts +0 -17
  56. package/dist/services.d.cts +0 -5
  57. package/dist/services.d.ts +0 -5
  58. package/dist/templates.d.cts +0 -140
  59. package/dist/templates.d.ts +0 -140
  60. package/dist/types.d.cts +0 -41
  61. package/dist/types.d.ts +0 -41
  62. package/dist/utils.d.cts +0 -184
  63. package/dist/utils.d.ts +0 -184
package/dist/types.d.ts DELETED
@@ -1,41 +0,0 @@
1
- export { b as CollectionConfig, c as CollectionConfigModule, C as CollectionSchema, d as CollectionSyncResult, a as FieldConfig, F as FieldType } from './collection-config-FLlGtsh9.js';
2
- export { A as AuthService, C as ContentService, u as HOOKS, k as HookContext, H as HookHandler, t as HookName, l as HookSystem, M as MediaService, v as ModelRelationship, P as Plugin, g as PluginAdminPage, q as PluginBuilderOptions, h as PluginComponent, b as PluginConfig, a as PluginContext, j as PluginHook, p as PluginLogger, n as PluginManager, i as PluginMenuItem, d as PluginMiddleware, e as PluginModel, m as PluginRegistry, c as PluginRoutes, f as PluginService, o as PluginStatus, s as PluginValidationResult, r as PluginValidator, S as ScopedHookSystem } from './plugin-UzmDImQc.js';
3
- import 'hono';
4
- import 'zod';
5
- import '@cloudflare/workers-types';
6
-
7
- /**
8
- * Plugin Manifest Types
9
- *
10
- * Defines the structure for plugin manifest.json files
11
- */
12
- interface PluginManifest {
13
- id: string;
14
- name: string;
15
- version: string;
16
- description: string;
17
- author: string;
18
- homepage?: string;
19
- repository?: string;
20
- license?: string;
21
- category: string;
22
- tags?: string[];
23
- dependencies?: string[];
24
- settings?: Record<string, any>;
25
- hooks?: Record<string, string>;
26
- routes?: Array<{
27
- path: string;
28
- method: string;
29
- handler: string;
30
- description?: string;
31
- }>;
32
- permissions?: Record<string, string>;
33
- adminMenu?: {
34
- label: string;
35
- icon: string;
36
- path: string;
37
- order: number;
38
- };
39
- }
40
-
41
- export type { PluginManifest };
package/dist/utils.d.cts DELETED
@@ -1,184 +0,0 @@
1
- /**
2
- * HTML sanitization utilities for preventing XSS attacks
3
- */
4
- /**
5
- * Escapes HTML special characters to prevent XSS attacks
6
- * @param text - The text to escape
7
- * @returns The escaped text safe for HTML output
8
- */
9
- declare function escapeHtml(text: string): string;
10
- /**
11
- * Sanitizes user input by escaping HTML special characters
12
- * This should be used for all user-provided text fields to prevent XSS
13
- * @param input - The input string to sanitize
14
- * @returns The sanitized string
15
- */
16
- declare function sanitizeInput(input: string | null | undefined): string;
17
- /**
18
- * Sanitizes an object's string properties
19
- * @param obj - Object with string properties to sanitize
20
- * @param fields - Array of field names to sanitize
21
- * @returns New object with sanitized fields
22
- */
23
- declare function sanitizeObject<T extends Record<string, any>>(obj: T, fields: (keyof T)[]): T;
24
-
25
- interface TemplateData {
26
- [key: string]: any;
27
- }
28
- declare class TemplateRenderer {
29
- private templateCache;
30
- constructor();
31
- /**
32
- * Simple Handlebars-like template engine
33
- */
34
- private renderTemplate;
35
- /**
36
- * Get nested value from object using dot notation
37
- */
38
- private getNestedValue;
39
- /**
40
- * Title case helper function
41
- */
42
- private titleCase;
43
- /**
44
- * Render a template string with data
45
- */
46
- render(template: string, data?: TemplateData): string;
47
- /**
48
- * Clear template cache (useful for development)
49
- */
50
- clearCache(): void;
51
- }
52
- declare const templateRenderer: TemplateRenderer;
53
- declare function renderTemplate(template: string, data?: TemplateData): string;
54
-
55
- /**
56
- * Query Filter Builder for SonicJS AI
57
- * Supports comprehensive filtering with AND/OR logic
58
- * Compatible with D1 Database (SQLite)
59
- */
60
- type FilterOperator = 'equals' | 'not_equals' | 'greater_than' | 'greater_than_equal' | 'less_than' | 'less_than_equal' | 'like' | 'contains' | 'in' | 'not_in' | 'all' | 'exists' | 'near' | 'within' | 'intersects';
61
- interface FilterCondition {
62
- field: string;
63
- operator: FilterOperator;
64
- value: any;
65
- }
66
- interface FilterGroup {
67
- and?: FilterCondition[];
68
- or?: FilterCondition[];
69
- }
70
- interface QueryFilter {
71
- where?: FilterGroup;
72
- limit?: number;
73
- offset?: number;
74
- sort?: {
75
- field: string;
76
- order: 'asc' | 'desc';
77
- }[];
78
- }
79
- interface QueryResult {
80
- sql: string;
81
- params: any[];
82
- errors: string[];
83
- }
84
- /**
85
- * Query Filter Builder
86
- * Converts filter objects into SQL WHERE clauses with parameterized queries
87
- */
88
- declare class QueryFilterBuilder {
89
- private params;
90
- private errors;
91
- /**
92
- * Build a complete SQL query from filter object
93
- */
94
- build(baseTable: string, filter: QueryFilter): QueryResult;
95
- /**
96
- * Build WHERE clause from filter group
97
- */
98
- private buildWhereClause;
99
- /**
100
- * Build a single condition
101
- */
102
- private buildCondition;
103
- /**
104
- * Build equals condition
105
- */
106
- private buildEquals;
107
- /**
108
- * Build not equals condition
109
- */
110
- private buildNotEquals;
111
- /**
112
- * Build comparison condition (>, >=, <, <=)
113
- */
114
- private buildComparison;
115
- /**
116
- * Build LIKE condition (case-insensitive, all words must be present)
117
- */
118
- private buildLike;
119
- /**
120
- * Build CONTAINS condition (case-insensitive substring)
121
- */
122
- private buildContains;
123
- /**
124
- * Build IN condition
125
- */
126
- private buildIn;
127
- /**
128
- * Build NOT IN condition
129
- */
130
- private buildNotIn;
131
- /**
132
- * Build ALL condition (value must contain all items in list)
133
- * For SQLite, we'll check if a JSON array contains all values
134
- */
135
- private buildAll;
136
- /**
137
- * Build EXISTS condition
138
- */
139
- private buildExists;
140
- /**
141
- * Sanitize field names to prevent SQL injection
142
- */
143
- private sanitizeFieldName;
144
- /**
145
- * Parse filter from query string
146
- */
147
- static parseFromQuery(query: Record<string, any>): QueryFilter;
148
- }
149
- /**
150
- * Helper function to build query from filter
151
- */
152
- declare function buildQuery(table: string, filter: QueryFilter): QueryResult;
153
-
154
- /**
155
- * Simple in-memory metrics tracker for real-time analytics
156
- * Tracks requests per second using a sliding window
157
- */
158
- declare class MetricsTracker {
159
- private requests;
160
- private readonly windowSize;
161
- /**
162
- * Record a new request
163
- */
164
- recordRequest(): void;
165
- /**
166
- * Clean up old requests outside the window
167
- */
168
- private cleanup;
169
- /**
170
- * Get current requests per second
171
- */
172
- getRequestsPerSecond(): number;
173
- /**
174
- * Get total requests in the current window
175
- */
176
- getTotalRequests(): number;
177
- /**
178
- * Get average requests per second over the window
179
- */
180
- getAverageRPS(): number;
181
- }
182
- declare const metricsTracker: MetricsTracker;
183
-
184
- export { type FilterCondition, type FilterGroup, type FilterOperator, type QueryFilter, QueryFilterBuilder, type QueryResult, TemplateRenderer, buildQuery, escapeHtml, metricsTracker, renderTemplate, sanitizeInput, sanitizeObject, templateRenderer };
package/dist/utils.d.ts DELETED
@@ -1,184 +0,0 @@
1
- /**
2
- * HTML sanitization utilities for preventing XSS attacks
3
- */
4
- /**
5
- * Escapes HTML special characters to prevent XSS attacks
6
- * @param text - The text to escape
7
- * @returns The escaped text safe for HTML output
8
- */
9
- declare function escapeHtml(text: string): string;
10
- /**
11
- * Sanitizes user input by escaping HTML special characters
12
- * This should be used for all user-provided text fields to prevent XSS
13
- * @param input - The input string to sanitize
14
- * @returns The sanitized string
15
- */
16
- declare function sanitizeInput(input: string | null | undefined): string;
17
- /**
18
- * Sanitizes an object's string properties
19
- * @param obj - Object with string properties to sanitize
20
- * @param fields - Array of field names to sanitize
21
- * @returns New object with sanitized fields
22
- */
23
- declare function sanitizeObject<T extends Record<string, any>>(obj: T, fields: (keyof T)[]): T;
24
-
25
- interface TemplateData {
26
- [key: string]: any;
27
- }
28
- declare class TemplateRenderer {
29
- private templateCache;
30
- constructor();
31
- /**
32
- * Simple Handlebars-like template engine
33
- */
34
- private renderTemplate;
35
- /**
36
- * Get nested value from object using dot notation
37
- */
38
- private getNestedValue;
39
- /**
40
- * Title case helper function
41
- */
42
- private titleCase;
43
- /**
44
- * Render a template string with data
45
- */
46
- render(template: string, data?: TemplateData): string;
47
- /**
48
- * Clear template cache (useful for development)
49
- */
50
- clearCache(): void;
51
- }
52
- declare const templateRenderer: TemplateRenderer;
53
- declare function renderTemplate(template: string, data?: TemplateData): string;
54
-
55
- /**
56
- * Query Filter Builder for SonicJS AI
57
- * Supports comprehensive filtering with AND/OR logic
58
- * Compatible with D1 Database (SQLite)
59
- */
60
- type FilterOperator = 'equals' | 'not_equals' | 'greater_than' | 'greater_than_equal' | 'less_than' | 'less_than_equal' | 'like' | 'contains' | 'in' | 'not_in' | 'all' | 'exists' | 'near' | 'within' | 'intersects';
61
- interface FilterCondition {
62
- field: string;
63
- operator: FilterOperator;
64
- value: any;
65
- }
66
- interface FilterGroup {
67
- and?: FilterCondition[];
68
- or?: FilterCondition[];
69
- }
70
- interface QueryFilter {
71
- where?: FilterGroup;
72
- limit?: number;
73
- offset?: number;
74
- sort?: {
75
- field: string;
76
- order: 'asc' | 'desc';
77
- }[];
78
- }
79
- interface QueryResult {
80
- sql: string;
81
- params: any[];
82
- errors: string[];
83
- }
84
- /**
85
- * Query Filter Builder
86
- * Converts filter objects into SQL WHERE clauses with parameterized queries
87
- */
88
- declare class QueryFilterBuilder {
89
- private params;
90
- private errors;
91
- /**
92
- * Build a complete SQL query from filter object
93
- */
94
- build(baseTable: string, filter: QueryFilter): QueryResult;
95
- /**
96
- * Build WHERE clause from filter group
97
- */
98
- private buildWhereClause;
99
- /**
100
- * Build a single condition
101
- */
102
- private buildCondition;
103
- /**
104
- * Build equals condition
105
- */
106
- private buildEquals;
107
- /**
108
- * Build not equals condition
109
- */
110
- private buildNotEquals;
111
- /**
112
- * Build comparison condition (>, >=, <, <=)
113
- */
114
- private buildComparison;
115
- /**
116
- * Build LIKE condition (case-insensitive, all words must be present)
117
- */
118
- private buildLike;
119
- /**
120
- * Build CONTAINS condition (case-insensitive substring)
121
- */
122
- private buildContains;
123
- /**
124
- * Build IN condition
125
- */
126
- private buildIn;
127
- /**
128
- * Build NOT IN condition
129
- */
130
- private buildNotIn;
131
- /**
132
- * Build ALL condition (value must contain all items in list)
133
- * For SQLite, we'll check if a JSON array contains all values
134
- */
135
- private buildAll;
136
- /**
137
- * Build EXISTS condition
138
- */
139
- private buildExists;
140
- /**
141
- * Sanitize field names to prevent SQL injection
142
- */
143
- private sanitizeFieldName;
144
- /**
145
- * Parse filter from query string
146
- */
147
- static parseFromQuery(query: Record<string, any>): QueryFilter;
148
- }
149
- /**
150
- * Helper function to build query from filter
151
- */
152
- declare function buildQuery(table: string, filter: QueryFilter): QueryResult;
153
-
154
- /**
155
- * Simple in-memory metrics tracker for real-time analytics
156
- * Tracks requests per second using a sliding window
157
- */
158
- declare class MetricsTracker {
159
- private requests;
160
- private readonly windowSize;
161
- /**
162
- * Record a new request
163
- */
164
- recordRequest(): void;
165
- /**
166
- * Clean up old requests outside the window
167
- */
168
- private cleanup;
169
- /**
170
- * Get current requests per second
171
- */
172
- getRequestsPerSecond(): number;
173
- /**
174
- * Get total requests in the current window
175
- */
176
- getTotalRequests(): number;
177
- /**
178
- * Get average requests per second over the window
179
- */
180
- getAverageRPS(): number;
181
- }
182
- declare const metricsTracker: MetricsTracker;
183
-
184
- export { type FilterCondition, type FilterGroup, type FilterOperator, type QueryFilter, QueryFilterBuilder, type QueryResult, TemplateRenderer, buildQuery, escapeHtml, metricsTracker, renderTemplate, sanitizeInput, sanitizeObject, templateRenderer };