@brightsideoy/kama 0.1.0-alpha.36 → 0.1.0-alpha.37

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 (3) hide show
  1. package/dist/index.js +1643 -182
  2. package/package.json +6 -5
  3. package/schema.sql +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightsideoy/kama",
3
- "version": "0.1.0-alpha.36",
3
+ "version": "0.1.0-alpha.37",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,12 +21,13 @@
21
21
  ],
22
22
  "scripts": {
23
23
  "dev": "concurrently \"vite\" \"tsx watch server/dev.ts\"",
24
- "build:server": "vite build",
24
+ "bundle:definitions": "node scripts/bundle-definitions.js",
25
+ "build:schema": "tsx src/db/generate-schema.ts",
26
+ "build:server": "npm run bundle:definitions && vite build",
25
27
  "build:ui": "vite build --config vite.config.ui.ts",
26
- "build": "npm run build:server && npm run build:ui",
28
+ "build": "npm run build:schema && npm run build:server && npm run build:ui",
27
29
  "build:cms": "npm run build",
28
- "build:schema": "tsx src/db/generate-schema.ts",
29
- "prepublishOnly": "npm run build:schema && npm run build",
30
+ "prepublishOnly": "npm run build",
30
31
  "db:seed": "npm run build:schema && tsx -e \"import Database from 'better-sqlite3'; import fs from 'node:fs'; const db = new Database('data/cms.db'); db.exec(fs.readFileSync('schema.sql', 'utf8')); console.log('✅ Database schema applied successfully!');\"",
31
32
  "d1:schema:remote": "npm run build:schema && npx wrangler d1 execute YOUR_D1_NAME --remote --file=./schema.sql",
32
33
  "serve": "tsx server/dev.ts"
package/schema.sql CHANGED
@@ -1,6 +1,16 @@
1
1
  -- Kama Core System Schema
2
2
  -- Auto-generated from server/db/dynamic-sync.ts
3
3
 
4
+ CREATE TABLE IF NOT EXISTS "content_schemas" (
5
+ id TEXT PRIMARY KEY,
6
+ name TEXT NOT NULL,
7
+ type TEXT UNIQUE NOT NULL,
8
+ schemaJson TEXT NOT NULL,
9
+ isSystem INTEGER DEFAULT 1,
10
+ createdAt TEXT DEFAULT CURRENT_TIMESTAMP,
11
+ updatedAt TEXT DEFAULT CURRENT_TIMESTAMP
12
+ );
13
+
4
14
  CREATE TABLE IF NOT EXISTS "users" (
5
15
  id TEXT PRIMARY KEY,
6
16
  email TEXT UNIQUE NOT NULL,
@@ -166,6 +176,7 @@ CREATE TABLE IF NOT EXISTS "node_assets" (
166
176
  FOREIGN KEY (assetId) REFERENCES assets(id) ON DELETE CASCADE
167
177
  );
168
178
 
179
+ CREATE INDEX IF NOT EXISTS idx_content_schemas_type ON content_schemas(type);
169
180
  CREATE INDEX IF NOT EXISTS idx_sessions_user ON sessions(userId);
170
181
  CREATE INDEX IF NOT EXISTS idx_sessions_expires ON sessions(expiresAt);
171
182
  CREATE INDEX IF NOT EXISTS idx_channels_visibility ON channels(isHidden);
@@ -191,3 +202,14 @@ CREATE INDEX IF NOT EXISTS idx_assets_parent ON assets(parentAssetId);
191
202
  INSERT OR IGNORE INTO channels (id, key, label, channelType, defaultLanguage, isHidden, dataJson) VALUES (1, 'default-channel', 'Default Channel', 'website', 'en', 0, '{}');
192
203
  INSERT OR IGNORE INTO trees (id, key, label, treeType, channelId, isHidden, dataJson) VALUES (1, 'default-tree', 'Default Navigation', 'navigation', 1, 0, '{}');
193
204
  INSERT OR IGNORE INTO channel_trees (channelId, treeId, key) VALUES (1, 1, 'main');
205
+
206
+
207
+ -- Native Columns
208
+ CREATE INDEX IF NOT EXISTS idx_content_nodes_slug ON content_nodes (slug);
209
+ CREATE INDEX IF NOT EXISTS idx_content_nodes_contentType ON content_nodes (contentType);
210
+ CREATE INDEX IF NOT EXISTS idx_content_nodes_updatedAt ON content_nodes (updatedAt);
211
+
212
+ -- JSON Custom Fields
213
+ CREATE INDEX IF NOT EXISTS idx_content_nodes_articleDate ON content_nodes (json_extract(dataJson, '$.articleDate'));
214
+ CREATE INDEX IF NOT EXISTS idx_content_nodes_startTime ON content_nodes (json_extract(dataJson, '$.startTime'));
215
+ CREATE INDEX IF NOT EXISTS idx_content_nodes_endTime ON content_nodes (json_extract(dataJson, '$.endTime'));