@aphexcms/sqlite-adapter 0.1.0
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/LICENSE +21 -0
- package/README.md +125 -0
- package/dist/asset-adapter.d.ts +66 -0
- package/dist/asset-adapter.d.ts.map +1 -0
- package/dist/asset-adapter.js +303 -0
- package/dist/asset-adapter.js.map +1 -0
- package/dist/document-adapter.d.ts +94 -0
- package/dist/document-adapter.d.ts.map +1 -0
- package/dist/document-adapter.js +486 -0
- package/dist/document-adapter.js.map +1 -0
- package/dist/filter-parser.d.ts +36 -0
- package/dist/filter-parser.d.ts.map +1 -0
- package/dist/filter-parser.js +308 -0
- package/dist/filter-parser.js.map +1 -0
- package/dist/index.d.ts +273 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +611 -0
- package/dist/index.js.map +1 -0
- package/dist/organization-adapter.d.ts +38 -0
- package/dist/organization-adapter.d.ts.map +1 -0
- package/dist/organization-adapter.js +241 -0
- package/dist/organization-adapter.js.map +1 -0
- package/dist/reference-adapter.d.ts +56 -0
- package/dist/reference-adapter.d.ts.map +1 -0
- package/dist/reference-adapter.js +109 -0
- package/dist/reference-adapter.js.map +1 -0
- package/dist/roles-adapter.d.ts +19 -0
- package/dist/roles-adapter.d.ts.map +1 -0
- package/dist/roles-adapter.js +87 -0
- package/dist/roles-adapter.js.map +1 -0
- package/dist/schema-adapter.d.ts +23 -0
- package/dist/schema-adapter.d.ts.map +1 -0
- package/dist/schema-adapter.js +99 -0
- package/dist/schema-adapter.js.map +1 -0
- package/dist/schema.d.ts +3803 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +240 -0
- package/dist/schema.js.map +1 -0
- package/dist/user-adapter.d.ts +31 -0
- package/dist/user-adapter.d.ts.map +1 -0
- package/dist/user-adapter.js +69 -0
- package/dist/user-adapter.js.map +1 -0
- package/dist/utils/reference-resolver.d.ts +15 -0
- package/dist/utils/reference-resolver.d.ts.map +1 -0
- package/dist/utils/reference-resolver.js +80 -0
- package/dist/utils/reference-resolver.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
// SQLite filter parser - converts Where filters to Drizzle SQL conditions
|
|
2
|
+
// Handles JSON columns (draftData/publishedData) for document fields via json_extract().
|
|
3
|
+
// Dialect notes vs the PostgreSQL parser:
|
|
4
|
+
// - JSON paths use json_extract(col, '$."a"."b"') instead of ->/->>
|
|
5
|
+
// - JSON booleans are stored as 0/1, so boolean filters compare against integers
|
|
6
|
+
// - LIKE replaces ILIKE (SQLite's LIKE is case-insensitive for ASCII by default)
|
|
7
|
+
// - IN (...) replaces = ANY(...) since SQLite has no ANY/ALL
|
|
8
|
+
import { sql, eq, ne, gt, gte, lt, lte, inArray, notInArray, like, isNull, isNotNull, and as drizzleAnd, or as drizzleOr } from 'drizzle-orm';
|
|
9
|
+
/**
|
|
10
|
+
* JSON columns that contain document data
|
|
11
|
+
* These are NOT accessed as regular columns
|
|
12
|
+
*/
|
|
13
|
+
const JSON_DATA_COLUMNS = new Set(['draftData', 'publishedData']);
|
|
14
|
+
/**
|
|
15
|
+
* Build a SQLite JSON path string from dotted field parts.
|
|
16
|
+
* Each part is quoted so keys with dots/spaces/dashes resolve correctly:
|
|
17
|
+
* ['author', 'name'] -> '$."author"."name"'
|
|
18
|
+
*/
|
|
19
|
+
function jsonPath(pathParts) {
|
|
20
|
+
return '$' + pathParts.map((p) => `."${p.replace(/"/g, '""')}"`).join('');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse a Where clause into Drizzle SQL conditions
|
|
24
|
+
*
|
|
25
|
+
* @param where - The where filter object
|
|
26
|
+
* @param table - The Drizzle table object
|
|
27
|
+
* @param perspective - Which JSON column to query ('draft' or 'published')
|
|
28
|
+
* @returns SQL condition
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const condition = parseWhere(
|
|
33
|
+
* {
|
|
34
|
+
* status: { equals: 'published' },
|
|
35
|
+
* title: { contains: 'blog' }
|
|
36
|
+
* },
|
|
37
|
+
* documentsTable,
|
|
38
|
+
* 'draft'
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function parseWhere(where, table, // SQLiteTable type - use any for flexibility
|
|
43
|
+
perspective = 'draft') {
|
|
44
|
+
if (!where) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const conditions = [];
|
|
48
|
+
// Handle AND operator
|
|
49
|
+
if (where.and && Array.isArray(where.and)) {
|
|
50
|
+
const andConditions = where.and
|
|
51
|
+
.map((w) => parseWhere(w, table, perspective))
|
|
52
|
+
.filter((c) => c !== undefined);
|
|
53
|
+
if (andConditions.length > 0) {
|
|
54
|
+
conditions.push(drizzleAnd(...andConditions));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Handle OR operator
|
|
58
|
+
if (where.or && Array.isArray(where.or)) {
|
|
59
|
+
const orConditions = where.or
|
|
60
|
+
.map((w) => parseWhere(w, table, perspective))
|
|
61
|
+
.filter((c) => c !== undefined);
|
|
62
|
+
if (orConditions.length > 0) {
|
|
63
|
+
conditions.push(drizzleOr(...orConditions));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Handle field filters
|
|
67
|
+
for (const [field, filter] of Object.entries(where)) {
|
|
68
|
+
// Skip logical operators (already handled above)
|
|
69
|
+
if (field === 'and' || field === 'or') {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
// Parse the filter
|
|
73
|
+
const condition = parseFieldFilter(field, filter, table, perspective);
|
|
74
|
+
if (condition) {
|
|
75
|
+
conditions.push(condition);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Combine all conditions with AND
|
|
79
|
+
if (conditions.length === 0) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
if (conditions.length === 1) {
|
|
83
|
+
return conditions[0];
|
|
84
|
+
}
|
|
85
|
+
return drizzleAnd(...conditions);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parse a single field filter into a Drizzle SQL condition
|
|
89
|
+
*/
|
|
90
|
+
function parseFieldFilter(fieldPath, filter, table, perspective) {
|
|
91
|
+
// Handle _meta.* paths - strip _meta prefix to access actual column
|
|
92
|
+
// e.g., '_meta.createdBy' -> 'createdBy'
|
|
93
|
+
let actualFieldPath = fieldPath;
|
|
94
|
+
if (fieldPath.startsWith('_meta.')) {
|
|
95
|
+
actualFieldPath = fieldPath.substring(6); // Remove '_meta.'
|
|
96
|
+
}
|
|
97
|
+
// Determine if this is a top-level column or JSON field
|
|
98
|
+
// Check if the field exists on the table and is not a JSON data column
|
|
99
|
+
const isTopLevelColumn = actualFieldPath in table && !JSON_DATA_COLUMNS.has(actualFieldPath);
|
|
100
|
+
// If filter is a direct value (not an object), treat as equals
|
|
101
|
+
if (filter === null || filter === undefined || typeof filter !== 'object') {
|
|
102
|
+
if (isTopLevelColumn) {
|
|
103
|
+
const column = table[actualFieldPath];
|
|
104
|
+
return column ? eq(column, filter) : undefined;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return buildJsonCondition(fieldPath, 'equals', filter, table, perspective);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// If it's an array, treat as 'in' operation
|
|
111
|
+
if (Array.isArray(filter)) {
|
|
112
|
+
if (isTopLevelColumn) {
|
|
113
|
+
const column = table[actualFieldPath];
|
|
114
|
+
return column ? inArray(column, filter) : undefined;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
return buildJsonCondition(fieldPath, 'in', filter, table, perspective);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Otherwise, it should be a FieldFilter object
|
|
121
|
+
const fieldFilter = filter;
|
|
122
|
+
const conditions = [];
|
|
123
|
+
// Process each operator
|
|
124
|
+
for (const [operator, value] of Object.entries(fieldFilter)) {
|
|
125
|
+
if (value === undefined)
|
|
126
|
+
continue;
|
|
127
|
+
const condition = isTopLevelColumn
|
|
128
|
+
? buildColumnCondition(actualFieldPath, operator, value, table)
|
|
129
|
+
: buildJsonCondition(fieldPath, operator, value, table, perspective);
|
|
130
|
+
if (condition) {
|
|
131
|
+
conditions.push(condition);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Combine all conditions for this field with AND
|
|
135
|
+
if (conditions.length === 0) {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
if (conditions.length === 1) {
|
|
139
|
+
return conditions[0];
|
|
140
|
+
}
|
|
141
|
+
return drizzleAnd(...conditions);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Build a condition for a top-level column
|
|
145
|
+
*/
|
|
146
|
+
function buildColumnCondition(fieldPath, operator, value, table) {
|
|
147
|
+
const column = table[fieldPath];
|
|
148
|
+
if (!column) {
|
|
149
|
+
console.warn(`[Filter Parser] Column not found: ${fieldPath}`);
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
switch (operator) {
|
|
153
|
+
case 'equals':
|
|
154
|
+
return eq(column, value);
|
|
155
|
+
case 'not_equals':
|
|
156
|
+
return ne(column, value);
|
|
157
|
+
case 'in':
|
|
158
|
+
return inArray(column, value);
|
|
159
|
+
case 'not_in':
|
|
160
|
+
return notInArray(column, value);
|
|
161
|
+
case 'exists':
|
|
162
|
+
return value ? isNotNull(column) : isNull(column);
|
|
163
|
+
case 'greater_than':
|
|
164
|
+
return gt(column, value);
|
|
165
|
+
case 'greater_than_equal':
|
|
166
|
+
return gte(column, value);
|
|
167
|
+
case 'less_than':
|
|
168
|
+
return lt(column, value);
|
|
169
|
+
case 'less_than_equal':
|
|
170
|
+
return lte(column, value);
|
|
171
|
+
case 'like':
|
|
172
|
+
return like(column, value);
|
|
173
|
+
case 'contains':
|
|
174
|
+
// SQLite LIKE is case-insensitive for ASCII (parity with Postgres ILIKE)
|
|
175
|
+
return like(column, `%${value}%`);
|
|
176
|
+
case 'starts_with':
|
|
177
|
+
return like(column, `${value}%`);
|
|
178
|
+
case 'ends_with':
|
|
179
|
+
return like(column, `%${value}`);
|
|
180
|
+
default:
|
|
181
|
+
console.warn(`[Filter Parser] Unknown operator: ${operator}`);
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Build a condition for a field inside a JSON document column
|
|
187
|
+
* Uses SQLite's json_extract()
|
|
188
|
+
*/
|
|
189
|
+
function buildJsonCondition(fieldPath, operator, value, table, perspective) {
|
|
190
|
+
// Get the JSON column (draftData or publishedData)
|
|
191
|
+
const jsonColumnName = perspective === 'draft' ? 'draftData' : 'publishedData';
|
|
192
|
+
const jsonColumn = table[jsonColumnName];
|
|
193
|
+
if (!jsonColumn) {
|
|
194
|
+
console.warn(`[Filter Parser] JSON column not found: ${jsonColumnName}`);
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
// Split field path for nested access (e.g., 'author.name' -> ['author', 'name'])
|
|
198
|
+
const path = jsonPath(fieldPath.split('.'));
|
|
199
|
+
// json_extract returns SQL NULL for missing keys, native types for JSON
|
|
200
|
+
// scalars (integers for booleans, numbers for numerics, text for strings)
|
|
201
|
+
const extract = sql `json_extract(${jsonColumn}, ${path})`;
|
|
202
|
+
switch (operator) {
|
|
203
|
+
case 'equals':
|
|
204
|
+
if (typeof value === 'boolean') {
|
|
205
|
+
// JSON booleans surface as 0/1 integers
|
|
206
|
+
return sql `${extract} = ${value ? 1 : 0}`;
|
|
207
|
+
}
|
|
208
|
+
return sql `${extract} = ${value}`;
|
|
209
|
+
case 'not_equals':
|
|
210
|
+
if (typeof value === 'boolean') {
|
|
211
|
+
return sql `${extract} != ${value ? 1 : 0}`;
|
|
212
|
+
}
|
|
213
|
+
return sql `${extract} != ${value}`;
|
|
214
|
+
case 'in': {
|
|
215
|
+
// SQLite has no = ANY(...) — expand to IN (...)
|
|
216
|
+
const values = value;
|
|
217
|
+
if (!Array.isArray(values) || values.length === 0) {
|
|
218
|
+
return sql `1 = 0`; // nothing can match an empty set
|
|
219
|
+
}
|
|
220
|
+
return sql `${extract} IN (${sql.join(values.map((v) => sql `${v}`), sql `, `)})`;
|
|
221
|
+
}
|
|
222
|
+
case 'not_in': {
|
|
223
|
+
const values = value;
|
|
224
|
+
if (!Array.isArray(values) || values.length === 0) {
|
|
225
|
+
return undefined; // != ALL(empty) is always true — no constraint
|
|
226
|
+
}
|
|
227
|
+
return sql `${extract} NOT IN (${sql.join(values.map((v) => sql `${v}`), sql `, `)})`;
|
|
228
|
+
}
|
|
229
|
+
case 'exists':
|
|
230
|
+
// json_extract returns NULL for missing keys (and JSON null — same as pg's -> NULL check)
|
|
231
|
+
if (value) {
|
|
232
|
+
return sql `${extract} IS NOT NULL`;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
return sql `${extract} IS NULL`;
|
|
236
|
+
}
|
|
237
|
+
case 'greater_than':
|
|
238
|
+
return sql `CAST(${extract} AS REAL) > ${value}`;
|
|
239
|
+
case 'greater_than_equal':
|
|
240
|
+
return sql `CAST(${extract} AS REAL) >= ${value}`;
|
|
241
|
+
case 'less_than':
|
|
242
|
+
return sql `CAST(${extract} AS REAL) < ${value}`;
|
|
243
|
+
case 'less_than_equal':
|
|
244
|
+
return sql `CAST(${extract} AS REAL) <= ${value}`;
|
|
245
|
+
case 'like':
|
|
246
|
+
return sql `${extract} LIKE ${value}`;
|
|
247
|
+
case 'contains':
|
|
248
|
+
// SQLite LIKE is ASCII case-insensitive (parity with Postgres ILIKE)
|
|
249
|
+
return sql `${extract} LIKE ${'%' + value + '%'}`;
|
|
250
|
+
case 'starts_with':
|
|
251
|
+
return sql `${extract} LIKE ${value + '%'}`;
|
|
252
|
+
case 'ends_with':
|
|
253
|
+
return sql `${extract} LIKE ${'%' + value}`;
|
|
254
|
+
default:
|
|
255
|
+
console.warn(`[Filter Parser] Unknown operator for JSON: ${operator}`);
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Parse a sort string or array into Drizzle order by clauses
|
|
261
|
+
*
|
|
262
|
+
* @param sort - Sort string or array of sort strings
|
|
263
|
+
* - Format: 'field' (ascending) or '-field' (descending)
|
|
264
|
+
* - Example: '-publishedAt' or ['title', '-createdAt']
|
|
265
|
+
* @param table - The Drizzle table object
|
|
266
|
+
* @param perspective - Which JSON column to query for non-column fields
|
|
267
|
+
* @returns Array of SQL order by clauses
|
|
268
|
+
*/
|
|
269
|
+
export function parseSort(sort, table, perspective = 'draft') {
|
|
270
|
+
if (!sort) {
|
|
271
|
+
return [];
|
|
272
|
+
}
|
|
273
|
+
const sortArray = Array.isArray(sort) ? sort : [sort];
|
|
274
|
+
const orderBy = [];
|
|
275
|
+
for (const sortField of sortArray) {
|
|
276
|
+
const trimmed = sortField.trim();
|
|
277
|
+
if (!trimmed)
|
|
278
|
+
continue;
|
|
279
|
+
// Check if descending (starts with -)
|
|
280
|
+
const descending = trimmed.startsWith('-');
|
|
281
|
+
const fieldName = descending ? trimmed.substring(1) : trimmed;
|
|
282
|
+
// Handle _meta.* paths - strip _meta prefix
|
|
283
|
+
let actualFieldName = fieldName;
|
|
284
|
+
if (fieldName.startsWith('_meta.')) {
|
|
285
|
+
actualFieldName = fieldName.substring(6);
|
|
286
|
+
}
|
|
287
|
+
// Check if top-level column or JSON field
|
|
288
|
+
const isTopLevelColumn = actualFieldName in table && !JSON_DATA_COLUMNS.has(actualFieldName);
|
|
289
|
+
if (isTopLevelColumn) {
|
|
290
|
+
const column = table[actualFieldName];
|
|
291
|
+
if (column) {
|
|
292
|
+
orderBy.push(descending ? sql `${column} DESC` : sql `${column} ASC`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
// JSON field
|
|
297
|
+
const jsonColumnName = perspective === 'draft' ? 'draftData' : 'publishedData';
|
|
298
|
+
const jsonColumn = table[jsonColumnName];
|
|
299
|
+
if (jsonColumn) {
|
|
300
|
+
const path = jsonPath(fieldName.split('.'));
|
|
301
|
+
const extract = sql `json_extract(${jsonColumn}, ${path})`;
|
|
302
|
+
orderBy.push(descending ? sql `${extract} DESC` : sql `${extract} ASC`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return orderBy;
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=filter-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-parser.js","sourceRoot":"","sources":["../src/filter-parser.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yFAAyF;AACzF,0CAA0C;AAC1C,oEAAoE;AACpE,iFAAiF;AACjF,iFAAiF;AACjF,6DAA6D;AAC7D,OAAO,EAEN,GAAG,EACH,EAAE,EACF,EAAE,EACF,EAAE,EACF,GAAG,EACH,EAAE,EACF,GAAG,EACH,OAAO,EACP,UAAU,EACV,IAAI,EACJ,MAAM,EACN,SAAS,EACT,GAAG,IAAI,UAAU,EACjB,EAAE,IAAI,SAAS,EACf,MAAM,aAAa,CAAC;AAGrB;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;AAElE;;;;GAIG;AACH,SAAS,QAAQ,CAAC,SAAmB;IACpC,OAAO,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,UAAU,CACzB,KAAwB,EACxB,KAAU,EAAE,6CAA6C;AACzD,cAAqC,OAAO;IAE5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,UAAU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G,CAAC,CAAC,CAAC;gBAC5C,MAAM,OAAO,GAAG,GAAG,CAAA,gBAAgB,UAAU,KAAK,IAAI,GAAG,CAAC;gBAC1D,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAA,GAAG,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA,GAAG,OAAO,MAAM,CAAC,CAAC;YACvE,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { type Client } from '@libsql/client';
|
|
2
|
+
import { drizzle } from 'drizzle-orm/libsql';
|
|
3
|
+
import type { DatabaseAdapter, DatabaseProvider, FindOptions, AssetFilters, NewOrganizationMember, SchemaType } from '@aphexcms/cms-core/server';
|
|
4
|
+
import type { Capability, NewRole } from '@aphexcms/cms-core';
|
|
5
|
+
import type { CMSSchema } from './schema.js';
|
|
6
|
+
/**
|
|
7
|
+
* Combined SQLite adapter that implements the full DatabaseAdapter interface
|
|
8
|
+
* Composes document, asset, user profile, schema, and organization adapters
|
|
9
|
+
*/
|
|
10
|
+
export declare class SQLiteAdapter implements DatabaseAdapter {
|
|
11
|
+
private db;
|
|
12
|
+
private tables;
|
|
13
|
+
private documentAdapter;
|
|
14
|
+
private assetAdapter;
|
|
15
|
+
private userProfileAdapter;
|
|
16
|
+
private schemaAdapter;
|
|
17
|
+
private organizationAdapter;
|
|
18
|
+
private rolesAdapter;
|
|
19
|
+
private referenceAdapter;
|
|
20
|
+
readonly hierarchyEnabled: boolean;
|
|
21
|
+
constructor(config: {
|
|
22
|
+
db: ReturnType<typeof drizzle>;
|
|
23
|
+
tables: CMSSchema;
|
|
24
|
+
multiTenancy?: {
|
|
25
|
+
enableHierarchy?: boolean;
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
replaceReferencesFor(organizationId: string, referencerId: string, refIds: string[]): Promise<void>;
|
|
29
|
+
findBackReferences(organizationId: string, refId: string): Promise<{
|
|
30
|
+
id: string;
|
|
31
|
+
type: string;
|
|
32
|
+
status: string | null;
|
|
33
|
+
}[]>;
|
|
34
|
+
findBackReferencesForMany(organizationId: string, refIds: string[]): Promise<{
|
|
35
|
+
id: string;
|
|
36
|
+
type: string;
|
|
37
|
+
status: string | null;
|
|
38
|
+
refId: string;
|
|
39
|
+
}[]>;
|
|
40
|
+
hasAnyReferences(organizationId: string): Promise<boolean>;
|
|
41
|
+
bulkInsertReferences(rows: Array<{
|
|
42
|
+
organizationId: string;
|
|
43
|
+
referencerId: string;
|
|
44
|
+
refId: string;
|
|
45
|
+
}>): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* List all documents for an org with just the minimal fields the
|
|
48
|
+
* references backfill needs. Single query, no per-type filtering —
|
|
49
|
+
* the backfill walks data via the schema-aware walker which already
|
|
50
|
+
* resolves the schema by `type`.
|
|
51
|
+
*/
|
|
52
|
+
listAllDocsForOrg(organizationId: string): Promise<Array<{
|
|
53
|
+
id: string;
|
|
54
|
+
type: string;
|
|
55
|
+
data: unknown;
|
|
56
|
+
}>>;
|
|
57
|
+
listRoles(organizationId: string): Promise<import("@aphexcms/cms-core").Role[]>;
|
|
58
|
+
findRoleByName(organizationId: string, name: string): Promise<import("@aphexcms/cms-core").Role | null>;
|
|
59
|
+
createRole(data: NewRole): Promise<import("@aphexcms/cms-core").Role>;
|
|
60
|
+
updateRole(organizationId: string, name: string, data: {
|
|
61
|
+
description?: string | null;
|
|
62
|
+
capabilities?: Capability[];
|
|
63
|
+
}): Promise<import("@aphexcms/cms-core").Role | null>;
|
|
64
|
+
deleteRole(organizationId: string, name: string): Promise<boolean>;
|
|
65
|
+
seedBuiltinRoles(organizationId: string): Promise<void>;
|
|
66
|
+
createDocument(data: any): Promise<import("@aphexcms/cms-core").Document>;
|
|
67
|
+
updateDocDraft(organizationId: string, id: string, data: any, updatedBy?: string): Promise<import("@aphexcms/cms-core").Document | null>;
|
|
68
|
+
deleteDocById(organizationId: string, id: string): Promise<boolean>;
|
|
69
|
+
publishDoc(organizationId: string, id: string): Promise<import("@aphexcms/cms-core").Document | null>;
|
|
70
|
+
unpublishDoc(organizationId: string, id: string): Promise<import("@aphexcms/cms-core").Document | null>;
|
|
71
|
+
countDocsByType(organizationId: string, type: string): Promise<number>;
|
|
72
|
+
getDocCountsByType(organizationId: string): Promise<Record<string, number>>;
|
|
73
|
+
createAsset(data: any): Promise<import("@aphexcms/cms-core").Asset>;
|
|
74
|
+
findAssetById(organizationId: string, id: string): Promise<import("@aphexcms/cms-core").Asset | null>;
|
|
75
|
+
findAssetByIdGlobal(id: string): Promise<import("@aphexcms/cms-core").Asset | null>;
|
|
76
|
+
findAssets(organizationId: string, filters?: any): Promise<import("@aphexcms/cms-core").Asset[]>;
|
|
77
|
+
updateAsset(organizationId: string, id: string, data: any): Promise<import("@aphexcms/cms-core").Asset | null>;
|
|
78
|
+
deleteAsset(organizationId: string, id: string): Promise<boolean>;
|
|
79
|
+
countAssets(organizationId: string, filters?: AssetFilters): Promise<number>;
|
|
80
|
+
countAssetsByType(organizationId: string): Promise<Record<string, number>>;
|
|
81
|
+
getTotalAssetsSize(organizationId: string): Promise<number>;
|
|
82
|
+
findManyDocAdvanced(organizationId: string, collectionName: string, options?: FindOptions): Promise<import("@aphexcms/cms-core").FindResult<import("@aphexcms/cms-core").Document>>;
|
|
83
|
+
findByDocIdAdvanced(organizationId: string, id: string, options?: Partial<FindOptions>): Promise<import("@aphexcms/cms-core").Document | null>;
|
|
84
|
+
countDocuments(organizationId: string, collectionName: string, where?: any): Promise<number>;
|
|
85
|
+
findManyAssetsAdvanced(organizationId: string, options?: any): Promise<import("@aphexcms/cms-core").FindResult<import("@aphexcms/cms-core").Asset>>;
|
|
86
|
+
findAssetByIdAdvanced(organizationId: string, id: string): Promise<import("@aphexcms/cms-core").Asset | null>;
|
|
87
|
+
countAssetsAdvanced(organizationId: string, where?: any): Promise<number>;
|
|
88
|
+
createUserProfile(data: any): Promise<import("@aphexcms/cms-core").UserProfile>;
|
|
89
|
+
findUserProfileById(userId: string): Promise<import("@aphexcms/cms-core").UserProfile | null>;
|
|
90
|
+
deleteUserProfile(userId: string): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Check if any user profiles exist (for detecting first user)
|
|
93
|
+
*/
|
|
94
|
+
hasAnyUserProfiles(): Promise<boolean>;
|
|
95
|
+
registerSchemaType(schemaType: SchemaType): Promise<void>;
|
|
96
|
+
getSchemaType(name: string): Promise<SchemaType | null>;
|
|
97
|
+
listDocumentTypes(): Promise<Array<{
|
|
98
|
+
name: string;
|
|
99
|
+
title: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
}>>;
|
|
102
|
+
listObjectTypes(): Promise<Array<{
|
|
103
|
+
name: string;
|
|
104
|
+
title: string;
|
|
105
|
+
description?: string;
|
|
106
|
+
}>>;
|
|
107
|
+
listSchemas(): Promise<SchemaType[]>;
|
|
108
|
+
deleteSchemaType(name: string): Promise<void>;
|
|
109
|
+
createOrganization(data: any): Promise<import("@aphexcms/cms-core").Organization>;
|
|
110
|
+
findAllOrganizations(): Promise<import("@aphexcms/cms-core").Organization[]>;
|
|
111
|
+
findOrganizationById(id: string): Promise<import("@aphexcms/cms-core").Organization | null>;
|
|
112
|
+
findOrganizationBySlug(slug: string): Promise<import("@aphexcms/cms-core").Organization | null>;
|
|
113
|
+
updateOrganization(id: string, data: any): Promise<import("@aphexcms/cms-core").Organization | null>;
|
|
114
|
+
deleteOrganization(id: string): Promise<boolean>;
|
|
115
|
+
addMember(data: NewOrganizationMember): Promise<import("@aphexcms/cms-core").OrganizationMember>;
|
|
116
|
+
removeMember(organizationId: string, userId: string): Promise<boolean>;
|
|
117
|
+
removeAllMembers(organizationId: string): Promise<boolean>;
|
|
118
|
+
updateMemberRole(organizationId: string, userId: string, role: string): Promise<import("@aphexcms/cms-core").OrganizationMember | null>;
|
|
119
|
+
findUserMembership(userId: string, organizationId: string): Promise<import("@aphexcms/cms-core").OrganizationMember | null>;
|
|
120
|
+
findUserOrganizations(userId: string): Promise<import("@aphexcms/cms-core").OrganizationMembership[]>;
|
|
121
|
+
findOrganizationMembers(organizationId: string): Promise<import("@aphexcms/cms-core").OrganizationMember[]>;
|
|
122
|
+
createInvitation(data: any): Promise<import("@aphexcms/cms-core").Invitation>;
|
|
123
|
+
findInvitationByToken(token: string): Promise<import("@aphexcms/cms-core").Invitation | null>;
|
|
124
|
+
findOrganizationInvitations(organizationId: string): Promise<import("@aphexcms/cms-core").Invitation[]>;
|
|
125
|
+
findInvitationsByEmail(email: string): Promise<import("@aphexcms/cms-core").Invitation[]>;
|
|
126
|
+
acceptInvitation(token: string, userId: string): Promise<import("@aphexcms/cms-core").OrganizationMember>;
|
|
127
|
+
deleteInvitation(id: string, organizationId?: string): Promise<boolean>;
|
|
128
|
+
removeAllInvitations(organizationId: string): Promise<boolean>;
|
|
129
|
+
cleanupExpiredInvitations(): Promise<number>;
|
|
130
|
+
updateUserSession(userId: string, organizationId: string): Promise<void>;
|
|
131
|
+
findUserSession(userId: string): Promise<import("@aphexcms/cms-core").UserSession | null>;
|
|
132
|
+
deleteUserSession(userId: string): Promise<boolean>;
|
|
133
|
+
updateUserPreferences(userId: string, preferences: {
|
|
134
|
+
includeChildOrganizations?: boolean;
|
|
135
|
+
}): Promise<void>;
|
|
136
|
+
getInstanceSettings(): Promise<Record<string, any> | {
|
|
137
|
+
allowUserOrgCreation: boolean;
|
|
138
|
+
}>;
|
|
139
|
+
updateInstanceSettings(settings: Record<string, any>): Promise<Record<string, any>>;
|
|
140
|
+
/**
|
|
141
|
+
* Execute a function within organization context.
|
|
142
|
+
*
|
|
143
|
+
* SQLite has no RLS, so there is no database-level context to set — org isolation
|
|
144
|
+
* comes from the WHERE clauses in every query (the same mechanism that isolates
|
|
145
|
+
* tenants on pooled Postgres, where the owner connection bypasses RLS). This is a
|
|
146
|
+
* passthrough kept for interface compatibility.
|
|
147
|
+
*/
|
|
148
|
+
withOrgContext<T>(_organizationId: string, fn: () => Promise<T>, _options?: {
|
|
149
|
+
overrideAccess?: boolean;
|
|
150
|
+
userId?: string;
|
|
151
|
+
userRole?: string;
|
|
152
|
+
}): Promise<T>;
|
|
153
|
+
/**
|
|
154
|
+
* Get all child organizations for a given parent organization
|
|
155
|
+
* Used for parent-child hierarchy access control
|
|
156
|
+
* @param parentOrganizationId - The parent organization ID
|
|
157
|
+
* @returns Array of child organization IDs
|
|
158
|
+
*/
|
|
159
|
+
getChildOrganizations(parentOrganizationId: string): Promise<string[]>;
|
|
160
|
+
findDocumentsReferencingAsset(organizationId: string, assetId: string, knownTypes?: string[]): Promise<{
|
|
161
|
+
documentId: string;
|
|
162
|
+
type: string;
|
|
163
|
+
title: string;
|
|
164
|
+
status: string | null;
|
|
165
|
+
}[]>;
|
|
166
|
+
countDocumentReferencesForAssets(organizationId: string, assetIds: string[], knownTypes?: string[]): Promise<Record<string, number>>;
|
|
167
|
+
clearAssetFromPublishedData(organizationId: string, assetId: string): Promise<number>;
|
|
168
|
+
createDocumentVersion(data: {
|
|
169
|
+
documentId: string;
|
|
170
|
+
organizationId: string;
|
|
171
|
+
eventType: 'draft' | 'publish';
|
|
172
|
+
data: any;
|
|
173
|
+
createdBy?: string | null;
|
|
174
|
+
}): Promise<import("@aphexcms/cms-core").DocumentVersion | null>;
|
|
175
|
+
listDocumentVersions(organizationId: string, documentId: string, options?: {
|
|
176
|
+
limit?: number;
|
|
177
|
+
offset?: number;
|
|
178
|
+
}): Promise<import("@aphexcms/cms-core").DocumentVersionList>;
|
|
179
|
+
getDocumentVersion(organizationId: string, documentId: string, versionNumber: number): Promise<import("@aphexcms/cms-core").DocumentVersion | null>;
|
|
180
|
+
deleteDocumentVersions(documentId: string, versionIds: string[]): Promise<void>;
|
|
181
|
+
withTransaction<T>(fn: (adapter: any) => Promise<T>): Promise<T>;
|
|
182
|
+
disconnect(): Promise<void>;
|
|
183
|
+
isHealthy(): Promise<boolean>;
|
|
184
|
+
}
|
|
185
|
+
export { SQLiteDocumentAdapter } from './document-adapter.js';
|
|
186
|
+
export { SQLiteAssetAdapter } from './asset-adapter.js';
|
|
187
|
+
export { cmsSchema } from './schema.js';
|
|
188
|
+
export type { CMSSchema } from './schema.js';
|
|
189
|
+
export { documents, assets, schemaTypes, instanceSettings, documentStatuses, schemaTypeKinds } from './schema.js';
|
|
190
|
+
export type { Document, NewDocument, Asset, NewAsset, SchemaType, NewSchemaType } from '@aphexcms/cms-core/server';
|
|
191
|
+
/**
|
|
192
|
+
* Tuning knobs for a local SQLite file. The defaults suit a web workload: WAL lets
|
|
193
|
+
* reads proceed while a write is in flight (the default journal mode blocks them),
|
|
194
|
+
* synchronous=NORMAL is the safe pairing with WAL, and busy_timeout waits instead of
|
|
195
|
+
* throwing SQLITE_BUSY under concurrent requests. libsql enables foreign_keys itself.
|
|
196
|
+
*
|
|
197
|
+
* Note: except journal_mode=WAL (persisted in the database file), these are
|
|
198
|
+
* per-connection settings applied to the client's main connection. libsql opens a
|
|
199
|
+
* fresh connection per interactive transaction, which gets SQLite defaults.
|
|
200
|
+
*/
|
|
201
|
+
export interface SQLitePragmaOptions {
|
|
202
|
+
/** PRAGMA journal_mode (default: 'WAL') */
|
|
203
|
+
journalMode?: 'WAL' | 'DELETE' | 'TRUNCATE' | 'PERSIST' | 'MEMORY';
|
|
204
|
+
/** PRAGMA synchronous (default: 'NORMAL') */
|
|
205
|
+
synchronous?: 'OFF' | 'NORMAL' | 'FULL' | 'EXTRA';
|
|
206
|
+
/** PRAGMA busy_timeout in milliseconds (default: 5000) */
|
|
207
|
+
busyTimeout?: number;
|
|
208
|
+
/** PRAGMA cache_size — positive: pages; negative: KiB (e.g. -65536 = 64MiB page cache). SQLite default is ~2MiB. Unset: left at default. */
|
|
209
|
+
cacheSize?: number;
|
|
210
|
+
/** PRAGMA mmap_size in bytes — memory-mapped I/O for faster reads. Unset: left at 0 (off). */
|
|
211
|
+
mmapSize?: number;
|
|
212
|
+
/** PRAGMA temp_store — where temp tables/indices live during sorts. Unset: left at default. */
|
|
213
|
+
tempStore?: 'DEFAULT' | 'FILE' | 'MEMORY';
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Apply the recommended SQLite pragmas (WAL, synchronous=NORMAL, busy_timeout) to a
|
|
217
|
+
* client you created yourself, with optional overrides/additions via `options`.
|
|
218
|
+
* Pass the database `url` so non-file targets (in-memory, Turso) are skipped
|
|
219
|
+
* automatically; omit it to apply unconditionally.
|
|
220
|
+
*
|
|
221
|
+
* The `url` path of `createSQLiteProvider` does this for you — this helper is for the
|
|
222
|
+
* `client` path, where the adapter won't touch a connection it didn't create.
|
|
223
|
+
*/
|
|
224
|
+
export declare function applyRecommendedPragmas(client: Client, url?: string, options?: SQLitePragmaOptions): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* SQLite-specific configuration options
|
|
227
|
+
*/
|
|
228
|
+
export interface SQLiteConfig {
|
|
229
|
+
/** Pre-initialized libsql client (recommended — lets the app share it with better-auth/drizzle) */
|
|
230
|
+
client?: Client;
|
|
231
|
+
/** Database URL if not providing a client: `file:path/to.db`, `file::memory:`, or `libsql://...` (Turso) */
|
|
232
|
+
url?: string;
|
|
233
|
+
/** Auth token for remote (Turso) databases */
|
|
234
|
+
authToken?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Pragmas to apply when the adapter creates the client from `url`.
|
|
237
|
+
* - `true` / omitted — the recommended set (WAL, synchronous=NORMAL, busy_timeout=5000),
|
|
238
|
+
* local `file:` databases only.
|
|
239
|
+
* - an options object — the recommended set with overrides/additions, e.g.
|
|
240
|
+
* `{ cacheSize: -65536, mmapSize: 268435456, tempStore: 'MEMORY' }`; local `file:` only.
|
|
241
|
+
* - `false` — none; manage pragmas yourself.
|
|
242
|
+
* - a string — your own pragma statements (e.g. `'PRAGMA busy_timeout=10000;'`),
|
|
243
|
+
* run verbatim instead of the recommended set, regardless of url.
|
|
244
|
+
* Ignored on the `client` path — the adapter doesn't touch a connection it didn't
|
|
245
|
+
* create; use `applyRecommendedPragmas` there.
|
|
246
|
+
*/
|
|
247
|
+
pragmas?: boolean | string | SQLitePragmaOptions;
|
|
248
|
+
/** Multi-tenancy configuration */
|
|
249
|
+
multiTenancy?: {
|
|
250
|
+
/** Enable parent-child organization hierarchy (default: true) */
|
|
251
|
+
enableHierarchy?: boolean;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Create a SQLite database provider with type-safe configuration
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* // With pre-initialized client (recommended)
|
|
259
|
+
* const provider = createSQLiteProvider({ client: myLibsqlClient });
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* // Local file database
|
|
263
|
+
* const provider = createSQLiteProvider({ url: 'file:.aphex/data.db' });
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* // Turso-hosted
|
|
267
|
+
* const provider = createSQLiteProvider({
|
|
268
|
+
* url: 'libsql://mydb-me.turso.io',
|
|
269
|
+
* authToken: process.env.DATABASE_AUTH_TOKEN
|
|
270
|
+
* });
|
|
271
|
+
*/
|
|
272
|
+
export declare function createSQLiteProvider(config: SQLiteConfig): DatabaseProvider;
|
|
273
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQ9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,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