@authhero/drizzle 0.32.0 → 0.34.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/dist/drizzle-adapter.cjs +2 -2
- package/dist/drizzle-adapter.mjs +1157 -1011
- package/drizzle/meta/0000_snapshot.json +115 -382
- package/drizzle/meta/0001_snapshot.json +116 -385
- package/drizzle/meta/_journal.json +1 -1
- package/package.json +2 -2
- package/src/schema/sqlite/branding.ts +37 -17
package/dist/drizzle-adapter.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (i, t, e) =>
|
|
1
|
+
var pr = Object.defineProperty;
|
|
2
|
+
var yr = (i, t, e) => t in i ? pr(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var f = (i, t, e) => yr(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
const v = Symbol.for("drizzle:entityKind");
|
|
5
5
|
function H(i, t) {
|
|
6
6
|
if (!i || typeof i != "object")
|
|
@@ -20,9 +20,9 @@ function H(i, t) {
|
|
|
20
20
|
}
|
|
21
21
|
return !1;
|
|
22
22
|
}
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
class
|
|
23
|
+
var Kt;
|
|
24
|
+
Kt = v;
|
|
25
|
+
class Pe {
|
|
26
26
|
constructor(t, e) {
|
|
27
27
|
f(this, "name");
|
|
28
28
|
f(this, "keyAsName");
|
|
@@ -54,10 +54,10 @@ class Be {
|
|
|
54
54
|
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
f(
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
class
|
|
57
|
+
f(Pe, Kt, "Column");
|
|
58
|
+
var jt;
|
|
59
|
+
jt = v;
|
|
60
|
+
class Ii {
|
|
61
61
|
constructor(t, e, n) {
|
|
62
62
|
f(this, "config");
|
|
63
63
|
/**
|
|
@@ -147,14 +147,14 @@ class ki {
|
|
|
147
147
|
this.config.name === "" && (this.config.name = t);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
f(
|
|
151
|
-
const
|
|
152
|
-
function
|
|
153
|
-
return !!i && typeof i == "function" &&
|
|
150
|
+
f(Ii, jt, "ColumnBuilder");
|
|
151
|
+
const Ie = Symbol.for("drizzle:Name"), It = Symbol.for("drizzle:isPgEnum");
|
|
152
|
+
function wr(i) {
|
|
153
|
+
return !!i && typeof i == "function" && It in i && i[It] === !0;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
class
|
|
155
|
+
var Mt;
|
|
156
|
+
Mt = v;
|
|
157
|
+
class bt {
|
|
158
158
|
constructor(t, e, n, s = !1, o = []) {
|
|
159
159
|
this._ = {
|
|
160
160
|
brand: "Subquery",
|
|
@@ -169,85 +169,85 @@ class St {
|
|
|
169
169
|
// return new SQL([this]);
|
|
170
170
|
// }
|
|
171
171
|
}
|
|
172
|
-
f(
|
|
173
|
-
const
|
|
172
|
+
f(bt, Mt, "Subquery");
|
|
173
|
+
const Nr = {
|
|
174
174
|
startActiveSpan(i, t) {
|
|
175
175
|
return t();
|
|
176
176
|
}
|
|
177
|
-
},
|
|
178
|
-
var
|
|
179
|
-
|
|
177
|
+
}, Ee = Symbol.for("drizzle:ViewBaseConfig"), Xe = Symbol.for("drizzle:Schema"), Tt = Symbol.for("drizzle:Columns"), qt = Symbol.for("drizzle:ExtraConfigColumns"), Ze = Symbol.for("drizzle:OriginalName"), et = Symbol.for("drizzle:BaseName"), Me = Symbol.for("drizzle:IsAlias"), Lt = Symbol.for("drizzle:ExtraConfigBuilder"), vr = Symbol.for("drizzle:IsDrizzleTable");
|
|
178
|
+
var Vt, Rt, Wt, Ht, Gt, Yt, Xt, Zt, en, tn;
|
|
179
|
+
tn = v, en = Ie, Zt = Ze, Xt = Xe, Yt = Tt, Gt = qt, Ht = et, Wt = Me, Rt = vr, Vt = Lt;
|
|
180
180
|
class M {
|
|
181
181
|
constructor(t, e, n) {
|
|
182
182
|
/**
|
|
183
183
|
* @internal
|
|
184
184
|
* Can be changed if the table is aliased.
|
|
185
185
|
*/
|
|
186
|
-
f(this,
|
|
186
|
+
f(this, en);
|
|
187
187
|
/**
|
|
188
188
|
* @internal
|
|
189
189
|
* Used to store the original name of the table, before any aliasing.
|
|
190
190
|
*/
|
|
191
|
-
f(this,
|
|
191
|
+
f(this, Zt);
|
|
192
192
|
/** @internal */
|
|
193
|
-
f(this,
|
|
193
|
+
f(this, Xt);
|
|
194
194
|
/** @internal */
|
|
195
|
-
f(this,
|
|
195
|
+
f(this, Yt);
|
|
196
196
|
/** @internal */
|
|
197
|
-
f(this,
|
|
197
|
+
f(this, Gt);
|
|
198
198
|
/**
|
|
199
199
|
* @internal
|
|
200
200
|
* Used to store the table name before the transformation via the `tableCreator` functions.
|
|
201
201
|
*/
|
|
202
|
-
f(this,
|
|
202
|
+
f(this, Ht);
|
|
203
203
|
/** @internal */
|
|
204
|
-
f(this,
|
|
204
|
+
f(this, Wt, !1);
|
|
205
205
|
/** @internal */
|
|
206
|
-
f(this,
|
|
206
|
+
f(this, Rt, !0);
|
|
207
207
|
/** @internal */
|
|
208
|
-
f(this,
|
|
209
|
-
this[
|
|
208
|
+
f(this, Vt);
|
|
209
|
+
this[Ie] = this[Ze] = t, this[Xe] = e, this[et] = n;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
f(M,
|
|
212
|
+
f(M, tn, "Table"), /** @internal */
|
|
213
213
|
f(M, "Symbol", {
|
|
214
|
-
Name:
|
|
215
|
-
Schema:
|
|
216
|
-
OriginalName:
|
|
217
|
-
Columns:
|
|
218
|
-
ExtraConfigColumns:
|
|
219
|
-
BaseName:
|
|
220
|
-
IsAlias:
|
|
221
|
-
ExtraConfigBuilder:
|
|
214
|
+
Name: Ie,
|
|
215
|
+
Schema: Xe,
|
|
216
|
+
OriginalName: Ze,
|
|
217
|
+
Columns: Tt,
|
|
218
|
+
ExtraConfigColumns: qt,
|
|
219
|
+
BaseName: et,
|
|
220
|
+
IsAlias: Me,
|
|
221
|
+
ExtraConfigBuilder: Lt
|
|
222
222
|
});
|
|
223
|
-
function
|
|
223
|
+
function Ti(i) {
|
|
224
224
|
return i != null && typeof i.getSQL == "function";
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function Sr(i) {
|
|
227
227
|
var e;
|
|
228
228
|
const t = { sql: "", params: [] };
|
|
229
229
|
for (const n of i)
|
|
230
230
|
t.sql += n.sql, t.params.push(...n.params), (e = n.typings) != null && e.length && (t.typings || (t.typings = []), t.typings.push(...n.typings));
|
|
231
231
|
return t;
|
|
232
232
|
}
|
|
233
|
-
var
|
|
234
|
-
|
|
233
|
+
var nn;
|
|
234
|
+
nn = v;
|
|
235
235
|
class G {
|
|
236
236
|
constructor(t) {
|
|
237
237
|
f(this, "value");
|
|
238
238
|
this.value = Array.isArray(t) ? t : [t];
|
|
239
239
|
}
|
|
240
240
|
getSQL() {
|
|
241
|
-
return new
|
|
241
|
+
return new J([this]);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
f(G,
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
const
|
|
244
|
+
f(G, nn, "StringChunk");
|
|
245
|
+
var rn;
|
|
246
|
+
rn = v;
|
|
247
|
+
const De = class De {
|
|
248
248
|
constructor(t) {
|
|
249
249
|
/** @internal */
|
|
250
|
-
f(this, "decoder",
|
|
250
|
+
f(this, "decoder", qi);
|
|
251
251
|
f(this, "shouldInlineParams", !1);
|
|
252
252
|
/** @internal */
|
|
253
253
|
f(this, "usedTables", []);
|
|
@@ -264,7 +264,7 @@ const xe = class xe {
|
|
|
264
264
|
return this.queryChunks.push(...t.queryChunks), this;
|
|
265
265
|
}
|
|
266
266
|
toQuery(t) {
|
|
267
|
-
return
|
|
267
|
+
return Nr.startActiveSpan("drizzle.buildSQL", (e) => {
|
|
268
268
|
const n = this.buildQueryFromSourceParams(this.queryChunks, t);
|
|
269
269
|
return e == null || e.setAttributes({
|
|
270
270
|
"drizzle.query.text": n.sql,
|
|
@@ -281,14 +281,14 @@ const xe = class xe {
|
|
|
281
281
|
escapeName: o,
|
|
282
282
|
escapeParam: l,
|
|
283
283
|
prepareTyping: _,
|
|
284
|
-
inlineParams:
|
|
285
|
-
paramStartIndex:
|
|
284
|
+
inlineParams: d,
|
|
285
|
+
paramStartIndex: c
|
|
286
286
|
} = n;
|
|
287
|
-
return
|
|
287
|
+
return Sr(t.map((u) => {
|
|
288
288
|
var h;
|
|
289
289
|
if (H(u, G))
|
|
290
290
|
return { sql: u.value.join(""), params: [] };
|
|
291
|
-
if (H(u,
|
|
291
|
+
if (H(u, Ve))
|
|
292
292
|
return { sql: o(u.value), params: [] };
|
|
293
293
|
if (u === void 0)
|
|
294
294
|
return { sql: "", params: [] };
|
|
@@ -298,56 +298,56 @@ const xe = class xe {
|
|
|
298
298
|
g.push(w), y < u.length - 1 && g.push(new G(", "));
|
|
299
299
|
return g.push(new G(")")), this.buildQueryFromSourceParams(g, n);
|
|
300
300
|
}
|
|
301
|
-
if (H(u,
|
|
301
|
+
if (H(u, De))
|
|
302
302
|
return this.buildQueryFromSourceParams(u.queryChunks, {
|
|
303
303
|
...n,
|
|
304
|
-
inlineParams:
|
|
304
|
+
inlineParams: d || u.shouldInlineParams
|
|
305
305
|
});
|
|
306
306
|
if (H(u, M)) {
|
|
307
307
|
const g = u[M.Symbol.Schema], y = u[M.Symbol.Name];
|
|
308
308
|
return {
|
|
309
|
-
sql: g === void 0 || u[
|
|
309
|
+
sql: g === void 0 || u[Me] ? o(y) : o(g) + "." + o(y),
|
|
310
310
|
params: []
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
|
-
if (H(u,
|
|
313
|
+
if (H(u, Pe)) {
|
|
314
314
|
const g = s.getColumnCasing(u);
|
|
315
315
|
if (e.invokeSource === "indexes")
|
|
316
316
|
return { sql: o(g), params: [] };
|
|
317
317
|
const y = u.table[M.Symbol.Schema];
|
|
318
318
|
return {
|
|
319
|
-
sql: u.table[
|
|
319
|
+
sql: u.table[Me] || y === void 0 ? o(u.table[M.Symbol.Name]) + "." + o(g) : o(y) + "." + o(u.table[M.Symbol.Name]) + "." + o(g),
|
|
320
320
|
params: []
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
if (H(u,
|
|
324
|
-
const g = u[
|
|
323
|
+
if (H(u, xt)) {
|
|
324
|
+
const g = u[Ee].schema, y = u[Ee].name;
|
|
325
325
|
return {
|
|
326
|
-
sql: g === void 0 || u[
|
|
326
|
+
sql: g === void 0 || u[Ee].isAlias ? o(y) : o(g) + "." + o(y),
|
|
327
327
|
params: []
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
if (H(u,
|
|
331
|
-
if (H(u.value,
|
|
332
|
-
return { sql: l(
|
|
330
|
+
if (H(u, Ae)) {
|
|
331
|
+
if (H(u.value, Ce))
|
|
332
|
+
return { sql: l(c.value++, u), params: [u], typings: ["none"] };
|
|
333
333
|
const g = u.value === null ? null : u.encoder.mapToDriverValue(u.value);
|
|
334
|
-
if (H(g,
|
|
334
|
+
if (H(g, De))
|
|
335
335
|
return this.buildQueryFromSourceParams([g], n);
|
|
336
|
-
if (
|
|
336
|
+
if (d)
|
|
337
337
|
return { sql: this.mapInlineParam(g, n), params: [] };
|
|
338
338
|
let y = ["none"];
|
|
339
|
-
return _ && (y = [_(u.encoder)]), { sql: l(
|
|
339
|
+
return _ && (y = [_(u.encoder)]), { sql: l(c.value++, g), params: [g], typings: y };
|
|
340
340
|
}
|
|
341
|
-
return H(u,
|
|
341
|
+
return H(u, Ce) ? { sql: l(c.value++, u), params: [u], typings: ["none"] } : H(u, De.Aliased) && u.fieldAlias !== void 0 ? { sql: o(u.fieldAlias), params: [] } : H(u, bt) ? u._.isWith ? { sql: o(u._.alias), params: [] } : this.buildQueryFromSourceParams([
|
|
342
342
|
new G("("),
|
|
343
343
|
u._.sql,
|
|
344
344
|
new G(") "),
|
|
345
|
-
new
|
|
346
|
-
], n) :
|
|
345
|
+
new Ve(u._.alias)
|
|
346
|
+
], n) : wr(u) ? u.schema ? { sql: o(u.schema) + "." + o(u.enumName), params: [] } : { sql: o(u.enumName), params: [] } : Ti(u) ? (h = u.shouldOmitSQLParens) != null && h.call(u) ? this.buildQueryFromSourceParams([u.getSQL()], n) : this.buildQueryFromSourceParams([
|
|
347
347
|
new G("("),
|
|
348
348
|
u.getSQL(),
|
|
349
349
|
new G(")")
|
|
350
|
-
], n) :
|
|
350
|
+
], n) : d ? { sql: this.mapInlineParam(u, n), params: [] } : { sql: l(c.value++, u), params: [u], typings: ["none"] };
|
|
351
351
|
}));
|
|
352
352
|
}
|
|
353
353
|
mapInlineParam(t, { escapeString: e }) {
|
|
@@ -367,7 +367,7 @@ const xe = class xe {
|
|
|
367
367
|
return this;
|
|
368
368
|
}
|
|
369
369
|
as(t) {
|
|
370
|
-
return t === void 0 ? this : new
|
|
370
|
+
return t === void 0 ? this : new De.Aliased(this, t);
|
|
371
371
|
}
|
|
372
372
|
mapWith(t) {
|
|
373
373
|
return this.decoder = typeof t == "function" ? { mapFromDriverValue: t } : t, this;
|
|
@@ -385,85 +385,85 @@ const xe = class xe {
|
|
|
385
385
|
return t ? this : void 0;
|
|
386
386
|
}
|
|
387
387
|
};
|
|
388
|
-
f(
|
|
389
|
-
let
|
|
390
|
-
var
|
|
391
|
-
|
|
392
|
-
class
|
|
388
|
+
f(De, rn, "SQL");
|
|
389
|
+
let J = De;
|
|
390
|
+
var sn;
|
|
391
|
+
sn = v;
|
|
392
|
+
class Ve {
|
|
393
393
|
constructor(t) {
|
|
394
394
|
f(this, "brand");
|
|
395
395
|
this.value = t;
|
|
396
396
|
}
|
|
397
397
|
getSQL() {
|
|
398
|
-
return new
|
|
398
|
+
return new J([this]);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
f(
|
|
402
|
-
function
|
|
401
|
+
f(Ve, sn, "Name");
|
|
402
|
+
function br(i) {
|
|
403
403
|
return typeof i == "object" && i !== null && "mapToDriverValue" in i && typeof i.mapToDriverValue == "function";
|
|
404
404
|
}
|
|
405
|
-
const
|
|
405
|
+
const qi = {
|
|
406
406
|
mapFromDriverValue: (i) => i
|
|
407
|
-
},
|
|
407
|
+
}, Li = {
|
|
408
408
|
mapToDriverValue: (i) => i
|
|
409
409
|
};
|
|
410
410
|
({
|
|
411
|
-
...
|
|
412
|
-
...
|
|
411
|
+
...qi,
|
|
412
|
+
...Li
|
|
413
413
|
});
|
|
414
|
-
var
|
|
415
|
-
|
|
416
|
-
class
|
|
414
|
+
var on;
|
|
415
|
+
on = v;
|
|
416
|
+
class Ae {
|
|
417
417
|
/**
|
|
418
418
|
* @param value - Parameter value
|
|
419
419
|
* @param encoder - Encoder to convert the value to a driver parameter
|
|
420
420
|
*/
|
|
421
|
-
constructor(t, e =
|
|
421
|
+
constructor(t, e = Li) {
|
|
422
422
|
f(this, "brand");
|
|
423
423
|
this.value = t, this.encoder = e;
|
|
424
424
|
}
|
|
425
425
|
getSQL() {
|
|
426
|
-
return new
|
|
426
|
+
return new J([this]);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
f(
|
|
429
|
+
f(Ae, on, "Param");
|
|
430
430
|
function N(i, ...t) {
|
|
431
431
|
const e = [];
|
|
432
432
|
(t.length > 0 || i.length > 0 && i[0] !== "") && e.push(new G(i[0]));
|
|
433
433
|
for (const [n, s] of t.entries())
|
|
434
434
|
e.push(s, new G(i[n + 1]));
|
|
435
|
-
return new
|
|
435
|
+
return new J(e);
|
|
436
436
|
}
|
|
437
437
|
((i) => {
|
|
438
438
|
function t() {
|
|
439
|
-
return new
|
|
439
|
+
return new J([]);
|
|
440
440
|
}
|
|
441
441
|
i.empty = t;
|
|
442
|
-
function e(
|
|
443
|
-
return new
|
|
442
|
+
function e(d) {
|
|
443
|
+
return new J(d);
|
|
444
444
|
}
|
|
445
445
|
i.fromList = e;
|
|
446
|
-
function n(
|
|
447
|
-
return new
|
|
446
|
+
function n(d) {
|
|
447
|
+
return new J([new G(d)]);
|
|
448
448
|
}
|
|
449
449
|
i.raw = n;
|
|
450
|
-
function s(
|
|
450
|
+
function s(d, c) {
|
|
451
451
|
const u = [];
|
|
452
|
-
for (const [h, g] of
|
|
453
|
-
h > 0 &&
|
|
454
|
-
return new
|
|
452
|
+
for (const [h, g] of d.entries())
|
|
453
|
+
h > 0 && c !== void 0 && u.push(c), u.push(g);
|
|
454
|
+
return new J(u);
|
|
455
455
|
}
|
|
456
456
|
i.join = s;
|
|
457
|
-
function o(
|
|
458
|
-
return new
|
|
457
|
+
function o(d) {
|
|
458
|
+
return new Ve(d);
|
|
459
459
|
}
|
|
460
460
|
i.identifier = o;
|
|
461
|
-
function l(
|
|
462
|
-
return new
|
|
461
|
+
function l(d) {
|
|
462
|
+
return new Ce(d);
|
|
463
463
|
}
|
|
464
464
|
i.placeholder = l;
|
|
465
|
-
function _(
|
|
466
|
-
return new
|
|
465
|
+
function _(d, c) {
|
|
466
|
+
return new Ae(d, c);
|
|
467
467
|
}
|
|
468
468
|
i.param = _;
|
|
469
469
|
})(N || (N = {}));
|
|
@@ -487,28 +487,28 @@ function N(i, ...t) {
|
|
|
487
487
|
f(n, e, "SQL.Aliased");
|
|
488
488
|
let t = n;
|
|
489
489
|
i.Aliased = t;
|
|
490
|
-
})(
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
class
|
|
490
|
+
})(J || (J = {}));
|
|
491
|
+
var an;
|
|
492
|
+
an = v;
|
|
493
|
+
class Ce {
|
|
494
494
|
constructor(t) {
|
|
495
495
|
this.name = t;
|
|
496
496
|
}
|
|
497
497
|
getSQL() {
|
|
498
|
-
return new
|
|
498
|
+
return new J([this]);
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
f(
|
|
502
|
-
const
|
|
503
|
-
var
|
|
504
|
-
|
|
505
|
-
class
|
|
501
|
+
f(Ce, an, "Placeholder");
|
|
502
|
+
const xr = Symbol.for("drizzle:IsDrizzleView");
|
|
503
|
+
var ln, _n, un;
|
|
504
|
+
un = v, _n = Ee, ln = xr;
|
|
505
|
+
class xt {
|
|
506
506
|
constructor({ name: t, schema: e, selectedFields: n, query: s }) {
|
|
507
507
|
/** @internal */
|
|
508
|
-
f(this,
|
|
508
|
+
f(this, _n);
|
|
509
509
|
/** @internal */
|
|
510
|
-
f(this,
|
|
511
|
-
this[
|
|
510
|
+
f(this, ln, !0);
|
|
511
|
+
this[Ee] = {
|
|
512
512
|
name: t,
|
|
513
513
|
originalName: t,
|
|
514
514
|
schema: e,
|
|
@@ -519,36 +519,36 @@ class bt {
|
|
|
519
519
|
};
|
|
520
520
|
}
|
|
521
521
|
getSQL() {
|
|
522
|
-
return new
|
|
522
|
+
return new J([this]);
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
|
-
f(
|
|
526
|
-
|
|
527
|
-
return new
|
|
525
|
+
f(xt, un, "View");
|
|
526
|
+
Pe.prototype.getSQL = function() {
|
|
527
|
+
return new J([this]);
|
|
528
528
|
};
|
|
529
529
|
M.prototype.getSQL = function() {
|
|
530
|
-
return new
|
|
530
|
+
return new J([this]);
|
|
531
531
|
};
|
|
532
|
-
|
|
533
|
-
return new
|
|
532
|
+
bt.prototype.getSQL = function() {
|
|
533
|
+
return new J([this]);
|
|
534
534
|
};
|
|
535
|
-
function
|
|
535
|
+
function Qe(i, t) {
|
|
536
536
|
return {
|
|
537
537
|
name: typeof i == "string" && i.length > 0 ? i : "",
|
|
538
538
|
config: typeof i == "object" ? i : t
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
|
-
const
|
|
542
|
-
function
|
|
543
|
-
return
|
|
541
|
+
const Ei = typeof TextDecoder > "u" ? null : new TextDecoder();
|
|
542
|
+
function Se(i, t) {
|
|
543
|
+
return br(t) && !Ti(i) && !H(i, Ae) && !H(i, Ce) && !H(i, Pe) && !H(i, M) && !H(i, xt) ? new Ae(i, t) : i;
|
|
544
544
|
}
|
|
545
|
-
const a = (i, t) => N`${i} = ${
|
|
545
|
+
const a = (i, t) => N`${i} = ${Se(t, i)}`, Dr = (i, t) => N`${i} <> ${Se(t, i)}`;
|
|
546
546
|
function m(...i) {
|
|
547
547
|
const t = i.filter(
|
|
548
548
|
(e) => e !== void 0
|
|
549
549
|
);
|
|
550
550
|
if (t.length !== 0)
|
|
551
|
-
return t.length === 1 ? new
|
|
551
|
+
return t.length === 1 ? new J(t) : new J([
|
|
552
552
|
new G("("),
|
|
553
553
|
N.join(t, new G(" and ")),
|
|
554
554
|
new G(")")
|
|
@@ -559,23 +559,23 @@ function ue(...i) {
|
|
|
559
559
|
(e) => e !== void 0
|
|
560
560
|
);
|
|
561
561
|
if (t.length !== 0)
|
|
562
|
-
return t.length === 1 ? new
|
|
562
|
+
return t.length === 1 ? new J(t) : new J([
|
|
563
563
|
new G("("),
|
|
564
564
|
N.join(t, new G(" or ")),
|
|
565
565
|
new G(")")
|
|
566
566
|
]);
|
|
567
567
|
}
|
|
568
|
-
const
|
|
569
|
-
function
|
|
570
|
-
return Array.isArray(t) ? t.length === 0 ? N`false` : N`${i} in ${t.map((e) =>
|
|
568
|
+
const Re = (i, t) => N`${i} > ${Se(t, i)}`, We = (i, t) => N`${i} >= ${Se(t, i)}`, xe = (i, t) => N`${i} < ${Se(t, i)}`, Oe = (i, t) => N`${i} <= ${Se(t, i)}`;
|
|
569
|
+
function we(i, t) {
|
|
570
|
+
return Array.isArray(t) ? t.length === 0 ? N`false` : N`${i} in ${t.map((e) => Se(e, i))}` : N`${i} in ${Se(t, i)}`;
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function pe(i) {
|
|
573
573
|
return N`${i} is null`;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function Or(i) {
|
|
576
576
|
return N`${i} is not null`;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function ze(i, t) {
|
|
579
579
|
return N`${i} like ${t}`;
|
|
580
580
|
}
|
|
581
581
|
function Y(i) {
|
|
@@ -587,9 +587,9 @@ function V(i) {
|
|
|
587
587
|
function R(i) {
|
|
588
588
|
return N`count(${N.raw("*")})`.mapWith(Number);
|
|
589
589
|
}
|
|
590
|
-
var
|
|
591
|
-
|
|
592
|
-
class
|
|
590
|
+
var dn;
|
|
591
|
+
dn = v;
|
|
592
|
+
class Ai {
|
|
593
593
|
constructor(t, e) {
|
|
594
594
|
/** @internal */
|
|
595
595
|
f(this, "reference");
|
|
@@ -610,13 +610,13 @@ class Li {
|
|
|
610
610
|
}
|
|
611
611
|
/** @internal */
|
|
612
612
|
build(t) {
|
|
613
|
-
return new
|
|
613
|
+
return new Ci(t, this);
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
f(
|
|
617
|
-
var
|
|
618
|
-
|
|
619
|
-
class
|
|
616
|
+
f(Ai, dn, "SQLiteForeignKeyBuilder");
|
|
617
|
+
var cn;
|
|
618
|
+
cn = v;
|
|
619
|
+
class Ci {
|
|
620
620
|
constructor(t, e) {
|
|
621
621
|
f(this, "reference");
|
|
622
622
|
f(this, "onUpdate");
|
|
@@ -625,20 +625,20 @@ class Ei {
|
|
|
625
625
|
}
|
|
626
626
|
getName() {
|
|
627
627
|
const { name: t, columns: e, foreignColumns: n } = this.reference(), s = e.map((_) => _.name), o = n.map((_) => _.name), l = [
|
|
628
|
-
this.table[
|
|
628
|
+
this.table[Ie],
|
|
629
629
|
...s,
|
|
630
|
-
n[0].table[
|
|
630
|
+
n[0].table[Ie],
|
|
631
631
|
...o
|
|
632
632
|
];
|
|
633
633
|
return t ?? `${l.join("_")}_fk`;
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
f(
|
|
637
|
-
function
|
|
638
|
-
return `${i[
|
|
636
|
+
f(Ci, cn, "SQLiteForeignKey");
|
|
637
|
+
function kr(i, t) {
|
|
638
|
+
return `${i[Ie]}_${t.join("_")}_unique`;
|
|
639
639
|
}
|
|
640
|
-
var
|
|
641
|
-
class
|
|
640
|
+
var gn, fn;
|
|
641
|
+
class de extends (fn = Ii, gn = v, fn) {
|
|
642
642
|
constructor() {
|
|
643
643
|
super(...arguments);
|
|
644
644
|
f(this, "foreignKeyConfigs", []);
|
|
@@ -659,35 +659,35 @@ class ce extends (dn = ki, cn = v, dn) {
|
|
|
659
659
|
/** @internal */
|
|
660
660
|
buildForeignKeys(e, n) {
|
|
661
661
|
return this.foreignKeyConfigs.map(({ ref: s, actions: o }) => ((l, _) => {
|
|
662
|
-
const
|
|
663
|
-
const
|
|
664
|
-
return { columns: [e], foreignColumns: [
|
|
662
|
+
const d = new Ai(() => {
|
|
663
|
+
const c = l();
|
|
664
|
+
return { columns: [e], foreignColumns: [c] };
|
|
665
665
|
});
|
|
666
|
-
return _.onUpdate &&
|
|
666
|
+
return _.onUpdate && d.onUpdate(_.onUpdate), _.onDelete && d.onDelete(_.onDelete), d.build(n);
|
|
667
667
|
})(s, o));
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
f(
|
|
671
|
-
var
|
|
672
|
-
class
|
|
670
|
+
f(de, gn, "SQLiteColumnBuilder");
|
|
671
|
+
var mn, hn;
|
|
672
|
+
class ce extends (hn = Pe, mn = v, hn) {
|
|
673
673
|
constructor(t, e) {
|
|
674
|
-
e.uniqueName || (e.uniqueName =
|
|
674
|
+
e.uniqueName || (e.uniqueName = kr(t, [e.name])), super(t, e), this.table = t;
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
|
-
f(
|
|
678
|
-
var
|
|
679
|
-
class
|
|
677
|
+
f(ce, mn, "SQLiteColumn");
|
|
678
|
+
var pn, yn;
|
|
679
|
+
class $i extends (yn = de, pn = v, yn) {
|
|
680
680
|
constructor(t) {
|
|
681
681
|
super(t, "bigint", "SQLiteBigInt");
|
|
682
682
|
}
|
|
683
683
|
/** @internal */
|
|
684
684
|
build(t) {
|
|
685
|
-
return new
|
|
685
|
+
return new Bi(t, this.config);
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
|
-
f(
|
|
689
|
-
var
|
|
690
|
-
class
|
|
688
|
+
f($i, pn, "SQLiteBigIntBuilder");
|
|
689
|
+
var wn, Nn;
|
|
690
|
+
class Bi extends (Nn = ce, wn = v, Nn) {
|
|
691
691
|
getSQLType() {
|
|
692
692
|
return "blob";
|
|
693
693
|
}
|
|
@@ -696,29 +696,29 @@ class Ci extends (yn = de, pn = v, yn) {
|
|
|
696
696
|
const e = Buffer.isBuffer(t) ? t : t instanceof ArrayBuffer ? Buffer.from(t) : t.buffer ? Buffer.from(t.buffer, t.byteOffset, t.byteLength) : Buffer.from(t);
|
|
697
697
|
return BigInt(e.toString("utf8"));
|
|
698
698
|
}
|
|
699
|
-
return BigInt(
|
|
699
|
+
return BigInt(Ei.decode(t));
|
|
700
700
|
}
|
|
701
701
|
mapToDriverValue(t) {
|
|
702
702
|
return Buffer.from(t.toString());
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
f(
|
|
706
|
-
var
|
|
707
|
-
class
|
|
705
|
+
f(Bi, wn, "SQLiteBigInt");
|
|
706
|
+
var vn, Sn;
|
|
707
|
+
class Pi extends (Sn = de, vn = v, Sn) {
|
|
708
708
|
constructor(t) {
|
|
709
709
|
super(t, "json", "SQLiteBlobJson");
|
|
710
710
|
}
|
|
711
711
|
/** @internal */
|
|
712
712
|
build(t) {
|
|
713
|
-
return new
|
|
713
|
+
return new Qi(
|
|
714
714
|
t,
|
|
715
715
|
this.config
|
|
716
716
|
);
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
|
-
f(
|
|
720
|
-
var
|
|
721
|
-
class
|
|
719
|
+
f(Pi, vn, "SQLiteBlobJsonBuilder");
|
|
720
|
+
var bn, xn;
|
|
721
|
+
class Qi extends (xn = ce, bn = v, xn) {
|
|
722
722
|
getSQLType() {
|
|
723
723
|
return "blob";
|
|
724
724
|
}
|
|
@@ -727,26 +727,26 @@ class Bi extends (Sn = de, vn = v, Sn) {
|
|
|
727
727
|
const e = Buffer.isBuffer(t) ? t : t instanceof ArrayBuffer ? Buffer.from(t) : t.buffer ? Buffer.from(t.buffer, t.byteOffset, t.byteLength) : Buffer.from(t);
|
|
728
728
|
return JSON.parse(e.toString("utf8"));
|
|
729
729
|
}
|
|
730
|
-
return JSON.parse(
|
|
730
|
+
return JSON.parse(Ei.decode(t));
|
|
731
731
|
}
|
|
732
732
|
mapToDriverValue(t) {
|
|
733
733
|
return Buffer.from(JSON.stringify(t));
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
f(
|
|
737
|
-
var
|
|
738
|
-
class
|
|
736
|
+
f(Qi, bn, "SQLiteBlobJson");
|
|
737
|
+
var Dn, On;
|
|
738
|
+
class Ji extends (On = de, Dn = v, On) {
|
|
739
739
|
constructor(t) {
|
|
740
740
|
super(t, "buffer", "SQLiteBlobBuffer");
|
|
741
741
|
}
|
|
742
742
|
/** @internal */
|
|
743
743
|
build(t) {
|
|
744
|
-
return new
|
|
744
|
+
return new Fi(t, this.config);
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
|
-
f(
|
|
748
|
-
var
|
|
749
|
-
class
|
|
747
|
+
f(Ji, Dn, "SQLiteBlobBufferBuilder");
|
|
748
|
+
var kn, zn;
|
|
749
|
+
class Fi extends (zn = ce, kn = v, zn) {
|
|
750
750
|
mapFromDriverValue(t) {
|
|
751
751
|
return Buffer.isBuffer(t) ? t : Buffer.from(t);
|
|
752
752
|
}
|
|
@@ -754,27 +754,27 @@ class Qi extends (On = de, Dn = v, On) {
|
|
|
754
754
|
return "blob";
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
f(
|
|
758
|
-
function
|
|
759
|
-
const { name: e, config: n } =
|
|
760
|
-
return (n == null ? void 0 : n.mode) === "json" ? new
|
|
757
|
+
f(Fi, kn, "SQLiteBlobBuffer");
|
|
758
|
+
function zr(i, t) {
|
|
759
|
+
const { name: e, config: n } = Qe(i, t);
|
|
760
|
+
return (n == null ? void 0 : n.mode) === "json" ? new Pi(e) : (n == null ? void 0 : n.mode) === "bigint" ? new $i(e) : new Ji(e);
|
|
761
761
|
}
|
|
762
|
-
var
|
|
763
|
-
class
|
|
762
|
+
var In, Tn;
|
|
763
|
+
class Ui extends (Tn = de, In = v, Tn) {
|
|
764
764
|
constructor(t, e, n) {
|
|
765
765
|
super(t, "custom", "SQLiteCustomColumn"), this.config.fieldConfig = e, this.config.customTypeParams = n;
|
|
766
766
|
}
|
|
767
767
|
/** @internal */
|
|
768
768
|
build(t) {
|
|
769
|
-
return new
|
|
769
|
+
return new Ki(
|
|
770
770
|
t,
|
|
771
771
|
this.config
|
|
772
772
|
);
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
|
-
f(
|
|
776
|
-
var
|
|
777
|
-
class
|
|
775
|
+
f(Ui, In, "SQLiteCustomColumnBuilder");
|
|
776
|
+
var qn, Ln;
|
|
777
|
+
class Ki extends (Ln = ce, qn = v, Ln) {
|
|
778
778
|
constructor(e, n) {
|
|
779
779
|
super(e, n);
|
|
780
780
|
f(this, "sqlName");
|
|
@@ -792,19 +792,19 @@ class Fi extends (Tn = de, In = v, Tn) {
|
|
|
792
792
|
return typeof this.mapTo == "function" ? this.mapTo(e) : e;
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
|
-
f(
|
|
796
|
-
function
|
|
795
|
+
f(Ki, qn, "SQLiteCustomColumn");
|
|
796
|
+
function Ir(i) {
|
|
797
797
|
return (t, e) => {
|
|
798
|
-
const { name: n, config: s } =
|
|
799
|
-
return new
|
|
798
|
+
const { name: n, config: s } = Qe(t, e);
|
|
799
|
+
return new Ui(
|
|
800
800
|
n,
|
|
801
801
|
s,
|
|
802
802
|
i
|
|
803
803
|
);
|
|
804
804
|
};
|
|
805
805
|
}
|
|
806
|
-
var
|
|
807
|
-
class
|
|
806
|
+
var En, An;
|
|
807
|
+
class He extends (An = de, En = v, An) {
|
|
808
808
|
constructor(t, e, n) {
|
|
809
809
|
super(t, e, n), this.config.autoIncrement = !1;
|
|
810
810
|
}
|
|
@@ -812,9 +812,9 @@ class Re extends (Ln = ce, qn = v, Ln) {
|
|
|
812
812
|
return t != null && t.autoIncrement && (this.config.autoIncrement = !0), this.config.hasDefault = !0, super.primaryKey();
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
f(
|
|
816
|
-
var
|
|
817
|
-
class
|
|
815
|
+
f(He, En, "SQLiteBaseIntegerBuilder");
|
|
816
|
+
var Cn, $n;
|
|
817
|
+
class Ge extends ($n = ce, Cn = v, $n) {
|
|
818
818
|
constructor() {
|
|
819
819
|
super(...arguments);
|
|
820
820
|
f(this, "autoIncrement", this.config.autoIncrement);
|
|
@@ -823,26 +823,26 @@ class We extends (An = de, En = v, An) {
|
|
|
823
823
|
return "integer";
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
f(
|
|
827
|
-
var
|
|
828
|
-
class
|
|
826
|
+
f(Ge, Cn, "SQLiteBaseInteger");
|
|
827
|
+
var Bn, Pn;
|
|
828
|
+
class ji extends (Pn = He, Bn = v, Pn) {
|
|
829
829
|
constructor(t) {
|
|
830
830
|
super(t, "number", "SQLiteInteger");
|
|
831
831
|
}
|
|
832
832
|
build(t) {
|
|
833
|
-
return new
|
|
833
|
+
return new Mi(
|
|
834
834
|
t,
|
|
835
835
|
this.config
|
|
836
836
|
);
|
|
837
837
|
}
|
|
838
838
|
}
|
|
839
|
-
f(
|
|
840
|
-
var Bn, Pn;
|
|
841
|
-
class Ki extends (Pn = We, Bn = v, Pn) {
|
|
842
|
-
}
|
|
843
|
-
f(Ki, Bn, "SQLiteInteger");
|
|
839
|
+
f(ji, Bn, "SQLiteIntegerBuilder");
|
|
844
840
|
var Qn, Jn;
|
|
845
|
-
class
|
|
841
|
+
class Mi extends (Jn = Ge, Qn = v, Jn) {
|
|
842
|
+
}
|
|
843
|
+
f(Mi, Qn, "SQLiteInteger");
|
|
844
|
+
var Fn, Un;
|
|
845
|
+
class Vi extends (Un = He, Fn = v, Un) {
|
|
846
846
|
constructor(t, e) {
|
|
847
847
|
super(t, "date", "SQLiteTimestamp"), this.config.mode = e;
|
|
848
848
|
}
|
|
@@ -855,15 +855,15 @@ class ji extends (Jn = Re, Qn = v, Jn) {
|
|
|
855
855
|
return this.default(N`(cast((julianday('now') - 2440587.5)*86400000 as integer))`);
|
|
856
856
|
}
|
|
857
857
|
build(t) {
|
|
858
|
-
return new
|
|
858
|
+
return new Ri(
|
|
859
859
|
t,
|
|
860
860
|
this.config
|
|
861
861
|
);
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
|
-
f(
|
|
865
|
-
var
|
|
866
|
-
class
|
|
864
|
+
f(Vi, Fn, "SQLiteTimestampBuilder");
|
|
865
|
+
var Kn, jn;
|
|
866
|
+
class Ri extends (jn = Ge, Kn = v, jn) {
|
|
867
867
|
constructor() {
|
|
868
868
|
super(...arguments);
|
|
869
869
|
f(this, "mode", this.config.mode);
|
|
@@ -876,22 +876,22 @@ class Mi extends (Un = We, Fn = v, Un) {
|
|
|
876
876
|
return this.config.mode === "timestamp" ? Math.floor(n / 1e3) : n;
|
|
877
877
|
}
|
|
878
878
|
}
|
|
879
|
-
f(
|
|
880
|
-
var
|
|
881
|
-
class
|
|
879
|
+
f(Ri, Kn, "SQLiteTimestamp");
|
|
880
|
+
var Mn, Vn;
|
|
881
|
+
class Wi extends (Vn = He, Mn = v, Vn) {
|
|
882
882
|
constructor(t, e) {
|
|
883
883
|
super(t, "boolean", "SQLiteBoolean"), this.config.mode = e;
|
|
884
884
|
}
|
|
885
885
|
build(t) {
|
|
886
|
-
return new
|
|
886
|
+
return new Hi(
|
|
887
887
|
t,
|
|
888
888
|
this.config
|
|
889
889
|
);
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
f(
|
|
893
|
-
var
|
|
894
|
-
class
|
|
892
|
+
f(Wi, Mn, "SQLiteBooleanBuilder");
|
|
893
|
+
var Rn, Wn;
|
|
894
|
+
class Hi extends (Wn = Ge, Rn = v, Wn) {
|
|
895
895
|
constructor() {
|
|
896
896
|
super(...arguments);
|
|
897
897
|
f(this, "mode", this.config.mode);
|
|
@@ -903,27 +903,27 @@ class Ri extends (Vn = We, Mn = v, Vn) {
|
|
|
903
903
|
return e ? 1 : 0;
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
f(
|
|
906
|
+
f(Hi, Rn, "SQLiteBoolean");
|
|
907
907
|
function p(i, t) {
|
|
908
|
-
const { name: e, config: n } =
|
|
909
|
-
return (n == null ? void 0 : n.mode) === "timestamp" || (n == null ? void 0 : n.mode) === "timestamp_ms" ? new
|
|
908
|
+
const { name: e, config: n } = Qe(i, t);
|
|
909
|
+
return (n == null ? void 0 : n.mode) === "timestamp" || (n == null ? void 0 : n.mode) === "timestamp_ms" ? new Vi(e, n.mode) : (n == null ? void 0 : n.mode) === "boolean" ? new Wi(e, n.mode) : new ji(e);
|
|
910
910
|
}
|
|
911
|
-
var
|
|
912
|
-
class
|
|
911
|
+
var Hn, Gn;
|
|
912
|
+
class Gi extends (Gn = de, Hn = v, Gn) {
|
|
913
913
|
constructor(t) {
|
|
914
914
|
super(t, "string", "SQLiteNumeric");
|
|
915
915
|
}
|
|
916
916
|
/** @internal */
|
|
917
917
|
build(t) {
|
|
918
|
-
return new
|
|
918
|
+
return new Yi(
|
|
919
919
|
t,
|
|
920
920
|
this.config
|
|
921
921
|
);
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
f(
|
|
925
|
-
var
|
|
926
|
-
class
|
|
924
|
+
f(Gi, Hn, "SQLiteNumericBuilder");
|
|
925
|
+
var Yn, Xn;
|
|
926
|
+
class Yi extends (Xn = ce, Yn = v, Xn) {
|
|
927
927
|
mapFromDriverValue(t) {
|
|
928
928
|
return typeof t == "string" ? t : String(t);
|
|
929
929
|
}
|
|
@@ -931,23 +931,23 @@ class Hi extends (Gn = de, Hn = v, Gn) {
|
|
|
931
931
|
return "numeric";
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
|
-
f(
|
|
935
|
-
var
|
|
936
|
-
class
|
|
934
|
+
f(Yi, Yn, "SQLiteNumeric");
|
|
935
|
+
var Zn, ei;
|
|
936
|
+
class Xi extends (ei = de, Zn = v, ei) {
|
|
937
937
|
constructor(t) {
|
|
938
938
|
super(t, "number", "SQLiteNumericNumber");
|
|
939
939
|
}
|
|
940
940
|
/** @internal */
|
|
941
941
|
build(t) {
|
|
942
|
-
return new
|
|
942
|
+
return new Zi(
|
|
943
943
|
t,
|
|
944
944
|
this.config
|
|
945
945
|
);
|
|
946
946
|
}
|
|
947
947
|
}
|
|
948
|
-
f(
|
|
949
|
-
var
|
|
950
|
-
class
|
|
948
|
+
f(Xi, Zn, "SQLiteNumericNumberBuilder");
|
|
949
|
+
var ti, ni;
|
|
950
|
+
class Zi extends (ni = ce, ti = v, ni) {
|
|
951
951
|
constructor() {
|
|
952
952
|
super(...arguments);
|
|
953
953
|
f(this, "mapToDriverValue", String);
|
|
@@ -959,23 +959,23 @@ class Yi extends (ei = de, Zn = v, ei) {
|
|
|
959
959
|
return "numeric";
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
|
-
f(
|
|
963
|
-
var
|
|
964
|
-
class
|
|
962
|
+
f(Zi, ti, "SQLiteNumericNumber");
|
|
963
|
+
var ii, ri;
|
|
964
|
+
class er extends (ri = de, ii = v, ri) {
|
|
965
965
|
constructor(t) {
|
|
966
966
|
super(t, "bigint", "SQLiteNumericBigInt");
|
|
967
967
|
}
|
|
968
968
|
/** @internal */
|
|
969
969
|
build(t) {
|
|
970
|
-
return new
|
|
970
|
+
return new tr(
|
|
971
971
|
t,
|
|
972
972
|
this.config
|
|
973
973
|
);
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
|
-
f(
|
|
977
|
-
var
|
|
978
|
-
class
|
|
976
|
+
f(er, ii, "SQLiteNumericBigIntBuilder");
|
|
977
|
+
var si, oi;
|
|
978
|
+
class tr extends (oi = ce, si = v, oi) {
|
|
979
979
|
constructor() {
|
|
980
980
|
super(...arguments);
|
|
981
981
|
f(this, "mapFromDriverValue", BigInt);
|
|
@@ -985,48 +985,48 @@ class Zi extends (ri = de, ii = v, ri) {
|
|
|
985
985
|
return "numeric";
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
|
-
f(
|
|
989
|
-
function
|
|
990
|
-
const { name: e, config: n } =
|
|
991
|
-
return s === "number" ? new
|
|
988
|
+
f(tr, si, "SQLiteNumericBigInt");
|
|
989
|
+
function Tr(i, t) {
|
|
990
|
+
const { name: e, config: n } = Qe(i, t), s = n == null ? void 0 : n.mode;
|
|
991
|
+
return s === "number" ? new Xi(e) : s === "bigint" ? new er(e) : new Gi(e);
|
|
992
992
|
}
|
|
993
|
-
var
|
|
994
|
-
class
|
|
993
|
+
var ai, li;
|
|
994
|
+
class nr extends (li = de, ai = v, li) {
|
|
995
995
|
constructor(t) {
|
|
996
996
|
super(t, "number", "SQLiteReal");
|
|
997
997
|
}
|
|
998
998
|
/** @internal */
|
|
999
999
|
build(t) {
|
|
1000
|
-
return new
|
|
1000
|
+
return new ir(t, this.config);
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
f(
|
|
1004
|
-
var
|
|
1005
|
-
class
|
|
1003
|
+
f(nr, ai, "SQLiteRealBuilder");
|
|
1004
|
+
var _i, ui;
|
|
1005
|
+
class ir extends (ui = ce, _i = v, ui) {
|
|
1006
1006
|
getSQLType() {
|
|
1007
1007
|
return "real";
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
f(
|
|
1011
|
-
function
|
|
1012
|
-
return new
|
|
1010
|
+
f(ir, _i, "SQLiteReal");
|
|
1011
|
+
function qr(i) {
|
|
1012
|
+
return new nr(i ?? "");
|
|
1013
1013
|
}
|
|
1014
|
-
var
|
|
1015
|
-
class
|
|
1014
|
+
var di, ci;
|
|
1015
|
+
class rr extends (ci = de, di = v, ci) {
|
|
1016
1016
|
constructor(t, e) {
|
|
1017
1017
|
super(t, "string", "SQLiteText"), this.config.enumValues = e.enum, this.config.length = e.length;
|
|
1018
1018
|
}
|
|
1019
1019
|
/** @internal */
|
|
1020
1020
|
build(t) {
|
|
1021
|
-
return new
|
|
1021
|
+
return new sr(
|
|
1022
1022
|
t,
|
|
1023
1023
|
this.config
|
|
1024
1024
|
);
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
f(
|
|
1028
|
-
var
|
|
1029
|
-
class
|
|
1027
|
+
f(rr, di, "SQLiteTextBuilder");
|
|
1028
|
+
var gi, fi;
|
|
1029
|
+
class sr extends (fi = ce, gi = v, fi) {
|
|
1030
1030
|
constructor(e, n) {
|
|
1031
1031
|
super(e, n);
|
|
1032
1032
|
f(this, "enumValues", this.config.enumValues);
|
|
@@ -1036,23 +1036,23 @@ class ir extends (di = de, ci = v, di) {
|
|
|
1036
1036
|
return `text${this.config.length ? `(${this.config.length})` : ""}`;
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
|
-
f(
|
|
1040
|
-
var
|
|
1041
|
-
class
|
|
1039
|
+
f(sr, gi, "SQLiteText");
|
|
1040
|
+
var mi, hi;
|
|
1041
|
+
class or extends (hi = de, mi = v, hi) {
|
|
1042
1042
|
constructor(t) {
|
|
1043
1043
|
super(t, "json", "SQLiteTextJson");
|
|
1044
1044
|
}
|
|
1045
1045
|
/** @internal */
|
|
1046
1046
|
build(t) {
|
|
1047
|
-
return new
|
|
1047
|
+
return new ar(
|
|
1048
1048
|
t,
|
|
1049
1049
|
this.config
|
|
1050
1050
|
);
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
1053
|
-
f(
|
|
1054
|
-
var
|
|
1055
|
-
class
|
|
1053
|
+
f(or, mi, "SQLiteTextJsonBuilder");
|
|
1054
|
+
var pi, yi;
|
|
1055
|
+
class ar extends (yi = ce, pi = v, yi) {
|
|
1056
1056
|
getSQLType() {
|
|
1057
1057
|
return "text";
|
|
1058
1058
|
}
|
|
@@ -1063,64 +1063,64 @@ class sr extends (hi = de, mi = v, hi) {
|
|
|
1063
1063
|
return JSON.stringify(t);
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
|
-
f(
|
|
1066
|
+
f(ar, pi, "SQLiteTextJson");
|
|
1067
1067
|
function r(i, t = {}) {
|
|
1068
|
-
const { name: e, config: n } =
|
|
1069
|
-
return n.mode === "json" ? new
|
|
1068
|
+
const { name: e, config: n } = Qe(i, t);
|
|
1069
|
+
return n.mode === "json" ? new or(e) : new rr(e, n);
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Lr() {
|
|
1072
1072
|
return {
|
|
1073
|
-
blob:
|
|
1074
|
-
customType:
|
|
1073
|
+
blob: zr,
|
|
1074
|
+
customType: Ir,
|
|
1075
1075
|
integer: p,
|
|
1076
|
-
numeric:
|
|
1077
|
-
real:
|
|
1076
|
+
numeric: Tr,
|
|
1077
|
+
real: qr,
|
|
1078
1078
|
text: r
|
|
1079
1079
|
};
|
|
1080
1080
|
}
|
|
1081
|
-
const
|
|
1082
|
-
var
|
|
1083
|
-
class
|
|
1081
|
+
const ht = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
1082
|
+
var wi, Ni, vi, Si, bi;
|
|
1083
|
+
class $e extends (bi = M, Si = v, vi = M.Symbol.Columns, Ni = ht, wi = M.Symbol.ExtraConfigBuilder, bi) {
|
|
1084
1084
|
constructor() {
|
|
1085
1085
|
super(...arguments);
|
|
1086
1086
|
/** @internal */
|
|
1087
|
-
f(this,
|
|
1087
|
+
f(this, vi);
|
|
1088
1088
|
/** @internal */
|
|
1089
|
-
f(this,
|
|
1089
|
+
f(this, Ni, []);
|
|
1090
1090
|
/** @internal */
|
|
1091
|
-
f(this,
|
|
1091
|
+
f(this, wi);
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
|
-
f(
|
|
1095
|
-
f(
|
|
1096
|
-
InlineForeignKeys:
|
|
1094
|
+
f($e, Si, "SQLiteTable"), /** @internal */
|
|
1095
|
+
f($e, "Symbol", Object.assign({}, M.Symbol, {
|
|
1096
|
+
InlineForeignKeys: ht
|
|
1097
1097
|
}));
|
|
1098
|
-
function
|
|
1099
|
-
const o = new
|
|
1100
|
-
Object.entries(l).map(([
|
|
1098
|
+
function Er(i, t, e, n, s = i) {
|
|
1099
|
+
const o = new $e(i, n, s), l = typeof t == "function" ? t(Lr()) : t, _ = Object.fromEntries(
|
|
1100
|
+
Object.entries(l).map(([c, u]) => {
|
|
1101
1101
|
const h = u;
|
|
1102
|
-
h.setName(
|
|
1102
|
+
h.setName(c);
|
|
1103
1103
|
const g = h.build(o);
|
|
1104
|
-
return o[
|
|
1104
|
+
return o[ht].push(...h.buildForeignKeys(g, o)), [c, g];
|
|
1105
1105
|
})
|
|
1106
|
-
),
|
|
1107
|
-
return
|
|
1106
|
+
), d = Object.assign(o, _);
|
|
1107
|
+
return d[M.Symbol.Columns] = _, d[M.Symbol.ExtraConfigColumns] = _, e && (d[$e.Symbol.ExtraConfigBuilder] = e), d;
|
|
1108
1108
|
}
|
|
1109
|
-
const D = (i, t, e) =>
|
|
1110
|
-
var
|
|
1111
|
-
|
|
1112
|
-
class
|
|
1109
|
+
const D = (i, t, e) => Er(i, t, e);
|
|
1110
|
+
var xi;
|
|
1111
|
+
xi = v;
|
|
1112
|
+
class Dt {
|
|
1113
1113
|
constructor(t, e) {
|
|
1114
1114
|
this.name = t, this.unique = e;
|
|
1115
1115
|
}
|
|
1116
1116
|
on(...t) {
|
|
1117
|
-
return new
|
|
1117
|
+
return new lr(this.name, t, this.unique);
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
|
-
f(
|
|
1121
|
-
var
|
|
1122
|
-
|
|
1123
|
-
class
|
|
1120
|
+
f(Dt, xi, "SQLiteIndexBuilderOn");
|
|
1121
|
+
var Di;
|
|
1122
|
+
Di = v;
|
|
1123
|
+
class lr {
|
|
1124
1124
|
constructor(t, e, n) {
|
|
1125
1125
|
/** @internal */
|
|
1126
1126
|
f(this, "config");
|
|
@@ -1139,31 +1139,31 @@ class or {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
/** @internal */
|
|
1141
1141
|
build(t) {
|
|
1142
|
-
return new
|
|
1142
|
+
return new _r(this.config, t);
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
|
-
f(
|
|
1146
|
-
var
|
|
1147
|
-
|
|
1148
|
-
class
|
|
1145
|
+
f(lr, Di, "SQLiteIndexBuilder");
|
|
1146
|
+
var Oi;
|
|
1147
|
+
Oi = v;
|
|
1148
|
+
class _r {
|
|
1149
1149
|
constructor(t, e) {
|
|
1150
1150
|
f(this, "config");
|
|
1151
1151
|
this.config = { ...t, table: e };
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
f(
|
|
1154
|
+
f(_r, Oi, "SQLiteIndex");
|
|
1155
1155
|
function S(i) {
|
|
1156
|
-
return new
|
|
1156
|
+
return new Dt(i, !1);
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1159
|
-
return new
|
|
1158
|
+
function Te(i) {
|
|
1159
|
+
return new Dt(i, !0);
|
|
1160
1160
|
}
|
|
1161
1161
|
function re(...i) {
|
|
1162
|
-
return i[0].columns ? new
|
|
1162
|
+
return i[0].columns ? new pt(i[0].columns, i[0].name) : new pt(i);
|
|
1163
1163
|
}
|
|
1164
|
-
var
|
|
1165
|
-
|
|
1166
|
-
class
|
|
1164
|
+
var ki;
|
|
1165
|
+
ki = v;
|
|
1166
|
+
class pt {
|
|
1167
1167
|
constructor(t, e) {
|
|
1168
1168
|
/** @internal */
|
|
1169
1169
|
f(this, "columns");
|
|
@@ -1173,23 +1173,23 @@ class ht {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
/** @internal */
|
|
1175
1175
|
build(t) {
|
|
1176
|
-
return new
|
|
1176
|
+
return new ur(t, this.columns, this.name);
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
|
-
f(
|
|
1180
|
-
var
|
|
1181
|
-
|
|
1182
|
-
class
|
|
1179
|
+
f(pt, ki, "SQLitePrimaryKeyBuilder");
|
|
1180
|
+
var zi;
|
|
1181
|
+
zi = v;
|
|
1182
|
+
class ur {
|
|
1183
1183
|
constructor(t, e, n) {
|
|
1184
1184
|
f(this, "columns");
|
|
1185
1185
|
f(this, "name");
|
|
1186
1186
|
this.table = t, this.columns = e, this.name = n;
|
|
1187
1187
|
}
|
|
1188
1188
|
getName() {
|
|
1189
|
-
return this.name ?? `${this.table[
|
|
1189
|
+
return this.name ?? `${this.table[$e.Symbol.Name]}_${this.columns.map((t) => t.name).join("_")}_pk`;
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
|
-
f(
|
|
1192
|
+
f(ur, zi, "SQLitePrimaryKey");
|
|
1193
1193
|
const x = D("tenants", {
|
|
1194
1194
|
id: r("id", { length: 191 }).primaryKey(),
|
|
1195
1195
|
name: r("name", { length: 255 }),
|
|
@@ -1291,17 +1291,17 @@ const x = D("tenants", {
|
|
|
1291
1291
|
columns: [i.user_id, i.tenant_id],
|
|
1292
1292
|
name: "users_tenants"
|
|
1293
1293
|
}),
|
|
1294
|
-
|
|
1294
|
+
Te("unique_email_provider").on(
|
|
1295
1295
|
i.email,
|
|
1296
1296
|
i.provider,
|
|
1297
1297
|
i.tenant_id
|
|
1298
1298
|
),
|
|
1299
|
-
|
|
1299
|
+
Te("unique_phone_provider").on(
|
|
1300
1300
|
i.phone_number,
|
|
1301
1301
|
i.provider,
|
|
1302
1302
|
i.tenant_id
|
|
1303
1303
|
),
|
|
1304
|
-
|
|
1304
|
+
Te("unique_username_provider").on(
|
|
1305
1305
|
i.username,
|
|
1306
1306
|
i.provider,
|
|
1307
1307
|
i.tenant_id
|
|
@@ -1456,7 +1456,7 @@ const x = D("tenants", {
|
|
|
1456
1456
|
}),
|
|
1457
1457
|
S("codes_expires_at_index").on(i.expires_at)
|
|
1458
1458
|
]
|
|
1459
|
-
),
|
|
1459
|
+
), Ar = D("authentication_codes", {
|
|
1460
1460
|
tenant_id: r("tenant_id", { length: 191 }).notNull().references(() => x.id, { onDelete: "cascade" }),
|
|
1461
1461
|
code: r("code", { length: 255 }).primaryKey(),
|
|
1462
1462
|
client_id: r("client_id", { length: 255 }).notNull(),
|
|
@@ -1470,7 +1470,7 @@ const x = D("tenants", {
|
|
|
1470
1470
|
created_at: r("created_at", { length: 35 }).notNull(),
|
|
1471
1471
|
expires_at: r("expires_at", { length: 35 }).notNull(),
|
|
1472
1472
|
used_at: r("used_at", { length: 35 })
|
|
1473
|
-
}),
|
|
1473
|
+
}), Cr = D(
|
|
1474
1474
|
"otps",
|
|
1475
1475
|
{
|
|
1476
1476
|
tenant_id: r("tenant_id", { length: 191 }).notNull().references(() => x.id, { onDelete: "cascade" }),
|
|
@@ -1496,7 +1496,7 @@ const x = D("tenants", {
|
|
|
1496
1496
|
S("otps_email_index").on(i.email),
|
|
1497
1497
|
S("otps_expires_at_index").on(i.expires_at)
|
|
1498
1498
|
]
|
|
1499
|
-
),
|
|
1499
|
+
), $r = D("tickets", {
|
|
1500
1500
|
tenant_id: r("tenant_id", { length: 191 }).notNull().references(() => x.id, { onDelete: "cascade" }),
|
|
1501
1501
|
id: r("id", { length: 255 }).primaryKey(),
|
|
1502
1502
|
client_id: r("client_id", { length: 255 }).notNull(),
|
|
@@ -1606,7 +1606,7 @@ const x = D("tenants", {
|
|
|
1606
1606
|
}),
|
|
1607
1607
|
S("idx_client_grants_audience").on(i.audience)
|
|
1608
1608
|
]
|
|
1609
|
-
),
|
|
1609
|
+
), K = D(
|
|
1610
1610
|
"connections",
|
|
1611
1611
|
{
|
|
1612
1612
|
id: r("id", { length: 255 }).notNull(),
|
|
@@ -1628,7 +1628,7 @@ const x = D("tenants", {
|
|
|
1628
1628
|
re({ columns: [i.tenant_id, i.id] }),
|
|
1629
1629
|
S("connections_tenant_id_index").on(i.tenant_id),
|
|
1630
1630
|
// Required for keys.connection foreign key reference
|
|
1631
|
-
|
|
1631
|
+
Te("connections_id_unique").on(i.id)
|
|
1632
1632
|
]
|
|
1633
1633
|
), ie = D(
|
|
1634
1634
|
"custom_domains",
|
|
@@ -1647,8 +1647,8 @@ const x = D("tenants", {
|
|
|
1647
1647
|
created_at: r("created_at", { length: 35 }).notNull(),
|
|
1648
1648
|
updated_at: r("updated_at", { length: 35 }).notNull()
|
|
1649
1649
|
},
|
|
1650
|
-
(i) => [
|
|
1651
|
-
),
|
|
1650
|
+
(i) => [Te("custom_domains_domain_unique").on(i.domain)]
|
|
1651
|
+
), Br = D("domains", {
|
|
1652
1652
|
id: r("id", { length: 255 }).primaryKey(),
|
|
1653
1653
|
tenant_id: r("tenant_id", { length: 191 }).notNull().references(() => x.id, { onDelete: "cascade" }),
|
|
1654
1654
|
domain: r("domain", { length: 255 }).notNull(),
|
|
@@ -1684,7 +1684,7 @@ const x = D("tenants", {
|
|
|
1684
1684
|
updated_at: r("updated_at", { length: 35 }).notNull()
|
|
1685
1685
|
},
|
|
1686
1686
|
(i) => [
|
|
1687
|
-
|
|
1687
|
+
Te("user_organizations_unique").on(
|
|
1688
1688
|
i.tenant_id,
|
|
1689
1689
|
i.user_id,
|
|
1690
1690
|
i.organization_id
|
|
@@ -1719,7 +1719,7 @@ const x = D("tenants", {
|
|
|
1719
1719
|
S("idx_invites_expires_at").on(i.expires_at),
|
|
1720
1720
|
S("idx_invites_tenant_created").on(i.tenant_id, i.created_at)
|
|
1721
1721
|
]
|
|
1722
|
-
),
|
|
1722
|
+
), F = D(
|
|
1723
1723
|
"roles",
|
|
1724
1724
|
{
|
|
1725
1725
|
id: r("id", { length: 21 }).notNull(),
|
|
@@ -1845,7 +1845,7 @@ const x = D("tenants", {
|
|
|
1845
1845
|
name: "resource_servers_pk"
|
|
1846
1846
|
})
|
|
1847
1847
|
]
|
|
1848
|
-
),
|
|
1848
|
+
), qe = D("branding", {
|
|
1849
1849
|
tenant_id: r("tenant_id", { length: 191 }).primaryKey().references(() => x.id, { onDelete: "cascade" }),
|
|
1850
1850
|
logo_url: r("logo_url", { length: 512 }),
|
|
1851
1851
|
favicon_url: r("favicon_url", { length: 512 }),
|
|
@@ -1859,7 +1859,7 @@ const x = D("tenants", {
|
|
|
1859
1859
|
}),
|
|
1860
1860
|
colors_page_background_end: r("colors_page_background_end", { length: 8 }),
|
|
1861
1861
|
colors_page_background_angle_dev: p("colors_page_background_angle_dev")
|
|
1862
|
-
}),
|
|
1862
|
+
}), Ne = D(
|
|
1863
1863
|
"universal_login_templates",
|
|
1864
1864
|
{
|
|
1865
1865
|
tenant_id: r("tenant_id", { length: 191 }).primaryKey().references(() => x.id, { onDelete: "cascade" }),
|
|
@@ -2025,7 +2025,7 @@ const x = D("tenants", {
|
|
|
2025
2025
|
updated_at: r("updated_at", { length: 35 }).notNull()
|
|
2026
2026
|
},
|
|
2027
2027
|
(i) => [S("flows_tenant_id_idx").on(i.tenant_id)]
|
|
2028
|
-
),
|
|
2028
|
+
), Le = D("prompt_settings", {
|
|
2029
2029
|
tenant_id: r("tenant_id", { length: 191 }).primaryKey(),
|
|
2030
2030
|
universal_login_experience: r("universal_login_experience", { length: 16 }).notNull().default("new"),
|
|
2031
2031
|
identifier_first: p("identifier_first", { mode: "boolean" }).notNull().default(!0),
|
|
@@ -2033,7 +2033,7 @@ const x = D("tenants", {
|
|
|
2033
2033
|
webauthn_platform_first_factor: p("webauthn_platform_first_factor", {
|
|
2034
2034
|
mode: "boolean"
|
|
2035
2035
|
}).notNull().default(!1)
|
|
2036
|
-
}),
|
|
2036
|
+
}), ve = D("email_providers", {
|
|
2037
2037
|
tenant_id: r("tenant_id", { length: 191 }).primaryKey(),
|
|
2038
2038
|
name: r("name", { length: 255 }).notNull(),
|
|
2039
2039
|
enabled: p("enabled", { mode: "boolean" }).notNull(),
|
|
@@ -2042,22 +2042,39 @@ const x = D("tenants", {
|
|
|
2042
2042
|
settings: r("settings", { length: 2048 }).notNull().default("{}"),
|
|
2043
2043
|
created_at: r("created_at", { length: 35 }).notNull(),
|
|
2044
2044
|
updated_at: r("updated_at", { length: 35 }).notNull()
|
|
2045
|
-
}), X = D(
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2045
|
+
}), X = D(
|
|
2046
|
+
"hooks",
|
|
2047
|
+
{
|
|
2048
|
+
hook_id: r("hook_id", { length: 21 }).primaryKey(),
|
|
2049
|
+
tenant_id: r("tenant_id", { length: 191 }).notNull().references(() => x.id, { onDelete: "cascade" }),
|
|
2050
|
+
url: r("url", { length: 512 }),
|
|
2051
|
+
// nullable - only required for webhook type hooks
|
|
2052
|
+
trigger_id: r("trigger_id", { length: 255 }).notNull(),
|
|
2053
|
+
enabled: p("enabled", { mode: "boolean" }).notNull(),
|
|
2054
|
+
created_at_ts: p("created_at_ts").notNull(),
|
|
2055
|
+
updated_at_ts: p("updated_at_ts").notNull(),
|
|
2056
|
+
synchronous: p("synchronous", { mode: "boolean" }).notNull().default(!1),
|
|
2057
|
+
priority: p("priority"),
|
|
2058
|
+
form_id: r("form_id", { length: 128 }),
|
|
2059
|
+
// only required for form type hooks
|
|
2060
|
+
template_id: r("template_id", { length: 64 }),
|
|
2061
|
+
// only required for template type hooks
|
|
2062
|
+
code_id: r("code_id", { length: 21 })
|
|
2063
|
+
// only required for code type hooks
|
|
2064
|
+
},
|
|
2065
|
+
(i) => [S("hooks_tenant_id_idx").on(i.tenant_id)]
|
|
2066
|
+
), fe = D(
|
|
2067
|
+
"hook_code",
|
|
2068
|
+
{
|
|
2069
|
+
id: r("id", { length: 21 }).primaryKey(),
|
|
2070
|
+
tenant_id: r("tenant_id", { length: 191 }).notNull().references(() => x.id, { onDelete: "cascade" }),
|
|
2071
|
+
code: r("code").notNull(),
|
|
2072
|
+
secrets: r("secrets"),
|
|
2073
|
+
created_at_ts: p("created_at_ts").notNull(),
|
|
2074
|
+
updated_at_ts: p("updated_at_ts").notNull()
|
|
2075
|
+
},
|
|
2076
|
+
(i) => [S("hook_code_tenant_id_idx").on(i.tenant_id)]
|
|
2077
|
+
), me = D("keys", {
|
|
2061
2078
|
kid: r("kid", { length: 255 }).primaryKey(),
|
|
2062
2079
|
tenant_id: r("tenant_id", { length: 191 }).references(() => x.id, {
|
|
2063
2080
|
onDelete: "cascade"
|
|
@@ -2072,7 +2089,7 @@ const x = D("tenants", {
|
|
|
2072
2089
|
current_until: r("current_until", { length: 35 }),
|
|
2073
2090
|
type: r("type", { length: 50 }).notNull().default("jwt_signing"),
|
|
2074
2091
|
connection: r("connection", { length: 255 }).references(
|
|
2075
|
-
() =>
|
|
2092
|
+
() => K.id,
|
|
2076
2093
|
{ onDelete: "cascade" }
|
|
2077
2094
|
)
|
|
2078
2095
|
}), Z = D(
|
|
@@ -2088,7 +2105,7 @@ const x = D("tenants", {
|
|
|
2088
2105
|
(i) => [
|
|
2089
2106
|
re({ columns: [i.tenant_id, i.prompt, i.language] })
|
|
2090
2107
|
]
|
|
2091
|
-
),
|
|
2108
|
+
), U = D(
|
|
2092
2109
|
"authentication_methods",
|
|
2093
2110
|
{
|
|
2094
2111
|
id: r("id", { length: 26 }).primaryKey(),
|
|
@@ -2181,40 +2198,41 @@ const x = D("tenants", {
|
|
|
2181
2198
|
S("idx_outbox_events_processed_at").on(i.processed_at),
|
|
2182
2199
|
S("idx_outbox_events_claimed_by").on(i.claimed_by)
|
|
2183
2200
|
]
|
|
2184
|
-
),
|
|
2201
|
+
), Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2185
2202
|
__proto__: null,
|
|
2186
|
-
authenticationCodes:
|
|
2187
|
-
authenticationMethods:
|
|
2188
|
-
branding:
|
|
2203
|
+
authenticationCodes: Ar,
|
|
2204
|
+
authenticationMethods: U,
|
|
2205
|
+
branding: qe,
|
|
2189
2206
|
clientGrants: W,
|
|
2190
2207
|
clients: O,
|
|
2191
2208
|
codes: P,
|
|
2192
|
-
connections:
|
|
2209
|
+
connections: K,
|
|
2193
2210
|
customDomains: ie,
|
|
2194
2211
|
customText: Z,
|
|
2195
|
-
domains:
|
|
2196
|
-
emailProviders:
|
|
2212
|
+
domains: Br,
|
|
2213
|
+
emailProviders: ve,
|
|
2197
2214
|
flows: ne,
|
|
2198
2215
|
forms: te,
|
|
2216
|
+
hookCode: fe,
|
|
2199
2217
|
hooks: X,
|
|
2200
2218
|
invites: ee,
|
|
2201
|
-
keys:
|
|
2219
|
+
keys: me,
|
|
2202
2220
|
loginSessions: se,
|
|
2203
2221
|
logs: T,
|
|
2204
2222
|
organizations: L,
|
|
2205
|
-
otps:
|
|
2223
|
+
otps: Cr,
|
|
2206
2224
|
outboxEvents: I,
|
|
2207
2225
|
passwords: C,
|
|
2208
|
-
promptSettings:
|
|
2226
|
+
promptSettings: Le,
|
|
2209
2227
|
refreshTokens: $,
|
|
2210
2228
|
resourceServers: E,
|
|
2211
2229
|
rolePermissions: ae,
|
|
2212
|
-
roles:
|
|
2230
|
+
roles: F,
|
|
2213
2231
|
sessions: B,
|
|
2214
2232
|
tenants: x,
|
|
2215
2233
|
themes: ge,
|
|
2216
|
-
tickets:
|
|
2217
|
-
universalLoginTemplates:
|
|
2234
|
+
tickets: $r,
|
|
2235
|
+
universalLoginTemplates: Ne,
|
|
2218
2236
|
userOrganizations: Q,
|
|
2219
2237
|
userPermissions: le,
|
|
2220
2238
|
userRoles: _e,
|
|
@@ -2236,16 +2254,16 @@ function z(i) {
|
|
|
2236
2254
|
}
|
|
2237
2255
|
return t;
|
|
2238
2256
|
}
|
|
2239
|
-
function
|
|
2257
|
+
function Pr(i, t, e = { ...i }) {
|
|
2240
2258
|
for (const n of t)
|
|
2241
2259
|
i[n] !== void 0 && (e[n] = JSON.stringify(i[n]));
|
|
2242
2260
|
return e;
|
|
2243
2261
|
}
|
|
2244
|
-
function
|
|
2262
|
+
function Qr(i, t, e = i) {
|
|
2245
2263
|
for (const n of t)
|
|
2246
2264
|
i[n] !== void 0 && (e[n] = i[n] ? 1 : 0);
|
|
2247
2265
|
}
|
|
2248
|
-
function
|
|
2266
|
+
function dr(i) {
|
|
2249
2267
|
const t = {};
|
|
2250
2268
|
for (const e in i)
|
|
2251
2269
|
i[e] !== void 0 && i[e] !== null && (t[e] = i[e]);
|
|
@@ -2262,15 +2280,15 @@ function b(i, t) {
|
|
|
2262
2280
|
}
|
|
2263
2281
|
return i;
|
|
2264
2282
|
}
|
|
2265
|
-
function
|
|
2283
|
+
function Be(i, t = "", e = {}) {
|
|
2266
2284
|
for (const n in i)
|
|
2267
2285
|
if (Object.prototype.hasOwnProperty.call(i, n)) {
|
|
2268
2286
|
const s = t ? `${t}_${n}` : n, o = i[n];
|
|
2269
|
-
typeof o == "object" && o !== null && !Array.isArray(o) ?
|
|
2287
|
+
typeof o == "object" && o !== null && !Array.isArray(o) ? Be(o, s, e) : typeof o == "boolean" ? e[s] = o ? 1 : 0 : e[s] = o;
|
|
2270
2288
|
}
|
|
2271
2289
|
return e;
|
|
2272
2290
|
}
|
|
2273
|
-
function
|
|
2291
|
+
function cr(i, t) {
|
|
2274
2292
|
const e = {};
|
|
2275
2293
|
for (const [n, s] of Object.entries(i)) {
|
|
2276
2294
|
const o = t.find(
|
|
@@ -2288,13 +2306,13 @@ function ur(i, t) {
|
|
|
2288
2306
|
}
|
|
2289
2307
|
return e;
|
|
2290
2308
|
}
|
|
2291
|
-
function
|
|
2309
|
+
function Jr(i) {
|
|
2292
2310
|
return typeof i == "string" ? parseInt(i, 10) : typeof i == "bigint" ? Number(i) : i;
|
|
2293
2311
|
}
|
|
2294
|
-
function
|
|
2312
|
+
function Fr(i) {
|
|
2295
2313
|
return {
|
|
2296
2314
|
async get(t) {
|
|
2297
|
-
const e = await i.select().from(
|
|
2315
|
+
const e = await i.select().from(qe).where(a(qe.tenant_id, t)).get();
|
|
2298
2316
|
if (!e) return null;
|
|
2299
2317
|
const {
|
|
2300
2318
|
tenant_id: n,
|
|
@@ -2302,8 +2320,8 @@ function Qr(i) {
|
|
|
2302
2320
|
colors_page_background_type: o,
|
|
2303
2321
|
colors_page_background_start: l,
|
|
2304
2322
|
colors_page_background_end: _,
|
|
2305
|
-
colors_page_background_angle_dev:
|
|
2306
|
-
font_url:
|
|
2323
|
+
colors_page_background_angle_dev: d,
|
|
2324
|
+
font_url: c,
|
|
2307
2325
|
...u
|
|
2308
2326
|
} = e;
|
|
2309
2327
|
return z({
|
|
@@ -2314,26 +2332,26 @@ function Qr(i) {
|
|
|
2314
2332
|
type: o,
|
|
2315
2333
|
start: l,
|
|
2316
2334
|
end: _,
|
|
2317
|
-
angle_deg:
|
|
2335
|
+
angle_deg: d
|
|
2318
2336
|
}
|
|
2319
2337
|
},
|
|
2320
|
-
font:
|
|
2338
|
+
font: c ? { url: c } : void 0
|
|
2321
2339
|
});
|
|
2322
2340
|
},
|
|
2323
2341
|
async set(t, e) {
|
|
2324
|
-
var _,
|
|
2342
|
+
var _, d, c, u, h, g, y, w;
|
|
2325
2343
|
const { colors: n, font: s, ...o } = e, l = {
|
|
2326
2344
|
...o,
|
|
2327
2345
|
tenant_id: t,
|
|
2328
2346
|
colors_primary: n == null ? void 0 : n.primary,
|
|
2329
2347
|
colors_page_background_type: (_ = n == null ? void 0 : n.page_background) == null ? void 0 : _.type,
|
|
2330
|
-
colors_page_background_start: (
|
|
2331
|
-
colors_page_background_end: (
|
|
2348
|
+
colors_page_background_start: (d = n == null ? void 0 : n.page_background) == null ? void 0 : d.start,
|
|
2349
|
+
colors_page_background_end: (c = n == null ? void 0 : n.page_background) == null ? void 0 : c.end,
|
|
2332
2350
|
colors_page_background_angle_dev: (u = n == null ? void 0 : n.page_background) == null ? void 0 : u.angle_deg,
|
|
2333
2351
|
font_url: s == null ? void 0 : s.url
|
|
2334
2352
|
};
|
|
2335
|
-
await i.insert(
|
|
2336
|
-
target:
|
|
2353
|
+
await i.insert(qe).values(l).onConflictDoUpdate({
|
|
2354
|
+
target: qe.tenant_id,
|
|
2337
2355
|
set: {
|
|
2338
2356
|
...o,
|
|
2339
2357
|
colors_primary: n == null ? void 0 : n.primary,
|
|
@@ -2347,7 +2365,7 @@ function Qr(i) {
|
|
|
2347
2365
|
}
|
|
2348
2366
|
};
|
|
2349
2367
|
}
|
|
2350
|
-
var
|
|
2368
|
+
var be = class extends Error {
|
|
2351
2369
|
/**
|
|
2352
2370
|
* Creates an instance of `HTTPException`.
|
|
2353
2371
|
* @param status - HTTP status code for the exception. Defaults to 500.
|
|
@@ -2373,10 +2391,10 @@ var Se = class extends Error {
|
|
|
2373
2391
|
});
|
|
2374
2392
|
}
|
|
2375
2393
|
};
|
|
2376
|
-
function
|
|
2394
|
+
function he(i, t, e) {
|
|
2377
2395
|
const n = t.split(/ OR /i);
|
|
2378
2396
|
if (n.length > 1) {
|
|
2379
|
-
const
|
|
2397
|
+
const c = n.map((u) => {
|
|
2380
2398
|
const h = u.trim().match(/^([^:]+):(.+)$/);
|
|
2381
2399
|
if (h) {
|
|
2382
2400
|
const [, g, y] = h;
|
|
@@ -2386,84 +2404,86 @@ function me(i, t, e) {
|
|
|
2386
2404
|
}
|
|
2387
2405
|
return null;
|
|
2388
2406
|
}).filter(Boolean);
|
|
2389
|
-
return
|
|
2407
|
+
return c.length === 0 ? void 0 : ue(...c);
|
|
2390
2408
|
}
|
|
2391
2409
|
const s = [];
|
|
2392
2410
|
let o = "", l = !1;
|
|
2393
|
-
for (let
|
|
2394
|
-
const u = t[
|
|
2411
|
+
for (let c = 0; c < t.length; c++) {
|
|
2412
|
+
const u = t[c];
|
|
2395
2413
|
u === '"' ? (l = !l, o += u) : u === " " && !l ? o.trim() && (s.push(o.trim()), o = "") : o += u;
|
|
2396
2414
|
}
|
|
2397
2415
|
o.trim() && s.push(o.trim());
|
|
2398
|
-
const _ = s.map((
|
|
2399
|
-
let u =
|
|
2400
|
-
if (
|
|
2401
|
-
h =
|
|
2402
|
-
else if (
|
|
2403
|
-
h =
|
|
2404
|
-
else if (
|
|
2405
|
-
const A = u ?
|
|
2416
|
+
const _ = s.map((c) => c.replace(/^([^:]+)=/g, "$1:")).map((c) => {
|
|
2417
|
+
let u = c.startsWith("-"), h = null, g = "", y = !1, w;
|
|
2418
|
+
if (c.startsWith("-_exists_:"))
|
|
2419
|
+
h = c.substring(10), y = !0, u = !0;
|
|
2420
|
+
else if (c.startsWith("_exists_:"))
|
|
2421
|
+
h = c.substring(9), y = !0, u = !1;
|
|
2422
|
+
else if (c.includes(":")) {
|
|
2423
|
+
const A = u ? c.substring(1) : c, q = A.indexOf(":");
|
|
2406
2424
|
h = A.substring(0, q), g = A.substring(q + 1), y = !1, g.startsWith(">=") ? (w = ">=", g = g.substring(2)) : g.startsWith(">") ? (w = ">", g = g.substring(1)) : g.startsWith("<=") ? (w = "<=", g = g.substring(2)) : g.startsWith("<") ? (w = "<", g = g.substring(1)) : w = "=", g.startsWith('"') && g.endsWith('"') && g.length > 1 && (g = g.slice(1, -1));
|
|
2407
2425
|
} else
|
|
2408
|
-
h = null, g =
|
|
2426
|
+
h = null, g = c, y = !1;
|
|
2409
2427
|
return { key: h, value: g, isNegation: u, isExistsQuery: y, operator: w };
|
|
2410
|
-
}),
|
|
2411
|
-
for (const { key:
|
|
2412
|
-
if (
|
|
2413
|
-
const w = i[
|
|
2428
|
+
}), d = [];
|
|
2429
|
+
for (const { key: c, value: u, isNegation: h, isExistsQuery: g, operator: y } of _)
|
|
2430
|
+
if (c) {
|
|
2431
|
+
const w = i[c];
|
|
2414
2432
|
if (!w) {
|
|
2415
|
-
g ?
|
|
2416
|
-
h ? N`${N.identifier(
|
|
2417
|
-
) :
|
|
2433
|
+
g ? d.push(
|
|
2434
|
+
h ? N`${N.identifier(c)} IS NULL` : N`${N.identifier(c)} IS NOT NULL`
|
|
2435
|
+
) : d.push(
|
|
2436
|
+
N`${N.identifier(c)} ${N.raw(h ? "!=" : y ?? "=")} ${u}`
|
|
2437
|
+
);
|
|
2418
2438
|
continue;
|
|
2419
2439
|
}
|
|
2420
2440
|
if (g)
|
|
2421
|
-
|
|
2441
|
+
d.push(h ? pe(w) : Or(w));
|
|
2422
2442
|
else if (h)
|
|
2423
2443
|
switch (y) {
|
|
2424
2444
|
case ">":
|
|
2425
|
-
|
|
2445
|
+
d.push(Oe(w, u));
|
|
2426
2446
|
break;
|
|
2427
2447
|
case ">=":
|
|
2428
|
-
|
|
2448
|
+
d.push(xe(w, u));
|
|
2429
2449
|
break;
|
|
2430
2450
|
case "<":
|
|
2431
|
-
|
|
2451
|
+
d.push(We(w, u));
|
|
2432
2452
|
break;
|
|
2433
2453
|
case "<=":
|
|
2434
|
-
|
|
2454
|
+
d.push(Re(w, u));
|
|
2435
2455
|
break;
|
|
2436
2456
|
default:
|
|
2437
|
-
|
|
2457
|
+
d.push(Dr(w, u));
|
|
2438
2458
|
}
|
|
2439
2459
|
else
|
|
2440
2460
|
switch (y) {
|
|
2441
2461
|
case ">":
|
|
2442
|
-
|
|
2462
|
+
d.push(Re(w, u));
|
|
2443
2463
|
break;
|
|
2444
2464
|
case ">=":
|
|
2445
|
-
|
|
2465
|
+
d.push(We(w, u));
|
|
2446
2466
|
break;
|
|
2447
2467
|
case "<":
|
|
2448
|
-
|
|
2468
|
+
d.push(xe(w, u));
|
|
2449
2469
|
break;
|
|
2450
2470
|
case "<=":
|
|
2451
|
-
|
|
2471
|
+
d.push(Oe(w, u));
|
|
2452
2472
|
break;
|
|
2453
2473
|
default:
|
|
2454
|
-
|
|
2474
|
+
d.push(a(w, u));
|
|
2455
2475
|
}
|
|
2456
2476
|
} else if (u) {
|
|
2457
2477
|
const A = (u.includes("|") ? [...e, "user_id"] : e).map((q) => {
|
|
2458
|
-
const
|
|
2459
|
-
return
|
|
2478
|
+
const ye = i[q];
|
|
2479
|
+
return ye ? q === "user_id" ? a(ye, u) : ze(ye, `%${u}%`) : null;
|
|
2460
2480
|
}).filter(Boolean);
|
|
2461
|
-
A.length > 0 &&
|
|
2481
|
+
A.length > 0 && d.push(ue(...A));
|
|
2462
2482
|
}
|
|
2463
|
-
if (
|
|
2464
|
-
return
|
|
2483
|
+
if (d.length !== 0)
|
|
2484
|
+
return d.length === 1 ? d[0] : m(...d);
|
|
2465
2485
|
}
|
|
2466
|
-
const
|
|
2486
|
+
const Ot = [
|
|
2467
2487
|
"global",
|
|
2468
2488
|
"is_first_party",
|
|
2469
2489
|
"oidc_conformant",
|
|
@@ -2474,7 +2494,7 @@ const Dt = [
|
|
|
2474
2494
|
"custom_login_page_on",
|
|
2475
2495
|
"require_pushed_authorization_requests",
|
|
2476
2496
|
"require_proof_of_possession"
|
|
2477
|
-
],
|
|
2497
|
+
], kt = [
|
|
2478
2498
|
"callbacks",
|
|
2479
2499
|
"allowed_origins",
|
|
2480
2500
|
"web_origins",
|
|
@@ -2483,7 +2503,7 @@ const Dt = [
|
|
|
2483
2503
|
"allowed_logout_urls",
|
|
2484
2504
|
"grant_types",
|
|
2485
2505
|
"signing_keys"
|
|
2486
|
-
],
|
|
2506
|
+
], zt = [
|
|
2487
2507
|
"session_transfer",
|
|
2488
2508
|
"oidc_logout",
|
|
2489
2509
|
"jwt_configuration",
|
|
@@ -2498,26 +2518,30 @@ const Dt = [
|
|
|
2498
2518
|
"signed_request_object",
|
|
2499
2519
|
"token_quota"
|
|
2500
2520
|
];
|
|
2501
|
-
function
|
|
2521
|
+
function Fe(i) {
|
|
2502
2522
|
const { tenant_id: t, connections: e, ...n } = i, s = { ...n };
|
|
2503
|
-
for (const o of Dt)
|
|
2504
|
-
s[o] = !!n[o];
|
|
2505
2523
|
for (const o of Ot)
|
|
2506
|
-
s[o] =
|
|
2524
|
+
s[o] = !!n[o];
|
|
2507
2525
|
for (const o of kt)
|
|
2526
|
+
s[o] = b(n[o], []);
|
|
2527
|
+
for (const o of zt)
|
|
2508
2528
|
s[o] = b(n[o], {});
|
|
2509
2529
|
return s.connections = b(e, []), z(s);
|
|
2510
2530
|
}
|
|
2511
|
-
function
|
|
2531
|
+
function Et(i) {
|
|
2512
2532
|
const t = { ...i };
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2533
|
+
Qr(
|
|
2534
|
+
i,
|
|
2535
|
+
Ot,
|
|
2536
|
+
t
|
|
2537
|
+
);
|
|
2516
2538
|
for (const e of kt)
|
|
2539
|
+
i[e] !== void 0 && (t[e] = JSON.stringify(i[e] || []));
|
|
2540
|
+
for (const e of zt)
|
|
2517
2541
|
i[e] !== void 0 && (t[e] = JSON.stringify(i[e] || {}));
|
|
2518
|
-
return i.connections !== void 0 && (t.connections = JSON.stringify(i.connections || [])),
|
|
2542
|
+
return i.connections !== void 0 && (t.connections = JSON.stringify(i.connections || [])), dr(t);
|
|
2519
2543
|
}
|
|
2520
|
-
function
|
|
2544
|
+
function Ur(i) {
|
|
2521
2545
|
return {
|
|
2522
2546
|
async create(t, e) {
|
|
2523
2547
|
var l, _;
|
|
@@ -2542,23 +2566,23 @@ function Jr(i) {
|
|
|
2542
2566
|
created_at: n,
|
|
2543
2567
|
updated_at: n
|
|
2544
2568
|
};
|
|
2545
|
-
for (const
|
|
2546
|
-
s[
|
|
2547
|
-
s.oidc_conformant = e.oidc_conformant ?? !0, s.auth0_conformant = e.auth0_conformant ?? !0, s.sso_disabled = e.sso_disabled ?? !
|
|
2548
|
-
for (const
|
|
2549
|
-
s[
|
|
2550
|
-
for (const
|
|
2551
|
-
s[
|
|
2569
|
+
for (const d of Ot)
|
|
2570
|
+
s[d] = e[d] ?? !1;
|
|
2571
|
+
s.oidc_conformant = e.oidc_conformant ?? !0, s.auth0_conformant = e.auth0_conformant ?? !0, s.sso_disabled = e.sso_disabled ?? !1;
|
|
2572
|
+
for (const d of kt)
|
|
2573
|
+
s[d] = e[d] || [];
|
|
2574
|
+
for (const d of zt)
|
|
2575
|
+
s[d] = e[d] || {};
|
|
2552
2576
|
s.connections = e.connections || [];
|
|
2553
|
-
const o =
|
|
2577
|
+
const o = Et(s);
|
|
2554
2578
|
try {
|
|
2555
2579
|
await i.insert(O).values({ ...o, tenant_id: t });
|
|
2556
|
-
} catch (
|
|
2557
|
-
throw (l =
|
|
2580
|
+
} catch (d) {
|
|
2581
|
+
throw (l = d == null ? void 0 : d.message) != null && l.includes("UNIQUE constraint failed") || (_ = d == null ? void 0 : d.message) != null && _.includes("duplicate key") ? new be(409, {
|
|
2558
2582
|
message: "Client already exists"
|
|
2559
|
-
}) :
|
|
2583
|
+
}) : d;
|
|
2560
2584
|
}
|
|
2561
|
-
return
|
|
2585
|
+
return Fe({ ...o, tenant_id: t });
|
|
2562
2586
|
},
|
|
2563
2587
|
async get(t, e) {
|
|
2564
2588
|
const n = await i.select().from(O).where(
|
|
@@ -2567,17 +2591,17 @@ function Jr(i) {
|
|
|
2567
2591
|
a(O.client_id, e)
|
|
2568
2592
|
)
|
|
2569
2593
|
).get();
|
|
2570
|
-
return n ?
|
|
2594
|
+
return n ? Fe(n) : null;
|
|
2571
2595
|
},
|
|
2572
2596
|
async getByClientId(t) {
|
|
2573
2597
|
const e = await i.select().from(O).where(a(O.client_id, t)).get();
|
|
2574
2598
|
return e ? {
|
|
2575
|
-
...
|
|
2599
|
+
...Fe(e),
|
|
2576
2600
|
tenant_id: e.tenant_id
|
|
2577
2601
|
} : null;
|
|
2578
2602
|
},
|
|
2579
2603
|
async update(t, e, n) {
|
|
2580
|
-
const s =
|
|
2604
|
+
const s = Et({
|
|
2581
2605
|
...n,
|
|
2582
2606
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2583
2607
|
});
|
|
@@ -2589,19 +2613,25 @@ function Jr(i) {
|
|
|
2589
2613
|
), !0;
|
|
2590
2614
|
},
|
|
2591
2615
|
async list(t, e) {
|
|
2592
|
-
const {
|
|
2593
|
-
|
|
2616
|
+
const {
|
|
2617
|
+
page: n = 0,
|
|
2618
|
+
per_page: s = 50,
|
|
2619
|
+
include_totals: o = !1,
|
|
2620
|
+
sort: l,
|
|
2621
|
+
q: _
|
|
2622
|
+
} = e || {};
|
|
2623
|
+
let d = i.select().from(O).where(a(O.tenant_id, t)).$dynamic();
|
|
2594
2624
|
if (_) {
|
|
2595
|
-
const g =
|
|
2596
|
-
g && (
|
|
2625
|
+
const g = he(O, _, ["name", "client_id"]);
|
|
2626
|
+
g && (d = d.where(m(a(O.tenant_id, t), g)));
|
|
2597
2627
|
}
|
|
2598
2628
|
if (l != null && l.sort_by) {
|
|
2599
2629
|
const g = O[l.sort_by];
|
|
2600
|
-
g && (
|
|
2630
|
+
g && (d = d.orderBy(
|
|
2601
2631
|
l.sort_order === "desc" ? V(g) : Y(g)
|
|
2602
2632
|
));
|
|
2603
2633
|
}
|
|
2604
|
-
const u = (await
|
|
2634
|
+
const u = (await d.offset(n * s).limit(s)).map(Fe);
|
|
2605
2635
|
if (!o)
|
|
2606
2636
|
return { clients: u };
|
|
2607
2637
|
const [h] = await i.select({ count: R() }).from(O).where(a(O.tenant_id, t));
|
|
@@ -2622,7 +2652,7 @@ function Jr(i) {
|
|
|
2622
2652
|
}
|
|
2623
2653
|
};
|
|
2624
2654
|
}
|
|
2625
|
-
function
|
|
2655
|
+
function Kr(i) {
|
|
2626
2656
|
const { tenant_id: t, is_system: e, options: n, metadata: s, ...o } = i;
|
|
2627
2657
|
return z({
|
|
2628
2658
|
...o,
|
|
@@ -2631,7 +2661,7 @@ function Fr(i) {
|
|
|
2631
2661
|
is_system: e ? !0 : void 0
|
|
2632
2662
|
});
|
|
2633
2663
|
}
|
|
2634
|
-
function
|
|
2664
|
+
function jr(i) {
|
|
2635
2665
|
return {
|
|
2636
2666
|
async listByClient(t, e) {
|
|
2637
2667
|
const n = await i.select({ connections: O.connections }).from(O).where(
|
|
@@ -2641,18 +2671,15 @@ function Ur(i) {
|
|
|
2641
2671
|
)
|
|
2642
2672
|
).get();
|
|
2643
2673
|
if (!n) return [];
|
|
2644
|
-
const s = b(
|
|
2645
|
-
n.connections,
|
|
2646
|
-
[]
|
|
2647
|
-
) || [];
|
|
2674
|
+
const s = b(n.connections, []) || [];
|
|
2648
2675
|
if (s.length === 0) return [];
|
|
2649
|
-
const l = (await i.select().from(
|
|
2676
|
+
const l = (await i.select().from(K).where(
|
|
2650
2677
|
m(
|
|
2651
|
-
a(
|
|
2652
|
-
|
|
2678
|
+
a(K.tenant_id, t),
|
|
2679
|
+
we(K.id, s)
|
|
2653
2680
|
)
|
|
2654
|
-
).all()).map(
|
|
2655
|
-
return s.map((_) => l.find((
|
|
2681
|
+
).all()).map(Kr);
|
|
2682
|
+
return s.map((_) => l.find((d) => d.id === _)).filter(Boolean);
|
|
2656
2683
|
},
|
|
2657
2684
|
async updateByClient(t, e, n) {
|
|
2658
2685
|
return (await i.update(O).set({ connections: JSON.stringify([...new Set(n)]) }).where(
|
|
@@ -2702,14 +2729,31 @@ function Ur(i) {
|
|
|
2702
2729
|
}
|
|
2703
2730
|
};
|
|
2704
2731
|
}
|
|
2705
|
-
let
|
|
2732
|
+
let Mr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Vr = (i) => crypto.getRandomValues(new Uint8Array(i)), Rr = (i, t, e) => {
|
|
2733
|
+
let n = (2 << Math.log2(i.length - 1)) - 1, s = -~(1.6 * n * t / i.length);
|
|
2734
|
+
return (o = t) => {
|
|
2735
|
+
let l = "";
|
|
2736
|
+
for (; ; ) {
|
|
2737
|
+
let _ = e(s), d = s | 0;
|
|
2738
|
+
for (; d--; )
|
|
2739
|
+
if (l += i[_[d] & n] || "", l.length >= o) return l;
|
|
2740
|
+
}
|
|
2741
|
+
};
|
|
2742
|
+
}, Wr = (i, t = 21) => Rr(i, t | 0, Vr), oe = (i = 21) => {
|
|
2706
2743
|
let t = "", e = crypto.getRandomValues(new Uint8Array(i |= 0));
|
|
2707
2744
|
for (; i--; )
|
|
2708
|
-
t +=
|
|
2745
|
+
t += Mr[e[i] & 63];
|
|
2709
2746
|
return t;
|
|
2710
2747
|
};
|
|
2711
|
-
function
|
|
2712
|
-
const {
|
|
2748
|
+
function tt(i) {
|
|
2749
|
+
const {
|
|
2750
|
+
tenant_id: t,
|
|
2751
|
+
scope: e,
|
|
2752
|
+
authorization_details_types: n,
|
|
2753
|
+
allow_any_organization: s,
|
|
2754
|
+
is_system: o,
|
|
2755
|
+
...l
|
|
2756
|
+
} = i;
|
|
2713
2757
|
return z({
|
|
2714
2758
|
...l,
|
|
2715
2759
|
scope: b(e, []),
|
|
@@ -2721,7 +2765,7 @@ function et(i) {
|
|
|
2721
2765
|
is_system: !!o
|
|
2722
2766
|
});
|
|
2723
2767
|
}
|
|
2724
|
-
function
|
|
2768
|
+
function Hr(i) {
|
|
2725
2769
|
return {
|
|
2726
2770
|
async create(t, e) {
|
|
2727
2771
|
const n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
@@ -2740,16 +2784,13 @@ function jr(i) {
|
|
|
2740
2784
|
created_at: n,
|
|
2741
2785
|
updated_at: n
|
|
2742
2786
|
};
|
|
2743
|
-
return await i.insert(W).values(o),
|
|
2787
|
+
return await i.insert(W).values(o), tt({ ...o, tenant_id: t });
|
|
2744
2788
|
},
|
|
2745
2789
|
async get(t, e) {
|
|
2746
2790
|
const n = await i.select().from(W).where(
|
|
2747
|
-
m(
|
|
2748
|
-
a(W.tenant_id, t),
|
|
2749
|
-
a(W.id, e)
|
|
2750
|
-
)
|
|
2791
|
+
m(a(W.tenant_id, t), a(W.id, e))
|
|
2751
2792
|
).get();
|
|
2752
|
-
return n ?
|
|
2793
|
+
return n ? tt(n) : null;
|
|
2753
2794
|
},
|
|
2754
2795
|
async update(t, e, n) {
|
|
2755
2796
|
const {
|
|
@@ -2757,23 +2798,26 @@ function jr(i) {
|
|
|
2757
2798
|
authorization_details_types: o,
|
|
2758
2799
|
allow_any_organization: l,
|
|
2759
2800
|
is_system: _,
|
|
2760
|
-
...
|
|
2761
|
-
} = n,
|
|
2762
|
-
...
|
|
2801
|
+
...d
|
|
2802
|
+
} = n, c = {
|
|
2803
|
+
...d,
|
|
2763
2804
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2764
2805
|
};
|
|
2765
|
-
return s !== void 0 && (
|
|
2806
|
+
return s !== void 0 && (c.scope = JSON.stringify(s)), o !== void 0 && (c.authorization_details_types = JSON.stringify(
|
|
2766
2807
|
o
|
|
2767
|
-
)), l !== void 0 && (
|
|
2768
|
-
m(
|
|
2769
|
-
a(W.tenant_id, t),
|
|
2770
|
-
a(W.id, e)
|
|
2771
|
-
)
|
|
2808
|
+
)), l !== void 0 && (c.allow_any_organization = l ? 1 : 0), _ !== void 0 && (c.is_system = _ ? 1 : 0), (await i.update(W).set(c).where(
|
|
2809
|
+
m(a(W.tenant_id, t), a(W.id, e))
|
|
2772
2810
|
).returning()).length > 0;
|
|
2773
2811
|
},
|
|
2774
2812
|
async list(t, e) {
|
|
2775
|
-
const {
|
|
2776
|
-
|
|
2813
|
+
const {
|
|
2814
|
+
page: n = 0,
|
|
2815
|
+
per_page: s = 50,
|
|
2816
|
+
include_totals: o = !1,
|
|
2817
|
+
sort: l,
|
|
2818
|
+
q: _
|
|
2819
|
+
} = e || {}, d = _ ? he(W, _, ["client_id", "audience"]) : void 0, c = d ? m(a(W.tenant_id, t), d) : a(W.tenant_id, t);
|
|
2820
|
+
let u = i.select().from(W).where(c).$dynamic();
|
|
2777
2821
|
if (l != null && l.sort_by) {
|
|
2778
2822
|
const w = W[l.sort_by];
|
|
2779
2823
|
w && (u = u.orderBy(
|
|
@@ -2781,10 +2825,10 @@ function jr(i) {
|
|
|
2781
2825
|
));
|
|
2782
2826
|
} else
|
|
2783
2827
|
u = u.orderBy(Y(W.created_at));
|
|
2784
|
-
const g = (await u.offset(n * s).limit(s)).map(
|
|
2828
|
+
const g = (await u.offset(n * s).limit(s)).map(tt);
|
|
2785
2829
|
if (!o)
|
|
2786
2830
|
return { client_grants: g };
|
|
2787
|
-
const [y] = await i.select({ count: R() }).from(W).where(
|
|
2831
|
+
const [y] = await i.select({ count: R() }).from(W).where(c);
|
|
2788
2832
|
return {
|
|
2789
2833
|
client_grants: g,
|
|
2790
2834
|
start: n * s,
|
|
@@ -2794,19 +2838,16 @@ function jr(i) {
|
|
|
2794
2838
|
},
|
|
2795
2839
|
async remove(t, e) {
|
|
2796
2840
|
return (await i.delete(W).where(
|
|
2797
|
-
m(
|
|
2798
|
-
a(W.tenant_id, t),
|
|
2799
|
-
a(W.id, e)
|
|
2800
|
-
)
|
|
2841
|
+
m(a(W.tenant_id, t), a(W.id, e))
|
|
2801
2842
|
).returning()).length > 0;
|
|
2802
2843
|
}
|
|
2803
2844
|
};
|
|
2804
2845
|
}
|
|
2805
|
-
function
|
|
2846
|
+
function nt(i) {
|
|
2806
2847
|
const { tenant_id: t, ...e } = i;
|
|
2807
2848
|
return z(e);
|
|
2808
2849
|
}
|
|
2809
|
-
function
|
|
2850
|
+
function Gr(i) {
|
|
2810
2851
|
return {
|
|
2811
2852
|
async create(t, e) {
|
|
2812
2853
|
const n = {
|
|
@@ -2815,21 +2856,27 @@ function Mr(i) {
|
|
|
2815
2856
|
created_at: e.created_at || (/* @__PURE__ */ new Date()).toISOString(),
|
|
2816
2857
|
expires_at: e.expires_at
|
|
2817
2858
|
};
|
|
2818
|
-
return await i.insert(P).values(n),
|
|
2859
|
+
return await i.insert(P).values(n), nt(n);
|
|
2819
2860
|
},
|
|
2820
2861
|
async get(t, e, n) {
|
|
2821
|
-
|
|
2862
|
+
if (!t)
|
|
2863
|
+
throw new Error("tenant_id is required");
|
|
2864
|
+
const s = await i.select().from(P).where(
|
|
2822
2865
|
m(
|
|
2866
|
+
a(P.tenant_id, t),
|
|
2823
2867
|
a(P.code_id, e),
|
|
2824
2868
|
a(P.code_type, n)
|
|
2825
2869
|
)
|
|
2826
|
-
)
|
|
2827
|
-
|
|
2828
|
-
const o = await s.get();
|
|
2829
|
-
return o ? tt(o) : null;
|
|
2870
|
+
).get();
|
|
2871
|
+
return s ? nt(s) : null;
|
|
2830
2872
|
},
|
|
2831
2873
|
async list(t, e) {
|
|
2832
|
-
const {
|
|
2874
|
+
const {
|
|
2875
|
+
page: n = 0,
|
|
2876
|
+
per_page: s = 50,
|
|
2877
|
+
include_totals: o = !1,
|
|
2878
|
+
sort: l
|
|
2879
|
+
} = e || {};
|
|
2833
2880
|
let _ = i.select().from(P).where(a(P.tenant_id, t)).$dynamic();
|
|
2834
2881
|
if (l != null && l.sort_by) {
|
|
2835
2882
|
const h = P[l.sort_by];
|
|
@@ -2837,43 +2884,39 @@ function Mr(i) {
|
|
|
2837
2884
|
l.sort_order === "desc" ? V(h) : Y(h)
|
|
2838
2885
|
));
|
|
2839
2886
|
}
|
|
2840
|
-
const
|
|
2887
|
+
const c = (await _.offset(n * s).limit(s)).map(nt);
|
|
2841
2888
|
if (!o)
|
|
2842
|
-
return { codes:
|
|
2889
|
+
return { codes: c };
|
|
2843
2890
|
const [u] = await i.select({ count: R() }).from(P).where(a(P.tenant_id, t));
|
|
2844
2891
|
return {
|
|
2845
|
-
codes:
|
|
2892
|
+
codes: c,
|
|
2846
2893
|
start: n * s,
|
|
2847
2894
|
limit: s,
|
|
2848
2895
|
length: Number((u == null ? void 0 : u.count) ?? 0)
|
|
2849
2896
|
};
|
|
2850
2897
|
},
|
|
2851
2898
|
async used(t, e) {
|
|
2852
|
-
return await i.update(P).set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where(
|
|
2853
|
-
m(a(P.tenant_id, t), a(P.code_id, e))
|
|
2854
|
-
), !0;
|
|
2899
|
+
return (await i.update(P).set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where(m(a(P.tenant_id, t), a(P.code_id, e))).returning()).length > 0;
|
|
2855
2900
|
},
|
|
2856
2901
|
async consume(t, e) {
|
|
2857
2902
|
return (await i.update(P).set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where(
|
|
2858
2903
|
m(
|
|
2859
2904
|
a(P.tenant_id, t),
|
|
2860
2905
|
a(P.code_id, e),
|
|
2861
|
-
|
|
2906
|
+
pe(P.used_at)
|
|
2862
2907
|
)
|
|
2863
2908
|
).returning()).length > 0;
|
|
2864
2909
|
},
|
|
2865
2910
|
async remove(t, e) {
|
|
2866
|
-
return (await i.delete(P).where(
|
|
2867
|
-
m(a(P.tenant_id, t), a(P.code_id, e))
|
|
2868
|
-
).returning()).length > 0;
|
|
2911
|
+
return (await i.delete(P).where(m(a(P.tenant_id, t), a(P.code_id, e))).returning()).length > 0;
|
|
2869
2912
|
}
|
|
2870
2913
|
};
|
|
2871
2914
|
}
|
|
2872
|
-
function
|
|
2915
|
+
function Yr() {
|
|
2873
2916
|
const { customAlphabet: i } = require("nanoid");
|
|
2874
2917
|
return `con_${i("0123456789abcdefghijklmnopqrstuvwxyz", 17)()}`;
|
|
2875
2918
|
}
|
|
2876
|
-
function
|
|
2919
|
+
function it(i) {
|
|
2877
2920
|
const { tenant_id: t, is_system: e, options: n, metadata: s, ...o } = i;
|
|
2878
2921
|
return z({
|
|
2879
2922
|
...o,
|
|
@@ -2882,12 +2925,12 @@ function nt(i) {
|
|
|
2882
2925
|
is_system: e ? !0 : void 0
|
|
2883
2926
|
});
|
|
2884
2927
|
}
|
|
2885
|
-
function
|
|
2928
|
+
function Xr(i) {
|
|
2886
2929
|
return {
|
|
2887
2930
|
async create(t, e) {
|
|
2888
2931
|
var o, l;
|
|
2889
2932
|
const n = (/* @__PURE__ */ new Date()).toISOString(), s = {
|
|
2890
|
-
id: e.id ||
|
|
2933
|
+
id: e.id || Yr(),
|
|
2891
2934
|
...e,
|
|
2892
2935
|
tenant_id: t,
|
|
2893
2936
|
options: JSON.stringify(e.options || {}),
|
|
@@ -2897,31 +2940,31 @@ function Rr(i) {
|
|
|
2897
2940
|
updated_at: n
|
|
2898
2941
|
};
|
|
2899
2942
|
try {
|
|
2900
|
-
await i.insert(
|
|
2943
|
+
await i.insert(K).values(s);
|
|
2901
2944
|
} catch (_) {
|
|
2902
|
-
throw (o = _ == null ? void 0 : _.message) != null && o.includes("UNIQUE constraint failed") || (l = _ == null ? void 0 : _.message) != null && l.includes("duplicate key") ? new
|
|
2945
|
+
throw (o = _ == null ? void 0 : _.message) != null && o.includes("UNIQUE constraint failed") || (l = _ == null ? void 0 : _.message) != null && l.includes("duplicate key") ? new be(409, {
|
|
2903
2946
|
message: "Connection already exists"
|
|
2904
2947
|
}) : _;
|
|
2905
2948
|
}
|
|
2906
|
-
return
|
|
2949
|
+
return it(s);
|
|
2907
2950
|
},
|
|
2908
2951
|
async get(t, e) {
|
|
2909
|
-
const n = await i.select().from(
|
|
2952
|
+
const n = await i.select().from(K).where(
|
|
2910
2953
|
m(
|
|
2911
|
-
a(
|
|
2912
|
-
a(
|
|
2954
|
+
a(K.tenant_id, t),
|
|
2955
|
+
a(K.id, e)
|
|
2913
2956
|
)
|
|
2914
2957
|
).get();
|
|
2915
|
-
return n ?
|
|
2958
|
+
return n ? it(n) : null;
|
|
2916
2959
|
},
|
|
2917
2960
|
async update(t, e, n) {
|
|
2918
2961
|
const s = {
|
|
2919
2962
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2920
2963
|
};
|
|
2921
|
-
return n.name !== void 0 && (s.name = n.name), n.strategy !== void 0 && (s.strategy = n.strategy), n.options !== void 0 && (s.options = JSON.stringify(n.options)), n.metadata !== void 0 && (s.metadata = JSON.stringify(n.metadata)), n.display_name !== void 0 && (s.display_name = n.display_name), n.response_type !== void 0 && (s.response_type = n.response_type), n.response_mode !== void 0 && (s.response_mode = n.response_mode), await i.update(
|
|
2964
|
+
return n.name !== void 0 && (s.name = n.name), n.strategy !== void 0 && (s.strategy = n.strategy), n.options !== void 0 && (s.options = JSON.stringify(n.options)), n.metadata !== void 0 && (s.metadata = JSON.stringify(n.metadata)), n.display_name !== void 0 && (s.display_name = n.display_name), n.response_type !== void 0 && (s.response_type = n.response_type), n.response_mode !== void 0 && (s.response_mode = n.response_mode), await i.update(K).set(s).where(
|
|
2922
2965
|
m(
|
|
2923
|
-
a(
|
|
2924
|
-
a(
|
|
2966
|
+
a(K.tenant_id, t),
|
|
2967
|
+
a(K.id, e)
|
|
2925
2968
|
)
|
|
2926
2969
|
), !0;
|
|
2927
2970
|
},
|
|
@@ -2933,21 +2976,22 @@ function Rr(i) {
|
|
|
2933
2976
|
sort: l,
|
|
2934
2977
|
q: _
|
|
2935
2978
|
} = e || {};
|
|
2936
|
-
let
|
|
2979
|
+
let d = a(K.tenant_id, t);
|
|
2937
2980
|
if (_) {
|
|
2938
|
-
const y =
|
|
2939
|
-
y && (d =
|
|
2981
|
+
const y = he(K, _, ["name"]);
|
|
2982
|
+
y && (d = m(d, y));
|
|
2940
2983
|
}
|
|
2984
|
+
let c = i.select().from(K).where(d).$dynamic();
|
|
2941
2985
|
if (l != null && l.sort_by) {
|
|
2942
|
-
const y =
|
|
2943
|
-
y && (
|
|
2986
|
+
const y = K[l.sort_by];
|
|
2987
|
+
y && (c = c.orderBy(
|
|
2944
2988
|
l.sort_order === "desc" ? V(y) : Y(y)
|
|
2945
2989
|
));
|
|
2946
2990
|
}
|
|
2947
|
-
const h = (await
|
|
2991
|
+
const h = (await c.offset(n * s).limit(s)).map(it);
|
|
2948
2992
|
if (!o)
|
|
2949
2993
|
return { connections: h };
|
|
2950
|
-
const [g] = await i.select({ count: R() }).from(
|
|
2994
|
+
const [g] = await i.select({ count: R() }).from(K).where(d);
|
|
2951
2995
|
return {
|
|
2952
2996
|
connections: h,
|
|
2953
2997
|
start: n * s,
|
|
@@ -2956,16 +3000,16 @@ function Rr(i) {
|
|
|
2956
3000
|
};
|
|
2957
3001
|
},
|
|
2958
3002
|
async remove(t, e) {
|
|
2959
|
-
return (await i.delete(
|
|
3003
|
+
return (await i.delete(K).where(
|
|
2960
3004
|
m(
|
|
2961
|
-
a(
|
|
2962
|
-
a(
|
|
3005
|
+
a(K.tenant_id, t),
|
|
3006
|
+
a(K.id, e)
|
|
2963
3007
|
)
|
|
2964
3008
|
).returning()).length > 0;
|
|
2965
3009
|
}
|
|
2966
3010
|
};
|
|
2967
3011
|
}
|
|
2968
|
-
function
|
|
3012
|
+
function Ue(i) {
|
|
2969
3013
|
const { tenant_id: t, domain_metadata: e, ...n } = i;
|
|
2970
3014
|
return z({
|
|
2971
3015
|
...n,
|
|
@@ -2973,7 +3017,7 @@ function Je(i) {
|
|
|
2973
3017
|
domain_metadata: b(e)
|
|
2974
3018
|
});
|
|
2975
3019
|
}
|
|
2976
|
-
function
|
|
3020
|
+
function Zr(i) {
|
|
2977
3021
|
return {
|
|
2978
3022
|
async create(t, e) {
|
|
2979
3023
|
const n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
@@ -2991,7 +3035,7 @@ function Wr(i) {
|
|
|
2991
3035
|
created_at: n,
|
|
2992
3036
|
updated_at: n
|
|
2993
3037
|
};
|
|
2994
|
-
return await i.insert(ie).values(o),
|
|
3038
|
+
return await i.insert(ie).values(o), Ue({ ...o, tenant_id: t });
|
|
2995
3039
|
},
|
|
2996
3040
|
async get(t, e) {
|
|
2997
3041
|
const n = await i.select().from(ie).where(
|
|
@@ -3000,17 +3044,17 @@ function Wr(i) {
|
|
|
3000
3044
|
a(ie.custom_domain_id, e)
|
|
3001
3045
|
)
|
|
3002
3046
|
).get();
|
|
3003
|
-
return n ?
|
|
3047
|
+
return n ? Ue(n) : null;
|
|
3004
3048
|
},
|
|
3005
3049
|
async getByDomain(t) {
|
|
3006
3050
|
const e = await i.select().from(ie).where(a(ie.domain, t)).get();
|
|
3007
3051
|
return e ? {
|
|
3008
|
-
...
|
|
3052
|
+
...Ue(e),
|
|
3009
3053
|
tenant_id: e.tenant_id
|
|
3010
3054
|
} : null;
|
|
3011
3055
|
},
|
|
3012
3056
|
async list(t) {
|
|
3013
|
-
return (await i.select().from(ie).where(a(ie.tenant_id, t)).all()).map(
|
|
3057
|
+
return (await i.select().from(ie).where(a(ie.tenant_id, t)).all()).map(Ue);
|
|
3014
3058
|
},
|
|
3015
3059
|
async update(t, e, n) {
|
|
3016
3060
|
const s = {
|
|
@@ -3033,7 +3077,7 @@ function Wr(i) {
|
|
|
3033
3077
|
}
|
|
3034
3078
|
};
|
|
3035
3079
|
}
|
|
3036
|
-
function
|
|
3080
|
+
function es(i) {
|
|
3037
3081
|
return {
|
|
3038
3082
|
async get(t, e, n) {
|
|
3039
3083
|
const s = await i.select().from(Z).where(
|
|
@@ -3060,7 +3104,11 @@ function Hr(i) {
|
|
|
3060
3104
|
created_at_ts: o,
|
|
3061
3105
|
updated_at_ts: o
|
|
3062
3106
|
}).onConflictDoUpdate({
|
|
3063
|
-
target: [
|
|
3107
|
+
target: [
|
|
3108
|
+
Z.tenant_id,
|
|
3109
|
+
Z.prompt,
|
|
3110
|
+
Z.language
|
|
3111
|
+
],
|
|
3064
3112
|
set: { custom_text: l, updated_at_ts: o }
|
|
3065
3113
|
});
|
|
3066
3114
|
},
|
|
@@ -3081,11 +3129,11 @@ function Hr(i) {
|
|
|
3081
3129
|
}
|
|
3082
3130
|
};
|
|
3083
3131
|
}
|
|
3084
|
-
function
|
|
3132
|
+
function ts(i) {
|
|
3085
3133
|
return {
|
|
3086
3134
|
async create(t, e) {
|
|
3087
3135
|
const n = (/* @__PURE__ */ new Date()).toISOString();
|
|
3088
|
-
await i.insert(
|
|
3136
|
+
await i.insert(ve).values({
|
|
3089
3137
|
tenant_id: t,
|
|
3090
3138
|
name: e.name,
|
|
3091
3139
|
enabled: e.enabled,
|
|
@@ -3097,7 +3145,7 @@ function Gr(i) {
|
|
|
3097
3145
|
});
|
|
3098
3146
|
},
|
|
3099
3147
|
async get(t) {
|
|
3100
|
-
const e = await i.select().from(
|
|
3148
|
+
const e = await i.select().from(ve).where(a(ve.tenant_id, t)).get();
|
|
3101
3149
|
if (!e) return null;
|
|
3102
3150
|
const { tenant_id: n, ...s } = e;
|
|
3103
3151
|
return z({
|
|
@@ -3111,14 +3159,14 @@ function Gr(i) {
|
|
|
3111
3159
|
const n = {
|
|
3112
3160
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
3113
3161
|
};
|
|
3114
|
-
e.name !== void 0 && (n.name = e.name), e.enabled !== void 0 && (n.enabled = e.enabled), e.default_from_address !== void 0 && (n.default_from_address = e.default_from_address), e.credentials !== void 0 && (n.credentials = JSON.stringify(e.credentials)), e.settings !== void 0 && (n.settings = JSON.stringify(e.settings)), await i.update(
|
|
3162
|
+
e.name !== void 0 && (n.name = e.name), e.enabled !== void 0 && (n.enabled = e.enabled), e.default_from_address !== void 0 && (n.default_from_address = e.default_from_address), e.credentials !== void 0 && (n.credentials = JSON.stringify(e.credentials)), e.settings !== void 0 && (n.settings = JSON.stringify(e.settings)), await i.update(ve).set(n).where(a(ve.tenant_id, t));
|
|
3115
3163
|
},
|
|
3116
3164
|
async remove(t) {
|
|
3117
|
-
await i.delete(
|
|
3165
|
+
await i.delete(ve).where(a(ve.tenant_id, t));
|
|
3118
3166
|
}
|
|
3119
3167
|
};
|
|
3120
3168
|
}
|
|
3121
|
-
function
|
|
3169
|
+
function ns(i) {
|
|
3122
3170
|
return {
|
|
3123
3171
|
async create(t, e) {
|
|
3124
3172
|
const n = (/* @__PURE__ */ new Date()).toISOString(), s = `af_${oe()}`;
|
|
@@ -3153,7 +3201,12 @@ function Yr(i) {
|
|
|
3153
3201
|
return n.name !== void 0 && (s.name = n.name), n.actions !== void 0 && (s.actions = JSON.stringify(n.actions)), (await i.update(ne).set(s).where(m(a(ne.tenant_id, t), a(ne.id, e))).returning()).length === 0 ? null : this.get(t, e);
|
|
3154
3202
|
},
|
|
3155
3203
|
async list(t, e) {
|
|
3156
|
-
const {
|
|
3204
|
+
const {
|
|
3205
|
+
page: n = 0,
|
|
3206
|
+
per_page: s = 50,
|
|
3207
|
+
include_totals: o = !1,
|
|
3208
|
+
sort: l
|
|
3209
|
+
} = e || {};
|
|
3157
3210
|
let _ = i.select().from(ne).where(a(ne.tenant_id, t)).$dynamic();
|
|
3158
3211
|
if (l != null && l.sort_by) {
|
|
3159
3212
|
const h = ne[l.sort_by];
|
|
@@ -3161,7 +3214,7 @@ function Yr(i) {
|
|
|
3161
3214
|
l.sort_order === "desc" ? V(h) : Y(h)
|
|
3162
3215
|
));
|
|
3163
3216
|
}
|
|
3164
|
-
const
|
|
3217
|
+
const c = (await _.offset(n * s).limit(s)).map((h) => {
|
|
3165
3218
|
const { tenant_id: g, actions: y, ...w } = h;
|
|
3166
3219
|
return z({
|
|
3167
3220
|
...w,
|
|
@@ -3169,10 +3222,10 @@ function Yr(i) {
|
|
|
3169
3222
|
});
|
|
3170
3223
|
});
|
|
3171
3224
|
if (!o)
|
|
3172
|
-
return { flows:
|
|
3225
|
+
return { flows: c };
|
|
3173
3226
|
const [u] = await i.select({ count: R() }).from(ne).where(a(ne.tenant_id, t));
|
|
3174
3227
|
return {
|
|
3175
|
-
flows:
|
|
3228
|
+
flows: c,
|
|
3176
3229
|
start: n * s,
|
|
3177
3230
|
limit: s,
|
|
3178
3231
|
length: Number((u == null ? void 0 : u.count) ?? 0)
|
|
@@ -3183,8 +3236,8 @@ function Yr(i) {
|
|
|
3183
3236
|
}
|
|
3184
3237
|
};
|
|
3185
3238
|
}
|
|
3186
|
-
const
|
|
3187
|
-
function
|
|
3239
|
+
const Ke = ["nodes", "start", "ending"];
|
|
3240
|
+
function is(i) {
|
|
3188
3241
|
return {
|
|
3189
3242
|
async create(t, e) {
|
|
3190
3243
|
const n = (/* @__PURE__ */ new Date()).toISOString(), s = oe(), o = {
|
|
@@ -3198,8 +3251,10 @@ function Xr(i) {
|
|
|
3198
3251
|
created_at: n,
|
|
3199
3252
|
updated_at: n
|
|
3200
3253
|
};
|
|
3201
|
-
for (const l of
|
|
3202
|
-
o[l] = JSON.stringify(
|
|
3254
|
+
for (const l of Ke)
|
|
3255
|
+
o[l] = JSON.stringify(
|
|
3256
|
+
e[l] || (l === "nodes" ? [] : {})
|
|
3257
|
+
);
|
|
3203
3258
|
return await i.insert(te).values(o), {
|
|
3204
3259
|
id: s,
|
|
3205
3260
|
...e,
|
|
@@ -3211,7 +3266,7 @@ function Xr(i) {
|
|
|
3211
3266
|
const n = await i.select().from(te).where(m(a(te.tenant_id, t), a(te.id, e))).get();
|
|
3212
3267
|
if (!n) return null;
|
|
3213
3268
|
const { tenant_id: s, ...o } = n, l = { ...o };
|
|
3214
|
-
for (const _ of
|
|
3269
|
+
for (const _ of Ke)
|
|
3215
3270
|
l[_] = b(o[_]);
|
|
3216
3271
|
return z(l);
|
|
3217
3272
|
},
|
|
@@ -3220,11 +3275,16 @@ function Xr(i) {
|
|
|
3220
3275
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
3221
3276
|
};
|
|
3222
3277
|
for (const [l, _] of Object.entries(n))
|
|
3223
|
-
_ !== void 0 && (
|
|
3278
|
+
_ !== void 0 && (Ke.includes(l) ? s[l] = JSON.stringify(_) : s[l] = _);
|
|
3224
3279
|
return (await i.update(te).set(s).where(m(a(te.tenant_id, t), a(te.id, e))).returning()).length > 0;
|
|
3225
3280
|
},
|
|
3226
3281
|
async list(t, e) {
|
|
3227
|
-
const {
|
|
3282
|
+
const {
|
|
3283
|
+
page: n = 0,
|
|
3284
|
+
per_page: s = 50,
|
|
3285
|
+
include_totals: o = !1,
|
|
3286
|
+
sort: l
|
|
3287
|
+
} = e || {};
|
|
3228
3288
|
let _ = i.select().from(te).where(a(te.tenant_id, t)).$dynamic();
|
|
3229
3289
|
if (l != null && l.sort_by) {
|
|
3230
3290
|
const h = te[l.sort_by];
|
|
@@ -3232,17 +3292,17 @@ function Xr(i) {
|
|
|
3232
3292
|
l.sort_order === "desc" ? V(h) : Y(h)
|
|
3233
3293
|
));
|
|
3234
3294
|
}
|
|
3235
|
-
const
|
|
3295
|
+
const c = (await _.offset(n * s).limit(s)).map((h) => {
|
|
3236
3296
|
const { tenant_id: g, ...y } = h, w = { ...y };
|
|
3237
|
-
for (const A of
|
|
3297
|
+
for (const A of Ke)
|
|
3238
3298
|
w[A] = b(y[A]);
|
|
3239
3299
|
return z(w);
|
|
3240
3300
|
});
|
|
3241
3301
|
if (!o)
|
|
3242
|
-
return { forms:
|
|
3302
|
+
return { forms: c };
|
|
3243
3303
|
const [u] = await i.select({ count: R() }).from(te).where(a(te.tenant_id, t));
|
|
3244
3304
|
return {
|
|
3245
|
-
forms:
|
|
3305
|
+
forms: c,
|
|
3246
3306
|
start: n * s,
|
|
3247
3307
|
limit: s,
|
|
3248
3308
|
length: Number((u == null ? void 0 : u.count) ?? 0)
|
|
@@ -3253,7 +3313,7 @@ function Xr(i) {
|
|
|
3253
3313
|
}
|
|
3254
3314
|
};
|
|
3255
3315
|
}
|
|
3256
|
-
function
|
|
3316
|
+
function gr(i) {
|
|
3257
3317
|
if (i != null) {
|
|
3258
3318
|
if (typeof i == "number")
|
|
3259
3319
|
return new Date(i).toISOString();
|
|
@@ -3265,8 +3325,8 @@ function cr(i) {
|
|
|
3265
3325
|
}
|
|
3266
3326
|
}
|
|
3267
3327
|
}
|
|
3268
|
-
function
|
|
3269
|
-
return
|
|
3328
|
+
function yt(i, t = (/* @__PURE__ */ new Date(0)).toISOString()) {
|
|
3329
|
+
return gr(i) ?? t;
|
|
3270
3330
|
}
|
|
3271
3331
|
function j(i) {
|
|
3272
3332
|
if (!i || i === "")
|
|
@@ -3274,27 +3334,73 @@ function j(i) {
|
|
|
3274
3334
|
const t = new Date(i);
|
|
3275
3335
|
return isNaN(t.getTime()) ? null : t.getTime();
|
|
3276
3336
|
}
|
|
3277
|
-
function
|
|
3337
|
+
function Je(i, t, e = []) {
|
|
3278
3338
|
const n = {};
|
|
3279
3339
|
for (const s of t) {
|
|
3280
3340
|
const o = s.replace(/_ts$/, "");
|
|
3281
|
-
n[o] =
|
|
3341
|
+
n[o] = yt(i[s]);
|
|
3282
3342
|
}
|
|
3283
3343
|
for (const s of e) {
|
|
3284
3344
|
const o = s.replace(/_ts$/, "");
|
|
3285
|
-
n[o] =
|
|
3345
|
+
n[o] = gr(i[s]);
|
|
3286
3346
|
}
|
|
3287
3347
|
return n;
|
|
3288
3348
|
}
|
|
3289
|
-
|
|
3349
|
+
const rs = Wr(
|
|
3350
|
+
"0123456789abcdefghijklmnopqrstuvwxyz",
|
|
3351
|
+
17
|
|
3352
|
+
);
|
|
3353
|
+
function ss() {
|
|
3354
|
+
return `hc_${rs()}`;
|
|
3355
|
+
}
|
|
3356
|
+
function At(i) {
|
|
3357
|
+
const { created_at_ts: t, updated_at_ts: e, secrets: n, ...s } = i, o = Je({ created_at_ts: t, updated_at_ts: e }, [
|
|
3358
|
+
"created_at_ts",
|
|
3359
|
+
"updated_at_ts"
|
|
3360
|
+
]);
|
|
3361
|
+
return {
|
|
3362
|
+
...s,
|
|
3363
|
+
...o,
|
|
3364
|
+
secrets: n ? JSON.parse(n) : void 0
|
|
3365
|
+
};
|
|
3366
|
+
}
|
|
3367
|
+
function os(i) {
|
|
3368
|
+
return {
|
|
3369
|
+
async create(t, e) {
|
|
3370
|
+
const n = Date.now(), o = {
|
|
3371
|
+
id: ss(),
|
|
3372
|
+
tenant_id: t,
|
|
3373
|
+
code: e.code,
|
|
3374
|
+
secrets: e.secrets ? JSON.stringify(e.secrets) : null,
|
|
3375
|
+
created_at_ts: n,
|
|
3376
|
+
updated_at_ts: n
|
|
3377
|
+
};
|
|
3378
|
+
return await i.insert(fe).values(o), At({ ...o, tenant_id: t });
|
|
3379
|
+
},
|
|
3380
|
+
async get(t, e) {
|
|
3381
|
+
const n = await i.select().from(fe).where(m(a(fe.tenant_id, t), a(fe.id, e))).get();
|
|
3382
|
+
return n ? At(n) : null;
|
|
3383
|
+
},
|
|
3384
|
+
async update(t, e, n) {
|
|
3385
|
+
const s = {
|
|
3386
|
+
updated_at_ts: Date.now()
|
|
3387
|
+
};
|
|
3388
|
+
return n.code !== void 0 && (s.code = n.code), n.secrets !== void 0 && (s.secrets = JSON.stringify(n.secrets)), (await i.update(fe).set(s).where(m(a(fe.tenant_id, t), a(fe.id, e))).returning()).length > 0;
|
|
3389
|
+
},
|
|
3390
|
+
async remove(t, e) {
|
|
3391
|
+
return (await i.delete(fe).where(m(a(fe.tenant_id, t), a(fe.id, e))).returning()).length > 0;
|
|
3392
|
+
}
|
|
3393
|
+
};
|
|
3394
|
+
}
|
|
3395
|
+
function as() {
|
|
3290
3396
|
const { customAlphabet: i } = require("nanoid");
|
|
3291
3397
|
return `h_${i("0123456789abcdefghijklmnopqrstuvwxyz", 17)()}`;
|
|
3292
3398
|
}
|
|
3293
|
-
function
|
|
3294
|
-
const { tenant_id: t, created_at_ts: e, updated_at_ts: n, ...s } = i, o =
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
);
|
|
3399
|
+
function rt(i) {
|
|
3400
|
+
const { tenant_id: t, created_at_ts: e, updated_at_ts: n, ...s } = i, o = Je({ created_at_ts: e, updated_at_ts: n }, [
|
|
3401
|
+
"created_at_ts",
|
|
3402
|
+
"updated_at_ts"
|
|
3403
|
+
]);
|
|
3298
3404
|
return z({
|
|
3299
3405
|
...s,
|
|
3300
3406
|
enabled: !!s.enabled,
|
|
@@ -3302,11 +3408,11 @@ function it(i) {
|
|
|
3302
3408
|
...o
|
|
3303
3409
|
});
|
|
3304
3410
|
}
|
|
3305
|
-
function
|
|
3411
|
+
function ls(i) {
|
|
3306
3412
|
return {
|
|
3307
3413
|
async create(t, e) {
|
|
3308
3414
|
const n = Date.now(), o = {
|
|
3309
|
-
hook_id: e.hook_id ||
|
|
3415
|
+
hook_id: e.hook_id || as(),
|
|
3310
3416
|
tenant_id: t,
|
|
3311
3417
|
trigger_id: e.trigger_id,
|
|
3312
3418
|
url: e.url,
|
|
@@ -3315,38 +3421,46 @@ function es(i) {
|
|
|
3315
3421
|
priority: e.priority,
|
|
3316
3422
|
form_id: e.form_id,
|
|
3317
3423
|
template_id: e.template_id,
|
|
3424
|
+
code_id: e.code_id,
|
|
3318
3425
|
created_at_ts: n,
|
|
3319
3426
|
updated_at_ts: n
|
|
3320
3427
|
};
|
|
3321
|
-
return await i.insert(X).values(o),
|
|
3428
|
+
return await i.insert(X).values(o), rt({ ...o, tenant_id: t });
|
|
3322
3429
|
},
|
|
3323
3430
|
async get(t, e) {
|
|
3324
|
-
const n = await i.select().from(X).where(
|
|
3325
|
-
|
|
3326
|
-
).get();
|
|
3327
|
-
return n ? it(n) : null;
|
|
3431
|
+
const n = await i.select().from(X).where(m(a(X.tenant_id, t), a(X.hook_id, e))).get();
|
|
3432
|
+
return n ? rt(n) : null;
|
|
3328
3433
|
},
|
|
3329
3434
|
async update(t, e, n) {
|
|
3330
3435
|
const s = {
|
|
3331
3436
|
updated_at_ts: Date.now()
|
|
3332
3437
|
};
|
|
3333
|
-
return n.trigger_id !== void 0 && (s.trigger_id = n.trigger_id), n.url !== void 0 && (s.url = n.url), n.enabled !== void 0 && (s.enabled = n.enabled), n.synchronous !== void 0 && (s.synchronous = n.synchronous), n.priority !== void 0 && (s.priority = n.priority), n.form_id !== void 0 && (s.form_id = n.form_id), n.template_id !== void 0 && (s.template_id = n.template_id), (await i.update(X).set(s).where(
|
|
3334
|
-
m(a(X.tenant_id, t), a(X.hook_id, e))
|
|
3335
|
-
).returning()).length > 0;
|
|
3438
|
+
return n.trigger_id !== void 0 && (s.trigger_id = n.trigger_id), n.url !== void 0 && (s.url = n.url), n.enabled !== void 0 && (s.enabled = n.enabled), n.synchronous !== void 0 && (s.synchronous = n.synchronous), n.priority !== void 0 && (s.priority = n.priority), n.form_id !== void 0 && (s.form_id = n.form_id), n.template_id !== void 0 && (s.template_id = n.template_id), n.code_id !== void 0 && (s.code_id = n.code_id), (await i.update(X).set(s).where(m(a(X.tenant_id, t), a(X.hook_id, e))).returning()).length > 0;
|
|
3336
3439
|
},
|
|
3337
3440
|
async list(t, e) {
|
|
3338
|
-
const {
|
|
3339
|
-
|
|
3441
|
+
const {
|
|
3442
|
+
page: n = 0,
|
|
3443
|
+
per_page: s = 50,
|
|
3444
|
+
include_totals: o = !1,
|
|
3445
|
+
sort: l,
|
|
3446
|
+
q: _
|
|
3447
|
+
} = e || {}, d = _ ? he(X, _, [
|
|
3448
|
+
"url",
|
|
3449
|
+
"form_id",
|
|
3450
|
+
"template_id",
|
|
3451
|
+
"code_id"
|
|
3452
|
+
]) : void 0, c = d ? m(a(X.tenant_id, t), d) : a(X.tenant_id, t);
|
|
3453
|
+
let u = i.select().from(X).where(c).$dynamic();
|
|
3340
3454
|
if (l != null && l.sort_by) {
|
|
3341
3455
|
const w = X[l.sort_by];
|
|
3342
3456
|
w && (u = u.orderBy(
|
|
3343
3457
|
l.sort_order === "desc" ? V(w) : Y(w)
|
|
3344
3458
|
));
|
|
3345
3459
|
}
|
|
3346
|
-
const g = (await u.offset(n * s).limit(s)).map(
|
|
3460
|
+
const g = (await u.offset(n * s).limit(s)).map(rt);
|
|
3347
3461
|
if (!o)
|
|
3348
3462
|
return { hooks: g };
|
|
3349
|
-
const [y] = await i.select({ count: R() }).from(X).where(
|
|
3463
|
+
const [y] = await i.select({ count: R() }).from(X).where(c);
|
|
3350
3464
|
return {
|
|
3351
3465
|
hooks: g,
|
|
3352
3466
|
start: n * s,
|
|
@@ -3355,36 +3469,32 @@ function es(i) {
|
|
|
3355
3469
|
};
|
|
3356
3470
|
},
|
|
3357
3471
|
async remove(t, e) {
|
|
3358
|
-
return (await i.delete(X).where(
|
|
3359
|
-
m(a(X.tenant_id, t), a(X.hook_id, e))
|
|
3360
|
-
).returning()).length > 0;
|
|
3472
|
+
return (await i.delete(X).where(m(a(X.tenant_id, t), a(X.hook_id, e))).returning()).length > 0;
|
|
3361
3473
|
}
|
|
3362
3474
|
};
|
|
3363
3475
|
}
|
|
3364
|
-
function
|
|
3476
|
+
function _s() {
|
|
3365
3477
|
const { customAlphabet: i } = require("nanoid");
|
|
3366
3478
|
return `inv_${i("0123456789abcdefghijklmnopqrstuvwxyz", 17)()}`;
|
|
3367
3479
|
}
|
|
3368
|
-
const
|
|
3480
|
+
const wt = [
|
|
3369
3481
|
"inviter",
|
|
3370
3482
|
"invitee",
|
|
3371
3483
|
"app_metadata",
|
|
3372
3484
|
"user_metadata",
|
|
3373
3485
|
"roles"
|
|
3374
3486
|
];
|
|
3375
|
-
function
|
|
3487
|
+
function st(i) {
|
|
3376
3488
|
const { tenant_id: t, send_invitation_email: e, ...n } = i, s = { ...n };
|
|
3377
|
-
for (const o of
|
|
3489
|
+
for (const o of wt)
|
|
3378
3490
|
s[o] = b(n[o], o === "roles" ? [] : {});
|
|
3379
3491
|
return s.send_invitation_email = !!e, z(s);
|
|
3380
3492
|
}
|
|
3381
|
-
function
|
|
3493
|
+
function us(i) {
|
|
3382
3494
|
return {
|
|
3383
3495
|
async create(t, e) {
|
|
3384
|
-
var
|
|
3385
|
-
const n = e.id ||
|
|
3386
|
-
o.getTime() + s * 1e3
|
|
3387
|
-
).toISOString(), _ = {
|
|
3496
|
+
var d, c;
|
|
3497
|
+
const n = e.id || _s(), s = e.ttl_sec || 604800, o = /* @__PURE__ */ new Date(), l = new Date(o.getTime() + s * 1e3).toISOString(), _ = {
|
|
3388
3498
|
id: n,
|
|
3389
3499
|
tenant_id: t,
|
|
3390
3500
|
organization_id: e.organization_id,
|
|
@@ -3397,29 +3507,34 @@ function ns(i) {
|
|
|
3397
3507
|
created_at: o.toISOString(),
|
|
3398
3508
|
expires_at: l
|
|
3399
3509
|
};
|
|
3400
|
-
for (const u of
|
|
3510
|
+
for (const u of wt)
|
|
3401
3511
|
e[u] !== void 0 && (_[u] = JSON.stringify(e[u]));
|
|
3402
3512
|
try {
|
|
3403
3513
|
await i.insert(ee).values(_);
|
|
3404
3514
|
} catch (u) {
|
|
3405
|
-
throw (
|
|
3515
|
+
throw (d = u == null ? void 0 : u.message) != null && d.includes("UNIQUE constraint failed") || (c = u == null ? void 0 : u.message) != null && c.includes("duplicate key") ? new be(409, { message: "Invite already exists" }) : u;
|
|
3406
3516
|
}
|
|
3407
|
-
return
|
|
3517
|
+
return st({ ..._, tenant_id: t });
|
|
3408
3518
|
},
|
|
3409
3519
|
async get(t, e) {
|
|
3410
3520
|
const n = await i.select().from(ee).where(m(a(ee.tenant_id, t), a(ee.id, e))).get();
|
|
3411
|
-
return n ?
|
|
3521
|
+
return n ? st(n) : null;
|
|
3412
3522
|
},
|
|
3413
3523
|
async update(t, e, n) {
|
|
3414
3524
|
const s = {};
|
|
3415
|
-
for (const l of
|
|
3525
|
+
for (const l of wt)
|
|
3416
3526
|
n[l] !== void 0 && (s[l] = JSON.stringify(n[l]));
|
|
3417
3527
|
return n.connection_id !== void 0 && (s.connection_id = n.connection_id), n.ttl_sec !== void 0 && (s.ttl_sec = n.ttl_sec, s.expires_at = new Date(
|
|
3418
3528
|
Date.now() + n.ttl_sec * 1e3
|
|
3419
3529
|
).toISOString()), (await i.update(ee).set(s).where(m(a(ee.tenant_id, t), a(ee.id, e))).returning()).length > 0;
|
|
3420
3530
|
},
|
|
3421
3531
|
async list(t, e) {
|
|
3422
|
-
const {
|
|
3532
|
+
const {
|
|
3533
|
+
page: n = 0,
|
|
3534
|
+
per_page: s = 50,
|
|
3535
|
+
include_totals: o = !1,
|
|
3536
|
+
sort: l
|
|
3537
|
+
} = e || {};
|
|
3423
3538
|
let _ = i.select().from(ee).where(a(ee.tenant_id, t)).$dynamic();
|
|
3424
3539
|
if (l != null && l.sort_by) {
|
|
3425
3540
|
const h = ee[l.sort_by];
|
|
@@ -3427,12 +3542,12 @@ function ns(i) {
|
|
|
3427
3542
|
l.sort_order === "desc" ? V(h) : Y(h)
|
|
3428
3543
|
));
|
|
3429
3544
|
}
|
|
3430
|
-
const
|
|
3545
|
+
const c = (await _.offset(n * s).limit(s)).map(st);
|
|
3431
3546
|
if (!o)
|
|
3432
|
-
return { invites:
|
|
3547
|
+
return { invites: c };
|
|
3433
3548
|
const [u] = await i.select({ count: R() }).from(ee).where(a(ee.tenant_id, t));
|
|
3434
3549
|
return {
|
|
3435
|
-
invites:
|
|
3550
|
+
invites: c,
|
|
3436
3551
|
start: n * s,
|
|
3437
3552
|
limit: s,
|
|
3438
3553
|
length: Number((u == null ? void 0 : u.count) ?? 0)
|
|
@@ -3443,54 +3558,59 @@ function ns(i) {
|
|
|
3443
3558
|
}
|
|
3444
3559
|
};
|
|
3445
3560
|
}
|
|
3446
|
-
function
|
|
3561
|
+
function ds(i) {
|
|
3447
3562
|
return {
|
|
3448
3563
|
async create(t) {
|
|
3449
|
-
await i.insert(
|
|
3564
|
+
await i.insert(me).values({
|
|
3450
3565
|
...t,
|
|
3451
3566
|
created_at: (/* @__PURE__ */ new Date()).toDateString()
|
|
3452
3567
|
});
|
|
3453
3568
|
},
|
|
3454
3569
|
async list(t) {
|
|
3455
|
-
const {
|
|
3456
|
-
|
|
3570
|
+
const {
|
|
3571
|
+
page: e = 0,
|
|
3572
|
+
per_page: n = 50,
|
|
3573
|
+
include_totals: s = !1,
|
|
3574
|
+
sort: o
|
|
3575
|
+
} = t || {}, l = (/* @__PURE__ */ new Date()).toISOString();
|
|
3576
|
+
let _ = i.select().from(me).where(ue(Re(me.revoked_at, l), pe(me.revoked_at))).$dynamic();
|
|
3457
3577
|
if (o != null && o.sort_by) {
|
|
3458
|
-
const h =
|
|
3578
|
+
const h = me[o.sort_by];
|
|
3459
3579
|
h && (_ = _.orderBy(
|
|
3460
3580
|
o.sort_order === "desc" ? V(h) : Y(h)
|
|
3461
3581
|
));
|
|
3462
3582
|
}
|
|
3463
|
-
const
|
|
3583
|
+
const c = (await _.offset(e * n).limit(n)).map((h) => {
|
|
3464
3584
|
const { created_at: g, ...y } = h;
|
|
3465
3585
|
return z(y);
|
|
3466
3586
|
});
|
|
3467
3587
|
if (!s)
|
|
3468
|
-
return { signingKeys:
|
|
3469
|
-
const [u] = await i.select({ count: R() }).from(
|
|
3588
|
+
return { signingKeys: c };
|
|
3589
|
+
const [u] = await i.select({ count: R() }).from(me).where(ue(Re(me.revoked_at, l), pe(me.revoked_at)));
|
|
3470
3590
|
return {
|
|
3471
|
-
signingKeys:
|
|
3591
|
+
signingKeys: c,
|
|
3472
3592
|
start: e * n,
|
|
3473
3593
|
limit: n,
|
|
3474
|
-
length:
|
|
3594
|
+
length: Jr((u == null ? void 0 : u.count) ?? 0)
|
|
3475
3595
|
};
|
|
3476
3596
|
},
|
|
3477
3597
|
async update(t, e) {
|
|
3478
|
-
return (await i.update(
|
|
3598
|
+
return (await i.update(me).set(e).where(a(me.kid, t)).returning()).length > 0;
|
|
3479
3599
|
}
|
|
3480
3600
|
};
|
|
3481
3601
|
}
|
|
3482
|
-
const
|
|
3483
|
-
function
|
|
3602
|
+
const Nt = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", ot = Nt.length;
|
|
3603
|
+
function cs() {
|
|
3484
3604
|
let e = Date.now(), n = "";
|
|
3485
3605
|
for (let o = 10; o > 0; o--)
|
|
3486
|
-
n =
|
|
3606
|
+
n = Nt.charAt(e % ot) + n, e = Math.floor(e / ot);
|
|
3487
3607
|
const s = new Uint8Array(16);
|
|
3488
3608
|
crypto.getRandomValues(s);
|
|
3489
3609
|
for (let o = 0; o < 16; o++)
|
|
3490
|
-
n +=
|
|
3610
|
+
n += Nt.charAt(s[o] % ot);
|
|
3491
3611
|
return n;
|
|
3492
3612
|
}
|
|
3493
|
-
function
|
|
3613
|
+
function Ct(i) {
|
|
3494
3614
|
const {
|
|
3495
3615
|
tenant_id: t,
|
|
3496
3616
|
created_at_ts: e,
|
|
@@ -3498,20 +3618,20 @@ function Et(i) {
|
|
|
3498
3618
|
expires_at_ts: s,
|
|
3499
3619
|
state_data: o,
|
|
3500
3620
|
...l
|
|
3501
|
-
} = i, _ =
|
|
3621
|
+
} = i, _ = Je(
|
|
3502
3622
|
{ created_at_ts: e, updated_at_ts: n, expires_at_ts: s },
|
|
3503
3623
|
["created_at_ts", "updated_at_ts", "expires_at_ts"]
|
|
3504
|
-
),
|
|
3624
|
+
), d = cr(l, ["authParams"]);
|
|
3505
3625
|
return z({
|
|
3506
|
-
...
|
|
3626
|
+
...d,
|
|
3507
3627
|
..._,
|
|
3508
3628
|
state_data: b(o)
|
|
3509
3629
|
});
|
|
3510
3630
|
}
|
|
3511
|
-
function
|
|
3631
|
+
function gs(i) {
|
|
3512
3632
|
return {
|
|
3513
3633
|
async create(t, e) {
|
|
3514
|
-
const n = Date.now(), s =
|
|
3634
|
+
const n = Date.now(), s = cs(), o = Be(
|
|
3515
3635
|
{ authParams: e.authParams || {} },
|
|
3516
3636
|
"authParams"
|
|
3517
3637
|
), l = {
|
|
@@ -3532,18 +3652,15 @@ function ss(i) {
|
|
|
3532
3652
|
updated_at_ts: n,
|
|
3533
3653
|
expires_at_ts: e.expires_at ? j(e.expires_at) : n + 1e3 * 60 * 60 * 24
|
|
3534
3654
|
};
|
|
3535
|
-
for (const [_,
|
|
3536
|
-
l[_] =
|
|
3537
|
-
return await i.insert(se).values(l),
|
|
3655
|
+
for (const [_, d] of Object.entries(o))
|
|
3656
|
+
l[_] = d;
|
|
3657
|
+
return await i.insert(se).values(l), Ct({ ...l, tenant_id: t });
|
|
3538
3658
|
},
|
|
3539
3659
|
async get(t, e) {
|
|
3540
3660
|
const n = await i.select().from(se).where(
|
|
3541
|
-
m(
|
|
3542
|
-
a(se.tenant_id, t),
|
|
3543
|
-
a(se.id, e)
|
|
3544
|
-
)
|
|
3661
|
+
m(a(se.tenant_id, t), a(se.id, e))
|
|
3545
3662
|
).get();
|
|
3546
|
-
return n ?
|
|
3663
|
+
return n ? Ct(n) : null;
|
|
3547
3664
|
},
|
|
3548
3665
|
async update(t, e, n) {
|
|
3549
3666
|
var o;
|
|
@@ -3554,30 +3671,24 @@ function ss(i) {
|
|
|
3554
3671
|
0,
|
|
3555
3672
|
1024
|
|
3556
3673
|
)), n.expires_at !== void 0 && (s.expires_at_ts = j(n.expires_at)), n.authParams) {
|
|
3557
|
-
const l =
|
|
3674
|
+
const l = Be(
|
|
3558
3675
|
{ authParams: n.authParams },
|
|
3559
3676
|
"authParams"
|
|
3560
3677
|
);
|
|
3561
3678
|
Object.assign(s, l);
|
|
3562
3679
|
}
|
|
3563
3680
|
return await i.update(se).set(s).where(
|
|
3564
|
-
m(
|
|
3565
|
-
a(se.tenant_id, t),
|
|
3566
|
-
a(se.id, e)
|
|
3567
|
-
)
|
|
3681
|
+
m(a(se.tenant_id, t), a(se.id, e))
|
|
3568
3682
|
), !0;
|
|
3569
3683
|
},
|
|
3570
3684
|
async remove(t, e) {
|
|
3571
3685
|
return (await i.delete(se).where(
|
|
3572
|
-
m(
|
|
3573
|
-
a(se.tenant_id, t),
|
|
3574
|
-
a(se.id, e)
|
|
3575
|
-
)
|
|
3686
|
+
m(a(se.tenant_id, t), a(se.id, e))
|
|
3576
3687
|
).returning()).length > 0;
|
|
3577
3688
|
}
|
|
3578
3689
|
};
|
|
3579
3690
|
}
|
|
3580
|
-
function
|
|
3691
|
+
function at(i) {
|
|
3581
3692
|
const {
|
|
3582
3693
|
tenant_id: t,
|
|
3583
3694
|
isMobile: e,
|
|
@@ -3586,8 +3697,8 @@ function ot(i) {
|
|
|
3586
3697
|
country_code: o,
|
|
3587
3698
|
city_name: l,
|
|
3588
3699
|
latitude: _,
|
|
3589
|
-
longitude:
|
|
3590
|
-
time_zone:
|
|
3700
|
+
longitude: d,
|
|
3701
|
+
time_zone: c,
|
|
3591
3702
|
continent_code: u,
|
|
3592
3703
|
scope: h,
|
|
3593
3704
|
...g
|
|
@@ -3602,12 +3713,12 @@ function ot(i) {
|
|
|
3602
3713
|
country_code: o,
|
|
3603
3714
|
city_name: l,
|
|
3604
3715
|
latitude: _,
|
|
3605
|
-
longitude:
|
|
3606
|
-
time_zone:
|
|
3716
|
+
longitude: d,
|
|
3717
|
+
time_zone: c,
|
|
3607
3718
|
continent_code: u
|
|
3608
3719
|
})), z(y);
|
|
3609
3720
|
}
|
|
3610
|
-
function
|
|
3721
|
+
function fs(i) {
|
|
3611
3722
|
return {
|
|
3612
3723
|
async create(t, e) {
|
|
3613
3724
|
var o, l;
|
|
@@ -3634,28 +3745,34 @@ function os(i) {
|
|
|
3634
3745
|
hostname: e.hostname,
|
|
3635
3746
|
session_connection: e.session_connection
|
|
3636
3747
|
};
|
|
3637
|
-
return e.auth0_client && (s.auth0_client = JSON.stringify(e.auth0_client)), e.details && (s.details = JSON.stringify(e.details).substring(0, 8192)), e.location_info && (s.country_code = e.location_info.country_code, s.city_name = e.location_info.city_name, s.latitude = e.location_info.latitude, s.longitude = e.location_info.longitude, s.time_zone = e.location_info.time_zone, s.continent_code = e.location_info.continent_code), await i.insert(T).values(s),
|
|
3748
|
+
return e.auth0_client && (s.auth0_client = JSON.stringify(e.auth0_client)), e.details && (s.details = JSON.stringify(e.details).substring(0, 8192)), e.location_info && (s.country_code = e.location_info.country_code, s.city_name = e.location_info.city_name, s.latitude = e.location_info.latitude, s.longitude = e.location_info.longitude, s.time_zone = e.location_info.time_zone, s.continent_code = e.location_info.continent_code), await i.insert(T).values(s), at({ ...s, tenant_id: t });
|
|
3638
3749
|
},
|
|
3639
3750
|
async list(t, e) {
|
|
3640
|
-
const {
|
|
3641
|
-
|
|
3751
|
+
const {
|
|
3752
|
+
page: n = 0,
|
|
3753
|
+
per_page: s = 50,
|
|
3754
|
+
include_totals: o = !1,
|
|
3755
|
+
sort: l,
|
|
3756
|
+
q: _
|
|
3757
|
+
} = e || {};
|
|
3758
|
+
let d = i.select().from(T).where(a(T.tenant_id, t)).$dynamic();
|
|
3642
3759
|
if (_) {
|
|
3643
|
-
const g =
|
|
3760
|
+
const g = he(T, _, [
|
|
3644
3761
|
"user_id",
|
|
3645
3762
|
"ip",
|
|
3646
3763
|
"type",
|
|
3647
3764
|
"client_id"
|
|
3648
3765
|
]);
|
|
3649
|
-
g && (
|
|
3766
|
+
g && (d = d.where(m(a(T.tenant_id, t), g)));
|
|
3650
3767
|
}
|
|
3651
3768
|
if (l != null && l.sort_by) {
|
|
3652
3769
|
const g = T[l.sort_by];
|
|
3653
|
-
g && (
|
|
3770
|
+
g && (d = d.orderBy(
|
|
3654
3771
|
l.sort_order === "desc" ? V(g) : Y(g)
|
|
3655
3772
|
));
|
|
3656
3773
|
} else
|
|
3657
|
-
|
|
3658
|
-
const u = (await
|
|
3774
|
+
d = d.orderBy(V(T.date));
|
|
3775
|
+
const u = (await d.offset(n * s).limit(s)).map(at);
|
|
3659
3776
|
if (!o)
|
|
3660
3777
|
return { logs: u };
|
|
3661
3778
|
const [h] = await i.select({ count: R() }).from(T).where(a(T.tenant_id, t));
|
|
@@ -3667,25 +3784,23 @@ function os(i) {
|
|
|
3667
3784
|
};
|
|
3668
3785
|
},
|
|
3669
3786
|
async get(t, e) {
|
|
3670
|
-
const n = await i.select().from(T).where(
|
|
3671
|
-
|
|
3672
|
-
).get();
|
|
3673
|
-
return n ? ot(n) : null;
|
|
3787
|
+
const n = await i.select().from(T).where(m(a(T.tenant_id, t), a(T.log_id, e))).get();
|
|
3788
|
+
return n ? at(n) : null;
|
|
3674
3789
|
}
|
|
3675
3790
|
};
|
|
3676
3791
|
}
|
|
3677
|
-
const
|
|
3678
|
-
function
|
|
3792
|
+
const vt = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", lt = vt.length;
|
|
3793
|
+
function ms() {
|
|
3679
3794
|
let e = Date.now(), n = "";
|
|
3680
3795
|
for (let o = 10; o > 0; o--)
|
|
3681
|
-
n =
|
|
3796
|
+
n = vt.charAt(e % lt) + n, e = Math.floor(e / lt);
|
|
3682
3797
|
const s = new Uint8Array(16);
|
|
3683
3798
|
crypto.getRandomValues(s);
|
|
3684
3799
|
for (let o = 0; o < 16; o++)
|
|
3685
|
-
n +=
|
|
3800
|
+
n += vt.charAt(s[o] % lt);
|
|
3686
3801
|
return n;
|
|
3687
3802
|
}
|
|
3688
|
-
function
|
|
3803
|
+
function je(i) {
|
|
3689
3804
|
const {
|
|
3690
3805
|
tenant_id: t,
|
|
3691
3806
|
created_at_ts: e,
|
|
@@ -3700,15 +3815,15 @@ function Ue(i) {
|
|
|
3700
3815
|
confirmed: !!o,
|
|
3701
3816
|
credential_backed_up: s != null ? !!s : void 0,
|
|
3702
3817
|
transports: b(l),
|
|
3703
|
-
created_at:
|
|
3704
|
-
updated_at:
|
|
3818
|
+
created_at: yt(e),
|
|
3819
|
+
updated_at: yt(n)
|
|
3705
3820
|
});
|
|
3706
3821
|
}
|
|
3707
|
-
function
|
|
3822
|
+
function hs(i) {
|
|
3708
3823
|
return {
|
|
3709
3824
|
async create(t, e) {
|
|
3710
3825
|
const n = Date.now(), o = {
|
|
3711
|
-
id: e.id ||
|
|
3826
|
+
id: e.id || ms(),
|
|
3712
3827
|
tenant_id: t,
|
|
3713
3828
|
user_id: e.user_id,
|
|
3714
3829
|
type: e.type,
|
|
@@ -3724,65 +3839,74 @@ function ls(i) {
|
|
|
3724
3839
|
created_at_ts: n,
|
|
3725
3840
|
updated_at_ts: n
|
|
3726
3841
|
};
|
|
3727
|
-
return await i.insert(
|
|
3842
|
+
return await i.insert(U).values(o), je({ ...o, tenant_id: t });
|
|
3728
3843
|
},
|
|
3729
3844
|
async get(t, e) {
|
|
3730
|
-
const n = await i.select().from(
|
|
3845
|
+
const n = await i.select().from(U).where(
|
|
3731
3846
|
m(
|
|
3732
|
-
a(
|
|
3733
|
-
a(
|
|
3847
|
+
a(U.tenant_id, t),
|
|
3848
|
+
a(U.id, e)
|
|
3734
3849
|
)
|
|
3735
3850
|
).get();
|
|
3736
|
-
return n ?
|
|
3851
|
+
return n ? je(n) : null;
|
|
3737
3852
|
},
|
|
3738
3853
|
async getByCredentialId(t, e) {
|
|
3739
|
-
const n = await i.select().from(
|
|
3854
|
+
const n = await i.select().from(U).where(
|
|
3740
3855
|
m(
|
|
3741
|
-
a(
|
|
3742
|
-
a(
|
|
3856
|
+
a(U.tenant_id, t),
|
|
3857
|
+
a(U.credential_id, e)
|
|
3743
3858
|
)
|
|
3744
3859
|
).get();
|
|
3745
|
-
return n ?
|
|
3860
|
+
return n ? je(n) : null;
|
|
3746
3861
|
},
|
|
3747
3862
|
async list(t, e) {
|
|
3748
|
-
return (await i.select().from(
|
|
3863
|
+
return (await i.select().from(U).where(
|
|
3749
3864
|
m(
|
|
3750
|
-
a(
|
|
3751
|
-
a(
|
|
3865
|
+
a(U.tenant_id, t),
|
|
3866
|
+
a(U.user_id, e)
|
|
3752
3867
|
)
|
|
3753
|
-
).all()).map(
|
|
3868
|
+
).all()).map(je);
|
|
3754
3869
|
},
|
|
3755
3870
|
async update(t, e, n) {
|
|
3756
3871
|
const s = {
|
|
3757
3872
|
updated_at_ts: Date.now()
|
|
3758
3873
|
};
|
|
3759
|
-
n.type !== void 0 && (s.type = n.type), n.phone_number !== void 0 && (s.phone_number = n.phone_number), n.totp_secret !== void 0 && (s.totp_secret = n.totp_secret), n.credential_id !== void 0 && (s.credential_id = n.credential_id), n.public_key !== void 0 && (s.public_key = n.public_key), n.sign_count !== void 0 && (s.sign_count = n.sign_count), n.credential_backed_up !== void 0 && (s.credential_backed_up = n.credential_backed_up ? 1 : 0), n.transports !== void 0 && (s.transports = JSON.stringify(n.transports)), n.friendly_name !== void 0 && (s.friendly_name = n.friendly_name), n.confirmed !== void 0 && (s.confirmed = n.confirmed ? 1 : 0), await i.update(
|
|
3874
|
+
n.type !== void 0 && (s.type = n.type), n.phone_number !== void 0 && (s.phone_number = n.phone_number), n.totp_secret !== void 0 && (s.totp_secret = n.totp_secret), n.credential_id !== void 0 && (s.credential_id = n.credential_id), n.public_key !== void 0 && (s.public_key = n.public_key), n.sign_count !== void 0 && (s.sign_count = n.sign_count), n.credential_backed_up !== void 0 && (s.credential_backed_up = n.credential_backed_up ? 1 : 0), n.transports !== void 0 && (s.transports = JSON.stringify(n.transports)), n.friendly_name !== void 0 && (s.friendly_name = n.friendly_name), n.confirmed !== void 0 && (s.confirmed = n.confirmed ? 1 : 0), await i.update(U).set(s).where(
|
|
3760
3875
|
m(
|
|
3761
|
-
a(
|
|
3762
|
-
a(
|
|
3876
|
+
a(U.tenant_id, t),
|
|
3877
|
+
a(U.id, e)
|
|
3763
3878
|
)
|
|
3764
3879
|
);
|
|
3765
3880
|
const o = await this.get(t, e);
|
|
3766
3881
|
if (!o)
|
|
3767
|
-
throw new Error(
|
|
3882
|
+
throw new Error(
|
|
3883
|
+
`Authentication method ${e} not found after update`
|
|
3884
|
+
);
|
|
3768
3885
|
return o;
|
|
3769
3886
|
},
|
|
3770
3887
|
async remove(t, e) {
|
|
3771
|
-
return (await i.delete(
|
|
3888
|
+
return (await i.delete(U).where(
|
|
3772
3889
|
m(
|
|
3773
|
-
a(
|
|
3774
|
-
a(
|
|
3890
|
+
a(U.tenant_id, t),
|
|
3891
|
+
a(U.id, e)
|
|
3775
3892
|
)
|
|
3776
3893
|
).returning()).length > 0;
|
|
3777
3894
|
}
|
|
3778
3895
|
};
|
|
3779
3896
|
}
|
|
3780
|
-
function
|
|
3897
|
+
function ps() {
|
|
3781
3898
|
const { customAlphabet: i } = require("nanoid");
|
|
3782
3899
|
return `org_${i("0123456789abcdefghijklmnopqrstuvwxyz", 17)()}`;
|
|
3783
3900
|
}
|
|
3784
|
-
function
|
|
3785
|
-
const {
|
|
3901
|
+
function _t(i) {
|
|
3902
|
+
const {
|
|
3903
|
+
tenant_id: t,
|
|
3904
|
+
branding: e,
|
|
3905
|
+
metadata: n,
|
|
3906
|
+
enabled_connections: s,
|
|
3907
|
+
token_quota: o,
|
|
3908
|
+
...l
|
|
3909
|
+
} = i;
|
|
3786
3910
|
return z({
|
|
3787
3911
|
...l,
|
|
3788
3912
|
branding: b(e, {}),
|
|
@@ -3791,12 +3915,12 @@ function lt(i) {
|
|
|
3791
3915
|
token_quota: b(o, {})
|
|
3792
3916
|
});
|
|
3793
3917
|
}
|
|
3794
|
-
function
|
|
3918
|
+
function ys(i) {
|
|
3795
3919
|
return {
|
|
3796
3920
|
async create(t, e) {
|
|
3797
3921
|
var l, _;
|
|
3798
3922
|
const n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
3799
|
-
id: e.id ||
|
|
3923
|
+
id: e.id || ps(),
|
|
3800
3924
|
tenant_id: t,
|
|
3801
3925
|
name: e.name,
|
|
3802
3926
|
display_name: e.display_name,
|
|
@@ -3809,12 +3933,12 @@ function us(i) {
|
|
|
3809
3933
|
};
|
|
3810
3934
|
try {
|
|
3811
3935
|
await i.insert(L).values(o);
|
|
3812
|
-
} catch (
|
|
3813
|
-
throw (l =
|
|
3936
|
+
} catch (d) {
|
|
3937
|
+
throw (l = d == null ? void 0 : d.message) != null && l.includes("UNIQUE constraint failed") || (_ = d == null ? void 0 : d.message) != null && _.includes("AlreadyExists") ? new be(409, {
|
|
3814
3938
|
message: "Organization already exists"
|
|
3815
|
-
}) :
|
|
3939
|
+
}) : d;
|
|
3816
3940
|
}
|
|
3817
|
-
return
|
|
3941
|
+
return _t({ ...o, tenant_id: t });
|
|
3818
3942
|
},
|
|
3819
3943
|
async get(t, e) {
|
|
3820
3944
|
let n = await i.select().from(L).where(
|
|
@@ -3825,7 +3949,7 @@ function us(i) {
|
|
|
3825
3949
|
a(L.tenant_id, t),
|
|
3826
3950
|
a(L.name, e)
|
|
3827
3951
|
)
|
|
3828
|
-
).get()), n ?
|
|
3952
|
+
).get()), n ? _t(n) : null;
|
|
3829
3953
|
},
|
|
3830
3954
|
async update(t, e, n) {
|
|
3831
3955
|
const s = {
|
|
@@ -3845,26 +3969,26 @@ function us(i) {
|
|
|
3845
3969
|
sort: l,
|
|
3846
3970
|
q: _
|
|
3847
3971
|
} = e || {};
|
|
3848
|
-
let
|
|
3849
|
-
if (_ && (
|
|
3972
|
+
let d = i.select().from(L).where(a(L.tenant_id, t)).$dynamic();
|
|
3973
|
+
if (_ && (d = d.where(
|
|
3850
3974
|
ue(
|
|
3851
|
-
|
|
3852
|
-
|
|
3975
|
+
ze(L.name, `%${_}%`),
|
|
3976
|
+
ze(L.display_name, `%${_}%`)
|
|
3853
3977
|
)
|
|
3854
3978
|
)), l != null && l.sort_by) {
|
|
3855
3979
|
const y = L[l.sort_by];
|
|
3856
|
-
y && (
|
|
3980
|
+
y && (d = d.orderBy(
|
|
3857
3981
|
l.sort_order === "desc" ? V(y) : Y(y)
|
|
3858
3982
|
));
|
|
3859
3983
|
}
|
|
3860
|
-
const u = (await
|
|
3984
|
+
const u = (await d.offset(n * s).limit(s)).map(_t);
|
|
3861
3985
|
if (!o)
|
|
3862
3986
|
return { organizations: u };
|
|
3863
3987
|
const h = [a(L.tenant_id, t)];
|
|
3864
3988
|
_ && h.push(
|
|
3865
3989
|
ue(
|
|
3866
|
-
|
|
3867
|
-
|
|
3990
|
+
ze(L.name, `%${_}%`),
|
|
3991
|
+
ze(L.display_name, `%${_}%`)
|
|
3868
3992
|
)
|
|
3869
3993
|
);
|
|
3870
3994
|
const [g] = await i.select({ count: R() }).from(L).where(m(...h));
|
|
@@ -3882,14 +4006,14 @@ function us(i) {
|
|
|
3882
4006
|
}
|
|
3883
4007
|
};
|
|
3884
4008
|
}
|
|
3885
|
-
function
|
|
4009
|
+
function ut(i) {
|
|
3886
4010
|
const { tenant_id: t, is_current: e, ...n } = i;
|
|
3887
4011
|
return {
|
|
3888
4012
|
...n,
|
|
3889
4013
|
is_current: !!e
|
|
3890
4014
|
};
|
|
3891
4015
|
}
|
|
3892
|
-
function
|
|
4016
|
+
function ws(i) {
|
|
3893
4017
|
return {
|
|
3894
4018
|
async create(t, e) {
|
|
3895
4019
|
const n = (/* @__PURE__ */ new Date()).toISOString(), s = e.id || oe();
|
|
@@ -3909,7 +4033,7 @@ function cs(i) {
|
|
|
3909
4033
|
created_at: n,
|
|
3910
4034
|
updated_at: n
|
|
3911
4035
|
};
|
|
3912
|
-
return await i.insert(C).values(o),
|
|
4036
|
+
return await i.insert(C).values(o), ut({ ...o, tenant_id: t });
|
|
3913
4037
|
},
|
|
3914
4038
|
async get(t, e) {
|
|
3915
4039
|
const n = await i.select().from(C).where(
|
|
@@ -3919,7 +4043,7 @@ function cs(i) {
|
|
|
3919
4043
|
a(C.is_current, 1)
|
|
3920
4044
|
)
|
|
3921
4045
|
).get();
|
|
3922
|
-
return n ?
|
|
4046
|
+
return n ? ut(n) : null;
|
|
3923
4047
|
},
|
|
3924
4048
|
async list(t, e, n) {
|
|
3925
4049
|
let s = i.select().from(C).where(
|
|
@@ -3928,7 +4052,7 @@ function cs(i) {
|
|
|
3928
4052
|
a(C.user_id, e)
|
|
3929
4053
|
)
|
|
3930
4054
|
).orderBy(V(C.created_at)).$dynamic();
|
|
3931
|
-
return n && (s = s.limit(n)), (await s).map(
|
|
4055
|
+
return n && (s = s.limit(n)), (await s).map(ut);
|
|
3932
4056
|
},
|
|
3933
4057
|
async update(t, e) {
|
|
3934
4058
|
const n = {
|
|
@@ -3949,10 +4073,10 @@ function cs(i) {
|
|
|
3949
4073
|
}
|
|
3950
4074
|
};
|
|
3951
4075
|
}
|
|
3952
|
-
function
|
|
4076
|
+
function Ns(i) {
|
|
3953
4077
|
return {
|
|
3954
4078
|
async get(t) {
|
|
3955
|
-
const e = await i.select().from(
|
|
4079
|
+
const e = await i.select().from(Le).where(a(Le.tenant_id, t)).get();
|
|
3956
4080
|
return e ? {
|
|
3957
4081
|
universal_login_experience: e.universal_login_experience,
|
|
3958
4082
|
identifier_first: !!e.identifier_first,
|
|
@@ -3966,14 +4090,14 @@ function ds(i) {
|
|
|
3966
4090
|
};
|
|
3967
4091
|
},
|
|
3968
4092
|
async set(t, e) {
|
|
3969
|
-
await i.insert(
|
|
4093
|
+
await i.insert(Le).values({
|
|
3970
4094
|
tenant_id: t,
|
|
3971
4095
|
universal_login_experience: e.universal_login_experience,
|
|
3972
4096
|
identifier_first: e.identifier_first,
|
|
3973
4097
|
password_first: e.password_first,
|
|
3974
4098
|
webauthn_platform_first_factor: e.webauthn_platform_first_factor
|
|
3975
4099
|
}).onConflictDoUpdate({
|
|
3976
|
-
target:
|
|
4100
|
+
target: Le.tenant_id,
|
|
3977
4101
|
set: {
|
|
3978
4102
|
universal_login_experience: e.universal_login_experience,
|
|
3979
4103
|
identifier_first: e.identifier_first,
|
|
@@ -3984,7 +4108,7 @@ function ds(i) {
|
|
|
3984
4108
|
}
|
|
3985
4109
|
};
|
|
3986
4110
|
}
|
|
3987
|
-
function
|
|
4111
|
+
function dt(i) {
|
|
3988
4112
|
const {
|
|
3989
4113
|
tenant_id: t,
|
|
3990
4114
|
created_at_ts: e,
|
|
@@ -3993,22 +4117,22 @@ function ut(i) {
|
|
|
3993
4117
|
last_exchanged_at_ts: o,
|
|
3994
4118
|
device: l,
|
|
3995
4119
|
resource_servers: _,
|
|
3996
|
-
rotating:
|
|
3997
|
-
...
|
|
3998
|
-
} = i, u =
|
|
4120
|
+
rotating: d,
|
|
4121
|
+
...c
|
|
4122
|
+
} = i, u = Je(
|
|
3999
4123
|
{ created_at_ts: e, expires_at_ts: n, idle_expires_at_ts: s, last_exchanged_at_ts: o },
|
|
4000
4124
|
["created_at_ts"],
|
|
4001
4125
|
["expires_at_ts", "idle_expires_at_ts", "last_exchanged_at_ts"]
|
|
4002
4126
|
);
|
|
4003
4127
|
return z({
|
|
4004
|
-
...
|
|
4128
|
+
...c,
|
|
4005
4129
|
...u,
|
|
4006
|
-
rotating: !!
|
|
4130
|
+
rotating: !!d,
|
|
4007
4131
|
device: b(l, {}),
|
|
4008
4132
|
resource_servers: b(_, [])
|
|
4009
4133
|
});
|
|
4010
4134
|
}
|
|
4011
|
-
function
|
|
4135
|
+
function vs(i) {
|
|
4012
4136
|
return {
|
|
4013
4137
|
async create(t, e) {
|
|
4014
4138
|
const n = Date.now(), s = {
|
|
@@ -4025,42 +4149,42 @@ function gs(i) {
|
|
|
4025
4149
|
idle_expires_at_ts: j(e.idle_expires_at),
|
|
4026
4150
|
last_exchanged_at_ts: j(e.last_exchanged_at)
|
|
4027
4151
|
};
|
|
4028
|
-
return await i.insert($).values(s),
|
|
4152
|
+
return await i.insert($).values(s), dt({ ...s, tenant_id: t });
|
|
4029
4153
|
},
|
|
4030
4154
|
async get(t, e) {
|
|
4031
4155
|
const n = await i.select().from($).where(
|
|
4032
|
-
m(
|
|
4033
|
-
a($.tenant_id, t),
|
|
4034
|
-
a($.id, e)
|
|
4035
|
-
)
|
|
4156
|
+
m(a($.tenant_id, t), a($.id, e))
|
|
4036
4157
|
).get();
|
|
4037
|
-
return n ?
|
|
4158
|
+
return n ? dt(n) : null;
|
|
4038
4159
|
},
|
|
4039
4160
|
async update(t, e, n) {
|
|
4040
4161
|
const s = {};
|
|
4041
4162
|
return n.device !== void 0 && (s.device = JSON.stringify(n.device)), n.resource_servers !== void 0 && (s.resource_servers = JSON.stringify(n.resource_servers)), n.rotating !== void 0 && (s.rotating = n.rotating), n.expires_at !== void 0 && (s.expires_at_ts = j(n.expires_at)), n.idle_expires_at !== void 0 && (s.idle_expires_at_ts = j(n.idle_expires_at)), n.last_exchanged_at !== void 0 && (s.last_exchanged_at_ts = j(n.last_exchanged_at)), (await i.update($).set(s).where(
|
|
4042
|
-
m(
|
|
4043
|
-
a($.tenant_id, t),
|
|
4044
|
-
a($.id, e)
|
|
4045
|
-
)
|
|
4163
|
+
m(a($.tenant_id, t), a($.id, e))
|
|
4046
4164
|
).returning()).length > 0;
|
|
4047
4165
|
},
|
|
4048
4166
|
async list(t, e) {
|
|
4049
|
-
const {
|
|
4050
|
-
|
|
4167
|
+
const {
|
|
4168
|
+
page: n = 0,
|
|
4169
|
+
per_page: s = 50,
|
|
4170
|
+
include_totals: o = !1,
|
|
4171
|
+
sort: l,
|
|
4172
|
+
q: _
|
|
4173
|
+
} = e || {};
|
|
4174
|
+
let d = i.select().from($).where(a($.tenant_id, t)).$dynamic();
|
|
4051
4175
|
if (_) {
|
|
4052
|
-
const g =
|
|
4053
|
-
g && (
|
|
4176
|
+
const g = he($, _, ["user_id"]);
|
|
4177
|
+
g && (d = d.where(
|
|
4054
4178
|
m(a($.tenant_id, t), g)
|
|
4055
4179
|
));
|
|
4056
4180
|
}
|
|
4057
4181
|
if (l != null && l.sort_by) {
|
|
4058
4182
|
const g = $[l.sort_by];
|
|
4059
|
-
g && (
|
|
4183
|
+
g && (d = d.orderBy(
|
|
4060
4184
|
l.sort_order === "desc" ? V(g) : Y(g)
|
|
4061
4185
|
));
|
|
4062
4186
|
}
|
|
4063
|
-
const u = (await
|
|
4187
|
+
const u = (await d.offset(n * s).limit(s)).map(dt);
|
|
4064
4188
|
if (!o)
|
|
4065
4189
|
return { refresh_tokens: u };
|
|
4066
4190
|
const [h] = await i.select({ count: R() }).from($).where(a($.tenant_id, t));
|
|
@@ -4073,23 +4197,20 @@ function gs(i) {
|
|
|
4073
4197
|
},
|
|
4074
4198
|
async remove(t, e) {
|
|
4075
4199
|
return (await i.delete($).where(
|
|
4076
|
-
m(
|
|
4077
|
-
a($.tenant_id, t),
|
|
4078
|
-
a($.id, e)
|
|
4079
|
-
)
|
|
4200
|
+
m(a($.tenant_id, t), a($.id, e))
|
|
4080
4201
|
).returning()).length > 0;
|
|
4081
4202
|
}
|
|
4082
4203
|
};
|
|
4083
4204
|
}
|
|
4084
|
-
function
|
|
4205
|
+
function Ss() {
|
|
4085
4206
|
const { customAlphabet: i } = require("nanoid");
|
|
4086
4207
|
return `api_${i("0123456789abcdefghijklmnopqrstuvwxyz", 17)()}`;
|
|
4087
4208
|
}
|
|
4088
|
-
const
|
|
4209
|
+
const St = [
|
|
4089
4210
|
"skip_consent_for_verifiable_first_party_clients",
|
|
4090
4211
|
"allow_offline_access",
|
|
4091
4212
|
"is_system"
|
|
4092
|
-
],
|
|
4213
|
+
], $t = /* @__PURE__ */ new Set([
|
|
4093
4214
|
"id",
|
|
4094
4215
|
"tenant_id",
|
|
4095
4216
|
"identifier",
|
|
@@ -4109,17 +4230,24 @@ const vt = [
|
|
|
4109
4230
|
"updated_at"
|
|
4110
4231
|
]);
|
|
4111
4232
|
function ct(i) {
|
|
4112
|
-
const {
|
|
4233
|
+
const {
|
|
4234
|
+
tenant_id: t,
|
|
4235
|
+
verification_key: e,
|
|
4236
|
+
scopes: n,
|
|
4237
|
+
options: s,
|
|
4238
|
+
metadata: o,
|
|
4239
|
+
...l
|
|
4240
|
+
} = i, _ = { ...l };
|
|
4113
4241
|
_.scopes = b(n, []), _.options = b(s, {}), _.metadata = b(o), e !== void 0 && (_.verificationKey = e);
|
|
4114
|
-
for (const
|
|
4115
|
-
l[
|
|
4242
|
+
for (const d of St)
|
|
4243
|
+
l[d] !== void 0 && l[d] !== null && (_[d] = !!l[d]);
|
|
4116
4244
|
return z(_);
|
|
4117
4245
|
}
|
|
4118
|
-
function
|
|
4246
|
+
function bs(i) {
|
|
4119
4247
|
return {
|
|
4120
4248
|
async create(t, e) {
|
|
4121
4249
|
const n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
4122
|
-
id: e.id ||
|
|
4250
|
+
id: e.id || Ss(),
|
|
4123
4251
|
tenant_id: t,
|
|
4124
4252
|
identifier: e.identifier,
|
|
4125
4253
|
name: e.name,
|
|
@@ -4134,7 +4262,7 @@ function ms(i) {
|
|
|
4134
4262
|
created_at: n,
|
|
4135
4263
|
updated_at: n
|
|
4136
4264
|
};
|
|
4137
|
-
for (const l of
|
|
4265
|
+
for (const l of St)
|
|
4138
4266
|
e[l] !== void 0 && (o[l] = e[l] ? 1 : 0);
|
|
4139
4267
|
return o.is_system === void 0 && (o.is_system = 0), await i.insert(E).values(o), ct({ ...o, tenant_id: t });
|
|
4140
4268
|
},
|
|
@@ -4152,7 +4280,7 @@ function ms(i) {
|
|
|
4152
4280
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
4153
4281
|
};
|
|
4154
4282
|
n.name !== void 0 && (s.name = n.name), n.identifier !== void 0 && (s.identifier = n.identifier), n.signing_alg !== void 0 && (s.signing_alg = n.signing_alg), n.signing_secret !== void 0 && (s.signing_secret = n.signing_secret), n.token_lifetime !== void 0 && (s.token_lifetime = n.token_lifetime), n.token_lifetime_for_web !== void 0 && (s.token_lifetime_for_web = n.token_lifetime_for_web), n.scopes !== void 0 && (s.scopes = JSON.stringify(n.scopes)), n.options !== void 0 && (s.options = N`json_patch(COALESCE(${E.options}, '{}'), ${JSON.stringify(n.options)})`), n.metadata !== void 0 && (s.metadata = JSON.stringify(n.metadata)), n.verificationKey !== void 0 && (s.verification_key = n.verificationKey);
|
|
4155
|
-
for (const l of
|
|
4283
|
+
for (const l of St)
|
|
4156
4284
|
n[l] !== void 0 && (s[l] = n[l] ? 1 : 0);
|
|
4157
4285
|
return (await i.update(E).set(s).where(
|
|
4158
4286
|
m(
|
|
@@ -4162,32 +4290,41 @@ function ms(i) {
|
|
|
4162
4290
|
).returning()).length > 0;
|
|
4163
4291
|
},
|
|
4164
4292
|
async list(t, e) {
|
|
4165
|
-
const {
|
|
4293
|
+
const {
|
|
4294
|
+
page: n = 0,
|
|
4295
|
+
per_page: s = 50,
|
|
4296
|
+
include_totals: o = !1,
|
|
4297
|
+
sort: l,
|
|
4298
|
+
q: _
|
|
4299
|
+
} = e || {}, d = Math.max(0, Math.floor(Number(n) || 0)), c = Math.min(
|
|
4300
|
+
Math.max(1, Math.floor(Number(s) || 50)),
|
|
4301
|
+
500
|
|
4302
|
+
), u = [a(E.tenant_id, t)];
|
|
4166
4303
|
if (_) {
|
|
4167
4304
|
const A = _.match(/^([^:]+):(.+)$/);
|
|
4168
4305
|
if (A) {
|
|
4169
|
-
const [, q,
|
|
4170
|
-
if (
|
|
4171
|
-
const
|
|
4172
|
-
u.push(
|
|
4306
|
+
const [, q, ye] = A, ke = q == null ? void 0 : q.startsWith("-"), Ye = ke ? q == null ? void 0 : q.substring(1) : q;
|
|
4307
|
+
if (Ye && $t.has(Ye) && !ke) {
|
|
4308
|
+
const hr = E[Ye];
|
|
4309
|
+
u.push(ze(hr, `%${ye}%`));
|
|
4173
4310
|
}
|
|
4174
4311
|
}
|
|
4175
4312
|
}
|
|
4176
4313
|
let h = i.select().from(E).where(m(...u)).$dynamic();
|
|
4177
|
-
if (l != null && l.sort_by &&
|
|
4314
|
+
if (l != null && l.sort_by && $t.has(l.sort_by)) {
|
|
4178
4315
|
const A = E[l.sort_by];
|
|
4179
4316
|
h = h.orderBy(
|
|
4180
4317
|
l.sort_order === "desc" ? V(A) : Y(A)
|
|
4181
4318
|
);
|
|
4182
4319
|
}
|
|
4183
|
-
const y = (await h.offset(
|
|
4320
|
+
const y = (await h.offset(d * c).limit(c)).map(ct);
|
|
4184
4321
|
if (!o)
|
|
4185
4322
|
return { resource_servers: y };
|
|
4186
4323
|
const [w] = await i.select({ count: R() }).from(E).where(m(...u));
|
|
4187
4324
|
return {
|
|
4188
4325
|
resource_servers: y,
|
|
4189
|
-
start:
|
|
4190
|
-
limit:
|
|
4326
|
+
start: d * c,
|
|
4327
|
+
limit: c,
|
|
4191
4328
|
length: Number((w == null ? void 0 : w.count) ?? 0)
|
|
4192
4329
|
};
|
|
4193
4330
|
},
|
|
@@ -4201,7 +4338,7 @@ function ms(i) {
|
|
|
4201
4338
|
}
|
|
4202
4339
|
};
|
|
4203
4340
|
}
|
|
4204
|
-
function
|
|
4341
|
+
function xs(i) {
|
|
4205
4342
|
return {
|
|
4206
4343
|
async assign(t, e, n) {
|
|
4207
4344
|
const s = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -4235,11 +4372,11 @@ function hs(i) {
|
|
|
4235
4372
|
}).from(E).where(
|
|
4236
4373
|
m(
|
|
4237
4374
|
a(E.tenant_id, t),
|
|
4238
|
-
|
|
4375
|
+
we(E.identifier, o)
|
|
4239
4376
|
)
|
|
4240
4377
|
).all();
|
|
4241
|
-
for (const
|
|
4242
|
-
l.set(
|
|
4378
|
+
for (const d of _)
|
|
4379
|
+
l.set(d.identifier, d.name);
|
|
4243
4380
|
}
|
|
4244
4381
|
return s.map((_) => ({
|
|
4245
4382
|
..._,
|
|
@@ -4266,7 +4403,7 @@ function hs(i) {
|
|
|
4266
4403
|
}
|
|
4267
4404
|
};
|
|
4268
4405
|
}
|
|
4269
|
-
function
|
|
4406
|
+
function Ds(i) {
|
|
4270
4407
|
return {
|
|
4271
4408
|
async create(t, e, n, s) {
|
|
4272
4409
|
var o, l;
|
|
@@ -4291,26 +4428,21 @@ function ps(i) {
|
|
|
4291
4428
|
a(le.tenant_id, t),
|
|
4292
4429
|
a(le.user_id, e)
|
|
4293
4430
|
];
|
|
4294
|
-
s && o.push(
|
|
4295
|
-
a(le.organization_id, s)
|
|
4296
|
-
);
|
|
4431
|
+
s && o.push(a(le.organization_id, s));
|
|
4297
4432
|
const l = await i.select().from(le).where(m(...o)).all();
|
|
4298
4433
|
return await Promise.all(
|
|
4299
|
-
l.map(async (
|
|
4300
|
-
const
|
|
4434
|
+
l.map(async (d) => {
|
|
4435
|
+
const c = await i.select({ name: E.name }).from(E).where(
|
|
4301
4436
|
m(
|
|
4302
4437
|
a(E.tenant_id, t),
|
|
4303
|
-
a(
|
|
4304
|
-
E.identifier,
|
|
4305
|
-
c.resource_server_identifier
|
|
4306
|
-
)
|
|
4438
|
+
a(E.identifier, d.resource_server_identifier)
|
|
4307
4439
|
)
|
|
4308
4440
|
).get();
|
|
4309
4441
|
return {
|
|
4310
|
-
resource_server_identifier:
|
|
4311
|
-
permission_name:
|
|
4312
|
-
resource_server_name: (
|
|
4313
|
-
organization_id:
|
|
4442
|
+
resource_server_identifier: d.resource_server_identifier,
|
|
4443
|
+
permission_name: d.permission_name,
|
|
4444
|
+
resource_server_name: (c == null ? void 0 : c.name) || d.resource_server_identifier,
|
|
4445
|
+
organization_id: d.organization_id === "" ? void 0 : d.organization_id
|
|
4314
4446
|
};
|
|
4315
4447
|
})
|
|
4316
4448
|
);
|
|
@@ -4325,16 +4457,13 @@ function ps(i) {
|
|
|
4325
4457
|
n.resource_server_identifier
|
|
4326
4458
|
),
|
|
4327
4459
|
a(le.permission_name, n.permission_name),
|
|
4328
|
-
a(
|
|
4329
|
-
le.organization_id,
|
|
4330
|
-
s || ""
|
|
4331
|
-
)
|
|
4460
|
+
a(le.organization_id, s || "")
|
|
4332
4461
|
)
|
|
4333
4462
|
).returning()).length > 0;
|
|
4334
4463
|
}
|
|
4335
4464
|
};
|
|
4336
4465
|
}
|
|
4337
|
-
function
|
|
4466
|
+
function gt(i) {
|
|
4338
4467
|
const { tenant_id: t, is_system: e, metadata: n, ...s } = i;
|
|
4339
4468
|
return z({
|
|
4340
4469
|
...s,
|
|
@@ -4342,7 +4471,7 @@ function dt(i) {
|
|
|
4342
4471
|
metadata: b(n)
|
|
4343
4472
|
});
|
|
4344
4473
|
}
|
|
4345
|
-
function
|
|
4474
|
+
function Os(i) {
|
|
4346
4475
|
return {
|
|
4347
4476
|
async create(t, e) {
|
|
4348
4477
|
const n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
@@ -4355,31 +4484,37 @@ function ys(i) {
|
|
|
4355
4484
|
created_at: n,
|
|
4356
4485
|
updated_at: n
|
|
4357
4486
|
};
|
|
4358
|
-
return await i.insert(
|
|
4487
|
+
return await i.insert(F).values(o), gt({ ...o, tenant_id: t });
|
|
4359
4488
|
},
|
|
4360
4489
|
async get(t, e) {
|
|
4361
|
-
const n = await i.select().from(
|
|
4362
|
-
return n ?
|
|
4490
|
+
const n = await i.select().from(F).where(m(a(F.tenant_id, t), a(F.id, e))).get();
|
|
4491
|
+
return n ? gt(n) : null;
|
|
4363
4492
|
},
|
|
4364
4493
|
async update(t, e, n) {
|
|
4365
4494
|
const s = {
|
|
4366
4495
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
4367
4496
|
};
|
|
4368
|
-
return n.name !== void 0 && (s.name = n.name), n.description !== void 0 && (s.description = n.description), n.is_system !== void 0 && (s.is_system = n.is_system ? 1 : 0), n.metadata !== void 0 && (s.metadata = JSON.stringify(n.metadata)), (await i.update(
|
|
4497
|
+
return n.name !== void 0 && (s.name = n.name), n.description !== void 0 && (s.description = n.description), n.is_system !== void 0 && (s.is_system = n.is_system ? 1 : 0), n.metadata !== void 0 && (s.metadata = JSON.stringify(n.metadata)), (await i.update(F).set(s).where(m(a(F.tenant_id, t), a(F.id, e))).returning()).length > 0;
|
|
4369
4498
|
},
|
|
4370
4499
|
async list(t, e) {
|
|
4371
|
-
const {
|
|
4372
|
-
|
|
4500
|
+
const {
|
|
4501
|
+
page: n = 0,
|
|
4502
|
+
per_page: s = 50,
|
|
4503
|
+
include_totals: o = !1,
|
|
4504
|
+
sort: l,
|
|
4505
|
+
q: _
|
|
4506
|
+
} = e || {}, d = _ ? he(F, _, ["name"]) : void 0, c = d ? m(a(F.tenant_id, t), d) : a(F.tenant_id, t);
|
|
4507
|
+
let u = i.select().from(F).where(c).$dynamic();
|
|
4373
4508
|
if (l != null && l.sort_by) {
|
|
4374
|
-
const w =
|
|
4509
|
+
const w = F[l.sort_by];
|
|
4375
4510
|
w && (u = u.orderBy(
|
|
4376
4511
|
l.sort_order === "desc" ? V(w) : Y(w)
|
|
4377
4512
|
));
|
|
4378
4513
|
}
|
|
4379
|
-
const g = (await u.offset(n * s).limit(s)).map(
|
|
4514
|
+
const g = (await u.offset(n * s).limit(s)).map(gt);
|
|
4380
4515
|
if (!o)
|
|
4381
4516
|
return { roles: g };
|
|
4382
|
-
const [y] = await i.select({ count: R() }).from(
|
|
4517
|
+
const [y] = await i.select({ count: R() }).from(F).where(c);
|
|
4383
4518
|
return {
|
|
4384
4519
|
roles: g,
|
|
4385
4520
|
start: n * s,
|
|
@@ -4388,11 +4523,11 @@ function ys(i) {
|
|
|
4388
4523
|
};
|
|
4389
4524
|
},
|
|
4390
4525
|
async remove(t, e) {
|
|
4391
|
-
return (await i.delete(
|
|
4526
|
+
return (await i.delete(F).where(m(a(F.tenant_id, t), a(F.id, e))).returning()).length > 0;
|
|
4392
4527
|
}
|
|
4393
4528
|
};
|
|
4394
4529
|
}
|
|
4395
|
-
const
|
|
4530
|
+
const ks = ["created_at_ts", "updated_at_ts"], zs = [
|
|
4396
4531
|
"expires_at_ts",
|
|
4397
4532
|
"idle_expires_at_ts",
|
|
4398
4533
|
"authenticated_at_ts",
|
|
@@ -4400,7 +4535,7 @@ const ws = ["created_at_ts", "updated_at_ts"], Ns = [
|
|
|
4400
4535
|
"used_at_ts",
|
|
4401
4536
|
"revoked_at_ts"
|
|
4402
4537
|
];
|
|
4403
|
-
function
|
|
4538
|
+
function ft(i) {
|
|
4404
4539
|
const {
|
|
4405
4540
|
tenant_id: t,
|
|
4406
4541
|
created_at_ts: e,
|
|
@@ -4409,12 +4544,12 @@ function gt(i) {
|
|
|
4409
4544
|
idle_expires_at_ts: o,
|
|
4410
4545
|
authenticated_at_ts: l,
|
|
4411
4546
|
last_interaction_at_ts: _,
|
|
4412
|
-
used_at_ts:
|
|
4413
|
-
revoked_at_ts:
|
|
4547
|
+
used_at_ts: d,
|
|
4548
|
+
revoked_at_ts: c,
|
|
4414
4549
|
device: u,
|
|
4415
4550
|
clients: h,
|
|
4416
4551
|
...g
|
|
4417
|
-
} = i, y =
|
|
4552
|
+
} = i, y = Je(
|
|
4418
4553
|
{
|
|
4419
4554
|
created_at_ts: e,
|
|
4420
4555
|
updated_at_ts: n,
|
|
@@ -4422,11 +4557,11 @@ function gt(i) {
|
|
|
4422
4557
|
idle_expires_at_ts: o,
|
|
4423
4558
|
authenticated_at_ts: l,
|
|
4424
4559
|
last_interaction_at_ts: _,
|
|
4425
|
-
used_at_ts:
|
|
4426
|
-
revoked_at_ts:
|
|
4560
|
+
used_at_ts: d,
|
|
4561
|
+
revoked_at_ts: c
|
|
4427
4562
|
},
|
|
4428
|
-
[...
|
|
4429
|
-
[...
|
|
4563
|
+
[...ks],
|
|
4564
|
+
[...zs]
|
|
4430
4565
|
);
|
|
4431
4566
|
return z({
|
|
4432
4567
|
...g,
|
|
@@ -4435,7 +4570,7 @@ function gt(i) {
|
|
|
4435
4570
|
clients: b(h, [])
|
|
4436
4571
|
});
|
|
4437
4572
|
}
|
|
4438
|
-
function
|
|
4573
|
+
function Is(i) {
|
|
4439
4574
|
return {
|
|
4440
4575
|
async create(t, e) {
|
|
4441
4576
|
const n = Date.now(), s = {
|
|
@@ -4454,13 +4589,11 @@ function vs(i) {
|
|
|
4454
4589
|
used_at_ts: j(e.used_at),
|
|
4455
4590
|
revoked_at_ts: j(e.revoked_at)
|
|
4456
4591
|
};
|
|
4457
|
-
return await i.insert(B).values(s),
|
|
4592
|
+
return await i.insert(B).values(s), ft({ ...s, tenant_id: t });
|
|
4458
4593
|
},
|
|
4459
4594
|
async get(t, e) {
|
|
4460
|
-
const n = await i.select().from(B).where(
|
|
4461
|
-
|
|
4462
|
-
).get();
|
|
4463
|
-
return n ? gt(n) : null;
|
|
4595
|
+
const n = await i.select().from(B).where(m(a(B.tenant_id, t), a(B.id, e))).get();
|
|
4596
|
+
return n ? ft(n) : null;
|
|
4464
4597
|
},
|
|
4465
4598
|
async update(t, e, n) {
|
|
4466
4599
|
const s = {
|
|
@@ -4468,23 +4601,27 @@ function vs(i) {
|
|
|
4468
4601
|
};
|
|
4469
4602
|
return n.user_id !== void 0 && (s.user_id = n.user_id), n.login_session_id !== void 0 && (s.login_session_id = n.login_session_id), n.device !== void 0 && (s.device = JSON.stringify(n.device)), n.clients !== void 0 && (s.clients = JSON.stringify(n.clients)), n.expires_at !== void 0 && (s.expires_at_ts = j(n.expires_at)), n.idle_expires_at !== void 0 && (s.idle_expires_at_ts = j(n.idle_expires_at)), n.authenticated_at !== void 0 && (s.authenticated_at_ts = j(n.authenticated_at)), n.last_interaction_at !== void 0 && (s.last_interaction_at_ts = j(
|
|
4470
4603
|
n.last_interaction_at
|
|
4471
|
-
)), n.used_at !== void 0 && (s.used_at_ts = j(n.used_at)), n.revoked_at !== void 0 && (s.revoked_at_ts = j(n.revoked_at)), (await i.update(B).set(s).where(
|
|
4472
|
-
m(a(B.tenant_id, t), a(B.id, e))
|
|
4473
|
-
).returning()).length > 0;
|
|
4604
|
+
)), n.used_at !== void 0 && (s.used_at_ts = j(n.used_at)), n.revoked_at !== void 0 && (s.revoked_at_ts = j(n.revoked_at)), (await i.update(B).set(s).where(m(a(B.tenant_id, t), a(B.id, e))).returning()).length > 0;
|
|
4474
4605
|
},
|
|
4475
4606
|
async list(t, e) {
|
|
4476
|
-
const {
|
|
4477
|
-
|
|
4607
|
+
const {
|
|
4608
|
+
page: n = 0,
|
|
4609
|
+
per_page: s = 50,
|
|
4610
|
+
include_totals: o = !1,
|
|
4611
|
+
sort: l,
|
|
4612
|
+
q: _
|
|
4613
|
+
} = e || {}, d = _ ? he(B, _, ["user_id"]) : void 0, c = d ? m(a(B.tenant_id, t), d) : a(B.tenant_id, t);
|
|
4614
|
+
let u = i.select().from(B).where(c).$dynamic();
|
|
4478
4615
|
if (l != null && l.sort_by) {
|
|
4479
4616
|
const w = B[l.sort_by];
|
|
4480
4617
|
w && (u = u.orderBy(
|
|
4481
4618
|
l.sort_order === "desc" ? V(w) : Y(w)
|
|
4482
4619
|
));
|
|
4483
4620
|
}
|
|
4484
|
-
const g = (await u.offset(n * s).limit(s)).map(
|
|
4621
|
+
const g = (await u.offset(n * s).limit(s)).map(ft);
|
|
4485
4622
|
if (!o)
|
|
4486
4623
|
return { sessions: g };
|
|
4487
|
-
const [y] = await i.select({ count: R() }).from(B).where(
|
|
4624
|
+
const [y] = await i.select({ count: R() }).from(B).where(c);
|
|
4488
4625
|
return {
|
|
4489
4626
|
sessions: g,
|
|
4490
4627
|
start: n * s,
|
|
@@ -4493,13 +4630,11 @@ function vs(i) {
|
|
|
4493
4630
|
};
|
|
4494
4631
|
},
|
|
4495
4632
|
async remove(t, e) {
|
|
4496
|
-
return (await i.delete(B).where(
|
|
4497
|
-
m(a(B.tenant_id, t), a(B.id, e))
|
|
4498
|
-
).returning()).length > 0;
|
|
4633
|
+
return (await i.delete(B).where(m(a(B.tenant_id, t), a(B.id, e))).returning()).length > 0;
|
|
4499
4634
|
}
|
|
4500
4635
|
};
|
|
4501
4636
|
}
|
|
4502
|
-
const
|
|
4637
|
+
const fr = [
|
|
4503
4638
|
"session_cookie",
|
|
4504
4639
|
"enabled_locales",
|
|
4505
4640
|
"error_page",
|
|
@@ -4515,32 +4650,32 @@ const dr = [
|
|
|
4515
4650
|
"acr_values_supported",
|
|
4516
4651
|
"mtls",
|
|
4517
4652
|
"mfa"
|
|
4518
|
-
],
|
|
4653
|
+
], mr = [
|
|
4519
4654
|
"allow_organization_name_in_authentication_api",
|
|
4520
4655
|
"customize_mfa_in_postlogin_action",
|
|
4521
4656
|
"pushed_authorization_requests_supported",
|
|
4522
4657
|
"authorization_response_iss_parameter_supported"
|
|
4523
4658
|
];
|
|
4524
|
-
function
|
|
4659
|
+
function Bt(i) {
|
|
4525
4660
|
const t = { ...i };
|
|
4526
|
-
for (const e of
|
|
4661
|
+
for (const e of fr)
|
|
4527
4662
|
typeof t[e] == "string" && (t[e] = b(t[e]));
|
|
4528
|
-
for (const e of
|
|
4663
|
+
for (const e of mr)
|
|
4529
4664
|
t[e] !== void 0 && t[e] !== null && (t[e] = t[e] === 1);
|
|
4530
4665
|
return z(t);
|
|
4531
4666
|
}
|
|
4532
|
-
function
|
|
4667
|
+
function Pt(i) {
|
|
4533
4668
|
const t = { ...i };
|
|
4534
|
-
|
|
4669
|
+
Pr(
|
|
4535
4670
|
i,
|
|
4536
|
-
|
|
4671
|
+
fr,
|
|
4537
4672
|
t
|
|
4538
4673
|
);
|
|
4539
|
-
for (const e of
|
|
4674
|
+
for (const e of mr)
|
|
4540
4675
|
i[e] !== void 0 && (t[e] = i[e] ? 1 : 0);
|
|
4541
|
-
return
|
|
4676
|
+
return dr(t);
|
|
4542
4677
|
}
|
|
4543
|
-
function
|
|
4678
|
+
function Ts(i) {
|
|
4544
4679
|
return {
|
|
4545
4680
|
async create(t) {
|
|
4546
4681
|
var s, o;
|
|
@@ -4549,11 +4684,11 @@ function Ss(i) {
|
|
|
4549
4684
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4550
4685
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4551
4686
|
...t
|
|
4552
|
-
}, n =
|
|
4687
|
+
}, n = Pt(e);
|
|
4553
4688
|
try {
|
|
4554
4689
|
await i.insert(x).values(n);
|
|
4555
4690
|
} catch (l) {
|
|
4556
|
-
throw (s = l == null ? void 0 : l.message) != null && s.includes("UNIQUE constraint failed") || (o = l == null ? void 0 : l.message) != null && o.includes("duplicate key") || (l == null ? void 0 : l.code) === "SQLITE_CONSTRAINT" ? new
|
|
4691
|
+
throw (s = l == null ? void 0 : l.message) != null && s.includes("UNIQUE constraint failed") || (o = l == null ? void 0 : l.message) != null && o.includes("duplicate key") || (l == null ? void 0 : l.code) === "SQLITE_CONSTRAINT" ? new be(409, {
|
|
4557
4692
|
message: `Tenant with ID '${e.id}' already exists`
|
|
4558
4693
|
}) : l;
|
|
4559
4694
|
}
|
|
@@ -4561,7 +4696,7 @@ function Ss(i) {
|
|
|
4561
4696
|
},
|
|
4562
4697
|
async get(t) {
|
|
4563
4698
|
const e = await i.select().from(x).where(a(x.id, t)).get();
|
|
4564
|
-
return e ?
|
|
4699
|
+
return e ? Bt(e) : null;
|
|
4565
4700
|
},
|
|
4566
4701
|
async list(t) {
|
|
4567
4702
|
const {
|
|
@@ -4573,7 +4708,7 @@ function Ss(i) {
|
|
|
4573
4708
|
} = t || {};
|
|
4574
4709
|
let _ = i.select().from(x).$dynamic();
|
|
4575
4710
|
if (l) {
|
|
4576
|
-
const h =
|
|
4711
|
+
const h = he(x, l, ["friendly_name"]);
|
|
4577
4712
|
h && (_ = _.where(h));
|
|
4578
4713
|
}
|
|
4579
4714
|
if (o != null && o.sort_by) {
|
|
@@ -4582,19 +4717,19 @@ function Ss(i) {
|
|
|
4582
4717
|
o.sort_order === "desc" ? V(h) : Y(h)
|
|
4583
4718
|
));
|
|
4584
4719
|
}
|
|
4585
|
-
const
|
|
4720
|
+
const c = (await _.offset(e * n).limit(n)).map(Bt);
|
|
4586
4721
|
if (!s)
|
|
4587
|
-
return { tenants:
|
|
4722
|
+
return { tenants: c };
|
|
4588
4723
|
const [u] = await i.select({ count: R() }).from(x);
|
|
4589
4724
|
return {
|
|
4590
|
-
tenants:
|
|
4725
|
+
tenants: c,
|
|
4591
4726
|
start: e * n,
|
|
4592
4727
|
limit: n,
|
|
4593
4728
|
length: Number((u == null ? void 0 : u.count) ?? 0)
|
|
4594
4729
|
};
|
|
4595
4730
|
},
|
|
4596
4731
|
async update(t, e) {
|
|
4597
|
-
const n =
|
|
4732
|
+
const n = Pt({
|
|
4598
4733
|
...e,
|
|
4599
4734
|
id: t,
|
|
4600
4735
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -4606,37 +4741,37 @@ function Ss(i) {
|
|
|
4606
4741
|
}
|
|
4607
4742
|
};
|
|
4608
4743
|
}
|
|
4609
|
-
const
|
|
4744
|
+
const qs = [
|
|
4610
4745
|
"colors",
|
|
4611
4746
|
"borders",
|
|
4612
4747
|
"fonts",
|
|
4613
4748
|
"page_background",
|
|
4614
4749
|
"widget"
|
|
4615
4750
|
];
|
|
4616
|
-
function
|
|
4617
|
-
const { tenant_id: t, ...e } = i, n =
|
|
4751
|
+
function Qt(i) {
|
|
4752
|
+
const { tenant_id: t, ...e } = i, n = cr(e, qs);
|
|
4618
4753
|
return n.borders && (n.borders.show_widget_shadow = !!n.borders.show_widget_shadow), n.fonts && (n.fonts.links_bold = !!n.fonts.links_bold, n.fonts.subtitle_bold = !!n.fonts.subtitle_bold, n.fonts.title_bold = !!n.fonts.title_bold), z(n);
|
|
4619
4754
|
}
|
|
4620
|
-
function
|
|
4755
|
+
function Ls(i) {
|
|
4621
4756
|
return {
|
|
4622
4757
|
async create(t, e, n) {
|
|
4623
4758
|
const s = (/* @__PURE__ */ new Date()).toISOString(), o = n || oe(), _ = {
|
|
4624
|
-
|
|
4759
|
+
...Be(e),
|
|
4625
4760
|
tenant_id: t,
|
|
4626
4761
|
themeId: o,
|
|
4627
4762
|
created_at: s,
|
|
4628
4763
|
updated_at: s
|
|
4629
4764
|
};
|
|
4630
|
-
return await i.insert(ge).values(_),
|
|
4765
|
+
return await i.insert(ge).values(_), Qt({ ..._, tenant_id: t });
|
|
4631
4766
|
},
|
|
4632
4767
|
async get(t, e) {
|
|
4633
4768
|
const n = await i.select().from(ge).where(
|
|
4634
4769
|
m(a(ge.tenant_id, t), a(ge.themeId, e))
|
|
4635
4770
|
).get();
|
|
4636
|
-
return n ?
|
|
4771
|
+
return n ? Qt(n) : null;
|
|
4637
4772
|
},
|
|
4638
4773
|
async update(t, e, n) {
|
|
4639
|
-
const s =
|
|
4774
|
+
const s = Be(n);
|
|
4640
4775
|
return s.updated_at = (/* @__PURE__ */ new Date()).toISOString(), await i.update(ge).set(s).where(
|
|
4641
4776
|
m(a(ge.tenant_id, t), a(ge.themeId, e))
|
|
4642
4777
|
), !0;
|
|
@@ -4648,21 +4783,21 @@ function xs(i) {
|
|
|
4648
4783
|
}
|
|
4649
4784
|
};
|
|
4650
4785
|
}
|
|
4651
|
-
function
|
|
4786
|
+
function Es(i) {
|
|
4652
4787
|
return {
|
|
4653
4788
|
async get(t) {
|
|
4654
|
-
const e = await i.select({ body:
|
|
4789
|
+
const e = await i.select({ body: Ne.body }).from(Ne).where(a(Ne.tenant_id, t)).get();
|
|
4655
4790
|
return e ? { body: e.body } : null;
|
|
4656
4791
|
},
|
|
4657
4792
|
async set(t, e) {
|
|
4658
4793
|
const n = Date.now();
|
|
4659
|
-
await i.insert(
|
|
4794
|
+
await i.insert(Ne).values({
|
|
4660
4795
|
tenant_id: t,
|
|
4661
4796
|
body: e.body,
|
|
4662
4797
|
created_at_ts: n,
|
|
4663
4798
|
updated_at_ts: n
|
|
4664
4799
|
}).onConflictDoUpdate({
|
|
4665
|
-
target:
|
|
4800
|
+
target: Ne.tenant_id,
|
|
4666
4801
|
set: {
|
|
4667
4802
|
body: e.body,
|
|
4668
4803
|
updated_at_ts: n
|
|
@@ -4670,11 +4805,11 @@ function Ds(i) {
|
|
|
4670
4805
|
});
|
|
4671
4806
|
},
|
|
4672
4807
|
async delete(t) {
|
|
4673
|
-
await i.delete(
|
|
4808
|
+
await i.delete(Ne).where(a(Ne.tenant_id, t));
|
|
4674
4809
|
}
|
|
4675
4810
|
};
|
|
4676
4811
|
}
|
|
4677
|
-
function
|
|
4812
|
+
function Jt(i, t) {
|
|
4678
4813
|
const e = {
|
|
4679
4814
|
connection: i.connection,
|
|
4680
4815
|
provider: i.provider,
|
|
@@ -4687,7 +4822,7 @@ function Pt(i, t) {
|
|
|
4687
4822
|
...typeof i.profileData == "string" ? b(i.profileData, {}) : {}
|
|
4688
4823
|
}, e;
|
|
4689
4824
|
}
|
|
4690
|
-
function
|
|
4825
|
+
function mt(i, t = []) {
|
|
4691
4826
|
const {
|
|
4692
4827
|
tenant_id: e,
|
|
4693
4828
|
app_metadata: n,
|
|
@@ -4695,24 +4830,24 @@ function ft(i, t = []) {
|
|
|
4695
4830
|
address: o,
|
|
4696
4831
|
email_verified: l,
|
|
4697
4832
|
phone_verified: _,
|
|
4698
|
-
is_social:
|
|
4699
|
-
linked_to:
|
|
4833
|
+
is_social: d,
|
|
4834
|
+
linked_to: c,
|
|
4700
4835
|
profileData: u,
|
|
4701
4836
|
...h
|
|
4702
|
-
} = i, g =
|
|
4837
|
+
} = i, g = Jt(i, !0), y = t.map((w) => Jt(w, !1));
|
|
4703
4838
|
return z({
|
|
4704
4839
|
...h,
|
|
4705
4840
|
email: i.email || "",
|
|
4706
4841
|
email_verified: !!l,
|
|
4707
4842
|
phone_verified: _ != null ? !!_ : void 0,
|
|
4708
|
-
is_social: !!
|
|
4843
|
+
is_social: !!d,
|
|
4709
4844
|
app_metadata: b(n, {}),
|
|
4710
4845
|
user_metadata: b(s, {}),
|
|
4711
4846
|
address: b(o),
|
|
4712
4847
|
identities: [g, ...y]
|
|
4713
4848
|
});
|
|
4714
4849
|
}
|
|
4715
|
-
function
|
|
4850
|
+
function As(i) {
|
|
4716
4851
|
return {
|
|
4717
4852
|
async create(t, e) {
|
|
4718
4853
|
var l, _;
|
|
@@ -4763,25 +4898,20 @@ function Os(i) {
|
|
|
4763
4898
|
created_at: n,
|
|
4764
4899
|
updated_at: n
|
|
4765
4900
|
});
|
|
4766
|
-
} catch (
|
|
4767
|
-
throw (l =
|
|
4901
|
+
} catch (d) {
|
|
4902
|
+
throw (l = d == null ? void 0 : d.message) != null && l.includes("UNIQUE constraint") || (_ = d == null ? void 0 : d.message) != null && _.includes("AlreadyExists") ? new be(409, { message: "User already exists" }) : (console.error("User upsert failed:", d == null ? void 0 : d.code, d == null ? void 0 : d.message), new be(500, {
|
|
4768
4903
|
message: "Internal server error"
|
|
4769
4904
|
}));
|
|
4770
4905
|
}
|
|
4771
|
-
return
|
|
4906
|
+
return mt(s);
|
|
4772
4907
|
},
|
|
4773
4908
|
async get(t, e) {
|
|
4774
|
-
const n = await i.select().from(k).where(
|
|
4775
|
-
m(a(k.tenant_id, t), a(k.user_id, e))
|
|
4776
|
-
).get();
|
|
4909
|
+
const n = await i.select().from(k).where(m(a(k.tenant_id, t), a(k.user_id, e))).get();
|
|
4777
4910
|
if (!n) return null;
|
|
4778
4911
|
const s = await i.select().from(k).where(
|
|
4779
|
-
m(
|
|
4780
|
-
a(k.tenant_id, t),
|
|
4781
|
-
a(k.linked_to, e)
|
|
4782
|
-
)
|
|
4912
|
+
m(a(k.tenant_id, t), a(k.linked_to, e))
|
|
4783
4913
|
).all();
|
|
4784
|
-
return
|
|
4914
|
+
return mt(n, s);
|
|
4785
4915
|
},
|
|
4786
4916
|
async update(t, e, n) {
|
|
4787
4917
|
const s = {
|
|
@@ -4813,26 +4943,30 @@ function Os(i) {
|
|
|
4813
4943
|
];
|
|
4814
4944
|
for (const _ of o)
|
|
4815
4945
|
n[_] !== void 0 && (s[_] = n[_]);
|
|
4816
|
-
return n.email_verified !== void 0 && (s.email_verified = n.email_verified), n.phone_verified !== void 0 && (s.phone_verified = n.phone_verified), n.is_social !== void 0 && (s.is_social = n.is_social), n.app_metadata !== void 0 && (s.app_metadata = JSON.stringify(n.app_metadata)), n.user_metadata !== void 0 && (s.user_metadata = JSON.stringify(n.user_metadata)), n.address !== void 0 && (s.address = JSON.stringify(n.address)), n.profileData !== void 0 && (s.profileData = JSON.stringify(n.profileData)), (await i.update(k).set(s).where(
|
|
4817
|
-
m(a(k.tenant_id, t), a(k.user_id, e))
|
|
4818
|
-
).returning()).length > 0;
|
|
4946
|
+
return n.email_verified !== void 0 && (s.email_verified = n.email_verified), n.phone_verified !== void 0 && (s.phone_verified = n.phone_verified), n.is_social !== void 0 && (s.is_social = n.is_social), n.app_metadata !== void 0 && (s.app_metadata = JSON.stringify(n.app_metadata)), n.user_metadata !== void 0 && (s.user_metadata = JSON.stringify(n.user_metadata)), n.address !== void 0 && (s.address = JSON.stringify(n.address)), n.profileData !== void 0 && (s.profileData = JSON.stringify(n.profileData)), (await i.update(k).set(s).where(m(a(k.tenant_id, t), a(k.user_id, e))).returning()).length > 0;
|
|
4819
4947
|
},
|
|
4820
4948
|
async list(t, e) {
|
|
4821
|
-
const {
|
|
4949
|
+
const {
|
|
4950
|
+
page: n = 0,
|
|
4951
|
+
per_page: s = 50,
|
|
4952
|
+
include_totals: o = !1,
|
|
4953
|
+
sort: l,
|
|
4954
|
+
q: _
|
|
4955
|
+
} = e || {}, d = [
|
|
4822
4956
|
a(k.tenant_id, t),
|
|
4823
|
-
|
|
4957
|
+
pe(k.linked_to)
|
|
4824
4958
|
];
|
|
4825
4959
|
if (_) {
|
|
4826
|
-
const q =
|
|
4960
|
+
const q = he(k, _, [
|
|
4827
4961
|
"email",
|
|
4828
4962
|
"name",
|
|
4829
4963
|
"nickname",
|
|
4830
4964
|
"username"
|
|
4831
4965
|
]);
|
|
4832
|
-
q &&
|
|
4966
|
+
q && d.push(q);
|
|
4833
4967
|
}
|
|
4834
|
-
const
|
|
4835
|
-
let u = i.select().from(k).where(
|
|
4968
|
+
const c = m(...d);
|
|
4969
|
+
let u = i.select().from(k).where(c).$dynamic();
|
|
4836
4970
|
if (l != null && l.sort_by) {
|
|
4837
4971
|
const q = k[l.sort_by];
|
|
4838
4972
|
q && (u = u.orderBy(
|
|
@@ -4844,16 +4978,16 @@ function Os(i) {
|
|
|
4844
4978
|
g.length > 0 && (y = await i.select().from(k).where(
|
|
4845
4979
|
m(
|
|
4846
4980
|
a(k.tenant_id, t),
|
|
4847
|
-
|
|
4981
|
+
we(k.linked_to, g)
|
|
4848
4982
|
)
|
|
4849
4983
|
));
|
|
4850
4984
|
const w = h.map((q) => {
|
|
4851
|
-
const
|
|
4852
|
-
return
|
|
4985
|
+
const ye = y.filter((ke) => ke.linked_to === q.user_id);
|
|
4986
|
+
return mt(q, ye);
|
|
4853
4987
|
});
|
|
4854
4988
|
if (!o)
|
|
4855
4989
|
return { users: w };
|
|
4856
|
-
const [A] = await i.select({ count: R() }).from(k).where(
|
|
4990
|
+
const [A] = await i.select({ count: R() }).from(k).where(c);
|
|
4857
4991
|
return {
|
|
4858
4992
|
users: w,
|
|
4859
4993
|
start: n * s,
|
|
@@ -4866,19 +5000,16 @@ function Os(i) {
|
|
|
4866
5000
|
try {
|
|
4867
5001
|
const n = await i.select({ user_id: k.user_id }).from(k).where(
|
|
4868
5002
|
m(a(k.tenant_id, t), a(k.linked_to, e))
|
|
4869
|
-
), s = [
|
|
4870
|
-
|
|
4871
|
-
...n.map((l) => l.user_id)
|
|
4872
|
-
];
|
|
4873
|
-
await i.delete(K).where(
|
|
5003
|
+
), s = [e, ...n.map((l) => l.user_id)];
|
|
5004
|
+
await i.delete(U).where(
|
|
4874
5005
|
m(
|
|
4875
|
-
a(
|
|
4876
|
-
|
|
5006
|
+
a(U.tenant_id, t),
|
|
5007
|
+
we(U.user_id, s)
|
|
4877
5008
|
)
|
|
4878
5009
|
), await i.delete(C).where(
|
|
4879
5010
|
m(
|
|
4880
5011
|
a(C.tenant_id, t),
|
|
4881
|
-
|
|
5012
|
+
we(C.user_id, s)
|
|
4882
5013
|
)
|
|
4883
5014
|
), await i.delete(k).where(
|
|
4884
5015
|
m(a(k.tenant_id, t), a(k.linked_to, e))
|
|
@@ -4903,7 +5034,7 @@ function Os(i) {
|
|
|
4903
5034
|
}
|
|
4904
5035
|
};
|
|
4905
5036
|
}
|
|
4906
|
-
function
|
|
5037
|
+
function Cs(i) {
|
|
4907
5038
|
return {
|
|
4908
5039
|
async create(t, e, n, s) {
|
|
4909
5040
|
var o, l;
|
|
@@ -4932,15 +5063,12 @@ function ks(i) {
|
|
|
4932
5063
|
role_id: _e.role_id
|
|
4933
5064
|
}).from(_e).where(m(...o)).all();
|
|
4934
5065
|
return l.length === 0 ? [] : (await Promise.all(
|
|
4935
|
-
l.map(async (
|
|
4936
|
-
const
|
|
4937
|
-
m(
|
|
4938
|
-
a(U.tenant_id, t),
|
|
4939
|
-
a(U.id, c.role_id)
|
|
4940
|
-
)
|
|
5066
|
+
l.map(async (d) => {
|
|
5067
|
+
const c = await i.select().from(F).where(
|
|
5068
|
+
m(a(F.tenant_id, t), a(F.id, d.role_id))
|
|
4941
5069
|
).get();
|
|
4942
|
-
if (!
|
|
4943
|
-
const { tenant_id: u, is_system: h, metadata: g, ...y } =
|
|
5070
|
+
if (!c) return null;
|
|
5071
|
+
const { tenant_id: u, is_system: h, metadata: g, ...y } = c;
|
|
4944
5072
|
return z({
|
|
4945
5073
|
...y,
|
|
4946
5074
|
is_system: h ? !0 : void 0,
|
|
@@ -4961,10 +5089,10 @@ function ks(i) {
|
|
|
4961
5089
|
}
|
|
4962
5090
|
};
|
|
4963
5091
|
}
|
|
4964
|
-
function
|
|
5092
|
+
function $s(i) {
|
|
4965
5093
|
return {
|
|
4966
5094
|
async create(t, e) {
|
|
4967
|
-
var
|
|
5095
|
+
var d, c;
|
|
4968
5096
|
const n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
4969
5097
|
id: e.id || oe(),
|
|
4970
5098
|
tenant_id: t,
|
|
@@ -4976,7 +5104,7 @@ function zs(i) {
|
|
|
4976
5104
|
try {
|
|
4977
5105
|
await i.insert(Q).values(o);
|
|
4978
5106
|
} catch (u) {
|
|
4979
|
-
throw (
|
|
5107
|
+
throw (d = u == null ? void 0 : u.message) != null && d.includes("UNIQUE constraint") || (c = u == null ? void 0 : u.message) != null && c.includes("duplicate key") ? new be(409, {
|
|
4980
5108
|
message: "User organization already exists"
|
|
4981
5109
|
}) : u;
|
|
4982
5110
|
}
|
|
@@ -5006,22 +5134,27 @@ function zs(i) {
|
|
|
5006
5134
|
).returning()).length > 0;
|
|
5007
5135
|
},
|
|
5008
5136
|
async list(t, e) {
|
|
5009
|
-
const {
|
|
5010
|
-
|
|
5137
|
+
const {
|
|
5138
|
+
page: n = 0,
|
|
5139
|
+
per_page: s = 50,
|
|
5140
|
+
include_totals: o = !1,
|
|
5141
|
+
q: l
|
|
5142
|
+
} = e || {}, _ = a(Q.tenant_id, t);
|
|
5143
|
+
let d = _;
|
|
5011
5144
|
if (l) {
|
|
5012
|
-
const g =
|
|
5145
|
+
const g = he(Q, l, [
|
|
5013
5146
|
"user_id",
|
|
5014
5147
|
"organization_id"
|
|
5015
5148
|
]);
|
|
5016
|
-
g && (
|
|
5149
|
+
g && (d = m(_, g));
|
|
5017
5150
|
}
|
|
5018
|
-
const u = (await i.select().from(Q).where(
|
|
5151
|
+
const u = (await i.select().from(Q).where(d).offset(n * s).limit(s)).map((g) => {
|
|
5019
5152
|
const { tenant_id: y, ...w } = g;
|
|
5020
5153
|
return w;
|
|
5021
5154
|
});
|
|
5022
5155
|
if (!o)
|
|
5023
5156
|
return { userOrganizations: u };
|
|
5024
|
-
const [h] = await i.select({ count: R() }).from(Q).where(
|
|
5157
|
+
const [h] = await i.select({ count: R() }).from(Q).where(d);
|
|
5025
5158
|
return {
|
|
5026
5159
|
userOrganizations: u,
|
|
5027
5160
|
start: n * s,
|
|
@@ -5035,7 +5168,7 @@ function zs(i) {
|
|
|
5035
5168
|
a(Q.tenant_id, t),
|
|
5036
5169
|
a(Q.user_id, e)
|
|
5037
5170
|
)
|
|
5038
|
-
).offset(s * o).limit(o).all(),
|
|
5171
|
+
).offset(s * o).limit(o).all(), c = (await Promise.all(
|
|
5039
5172
|
_.map(async (h) => {
|
|
5040
5173
|
const g = await i.select().from(L).where(
|
|
5041
5174
|
m(
|
|
@@ -5044,18 +5177,25 @@ function zs(i) {
|
|
|
5044
5177
|
)
|
|
5045
5178
|
).get();
|
|
5046
5179
|
if (!g) return null;
|
|
5047
|
-
const {
|
|
5180
|
+
const {
|
|
5181
|
+
tenant_id: y,
|
|
5182
|
+
branding: w,
|
|
5183
|
+
metadata: A,
|
|
5184
|
+
enabled_connections: q,
|
|
5185
|
+
token_quota: ye,
|
|
5186
|
+
...ke
|
|
5187
|
+
} = g;
|
|
5048
5188
|
return z({
|
|
5049
|
-
...
|
|
5189
|
+
...ke,
|
|
5050
5190
|
branding: b(w, {}),
|
|
5051
5191
|
metadata: b(A, {}),
|
|
5052
5192
|
enabled_connections: b(q, []),
|
|
5053
|
-
token_quota: b(
|
|
5193
|
+
token_quota: b(ye, {})
|
|
5054
5194
|
});
|
|
5055
5195
|
})
|
|
5056
5196
|
)).filter(Boolean);
|
|
5057
5197
|
if (!l)
|
|
5058
|
-
return { organizations:
|
|
5198
|
+
return { organizations: c };
|
|
5059
5199
|
const [u] = await i.select({ count: R() }).from(Q).where(
|
|
5060
5200
|
m(
|
|
5061
5201
|
a(Q.tenant_id, t),
|
|
@@ -5063,7 +5203,7 @@ function zs(i) {
|
|
|
5063
5203
|
)
|
|
5064
5204
|
);
|
|
5065
5205
|
return {
|
|
5066
|
-
organizations:
|
|
5206
|
+
organizations: c,
|
|
5067
5207
|
start: s * o,
|
|
5068
5208
|
limit: o,
|
|
5069
5209
|
length: Number((u == null ? void 0 : u.count) ?? 0)
|
|
@@ -5079,27 +5219,29 @@ function zs(i) {
|
|
|
5079
5219
|
}
|
|
5080
5220
|
};
|
|
5081
5221
|
}
|
|
5082
|
-
const
|
|
5083
|
-
function
|
|
5222
|
+
const Ft = ["s", "seacft", "seccft", "sepft", "sertft", "ssa"], Bs = ["pwd_leak", "signup_pwd_leak", "reset_pwd_leak"];
|
|
5223
|
+
function Ps(i) {
|
|
5084
5224
|
return {
|
|
5085
5225
|
async getDaily(t, e) {
|
|
5086
5226
|
const n = /* @__PURE__ */ new Date(), s = (e == null ? void 0 : e.from) || new Date(n.getTime() - 30 * 24 * 60 * 60 * 1e3).toISOString().split("T")[0], o = (e == null ? void 0 : e.to) || n.toISOString().split("T")[0];
|
|
5087
5227
|
return (await i.select({
|
|
5088
5228
|
date: N`substr(${T.date}, 1, 10)`.as("date"),
|
|
5089
|
-
logins: N`SUM(CASE WHEN ${T.type} IN (${N.join(
|
|
5090
|
-
|
|
5091
|
-
|
|
5229
|
+
logins: N`SUM(CASE WHEN ${T.type} IN (${N.join(
|
|
5230
|
+
Ft.map((_) => N`${_}`),
|
|
5231
|
+
N`, `
|
|
5232
|
+
)}) THEN 1 ELSE 0 END)`.as("logins"),
|
|
5092
5233
|
signups: N`SUM(CASE WHEN ${T.type} = 'ss' THEN 1 ELSE 0 END)`.as(
|
|
5093
5234
|
"signups"
|
|
5094
5235
|
),
|
|
5095
|
-
leaked_passwords: N`SUM(CASE WHEN ${T.type} IN (${N.join(
|
|
5096
|
-
|
|
5097
|
-
|
|
5236
|
+
leaked_passwords: N`SUM(CASE WHEN ${T.type} IN (${N.join(
|
|
5237
|
+
Bs.map((_) => N`${_}`),
|
|
5238
|
+
N`, `
|
|
5239
|
+
)}) THEN 1 ELSE 0 END)`.as("leaked_passwords")
|
|
5098
5240
|
}).from(T).where(
|
|
5099
5241
|
m(
|
|
5100
5242
|
a(T.tenant_id, t),
|
|
5101
|
-
|
|
5102
|
-
|
|
5243
|
+
We(T.date, s),
|
|
5244
|
+
Oe(T.date, `${o}T23:59:59.999Z`)
|
|
5103
5245
|
)
|
|
5104
5246
|
).groupBy(N`substr(${T.date}, 1, 10)`).orderBy(N`substr(${T.date}, 1, 10)`).all()).map((_) => ({
|
|
5105
5247
|
date: _.date,
|
|
@@ -5118,21 +5260,24 @@ function Ts(i) {
|
|
|
5118
5260
|
}).from(T).where(
|
|
5119
5261
|
m(
|
|
5120
5262
|
a(T.tenant_id, t),
|
|
5121
|
-
|
|
5122
|
-
N`${T.type} IN (${N.join(
|
|
5263
|
+
We(T.date, e),
|
|
5264
|
+
N`${T.type} IN (${N.join(
|
|
5265
|
+
Ft.map((s) => N`${s}`),
|
|
5266
|
+
N`, `
|
|
5267
|
+
)})`
|
|
5123
5268
|
)
|
|
5124
5269
|
);
|
|
5125
5270
|
return Number(n == null ? void 0 : n.count) || 0;
|
|
5126
5271
|
}
|
|
5127
5272
|
};
|
|
5128
5273
|
}
|
|
5129
|
-
function
|
|
5274
|
+
function Ut(i) {
|
|
5130
5275
|
return {
|
|
5131
5276
|
...i,
|
|
5132
5277
|
payload: b(i.payload, {})
|
|
5133
5278
|
};
|
|
5134
5279
|
}
|
|
5135
|
-
function
|
|
5280
|
+
function Qs(i) {
|
|
5136
5281
|
return {
|
|
5137
5282
|
async create(t, e) {
|
|
5138
5283
|
const n = oe(), s = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5154,23 +5299,23 @@ function qs(i) {
|
|
|
5154
5299
|
}), n;
|
|
5155
5300
|
},
|
|
5156
5301
|
async getByIds(t) {
|
|
5157
|
-
return t.length === 0 ? [] : (await i.select().from(I).where(
|
|
5302
|
+
return t.length === 0 ? [] : (await i.select().from(I).where(we(I.id, t)).all()).map(Ut);
|
|
5158
5303
|
},
|
|
5159
5304
|
async getUnprocessed(t) {
|
|
5160
5305
|
const e = (/* @__PURE__ */ new Date()).toISOString();
|
|
5161
5306
|
return (await i.select().from(I).where(
|
|
5162
5307
|
m(
|
|
5163
|
-
|
|
5308
|
+
pe(I.processed_at),
|
|
5164
5309
|
ue(
|
|
5165
|
-
|
|
5166
|
-
|
|
5310
|
+
pe(I.next_retry_at),
|
|
5311
|
+
Oe(I.next_retry_at, e)
|
|
5167
5312
|
),
|
|
5168
5313
|
ue(
|
|
5169
|
-
|
|
5170
|
-
|
|
5314
|
+
pe(I.claimed_by),
|
|
5315
|
+
Oe(I.claim_expires_at, e)
|
|
5171
5316
|
)
|
|
5172
5317
|
)
|
|
5173
|
-
).orderBy(I.created_at, I.id).limit(t).all()).map(
|
|
5318
|
+
).orderBy(I.created_at, I.id).limit(t).all()).map(Ut);
|
|
5174
5319
|
},
|
|
5175
5320
|
async claimEvents(t, e, n) {
|
|
5176
5321
|
if (t.length === 0) return [];
|
|
@@ -5180,22 +5325,22 @@ function qs(i) {
|
|
|
5180
5325
|
claim_expires_at: o
|
|
5181
5326
|
}).where(
|
|
5182
5327
|
m(
|
|
5183
|
-
|
|
5184
|
-
|
|
5328
|
+
we(I.id, t),
|
|
5329
|
+
pe(I.processed_at),
|
|
5185
5330
|
ue(
|
|
5186
|
-
|
|
5187
|
-
|
|
5331
|
+
pe(I.claimed_by),
|
|
5332
|
+
Oe(I.claim_expires_at, s)
|
|
5188
5333
|
)
|
|
5189
5334
|
)
|
|
5190
5335
|
), (await i.select({ id: I.id }).from(I).where(
|
|
5191
5336
|
m(
|
|
5192
|
-
|
|
5337
|
+
we(I.id, t),
|
|
5193
5338
|
a(I.claimed_by, e)
|
|
5194
5339
|
)
|
|
5195
5340
|
).all()).map((_) => _.id);
|
|
5196
5341
|
},
|
|
5197
5342
|
async markProcessed(t) {
|
|
5198
|
-
t.length !== 0 && await i.update(I).set({ processed_at: (/* @__PURE__ */ new Date()).toISOString() }).where(
|
|
5343
|
+
t.length !== 0 && await i.update(I).set({ processed_at: (/* @__PURE__ */ new Date()).toISOString() }).where(we(I.id, t));
|
|
5199
5344
|
},
|
|
5200
5345
|
async markRetry(t, e, n) {
|
|
5201
5346
|
await i.update(I).set({
|
|
@@ -5210,71 +5355,72 @@ function qs(i) {
|
|
|
5210
5355
|
return (await i.delete(I).where(
|
|
5211
5356
|
m(
|
|
5212
5357
|
N`${I.processed_at} IS NOT NULL`,
|
|
5213
|
-
|
|
5358
|
+
Oe(I.processed_at, t)
|
|
5214
5359
|
)
|
|
5215
5360
|
).returning()).length;
|
|
5216
5361
|
}
|
|
5217
5362
|
};
|
|
5218
5363
|
}
|
|
5219
|
-
const
|
|
5220
|
-
function
|
|
5364
|
+
const Js = 7 * 24 * 60 * 60 * 1e3;
|
|
5365
|
+
function Fs(i) {
|
|
5221
5366
|
return async (t) => {
|
|
5222
|
-
const e = Date.now() -
|
|
5367
|
+
const e = Date.now() - Js;
|
|
5223
5368
|
try {
|
|
5224
5369
|
let n = [
|
|
5225
5370
|
ue(
|
|
5226
|
-
|
|
5227
|
-
|
|
5371
|
+
xe($.expires_at_ts, e),
|
|
5372
|
+
xe($.idle_expires_at_ts, e)
|
|
5228
5373
|
)
|
|
5229
5374
|
];
|
|
5230
5375
|
t != null && t.tenant_id && n.push(a($.tenant_id, t.tenant_id)), await i.delete($).where(m(...n)), n = [
|
|
5231
5376
|
ue(
|
|
5232
|
-
|
|
5233
|
-
|
|
5377
|
+
xe(B.expires_at_ts, e),
|
|
5378
|
+
xe(B.idle_expires_at_ts, e)
|
|
5234
5379
|
)
|
|
5235
|
-
], t != null && t.tenant_id && n.push(a(B.tenant_id, t.tenant_id)), t != null && t.user_id && n.push(a(B.user_id, t.user_id)), await i.delete(B).where(m(...n)), n = [
|
|
5380
|
+
], t != null && t.tenant_id && n.push(a(B.tenant_id, t.tenant_id)), t != null && t.user_id && n.push(a(B.user_id, t.user_id)), await i.delete(B).where(m(...n)), n = [xe(se.expires_at_ts, e)], t != null && t.tenant_id && n.push(a(se.tenant_id, t.tenant_id)), await i.delete(se).where(m(...n));
|
|
5236
5381
|
} catch (n) {
|
|
5237
5382
|
console.error("Session cleanup error:", n);
|
|
5238
5383
|
}
|
|
5239
5384
|
};
|
|
5240
5385
|
}
|
|
5241
|
-
function
|
|
5386
|
+
function js(i, t = { useTransactions: !0 }) {
|
|
5242
5387
|
const e = {
|
|
5243
|
-
branding:
|
|
5244
|
-
clients:
|
|
5245
|
-
clientConnections:
|
|
5246
|
-
clientGrants:
|
|
5247
|
-
codes:
|
|
5248
|
-
connections:
|
|
5249
|
-
customDomains:
|
|
5250
|
-
customText:
|
|
5251
|
-
emailProviders:
|
|
5252
|
-
flows:
|
|
5253
|
-
forms:
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5388
|
+
branding: Fr(i),
|
|
5389
|
+
clients: Ur(i),
|
|
5390
|
+
clientConnections: jr(i),
|
|
5391
|
+
clientGrants: Hr(i),
|
|
5392
|
+
codes: Gr(i),
|
|
5393
|
+
connections: Xr(i),
|
|
5394
|
+
customDomains: Zr(i),
|
|
5395
|
+
customText: es(i),
|
|
5396
|
+
emailProviders: ts(i),
|
|
5397
|
+
flows: ns(i),
|
|
5398
|
+
forms: is(i),
|
|
5399
|
+
hookCode: os(i),
|
|
5400
|
+
hooks: ls(i),
|
|
5401
|
+
invites: us(i),
|
|
5402
|
+
keys: ds(i),
|
|
5403
|
+
loginSessions: gs(i),
|
|
5404
|
+
logs: fs(i),
|
|
5405
|
+
authenticationMethods: hs(i),
|
|
5406
|
+
organizations: ys(i),
|
|
5407
|
+
passwords: ws(i),
|
|
5408
|
+
promptSettings: Ns(i),
|
|
5409
|
+
refreshTokens: vs(i),
|
|
5410
|
+
resourceServers: bs(i),
|
|
5411
|
+
rolePermissions: xs(i),
|
|
5412
|
+
userPermissions: Ds(i),
|
|
5413
|
+
roles: Os(i),
|
|
5414
|
+
sessions: Is(i),
|
|
5415
|
+
sessionCleanup: Fs(i),
|
|
5416
|
+
tenants: Ts(i),
|
|
5417
|
+
themes: Ls(i),
|
|
5418
|
+
universalLoginTemplates: Es(i),
|
|
5419
|
+
users: As(i),
|
|
5420
|
+
userRoles: Cs(i),
|
|
5421
|
+
userOrganizations: $s(i),
|
|
5422
|
+
stats: Ps(i),
|
|
5423
|
+
outbox: Qs(i),
|
|
5278
5424
|
async transaction(n) {
|
|
5279
5425
|
if (t.useTransactions === !1)
|
|
5280
5426
|
return n(e);
|
|
@@ -5290,6 +5436,6 @@ function $s(i, t = { useTransactions: !0 }) {
|
|
|
5290
5436
|
return e;
|
|
5291
5437
|
}
|
|
5292
5438
|
export {
|
|
5293
|
-
|
|
5294
|
-
|
|
5439
|
+
js as default,
|
|
5440
|
+
Ks as sqlite
|
|
5295
5441
|
};
|