@authhero/kysely-adapter 5.1.0 → 6.0.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 +174 -26
- package/dist/kysely-adapter.mjs +756 -712
- package/package.json +2 -2
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -2,17 +2,17 @@ var Ee = Object.defineProperty;
|
|
|
2
2
|
var de = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var j = (t, e,
|
|
7
|
-
var c = (t, e,
|
|
8
|
-
import { parseUserId as Y, codeSchema as
|
|
5
|
+
var Je = (t, e, a) => e in t ? Ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
6
|
+
var j = (t, e, a) => Je(t, typeof e != "symbol" ? e + "" : e, a), U = (t, e, a) => e.has(t) || de("Cannot " + a);
|
|
7
|
+
var c = (t, e, a) => (U(t, e, "read from private field"), a ? a.call(t) : e.get(t)), w = (t, e, a) => e.has(t) ? de("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), M = (t, e, a, r) => (U(t, e, "write to private field"), r ? r.call(t, a) : e.set(t, a), a), u = (t, e, a) => (U(t, e, "access private method"), a);
|
|
8
|
+
import { parseUserId as Y, codeSchema as ze, connectionSchema as Re, loginSchema as Ue, promptSettingSchema as Ke } from "@authhero/adapter-interfaces";
|
|
9
9
|
import "@hono/zod-openapi";
|
|
10
10
|
var V = class extends Error {
|
|
11
|
-
constructor(e = 500,
|
|
12
|
-
super(
|
|
11
|
+
constructor(e = 500, a) {
|
|
12
|
+
super(a == null ? void 0 : a.message, { cause: a == null ? void 0 : a.cause });
|
|
13
13
|
j(this, "res");
|
|
14
14
|
j(this, "status");
|
|
15
|
-
this.res =
|
|
15
|
+
this.res = a == null ? void 0 : a.res, this.status = e;
|
|
16
16
|
}
|
|
17
17
|
getResponse() {
|
|
18
18
|
return this.res ? new Response(this.res.body, {
|
|
@@ -24,17 +24,17 @@ var V = class extends Error {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
function Be(t) {
|
|
27
|
-
return async (e,
|
|
28
|
-
const { identities:
|
|
27
|
+
return async (e, a) => {
|
|
28
|
+
const { identities: r, ...o } = a, n = {
|
|
29
29
|
...o,
|
|
30
30
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
31
31
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32
32
|
login_count: 0,
|
|
33
33
|
tenant_id: e,
|
|
34
|
-
email_verified:
|
|
35
|
-
is_social:
|
|
36
|
-
app_metadata: JSON.stringify(
|
|
37
|
-
user_metadata: JSON.stringify(
|
|
34
|
+
email_verified: a.email_verified ? 1 : 0,
|
|
35
|
+
is_social: a.is_social ? 1 : 0,
|
|
36
|
+
app_metadata: JSON.stringify(a.app_metadata),
|
|
37
|
+
user_metadata: JSON.stringify(a.user_metadata)
|
|
38
38
|
};
|
|
39
39
|
try {
|
|
40
40
|
await t.insertInto("users").values(n).execute();
|
|
@@ -52,16 +52,16 @@ function Be(t) {
|
|
|
52
52
|
}
|
|
53
53
|
function f(t) {
|
|
54
54
|
const e = { ...t };
|
|
55
|
-
for (const
|
|
56
|
-
e[
|
|
55
|
+
for (const a in e)
|
|
56
|
+
e[a] === null ? delete e[a] : typeof e[a] == "object" && (Array.isArray(e[a]) ? e[a] = e[a].map(f) : e[a] = f(e[a]));
|
|
57
57
|
return e;
|
|
58
58
|
}
|
|
59
59
|
function _e(t) {
|
|
60
60
|
let e = {};
|
|
61
61
|
try {
|
|
62
62
|
e = JSON.parse(t.profileData || "{}");
|
|
63
|
-
} catch (
|
|
64
|
-
console.error("Error parsing profileData",
|
|
63
|
+
} catch (a) {
|
|
64
|
+
console.error("Error parsing profileData", a);
|
|
65
65
|
}
|
|
66
66
|
return {
|
|
67
67
|
connection: t.connection,
|
|
@@ -76,26 +76,26 @@ function _e(t) {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
function Qe(t) {
|
|
79
|
-
return async (e,
|
|
80
|
-
const [
|
|
81
|
-
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=",
|
|
82
|
-
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=",
|
|
79
|
+
return async (e, a) => {
|
|
80
|
+
const [r, o] = await Promise.all([
|
|
81
|
+
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).selectAll().executeTakeFirst(),
|
|
82
|
+
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", a).selectAll().execute()
|
|
83
83
|
]);
|
|
84
|
-
if (!
|
|
84
|
+
if (!r)
|
|
85
85
|
return null;
|
|
86
|
-
const { tenant_id: n, ...s } =
|
|
86
|
+
const { tenant_id: n, ...s } = r, l = {
|
|
87
87
|
...s,
|
|
88
|
-
email:
|
|
89
|
-
email_verified:
|
|
90
|
-
is_social:
|
|
91
|
-
app_metadata: JSON.parse(
|
|
92
|
-
user_metadata: JSON.parse(
|
|
88
|
+
email: r.email || "",
|
|
89
|
+
email_verified: r.email_verified === 1,
|
|
90
|
+
is_social: r.is_social === 1,
|
|
91
|
+
app_metadata: JSON.parse(r.app_metadata),
|
|
92
|
+
user_metadata: JSON.parse(r.user_metadata),
|
|
93
93
|
identities: [
|
|
94
94
|
{
|
|
95
|
-
connection:
|
|
96
|
-
provider:
|
|
97
|
-
user_id: Y(
|
|
98
|
-
isSocial: !!
|
|
95
|
+
connection: r.connection,
|
|
96
|
+
provider: r.provider,
|
|
97
|
+
user_id: Y(r.user_id).id,
|
|
98
|
+
isSocial: !!r.is_social
|
|
99
99
|
},
|
|
100
100
|
...o.map(_e)
|
|
101
101
|
]
|
|
@@ -103,8 +103,8 @@ function Qe(t) {
|
|
|
103
103
|
return f(l);
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function T(t, e,
|
|
107
|
-
return
|
|
106
|
+
function T(t, e, a, r) {
|
|
107
|
+
return a.split(/\s+/).map((n) => n.replace(/^([^:]+)=/g, "$1:")).map((n) => {
|
|
108
108
|
let s = n.startsWith("-"), l, d, g, m;
|
|
109
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, d] = s ? n.substring(1).split(":") : n.split(":"), g = !1, d.startsWith(">=") ? (m = ">=", d = d.substring(2)) : d.startsWith(">") ? (m = ">", d = d.substring(1)) : d.startsWith("<=") ? (m = "<=", d = d.substring(2)) : d.startsWith("<") ? (m = "<", d = d.substring(1)) : m = "=") : (l = null, d = n, g = !1), { key: l, value: d, isNegation: s, isExistsQuery: g, operator: m };
|
|
110
110
|
}).forEach(({ key: n, value: s, isNegation: l, isExistsQuery: d, operator: g }) => {
|
|
@@ -134,27 +134,27 @@ function T(t, e, r, a) {
|
|
|
134
134
|
const { ref: m } = t.dynamic;
|
|
135
135
|
e = e.where(
|
|
136
136
|
(y) => y.or(
|
|
137
|
-
|
|
137
|
+
r.map((x) => y(m(x), "like", `%${s}%`))
|
|
138
138
|
)
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
141
|
}), e;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function b(t) {
|
|
144
144
|
return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
|
|
145
145
|
}
|
|
146
146
|
function Ve(t) {
|
|
147
|
-
return async (e,
|
|
147
|
+
return async (e, a = {
|
|
148
148
|
page: 0,
|
|
149
149
|
per_page: 50,
|
|
150
150
|
include_totals: !1
|
|
151
151
|
}) => {
|
|
152
|
-
let
|
|
153
|
-
if (
|
|
152
|
+
let r = t.selectFrom("users").where("users.tenant_id", "=", e);
|
|
153
|
+
if (a.q && (r = T(t, r, a.q, ["email", "name"])), a.sort && a.sort.sort_by) {
|
|
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 n = await
|
|
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() : [], d = n.map((m) => {
|
|
158
158
|
const y = l.filter(
|
|
159
159
|
(x) => x.linked_to === m.user_id
|
|
160
160
|
);
|
|
@@ -174,36 +174,36 @@ function Ve(t) {
|
|
|
174
174
|
...y.map(_e)
|
|
175
175
|
]
|
|
176
176
|
});
|
|
177
|
-
}), { count: g } = await
|
|
177
|
+
}), { count: g } = await r.select((m) => m.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
178
178
|
return {
|
|
179
179
|
users: d,
|
|
180
|
-
start:
|
|
181
|
-
limit:
|
|
182
|
-
length:
|
|
180
|
+
start: a.page * a.per_page,
|
|
181
|
+
limit: a.per_page,
|
|
182
|
+
length: b(g)
|
|
183
183
|
};
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
function We(t) {
|
|
187
|
-
return async (e,
|
|
187
|
+
return async (e, a) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", a).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1);
|
|
188
188
|
}
|
|
189
189
|
function qe(t) {
|
|
190
190
|
if (t.email_verified !== void 0)
|
|
191
191
|
return t.email_verified ? 1 : 0;
|
|
192
192
|
}
|
|
193
193
|
function Ge(t) {
|
|
194
|
-
return async (e,
|
|
194
|
+
return async (e, a, r) => {
|
|
195
195
|
const o = {
|
|
196
|
-
...
|
|
197
|
-
email_verified: qe(
|
|
196
|
+
...r,
|
|
197
|
+
email_verified: qe(r),
|
|
198
198
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
199
199
|
};
|
|
200
|
-
return
|
|
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,
|
|
204
|
+
return async (e, a, r, o) => {
|
|
205
205
|
const n = { linked_to: null };
|
|
206
|
-
return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", `${
|
|
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) {
|
|
@@ -219,26 +219,26 @@ function Xe(t) {
|
|
|
219
219
|
}
|
|
220
220
|
const Ye = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
221
221
|
let k = (t = 21) => {
|
|
222
|
-
let e = "",
|
|
222
|
+
let e = "", a = crypto.getRandomValues(new Uint8Array(t));
|
|
223
223
|
for (; t--; )
|
|
224
|
-
e += Ye[
|
|
224
|
+
e += Ye[a[t] & 63];
|
|
225
225
|
return e;
|
|
226
226
|
};
|
|
227
227
|
function Ze(t) {
|
|
228
228
|
return async (e) => {
|
|
229
|
-
const
|
|
229
|
+
const a = {
|
|
230
230
|
id: e.id || k(),
|
|
231
231
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
232
232
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
233
233
|
...e
|
|
234
234
|
};
|
|
235
|
-
return await t.insertInto("tenants").values(
|
|
235
|
+
return await t.insertInto("tenants").values(a).execute(), a;
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
function et(t) {
|
|
239
239
|
return async (e) => {
|
|
240
|
-
const
|
|
241
|
-
return
|
|
240
|
+
const a = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
|
|
241
|
+
return a ? f(a) : null;
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
function tt(t) {
|
|
@@ -247,18 +247,18 @@ function tt(t) {
|
|
|
247
247
|
per_page: 50,
|
|
248
248
|
include_totals: !1
|
|
249
249
|
}) => {
|
|
250
|
-
let
|
|
250
|
+
let a = t.selectFrom("tenants");
|
|
251
251
|
if (e.sort && e.sort.sort_by) {
|
|
252
252
|
const { ref: l } = t.dynamic;
|
|
253
|
-
|
|
253
|
+
a = a.orderBy(l(e.sort.sort_by), e.sort.sort_order);
|
|
254
254
|
}
|
|
255
|
-
e.q && (
|
|
256
|
-
const o = await
|
|
255
|
+
e.q && (a = a.where((l) => l.or([l("name", "like", `%${e.q}%`)])));
|
|
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
259
|
tenants: o
|
|
260
260
|
};
|
|
261
|
-
const { count: n } = await
|
|
261
|
+
const { count: n } = await a.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = b(n);
|
|
262
262
|
return {
|
|
263
263
|
tenants: o.map(f),
|
|
264
264
|
start: (e.page - 1) * e.per_page,
|
|
@@ -267,17 +267,17 @@ function tt(t) {
|
|
|
267
267
|
};
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
return async (e,
|
|
272
|
-
const
|
|
273
|
-
...
|
|
270
|
+
function at(t) {
|
|
271
|
+
return async (e, a) => {
|
|
272
|
+
const r = {
|
|
273
|
+
...a,
|
|
274
274
|
id: e,
|
|
275
275
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
276
276
|
};
|
|
277
|
-
await t.updateTable("tenants").set(
|
|
277
|
+
await t.updateTable("tenants").set(r).where("id", "=", e).execute();
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function rt(t) {
|
|
281
281
|
return async (e) => (await t.deleteFrom("tenants").where("tenants.id", "=", e).execute()).length === 1;
|
|
282
282
|
}
|
|
283
283
|
function nt(t) {
|
|
@@ -285,8 +285,8 @@ function nt(t) {
|
|
|
285
285
|
create: Ze(t),
|
|
286
286
|
get: et(t),
|
|
287
287
|
list: tt(t),
|
|
288
|
-
update:
|
|
289
|
-
remove:
|
|
288
|
+
update: at(t),
|
|
289
|
+
remove: rt(t)
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
function ue(t) {
|
|
@@ -294,23 +294,23 @@ function ue(t) {
|
|
|
294
294
|
}
|
|
295
295
|
const ot = 1024;
|
|
296
296
|
function st(t) {
|
|
297
|
-
return async (e,
|
|
297
|
+
return async (e, a) => {
|
|
298
298
|
var o, n, s;
|
|
299
|
-
const
|
|
299
|
+
const r = {
|
|
300
300
|
id: k(),
|
|
301
|
-
...
|
|
302
|
-
user_agent:
|
|
301
|
+
...a,
|
|
302
|
+
user_agent: a.user_agent.slice(0, ot)
|
|
303
303
|
};
|
|
304
304
|
return await t.insertInto("logs").values({
|
|
305
|
-
...
|
|
305
|
+
...r,
|
|
306
306
|
// Truncate long strings to avoid database errors
|
|
307
|
-
description: (o =
|
|
308
|
-
isMobile:
|
|
307
|
+
description: (o = r.description) == null ? void 0 : o.substring(0, 256),
|
|
308
|
+
isMobile: a.isMobile ? 1 : 0,
|
|
309
309
|
tenant_id: e,
|
|
310
|
-
scope: (n =
|
|
311
|
-
auth0_client: ue(
|
|
312
|
-
details: (s = ue(
|
|
313
|
-
}).execute(),
|
|
310
|
+
scope: (n = a.scope) == null ? void 0 : n.join(","),
|
|
311
|
+
auth0_client: ue(a.auth0_client),
|
|
312
|
+
details: (s = ue(a.details)) == null ? void 0 : s.substring(0, 8192)
|
|
313
|
+
}).execute(), r;
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
316
|
function me(t) {
|
|
@@ -336,35 +336,35 @@ function pe(t) {
|
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function it(t) {
|
|
339
|
-
return async (e,
|
|
339
|
+
return async (e, a = {
|
|
340
340
|
page: 0,
|
|
341
341
|
per_page: 50,
|
|
342
342
|
include_totals: !1
|
|
343
343
|
}) => {
|
|
344
|
-
let
|
|
345
|
-
|
|
346
|
-
let o =
|
|
347
|
-
if (
|
|
344
|
+
let r = t.selectFrom("logs").where("logs.tenant_id", "=", e);
|
|
345
|
+
a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
|
|
346
|
+
let o = r;
|
|
347
|
+
if (a.sort && a.sort.sort_by) {
|
|
348
348
|
const { ref: l } = t.dynamic;
|
|
349
349
|
o = o.orderBy(
|
|
350
|
-
l(
|
|
351
|
-
|
|
350
|
+
l(a.sort.sort_by),
|
|
351
|
+
a.sort.sort_order
|
|
352
352
|
);
|
|
353
353
|
}
|
|
354
|
-
o = o.offset(
|
|
355
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
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
357
|
logs: n.map(pe),
|
|
358
|
-
start:
|
|
359
|
-
limit:
|
|
360
|
-
length:
|
|
358
|
+
start: a.page * a.per_page,
|
|
359
|
+
limit: a.per_page,
|
|
360
|
+
length: b(s)
|
|
361
361
|
};
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
364
|
function lt(t) {
|
|
365
|
-
return async (e,
|
|
366
|
-
const
|
|
367
|
-
return
|
|
365
|
+
return async (e, a) => {
|
|
366
|
+
const r = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", a).selectAll().executeTakeFirst();
|
|
367
|
+
return r ? pe(r) : null;
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
370
|
function ct(t) {
|
|
@@ -375,46 +375,78 @@ function ct(t) {
|
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
377
|
function dt(t) {
|
|
378
|
-
return async (e,
|
|
378
|
+
return async (e, a) => {
|
|
379
|
+
const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", a).where("sessions.revoked_at", "is", null).selectAll().executeTakeFirst();
|
|
380
|
+
if (!r)
|
|
381
|
+
return null;
|
|
382
|
+
const { tenant_id: o, device: n, clients: s, ...l } = r, d = l.id || l.session_id || "";
|
|
383
|
+
return {
|
|
384
|
+
...l,
|
|
385
|
+
id: d,
|
|
386
|
+
device: JSON.parse(n),
|
|
387
|
+
clients: JSON.parse(s)
|
|
388
|
+
};
|
|
389
|
+
};
|
|
379
390
|
}
|
|
380
391
|
function ut(t) {
|
|
381
|
-
return async (e,
|
|
382
|
-
const
|
|
383
|
-
...
|
|
392
|
+
return async (e, a) => {
|
|
393
|
+
const r = {
|
|
394
|
+
...a,
|
|
395
|
+
// fallback untill we changed primary key
|
|
396
|
+
session_id: a.id,
|
|
384
397
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
385
|
-
|
|
398
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
399
|
+
authenticated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
400
|
+
last_interaction_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
386
401
|
};
|
|
387
|
-
return await t.insertInto("sessions").values({
|
|
402
|
+
return await t.insertInto("sessions").values({
|
|
403
|
+
...r,
|
|
404
|
+
tenant_id: e,
|
|
405
|
+
device: JSON.stringify(a.device),
|
|
406
|
+
clients: JSON.stringify(a.clients)
|
|
407
|
+
}).execute(), r;
|
|
388
408
|
};
|
|
389
409
|
}
|
|
390
410
|
function mt(t) {
|
|
391
|
-
return async (e,
|
|
411
|
+
return async (e, a) => !!(await t.deleteFrom("sessions").where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
|
|
392
412
|
}
|
|
393
413
|
function ht(t) {
|
|
394
|
-
return async (e,
|
|
414
|
+
return async (e, a, r) => {
|
|
415
|
+
const o = {
|
|
416
|
+
...r,
|
|
417
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
418
|
+
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
419
|
+
clients: r.clients ? JSON.stringify(r.clients) : void 0
|
|
420
|
+
};
|
|
421
|
+
return !!(await t.updateTable("sessions").set(o).where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
|
|
422
|
+
};
|
|
395
423
|
}
|
|
396
424
|
function ft(t) {
|
|
397
|
-
return async (e,
|
|
425
|
+
return async (e, a = {
|
|
398
426
|
page: 0,
|
|
399
427
|
per_page: 50,
|
|
400
428
|
include_totals: !1
|
|
401
429
|
}) => {
|
|
402
|
-
let
|
|
403
|
-
|
|
404
|
-
let o =
|
|
405
|
-
if (
|
|
430
|
+
let r = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
|
|
431
|
+
a.q && (r = T(t, r, a.q, ["user_id", "session_id"]));
|
|
432
|
+
let o = r;
|
|
433
|
+
if (a.sort && a.sort.sort_by) {
|
|
406
434
|
const { ref: d } = t.dynamic;
|
|
407
435
|
o = o.orderBy(
|
|
408
|
-
d(
|
|
409
|
-
|
|
436
|
+
d(a.sort.sort_by),
|
|
437
|
+
a.sort.sort_order
|
|
410
438
|
);
|
|
411
439
|
}
|
|
412
|
-
o = o.offset(
|
|
413
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
440
|
+
o = o.offset(a.page * a.per_page).limit(a.per_page);
|
|
441
|
+
const n = await o.selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = b(s);
|
|
414
442
|
return {
|
|
415
|
-
sessions: n
|
|
416
|
-
|
|
417
|
-
|
|
443
|
+
sessions: n.map((d) => ({
|
|
444
|
+
...d,
|
|
445
|
+
device: JSON.parse(d.device),
|
|
446
|
+
clients: JSON.parse(d.clients)
|
|
447
|
+
})),
|
|
448
|
+
start: a.page * a.per_page,
|
|
449
|
+
limit: a.per_page,
|
|
418
450
|
length: l
|
|
419
451
|
};
|
|
420
452
|
};
|
|
@@ -429,29 +461,29 @@ function _t(t) {
|
|
|
429
461
|
};
|
|
430
462
|
}
|
|
431
463
|
function pt(t) {
|
|
432
|
-
return async (e,
|
|
433
|
-
const
|
|
464
|
+
return async (e, a) => {
|
|
465
|
+
const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", a).selectAll().executeTakeFirstOrThrow(), { tenant_id: o, ...n } = r;
|
|
434
466
|
return n;
|
|
435
467
|
};
|
|
436
468
|
}
|
|
437
469
|
function gt(t) {
|
|
438
|
-
return async (e,
|
|
439
|
-
const
|
|
440
|
-
...
|
|
470
|
+
return async (e, a) => {
|
|
471
|
+
const r = {
|
|
472
|
+
...a,
|
|
441
473
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
442
474
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
443
475
|
};
|
|
444
476
|
return await t.insertInto("passwords").values({
|
|
445
|
-
...
|
|
477
|
+
...r,
|
|
446
478
|
tenant_id: e
|
|
447
|
-
}).execute(),
|
|
479
|
+
}).execute(), r;
|
|
448
480
|
};
|
|
449
481
|
}
|
|
450
482
|
function wt(t) {
|
|
451
|
-
return async (e,
|
|
452
|
-
password:
|
|
483
|
+
return async (e, a) => (await t.updateTable("passwords").set({
|
|
484
|
+
password: a.password,
|
|
453
485
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
454
|
-
}).where("tenant_id", "=", e).where("user_id", "=",
|
|
486
|
+
}).where("tenant_id", "=", e).where("user_id", "=", a.user_id).execute()).length === 1;
|
|
455
487
|
}
|
|
456
488
|
function yt(t) {
|
|
457
489
|
return {
|
|
@@ -461,78 +493,78 @@ function yt(t) {
|
|
|
461
493
|
};
|
|
462
494
|
}
|
|
463
495
|
function Nt(t) {
|
|
464
|
-
return async (e,
|
|
496
|
+
return async (e, a = {
|
|
465
497
|
page: 0,
|
|
466
498
|
per_page: 50,
|
|
467
499
|
include_totals: !1
|
|
468
500
|
}) => {
|
|
469
|
-
let
|
|
470
|
-
|
|
471
|
-
const n = await
|
|
501
|
+
let r = t.selectFrom("codes").where("codes.tenant_id", "=", e);
|
|
502
|
+
a.q && (r = T(t, r, a.q, ["code", "login_id"]));
|
|
503
|
+
const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
472
504
|
return {
|
|
473
505
|
codes: n.map((d) => {
|
|
474
506
|
const { tenant_id: g, ...m } = d;
|
|
475
|
-
return
|
|
507
|
+
return ze.parse(f(m));
|
|
476
508
|
}),
|
|
477
|
-
start:
|
|
478
|
-
limit:
|
|
479
|
-
length:
|
|
509
|
+
start: a.page * a.per_page,
|
|
510
|
+
limit: a.per_page,
|
|
511
|
+
length: b(s)
|
|
480
512
|
};
|
|
481
513
|
};
|
|
482
514
|
}
|
|
483
515
|
function vt(t) {
|
|
484
|
-
return async (e,
|
|
485
|
-
const
|
|
486
|
-
...
|
|
516
|
+
return async (e, a) => {
|
|
517
|
+
const r = {
|
|
518
|
+
...a,
|
|
487
519
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
488
520
|
};
|
|
489
521
|
return await t.insertInto("codes").values({
|
|
490
|
-
...
|
|
522
|
+
...r,
|
|
491
523
|
tenant_id: e
|
|
492
|
-
}).execute(),
|
|
524
|
+
}).execute(), r;
|
|
493
525
|
};
|
|
494
526
|
}
|
|
495
|
-
function bt(t) {
|
|
496
|
-
return async (e, r) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", r).executeTakeFirst()).numDeletedRows > 0;
|
|
497
|
-
}
|
|
498
527
|
function Ct(t) {
|
|
499
|
-
return async (e,
|
|
500
|
-
|
|
528
|
+
return async (e, a) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
529
|
+
}
|
|
530
|
+
function bt(t) {
|
|
531
|
+
return async (e, a, r) => {
|
|
532
|
+
let o = t.selectFrom("codes").where("codes.code_id", "=", a).where("codes.code_type", "=", r);
|
|
501
533
|
e.length && (o = o.where("codes.tenant_id", "=", e));
|
|
502
534
|
const n = await o.selectAll().executeTakeFirst();
|
|
503
535
|
return n ? f(n) : null;
|
|
504
536
|
};
|
|
505
537
|
}
|
|
506
538
|
function xt(t) {
|
|
507
|
-
return async (e,
|
|
539
|
+
return async (e, a) => (await t.updateTable("codes").set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where("codes.tenant_id", "=", e).where("codes.code_id", "=", a).executeTakeFirst()).numUpdatedRows > 0;
|
|
508
540
|
}
|
|
509
541
|
function Tt(t) {
|
|
510
542
|
return {
|
|
511
543
|
create: vt(t),
|
|
512
544
|
list: Nt(t),
|
|
513
|
-
remove:
|
|
545
|
+
remove: Ct(t),
|
|
514
546
|
used: xt(t),
|
|
515
|
-
get:
|
|
547
|
+
get: bt(t)
|
|
516
548
|
};
|
|
517
549
|
}
|
|
518
550
|
function St(t) {
|
|
519
|
-
return async (e,
|
|
520
|
-
const
|
|
551
|
+
return async (e, a) => {
|
|
552
|
+
const r = {
|
|
521
553
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
522
554
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
523
|
-
...
|
|
524
|
-
}, o = JSON.stringify(
|
|
555
|
+
...a
|
|
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), d = JSON.stringify(a.allowed_clients);
|
|
525
557
|
return await t.insertInto("applications").values({
|
|
526
|
-
...
|
|
558
|
+
...r,
|
|
527
559
|
tenant_id: e,
|
|
528
|
-
disable_sign_ups:
|
|
529
|
-
addons:
|
|
560
|
+
disable_sign_ups: a.disable_sign_ups ? 1 : 0,
|
|
561
|
+
addons: a.addons ? JSON.stringify(a.addons) : "{}",
|
|
530
562
|
callbacks: n,
|
|
531
563
|
allowed_origins: o,
|
|
532
564
|
web_origins: s,
|
|
533
565
|
allowed_logout_urls: l,
|
|
534
566
|
allowed_clients: d
|
|
535
|
-
}).execute(),
|
|
567
|
+
}).execute(), r;
|
|
536
568
|
};
|
|
537
569
|
}
|
|
538
570
|
function Ot(t) {
|
|
@@ -550,36 +582,36 @@ function Ot(t) {
|
|
|
550
582
|
});
|
|
551
583
|
}
|
|
552
584
|
function kt(t) {
|
|
553
|
-
return async (e,
|
|
554
|
-
const
|
|
555
|
-
return
|
|
556
|
-
...
|
|
557
|
-
disable_sign_ups: !!
|
|
558
|
-
addons: JSON.parse(
|
|
559
|
-
callbacks: JSON.parse(
|
|
560
|
-
allowed_origins: JSON.parse(
|
|
561
|
-
web_origins: JSON.parse(
|
|
562
|
-
allowed_logout_urls: JSON.parse(
|
|
585
|
+
return async (e, a) => {
|
|
586
|
+
const r = await t.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", a).selectAll().executeTakeFirst();
|
|
587
|
+
return r ? f({
|
|
588
|
+
...r,
|
|
589
|
+
disable_sign_ups: !!r.disable_sign_ups,
|
|
590
|
+
addons: JSON.parse(r.addons),
|
|
591
|
+
callbacks: JSON.parse(r.callbacks),
|
|
592
|
+
allowed_origins: JSON.parse(r.allowed_origins),
|
|
593
|
+
web_origins: JSON.parse(r.web_origins),
|
|
594
|
+
allowed_logout_urls: JSON.parse(r.allowed_logout_urls)
|
|
563
595
|
}) : null;
|
|
564
596
|
};
|
|
565
597
|
}
|
|
566
598
|
function $t(t) {
|
|
567
|
-
return async (e,
|
|
599
|
+
return async (e, a) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
568
600
|
}
|
|
569
601
|
function It(t) {
|
|
570
|
-
return async (e,
|
|
602
|
+
return async (e, a, r) => {
|
|
571
603
|
const o = {
|
|
572
|
-
...
|
|
604
|
+
...r,
|
|
573
605
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
574
|
-
allowed_origins:
|
|
575
|
-
callbacks:
|
|
576
|
-
web_origins:
|
|
577
|
-
allowed_logout_urls:
|
|
578
|
-
allowed_clients:
|
|
579
|
-
addons:
|
|
580
|
-
disable_sign_ups:
|
|
606
|
+
allowed_origins: r.allowed_origins ? JSON.stringify(r.allowed_origins) : void 0,
|
|
607
|
+
callbacks: r.callbacks ? JSON.stringify(r.callbacks) : void 0,
|
|
608
|
+
web_origins: r.web_origins ? JSON.stringify(r.web_origins) : void 0,
|
|
609
|
+
allowed_logout_urls: r.allowed_logout_urls ? JSON.stringify(r.allowed_logout_urls) : void 0,
|
|
610
|
+
allowed_clients: r.allowed_clients ? JSON.stringify(r.allowed_clients) : void 0,
|
|
611
|
+
addons: r.addons ? JSON.stringify(r.addons) : "{}",
|
|
612
|
+
disable_sign_ups: r.disable_sign_ups ? 1 : 0
|
|
581
613
|
};
|
|
582
|
-
return await t.updateTable("applications").set(o).where("applications.id", "=",
|
|
614
|
+
return await t.updateTable("applications").set(o).where("applications.id", "=", a).where("applications.tenant_id", "=", e).execute(), !0;
|
|
583
615
|
};
|
|
584
616
|
}
|
|
585
617
|
function Dt(t) {
|
|
@@ -592,65 +624,65 @@ function Dt(t) {
|
|
|
592
624
|
};
|
|
593
625
|
}
|
|
594
626
|
function Pt(t) {
|
|
595
|
-
return async (e,
|
|
596
|
-
const
|
|
627
|
+
return async (e, a) => {
|
|
628
|
+
const r = {
|
|
597
629
|
id: k(),
|
|
598
|
-
...
|
|
630
|
+
...a,
|
|
599
631
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
600
632
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
601
633
|
};
|
|
602
634
|
return await t.insertInto("connections").values({
|
|
603
|
-
...
|
|
635
|
+
...r,
|
|
604
636
|
// The connection options will have many different properties depending on the strategy
|
|
605
|
-
options: JSON.stringify(
|
|
637
|
+
options: JSON.stringify(r.options || {}),
|
|
606
638
|
tenant_id: e
|
|
607
|
-
}).execute(),
|
|
639
|
+
}).execute(), r;
|
|
608
640
|
};
|
|
609
641
|
}
|
|
610
642
|
function jt(t) {
|
|
611
|
-
return async (e,
|
|
643
|
+
return async (e, a = {
|
|
612
644
|
page: 0,
|
|
613
645
|
per_page: 50,
|
|
614
646
|
include_totals: !1
|
|
615
647
|
}) => {
|
|
616
|
-
let
|
|
617
|
-
|
|
618
|
-
const s = (await
|
|
648
|
+
let r = t.selectFrom("connections").where("connections.tenant_id", "=", e);
|
|
649
|
+
a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
|
|
650
|
+
const s = (await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute()).map(
|
|
619
651
|
(d) => f({
|
|
620
652
|
...d,
|
|
621
653
|
options: JSON.parse(d.options)
|
|
622
654
|
})
|
|
623
|
-
), { count: l } = await
|
|
655
|
+
), { count: l } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
624
656
|
return {
|
|
625
657
|
connections: s,
|
|
626
|
-
start:
|
|
627
|
-
limit:
|
|
628
|
-
length:
|
|
658
|
+
start: a.page * a.per_page,
|
|
659
|
+
limit: a.per_page,
|
|
660
|
+
length: b(l)
|
|
629
661
|
};
|
|
630
662
|
};
|
|
631
663
|
}
|
|
632
664
|
function Mt(t) {
|
|
633
|
-
return async (e,
|
|
665
|
+
return async (e, a) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
634
666
|
}
|
|
635
667
|
function At(t) {
|
|
636
|
-
return async (e,
|
|
637
|
-
const
|
|
638
|
-
return
|
|
639
|
-
...
|
|
640
|
-
options: JSON.parse(
|
|
668
|
+
return async (e, a) => {
|
|
669
|
+
const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).selectAll().executeTakeFirst();
|
|
670
|
+
return r ? f({
|
|
671
|
+
...r,
|
|
672
|
+
options: JSON.parse(r.options)
|
|
641
673
|
}) : null;
|
|
642
674
|
};
|
|
643
675
|
}
|
|
644
676
|
function Ft(t) {
|
|
645
|
-
return async (e,
|
|
677
|
+
return async (e, a, r) => {
|
|
646
678
|
const o = {
|
|
647
|
-
...
|
|
679
|
+
...r,
|
|
648
680
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
649
681
|
};
|
|
650
682
|
return await t.updateTable("connections").set({
|
|
651
683
|
...o,
|
|
652
684
|
options: o.options ? JSON.stringify(o.options) : void 0
|
|
653
|
-
}).where("connections.id", "=",
|
|
685
|
+
}).where("connections.id", "=", a).where("connections.tenant_id", "=", e).execute(), !0;
|
|
654
686
|
};
|
|
655
687
|
}
|
|
656
688
|
function Lt(t) {
|
|
@@ -665,15 +697,15 @@ function Lt(t) {
|
|
|
665
697
|
function Et(t) {
|
|
666
698
|
return {
|
|
667
699
|
get: async (e) => {
|
|
668
|
-
const
|
|
669
|
-
if (!r)
|
|
670
|
-
return null;
|
|
671
|
-
const a = await t.selectFrom("tenants").selectAll().where("id", "=", r.tenant_id).executeTakeFirst();
|
|
700
|
+
const a = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
|
|
672
701
|
if (!a)
|
|
702
|
+
return null;
|
|
703
|
+
const r = await t.selectFrom("tenants").selectAll().where("id", "=", a.tenant_id).executeTakeFirst();
|
|
704
|
+
if (!r)
|
|
673
705
|
throw new V(404, { message: "Tenant not found" });
|
|
674
|
-
const o = await t.selectFrom("connections").where("tenant_id", "=",
|
|
706
|
+
const o = await t.selectFrom("connections").where("tenant_id", "=", a.tenant_id).selectAll().execute(), n = await t.selectFrom("domains").where("tenant_id", "=", a.tenant_id).selectAll().execute();
|
|
675
707
|
return {
|
|
676
|
-
...
|
|
708
|
+
...a,
|
|
677
709
|
connections: o.map(
|
|
678
710
|
(l) => Re.parse(
|
|
679
711
|
f({
|
|
@@ -683,64 +715,64 @@ function Et(t) {
|
|
|
683
715
|
)
|
|
684
716
|
),
|
|
685
717
|
domains: n,
|
|
686
|
-
addons:
|
|
687
|
-
callbacks:
|
|
688
|
-
allowed_origins:
|
|
689
|
-
web_origins:
|
|
690
|
-
allowed_logout_urls:
|
|
691
|
-
allowed_clients:
|
|
692
|
-
tenant: f(
|
|
718
|
+
addons: a.addons ? JSON.parse(a.addons) : {},
|
|
719
|
+
callbacks: a.callbacks ? JSON.parse(a.callbacks) : [],
|
|
720
|
+
allowed_origins: a.allowed_origins ? JSON.parse(a.allowed_origins) : [],
|
|
721
|
+
web_origins: a.web_origins ? JSON.parse(a.web_origins) : [],
|
|
722
|
+
allowed_logout_urls: a.allowed_logout_urls ? JSON.parse(a.allowed_logout_urls) : [],
|
|
723
|
+
allowed_clients: a.allowed_clients ? JSON.parse(a.allowed_clients) : [],
|
|
724
|
+
tenant: f(r),
|
|
693
725
|
// this is really an integer in the database
|
|
694
|
-
disable_sign_ups: !!
|
|
726
|
+
disable_sign_ups: !!a.disable_sign_ups
|
|
695
727
|
};
|
|
696
728
|
}
|
|
697
729
|
};
|
|
698
730
|
}
|
|
699
|
-
function
|
|
731
|
+
function Jt(t) {
|
|
700
732
|
return async () => await t.selectFrom("keys").where(
|
|
701
|
-
(
|
|
702
|
-
|
|
703
|
-
|
|
733
|
+
(a) => a.or([
|
|
734
|
+
a("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
|
|
735
|
+
a("revoked_at", "is", null)
|
|
704
736
|
])
|
|
705
737
|
).selectAll().execute();
|
|
706
738
|
}
|
|
707
|
-
function
|
|
739
|
+
function zt(t) {
|
|
708
740
|
return async (e) => {
|
|
709
741
|
await t.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
|
|
710
742
|
};
|
|
711
743
|
}
|
|
712
744
|
function Rt(t) {
|
|
713
|
-
return async (e,
|
|
745
|
+
return async (e, a) => !!(await t.updateTable("keys").set(a).where("kid", "=", e).execute()).length;
|
|
714
746
|
}
|
|
715
747
|
function Ut(t) {
|
|
716
748
|
return {
|
|
717
|
-
create:
|
|
718
|
-
list:
|
|
749
|
+
create: zt(t),
|
|
750
|
+
list: Jt(t),
|
|
719
751
|
update: Rt(t)
|
|
720
752
|
};
|
|
721
753
|
}
|
|
722
754
|
function Kt(t) {
|
|
723
|
-
return async (e,
|
|
724
|
-
const
|
|
755
|
+
return async (e, a) => {
|
|
756
|
+
const r = {
|
|
725
757
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
726
758
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
727
759
|
tenant_id: e,
|
|
728
760
|
id: k(),
|
|
729
|
-
...
|
|
761
|
+
...a
|
|
730
762
|
};
|
|
731
|
-
return await t.insertInto("domains").values(
|
|
763
|
+
return await t.insertInto("domains").values(r).execute(), r;
|
|
732
764
|
};
|
|
733
765
|
}
|
|
734
766
|
function Bt(t) {
|
|
735
|
-
return async (e,
|
|
736
|
-
let
|
|
737
|
-
|
|
738
|
-
const n = await
|
|
767
|
+
return async (e, a) => {
|
|
768
|
+
let r = t.selectFrom("domains").where("domains.tenant_id", "=", e);
|
|
769
|
+
a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
|
|
770
|
+
const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
739
771
|
return {
|
|
740
772
|
domains: n,
|
|
741
|
-
start:
|
|
742
|
-
limit:
|
|
743
|
-
length:
|
|
773
|
+
start: a.page * a.per_page,
|
|
774
|
+
limit: a.per_page,
|
|
775
|
+
length: b(s)
|
|
744
776
|
};
|
|
745
777
|
};
|
|
746
778
|
}
|
|
@@ -752,11 +784,11 @@ function Qt(t) {
|
|
|
752
784
|
}
|
|
753
785
|
function Vt(t) {
|
|
754
786
|
return async (e) => {
|
|
755
|
-
const [
|
|
756
|
-
if (!
|
|
787
|
+
const [a] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
|
|
788
|
+
if (!a)
|
|
757
789
|
return null;
|
|
758
790
|
const {
|
|
759
|
-
tenant_id:
|
|
791
|
+
tenant_id: r,
|
|
760
792
|
colors_primary: o,
|
|
761
793
|
colors_page_background_type: n,
|
|
762
794
|
colors_page_background_start: s,
|
|
@@ -764,7 +796,7 @@ function Vt(t) {
|
|
|
764
796
|
colors_page_background_angle_dev: d,
|
|
765
797
|
font_url: g,
|
|
766
798
|
...m
|
|
767
|
-
} =
|
|
799
|
+
} = a;
|
|
768
800
|
return f({
|
|
769
801
|
...m,
|
|
770
802
|
colors: {
|
|
@@ -781,29 +813,29 @@ function Vt(t) {
|
|
|
781
813
|
};
|
|
782
814
|
}
|
|
783
815
|
function Wt(t) {
|
|
784
|
-
return async (e,
|
|
785
|
-
var s, l, d, g, m, y, x, Z, ee, te,
|
|
786
|
-
const { colors:
|
|
816
|
+
return async (e, a) => {
|
|
817
|
+
var s, l, d, g, m, y, x, Z, ee, te, ae, re, ne, oe, se, ie, le, ce;
|
|
818
|
+
const { colors: r, font: o, ...n } = a;
|
|
787
819
|
try {
|
|
788
820
|
await t.insertInto("branding").values({
|
|
789
821
|
...n,
|
|
790
|
-
colors_primary:
|
|
791
|
-
colors_page_background_type: (l = (s =
|
|
792
|
-
colors_page_background_start: (g = (d =
|
|
793
|
-
colors_page_background_end: (y = (m =
|
|
794
|
-
colors_page_background_angle_dev: (Z = (x =
|
|
795
|
-
font_url: (ee =
|
|
822
|
+
colors_primary: r == null ? void 0 : r.primary,
|
|
823
|
+
colors_page_background_type: (l = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : l.type,
|
|
824
|
+
colors_page_background_start: (g = (d = a.colors) == null ? void 0 : d.page_background) == null ? void 0 : g.start,
|
|
825
|
+
colors_page_background_end: (y = (m = a.colors) == null ? void 0 : m.page_background) == null ? void 0 : y.end,
|
|
826
|
+
colors_page_background_angle_dev: (Z = (x = a.colors) == null ? void 0 : x.page_background) == null ? void 0 : Z.angle_deg,
|
|
827
|
+
font_url: (ee = a.font) == null ? void 0 : ee.url,
|
|
796
828
|
tenant_id: e
|
|
797
829
|
}).execute();
|
|
798
830
|
} catch {
|
|
799
831
|
await t.updateTable("branding").set({
|
|
800
832
|
...n,
|
|
801
|
-
colors_primary:
|
|
802
|
-
colors_page_background_type: (
|
|
803
|
-
colors_page_background_start: (ne = (
|
|
804
|
-
colors_page_background_end: (se = (oe =
|
|
805
|
-
colors_page_background_angle_dev: (le = (ie =
|
|
806
|
-
font_url: (ce =
|
|
833
|
+
colors_primary: r == null ? void 0 : r.primary,
|
|
834
|
+
colors_page_background_type: (ae = (te = a.colors) == null ? void 0 : te.page_background) == null ? void 0 : ae.type,
|
|
835
|
+
colors_page_background_start: (ne = (re = a.colors) == null ? void 0 : re.page_background) == null ? void 0 : ne.start,
|
|
836
|
+
colors_page_background_end: (se = (oe = a.colors) == null ? void 0 : oe.page_background) == null ? void 0 : se.end,
|
|
837
|
+
colors_page_background_angle_dev: (le = (ie = a.colors) == null ? void 0 : ie.page_background) == null ? void 0 : le.angle_deg,
|
|
838
|
+
font_url: (ce = a.font) == null ? void 0 : ce.url
|
|
807
839
|
}).where("tenant_id", "=", e).execute();
|
|
808
840
|
}
|
|
809
841
|
};
|
|
@@ -815,14 +847,14 @@ function qt(t) {
|
|
|
815
847
|
};
|
|
816
848
|
}
|
|
817
849
|
function Gt(t) {
|
|
818
|
-
return async (e,
|
|
850
|
+
return async (e, a = {
|
|
819
851
|
page: 0,
|
|
820
852
|
per_page: 50,
|
|
821
853
|
include_totals: !1
|
|
822
854
|
}) => {
|
|
823
|
-
let
|
|
824
|
-
|
|
825
|
-
const n = await
|
|
855
|
+
let r = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
|
|
856
|
+
a.q && (r = T(t, r, a.q, ["url"]));
|
|
857
|
+
const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
826
858
|
return {
|
|
827
859
|
hooks: n.map((d) => {
|
|
828
860
|
const { tenant_id: g, enabled: m, synchronous: y, ...x } = d;
|
|
@@ -832,53 +864,53 @@ function Gt(t) {
|
|
|
832
864
|
synchronous: !!y
|
|
833
865
|
});
|
|
834
866
|
}),
|
|
835
|
-
start:
|
|
836
|
-
limit:
|
|
837
|
-
length:
|
|
867
|
+
start: a.page * a.per_page,
|
|
868
|
+
limit: a.per_page,
|
|
869
|
+
length: b(s)
|
|
838
870
|
};
|
|
839
871
|
};
|
|
840
872
|
}
|
|
841
873
|
function Ht(t) {
|
|
842
|
-
return async (e,
|
|
843
|
-
const
|
|
844
|
-
return
|
|
845
|
-
...
|
|
846
|
-
enabled: !!
|
|
847
|
-
synchronous: !!
|
|
874
|
+
return async (e, a) => {
|
|
875
|
+
const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).selectAll().executeTakeFirst();
|
|
876
|
+
return r ? f({
|
|
877
|
+
...r,
|
|
878
|
+
enabled: !!r.enabled,
|
|
879
|
+
synchronous: !!r.synchronous
|
|
848
880
|
}) : null;
|
|
849
881
|
};
|
|
850
882
|
}
|
|
851
883
|
function Xt(t) {
|
|
852
|
-
return async (e,
|
|
884
|
+
return async (e, a) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
853
885
|
}
|
|
854
886
|
function Yt(t) {
|
|
855
|
-
return async (e,
|
|
856
|
-
const
|
|
887
|
+
return async (e, a) => {
|
|
888
|
+
const r = {
|
|
857
889
|
hook_id: k(),
|
|
858
|
-
...
|
|
890
|
+
...a,
|
|
859
891
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
860
892
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
861
893
|
};
|
|
862
894
|
return await t.insertInto("hooks").values({
|
|
863
|
-
...
|
|
895
|
+
...r,
|
|
864
896
|
tenant_id: e,
|
|
865
|
-
enabled:
|
|
866
|
-
synchronous:
|
|
867
|
-
}).execute(),
|
|
897
|
+
enabled: a.enabled ? 1 : 0,
|
|
898
|
+
synchronous: a.synchronous ? 1 : 0
|
|
899
|
+
}).execute(), r;
|
|
868
900
|
};
|
|
869
901
|
}
|
|
870
902
|
function Zt(t) {
|
|
871
|
-
return async (e,
|
|
903
|
+
return async (e, a, r) => {
|
|
872
904
|
const o = {
|
|
873
|
-
...
|
|
905
|
+
...r,
|
|
874
906
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
875
|
-
enabled:
|
|
876
|
-
synchronous:
|
|
907
|
+
enabled: r.enabled !== void 0 ? r.enabled ? 1 : 0 : void 0,
|
|
908
|
+
synchronous: r.enabled !== void 0 ? r.synchronous ? 1 : 0 : void 0
|
|
877
909
|
};
|
|
878
|
-
return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=",
|
|
910
|
+
return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=", a).where("hooks.tenant_id", "=", e).execute(), !0;
|
|
879
911
|
};
|
|
880
912
|
}
|
|
881
|
-
function
|
|
913
|
+
function ea(t) {
|
|
882
914
|
return {
|
|
883
915
|
create: Yt(t),
|
|
884
916
|
get: Ht(t),
|
|
@@ -887,110 +919,110 @@ function er(t) {
|
|
|
887
919
|
remove: Xt(t)
|
|
888
920
|
};
|
|
889
921
|
}
|
|
890
|
-
function
|
|
891
|
-
for (let
|
|
892
|
-
if (Object.prototype.hasOwnProperty.call(t,
|
|
893
|
-
const o = e ? `${e}_${
|
|
894
|
-
typeof t[
|
|
922
|
+
function J(t, e = "", a = {}) {
|
|
923
|
+
for (let r in t)
|
|
924
|
+
if (Object.prototype.hasOwnProperty.call(t, r)) {
|
|
925
|
+
const o = e ? `${e}_${r}` : r;
|
|
926
|
+
typeof t[r] == "object" && t[r] !== null && !Array.isArray(t[r]) ? J(t[r], o, a) : a[o] = t[r];
|
|
895
927
|
}
|
|
896
|
-
return
|
|
928
|
+
return a;
|
|
897
929
|
}
|
|
898
|
-
function
|
|
899
|
-
const
|
|
900
|
-
for (const [
|
|
930
|
+
function ta(t, e) {
|
|
931
|
+
const a = {};
|
|
932
|
+
for (const [r, o] of Object.entries(t)) {
|
|
901
933
|
const n = e.find(
|
|
902
|
-
(s) =>
|
|
934
|
+
(s) => r.startsWith(`${s}_`)
|
|
903
935
|
);
|
|
904
936
|
if (!n)
|
|
905
|
-
r
|
|
937
|
+
a[r] = o;
|
|
906
938
|
else {
|
|
907
|
-
const s =
|
|
908
|
-
|
|
909
|
-
...
|
|
939
|
+
const s = r.slice(n.length + 1);
|
|
940
|
+
a[n] = {
|
|
941
|
+
...a[n],
|
|
910
942
|
[s]: o
|
|
911
943
|
};
|
|
912
944
|
}
|
|
913
945
|
}
|
|
914
|
-
return
|
|
946
|
+
return a;
|
|
915
947
|
}
|
|
916
|
-
function
|
|
917
|
-
return async (e,
|
|
918
|
-
const
|
|
948
|
+
function aa(t) {
|
|
949
|
+
return async (e, a) => {
|
|
950
|
+
const r = {
|
|
919
951
|
themeId: k(),
|
|
920
|
-
...
|
|
952
|
+
...a,
|
|
921
953
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
922
954
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
923
955
|
};
|
|
924
|
-
return await t.insertInto("themes").values({ ...
|
|
956
|
+
return await t.insertInto("themes").values({ ...J(r), tenant_id: e }).execute(), r;
|
|
925
957
|
};
|
|
926
958
|
}
|
|
927
|
-
function
|
|
928
|
-
return async (e,
|
|
959
|
+
function ra(t) {
|
|
960
|
+
return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
929
961
|
}
|
|
930
|
-
function
|
|
931
|
-
return async (e,
|
|
932
|
-
const
|
|
933
|
-
return
|
|
962
|
+
function na(t) {
|
|
963
|
+
return async (e, a) => {
|
|
964
|
+
const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).selectAll().executeTakeFirst();
|
|
965
|
+
return r ? f(r) : null;
|
|
934
966
|
};
|
|
935
967
|
}
|
|
936
|
-
function
|
|
937
|
-
return async (e,
|
|
938
|
-
const o =
|
|
939
|
-
...
|
|
968
|
+
function oa(t) {
|
|
969
|
+
return async (e, a, r) => {
|
|
970
|
+
const o = J({
|
|
971
|
+
...r,
|
|
940
972
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
941
973
|
});
|
|
942
|
-
return await t.updateTable("themes").set(o).where("themes.id", "=",
|
|
974
|
+
return await t.updateTable("themes").set(o).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
|
|
943
975
|
};
|
|
944
976
|
}
|
|
945
|
-
function
|
|
977
|
+
function sa(t) {
|
|
946
978
|
return {
|
|
947
|
-
create:
|
|
948
|
-
get:
|
|
949
|
-
remove:
|
|
950
|
-
update:
|
|
979
|
+
create: aa(t),
|
|
980
|
+
get: na(t),
|
|
981
|
+
remove: ra(t),
|
|
982
|
+
update: oa(t)
|
|
951
983
|
};
|
|
952
984
|
}
|
|
953
|
-
function
|
|
954
|
-
return async (e,
|
|
955
|
-
const
|
|
985
|
+
function ia(t) {
|
|
986
|
+
return async (e, a) => {
|
|
987
|
+
const r = (/* @__PURE__ */ new Date()).toISOString(), o = await t.selectFrom("logins").where("logins.expires_at", ">", r).where("logins.login_id", "=", a).selectAll().executeTakeFirst();
|
|
956
988
|
return o ? Ue.parse(
|
|
957
|
-
|
|
989
|
+
ta(f(o), ["authParams"])
|
|
958
990
|
) : null;
|
|
959
991
|
};
|
|
960
992
|
}
|
|
961
|
-
function
|
|
962
|
-
return async (e,
|
|
963
|
-
const
|
|
993
|
+
function la(t) {
|
|
994
|
+
return async (e, a) => {
|
|
995
|
+
const r = {
|
|
964
996
|
login_id: k(),
|
|
965
|
-
...
|
|
997
|
+
...a,
|
|
966
998
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
967
999
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
968
1000
|
};
|
|
969
|
-
return await t.insertInto("logins").values({ ...
|
|
1001
|
+
return await t.insertInto("logins").values({ ...J(r), tenant_id: e }).execute(), r;
|
|
970
1002
|
};
|
|
971
1003
|
}
|
|
972
|
-
function
|
|
973
|
-
return async (e,
|
|
1004
|
+
function ca(t) {
|
|
1005
|
+
return async (e, a, r) => (await t.updateTable("logins").set(J(r)).where("logins.login_id", "=", a).where("logins.tenant_id", "=", e).execute()).length === 1;
|
|
974
1006
|
}
|
|
975
|
-
function
|
|
976
|
-
return async (e,
|
|
1007
|
+
function da(t) {
|
|
1008
|
+
return async (e, a) => (await t.deleteFrom("logins").where("logins.tenant_id", "=", e).where("logins.login_id", "=", a).execute()).length > 0;
|
|
977
1009
|
}
|
|
978
|
-
function
|
|
1010
|
+
function ua(t) {
|
|
979
1011
|
return {
|
|
980
|
-
create:
|
|
981
|
-
get:
|
|
982
|
-
update:
|
|
983
|
-
remove:
|
|
1012
|
+
create: la(t),
|
|
1013
|
+
get: ia(t),
|
|
1014
|
+
update: ca(t),
|
|
1015
|
+
remove: da(t)
|
|
984
1016
|
};
|
|
985
1017
|
}
|
|
986
|
-
function
|
|
1018
|
+
function ma(t) {
|
|
987
1019
|
return async (e) => {
|
|
988
|
-
const [
|
|
1020
|
+
const [a] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
|
|
989
1021
|
return f({
|
|
990
|
-
identifier_first: !!(
|
|
991
|
-
password_first: !!(
|
|
992
|
-
webauthn_platform_first_factor: !!(
|
|
993
|
-
universal_login_experience: (
|
|
1022
|
+
identifier_first: !!(a != null && a.identifier_first),
|
|
1023
|
+
password_first: !!(a != null && a.password_first),
|
|
1024
|
+
webauthn_platform_first_factor: !!(a != null && a.webauthn_platform_first_factor),
|
|
1025
|
+
universal_login_experience: (a == null ? void 0 : a.universal_login_experience) || "new"
|
|
994
1026
|
});
|
|
995
1027
|
};
|
|
996
1028
|
}
|
|
@@ -1003,37 +1035,37 @@ function he(t) {
|
|
|
1003
1035
|
universal_login_experience: t.universal_login_experience
|
|
1004
1036
|
});
|
|
1005
1037
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return async (e,
|
|
1038
|
+
function ha(t) {
|
|
1039
|
+
return async (e, a) => {
|
|
1008
1040
|
try {
|
|
1009
|
-
const
|
|
1041
|
+
const r = Ke.parse(a);
|
|
1010
1042
|
await t.insertInto("prompt_settings").values({
|
|
1011
|
-
...he(
|
|
1043
|
+
...he(r),
|
|
1012
1044
|
tenant_id: e
|
|
1013
1045
|
}).execute();
|
|
1014
1046
|
} catch {
|
|
1015
|
-
await t.updateTable("prompt_settings").set(he(
|
|
1047
|
+
await t.updateTable("prompt_settings").set(he(a)).where("tenant_id", "=", e).execute();
|
|
1016
1048
|
}
|
|
1017
1049
|
};
|
|
1018
1050
|
}
|
|
1019
|
-
function
|
|
1051
|
+
function fa(t) {
|
|
1020
1052
|
return {
|
|
1021
|
-
get:
|
|
1022
|
-
set:
|
|
1053
|
+
get: ma(t),
|
|
1054
|
+
set: ha(t)
|
|
1023
1055
|
};
|
|
1024
1056
|
}
|
|
1025
|
-
function
|
|
1057
|
+
function _a(t) {
|
|
1026
1058
|
return async (e) => {
|
|
1027
|
-
const [
|
|
1028
|
-
if (!
|
|
1059
|
+
const [a] = await t.selectFrom("email_providers").where("email_providers.tenant_id", "=", e).selectAll().execute();
|
|
1060
|
+
if (!a)
|
|
1029
1061
|
return null;
|
|
1030
1062
|
const {
|
|
1031
|
-
tenant_id:
|
|
1063
|
+
tenant_id: r,
|
|
1032
1064
|
credentials: o,
|
|
1033
1065
|
settings: n,
|
|
1034
1066
|
enabled: s,
|
|
1035
1067
|
...l
|
|
1036
|
-
} =
|
|
1068
|
+
} = a;
|
|
1037
1069
|
return f({
|
|
1038
1070
|
...l,
|
|
1039
1071
|
credentials: JSON.parse(o),
|
|
@@ -1042,24 +1074,24 @@ function _r(t) {
|
|
|
1042
1074
|
});
|
|
1043
1075
|
};
|
|
1044
1076
|
}
|
|
1045
|
-
function
|
|
1046
|
-
return async (e,
|
|
1047
|
-
const { credentials:
|
|
1077
|
+
function pa(t) {
|
|
1078
|
+
return async (e, a) => {
|
|
1079
|
+
const { credentials: r, settings: o, enabled: n, ...s } = a;
|
|
1048
1080
|
await t.updateTable("email_providers").set({
|
|
1049
1081
|
...s,
|
|
1050
|
-
credentials:
|
|
1082
|
+
credentials: r ? JSON.stringify(r) : void 0,
|
|
1051
1083
|
settings: o ? JSON.stringify(o) : void 0,
|
|
1052
1084
|
enabled: n !== void 0 ? n ? 1 : 0 : void 0
|
|
1053
1085
|
}).where("tenant_id", "=", e).execute();
|
|
1054
1086
|
};
|
|
1055
1087
|
}
|
|
1056
|
-
function
|
|
1057
|
-
return async (e,
|
|
1058
|
-
const { credentials:
|
|
1088
|
+
function ga(t) {
|
|
1089
|
+
return async (e, a) => {
|
|
1090
|
+
const { credentials: r, settings: o, enabled: n, ...s } = a;
|
|
1059
1091
|
await t.insertInto("email_providers").values({
|
|
1060
1092
|
...s,
|
|
1061
1093
|
enabled: n ? 1 : 0,
|
|
1062
|
-
credentials: JSON.stringify(
|
|
1094
|
+
credentials: JSON.stringify(r),
|
|
1063
1095
|
settings: JSON.stringify(o),
|
|
1064
1096
|
tenant_id: e,
|
|
1065
1097
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1067,73 +1099,73 @@ function gr(t) {
|
|
|
1067
1099
|
}).execute();
|
|
1068
1100
|
};
|
|
1069
1101
|
}
|
|
1070
|
-
function
|
|
1102
|
+
function wa(t) {
|
|
1071
1103
|
return {
|
|
1072
|
-
get:
|
|
1073
|
-
create:
|
|
1074
|
-
update:
|
|
1104
|
+
get: _a(t),
|
|
1105
|
+
create: ga(t),
|
|
1106
|
+
update: pa(t)
|
|
1075
1107
|
};
|
|
1076
1108
|
}
|
|
1077
|
-
function
|
|
1078
|
-
return async (e,
|
|
1109
|
+
function ya(t) {
|
|
1110
|
+
return async (e, a) => await t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e).where("refresh_tokens.token", "=", a).where("refresh_tokens.revoked_at", "is", null).selectAll().executeTakeFirst() ?? null;
|
|
1079
1111
|
}
|
|
1080
|
-
function
|
|
1081
|
-
return async (e,
|
|
1082
|
-
const
|
|
1083
|
-
...
|
|
1112
|
+
function Na(t) {
|
|
1113
|
+
return async (e, a) => {
|
|
1114
|
+
const r = {
|
|
1115
|
+
...a,
|
|
1084
1116
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1085
1117
|
};
|
|
1086
|
-
return await t.insertInto("refresh_tokens").values({ ...
|
|
1118
|
+
return await t.insertInto("refresh_tokens").values({ ...r, tenant_id: e }).execute(), { ...a, ...r };
|
|
1087
1119
|
};
|
|
1088
1120
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return async (e,
|
|
1121
|
+
function va(t) {
|
|
1122
|
+
return async (e, a) => !!(await t.deleteFrom("refresh_tokens").where("tenant_id", "=", e).where("refresh_tokens.token", "=", a).execute()).length;
|
|
1091
1123
|
}
|
|
1092
|
-
function
|
|
1093
|
-
return async (e,
|
|
1124
|
+
function Ca(t) {
|
|
1125
|
+
return async (e, a, r) => !!(await t.updateTable("refresh_tokens").set(r).where("tenant_id", "=", e).where("refresh_tokens.token", "=", a).execute()).length;
|
|
1094
1126
|
}
|
|
1095
|
-
function
|
|
1096
|
-
return async (e,
|
|
1127
|
+
function ba(t) {
|
|
1128
|
+
return async (e, a = {
|
|
1097
1129
|
page: 0,
|
|
1098
1130
|
per_page: 50,
|
|
1099
1131
|
include_totals: !1
|
|
1100
1132
|
}) => {
|
|
1101
|
-
let
|
|
1102
|
-
|
|
1103
|
-
let o =
|
|
1104
|
-
if (
|
|
1133
|
+
let r = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
|
|
1134
|
+
a.q && (r = T(t, r, a.q, ["token", "session_id"]));
|
|
1135
|
+
let o = r;
|
|
1136
|
+
if (a.sort && a.sort.sort_by) {
|
|
1105
1137
|
const { ref: d } = t.dynamic;
|
|
1106
1138
|
o = o.orderBy(
|
|
1107
|
-
d(
|
|
1108
|
-
|
|
1139
|
+
d(a.sort.sort_by),
|
|
1140
|
+
a.sort.sort_order
|
|
1109
1141
|
);
|
|
1110
1142
|
}
|
|
1111
|
-
o = o.offset(
|
|
1112
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
1143
|
+
o = o.offset(a.page * a.per_page).limit(a.per_page);
|
|
1144
|
+
const n = await o.selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = b(s);
|
|
1113
1145
|
return {
|
|
1114
1146
|
refresh_tokens: n,
|
|
1115
|
-
start:
|
|
1116
|
-
limit:
|
|
1147
|
+
start: a.page * a.per_page,
|
|
1148
|
+
limit: a.per_page,
|
|
1117
1149
|
length: l
|
|
1118
1150
|
};
|
|
1119
1151
|
};
|
|
1120
1152
|
}
|
|
1121
|
-
function
|
|
1153
|
+
function xa(t) {
|
|
1122
1154
|
return {
|
|
1123
|
-
create:
|
|
1124
|
-
get:
|
|
1125
|
-
list:
|
|
1126
|
-
remove:
|
|
1127
|
-
update:
|
|
1155
|
+
create: Na(t),
|
|
1156
|
+
get: ya(t),
|
|
1157
|
+
list: ba(t),
|
|
1158
|
+
remove: va(t),
|
|
1159
|
+
update: Ca(t)
|
|
1128
1160
|
};
|
|
1129
1161
|
}
|
|
1130
|
-
function
|
|
1162
|
+
function Ta(t) {
|
|
1131
1163
|
return t[t.length - 1];
|
|
1132
1164
|
}
|
|
1133
1165
|
function p(t) {
|
|
1134
1166
|
return Object.freeze(t);
|
|
1135
1167
|
}
|
|
1136
|
-
const
|
|
1168
|
+
const z = p({
|
|
1137
1169
|
is(t) {
|
|
1138
1170
|
return t.kind === "IdentifierNode";
|
|
1139
1171
|
},
|
|
@@ -1150,17 +1182,17 @@ const J = p({
|
|
|
1150
1182
|
create(t) {
|
|
1151
1183
|
return p({
|
|
1152
1184
|
kind: "SchemableIdentifierNode",
|
|
1153
|
-
identifier:
|
|
1185
|
+
identifier: z.create(t)
|
|
1154
1186
|
});
|
|
1155
1187
|
},
|
|
1156
1188
|
createWithSchema(t, e) {
|
|
1157
1189
|
return p({
|
|
1158
1190
|
kind: "SchemableIdentifierNode",
|
|
1159
|
-
schema:
|
|
1160
|
-
identifier:
|
|
1191
|
+
schema: z.create(t),
|
|
1192
|
+
identifier: z.create(e)
|
|
1161
1193
|
});
|
|
1162
1194
|
}
|
|
1163
|
-
}),
|
|
1195
|
+
}), Sa = p({
|
|
1164
1196
|
is(t) {
|
|
1165
1197
|
return t.kind === "AliasNode";
|
|
1166
1198
|
},
|
|
@@ -1189,7 +1221,7 @@ const J = p({
|
|
|
1189
1221
|
}
|
|
1190
1222
|
});
|
|
1191
1223
|
var R;
|
|
1192
|
-
class
|
|
1224
|
+
class Oa {
|
|
1193
1225
|
constructor() {
|
|
1194
1226
|
j(this, "nodeStack", []);
|
|
1195
1227
|
w(this, R, p({
|
|
@@ -1292,14 +1324,14 @@ class Or {
|
|
|
1292
1324
|
if (!e)
|
|
1293
1325
|
return e;
|
|
1294
1326
|
this.nodeStack.push(e);
|
|
1295
|
-
const
|
|
1296
|
-
return this.nodeStack.pop(), p(
|
|
1327
|
+
const a = this.transformNodeImpl(e);
|
|
1328
|
+
return this.nodeStack.pop(), p(a);
|
|
1297
1329
|
}
|
|
1298
1330
|
transformNodeImpl(e) {
|
|
1299
1331
|
return c(this, R)[e.kind](e);
|
|
1300
1332
|
}
|
|
1301
1333
|
transformNodeList(e) {
|
|
1302
|
-
return e && p(e.map((
|
|
1334
|
+
return e && p(e.map((a) => this.transformNode(a)));
|
|
1303
1335
|
}
|
|
1304
1336
|
transformSelectQuery(e) {
|
|
1305
1337
|
return {
|
|
@@ -2023,7 +2055,7 @@ class Or {
|
|
|
2023
2055
|
}
|
|
2024
2056
|
}
|
|
2025
2057
|
R = new WeakMap();
|
|
2026
|
-
const
|
|
2058
|
+
const ka = p({
|
|
2027
2059
|
AlterTableNode: !0,
|
|
2028
2060
|
CreateIndexNode: !0,
|
|
2029
2061
|
CreateSchemaNode: !0,
|
|
@@ -2043,77 +2075,77 @@ const kr = p({
|
|
|
2043
2075
|
MergeQueryNode: !0
|
|
2044
2076
|
});
|
|
2045
2077
|
var P, S, O, _, ge, we, ye, $, q, Ne;
|
|
2046
|
-
class $
|
|
2047
|
-
constructor(
|
|
2078
|
+
class $a extends Oa {
|
|
2079
|
+
constructor(a) {
|
|
2048
2080
|
super();
|
|
2049
2081
|
w(this, _);
|
|
2050
2082
|
w(this, P);
|
|
2051
2083
|
w(this, S, /* @__PURE__ */ new Set());
|
|
2052
2084
|
w(this, O, /* @__PURE__ */ new Set());
|
|
2053
|
-
M(this, P,
|
|
2085
|
+
M(this, P, a);
|
|
2054
2086
|
}
|
|
2055
|
-
transformNodeImpl(
|
|
2056
|
-
if (!u(this, _, ge).call(this,
|
|
2057
|
-
return super.transformNodeImpl(
|
|
2058
|
-
const
|
|
2059
|
-
for (const s of
|
|
2087
|
+
transformNodeImpl(a) {
|
|
2088
|
+
if (!u(this, _, ge).call(this, a))
|
|
2089
|
+
return super.transformNodeImpl(a);
|
|
2090
|
+
const r = u(this, _, ye).call(this, a);
|
|
2091
|
+
for (const s of r)
|
|
2060
2092
|
c(this, O).add(s);
|
|
2061
|
-
const o = u(this, _, we).call(this,
|
|
2093
|
+
const o = u(this, _, we).call(this, a);
|
|
2062
2094
|
for (const s of o)
|
|
2063
2095
|
c(this, S).add(s);
|
|
2064
|
-
const n = super.transformNodeImpl(
|
|
2096
|
+
const n = super.transformNodeImpl(a);
|
|
2065
2097
|
for (const s of o)
|
|
2066
2098
|
c(this, S).delete(s);
|
|
2067
|
-
for (const s of
|
|
2099
|
+
for (const s of r)
|
|
2068
2100
|
c(this, O).delete(s);
|
|
2069
2101
|
return n;
|
|
2070
2102
|
}
|
|
2071
|
-
transformSchemableIdentifier(
|
|
2072
|
-
const
|
|
2073
|
-
return
|
|
2074
|
-
...
|
|
2075
|
-
schema:
|
|
2103
|
+
transformSchemableIdentifier(a) {
|
|
2104
|
+
const r = super.transformSchemableIdentifier(a);
|
|
2105
|
+
return r.schema || !c(this, S).has(a.identifier.name) ? r : {
|
|
2106
|
+
...r,
|
|
2107
|
+
schema: z.create(c(this, P))
|
|
2076
2108
|
};
|
|
2077
2109
|
}
|
|
2078
|
-
transformReferences(
|
|
2079
|
-
const
|
|
2080
|
-
return
|
|
2081
|
-
...
|
|
2082
|
-
table: K.createWithSchema(c(this, P),
|
|
2083
|
-
};
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
P = new WeakMap(), S = new WeakMap(), O = new WeakMap(), _ = new WeakSet(), ge = function(
|
|
2087
|
-
return
|
|
2088
|
-
}, we = function(
|
|
2089
|
-
const
|
|
2090
|
-
if ("name" in
|
|
2091
|
-
for (const o of
|
|
2092
|
-
u(this, _, $).call(this, o,
|
|
2093
|
-
if ("into" in
|
|
2094
|
-
for (const o of
|
|
2095
|
-
u(this, _, $).call(this, o.table,
|
|
2096
|
-
return "using" in
|
|
2097
|
-
}, ye = function(
|
|
2098
|
-
const
|
|
2099
|
-
return "with" in
|
|
2100
|
-
}, $ = function(
|
|
2101
|
-
const o = K.is(
|
|
2102
|
-
o && u(this, _, q).call(this, o.table,
|
|
2103
|
-
}, q = function(
|
|
2104
|
-
const o =
|
|
2105
|
-
!c(this, S).has(o) && !c(this, O).has(o) &&
|
|
2106
|
-
}, Ne = function(
|
|
2107
|
-
for (const o of
|
|
2110
|
+
transformReferences(a) {
|
|
2111
|
+
const r = super.transformReferences(a);
|
|
2112
|
+
return r.table.table.schema ? r : {
|
|
2113
|
+
...r,
|
|
2114
|
+
table: K.createWithSchema(c(this, P), r.table.table.identifier.name)
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
P = new WeakMap(), S = new WeakMap(), O = new WeakMap(), _ = new WeakSet(), ge = function(a) {
|
|
2119
|
+
return a.kind in ka;
|
|
2120
|
+
}, we = function(a) {
|
|
2121
|
+
const r = /* @__PURE__ */ new Set();
|
|
2122
|
+
if ("name" in a && a.name && W.is(a.name) && u(this, _, q).call(this, a.name, r), "from" in a && a.from)
|
|
2123
|
+
for (const o of a.from.froms)
|
|
2124
|
+
u(this, _, $).call(this, o, r);
|
|
2125
|
+
if ("into" in a && a.into && u(this, _, $).call(this, a.into, r), "table" in a && a.table && u(this, _, $).call(this, a.table, r), "joins" in a && a.joins)
|
|
2126
|
+
for (const o of a.joins)
|
|
2127
|
+
u(this, _, $).call(this, o.table, r);
|
|
2128
|
+
return "using" in a && a.using && u(this, _, $).call(this, a.using, r), r;
|
|
2129
|
+
}, ye = function(a) {
|
|
2130
|
+
const r = /* @__PURE__ */ new Set();
|
|
2131
|
+
return "with" in a && a.with && u(this, _, Ne).call(this, a.with, r), r;
|
|
2132
|
+
}, $ = function(a, r) {
|
|
2133
|
+
const o = K.is(a) ? a : Sa.is(a) && K.is(a.node) ? a.node : null;
|
|
2134
|
+
o && u(this, _, q).call(this, o.table, r);
|
|
2135
|
+
}, q = function(a, r) {
|
|
2136
|
+
const o = a.identifier.name;
|
|
2137
|
+
!c(this, S).has(o) && !c(this, O).has(o) && r.add(o);
|
|
2138
|
+
}, Ne = function(a, r) {
|
|
2139
|
+
for (const o of a.expressions) {
|
|
2108
2140
|
const n = o.name.table.table.identifier.name;
|
|
2109
|
-
c(this, O).has(n) ||
|
|
2141
|
+
c(this, O).has(n) || r.add(n);
|
|
2110
2142
|
}
|
|
2111
2143
|
};
|
|
2112
2144
|
var L;
|
|
2113
|
-
class
|
|
2145
|
+
class Ia {
|
|
2114
2146
|
constructor(e) {
|
|
2115
2147
|
w(this, L);
|
|
2116
|
-
M(this, L, new $
|
|
2148
|
+
M(this, L, new $a(e));
|
|
2117
2149
|
}
|
|
2118
2150
|
transformQuery(e) {
|
|
2119
2151
|
return c(this, L).transformNode(e.node);
|
|
@@ -2123,7 +2155,7 @@ class Ir {
|
|
|
2123
2155
|
}
|
|
2124
2156
|
}
|
|
2125
2157
|
L = new WeakMap();
|
|
2126
|
-
class
|
|
2158
|
+
class Da {
|
|
2127
2159
|
transformQuery(e) {
|
|
2128
2160
|
return e.node;
|
|
2129
2161
|
}
|
|
@@ -2131,8 +2163,8 @@ class Dr {
|
|
|
2131
2163
|
return e.result;
|
|
2132
2164
|
}
|
|
2133
2165
|
}
|
|
2134
|
-
const
|
|
2135
|
-
var h, i, A, N, v, I,
|
|
2166
|
+
const Pa = "kysely_migration", fe = "kysely_migration_lock", ja = !1, B = "migration_lock", Ma = p({ __noMigrations__: !0 });
|
|
2167
|
+
var h, i, A, N, v, I, Ce, C, be, xe, Te, Se, Oe, G, D, H, ke, $e, Ie, X, De, Pe, je, Me, Ae, F;
|
|
2136
2168
|
class ve {
|
|
2137
2169
|
constructor(e) {
|
|
2138
2170
|
w(this, i);
|
|
@@ -2145,11 +2177,11 @@ class ve {
|
|
|
2145
2177
|
* The returned array is sorted by migration name.
|
|
2146
2178
|
*/
|
|
2147
2179
|
async getMigrations() {
|
|
2148
|
-
const e = await u(this, i, D).call(this, c(this, i, v)) ? await c(this, h).db.withPlugin(c(this, i,
|
|
2149
|
-
return (await u(this, i, X).call(this)).map(({ name:
|
|
2150
|
-
const n = e.find((s) => s.name ===
|
|
2180
|
+
const e = await u(this, i, D).call(this, c(this, i, v)) ? await c(this, h).db.withPlugin(c(this, i, C)).selectFrom(c(this, i, v)).select(["name", "timestamp"]).execute() : [];
|
|
2181
|
+
return (await u(this, i, X).call(this)).map(({ name: r, ...o }) => {
|
|
2182
|
+
const n = e.find((s) => s.name === r);
|
|
2151
2183
|
return {
|
|
2152
|
-
name:
|
|
2184
|
+
name: r,
|
|
2153
2185
|
migration: o,
|
|
2154
2186
|
executedAt: n ? new Date(n.timestamp) : void 0
|
|
2155
2187
|
};
|
|
@@ -2229,16 +2261,16 @@ class ve {
|
|
|
2229
2261
|
* ```
|
|
2230
2262
|
*/
|
|
2231
2263
|
async migrateTo(e) {
|
|
2232
|
-
return u(this, i, A).call(this, ({ migrations:
|
|
2233
|
-
if (e ===
|
|
2264
|
+
return u(this, i, A).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: o }) => {
|
|
2265
|
+
if (e === Ma)
|
|
2234
2266
|
return { direction: "Down", step: 1 / 0 };
|
|
2235
|
-
if (!
|
|
2267
|
+
if (!a.find((l) => l.name === e))
|
|
2236
2268
|
throw new Error(`migration "${e}" doesn't exist`);
|
|
2237
|
-
const n =
|
|
2269
|
+
const n = r.indexOf(e), s = o.findIndex((l) => l.name === e);
|
|
2238
2270
|
if (n !== -1)
|
|
2239
2271
|
return {
|
|
2240
2272
|
direction: "Down",
|
|
2241
|
-
step:
|
|
2273
|
+
step: r.length - n - 1
|
|
2242
2274
|
};
|
|
2243
2275
|
if (s !== -1)
|
|
2244
2276
|
return { direction: "Up", step: s + 1 };
|
|
@@ -2282,21 +2314,21 @@ class ve {
|
|
|
2282
2314
|
}
|
|
2283
2315
|
h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
2284
2316
|
try {
|
|
2285
|
-
return await u(this, i,
|
|
2286
|
-
} catch (
|
|
2287
|
-
return
|
|
2317
|
+
return await u(this, i, be).call(this), await u(this, i, ke).call(this, e);
|
|
2318
|
+
} catch (a) {
|
|
2319
|
+
return a instanceof Q ? a.resultSet : { error: a };
|
|
2288
2320
|
}
|
|
2289
2321
|
}, N = function() {
|
|
2290
2322
|
return c(this, h).migrationTableSchema;
|
|
2291
2323
|
}, v = function() {
|
|
2292
|
-
return c(this, h).migrationTableName ??
|
|
2324
|
+
return c(this, h).migrationTableName ?? Pa;
|
|
2293
2325
|
}, I = function() {
|
|
2294
2326
|
return c(this, h).migrationLockTableName ?? fe;
|
|
2295
|
-
},
|
|
2296
|
-
return c(this, h).allowUnorderedMigrations ??
|
|
2297
|
-
},
|
|
2298
|
-
return c(this, i, N) ? new
|
|
2299
|
-
},
|
|
2327
|
+
}, Ce = function() {
|
|
2328
|
+
return c(this, h).allowUnorderedMigrations ?? ja;
|
|
2329
|
+
}, C = function() {
|
|
2330
|
+
return c(this, i, N) ? new Ia(c(this, i, N)) : new Da();
|
|
2331
|
+
}, be = async function() {
|
|
2300
2332
|
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);
|
|
2301
2333
|
}, xe = async function() {
|
|
2302
2334
|
if (c(this, i, N) && !await u(this, i, G).call(this))
|
|
@@ -2309,7 +2341,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2309
2341
|
}, Te = async function() {
|
|
2310
2342
|
if (!await u(this, i, D).call(this, c(this, i, v)))
|
|
2311
2343
|
try {
|
|
2312
|
-
c(this, i, N) && await u(this, i, F).call(this, c(this, h).db.schema.createSchema(c(this, i, N))), await u(this, i, F).call(this, c(this, h).db.schema.withPlugin(c(this, i,
|
|
2344
|
+
c(this, i, N) && await u(this, i, F).call(this, c(this, h).db.schema.createSchema(c(this, i, N))), await u(this, i, F).call(this, c(this, h).db.schema.withPlugin(c(this, i, C)).createTable(c(this, i, v)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
|
|
2313
2345
|
} catch (e) {
|
|
2314
2346
|
if (!await u(this, i, D).call(this, c(this, i, v)))
|
|
2315
2347
|
throw e;
|
|
@@ -2317,7 +2349,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2317
2349
|
}, Se = async function() {
|
|
2318
2350
|
if (!await u(this, i, D).call(this, c(this, i, I)))
|
|
2319
2351
|
try {
|
|
2320
|
-
await u(this, i, F).call(this, c(this, h).db.schema.withPlugin(c(this, i,
|
|
2352
|
+
await u(this, i, F).call(this, c(this, h).db.schema.withPlugin(c(this, i, C)).createTable(c(this, i, I)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
|
|
2321
2353
|
} catch (e) {
|
|
2322
2354
|
if (!await u(this, i, D).call(this, c(this, i, I)))
|
|
2323
2355
|
throw e;
|
|
@@ -2325,68 +2357,68 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2325
2357
|
}, Oe = async function() {
|
|
2326
2358
|
if (!await u(this, i, H).call(this))
|
|
2327
2359
|
try {
|
|
2328
|
-
await c(this, h).db.withPlugin(c(this, i,
|
|
2360
|
+
await c(this, h).db.withPlugin(c(this, i, C)).insertInto(c(this, i, I)).values({ id: B, is_locked: 0 }).execute();
|
|
2329
2361
|
} catch (e) {
|
|
2330
2362
|
if (!await u(this, i, H).call(this))
|
|
2331
2363
|
throw e;
|
|
2332
2364
|
}
|
|
2333
2365
|
}, G = async function() {
|
|
2334
|
-
return (await c(this, h).db.introspection.getSchemas()).some((
|
|
2366
|
+
return (await c(this, h).db.introspection.getSchemas()).some((a) => a.name === c(this, i, N));
|
|
2335
2367
|
}, D = async function(e) {
|
|
2336
|
-
const
|
|
2368
|
+
const a = c(this, i, N);
|
|
2337
2369
|
return (await c(this, h).db.introspection.getTables({
|
|
2338
2370
|
withInternalKyselyTables: !0
|
|
2339
|
-
})).some((o) => o.name === e && (!
|
|
2371
|
+
})).some((o) => o.name === e && (!a || o.schema === a));
|
|
2340
2372
|
}, H = async function() {
|
|
2341
|
-
return !!await c(this, h).db.withPlugin(c(this, i,
|
|
2373
|
+
return !!await c(this, h).db.withPlugin(c(this, i, C)).selectFrom(c(this, i, I)).where("id", "=", B).select("id").executeTakeFirst();
|
|
2342
2374
|
}, ke = async function(e) {
|
|
2343
|
-
const
|
|
2375
|
+
const a = c(this, h).db.getExecutor().adapter, r = p({
|
|
2344
2376
|
lockTable: c(this, h).migrationLockTableName ?? fe,
|
|
2345
2377
|
lockRowId: B,
|
|
2346
2378
|
lockTableSchema: c(this, h).migrationTableSchema
|
|
2347
2379
|
}), o = async (n) => {
|
|
2348
2380
|
try {
|
|
2349
|
-
await
|
|
2381
|
+
await a.acquireMigrationLock(n, r);
|
|
2350
2382
|
const s = await u(this, i, $e).call(this, n);
|
|
2351
2383
|
if (s.migrations.length === 0)
|
|
2352
2384
|
return { results: [] };
|
|
2353
2385
|
const { direction: l, step: d } = e(s);
|
|
2354
2386
|
return d <= 0 ? { results: [] } : l === "Down" ? await u(this, i, Me).call(this, n, s, d) : l === "Up" ? await u(this, i, Ae).call(this, n, s, d) : { results: [] };
|
|
2355
2387
|
} finally {
|
|
2356
|
-
await
|
|
2388
|
+
await a.releaseMigrationLock(n, r);
|
|
2357
2389
|
}
|
|
2358
2390
|
};
|
|
2359
|
-
return
|
|
2391
|
+
return a.supportsTransactionalDdl ? c(this, h).db.transaction().execute(o) : c(this, h).db.connection().execute(o);
|
|
2360
2392
|
}, $e = async function(e) {
|
|
2361
|
-
const
|
|
2362
|
-
u(this, i, Pe).call(this,
|
|
2363
|
-
const o = u(this, i, Ie).call(this,
|
|
2393
|
+
const a = await u(this, i, X).call(this), r = await u(this, i, De).call(this, e);
|
|
2394
|
+
u(this, i, Pe).call(this, a, r), c(this, i, Ce) || u(this, i, je).call(this, a, r);
|
|
2395
|
+
const o = u(this, i, Ie).call(this, a, r);
|
|
2364
2396
|
return p({
|
|
2365
|
-
migrations:
|
|
2366
|
-
executedMigrations:
|
|
2367
|
-
lastMigration:
|
|
2397
|
+
migrations: a,
|
|
2398
|
+
executedMigrations: r,
|
|
2399
|
+
lastMigration: Ta(r),
|
|
2368
2400
|
pendingMigrations: o
|
|
2369
2401
|
});
|
|
2370
|
-
}, Ie = function(e,
|
|
2371
|
-
return e.filter((
|
|
2402
|
+
}, Ie = function(e, a) {
|
|
2403
|
+
return e.filter((r) => !a.includes(r.name));
|
|
2372
2404
|
}, X = async function() {
|
|
2373
2405
|
const e = await c(this, h).provider.getMigrations();
|
|
2374
|
-
return Object.keys(e).sort().map((
|
|
2375
|
-
...e[
|
|
2376
|
-
name:
|
|
2406
|
+
return Object.keys(e).sort().map((a) => ({
|
|
2407
|
+
...e[a],
|
|
2408
|
+
name: a
|
|
2377
2409
|
}));
|
|
2378
2410
|
}, De = async function(e) {
|
|
2379
|
-
return (await e.withPlugin(c(this, i,
|
|
2380
|
-
}, Pe = function(e,
|
|
2381
|
-
for (const
|
|
2382
|
-
if (!e.some((o) => o.name ===
|
|
2383
|
-
throw new Error(`corrupted migrations: previously executed migration ${
|
|
2384
|
-
}, je = function(e,
|
|
2385
|
-
for (let
|
|
2386
|
-
if (e[
|
|
2387
|
-
throw new Error(`corrupted migrations: expected previously executed migration ${r
|
|
2388
|
-
}, Me = async function(e,
|
|
2389
|
-
const o =
|
|
2411
|
+
return (await e.withPlugin(c(this, i, C)).selectFrom(c(this, i, v)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
|
|
2412
|
+
}, Pe = function(e, a) {
|
|
2413
|
+
for (const r of a)
|
|
2414
|
+
if (!e.some((o) => o.name === r))
|
|
2415
|
+
throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
|
|
2416
|
+
}, je = function(e, a) {
|
|
2417
|
+
for (let r = 0; r < a.length; ++r)
|
|
2418
|
+
if (e[r].name !== a[r])
|
|
2419
|
+
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.`);
|
|
2420
|
+
}, Me = async function(e, a, r) {
|
|
2421
|
+
const o = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((l) => l.name === s)), n = o.map((s) => ({
|
|
2390
2422
|
migrationName: s.name,
|
|
2391
2423
|
direction: "Down",
|
|
2392
2424
|
status: "NotExecuted"
|
|
@@ -2394,7 +2426,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2394
2426
|
for (let s = 0; s < n.length; ++s) {
|
|
2395
2427
|
const l = o[s];
|
|
2396
2428
|
try {
|
|
2397
|
-
l.down && (await l.down(e), await e.withPlugin(c(this, i,
|
|
2429
|
+
l.down && (await l.down(e), await e.withPlugin(c(this, i, C)).deleteFrom(c(this, i, v)).where("name", "=", l.name).execute(), n[s] = {
|
|
2398
2430
|
migrationName: l.name,
|
|
2399
2431
|
direction: "Down",
|
|
2400
2432
|
status: "Success"
|
|
@@ -2411,16 +2443,16 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2411
2443
|
}
|
|
2412
2444
|
}
|
|
2413
2445
|
return { results: n };
|
|
2414
|
-
}, Ae = async function(e,
|
|
2415
|
-
const n =
|
|
2446
|
+
}, Ae = async function(e, a, r) {
|
|
2447
|
+
const n = a.pendingMigrations.slice(0, r).map((s) => ({
|
|
2416
2448
|
migrationName: s.name,
|
|
2417
2449
|
direction: "Up",
|
|
2418
2450
|
status: "NotExecuted"
|
|
2419
2451
|
}));
|
|
2420
2452
|
for (let s = 0; s < n.length; s++) {
|
|
2421
|
-
const l =
|
|
2453
|
+
const l = a.pendingMigrations[s];
|
|
2422
2454
|
try {
|
|
2423
|
-
await l.up(e), await e.withPlugin(c(this, i,
|
|
2455
|
+
await l.up(e), await e.withPlugin(c(this, i, C)).insertInto(c(this, i, v)).values({
|
|
2424
2456
|
name: l.name,
|
|
2425
2457
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2426
2458
|
}).execute(), n[s] = {
|
|
@@ -2445,10 +2477,10 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2445
2477
|
};
|
|
2446
2478
|
var E;
|
|
2447
2479
|
class Q extends Error {
|
|
2448
|
-
constructor(
|
|
2480
|
+
constructor(a) {
|
|
2449
2481
|
super();
|
|
2450
2482
|
w(this, E);
|
|
2451
|
-
M(this, E,
|
|
2483
|
+
M(this, E, a);
|
|
2452
2484
|
}
|
|
2453
2485
|
get resultSet() {
|
|
2454
2486
|
return c(this, E);
|
|
@@ -2464,7 +2496,7 @@ class Fe {
|
|
|
2464
2496
|
return this.migrations;
|
|
2465
2497
|
}
|
|
2466
2498
|
}
|
|
2467
|
-
async function
|
|
2499
|
+
async function Aa(t) {
|
|
2468
2500
|
await t.schema.createTable("tenants").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)").addColumn("audience", "varchar(255)").addColumn("sender_email", "varchar(255)").addColumn("sender_name", "varchar(255)").addColumn("language", "varchar(255)").addColumn("logo", "varchar(255)").addColumn("primary_color", "varchar(255)").addColumn("secondary_color", "varchar(255)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createTable("users").addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn(
|
|
2469
2501
|
"tenant_id",
|
|
2470
2502
|
"varchar(255)",
|
|
@@ -2532,35 +2564,35 @@ async function Ar(t) {
|
|
|
2532
2564
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
2533
2565
|
).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("email_service", "varchar(255)").addColumn("email_api_key", "varchar(255)").addColumn("dkim_private_key", "varchar(2048)").addColumn("dkim_public_key", "varchar(2048)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute();
|
|
2534
2566
|
}
|
|
2535
|
-
async function
|
|
2567
|
+
async function Fa(t) {
|
|
2536
2568
|
await t.schema.dropTable("domains").execute(), await t.schema.dropTable("members").execute(), await t.schema.dropTable("users").execute(), await t.schema.dropTable("connections").execute(), await t.schema.dropTable("applications").execute(), await t.schema.dropTable("migrations").execute(), await t.schema.dropTable("tenants").execute();
|
|
2537
2569
|
}
|
|
2538
|
-
const
|
|
2570
|
+
const La = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2539
2571
|
__proto__: null,
|
|
2540
|
-
down:
|
|
2541
|
-
up:
|
|
2572
|
+
down: Fa,
|
|
2573
|
+
up: Aa
|
|
2542
2574
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2543
|
-
async function
|
|
2575
|
+
async function Ea(t) {
|
|
2544
2576
|
await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
|
|
2545
2577
|
}
|
|
2546
|
-
async function
|
|
2578
|
+
async function Ja(t) {
|
|
2547
2579
|
await t.schema.alterTable("tenants").dropColumn("support_url").execute();
|
|
2548
2580
|
}
|
|
2549
|
-
const
|
|
2581
|
+
const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2550
2582
|
__proto__: null,
|
|
2551
|
-
down:
|
|
2552
|
-
up:
|
|
2583
|
+
down: Ja,
|
|
2584
|
+
up: Ea
|
|
2553
2585
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2554
|
-
async function
|
|
2586
|
+
async function Ra(t) {
|
|
2555
2587
|
}
|
|
2556
|
-
async function
|
|
2588
|
+
async function Ua(t) {
|
|
2557
2589
|
}
|
|
2558
|
-
const
|
|
2590
|
+
const Ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2559
2591
|
__proto__: null,
|
|
2560
|
-
down:
|
|
2561
|
-
up:
|
|
2592
|
+
down: Ua,
|
|
2593
|
+
up: Ra
|
|
2562
2594
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2563
|
-
async function
|
|
2595
|
+
async function Ba(t) {
|
|
2564
2596
|
await t.schema.createTable("logs").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("category", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addForeignKeyConstraint(
|
|
2565
2597
|
"tenant_id_constraint",
|
|
2566
2598
|
["tenant_id"],
|
|
@@ -2569,24 +2601,24 @@ async function Br(t) {
|
|
|
2569
2601
|
(e) => e.onDelete("cascade")
|
|
2570
2602
|
).addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (e) => e.notNull()).addColumn("date", "varchar(25)", (e) => e.notNull()).addColumn("client_id", "varchar(255)").addColumn("client_name", "varchar(255)").addColumn("user_agent", "varchar(255)").addColumn("description", "varchar(255)").addColumn("details", "varchar(2048)").execute();
|
|
2571
2603
|
}
|
|
2572
|
-
async function
|
|
2604
|
+
async function Qa(t) {
|
|
2573
2605
|
await t.schema.dropTable("logs").execute();
|
|
2574
2606
|
}
|
|
2575
|
-
const
|
|
2607
|
+
const Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2576
2608
|
__proto__: null,
|
|
2577
|
-
down:
|
|
2578
|
-
up:
|
|
2609
|
+
down: Qa,
|
|
2610
|
+
up: Ba
|
|
2579
2611
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2580
|
-
async function
|
|
2612
|
+
async function Wa(t) {
|
|
2581
2613
|
}
|
|
2582
|
-
async function
|
|
2614
|
+
async function qa(t) {
|
|
2583
2615
|
}
|
|
2584
|
-
const
|
|
2616
|
+
const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2585
2617
|
__proto__: null,
|
|
2586
|
-
down:
|
|
2587
|
-
up:
|
|
2618
|
+
down: qa,
|
|
2619
|
+
up: Wa
|
|
2588
2620
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2589
|
-
async function
|
|
2621
|
+
async function Ha(t) {
|
|
2590
2622
|
await t.schema.createTable("sessions").addColumn("session_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
2591
2623
|
"client_id",
|
|
2592
2624
|
"varchar(255)",
|
|
@@ -2615,15 +2647,15 @@ async function Hr(t) {
|
|
|
2615
2647
|
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
2616
2648
|
).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("send", "varchar(255)").addColumn("nonce", "varchar(255)").addColumn("state", "varchar(1024)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute(), await t.schema.createIndex("otps_email_index").on("otps").column("email").execute(), await t.schema.createIndex("otps_expires_at_index").on("otps").column("expires_at").execute();
|
|
2617
2649
|
}
|
|
2618
|
-
async function
|
|
2650
|
+
async function Xa(t) {
|
|
2619
2651
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
|
|
2620
2652
|
}
|
|
2621
|
-
const
|
|
2653
|
+
const Ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2622
2654
|
__proto__: null,
|
|
2623
|
-
down:
|
|
2624
|
-
up:
|
|
2655
|
+
down: Xa,
|
|
2656
|
+
up: Ha
|
|
2625
2657
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2626
|
-
async function
|
|
2658
|
+
async function Za(t) {
|
|
2627
2659
|
await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
|
|
2628
2660
|
"user_id_constraint",
|
|
2629
2661
|
["user_id", "tenant_id"],
|
|
@@ -2638,24 +2670,24 @@ async function Zr(t) {
|
|
|
2638
2670
|
(e) => e.onDelete("cascade")
|
|
2639
2671
|
).addColumn("type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute(), await t.schema.createIndex("codes_expires_at_index").on("codes").column("expires_at").execute();
|
|
2640
2672
|
}
|
|
2641
|
-
async function
|
|
2673
|
+
async function er(t) {
|
|
2642
2674
|
await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
|
|
2643
2675
|
}
|
|
2644
|
-
const
|
|
2676
|
+
const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2645
2677
|
__proto__: null,
|
|
2646
|
-
down:
|
|
2647
|
-
up:
|
|
2678
|
+
down: er,
|
|
2679
|
+
up: Za
|
|
2648
2680
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2649
|
-
async function
|
|
2681
|
+
async function ar(t) {
|
|
2650
2682
|
}
|
|
2651
|
-
async function
|
|
2683
|
+
async function rr(t) {
|
|
2652
2684
|
}
|
|
2653
|
-
const
|
|
2685
|
+
const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2654
2686
|
__proto__: null,
|
|
2655
|
-
down:
|
|
2656
|
-
up:
|
|
2687
|
+
down: rr,
|
|
2688
|
+
up: ar
|
|
2657
2689
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2658
|
-
async function
|
|
2690
|
+
async function or(t) {
|
|
2659
2691
|
await t.schema.alterTable("passwords").addColumn(
|
|
2660
2692
|
"password",
|
|
2661
2693
|
"varchar(255)",
|
|
@@ -2663,172 +2695,172 @@ async function oa(t) {
|
|
|
2663
2695
|
(e) => e.notNull()
|
|
2664
2696
|
).execute();
|
|
2665
2697
|
}
|
|
2666
|
-
async function
|
|
2698
|
+
async function sr(t) {
|
|
2667
2699
|
await t.schema.alterTable("passwords").dropColumn("password").execute();
|
|
2668
2700
|
}
|
|
2669
|
-
const
|
|
2701
|
+
const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2670
2702
|
__proto__: null,
|
|
2671
|
-
down:
|
|
2672
|
-
up:
|
|
2703
|
+
down: sr,
|
|
2704
|
+
up: or
|
|
2673
2705
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2674
|
-
async function
|
|
2706
|
+
async function lr(t) {
|
|
2675
2707
|
}
|
|
2676
|
-
async function
|
|
2708
|
+
async function cr(t) {
|
|
2677
2709
|
}
|
|
2678
|
-
const
|
|
2710
|
+
const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2679
2711
|
__proto__: null,
|
|
2680
|
-
down:
|
|
2681
|
-
up:
|
|
2712
|
+
down: cr,
|
|
2713
|
+
up: lr
|
|
2682
2714
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2683
|
-
async function
|
|
2715
|
+
async function ur(t) {
|
|
2684
2716
|
}
|
|
2685
|
-
async function
|
|
2717
|
+
async function mr(t) {
|
|
2686
2718
|
}
|
|
2687
|
-
const
|
|
2719
|
+
const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2688
2720
|
__proto__: null,
|
|
2689
|
-
down:
|
|
2690
|
-
up:
|
|
2721
|
+
down: mr,
|
|
2722
|
+
up: ur
|
|
2691
2723
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2692
|
-
async function
|
|
2724
|
+
async function fr(t) {
|
|
2693
2725
|
}
|
|
2694
|
-
async function
|
|
2726
|
+
async function _r(t) {
|
|
2695
2727
|
}
|
|
2696
|
-
const
|
|
2728
|
+
const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2697
2729
|
__proto__: null,
|
|
2698
|
-
down:
|
|
2699
|
-
up:
|
|
2730
|
+
down: _r,
|
|
2731
|
+
up: fr
|
|
2700
2732
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2701
|
-
async function
|
|
2733
|
+
async function gr(t) {
|
|
2702
2734
|
await t.schema.createIndex("users_email_index").on("users").column("email").execute();
|
|
2703
2735
|
}
|
|
2704
|
-
async function
|
|
2736
|
+
async function wr(t) {
|
|
2705
2737
|
await t.schema.dropIndex("users_email_index").execute();
|
|
2706
2738
|
}
|
|
2707
|
-
const
|
|
2739
|
+
const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2708
2740
|
__proto__: null,
|
|
2709
|
-
down:
|
|
2710
|
-
up:
|
|
2741
|
+
down: wr,
|
|
2742
|
+
up: gr
|
|
2711
2743
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2712
|
-
async function
|
|
2744
|
+
async function Nr(t) {
|
|
2713
2745
|
await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
|
|
2714
2746
|
}
|
|
2715
|
-
async function
|
|
2747
|
+
async function vr(t) {
|
|
2716
2748
|
await t.schema.alterTable("users").dropColumn("profileData").execute();
|
|
2717
2749
|
}
|
|
2718
|
-
const
|
|
2750
|
+
const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2719
2751
|
__proto__: null,
|
|
2720
|
-
down:
|
|
2721
|
-
up:
|
|
2752
|
+
down: vr,
|
|
2753
|
+
up: Nr
|
|
2722
2754
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2723
|
-
async function
|
|
2755
|
+
async function br(t) {
|
|
2724
2756
|
await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
|
|
2725
2757
|
}
|
|
2726
|
-
async function
|
|
2758
|
+
async function xr(t) {
|
|
2727
2759
|
await t.schema.dropIndex("users_linked_to_index");
|
|
2728
2760
|
}
|
|
2729
|
-
const
|
|
2761
|
+
const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2730
2762
|
__proto__: null,
|
|
2731
|
-
down:
|
|
2732
|
-
up:
|
|
2763
|
+
down: xr,
|
|
2764
|
+
up: br
|
|
2733
2765
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2734
|
-
async function
|
|
2766
|
+
async function Sr(t) {
|
|
2735
2767
|
await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
|
|
2736
2768
|
}
|
|
2737
|
-
async function
|
|
2769
|
+
async function Or(t) {
|
|
2738
2770
|
await t.schema.alterTable("users").dropColumn("locale").execute();
|
|
2739
2771
|
}
|
|
2740
|
-
const
|
|
2772
|
+
const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2741
2773
|
__proto__: null,
|
|
2742
|
-
down:
|
|
2743
|
-
up:
|
|
2774
|
+
down: Or,
|
|
2775
|
+
up: Sr
|
|
2744
2776
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2745
|
-
async function $
|
|
2777
|
+
async function $r(t) {
|
|
2746
2778
|
await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
2747
2779
|
"tenant_id",
|
|
2748
2780
|
"varchar(255)",
|
|
2749
2781
|
(e) => e.references("tenants.id").onDelete("cascade")
|
|
2750
2782
|
).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("revoked_at", "varchar(255)").addColumn("cert", "varchar(2048)").addColumn("pkcs7", "varchar(2048)").addColumn("fingerprint", "varchar(256)").addColumn("thumbprint", "varchar(256)").addColumn("current_since", "varchar(256)").addColumn("current_until", "varchar(256)").execute();
|
|
2751
2783
|
}
|
|
2752
|
-
async function
|
|
2784
|
+
async function Ir(t) {
|
|
2753
2785
|
await t.schema.dropTable("keys").execute();
|
|
2754
2786
|
}
|
|
2755
|
-
const
|
|
2787
|
+
const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2756
2788
|
__proto__: null,
|
|
2757
|
-
down:
|
|
2758
|
-
up: $
|
|
2789
|
+
down: Ir,
|
|
2790
|
+
up: $r
|
|
2759
2791
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2760
|
-
async function
|
|
2792
|
+
async function Pr(t) {
|
|
2761
2793
|
}
|
|
2762
|
-
async function
|
|
2794
|
+
async function jr(t) {
|
|
2763
2795
|
}
|
|
2764
|
-
const
|
|
2796
|
+
const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2765
2797
|
__proto__: null,
|
|
2766
|
-
down:
|
|
2767
|
-
up:
|
|
2798
|
+
down: jr,
|
|
2799
|
+
up: Pr
|
|
2768
2800
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2769
|
-
async function
|
|
2801
|
+
async function Ar(t) {
|
|
2770
2802
|
}
|
|
2771
|
-
async function
|
|
2803
|
+
async function Fr(t) {
|
|
2772
2804
|
}
|
|
2773
|
-
const
|
|
2805
|
+
const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2774
2806
|
__proto__: null,
|
|
2775
|
-
down:
|
|
2776
|
-
up:
|
|
2807
|
+
down: Fr,
|
|
2808
|
+
up: Ar
|
|
2777
2809
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2778
|
-
async function
|
|
2810
|
+
async function Er(t) {
|
|
2779
2811
|
await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
|
|
2780
2812
|
}
|
|
2781
|
-
async function
|
|
2813
|
+
async function Jr(t) {
|
|
2782
2814
|
await t.schema.alterTable("otps").dropColumn("audience").execute();
|
|
2783
2815
|
}
|
|
2784
|
-
const
|
|
2816
|
+
const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2785
2817
|
__proto__: null,
|
|
2786
|
-
down:
|
|
2787
|
-
up:
|
|
2818
|
+
down: Jr,
|
|
2819
|
+
up: Er
|
|
2788
2820
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2789
|
-
async function
|
|
2821
|
+
async function Rr(t) {
|
|
2790
2822
|
}
|
|
2791
|
-
async function
|
|
2823
|
+
async function Ur(t) {
|
|
2792
2824
|
}
|
|
2793
|
-
const
|
|
2825
|
+
const Kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2794
2826
|
__proto__: null,
|
|
2795
|
-
down:
|
|
2796
|
-
up:
|
|
2827
|
+
down: Ur,
|
|
2828
|
+
up: Rr
|
|
2797
2829
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2798
|
-
async function
|
|
2830
|
+
async function Br(t) {
|
|
2799
2831
|
await t.schema.alterTable("logs").dropColumn("category").execute();
|
|
2800
2832
|
}
|
|
2801
|
-
async function
|
|
2833
|
+
async function Qr(t) {
|
|
2802
2834
|
await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
|
|
2803
2835
|
}
|
|
2804
|
-
const
|
|
2836
|
+
const Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2805
2837
|
__proto__: null,
|
|
2806
|
-
down:
|
|
2807
|
-
up:
|
|
2838
|
+
down: Qr,
|
|
2839
|
+
up: Br
|
|
2808
2840
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2809
|
-
async function
|
|
2841
|
+
async function Wr(t) {
|
|
2810
2842
|
await t.schema.alterTable("users").dropColumn("tags").execute();
|
|
2811
2843
|
}
|
|
2812
|
-
async function
|
|
2844
|
+
async function qr(t) {
|
|
2813
2845
|
await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
|
|
2814
2846
|
}
|
|
2815
|
-
const
|
|
2847
|
+
const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2816
2848
|
__proto__: null,
|
|
2817
|
-
down:
|
|
2818
|
-
up:
|
|
2849
|
+
down: qr,
|
|
2850
|
+
up: Wr
|
|
2819
2851
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2820
|
-
async function
|
|
2852
|
+
async function Hr(t) {
|
|
2821
2853
|
await t.schema.createIndex("logs_user_id").on("logs").column("user_id").execute(), await t.schema.createIndex("logs_tenant_id").on("logs").column("tenant_id").execute(), await t.schema.createIndex("logs_date").on("logs").column("date").execute();
|
|
2822
2854
|
}
|
|
2823
|
-
async function
|
|
2855
|
+
async function Xr(t) {
|
|
2824
2856
|
await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
|
|
2825
2857
|
}
|
|
2826
|
-
const
|
|
2858
|
+
const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2827
2859
|
__proto__: null,
|
|
2828
|
-
down:
|
|
2829
|
-
up:
|
|
2860
|
+
down: Xr,
|
|
2861
|
+
up: Hr
|
|
2830
2862
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2831
|
-
async function
|
|
2863
|
+
async function Zr(t) {
|
|
2832
2864
|
await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
|
|
2833
2865
|
}
|
|
2834
2866
|
async function en(t) {
|
|
@@ -2837,18 +2869,18 @@ async function en(t) {
|
|
|
2837
2869
|
const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2838
2870
|
__proto__: null,
|
|
2839
2871
|
down: en,
|
|
2840
|
-
up:
|
|
2872
|
+
up: Zr
|
|
2841
2873
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2842
|
-
async function
|
|
2874
|
+
async function an(t) {
|
|
2843
2875
|
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();
|
|
2844
2876
|
}
|
|
2845
|
-
async function
|
|
2877
|
+
async function rn(t) {
|
|
2846
2878
|
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();
|
|
2847
2879
|
}
|
|
2848
2880
|
const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2849
2881
|
__proto__: null,
|
|
2850
|
-
down:
|
|
2851
|
-
up:
|
|
2882
|
+
down: rn,
|
|
2883
|
+
up: an
|
|
2852
2884
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2853
2885
|
async function on(t) {
|
|
2854
2886
|
await t.schema.createIndex("users_name_index").on("users").column("name").execute();
|
|
@@ -2910,11 +2942,11 @@ const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2910
2942
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2911
2943
|
async function vn(t) {
|
|
2912
2944
|
}
|
|
2913
|
-
async function
|
|
2945
|
+
async function Cn(t) {
|
|
2914
2946
|
}
|
|
2915
|
-
const
|
|
2947
|
+
const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2916
2948
|
__proto__: null,
|
|
2917
|
-
down:
|
|
2949
|
+
down: Cn,
|
|
2918
2950
|
up: vn
|
|
2919
2951
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2920
2952
|
async function xn(t) {
|
|
@@ -2972,16 +3004,16 @@ const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2972
3004
|
down: Ln,
|
|
2973
3005
|
up: Fn
|
|
2974
3006
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2975
|
-
async function
|
|
3007
|
+
async function Jn(t) {
|
|
2976
3008
|
await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
|
|
2977
3009
|
}
|
|
2978
|
-
async function
|
|
3010
|
+
async function zn(t) {
|
|
2979
3011
|
await t.schema.alterTable("otps").dropColumn("ip").execute();
|
|
2980
3012
|
}
|
|
2981
3013
|
const Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2982
3014
|
__proto__: null,
|
|
2983
|
-
down:
|
|
2984
|
-
up:
|
|
3015
|
+
down: zn,
|
|
3016
|
+
up: Jn
|
|
2985
3017
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2986
3018
|
async function Un(t) {
|
|
2987
3019
|
await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
|
|
@@ -3035,12 +3067,12 @@ async function eo(t) {
|
|
|
3035
3067
|
}
|
|
3036
3068
|
async function to(t) {
|
|
3037
3069
|
}
|
|
3038
|
-
const
|
|
3070
|
+
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3039
3071
|
__proto__: null,
|
|
3040
3072
|
down: to,
|
|
3041
3073
|
up: eo
|
|
3042
3074
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3043
|
-
async function
|
|
3075
|
+
async function ro(t) {
|
|
3044
3076
|
await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3045
3077
|
"tenant_id",
|
|
3046
3078
|
"varchar(255)",
|
|
@@ -3069,7 +3101,7 @@ async function no(t) {
|
|
|
3069
3101
|
const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3070
3102
|
__proto__: null,
|
|
3071
3103
|
down: no,
|
|
3072
|
-
up:
|
|
3104
|
+
up: ro
|
|
3073
3105
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3074
3106
|
async function so(t) {
|
|
3075
3107
|
}
|
|
@@ -3120,16 +3152,16 @@ const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3120
3152
|
down: No,
|
|
3121
3153
|
up: yo
|
|
3122
3154
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3123
|
-
async function
|
|
3155
|
+
async function Co(t) {
|
|
3124
3156
|
await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
|
|
3125
3157
|
}
|
|
3126
|
-
async function
|
|
3158
|
+
async function bo(t) {
|
|
3127
3159
|
await t.schema.alterTable("logins").dropColumn("nonce").execute();
|
|
3128
3160
|
}
|
|
3129
3161
|
const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3130
3162
|
__proto__: null,
|
|
3131
|
-
down:
|
|
3132
|
-
up:
|
|
3163
|
+
down: bo,
|
|
3164
|
+
up: Co
|
|
3133
3165
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3134
3166
|
async function To(t) {
|
|
3135
3167
|
}
|
|
@@ -3216,19 +3248,19 @@ async function Lo(t) {
|
|
|
3216
3248
|
async function Eo(t) {
|
|
3217
3249
|
await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
|
|
3218
3250
|
}
|
|
3219
|
-
const
|
|
3251
|
+
const Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3220
3252
|
__proto__: null,
|
|
3221
3253
|
down: Eo,
|
|
3222
3254
|
up: Lo
|
|
3223
3255
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3224
|
-
async function
|
|
3256
|
+
async function zo(t) {
|
|
3225
3257
|
}
|
|
3226
3258
|
async function Ro(t) {
|
|
3227
3259
|
}
|
|
3228
3260
|
const Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3229
3261
|
__proto__: null,
|
|
3230
3262
|
down: Ro,
|
|
3231
|
-
up:
|
|
3263
|
+
up: zo
|
|
3232
3264
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3233
3265
|
async function Ko(t) {
|
|
3234
3266
|
await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
|
|
@@ -3287,12 +3319,12 @@ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3287
3319
|
async function ts(t) {
|
|
3288
3320
|
await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
|
|
3289
3321
|
}
|
|
3290
|
-
async function
|
|
3322
|
+
async function as(t) {
|
|
3291
3323
|
await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
|
|
3292
3324
|
}
|
|
3293
|
-
const
|
|
3325
|
+
const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3294
3326
|
__proto__: null,
|
|
3295
|
-
down:
|
|
3327
|
+
down: as,
|
|
3296
3328
|
up: ts
|
|
3297
3329
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3298
3330
|
async function ns(t) {
|
|
@@ -3375,15 +3407,15 @@ const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3375
3407
|
down: Ns,
|
|
3376
3408
|
up: ys
|
|
3377
3409
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3378
|
-
async function bs(t) {
|
|
3379
|
-
}
|
|
3380
3410
|
async function Cs(t) {
|
|
3411
|
+
}
|
|
3412
|
+
async function bs(t) {
|
|
3381
3413
|
await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
|
|
3382
3414
|
}
|
|
3383
3415
|
const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3384
3416
|
__proto__: null,
|
|
3385
|
-
down:
|
|
3386
|
-
up:
|
|
3417
|
+
down: bs,
|
|
3418
|
+
up: Cs
|
|
3387
3419
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3388
3420
|
async function Ts(t) {
|
|
3389
3421
|
await t.schema.createTable("refresh_tokens").addColumn(
|
|
@@ -3407,31 +3439,42 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3407
3439
|
__proto__: null,
|
|
3408
3440
|
down: Ss,
|
|
3409
3441
|
up: Ts
|
|
3442
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3443
|
+
async function ks(t) {
|
|
3444
|
+
await t.schema.alterTable("sessions").addColumn("id", "varchar(21)").execute(), await t.schema.alterTable("sessions").addColumn("idle_expires_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("updated_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("authenticated_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("revoked_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("last_interaction_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("device", "varchar(2048)").execute(), await t.schema.alterTable("sessions").addColumn("clients", "varchar(1024)").execute(), await t.schema.alterTable("sessions").dropColumn("expires_at").execute(), await t.schema.alterTable("sessions").addColumn("expires_at", "varchar(35)").execute();
|
|
3445
|
+
}
|
|
3446
|
+
async function $s(t) {
|
|
3447
|
+
await t.schema.alterTable("sessions").dropColumn("id").dropColumn("idle_expires_at").dropColumn("updated_at").dropColumn("revoked_at").dropColumn("authenticated_at").dropColumn("last_interaction_at").dropColumn("device").dropColumn("clients").execute();
|
|
3448
|
+
}
|
|
3449
|
+
const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3450
|
+
__proto__: null,
|
|
3451
|
+
down: $s,
|
|
3452
|
+
up: ks
|
|
3410
3453
|
}, Symbol.toStringTag, { value: "Module" })), Le = {
|
|
3411
|
-
m1_init:
|
|
3412
|
-
m2_magicLink:
|
|
3413
|
-
m3_updateAt:
|
|
3414
|
-
m4_logTable:
|
|
3415
|
-
m5_userProfile:
|
|
3416
|
-
m6_sessions:
|
|
3417
|
-
m7_passwords:
|
|
3418
|
-
m8_logsTableNewFields:
|
|
3419
|
-
m9_passwordTableNewField:
|
|
3420
|
-
n01_codesTable:
|
|
3421
|
-
n11_universalLoginSession:
|
|
3422
|
-
n12_userFields:
|
|
3423
|
-
n13_userEmailIndex:
|
|
3424
|
-
n14_profileDataField:
|
|
3425
|
-
n15_userEmailIndex:
|
|
3426
|
-
n16_userLocale:
|
|
3427
|
-
n17_signingKeys:
|
|
3428
|
-
n18_logsFields:
|
|
3429
|
-
n19_connectionsUserinfo:
|
|
3430
|
-
n20_missingFields:
|
|
3431
|
-
n21_sessionDeletedAt:
|
|
3432
|
-
n22_dropLogsFields:
|
|
3433
|
-
n23_dropUsersFields:
|
|
3434
|
-
n24_logsIndexes:
|
|
3454
|
+
m1_init: La,
|
|
3455
|
+
m2_magicLink: za,
|
|
3456
|
+
m3_updateAt: Ka,
|
|
3457
|
+
m4_logTable: Va,
|
|
3458
|
+
m5_userProfile: Ga,
|
|
3459
|
+
m6_sessions: Ya,
|
|
3460
|
+
m7_passwords: tr,
|
|
3461
|
+
m8_logsTableNewFields: nr,
|
|
3462
|
+
m9_passwordTableNewField: ir,
|
|
3463
|
+
n01_codesTable: dr,
|
|
3464
|
+
n11_universalLoginSession: hr,
|
|
3465
|
+
n12_userFields: pr,
|
|
3466
|
+
n13_userEmailIndex: yr,
|
|
3467
|
+
n14_profileDataField: Cr,
|
|
3468
|
+
n15_userEmailIndex: Tr,
|
|
3469
|
+
n16_userLocale: kr,
|
|
3470
|
+
n17_signingKeys: Dr,
|
|
3471
|
+
n18_logsFields: Mr,
|
|
3472
|
+
n19_connectionsUserinfo: Lr,
|
|
3473
|
+
n20_missingFields: zr,
|
|
3474
|
+
n21_sessionDeletedAt: Kr,
|
|
3475
|
+
n22_dropLogsFields: Vr,
|
|
3476
|
+
n23_dropUsersFields: Gr,
|
|
3477
|
+
n24_logsIndexes: Yr,
|
|
3435
3478
|
n25_logDescMaxLength: tn,
|
|
3436
3479
|
n26_logsTableExtraFields: nn,
|
|
3437
3480
|
n27_usersTableNameIndex: ln,
|
|
@@ -3439,7 +3482,7 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3439
3482
|
n29_increaseOtpStateLength: fn,
|
|
3440
3483
|
n30_increaseTicketStateLength: gn,
|
|
3441
3484
|
n31_branding: Nn,
|
|
3442
|
-
n32_indexesAndNotNull:
|
|
3485
|
+
n32_indexesAndNotNull: bn,
|
|
3443
3486
|
n33_vendorIdInUniversalLoginSession: Sn,
|
|
3444
3487
|
n34_auth0ClientInUniversalLoginSession: $n,
|
|
3445
3488
|
n35_increaseUniversalSessionStateLength: Pn,
|
|
@@ -3450,7 +3493,7 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3450
3493
|
n40_userId: Wn,
|
|
3451
3494
|
n41_hooks: Hn,
|
|
3452
3495
|
n42_userIdIndexes: Zn,
|
|
3453
|
-
n43_userIdIndexes:
|
|
3496
|
+
n43_userIdIndexes: ao,
|
|
3454
3497
|
n44_codes: oo,
|
|
3455
3498
|
n45_hookProperties: lo,
|
|
3456
3499
|
n46_loginAuth0Client: mo,
|
|
@@ -3462,13 +3505,13 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3462
3505
|
n52_cert: Io,
|
|
3463
3506
|
n53_codes_primary_key: jo,
|
|
3464
3507
|
n54_cleanup_tables: Fo,
|
|
3465
|
-
n55_logs_index:
|
|
3508
|
+
n55_logs_index: Jo,
|
|
3466
3509
|
n56_application_fields: Uo,
|
|
3467
3510
|
n57_prompt_settings: Qo,
|
|
3468
3511
|
n58_connection_client_id: qo,
|
|
3469
3512
|
n59_connection_options: Xo,
|
|
3470
3513
|
n60_users_metadata: es,
|
|
3471
|
-
n61_userLocales:
|
|
3514
|
+
n61_userLocales: rs,
|
|
3472
3515
|
n62_prompt: ss,
|
|
3473
3516
|
n63_connection_cleanup: cs,
|
|
3474
3517
|
n64_act_as: ms,
|
|
@@ -3476,14 +3519,15 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3476
3519
|
n66_email_providers: ws,
|
|
3477
3520
|
n67_drop_tickets: vs,
|
|
3478
3521
|
n68_login_useragents: xs,
|
|
3479
|
-
n70_refresh_tokens: Os
|
|
3522
|
+
n70_refresh_tokens: Os,
|
|
3523
|
+
n71_session_new_fields: Is
|
|
3480
3524
|
};
|
|
3481
|
-
async function
|
|
3525
|
+
async function As(t, e = !1) {
|
|
3482
3526
|
e && console.log("migrating...");
|
|
3483
|
-
const
|
|
3527
|
+
const a = new Fe(Le), r = new ve({
|
|
3484
3528
|
db: t,
|
|
3485
|
-
provider:
|
|
3486
|
-
}), { error: o, results: n } = await
|
|
3529
|
+
provider: a
|
|
3530
|
+
}), { error: o, results: n } = await r.migrateToLatest();
|
|
3487
3531
|
if (n == null || n.forEach((s) => {
|
|
3488
3532
|
s.status === "Success" ? e && console.log(
|
|
3489
3533
|
`migration "${s.migrationName}" was executed successfully`
|
|
@@ -3491,41 +3535,41 @@ async function Ps(t, e = !1) {
|
|
|
3491
3535
|
}), o)
|
|
3492
3536
|
throw console.error("failed to migrate"), console.error(o), o;
|
|
3493
3537
|
}
|
|
3494
|
-
async function
|
|
3538
|
+
async function Fs(t) {
|
|
3495
3539
|
console.log("migrating...");
|
|
3496
|
-
const e = new Fe(Le),
|
|
3540
|
+
const e = new Fe(Le), a = new ve({
|
|
3497
3541
|
db: t,
|
|
3498
3542
|
provider: e
|
|
3499
|
-
}), { error:
|
|
3543
|
+
}), { error: r, results: o } = await a.migrateDown();
|
|
3500
3544
|
if (o == null || o.forEach((n) => {
|
|
3501
3545
|
n.status === "Success" ? console.log(`migration "${n.migrationName}" was reverted successfully`) : n.status === "Error" && console.error(`failed to execute migration "${n.migrationName}"`);
|
|
3502
|
-
}),
|
|
3503
|
-
throw console.error("failed to migrate"), console.error(
|
|
3546
|
+
}), r)
|
|
3547
|
+
throw console.error("failed to migrate"), console.error(r), r;
|
|
3504
3548
|
}
|
|
3505
|
-
function
|
|
3549
|
+
function Ls(t) {
|
|
3506
3550
|
return {
|
|
3507
3551
|
applications: Dt(t),
|
|
3508
3552
|
branding: qt(t),
|
|
3509
3553
|
clients: Et(t),
|
|
3510
3554
|
codes: Tt(t),
|
|
3511
3555
|
connections: Lt(t),
|
|
3512
|
-
emailProviders:
|
|
3556
|
+
emailProviders: wa(t),
|
|
3513
3557
|
domains: Qt(t),
|
|
3514
|
-
hooks:
|
|
3558
|
+
hooks: ea(t),
|
|
3515
3559
|
keys: Ut(t),
|
|
3516
|
-
logins:
|
|
3560
|
+
logins: ua(t),
|
|
3517
3561
|
logs: ct(t),
|
|
3518
3562
|
passwords: yt(t),
|
|
3519
|
-
promptSettings:
|
|
3520
|
-
refreshTokens:
|
|
3563
|
+
promptSettings: fa(t),
|
|
3564
|
+
refreshTokens: xa(t),
|
|
3521
3565
|
sessions: _t(t),
|
|
3522
3566
|
tenants: nt(t),
|
|
3523
|
-
themes:
|
|
3567
|
+
themes: sa(t),
|
|
3524
3568
|
users: Xe(t)
|
|
3525
3569
|
};
|
|
3526
3570
|
}
|
|
3527
3571
|
export {
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3572
|
+
Ls as default,
|
|
3573
|
+
Fs as migrateDown,
|
|
3574
|
+
As as migrateToLatest
|
|
3531
3575
|
};
|