@g9tm/lynxcontrols-sqlite 1.4.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/README.md +12 -0
- package/contract/cases.json +463 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/codecs/codecs.d.ts +68 -0
- package/dist/codecs/codecs.d.ts.map +1 -0
- package/dist/codecs/codecs.js +201 -0
- package/dist/codecs/codecs.js.map +1 -0
- package/dist/contract/run-contract.d.ts +94 -0
- package/dist/contract/run-contract.d.ts.map +1 -0
- package/dist/contract/run-contract.js +159 -0
- package/dist/contract/run-contract.js.map +1 -0
- package/dist/driver/types.d.ts +87 -0
- package/dist/driver/types.d.ts.map +1 -0
- package/dist/driver/types.js +14 -0
- package/dist/driver/types.js.map +1 -0
- package/dist/errors.d.ts +39 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +57 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/query/builders.d.ts +216 -0
- package/dist/query/builders.d.ts.map +1 -0
- package/dist/query/builders.js +490 -0
- package/dist/query/builders.js.map +1 -0
- package/dist/query/compile.d.ts +42 -0
- package/dist/query/compile.d.ts.map +1 -0
- package/dist/query/compile.js +307 -0
- package/dist/query/compile.js.map +1 -0
- package/dist/query/expr.d.ts +201 -0
- package/dist/query/expr.d.ts.map +1 -0
- package/dist/query/expr.js +247 -0
- package/dist/query/expr.js.map +1 -0
- package/dist/repo/audit.d.ts +19 -0
- package/dist/repo/audit.d.ts.map +1 -0
- package/dist/repo/audit.js +36 -0
- package/dist/repo/audit.js.map +1 -0
- package/dist/repo/repository.d.ts +233 -0
- package/dist/repo/repository.d.ts.map +1 -0
- package/dist/repo/repository.js +715 -0
- package/dist/repo/repository.js.map +1 -0
- package/dist/schema/columns.d.ts +115 -0
- package/dist/schema/columns.d.ts.map +1 -0
- package/dist/schema/columns.js +112 -0
- package/dist/schema/columns.js.map +1 -0
- package/dist/schema/entity.d.ts +135 -0
- package/dist/schema/entity.d.ts.map +1 -0
- package/dist/schema/entity.js +227 -0
- package/dist/schema/entity.js.map +1 -0
- package/dist/schema/policies.d.ts +89 -0
- package/dist/schema/policies.d.ts.map +1 -0
- package/dist/schema/policies.js +54 -0
- package/dist/schema/policies.js.map +1 -0
- package/dist/session/ambient.d.ts +32 -0
- package/dist/session/ambient.d.ts.map +1 -0
- package/dist/session/ambient.js +28 -0
- package/dist/session/ambient.js.map +1 -0
- package/dist/session/cache.d.ts +62 -0
- package/dist/session/cache.d.ts.map +1 -0
- package/dist/session/cache.js +239 -0
- package/dist/session/cache.js.map +1 -0
- package/dist/session/database.d.ts +221 -0
- package/dist/session/database.d.ts.map +1 -0
- package/dist/session/database.js +430 -0
- package/dist/session/database.js.map +1 -0
- package/dist/session/locator.d.ts +33 -0
- package/dist/session/locator.d.ts.map +1 -0
- package/dist/session/locator.js +39 -0
- package/dist/session/locator.js.map +1 -0
- package/dist/session/migrations.d.ts +75 -0
- package/dist/session/migrations.d.ts.map +1 -0
- package/dist/session/migrations.js +88 -0
- package/dist/session/migrations.js.map +1 -0
- package/dist/session/mutex.d.ts +7 -0
- package/dist/session/mutex.d.ts.map +1 -0
- package/dist/session/mutex.js +27 -0
- package/dist/session/mutex.js.map +1 -0
- package/dist/session/rows.d.ts +17 -0
- package/dist/session/rows.d.ts.map +1 -0
- package/dist/session/rows.js +52 -0
- package/dist/session/rows.js.map +1 -0
- package/dist/session/schema-setup.d.ts +21 -0
- package/dist/session/schema-setup.d.ts.map +1 -0
- package/dist/session/schema-setup.js +227 -0
- package/dist/session/schema-setup.js.map +1 -0
- package/dist/session/scope.d.ts +117 -0
- package/dist/session/scope.d.ts.map +1 -0
- package/dist/session/scope.js +233 -0
- package/dist/session/scope.js.map +1 -0
- package/dist/session/write-hooks.d.ts +84 -0
- package/dist/session/write-hooks.d.ts.map +1 -0
- package/dist/session/write-hooks.js +55 -0
- package/dist/session/write-hooks.js.map +1 -0
- package/dist/values/ids.d.ts +46 -0
- package/dist/values/ids.d.ts.map +1 -0
- package/dist/values/ids.js +84 -0
- package/dist/values/ids.js.map +1 -0
- package/dist/values/int64.d.ts +33 -0
- package/dist/values/int64.d.ts.map +1 -0
- package/dist/values/int64.js +105 -0
- package/dist/values/int64.js.map +1 -0
- package/dist/values/local-date-time.d.ts +61 -0
- package/dist/values/local-date-time.d.ts.map +1 -0
- package/dist/values/local-date-time.js +122 -0
- package/dist/values/local-date-time.js.map +1 -0
- package/dist/values/sql-value.d.ts +36 -0
- package/dist/values/sql-value.d.ts.map +1 -0
- package/dist/values/sql-value.js +70 -0
- package/dist/values/sql-value.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { G9SqliteError } from "../errors.js";
|
|
2
|
+
const EXPR_KINDS = new Set([
|
|
3
|
+
'col',
|
|
4
|
+
'value',
|
|
5
|
+
'raw',
|
|
6
|
+
'compare',
|
|
7
|
+
'arith',
|
|
8
|
+
'logic',
|
|
9
|
+
'not',
|
|
10
|
+
'negate',
|
|
11
|
+
'isNull',
|
|
12
|
+
'in',
|
|
13
|
+
'like',
|
|
14
|
+
'between',
|
|
15
|
+
'fn',
|
|
16
|
+
'countWhen'
|
|
17
|
+
]);
|
|
18
|
+
function isExpr(value) {
|
|
19
|
+
return 'object' == typeof value && null !== value && !(value instanceof ArrayBuffer) && EXPR_KINDS.has(value.kind) && ('col' !== value.kind || 'object' == typeof value.scope);
|
|
20
|
+
}
|
|
21
|
+
function isColumnRef(value) {
|
|
22
|
+
return isExpr(value) && 'col' === value.kind;
|
|
23
|
+
}
|
|
24
|
+
function toExpr(operand) {
|
|
25
|
+
if (isExpr(operand)) return operand;
|
|
26
|
+
if (void 0 === operand) throw new G9SqliteError('misuse', 'undefined is not a SQL value; use null for SQL NULL.');
|
|
27
|
+
return {
|
|
28
|
+
kind: 'value',
|
|
29
|
+
value: operand
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function compare(op) {
|
|
33
|
+
return function(left, right) {
|
|
34
|
+
return {
|
|
35
|
+
kind: 'compare',
|
|
36
|
+
op,
|
|
37
|
+
left: toExpr(left),
|
|
38
|
+
right: toExpr(right)
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const eq = compare('eq');
|
|
43
|
+
const ne = compare('ne');
|
|
44
|
+
const sqlEq = compare('sqlEq');
|
|
45
|
+
const sqlNe = compare('sqlNe');
|
|
46
|
+
const lt = compare('lt');
|
|
47
|
+
const lte = compare('lte');
|
|
48
|
+
const gt = compare('gt');
|
|
49
|
+
const gte = compare('gte');
|
|
50
|
+
const isSame = compare('is');
|
|
51
|
+
const isDifferent = compare('isNot');
|
|
52
|
+
function colEq(left, right) {
|
|
53
|
+
return {
|
|
54
|
+
kind: 'compare',
|
|
55
|
+
op: 'sqlEq',
|
|
56
|
+
left,
|
|
57
|
+
right
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function isNull(operand) {
|
|
61
|
+
return {
|
|
62
|
+
kind: 'isNull',
|
|
63
|
+
operand: toExpr(operand),
|
|
64
|
+
negated: false
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function isNotNull(operand) {
|
|
68
|
+
return {
|
|
69
|
+
kind: 'isNull',
|
|
70
|
+
operand: toExpr(operand),
|
|
71
|
+
negated: true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function notNullOrEmpty(operand) {
|
|
75
|
+
const e = toExpr(operand);
|
|
76
|
+
return and(isNotNull(e), {
|
|
77
|
+
kind: 'compare',
|
|
78
|
+
op: 'sqlNe',
|
|
79
|
+
left: e,
|
|
80
|
+
right: {
|
|
81
|
+
kind: 'value',
|
|
82
|
+
value: ''
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function isNullOrEmpty(operand) {
|
|
87
|
+
const e = toExpr(operand);
|
|
88
|
+
return or(isNull(e), {
|
|
89
|
+
kind: 'compare',
|
|
90
|
+
op: 'sqlEq',
|
|
91
|
+
left: e,
|
|
92
|
+
right: {
|
|
93
|
+
kind: 'value',
|
|
94
|
+
value: ''
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function inList(operand, values) {
|
|
99
|
+
return {
|
|
100
|
+
kind: 'in',
|
|
101
|
+
operand: toExpr(operand),
|
|
102
|
+
values: Array.from(values),
|
|
103
|
+
negated: false
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function notInList(operand, values) {
|
|
107
|
+
return {
|
|
108
|
+
kind: 'in',
|
|
109
|
+
operand: toExpr(operand),
|
|
110
|
+
values: Array.from(values),
|
|
111
|
+
negated: true
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function escapeLike(text) {
|
|
115
|
+
return text.replace(/\\/g, '\\\\').replace(/%/g, '\\%').replace(/_/g, '\\_');
|
|
116
|
+
}
|
|
117
|
+
function like(operand, pattern) {
|
|
118
|
+
return {
|
|
119
|
+
kind: 'like',
|
|
120
|
+
operand: toExpr(operand),
|
|
121
|
+
pattern,
|
|
122
|
+
escape: false
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function contains(operand, fragment) {
|
|
126
|
+
return {
|
|
127
|
+
kind: 'like',
|
|
128
|
+
operand: toExpr(operand),
|
|
129
|
+
pattern: `%${escapeLike(fragment)}%`,
|
|
130
|
+
escape: true
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function startsWith(operand, prefix) {
|
|
134
|
+
return {
|
|
135
|
+
kind: 'like',
|
|
136
|
+
operand: toExpr(operand),
|
|
137
|
+
pattern: `${escapeLike(prefix)}%`,
|
|
138
|
+
escape: true
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function endsWith(operand, suffix) {
|
|
142
|
+
return {
|
|
143
|
+
kind: 'like',
|
|
144
|
+
operand: toExpr(operand),
|
|
145
|
+
pattern: `%${escapeLike(suffix)}`,
|
|
146
|
+
escape: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function between(operand, low, high) {
|
|
150
|
+
return {
|
|
151
|
+
kind: 'between',
|
|
152
|
+
operand: toExpr(operand),
|
|
153
|
+
low: toExpr(low),
|
|
154
|
+
high: toExpr(high)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function flatten(op, items) {
|
|
158
|
+
const out = [];
|
|
159
|
+
for (const item of items)if (item) if ('logic' === item.kind && item.op === op) out.push(...item.items);
|
|
160
|
+
else out.push(item);
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
function and(...items) {
|
|
164
|
+
const flat = flatten('AND', items);
|
|
165
|
+
if (0 === flat.length) throw new G9SqliteError('misuse', 'and() needs at least one predicate.');
|
|
166
|
+
return 1 === flat.length ? flat[0] : {
|
|
167
|
+
kind: 'logic',
|
|
168
|
+
op: 'AND',
|
|
169
|
+
items: flat
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function or(...items) {
|
|
173
|
+
const flat = flatten('OR', items);
|
|
174
|
+
if (0 === flat.length) throw new G9SqliteError('misuse', 'or() needs at least one predicate.');
|
|
175
|
+
return 1 === flat.length ? flat[0] : {
|
|
176
|
+
kind: 'logic',
|
|
177
|
+
op: 'OR',
|
|
178
|
+
items: flat
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function not(operand) {
|
|
182
|
+
return {
|
|
183
|
+
kind: 'not',
|
|
184
|
+
operand
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const arith = (op)=>(left, right)=>({
|
|
188
|
+
kind: 'arith',
|
|
189
|
+
op,
|
|
190
|
+
left: toExpr(left),
|
|
191
|
+
right: toExpr(right)
|
|
192
|
+
});
|
|
193
|
+
const add = arith('+');
|
|
194
|
+
const sub = arith('-');
|
|
195
|
+
const mul = arith('*');
|
|
196
|
+
const div = arith('/');
|
|
197
|
+
const mod = arith('%');
|
|
198
|
+
function negate(operand) {
|
|
199
|
+
return {
|
|
200
|
+
kind: 'negate',
|
|
201
|
+
operand: toExpr(operand)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function fn(name, ...args) {
|
|
205
|
+
return {
|
|
206
|
+
kind: 'fn',
|
|
207
|
+
name,
|
|
208
|
+
args: args.map(toExpr)
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function count(operand) {
|
|
212
|
+
return void 0 === operand ? {
|
|
213
|
+
kind: 'raw',
|
|
214
|
+
sql: 'COUNT(*)',
|
|
215
|
+
params: []
|
|
216
|
+
} : fn('COUNT', operand);
|
|
217
|
+
}
|
|
218
|
+
function countWhen(condition) {
|
|
219
|
+
return {
|
|
220
|
+
kind: 'countWhen',
|
|
221
|
+
condition
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const sum = (operand)=>fn('SUM', operand);
|
|
225
|
+
const avg = (operand)=>fn('AVG', operand);
|
|
226
|
+
const min = (operand)=>fn('MIN', operand);
|
|
227
|
+
const max = (operand)=>fn('MAX', operand);
|
|
228
|
+
const coalesce = (primary, fallback)=>fn('COALESCE', primary, fallback);
|
|
229
|
+
const lower = (operand)=>fn('LOWER', operand);
|
|
230
|
+
const upper = (operand)=>fn('UPPER', operand);
|
|
231
|
+
const expr_length = (operand)=>fn('LENGTH', operand);
|
|
232
|
+
function raw(sql, ...params) {
|
|
233
|
+
return {
|
|
234
|
+
kind: 'raw',
|
|
235
|
+
sql,
|
|
236
|
+
params
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function expr_value(v) {
|
|
240
|
+
return toExpr(v);
|
|
241
|
+
}
|
|
242
|
+
function codecOf(expr) {
|
|
243
|
+
return 'col' === expr.kind ? expr.spec.codec : void 0;
|
|
244
|
+
}
|
|
245
|
+
export { add, and, avg, between, coalesce, codecOf, colEq, contains, count, countWhen, div, endsWith, eq, expr_length as length, expr_value as value, gt, gte, inList, isColumnRef, isDifferent, isExpr, isNotNull, isNull, isNullOrEmpty, isSame, like, lower, lt, lte, max, min, mod, mul, ne, negate, not, notInList, notNullOrEmpty, or, raw, sqlEq, sqlNe, startsWith, sub, sum, toExpr, upper };
|
|
246
|
+
|
|
247
|
+
//# sourceMappingURL=expr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query/expr.js","sources":["../../src/query/expr.ts"],"sourcesContent":["import type { G9Codec } from '../codecs/codecs';\nimport { G9SqliteError } from '../errors';\nimport type { G9ColumnSpec } from '../schema/columns';\nimport type { G9SqlValue } from '../values/sql-value';\n\n/**\n * A reference to one column of one entity occurrence in a query. Predicates receive an object of these\n * (`(x) => eq(x.parentId, parent)`); the compiler turns it into a quoted, alias-qualified column.\n */\nexport interface G9ColumnRef<T = unknown> {\n readonly kind: 'col';\n /** Which entity occurrence (root, or a joined table) this column belongs to. */\n readonly scope: G9QueryScope;\n readonly property: string;\n readonly column: string;\n readonly spec: G9ColumnSpec;\n /** @internal type witness. */\n readonly __type?: T;\n}\n\n/** One entity occurrence in a query (the root table or a join). */\nexport interface G9QueryScope {\n readonly table: string;\n readonly entityName: string;\n /** Distinguishes two occurrences of the same table (self-joins). */\n readonly alias: string | undefined;\n}\n\n/** A SQL expression tree node. Built with the operators below; compiled by the query compiler. */\nexport type G9Expr =\n | G9ColumnRef\n | { readonly kind: 'value'; readonly value: unknown }\n | { readonly kind: 'raw'; readonly sql: string; readonly params: readonly unknown[] }\n | { readonly kind: 'compare'; readonly op: G9CompareOp; readonly left: G9Expr; readonly right: G9Expr }\n | { readonly kind: 'arith'; readonly op: '+' | '-' | '*' | '/' | '%'; readonly left: G9Expr; readonly right: G9Expr }\n | { readonly kind: 'logic'; readonly op: 'AND' | 'OR'; readonly items: readonly G9Expr[] }\n | { readonly kind: 'not'; readonly operand: G9Expr }\n | { readonly kind: 'negate'; readonly operand: G9Expr }\n | { readonly kind: 'isNull'; readonly operand: G9Expr; readonly negated: boolean }\n | { readonly kind: 'in'; readonly operand: G9Expr; readonly values: readonly unknown[]; readonly negated: boolean }\n | { readonly kind: 'like'; readonly operand: G9Expr; readonly pattern: string; readonly escape: boolean }\n | { readonly kind: 'between'; readonly operand: G9Expr; readonly low: G9Expr; readonly high: G9Expr }\n | { readonly kind: 'fn'; readonly name: G9FunctionName; readonly args: readonly G9Expr[] }\n | { readonly kind: 'countWhen'; readonly condition: G9Expr };\n\n/**\n * `eq`/`ne` carry C# null semantics (MAUI's builder); `sqlEq`/`sqlNe` are plain SQL; `is`/`isNot` are SQLite's\n * null-safe `IS` / `IS NOT`.\n */\nexport type G9CompareOp = 'eq' | 'ne' | 'sqlEq' | 'sqlNe' | 'lt' | 'lte' | 'gt' | 'gte' | 'is' | 'isNot';\n\n/** The SQL functions the query builder can emit. */\nexport type G9FunctionName = 'COUNT' | 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'COALESCE' | 'LOWER' | 'UPPER' | 'LENGTH';\n\n/** Anything an operator accepts: an expression, a column, or a plain value bound as a parameter. */\nexport type G9Operand<T = unknown> = G9Expr | G9ColumnRef<T> | T | null;\n\n/** A boolean-valued expression (a predicate). */\nexport type G9Predicate = G9Expr;\n\nconst EXPR_KINDS = new Set([\n 'col',\n 'value',\n 'raw',\n 'compare',\n 'arith',\n 'logic',\n 'not',\n 'negate',\n 'isNull',\n 'in',\n 'like',\n 'between',\n 'fn',\n 'countWhen',\n]);\n\n/** `true` for a {@link G9Expr} node (as opposed to a plain value). */\nexport function isExpr(value: unknown): value is G9Expr {\n return (\n typeof value === 'object' &&\n value !== null &&\n !(value instanceof ArrayBuffer) &&\n EXPR_KINDS.has((value as { kind?: unknown }).kind as string) &&\n // A G9LocalDateTime or a JSON value never has these exact shapes; columns carry a scope.\n ((value as { kind: string }).kind !== 'col' || typeof (value as { scope?: unknown }).scope === 'object')\n );\n}\n\n/** `true` for a column reference. */\nexport function isColumnRef(value: unknown): value is G9ColumnRef {\n return isExpr(value) && value.kind === 'col';\n}\n\n/** Wraps a plain value as a bound parameter; expressions pass through. */\nexport function toExpr(operand: unknown): G9Expr {\n if (isExpr(operand)) return operand;\n if (operand === undefined) {\n throw new G9SqliteError('misuse', 'undefined is not a SQL value; use null for SQL NULL.');\n }\n return { kind: 'value', value: operand };\n}\n\nfunction compare(op: G9CompareOp) {\n return function compareWith<T>(left: G9Operand<T>, right: G9Operand<T>): G9Predicate {\n return { kind: 'compare', op, left: toExpr(left), right: toExpr(right) };\n };\n}\n\n/**\n * C# `==`: `col = ?`, or `col IS NULL` when the value is null (a captured null too). Two columns compare with plain\n * `=` (MAUI left join conditions untouched). Two values use `IS`.\n */\nexport const eq = compare('eq');\n/**\n * C# `!=`: `(col <> ? OR col IS NULL)` — rows whose column is NULL are kept, as C# would — or `col IS NOT NULL` for a\n * null value. Two columns compare with plain `<>`.\n */\nexport const ne = compare('ne');\n/** Plain SQL `=` (NULL never matches). */\nexport const sqlEq = compare('sqlEq');\n/** Plain SQL `<>`: rows with NULL in the column are NOT returned (unlike {@link ne}). */\nexport const sqlNe = compare('sqlNe');\n/** SQL `<` (NULL never matches). */\nexport const lt = compare('lt');\n/** SQL `<=` (NULL never matches). */\nexport const lte = compare('lte');\n/** SQL `>` (NULL never matches). */\nexport const gt = compare('gt');\n/** SQL `>=` (NULL never matches). */\nexport const gte = compare('gte');\n/** SQLite null-safe equality `a IS b` (NULL IS NULL is true). */\nexport const isSame = compare('is');\n/** SQLite null-safe inequality `a IS NOT b`. */\nexport const isDifferent = compare('isNot');\n\n/** Column-to-column equality, emitted as plain `a = b` exactly as MAUI did for `x.A == x.B` (NULLs do not match). */\nexport function colEq<T>(left: G9ColumnRef<T> | G9Expr, right: G9ColumnRef<T> | G9Expr): G9Predicate {\n return { kind: 'compare', op: 'sqlEq', left, right };\n}\n\n/** `col IS NULL`. */\nexport function isNull(operand: G9Operand): G9Predicate {\n return { kind: 'isNull', operand: toExpr(operand), negated: false };\n}\n\n/** `col IS NOT NULL`. */\nexport function isNotNull(operand: G9Operand): G9Predicate {\n return { kind: 'isNull', operand: toExpr(operand), negated: true };\n}\n\n/** MAUI idiom `x.Code != null && x.Code != \"\"`: `col IS NOT NULL AND col <> ''`. */\nexport function notNullOrEmpty(operand: G9Operand<string>): G9Predicate {\n const e = toExpr(operand);\n return and(isNotNull(e), { kind: 'compare', op: 'sqlNe', left: e, right: { kind: 'value', value: '' } });\n}\n\n/** C# `string.IsNullOrEmpty(x.Code)`: `(col IS NULL OR col = '')`. */\nexport function isNullOrEmpty(operand: G9Operand<string>): G9Predicate {\n const e = toExpr(operand);\n return or(isNull(e), { kind: 'compare', op: 'sqlEq', left: e, right: { kind: 'value', value: '' } });\n}\n\n/**\n * C# `list.Contains(x.Col)`: `col IN (?, …)`. An empty list matches nothing (`0 = 1`). A list containing `null`\n * also matches NULL rows (`… OR col IS NULL`), the C# meaning. More values than the placeholder budget travel as\n * one JSON parameter through `json_each` (MAUI, 16 000).\n */\nexport function inList<T>(operand: G9Operand<T>, values: Iterable<T | null>): G9Predicate {\n return { kind: 'in', operand: toExpr(operand), values: Array.from(values), negated: false };\n}\n\n/**\n * C# `!list.Contains(x.Col)`, emitted as MAUI did: `NOT (col IN (…))`, so — exactly like the MAUI query — rows\n * whose column is NULL are not returned. A `null` in the list is handled explicitly (`col IS NOT NULL AND NOT …`)\n * instead of falling into SQL's `NOT IN (…, NULL)` trap that returns nothing. An empty list matches every row.\n */\nexport function notInList<T>(operand: G9Operand<T>, values: Iterable<T | null>): G9Predicate {\n return { kind: 'in', operand: toExpr(operand), values: Array.from(values), negated: true };\n}\n\nfunction escapeLike(text: string): string {\n return text.replace(/\\\\/g, '\\\\\\\\').replace(/%/g, '\\\\%').replace(/_/g, '\\\\_');\n}\n\n/** Raw `LIKE` with a caller pattern (`%`/`_` are wildcards; no escape clause). */\nexport function like(operand: G9Operand<string>, pattern: string): G9Predicate {\n return { kind: 'like', operand: toExpr(operand), pattern, escape: false };\n}\n\n/** C# `x.Name.Contains(s)`: `LIKE '%s%' ESCAPE '\\'` with `%`, `_`, `\\` in `s` escaped. */\nexport function contains(operand: G9Operand<string>, fragment: string): G9Predicate {\n return { kind: 'like', operand: toExpr(operand), pattern: `%${escapeLike(fragment)}%`, escape: true };\n}\n\n/** C# `StartsWith`: `LIKE 's%' ESCAPE '\\'`. */\nexport function startsWith(operand: G9Operand<string>, prefix: string): G9Predicate {\n return { kind: 'like', operand: toExpr(operand), pattern: `${escapeLike(prefix)}%`, escape: true };\n}\n\n/** C# `EndsWith`: `LIKE '%s' ESCAPE '\\'`. */\nexport function endsWith(operand: G9Operand<string>, suffix: string): G9Predicate {\n return { kind: 'like', operand: toExpr(operand), pattern: `%${escapeLike(suffix)}`, escape: true };\n}\n\n/** `col BETWEEN low AND high` (inclusive). */\nexport function between<T>(operand: G9Operand<T>, low: G9Operand<T>, high: G9Operand<T>): G9Predicate {\n return { kind: 'between', operand: toExpr(operand), low: toExpr(low), high: toExpr(high) };\n}\n\nfunction flatten(op: 'AND' | 'OR', items: readonly (G9Predicate | null | undefined | false)[]): G9Expr[] {\n const out: G9Expr[] = [];\n for (const item of items) {\n if (!item) continue;\n if (item.kind === 'logic' && item.op === op) out.push(...item.items);\n else out.push(item);\n }\n return out;\n}\n\n/** Logical AND of the given predicates (falsy entries are skipped, so conditional parts read naturally). */\nexport function and(...items: (G9Predicate | null | undefined | false)[]): G9Predicate {\n const flat = flatten('AND', items);\n if (flat.length === 0) throw new G9SqliteError('misuse', 'and() needs at least one predicate.');\n return flat.length === 1 ? (flat[0] as G9Expr) : { kind: 'logic', op: 'AND', items: flat };\n}\n\n/** Logical OR of the given predicates (falsy entries are skipped). */\nexport function or(...items: (G9Predicate | null | undefined | false)[]): G9Predicate {\n const flat = flatten('OR', items);\n if (flat.length === 0) throw new G9SqliteError('misuse', 'or() needs at least one predicate.');\n return flat.length === 1 ? (flat[0] as G9Expr) : { kind: 'logic', op: 'OR', items: flat };\n}\n\n/** C# `!`: `NOT (…)`; for a boolean column, MAUI's `col = 0`. */\nexport function not(operand: G9Predicate | G9ColumnRef<boolean>): G9Predicate {\n return { kind: 'not', operand };\n}\n\nconst arith =\n (op: '+' | '-' | '*' | '/' | '%') =>\n (left: G9Operand<number>, right: G9Operand<number>): G9Expr => ({\n kind: 'arith',\n op,\n left: toExpr(left),\n right: toExpr(right),\n });\n\n/** Arithmetic (always parenthesised in SQL, so the tree's grouping survives). */\nexport const add = arith('+');\n/** Arithmetic `-` (parenthesised). */\nexport const sub = arith('-');\n/** Arithmetic `*` (parenthesised). */\nexport const mul = arith('*');\n/** Arithmetic `/` (parenthesised). */\nexport const div = arith('/');\n/** Arithmetic `%` (parenthesised). */\nexport const mod = arith('%');\n\n/** Unary minus `-(…)`. */\nexport function negate(operand: G9Operand<number>): G9Expr {\n return { kind: 'negate', operand: toExpr(operand) };\n}\n\nfunction fn(name: G9FunctionName, ...args: G9Operand[]): G9Expr {\n return { kind: 'fn', name, args: args.map(toExpr) };\n}\n\n/** MAUI `SqliteAggregateMaker.Count()` / `Count(column)`: `COUNT(*)` or `COUNT(col)`. */\nexport function count(operand?: G9Operand): G9Expr {\n return operand === undefined ? { kind: 'raw', sql: 'COUNT(*)', params: [] } : fn('COUNT', operand);\n}\n\n/** MAUI `CountWhen(condition)`: `COALESCE(SUM(CASE WHEN (cond) THEN 1 ELSE 0 END), 0)`. */\nexport function countWhen(condition: G9Predicate): G9Expr {\n return { kind: 'countWhen', condition };\n}\n\n/** `SUM(col)`. */\nexport const sum = (operand: G9Operand<number>): G9Expr => fn('SUM', operand);\n/** `AVG(col)`. */\nexport const avg = (operand: G9Operand<number>): G9Expr => fn('AVG', operand);\n/** `MIN(col)`. */\nexport const min = (operand: G9Operand): G9Expr => fn('MIN', operand);\n/** `MAX(col)`. */\nexport const max = (operand: G9Operand): G9Expr => fn('MAX', operand);\n/** `COALESCE(primary, fallback)`. */\nexport const coalesce = (primary: G9Operand, fallback: G9Operand): G9Expr => fn('COALESCE', primary, fallback);\n/** `LOWER(col)`. */\nexport const lower = (operand: G9Operand<string>): G9Expr => fn('LOWER', operand);\n/** `UPPER(col)`. */\nexport const upper = (operand: G9Operand<string>): G9Expr => fn('UPPER', operand);\n/** `LENGTH(col)`. */\nexport const length = (operand: G9Operand): G9Expr => fn('LENGTH', operand);\n\n/** A raw SQL fragment with positional `?` parameters (outside every G9 rule: no id normalisation, no codecs). */\nexport function raw(sql: string, ...params: unknown[]): G9Expr {\n return { kind: 'raw', sql, params };\n}\n\n/** A plain value as an explicit parameter (rarely needed: operators wrap values themselves). */\nexport function value(v: unknown): G9Expr {\n return toExpr(v);\n}\n\n/** Codec of a column reference, for binding the other side of a comparison. */\nexport function codecOf(expr: G9Expr): G9Codec<unknown> | undefined {\n return expr.kind === 'col' ? expr.spec.codec : undefined;\n}\n\n/** A value already in driver form; used by the compiler for its own parameters. */\nexport type G9BoundValue = G9SqlValue;\n"],"names":["EXPR_KINDS","Set","isExpr","value","ArrayBuffer","isColumnRef","toExpr","operand","undefined","G9SqliteError","compare","op","left","right","eq","ne","sqlEq","sqlNe","lt","lte","gt","gte","isSame","isDifferent","colEq","isNull","isNotNull","notNullOrEmpty","e","and","isNullOrEmpty","or","inList","values","Array","notInList","escapeLike","text","like","pattern","contains","fragment","startsWith","prefix","endsWith","suffix","between","low","high","flatten","items","out","item","flat","not","arith","add","sub","mul","div","mod","negate","fn","name","args","count","countWhen","condition","sum","avg","min","max","coalesce","primary","fallback","lower","upper","length","raw","sql","params","v","codecOf","expr"],"mappings":";AA4DA,MAAMA,aAAa,IAAIC,IAAI;IACzB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAGM,SAASC,OAAOC,KAAc;IACnC,OACE,AAAiB,YAAjB,OAAOA,SACPA,AAAU,SAAVA,SACA,CAAEA,CAAAA,iBAAiBC,WAAU,KAC7BJ,WAAW,GAAG,CAAEG,MAA6B,IAAI,KAE/CA,CAAAA,AAAoC,UAApCA,MAA2B,IAAI,IAAc,AAAgD,YAAhD,OAAQA,MAA8B,KAAK,AAAY;AAE1G;AAGO,SAASE,YAAYF,KAAc;IAC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E,MAAM;QAAU,SAASD,OAAOC;IAAS;AACpD;AAEA,SAASuD,GAAGC,IAAoB,EAAE,GAAGC,IAAiB;IACpD,OAAO;QAAE,MAAM;QAAMD;QAAM,MAAMC,KAAK,GAAG,CAAC1D;IAAQ;AACpD;AAGO,SAAS2D,MAAM1D,OAAmB;IACvC,OAAOA,AAAYC,WAAZD,UAAwB;QAAE,MAAM;QAAO,KAAK;QAAY,QAAQ,EAAE;IAAC,IAAIuD,GAAG,SAASvD;AAC5F;AAGO,SAAS2D,UAAUC,SAAsB;IAC9C,OAAO;QAAE,MAAM;QAAaA;IAAU;AACxC;AAGO,MAAMC,MAAM,CAAC7D,UAAuCuD,GAAG,OAAOvD;AAE9D,MAAM8D,MAAM,CAAC9D,UAAuCuD,GAAG,OAAOvD;AAE9D,MAAM+D,MAAM,CAAC/D,UAA+BuD,GAAG,OAAOvD;AAEtD,MAAMgE,MAAM,CAAChE,UAA+BuD,GAAG,OAAOvD;AAEtD,MAAMiE,WAAW,CAACC,SAAoBC,WAAgCZ,GAAG,YAAYW,SAASC;AAE9F,MAAMC,QAAQ,CAACpE,UAAuCuD,GAAG,SAASvD;AAElE,MAAMqE,QAAQ,CAACrE,UAAuCuD,GAAG,SAASvD;AAElE,MAAMsE,cAAS,CAACtE,UAA+BuD,GAAG,UAAUvD;AAG5D,SAASuE,IAAIC,GAAW,EAAE,GAAGC,MAAiB;IACnD,OAAO;QAAE,MAAM;QAAOD;QAAKC;IAAO;AACpC;AAGO,SAAS7E,WAAM8E,CAAU;IAC9B,OAAO3E,OAAO2E;AAChB;AAGO,SAASC,QAAQC,IAAY;IAClC,OAAOA,AAAc,UAAdA,KAAK,IAAI,GAAaA,KAAK,IAAI,CAAC,KAAK,GAAG3E;AACjD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { G9EntityDescriptor } from '../schema/entity.js';
|
|
2
|
+
import { type G9IdCase } from '../values/ids.js';
|
|
3
|
+
import { type G9LocalDateTime } from '../values/local-date-time.js';
|
|
4
|
+
type Row = Record<string, unknown>;
|
|
5
|
+
/**
|
|
6
|
+
* MAUI `SqliteEntityAuditDefaults.ApplyInsertDefaults`: normalises or mints the id, sets created and updated time to
|
|
7
|
+
* `now`, and both user columns to `userId` — or, with no user, to whichever user the row already carried.
|
|
8
|
+
* No-op for an entity that is not audited.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyInsertDefaults(entity: G9EntityDescriptor, row: Row, now: G9LocalDateTime, userId: string | null, idCase?: G9IdCase): void;
|
|
11
|
+
/**
|
|
12
|
+
* MAUI `SqliteEntityAuditDefaults.ApplyUpdateDefaults`: normalises or mints the id, refreshes updated time, and the
|
|
13
|
+
* updating user only when one is signed in (a background job never erases who last touched the row).
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyUpdateDefaults(entity: G9EntityDescriptor, row: Row, now: G9LocalDateTime, userId: string | null, idCase?: G9IdCase): void;
|
|
16
|
+
/** MAUI `ApplyUpsertAuditIfNeeded`: insert defaults when the row has no creator or creation time yet, else update. */
|
|
17
|
+
export declare function applyUpsertDefaults(entity: G9EntityDescriptor, row: Row, now: G9LocalDateTime, userId: string | null, idCase?: G9IdCase): void;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/repo/audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAmB,KAAK,eAAe,EAAuB,MAAM,2BAA2B,CAAC;AAEvG,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,EAC1B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,GAAE,QAAkB,GACzB,IAAI,CAiBN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,EAC1B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,GAAE,QAAkB,GACzB,IAAI,CAMN;AAED,sHAAsH;AACtH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,EAC1B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,GAAE,QAAkB,GACzB,IAAI,CAMN"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { newId, normalizeId } from "../values/ids.js";
|
|
2
|
+
import { G9_DATETIME_MIN, localDateTimeEquals } from "../values/local-date-time.js";
|
|
3
|
+
function applyInsertDefaults(entity, row, now, userId, idCase = 'lower') {
|
|
4
|
+
var _normalizeId, _ref, _row_audit_createdByUserId;
|
|
5
|
+
const audit = entity.audit;
|
|
6
|
+
if (!audit) return;
|
|
7
|
+
row[audit.id] = null != (_normalizeId = normalizeId(row[audit.id], idCase)) ? _normalizeId : newId(idCase);
|
|
8
|
+
row[audit.createdTime] = now;
|
|
9
|
+
row[audit.updatedTime] = now;
|
|
10
|
+
if (userId) {
|
|
11
|
+
row[audit.createdByUserId] = userId;
|
|
12
|
+
row[audit.updatedByUserId] = userId;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const fallback = null != (_ref = null != (_row_audit_createdByUserId = row[audit.createdByUserId]) ? _row_audit_createdByUserId : row[audit.updatedByUserId]) ? _ref : null;
|
|
16
|
+
row[audit.createdByUserId] = fallback;
|
|
17
|
+
row[audit.updatedByUserId] = fallback;
|
|
18
|
+
}
|
|
19
|
+
function applyUpdateDefaults(entity, row, now, userId, idCase = 'lower') {
|
|
20
|
+
var _normalizeId;
|
|
21
|
+
const audit = entity.audit;
|
|
22
|
+
if (!audit) return;
|
|
23
|
+
row[audit.id] = null != (_normalizeId = normalizeId(row[audit.id], idCase)) ? _normalizeId : newId(idCase);
|
|
24
|
+
row[audit.updatedTime] = now;
|
|
25
|
+
if (userId) row[audit.updatedByUserId] = userId;
|
|
26
|
+
}
|
|
27
|
+
function applyUpsertDefaults(entity, row, now, userId, idCase = 'lower') {
|
|
28
|
+
const audit = entity.audit;
|
|
29
|
+
if (!audit) return;
|
|
30
|
+
const created = row[audit.createdTime];
|
|
31
|
+
const isNew = !row[audit.createdByUserId] || !created || localDateTimeEquals(created, G9_DATETIME_MIN);
|
|
32
|
+
(isNew ? applyInsertDefaults : applyUpdateDefaults)(entity, row, now, userId, idCase);
|
|
33
|
+
}
|
|
34
|
+
export { applyInsertDefaults, applyUpdateDefaults, applyUpsertDefaults };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo/audit.js","sources":["../../src/repo/audit.ts"],"sourcesContent":["import type { G9EntityDescriptor } from '../schema/entity';\nimport { type G9IdCase, newId, normalizeId } from '../values/ids';\nimport { G9_DATETIME_MIN, type G9LocalDateTime, localDateTimeEquals } from '../values/local-date-time';\n\ntype Row = Record<string, unknown>;\n\n/**\n * MAUI `SqliteEntityAuditDefaults.ApplyInsertDefaults`: normalises or mints the id, sets created and updated time to\n * `now`, and both user columns to `userId` — or, with no user, to whichever user the row already carried.\n * No-op for an entity that is not audited.\n */\nexport function applyInsertDefaults(\n entity: G9EntityDescriptor,\n row: Row,\n now: G9LocalDateTime,\n userId: string | null,\n idCase: G9IdCase = 'lower',\n): void {\n const audit = entity.audit;\n if (!audit) return;\n row[audit.id] = normalizeId(row[audit.id] as string | null, idCase) ?? newId(idCase);\n row[audit.createdTime] = now;\n row[audit.updatedTime] = now;\n if (userId) {\n row[audit.createdByUserId] = userId;\n row[audit.updatedByUserId] = userId;\n return;\n }\n const fallback =\n (row[audit.createdByUserId] as string | null | undefined) ??\n (row[audit.updatedByUserId] as string | null | undefined) ??\n null;\n row[audit.createdByUserId] = fallback;\n row[audit.updatedByUserId] = fallback;\n}\n\n/**\n * MAUI `SqliteEntityAuditDefaults.ApplyUpdateDefaults`: normalises or mints the id, refreshes updated time, and the\n * updating user only when one is signed in (a background job never erases who last touched the row).\n */\nexport function applyUpdateDefaults(\n entity: G9EntityDescriptor,\n row: Row,\n now: G9LocalDateTime,\n userId: string | null,\n idCase: G9IdCase = 'lower',\n): void {\n const audit = entity.audit;\n if (!audit) return;\n row[audit.id] = normalizeId(row[audit.id] as string | null, idCase) ?? newId(idCase);\n row[audit.updatedTime] = now;\n if (userId) row[audit.updatedByUserId] = userId;\n}\n\n/** MAUI `ApplyUpsertAuditIfNeeded`: insert defaults when the row has no creator or creation time yet, else update. */\nexport function applyUpsertDefaults(\n entity: G9EntityDescriptor,\n row: Row,\n now: G9LocalDateTime,\n userId: string | null,\n idCase: G9IdCase = 'lower',\n): void {\n const audit = entity.audit;\n if (!audit) return;\n const created = row[audit.createdTime] as G9LocalDateTime | null | undefined;\n const isNew = !row[audit.createdByUserId] || !created || localDateTimeEquals(created, G9_DATETIME_MIN);\n (isNew ? applyInsertDefaults : applyUpdateDefaults)(entity, row, now, userId, idCase);\n}\n"],"names":["applyInsertDefaults","entity","row","now","userId","idCase","_normalizeId","_ref","_row_audit_createdByUserId","audit","newId","fallback","applyUpdateDefaults","applyUpsertDefaults","created","isNew","localDateTimeEquals","G9_DATETIME_MIN"],"mappings":";;AAWO,SAASA,oBACdC,MAA0B,EAC1BC,GAAQ,EACRC,GAAoB,EACpBC,MAAqB,EACrBC,SAAmB,OAAO;QAIVC,cASdC,MAACC;IAXH,MAAMC,QAAQR,OAAO,KAAK;IAC1B,IAAI,CAACQ,OAAO;IACZP,GAAG,CAACO,MAAM,EAAE,CAAC,GAAG,QAAAH,CAAAA,eAAAA,YAAYJ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BAAoBF,SAASG;IACrFF,CAAAA,QAAQf,sBAAsBY,mBAAkB,EAAGX,QAAQC,KAAKC,KAAKC,QAAQC;AAChF"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import type { G9AbortSignal } from '@g9tm/lynxcontrols-foundation';
|
|
2
|
+
import type { G9DriverStatement, G9SqlResult } from '../driver/types.js';
|
|
3
|
+
import { type G9BuildOptions, type G9DeleteBuilder, type G9SelectBuilder, type G9SqlStatement, type G9UpdateBuilder } from '../query/builders.js';
|
|
4
|
+
import { type G9ColumnRef, type G9Predicate } from '../query/expr.js';
|
|
5
|
+
import type { G9EntityColumn, G9EntityDescriptor, G9InsertRow, G9RefsOf, G9Row } from '../schema/entity.js';
|
|
6
|
+
import { G9CachePolicy, type G9ConflictPolicy } from '../schema/policies.js';
|
|
7
|
+
import type { G9CacheHandle } from '../session/cache.js';
|
|
8
|
+
import type { G9SqliteDatabase, G9TxState, G9UnitOfWork } from '../session/database.js';
|
|
9
|
+
import type { G9SqliteScope } from '../session/scope.js';
|
|
10
|
+
import { type G9SqliteInterceptor, type G9WriteContext, G9WriteKind } from '../session/write-hooks.js';
|
|
11
|
+
import type { G9LocalDateTime } from '../values/local-date-time.js';
|
|
12
|
+
import { type G9SqlValue } from '../values/sql-value.js';
|
|
13
|
+
type Row = Record<string, unknown>;
|
|
14
|
+
/** Per-call write options. */
|
|
15
|
+
export interface G9WriteOptions {
|
|
16
|
+
readonly signal?: G9AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
/** Insert options: conflict policy (default the entity's, MAUI `OnConflict`). */
|
|
19
|
+
export interface G9InsertOptions extends G9WriteOptions {
|
|
20
|
+
readonly conflict?: G9ConflictPolicy;
|
|
21
|
+
}
|
|
22
|
+
/** Delete options: `hard` deletes even on a soft-delete entity. */
|
|
23
|
+
export interface G9DeleteOptions extends G9WriteOptions {
|
|
24
|
+
readonly hard?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** @internal Where a repository runs: the database, optionally inside a transaction. */
|
|
27
|
+
export interface G9RepoScope {
|
|
28
|
+
readonly db: G9SqliteDatabase;
|
|
29
|
+
readonly tx: G9TxState | null;
|
|
30
|
+
/** `db.unfiltered(...)`: always-filters are bypassed for repositories of this scope. */
|
|
31
|
+
readonly bypassFilters: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The repository of one entity (MAUI `SqliteRepository<T>` with its `Select`, `Insert`, `Update`, `Delete` and
|
|
35
|
+
* `Table` accessors). Every managed path applies the entity descriptor: GUID normalisation, codecs, audit, soft
|
|
36
|
+
* delete, always-filter, write conditions, conflict policy, caches.
|
|
37
|
+
*/
|
|
38
|
+
export declare class G9Repository<E extends G9EntityDescriptor> {
|
|
39
|
+
readonly entity: E;
|
|
40
|
+
/** MAUI `Select`. */
|
|
41
|
+
readonly select: G9SelectAccessor<E>;
|
|
42
|
+
/** MAUI `Insert`. */
|
|
43
|
+
readonly insert: G9InsertAccessor<E>;
|
|
44
|
+
/** MAUI `Update`. */
|
|
45
|
+
readonly update: G9UpdateAccessor<E>;
|
|
46
|
+
/** MAUI `Delete`. */
|
|
47
|
+
readonly delete: G9DeleteAccessor<E>;
|
|
48
|
+
/** MAUI `Table`. */
|
|
49
|
+
readonly table: G9TableAccessor<E>;
|
|
50
|
+
/** @internal */ readonly scope: G9RepoScope;
|
|
51
|
+
constructor(scope: G9RepoScope, entity: E);
|
|
52
|
+
/** @internal */
|
|
53
|
+
get db(): G9SqliteDatabase;
|
|
54
|
+
/** MAUI `HasCache` / `HasDefinedCache`. */
|
|
55
|
+
get hasCache(): boolean;
|
|
56
|
+
/** The entity cache (MAUI `GetCacheDataAsync` etc.); throws `misuse` when none is defined. */
|
|
57
|
+
get cache(): G9CacheHandle<G9Row<E>>;
|
|
58
|
+
/** MAUI `DefineCache`: defines this entity's cache (idempotent) and loads it. */
|
|
59
|
+
defineCache(policy?: G9CachePolicy | undefined): Promise<G9CacheHandle<G9Row<E>>>;
|
|
60
|
+
/** Soft-delete restore (N05): clears the flag (and deletion audit) of the given rows. */
|
|
61
|
+
restore(target: G9Row<E> | ((refs: G9RefsOf<E>) => G9Predicate), options?: G9WriteOptions): Promise<number>;
|
|
62
|
+
/** @internal Compile options of this scope. */
|
|
63
|
+
buildOptions(): G9BuildOptions;
|
|
64
|
+
/** @internal */
|
|
65
|
+
get codec(): import("../index.js").G9CodecContext;
|
|
66
|
+
/** @internal */
|
|
67
|
+
interceptors(): G9SqliteInterceptor[];
|
|
68
|
+
/** @internal Key predicate for a row (MAUI: sqlite-net matched the [PrimaryKey]). */
|
|
69
|
+
keyPredicate(row: Row): G9Predicate;
|
|
70
|
+
/** @internal Always-filter + write conditions for updates/deletes of this entity. */
|
|
71
|
+
writePredicates(kind: G9WriteKind): G9Predicate[];
|
|
72
|
+
/** @internal MAUI `NormalizeGuidStringIdProperties` + `EnsureGeneratedPrimaryKey` + audit defaults. */
|
|
73
|
+
prepareRow(row: Row, mode: 'insert' | 'update' | 'upsert', now: G9LocalDateTime, userId: string | null): void;
|
|
74
|
+
/** @internal Encodes one column value of a row (undefined = omitted). */
|
|
75
|
+
encode(column: G9EntityColumn, value: unknown): G9SqlValue;
|
|
76
|
+
/** @internal INSERT for one row under a conflict policy. */
|
|
77
|
+
insertStatement(row: Row, conflict: G9ConflictPolicy): G9DriverStatement;
|
|
78
|
+
/** @internal */
|
|
79
|
+
column(property: string): G9EntityColumn;
|
|
80
|
+
/** @internal Runs per-row `onWriting` hooks; throws {@link G9WriteVetoedError} on a veto. */
|
|
81
|
+
runWriting(contexts: G9WriteContext[], signal: G9AbortSignal | undefined): Promise<void>;
|
|
82
|
+
/** @internal Commit-time effects in pipeline order: cache invalidation, post-commit hooks, change event. */
|
|
83
|
+
afterCommit(uow: G9UnitOfWork, contexts: G9WriteContext[], kind: G9WriteKind, changes: number): void;
|
|
84
|
+
/** @internal Context objects handed to interceptors. */
|
|
85
|
+
contexts(kind: G9WriteKind, rows: Row[] | null, uow: G9UnitOfWork): G9WriteContext[];
|
|
86
|
+
/** @internal Whether this entity's writes need a full transaction (interceptors with `onWriting`). */
|
|
87
|
+
needsTransaction(): boolean;
|
|
88
|
+
/** @internal Inserts/upserts rows through the pipeline. */
|
|
89
|
+
writeRows(rows: Row[], kind: G9WriteKind, mode: 'insert' | 'upsert', conflict: G9ConflictPolicy, options: G9WriteOptions, forceTransaction?: boolean): Promise<number>;
|
|
90
|
+
/** @internal MAUI `RejectEmptyGuidPrimaryKeys`. */
|
|
91
|
+
rejectEmptyGuidKeys(rows: Row[]): void;
|
|
92
|
+
/** @internal sqlite-net assigned an auto-increment key back to the object after insert. */
|
|
93
|
+
assignRowIds(rows: Row[], results: readonly G9SqlResult[]): void;
|
|
94
|
+
/** @internal Whole-entity updates by key. */
|
|
95
|
+
updateRows(rows: Row[], options: G9WriteOptions): Promise<number>;
|
|
96
|
+
/** @internal Partial (set-based) update with automatic audit stamping (MAUI `ApplyAutomaticUpdateAudit`). */
|
|
97
|
+
runPartialUpdate(builder: G9UpdateBuilder<E>, kind: G9WriteKind, options: G9WriteOptions): Promise<number>;
|
|
98
|
+
private compileUpdate;
|
|
99
|
+
/** @internal Audit stamps an UPDATE gets unless it sets them itself. */
|
|
100
|
+
auditAssignments(builder: G9UpdateBuilder<E>): {
|
|
101
|
+
ref: G9ColumnRef;
|
|
102
|
+
value: unknown;
|
|
103
|
+
}[];
|
|
104
|
+
/** @internal Delete by builder: soft delete becomes an update of the flag (N05). */
|
|
105
|
+
runDelete(builder: G9DeleteBuilder<E>, options: G9DeleteOptions): Promise<number>;
|
|
106
|
+
private narrowAllRowsDelete;
|
|
107
|
+
/** @internal Managed SELECT through the scope. */
|
|
108
|
+
query<R>(builder: G9SelectBuilder<E, R> | G9SelectBuilder<G9EntityDescriptor, R>, signal?: G9AbortSignal): Promise<R[]>;
|
|
109
|
+
/** @internal Runs statements in the scope (transaction or a locked read). */
|
|
110
|
+
runStatements(statements: readonly G9DriverStatement[], signal?: G9AbortSignal): Promise<G9SqlResult[]>;
|
|
111
|
+
/** @internal Raw mutation in the scope: invalidates this entity's caches after commit (MAUI `ExecuteCoreAsync`). */
|
|
112
|
+
executeRaw(statement: G9DriverStatement, signal?: G9AbortSignal): Promise<number>;
|
|
113
|
+
}
|
|
114
|
+
/** MAUI `ReadLeadingSqlKeyword` + `IsMutationSql`: comments skipped, INSERT/UPDATE/DELETE/REPLACE (and WITH). */
|
|
115
|
+
export declare function isMutationSql(sql: string): boolean;
|
|
116
|
+
/** MAUI `ISqliteSelectAccessor<T>`. */
|
|
117
|
+
export declare class G9SelectAccessor<E extends G9EntityDescriptor> {
|
|
118
|
+
private readonly repo;
|
|
119
|
+
constructor(repo: G9Repository<E>);
|
|
120
|
+
/** MAUI `Compose()`: a fresh SELECT builder for this entity. */
|
|
121
|
+
compose(): G9SelectBuilder<E>;
|
|
122
|
+
/** MAUI `ByIdAsync`: the row with this primary key (a value, or an object for a composite key), or `null`. */
|
|
123
|
+
byId(key: unknown, options?: G9WriteOptions): Promise<G9Row<E> | null>;
|
|
124
|
+
/** MAUI `FirstOrDefaultAsync`. */
|
|
125
|
+
first(predicate: (refs: G9RefsOf<E>) => G9Predicate, options?: G9WriteOptions): Promise<G9Row<E> | null>;
|
|
126
|
+
/** MAUI `AllAsync` (managed: always-filter and soft delete apply). */
|
|
127
|
+
all(options?: G9WriteOptions): Promise<G9Row<E>[]>;
|
|
128
|
+
/** MAUI `WhereAsync`. */
|
|
129
|
+
where(predicate: (refs: G9RefsOf<E>) => G9Predicate, options?: G9WriteOptions): Promise<G9Row<E>[]>;
|
|
130
|
+
/** MAUI `CountAsync()` / `CountAsync(predicate)`. */
|
|
131
|
+
count(predicate?: (refs: G9RefsOf<E>) => G9Predicate, options?: G9WriteOptions): Promise<number>;
|
|
132
|
+
/** MAUI `AnyAsync`: `SELECT EXISTS(SELECT 1 … LIMIT 1)` (stops at the first match). */
|
|
133
|
+
any(predicate: (refs: G9RefsOf<E>) => G9Predicate, options?: G9WriteOptions): Promise<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* MAUI `QueryAsync(compose)` / `QueryAsync<TResult>(compose)`: runs a composed builder (or a function that composes
|
|
136
|
+
* one) and decodes rows by its shape (entity rows, or a projection).
|
|
137
|
+
*/
|
|
138
|
+
query<R = G9Row<E>>(compose: G9SelectBuilder<E, R> | ((builder: G9SelectBuilder<E>) => G9SelectBuilder<E, R>), options?: G9WriteOptions): Promise<R[]>;
|
|
139
|
+
/** MAUI `QueryAsync(SqlStatement)`: a built statement, rows decoded as this entity. */
|
|
140
|
+
queryStatement(statement: G9SqlStatement, options?: G9WriteOptions): Promise<G9Row<E>[]>;
|
|
141
|
+
/** MAUI `QueryAsync<TResult>(SqlStatement)`: generic records by result column name. */
|
|
142
|
+
queryStatementAs<R = Record<string, unknown>>(statement: G9SqlStatement, options?: G9WriteOptions): Promise<R[]>;
|
|
143
|
+
}
|
|
144
|
+
/** MAUI `ISqliteInsertAccessor<T>`. Rows are prepared in place (ids, audit), as MAUI mutated the entity. */
|
|
145
|
+
export declare class G9InsertAccessor<E extends G9EntityDescriptor> {
|
|
146
|
+
private readonly repo;
|
|
147
|
+
constructor(repo: G9Repository<E>);
|
|
148
|
+
/** MAUI `PrepareForInsert`: audit defaults, GUID normalisation and a minted key, without writing. */
|
|
149
|
+
prepare(row: G9InsertRow<E>): G9Row<E>;
|
|
150
|
+
/** MAUI `OneAsync`: one row (conflict policy: per call, else the entity's). Returns rows inserted. */
|
|
151
|
+
one(row: G9InsertRow<E>, options?: G9InsertOptions): Promise<number>;
|
|
152
|
+
/** MAUI `ManyAsync`: all rows atomically, in one bridge call. */
|
|
153
|
+
many(rows: readonly G9InsertRow<E>[], options?: G9InsertOptions): Promise<number>;
|
|
154
|
+
/**
|
|
155
|
+
* MAUI `BatchAsync`: `singleTransaction` (default) inserts everything atomically; otherwise one transaction per
|
|
156
|
+
* batch of `batchSize` (earlier batches stay committed when a later one fails, which then rolls back whole).
|
|
157
|
+
*/
|
|
158
|
+
batch(rows: readonly G9InsertRow<E>[], options?: G9InsertOptions & {
|
|
159
|
+
batchSize?: number;
|
|
160
|
+
singleTransaction?: boolean;
|
|
161
|
+
}): Promise<number>;
|
|
162
|
+
/** MAUI `OrReplaceAsync`: `INSERT OR REPLACE` (DELETE + INSERT: delete triggers fire; unsupplied columns reset). */
|
|
163
|
+
orReplace(row: G9InsertRow<E>, options?: G9WriteOptions): Promise<number>;
|
|
164
|
+
/**
|
|
165
|
+
* MAUI `MergeAsync`: upsert on the primary key (or `keys`), updating every non-key column except the creation
|
|
166
|
+
* audit pair, in batches inside one transaction. The empty GUID is refused as a key.
|
|
167
|
+
*/
|
|
168
|
+
merge(rows: readonly G9InsertRow<E>[], options?: G9WriteOptions & {
|
|
169
|
+
keys?: readonly (keyof G9Row<E> & string)[] | ((refs: G9RefsOf<E>) => G9ColumnRef | readonly G9ColumnRef[]);
|
|
170
|
+
batchSize?: number;
|
|
171
|
+
}): Promise<number>;
|
|
172
|
+
}
|
|
173
|
+
/** MAUI `ISqliteUpdateAccessor<T>`. */
|
|
174
|
+
export declare class G9UpdateAccessor<E extends G9EntityDescriptor> {
|
|
175
|
+
private readonly repo;
|
|
176
|
+
constructor(repo: G9Repository<E>);
|
|
177
|
+
/** MAUI `Compose()`. */
|
|
178
|
+
compose(): G9UpdateBuilder<E>;
|
|
179
|
+
/** MAUI `OneAsync`: whole row by key; audit `updated*` refreshed. */
|
|
180
|
+
one(row: G9Row<E>, options?: G9WriteOptions): Promise<number>;
|
|
181
|
+
/** MAUI `ManyAsync`: all rows atomically. */
|
|
182
|
+
many(rows: readonly G9Row<E>[], options?: G9WriteOptions): Promise<number>;
|
|
183
|
+
/** MAUI `SetAuditUserIdsAsync`: sets both audit user columns on matching rows (0 when the entity has none). */
|
|
184
|
+
setAuditUserIds(predicate: (refs: G9RefsOf<E>) => G9Predicate, auditUserId: string | null, options?: G9WriteOptions): Promise<number>;
|
|
185
|
+
/** MAUI `ExecuteAsync(compose)`: a composed partial update (audit stamped, filters and write conditions applied). */
|
|
186
|
+
execute(compose: G9UpdateBuilder<E> | ((builder: G9UpdateBuilder<E>) => G9UpdateBuilder<E>), options?: G9WriteOptions): Promise<number>;
|
|
187
|
+
/** MAUI `ExecuteAsync(SqlStatement)`: a raw UPDATE statement, run as given (outside managed filters). */
|
|
188
|
+
executeStatement(statement: G9SqlStatement, options?: G9WriteOptions): Promise<number>;
|
|
189
|
+
}
|
|
190
|
+
/** MAUI `ISqliteDeleteAccessor<T>`. On a soft-delete entity every delete is an update of the flag unless `hard`. */
|
|
191
|
+
export declare class G9DeleteAccessor<E extends G9EntityDescriptor> {
|
|
192
|
+
private readonly repo;
|
|
193
|
+
constructor(repo: G9Repository<E>);
|
|
194
|
+
/** MAUI `Compose()`. */
|
|
195
|
+
compose(): G9DeleteBuilder<E>;
|
|
196
|
+
/** MAUI `EntityAsync`: deletes the row with this key. */
|
|
197
|
+
entity(row: G9Row<E>, options?: G9DeleteOptions): Promise<number>;
|
|
198
|
+
/** Deletes several rows by key in one statement. */
|
|
199
|
+
entities(rows: readonly G9Row<E>[], options?: G9DeleteOptions): Promise<number>;
|
|
200
|
+
/** MAUI `AllAsync`: every row (soft-deleted ones are left alone on a soft-delete entity). */
|
|
201
|
+
all(options?: G9DeleteOptions): Promise<number>;
|
|
202
|
+
/** MAUI `WhereAsync` (one DELETE statement; returns the count). */
|
|
203
|
+
where(predicate: (refs: G9RefsOf<E>) => G9Predicate, options?: G9DeleteOptions): Promise<number>;
|
|
204
|
+
/** MAUI `ExecuteAsync(compose)`. */
|
|
205
|
+
execute(compose: G9DeleteBuilder<E> | ((builder: G9DeleteBuilder<E>) => G9DeleteBuilder<E>), options?: G9DeleteOptions): Promise<number>;
|
|
206
|
+
/** MAUI `ExecuteAsync(SqlStatement)`: a raw DELETE statement, run as given. */
|
|
207
|
+
executeStatement(statement: G9SqlStatement, options?: G9WriteOptions): Promise<number>;
|
|
208
|
+
}
|
|
209
|
+
/** MAUI `ISqliteTableAccessor<T>`: raw access to the entity's table. Raw SQL is outside filters and soft delete. */
|
|
210
|
+
export declare class G9TableAccessor<E extends G9EntityDescriptor> {
|
|
211
|
+
private readonly repo;
|
|
212
|
+
constructor(repo: G9Repository<E>);
|
|
213
|
+
/** MAUI `Name`. */
|
|
214
|
+
get name(): string;
|
|
215
|
+
/** MAUI `ExistsAsync`. */
|
|
216
|
+
exists(): Promise<boolean>;
|
|
217
|
+
/** MAUI `HasColumnAsync(name)` / `HasColumnAsync(selector)`. */
|
|
218
|
+
hasColumn(column: string | ((refs: G9RefsOf<E>) => G9ColumnRef)): Promise<boolean>;
|
|
219
|
+
/** MAUI `QueryAsync(sql, args)`: rows decoded as this entity. */
|
|
220
|
+
query(sql: string, ...params: unknown[]): Promise<G9Row<E>[]>;
|
|
221
|
+
/** MAUI `QueryAsync<TResult>(sql, args)`: generic records. */
|
|
222
|
+
queryAs<R = Record<string, unknown>>(sql: string, ...params: unknown[]): Promise<R[]>;
|
|
223
|
+
/** MAUI `ScalarAsync<TResult>`: first column of the first row (`null` when none; int64 beyond 2^53 as text). */
|
|
224
|
+
scalar<R = unknown>(sql: string, ...params: unknown[]): Promise<R | null>;
|
|
225
|
+
/** MAUI `ExecuteAsync(sql, args)`: a mutation invalidates this entity's caches after commit. */
|
|
226
|
+
execute(sql: string, ...params: unknown[]): Promise<number>;
|
|
227
|
+
/** MAUI `ExecuteAsync(SqlStatement)`. */
|
|
228
|
+
executeStatement(statement: G9SqlStatement): Promise<number>;
|
|
229
|
+
/** MAUI `RunInTransactionAsync`: `work` runs in a transaction of this repository's scope. */
|
|
230
|
+
runInTransaction<T>(work: (tx: G9SqliteScope) => Promise<T>): Promise<T>;
|
|
231
|
+
}
|
|
232
|
+
export {};
|
|
233
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/repo/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAA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