@authhero/kysely-adapter 10.1.0 → 10.3.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/kysely-adapter.cjs +1 -1
- package/dist/kysely-adapter.d.ts +3 -0
- package/dist/kysely-adapter.mjs +283 -280
- package/package.json +3 -3
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -4,7 +4,7 @@ var le = (t) => {
|
|
|
4
4
|
};
|
|
5
5
|
var Ee = (t, e, a) => e in t ? ze(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
6
6
|
var j = (t, e, a) => Ee(t, typeof e != "symbol" ? e + "" : e, a), R = (t, e, a) => e.has(t) || le("Cannot " + a);
|
|
7
|
-
var
|
|
7
|
+
var d = (t, e, a) => (R(t, e, "read from private field"), a ? a.call(t) : e.get(t)), y = (t, e, a) => e.has(t) ? le("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), M = (t, e, a, r) => (R(t, e, "write to private field"), r ? r.call(t, a) : e.set(t, a), a), u = (t, e, a) => (R(t, e, "access private method"), a);
|
|
8
8
|
import { parseUserId as Y, codeSchema as Je, connectionSchema as Ke, loginSessionSchema as Re, promptSettingSchema as Ue } from "@authhero/adapter-interfaces";
|
|
9
9
|
import "@hono/zod-openapi";
|
|
10
10
|
var V = class extends Error {
|
|
@@ -25,8 +25,8 @@ var V = class extends Error {
|
|
|
25
25
|
};
|
|
26
26
|
function Be(t) {
|
|
27
27
|
return async (e, a) => {
|
|
28
|
-
const { identities: r, ...
|
|
29
|
-
...
|
|
28
|
+
const { identities: r, ...o } = a, n = {
|
|
29
|
+
...o,
|
|
30
30
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
31
31
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32
32
|
login_count: 0,
|
|
@@ -37,16 +37,16 @@ function Be(t) {
|
|
|
37
37
|
user_metadata: JSON.stringify(a.user_metadata)
|
|
38
38
|
};
|
|
39
39
|
try {
|
|
40
|
-
await t.insertInto("users").values(
|
|
40
|
+
await t.insertInto("users").values(n).execute();
|
|
41
41
|
} catch (s) {
|
|
42
42
|
throw s.code === "SQLITE_CONSTRAINT_UNIQUE" || s.message.includes("AlreadyExists") ? new V(409, { message: "User already exists" }) : new V(500, { message: `${s.code}, ${s.message}` });
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
|
-
...
|
|
45
|
+
...n,
|
|
46
46
|
// TODO: check if this is correct. Should it be optional?
|
|
47
|
-
email:
|
|
48
|
-
email_verified:
|
|
49
|
-
is_social:
|
|
47
|
+
email: n.email || "",
|
|
48
|
+
email_verified: n.email_verified === 1,
|
|
49
|
+
is_social: n.is_social === 1
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
}
|
|
@@ -77,13 +77,13 @@ function fe(t) {
|
|
|
77
77
|
}
|
|
78
78
|
function Qe(t) {
|
|
79
79
|
return async (e, a) => {
|
|
80
|
-
const [r,
|
|
80
|
+
const [r, o] = await Promise.all([
|
|
81
81
|
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).selectAll().executeTakeFirst(),
|
|
82
82
|
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", a).selectAll().execute()
|
|
83
83
|
]);
|
|
84
84
|
if (!r)
|
|
85
85
|
return null;
|
|
86
|
-
const { tenant_id:
|
|
86
|
+
const { tenant_id: n, ...s } = r, l = {
|
|
87
87
|
...s,
|
|
88
88
|
email: r.email || "",
|
|
89
89
|
email_verified: r.email_verified === 1,
|
|
@@ -97,39 +97,39 @@ function Qe(t) {
|
|
|
97
97
|
user_id: Y(r.user_id).id,
|
|
98
98
|
isSocial: !!r.is_social
|
|
99
99
|
},
|
|
100
|
-
...
|
|
100
|
+
...o.map(fe)
|
|
101
101
|
]
|
|
102
102
|
};
|
|
103
103
|
return _(l);
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function O(t, e, a, r) {
|
|
107
|
-
return a.split(/\s+/).map((
|
|
108
|
-
let s =
|
|
109
|
-
return
|
|
110
|
-
}).forEach(({ key:
|
|
111
|
-
if (
|
|
112
|
-
if (
|
|
113
|
-
l ? e = e.where(
|
|
107
|
+
return a.split(/\s+/).map((n) => n.replace(/^([^:]+)=/g, "$1:")).map((n) => {
|
|
108
|
+
let s = n.startsWith("-"), l, c, g, m;
|
|
109
|
+
return n.startsWith("-_exists_:") ? (l = n.substring(10), g = !0, s = !0) : n.startsWith("_exists_:") ? (l = n.substring(9), g = !0, s = !1) : n.includes(":") ? (s = n.startsWith("-"), [l, c] = s ? n.substring(1).split(":") : n.split(":"), g = !1, c.startsWith(">=") ? (m = ">=", c = c.substring(2)) : c.startsWith(">") ? (m = ">", c = c.substring(1)) : c.startsWith("<=") ? (m = "<=", c = c.substring(2)) : c.startsWith("<") ? (m = "<", c = c.substring(1)) : m = "=") : (l = null, c = n, g = !1), { key: l, value: c, isNegation: s, isExistsQuery: g, operator: m };
|
|
110
|
+
}).forEach(({ key: n, value: s, isNegation: l, isExistsQuery: c, operator: g }) => {
|
|
111
|
+
if (n)
|
|
112
|
+
if (c)
|
|
113
|
+
l ? e = e.where(n, "is", null) : e = e.where(n, "is not", null);
|
|
114
114
|
else if (l)
|
|
115
115
|
switch (g) {
|
|
116
116
|
case ">":
|
|
117
|
-
e = e.where(
|
|
117
|
+
e = e.where(n, "<=", s);
|
|
118
118
|
break;
|
|
119
119
|
case ">=":
|
|
120
|
-
e = e.where(
|
|
120
|
+
e = e.where(n, "<", s);
|
|
121
121
|
break;
|
|
122
122
|
case "<":
|
|
123
|
-
e = e.where(
|
|
123
|
+
e = e.where(n, ">=", s);
|
|
124
124
|
break;
|
|
125
125
|
case "<=":
|
|
126
|
-
e = e.where(
|
|
126
|
+
e = e.where(n, ">", s);
|
|
127
127
|
break;
|
|
128
128
|
default:
|
|
129
|
-
e = e.where(
|
|
129
|
+
e = e.where(n, "!=", s);
|
|
130
130
|
}
|
|
131
131
|
else
|
|
132
|
-
e = e.where(
|
|
132
|
+
e = e.where(n, g, s);
|
|
133
133
|
else {
|
|
134
134
|
const { ref: m } = t.dynamic;
|
|
135
135
|
e = e.where(
|
|
@@ -154,7 +154,7 @@ function Ve(t) {
|
|
|
154
154
|
const { ref: m } = t.dynamic;
|
|
155
155
|
r = r.orderBy(m(a.sort.sort_by), a.sort.sort_order);
|
|
156
156
|
}
|
|
157
|
-
const
|
|
157
|
+
const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), s = n.map((m) => m.user_id), l = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], c = n.map((m) => {
|
|
158
158
|
const w = l.filter(
|
|
159
159
|
(b) => b.linked_to === m.user_id
|
|
160
160
|
);
|
|
@@ -176,7 +176,7 @@ function Ve(t) {
|
|
|
176
176
|
});
|
|
177
177
|
}), { count: g } = await r.select((m) => m.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
178
178
|
return {
|
|
179
|
-
users:
|
|
179
|
+
users: c,
|
|
180
180
|
start: a.page * a.per_page,
|
|
181
181
|
limit: a.per_page,
|
|
182
182
|
length: x(g)
|
|
@@ -192,18 +192,18 @@ function qe(t) {
|
|
|
192
192
|
}
|
|
193
193
|
function Ge(t) {
|
|
194
194
|
return async (e, a, r) => {
|
|
195
|
-
const
|
|
195
|
+
const o = {
|
|
196
196
|
...r,
|
|
197
197
|
email_verified: qe(r),
|
|
198
198
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
199
199
|
};
|
|
200
|
-
return r.app_metadata && (
|
|
200
|
+
return r.app_metadata && (o.app_metadata = JSON.stringify(r.app_metadata)), r.user_metadata && (o.user_metadata = JSON.stringify(r.user_metadata)), (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1;
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
function He(t) {
|
|
204
|
-
return async (e, a, r,
|
|
205
|
-
const
|
|
206
|
-
return (await t.updateTable("users").set(
|
|
204
|
+
return async (e, a, r, o) => {
|
|
205
|
+
const n = { linked_to: null };
|
|
206
|
+
return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", `${r}|${o}`).where("users.linked_to", "=", `${a}`).execute()).length === 1;
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
function Xe(t) {
|
|
@@ -253,14 +253,14 @@ function tt(t) {
|
|
|
253
253
|
a = a.orderBy(l(e.sort.sort_by), e.sort.sort_order);
|
|
254
254
|
}
|
|
255
255
|
e.q && (a = a.where((l) => l.or([l("name", "like", `%${e.q}%`)])));
|
|
256
|
-
const
|
|
256
|
+
const o = await a.offset(e.page * e.per_page).limit(e.per_page).selectAll().execute();
|
|
257
257
|
if (!e.include_totals)
|
|
258
258
|
return {
|
|
259
|
-
tenants:
|
|
259
|
+
tenants: o
|
|
260
260
|
};
|
|
261
|
-
const { count:
|
|
261
|
+
const { count: n } = await a.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = x(n);
|
|
262
262
|
return {
|
|
263
|
-
tenants:
|
|
263
|
+
tenants: o.map(_),
|
|
264
264
|
start: (e.page - 1) * e.per_page,
|
|
265
265
|
limit: e.per_page,
|
|
266
266
|
length: s
|
|
@@ -295,7 +295,7 @@ function ue(t) {
|
|
|
295
295
|
const ot = 1024;
|
|
296
296
|
function st(t) {
|
|
297
297
|
return async (e, a) => {
|
|
298
|
-
var
|
|
298
|
+
var o, n, s;
|
|
299
299
|
const r = {
|
|
300
300
|
id: k(),
|
|
301
301
|
...a,
|
|
@@ -304,10 +304,10 @@ function st(t) {
|
|
|
304
304
|
return await t.insertInto("logs").values({
|
|
305
305
|
...r,
|
|
306
306
|
// Truncate long strings to avoid database errors
|
|
307
|
-
description: (
|
|
307
|
+
description: (o = r.description) == null ? void 0 : o.substring(0, 256),
|
|
308
308
|
isMobile: a.isMobile ? 1 : 0,
|
|
309
309
|
tenant_id: e,
|
|
310
|
-
scope: (
|
|
310
|
+
scope: (n = a.scope) == null ? void 0 : n.join(","),
|
|
311
311
|
auth0_client: ue(a.auth0_client),
|
|
312
312
|
details: (s = ue(a.details)) == null ? void 0 : s.substring(0, 8192)
|
|
313
313
|
}).execute(), r;
|
|
@@ -343,35 +343,35 @@ function it(t) {
|
|
|
343
343
|
}) => {
|
|
344
344
|
let r = t.selectFrom("logs").where("logs.tenant_id", "=", e);
|
|
345
345
|
a.q && (r = O(t, r, a.q, ["user_id", "ip"]));
|
|
346
|
-
let
|
|
346
|
+
let o = r;
|
|
347
347
|
if (a.sort && a.sort.sort_by) {
|
|
348
348
|
const { ref: l } = t.dynamic;
|
|
349
|
-
|
|
349
|
+
o = o.orderBy(
|
|
350
350
|
l(a.sort.sort_by),
|
|
351
351
|
a.sort.sort_order
|
|
352
352
|
);
|
|
353
353
|
}
|
|
354
|
-
|
|
355
|
-
const
|
|
354
|
+
o = o.offset(a.page * a.per_page).limit(a.per_page);
|
|
355
|
+
const n = await o.selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
356
356
|
return {
|
|
357
|
-
logs:
|
|
357
|
+
logs: n.map(pe),
|
|
358
358
|
start: a.page * a.per_page,
|
|
359
359
|
limit: a.per_page,
|
|
360
360
|
length: x(s)
|
|
361
361
|
};
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function ct(t) {
|
|
365
365
|
return async (e, a) => {
|
|
366
366
|
const r = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", a).selectAll().executeTakeFirst();
|
|
367
367
|
return r ? pe(r) : null;
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function dt(t) {
|
|
371
371
|
return {
|
|
372
372
|
create: st(t),
|
|
373
373
|
list: it(t),
|
|
374
|
-
get:
|
|
374
|
+
get: ct(t)
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
377
|
function lt(t) {
|
|
@@ -379,10 +379,10 @@ function lt(t) {
|
|
|
379
379
|
const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", a).selectAll().executeTakeFirst();
|
|
380
380
|
if (!r)
|
|
381
381
|
return null;
|
|
382
|
-
const { tenant_id:
|
|
382
|
+
const { tenant_id: o, device: n, clients: s, ...l } = r;
|
|
383
383
|
return {
|
|
384
384
|
...l,
|
|
385
|
-
device: JSON.parse(
|
|
385
|
+
device: JSON.parse(n),
|
|
386
386
|
clients: JSON.parse(s)
|
|
387
387
|
};
|
|
388
388
|
};
|
|
@@ -409,13 +409,13 @@ function mt(t) {
|
|
|
409
409
|
}
|
|
410
410
|
function ht(t) {
|
|
411
411
|
return async (e, a, r) => {
|
|
412
|
-
const
|
|
412
|
+
const o = {
|
|
413
413
|
...r,
|
|
414
414
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
415
415
|
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
416
416
|
clients: r.clients ? JSON.stringify(r.clients) : void 0
|
|
417
417
|
};
|
|
418
|
-
return !!(await t.updateTable("sessions").set(
|
|
418
|
+
return !!(await t.updateTable("sessions").set(o).where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
421
|
function _t(t) {
|
|
@@ -426,21 +426,21 @@ function _t(t) {
|
|
|
426
426
|
}) => {
|
|
427
427
|
let r = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
|
|
428
428
|
a.q && (r = O(t, r, a.q, ["user_id", "session_id"]));
|
|
429
|
-
let
|
|
429
|
+
let o = r;
|
|
430
430
|
if (a.sort && a.sort.sort_by) {
|
|
431
|
-
const { ref:
|
|
432
|
-
|
|
433
|
-
|
|
431
|
+
const { ref: c } = t.dynamic;
|
|
432
|
+
o = o.orderBy(
|
|
433
|
+
c(a.sort.sort_by),
|
|
434
434
|
a.sort.sort_order
|
|
435
435
|
);
|
|
436
436
|
}
|
|
437
|
-
|
|
438
|
-
const
|
|
437
|
+
o = o.offset(a.page * a.per_page).limit(a.per_page);
|
|
438
|
+
const n = await o.selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
|
|
439
439
|
return {
|
|
440
|
-
sessions:
|
|
441
|
-
...
|
|
442
|
-
device: JSON.parse(
|
|
443
|
-
clients: JSON.parse(
|
|
440
|
+
sessions: n.map((c) => ({
|
|
441
|
+
...c,
|
|
442
|
+
device: JSON.parse(c.device),
|
|
443
|
+
clients: JSON.parse(c.clients)
|
|
444
444
|
})),
|
|
445
445
|
start: a.page * a.per_page,
|
|
446
446
|
limit: a.per_page,
|
|
@@ -462,8 +462,8 @@ function pt(t) {
|
|
|
462
462
|
const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", a).selectAll().executeTakeFirst();
|
|
463
463
|
if (!r)
|
|
464
464
|
return null;
|
|
465
|
-
const { tenant_id:
|
|
466
|
-
return
|
|
465
|
+
const { tenant_id: o, ...n } = r;
|
|
466
|
+
return n;
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
469
|
function gt(t) {
|
|
@@ -500,10 +500,10 @@ function vt(t) {
|
|
|
500
500
|
}) => {
|
|
501
501
|
let r = t.selectFrom("codes").where("codes.tenant_id", "=", e);
|
|
502
502
|
a.q && (r = O(t, r, a.q, ["code", "login_id"]));
|
|
503
|
-
const
|
|
503
|
+
const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
504
504
|
return {
|
|
505
|
-
codes:
|
|
506
|
-
const { tenant_id: g, ...m } =
|
|
505
|
+
codes: n.map((c) => {
|
|
506
|
+
const { tenant_id: g, ...m } = c;
|
|
507
507
|
return Je.parse(_(m));
|
|
508
508
|
}),
|
|
509
509
|
start: a.page * a.per_page,
|
|
@@ -529,10 +529,10 @@ function Ct(t) {
|
|
|
529
529
|
}
|
|
530
530
|
function bt(t) {
|
|
531
531
|
return async (e, a, r) => {
|
|
532
|
-
let
|
|
533
|
-
e.length && (
|
|
534
|
-
const
|
|
535
|
-
return
|
|
532
|
+
let o = t.selectFrom("codes").where("codes.code_id", "=", a).where("codes.code_type", "=", r);
|
|
533
|
+
e.length && (o = o.where("codes.tenant_id", "=", e));
|
|
534
|
+
const n = await o.selectAll().executeTakeFirst();
|
|
535
|
+
return n ? _(n) : null;
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
538
|
function xt(t) {
|
|
@@ -553,31 +553,31 @@ function St(t) {
|
|
|
553
553
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
554
554
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
555
555
|
...a
|
|
556
|
-
},
|
|
556
|
+
}, o = JSON.stringify(a.allowed_origins), n = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), l = JSON.stringify(a.allowed_logout_urls), c = JSON.stringify(a.allowed_clients);
|
|
557
557
|
return await t.insertInto("applications").values({
|
|
558
558
|
...r,
|
|
559
559
|
tenant_id: e,
|
|
560
560
|
disable_sign_ups: a.disable_sign_ups ? 1 : 0,
|
|
561
561
|
addons: a.addons ? JSON.stringify(a.addons) : "{}",
|
|
562
|
-
callbacks:
|
|
563
|
-
allowed_origins:
|
|
562
|
+
callbacks: n,
|
|
563
|
+
allowed_origins: o,
|
|
564
564
|
web_origins: s,
|
|
565
565
|
allowed_logout_urls: l,
|
|
566
|
-
allowed_clients:
|
|
566
|
+
allowed_clients: c
|
|
567
567
|
}).execute(), r;
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
570
|
function Ot(t) {
|
|
571
571
|
return async (e) => ({
|
|
572
|
-
applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((
|
|
573
|
-
...
|
|
574
|
-
disable_sign_ups: !!
|
|
575
|
-
addons:
|
|
576
|
-
callbacks:
|
|
577
|
-
allowed_origins:
|
|
578
|
-
web_origins:
|
|
579
|
-
allowed_logout_urls:
|
|
580
|
-
allowed_clients:
|
|
572
|
+
applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((n) => ({
|
|
573
|
+
...n,
|
|
574
|
+
disable_sign_ups: !!n.disable_sign_ups,
|
|
575
|
+
addons: n.addons ? JSON.parse(n.addons) : {},
|
|
576
|
+
callbacks: n.callbacks ? JSON.parse(n.callbacks) : [],
|
|
577
|
+
allowed_origins: n.allowed_origins ? JSON.parse(n.allowed_origins) : [],
|
|
578
|
+
web_origins: n.web_origins ? JSON.parse(n.web_origins) : [],
|
|
579
|
+
allowed_logout_urls: n.allowed_logout_urls ? JSON.parse(n.allowed_logout_urls) : [],
|
|
580
|
+
allowed_clients: n.allowed_logout_urls ? JSON.parse(n.allowed_logout_urls) : []
|
|
581
581
|
}))
|
|
582
582
|
});
|
|
583
583
|
}
|
|
@@ -600,7 +600,7 @@ function $t(t) {
|
|
|
600
600
|
}
|
|
601
601
|
function Dt(t) {
|
|
602
602
|
return async (e, a, r) => {
|
|
603
|
-
const
|
|
603
|
+
const o = {
|
|
604
604
|
...r,
|
|
605
605
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
606
606
|
allowed_origins: r.allowed_origins ? JSON.stringify(r.allowed_origins) : void 0,
|
|
@@ -611,7 +611,7 @@ function Dt(t) {
|
|
|
611
611
|
addons: r.addons ? JSON.stringify(r.addons) : "{}",
|
|
612
612
|
disable_sign_ups: r.disable_sign_ups ? 1 : 0
|
|
613
613
|
};
|
|
614
|
-
return await t.updateTable("applications").set(
|
|
614
|
+
return await t.updateTable("applications").set(o).where("applications.id", "=", a).where("applications.tenant_id", "=", e).execute(), !0;
|
|
615
615
|
};
|
|
616
616
|
}
|
|
617
617
|
function It(t) {
|
|
@@ -648,11 +648,11 @@ function jt(t) {
|
|
|
648
648
|
let r = t.selectFrom("connections").where("connections.tenant_id", "=", e);
|
|
649
649
|
a.q && (r = O(t, r, a.q, ["user_id", "ip"]));
|
|
650
650
|
const s = (await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute()).map(
|
|
651
|
-
(
|
|
652
|
-
...
|
|
653
|
-
options: JSON.parse(
|
|
651
|
+
(c) => _({
|
|
652
|
+
...c,
|
|
653
|
+
options: JSON.parse(c.options)
|
|
654
654
|
})
|
|
655
|
-
), { count: l } = await r.select((
|
|
655
|
+
), { count: l } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
656
656
|
return {
|
|
657
657
|
connections: s,
|
|
658
658
|
start: a.page * a.per_page,
|
|
@@ -675,13 +675,13 @@ function Ft(t) {
|
|
|
675
675
|
}
|
|
676
676
|
function At(t) {
|
|
677
677
|
return async (e, a, r) => {
|
|
678
|
-
const
|
|
678
|
+
const o = {
|
|
679
679
|
...r,
|
|
680
680
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
681
681
|
};
|
|
682
682
|
return await t.updateTable("connections").set({
|
|
683
|
-
...
|
|
684
|
-
options:
|
|
683
|
+
...o,
|
|
684
|
+
options: o.options ? JSON.stringify(o.options) : void 0
|
|
685
685
|
}).where("connections.id", "=", a).where("connections.tenant_id", "=", e).execute(), !0;
|
|
686
686
|
};
|
|
687
687
|
}
|
|
@@ -703,10 +703,10 @@ function zt(t) {
|
|
|
703
703
|
const r = await t.selectFrom("tenants").selectAll().where("id", "=", a.tenant_id).executeTakeFirst();
|
|
704
704
|
if (!r)
|
|
705
705
|
throw new V(404, { message: "Tenant not found" });
|
|
706
|
-
const
|
|
706
|
+
const o = await t.selectFrom("connections").where("tenant_id", "=", a.tenant_id).selectAll().execute();
|
|
707
707
|
return {
|
|
708
708
|
...a,
|
|
709
|
-
connections:
|
|
709
|
+
connections: o.map(
|
|
710
710
|
(s) => Ke.parse(
|
|
711
711
|
_({
|
|
712
712
|
...s,
|
|
@@ -787,12 +787,12 @@ function Vt(t) {
|
|
|
787
787
|
}
|
|
788
788
|
function Wt(t) {
|
|
789
789
|
return async (e, a, r) => {
|
|
790
|
-
const
|
|
790
|
+
const o = {
|
|
791
791
|
...r,
|
|
792
792
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
793
793
|
primary: r.primary ? 1 : 0
|
|
794
794
|
};
|
|
795
|
-
return (await t.updateTable("custom_domains").set(
|
|
795
|
+
return (await t.updateTable("custom_domains").set(o).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).execute()).length > 0;
|
|
796
796
|
};
|
|
797
797
|
}
|
|
798
798
|
function qt(t) {
|
|
@@ -811,23 +811,23 @@ function Gt(t) {
|
|
|
811
811
|
return null;
|
|
812
812
|
const {
|
|
813
813
|
tenant_id: r,
|
|
814
|
-
colors_primary:
|
|
815
|
-
colors_page_background_type:
|
|
814
|
+
colors_primary: o,
|
|
815
|
+
colors_page_background_type: n,
|
|
816
816
|
colors_page_background_start: s,
|
|
817
817
|
colors_page_background_end: l,
|
|
818
|
-
colors_page_background_angle_dev:
|
|
818
|
+
colors_page_background_angle_dev: c,
|
|
819
819
|
font_url: g,
|
|
820
820
|
...m
|
|
821
821
|
} = a;
|
|
822
822
|
return _({
|
|
823
823
|
...m,
|
|
824
824
|
colors: {
|
|
825
|
-
primary:
|
|
825
|
+
primary: o,
|
|
826
826
|
page_background: {
|
|
827
|
-
type:
|
|
827
|
+
type: n,
|
|
828
828
|
start: s,
|
|
829
829
|
end: l,
|
|
830
|
-
angle_deg:
|
|
830
|
+
angle_deg: c
|
|
831
831
|
}
|
|
832
832
|
},
|
|
833
833
|
font: g ? { url: g } : void 0
|
|
@@ -836,14 +836,14 @@ function Gt(t) {
|
|
|
836
836
|
}
|
|
837
837
|
function Ht(t) {
|
|
838
838
|
return async (e, a) => {
|
|
839
|
-
var s, l,
|
|
840
|
-
const { colors: r, font:
|
|
839
|
+
var s, l, c, g, m, w, b, Z, ee, te, ae, re, ne, oe, se, ie, ce, de;
|
|
840
|
+
const { colors: r, font: o, ...n } = a;
|
|
841
841
|
try {
|
|
842
842
|
await t.insertInto("branding").values({
|
|
843
|
-
...
|
|
843
|
+
...n,
|
|
844
844
|
colors_primary: r == null ? void 0 : r.primary,
|
|
845
845
|
colors_page_background_type: (l = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : l.type,
|
|
846
|
-
colors_page_background_start: (g = (
|
|
846
|
+
colors_page_background_start: (g = (c = a.colors) == null ? void 0 : c.page_background) == null ? void 0 : g.start,
|
|
847
847
|
colors_page_background_end: (w = (m = a.colors) == null ? void 0 : m.page_background) == null ? void 0 : w.end,
|
|
848
848
|
colors_page_background_angle_dev: (Z = (b = a.colors) == null ? void 0 : b.page_background) == null ? void 0 : Z.angle_deg,
|
|
849
849
|
font_url: (ee = a.font) == null ? void 0 : ee.url,
|
|
@@ -851,13 +851,13 @@ function Ht(t) {
|
|
|
851
851
|
}).execute();
|
|
852
852
|
} catch {
|
|
853
853
|
await t.updateTable("branding").set({
|
|
854
|
-
...
|
|
854
|
+
...n,
|
|
855
855
|
colors_primary: r == null ? void 0 : r.primary,
|
|
856
856
|
colors_page_background_type: (ae = (te = a.colors) == null ? void 0 : te.page_background) == null ? void 0 : ae.type,
|
|
857
857
|
colors_page_background_start: (ne = (re = a.colors) == null ? void 0 : re.page_background) == null ? void 0 : ne.start,
|
|
858
858
|
colors_page_background_end: (se = (oe = a.colors) == null ? void 0 : oe.page_background) == null ? void 0 : se.end,
|
|
859
|
-
colors_page_background_angle_dev: (
|
|
860
|
-
font_url: (
|
|
859
|
+
colors_page_background_angle_dev: (ce = (ie = a.colors) == null ? void 0 : ie.page_background) == null ? void 0 : ce.angle_deg,
|
|
860
|
+
font_url: (de = a.font) == null ? void 0 : de.url
|
|
861
861
|
}).where("tenant_id", "=", e).execute();
|
|
862
862
|
}
|
|
863
863
|
};
|
|
@@ -876,10 +876,10 @@ function Yt(t) {
|
|
|
876
876
|
}) => {
|
|
877
877
|
let r = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
|
|
878
878
|
a.q && (r = O(t, r, a.q, ["url"]));
|
|
879
|
-
const
|
|
879
|
+
const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
880
880
|
return {
|
|
881
|
-
hooks:
|
|
882
|
-
const { tenant_id: g, enabled: m, synchronous: w, ...b } =
|
|
881
|
+
hooks: n.map((c) => {
|
|
882
|
+
const { tenant_id: g, enabled: m, synchronous: w, ...b } = c;
|
|
883
883
|
return _({
|
|
884
884
|
...b,
|
|
885
885
|
enabled: !!m,
|
|
@@ -923,13 +923,13 @@ function ta(t) {
|
|
|
923
923
|
}
|
|
924
924
|
function aa(t) {
|
|
925
925
|
return async (e, a, r) => {
|
|
926
|
-
const
|
|
926
|
+
const o = {
|
|
927
927
|
...r,
|
|
928
928
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
929
929
|
enabled: r.enabled !== void 0 ? r.enabled ? 1 : 0 : void 0,
|
|
930
930
|
synchronous: r.enabled !== void 0 ? r.synchronous ? 1 : 0 : void 0
|
|
931
931
|
};
|
|
932
|
-
return await t.updateTable("hooks").set(
|
|
932
|
+
return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=", a).where("hooks.tenant_id", "=", e).execute(), !0;
|
|
933
933
|
};
|
|
934
934
|
}
|
|
935
935
|
function ra(t) {
|
|
@@ -944,24 +944,24 @@ function ra(t) {
|
|
|
944
944
|
function E(t, e = "", a = {}) {
|
|
945
945
|
for (let r in t)
|
|
946
946
|
if (Object.prototype.hasOwnProperty.call(t, r)) {
|
|
947
|
-
const
|
|
948
|
-
typeof t[r] == "object" && t[r] !== null && !Array.isArray(t[r]) ? E(t[r],
|
|
947
|
+
const o = e ? `${e}_${r}` : r;
|
|
948
|
+
typeof t[r] == "object" && t[r] !== null && !Array.isArray(t[r]) ? E(t[r], o, a) : a[o] = t[r];
|
|
949
949
|
}
|
|
950
950
|
return a;
|
|
951
951
|
}
|
|
952
952
|
function na(t, e) {
|
|
953
953
|
const a = {};
|
|
954
|
-
for (const [r,
|
|
955
|
-
const
|
|
954
|
+
for (const [r, o] of Object.entries(t)) {
|
|
955
|
+
const n = e.find(
|
|
956
956
|
(s) => r.startsWith(`${s}_`)
|
|
957
957
|
);
|
|
958
|
-
if (!
|
|
959
|
-
a[r] =
|
|
958
|
+
if (!n)
|
|
959
|
+
a[r] = o;
|
|
960
960
|
else {
|
|
961
|
-
const s = r.slice(
|
|
962
|
-
a[
|
|
963
|
-
...a[
|
|
964
|
-
[s]:
|
|
961
|
+
const s = r.slice(n.length + 1);
|
|
962
|
+
a[n] = {
|
|
963
|
+
...a[n],
|
|
964
|
+
[s]: o
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
967
|
}
|
|
@@ -987,38 +987,38 @@ function ia(t) {
|
|
|
987
987
|
return r ? _(r) : null;
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function ca(t) {
|
|
991
991
|
return async (e, a, r) => {
|
|
992
|
-
const
|
|
992
|
+
const o = E({
|
|
993
993
|
...r,
|
|
994
994
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
995
995
|
});
|
|
996
|
-
return await t.updateTable("themes").set(
|
|
996
|
+
return await t.updateTable("themes").set(o).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
|
|
997
997
|
};
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function da(t) {
|
|
1000
1000
|
return {
|
|
1001
1001
|
create: oa(t),
|
|
1002
1002
|
get: ia(t),
|
|
1003
1003
|
remove: sa(t),
|
|
1004
|
-
update:
|
|
1004
|
+
update: ca(t)
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
1007
1007
|
function la(t) {
|
|
1008
1008
|
return async (e, a) => {
|
|
1009
|
-
const r = (/* @__PURE__ */ new Date()).toISOString(),
|
|
1010
|
-
return
|
|
1011
|
-
na(_(
|
|
1009
|
+
const r = (/* @__PURE__ */ new Date()).toISOString(), o = await t.selectFrom("login_sessions").where("login_sessions.expires_at", ">", r).where("login_sessions.id", "=", a).selectAll().executeTakeFirst();
|
|
1010
|
+
return o ? Re.parse(
|
|
1011
|
+
na(_(o), ["authParams"])
|
|
1012
1012
|
) : null;
|
|
1013
1013
|
};
|
|
1014
1014
|
}
|
|
1015
1015
|
function ua(t) {
|
|
1016
1016
|
return async (e, a) => {
|
|
1017
|
-
var
|
|
1017
|
+
var o;
|
|
1018
1018
|
const r = {
|
|
1019
1019
|
id: k(),
|
|
1020
1020
|
...a,
|
|
1021
|
-
authorization_url: (
|
|
1021
|
+
authorization_url: (o = a.authorization_url) == null ? void 0 : o.slice(0, 1024),
|
|
1022
1022
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1023
1023
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1024
1024
|
};
|
|
@@ -1085,38 +1085,38 @@ function ya(t) {
|
|
|
1085
1085
|
return null;
|
|
1086
1086
|
const {
|
|
1087
1087
|
tenant_id: r,
|
|
1088
|
-
credentials:
|
|
1089
|
-
settings:
|
|
1088
|
+
credentials: o,
|
|
1089
|
+
settings: n,
|
|
1090
1090
|
enabled: s,
|
|
1091
1091
|
...l
|
|
1092
1092
|
} = a;
|
|
1093
1093
|
return _({
|
|
1094
1094
|
...l,
|
|
1095
|
-
credentials: JSON.parse(
|
|
1096
|
-
settings: JSON.parse(
|
|
1095
|
+
credentials: JSON.parse(o),
|
|
1096
|
+
settings: JSON.parse(n),
|
|
1097
1097
|
enabled: !!s
|
|
1098
1098
|
});
|
|
1099
1099
|
};
|
|
1100
1100
|
}
|
|
1101
1101
|
function wa(t) {
|
|
1102
1102
|
return async (e, a) => {
|
|
1103
|
-
const { credentials: r, settings:
|
|
1103
|
+
const { credentials: r, settings: o, enabled: n, ...s } = a;
|
|
1104
1104
|
await t.updateTable("email_providers").set({
|
|
1105
1105
|
...s,
|
|
1106
1106
|
credentials: r ? JSON.stringify(r) : void 0,
|
|
1107
|
-
settings:
|
|
1108
|
-
enabled:
|
|
1107
|
+
settings: o ? JSON.stringify(o) : void 0,
|
|
1108
|
+
enabled: n !== void 0 ? n ? 1 : 0 : void 0
|
|
1109
1109
|
}).where("tenant_id", "=", e).execute();
|
|
1110
1110
|
};
|
|
1111
1111
|
}
|
|
1112
1112
|
function va(t) {
|
|
1113
1113
|
return async (e, a) => {
|
|
1114
|
-
const { credentials: r, settings:
|
|
1114
|
+
const { credentials: r, settings: o, enabled: n, ...s } = a;
|
|
1115
1115
|
await t.insertInto("email_providers").values({
|
|
1116
1116
|
...s,
|
|
1117
|
-
enabled:
|
|
1117
|
+
enabled: n ? 1 : 0,
|
|
1118
1118
|
credentials: JSON.stringify(r),
|
|
1119
|
-
settings: JSON.stringify(
|
|
1119
|
+
settings: JSON.stringify(o),
|
|
1120
1120
|
tenant_id: e,
|
|
1121
1121
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1122
1122
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -1161,13 +1161,13 @@ function xa(t) {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
function Ta(t) {
|
|
1163
1163
|
return async (e, a, r) => {
|
|
1164
|
-
const
|
|
1164
|
+
const o = {
|
|
1165
1165
|
...r,
|
|
1166
1166
|
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
1167
1167
|
resource_servers: r.resource_servers ? JSON.stringify(r.resource_servers) : void 0,
|
|
1168
1168
|
rotating: r.rotating ? 1 : 0
|
|
1169
1169
|
};
|
|
1170
|
-
return !!(await t.updateTable("refresh_tokens").set(
|
|
1170
|
+
return !!(await t.updateTable("refresh_tokens").set(o).where("tenant_id", "=", e).where("refresh_tokens.id", "=", a).execute()).length;
|
|
1171
1171
|
};
|
|
1172
1172
|
}
|
|
1173
1173
|
function Sa(t) {
|
|
@@ -1178,22 +1178,22 @@ function Sa(t) {
|
|
|
1178
1178
|
}) => {
|
|
1179
1179
|
let r = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
|
|
1180
1180
|
a.q && (r = O(t, r, a.q, ["token", "session_id"]));
|
|
1181
|
-
let
|
|
1181
|
+
let o = r;
|
|
1182
1182
|
if (a.sort && a.sort.sort_by) {
|
|
1183
|
-
const { ref:
|
|
1184
|
-
|
|
1185
|
-
|
|
1183
|
+
const { ref: c } = t.dynamic;
|
|
1184
|
+
o = o.orderBy(
|
|
1185
|
+
c(a.sort.sort_by),
|
|
1186
1186
|
a.sort.sort_order
|
|
1187
1187
|
);
|
|
1188
1188
|
}
|
|
1189
|
-
|
|
1190
|
-
const
|
|
1191
|
-
return {
|
|
1192
|
-
refresh_tokens:
|
|
1193
|
-
...
|
|
1194
|
-
rotating: !!
|
|
1195
|
-
device:
|
|
1196
|
-
resource_servers:
|
|
1189
|
+
o = o.offset(a.page * a.per_page).limit(a.per_page);
|
|
1190
|
+
const n = await o.selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
|
|
1191
|
+
return {
|
|
1192
|
+
refresh_tokens: n.map((c) => ({
|
|
1193
|
+
...c,
|
|
1194
|
+
rotating: !!c.rotating,
|
|
1195
|
+
device: c.device ? JSON.parse(c.device) : {},
|
|
1196
|
+
resource_servers: c.resource_servers ? JSON.parse(c.resource_servers) : []
|
|
1197
1197
|
})),
|
|
1198
1198
|
start: a.page * a.per_page,
|
|
1199
1199
|
limit: a.per_page,
|
|
@@ -1217,19 +1217,22 @@ function ka(t) {
|
|
|
1217
1217
|
).toISOString(), r = new Date(
|
|
1218
1218
|
Date.now() - 1e3 * 60 * 60 * 24 * 30 * 3
|
|
1219
1219
|
).toISOString();
|
|
1220
|
-
await t.deleteFrom("codes").where("created_at", "<", e).limit(1e5).execute(), await t.deleteFrom("login_sessions").where("created_at", "<", a).where("session_id", "is", null).limit(1e5).execute(), await t.deleteFrom("logs").where("date", "<", r).limit(1e5).execute(), await t.deleteFrom("refresh_tokens").where("expires_at", "<", a).limit(1e5).execute(),
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
]),
|
|
1226
|
-
n(
|
|
1227
|
-
"sessions.id",
|
|
1228
|
-
"not in",
|
|
1229
|
-
t.selectFrom("refresh_tokens").select("session_id")
|
|
1230
|
-
)
|
|
1220
|
+
console.log("delete codes"), await t.deleteFrom("codes").where("created_at", "<", e).limit(1e5).execute(), console.log("delete sessions"), await t.deleteFrom("login_sessions").where("created_at", "<", a).where("session_id", "is", null).limit(1e5).execute(), console.log("delete logs"), await t.deleteFrom("logs").where("date", "<", r).limit(1e5).execute(), console.log("delete refresh tokens"), await t.deleteFrom("refresh_tokens").where("expires_at", "<", a).limit(1e5).execute(), console.log("delete sessions");
|
|
1221
|
+
const o = await t.selectFrom("sessions").select("id").where(
|
|
1222
|
+
(n) => n.or([
|
|
1223
|
+
n("expires_at", "<", a),
|
|
1224
|
+
n("idle_expires_at", "<", a)
|
|
1231
1225
|
])
|
|
1226
|
+
).where(
|
|
1227
|
+
"id",
|
|
1228
|
+
"not in",
|
|
1229
|
+
t.selectFrom("refresh_tokens").select("session_id")
|
|
1232
1230
|
).limit(1e5).execute();
|
|
1231
|
+
o.length > 0 && await t.deleteFrom("sessions").where(
|
|
1232
|
+
"id",
|
|
1233
|
+
"in",
|
|
1234
|
+
o.map((n) => n.id)
|
|
1235
|
+
).execute(), console.log("cleanup complete");
|
|
1233
1236
|
};
|
|
1234
1237
|
}
|
|
1235
1238
|
function $a(t) {
|
|
@@ -1401,7 +1404,7 @@ class Ia {
|
|
|
1401
1404
|
return this.nodeStack.pop(), p(a);
|
|
1402
1405
|
}
|
|
1403
1406
|
transformNodeImpl(e) {
|
|
1404
|
-
return
|
|
1407
|
+
return d(this, K)[e.kind](e);
|
|
1405
1408
|
}
|
|
1406
1409
|
transformNodeList(e) {
|
|
1407
1410
|
return e && p(e.map((a) => this.transformNode(a)));
|
|
@@ -2162,29 +2165,29 @@ class ja extends Ia {
|
|
|
2162
2165
|
return super.transformNodeImpl(a);
|
|
2163
2166
|
const r = u(this, f, we).call(this, a);
|
|
2164
2167
|
for (const s of r)
|
|
2165
|
-
|
|
2166
|
-
const
|
|
2167
|
-
for (const s of
|
|
2168
|
-
|
|
2169
|
-
const
|
|
2170
|
-
for (const s of
|
|
2171
|
-
|
|
2168
|
+
d(this, S).add(s);
|
|
2169
|
+
const o = u(this, f, ye).call(this, a);
|
|
2170
|
+
for (const s of o)
|
|
2171
|
+
d(this, T).add(s);
|
|
2172
|
+
const n = super.transformNodeImpl(a);
|
|
2173
|
+
for (const s of o)
|
|
2174
|
+
d(this, T).delete(s);
|
|
2172
2175
|
for (const s of r)
|
|
2173
|
-
|
|
2174
|
-
return
|
|
2176
|
+
d(this, S).delete(s);
|
|
2177
|
+
return n;
|
|
2175
2178
|
}
|
|
2176
2179
|
transformSchemableIdentifier(a) {
|
|
2177
2180
|
const r = super.transformSchemableIdentifier(a);
|
|
2178
|
-
return r.schema || !
|
|
2181
|
+
return r.schema || !d(this, T).has(a.identifier.name) ? r : {
|
|
2179
2182
|
...r,
|
|
2180
|
-
schema: J.create(
|
|
2183
|
+
schema: J.create(d(this, P))
|
|
2181
2184
|
};
|
|
2182
2185
|
}
|
|
2183
2186
|
transformReferences(a) {
|
|
2184
2187
|
const r = super.transformReferences(a);
|
|
2185
2188
|
return r.table.table.schema ? r : {
|
|
2186
2189
|
...r,
|
|
2187
|
-
table: U.createWithSchema(
|
|
2190
|
+
table: U.createWithSchema(d(this, P), r.table.table.identifier.name)
|
|
2188
2191
|
};
|
|
2189
2192
|
}
|
|
2190
2193
|
}
|
|
@@ -2193,25 +2196,25 @@ P = new WeakMap(), T = new WeakMap(), S = new WeakMap(), f = new WeakSet(), ge =
|
|
|
2193
2196
|
}, ye = function(a) {
|
|
2194
2197
|
const r = /* @__PURE__ */ new Set();
|
|
2195
2198
|
if ("name" in a && a.name && W.is(a.name) && u(this, f, q).call(this, a.name, r), "from" in a && a.from)
|
|
2196
|
-
for (const
|
|
2197
|
-
u(this, f, $).call(this,
|
|
2199
|
+
for (const o of a.from.froms)
|
|
2200
|
+
u(this, f, $).call(this, o, r);
|
|
2198
2201
|
if ("into" in a && a.into && u(this, f, $).call(this, a.into, r), "table" in a && a.table && u(this, f, $).call(this, a.table, r), "joins" in a && a.joins)
|
|
2199
|
-
for (const
|
|
2200
|
-
u(this, f, $).call(this,
|
|
2202
|
+
for (const o of a.joins)
|
|
2203
|
+
u(this, f, $).call(this, o.table, r);
|
|
2201
2204
|
return "using" in a && a.using && u(this, f, $).call(this, a.using, r), r;
|
|
2202
2205
|
}, we = function(a) {
|
|
2203
2206
|
const r = /* @__PURE__ */ new Set();
|
|
2204
2207
|
return "with" in a && a.with && u(this, f, ve).call(this, a.with, r), r;
|
|
2205
2208
|
}, $ = function(a, r) {
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2209
|
+
const o = U.is(a) ? a : Da.is(a) && U.is(a.node) ? a.node : null;
|
|
2210
|
+
o && u(this, f, q).call(this, o.table, r);
|
|
2208
2211
|
}, q = function(a, r) {
|
|
2209
|
-
const
|
|
2210
|
-
!
|
|
2212
|
+
const o = a.identifier.name;
|
|
2213
|
+
!d(this, T).has(o) && !d(this, S).has(o) && r.add(o);
|
|
2211
2214
|
}, ve = function(a, r) {
|
|
2212
|
-
for (const
|
|
2213
|
-
const
|
|
2214
|
-
|
|
2215
|
+
for (const o of a.expressions) {
|
|
2216
|
+
const n = o.name.table.table.identifier.name;
|
|
2217
|
+
d(this, S).has(n) || r.add(n);
|
|
2215
2218
|
}
|
|
2216
2219
|
};
|
|
2217
2220
|
var L;
|
|
@@ -2221,7 +2224,7 @@ class Ma {
|
|
|
2221
2224
|
M(this, L, new ja(e));
|
|
2222
2225
|
}
|
|
2223
2226
|
transformQuery(e) {
|
|
2224
|
-
return
|
|
2227
|
+
return d(this, L).transformNode(e.node);
|
|
2225
2228
|
}
|
|
2226
2229
|
async transformResult(e) {
|
|
2227
2230
|
return e.result;
|
|
@@ -2250,13 +2253,13 @@ class Ne {
|
|
|
2250
2253
|
* The returned array is sorted by migration name.
|
|
2251
2254
|
*/
|
|
2252
2255
|
async getMigrations() {
|
|
2253
|
-
const e = await u(this, i, I).call(this,
|
|
2254
|
-
return (await u(this, i, X).call(this)).map(({ name: r, ...
|
|
2255
|
-
const
|
|
2256
|
+
const e = await u(this, i, I).call(this, d(this, i, N)) ? await d(this, h).db.withPlugin(d(this, i, C)).selectFrom(d(this, i, N)).select(["name", "timestamp"]).execute() : [];
|
|
2257
|
+
return (await u(this, i, X).call(this)).map(({ name: r, ...o }) => {
|
|
2258
|
+
const n = e.find((s) => s.name === r);
|
|
2256
2259
|
return {
|
|
2257
2260
|
name: r,
|
|
2258
|
-
migration:
|
|
2259
|
-
executedAt:
|
|
2261
|
+
migration: o,
|
|
2262
|
+
executedAt: n ? new Date(n.timestamp) : void 0
|
|
2260
2263
|
};
|
|
2261
2264
|
});
|
|
2262
2265
|
}
|
|
@@ -2334,16 +2337,16 @@ class Ne {
|
|
|
2334
2337
|
* ```
|
|
2335
2338
|
*/
|
|
2336
2339
|
async migrateTo(e) {
|
|
2337
|
-
return u(this, i, F).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations:
|
|
2340
|
+
return u(this, i, F).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: o }) => {
|
|
2338
2341
|
if (e === za)
|
|
2339
2342
|
return { direction: "Down", step: 1 / 0 };
|
|
2340
2343
|
if (!a.find((l) => l.name === e))
|
|
2341
2344
|
throw new Error(`migration "${e}" doesn't exist`);
|
|
2342
|
-
const
|
|
2343
|
-
if (
|
|
2345
|
+
const n = r.indexOf(e), s = o.findIndex((l) => l.name === e);
|
|
2346
|
+
if (n !== -1)
|
|
2344
2347
|
return {
|
|
2345
2348
|
direction: "Down",
|
|
2346
|
-
step: r.length -
|
|
2349
|
+
step: r.length - n - 1
|
|
2347
2350
|
};
|
|
2348
2351
|
if (s !== -1)
|
|
2349
2352
|
return { direction: "Up", step: s + 1 };
|
|
@@ -2392,161 +2395,161 @@ h = new WeakMap(), i = new WeakSet(), F = async function(e) {
|
|
|
2392
2395
|
return a instanceof Q ? a.resultSet : { error: a };
|
|
2393
2396
|
}
|
|
2394
2397
|
}, v = function() {
|
|
2395
|
-
return
|
|
2398
|
+
return d(this, h).migrationTableSchema;
|
|
2396
2399
|
}, N = function() {
|
|
2397
|
-
return
|
|
2400
|
+
return d(this, h).migrationTableName ?? Aa;
|
|
2398
2401
|
}, D = function() {
|
|
2399
|
-
return
|
|
2402
|
+
return d(this, h).migrationLockTableName ?? _e;
|
|
2400
2403
|
}, Ce = function() {
|
|
2401
|
-
return
|
|
2404
|
+
return d(this, h).allowUnorderedMigrations ?? La;
|
|
2402
2405
|
}, C = function() {
|
|
2403
|
-
return
|
|
2406
|
+
return d(this, i, v) ? new Ma(d(this, i, v)) : new Fa();
|
|
2404
2407
|
}, be = async function() {
|
|
2405
2408
|
await u(this, i, xe).call(this), await u(this, i, Te).call(this), await u(this, i, Se).call(this), await u(this, i, Oe).call(this);
|
|
2406
2409
|
}, xe = async function() {
|
|
2407
|
-
if (
|
|
2410
|
+
if (d(this, i, v) && !await u(this, i, G).call(this))
|
|
2408
2411
|
try {
|
|
2409
|
-
await u(this, i, A).call(this,
|
|
2412
|
+
await u(this, i, A).call(this, d(this, h).db.schema.createSchema(d(this, i, v)));
|
|
2410
2413
|
} catch (e) {
|
|
2411
2414
|
if (!await u(this, i, G).call(this))
|
|
2412
2415
|
throw e;
|
|
2413
2416
|
}
|
|
2414
2417
|
}, Te = async function() {
|
|
2415
|
-
if (!await u(this, i, I).call(this,
|
|
2418
|
+
if (!await u(this, i, I).call(this, d(this, i, N)))
|
|
2416
2419
|
try {
|
|
2417
|
-
|
|
2420
|
+
d(this, i, v) && await u(this, i, A).call(this, d(this, h).db.schema.createSchema(d(this, i, v))), await u(this, i, A).call(this, d(this, h).db.schema.withPlugin(d(this, i, C)).createTable(d(this, i, N)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
|
|
2418
2421
|
} catch (e) {
|
|
2419
|
-
if (!await u(this, i, I).call(this,
|
|
2422
|
+
if (!await u(this, i, I).call(this, d(this, i, N)))
|
|
2420
2423
|
throw e;
|
|
2421
2424
|
}
|
|
2422
2425
|
}, Se = async function() {
|
|
2423
|
-
if (!await u(this, i, I).call(this,
|
|
2426
|
+
if (!await u(this, i, I).call(this, d(this, i, D)))
|
|
2424
2427
|
try {
|
|
2425
|
-
await u(this, i, A).call(this,
|
|
2428
|
+
await u(this, i, A).call(this, d(this, h).db.schema.withPlugin(d(this, i, C)).createTable(d(this, i, D)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
|
|
2426
2429
|
} catch (e) {
|
|
2427
|
-
if (!await u(this, i, I).call(this,
|
|
2430
|
+
if (!await u(this, i, I).call(this, d(this, i, D)))
|
|
2428
2431
|
throw e;
|
|
2429
2432
|
}
|
|
2430
2433
|
}, Oe = async function() {
|
|
2431
2434
|
if (!await u(this, i, H).call(this))
|
|
2432
2435
|
try {
|
|
2433
|
-
await
|
|
2436
|
+
await d(this, h).db.withPlugin(d(this, i, C)).insertInto(d(this, i, D)).values({ id: B, is_locked: 0 }).execute();
|
|
2434
2437
|
} catch (e) {
|
|
2435
2438
|
if (!await u(this, i, H).call(this))
|
|
2436
2439
|
throw e;
|
|
2437
2440
|
}
|
|
2438
2441
|
}, G = async function() {
|
|
2439
|
-
return (await
|
|
2442
|
+
return (await d(this, h).db.introspection.getSchemas()).some((a) => a.name === d(this, i, v));
|
|
2440
2443
|
}, I = async function(e) {
|
|
2441
|
-
const a =
|
|
2442
|
-
return (await
|
|
2444
|
+
const a = d(this, i, v);
|
|
2445
|
+
return (await d(this, h).db.introspection.getTables({
|
|
2443
2446
|
withInternalKyselyTables: !0
|
|
2444
|
-
})).some((
|
|
2447
|
+
})).some((o) => o.name === e && (!a || o.schema === a));
|
|
2445
2448
|
}, H = async function() {
|
|
2446
|
-
return !!await
|
|
2449
|
+
return !!await d(this, h).db.withPlugin(d(this, i, C)).selectFrom(d(this, i, D)).where("id", "=", B).select("id").executeTakeFirst();
|
|
2447
2450
|
}, ke = async function(e) {
|
|
2448
|
-
const a =
|
|
2449
|
-
lockTable:
|
|
2451
|
+
const a = d(this, h).db.getExecutor().adapter, r = p({
|
|
2452
|
+
lockTable: d(this, h).migrationLockTableName ?? _e,
|
|
2450
2453
|
lockRowId: B,
|
|
2451
|
-
lockTableSchema:
|
|
2452
|
-
}),
|
|
2454
|
+
lockTableSchema: d(this, h).migrationTableSchema
|
|
2455
|
+
}), o = async (n) => {
|
|
2453
2456
|
try {
|
|
2454
|
-
await a.acquireMigrationLock(
|
|
2455
|
-
const s = await u(this, i, $e).call(this,
|
|
2457
|
+
await a.acquireMigrationLock(n, r);
|
|
2458
|
+
const s = await u(this, i, $e).call(this, n);
|
|
2456
2459
|
if (s.migrations.length === 0)
|
|
2457
2460
|
return { results: [] };
|
|
2458
|
-
const { direction: l, step:
|
|
2459
|
-
return
|
|
2461
|
+
const { direction: l, step: c } = e(s);
|
|
2462
|
+
return c <= 0 ? { results: [] } : l === "Down" ? await u(this, i, Me).call(this, n, s, c) : l === "Up" ? await u(this, i, Fe).call(this, n, s, c) : { results: [] };
|
|
2460
2463
|
} finally {
|
|
2461
|
-
await a.releaseMigrationLock(
|
|
2464
|
+
await a.releaseMigrationLock(n, r);
|
|
2462
2465
|
}
|
|
2463
2466
|
};
|
|
2464
|
-
return a.supportsTransactionalDdl ?
|
|
2467
|
+
return a.supportsTransactionalDdl ? d(this, h).db.transaction().execute(o) : d(this, h).db.connection().execute(o);
|
|
2465
2468
|
}, $e = async function(e) {
|
|
2466
2469
|
const a = await u(this, i, X).call(this), r = await u(this, i, Ie).call(this, e);
|
|
2467
|
-
u(this, i, Pe).call(this, a, r),
|
|
2468
|
-
const
|
|
2470
|
+
u(this, i, Pe).call(this, a, r), d(this, i, Ce) || u(this, i, je).call(this, a, r);
|
|
2471
|
+
const o = u(this, i, De).call(this, a, r);
|
|
2469
2472
|
return p({
|
|
2470
2473
|
migrations: a,
|
|
2471
2474
|
executedMigrations: r,
|
|
2472
2475
|
lastMigration: $a(r),
|
|
2473
|
-
pendingMigrations:
|
|
2476
|
+
pendingMigrations: o
|
|
2474
2477
|
});
|
|
2475
2478
|
}, De = function(e, a) {
|
|
2476
2479
|
return e.filter((r) => !a.includes(r.name));
|
|
2477
2480
|
}, X = async function() {
|
|
2478
|
-
const e = await
|
|
2481
|
+
const e = await d(this, h).provider.getMigrations();
|
|
2479
2482
|
return Object.keys(e).sort().map((a) => ({
|
|
2480
2483
|
...e[a],
|
|
2481
2484
|
name: a
|
|
2482
2485
|
}));
|
|
2483
2486
|
}, Ie = async function(e) {
|
|
2484
|
-
return (await e.withPlugin(
|
|
2487
|
+
return (await e.withPlugin(d(this, i, C)).selectFrom(d(this, i, N)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
|
|
2485
2488
|
}, Pe = function(e, a) {
|
|
2486
2489
|
for (const r of a)
|
|
2487
|
-
if (!e.some((
|
|
2490
|
+
if (!e.some((o) => o.name === r))
|
|
2488
2491
|
throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
|
|
2489
2492
|
}, je = function(e, a) {
|
|
2490
2493
|
for (let r = 0; r < a.length; ++r)
|
|
2491
2494
|
if (e[r].name !== a[r])
|
|
2492
2495
|
throw new Error(`corrupted migrations: expected previously executed migration ${a[r]} to be at index ${r} but ${e[r].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
|
|
2493
2496
|
}, Me = async function(e, a, r) {
|
|
2494
|
-
const
|
|
2497
|
+
const o = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((l) => l.name === s)), n = o.map((s) => ({
|
|
2495
2498
|
migrationName: s.name,
|
|
2496
2499
|
direction: "Down",
|
|
2497
2500
|
status: "NotExecuted"
|
|
2498
2501
|
}));
|
|
2499
|
-
for (let s = 0; s <
|
|
2500
|
-
const l =
|
|
2502
|
+
for (let s = 0; s < n.length; ++s) {
|
|
2503
|
+
const l = o[s];
|
|
2501
2504
|
try {
|
|
2502
|
-
l.down && (await l.down(e), await e.withPlugin(
|
|
2505
|
+
l.down && (await l.down(e), await e.withPlugin(d(this, i, C)).deleteFrom(d(this, i, N)).where("name", "=", l.name).execute(), n[s] = {
|
|
2503
2506
|
migrationName: l.name,
|
|
2504
2507
|
direction: "Down",
|
|
2505
2508
|
status: "Success"
|
|
2506
2509
|
});
|
|
2507
|
-
} catch (
|
|
2508
|
-
throw
|
|
2510
|
+
} catch (c) {
|
|
2511
|
+
throw n[s] = {
|
|
2509
2512
|
migrationName: l.name,
|
|
2510
2513
|
direction: "Down",
|
|
2511
2514
|
status: "Error"
|
|
2512
2515
|
}, new Q({
|
|
2513
|
-
error:
|
|
2514
|
-
results:
|
|
2516
|
+
error: c,
|
|
2517
|
+
results: n
|
|
2515
2518
|
});
|
|
2516
2519
|
}
|
|
2517
2520
|
}
|
|
2518
|
-
return { results:
|
|
2521
|
+
return { results: n };
|
|
2519
2522
|
}, Fe = async function(e, a, r) {
|
|
2520
|
-
const
|
|
2523
|
+
const n = a.pendingMigrations.slice(0, r).map((s) => ({
|
|
2521
2524
|
migrationName: s.name,
|
|
2522
2525
|
direction: "Up",
|
|
2523
2526
|
status: "NotExecuted"
|
|
2524
2527
|
}));
|
|
2525
|
-
for (let s = 0; s <
|
|
2528
|
+
for (let s = 0; s < n.length; s++) {
|
|
2526
2529
|
const l = a.pendingMigrations[s];
|
|
2527
2530
|
try {
|
|
2528
|
-
await l.up(e), await e.withPlugin(
|
|
2531
|
+
await l.up(e), await e.withPlugin(d(this, i, C)).insertInto(d(this, i, N)).values({
|
|
2529
2532
|
name: l.name,
|
|
2530
2533
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2531
|
-
}).execute(),
|
|
2534
|
+
}).execute(), n[s] = {
|
|
2532
2535
|
migrationName: l.name,
|
|
2533
2536
|
direction: "Up",
|
|
2534
2537
|
status: "Success"
|
|
2535
2538
|
};
|
|
2536
|
-
} catch (
|
|
2537
|
-
throw
|
|
2539
|
+
} catch (c) {
|
|
2540
|
+
throw n[s] = {
|
|
2538
2541
|
migrationName: l.name,
|
|
2539
2542
|
direction: "Up",
|
|
2540
2543
|
status: "Error"
|
|
2541
2544
|
}, new Q({
|
|
2542
|
-
error:
|
|
2543
|
-
results:
|
|
2545
|
+
error: c,
|
|
2546
|
+
results: n
|
|
2544
2547
|
});
|
|
2545
2548
|
}
|
|
2546
2549
|
}
|
|
2547
|
-
return { results:
|
|
2550
|
+
return { results: n };
|
|
2548
2551
|
}, A = async function(e) {
|
|
2549
|
-
|
|
2552
|
+
d(this, h).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
|
|
2550
2553
|
};
|
|
2551
2554
|
var z;
|
|
2552
2555
|
class Q extends Error {
|
|
@@ -2556,7 +2559,7 @@ class Q extends Error {
|
|
|
2556
2559
|
M(this, z, a);
|
|
2557
2560
|
}
|
|
2558
2561
|
get resultSet() {
|
|
2559
|
-
return
|
|
2562
|
+
return d(this, z);
|
|
2560
2563
|
}
|
|
2561
2564
|
}
|
|
2562
2565
|
z = new WeakMap();
|
|
@@ -2751,12 +2754,12 @@ async function sr(t) {
|
|
|
2751
2754
|
}
|
|
2752
2755
|
async function ir(t) {
|
|
2753
2756
|
}
|
|
2754
|
-
const
|
|
2757
|
+
const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2755
2758
|
__proto__: null,
|
|
2756
2759
|
down: ir,
|
|
2757
2760
|
up: sr
|
|
2758
2761
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2759
|
-
async function
|
|
2762
|
+
async function dr(t) {
|
|
2760
2763
|
await t.schema.alterTable("passwords").addColumn(
|
|
2761
2764
|
"password",
|
|
2762
2765
|
"varchar(255)",
|
|
@@ -2770,7 +2773,7 @@ async function lr(t) {
|
|
|
2770
2773
|
const ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2771
2774
|
__proto__: null,
|
|
2772
2775
|
down: lr,
|
|
2773
|
-
up:
|
|
2776
|
+
up: dr
|
|
2774
2777
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2775
2778
|
async function mr(t) {
|
|
2776
2779
|
}
|
|
@@ -2943,12 +2946,12 @@ const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2943
2946
|
async function sn(t) {
|
|
2944
2947
|
await t.schema.alterTable("logs").addColumn("user_name", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("auth0_client", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("isMobile", "boolean").execute(), await t.schema.alterTable("logs").addColumn("connection", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("connection_id", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("audience", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("scope", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy_type", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("hostname", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("session_connection", "varchar(255)").execute();
|
|
2945
2948
|
}
|
|
2946
|
-
async function
|
|
2949
|
+
async function cn(t) {
|
|
2947
2950
|
await t.schema.alterTable("logs").dropColumn("user_name").execute(), await t.schema.alterTable("logs").dropColumn("auth0_client").execute(), await t.schema.alterTable("logs").dropColumn("isMobile").execute(), await t.schema.alterTable("logs").dropColumn("connection").execute(), await t.schema.alterTable("logs").dropColumn("connection_id").execute(), await t.schema.alterTable("logs").dropColumn("audience").execute(), await t.schema.alterTable("logs").dropColumn("scope").execute(), await t.schema.alterTable("logs").dropColumn("strategy").execute(), await t.schema.alterTable("logs").dropColumn("strategy_type").execute(), await t.schema.alterTable("logs").dropColumn("hostname").execute(), await t.schema.alterTable("logs").dropColumn("session_connection").execute();
|
|
2948
2951
|
}
|
|
2949
|
-
const
|
|
2952
|
+
const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2950
2953
|
__proto__: null,
|
|
2951
|
-
down:
|
|
2954
|
+
down: cn,
|
|
2952
2955
|
up: sn
|
|
2953
2956
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2954
2957
|
async function ln(t) {
|
|
@@ -3396,16 +3399,16 @@ const is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3396
3399
|
down: ss,
|
|
3397
3400
|
up: os
|
|
3398
3401
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3399
|
-
async function
|
|
3402
|
+
async function cs(t) {
|
|
3400
3403
|
await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
|
|
3401
3404
|
}
|
|
3402
|
-
async function
|
|
3405
|
+
async function ds(t) {
|
|
3403
3406
|
await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
|
|
3404
3407
|
}
|
|
3405
3408
|
const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3406
3409
|
__proto__: null,
|
|
3407
|
-
down:
|
|
3408
|
-
up:
|
|
3410
|
+
down: ds,
|
|
3411
|
+
up: cs
|
|
3409
3412
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3410
3413
|
async function us(t) {
|
|
3411
3414
|
}
|
|
@@ -3675,7 +3678,7 @@ const ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3675
3678
|
m5_userProfile: Za,
|
|
3676
3679
|
m6_sessions: ar,
|
|
3677
3680
|
m7_passwords: or,
|
|
3678
|
-
m8_logsTableNewFields:
|
|
3681
|
+
m8_logsTableNewFields: cr,
|
|
3679
3682
|
m9_passwordTableNewField: ur,
|
|
3680
3683
|
n01_codesTable: _r,
|
|
3681
3684
|
n11_universalLoginSession: gr,
|
|
@@ -3693,7 +3696,7 @@ const ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3693
3696
|
n23_dropUsersFields: Zr,
|
|
3694
3697
|
n24_logsIndexes: an,
|
|
3695
3698
|
n25_logDescMaxLength: on,
|
|
3696
|
-
n26_logsTableExtraFields:
|
|
3699
|
+
n26_logsTableExtraFields: dn,
|
|
3697
3700
|
n27_usersTableNameIndex: mn,
|
|
3698
3701
|
n28_usersEmailConstrain: fn,
|
|
3699
3702
|
n29_increaseOtpStateLength: yn,
|
|
@@ -3747,27 +3750,27 @@ const ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3747
3750
|
n78_login_sessions: ti,
|
|
3748
3751
|
n79_drop_sessions_2: ni
|
|
3749
3752
|
};
|
|
3750
|
-
async function
|
|
3753
|
+
async function di(t, e = !1) {
|
|
3751
3754
|
e && console.log("migrating...");
|
|
3752
3755
|
const a = new Ae(Le), r = new Ne({
|
|
3753
3756
|
db: t,
|
|
3754
3757
|
provider: a
|
|
3755
|
-
}), { error:
|
|
3756
|
-
if (
|
|
3758
|
+
}), { error: o, results: n } = await r.migrateToLatest();
|
|
3759
|
+
if (n == null || n.forEach((s) => {
|
|
3757
3760
|
s.status === "Success" ? e && console.log(
|
|
3758
3761
|
`migration "${s.migrationName}" was executed successfully`
|
|
3759
3762
|
) : s.status === "Error" && console.error(`failed to execute migration "${s.migrationName}"`);
|
|
3760
|
-
}),
|
|
3761
|
-
throw console.error("failed to migrate"), console.error(
|
|
3763
|
+
}), o)
|
|
3764
|
+
throw console.error("failed to migrate"), console.error(o), o;
|
|
3762
3765
|
}
|
|
3763
3766
|
async function li(t) {
|
|
3764
3767
|
console.log("migrating...");
|
|
3765
3768
|
const e = new Ae(Le), a = new Ne({
|
|
3766
3769
|
db: t,
|
|
3767
3770
|
provider: e
|
|
3768
|
-
}), { error: r, results:
|
|
3769
|
-
if (
|
|
3770
|
-
|
|
3771
|
+
}), { error: r, results: o } = await a.migrateDown();
|
|
3772
|
+
if (o == null || o.forEach((n) => {
|
|
3773
|
+
n.status === "Success" ? console.log(`migration "${n.migrationName}" was reverted successfully`) : n.status === "Error" && console.error(`failed to execute migration "${n.migrationName}"`);
|
|
3771
3774
|
}), r)
|
|
3772
3775
|
throw console.error("failed to migrate"), console.error(r), r;
|
|
3773
3776
|
}
|
|
@@ -3784,18 +3787,18 @@ function ui(t) {
|
|
|
3784
3787
|
hooks: ra(t),
|
|
3785
3788
|
keys: Rt(t),
|
|
3786
3789
|
loginSessions: _a(t),
|
|
3787
|
-
logs:
|
|
3790
|
+
logs: dt(t),
|
|
3788
3791
|
passwords: wt(t),
|
|
3789
3792
|
promptSettings: ga(t),
|
|
3790
3793
|
refreshTokens: Oa(t),
|
|
3791
3794
|
sessions: ft(t),
|
|
3792
3795
|
tenants: nt(t),
|
|
3793
|
-
themes:
|
|
3796
|
+
themes: da(t),
|
|
3794
3797
|
users: Xe(t)
|
|
3795
3798
|
};
|
|
3796
3799
|
}
|
|
3797
3800
|
export {
|
|
3798
3801
|
ui as default,
|
|
3799
3802
|
li as migrateDown,
|
|
3800
|
-
|
|
3803
|
+
di as migrateToLatest
|
|
3801
3804
|
};
|