@sonicjs-cms/core 2.0.0-alpha.1 → 2.0.0-alpha.11

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 (98) hide show
  1. package/dist/chunk-3MNMOLSA.js +133 -0
  2. package/dist/chunk-3MNMOLSA.js.map +1 -0
  3. package/dist/{chunk-BRC3F4CG.cjs → chunk-6BHDKYLU.cjs} +8 -2
  4. package/dist/{chunk-KRJMGD4E.js.map → chunk-6BHDKYLU.cjs.map} +1 -1
  5. package/dist/{chunk-CXZDAR6S.js → chunk-7N3HK7ZK.js} +3 -3
  6. package/dist/{chunk-CXZDAR6S.js.map → chunk-7N3HK7ZK.js.map} +1 -1
  7. package/dist/chunk-AGOE25LF.cjs +137 -0
  8. package/dist/chunk-AGOE25LF.cjs.map +1 -0
  9. package/dist/{chunk-NRSL6BQI.js → chunk-BITQ4MFX.js} +3 -3
  10. package/dist/{chunk-NRSL6BQI.js.map → chunk-BITQ4MFX.js.map} +1 -1
  11. package/dist/{chunk-24PWAFUT.cjs → chunk-BUKT6HP5.cjs} +13 -13
  12. package/dist/{chunk-24PWAFUT.cjs.map → chunk-BUKT6HP5.cjs.map} +1 -1
  13. package/dist/chunk-DG4INX36.cjs +14246 -0
  14. package/dist/chunk-DG4INX36.cjs.map +1 -0
  15. package/dist/chunk-FDUDHGI6.js +14233 -0
  16. package/dist/chunk-FDUDHGI6.js.map +1 -0
  17. package/dist/{chunk-L3NXO7Y4.cjs → chunk-FVMV5DKA.cjs} +49 -49
  18. package/dist/{chunk-L3NXO7Y4.cjs.map → chunk-FVMV5DKA.cjs.map} +1 -1
  19. package/dist/{chunk-KRJMGD4E.js → chunk-FZYF43TN.js} +8 -2
  20. package/dist/chunk-FZYF43TN.js.map +1 -0
  21. package/dist/chunk-G4JGVZAF.js +1337 -0
  22. package/dist/chunk-G4JGVZAF.js.map +1 -0
  23. package/dist/{chunk-EMMSS5I5.cjs → chunk-IGJUBJBW.cjs} +8 -2
  24. package/dist/{chunk-ALTMI5Y2.cjs.map → chunk-IGJUBJBW.cjs.map} +1 -1
  25. package/dist/chunk-LEGKJ5DI.cjs +1344 -0
  26. package/dist/chunk-LEGKJ5DI.cjs.map +1 -0
  27. package/dist/{chunk-WJ7QYVR2.cjs → chunk-RNR4HA23.cjs} +4 -4
  28. package/dist/{chunk-WJ7QYVR2.cjs.map → chunk-RNR4HA23.cjs.map} +1 -1
  29. package/dist/{chunk-G3PMV62Z.js → chunk-V4OQ3NZ2.js} +7 -3
  30. package/dist/{chunk-G3PMV62Z.js.map → chunk-V4OQ3NZ2.js.map} +1 -1
  31. package/dist/{chunk-PTQZ5FEI.js → chunk-WESS2U3K.js} +3 -3
  32. package/dist/{chunk-PTQZ5FEI.js.map → chunk-WESS2U3K.js.map} +1 -1
  33. package/dist/index.cjs +147 -101
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.ts +5 -135
  36. package/dist/index.js +24 -9
  37. package/dist/index.js.map +1 -1
  38. package/dist/middleware.cjs +23 -23
  39. package/dist/middleware.d.ts +2 -206
  40. package/dist/middleware.js +3 -3
  41. package/dist/plugins.cjs +8 -8
  42. package/dist/plugins.d.ts +2 -330
  43. package/dist/plugins.js +2 -2
  44. package/dist/routes.cjs +52 -3
  45. package/dist/routes.d.ts +2 -17
  46. package/dist/routes.js +7 -2
  47. package/dist/services.cjs +31 -19
  48. package/dist/services.d.ts +2 -5
  49. package/dist/services.js +3 -3
  50. package/dist/templates.cjs +23 -10
  51. package/dist/templates.d.ts +2 -140
  52. package/dist/templates.js +3 -2
  53. package/dist/types.cjs +1 -1
  54. package/dist/types.d.ts +2 -41
  55. package/dist/types.js +1 -1
  56. package/dist/utils.cjs +1 -1
  57. package/dist/utils.d.ts +2 -184
  58. package/dist/utils.js +1 -1
  59. package/migrations/001_initial_schema.sql +198 -0
  60. package/migrations/002_faq_plugin.sql +86 -0
  61. package/migrations/003_stage5_enhancements.sql +121 -0
  62. package/migrations/004_stage6_user_management.sql +183 -0
  63. package/migrations/005_stage7_workflow_automation.sql +294 -0
  64. package/migrations/006_plugin_system.sql +155 -0
  65. package/migrations/007_demo_login_plugin.sql +23 -0
  66. package/migrations/008_fix_slug_validation.sql +22 -0
  67. package/migrations/009_system_logging.sql +57 -0
  68. package/migrations/011_config_managed_collections.sql +14 -0
  69. package/migrations/012_testimonials_plugin.sql +80 -0
  70. package/migrations/013_code_examples_plugin.sql +177 -0
  71. package/migrations/014_fix_plugin_registry.sql +88 -0
  72. package/migrations/015_add_remaining_plugins.sql +89 -0
  73. package/migrations/016_remove_duplicate_cache_plugin.sql +17 -0
  74. package/migrations/017_auth_configurable_fields.sql +49 -0
  75. package/package.json +2 -2
  76. package/dist/chunk-4URGXJP7.js +0 -3
  77. package/dist/chunk-4URGXJP7.js.map +0 -1
  78. package/dist/chunk-ALTMI5Y2.cjs +0 -4
  79. package/dist/chunk-BOLQHE4J.cjs +0 -11
  80. package/dist/chunk-BOLQHE4J.cjs.map +0 -1
  81. package/dist/chunk-BRC3F4CG.cjs.map +0 -1
  82. package/dist/chunk-EMMSS5I5.cjs.map +0 -1
  83. package/dist/chunk-HD7R6T6I.js +0 -9
  84. package/dist/chunk-HD7R6T6I.js.map +0 -1
  85. package/dist/collection-config-FLlGtsh9.d.cts +0 -107
  86. package/dist/collection-config-FLlGtsh9.d.ts +0 -107
  87. package/dist/index-BlsY5XNH.d.ts +0 -8333
  88. package/dist/index-D45jaIlr.d.cts +0 -8333
  89. package/dist/index.d.cts +0 -136
  90. package/dist/middleware.d.cts +0 -206
  91. package/dist/plugin-UzmDImQc.d.cts +0 -357
  92. package/dist/plugin-UzmDImQc.d.ts +0 -357
  93. package/dist/plugins.d.cts +0 -330
  94. package/dist/routes.d.cts +0 -17
  95. package/dist/services.d.cts +0 -5
  96. package/dist/templates.d.cts +0 -140
  97. package/dist/types.d.cts +0 -41
  98. package/dist/utils.d.cts +0 -184
@@ -1,140 +0,0 @@
1
- interface FormField {
2
- name: string;
3
- label: string;
4
- type: 'text' | 'email' | 'textarea' | 'select' | 'checkbox' | 'rich_text' | 'number' | 'date' | 'multi_select' | 'file';
5
- value?: any;
6
- placeholder?: string;
7
- required?: boolean;
8
- readonly?: boolean;
9
- helpText?: string;
10
- options?: Array<{
11
- value: string;
12
- label: string;
13
- selected?: boolean;
14
- }>;
15
- rows?: number;
16
- className?: string;
17
- validation?: {
18
- min?: number;
19
- max?: number;
20
- pattern?: string;
21
- };
22
- }
23
- interface FormData {
24
- id?: string;
25
- action?: string;
26
- method?: string;
27
- hxPost?: string;
28
- hxPut?: string;
29
- hxTarget?: string;
30
- fields: FormField[];
31
- submitButtons: Array<{
32
- label: string;
33
- type?: 'submit' | 'button';
34
- value?: string;
35
- name?: string;
36
- className?: string;
37
- onclick?: string;
38
- }>;
39
- title?: string;
40
- description?: string;
41
- className?: string;
42
- }
43
- declare function renderForm(data: FormData): string;
44
- declare function renderFormField(field: FormField): string;
45
-
46
- interface TableColumn {
47
- key: string;
48
- label: string;
49
- sortable?: boolean;
50
- className?: string;
51
- sortType?: 'string' | 'number' | 'date' | 'boolean';
52
- render?: (value: any, row: any) => string;
53
- }
54
- interface TableData<T = any> {
55
- columns: TableColumn[];
56
- rows: T[];
57
- selectable?: boolean;
58
- className?: string;
59
- emptyMessage?: string;
60
- tableId?: string;
61
- title?: string;
62
- rowClickable?: boolean;
63
- rowClickUrl?: (row: T) => string;
64
- }
65
- declare function renderTable<T = any>(data: TableData<T>): string;
66
-
67
- interface PaginationData {
68
- currentPage: number;
69
- totalPages: number;
70
- totalItems: number;
71
- itemsPerPage: number;
72
- startItem: number;
73
- endItem: number;
74
- baseUrl: string;
75
- queryParams?: Record<string, string>;
76
- showPageNumbers?: boolean;
77
- maxPageNumbers?: number;
78
- showPageSizeSelector?: boolean;
79
- pageSizeOptions?: number[];
80
- }
81
- declare function renderPagination(data: PaginationData): string;
82
-
83
- type AlertType = 'success' | 'error' | 'warning' | 'info';
84
- interface AlertData {
85
- type: AlertType;
86
- title?: string;
87
- message: string;
88
- dismissible?: boolean;
89
- className?: string;
90
- icon?: boolean;
91
- }
92
- declare function renderAlert(data: AlertData): string;
93
-
94
- interface ConfirmationDialogOptions {
95
- id: string;
96
- title: string;
97
- message: string;
98
- confirmText?: string;
99
- cancelText?: string;
100
- confirmClass?: string;
101
- iconColor?: 'red' | 'yellow' | 'blue';
102
- onConfirm?: string;
103
- }
104
- declare function renderConfirmationDialog(options: ConfirmationDialogOptions): string;
105
- /**
106
- * Helper function to show a confirmation dialog programmatically
107
- * Usage in templates: Add this script and call showConfirmDialog()
108
- */
109
- declare function getConfirmationDialogScript(): string;
110
-
111
- interface FilterOption {
112
- value: string;
113
- label: string;
114
- selected?: boolean;
115
- color?: string;
116
- }
117
- interface Filter {
118
- name: string;
119
- label: string;
120
- options: FilterOption[];
121
- }
122
- interface FilterBarData {
123
- filters: Filter[];
124
- actions?: Array<{
125
- label: string;
126
- className?: string;
127
- onclick?: string;
128
- hxGet?: string;
129
- hxTarget?: string;
130
- }>;
131
- bulkActions?: Array<{
132
- label: string;
133
- value: string;
134
- icon?: string;
135
- className?: string;
136
- }>;
137
- }
138
- declare function renderFilterBar(data: FilterBarData): string;
139
-
140
- export { type AlertData, type ConfirmationDialogOptions, type Filter, type FilterBarData, type FilterOption, type FormData, type FormField, type PaginationData, type TableColumn, type TableData, getConfirmationDialogScript, renderAlert, renderConfirmationDialog, renderFilterBar, renderForm, renderFormField, renderPagination, renderTable };
package/dist/types.d.cts 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.cjs';
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.cjs';
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 };