@beechcms/core 0.9.0 → 0.9.2
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/dist/dashboard-layout/content-view.d.ts +4 -4
- package/package.json +2 -2
- package/dist/automations-grammar-words.d.ts +0 -2
- package/dist/automations-grammar-words.d.ts.map +0 -1
- package/dist/automations-grammar-words.js +0 -8
- package/dist/automations.repository.interface.d.ts +0 -19
- package/dist/automations.repository.interface.d.ts.map +0 -1
- package/dist/automations.repository.interface.js +0 -3
- package/dist/automations.runner.interface.d.ts +0 -10
- package/dist/automations.runner.interface.d.ts.map +0 -1
- package/dist/automations.runner.interface.js +0 -3
- package/dist/automations.runner.stub.d.ts +0 -5
- package/dist/automations.runner.stub.d.ts.map +0 -1
- package/dist/automations.runner.stub.js +0 -7
- package/dist/automations.types.d.ts +0 -75
- package/dist/automations.types.d.ts.map +0 -1
- package/dist/automations.types.js +0 -3
- package/dist/clock.d.ts +0 -25
- package/dist/clock.d.ts.map +0 -1
- package/dist/clock.js +0 -11
- package/dist/content-scan.repository.d.ts +0 -9
- package/dist/content-scan.repository.d.ts.map +0 -1
- package/dist/content-scan.repository.js +0 -3
- package/dist/content.repository.d.ts +0 -247
- package/dist/content.repository.d.ts.map +0 -1
- package/dist/content.repository.js +0 -59
- package/dist/dashboard-layout/kanban/kanban-position.repository.d.ts +0 -19
- package/dist/dashboard-layout/kanban/kanban-position.repository.d.ts.map +0 -1
- package/dist/dashboard-layout/kanban/kanban-position.repository.js +0 -3
- package/dist/dashboard-layout.d.ts +0 -154
- package/dist/dashboard-layout.d.ts.map +0 -1
- package/dist/dashboard-layout.js +0 -186
- package/dist/dashboard-layout.repository.d.ts +0 -18
- package/dist/dashboard-layout.repository.d.ts.map +0 -1
- package/dist/dashboard-layout.repository.js +0 -3
- package/dist/dashboard-permissions.d.ts +0 -3
- package/dist/dashboard-permissions.d.ts.map +0 -1
- package/dist/dashboard-permissions.js +0 -11
- package/dist/dashboard-scopes.d.ts +0 -12
- package/dist/dashboard-scopes.d.ts.map +0 -1
- package/dist/dashboard-scopes.js +0 -30
- package/dist/define-seed.d.ts +0 -3
- package/dist/define-seed.d.ts.map +0 -1
- package/dist/define-seed.js +0 -5
- package/dist/demo-data.repository.d.ts +0 -5
- package/dist/demo-data.repository.d.ts.map +0 -1
- package/dist/demo-data.repository.js +0 -3
- package/dist/email.provider.d.ts +0 -32
- package/dist/email.provider.d.ts.map +0 -1
- package/dist/email.provider.js +0 -4
- package/dist/engine/ddl/seed-ddl-destructive.d.ts +0 -40
- package/dist/engine/ddl/seed-ddl-destructive.d.ts.map +0 -1
- package/dist/engine/ddl/seed-ddl-destructive.js +0 -149
- package/dist/engine/ddl.d.ts +0 -193
- package/dist/engine/ddl.d.ts.map +0 -1
- package/dist/engine/ddl.js +0 -518
- package/dist/engine/define-seed.d.ts +0 -3
- package/dist/engine/define-seed.d.ts.map +0 -1
- package/dist/engine/define-seed.js +0 -5
- package/dist/engine/introspection.d.ts +0 -101
- package/dist/engine/introspection.d.ts.map +0 -1
- package/dist/engine/introspection.js +0 -127
- package/dist/engine/localization.d.ts +0 -127
- package/dist/engine/localization.d.ts.map +0 -1
- package/dist/engine/localization.js +0 -212
- package/dist/engine/policies.d.ts +0 -58
- package/dist/engine/policies.d.ts.map +0 -1
- package/dist/engine/policies.js +0 -168
- package/dist/engine/privacy.service.d.ts +0 -65
- package/dist/engine/privacy.service.d.ts.map +0 -1
- package/dist/engine/privacy.service.js +0 -114
- package/dist/engine/query.d.ts +0 -23
- package/dist/engine/query.d.ts.map +0 -1
- package/dist/engine/query.js +0 -236
- package/dist/engine/relations.d.ts +0 -28
- package/dist/engine/relations.d.ts.map +0 -1
- package/dist/engine/relations.js +0 -25
- package/dist/engine/schema-fingerprint.d.ts +0 -73
- package/dist/engine/schema-fingerprint.d.ts.map +0 -1
- package/dist/engine/schema-fingerprint.js +0 -97
- package/dist/engine/schema-mutator.d.ts +0 -26
- package/dist/engine/schema-mutator.d.ts.map +0 -1
- package/dist/engine/schema-mutator.js +0 -3
- package/dist/engine/seed-ddl-destructive.d.ts +0 -40
- package/dist/engine/seed-ddl-destructive.d.ts.map +0 -1
- package/dist/engine/seed-ddl-destructive.js +0 -149
- package/dist/engine/seed-ddl.d.ts +0 -40
- package/dist/engine/seed-ddl.d.ts.map +0 -1
- package/dist/engine/seed-ddl.js +0 -100
- package/dist/engine/seed-registry.d.ts +0 -71
- package/dist/engine/seed-registry.d.ts.map +0 -1
- package/dist/engine/seed-registry.js +0 -167
- package/dist/engine/seed-types-generator.d.ts +0 -10
- package/dist/engine/seed-types-generator.d.ts.map +0 -1
- package/dist/engine/seed-types-generator.js +0 -89
- package/dist/engine/seed-validation.d.ts +0 -30
- package/dist/engine/seed-validation.d.ts.map +0 -1
- package/dist/engine/seed-validation.js +0 -319
- package/dist/engine/seeds.d.ts +0 -20
- package/dist/engine/seeds.d.ts.map +0 -1
- package/dist/engine/seeds.js +0 -21
- package/dist/engine/serialize.d.ts +0 -20
- package/dist/engine/serialize.d.ts.map +0 -1
- package/dist/engine/serialize.js +0 -160
- package/dist/engine.d.ts +0 -144
- package/dist/engine.d.ts.map +0 -1
- package/dist/engine.js +0 -741
- package/dist/file-types.d.ts +0 -13
- package/dist/file-types.d.ts.map +0 -1
- package/dist/file-types.js +0 -85
- package/dist/hooks.d.ts +0 -29
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js +0 -3
- package/dist/id-generator.d.ts +0 -26
- package/dist/id-generator.d.ts.map +0 -1
- package/dist/id-generator.js +0 -12
- package/dist/idempotency.repository.d.ts +0 -13
- package/dist/idempotency.repository.d.ts.map +0 -1
- package/dist/idempotency.repository.js +0 -3
- package/dist/kanban-position.repository.d.ts +0 -19
- package/dist/kanban-position.repository.d.ts.map +0 -1
- package/dist/kanban-position.repository.js +0 -3
- package/dist/kanban.d.ts +0 -75
- package/dist/kanban.d.ts.map +0 -1
- package/dist/kanban.js +0 -82
- package/dist/layout-permissions.d.ts +0 -3
- package/dist/layout-permissions.d.ts.map +0 -1
- package/dist/layout-permissions.js +0 -11
- package/dist/media.repository.d.ts +0 -61
- package/dist/media.repository.d.ts.map +0 -1
- package/dist/media.repository.js +0 -3
- package/dist/policies.d.ts +0 -10
- package/dist/policies.d.ts.map +0 -1
- package/dist/policies.js +0 -33
- package/dist/queue.interface.d.ts +0 -39
- package/dist/queue.interface.d.ts.map +0 -1
- package/dist/queue.interface.js +0 -3
- package/dist/queue.stub.d.ts +0 -6
- package/dist/queue.stub.d.ts.map +0 -1
- package/dist/queue.stub.js +0 -8
- package/dist/relations.d.ts +0 -28
- package/dist/relations.d.ts.map +0 -1
- package/dist/relations.js +0 -25
- package/dist/richtext-render.d.ts +0 -11
- package/dist/richtext-render.d.ts.map +0 -1
- package/dist/richtext-render.js +0 -87
- package/dist/richtext.d.ts +0 -11
- package/dist/richtext.d.ts.map +0 -1
- package/dist/richtext.js +0 -13
- package/dist/scheduler.interface.d.ts +0 -4
- package/dist/scheduler.interface.d.ts.map +0 -1
- package/dist/scheduler.interface.js +0 -3
- package/dist/scheduler.stub.d.ts +0 -5
- package/dist/scheduler.stub.d.ts.map +0 -1
- package/dist/scheduler.stub.js +0 -7
- package/dist/schema-mutator.d.ts +0 -26
- package/dist/schema-mutator.d.ts.map +0 -1
- package/dist/schema-mutator.js +0 -3
- package/dist/seed-ddl-destructive.d.ts +0 -40
- package/dist/seed-ddl-destructive.d.ts.map +0 -1
- package/dist/seed-ddl-destructive.js +0 -149
- package/dist/seed-ddl.d.ts +0 -40
- package/dist/seed-ddl.d.ts.map +0 -1
- package/dist/seed-ddl.js +0 -100
- package/dist/seed-layout.d.ts +0 -145
- package/dist/seed-layout.d.ts.map +0 -1
- package/dist/seed-layout.js +0 -192
- package/dist/seed-layout.repository.d.ts +0 -22
- package/dist/seed-layout.repository.d.ts.map +0 -1
- package/dist/seed-layout.repository.js +0 -3
- package/dist/seed-registry.d.ts +0 -71
- package/dist/seed-registry.d.ts.map +0 -1
- package/dist/seed-registry.js +0 -143
- package/dist/seed-types-generator.d.ts +0 -10
- package/dist/seed-types-generator.d.ts.map +0 -1
- package/dist/seed-types-generator.js +0 -86
- package/dist/seed-validation.d.ts +0 -23
- package/dist/seed-validation.d.ts.map +0 -1
- package/dist/seed-validation.js +0 -224
- package/dist/seed.repository.d.ts +0 -37
- package/dist/seed.repository.d.ts.map +0 -1
- package/dist/seed.repository.js +0 -3
- package/dist/seeds.d.ts +0 -20
- package/dist/seeds.d.ts.map +0 -1
- package/dist/seeds.js +0 -21
- package/dist/site-settings.repository.d.ts +0 -16
- package/dist/site-settings.repository.d.ts.map +0 -1
- package/dist/site-settings.repository.js +0 -3
- package/dist/slug-utils.d.ts +0 -18
- package/dist/slug-utils.d.ts.map +0 -1
- package/dist/slug-utils.js +0 -32
- package/dist/storage.d.ts +0 -46
- package/dist/storage.d.ts.map +0 -1
- package/dist/storage.js +0 -3
- package/dist/types.d.ts +0 -243
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/validation.d.ts +0 -50
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -660
- package/dist/webhook-validation.d.ts +0 -3
- package/dist/webhook-validation.d.ts.map +0 -1
- package/dist/webhook-validation.js +0 -6
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Branch } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Serializes a value for writing to the DB.
|
|
4
|
-
* boolean → 0/1 | date → Unix timestamp | json/tags/richtext/repeater → JSON string
|
|
5
|
-
*
|
|
6
|
-
* @param branch The branch definition.
|
|
7
|
-
* @param value The value to serialize.
|
|
8
|
-
* @returns The serialized DB value (string, number, or null).
|
|
9
|
-
*/
|
|
10
|
-
export declare function serializeForDb(branch: Branch, value: unknown): string | number | null;
|
|
11
|
-
/**
|
|
12
|
-
* Deserializes a value read from the DB to its API/JS representation.
|
|
13
|
-
* 0/1 → boolean | Unix timestamp → ISO 8601 | JSON string → object/array
|
|
14
|
-
*
|
|
15
|
-
* @param branch The branch definition.
|
|
16
|
-
* @param value The raw database value.
|
|
17
|
-
* @returns The deserialized value.
|
|
18
|
-
*/
|
|
19
|
-
export declare function deserializeFromDb(branch: Branch, value: unknown): unknown;
|
|
20
|
-
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/engine/serialize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,MAAM,EAOP,MAAM,YAAY,CAAC;AAmEpB;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAsCrF;AAGD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAmCzE"}
|
package/dist/engine/serialize.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if a branch represents a multiple asset list field.
|
|
3
|
-
*
|
|
4
|
-
* @param branch The branch definition.
|
|
5
|
-
* @returns True if it's an asset list, false otherwise.
|
|
6
|
-
*/
|
|
7
|
-
function isAssetListBranch(branch) {
|
|
8
|
-
return branch.type === 'file' && (branch.multiple === true || branch.format === 'asset-list');
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Normalizes an unknown value to a valid HTTP URL string, or null.
|
|
12
|
-
*
|
|
13
|
-
* @param value The value to normalize.
|
|
14
|
-
* @returns The normalized URL string, or null if invalid.
|
|
15
|
-
*/
|
|
16
|
-
function normalizeHttpUrl(value) {
|
|
17
|
-
if (typeof value !== 'string')
|
|
18
|
-
return null;
|
|
19
|
-
const cleaned = value.trim();
|
|
20
|
-
if (!cleaned)
|
|
21
|
-
return null;
|
|
22
|
-
try {
|
|
23
|
-
const parsed = new URL(cleaned);
|
|
24
|
-
return parsed.protocol.startsWith('http') ? cleaned : null;
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Safely parses a JSON string, falling back to the raw string on error.
|
|
32
|
-
*
|
|
33
|
-
* @param value The string to parse.
|
|
34
|
-
* @returns The parsed object, or the original string.
|
|
35
|
-
*/
|
|
36
|
-
function parseJsonSafe(value) {
|
|
37
|
-
try {
|
|
38
|
-
return JSON.parse(value);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Normalizes raw asset list values to a flat list of valid URL strings.
|
|
46
|
-
*
|
|
47
|
-
* @param rawValue The raw value (string, array, or object) to normalize.
|
|
48
|
-
* @returns An array of unique normalized URL strings.
|
|
49
|
-
*/
|
|
50
|
-
function normalizeAssetListValue(rawValue) {
|
|
51
|
-
const input = typeof rawValue === 'string' ? parseJsonSafe(rawValue) : rawValue;
|
|
52
|
-
const values = Array.isArray(input) ? input : [input];
|
|
53
|
-
const normalized = [];
|
|
54
|
-
for (const item of values) {
|
|
55
|
-
if (item == null)
|
|
56
|
-
continue;
|
|
57
|
-
const direct = normalizeHttpUrl(item);
|
|
58
|
-
if (direct) {
|
|
59
|
-
normalized.push(direct);
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (typeof item === 'object' && !Array.isArray(item)) {
|
|
63
|
-
const fromObj = normalizeHttpUrl(item.url);
|
|
64
|
-
if (fromObj)
|
|
65
|
-
normalized.push(fromObj);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return [...new Set(normalized)];
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Serializes a value for writing to the DB.
|
|
72
|
-
* boolean → 0/1 | date → Unix timestamp | json/tags/richtext/repeater → JSON string
|
|
73
|
-
*
|
|
74
|
-
* @param branch The branch definition.
|
|
75
|
-
* @param value The value to serialize.
|
|
76
|
-
* @returns The serialized DB value (string, number, or null).
|
|
77
|
-
*/
|
|
78
|
-
export function serializeForDb(branch, value) {
|
|
79
|
-
if (value === null || value === undefined)
|
|
80
|
-
return null;
|
|
81
|
-
switch (branch.type) {
|
|
82
|
-
case 'boolean':
|
|
83
|
-
return value ? 1 : 0;
|
|
84
|
-
case 'json':
|
|
85
|
-
case 'tags':
|
|
86
|
-
case 'richtext':
|
|
87
|
-
return typeof value === 'string' ? value : JSON.stringify(value);
|
|
88
|
-
case 'date': {
|
|
89
|
-
if (typeof value === 'number')
|
|
90
|
-
return value;
|
|
91
|
-
if (typeof value === 'string') {
|
|
92
|
-
const d = new Date(value);
|
|
93
|
-
if (Number.isNaN(d.getTime()))
|
|
94
|
-
return null;
|
|
95
|
-
if (branch.format === 'date') {
|
|
96
|
-
const midnight = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
97
|
-
return Math.floor(midnight / 1000);
|
|
98
|
-
}
|
|
99
|
-
return Math.floor(d.getTime() / 1000);
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
case 'file':
|
|
104
|
-
if (isAssetListBranch(branch)) {
|
|
105
|
-
return Array.isArray(value) ? JSON.stringify(value) : typeof value === 'string' ? value : null;
|
|
106
|
-
}
|
|
107
|
-
return typeof value === 'string' ? value : null;
|
|
108
|
-
case 'repeater':
|
|
109
|
-
return JSON.stringify(Array.isArray(value) ? value : []);
|
|
110
|
-
default:
|
|
111
|
-
return typeof value === 'string' ? value : typeof value === 'number' ? value : null;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Deserializes a value read from the DB to its API/JS representation.
|
|
116
|
-
* 0/1 → boolean | Unix timestamp → ISO 8601 | JSON string → object/array
|
|
117
|
-
*
|
|
118
|
-
* @param branch The branch definition.
|
|
119
|
-
* @param value The raw database value.
|
|
120
|
-
* @returns The deserialized value.
|
|
121
|
-
*/
|
|
122
|
-
export function deserializeFromDb(branch, value) {
|
|
123
|
-
if (branch.type === 'repeater') {
|
|
124
|
-
if (typeof value !== 'string' || value.length === 0)
|
|
125
|
-
return [];
|
|
126
|
-
const parsed = parseJsonSafe(value);
|
|
127
|
-
return Array.isArray(parsed) ? parsed : [];
|
|
128
|
-
}
|
|
129
|
-
if (value === null || value === undefined)
|
|
130
|
-
return null;
|
|
131
|
-
switch (branch.type) {
|
|
132
|
-
case 'boolean':
|
|
133
|
-
return value === 1 || value === true;
|
|
134
|
-
case 'json':
|
|
135
|
-
case 'tags':
|
|
136
|
-
case 'richtext': {
|
|
137
|
-
if (typeof value === 'string') {
|
|
138
|
-
try {
|
|
139
|
-
return JSON.parse(value);
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
return value;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return value;
|
|
146
|
-
}
|
|
147
|
-
case 'date': {
|
|
148
|
-
if (typeof value !== 'number')
|
|
149
|
-
return null;
|
|
150
|
-
const d = new Date(value * 1000);
|
|
151
|
-
return branch.format === 'date' ? d.toISOString().slice(0, 10) : d.toISOString();
|
|
152
|
-
}
|
|
153
|
-
case 'file':
|
|
154
|
-
if (isAssetListBranch(branch))
|
|
155
|
-
return normalizeAssetListValue(value);
|
|
156
|
-
return typeof value === 'string' ? value : null;
|
|
157
|
-
default:
|
|
158
|
-
return value;
|
|
159
|
-
}
|
|
160
|
-
}
|
package/dist/engine.d.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Botanical Engine: Schema Compiler + Query Builder.
|
|
3
|
-
*
|
|
4
|
-
* In v0.4.0 each Seed has a dedicated SQL table (`content_{slug}`) with
|
|
5
|
-
* real typed columns. This module generates the DDL and builds parameterized queries.
|
|
6
|
-
* It does not know about HTTP, auth, or UI — it's a pure TypeScript library.
|
|
7
|
-
*/
|
|
8
|
-
import type { Seed, Branch, SelectOptions, ParameterizedQuery } from './types.js';
|
|
9
|
-
export declare function indexableSearchBranches(seed: Seed): Branch[];
|
|
10
|
-
/**
|
|
11
|
-
* Generates `CREATE TABLE IF NOT EXISTS content_{slug}` with system columns
|
|
12
|
-
* + one column per Branch. Pure function: same Seed → same SQL.
|
|
13
|
-
*/
|
|
14
|
-
export declare function generateCreateTable(seed: Seed): string;
|
|
15
|
-
/**
|
|
16
|
-
* Generates the drafts table `content_{slug}_drafts` for Seeds with `allowDrafts: true`.
|
|
17
|
-
* All branch columns are nullable (drafts are partial).
|
|
18
|
-
* Returns null if the Seed does not have `allowDrafts: true`.
|
|
19
|
-
*/
|
|
20
|
-
export declare function generateDraftTable(seed: Seed): string | null;
|
|
21
|
-
/**
|
|
22
|
-
* Generates `ALTER TABLE content_{slug} ADD COLUMN {alias} {type}`.
|
|
23
|
-
* New columns are always nullable (SQLite limit on ALTER TABLE).
|
|
24
|
-
*/
|
|
25
|
-
export declare function generateAddColumn(seed: Seed, branch: Branch): string;
|
|
26
|
-
/**
|
|
27
|
-
* Generates B-tree indexes for status, created_at and every filterable Branch
|
|
28
|
-
* with an indexable type (text, number, date, boolean).
|
|
29
|
-
*/
|
|
30
|
-
export declare function generateIndexes(seed: Seed): string[];
|
|
31
|
-
/**
|
|
32
|
-
* Generates the FTS5 virtual table for indexable text/richtext Branches.
|
|
33
|
-
* Returns null if the Seed has no branches with search enabled.
|
|
34
|
-
*/
|
|
35
|
-
export declare function generateFtsTable(seed: Seed): string | null;
|
|
36
|
-
/**
|
|
37
|
-
* Generates the 3 SQLite triggers (insert/update/delete) that keep the FTS
|
|
38
|
-
* automatically synchronized — eliminates the need for manual syncFts.
|
|
39
|
-
* Returns an empty array if the Seed has no indexable branches.
|
|
40
|
-
*/
|
|
41
|
-
export declare function generateFtsTriggers(seed: Seed): string[];
|
|
42
|
-
/**
|
|
43
|
-
* Builds a parameterized SELECT on `content_{slug}`.
|
|
44
|
-
* Never uses json_extract — every column is a real column.
|
|
45
|
-
* Unknown columns in filters/orderBy are ignored (fail-closed).
|
|
46
|
-
*/
|
|
47
|
-
export declare function buildSelectQuery(seed: Seed, options?: SelectOptions): ParameterizedQuery;
|
|
48
|
-
export interface SchemaColumn {
|
|
49
|
-
name: string;
|
|
50
|
-
sqlType: 'TEXT' | 'REAL' | 'INTEGER';
|
|
51
|
-
notNull: boolean;
|
|
52
|
-
isPk: boolean;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Returns the list of expected columns for a Seed's table.
|
|
56
|
-
* Used by `beech seed:load --diff` to compare current vs expected schema.
|
|
57
|
-
*/
|
|
58
|
-
export declare function getExpectedColumns(seed: Seed): SchemaColumn[];
|
|
59
|
-
/**
|
|
60
|
-
* Serializes a value for writing to the DB.
|
|
61
|
-
* boolean → 0/1 | date → Unix timestamp | json/asset-list → JSON string
|
|
62
|
-
*/
|
|
63
|
-
export declare function serializeForDb(branch: Branch, value: unknown): string | number | null;
|
|
64
|
-
/**
|
|
65
|
-
* Returns the junction table name for a many-to-many relation branch.
|
|
66
|
-
* Format: `rel_<seedSlug>_<branchAlias>`.
|
|
67
|
-
*/
|
|
68
|
-
export declare function junctionTableName(seedSlug: string, branchAlias: string): string;
|
|
69
|
-
/**
|
|
70
|
-
* Generates `CREATE TABLE IF NOT EXISTS rel_<seed>_<alias>` for a multi-relation
|
|
71
|
-
* branch. The parent FK always cascades (parent lifecycle owns the edge);
|
|
72
|
-
* the target FK uses `branch.onDelete` (default CASCADE).
|
|
73
|
-
*
|
|
74
|
-
* @throws {Error} when called on a non-multi-relation branch
|
|
75
|
-
* @throws {Error} when `branch.targetSeed` is missing
|
|
76
|
-
*/
|
|
77
|
-
export declare function generateJunctionTable(seed: Seed, branch: Branch): string;
|
|
78
|
-
/**
|
|
79
|
-
* Generates the two B-tree indexes for a junction table:
|
|
80
|
-
* one on `parent_id` (list entries by parent) and one on `target_id`
|
|
81
|
-
* (cascade checks from target side).
|
|
82
|
-
*/
|
|
83
|
-
export declare function generateJunctionIndexes(seed: Seed, branch: Branch): string[];
|
|
84
|
-
/**
|
|
85
|
-
* Generates the drafts junction table `rel_<seed>_<alias>_drafts` for a
|
|
86
|
-
* many-to-many relation branch. Note: no FK on `target_id` — targets may be
|
|
87
|
-
* deleted between draft save and publish; the FK would be wrong here.
|
|
88
|
-
* Returns null when `seed.allowDrafts` is falsy.
|
|
89
|
-
*/
|
|
90
|
-
export declare function generateJunctionDraftTable(seed: Seed, branch: Branch): string | null;
|
|
91
|
-
/**
|
|
92
|
-
* Returns every `DROP TABLE IF EXISTS` needed to fully remove a content type:
|
|
93
|
-
* the main `content_{slug}` table, its `fts_{slug}` virtual table, the
|
|
94
|
-
* `content_{slug}_drafts` mirror (when drafts are enabled), and each
|
|
95
|
-
* multi-relation junction table `rel_{slug}_{alias}` (+ its `_drafts` mirror).
|
|
96
|
-
*
|
|
97
|
-
* FTS triggers reference the main table; dropping the main table also drops
|
|
98
|
-
* its triggers in SQLite, but we drop the FTS table explicitly so no orphaned
|
|
99
|
-
* virtual table survives. Order: junction (children) → drafts → fts → main.
|
|
100
|
-
*/
|
|
101
|
-
export declare function generateDropTable(seed: Seed): string[];
|
|
102
|
-
/**
|
|
103
|
-
* Returns the `DROP COLUMN` statements for removing a single field.
|
|
104
|
-
*
|
|
105
|
-
* - For a multi-relation branch (no column on the parent table) it drops the
|
|
106
|
-
* junction table `rel_{slug}_{alias}` (+ `_drafts`) instead.
|
|
107
|
-
* - For a normal branch it drops the column from `content_{slug}` and, when
|
|
108
|
-
* drafts are enabled, the mirror column from `content_{slug}_drafts`.
|
|
109
|
-
* - For an orphan column (no matching branch in the definition) it falls back
|
|
110
|
-
* to a plain `ALTER TABLE … DROP COLUMN`, never touching drafts.
|
|
111
|
-
*
|
|
112
|
-
* Callers must rebuild FTS separately (planFtsRebuild) when the dropped column
|
|
113
|
-
* was searchable, since SQLite cannot ALTER an fts5 table's columns.
|
|
114
|
-
*/
|
|
115
|
-
export declare function generateDropColumn(seed: Seed, alias: string): string[];
|
|
116
|
-
/**
|
|
117
|
-
* Returns the `RENAME COLUMN` statements for renaming a field's alias while
|
|
118
|
-
* keeping the stable `branch.id`. Renames the column on `content_{slug}` and,
|
|
119
|
-
* when drafts are enabled, the mirror column on `content_{slug}_drafts`.
|
|
120
|
-
*
|
|
121
|
-
* For a multi-relation branch the alias is part of the junction table name, so
|
|
122
|
-
* the junction table (+ `_drafts`) is renamed instead of a column.
|
|
123
|
-
*
|
|
124
|
-
* Callers must rebuild FTS separately (planFtsRebuild) when the renamed column
|
|
125
|
-
* was searchable.
|
|
126
|
-
*/
|
|
127
|
-
export declare function generateRenameColumn(seed: Seed, from: string, to: string): string[];
|
|
128
|
-
/**
|
|
129
|
-
* Returns the add/copy/drop/rename statements that change a column's SQL type
|
|
130
|
-
* in place, preserving data via `CAST`. This is the documented simpler
|
|
131
|
-
* alternative to SQLite's full 12-step table rebuild.
|
|
132
|
-
*
|
|
133
|
-
* The `branch` passed in is the *target* definition (already carrying the new
|
|
134
|
-
* `type`); its SQL type is read from BRANCH_TYPE_SQL. Multi-relation branches
|
|
135
|
-
* have no column to retype and are rejected. Mirrors the change onto the drafts
|
|
136
|
-
* table when drafts are enabled. Callers rebuild FTS separately when needed.
|
|
137
|
-
*/
|
|
138
|
-
export declare function generateRetypeColumn(seed: Seed, branch: Branch): string[];
|
|
139
|
-
/**
|
|
140
|
-
* Deserializes a value read from the DB for the API response.
|
|
141
|
-
* 0/1 → boolean | Unix timestamp → ISO 8601 | JSON string → object
|
|
142
|
-
*/
|
|
143
|
-
export declare function deserializeFromDb(branch: Branch, value: unknown): unknown;
|
|
144
|
-
//# sourceMappingURL=engine.d.ts.map
|
package/dist/engine.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,IAAI,EACJ,MAAM,EAKN,aAAa,EACb,kBAAkB,EACnB,MAAM,YAAY,CAAA;A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