@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,715 @@
|
|
|
1
|
+
import { G9SqliteError } from "../errors.js";
|
|
2
|
+
import { G9Sql } from "../query/builders.js";
|
|
3
|
+
import { compileExpr, encodeParam, quoteIdentifier } from "../query/compile.js";
|
|
4
|
+
import { and, eq, inList, isColumnRef } from "../query/expr.js";
|
|
5
|
+
import { G9CachePolicy } from "../schema/policies.js";
|
|
6
|
+
import { resolveCurrentUserId } from "../session/ambient.js";
|
|
7
|
+
import { decodeEntityRows, decodeGenericRows, decodeShaped } from "../session/rows.js";
|
|
8
|
+
import { G9WriteKind, G9WriteVetoedError } from "../session/write-hooks.js";
|
|
9
|
+
import { isEmptyGuid, newId, normalizeRequiredId } from "../values/ids.js";
|
|
10
|
+
import { isInt64Tag } from "../values/sql-value.js";
|
|
11
|
+
import { applyInsertDefaults, applyUpdateDefaults, applyUpsertDefaults } from "./audit.js";
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
14
|
+
value: value,
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true
|
|
18
|
+
});
|
|
19
|
+
else obj[key] = value;
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
var _this_entity_cachePolicy;
|
|
23
|
+
function isNoSuchTable(error) {
|
|
24
|
+
return error instanceof G9SqliteError && /no such table/i.test(error.message);
|
|
25
|
+
}
|
|
26
|
+
async function orEmpty(work, empty) {
|
|
27
|
+
try {
|
|
28
|
+
return await work();
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (isNoSuchTable(error)) return empty;
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const interceptorCache = new WeakMap();
|
|
35
|
+
function applies(interceptor, entity) {
|
|
36
|
+
let perEntity = interceptorCache.get(interceptor);
|
|
37
|
+
if (!perEntity) {
|
|
38
|
+
perEntity = new WeakMap();
|
|
39
|
+
interceptorCache.set(interceptor, perEntity);
|
|
40
|
+
}
|
|
41
|
+
let value = perEntity.get(entity);
|
|
42
|
+
if (void 0 === value) {
|
|
43
|
+
value = interceptor.appliesTo ? true === interceptor.appliesTo(entity) : true;
|
|
44
|
+
perEntity.set(entity, value);
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
function sum(results) {
|
|
49
|
+
let n = 0;
|
|
50
|
+
for (const r of results)n += r.changes;
|
|
51
|
+
return n;
|
|
52
|
+
}
|
|
53
|
+
class G9Repository {
|
|
54
|
+
get db() {
|
|
55
|
+
return this.scope.db;
|
|
56
|
+
}
|
|
57
|
+
get hasCache() {
|
|
58
|
+
return void 0 !== this.db.caches.entityCache(this.entity);
|
|
59
|
+
}
|
|
60
|
+
get cache() {
|
|
61
|
+
const cache = this.db.caches.entityCache(this.entity);
|
|
62
|
+
if (!cache) throw new G9SqliteError('misuse', `Cache is not defined for '${this.entity.name}'. Declare .cache(policy) on the entity or call defineCache().`);
|
|
63
|
+
return cache;
|
|
64
|
+
}
|
|
65
|
+
async defineCache(policy = null != (_this_entity_cachePolicy = this.entity.cachePolicy) ? _this_entity_cachePolicy : void 0) {
|
|
66
|
+
const cache = this.db.caches.defineEntityCache(this.entity, null != policy ? policy : G9CachePolicy.debounced(300));
|
|
67
|
+
await cache.refresh();
|
|
68
|
+
return cache;
|
|
69
|
+
}
|
|
70
|
+
async restore(target, options = {}) {
|
|
71
|
+
const sd = this.entity.softDelete;
|
|
72
|
+
if (!sd) throw new G9SqliteError('misuse', `'${this.entity.name}' has no soft delete to restore from.`);
|
|
73
|
+
const builder = G9Sql.update(this.entity).onlyDeleted();
|
|
74
|
+
builder.set(sd.flag, false);
|
|
75
|
+
if (sd.deletedTime) builder.set(sd.deletedTime, null);
|
|
76
|
+
if (sd.deletedByUserId) builder.set(sd.deletedByUserId, null);
|
|
77
|
+
if ('function' == typeof target) builder.where(target);
|
|
78
|
+
else builder.where(()=>this.keyPredicate(target));
|
|
79
|
+
return this.runPartialUpdate(builder, G9WriteKind.Update, options);
|
|
80
|
+
}
|
|
81
|
+
buildOptions() {
|
|
82
|
+
return {
|
|
83
|
+
...this.db.buildOptions(),
|
|
84
|
+
bypassFilters: this.scope.bypassFilters
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
get codec() {
|
|
88
|
+
return this.db.options.codec;
|
|
89
|
+
}
|
|
90
|
+
interceptors() {
|
|
91
|
+
return this.db.options.interceptors.filter((i)=>applies(i, this.entity));
|
|
92
|
+
}
|
|
93
|
+
keyPredicate(row) {
|
|
94
|
+
const pk = this.entity.primaryKey;
|
|
95
|
+
if (0 === pk.length) throw new G9SqliteError('misuse', `'${this.entity.name}' has no primary key; use a predicate instead.`);
|
|
96
|
+
const refs = this.entity.refs;
|
|
97
|
+
return and(...pk.map((c)=>{
|
|
98
|
+
const value = row[c.property];
|
|
99
|
+
if (null == value) throw new G9SqliteError('misuse', `'${this.entity.name}.${c.property}' (key) is missing on the row.`);
|
|
100
|
+
return eq(refs[c.property], value);
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
writePredicates(kind) {
|
|
104
|
+
const out = [];
|
|
105
|
+
if (this.entity.alwaysFilter && !this.scope.bypassFilters) out.push(this.entity.alwaysFilter(this.entity.refs));
|
|
106
|
+
for (const i of this.interceptors()){
|
|
107
|
+
var _i_writeCondition;
|
|
108
|
+
const condition = null == (_i_writeCondition = i.writeCondition) ? void 0 : _i_writeCondition.call(i, kind, this.entity.refs, this.entity);
|
|
109
|
+
if (condition) out.push(condition);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
prepareRow(row, mode, now, userId) {
|
|
114
|
+
const idCase = this.codec.idCase;
|
|
115
|
+
if ('insert' === mode) applyInsertDefaults(this.entity, row, now, userId, idCase);
|
|
116
|
+
else if ('upsert' === mode) applyUpsertDefaults(this.entity, row, now, userId, idCase);
|
|
117
|
+
else applyUpdateDefaults(this.entity, row, now, userId, idCase);
|
|
118
|
+
for (const c of this.entity.columns){
|
|
119
|
+
if (c.guid && 'string' == typeof row[c.property]) row[c.property] = normalizeRequiredId(row[c.property], idCase);
|
|
120
|
+
if ('update' !== mode && c.primaryKey && c.guid && !c.autoIncrement) {
|
|
121
|
+
const v = row[c.property];
|
|
122
|
+
if (null == v || 'string' == typeof v && '' === v.trim()) row[c.property] = newId(idCase);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
encode(column, value) {
|
|
127
|
+
if (null == value) {
|
|
128
|
+
if (!column.nullable && !(column.autoIncrement && void 0 === value)) throw new G9SqliteError('misuse', `'${this.entity.name}.${column.property}' is not nullable but has no value.`);
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return encodeParam(value, column.codec, this.codec);
|
|
132
|
+
}
|
|
133
|
+
insertStatement(row, conflict) {
|
|
134
|
+
const columns = this.entity.columns.filter((c)=>!(c.autoIncrement && (void 0 === row[c.property] || null === row[c.property] || 0 === row[c.property])) && !(void 0 === row[c.property] && (c.nullable || c.generated)));
|
|
135
|
+
const params = columns.map((c)=>this.encode(c, row[c.property]));
|
|
136
|
+
const verb = 'ignore' === conflict ? 'INSERT OR IGNORE' : 'replace' === conflict ? 'INSERT OR REPLACE' : 'INSERT';
|
|
137
|
+
let sql = `${verb} INTO ${quoteIdentifier(this.entity.table)} (${columns.map((c)=>quoteIdentifier(c.column)).join(', ')}) VALUES (${columns.map(()=>'?').join(', ')})`;
|
|
138
|
+
if ('object' == typeof conflict) {
|
|
139
|
+
const target = conflict.target ? conflict.target.map((p)=>this.column(p)) : this.entity.primaryKey;
|
|
140
|
+
if (0 === target.length) throw new G9SqliteError('misuse', `Upsert of '${this.entity.name}' needs a conflict target.`);
|
|
141
|
+
const targetSet = new Set(target);
|
|
142
|
+
const audit = this.entity.audit;
|
|
143
|
+
const updatable = (conflict.update ? conflict.update.map((p)=>this.column(p)) : columns).filter((c)=>!targetSet.has(c) && !(audit && (c.property === audit.createdTime || c.property === audit.createdByUserId)));
|
|
144
|
+
const targetSql = target.map((c)=>quoteIdentifier(c.column)).join(', ');
|
|
145
|
+
if (0 === updatable.length) sql += ` ON CONFLICT (${targetSql}) DO NOTHING`;
|
|
146
|
+
else {
|
|
147
|
+
sql += ` ON CONFLICT (${targetSql}) DO UPDATE SET ${updatable.map((c)=>`${quoteIdentifier(c.column)} = excluded.${quoteIdentifier(c.column)}`).join(', ')}`;
|
|
148
|
+
const filters = this.writePredicates(G9WriteKind.Upsert);
|
|
149
|
+
if (filters.length) {
|
|
150
|
+
const f = compileExpr(and(...filters), {
|
|
151
|
+
codec: this.codec,
|
|
152
|
+
culture: null,
|
|
153
|
+
localized: new Set(),
|
|
154
|
+
qualify: false,
|
|
155
|
+
maxInListParameters: Number.MAX_SAFE_INTEGER
|
|
156
|
+
});
|
|
157
|
+
sql += ` WHERE ${f.sql}`;
|
|
158
|
+
params.push(...f.params);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
sql,
|
|
164
|
+
params
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
column(property) {
|
|
168
|
+
const c = this.entity.byProperty.get(property);
|
|
169
|
+
if (!c) throw new G9SqliteError('misuse', `'${property}' is not a column of '${this.entity.name}'.`);
|
|
170
|
+
return c;
|
|
171
|
+
}
|
|
172
|
+
async runWriting(contexts, signal) {
|
|
173
|
+
const hooks = this.interceptors().filter((i)=>i.onWriting);
|
|
174
|
+
if (0 === hooks.length) return;
|
|
175
|
+
for (const context of contexts)for (const hook of hooks){
|
|
176
|
+
var _hook_onWriting;
|
|
177
|
+
const decision = await (null == (_hook_onWriting = hook.onWriting) ? void 0 : _hook_onWriting.call(hook, context, signal));
|
|
178
|
+
if (decision && !decision.proceed) throw new G9WriteVetoedError(this.entity.name, context.kind, decision.reason);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
afterCommit(uow, contexts, kind, changes) {
|
|
182
|
+
const hooks = this.interceptors().filter((i)=>i.onWritten);
|
|
183
|
+
uow.onCommit(async ()=>{
|
|
184
|
+
this.db.caches.invalidateTable(this.entity.table);
|
|
185
|
+
for (const context of contexts)for (const hook of hooks)try {
|
|
186
|
+
var _hook_onWritten;
|
|
187
|
+
await (null == (_hook_onWritten = hook.onWritten) ? void 0 : _hook_onWritten.call(hook, context, uow.signal));
|
|
188
|
+
} catch (error) {
|
|
189
|
+
var _hook_name;
|
|
190
|
+
this.db.report(`onWritten of '${null != (_hook_name = hook.name) ? _hook_name : 'interceptor'}' failed (the write is committed)`, error);
|
|
191
|
+
}
|
|
192
|
+
this.db.emitChange({
|
|
193
|
+
table: this.entity.table,
|
|
194
|
+
entity: this.entity,
|
|
195
|
+
kind,
|
|
196
|
+
rowCount: changes
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
contexts(kind, rows, uow) {
|
|
201
|
+
const transaction = uow.tx ? {
|
|
202
|
+
execute: async (sql, ...params)=>sum(await uow.run([
|
|
203
|
+
{
|
|
204
|
+
sql,
|
|
205
|
+
params: this.db.encodeRaw(params)
|
|
206
|
+
}
|
|
207
|
+
])),
|
|
208
|
+
query: async (sql, ...params)=>{
|
|
209
|
+
const [r] = await uow.run([
|
|
210
|
+
{
|
|
211
|
+
sql,
|
|
212
|
+
params: this.db.encodeRaw(params)
|
|
213
|
+
}
|
|
214
|
+
]);
|
|
215
|
+
return decodeGenericRows(r);
|
|
216
|
+
}
|
|
217
|
+
} : {
|
|
218
|
+
execute: async ()=>{
|
|
219
|
+
throw new G9SqliteError('misuse', 'No transaction is open for this write.');
|
|
220
|
+
},
|
|
221
|
+
query: async ()=>{
|
|
222
|
+
throw new G9SqliteError('misuse', 'No transaction is open for this write.');
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
if (null === rows) return [
|
|
226
|
+
{
|
|
227
|
+
kind,
|
|
228
|
+
entity: this.entity,
|
|
229
|
+
row: null,
|
|
230
|
+
rowCount: -1,
|
|
231
|
+
items: new Map(),
|
|
232
|
+
transaction
|
|
233
|
+
}
|
|
234
|
+
];
|
|
235
|
+
return rows.map((row)=>({
|
|
236
|
+
kind,
|
|
237
|
+
entity: this.entity,
|
|
238
|
+
row,
|
|
239
|
+
rowCount: rows.length,
|
|
240
|
+
items: new Map(),
|
|
241
|
+
transaction
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
needsTransaction() {
|
|
245
|
+
return this.interceptors().some((i)=>i.onWriting);
|
|
246
|
+
}
|
|
247
|
+
async writeRows(rows, kind, mode, conflict, options, forceTransaction = false) {
|
|
248
|
+
if (0 === rows.length) return 0;
|
|
249
|
+
return this.db.unit(this.scope.tx, forceTransaction || this.needsTransaction(), async (uow)=>{
|
|
250
|
+
const contexts = this.contexts(kind, rows, uow);
|
|
251
|
+
await this.runWriting(contexts, options.signal);
|
|
252
|
+
const now = this.db.options.clock.now();
|
|
253
|
+
const userId = resolveCurrentUserId(this.db.options.currentUser, this.codec.idCase);
|
|
254
|
+
for (const row of rows)this.prepareRow(row, mode, now, userId);
|
|
255
|
+
if ('upsert' === mode) this.rejectEmptyGuidKeys(rows);
|
|
256
|
+
const results = await uow.run(rows.map((row)=>this.insertStatement(row, conflict)));
|
|
257
|
+
this.assignRowIds(rows, results);
|
|
258
|
+
const changes = sum(results);
|
|
259
|
+
this.afterCommit(uow, contexts, kind, changes);
|
|
260
|
+
return changes;
|
|
261
|
+
}, options.signal ? {
|
|
262
|
+
signal: options.signal
|
|
263
|
+
} : {});
|
|
264
|
+
}
|
|
265
|
+
rejectEmptyGuidKeys(rows) {
|
|
266
|
+
for (const c of this.entity.primaryKey)if (c.guid) {
|
|
267
|
+
for (const row of rows)if (isEmptyGuid(row[c.property])) throw new G9SqliteError('misuse', `Merge of '${this.entity.name}': '${c.property}' is the empty GUID, a placeholder that would upsert every such row onto the same row. Leave it blank to have one generated, or supply the real id.`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
assignRowIds(rows, results) {
|
|
271
|
+
const auto = this.entity.primaryKey.find((c)=>c.autoIncrement);
|
|
272
|
+
if (!auto) return;
|
|
273
|
+
rows.forEach((row, i)=>{
|
|
274
|
+
const r = results[i];
|
|
275
|
+
if (r && r.changes > 0 && (void 0 === row[auto.property] || null === row[auto.property] || 0 === row[auto.property])) {
|
|
276
|
+
const id = r.lastInsertRowId;
|
|
277
|
+
row[auto.property] = 'int64' === auto.codec.kind ? isInt64Tag(id) ? id.int64 : String(id) : id;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
async updateRows(rows, options) {
|
|
282
|
+
if (0 === rows.length) return 0;
|
|
283
|
+
return this.db.unit(this.scope.tx, this.needsTransaction(), async (uow)=>{
|
|
284
|
+
const contexts = this.contexts(G9WriteKind.Update, rows, uow);
|
|
285
|
+
await this.runWriting(contexts, options.signal);
|
|
286
|
+
const now = this.db.options.clock.now();
|
|
287
|
+
const userId = resolveCurrentUserId(this.db.options.currentUser, this.codec.idCase);
|
|
288
|
+
const statements = rows.map((row)=>{
|
|
289
|
+
this.prepareRow(row, 'update', now, userId);
|
|
290
|
+
const builder = G9Sql.update(this.entity).includeDeleted();
|
|
291
|
+
for (const c of this.entity.columns)if (!c.primaryKey && void 0 !== row[c.property]) builder.set(c.property, row[c.property]);
|
|
292
|
+
builder.where(()=>and(this.keyPredicate(row), ...this.writePredicates(G9WriteKind.Update)));
|
|
293
|
+
return builder.compile(this.buildOptions());
|
|
294
|
+
});
|
|
295
|
+
const results = await uow.run(statements);
|
|
296
|
+
const changes = sum(results);
|
|
297
|
+
this.afterCommit(uow, contexts, G9WriteKind.Update, changes);
|
|
298
|
+
return changes;
|
|
299
|
+
}, options.signal ? {
|
|
300
|
+
signal: options.signal
|
|
301
|
+
} : {});
|
|
302
|
+
}
|
|
303
|
+
async runPartialUpdate(builder, kind, options) {
|
|
304
|
+
return this.db.unit(this.scope.tx, this.needsTransaction(), async (uow)=>{
|
|
305
|
+
const contexts = this.contexts(kind, null, uow);
|
|
306
|
+
await this.runWriting(contexts, options.signal);
|
|
307
|
+
const extra = this.auditAssignments(builder);
|
|
308
|
+
const conditions = this.writePredicates(kind);
|
|
309
|
+
if (conditions.length) builder.where(()=>and(...conditions));
|
|
310
|
+
const statement = this.compileUpdate(builder, extra);
|
|
311
|
+
const results = await uow.run([
|
|
312
|
+
statement
|
|
313
|
+
]);
|
|
314
|
+
const changes = sum(results);
|
|
315
|
+
this.afterCommit(uow, contexts, kind, changes);
|
|
316
|
+
return changes;
|
|
317
|
+
}, options.signal ? {
|
|
318
|
+
signal: options.signal
|
|
319
|
+
} : {});
|
|
320
|
+
}
|
|
321
|
+
compileUpdate(builder, extra) {
|
|
322
|
+
if (builder.isAllRows && builder.predicateParts.length > 0) {
|
|
323
|
+
const copy = G9Sql.update(this.entity);
|
|
324
|
+
for (const s of builder.assignments)copy.set(()=>s.ref, s.value);
|
|
325
|
+
for (const w of builder.predicateParts)copy.where(()=>w);
|
|
326
|
+
return copy.compile(this.buildOptions(), extra);
|
|
327
|
+
}
|
|
328
|
+
return builder.compile(this.buildOptions(), extra);
|
|
329
|
+
}
|
|
330
|
+
auditAssignments(builder) {
|
|
331
|
+
const audit = this.entity.audit;
|
|
332
|
+
if (!audit) return [];
|
|
333
|
+
const refs = this.entity.refs;
|
|
334
|
+
const assigned = new Set(builder.assignments.map((a)=>a.ref.property));
|
|
335
|
+
const out = [];
|
|
336
|
+
if (!assigned.has(audit.updatedTime)) out.push({
|
|
337
|
+
ref: refs[audit.updatedTime],
|
|
338
|
+
value: this.db.options.clock.now()
|
|
339
|
+
});
|
|
340
|
+
if (!assigned.has(audit.updatedByUserId)) {
|
|
341
|
+
const user = resolveCurrentUserId(this.db.options.currentUser, this.codec.idCase);
|
|
342
|
+
if (user) out.push({
|
|
343
|
+
ref: refs[audit.updatedByUserId],
|
|
344
|
+
value: user
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
return out;
|
|
348
|
+
}
|
|
349
|
+
async runDelete(builder, options) {
|
|
350
|
+
const sd = this.entity.softDelete;
|
|
351
|
+
if (sd && !options.hard) {
|
|
352
|
+
const update = builder.toSoftDeleteUpdate();
|
|
353
|
+
update.set(sd.flag, true);
|
|
354
|
+
if (sd.deletedTime) update.set(sd.deletedTime, this.db.options.clock.now());
|
|
355
|
+
if (sd.deletedByUserId) update.set(sd.deletedByUserId, resolveCurrentUserId(this.db.options.currentUser, this.codec.idCase));
|
|
356
|
+
return this.runPartialUpdate(update, G9WriteKind.SoftDelete, options);
|
|
357
|
+
}
|
|
358
|
+
return this.db.unit(this.scope.tx, this.needsTransaction(), async (uow)=>{
|
|
359
|
+
const contexts = this.contexts(G9WriteKind.Delete, null, uow);
|
|
360
|
+
await this.runWriting(contexts, options.signal);
|
|
361
|
+
const conditions = this.writePredicates(G9WriteKind.Delete);
|
|
362
|
+
if (conditions.length) builder.where(()=>and(...conditions));
|
|
363
|
+
const statement = builder.isAllRows && conditions.length ? this.narrowAllRowsDelete(builder) : builder.compile(this.buildOptions());
|
|
364
|
+
const results = await uow.run([
|
|
365
|
+
statement
|
|
366
|
+
]);
|
|
367
|
+
const changes = sum(results);
|
|
368
|
+
this.afterCommit(uow, contexts, G9WriteKind.Delete, changes);
|
|
369
|
+
return changes;
|
|
370
|
+
}, options.signal ? {
|
|
371
|
+
signal: options.signal
|
|
372
|
+
} : {});
|
|
373
|
+
}
|
|
374
|
+
narrowAllRowsDelete(builder) {
|
|
375
|
+
const copy = G9Sql["delete"](this.entity).includeDeleted();
|
|
376
|
+
const update = builder.toSoftDeleteUpdate();
|
|
377
|
+
for (const w of update.predicateParts)copy.where(()=>w);
|
|
378
|
+
return copy.compile(this.buildOptions());
|
|
379
|
+
}
|
|
380
|
+
async query(builder, signal) {
|
|
381
|
+
const { statement, shape } = builder.compile(this.buildOptions());
|
|
382
|
+
const [result] = await this.runStatements([
|
|
383
|
+
statement
|
|
384
|
+
], signal);
|
|
385
|
+
return decodeShaped(shape, result, this.codec);
|
|
386
|
+
}
|
|
387
|
+
async runStatements(statements, signal) {
|
|
388
|
+
if (this.scope.tx) return this.db.runInTx(this.scope.tx, statements, void 0, signal);
|
|
389
|
+
return this.db.runRead(statements, signal ? {
|
|
390
|
+
signal
|
|
391
|
+
} : {});
|
|
392
|
+
}
|
|
393
|
+
async executeRaw(statement, signal) {
|
|
394
|
+
return this.db.unit(this.scope.tx, false, async (uow)=>{
|
|
395
|
+
const results = await uow.run([
|
|
396
|
+
statement
|
|
397
|
+
]);
|
|
398
|
+
const changes = sum(results);
|
|
399
|
+
if (isMutationSql(statement.sql)) uow.onCommit(()=>{
|
|
400
|
+
this.db.caches.invalidateTable(this.entity.table);
|
|
401
|
+
this.db.emitChange({
|
|
402
|
+
table: this.entity.table,
|
|
403
|
+
entity: this.entity,
|
|
404
|
+
kind: 'raw',
|
|
405
|
+
rowCount: changes
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
return changes;
|
|
409
|
+
}, signal ? {
|
|
410
|
+
signal
|
|
411
|
+
} : {});
|
|
412
|
+
}
|
|
413
|
+
constructor(scope, entity){
|
|
414
|
+
_define_property(this, "entity", void 0);
|
|
415
|
+
_define_property(this, "select", void 0);
|
|
416
|
+
_define_property(this, "insert", void 0);
|
|
417
|
+
_define_property(this, "update", void 0);
|
|
418
|
+
_define_property(this, "delete", void 0);
|
|
419
|
+
_define_property(this, "table", void 0);
|
|
420
|
+
_define_property(this, "scope", void 0);
|
|
421
|
+
this.scope = scope;
|
|
422
|
+
this.entity = entity;
|
|
423
|
+
this.select = new G9SelectAccessor(this);
|
|
424
|
+
this.insert = new G9InsertAccessor(this);
|
|
425
|
+
this.update = new G9UpdateAccessor(this);
|
|
426
|
+
this.delete = new G9DeleteAccessor(this);
|
|
427
|
+
this.table = new G9TableAccessor(this);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function isMutationSql(sql) {
|
|
431
|
+
const stripped = sql.replace(/^(?:\s+|--[^\n]*(?:\n|$)|\/\*[\s\S]*?(?:\*\/|$))*/, '');
|
|
432
|
+
const m = /^[A-Za-z]+/.exec(stripped);
|
|
433
|
+
const keyword = m ? m[0].toUpperCase() : '';
|
|
434
|
+
return 'INSERT' === keyword || 'UPDATE' === keyword || 'DELETE' === keyword || 'REPLACE' === keyword;
|
|
435
|
+
}
|
|
436
|
+
class G9SelectAccessor {
|
|
437
|
+
compose() {
|
|
438
|
+
return G9Sql.select(this.repo.entity);
|
|
439
|
+
}
|
|
440
|
+
async byId(key, options = {}) {
|
|
441
|
+
var _rows_;
|
|
442
|
+
const pk = this.repo.entity.primaryKey;
|
|
443
|
+
const row = 1 === pk.length && ('object' != typeof key || null === key) ? {
|
|
444
|
+
[pk[0].property]: key
|
|
445
|
+
} : key;
|
|
446
|
+
const builder = this.compose().where(()=>this.repo.keyPredicate(row)).limit(1);
|
|
447
|
+
const rows = await orEmpty(()=>this.repo.query(builder, options.signal), []);
|
|
448
|
+
return null != (_rows_ = rows[0]) ? _rows_ : null;
|
|
449
|
+
}
|
|
450
|
+
async first(predicate, options = {}) {
|
|
451
|
+
var _rows_;
|
|
452
|
+
const rows = await orEmpty(()=>this.repo.query(this.compose().where(predicate).limit(1), options.signal), []);
|
|
453
|
+
return null != (_rows_ = rows[0]) ? _rows_ : null;
|
|
454
|
+
}
|
|
455
|
+
async all(options = {}) {
|
|
456
|
+
return orEmpty(()=>this.repo.query(this.compose(), options.signal), []);
|
|
457
|
+
}
|
|
458
|
+
async where(predicate, options = {}) {
|
|
459
|
+
return orEmpty(()=>this.repo.query(this.compose().where(predicate), options.signal), []);
|
|
460
|
+
}
|
|
461
|
+
async count(predicate, options = {}) {
|
|
462
|
+
const builder = this.compose().selectCount();
|
|
463
|
+
if (predicate) builder.where(predicate);
|
|
464
|
+
const rows = await orEmpty(()=>this.repo.query(builder, options.signal), [
|
|
465
|
+
{
|
|
466
|
+
count: 0
|
|
467
|
+
}
|
|
468
|
+
]);
|
|
469
|
+
return Number(rows[0].count);
|
|
470
|
+
}
|
|
471
|
+
async any(predicate, options = {}) {
|
|
472
|
+
var _ref;
|
|
473
|
+
var _results__rows_, _results_;
|
|
474
|
+
const inner = this.compose().selectRaw('1').where(predicate).limit(1).build(this.repo.buildOptions());
|
|
475
|
+
const results = await orEmpty(()=>this.repo.runStatements([
|
|
476
|
+
{
|
|
477
|
+
sql: `SELECT EXISTS(${inner.sql}) AS "any"`,
|
|
478
|
+
params: inner.params
|
|
479
|
+
}
|
|
480
|
+
], options.signal), []);
|
|
481
|
+
return Number(null != (_ref = null == (_results_ = results[0]) ? void 0 : null == (_results__rows_ = _results_.rows[0]) ? void 0 : _results__rows_[0]) ? _ref : 0) > 0;
|
|
482
|
+
}
|
|
483
|
+
async query(compose, options = {}) {
|
|
484
|
+
const builder = 'function' == typeof compose ? compose(this.compose()) : compose;
|
|
485
|
+
return orEmpty(()=>this.repo.query(builder, options.signal), []);
|
|
486
|
+
}
|
|
487
|
+
async queryStatement(statement, options = {}) {
|
|
488
|
+
return orEmpty(async ()=>{
|
|
489
|
+
const [r] = await this.repo.runStatements([
|
|
490
|
+
statement
|
|
491
|
+
], options.signal);
|
|
492
|
+
return decodeEntityRows(this.repo.entity, r, this.repo.codec);
|
|
493
|
+
}, []);
|
|
494
|
+
}
|
|
495
|
+
async queryStatementAs(statement, options = {}) {
|
|
496
|
+
return orEmpty(async ()=>{
|
|
497
|
+
const [r] = await this.repo.runStatements([
|
|
498
|
+
statement
|
|
499
|
+
], options.signal);
|
|
500
|
+
return decodeGenericRows(r);
|
|
501
|
+
}, []);
|
|
502
|
+
}
|
|
503
|
+
constructor(repo){
|
|
504
|
+
_define_property(this, "repo", void 0);
|
|
505
|
+
this.repo = repo;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
class G9InsertAccessor {
|
|
509
|
+
prepare(row) {
|
|
510
|
+
const userId = resolveCurrentUserId(this.repo.db.options.currentUser, this.repo.codec.idCase);
|
|
511
|
+
this.repo.prepareRow(row, 'insert', this.repo.db.options.clock.now(), userId);
|
|
512
|
+
return row;
|
|
513
|
+
}
|
|
514
|
+
async one(row, options = {}) {
|
|
515
|
+
return this.many([
|
|
516
|
+
row
|
|
517
|
+
], options);
|
|
518
|
+
}
|
|
519
|
+
async many(rows, options = {}) {
|
|
520
|
+
var _options_conflict;
|
|
521
|
+
const conflict = null != (_options_conflict = options.conflict) ? _options_conflict : this.repo.entity.conflictPolicy;
|
|
522
|
+
const kind = 'object' == typeof conflict ? G9WriteKind.Upsert : G9WriteKind.Insert;
|
|
523
|
+
return this.repo.writeRows([
|
|
524
|
+
...rows
|
|
525
|
+
], kind, 'object' == typeof conflict ? 'upsert' : 'insert', conflict, options);
|
|
526
|
+
}
|
|
527
|
+
async batch(rows, options = {}) {
|
|
528
|
+
var _options_batchSize;
|
|
529
|
+
const batchSize = null != (_options_batchSize = options.batchSize) ? _options_batchSize : 500;
|
|
530
|
+
if (!Number.isSafeInteger(batchSize) || batchSize <= 0) throw new G9SqliteError('misuse', 'batchSize must be > 0.');
|
|
531
|
+
if (false !== options.singleTransaction) return this.many(rows, options);
|
|
532
|
+
let total = 0;
|
|
533
|
+
for(let i = 0; i < rows.length; i += batchSize)total += await this.many(rows.slice(i, i + batchSize), options);
|
|
534
|
+
return total;
|
|
535
|
+
}
|
|
536
|
+
async orReplace(row, options = {}) {
|
|
537
|
+
return this.repo.writeRows([
|
|
538
|
+
row
|
|
539
|
+
], G9WriteKind.Upsert, 'upsert', 'replace', options);
|
|
540
|
+
}
|
|
541
|
+
async merge(rows, options = {}) {
|
|
542
|
+
var _options_batchSize;
|
|
543
|
+
const batchSize = null != (_options_batchSize = options.batchSize) ? _options_batchSize : 500;
|
|
544
|
+
if (!Number.isSafeInteger(batchSize) || batchSize <= 0) throw new G9SqliteError('misuse', 'batchSize must be > 0.');
|
|
545
|
+
let target;
|
|
546
|
+
if ('function' == typeof options.keys) {
|
|
547
|
+
const sel = options.keys(this.repo.entity.refs);
|
|
548
|
+
target = (isColumnRef(sel) ? [
|
|
549
|
+
sel
|
|
550
|
+
] : sel).map((r)=>r.property);
|
|
551
|
+
} else if (options.keys) target = [
|
|
552
|
+
...options.keys
|
|
553
|
+
];
|
|
554
|
+
if (target) for (const k of target)this.repo.column(k);
|
|
555
|
+
if (target && 0 === target.length) throw new G9SqliteError('misuse', 'No valid merge keys were given.');
|
|
556
|
+
const conflict = {
|
|
557
|
+
kind: 'upsert',
|
|
558
|
+
target,
|
|
559
|
+
update: void 0
|
|
560
|
+
};
|
|
561
|
+
return this.repo.writeRows([
|
|
562
|
+
...rows
|
|
563
|
+
], G9WriteKind.Upsert, 'upsert', conflict, options);
|
|
564
|
+
}
|
|
565
|
+
constructor(repo){
|
|
566
|
+
_define_property(this, "repo", void 0);
|
|
567
|
+
this.repo = repo;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
class G9UpdateAccessor {
|
|
571
|
+
compose() {
|
|
572
|
+
return G9Sql.update(this.repo.entity);
|
|
573
|
+
}
|
|
574
|
+
async one(row, options = {}) {
|
|
575
|
+
return this.repo.updateRows([
|
|
576
|
+
row
|
|
577
|
+
], options);
|
|
578
|
+
}
|
|
579
|
+
async many(rows, options = {}) {
|
|
580
|
+
return this.repo.updateRows([
|
|
581
|
+
...rows
|
|
582
|
+
], options);
|
|
583
|
+
}
|
|
584
|
+
async setAuditUserIds(predicate, auditUserId, options = {}) {
|
|
585
|
+
const created = this.repo.entity.byProperty.get('createdByUserId');
|
|
586
|
+
const updated = this.repo.entity.byProperty.get('updatedByUserId');
|
|
587
|
+
if (!created && !updated) return 0;
|
|
588
|
+
const builder = this.compose();
|
|
589
|
+
if (created) builder.set('createdByUserId', auditUserId);
|
|
590
|
+
if (updated) builder.set('updatedByUserId', auditUserId);
|
|
591
|
+
builder.where(predicate);
|
|
592
|
+
return this.repo.runPartialUpdate(builder, G9WriteKind.PartialUpdate, options);
|
|
593
|
+
}
|
|
594
|
+
async execute(compose, options = {}) {
|
|
595
|
+
const builder = 'function' == typeof compose ? compose(this.compose()) : compose;
|
|
596
|
+
return this.repo.runPartialUpdate(builder, G9WriteKind.PartialUpdate, options);
|
|
597
|
+
}
|
|
598
|
+
async executeStatement(statement, options = {}) {
|
|
599
|
+
return this.repo.executeRaw(statement, options.signal);
|
|
600
|
+
}
|
|
601
|
+
constructor(repo){
|
|
602
|
+
_define_property(this, "repo", void 0);
|
|
603
|
+
this.repo = repo;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
class G9DeleteAccessor {
|
|
607
|
+
compose() {
|
|
608
|
+
return G9Sql["delete"](this.repo.entity);
|
|
609
|
+
}
|
|
610
|
+
async entity(row, options = {}) {
|
|
611
|
+
return this.repo.runDelete(this.compose().where(()=>this.repo.keyPredicate(row)), options);
|
|
612
|
+
}
|
|
613
|
+
async entities(rows, options = {}) {
|
|
614
|
+
if (0 === rows.length) return 0;
|
|
615
|
+
const pk = this.repo.entity.primaryKey;
|
|
616
|
+
if (1 !== pk.length) return this.repo.db.unit(this.repo.scope.tx, true, async (uow)=>{
|
|
617
|
+
const scoped = new G9Repository({
|
|
618
|
+
...this.repo.scope,
|
|
619
|
+
tx: uow.txState
|
|
620
|
+
}, this.repo.entity);
|
|
621
|
+
let n = 0;
|
|
622
|
+
for (const row of rows)n += await scoped.delete.entity(row, options);
|
|
623
|
+
return n;
|
|
624
|
+
});
|
|
625
|
+
const key = pk[0];
|
|
626
|
+
const refs = this.repo.entity.refs;
|
|
627
|
+
return this.repo.runDelete(this.compose().where(()=>inList(refs[key.property], rows.map((r)=>r[key.property]))), options);
|
|
628
|
+
}
|
|
629
|
+
async all(options = {}) {
|
|
630
|
+
return this.repo.runDelete(this.compose().allRows(), options);
|
|
631
|
+
}
|
|
632
|
+
async where(predicate, options = {}) {
|
|
633
|
+
return this.repo.runDelete(this.compose().where(predicate), options);
|
|
634
|
+
}
|
|
635
|
+
async execute(compose, options = {}) {
|
|
636
|
+
const builder = 'function' == typeof compose ? compose(this.compose()) : compose;
|
|
637
|
+
return this.repo.runDelete(builder, options);
|
|
638
|
+
}
|
|
639
|
+
async executeStatement(statement, options = {}) {
|
|
640
|
+
return this.repo.executeRaw(statement, options.signal);
|
|
641
|
+
}
|
|
642
|
+
constructor(repo){
|
|
643
|
+
_define_property(this, "repo", void 0);
|
|
644
|
+
this.repo = repo;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
class G9TableAccessor {
|
|
648
|
+
get name() {
|
|
649
|
+
return this.repo.entity.table;
|
|
650
|
+
}
|
|
651
|
+
async exists() {
|
|
652
|
+
const n = await this.scalar("SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = ?", this.name);
|
|
653
|
+
return Number(n) > 0;
|
|
654
|
+
}
|
|
655
|
+
async hasColumn(column) {
|
|
656
|
+
const name = 'function' == typeof column ? column(this.repo.entity.refs).column : column;
|
|
657
|
+
if ('string' != typeof name || '' === name.trim()) throw new G9SqliteError('misuse', 'A column name is required.');
|
|
658
|
+
const n = await this.scalar('SELECT COUNT(*) FROM pragma_table_info(?) WHERE lower(name) = lower(?)', this.name, name);
|
|
659
|
+
return Number(n) > 0;
|
|
660
|
+
}
|
|
661
|
+
async query(sql, ...params) {
|
|
662
|
+
return orEmpty(async ()=>{
|
|
663
|
+
const [r] = await this.repo.runStatements([
|
|
664
|
+
{
|
|
665
|
+
sql,
|
|
666
|
+
params: this.repo.db.encodeRaw(params)
|
|
667
|
+
}
|
|
668
|
+
]);
|
|
669
|
+
return decodeEntityRows(this.repo.entity, r, this.repo.codec);
|
|
670
|
+
}, []);
|
|
671
|
+
}
|
|
672
|
+
async queryAs(sql, ...params) {
|
|
673
|
+
return orEmpty(async ()=>{
|
|
674
|
+
const [r] = await this.repo.runStatements([
|
|
675
|
+
{
|
|
676
|
+
sql,
|
|
677
|
+
params: this.repo.db.encodeRaw(params)
|
|
678
|
+
}
|
|
679
|
+
]);
|
|
680
|
+
return decodeGenericRows(r);
|
|
681
|
+
}, []);
|
|
682
|
+
}
|
|
683
|
+
async scalar(sql, ...params) {
|
|
684
|
+
return orEmpty(async ()=>{
|
|
685
|
+
var _r_rows_;
|
|
686
|
+
const [r] = await this.repo.runStatements([
|
|
687
|
+
{
|
|
688
|
+
sql,
|
|
689
|
+
params: this.repo.db.encodeRaw(params)
|
|
690
|
+
}
|
|
691
|
+
]);
|
|
692
|
+
const v = null == r ? void 0 : null == (_r_rows_ = r.rows[0]) ? void 0 : _r_rows_[0];
|
|
693
|
+
return void 0 === v ? null : isInt64Tag(v) ? v.int64 : v;
|
|
694
|
+
}, null);
|
|
695
|
+
}
|
|
696
|
+
async execute(sql, ...params) {
|
|
697
|
+
return this.repo.executeRaw({
|
|
698
|
+
sql,
|
|
699
|
+
params: this.repo.db.encodeRaw(params)
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
async executeStatement(statement) {
|
|
703
|
+
return this.repo.executeRaw(statement);
|
|
704
|
+
}
|
|
705
|
+
async runInTransaction(work) {
|
|
706
|
+
return this.repo.scope.transaction(work);
|
|
707
|
+
}
|
|
708
|
+
constructor(repo){
|
|
709
|
+
_define_property(this, "repo", void 0);
|
|
710
|
+
this.repo = repo;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
export { G9DeleteAccessor, G9InsertAccessor, G9Repository, G9SelectAccessor, G9TableAccessor, G9UpdateAccessor, isMutationSql };
|
|
714
|
+
|
|
715
|
+
//# sourceMappingURL=repository.js.map
|