@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
@@ -0,0 +1,89 @@
1
+ -- Add Remaining Plugins
2
+ -- Migration: 015_add_remaining_plugins
3
+ -- Description: Add all remaining core plugins that were missing from the registry
4
+
5
+ -- Testimonials Plugin (with correct name)
6
+ INSERT OR IGNORE INTO plugins (
7
+ id, name, display_name, description, version, author, category, icon,
8
+ status, is_core, permissions, dependencies, settings, installed_at, last_updated
9
+ ) VALUES (
10
+ 'testimonials-plugin',
11
+ 'testimonials-plugin',
12
+ 'Customer Testimonials',
13
+ 'Manage customer testimonials and reviews with rating support',
14
+ '1.0.0',
15
+ 'SonicJS',
16
+ 'content',
17
+ '⭐',
18
+ 'active',
19
+ FALSE,
20
+ '["manage:testimonials"]',
21
+ '[]',
22
+ '{"defaultPublished": true, "requireRating": false}',
23
+ unixepoch(),
24
+ unixepoch()
25
+ );
26
+
27
+ -- Code Examples Plugin (with correct name)
28
+ INSERT OR IGNORE INTO plugins (
29
+ id, name, display_name, description, version, author, category, icon,
30
+ status, is_core, permissions, dependencies, settings, installed_at, last_updated
31
+ ) VALUES (
32
+ 'code-examples-plugin',
33
+ 'code-examples-plugin',
34
+ 'Code Examples',
35
+ 'Manage code snippets and examples with syntax highlighting support',
36
+ '1.0.0',
37
+ 'SonicJS',
38
+ 'content',
39
+ '💻',
40
+ 'active',
41
+ FALSE,
42
+ '["manage:code-examples"]',
43
+ '[]',
44
+ '{"defaultPublished": true, "supportedLanguages": ["javascript", "typescript", "python", "go", "rust", "java", "php", "ruby", "sql"]}',
45
+ unixepoch(),
46
+ unixepoch()
47
+ );
48
+
49
+ -- Workflow Plugin (with correct name)
50
+ INSERT OR IGNORE INTO plugins (
51
+ id, name, display_name, description, version, author, category, icon,
52
+ status, is_core, permissions, dependencies, installed_at, last_updated
53
+ ) VALUES (
54
+ 'workflow-plugin',
55
+ 'workflow-plugin',
56
+ 'Workflow Engine',
57
+ 'Content workflow management with approval chains, scheduling, and automation',
58
+ '1.0.0',
59
+ 'SonicJS Team',
60
+ 'content',
61
+ '🔄',
62
+ 'active',
63
+ TRUE,
64
+ '["manage:workflows", "approve:content"]',
65
+ '[]',
66
+ unixepoch(),
67
+ unixepoch()
68
+ );
69
+
70
+ -- Demo Login Plugin (already exists with correct name from migration 007, but let's ensure it's there)
71
+ INSERT OR IGNORE INTO plugins (
72
+ id, name, display_name, description, version, author, category, icon,
73
+ status, is_core, permissions, dependencies, installed_at, last_updated
74
+ ) VALUES (
75
+ 'demo-login-plugin',
76
+ 'demo-login-plugin',
77
+ 'Demo Login Prefill',
78
+ 'Prefills login form with demo credentials for easy site demonstration',
79
+ '1.0.0',
80
+ 'SonicJS',
81
+ 'demo',
82
+ '🎯',
83
+ 'active',
84
+ FALSE,
85
+ '[]',
86
+ '[]',
87
+ unixepoch(),
88
+ unixepoch()
89
+ );
@@ -0,0 +1,17 @@
1
+ -- Migration: Remove duplicate cache plugin entry
2
+ -- Description: Removes the old 'cache' plugin (id: 'cache') that is a duplicate of 'core-cache'
3
+ -- This fixes the issue where Cache System appears twice in the plugins list
4
+ -- Created: 2025-10-14
5
+
6
+ -- Remove the old 'cache' plugin entry if it exists
7
+ -- The correct plugin is 'core-cache' which is managed by plugin-bootstrap.ts
8
+ DELETE FROM plugins WHERE id = 'cache' AND name = 'cache';
9
+
10
+ -- Clean up any related entries in plugin activity log
11
+ DELETE FROM plugin_activity_log WHERE plugin_id = 'cache';
12
+
13
+ -- Clean up any related entries in plugin hooks
14
+ DELETE FROM plugin_hooks WHERE plugin_id = 'cache';
15
+
16
+ -- Clean up any related entries in plugin routes
17
+ DELETE FROM plugin_routes WHERE plugin_id = 'cache';
@@ -0,0 +1,49 @@
1
+ -- Migration: Make authentication fields configurable
2
+ -- This migration updates the core-auth plugin to support configurable required fields
3
+
4
+ -- The settings will be stored in the plugins table as JSON
5
+ -- Default settings for core-auth plugin include:
6
+ -- {
7
+ -- "requiredFields": {
8
+ -- "email": { "required": true, "minLength": 5 },
9
+ -- "password": { "required": true, "minLength": 8 },
10
+ -- "username": { "required": true, "minLength": 3 },
11
+ -- "firstName": { "required": true, "minLength": 1 },
12
+ -- "lastName": { "required": true, "minLength": 1 }
13
+ -- },
14
+ -- "validation": {
15
+ -- "emailFormat": true,
16
+ -- "allowDuplicateUsernames": false
17
+ -- }
18
+ -- }
19
+
20
+ -- Update core-auth plugin settings with configurable field requirements
21
+ UPDATE plugins
22
+ SET settings = json_object(
23
+ 'requiredFields', json_object(
24
+ 'email', json_object('required', 1, 'minLength', 5, 'label', 'Email', 'type', 'email'),
25
+ 'password', json_object('required', 1, 'minLength', 8, 'label', 'Password', 'type', 'password'),
26
+ 'username', json_object('required', 1, 'minLength', 3, 'label', 'Username', 'type', 'text'),
27
+ 'firstName', json_object('required', 1, 'minLength', 1, 'label', 'First Name', 'type', 'text'),
28
+ 'lastName', json_object('required', 1, 'minLength', 1, 'label', 'Last Name', 'type', 'text')
29
+ ),
30
+ 'validation', json_object(
31
+ 'emailFormat', 1,
32
+ 'allowDuplicateUsernames', 0,
33
+ 'passwordRequirements', json_object(
34
+ 'requireUppercase', 0,
35
+ 'requireLowercase', 0,
36
+ 'requireNumbers', 0,
37
+ 'requireSpecialChars', 0
38
+ )
39
+ ),
40
+ 'registration', json_object(
41
+ 'enabled', 1,
42
+ 'requireEmailVerification', 0,
43
+ 'defaultRole', 'viewer'
44
+ )
45
+ )
46
+ WHERE id = 'core-auth';
47
+
48
+ -- If core-auth plugin doesn't exist, this migration will be handled by bootstrap
49
+ -- No need to insert here as plugin bootstrap handles initial plugin creation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonicjs-cms/core",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.4",
4
4
  "description": "Core framework for SonicJS headless CMS - Edge-first, TypeScript-native CMS built for Cloudflare Workers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,3 +0,0 @@
1
-
2
- //# sourceMappingURL=chunk-4URGXJP7.js.map
3
- //# sourceMappingURL=chunk-4URGXJP7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-4URGXJP7.js"}
@@ -1,4 +0,0 @@
1
- 'use strict';
2
-
3
- //# sourceMappingURL=chunk-ALTMI5Y2.cjs.map
4
- //# sourceMappingURL=chunk-ALTMI5Y2.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-ALTMI5Y2.cjs"}
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- // src/routes/index.ts
4
- var ROUTES_INFO = {
5
- message: "Routes are application-specific - implement in your application",
6
- reference: "https://github.com/sonicjs/sonicjs"
7
- };
8
-
9
- exports.ROUTES_INFO = ROUTES_INFO;
10
- //# sourceMappingURL=chunk-BOLQHE4J.cjs.map
11
- //# sourceMappingURL=chunk-BOLQHE4J.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/index.ts"],"names":[],"mappings":";;;AAYO,IAAM,WAAA,GAAc;AAAA,EACzB,OAAA,EAAS,iEAAA;AAAA,EACT,SAAA,EAAW;AACb","file":"chunk-BOLQHE4J.cjs","sourcesContent":["/**\n * Routes Module Exports\n *\n * Note: HTTP routes are application-specific and should be implemented\n * in the consuming application rather than in the core package.\n *\n * The core package provides the building blocks (middleware, services, types)\n * but each application should define its own routes based on its specific needs.\n *\n * For reference implementations, see the main SonicJS repository.\n */\n\nexport const ROUTES_INFO = {\n message: 'Routes are application-specific - implement in your application',\n reference: 'https://github.com/sonicjs/sonicjs'\n} as const\n"]}
@@ -1,9 +0,0 @@
1
- // src/routes/index.ts
2
- var ROUTES_INFO = {
3
- message: "Routes are application-specific - implement in your application",
4
- reference: "https://github.com/sonicjs/sonicjs"
5
- };
6
-
7
- export { ROUTES_INFO };
8
- //# sourceMappingURL=chunk-HD7R6T6I.js.map
9
- //# sourceMappingURL=chunk-HD7R6T6I.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/index.ts"],"names":[],"mappings":";AAYO,IAAM,WAAA,GAAc;AAAA,EACzB,OAAA,EAAS,iEAAA;AAAA,EACT,SAAA,EAAW;AACb","file":"chunk-HD7R6T6I.js","sourcesContent":["/**\n * Routes Module Exports\n *\n * Note: HTTP routes are application-specific and should be implemented\n * in the consuming application rather than in the core package.\n *\n * The core package provides the building blocks (middleware, services, types)\n * but each application should define its own routes based on its specific needs.\n *\n * For reference implementations, see the main SonicJS repository.\n */\n\nexport const ROUTES_INFO = {\n message: 'Routes are application-specific - implement in your application',\n reference: 'https://github.com/sonicjs/sonicjs'\n} as const\n"]}
@@ -1,107 +0,0 @@
1
- /**
2
- * Collection Configuration Types
3
- *
4
- * These types define the structure for collection configuration files.
5
- * Collections can be defined in TypeScript/JSON files and synced to the database.
6
- */
7
- type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'email' | 'url' | 'richtext' | 'markdown' | 'json' | 'array' | 'object' | 'reference' | 'media' | 'select' | 'multiselect' | 'checkbox' | 'radio' | 'textarea' | 'slug' | 'color' | 'file';
8
- interface FieldConfig {
9
- type: FieldType;
10
- title?: string;
11
- description?: string;
12
- required?: boolean;
13
- default?: any;
14
- placeholder?: string;
15
- helpText?: string;
16
- min?: number;
17
- max?: number;
18
- minLength?: number;
19
- maxLength?: number;
20
- pattern?: string;
21
- enum?: string[];
22
- enumLabels?: string[];
23
- collection?: string;
24
- items?: FieldConfig;
25
- properties?: Record<string, FieldConfig>;
26
- format?: string;
27
- widget?: string;
28
- dependsOn?: string;
29
- showWhen?: any;
30
- }
31
- interface CollectionSchema {
32
- type: 'object';
33
- properties: Record<string, FieldConfig>;
34
- required?: string[];
35
- }
36
- interface CollectionConfig {
37
- /**
38
- * Unique machine name for the collection (lowercase, underscores)
39
- * e.g., 'blog_posts', 'products', 'team_members'
40
- */
41
- name: string;
42
- /**
43
- * Human-readable display name
44
- * e.g., 'Blog Posts', 'Products', 'Team Members'
45
- */
46
- displayName: string;
47
- /**
48
- * Optional description of the collection
49
- */
50
- description?: string;
51
- /**
52
- * JSON schema definition for the collection's content structure
53
- */
54
- schema: CollectionSchema;
55
- /**
56
- * If true, this collection is managed by config files and cannot be edited in the UI
57
- * Default: true for config-based collections
58
- */
59
- managed?: boolean;
60
- /**
61
- * If true, the collection is active and available for use
62
- * Default: true
63
- */
64
- isActive?: boolean;
65
- /**
66
- * Optional icon name for the collection (used in admin UI)
67
- */
68
- icon?: string;
69
- /**
70
- * Optional color for the collection (hex code)
71
- */
72
- color?: string;
73
- /**
74
- * Optional default sort field
75
- */
76
- defaultSort?: string;
77
- /**
78
- * Optional default sort order
79
- */
80
- defaultSortOrder?: 'asc' | 'desc';
81
- /**
82
- * Optional fields to show in list view
83
- */
84
- listFields?: string[];
85
- /**
86
- * Optional search fields
87
- */
88
- searchFields?: string[];
89
- /**
90
- * Optional metadata
91
- */
92
- metadata?: Record<string, any>;
93
- }
94
- interface CollectionConfigModule {
95
- default: CollectionConfig;
96
- }
97
- /**
98
- * Result of syncing a collection
99
- */
100
- interface CollectionSyncResult {
101
- name: string;
102
- status: 'created' | 'updated' | 'unchanged' | 'error';
103
- message?: string;
104
- error?: string;
105
- }
106
-
107
- export type { CollectionSchema as C, FieldType as F, FieldConfig as a, CollectionConfig as b, CollectionConfigModule as c, CollectionSyncResult as d };
@@ -1,107 +0,0 @@
1
- /**
2
- * Collection Configuration Types
3
- *
4
- * These types define the structure for collection configuration files.
5
- * Collections can be defined in TypeScript/JSON files and synced to the database.
6
- */
7
- type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'email' | 'url' | 'richtext' | 'markdown' | 'json' | 'array' | 'object' | 'reference' | 'media' | 'select' | 'multiselect' | 'checkbox' | 'radio' | 'textarea' | 'slug' | 'color' | 'file';
8
- interface FieldConfig {
9
- type: FieldType;
10
- title?: string;
11
- description?: string;
12
- required?: boolean;
13
- default?: any;
14
- placeholder?: string;
15
- helpText?: string;
16
- min?: number;
17
- max?: number;
18
- minLength?: number;
19
- maxLength?: number;
20
- pattern?: string;
21
- enum?: string[];
22
- enumLabels?: string[];
23
- collection?: string;
24
- items?: FieldConfig;
25
- properties?: Record<string, FieldConfig>;
26
- format?: string;
27
- widget?: string;
28
- dependsOn?: string;
29
- showWhen?: any;
30
- }
31
- interface CollectionSchema {
32
- type: 'object';
33
- properties: Record<string, FieldConfig>;
34
- required?: string[];
35
- }
36
- interface CollectionConfig {
37
- /**
38
- * Unique machine name for the collection (lowercase, underscores)
39
- * e.g., 'blog_posts', 'products', 'team_members'
40
- */
41
- name: string;
42
- /**
43
- * Human-readable display name
44
- * e.g., 'Blog Posts', 'Products', 'Team Members'
45
- */
46
- displayName: string;
47
- /**
48
- * Optional description of the collection
49
- */
50
- description?: string;
51
- /**
52
- * JSON schema definition for the collection's content structure
53
- */
54
- schema: CollectionSchema;
55
- /**
56
- * If true, this collection is managed by config files and cannot be edited in the UI
57
- * Default: true for config-based collections
58
- */
59
- managed?: boolean;
60
- /**
61
- * If true, the collection is active and available for use
62
- * Default: true
63
- */
64
- isActive?: boolean;
65
- /**
66
- * Optional icon name for the collection (used in admin UI)
67
- */
68
- icon?: string;
69
- /**
70
- * Optional color for the collection (hex code)
71
- */
72
- color?: string;
73
- /**
74
- * Optional default sort field
75
- */
76
- defaultSort?: string;
77
- /**
78
- * Optional default sort order
79
- */
80
- defaultSortOrder?: 'asc' | 'desc';
81
- /**
82
- * Optional fields to show in list view
83
- */
84
- listFields?: string[];
85
- /**
86
- * Optional search fields
87
- */
88
- searchFields?: string[];
89
- /**
90
- * Optional metadata
91
- */
92
- metadata?: Record<string, any>;
93
- }
94
- interface CollectionConfigModule {
95
- default: CollectionConfig;
96
- }
97
- /**
98
- * Result of syncing a collection
99
- */
100
- interface CollectionSyncResult {
101
- name: string;
102
- status: 'created' | 'updated' | 'unchanged' | 'error';
103
- message?: string;
104
- error?: string;
105
- }
106
-
107
- export type { CollectionSchema as C, FieldType as F, FieldConfig as a, CollectionConfig as b, CollectionConfigModule as c, CollectionSyncResult as d };