@sonicjs-cms/core 2.0.10 → 2.0.12

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 (87) hide show
  1. package/README.md +75 -1
  2. package/dist/chunk-22EFGHAX.cjs +801 -0
  3. package/dist/chunk-22EFGHAX.cjs.map +1 -0
  4. package/dist/{chunk-3PHG75W4.cjs → chunk-2HRF65VF.cjs} +9 -5
  5. package/dist/chunk-2HRF65VF.cjs.map +1 -0
  6. package/dist/{chunk-DOR2IU73.cjs → chunk-3F4LF7LW.cjs} +249 -2
  7. package/dist/chunk-3F4LF7LW.cjs.map +1 -0
  8. package/dist/chunk-3OKKNBPD.cjs +70 -0
  9. package/dist/chunk-3OKKNBPD.cjs.map +1 -0
  10. package/dist/{chunk-LW33AOBF.js → chunk-5RKQB2JG.js} +6 -222
  11. package/dist/chunk-5RKQB2JG.js.map +1 -0
  12. package/dist/{chunk-Z4H6DBVF.js → chunk-6B4ENDQM.js} +12006 -10745
  13. package/dist/chunk-6B4ENDQM.js.map +1 -0
  14. package/dist/chunk-AUVW4I3D.js +1550 -0
  15. package/dist/chunk-AUVW4I3D.js.map +1 -0
  16. package/dist/{chunk-HKEK7UNV.js → chunk-CPXAVWCU.js} +3 -3
  17. package/dist/{chunk-HKEK7UNV.js.map → chunk-CPXAVWCU.js.map} +1 -1
  18. package/dist/{chunk-MXJJN4IA.js → chunk-DSDHGJ4F.js} +9 -5
  19. package/dist/chunk-DSDHGJ4F.js.map +1 -0
  20. package/dist/{chunk-F5ESJXI2.cjs → chunk-DTLB6UIH.cjs} +3 -3
  21. package/dist/{chunk-F5ESJXI2.cjs.map → chunk-DTLB6UIH.cjs.map} +1 -1
  22. package/dist/{chunk-HXA5QSI3.cjs → chunk-F4IGVB2V.cjs} +22 -6
  23. package/dist/chunk-F4IGVB2V.cjs.map +1 -0
  24. package/dist/{chunk-Q7SL7U43.cjs → chunk-K5WUGEXH.cjs} +12014 -10752
  25. package/dist/chunk-K5WUGEXH.cjs.map +1 -0
  26. package/dist/{chunk-YHG45LMU.js → chunk-LBSKQKYL.js} +20 -4
  27. package/dist/chunk-LBSKQKYL.js.map +1 -0
  28. package/dist/chunk-LWMMMW43.js +787 -0
  29. package/dist/chunk-LWMMMW43.js.map +1 -0
  30. package/dist/{chunk-6FR25MPC.js → chunk-M2YDOOBC.js} +246 -3
  31. package/dist/chunk-M2YDOOBC.js.map +1 -0
  32. package/dist/{chunk-FTMKKKNH.js → chunk-QNWYQZ55.js} +3 -3
  33. package/dist/{chunk-FTMKKKNH.js.map → chunk-QNWYQZ55.js.map} +1 -1
  34. package/dist/chunk-RDJ2QLA2.cjs +1552 -0
  35. package/dist/chunk-RDJ2QLA2.cjs.map +1 -0
  36. package/dist/chunk-RKNHW6QU.js +61 -0
  37. package/dist/chunk-RKNHW6QU.js.map +1 -0
  38. package/dist/{chunk-MU3MR2QR.cjs → chunk-YU6QFFI4.cjs} +5 -222
  39. package/dist/chunk-YU6QFFI4.cjs.map +1 -0
  40. package/dist/{chunk-CAP6QQR2.cjs → chunk-ZMSYKV62.cjs} +5 -5
  41. package/dist/{chunk-CAP6QQR2.cjs.map → chunk-ZMSYKV62.cjs.map} +1 -1
  42. package/dist/index.cjs +527 -154
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.js +390 -13
  45. package/dist/index.js.map +1 -1
  46. package/dist/middleware.cjs +24 -23
  47. package/dist/middleware.js +3 -2
  48. package/dist/migrations-DURR3GZX.js +4 -0
  49. package/dist/migrations-DURR3GZX.js.map +1 -0
  50. package/dist/migrations-P5BD7WQK.cjs +13 -0
  51. package/dist/migrations-P5BD7WQK.cjs.map +1 -0
  52. package/dist/plugins.cjs +7 -7
  53. package/dist/plugins.js +1 -1
  54. package/dist/routes.cjs +31 -29
  55. package/dist/routes.js +8 -6
  56. package/dist/services.cjs +42 -24
  57. package/dist/services.js +4 -2
  58. package/dist/templates.cjs +17 -21
  59. package/dist/templates.js +2 -2
  60. package/dist/utils.cjs +44 -11
  61. package/dist/utils.js +2 -1
  62. package/migrations/001_initial_schema.sql +2 -2
  63. package/migrations/007_demo_login_plugin.sql +1 -1
  64. package/migrations/020_add_email_plugin.sql +22 -0
  65. package/migrations/021_add_magic_link_auth_plugin.sql +42 -0
  66. package/migrations/022_add_tinymce_plugin.sql +25 -0
  67. package/migrations/023_add_easy_mdx_plugin.sql +25 -0
  68. package/migrations/024_add_quill_editor_plugin.sql +25 -0
  69. package/migrations/025_rename_mdxeditor_to_easy_mdx.sql +22 -0
  70. package/migrations/026_add_otp_login.sql +42 -0
  71. package/package.json +7 -3
  72. package/dist/chunk-3PHG75W4.cjs.map +0 -1
  73. package/dist/chunk-6FR25MPC.js.map +0 -1
  74. package/dist/chunk-COBUPOMD.js +0 -1511
  75. package/dist/chunk-COBUPOMD.js.map +0 -1
  76. package/dist/chunk-DOR2IU73.cjs.map +0 -1
  77. package/dist/chunk-HXA5QSI3.cjs.map +0 -1
  78. package/dist/chunk-LW33AOBF.js.map +0 -1
  79. package/dist/chunk-MU3MR2QR.cjs.map +0 -1
  80. package/dist/chunk-MXJJN4IA.js.map +0 -1
  81. package/dist/chunk-NBDPIRQS.cjs +0 -1526
  82. package/dist/chunk-NBDPIRQS.cjs.map +0 -1
  83. package/dist/chunk-Q7SL7U43.cjs.map +0 -1
  84. package/dist/chunk-YHG45LMU.js.map +0 -1
  85. package/dist/chunk-Z4H6DBVF.js.map +0 -1
  86. package/migrations/002_faq_plugin.sql +0 -86
  87. package/migrations/013_code_examples_plugin.sql +0 -177
@@ -1,86 +0,0 @@
1
- -- FAQ Plugin Migration (DEPRECATED - Now managed by third-party plugin)
2
- -- Creates FAQ table for the FAQ plugin
3
- -- NOTE: This migration is kept for historical purposes.
4
- -- The FAQ functionality is now provided by the faq-plugin third-party plugin.
5
-
6
- CREATE TABLE IF NOT EXISTS faqs (
7
- id INTEGER PRIMARY KEY AUTOINCREMENT,
8
- question TEXT NOT NULL,
9
- answer TEXT NOT NULL,
10
- category TEXT,
11
- tags TEXT,
12
- isPublished INTEGER NOT NULL DEFAULT 1,
13
- sortOrder INTEGER NOT NULL DEFAULT 0,
14
- created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
15
- updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
16
- );
17
-
18
- -- Create indexes for better performance
19
- CREATE INDEX IF NOT EXISTS idx_faqs_category ON faqs(category);
20
- CREATE INDEX IF NOT EXISTS idx_faqs_published ON faqs(isPublished);
21
- CREATE INDEX IF NOT EXISTS idx_faqs_sort_order ON faqs(sortOrder);
22
-
23
- -- Create trigger to update updated_at timestamp
24
- CREATE TRIGGER IF NOT EXISTS faqs_updated_at
25
- AFTER UPDATE ON faqs
26
- BEGIN
27
- UPDATE faqs SET updated_at = strftime('%s', 'now') WHERE id = NEW.id;
28
- END;
29
-
30
- -- Insert sample FAQ data
31
- INSERT OR IGNORE INTO faqs (question, answer, category, tags, isPublished, sortOrder) VALUES
32
- ('What is SonicJS AI?',
33
- 'SonicJS AI is a modern, TypeScript-first headless CMS built for Cloudflare''s edge platform. It provides a complete content management system with admin interface, API endpoints, and plugin architecture.',
34
- 'general',
35
- 'sonicjs, cms, cloudflare',
36
- 1,
37
- 1),
38
-
39
- ('How do I get started with SonicJS AI?',
40
- 'To get started: 1) Clone the repository, 2) Install dependencies with npm install, 3) Set up your Cloudflare account and services, 4) Run the development server with npm run dev, 5) Access the admin interface at /admin.',
41
- 'general',
42
- 'getting-started, setup',
43
- 1,
44
- 2),
45
-
46
- ('What technologies does SonicJS AI use?',
47
- 'SonicJS AI is built with: TypeScript for type safety, Hono.js as the web framework, Cloudflare D1 for the database, Cloudflare R2 for media storage, Cloudflare Workers for serverless execution, and Tailwind CSS for styling.',
48
- 'technical',
49
- 'technology-stack, typescript, cloudflare',
50
- 1,
51
- 3),
52
-
53
- ('How do I create content in SonicJS AI?',
54
- 'Content creation is done through the admin interface. Navigate to /admin, log in with your credentials, go to Content section, select a collection, and click "New Content" to create articles, pages, or other content types.',
55
- 'general',
56
- 'content-creation, admin',
57
- 1,
58
- 4),
59
-
60
- ('Is SonicJS AI free to use?',
61
- 'SonicJS AI is open source and free to use. You only pay for the Cloudflare services you consume (D1 database, R2 storage, Workers execution time). Cloudflare offers generous free tiers for development and small projects.',
62
- 'billing',
63
- 'pricing, open-source, cloudflare',
64
- 1,
65
- 5),
66
-
67
- ('How do I add custom functionality?',
68
- 'SonicJS AI features a plugin system that allows you to extend functionality. You can create plugins using the PluginBuilder API, add custom routes, models, admin pages, and integrate with external services.',
69
- 'technical',
70
- 'plugins, customization, development',
71
- 1,
72
- 6),
73
-
74
- ('Can I customize the admin interface?',
75
- 'Yes! The admin interface is built with TypeScript templates and can be customized. You can modify existing templates, create new components, add custom pages, and integrate your own styling while maintaining the dark theme.',
76
- 'technical',
77
- 'admin-interface, customization, templates',
78
- 1,
79
- 7),
80
-
81
- ('How does authentication work?',
82
- 'SonicJS AI includes a built-in authentication system with JWT tokens, role-based access control (admin, editor, viewer), secure password hashing, and session management. Users can be managed through the admin interface.',
83
- 'technical',
84
- 'authentication, security, users',
85
- 1,
86
- 8);
@@ -1,177 +0,0 @@
1
- -- Code Examples Plugin Migration
2
- -- Creates code_examples table for the code examples plugin
3
- -- This demonstrates a code-based collection for storing and managing code snippets
4
-
5
- CREATE TABLE IF NOT EXISTS code_examples (
6
- id INTEGER PRIMARY KEY AUTOINCREMENT,
7
- title TEXT NOT NULL,
8
- description TEXT,
9
- code TEXT NOT NULL,
10
- language TEXT NOT NULL,
11
- category TEXT,
12
- tags TEXT,
13
- isPublished INTEGER NOT NULL DEFAULT 1,
14
- sortOrder INTEGER NOT NULL DEFAULT 0,
15
- created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
16
- updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
17
- );
18
-
19
- -- Create indexes for better performance
20
- CREATE INDEX IF NOT EXISTS idx_code_examples_published ON code_examples(isPublished);
21
- CREATE INDEX IF NOT EXISTS idx_code_examples_sort_order ON code_examples(sortOrder);
22
- CREATE INDEX IF NOT EXISTS idx_code_examples_language ON code_examples(language);
23
- CREATE INDEX IF NOT EXISTS idx_code_examples_category ON code_examples(category);
24
-
25
- -- Create trigger to update updated_at timestamp
26
- CREATE TRIGGER IF NOT EXISTS code_examples_updated_at
27
- AFTER UPDATE ON code_examples
28
- BEGIN
29
- UPDATE code_examples SET updated_at = strftime('%s', 'now') WHERE id = NEW.id;
30
- END;
31
-
32
- -- Insert plugin record
33
- INSERT OR IGNORE INTO plugins (name, display_name, description, version, status, category, settings) VALUES
34
- ('code-examples',
35
- 'Code Examples',
36
- 'Manage code snippets and examples with syntax highlighting support. Perfect for documentation and tutorials.',
37
- '1.0.0',
38
- 'active',
39
- 'content',
40
- '{"defaultPublished": true, "supportedLanguages": ["javascript", "typescript", "python", "go", "rust", "java", "php", "ruby", "sql"]}');
41
-
42
- -- Insert sample code examples
43
- INSERT OR IGNORE INTO code_examples (title, description, code, language, category, tags, isPublished, sortOrder) VALUES
44
- ('React useState Hook',
45
- 'Basic example of using the useState hook in React for managing component state.',
46
- 'import { useState } from ''react'';
47
-
48
- function Counter() {
49
- const [count, setCount] = useState(0);
50
-
51
- return (
52
- <div>
53
- <p>Count: {count}</p>
54
- <button onClick={() => setCount(count + 1)}>
55
- Increment
56
- </button>
57
- </div>
58
- );
59
- }
60
-
61
- export default Counter;',
62
- 'javascript',
63
- 'frontend',
64
- 'react,hooks,state',
65
- 1,
66
- 1),
67
-
68
- ('TypeScript Interface Example',
69
- 'Defining a TypeScript interface for type-safe objects.',
70
- 'interface User {
71
- id: string;
72
- email: string;
73
- name: string;
74
- role: ''admin'' | ''editor'' | ''viewer'';
75
- createdAt: Date;
76
- }
77
-
78
- function greetUser(user: User): string {
79
- return `Hello, ${user.name}!`;
80
- }
81
-
82
- const user: User = {
83
- id: ''123'',
84
- email: ''user@example.com'',
85
- name: ''John Doe'',
86
- role: ''admin'',
87
- createdAt: new Date()
88
- };
89
-
90
- console.log(greetUser(user));',
91
- 'typescript',
92
- 'backend',
93
- 'typescript,types,interface',
94
- 1,
95
- 2),
96
-
97
- ('Python List Comprehension',
98
- 'Elegant way to create lists in Python using list comprehensions.',
99
- '# Basic list comprehension
100
- squares = [x**2 for x in range(10)]
101
- print(squares) # [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
102
-
103
- # With condition
104
- even_squares = [x**2 for x in range(10) if x % 2 == 0]
105
- print(even_squares) # [0, 4, 16, 36, 64]
106
-
107
- # Nested list comprehension
108
- matrix = [[i+j for j in range(3)] for i in range(3)]
109
- print(matrix) # [[0, 1, 2], [1, 2, 3], [2, 3, 4]]',
110
- 'python',
111
- 'general',
112
- 'python,lists,comprehension',
113
- 1,
114
- 3),
115
-
116
- ('SQL Join Example',
117
- 'Common SQL JOIN patterns for combining data from multiple tables.',
118
- '-- INNER JOIN: Returns only matching rows
119
- SELECT users.name, orders.total
120
- FROM users
121
- INNER JOIN orders ON users.id = orders.user_id;
122
-
123
- -- LEFT JOIN: Returns all users, even without orders
124
- SELECT users.name, orders.total
125
- FROM users
126
- LEFT JOIN orders ON users.id = orders.user_id;
127
-
128
- -- Multiple JOINs
129
- SELECT
130
- users.name,
131
- orders.order_date,
132
- products.name AS product_name
133
- FROM users
134
- INNER JOIN orders ON users.id = orders.user_id
135
- INNER JOIN order_items ON orders.id = order_items.order_id
136
- INNER JOIN products ON order_items.product_id = products.id;',
137
- 'sql',
138
- 'database',
139
- 'sql,joins,queries',
140
- 1,
141
- 4),
142
-
143
- ('Go Error Handling',
144
- 'Idiomatic error handling pattern in Go.',
145
- 'package main
146
-
147
- import (
148
- "errors"
149
- "fmt"
150
- )
151
-
152
- func divide(a, b float64) (float64, error) {
153
- if b == 0 {
154
- return 0, errors.New("division by zero")
155
- }
156
- return a / b, nil
157
- }
158
-
159
- func main() {
160
- result, err := divide(10, 2)
161
- if err != nil {
162
- fmt.Println("Error:", err)
163
- return
164
- }
165
- fmt.Printf("Result: %.2f\n", result)
166
-
167
- // This will error
168
- _, err = divide(10, 0)
169
- if err != nil {
170
- fmt.Println("Error:", err)
171
- }
172
- }',
173
- 'go',
174
- 'backend',
175
- 'go,error-handling,functions',
176
- 1,
177
- 5);