@sonicjs-cms/core 2.18.1 → 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-XXDFQERJ.js → chunk-6OC6MF3C.js} +7192 -9806
- 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-IDCZBF35.js +1186 -0
- 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-SQ6FNXU2.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-MUNO67TT.cjs +1219 -0
- 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-MGFRZO24.js → chunk-QZGABF2M.js} +3 -149
- package/dist/chunk-QZGABF2M.js.map +1 -0
- package/dist/{chunk-T3Q5V33G.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-SXXTQETM.cjs → chunk-TO6EY4P7.cjs} +8722 -11323
- 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 +13737 -4327
- 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 +13456 -4068
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +38 -32
- package/dist/middleware.d.cts +69 -7
- package/dist/middleware.d.ts +69 -7
- package/dist/middleware.js +9 -3
- package/dist/migrations-2XHQEGOQ.cjs +13 -0
- package/dist/{migrations-IYNTWDC6.cjs.map → migrations-2XHQEGOQ.cjs.map} +1 -1
- package/dist/migrations-PE3CDVSM.js +4 -0
- package/dist/{migrations-R337UD46.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-4R3NOOL3.js +0 -2217
- package/dist/chunk-4R3NOOL3.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-ABB34XUS.cjs.map +0 -1
- package/dist/chunk-C54YUA23.cjs +0 -2219
- package/dist/chunk-C54YUA23.cjs.map +0 -1
- package/dist/chunk-DSUJ5YQH.cjs +0 -722
- package/dist/chunk-DSUJ5YQH.cjs.map +0 -1
- package/dist/chunk-EW5NOBVU.js +0 -1783
- package/dist/chunk-EW5NOBVU.js.map +0 -1
- package/dist/chunk-EXNEW5US.js +0 -648
- package/dist/chunk-EXNEW5US.js.map +0 -1
- package/dist/chunk-I2H5NGJQ.js +0 -692
- package/dist/chunk-I2H5NGJQ.js.map +0 -1
- package/dist/chunk-MGFRZO24.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-SQ6FNXU2.cjs.map +0 -1
- package/dist/chunk-SXXTQETM.cjs.map +0 -1
- package/dist/chunk-T3Q5V33G.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-XXDFQERJ.js.map +0 -1
- package/dist/migrations-IYNTWDC6.cjs +0 -13
- package/dist/migrations-R337UD46.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
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
-- Migration 0002: Document Schema (v3 greenfield)
|
|
2
|
+
-- Contains only the new document data model tables, generated columns, and indexes.
|
|
3
|
+
|
|
4
|
+
-- Document type registry
|
|
5
|
+
CREATE TABLE IF NOT EXISTS document_types (
|
|
6
|
+
id TEXT PRIMARY KEY,
|
|
7
|
+
name TEXT NOT NULL UNIQUE,
|
|
8
|
+
display_name TEXT NOT NULL,
|
|
9
|
+
description TEXT,
|
|
10
|
+
schema TEXT NOT NULL DEFAULT '{}',
|
|
11
|
+
queryable_fields TEXT NOT NULL DEFAULT '[]',
|
|
12
|
+
settings TEXT NOT NULL DEFAULT '{}',
|
|
13
|
+
plugin_id TEXT,
|
|
14
|
+
source TEXT NOT NULL DEFAULT 'code' CHECK (source IN ('code', 'plugin', 'system')),
|
|
15
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
16
|
+
is_system INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
is_active INTEGER NOT NULL DEFAULT 1,
|
|
18
|
+
is_auth INTEGER NOT NULL DEFAULT 0,
|
|
19
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
|
20
|
+
updated_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
CREATE INDEX IF NOT EXISTS idx_document_types_plugin ON document_types(plugin_id);
|
|
24
|
+
CREATE INDEX IF NOT EXISTS idx_document_types_active ON document_types(is_active);
|
|
25
|
+
|
|
26
|
+
-- Documents: canonical document rows and historical versions.
|
|
27
|
+
CREATE TABLE IF NOT EXISTS documents (
|
|
28
|
+
id TEXT PRIMARY KEY,
|
|
29
|
+
root_id TEXT NOT NULL,
|
|
30
|
+
type_id TEXT NOT NULL REFERENCES document_types(id),
|
|
31
|
+
type_version INTEGER NOT NULL DEFAULT 1,
|
|
32
|
+
|
|
33
|
+
version_of_id TEXT REFERENCES documents(id),
|
|
34
|
+
version_number INTEGER NOT NULL DEFAULT 1,
|
|
35
|
+
|
|
36
|
+
is_current_draft INTEGER NOT NULL DEFAULT 1,
|
|
37
|
+
is_published INTEGER NOT NULL DEFAULT 0,
|
|
38
|
+
status TEXT NOT NULL DEFAULT 'draft' CHECK (status IN ('draft', 'published', 'archived')),
|
|
39
|
+
|
|
40
|
+
parent_root_id TEXT NOT NULL DEFAULT '',
|
|
41
|
+
slug TEXT,
|
|
42
|
+
path TEXT,
|
|
43
|
+
title TEXT,
|
|
44
|
+
zone TEXT,
|
|
45
|
+
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
46
|
+
visible INTEGER NOT NULL DEFAULT 1,
|
|
47
|
+
|
|
48
|
+
published_at INTEGER,
|
|
49
|
+
scheduled_at INTEGER,
|
|
50
|
+
expires_at INTEGER,
|
|
51
|
+
deleted_at INTEGER,
|
|
52
|
+
|
|
53
|
+
tenant_id TEXT NOT NULL DEFAULT 'default',
|
|
54
|
+
locale TEXT NOT NULL DEFAULT 'default',
|
|
55
|
+
translation_group_id TEXT NOT NULL DEFAULT '',
|
|
56
|
+
|
|
57
|
+
data TEXT NOT NULL DEFAULT '{}',
|
|
58
|
+
metadata TEXT NOT NULL DEFAULT '{}',
|
|
59
|
+
|
|
60
|
+
owner_id TEXT,
|
|
61
|
+
created_by TEXT,
|
|
62
|
+
updated_by TEXT,
|
|
63
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
|
64
|
+
updated_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
-- Queryable scalar fields (VIRTUAL generated columns) and their q_* filter indexes
|
|
68
|
+
-- are AUTO-GENERATED at runtime from each document type's queryableFields config —
|
|
69
|
+
-- see DocumentTypeRegistry.register() -> ensureScalarSchema() (document-scalar-schema.ts).
|
|
70
|
+
-- Do not hand-add q_* columns/indexes here; declare the field in the type instead.
|
|
71
|
+
|
|
72
|
+
-- Revision chain
|
|
73
|
+
CREATE INDEX IF NOT EXISTS idx_documents_root ON documents(root_id, version_number DESC);
|
|
74
|
+
|
|
75
|
+
-- List / lifecycle
|
|
76
|
+
CREATE INDEX IF NOT EXISTS idx_documents_published ON documents(tenant_id, type_id, locale, is_published)
|
|
77
|
+
WHERE is_published = 1 AND deleted_at IS NULL;
|
|
78
|
+
CREATE INDEX IF NOT EXISTS idx_documents_drafts ON documents(tenant_id, type_id, status, is_current_draft)
|
|
79
|
+
WHERE is_current_draft = 1;
|
|
80
|
+
CREATE INDEX IF NOT EXISTS idx_documents_parent ON documents(tenant_id, parent_root_id, sort_order, is_published);
|
|
81
|
+
CREATE INDEX IF NOT EXISTS idx_documents_path ON documents(tenant_id, path);
|
|
82
|
+
CREATE INDEX IF NOT EXISTS idx_documents_translation ON documents(translation_group_id, locale);
|
|
83
|
+
CREATE INDEX IF NOT EXISTS idx_documents_deleted ON documents(deleted_at);
|
|
84
|
+
CREATE INDEX IF NOT EXISTS idx_documents_scheduled ON documents(scheduled_at) WHERE scheduled_at IS NOT NULL;
|
|
85
|
+
CREATE INDEX IF NOT EXISTS idx_documents_expires ON documents(expires_at) WHERE expires_at IS NOT NULL;
|
|
86
|
+
|
|
87
|
+
-- Stable keyset/cursor pagination for published lists
|
|
88
|
+
CREATE INDEX IF NOT EXISTS idx_documents_published_cursor
|
|
89
|
+
ON documents(tenant_id, type_id, updated_at DESC, id DESC)
|
|
90
|
+
WHERE is_published = 1 AND deleted_at IS NULL;
|
|
91
|
+
|
|
92
|
+
-- (q_* generated-column filter indexes are auto-created at runtime — see note above.)
|
|
93
|
+
|
|
94
|
+
-- Partial unique indexes: the hard concurrency guarantees for draft/publish invariants.
|
|
95
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_documents_one_current_draft
|
|
96
|
+
ON documents(root_id) WHERE is_current_draft = 1;
|
|
97
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_documents_one_published
|
|
98
|
+
ON documents(root_id) WHERE is_published = 1;
|
|
99
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_documents_unique_version
|
|
100
|
+
ON documents(root_id, version_number);
|
|
101
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_documents_unique_slug
|
|
102
|
+
ON documents(tenant_id, locale, type_id, parent_root_id, slug)
|
|
103
|
+
WHERE is_current_draft = 1 AND deleted_at IS NULL AND slug IS NOT NULL;
|
|
104
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_documents_one_translation_per_locale
|
|
105
|
+
ON documents(tenant_id, translation_group_id, locale)
|
|
106
|
+
WHERE is_current_draft = 1 AND translation_group_id <> '';
|
|
107
|
+
|
|
108
|
+
-- Document references: typed document-to-document edges.
|
|
109
|
+
CREATE TABLE IF NOT EXISTS document_references (
|
|
110
|
+
id TEXT PRIMARY KEY,
|
|
111
|
+
tenant_id TEXT NOT NULL,
|
|
112
|
+
from_root_id TEXT NOT NULL,
|
|
113
|
+
from_document_id TEXT NOT NULL REFERENCES documents(id) ON DELETE CASCADE,
|
|
114
|
+
field_name TEXT NOT NULL,
|
|
115
|
+
ordinal INTEGER NOT NULL DEFAULT 0,
|
|
116
|
+
to_root_id TEXT NOT NULL,
|
|
117
|
+
ref_strength TEXT NOT NULL DEFAULT 'weak' CHECK (ref_strength IN ('strong', 'weak')),
|
|
118
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
CREATE INDEX IF NOT EXISTS idx_docref_to ON document_references(tenant_id, to_root_id);
|
|
122
|
+
CREATE INDEX IF NOT EXISTS idx_docref_from ON document_references(from_document_id);
|
|
123
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_docref_unique
|
|
124
|
+
ON document_references(from_document_id, field_name, ordinal);
|
|
125
|
+
|
|
126
|
+
-- Document facets: indexed rows for multi-valued scalar fields (e.g. tags arrays).
|
|
127
|
+
CREATE TABLE IF NOT EXISTS document_facets (
|
|
128
|
+
id TEXT PRIMARY KEY,
|
|
129
|
+
tenant_id TEXT NOT NULL,
|
|
130
|
+
document_id TEXT NOT NULL REFERENCES documents(id) ON DELETE CASCADE,
|
|
131
|
+
root_id TEXT NOT NULL,
|
|
132
|
+
type_id TEXT NOT NULL,
|
|
133
|
+
field_name TEXT NOT NULL,
|
|
134
|
+
ordinal INTEGER NOT NULL DEFAULT 0,
|
|
135
|
+
value_text TEXT,
|
|
136
|
+
value_number REAL,
|
|
137
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
CREATE INDEX IF NOT EXISTS idx_facets_lookup ON document_facets(tenant_id, type_id, field_name, value_text);
|
|
141
|
+
CREATE INDEX IF NOT EXISTS idx_facets_doc ON document_facets(document_id);
|
|
142
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_facets_unique
|
|
143
|
+
ON document_facets(document_id, field_name, ordinal);
|
|
144
|
+
|
|
145
|
+
-- Document permissions: per-document ACL overrides.
|
|
146
|
+
CREATE TABLE IF NOT EXISTS document_permissions (
|
|
147
|
+
id TEXT PRIMARY KEY,
|
|
148
|
+
tenant_id TEXT NOT NULL,
|
|
149
|
+
root_id TEXT NOT NULL,
|
|
150
|
+
principal_type TEXT NOT NULL CHECK (principal_type IN ('user', 'role', 'group', 'public', 'token')),
|
|
151
|
+
principal_id TEXT NOT NULL,
|
|
152
|
+
permission TEXT NOT NULL CHECK (permission IN ('read', 'create', 'update', 'delete', 'publish', 'manage')),
|
|
153
|
+
effect TEXT NOT NULL DEFAULT 'allow' CHECK (effect IN ('allow', 'deny')),
|
|
154
|
+
inherited INTEGER NOT NULL DEFAULT 0,
|
|
155
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
|
156
|
+
created_by TEXT
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
CREATE INDEX IF NOT EXISTS idx_document_permissions_root ON document_permissions(tenant_id, root_id);
|
|
160
|
+
CREATE INDEX IF NOT EXISTS idx_document_permissions_principal
|
|
161
|
+
ON document_permissions(tenant_id, principal_type, principal_id, permission);
|
|
162
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_document_permissions_unique
|
|
163
|
+
ON document_permissions(root_id, principal_type, principal_id, permission);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonicjs-cms/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.10",
|
|
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",
|
|
@@ -67,10 +67,11 @@
|
|
|
67
67
|
"type-check": "tsc --noEmit",
|
|
68
68
|
"lint": "eslint src/",
|
|
69
69
|
"lint:fix": "eslint src/ --fix",
|
|
70
|
-
"test": "vitest
|
|
71
|
-
"test:cov": "vitest
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"test:cov": "vitest run --coverage",
|
|
72
72
|
"test:watch": "vitest",
|
|
73
|
-
"prepublishOnly": "npm run build"
|
|
73
|
+
"prepublishOnly": "npm run build",
|
|
74
|
+
"prepare": "npm run build"
|
|
74
75
|
},
|
|
75
76
|
"keywords": [
|
|
76
77
|
"cms",
|
|
@@ -103,6 +104,8 @@
|
|
|
103
104
|
},
|
|
104
105
|
"dependencies": {
|
|
105
106
|
"@cf-wasm/resvg": "^0.3.3",
|
|
107
|
+
"better-auth": "^1.6.13",
|
|
108
|
+
"better-auth-cloudflare": "^0.3.0",
|
|
106
109
|
"csv-parse": "^6.2.1",
|
|
107
110
|
"drizzle-zod": "^0.8.3",
|
|
108
111
|
"highlight.js": "^11.11.1",
|
|
@@ -114,18 +117,20 @@
|
|
|
114
117
|
},
|
|
115
118
|
"devDependencies": {
|
|
116
119
|
"@cloudflare/workers-types": "^4.20251014.0",
|
|
120
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
117
121
|
"@types/node": "^24.9.2",
|
|
118
122
|
"@types/qrcode-svg": "^1.1.5",
|
|
119
123
|
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
120
124
|
"@typescript-eslint/parser": "^8.50.0",
|
|
121
|
-
"@vitest/coverage-v8": "^4.
|
|
125
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
126
|
+
"better-sqlite3": "^12.10.0",
|
|
122
127
|
"drizzle-orm": "^0.45.2",
|
|
123
128
|
"eslint": "^9.39.2",
|
|
124
129
|
"glob": "^10.5.0",
|
|
125
|
-
"hono": "^4.12.
|
|
130
|
+
"hono": "^4.12.26",
|
|
126
131
|
"tsup": "^8.5.0",
|
|
127
132
|
"typescript": "^5.9.3",
|
|
128
|
-
"vitest": "^4.
|
|
133
|
+
"vitest": "^4.1.9",
|
|
129
134
|
"zod": "^4.1.12"
|
|
130
135
|
},
|
|
131
136
|
"engines": {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkUYJ6TJHX_cjs = require('./chunk-UYJ6TJHX.cjs');
|
|
4
|
-
require('./chunk-IGJUBJBW.cjs');
|
|
5
|
-
|
|
6
|
-
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst; }
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "renderCatalystCheckbox", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return chunkUYJ6TJHX_cjs.renderCatalystCheckbox; }
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=admin-layout-catalyst.template-HFD37TY5.cjs.map
|
|
17
|
-
//# sourceMappingURL=admin-layout-catalyst.template-HFD37TY5.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { init_admin_layout_catalyst_template } from './chunk-55RDMDOP.js';
|
|
2
|
-
export { renderAdminLayoutCatalyst, renderCatalystCheckbox } from './chunk-55RDMDOP.js';
|
|
3
|
-
import './chunk-V4OQ3NZ2.js';
|
|
4
|
-
|
|
5
|
-
init_admin_layout_catalyst_template();
|
|
6
|
-
//# sourceMappingURL=admin-layout-catalyst.template-UMTIN66R.js.map
|
|
7
|
-
//# sourceMappingURL=admin-layout-catalyst.template-UMTIN66R.js.map
|
package/dist/app-C9esKLmh.d.cts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Hono, Context } from 'hono';
|
|
2
|
-
import { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Main Application Factory
|
|
6
|
-
*
|
|
7
|
-
* Creates a configured SonicJS application with all core functionality
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
interface Bindings {
|
|
11
|
-
DB: D1Database;
|
|
12
|
-
CACHE_KV: KVNamespace;
|
|
13
|
-
MEDIA_BUCKET: R2Bucket;
|
|
14
|
-
ASSETS: Fetcher;
|
|
15
|
-
EMAIL_QUEUE?: Queue;
|
|
16
|
-
SENDGRID_API_KEY?: string;
|
|
17
|
-
DEFAULT_FROM_EMAIL?: string;
|
|
18
|
-
IMAGES_ACCOUNT_ID?: string;
|
|
19
|
-
IMAGES_API_TOKEN?: string;
|
|
20
|
-
ENVIRONMENT?: string;
|
|
21
|
-
CORS_ORIGINS?: string;
|
|
22
|
-
JWT_SECRET?: string;
|
|
23
|
-
JWT_EXPIRES_IN?: string;
|
|
24
|
-
JWT_REFRESH_GRACE_SECONDS?: string;
|
|
25
|
-
BUCKET_NAME?: string;
|
|
26
|
-
GOOGLE_MAPS_API_KEY?: string;
|
|
27
|
-
}
|
|
28
|
-
interface Variables {
|
|
29
|
-
user?: {
|
|
30
|
-
userId: string;
|
|
31
|
-
email: string;
|
|
32
|
-
role: string;
|
|
33
|
-
exp: number;
|
|
34
|
-
iat: number;
|
|
35
|
-
};
|
|
36
|
-
requestId?: string;
|
|
37
|
-
startTime?: number;
|
|
38
|
-
appVersion?: string;
|
|
39
|
-
csrfToken?: string;
|
|
40
|
-
pluginMenuItems?: Array<{
|
|
41
|
-
label: string;
|
|
42
|
-
path: string;
|
|
43
|
-
icon: string;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
interface SonicJSConfig {
|
|
47
|
-
collections?: {
|
|
48
|
-
directory?: string;
|
|
49
|
-
autoSync?: boolean;
|
|
50
|
-
};
|
|
51
|
-
plugins?: {
|
|
52
|
-
directory?: string;
|
|
53
|
-
autoLoad?: boolean;
|
|
54
|
-
disableAll?: boolean;
|
|
55
|
-
};
|
|
56
|
-
routes?: Array<{
|
|
57
|
-
path: string;
|
|
58
|
-
handler: Hono;
|
|
59
|
-
}>;
|
|
60
|
-
middleware?: {
|
|
61
|
-
beforeAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>;
|
|
62
|
-
afterAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>;
|
|
63
|
-
};
|
|
64
|
-
adminAccessRoles?: string[];
|
|
65
|
-
version?: string;
|
|
66
|
-
name?: string;
|
|
67
|
-
}
|
|
68
|
-
type SonicJSApp = Hono<{
|
|
69
|
-
Bindings: Bindings;
|
|
70
|
-
Variables: Variables;
|
|
71
|
-
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Create a SonicJS application with core functionality
|
|
74
|
-
*
|
|
75
|
-
* @param config - Application configuration
|
|
76
|
-
* @returns Configured Hono application
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import { createSonicJSApp } from '@sonicjs-cms/core'
|
|
81
|
-
*
|
|
82
|
-
* const app = createSonicJSApp({
|
|
83
|
-
* collections: {
|
|
84
|
-
* directory: './src/collections',
|
|
85
|
-
* autoSync: true
|
|
86
|
-
* },
|
|
87
|
-
* plugins: {
|
|
88
|
-
* directory: './src/plugins',
|
|
89
|
-
* autoLoad: true
|
|
90
|
-
* }
|
|
91
|
-
* })
|
|
92
|
-
*
|
|
93
|
-
* export default app
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
declare function createSonicJSApp(config?: SonicJSConfig): SonicJSApp;
|
|
97
|
-
/**
|
|
98
|
-
* Setup core middleware (backward compatibility)
|
|
99
|
-
*
|
|
100
|
-
* @param _app - Hono application
|
|
101
|
-
* @deprecated Use createSonicJSApp() instead
|
|
102
|
-
*/
|
|
103
|
-
declare function setupCoreMiddleware(_app: SonicJSApp): void;
|
|
104
|
-
/**
|
|
105
|
-
* Setup core routes (backward compatibility)
|
|
106
|
-
*
|
|
107
|
-
* @param _app - Hono application
|
|
108
|
-
* @deprecated Use createSonicJSApp() instead
|
|
109
|
-
*/
|
|
110
|
-
declare function setupCoreRoutes(_app: SonicJSApp): void;
|
|
111
|
-
|
|
112
|
-
export { type Bindings as B, type SonicJSConfig as S, type Variables as V, type SonicJSApp as a, setupCoreRoutes as b, createSonicJSApp as c, setupCoreMiddleware as s };
|
package/dist/app-C9esKLmh.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Hono, Context } from 'hono';
|
|
2
|
-
import { D1Database, KVNamespace, R2Bucket } from '@cloudflare/workers-types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Main Application Factory
|
|
6
|
-
*
|
|
7
|
-
* Creates a configured SonicJS application with all core functionality
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
interface Bindings {
|
|
11
|
-
DB: D1Database;
|
|
12
|
-
CACHE_KV: KVNamespace;
|
|
13
|
-
MEDIA_BUCKET: R2Bucket;
|
|
14
|
-
ASSETS: Fetcher;
|
|
15
|
-
EMAIL_QUEUE?: Queue;
|
|
16
|
-
SENDGRID_API_KEY?: string;
|
|
17
|
-
DEFAULT_FROM_EMAIL?: string;
|
|
18
|
-
IMAGES_ACCOUNT_ID?: string;
|
|
19
|
-
IMAGES_API_TOKEN?: string;
|
|
20
|
-
ENVIRONMENT?: string;
|
|
21
|
-
CORS_ORIGINS?: string;
|
|
22
|
-
JWT_SECRET?: string;
|
|
23
|
-
JWT_EXPIRES_IN?: string;
|
|
24
|
-
JWT_REFRESH_GRACE_SECONDS?: string;
|
|
25
|
-
BUCKET_NAME?: string;
|
|
26
|
-
GOOGLE_MAPS_API_KEY?: string;
|
|
27
|
-
}
|
|
28
|
-
interface Variables {
|
|
29
|
-
user?: {
|
|
30
|
-
userId: string;
|
|
31
|
-
email: string;
|
|
32
|
-
role: string;
|
|
33
|
-
exp: number;
|
|
34
|
-
iat: number;
|
|
35
|
-
};
|
|
36
|
-
requestId?: string;
|
|
37
|
-
startTime?: number;
|
|
38
|
-
appVersion?: string;
|
|
39
|
-
csrfToken?: string;
|
|
40
|
-
pluginMenuItems?: Array<{
|
|
41
|
-
label: string;
|
|
42
|
-
path: string;
|
|
43
|
-
icon: string;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
interface SonicJSConfig {
|
|
47
|
-
collections?: {
|
|
48
|
-
directory?: string;
|
|
49
|
-
autoSync?: boolean;
|
|
50
|
-
};
|
|
51
|
-
plugins?: {
|
|
52
|
-
directory?: string;
|
|
53
|
-
autoLoad?: boolean;
|
|
54
|
-
disableAll?: boolean;
|
|
55
|
-
};
|
|
56
|
-
routes?: Array<{
|
|
57
|
-
path: string;
|
|
58
|
-
handler: Hono;
|
|
59
|
-
}>;
|
|
60
|
-
middleware?: {
|
|
61
|
-
beforeAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>;
|
|
62
|
-
afterAuth?: Array<(c: Context, next: () => Promise<void>) => Promise<void>>;
|
|
63
|
-
};
|
|
64
|
-
adminAccessRoles?: string[];
|
|
65
|
-
version?: string;
|
|
66
|
-
name?: string;
|
|
67
|
-
}
|
|
68
|
-
type SonicJSApp = Hono<{
|
|
69
|
-
Bindings: Bindings;
|
|
70
|
-
Variables: Variables;
|
|
71
|
-
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Create a SonicJS application with core functionality
|
|
74
|
-
*
|
|
75
|
-
* @param config - Application configuration
|
|
76
|
-
* @returns Configured Hono application
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import { createSonicJSApp } from '@sonicjs-cms/core'
|
|
81
|
-
*
|
|
82
|
-
* const app = createSonicJSApp({
|
|
83
|
-
* collections: {
|
|
84
|
-
* directory: './src/collections',
|
|
85
|
-
* autoSync: true
|
|
86
|
-
* },
|
|
87
|
-
* plugins: {
|
|
88
|
-
* directory: './src/plugins',
|
|
89
|
-
* autoLoad: true
|
|
90
|
-
* }
|
|
91
|
-
* })
|
|
92
|
-
*
|
|
93
|
-
* export default app
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
declare function createSonicJSApp(config?: SonicJSConfig): SonicJSApp;
|
|
97
|
-
/**
|
|
98
|
-
* Setup core middleware (backward compatibility)
|
|
99
|
-
*
|
|
100
|
-
* @param _app - Hono application
|
|
101
|
-
* @deprecated Use createSonicJSApp() instead
|
|
102
|
-
*/
|
|
103
|
-
declare function setupCoreMiddleware(_app: SonicJSApp): void;
|
|
104
|
-
/**
|
|
105
|
-
* Setup core routes (backward compatibility)
|
|
106
|
-
*
|
|
107
|
-
* @param _app - Hono application
|
|
108
|
-
* @deprecated Use createSonicJSApp() instead
|
|
109
|
-
*/
|
|
110
|
-
declare function setupCoreRoutes(_app: SonicJSApp): void;
|
|
111
|
-
|
|
112
|
-
export { type Bindings as B, type SonicJSConfig as S, type Variables as V, type SonicJSApp as a, setupCoreRoutes as b, createSonicJSApp as c, setupCoreMiddleware as s };
|