@sonicjs-cms/core 2.19.0 → 3.0.0-beta.10
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/README.md +52 -52
- package/dist/admin-documents-form.template-DDSH6ROU.js +6 -0
- package/dist/{admin-layout-catalyst.template-UMTIN66R.js.map → admin-documents-form.template-DDSH6ROU.js.map} +1 -1
- package/dist/admin-documents-form.template-LSZKGA5J.cjs +19 -0
- package/dist/{admin-layout-catalyst.template-HFD37TY5.cjs.map → admin-documents-form.template-LSZKGA5J.cjs.map} +1 -1
- package/dist/{filter-bar.template-DlVYMk-T.d.cts → admin-layout-catalyst.template-DrwDUfsE.d.cts} +25 -1
- package/dist/{filter-bar.template-DlVYMk-T.d.ts → admin-layout-catalyst.template-DrwDUfsE.d.ts} +25 -1
- package/dist/admin-layout-catalyst.template-KDHKVLXR.cjs +21 -0
- package/dist/admin-layout-catalyst.template-KDHKVLXR.cjs.map +1 -0
- package/dist/admin-layout-catalyst.template-YQ4EMF2J.js +7 -0
- package/dist/admin-layout-catalyst.template-YQ4EMF2J.js.map +1 -0
- package/dist/app-Bo0X1OWX.d.ts +1268 -0
- package/dist/app-Do66yCcV.d.cts +1268 -0
- package/dist/cache-DDARE4QE.js +4 -0
- package/dist/cache-DDARE4QE.js.map +1 -0
- package/dist/cache-LVYS4BPL.cjs +33 -0
- package/dist/cache-LVYS4BPL.cjs.map +1 -0
- package/dist/chunk-2CB4KY7I.cjs +771 -0
- package/dist/chunk-2CB4KY7I.cjs.map +1 -0
- package/dist/{chunk-ABB34XUS.cjs → chunk-3KYKEXV7.cjs} +667 -19
- package/dist/chunk-3KYKEXV7.cjs.map +1 -0
- package/dist/chunk-4BTBSXMR.cjs +912 -0
- package/dist/chunk-4BTBSXMR.cjs.map +1 -0
- package/dist/{chunk-55RDMDOP.js → chunk-5V62WT6M.js} +181 -57
- package/dist/chunk-5V62WT6M.js.map +1 -0
- package/dist/{chunk-OCL3HMEG.js → chunk-6OC6MF3C.js} +7004 -9807
- package/dist/chunk-6OC6MF3C.js.map +1 -0
- package/dist/chunk-AI663NBO.js +821 -0
- package/dist/chunk-AI663NBO.js.map +1 -0
- package/dist/chunk-ALDRXTUO.js +273 -0
- package/dist/chunk-ALDRXTUO.js.map +1 -0
- package/dist/{chunk-TFNTM3OA.js → chunk-ATUPB6MN.js} +645 -15
- package/dist/chunk-ATUPB6MN.js.map +1 -0
- package/dist/chunk-BLMTL57B.js +767 -0
- package/dist/chunk-BLMTL57B.js.map +1 -0
- package/dist/{chunk-4ZSNJDLS.cjs → chunk-CRGUD4KC.cjs} +9 -9
- package/dist/chunk-CRGUD4KC.cjs.map +1 -0
- package/dist/chunk-F67UK75A.cjs +158 -0
- package/dist/chunk-F67UK75A.cjs.map +1 -0
- package/dist/chunk-GCDZZNIN.js +192 -0
- package/dist/chunk-GCDZZNIN.js.map +1 -0
- package/dist/chunk-HIKBY7MS.cjs +70 -0
- package/dist/chunk-HIKBY7MS.cjs.map +1 -0
- package/dist/{chunk-4NPCDK6B.js → chunk-IDCZBF35.js} +557 -90
- package/dist/chunk-IDCZBF35.js.map +1 -0
- package/dist/chunk-IESEVHXL.js +66 -0
- package/dist/chunk-IESEVHXL.js.map +1 -0
- package/dist/chunk-IGADDMXH.js +387 -0
- package/dist/chunk-IGADDMXH.js.map +1 -0
- package/dist/chunk-IHTXB7AT.cjs +276 -0
- package/dist/chunk-IHTXB7AT.cjs.map +1 -0
- package/dist/chunk-IVPRUGTY.js +242 -0
- package/dist/chunk-IVPRUGTY.js.map +1 -0
- package/dist/{chunk-JZVHLLSI.cjs → chunk-IXUHXTHW.cjs} +2 -151
- package/dist/chunk-IXUHXTHW.cjs.map +1 -0
- package/dist/chunk-J6JTWD2A.cjs +100 -0
- package/dist/chunk-J6JTWD2A.cjs.map +1 -0
- package/dist/chunk-JEQ7FLOD.cjs +199 -0
- package/dist/chunk-JEQ7FLOD.cjs.map +1 -0
- package/dist/{chunk-ON5ZMSU4.js → chunk-JQISFW6U.js} +3 -3
- package/dist/chunk-JQISFW6U.js.map +1 -0
- package/dist/chunk-K25XHMM3.js +566 -0
- package/dist/chunk-K25XHMM3.js.map +1 -0
- package/dist/{chunk-UYJ6TJHX.cjs → chunk-K623Q6WD.cjs} +181 -56
- package/dist/chunk-K623Q6WD.cjs.map +1 -0
- package/dist/{chunk-7A4CB7T3.cjs → chunk-MUNO67TT.cjs} +561 -91
- package/dist/chunk-MUNO67TT.cjs.map +1 -0
- package/dist/chunk-N32OWET6.cjs +327 -0
- package/dist/chunk-N32OWET6.cjs.map +1 -0
- package/dist/chunk-NUKJ54GA.cjs +245 -0
- package/dist/chunk-NUKJ54GA.cjs.map +1 -0
- package/dist/{chunk-XWIA3HVX.js → chunk-OBA2RYZN.js} +6 -1249
- package/dist/chunk-OBA2RYZN.js.map +1 -0
- package/dist/chunk-PMGOBS6X.cjs +408 -0
- package/dist/chunk-PMGOBS6X.cjs.map +1 -0
- package/dist/{chunk-OHYBNCVL.cjs → chunk-PXNTCCPE.cjs} +10 -1256
- package/dist/chunk-PXNTCCPE.cjs.map +1 -0
- package/dist/chunk-PYVFXCSD.js +1828 -0
- package/dist/chunk-PYVFXCSD.js.map +1 -0
- package/dist/{chunk-BU7SFHGP.js → chunk-QZGABF2M.js} +3 -149
- package/dist/chunk-QZGABF2M.js.map +1 -0
- package/dist/{chunk-E4YFJBM2.cjs → chunk-R4ILO3W6.cjs} +876 -829
- package/dist/chunk-R4ILO3W6.cjs.map +1 -0
- package/dist/chunk-RMRJGMDE.js +323 -0
- package/dist/chunk-RMRJGMDE.js.map +1 -0
- package/dist/chunk-RNZFGN4R.js +88 -0
- package/dist/chunk-RNZFGN4R.js.map +1 -0
- package/dist/chunk-RQ6N3FTV.js +900 -0
- package/dist/chunk-RQ6N3FTV.js.map +1 -0
- package/dist/{chunk-R4FOLLFB.cjs → chunk-TO6EY4P7.cjs} +8730 -11520
- package/dist/chunk-TO6EY4P7.cjs.map +1 -0
- package/dist/chunk-V464XBYS.js +154 -0
- package/dist/chunk-V464XBYS.js.map +1 -0
- package/dist/chunk-YA3TJ65D.cjs +575 -0
- package/dist/chunk-YA3TJ65D.cjs.map +1 -0
- package/dist/chunk-YP7GW2G5.cjs +866 -0
- package/dist/chunk-YP7GW2G5.cjs.map +1 -0
- package/dist/{collection-config-B4PG-AaF.d.cts → collection-config-JgHOpFCG.d.cts} +30 -2
- package/dist/{collection-config-B4PG-AaF.d.ts → collection-config-JgHOpFCG.d.ts} +30 -2
- package/dist/config-HFXANXCC.js +6 -0
- package/dist/config-HFXANXCC.js.map +1 -0
- package/dist/config-ON6FNMYX.cjs +19 -0
- package/dist/config-ON6FNMYX.cjs.map +1 -0
- package/dist/define-plugin-BzNHc1ZI.d.ts +1321 -0
- package/dist/define-plugin-IWDKYaVm.d.cts +1321 -0
- package/dist/document-projection-TDWRJX3Z.cjs +13 -0
- package/dist/document-projection-TDWRJX3Z.cjs.map +1 -0
- package/dist/document-projection-YYMC6I4U.js +4 -0
- package/dist/document-projection-YYMC6I4U.js.map +1 -0
- package/dist/index.cjs +13736 -4326
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +331 -493
- package/dist/index.d.ts +331 -493
- package/dist/index.js +13455 -4067
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +38 -32
- package/dist/middleware.d.cts +50 -7
- package/dist/middleware.d.ts +50 -7
- package/dist/middleware.js +9 -3
- package/dist/migrations-2XHQEGOQ.cjs +13 -0
- package/dist/{migrations-566IIPS2.cjs.map → migrations-2XHQEGOQ.cjs.map} +1 -1
- package/dist/migrations-PE3CDVSM.js +4 -0
- package/dist/{migrations-H5IXZNCO.js.map → migrations-PE3CDVSM.js.map} +1 -1
- package/dist/{plugin-bootstrap-DfVerYV4.d.cts → plugin-bootstrap-B8ThJU21.d.cts} +4315 -1661
- package/dist/{plugin-bootstrap-P_ciLp_C.d.ts → plugin-bootstrap-qu8hJgUt.d.ts} +4315 -1661
- package/dist/plugins.cjs +171 -12
- package/dist/plugins.d.cts +36 -2
- package/dist/plugins.d.ts +36 -2
- package/dist/plugins.js +5 -2
- package/dist/rbac-O73MFKDA.js +5 -0
- package/dist/rbac-O73MFKDA.js.map +1 -0
- package/dist/rbac-VONLJJKB.cjs +14 -0
- package/dist/rbac-VONLJJKB.cjs.map +1 -0
- package/dist/routes.cjs +42 -46
- package/dist/routes.d.cts +56 -146
- package/dist/routes.d.ts +56 -146
- package/dist/routes.js +18 -10
- package/dist/services.cjs +43 -76
- package/dist/services.d.cts +93 -55
- package/dist/services.d.ts +93 -55
- package/dist/services.js +6 -3
- package/dist/{telemetry-B9vIV4wh.d.cts → telemetry-Cku1ax74.d.cts} +1 -1
- package/dist/{telemetry-B9vIV4wh.d.ts → telemetry-Cku1ax74.d.ts} +1 -1
- package/dist/templates.cjs +17 -29
- package/dist/templates.d.cts +2 -89
- package/dist/templates.d.ts +2 -89
- package/dist/templates.js +3 -3
- package/dist/types-Dea1eNxU.d.cts +286 -0
- package/dist/types-Dea1eNxU.d.ts +286 -0
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/utils.cjs +21 -20
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +3 -2
- package/migrations/0001_core.sql +184 -0
- package/migrations/0002_documents.sql +163 -0
- package/package.json +12 -7
- package/dist/admin-layout-catalyst.template-HFD37TY5.cjs +0 -17
- package/dist/admin-layout-catalyst.template-UMTIN66R.js +0 -7
- package/dist/app-C9esKLmh.d.cts +0 -112
- package/dist/app-C9esKLmh.d.ts +0 -112
- package/dist/chunk-4NPCDK6B.js.map +0 -1
- package/dist/chunk-4ZSNJDLS.cjs.map +0 -1
- package/dist/chunk-55RDMDOP.js.map +0 -1
- package/dist/chunk-635JAMSE.cjs +0 -653
- package/dist/chunk-635JAMSE.cjs.map +0 -1
- package/dist/chunk-7A4CB7T3.cjs.map +0 -1
- package/dist/chunk-ABB34XUS.cjs.map +0 -1
- package/dist/chunk-BU7SFHGP.js.map +0 -1
- package/dist/chunk-E4YFJBM2.cjs.map +0 -1
- package/dist/chunk-EXNEW5US.js +0 -648
- package/dist/chunk-EXNEW5US.js.map +0 -1
- package/dist/chunk-JZV22DEV.js +0 -1783
- package/dist/chunk-JZV22DEV.js.map +0 -1
- package/dist/chunk-JZVHLLSI.cjs.map +0 -1
- package/dist/chunk-OCL3HMEG.js.map +0 -1
- package/dist/chunk-OHYBNCVL.cjs.map +0 -1
- package/dist/chunk-ON5ZMSU4.js.map +0 -1
- package/dist/chunk-QFWHAFEO.js +0 -1843
- package/dist/chunk-QFWHAFEO.js.map +0 -1
- package/dist/chunk-R4FOLLFB.cjs.map +0 -1
- package/dist/chunk-RLMUFFUD.cjs +0 -2219
- package/dist/chunk-RLMUFFUD.cjs.map +0 -1
- package/dist/chunk-TFNTM3OA.js.map +0 -1
- package/dist/chunk-UYJ6TJHX.cjs.map +0 -1
- package/dist/chunk-WAEQXGCX.cjs +0 -1898
- package/dist/chunk-WAEQXGCX.cjs.map +0 -1
- package/dist/chunk-XWIA3HVX.js.map +0 -1
- package/dist/chunk-ZYAYUIZE.js +0 -2217
- package/dist/chunk-ZYAYUIZE.js.map +0 -1
- package/dist/migrations-566IIPS2.cjs +0 -13
- package/dist/migrations-H5IXZNCO.js +0 -4
- package/dist/plugin-manager-BoM3Q7o7.d.cts +0 -328
- package/dist/plugin-manager-Efx9RyDX.d.ts +0 -328
- package/migrations/001_initial_schema.sql +0 -170
- package/migrations/002_faq_plugin.sql +0 -86
- package/migrations/003_stage5_enhancements.sql +0 -121
- package/migrations/004_stage6_user_management.sql +0 -183
- package/migrations/005_stage7_workflow_automation.sql +0 -294
- package/migrations/006_plugin_system.sql +0 -155
- package/migrations/007_demo_login_plugin.sql +0 -23
- package/migrations/008_fix_slug_validation.sql +0 -22
- package/migrations/009_system_logging.sql +0 -57
- package/migrations/011_config_managed_collections.sql +0 -15
- package/migrations/012_testimonials_plugin.sql +0 -80
- package/migrations/013_code_examples_plugin.sql +0 -177
- package/migrations/014_fix_plugin_registry.sql +0 -88
- package/migrations/015_add_remaining_plugins.sql +0 -89
- package/migrations/016_remove_duplicate_cache_plugin.sql +0 -17
- package/migrations/017_auth_configurable_fields.sql +0 -49
- package/migrations/018_settings_table.sql +0 -23
- package/migrations/019_remove_blog_posts_collection.sql +0 -15
- package/migrations/020_add_email_plugin.sql +0 -22
- package/migrations/021_add_magic_link_auth_plugin.sql +0 -42
- package/migrations/022_add_tinymce_plugin.sql +0 -25
- package/migrations/023_add_easy_mdx_plugin.sql +0 -25
- package/migrations/024_add_quill_editor_plugin.sql +0 -25
- package/migrations/025_add_easymde_plugin.sql +0 -25
- package/migrations/026_add_otp_login.sql +0 -42
- package/migrations/027_fix_slug_field_type.sql +0 -18
- package/migrations/028_fix_slug_field_type_in_schemas.sql +0 -30
- package/migrations/029_add_forms_system.sql +0 -184
- package/migrations/030_add_turnstile_to_forms.sql +0 -14
- package/migrations/031_ai_search_plugin.sql +0 -45
- package/migrations/032_user_profiles.sql +0 -37
- package/migrations/033_form_content_integration.sql +0 -19
- package/migrations/034_security_audit_plugin.sql +0 -27
- package/migrations/035_user_profiles_data_column.sql +0 -16
- package/migrations/036_analytics_events.sql +0 -22
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
To create a new SonicJS project, use:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npx create-sonicjs my-app
|
|
17
|
+
npx create-sonicjs@latest my-app
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
This is the recommended way to get started with SonicJS. It sets up everything you need with a single command.
|
|
@@ -28,9 +28,9 @@ This is the recommended way to get started with SonicJS. It sets up everything y
|
|
|
28
28
|
- 🔒 **Type-Safe**: Full TypeScript support with comprehensive type definitions
|
|
29
29
|
- 🔌 **Plugin System**: Extensible architecture with hooks and middleware
|
|
30
30
|
- ⚡ **Three-Tier Caching**: Memory, KV, and database layers for optimal performance
|
|
31
|
-
- 🎨 **Admin Interface**:
|
|
32
|
-
- 🔐 **Authentication**:
|
|
33
|
-
- 📝 **Content Management**:
|
|
31
|
+
- 🎨 **Admin Interface**: Glass-morphism design system
|
|
32
|
+
- 🔐 **Authentication**: Better Auth with session management and role-based permissions
|
|
33
|
+
- 📝 **Content Management**: Document-model collections with versioning
|
|
34
34
|
- 🖼️ **Media Management**: R2 storage with automatic optimization
|
|
35
35
|
- 🌐 **REST API**: Auto-generated endpoints for all collections
|
|
36
36
|
|
|
@@ -54,22 +54,24 @@ npm install wrangler drizzle-kit # For development
|
|
|
54
54
|
|
|
55
55
|
## 🚀 Quick Start
|
|
56
56
|
|
|
57
|
-
### 1. Create Your Application
|
|
57
|
+
### 1. Register Collections and Create Your Application
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
// src/index.ts
|
|
61
|
-
import {
|
|
61
|
+
import {
|
|
62
|
+
createSonicJSApp,
|
|
63
|
+
registerCollections,
|
|
64
|
+
} from '@sonicjs-cms/core'
|
|
62
65
|
import type { SonicJSConfig } from '@sonicjs-cms/core'
|
|
66
|
+
import blogPostsCollection from './collections/blog-posts.collection'
|
|
67
|
+
|
|
68
|
+
// Register code-defined collections before creating the app
|
|
69
|
+
registerCollections([blogPostsCollection])
|
|
63
70
|
|
|
64
71
|
const config: SonicJSConfig = {
|
|
65
|
-
collections: {
|
|
66
|
-
directory: './src/collections',
|
|
67
|
-
autoSync: true
|
|
68
|
-
},
|
|
69
72
|
plugins: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
+
register: [/* your plugins here */],
|
|
74
|
+
},
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export default createSonicJSApp(config)
|
|
@@ -77,13 +79,16 @@ export default createSonicJSApp(config)
|
|
|
77
79
|
|
|
78
80
|
### 2. Define Collections
|
|
79
81
|
|
|
82
|
+
Collections are TypeScript config objects — no database table required.
|
|
83
|
+
|
|
80
84
|
```typescript
|
|
81
85
|
// src/collections/blog-posts.collection.ts
|
|
82
86
|
import type { CollectionConfig } from '@sonicjs-cms/core'
|
|
83
87
|
|
|
84
88
|
export default {
|
|
85
|
-
name: '
|
|
86
|
-
displayName: 'Blog
|
|
89
|
+
name: 'blog_post',
|
|
90
|
+
displayName: 'Blog Post',
|
|
91
|
+
slug: 'blog-posts',
|
|
87
92
|
description: 'Manage your blog posts',
|
|
88
93
|
|
|
89
94
|
schema: {
|
|
@@ -93,26 +98,23 @@ export default {
|
|
|
93
98
|
type: 'string',
|
|
94
99
|
title: 'Title',
|
|
95
100
|
required: true,
|
|
96
|
-
maxLength: 200
|
|
101
|
+
maxLength: 200,
|
|
97
102
|
},
|
|
98
103
|
content: {
|
|
99
|
-
type: '
|
|
104
|
+
type: 'lexical',
|
|
100
105
|
title: 'Content',
|
|
101
|
-
required: true
|
|
106
|
+
required: true,
|
|
102
107
|
},
|
|
103
108
|
publishedAt: {
|
|
104
109
|
type: 'datetime',
|
|
105
|
-
title: 'Published Date'
|
|
110
|
+
title: 'Published Date',
|
|
106
111
|
},
|
|
107
|
-
status: {
|
|
108
|
-
type: 'select',
|
|
109
|
-
title: 'Status',
|
|
110
|
-
enum: ['draft', 'published', 'archived'],
|
|
111
|
-
default: 'draft'
|
|
112
|
-
}
|
|
113
112
|
},
|
|
114
|
-
required: ['title', 'content']
|
|
115
|
-
}
|
|
113
|
+
required: ['title', 'content'],
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
managed: true,
|
|
117
|
+
isActive: true,
|
|
116
118
|
} satisfies CollectionConfig
|
|
117
119
|
```
|
|
118
120
|
|
|
@@ -131,7 +133,7 @@ database_id = "your-database-id"
|
|
|
131
133
|
migrations_dir = "./node_modules/@sonicjs-cms/core/migrations"
|
|
132
134
|
|
|
133
135
|
[[r2_buckets]]
|
|
134
|
-
binding = "
|
|
136
|
+
binding = "MEDIA_BUCKET"
|
|
135
137
|
bucket_name = "my-sonicjs-media"
|
|
136
138
|
```
|
|
137
139
|
|
|
@@ -152,7 +154,7 @@ Visit `http://localhost:8787/admin` to access the admin interface.
|
|
|
152
154
|
### Main Application
|
|
153
155
|
|
|
154
156
|
```typescript
|
|
155
|
-
import { createSonicJSApp } from '@sonicjs-cms/core'
|
|
157
|
+
import { createSonicJSApp, registerCollections } from '@sonicjs-cms/core'
|
|
156
158
|
import type { SonicJSConfig, SonicJSApp, Bindings, Variables } from '@sonicjs-cms/core'
|
|
157
159
|
```
|
|
158
160
|
|
|
@@ -161,7 +163,6 @@ import type { SonicJSConfig, SonicJSApp, Bindings, Variables } from '@sonicjs-cm
|
|
|
161
163
|
```typescript
|
|
162
164
|
import {
|
|
163
165
|
loadCollectionConfigs,
|
|
164
|
-
syncCollections,
|
|
165
166
|
MigrationService,
|
|
166
167
|
Logger,
|
|
167
168
|
PluginService
|
|
@@ -223,8 +224,8 @@ import {
|
|
|
223
224
|
import {
|
|
224
225
|
createDb,
|
|
225
226
|
users,
|
|
226
|
-
collections,
|
|
227
227
|
content,
|
|
228
|
+
contentVersions,
|
|
228
229
|
media
|
|
229
230
|
} from '@sonicjs-cms/core'
|
|
230
231
|
```
|
|
@@ -272,31 +273,29 @@ customRoutes.get('/api/custom', requireAuth(), async (c) => {
|
|
|
272
273
|
|
|
273
274
|
// In your app config
|
|
274
275
|
export default createSonicJSApp({
|
|
275
|
-
|
|
276
|
+
plugins: {
|
|
277
|
+
register: [{ name: 'custom', version: '1.0.0', register: (app) => app.route('/custom', customRoutes) }],
|
|
278
|
+
},
|
|
276
279
|
})
|
|
277
280
|
```
|
|
278
281
|
|
|
279
282
|
### Custom Plugin
|
|
280
283
|
|
|
281
284
|
```typescript
|
|
282
|
-
import type { Plugin } from '@sonicjs-cms/core'
|
|
285
|
+
import type { Plugin, PluginContext } from '@sonicjs-cms/core'
|
|
283
286
|
|
|
284
287
|
export default {
|
|
285
288
|
name: 'my-plugin',
|
|
286
289
|
version: '1.0.0',
|
|
287
290
|
description: 'My custom plugin',
|
|
288
291
|
|
|
289
|
-
async
|
|
292
|
+
async activate(context: PluginContext) {
|
|
290
293
|
console.log('Plugin activated!')
|
|
291
294
|
},
|
|
292
295
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
content.metadata = { modified: new Date() }
|
|
297
|
-
return content
|
|
298
|
-
}
|
|
299
|
-
}
|
|
296
|
+
async install(context: PluginContext) {
|
|
297
|
+
// Run once on install — migrations, seed data, etc.
|
|
298
|
+
},
|
|
300
299
|
} satisfies Plugin
|
|
301
300
|
```
|
|
302
301
|
|
|
@@ -309,7 +308,8 @@ const logger = new Logger({ category: 'custom', level: 'info' })
|
|
|
309
308
|
logger.info('Application started')
|
|
310
309
|
|
|
311
310
|
const migrationService = new MigrationService(db)
|
|
312
|
-
await migrationService.
|
|
311
|
+
const status = await migrationService.getMigrationStatus()
|
|
312
|
+
await migrationService.ensureSchemaCompatibility()
|
|
313
313
|
```
|
|
314
314
|
|
|
315
315
|
## 🏗️ Architecture
|
|
@@ -400,24 +400,24 @@ migrations/*.sql → scripts/generate-migrations.ts → src/db/migrations-bundle
|
|
|
400
400
|
The `generate-migrations.ts` script:
|
|
401
401
|
- Reads all `.sql` files from `migrations/`
|
|
402
402
|
- Generates `src/db/migrations-bundle.ts` with embedded SQL
|
|
403
|
-
-
|
|
403
|
+
- Lets `MigrationService` compare bundled migrations against D1's `d1_migrations` status
|
|
404
404
|
|
|
405
|
-
**Important**:
|
|
405
|
+
**Important**: Cloudflare D1/Wrangler is the migration runner and `d1_migrations` is the canonical tracking table. Run migrations with `wrangler d1 migrations apply`; SonicJS only reports status and runs idempotent compatibility repairs at bootstrap.
|
|
406
406
|
|
|
407
407
|
## 🔄 Versioning
|
|
408
408
|
|
|
409
409
|
SonicJS follows semantic versioning:
|
|
410
410
|
|
|
411
|
-
- **
|
|
412
|
-
- **
|
|
411
|
+
- **v3.x.x** - Current (document model, Better Auth, edge-first)
|
|
412
|
+
- **v2.x.x** - Legacy monolith (deprecated)
|
|
413
413
|
|
|
414
|
-
**Current Version**: `
|
|
414
|
+
**Current Version**: `3.0.0-beta.9`
|
|
415
415
|
|
|
416
416
|
### Upgrade Path
|
|
417
417
|
|
|
418
418
|
```bash
|
|
419
|
-
# Install the
|
|
420
|
-
npm install @sonicjs-cms/core@
|
|
419
|
+
# Install the latest package
|
|
420
|
+
npm install @sonicjs-cms/core@latest
|
|
421
421
|
|
|
422
422
|
# Run any new migrations
|
|
423
423
|
wrangler d1 migrations apply DB
|
|
@@ -466,12 +466,12 @@ MIT © SonicJS Team - See [LICENSE](./LICENSE) for details.
|
|
|
466
466
|
|
|
467
467
|
## 🛡️ Security
|
|
468
468
|
|
|
469
|
-
-
|
|
470
|
-
- Role-based access control
|
|
469
|
+
- Better Auth (sessions + RBAC)
|
|
470
|
+
- Role-based access control
|
|
471
471
|
- Permission system
|
|
472
472
|
- Secure headers
|
|
473
473
|
- Input sanitization
|
|
474
474
|
|
|
475
475
|
---
|
|
476
476
|
|
|
477
|
-
**Built with ❤️ for the edge** |
|
|
477
|
+
**Built with ❤️ for the edge** | v3.0.0-beta.9
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { renderDocumentFormPage, renderVersionHistoryFragment } from './chunk-RMRJGMDE.js';
|
|
2
|
+
import './chunk-5V62WT6M.js';
|
|
3
|
+
import './chunk-TQABQWOP.js';
|
|
4
|
+
import './chunk-V4OQ3NZ2.js';
|
|
5
|
+
//# sourceMappingURL=admin-documents-form.template-DDSH6ROU.js.map
|
|
6
|
+
//# sourceMappingURL=admin-documents-form.template-DDSH6ROU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"admin-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"admin-documents-form.template-DDSH6ROU.js"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkN32OWET6_cjs = require('./chunk-N32OWET6.cjs');
|
|
4
|
+
require('./chunk-K623Q6WD.cjs');
|
|
5
|
+
require('./chunk-MNWKYY5E.cjs');
|
|
6
|
+
require('./chunk-IGJUBJBW.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "renderDocumentFormPage", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkN32OWET6_cjs.renderDocumentFormPage; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "renderVersionHistoryFragment", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkN32OWET6_cjs.renderVersionHistoryFragment; }
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=admin-documents-form.template-LSZKGA5J.cjs.map
|
|
19
|
+
//# sourceMappingURL=admin-documents-form.template-LSZKGA5J.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"admin-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"admin-documents-form.template-LSZKGA5J.cjs"}
|
package/dist/{filter-bar.template-DlVYMk-T.d.cts → admin-layout-catalyst.template-DrwDUfsE.d.cts}
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { HtmlEscapedString } from 'hono/utils/html';
|
|
2
|
+
|
|
1
3
|
interface FormField {
|
|
2
4
|
name: string;
|
|
3
5
|
label: string;
|
|
@@ -138,4 +140,26 @@ interface FilterBarData {
|
|
|
138
140
|
}
|
|
139
141
|
declare function renderFilterBar(data: FilterBarData): string;
|
|
140
142
|
|
|
141
|
-
|
|
143
|
+
interface AdminLayoutCatalystData {
|
|
144
|
+
title: string;
|
|
145
|
+
pageTitle?: string;
|
|
146
|
+
currentPath?: string;
|
|
147
|
+
version?: string;
|
|
148
|
+
enableExperimentalFeatures?: boolean;
|
|
149
|
+
user?: {
|
|
150
|
+
name: string;
|
|
151
|
+
email: string;
|
|
152
|
+
role: string;
|
|
153
|
+
};
|
|
154
|
+
scripts?: string[];
|
|
155
|
+
styles?: string[];
|
|
156
|
+
content: string | HtmlEscapedString;
|
|
157
|
+
dynamicMenuItems?: Array<{
|
|
158
|
+
label: string;
|
|
159
|
+
path: string;
|
|
160
|
+
icon: string;
|
|
161
|
+
}>;
|
|
162
|
+
}
|
|
163
|
+
declare function renderAdminLayoutCatalyst(data: AdminLayoutCatalystData): string;
|
|
164
|
+
|
|
165
|
+
export { type AdminLayoutCatalystData as A, type ConfirmationDialogOptions as C, type Filter as F, type PaginationData as P, type TableColumn as T, type AlertData as a, type FilterBarData as b, type FilterOption as c, type FormData as d, type FormField as e, type TableData as f, getConfirmationDialogScript as g, renderAlert as h, renderConfirmationDialog as i, renderFilterBar as j, renderForm as k, renderFormField as l, renderPagination as m, renderTable as n, renderAdminLayoutCatalyst as r };
|
package/dist/{filter-bar.template-DlVYMk-T.d.ts → admin-layout-catalyst.template-DrwDUfsE.d.ts}
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { HtmlEscapedString } from 'hono/utils/html';
|
|
2
|
+
|
|
1
3
|
interface FormField {
|
|
2
4
|
name: string;
|
|
3
5
|
label: string;
|
|
@@ -138,4 +140,26 @@ interface FilterBarData {
|
|
|
138
140
|
}
|
|
139
141
|
declare function renderFilterBar(data: FilterBarData): string;
|
|
140
142
|
|
|
141
|
-
|
|
143
|
+
interface AdminLayoutCatalystData {
|
|
144
|
+
title: string;
|
|
145
|
+
pageTitle?: string;
|
|
146
|
+
currentPath?: string;
|
|
147
|
+
version?: string;
|
|
148
|
+
enableExperimentalFeatures?: boolean;
|
|
149
|
+
user?: {
|
|
150
|
+
name: string;
|
|
151
|
+
email: string;
|
|
152
|
+
role: string;
|
|
153
|
+
};
|
|
154
|
+
scripts?: string[];
|
|
155
|
+
styles?: string[];
|
|
156
|
+
content: string | HtmlEscapedString;
|
|
157
|
+
dynamicMenuItems?: Array<{
|
|
158
|
+
label: string;
|
|
159
|
+
path: string;
|
|
160
|
+
icon: string;
|
|
161
|
+
}>;
|
|
162
|
+
}
|
|
163
|
+
declare function renderAdminLayoutCatalyst(data: AdminLayoutCatalystData): string;
|
|
164
|
+
|
|
165
|
+
export { type AdminLayoutCatalystData as A, type ConfirmationDialogOptions as C, type Filter as F, type PaginationData as P, type TableColumn as T, type AlertData as a, type FilterBarData as b, type FilterOption as c, type FormData as d, type FormField as e, type TableData as f, getConfirmationDialogScript as g, renderAlert as h, renderConfirmationDialog as i, renderFilterBar as j, renderForm as k, renderFormField as l, renderPagination as m, renderTable as n, renderAdminLayoutCatalyst as r };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkK623Q6WD_cjs = require('./chunk-K623Q6WD.cjs');
|
|
4
|
+
require('./chunk-IGJUBJBW.cjs');
|
|
5
|
+
|
|
6
|
+
chunkK623Q6WD_cjs.init_admin_layout_catalyst_template();
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkK623Q6WD_cjs.renderAdminLayoutCatalyst; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "renderCatalystCheckbox", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkK623Q6WD_cjs.renderCatalystCheckbox; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "setBranchLabel", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkK623Q6WD_cjs.setBranchLabel; }
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=admin-layout-catalyst.template-KDHKVLXR.cjs.map
|
|
21
|
+
//# sourceMappingURL=admin-layout-catalyst.template-KDHKVLXR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"admin-layout-catalyst.template-KDHKVLXR.cjs"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { init_admin_layout_catalyst_template } from './chunk-5V62WT6M.js';
|
|
2
|
+
export { renderAdminLayoutCatalyst, renderCatalystCheckbox, setBranchLabel } from './chunk-5V62WT6M.js';
|
|
3
|
+
import './chunk-V4OQ3NZ2.js';
|
|
4
|
+
|
|
5
|
+
init_admin_layout_catalyst_template();
|
|
6
|
+
//# sourceMappingURL=admin-layout-catalyst.template-YQ4EMF2J.js.map
|
|
7
|
+
//# sourceMappingURL=admin-layout-catalyst.template-YQ4EMF2J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"admin-layout-catalyst.template-YQ4EMF2J.js"}
|