@authhero/drizzle 0.40.0 → 0.41.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.mjs
CHANGED
|
@@ -238,7 +238,7 @@ class Z {
|
|
|
238
238
|
this.value = Array.isArray(i) ? i : [i];
|
|
239
239
|
}
|
|
240
240
|
getSQL() {
|
|
241
|
-
return new
|
|
241
|
+
return new F([this]);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
p(Z, sn, "StringChunk");
|
|
@@ -386,7 +386,7 @@ const De = class De {
|
|
|
386
386
|
}
|
|
387
387
|
};
|
|
388
388
|
p(De, on, "SQL");
|
|
389
|
-
let
|
|
389
|
+
let F = De;
|
|
390
390
|
var an;
|
|
391
391
|
an = v;
|
|
392
392
|
class Re {
|
|
@@ -395,7 +395,7 @@ class Re {
|
|
|
395
395
|
this.value = i;
|
|
396
396
|
}
|
|
397
397
|
getSQL() {
|
|
398
|
-
return new
|
|
398
|
+
return new F([this]);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
p(Re, an, "Name");
|
|
@@ -423,7 +423,7 @@ class Ae {
|
|
|
423
423
|
this.value = i, this.encoder = e;
|
|
424
424
|
}
|
|
425
425
|
getSQL() {
|
|
426
|
-
return new
|
|
426
|
+
return new F([this]);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
p(Ae, ln, "Param");
|
|
@@ -432,26 +432,26 @@ function w(n, ...i) {
|
|
|
432
432
|
(i.length > 0 || n.length > 0 && n[0] !== "") && e.push(new Z(n[0]));
|
|
433
433
|
for (const [t, r] of i.entries())
|
|
434
434
|
e.push(r, new Z(n[t + 1]));
|
|
435
|
-
return new
|
|
435
|
+
return new F(e);
|
|
436
436
|
}
|
|
437
437
|
((n) => {
|
|
438
438
|
function i() {
|
|
439
|
-
return new
|
|
439
|
+
return new F([]);
|
|
440
440
|
}
|
|
441
441
|
n.empty = i;
|
|
442
442
|
function e(u) {
|
|
443
|
-
return new
|
|
443
|
+
return new F(u);
|
|
444
444
|
}
|
|
445
445
|
n.fromList = e;
|
|
446
446
|
function t(u) {
|
|
447
|
-
return new
|
|
447
|
+
return new F([new Z(u)]);
|
|
448
448
|
}
|
|
449
449
|
n.raw = t;
|
|
450
450
|
function r(u, c) {
|
|
451
451
|
const d = [];
|
|
452
452
|
for (const [h, f] of u.entries())
|
|
453
453
|
h > 0 && c !== void 0 && d.push(c), d.push(f);
|
|
454
|
-
return new
|
|
454
|
+
return new F(d);
|
|
455
455
|
}
|
|
456
456
|
n.join = r;
|
|
457
457
|
function o(u) {
|
|
@@ -487,7 +487,7 @@ function w(n, ...i) {
|
|
|
487
487
|
p(t, e, "SQL.Aliased");
|
|
488
488
|
let i = t;
|
|
489
489
|
n.Aliased = i;
|
|
490
|
-
})(
|
|
490
|
+
})(F || (F = {}));
|
|
491
491
|
var _n;
|
|
492
492
|
_n = v;
|
|
493
493
|
class Be {
|
|
@@ -495,7 +495,7 @@ class Be {
|
|
|
495
495
|
this.name = i;
|
|
496
496
|
}
|
|
497
497
|
getSQL() {
|
|
498
|
-
return new
|
|
498
|
+
return new F([this]);
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
p(Be, _n, "Placeholder");
|
|
@@ -519,18 +519,18 @@ class Dt {
|
|
|
519
519
|
};
|
|
520
520
|
}
|
|
521
521
|
getSQL() {
|
|
522
|
-
return new
|
|
522
|
+
return new F([this]);
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
p(Dt, cn, "View");
|
|
526
526
|
Qe.prototype.getSQL = function() {
|
|
527
|
-
return new
|
|
527
|
+
return new F([this]);
|
|
528
528
|
};
|
|
529
529
|
M.prototype.getSQL = function() {
|
|
530
|
-
return new
|
|
530
|
+
return new F([this]);
|
|
531
531
|
};
|
|
532
532
|
bt.prototype.getSQL = function() {
|
|
533
|
-
return new
|
|
533
|
+
return new F([this]);
|
|
534
534
|
};
|
|
535
535
|
function Je(n, i) {
|
|
536
536
|
return {
|
|
@@ -548,7 +548,7 @@ function g(...n) {
|
|
|
548
548
|
(e) => e !== void 0
|
|
549
549
|
);
|
|
550
550
|
if (i.length !== 0)
|
|
551
|
-
return i.length === 1 ? new
|
|
551
|
+
return i.length === 1 ? new F(i) : new F([
|
|
552
552
|
new Z("("),
|
|
553
553
|
w.join(i, new Z(" and ")),
|
|
554
554
|
new Z(")")
|
|
@@ -559,7 +559,7 @@ function de(...n) {
|
|
|
559
559
|
(e) => e !== void 0
|
|
560
560
|
);
|
|
561
561
|
if (i.length !== 0)
|
|
562
|
-
return i.length === 1 ? new
|
|
562
|
+
return i.length === 1 ? new F(i) : new F([
|
|
563
563
|
new Z("("),
|
|
564
564
|
w.join(i, new Z(" or ")),
|
|
565
565
|
new Z(")")
|
|
@@ -569,7 +569,7 @@ const We = (n, i) => w`${n} > ${xe(i, n)}`, He = (n, i) => w`${n} >= ${xe(i, n)}
|
|
|
569
569
|
function Ne(n, i) {
|
|
570
570
|
return Array.isArray(i) ? i.length === 0 ? w`false` : w`${n} in ${i.map((e) => xe(e, n))}` : w`${n} in ${xe(i, n)}`;
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function me(n) {
|
|
573
573
|
return w`${n} is null`;
|
|
574
574
|
}
|
|
575
575
|
function Me(n) {
|
|
@@ -1365,7 +1365,7 @@ const D = O("tenants", {
|
|
|
1365
1365
|
S("idx_sessions_user_id").on(n.tenant_id, n.user_id),
|
|
1366
1366
|
S("idx_sessions_expires_at_ts").on(n.expires_at_ts)
|
|
1367
1367
|
]
|
|
1368
|
-
),
|
|
1368
|
+
), z = O(
|
|
1369
1369
|
"refresh_tokens",
|
|
1370
1370
|
{
|
|
1371
1371
|
id: s("id", { length: 21 }).notNull(),
|
|
@@ -1379,7 +1379,8 @@ const D = O("tenants", {
|
|
|
1379
1379
|
created_at_ts: m("created_at_ts").notNull(),
|
|
1380
1380
|
expires_at_ts: m("expires_at_ts"),
|
|
1381
1381
|
idle_expires_at_ts: m("idle_expires_at_ts"),
|
|
1382
|
-
last_exchanged_at_ts: m("last_exchanged_at_ts")
|
|
1382
|
+
last_exchanged_at_ts: m("last_exchanged_at_ts"),
|
|
1383
|
+
revoked_at_ts: m("revoked_at_ts")
|
|
1383
1384
|
},
|
|
1384
1385
|
(n) => [
|
|
1385
1386
|
oe({
|
|
@@ -1433,7 +1434,7 @@ const D = O("tenants", {
|
|
|
1433
1434
|
S("login_sessions_tenant_user_idx").on(n.tenant_id, n.user_id),
|
|
1434
1435
|
S("idx_login_sessions_expires_at_ts").on(n.expires_at_ts)
|
|
1435
1436
|
]
|
|
1436
|
-
),
|
|
1437
|
+
), J = O(
|
|
1437
1438
|
"codes",
|
|
1438
1439
|
{
|
|
1439
1440
|
code_id: s("code_id", { length: 191 }).notNull(),
|
|
@@ -1609,7 +1610,7 @@ const D = O("tenants", {
|
|
|
1609
1610
|
}),
|
|
1610
1611
|
S("idx_client_grants_audience").on(n.audience)
|
|
1611
1612
|
]
|
|
1612
|
-
),
|
|
1613
|
+
), j = O(
|
|
1613
1614
|
"connections",
|
|
1614
1615
|
{
|
|
1615
1616
|
id: s("id", { length: 255 }).notNull(),
|
|
@@ -1676,7 +1677,7 @@ const D = O("tenants", {
|
|
|
1676
1677
|
updated_at: s("updated_at", { length: 35 }).notNull()
|
|
1677
1678
|
},
|
|
1678
1679
|
(n) => [S("idx_organizations_tenant_id").on(n.tenant_id)]
|
|
1679
|
-
),
|
|
1680
|
+
), P = O(
|
|
1680
1681
|
"user_organizations",
|
|
1681
1682
|
{
|
|
1682
1683
|
id: s("id", { length: 21 }).primaryKey(),
|
|
@@ -1722,7 +1723,7 @@ const D = O("tenants", {
|
|
|
1722
1723
|
S("idx_invites_expires_at").on(n.expires_at),
|
|
1723
1724
|
S("idx_invites_tenant_created").on(n.tenant_id, n.created_at)
|
|
1724
1725
|
]
|
|
1725
|
-
),
|
|
1726
|
+
), U = O(
|
|
1726
1727
|
"roles",
|
|
1727
1728
|
{
|
|
1728
1729
|
id: s("id", { length: 21 }).notNull(),
|
|
@@ -2092,7 +2093,7 @@ const D = O("tenants", {
|
|
|
2092
2093
|
current_until: s("current_until", { length: 35 }),
|
|
2093
2094
|
type: s("type", { length: 50 }).notNull().default("jwt_signing"),
|
|
2094
2095
|
connection: s("connection", { length: 255 }).references(
|
|
2095
|
-
() =>
|
|
2096
|
+
() => j.id,
|
|
2096
2097
|
{ onDelete: "cascade" }
|
|
2097
2098
|
)
|
|
2098
2099
|
}), te = O(
|
|
@@ -2108,7 +2109,7 @@ const D = O("tenants", {
|
|
|
2108
2109
|
(n) => [
|
|
2109
2110
|
oe({ columns: [n.tenant_id, n.prompt, n.language] })
|
|
2110
2111
|
]
|
|
2111
|
-
),
|
|
2112
|
+
), K = O(
|
|
2112
2113
|
"authentication_methods",
|
|
2113
2114
|
{
|
|
2114
2115
|
id: s("id", { length: 26 }).primaryKey(),
|
|
@@ -2214,12 +2215,12 @@ const D = O("tenants", {
|
|
|
2214
2215
|
), Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2215
2216
|
__proto__: null,
|
|
2216
2217
|
authenticationCodes: Br,
|
|
2217
|
-
authenticationMethods:
|
|
2218
|
+
authenticationMethods: K,
|
|
2218
2219
|
branding: Le,
|
|
2219
2220
|
clientGrants: Y,
|
|
2220
2221
|
clients: I,
|
|
2221
|
-
codes:
|
|
2222
|
-
connections:
|
|
2222
|
+
codes: J,
|
|
2223
|
+
connections: j,
|
|
2223
2224
|
customDomains: se,
|
|
2224
2225
|
customText: te,
|
|
2225
2226
|
domains: Jr,
|
|
@@ -2237,33 +2238,33 @@ const D = O("tenants", {
|
|
|
2237
2238
|
outboxEvents: b,
|
|
2238
2239
|
passwords: A,
|
|
2239
2240
|
promptSettings: Ee,
|
|
2240
|
-
refreshTokens:
|
|
2241
|
+
refreshTokens: z,
|
|
2241
2242
|
resourceServers: C,
|
|
2242
2243
|
rolePermissions: le,
|
|
2243
|
-
roles:
|
|
2244
|
+
roles: U,
|
|
2244
2245
|
sessions: $,
|
|
2245
2246
|
tenants: D,
|
|
2246
2247
|
themes: fe,
|
|
2247
2248
|
tickets: Qr,
|
|
2248
2249
|
universalLoginTemplates: ve,
|
|
2249
|
-
userOrganizations:
|
|
2250
|
+
userOrganizations: P,
|
|
2250
2251
|
userPermissions: _e,
|
|
2251
2252
|
userRoles: ue,
|
|
2252
2253
|
users: k
|
|
2253
2254
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2254
|
-
function
|
|
2255
|
+
function T(n) {
|
|
2255
2256
|
if (n == null || typeof n != "object")
|
|
2256
2257
|
return n;
|
|
2257
2258
|
if (Array.isArray(n))
|
|
2258
2259
|
return n.map(
|
|
2259
|
-
(e) => e !== null && typeof e == "object" ?
|
|
2260
|
+
(e) => e !== null && typeof e == "object" ? T(e) : e
|
|
2260
2261
|
);
|
|
2261
2262
|
const i = { ...n };
|
|
2262
2263
|
for (const e in i) {
|
|
2263
2264
|
const t = i[e];
|
|
2264
2265
|
t === null ? delete i[e] : t !== null && typeof t == "object" && (Array.isArray(t) ? i[e] = t.map(
|
|
2265
|
-
(r) => r !== null && typeof r == "object" ?
|
|
2266
|
-
) : i[e] =
|
|
2266
|
+
(r) => r !== null && typeof r == "object" ? T(r) : r
|
|
2267
|
+
) : i[e] = T(t));
|
|
2267
2268
|
}
|
|
2268
2269
|
return i;
|
|
2269
2270
|
}
|
|
@@ -2337,7 +2338,7 @@ function Kr(n) {
|
|
|
2337
2338
|
font_url: c,
|
|
2338
2339
|
...d
|
|
2339
2340
|
} = e;
|
|
2340
|
-
return
|
|
2341
|
+
return T({
|
|
2341
2342
|
...d,
|
|
2342
2343
|
colors: {
|
|
2343
2344
|
primary: r,
|
|
@@ -2404,7 +2405,7 @@ var be = class extends Error {
|
|
|
2404
2405
|
});
|
|
2405
2406
|
}
|
|
2406
2407
|
};
|
|
2407
|
-
function
|
|
2408
|
+
function ye(n, i, e) {
|
|
2408
2409
|
const t = i.split(/ OR /i);
|
|
2409
2410
|
if (t.length > 1) {
|
|
2410
2411
|
const c = t.map((d) => {
|
|
@@ -2451,7 +2452,7 @@ function me(n, i, e) {
|
|
|
2451
2452
|
continue;
|
|
2452
2453
|
}
|
|
2453
2454
|
if (f)
|
|
2454
|
-
u.push(h ?
|
|
2455
|
+
u.push(h ? me(N) : Me(N));
|
|
2455
2456
|
else if (h)
|
|
2456
2457
|
switch (y) {
|
|
2457
2458
|
case ">":
|
|
@@ -2539,7 +2540,7 @@ function Fe(n) {
|
|
|
2539
2540
|
r[o] = x(t[o], []);
|
|
2540
2541
|
for (const o of zt)
|
|
2541
2542
|
r[o] = x(t[o], {});
|
|
2542
|
-
return r.connections = x(e, []),
|
|
2543
|
+
return r.connections = x(e, []), T(r);
|
|
2543
2544
|
}
|
|
2544
2545
|
function Ct(n) {
|
|
2545
2546
|
const i = { ...n };
|
|
@@ -2635,7 +2636,7 @@ function jr(n) {
|
|
|
2635
2636
|
} = e || {};
|
|
2636
2637
|
let u = n.select().from(I).where(a(I.tenant_id, i)).$dynamic();
|
|
2637
2638
|
if (_) {
|
|
2638
|
-
const f =
|
|
2639
|
+
const f = ye(I, _, ["name", "client_id"]);
|
|
2639
2640
|
f && (u = u.where(g(a(I.tenant_id, i), f)));
|
|
2640
2641
|
}
|
|
2641
2642
|
if (l != null && l.sort_by) {
|
|
@@ -2667,7 +2668,7 @@ function jr(n) {
|
|
|
2667
2668
|
}
|
|
2668
2669
|
function Mr(n) {
|
|
2669
2670
|
const { tenant_id: i, is_system: e, options: t, metadata: r, ...o } = n;
|
|
2670
|
-
return
|
|
2671
|
+
return T({
|
|
2671
2672
|
...o,
|
|
2672
2673
|
options: x(t, {}),
|
|
2673
2674
|
metadata: x(r),
|
|
@@ -2686,10 +2687,10 @@ function Vr(n) {
|
|
|
2686
2687
|
if (!t) return [];
|
|
2687
2688
|
const r = x(t.connections, []) || [];
|
|
2688
2689
|
if (r.length === 0) return [];
|
|
2689
|
-
const l = (await n.select().from(
|
|
2690
|
+
const l = (await n.select().from(j).where(
|
|
2690
2691
|
g(
|
|
2691
|
-
a(
|
|
2692
|
-
Ne(
|
|
2692
|
+
a(j.tenant_id, i),
|
|
2693
|
+
Ne(j.id, r)
|
|
2693
2694
|
)
|
|
2694
2695
|
).all()).map(Mr);
|
|
2695
2696
|
return r.map((_) => l.find((u) => u.id === _)).filter(Boolean);
|
|
@@ -2782,7 +2783,7 @@ function tt(n) {
|
|
|
2782
2783
|
is_system: o,
|
|
2783
2784
|
...l
|
|
2784
2785
|
} = n;
|
|
2785
|
-
return
|
|
2786
|
+
return T({
|
|
2786
2787
|
...l,
|
|
2787
2788
|
scope: x(e, []),
|
|
2788
2789
|
authorization_details_types: x(
|
|
@@ -2844,7 +2845,7 @@ function Yr(n) {
|
|
|
2844
2845
|
include_totals: o = !1,
|
|
2845
2846
|
sort: l,
|
|
2846
2847
|
q: _
|
|
2847
|
-
} = e || {}, u = _ ?
|
|
2848
|
+
} = e || {}, u = _ ? ye(Y, _, ["client_id", "audience"]) : void 0, c = u ? g(a(Y.tenant_id, i), u) : a(Y.tenant_id, i);
|
|
2848
2849
|
let d = n.select().from(Y).where(c).$dynamic();
|
|
2849
2850
|
if (l != null && l.sort_by) {
|
|
2850
2851
|
const N = Y[l.sort_by];
|
|
@@ -2873,7 +2874,7 @@ function Yr(n) {
|
|
|
2873
2874
|
}
|
|
2874
2875
|
function nt(n) {
|
|
2875
2876
|
const { tenant_id: i, ...e } = n;
|
|
2876
|
-
return
|
|
2877
|
+
return T(e);
|
|
2877
2878
|
}
|
|
2878
2879
|
function Xr(n) {
|
|
2879
2880
|
return {
|
|
@@ -2884,16 +2885,16 @@ function Xr(n) {
|
|
|
2884
2885
|
created_at: e.created_at || (/* @__PURE__ */ new Date()).toISOString(),
|
|
2885
2886
|
expires_at: e.expires_at
|
|
2886
2887
|
};
|
|
2887
|
-
return await n.insert(
|
|
2888
|
+
return await n.insert(J).values(t), nt(t);
|
|
2888
2889
|
},
|
|
2889
2890
|
async get(i, e, t) {
|
|
2890
2891
|
if (!i)
|
|
2891
2892
|
throw new Error("tenant_id is required");
|
|
2892
|
-
const r = await n.select().from(
|
|
2893
|
+
const r = await n.select().from(J).where(
|
|
2893
2894
|
g(
|
|
2894
|
-
a(
|
|
2895
|
-
a(
|
|
2896
|
-
a(
|
|
2895
|
+
a(J.tenant_id, i),
|
|
2896
|
+
a(J.code_id, e),
|
|
2897
|
+
a(J.code_type, t)
|
|
2897
2898
|
)
|
|
2898
2899
|
).get();
|
|
2899
2900
|
return r ? nt(r) : null;
|
|
@@ -2905,9 +2906,9 @@ function Xr(n) {
|
|
|
2905
2906
|
include_totals: o = !1,
|
|
2906
2907
|
sort: l
|
|
2907
2908
|
} = e || {};
|
|
2908
|
-
let _ = n.select().from(
|
|
2909
|
+
let _ = n.select().from(J).where(a(J.tenant_id, i)).$dynamic();
|
|
2909
2910
|
if (l != null && l.sort_by) {
|
|
2910
|
-
const h =
|
|
2911
|
+
const h = J[l.sort_by];
|
|
2911
2912
|
h && (_ = _.orderBy(
|
|
2912
2913
|
l.sort_order === "desc" ? V(h) : G(h)
|
|
2913
2914
|
));
|
|
@@ -2915,7 +2916,7 @@ function Xr(n) {
|
|
|
2915
2916
|
const c = (await _.offset(t * r).limit(r)).map(nt);
|
|
2916
2917
|
if (!o)
|
|
2917
2918
|
return { codes: c };
|
|
2918
|
-
const [d] = await n.select({ count: R() }).from(
|
|
2919
|
+
const [d] = await n.select({ count: R() }).from(J).where(a(J.tenant_id, i));
|
|
2919
2920
|
return {
|
|
2920
2921
|
codes: c,
|
|
2921
2922
|
start: t * r,
|
|
@@ -2924,19 +2925,19 @@ function Xr(n) {
|
|
|
2924
2925
|
};
|
|
2925
2926
|
},
|
|
2926
2927
|
async used(i, e) {
|
|
2927
|
-
return (await n.update(
|
|
2928
|
+
return (await n.update(J).set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where(g(a(J.tenant_id, i), a(J.code_id, e))).returning()).length > 0;
|
|
2928
2929
|
},
|
|
2929
2930
|
async consume(i, e) {
|
|
2930
|
-
return (await n.update(
|
|
2931
|
+
return (await n.update(J).set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where(
|
|
2931
2932
|
g(
|
|
2932
|
-
a(
|
|
2933
|
-
a(
|
|
2934
|
-
|
|
2933
|
+
a(J.tenant_id, i),
|
|
2934
|
+
a(J.code_id, e),
|
|
2935
|
+
me(J.used_at)
|
|
2935
2936
|
)
|
|
2936
2937
|
).returning()).length > 0;
|
|
2937
2938
|
},
|
|
2938
2939
|
async remove(i, e) {
|
|
2939
|
-
return (await n.delete(
|
|
2940
|
+
return (await n.delete(J).where(g(a(J.tenant_id, i), a(J.code_id, e))).returning()).length > 0;
|
|
2940
2941
|
}
|
|
2941
2942
|
};
|
|
2942
2943
|
}
|
|
@@ -2946,7 +2947,7 @@ function Zr() {
|
|
|
2946
2947
|
}
|
|
2947
2948
|
function it(n) {
|
|
2948
2949
|
const { tenant_id: i, is_system: e, options: t, metadata: r, ...o } = n;
|
|
2949
|
-
return
|
|
2950
|
+
return T({
|
|
2950
2951
|
...o,
|
|
2951
2952
|
options: x(t, {}),
|
|
2952
2953
|
metadata: x(r),
|
|
@@ -2968,7 +2969,7 @@ function es(n) {
|
|
|
2968
2969
|
updated_at: t
|
|
2969
2970
|
};
|
|
2970
2971
|
try {
|
|
2971
|
-
await n.insert(
|
|
2972
|
+
await n.insert(j).values(r);
|
|
2972
2973
|
} catch (_) {
|
|
2973
2974
|
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, {
|
|
2974
2975
|
message: "Connection already exists"
|
|
@@ -2977,10 +2978,10 @@ function es(n) {
|
|
|
2977
2978
|
return it(r);
|
|
2978
2979
|
},
|
|
2979
2980
|
async get(i, e) {
|
|
2980
|
-
const t = await n.select().from(
|
|
2981
|
+
const t = await n.select().from(j).where(
|
|
2981
2982
|
g(
|
|
2982
|
-
a(
|
|
2983
|
-
a(
|
|
2983
|
+
a(j.tenant_id, i),
|
|
2984
|
+
a(j.id, e)
|
|
2984
2985
|
)
|
|
2985
2986
|
).get();
|
|
2986
2987
|
return t ? it(t) : null;
|
|
@@ -2989,10 +2990,10 @@ function es(n) {
|
|
|
2989
2990
|
const r = {
|
|
2990
2991
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2991
2992
|
};
|
|
2992
|
-
return t.name !== void 0 && (r.name = t.name), t.strategy !== void 0 && (r.strategy = t.strategy), t.options !== void 0 && (r.options = JSON.stringify(t.options)), t.metadata !== void 0 && (r.metadata = JSON.stringify(t.metadata)), t.display_name !== void 0 && (r.display_name = t.display_name), t.response_type !== void 0 && (r.response_type = t.response_type), t.response_mode !== void 0 && (r.response_mode = t.response_mode), await n.update(
|
|
2993
|
+
return t.name !== void 0 && (r.name = t.name), t.strategy !== void 0 && (r.strategy = t.strategy), t.options !== void 0 && (r.options = JSON.stringify(t.options)), t.metadata !== void 0 && (r.metadata = JSON.stringify(t.metadata)), t.display_name !== void 0 && (r.display_name = t.display_name), t.response_type !== void 0 && (r.response_type = t.response_type), t.response_mode !== void 0 && (r.response_mode = t.response_mode), await n.update(j).set(r).where(
|
|
2993
2994
|
g(
|
|
2994
|
-
a(
|
|
2995
|
-
a(
|
|
2995
|
+
a(j.tenant_id, i),
|
|
2996
|
+
a(j.id, e)
|
|
2996
2997
|
)
|
|
2997
2998
|
), !0;
|
|
2998
2999
|
},
|
|
@@ -3004,14 +3005,14 @@ function es(n) {
|
|
|
3004
3005
|
sort: l,
|
|
3005
3006
|
q: _
|
|
3006
3007
|
} = e || {};
|
|
3007
|
-
let u = a(
|
|
3008
|
+
let u = a(j.tenant_id, i);
|
|
3008
3009
|
if (_) {
|
|
3009
|
-
const y =
|
|
3010
|
+
const y = ye(j, _, ["name"]);
|
|
3010
3011
|
y && (u = g(u, y));
|
|
3011
3012
|
}
|
|
3012
|
-
let c = n.select().from(
|
|
3013
|
+
let c = n.select().from(j).where(u).$dynamic();
|
|
3013
3014
|
if (l != null && l.sort_by) {
|
|
3014
|
-
const y =
|
|
3015
|
+
const y = j[l.sort_by];
|
|
3015
3016
|
y && (c = c.orderBy(
|
|
3016
3017
|
l.sort_order === "desc" ? V(y) : G(y)
|
|
3017
3018
|
));
|
|
@@ -3019,7 +3020,7 @@ function es(n) {
|
|
|
3019
3020
|
const h = (await c.offset(t * r).limit(r)).map(it);
|
|
3020
3021
|
if (!o)
|
|
3021
3022
|
return { connections: h };
|
|
3022
|
-
const [f] = await n.select({ count: R() }).from(
|
|
3023
|
+
const [f] = await n.select({ count: R() }).from(j).where(u);
|
|
3023
3024
|
return {
|
|
3024
3025
|
connections: h,
|
|
3025
3026
|
start: t * r,
|
|
@@ -3028,10 +3029,10 @@ function es(n) {
|
|
|
3028
3029
|
};
|
|
3029
3030
|
},
|
|
3030
3031
|
async remove(i, e) {
|
|
3031
|
-
return (await n.delete(
|
|
3032
|
+
return (await n.delete(j).where(
|
|
3032
3033
|
g(
|
|
3033
|
-
a(
|
|
3034
|
-
a(
|
|
3034
|
+
a(j.tenant_id, i),
|
|
3035
|
+
a(j.id, e)
|
|
3035
3036
|
)
|
|
3036
3037
|
).returning()).length > 0;
|
|
3037
3038
|
}
|
|
@@ -3039,7 +3040,7 @@ function es(n) {
|
|
|
3039
3040
|
}
|
|
3040
3041
|
function Ue(n) {
|
|
3041
3042
|
const { tenant_id: i, domain_metadata: e, ...t } = n;
|
|
3042
|
-
return
|
|
3043
|
+
return T({
|
|
3043
3044
|
...t,
|
|
3044
3045
|
primary: !!t.primary,
|
|
3045
3046
|
domain_metadata: x(e)
|
|
@@ -3176,7 +3177,7 @@ function is(n) {
|
|
|
3176
3177
|
const e = await n.select().from(Se).where(a(Se.tenant_id, i)).get();
|
|
3177
3178
|
if (!e) return null;
|
|
3178
3179
|
const { tenant_id: t, ...r } = e;
|
|
3179
|
-
return
|
|
3180
|
+
return T({
|
|
3180
3181
|
...r,
|
|
3181
3182
|
enabled: !!r.enabled,
|
|
3182
3183
|
credentials: x(r.credentials, {}),
|
|
@@ -3217,7 +3218,7 @@ function rs(n) {
|
|
|
3217
3218
|
const t = await n.select().from(re).where(g(a(re.tenant_id, i), a(re.id, e))).get();
|
|
3218
3219
|
if (!t) return null;
|
|
3219
3220
|
const { tenant_id: r, actions: o, ...l } = t;
|
|
3220
|
-
return
|
|
3221
|
+
return T({
|
|
3221
3222
|
...l,
|
|
3222
3223
|
actions: x(o, [])
|
|
3223
3224
|
});
|
|
@@ -3244,7 +3245,7 @@ function rs(n) {
|
|
|
3244
3245
|
}
|
|
3245
3246
|
const c = (await _.offset(t * r).limit(r)).map((h) => {
|
|
3246
3247
|
const { tenant_id: f, actions: y, ...N } = h;
|
|
3247
|
-
return
|
|
3248
|
+
return T({
|
|
3248
3249
|
...N,
|
|
3249
3250
|
actions: x(y, [])
|
|
3250
3251
|
});
|
|
@@ -3296,7 +3297,7 @@ function ss(n) {
|
|
|
3296
3297
|
const { tenant_id: r, ...o } = t, l = { ...o };
|
|
3297
3298
|
for (const _ of Ke)
|
|
3298
3299
|
l[_] = x(o[_]);
|
|
3299
|
-
return
|
|
3300
|
+
return T(l);
|
|
3300
3301
|
},
|
|
3301
3302
|
async update(i, e, t) {
|
|
3302
3303
|
const r = {
|
|
@@ -3324,7 +3325,7 @@ function ss(n) {
|
|
|
3324
3325
|
const { tenant_id: f, ...y } = h, N = { ...y };
|
|
3325
3326
|
for (const B of Ke)
|
|
3326
3327
|
N[B] = x(y[B]);
|
|
3327
|
-
return
|
|
3328
|
+
return T(N);
|
|
3328
3329
|
});
|
|
3329
3330
|
if (!o)
|
|
3330
3331
|
return { forms: c };
|
|
@@ -3356,7 +3357,7 @@ function pr(n) {
|
|
|
3356
3357
|
function wt(n, i = (/* @__PURE__ */ new Date(0)).toISOString()) {
|
|
3357
3358
|
return pr(n) ?? i;
|
|
3358
3359
|
}
|
|
3359
|
-
function
|
|
3360
|
+
function Q(n) {
|
|
3360
3361
|
if (!n || n === "")
|
|
3361
3362
|
return null;
|
|
3362
3363
|
const i = new Date(n);
|
|
@@ -3426,7 +3427,7 @@ function rt(n) {
|
|
|
3426
3427
|
"created_at_ts",
|
|
3427
3428
|
"updated_at_ts"
|
|
3428
3429
|
]);
|
|
3429
|
-
return
|
|
3430
|
+
return T({
|
|
3430
3431
|
...r,
|
|
3431
3432
|
enabled: !!r.enabled,
|
|
3432
3433
|
synchronous: !!r.synchronous,
|
|
@@ -3469,7 +3470,7 @@ function us(n) {
|
|
|
3469
3470
|
include_totals: o = !1,
|
|
3470
3471
|
sort: l,
|
|
3471
3472
|
q: _
|
|
3472
|
-
} = e || {}, u = _ ?
|
|
3473
|
+
} = e || {}, u = _ ? ye(ee, _, [
|
|
3473
3474
|
"url",
|
|
3474
3475
|
"form_id",
|
|
3475
3476
|
"template_id",
|
|
@@ -3513,7 +3514,7 @@ function st(n) {
|
|
|
3513
3514
|
const { tenant_id: i, send_invitation_email: e, ...t } = n, r = { ...t };
|
|
3514
3515
|
for (const o of Nt)
|
|
3515
3516
|
r[o] = x(t[o], o === "roles" ? [] : {});
|
|
3516
|
-
return r.send_invitation_email = !!e,
|
|
3517
|
+
return r.send_invitation_email = !!e, T(r);
|
|
3517
3518
|
}
|
|
3518
3519
|
function cs(n) {
|
|
3519
3520
|
return {
|
|
@@ -3598,7 +3599,7 @@ function gs(n) {
|
|
|
3598
3599
|
include_totals: r = !1,
|
|
3599
3600
|
sort: o
|
|
3600
3601
|
} = i || {}, l = (/* @__PURE__ */ new Date()).toISOString();
|
|
3601
|
-
let _ = n.select().from(he).where(de(We(he.revoked_at, l),
|
|
3602
|
+
let _ = n.select().from(he).where(de(We(he.revoked_at, l), me(he.revoked_at))).$dynamic();
|
|
3602
3603
|
if (o != null && o.sort_by) {
|
|
3603
3604
|
const h = he[o.sort_by];
|
|
3604
3605
|
h && (_ = _.orderBy(
|
|
@@ -3607,11 +3608,11 @@ function gs(n) {
|
|
|
3607
3608
|
}
|
|
3608
3609
|
const c = (await _.offset(e * t).limit(t)).map((h) => {
|
|
3609
3610
|
const { created_at: f, ...y } = h;
|
|
3610
|
-
return
|
|
3611
|
+
return T(y);
|
|
3611
3612
|
});
|
|
3612
3613
|
if (!r)
|
|
3613
3614
|
return { signingKeys: c };
|
|
3614
|
-
const [d] = await n.select({ count: R() }).from(he).where(de(We(he.revoked_at, l),
|
|
3615
|
+
const [d] = await n.select({ count: R() }).from(he).where(de(We(he.revoked_at, l), me(he.revoked_at)));
|
|
3615
3616
|
return {
|
|
3616
3617
|
signingKeys: c,
|
|
3617
3618
|
start: e * t,
|
|
@@ -3651,7 +3652,7 @@ function Bt(n) {
|
|
|
3651
3652
|
for (const [h, f] of Object.entries(_))
|
|
3652
3653
|
f != null && (c[h] = f);
|
|
3653
3654
|
const d = fr(c, ["auth_strategy"]);
|
|
3654
|
-
return
|
|
3655
|
+
return T({
|
|
3655
3656
|
...d,
|
|
3656
3657
|
authParams: typeof l == "string" && l.length > 0 ? JSON.parse(l) : {},
|
|
3657
3658
|
...u,
|
|
@@ -3682,7 +3683,7 @@ function ps(n) {
|
|
|
3682
3683
|
authenticated_at: e.authenticated_at,
|
|
3683
3684
|
created_at_ts: t,
|
|
3684
3685
|
updated_at_ts: t,
|
|
3685
|
-
expires_at_ts: e.expires_at ?
|
|
3686
|
+
expires_at_ts: e.expires_at ? Q(e.expires_at) : t + 1e3 * 60 * 60 * 24
|
|
3686
3687
|
};
|
|
3687
3688
|
return await n.insert(L).values(o), Bt({ ...o, tenant_id: i });
|
|
3688
3689
|
},
|
|
@@ -3698,7 +3699,7 @@ function ps(n) {
|
|
|
3698
3699
|
if (t.session_id !== void 0 && (r.session_id = t.session_id), t.state !== void 0 && (r.state = t.state), t.state_data !== void 0 && (r.state_data = JSON.stringify(t.state_data)), t.failure_reason !== void 0 && (r.failure_reason = t.failure_reason), t.user_id !== void 0 && (r.user_id = t.user_id), t.auth_connection !== void 0 && (r.auth_connection = t.auth_connection), t.auth_strategy !== void 0 && (r.auth_strategy_strategy = (o = t.auth_strategy) == null ? void 0 : o.strategy, r.auth_strategy_strategy_type = (l = t.auth_strategy) == null ? void 0 : l.strategy_type), t.authenticated_at !== void 0 && (r.authenticated_at = t.authenticated_at), t.authorization_url !== void 0 && (r.authorization_url = (_ = t.authorization_url) == null ? void 0 : _.substring(
|
|
3699
3700
|
0,
|
|
3700
3701
|
1024
|
|
3701
|
-
)), t.expires_at !== void 0 && (r.expires_at_ts =
|
|
3702
|
+
)), t.expires_at !== void 0 && (r.expires_at_ts = Q(t.expires_at)), t.authParams !== void 0) {
|
|
3702
3703
|
const u = await n.select({ auth_params: L.auth_params }).from(L).where(
|
|
3703
3704
|
g(
|
|
3704
3705
|
a(L.tenant_id, i),
|
|
@@ -3742,14 +3743,14 @@ function at(n) {
|
|
|
3742
3743
|
details: x(r),
|
|
3743
3744
|
scope: h ? h.split(",") : void 0
|
|
3744
3745
|
};
|
|
3745
|
-
return o && (y.location_info =
|
|
3746
|
+
return o && (y.location_info = T({
|
|
3746
3747
|
country_code: o,
|
|
3747
3748
|
city_name: l,
|
|
3748
3749
|
latitude: _,
|
|
3749
3750
|
longitude: u,
|
|
3750
3751
|
time_zone: c,
|
|
3751
3752
|
continent_code: d
|
|
3752
|
-
})),
|
|
3753
|
+
})), T(y);
|
|
3753
3754
|
}
|
|
3754
3755
|
function hs(n) {
|
|
3755
3756
|
return {
|
|
@@ -3790,7 +3791,7 @@ function hs(n) {
|
|
|
3790
3791
|
} = e || {};
|
|
3791
3792
|
let u = n.select().from(q).where(a(q.tenant_id, i)).$dynamic();
|
|
3792
3793
|
if (_) {
|
|
3793
|
-
const f =
|
|
3794
|
+
const f = ye(q, _, [
|
|
3794
3795
|
"user_id",
|
|
3795
3796
|
"ip",
|
|
3796
3797
|
"type",
|
|
@@ -3843,7 +3844,7 @@ function je(n) {
|
|
|
3843
3844
|
transports: l,
|
|
3844
3845
|
..._
|
|
3845
3846
|
} = n;
|
|
3846
|
-
return
|
|
3847
|
+
return T({
|
|
3847
3848
|
..._,
|
|
3848
3849
|
confirmed: !!o,
|
|
3849
3850
|
credential_backed_up: r != null ? !!r : void 0,
|
|
@@ -3872,31 +3873,31 @@ function ys(n) {
|
|
|
3872
3873
|
created_at_ts: t,
|
|
3873
3874
|
updated_at_ts: t
|
|
3874
3875
|
};
|
|
3875
|
-
return await n.insert(
|
|
3876
|
+
return await n.insert(K).values(o), je({ ...o, tenant_id: i });
|
|
3876
3877
|
},
|
|
3877
3878
|
async get(i, e) {
|
|
3878
|
-
const t = await n.select().from(
|
|
3879
|
+
const t = await n.select().from(K).where(
|
|
3879
3880
|
g(
|
|
3880
|
-
a(
|
|
3881
|
-
a(
|
|
3881
|
+
a(K.tenant_id, i),
|
|
3882
|
+
a(K.id, e)
|
|
3882
3883
|
)
|
|
3883
3884
|
).get();
|
|
3884
3885
|
return t ? je(t) : null;
|
|
3885
3886
|
},
|
|
3886
3887
|
async getByCredentialId(i, e) {
|
|
3887
|
-
const t = await n.select().from(
|
|
3888
|
+
const t = await n.select().from(K).where(
|
|
3888
3889
|
g(
|
|
3889
|
-
a(
|
|
3890
|
-
a(
|
|
3890
|
+
a(K.tenant_id, i),
|
|
3891
|
+
a(K.credential_id, e)
|
|
3891
3892
|
)
|
|
3892
3893
|
).get();
|
|
3893
3894
|
return t ? je(t) : null;
|
|
3894
3895
|
},
|
|
3895
3896
|
async list(i, e) {
|
|
3896
|
-
return (await n.select().from(
|
|
3897
|
+
return (await n.select().from(K).where(
|
|
3897
3898
|
g(
|
|
3898
|
-
a(
|
|
3899
|
-
a(
|
|
3899
|
+
a(K.tenant_id, i),
|
|
3900
|
+
a(K.user_id, e)
|
|
3900
3901
|
)
|
|
3901
3902
|
).all()).map(je);
|
|
3902
3903
|
},
|
|
@@ -3904,10 +3905,10 @@ function ys(n) {
|
|
|
3904
3905
|
const r = {
|
|
3905
3906
|
updated_at_ts: Date.now()
|
|
3906
3907
|
};
|
|
3907
|
-
t.type !== void 0 && (r.type = t.type), t.phone_number !== void 0 && (r.phone_number = t.phone_number), t.totp_secret !== void 0 && (r.totp_secret = t.totp_secret), t.credential_id !== void 0 && (r.credential_id = t.credential_id), t.public_key !== void 0 && (r.public_key = t.public_key), t.sign_count !== void 0 && (r.sign_count = t.sign_count), t.credential_backed_up !== void 0 && (r.credential_backed_up = t.credential_backed_up ? 1 : 0), t.transports !== void 0 && (r.transports = JSON.stringify(t.transports)), t.friendly_name !== void 0 && (r.friendly_name = t.friendly_name), t.confirmed !== void 0 && (r.confirmed = t.confirmed ? 1 : 0), await n.update(
|
|
3908
|
+
t.type !== void 0 && (r.type = t.type), t.phone_number !== void 0 && (r.phone_number = t.phone_number), t.totp_secret !== void 0 && (r.totp_secret = t.totp_secret), t.credential_id !== void 0 && (r.credential_id = t.credential_id), t.public_key !== void 0 && (r.public_key = t.public_key), t.sign_count !== void 0 && (r.sign_count = t.sign_count), t.credential_backed_up !== void 0 && (r.credential_backed_up = t.credential_backed_up ? 1 : 0), t.transports !== void 0 && (r.transports = JSON.stringify(t.transports)), t.friendly_name !== void 0 && (r.friendly_name = t.friendly_name), t.confirmed !== void 0 && (r.confirmed = t.confirmed ? 1 : 0), await n.update(K).set(r).where(
|
|
3908
3909
|
g(
|
|
3909
|
-
a(
|
|
3910
|
-
a(
|
|
3910
|
+
a(K.tenant_id, i),
|
|
3911
|
+
a(K.id, e)
|
|
3911
3912
|
)
|
|
3912
3913
|
);
|
|
3913
3914
|
const o = await this.get(i, e);
|
|
@@ -3918,10 +3919,10 @@ function ys(n) {
|
|
|
3918
3919
|
return o;
|
|
3919
3920
|
},
|
|
3920
3921
|
async remove(i, e) {
|
|
3921
|
-
return (await n.delete(
|
|
3922
|
+
return (await n.delete(K).where(
|
|
3922
3923
|
g(
|
|
3923
|
-
a(
|
|
3924
|
-
a(
|
|
3924
|
+
a(K.tenant_id, i),
|
|
3925
|
+
a(K.id, e)
|
|
3925
3926
|
)
|
|
3926
3927
|
).returning()).length > 0;
|
|
3927
3928
|
}
|
|
@@ -3940,7 +3941,7 @@ function _t(n) {
|
|
|
3940
3941
|
token_quota: o,
|
|
3941
3942
|
...l
|
|
3942
3943
|
} = n;
|
|
3943
|
-
return
|
|
3944
|
+
return T({
|
|
3944
3945
|
...l,
|
|
3945
3946
|
branding: x(e, {}),
|
|
3946
3947
|
metadata: x(t, {}),
|
|
@@ -4148,21 +4149,33 @@ function dt(n) {
|
|
|
4148
4149
|
expires_at_ts: t,
|
|
4149
4150
|
idle_expires_at_ts: r,
|
|
4150
4151
|
last_exchanged_at_ts: o,
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4152
|
+
revoked_at_ts: l,
|
|
4153
|
+
device: _,
|
|
4154
|
+
resource_servers: u,
|
|
4155
|
+
rotating: c,
|
|
4156
|
+
...d
|
|
4157
|
+
} = n, h = Pe(
|
|
4158
|
+
{
|
|
4159
|
+
created_at_ts: e,
|
|
4160
|
+
expires_at_ts: t,
|
|
4161
|
+
idle_expires_at_ts: r,
|
|
4162
|
+
last_exchanged_at_ts: o,
|
|
4163
|
+
revoked_at_ts: l
|
|
4164
|
+
},
|
|
4157
4165
|
["created_at_ts"],
|
|
4158
|
-
[
|
|
4166
|
+
[
|
|
4167
|
+
"expires_at_ts",
|
|
4168
|
+
"idle_expires_at_ts",
|
|
4169
|
+
"last_exchanged_at_ts",
|
|
4170
|
+
"revoked_at_ts"
|
|
4171
|
+
]
|
|
4159
4172
|
);
|
|
4160
|
-
return
|
|
4161
|
-
...c,
|
|
4173
|
+
return T({
|
|
4162
4174
|
...d,
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4175
|
+
...h,
|
|
4176
|
+
rotating: !!c,
|
|
4177
|
+
device: x(_, {}),
|
|
4178
|
+
resource_servers: x(u, [])
|
|
4166
4179
|
});
|
|
4167
4180
|
}
|
|
4168
4181
|
function $t(n, i) {
|
|
@@ -4181,13 +4194,13 @@ function xs(n) {
|
|
|
4181
4194
|
resource_servers: JSON.stringify(e.resource_servers || []),
|
|
4182
4195
|
rotating: e.rotating ?? !1,
|
|
4183
4196
|
created_at_ts: t,
|
|
4184
|
-
expires_at_ts:
|
|
4185
|
-
idle_expires_at_ts:
|
|
4186
|
-
last_exchanged_at_ts:
|
|
4197
|
+
expires_at_ts: Q(e.expires_at),
|
|
4198
|
+
idle_expires_at_ts: Q(e.idle_expires_at),
|
|
4199
|
+
last_exchanged_at_ts: Q(e.last_exchanged_at)
|
|
4187
4200
|
};
|
|
4188
4201
|
await n.run(w`BEGIN`);
|
|
4189
4202
|
try {
|
|
4190
|
-
await n.insert(
|
|
4203
|
+
await n.insert(z).values(r);
|
|
4191
4204
|
const o = $t(
|
|
4192
4205
|
r.expires_at_ts,
|
|
4193
4206
|
r.idle_expires_at_ts
|
|
@@ -4208,32 +4221,32 @@ function xs(n) {
|
|
|
4208
4221
|
return dt({ ...r, tenant_id: i });
|
|
4209
4222
|
},
|
|
4210
4223
|
async get(i, e) {
|
|
4211
|
-
const t = await n.select().from(
|
|
4212
|
-
g(a(
|
|
4224
|
+
const t = await n.select().from(z).where(
|
|
4225
|
+
g(a(z.tenant_id, i), a(z.id, e))
|
|
4213
4226
|
).get();
|
|
4214
4227
|
return t ? dt(t) : null;
|
|
4215
4228
|
},
|
|
4216
4229
|
async update(i, e, t) {
|
|
4217
4230
|
const r = {};
|
|
4218
|
-
t.device !== void 0 && (r.device = JSON.stringify(t.device)), t.resource_servers !== void 0 && (r.resource_servers = JSON.stringify(t.resource_servers)), t.rotating !== void 0 && (r.rotating = t.rotating), t.expires_at !== void 0 && (r.expires_at_ts =
|
|
4231
|
+
t.device !== void 0 && (r.device = JSON.stringify(t.device)), t.resource_servers !== void 0 && (r.resource_servers = JSON.stringify(t.resource_servers)), t.rotating !== void 0 && (r.rotating = t.rotating), t.expires_at !== void 0 && (r.expires_at_ts = Q(t.expires_at)), t.idle_expires_at !== void 0 && (r.idle_expires_at_ts = Q(t.idle_expires_at)), t.last_exchanged_at !== void 0 && (r.last_exchanged_at_ts = Q(t.last_exchanged_at)), t.revoked_at !== void 0 && (r.revoked_at_ts = Q(t.revoked_at));
|
|
4219
4232
|
const o = r.expires_at_ts !== void 0 || r.idle_expires_at_ts !== void 0;
|
|
4220
4233
|
await n.run(w`BEGIN`);
|
|
4221
4234
|
try {
|
|
4222
|
-
const _ = (await n.update(
|
|
4235
|
+
const _ = (await n.update(z).set(r).where(
|
|
4223
4236
|
g(
|
|
4224
|
-
a(
|
|
4225
|
-
a(
|
|
4237
|
+
a(z.tenant_id, i),
|
|
4238
|
+
a(z.id, e)
|
|
4226
4239
|
)
|
|
4227
4240
|
).returning()).length > 0;
|
|
4228
4241
|
if (_ && o) {
|
|
4229
4242
|
const u = await n.select({
|
|
4230
|
-
login_id:
|
|
4231
|
-
expires_at_ts:
|
|
4232
|
-
idle_expires_at_ts:
|
|
4233
|
-
}).from(
|
|
4243
|
+
login_id: z.login_id,
|
|
4244
|
+
expires_at_ts: z.expires_at_ts,
|
|
4245
|
+
idle_expires_at_ts: z.idle_expires_at_ts
|
|
4246
|
+
}).from(z).where(
|
|
4234
4247
|
g(
|
|
4235
|
-
a(
|
|
4236
|
-
a(
|
|
4248
|
+
a(z.tenant_id, i),
|
|
4249
|
+
a(z.id, e)
|
|
4237
4250
|
)
|
|
4238
4251
|
).get();
|
|
4239
4252
|
if (u != null && u.login_id) {
|
|
@@ -4266,15 +4279,15 @@ function xs(n) {
|
|
|
4266
4279
|
sort: l,
|
|
4267
4280
|
q: _
|
|
4268
4281
|
} = e || {};
|
|
4269
|
-
let u = n.select().from(
|
|
4282
|
+
let u = n.select().from(z).where(a(z.tenant_id, i)).$dynamic();
|
|
4270
4283
|
if (_) {
|
|
4271
|
-
const f =
|
|
4284
|
+
const f = ye(z, _, ["user_id"]);
|
|
4272
4285
|
f && (u = u.where(
|
|
4273
|
-
g(a(
|
|
4286
|
+
g(a(z.tenant_id, i), f)
|
|
4274
4287
|
));
|
|
4275
4288
|
}
|
|
4276
4289
|
if (l != null && l.sort_by) {
|
|
4277
|
-
const f =
|
|
4290
|
+
const f = z[l.sort_by];
|
|
4278
4291
|
f && (u = u.orderBy(
|
|
4279
4292
|
l.sort_order === "desc" ? V(f) : G(f)
|
|
4280
4293
|
));
|
|
@@ -4282,7 +4295,7 @@ function xs(n) {
|
|
|
4282
4295
|
const d = (await u.offset(t * r).limit(r)).map(dt);
|
|
4283
4296
|
if (!o)
|
|
4284
4297
|
return { refresh_tokens: d };
|
|
4285
|
-
const [h] = await n.select({ count: R() }).from(
|
|
4298
|
+
const [h] = await n.select({ count: R() }).from(z).where(a(z.tenant_id, i));
|
|
4286
4299
|
return {
|
|
4287
4300
|
refresh_tokens: d,
|
|
4288
4301
|
start: t * r,
|
|
@@ -4291,9 +4304,18 @@ function xs(n) {
|
|
|
4291
4304
|
};
|
|
4292
4305
|
},
|
|
4293
4306
|
async remove(i, e) {
|
|
4294
|
-
return (await n.delete(
|
|
4295
|
-
g(a(
|
|
4307
|
+
return (await n.delete(z).where(
|
|
4308
|
+
g(a(z.tenant_id, i), a(z.id, e))
|
|
4296
4309
|
).returning()).length > 0;
|
|
4310
|
+
},
|
|
4311
|
+
async revokeByLoginSession(i, e, t) {
|
|
4312
|
+
return (await n.update(z).set({ revoked_at_ts: Q(t) }).where(
|
|
4313
|
+
g(
|
|
4314
|
+
a(z.tenant_id, i),
|
|
4315
|
+
a(z.login_id, e),
|
|
4316
|
+
me(z.revoked_at_ts)
|
|
4317
|
+
)
|
|
4318
|
+
).returning()).length;
|
|
4297
4319
|
}
|
|
4298
4320
|
};
|
|
4299
4321
|
}
|
|
@@ -4336,7 +4358,7 @@ function ct(n) {
|
|
|
4336
4358
|
_.scopes = x(t, []), _.options = x(r, {}), _.metadata = x(o), e !== void 0 && (_.verificationKey = e);
|
|
4337
4359
|
for (const u of xt)
|
|
4338
4360
|
l[u] !== void 0 && l[u] !== null && (_[u] = !!l[u]);
|
|
4339
|
-
return
|
|
4361
|
+
return T(_);
|
|
4340
4362
|
}
|
|
4341
4363
|
function Ds(n) {
|
|
4342
4364
|
return {
|
|
@@ -4560,7 +4582,7 @@ function ks(n) {
|
|
|
4560
4582
|
}
|
|
4561
4583
|
function gt(n) {
|
|
4562
4584
|
const { tenant_id: i, is_system: e, metadata: t, ...r } = n;
|
|
4563
|
-
return
|
|
4585
|
+
return T({
|
|
4564
4586
|
...r,
|
|
4565
4587
|
is_system: e ? !0 : void 0,
|
|
4566
4588
|
metadata: x(t)
|
|
@@ -4579,17 +4601,17 @@ function Is(n) {
|
|
|
4579
4601
|
created_at: t,
|
|
4580
4602
|
updated_at: t
|
|
4581
4603
|
};
|
|
4582
|
-
return await n.insert(
|
|
4604
|
+
return await n.insert(U).values(o), gt({ ...o, tenant_id: i });
|
|
4583
4605
|
},
|
|
4584
4606
|
async get(i, e) {
|
|
4585
|
-
const t = await n.select().from(
|
|
4607
|
+
const t = await n.select().from(U).where(g(a(U.tenant_id, i), a(U.id, e))).get();
|
|
4586
4608
|
return t ? gt(t) : null;
|
|
4587
4609
|
},
|
|
4588
4610
|
async update(i, e, t) {
|
|
4589
4611
|
const r = {
|
|
4590
4612
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
4591
4613
|
};
|
|
4592
|
-
return t.name !== void 0 && (r.name = t.name), t.description !== void 0 && (r.description = t.description), t.is_system !== void 0 && (r.is_system = t.is_system ? 1 : 0), t.metadata !== void 0 && (r.metadata = JSON.stringify(t.metadata)), (await n.update(
|
|
4614
|
+
return t.name !== void 0 && (r.name = t.name), t.description !== void 0 && (r.description = t.description), t.is_system !== void 0 && (r.is_system = t.is_system ? 1 : 0), t.metadata !== void 0 && (r.metadata = JSON.stringify(t.metadata)), (await n.update(U).set(r).where(g(a(U.tenant_id, i), a(U.id, e))).returning()).length > 0;
|
|
4593
4615
|
},
|
|
4594
4616
|
async list(i, e) {
|
|
4595
4617
|
const {
|
|
@@ -4598,10 +4620,10 @@ function Is(n) {
|
|
|
4598
4620
|
include_totals: o = !1,
|
|
4599
4621
|
sort: l,
|
|
4600
4622
|
q: _
|
|
4601
|
-
} = e || {}, u = _ ?
|
|
4602
|
-
let d = n.select().from(
|
|
4623
|
+
} = e || {}, u = _ ? ye(U, _, ["name"]) : void 0, c = u ? g(a(U.tenant_id, i), u) : a(U.tenant_id, i);
|
|
4624
|
+
let d = n.select().from(U).where(c).$dynamic();
|
|
4603
4625
|
if (l != null && l.sort_by) {
|
|
4604
|
-
const N =
|
|
4626
|
+
const N = U[l.sort_by];
|
|
4605
4627
|
N && (d = d.orderBy(
|
|
4606
4628
|
l.sort_order === "desc" ? V(N) : G(N)
|
|
4607
4629
|
));
|
|
@@ -4609,7 +4631,7 @@ function Is(n) {
|
|
|
4609
4631
|
const f = (await d.offset(t * r).limit(r)).map(gt);
|
|
4610
4632
|
if (!o)
|
|
4611
4633
|
return { roles: f };
|
|
4612
|
-
const [y] = await n.select({ count: R() }).from(
|
|
4634
|
+
const [y] = await n.select({ count: R() }).from(U).where(c);
|
|
4613
4635
|
return {
|
|
4614
4636
|
roles: f,
|
|
4615
4637
|
start: t * r,
|
|
@@ -4618,7 +4640,7 @@ function Is(n) {
|
|
|
4618
4640
|
};
|
|
4619
4641
|
},
|
|
4620
4642
|
async remove(i, e) {
|
|
4621
|
-
return (await n.delete(
|
|
4643
|
+
return (await n.delete(U).where(g(a(U.tenant_id, i), a(U.id, e))).returning()).length > 0;
|
|
4622
4644
|
}
|
|
4623
4645
|
};
|
|
4624
4646
|
}
|
|
@@ -4658,7 +4680,7 @@ function ft(n) {
|
|
|
4658
4680
|
[...zs],
|
|
4659
4681
|
[...Ts]
|
|
4660
4682
|
);
|
|
4661
|
-
return
|
|
4683
|
+
return T({
|
|
4662
4684
|
...f,
|
|
4663
4685
|
...y,
|
|
4664
4686
|
device: x(d, {}),
|
|
@@ -4677,12 +4699,12 @@ function qs(n) {
|
|
|
4677
4699
|
clients: JSON.stringify(e.clients || []),
|
|
4678
4700
|
created_at_ts: t,
|
|
4679
4701
|
updated_at_ts: t,
|
|
4680
|
-
expires_at_ts:
|
|
4681
|
-
idle_expires_at_ts:
|
|
4682
|
-
authenticated_at_ts: e.authenticated_at ?
|
|
4683
|
-
last_interaction_at_ts: e.last_interaction_at ?
|
|
4684
|
-
used_at_ts:
|
|
4685
|
-
revoked_at_ts:
|
|
4702
|
+
expires_at_ts: Q(e.expires_at),
|
|
4703
|
+
idle_expires_at_ts: Q(e.idle_expires_at),
|
|
4704
|
+
authenticated_at_ts: e.authenticated_at ? Q(e.authenticated_at) : t,
|
|
4705
|
+
last_interaction_at_ts: e.last_interaction_at ? Q(e.last_interaction_at) : t,
|
|
4706
|
+
used_at_ts: Q(e.used_at),
|
|
4707
|
+
revoked_at_ts: Q(e.revoked_at)
|
|
4686
4708
|
};
|
|
4687
4709
|
return await n.insert($).values(r), ft({ ...r, tenant_id: i });
|
|
4688
4710
|
},
|
|
@@ -4694,9 +4716,9 @@ function qs(n) {
|
|
|
4694
4716
|
const r = {
|
|
4695
4717
|
updated_at_ts: Date.now()
|
|
4696
4718
|
};
|
|
4697
|
-
return t.user_id !== void 0 && (r.user_id = t.user_id), t.login_session_id !== void 0 && (r.login_session_id = t.login_session_id), t.device !== void 0 && (r.device = JSON.stringify(t.device)), t.clients !== void 0 && (r.clients = JSON.stringify(t.clients)), t.expires_at !== void 0 && (r.expires_at_ts =
|
|
4719
|
+
return t.user_id !== void 0 && (r.user_id = t.user_id), t.login_session_id !== void 0 && (r.login_session_id = t.login_session_id), t.device !== void 0 && (r.device = JSON.stringify(t.device)), t.clients !== void 0 && (r.clients = JSON.stringify(t.clients)), t.expires_at !== void 0 && (r.expires_at_ts = Q(t.expires_at)), t.idle_expires_at !== void 0 && (r.idle_expires_at_ts = Q(t.idle_expires_at)), t.authenticated_at !== void 0 && (r.authenticated_at_ts = Q(t.authenticated_at)), t.last_interaction_at !== void 0 && (r.last_interaction_at_ts = Q(
|
|
4698
4720
|
t.last_interaction_at
|
|
4699
|
-
)), t.used_at !== void 0 && (r.used_at_ts =
|
|
4721
|
+
)), t.used_at !== void 0 && (r.used_at_ts = Q(t.used_at)), t.revoked_at !== void 0 && (r.revoked_at_ts = Q(t.revoked_at)), (await n.update($).set(r).where(g(a($.tenant_id, i), a($.id, e))).returning()).length > 0;
|
|
4700
4722
|
},
|
|
4701
4723
|
async list(i, e) {
|
|
4702
4724
|
const {
|
|
@@ -4705,7 +4727,7 @@ function qs(n) {
|
|
|
4705
4727
|
include_totals: o = !1,
|
|
4706
4728
|
sort: l,
|
|
4707
4729
|
q: _
|
|
4708
|
-
} = e || {}, u = _ ?
|
|
4730
|
+
} = e || {}, u = _ ? ye($, _, ["user_id"]) : void 0, c = u ? g(a($.tenant_id, i), u) : a($.tenant_id, i);
|
|
4709
4731
|
let d = n.select().from($).where(c).$dynamic();
|
|
4710
4732
|
if (l != null && l.sort_by) {
|
|
4711
4733
|
const N = $[l.sort_by];
|
|
@@ -4757,7 +4779,7 @@ function Jt(n) {
|
|
|
4757
4779
|
typeof i[e] == "string" && (i[e] = x(i[e]));
|
|
4758
4780
|
for (const e of mr)
|
|
4759
4781
|
i[e] !== void 0 && i[e] !== null && (i[e] = i[e] === 1);
|
|
4760
|
-
return
|
|
4782
|
+
return T(i);
|
|
4761
4783
|
}
|
|
4762
4784
|
function Pt(n) {
|
|
4763
4785
|
const i = { ...n };
|
|
@@ -4803,7 +4825,7 @@ function Ls(n) {
|
|
|
4803
4825
|
} = i || {};
|
|
4804
4826
|
let _ = n.select().from(D).$dynamic();
|
|
4805
4827
|
if (l) {
|
|
4806
|
-
const h =
|
|
4828
|
+
const h = ye(D, l, ["friendly_name"]);
|
|
4807
4829
|
h && (_ = _.where(h));
|
|
4808
4830
|
}
|
|
4809
4831
|
if (o != null && o.sort_by) {
|
|
@@ -4845,7 +4867,7 @@ const Es = [
|
|
|
4845
4867
|
];
|
|
4846
4868
|
function Ft(n) {
|
|
4847
4869
|
const { tenant_id: i, ...e } = n, t = fr(e, Es);
|
|
4848
|
-
return t.borders && (t.borders.show_widget_shadow = !!t.borders.show_widget_shadow), t.fonts && (t.fonts.links_bold = !!t.fonts.links_bold, t.fonts.subtitle_bold = !!t.fonts.subtitle_bold, t.fonts.title_bold = !!t.fonts.title_bold),
|
|
4870
|
+
return t.borders && (t.borders.show_widget_shadow = !!t.borders.show_widget_shadow), t.fonts && (t.fonts.links_bold = !!t.fonts.links_bold, t.fonts.subtitle_bold = !!t.fonts.subtitle_bold, t.fonts.title_bold = !!t.fonts.title_bold), T(t);
|
|
4849
4871
|
}
|
|
4850
4872
|
function Cs(n) {
|
|
4851
4873
|
return {
|
|
@@ -4930,7 +4952,7 @@ function pt(n, i = []) {
|
|
|
4930
4952
|
profileData: d,
|
|
4931
4953
|
...h
|
|
4932
4954
|
} = n, f = Ut(n, !0), y = i.map((N) => Ut(N, !1));
|
|
4933
|
-
return
|
|
4955
|
+
return T({
|
|
4934
4956
|
...h,
|
|
4935
4957
|
email: n.email || "",
|
|
4936
4958
|
email_verified: !!l,
|
|
@@ -5059,10 +5081,10 @@ function Bs(n) {
|
|
|
5059
5081
|
q: u
|
|
5060
5082
|
} = t || {}, c = [
|
|
5061
5083
|
a(k.tenant_id, e),
|
|
5062
|
-
|
|
5084
|
+
me(k.linked_to)
|
|
5063
5085
|
];
|
|
5064
5086
|
if (u) {
|
|
5065
|
-
const H =
|
|
5087
|
+
const H = ye(k, u, [
|
|
5066
5088
|
"email",
|
|
5067
5089
|
"name",
|
|
5068
5090
|
"nickname",
|
|
@@ -5106,10 +5128,10 @@ function Bs(n) {
|
|
|
5106
5128
|
const r = await n.select({ user_id: k.user_id }).from(k).where(
|
|
5107
5129
|
g(a(k.tenant_id, e), a(k.linked_to, t))
|
|
5108
5130
|
), o = [t, ...r.map((_) => _.user_id)];
|
|
5109
|
-
await n.delete(
|
|
5131
|
+
await n.delete(K).where(
|
|
5110
5132
|
g(
|
|
5111
|
-
a(
|
|
5112
|
-
Ne(
|
|
5133
|
+
a(K.tenant_id, e),
|
|
5134
|
+
Ne(K.user_id, o)
|
|
5113
5135
|
)
|
|
5114
5136
|
), await n.delete(A).where(
|
|
5115
5137
|
g(
|
|
@@ -5169,12 +5191,12 @@ function $s(n) {
|
|
|
5169
5191
|
}).from(ue).where(g(...o)).all();
|
|
5170
5192
|
return l.length === 0 ? [] : (await Promise.all(
|
|
5171
5193
|
l.map(async (u) => {
|
|
5172
|
-
const c = await n.select().from(
|
|
5173
|
-
g(a(
|
|
5194
|
+
const c = await n.select().from(U).where(
|
|
5195
|
+
g(a(U.tenant_id, i), a(U.id, u.role_id))
|
|
5174
5196
|
).get();
|
|
5175
5197
|
if (!c) return null;
|
|
5176
5198
|
const { tenant_id: d, is_system: h, metadata: f, ...y } = c;
|
|
5177
|
-
return
|
|
5199
|
+
return T({
|
|
5178
5200
|
...y,
|
|
5179
5201
|
is_system: h ? !0 : void 0,
|
|
5180
5202
|
metadata: x(f)
|
|
@@ -5207,7 +5229,7 @@ function Qs(n) {
|
|
|
5207
5229
|
updated_at: t
|
|
5208
5230
|
};
|
|
5209
5231
|
try {
|
|
5210
|
-
await n.insert(
|
|
5232
|
+
await n.insert(P).values(o);
|
|
5211
5233
|
} catch (d) {
|
|
5212
5234
|
throw (u = d == null ? void 0 : d.message) != null && u.includes("UNIQUE constraint") || (c = d == null ? void 0 : d.message) != null && c.includes("duplicate key") ? new be(409, {
|
|
5213
5235
|
message: "User organization already exists"
|
|
@@ -5217,10 +5239,10 @@ function Qs(n) {
|
|
|
5217
5239
|
return _;
|
|
5218
5240
|
},
|
|
5219
5241
|
async get(i, e) {
|
|
5220
|
-
const t = await n.select().from(
|
|
5242
|
+
const t = await n.select().from(P).where(
|
|
5221
5243
|
g(
|
|
5222
|
-
a(
|
|
5223
|
-
a(
|
|
5244
|
+
a(P.tenant_id, i),
|
|
5245
|
+
a(P.id, e)
|
|
5224
5246
|
)
|
|
5225
5247
|
).get();
|
|
5226
5248
|
if (!t) return null;
|
|
@@ -5231,10 +5253,10 @@ function Qs(n) {
|
|
|
5231
5253
|
const r = {
|
|
5232
5254
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5233
5255
|
};
|
|
5234
|
-
return t.user_id !== void 0 && (r.user_id = t.user_id), t.organization_id !== void 0 && (r.organization_id = t.organization_id), (await n.update(
|
|
5256
|
+
return t.user_id !== void 0 && (r.user_id = t.user_id), t.organization_id !== void 0 && (r.organization_id = t.organization_id), (await n.update(P).set(r).where(
|
|
5235
5257
|
g(
|
|
5236
|
-
a(
|
|
5237
|
-
a(
|
|
5258
|
+
a(P.tenant_id, i),
|
|
5259
|
+
a(P.id, e)
|
|
5238
5260
|
)
|
|
5239
5261
|
).returning()).length > 0;
|
|
5240
5262
|
},
|
|
@@ -5244,22 +5266,22 @@ function Qs(n) {
|
|
|
5244
5266
|
per_page: r = 50,
|
|
5245
5267
|
include_totals: o = !1,
|
|
5246
5268
|
q: l
|
|
5247
|
-
} = e || {}, _ = a(
|
|
5269
|
+
} = e || {}, _ = a(P.tenant_id, i);
|
|
5248
5270
|
let u = _;
|
|
5249
5271
|
if (l) {
|
|
5250
|
-
const f =
|
|
5272
|
+
const f = ye(P, l, [
|
|
5251
5273
|
"user_id",
|
|
5252
5274
|
"organization_id"
|
|
5253
5275
|
]);
|
|
5254
5276
|
f && (u = g(_, f));
|
|
5255
5277
|
}
|
|
5256
|
-
const d = (await n.select().from(
|
|
5278
|
+
const d = (await n.select().from(P).where(u).offset(t * r).limit(r)).map((f) => {
|
|
5257
5279
|
const { tenant_id: y, ...N } = f;
|
|
5258
5280
|
return N;
|
|
5259
5281
|
});
|
|
5260
5282
|
if (!o)
|
|
5261
5283
|
return { userOrganizations: d };
|
|
5262
|
-
const [h] = await n.select({ count: R() }).from(
|
|
5284
|
+
const [h] = await n.select({ count: R() }).from(P).where(u);
|
|
5263
5285
|
return {
|
|
5264
5286
|
userOrganizations: d,
|
|
5265
5287
|
start: t * r,
|
|
@@ -5268,10 +5290,10 @@ function Qs(n) {
|
|
|
5268
5290
|
};
|
|
5269
5291
|
},
|
|
5270
5292
|
async listUserOrganizations(i, e, t) {
|
|
5271
|
-
const { page: r = 0, per_page: o = 50, include_totals: l = !1 } = t || {}, _ = await n.select().from(
|
|
5293
|
+
const { page: r = 0, per_page: o = 50, include_totals: l = !1 } = t || {}, _ = await n.select().from(P).where(
|
|
5272
5294
|
g(
|
|
5273
|
-
a(
|
|
5274
|
-
a(
|
|
5295
|
+
a(P.tenant_id, i),
|
|
5296
|
+
a(P.user_id, e)
|
|
5275
5297
|
)
|
|
5276
5298
|
).offset(r * o).limit(o).all(), c = (await Promise.all(
|
|
5277
5299
|
_.map(async (h) => {
|
|
@@ -5290,7 +5312,7 @@ function Qs(n) {
|
|
|
5290
5312
|
token_quota: H,
|
|
5291
5313
|
...ke
|
|
5292
5314
|
} = f;
|
|
5293
|
-
return
|
|
5315
|
+
return T({
|
|
5294
5316
|
...ke,
|
|
5295
5317
|
branding: x(N, {}),
|
|
5296
5318
|
metadata: x(B, {}),
|
|
@@ -5301,10 +5323,10 @@ function Qs(n) {
|
|
|
5301
5323
|
)).filter(Boolean);
|
|
5302
5324
|
if (!l)
|
|
5303
5325
|
return { organizations: c };
|
|
5304
|
-
const [d] = await n.select({ count: R() }).from(
|
|
5326
|
+
const [d] = await n.select({ count: R() }).from(P).where(
|
|
5305
5327
|
g(
|
|
5306
|
-
a(
|
|
5307
|
-
a(
|
|
5328
|
+
a(P.tenant_id, i),
|
|
5329
|
+
a(P.user_id, e)
|
|
5308
5330
|
)
|
|
5309
5331
|
);
|
|
5310
5332
|
return {
|
|
@@ -5315,10 +5337,10 @@ function Qs(n) {
|
|
|
5315
5337
|
};
|
|
5316
5338
|
},
|
|
5317
5339
|
async remove(i, e) {
|
|
5318
|
-
return (await n.delete(
|
|
5340
|
+
return (await n.delete(P).where(
|
|
5319
5341
|
g(
|
|
5320
|
-
a(
|
|
5321
|
-
a(
|
|
5342
|
+
a(P.tenant_id, i),
|
|
5343
|
+
a(P.id, e)
|
|
5322
5344
|
)
|
|
5323
5345
|
).returning()).length > 0;
|
|
5324
5346
|
}
|
|
@@ -5410,13 +5432,13 @@ function Fs(n) {
|
|
|
5410
5432
|
const e = (/* @__PURE__ */ new Date()).toISOString();
|
|
5411
5433
|
return (await n.select().from(b).where(
|
|
5412
5434
|
g(
|
|
5413
|
-
|
|
5435
|
+
me(b.processed_at),
|
|
5414
5436
|
de(
|
|
5415
|
-
|
|
5437
|
+
me(b.next_retry_at),
|
|
5416
5438
|
Oe(b.next_retry_at, e)
|
|
5417
5439
|
),
|
|
5418
5440
|
de(
|
|
5419
|
-
|
|
5441
|
+
me(b.claimed_by),
|
|
5420
5442
|
Oe(b.claim_expires_at, e)
|
|
5421
5443
|
)
|
|
5422
5444
|
)
|
|
@@ -5431,9 +5453,9 @@ function Fs(n) {
|
|
|
5431
5453
|
}).where(
|
|
5432
5454
|
g(
|
|
5433
5455
|
Ne(b.id, i),
|
|
5434
|
-
|
|
5456
|
+
me(b.processed_at),
|
|
5435
5457
|
de(
|
|
5436
|
-
|
|
5458
|
+
me(b.claimed_by),
|
|
5437
5459
|
Oe(b.claim_expires_at, r)
|
|
5438
5460
|
)
|
|
5439
5461
|
)
|
|
@@ -5531,11 +5553,11 @@ function Ks(n) {
|
|
|
5531
5553
|
try {
|
|
5532
5554
|
let t = [
|
|
5533
5555
|
de(
|
|
5534
|
-
we(
|
|
5535
|
-
we(
|
|
5556
|
+
we(z.expires_at_ts, e),
|
|
5557
|
+
we(z.idle_expires_at_ts, e)
|
|
5536
5558
|
)
|
|
5537
5559
|
];
|
|
5538
|
-
i != null && i.tenant_id && t.push(a(
|
|
5560
|
+
i != null && i.tenant_id && t.push(a(z.tenant_id, i.tenant_id)), await n.delete(z).where(g(...t)), t = [
|
|
5539
5561
|
de(
|
|
5540
5562
|
we($.expires_at_ts, e),
|
|
5541
5563
|
we($.idle_expires_at_ts, e)
|