@authhero/kysely-adapter 5.0.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 +757 -714
- 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,74 +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
|
-
...
|
|
1084
|
-
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1085
|
-
expires_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1112
|
+
function Na(t) {
|
|
1113
|
+
return async (e, a) => {
|
|
1114
|
+
const r = {
|
|
1115
|
+
...a,
|
|
1116
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1086
1117
|
};
|
|
1087
|
-
return await t.insertInto("refresh_tokens").values({ ...
|
|
1118
|
+
return await t.insertInto("refresh_tokens").values({ ...r, tenant_id: e }).execute(), { ...a, ...r };
|
|
1088
1119
|
};
|
|
1089
1120
|
}
|
|
1090
|
-
function
|
|
1091
|
-
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;
|
|
1092
1123
|
}
|
|
1093
|
-
function
|
|
1094
|
-
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;
|
|
1095
1126
|
}
|
|
1096
|
-
function
|
|
1097
|
-
return async (e,
|
|
1127
|
+
function ba(t) {
|
|
1128
|
+
return async (e, a = {
|
|
1098
1129
|
page: 0,
|
|
1099
1130
|
per_page: 50,
|
|
1100
1131
|
include_totals: !1
|
|
1101
1132
|
}) => {
|
|
1102
|
-
let
|
|
1103
|
-
|
|
1104
|
-
let o =
|
|
1105
|
-
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) {
|
|
1106
1137
|
const { ref: d } = t.dynamic;
|
|
1107
1138
|
o = o.orderBy(
|
|
1108
|
-
d(
|
|
1109
|
-
|
|
1139
|
+
d(a.sort.sort_by),
|
|
1140
|
+
a.sort.sort_order
|
|
1110
1141
|
);
|
|
1111
1142
|
}
|
|
1112
|
-
o = o.offset(
|
|
1113
|
-
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);
|
|
1114
1145
|
return {
|
|
1115
1146
|
refresh_tokens: n,
|
|
1116
|
-
start:
|
|
1117
|
-
limit:
|
|
1147
|
+
start: a.page * a.per_page,
|
|
1148
|
+
limit: a.per_page,
|
|
1118
1149
|
length: l
|
|
1119
1150
|
};
|
|
1120
1151
|
};
|
|
1121
1152
|
}
|
|
1122
|
-
function
|
|
1153
|
+
function xa(t) {
|
|
1123
1154
|
return {
|
|
1124
|
-
create:
|
|
1125
|
-
get:
|
|
1126
|
-
list:
|
|
1127
|
-
remove:
|
|
1128
|
-
update:
|
|
1155
|
+
create: Na(t),
|
|
1156
|
+
get: ya(t),
|
|
1157
|
+
list: ba(t),
|
|
1158
|
+
remove: va(t),
|
|
1159
|
+
update: Ca(t)
|
|
1129
1160
|
};
|
|
1130
1161
|
}
|
|
1131
|
-
function
|
|
1162
|
+
function Ta(t) {
|
|
1132
1163
|
return t[t.length - 1];
|
|
1133
1164
|
}
|
|
1134
1165
|
function p(t) {
|
|
1135
1166
|
return Object.freeze(t);
|
|
1136
1167
|
}
|
|
1137
|
-
const
|
|
1168
|
+
const z = p({
|
|
1138
1169
|
is(t) {
|
|
1139
1170
|
return t.kind === "IdentifierNode";
|
|
1140
1171
|
},
|
|
@@ -1151,17 +1182,17 @@ const J = p({
|
|
|
1151
1182
|
create(t) {
|
|
1152
1183
|
return p({
|
|
1153
1184
|
kind: "SchemableIdentifierNode",
|
|
1154
|
-
identifier:
|
|
1185
|
+
identifier: z.create(t)
|
|
1155
1186
|
});
|
|
1156
1187
|
},
|
|
1157
1188
|
createWithSchema(t, e) {
|
|
1158
1189
|
return p({
|
|
1159
1190
|
kind: "SchemableIdentifierNode",
|
|
1160
|
-
schema:
|
|
1161
|
-
identifier:
|
|
1191
|
+
schema: z.create(t),
|
|
1192
|
+
identifier: z.create(e)
|
|
1162
1193
|
});
|
|
1163
1194
|
}
|
|
1164
|
-
}),
|
|
1195
|
+
}), Sa = p({
|
|
1165
1196
|
is(t) {
|
|
1166
1197
|
return t.kind === "AliasNode";
|
|
1167
1198
|
},
|
|
@@ -1190,7 +1221,7 @@ const J = p({
|
|
|
1190
1221
|
}
|
|
1191
1222
|
});
|
|
1192
1223
|
var R;
|
|
1193
|
-
class
|
|
1224
|
+
class Oa {
|
|
1194
1225
|
constructor() {
|
|
1195
1226
|
j(this, "nodeStack", []);
|
|
1196
1227
|
w(this, R, p({
|
|
@@ -1293,14 +1324,14 @@ class Or {
|
|
|
1293
1324
|
if (!e)
|
|
1294
1325
|
return e;
|
|
1295
1326
|
this.nodeStack.push(e);
|
|
1296
|
-
const
|
|
1297
|
-
return this.nodeStack.pop(), p(
|
|
1327
|
+
const a = this.transformNodeImpl(e);
|
|
1328
|
+
return this.nodeStack.pop(), p(a);
|
|
1298
1329
|
}
|
|
1299
1330
|
transformNodeImpl(e) {
|
|
1300
1331
|
return c(this, R)[e.kind](e);
|
|
1301
1332
|
}
|
|
1302
1333
|
transformNodeList(e) {
|
|
1303
|
-
return e && p(e.map((
|
|
1334
|
+
return e && p(e.map((a) => this.transformNode(a)));
|
|
1304
1335
|
}
|
|
1305
1336
|
transformSelectQuery(e) {
|
|
1306
1337
|
return {
|
|
@@ -2024,7 +2055,7 @@ class Or {
|
|
|
2024
2055
|
}
|
|
2025
2056
|
}
|
|
2026
2057
|
R = new WeakMap();
|
|
2027
|
-
const
|
|
2058
|
+
const ka = p({
|
|
2028
2059
|
AlterTableNode: !0,
|
|
2029
2060
|
CreateIndexNode: !0,
|
|
2030
2061
|
CreateSchemaNode: !0,
|
|
@@ -2044,77 +2075,77 @@ const kr = p({
|
|
|
2044
2075
|
MergeQueryNode: !0
|
|
2045
2076
|
});
|
|
2046
2077
|
var P, S, O, _, ge, we, ye, $, q, Ne;
|
|
2047
|
-
class $
|
|
2048
|
-
constructor(
|
|
2078
|
+
class $a extends Oa {
|
|
2079
|
+
constructor(a) {
|
|
2049
2080
|
super();
|
|
2050
2081
|
w(this, _);
|
|
2051
2082
|
w(this, P);
|
|
2052
2083
|
w(this, S, /* @__PURE__ */ new Set());
|
|
2053
2084
|
w(this, O, /* @__PURE__ */ new Set());
|
|
2054
|
-
M(this, P,
|
|
2085
|
+
M(this, P, a);
|
|
2055
2086
|
}
|
|
2056
|
-
transformNodeImpl(
|
|
2057
|
-
if (!u(this, _, ge).call(this,
|
|
2058
|
-
return super.transformNodeImpl(
|
|
2059
|
-
const
|
|
2060
|
-
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)
|
|
2061
2092
|
c(this, O).add(s);
|
|
2062
|
-
const o = u(this, _, we).call(this,
|
|
2093
|
+
const o = u(this, _, we).call(this, a);
|
|
2063
2094
|
for (const s of o)
|
|
2064
2095
|
c(this, S).add(s);
|
|
2065
|
-
const n = super.transformNodeImpl(
|
|
2096
|
+
const n = super.transformNodeImpl(a);
|
|
2066
2097
|
for (const s of o)
|
|
2067
2098
|
c(this, S).delete(s);
|
|
2068
|
-
for (const s of
|
|
2099
|
+
for (const s of r)
|
|
2069
2100
|
c(this, O).delete(s);
|
|
2070
2101
|
return n;
|
|
2071
2102
|
}
|
|
2072
|
-
transformSchemableIdentifier(
|
|
2073
|
-
const
|
|
2074
|
-
return
|
|
2075
|
-
...
|
|
2076
|
-
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))
|
|
2077
2108
|
};
|
|
2078
2109
|
}
|
|
2079
|
-
transformReferences(
|
|
2080
|
-
const
|
|
2081
|
-
return
|
|
2082
|
-
...
|
|
2083
|
-
table: K.createWithSchema(c(this, P),
|
|
2084
|
-
};
|
|
2085
|
-
}
|
|
2086
|
-
}
|
|
2087
|
-
P = new WeakMap(), S = new WeakMap(), O = new WeakMap(), _ = new WeakSet(), ge = function(
|
|
2088
|
-
return
|
|
2089
|
-
}, we = function(
|
|
2090
|
-
const
|
|
2091
|
-
if ("name" in
|
|
2092
|
-
for (const o of
|
|
2093
|
-
u(this, _, $).call(this, o,
|
|
2094
|
-
if ("into" in
|
|
2095
|
-
for (const o of
|
|
2096
|
-
u(this, _, $).call(this, o.table,
|
|
2097
|
-
return "using" in
|
|
2098
|
-
}, ye = function(
|
|
2099
|
-
const
|
|
2100
|
-
return "with" in
|
|
2101
|
-
}, $ = function(
|
|
2102
|
-
const o = K.is(
|
|
2103
|
-
o && u(this, _, q).call(this, o.table,
|
|
2104
|
-
}, q = function(
|
|
2105
|
-
const o =
|
|
2106
|
-
!c(this, S).has(o) && !c(this, O).has(o) &&
|
|
2107
|
-
}, Ne = function(
|
|
2108
|
-
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) {
|
|
2109
2140
|
const n = o.name.table.table.identifier.name;
|
|
2110
|
-
c(this, O).has(n) ||
|
|
2141
|
+
c(this, O).has(n) || r.add(n);
|
|
2111
2142
|
}
|
|
2112
2143
|
};
|
|
2113
2144
|
var L;
|
|
2114
|
-
class
|
|
2145
|
+
class Ia {
|
|
2115
2146
|
constructor(e) {
|
|
2116
2147
|
w(this, L);
|
|
2117
|
-
M(this, L, new $
|
|
2148
|
+
M(this, L, new $a(e));
|
|
2118
2149
|
}
|
|
2119
2150
|
transformQuery(e) {
|
|
2120
2151
|
return c(this, L).transformNode(e.node);
|
|
@@ -2124,7 +2155,7 @@ class Ir {
|
|
|
2124
2155
|
}
|
|
2125
2156
|
}
|
|
2126
2157
|
L = new WeakMap();
|
|
2127
|
-
class
|
|
2158
|
+
class Da {
|
|
2128
2159
|
transformQuery(e) {
|
|
2129
2160
|
return e.node;
|
|
2130
2161
|
}
|
|
@@ -2132,8 +2163,8 @@ class Dr {
|
|
|
2132
2163
|
return e.result;
|
|
2133
2164
|
}
|
|
2134
2165
|
}
|
|
2135
|
-
const
|
|
2136
|
-
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;
|
|
2137
2168
|
class ve {
|
|
2138
2169
|
constructor(e) {
|
|
2139
2170
|
w(this, i);
|
|
@@ -2146,11 +2177,11 @@ class ve {
|
|
|
2146
2177
|
* The returned array is sorted by migration name.
|
|
2147
2178
|
*/
|
|
2148
2179
|
async getMigrations() {
|
|
2149
|
-
const e = await u(this, i, D).call(this, c(this, i, v)) ? await c(this, h).db.withPlugin(c(this, i,
|
|
2150
|
-
return (await u(this, i, X).call(this)).map(({ name:
|
|
2151
|
-
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);
|
|
2152
2183
|
return {
|
|
2153
|
-
name:
|
|
2184
|
+
name: r,
|
|
2154
2185
|
migration: o,
|
|
2155
2186
|
executedAt: n ? new Date(n.timestamp) : void 0
|
|
2156
2187
|
};
|
|
@@ -2230,16 +2261,16 @@ class ve {
|
|
|
2230
2261
|
* ```
|
|
2231
2262
|
*/
|
|
2232
2263
|
async migrateTo(e) {
|
|
2233
|
-
return u(this, i, A).call(this, ({ migrations:
|
|
2234
|
-
if (e ===
|
|
2264
|
+
return u(this, i, A).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: o }) => {
|
|
2265
|
+
if (e === Ma)
|
|
2235
2266
|
return { direction: "Down", step: 1 / 0 };
|
|
2236
|
-
if (!
|
|
2267
|
+
if (!a.find((l) => l.name === e))
|
|
2237
2268
|
throw new Error(`migration "${e}" doesn't exist`);
|
|
2238
|
-
const n =
|
|
2269
|
+
const n = r.indexOf(e), s = o.findIndex((l) => l.name === e);
|
|
2239
2270
|
if (n !== -1)
|
|
2240
2271
|
return {
|
|
2241
2272
|
direction: "Down",
|
|
2242
|
-
step:
|
|
2273
|
+
step: r.length - n - 1
|
|
2243
2274
|
};
|
|
2244
2275
|
if (s !== -1)
|
|
2245
2276
|
return { direction: "Up", step: s + 1 };
|
|
@@ -2283,21 +2314,21 @@ class ve {
|
|
|
2283
2314
|
}
|
|
2284
2315
|
h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
2285
2316
|
try {
|
|
2286
|
-
return await u(this, i,
|
|
2287
|
-
} catch (
|
|
2288
|
-
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 };
|
|
2289
2320
|
}
|
|
2290
2321
|
}, N = function() {
|
|
2291
2322
|
return c(this, h).migrationTableSchema;
|
|
2292
2323
|
}, v = function() {
|
|
2293
|
-
return c(this, h).migrationTableName ??
|
|
2324
|
+
return c(this, h).migrationTableName ?? Pa;
|
|
2294
2325
|
}, I = function() {
|
|
2295
2326
|
return c(this, h).migrationLockTableName ?? fe;
|
|
2296
|
-
},
|
|
2297
|
-
return c(this, h).allowUnorderedMigrations ??
|
|
2298
|
-
},
|
|
2299
|
-
return c(this, i, N) ? new
|
|
2300
|
-
},
|
|
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() {
|
|
2301
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);
|
|
2302
2333
|
}, xe = async function() {
|
|
2303
2334
|
if (c(this, i, N) && !await u(this, i, G).call(this))
|
|
@@ -2310,7 +2341,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2310
2341
|
}, Te = async function() {
|
|
2311
2342
|
if (!await u(this, i, D).call(this, c(this, i, v)))
|
|
2312
2343
|
try {
|
|
2313
|
-
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()));
|
|
2314
2345
|
} catch (e) {
|
|
2315
2346
|
if (!await u(this, i, D).call(this, c(this, i, v)))
|
|
2316
2347
|
throw e;
|
|
@@ -2318,7 +2349,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2318
2349
|
}, Se = async function() {
|
|
2319
2350
|
if (!await u(this, i, D).call(this, c(this, i, I)))
|
|
2320
2351
|
try {
|
|
2321
|
-
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)));
|
|
2322
2353
|
} catch (e) {
|
|
2323
2354
|
if (!await u(this, i, D).call(this, c(this, i, I)))
|
|
2324
2355
|
throw e;
|
|
@@ -2326,68 +2357,68 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2326
2357
|
}, Oe = async function() {
|
|
2327
2358
|
if (!await u(this, i, H).call(this))
|
|
2328
2359
|
try {
|
|
2329
|
-
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();
|
|
2330
2361
|
} catch (e) {
|
|
2331
2362
|
if (!await u(this, i, H).call(this))
|
|
2332
2363
|
throw e;
|
|
2333
2364
|
}
|
|
2334
2365
|
}, G = async function() {
|
|
2335
|
-
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));
|
|
2336
2367
|
}, D = async function(e) {
|
|
2337
|
-
const
|
|
2368
|
+
const a = c(this, i, N);
|
|
2338
2369
|
return (await c(this, h).db.introspection.getTables({
|
|
2339
2370
|
withInternalKyselyTables: !0
|
|
2340
|
-
})).some((o) => o.name === e && (!
|
|
2371
|
+
})).some((o) => o.name === e && (!a || o.schema === a));
|
|
2341
2372
|
}, H = async function() {
|
|
2342
|
-
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();
|
|
2343
2374
|
}, ke = async function(e) {
|
|
2344
|
-
const
|
|
2375
|
+
const a = c(this, h).db.getExecutor().adapter, r = p({
|
|
2345
2376
|
lockTable: c(this, h).migrationLockTableName ?? fe,
|
|
2346
2377
|
lockRowId: B,
|
|
2347
2378
|
lockTableSchema: c(this, h).migrationTableSchema
|
|
2348
2379
|
}), o = async (n) => {
|
|
2349
2380
|
try {
|
|
2350
|
-
await
|
|
2381
|
+
await a.acquireMigrationLock(n, r);
|
|
2351
2382
|
const s = await u(this, i, $e).call(this, n);
|
|
2352
2383
|
if (s.migrations.length === 0)
|
|
2353
2384
|
return { results: [] };
|
|
2354
2385
|
const { direction: l, step: d } = e(s);
|
|
2355
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: [] };
|
|
2356
2387
|
} finally {
|
|
2357
|
-
await
|
|
2388
|
+
await a.releaseMigrationLock(n, r);
|
|
2358
2389
|
}
|
|
2359
2390
|
};
|
|
2360
|
-
return
|
|
2391
|
+
return a.supportsTransactionalDdl ? c(this, h).db.transaction().execute(o) : c(this, h).db.connection().execute(o);
|
|
2361
2392
|
}, $e = async function(e) {
|
|
2362
|
-
const
|
|
2363
|
-
u(this, i, Pe).call(this,
|
|
2364
|
-
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);
|
|
2365
2396
|
return p({
|
|
2366
|
-
migrations:
|
|
2367
|
-
executedMigrations:
|
|
2368
|
-
lastMigration:
|
|
2397
|
+
migrations: a,
|
|
2398
|
+
executedMigrations: r,
|
|
2399
|
+
lastMigration: Ta(r),
|
|
2369
2400
|
pendingMigrations: o
|
|
2370
2401
|
});
|
|
2371
|
-
}, Ie = function(e,
|
|
2372
|
-
return e.filter((
|
|
2402
|
+
}, Ie = function(e, a) {
|
|
2403
|
+
return e.filter((r) => !a.includes(r.name));
|
|
2373
2404
|
}, X = async function() {
|
|
2374
2405
|
const e = await c(this, h).provider.getMigrations();
|
|
2375
|
-
return Object.keys(e).sort().map((
|
|
2376
|
-
...e[
|
|
2377
|
-
name:
|
|
2406
|
+
return Object.keys(e).sort().map((a) => ({
|
|
2407
|
+
...e[a],
|
|
2408
|
+
name: a
|
|
2378
2409
|
}));
|
|
2379
2410
|
}, De = async function(e) {
|
|
2380
|
-
return (await e.withPlugin(c(this, i,
|
|
2381
|
-
}, Pe = function(e,
|
|
2382
|
-
for (const
|
|
2383
|
-
if (!e.some((o) => o.name ===
|
|
2384
|
-
throw new Error(`corrupted migrations: previously executed migration ${
|
|
2385
|
-
}, je = function(e,
|
|
2386
|
-
for (let
|
|
2387
|
-
if (e[
|
|
2388
|
-
throw new Error(`corrupted migrations: expected previously executed migration ${r
|
|
2389
|
-
}, Me = async function(e,
|
|
2390
|
-
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) => ({
|
|
2391
2422
|
migrationName: s.name,
|
|
2392
2423
|
direction: "Down",
|
|
2393
2424
|
status: "NotExecuted"
|
|
@@ -2395,7 +2426,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2395
2426
|
for (let s = 0; s < n.length; ++s) {
|
|
2396
2427
|
const l = o[s];
|
|
2397
2428
|
try {
|
|
2398
|
-
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] = {
|
|
2399
2430
|
migrationName: l.name,
|
|
2400
2431
|
direction: "Down",
|
|
2401
2432
|
status: "Success"
|
|
@@ -2412,16 +2443,16 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2412
2443
|
}
|
|
2413
2444
|
}
|
|
2414
2445
|
return { results: n };
|
|
2415
|
-
}, Ae = async function(e,
|
|
2416
|
-
const n =
|
|
2446
|
+
}, Ae = async function(e, a, r) {
|
|
2447
|
+
const n = a.pendingMigrations.slice(0, r).map((s) => ({
|
|
2417
2448
|
migrationName: s.name,
|
|
2418
2449
|
direction: "Up",
|
|
2419
2450
|
status: "NotExecuted"
|
|
2420
2451
|
}));
|
|
2421
2452
|
for (let s = 0; s < n.length; s++) {
|
|
2422
|
-
const l =
|
|
2453
|
+
const l = a.pendingMigrations[s];
|
|
2423
2454
|
try {
|
|
2424
|
-
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({
|
|
2425
2456
|
name: l.name,
|
|
2426
2457
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2427
2458
|
}).execute(), n[s] = {
|
|
@@ -2446,10 +2477,10 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2446
2477
|
};
|
|
2447
2478
|
var E;
|
|
2448
2479
|
class Q extends Error {
|
|
2449
|
-
constructor(
|
|
2480
|
+
constructor(a) {
|
|
2450
2481
|
super();
|
|
2451
2482
|
w(this, E);
|
|
2452
|
-
M(this, E,
|
|
2483
|
+
M(this, E, a);
|
|
2453
2484
|
}
|
|
2454
2485
|
get resultSet() {
|
|
2455
2486
|
return c(this, E);
|
|
@@ -2465,7 +2496,7 @@ class Fe {
|
|
|
2465
2496
|
return this.migrations;
|
|
2466
2497
|
}
|
|
2467
2498
|
}
|
|
2468
|
-
async function
|
|
2499
|
+
async function Aa(t) {
|
|
2469
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(
|
|
2470
2501
|
"tenant_id",
|
|
2471
2502
|
"varchar(255)",
|
|
@@ -2533,35 +2564,35 @@ async function Ar(t) {
|
|
|
2533
2564
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
2534
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();
|
|
2535
2566
|
}
|
|
2536
|
-
async function
|
|
2567
|
+
async function Fa(t) {
|
|
2537
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();
|
|
2538
2569
|
}
|
|
2539
|
-
const
|
|
2570
|
+
const La = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2540
2571
|
__proto__: null,
|
|
2541
|
-
down:
|
|
2542
|
-
up:
|
|
2572
|
+
down: Fa,
|
|
2573
|
+
up: Aa
|
|
2543
2574
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2544
|
-
async function
|
|
2575
|
+
async function Ea(t) {
|
|
2545
2576
|
await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
|
|
2546
2577
|
}
|
|
2547
|
-
async function
|
|
2578
|
+
async function Ja(t) {
|
|
2548
2579
|
await t.schema.alterTable("tenants").dropColumn("support_url").execute();
|
|
2549
2580
|
}
|
|
2550
|
-
const
|
|
2581
|
+
const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2551
2582
|
__proto__: null,
|
|
2552
|
-
down:
|
|
2553
|
-
up:
|
|
2583
|
+
down: Ja,
|
|
2584
|
+
up: Ea
|
|
2554
2585
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2555
|
-
async function
|
|
2586
|
+
async function Ra(t) {
|
|
2556
2587
|
}
|
|
2557
|
-
async function
|
|
2588
|
+
async function Ua(t) {
|
|
2558
2589
|
}
|
|
2559
|
-
const
|
|
2590
|
+
const Ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2560
2591
|
__proto__: null,
|
|
2561
|
-
down:
|
|
2562
|
-
up:
|
|
2592
|
+
down: Ua,
|
|
2593
|
+
up: Ra
|
|
2563
2594
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2564
|
-
async function
|
|
2595
|
+
async function Ba(t) {
|
|
2565
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(
|
|
2566
2597
|
"tenant_id_constraint",
|
|
2567
2598
|
["tenant_id"],
|
|
@@ -2570,24 +2601,24 @@ async function Br(t) {
|
|
|
2570
2601
|
(e) => e.onDelete("cascade")
|
|
2571
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();
|
|
2572
2603
|
}
|
|
2573
|
-
async function
|
|
2604
|
+
async function Qa(t) {
|
|
2574
2605
|
await t.schema.dropTable("logs").execute();
|
|
2575
2606
|
}
|
|
2576
|
-
const
|
|
2607
|
+
const Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2577
2608
|
__proto__: null,
|
|
2578
|
-
down:
|
|
2579
|
-
up:
|
|
2609
|
+
down: Qa,
|
|
2610
|
+
up: Ba
|
|
2580
2611
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2581
|
-
async function
|
|
2612
|
+
async function Wa(t) {
|
|
2582
2613
|
}
|
|
2583
|
-
async function
|
|
2614
|
+
async function qa(t) {
|
|
2584
2615
|
}
|
|
2585
|
-
const
|
|
2616
|
+
const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2586
2617
|
__proto__: null,
|
|
2587
|
-
down:
|
|
2588
|
-
up:
|
|
2618
|
+
down: qa,
|
|
2619
|
+
up: Wa
|
|
2589
2620
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2590
|
-
async function
|
|
2621
|
+
async function Ha(t) {
|
|
2591
2622
|
await t.schema.createTable("sessions").addColumn("session_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
2592
2623
|
"client_id",
|
|
2593
2624
|
"varchar(255)",
|
|
@@ -2616,15 +2647,15 @@ async function Hr(t) {
|
|
|
2616
2647
|
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
2617
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();
|
|
2618
2649
|
}
|
|
2619
|
-
async function
|
|
2650
|
+
async function Xa(t) {
|
|
2620
2651
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
|
|
2621
2652
|
}
|
|
2622
|
-
const
|
|
2653
|
+
const Ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2623
2654
|
__proto__: null,
|
|
2624
|
-
down:
|
|
2625
|
-
up:
|
|
2655
|
+
down: Xa,
|
|
2656
|
+
up: Ha
|
|
2626
2657
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2627
|
-
async function
|
|
2658
|
+
async function Za(t) {
|
|
2628
2659
|
await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
|
|
2629
2660
|
"user_id_constraint",
|
|
2630
2661
|
["user_id", "tenant_id"],
|
|
@@ -2639,24 +2670,24 @@ async function Zr(t) {
|
|
|
2639
2670
|
(e) => e.onDelete("cascade")
|
|
2640
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();
|
|
2641
2672
|
}
|
|
2642
|
-
async function
|
|
2673
|
+
async function er(t) {
|
|
2643
2674
|
await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
|
|
2644
2675
|
}
|
|
2645
|
-
const
|
|
2676
|
+
const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2646
2677
|
__proto__: null,
|
|
2647
|
-
down:
|
|
2648
|
-
up:
|
|
2678
|
+
down: er,
|
|
2679
|
+
up: Za
|
|
2649
2680
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2650
|
-
async function
|
|
2681
|
+
async function ar(t) {
|
|
2651
2682
|
}
|
|
2652
|
-
async function
|
|
2683
|
+
async function rr(t) {
|
|
2653
2684
|
}
|
|
2654
|
-
const
|
|
2685
|
+
const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2655
2686
|
__proto__: null,
|
|
2656
|
-
down:
|
|
2657
|
-
up:
|
|
2687
|
+
down: rr,
|
|
2688
|
+
up: ar
|
|
2658
2689
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2659
|
-
async function
|
|
2690
|
+
async function or(t) {
|
|
2660
2691
|
await t.schema.alterTable("passwords").addColumn(
|
|
2661
2692
|
"password",
|
|
2662
2693
|
"varchar(255)",
|
|
@@ -2664,172 +2695,172 @@ async function oa(t) {
|
|
|
2664
2695
|
(e) => e.notNull()
|
|
2665
2696
|
).execute();
|
|
2666
2697
|
}
|
|
2667
|
-
async function
|
|
2698
|
+
async function sr(t) {
|
|
2668
2699
|
await t.schema.alterTable("passwords").dropColumn("password").execute();
|
|
2669
2700
|
}
|
|
2670
|
-
const
|
|
2701
|
+
const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2671
2702
|
__proto__: null,
|
|
2672
|
-
down:
|
|
2673
|
-
up:
|
|
2703
|
+
down: sr,
|
|
2704
|
+
up: or
|
|
2674
2705
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2675
|
-
async function
|
|
2706
|
+
async function lr(t) {
|
|
2676
2707
|
}
|
|
2677
|
-
async function
|
|
2708
|
+
async function cr(t) {
|
|
2678
2709
|
}
|
|
2679
|
-
const
|
|
2710
|
+
const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2680
2711
|
__proto__: null,
|
|
2681
|
-
down:
|
|
2682
|
-
up:
|
|
2712
|
+
down: cr,
|
|
2713
|
+
up: lr
|
|
2683
2714
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2684
|
-
async function
|
|
2715
|
+
async function ur(t) {
|
|
2685
2716
|
}
|
|
2686
|
-
async function
|
|
2717
|
+
async function mr(t) {
|
|
2687
2718
|
}
|
|
2688
|
-
const
|
|
2719
|
+
const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2689
2720
|
__proto__: null,
|
|
2690
|
-
down:
|
|
2691
|
-
up:
|
|
2721
|
+
down: mr,
|
|
2722
|
+
up: ur
|
|
2692
2723
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2693
|
-
async function
|
|
2724
|
+
async function fr(t) {
|
|
2694
2725
|
}
|
|
2695
|
-
async function
|
|
2726
|
+
async function _r(t) {
|
|
2696
2727
|
}
|
|
2697
|
-
const
|
|
2728
|
+
const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2698
2729
|
__proto__: null,
|
|
2699
|
-
down:
|
|
2700
|
-
up:
|
|
2730
|
+
down: _r,
|
|
2731
|
+
up: fr
|
|
2701
2732
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2702
|
-
async function
|
|
2733
|
+
async function gr(t) {
|
|
2703
2734
|
await t.schema.createIndex("users_email_index").on("users").column("email").execute();
|
|
2704
2735
|
}
|
|
2705
|
-
async function
|
|
2736
|
+
async function wr(t) {
|
|
2706
2737
|
await t.schema.dropIndex("users_email_index").execute();
|
|
2707
2738
|
}
|
|
2708
|
-
const
|
|
2739
|
+
const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2709
2740
|
__proto__: null,
|
|
2710
|
-
down:
|
|
2711
|
-
up:
|
|
2741
|
+
down: wr,
|
|
2742
|
+
up: gr
|
|
2712
2743
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2713
|
-
async function
|
|
2744
|
+
async function Nr(t) {
|
|
2714
2745
|
await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
|
|
2715
2746
|
}
|
|
2716
|
-
async function
|
|
2747
|
+
async function vr(t) {
|
|
2717
2748
|
await t.schema.alterTable("users").dropColumn("profileData").execute();
|
|
2718
2749
|
}
|
|
2719
|
-
const
|
|
2750
|
+
const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2720
2751
|
__proto__: null,
|
|
2721
|
-
down:
|
|
2722
|
-
up:
|
|
2752
|
+
down: vr,
|
|
2753
|
+
up: Nr
|
|
2723
2754
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2724
|
-
async function
|
|
2755
|
+
async function br(t) {
|
|
2725
2756
|
await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
|
|
2726
2757
|
}
|
|
2727
|
-
async function
|
|
2758
|
+
async function xr(t) {
|
|
2728
2759
|
await t.schema.dropIndex("users_linked_to_index");
|
|
2729
2760
|
}
|
|
2730
|
-
const
|
|
2761
|
+
const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2731
2762
|
__proto__: null,
|
|
2732
|
-
down:
|
|
2733
|
-
up:
|
|
2763
|
+
down: xr,
|
|
2764
|
+
up: br
|
|
2734
2765
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2735
|
-
async function
|
|
2766
|
+
async function Sr(t) {
|
|
2736
2767
|
await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
|
|
2737
2768
|
}
|
|
2738
|
-
async function
|
|
2769
|
+
async function Or(t) {
|
|
2739
2770
|
await t.schema.alterTable("users").dropColumn("locale").execute();
|
|
2740
2771
|
}
|
|
2741
|
-
const
|
|
2772
|
+
const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2742
2773
|
__proto__: null,
|
|
2743
|
-
down:
|
|
2744
|
-
up:
|
|
2774
|
+
down: Or,
|
|
2775
|
+
up: Sr
|
|
2745
2776
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2746
|
-
async function $
|
|
2777
|
+
async function $r(t) {
|
|
2747
2778
|
await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
2748
2779
|
"tenant_id",
|
|
2749
2780
|
"varchar(255)",
|
|
2750
2781
|
(e) => e.references("tenants.id").onDelete("cascade")
|
|
2751
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();
|
|
2752
2783
|
}
|
|
2753
|
-
async function
|
|
2784
|
+
async function Ir(t) {
|
|
2754
2785
|
await t.schema.dropTable("keys").execute();
|
|
2755
2786
|
}
|
|
2756
|
-
const
|
|
2787
|
+
const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2757
2788
|
__proto__: null,
|
|
2758
|
-
down:
|
|
2759
|
-
up: $
|
|
2789
|
+
down: Ir,
|
|
2790
|
+
up: $r
|
|
2760
2791
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2761
|
-
async function
|
|
2792
|
+
async function Pr(t) {
|
|
2762
2793
|
}
|
|
2763
|
-
async function
|
|
2794
|
+
async function jr(t) {
|
|
2764
2795
|
}
|
|
2765
|
-
const
|
|
2796
|
+
const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2766
2797
|
__proto__: null,
|
|
2767
|
-
down:
|
|
2768
|
-
up:
|
|
2798
|
+
down: jr,
|
|
2799
|
+
up: Pr
|
|
2769
2800
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2770
|
-
async function
|
|
2801
|
+
async function Ar(t) {
|
|
2771
2802
|
}
|
|
2772
|
-
async function
|
|
2803
|
+
async function Fr(t) {
|
|
2773
2804
|
}
|
|
2774
|
-
const
|
|
2805
|
+
const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2775
2806
|
__proto__: null,
|
|
2776
|
-
down:
|
|
2777
|
-
up:
|
|
2807
|
+
down: Fr,
|
|
2808
|
+
up: Ar
|
|
2778
2809
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2779
|
-
async function
|
|
2810
|
+
async function Er(t) {
|
|
2780
2811
|
await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
|
|
2781
2812
|
}
|
|
2782
|
-
async function
|
|
2813
|
+
async function Jr(t) {
|
|
2783
2814
|
await t.schema.alterTable("otps").dropColumn("audience").execute();
|
|
2784
2815
|
}
|
|
2785
|
-
const
|
|
2816
|
+
const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2786
2817
|
__proto__: null,
|
|
2787
|
-
down:
|
|
2788
|
-
up:
|
|
2818
|
+
down: Jr,
|
|
2819
|
+
up: Er
|
|
2789
2820
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2790
|
-
async function
|
|
2821
|
+
async function Rr(t) {
|
|
2791
2822
|
}
|
|
2792
|
-
async function
|
|
2823
|
+
async function Ur(t) {
|
|
2793
2824
|
}
|
|
2794
|
-
const
|
|
2825
|
+
const Kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2795
2826
|
__proto__: null,
|
|
2796
|
-
down:
|
|
2797
|
-
up:
|
|
2827
|
+
down: Ur,
|
|
2828
|
+
up: Rr
|
|
2798
2829
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2799
|
-
async function
|
|
2830
|
+
async function Br(t) {
|
|
2800
2831
|
await t.schema.alterTable("logs").dropColumn("category").execute();
|
|
2801
2832
|
}
|
|
2802
|
-
async function
|
|
2833
|
+
async function Qr(t) {
|
|
2803
2834
|
await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
|
|
2804
2835
|
}
|
|
2805
|
-
const
|
|
2836
|
+
const Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2806
2837
|
__proto__: null,
|
|
2807
|
-
down:
|
|
2808
|
-
up:
|
|
2838
|
+
down: Qr,
|
|
2839
|
+
up: Br
|
|
2809
2840
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2810
|
-
async function
|
|
2841
|
+
async function Wr(t) {
|
|
2811
2842
|
await t.schema.alterTable("users").dropColumn("tags").execute();
|
|
2812
2843
|
}
|
|
2813
|
-
async function
|
|
2844
|
+
async function qr(t) {
|
|
2814
2845
|
await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
|
|
2815
2846
|
}
|
|
2816
|
-
const
|
|
2847
|
+
const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2817
2848
|
__proto__: null,
|
|
2818
|
-
down:
|
|
2819
|
-
up:
|
|
2849
|
+
down: qr,
|
|
2850
|
+
up: Wr
|
|
2820
2851
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2821
|
-
async function
|
|
2852
|
+
async function Hr(t) {
|
|
2822
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();
|
|
2823
2854
|
}
|
|
2824
|
-
async function
|
|
2855
|
+
async function Xr(t) {
|
|
2825
2856
|
await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
|
|
2826
2857
|
}
|
|
2827
|
-
const
|
|
2858
|
+
const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2828
2859
|
__proto__: null,
|
|
2829
|
-
down:
|
|
2830
|
-
up:
|
|
2860
|
+
down: Xr,
|
|
2861
|
+
up: Hr
|
|
2831
2862
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2832
|
-
async function
|
|
2863
|
+
async function Zr(t) {
|
|
2833
2864
|
await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
|
|
2834
2865
|
}
|
|
2835
2866
|
async function en(t) {
|
|
@@ -2838,18 +2869,18 @@ async function en(t) {
|
|
|
2838
2869
|
const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2839
2870
|
__proto__: null,
|
|
2840
2871
|
down: en,
|
|
2841
|
-
up:
|
|
2872
|
+
up: Zr
|
|
2842
2873
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2843
|
-
async function
|
|
2874
|
+
async function an(t) {
|
|
2844
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();
|
|
2845
2876
|
}
|
|
2846
|
-
async function
|
|
2877
|
+
async function rn(t) {
|
|
2847
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();
|
|
2848
2879
|
}
|
|
2849
2880
|
const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2850
2881
|
__proto__: null,
|
|
2851
|
-
down:
|
|
2852
|
-
up:
|
|
2882
|
+
down: rn,
|
|
2883
|
+
up: an
|
|
2853
2884
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2854
2885
|
async function on(t) {
|
|
2855
2886
|
await t.schema.createIndex("users_name_index").on("users").column("name").execute();
|
|
@@ -2911,11 +2942,11 @@ const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2911
2942
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2912
2943
|
async function vn(t) {
|
|
2913
2944
|
}
|
|
2914
|
-
async function
|
|
2945
|
+
async function Cn(t) {
|
|
2915
2946
|
}
|
|
2916
|
-
const
|
|
2947
|
+
const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2917
2948
|
__proto__: null,
|
|
2918
|
-
down:
|
|
2949
|
+
down: Cn,
|
|
2919
2950
|
up: vn
|
|
2920
2951
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2921
2952
|
async function xn(t) {
|
|
@@ -2973,16 +3004,16 @@ const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2973
3004
|
down: Ln,
|
|
2974
3005
|
up: Fn
|
|
2975
3006
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2976
|
-
async function
|
|
3007
|
+
async function Jn(t) {
|
|
2977
3008
|
await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
|
|
2978
3009
|
}
|
|
2979
|
-
async function
|
|
3010
|
+
async function zn(t) {
|
|
2980
3011
|
await t.schema.alterTable("otps").dropColumn("ip").execute();
|
|
2981
3012
|
}
|
|
2982
3013
|
const Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2983
3014
|
__proto__: null,
|
|
2984
|
-
down:
|
|
2985
|
-
up:
|
|
3015
|
+
down: zn,
|
|
3016
|
+
up: Jn
|
|
2986
3017
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2987
3018
|
async function Un(t) {
|
|
2988
3019
|
await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
|
|
@@ -3036,12 +3067,12 @@ async function eo(t) {
|
|
|
3036
3067
|
}
|
|
3037
3068
|
async function to(t) {
|
|
3038
3069
|
}
|
|
3039
|
-
const
|
|
3070
|
+
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3040
3071
|
__proto__: null,
|
|
3041
3072
|
down: to,
|
|
3042
3073
|
up: eo
|
|
3043
3074
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3044
|
-
async function
|
|
3075
|
+
async function ro(t) {
|
|
3045
3076
|
await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3046
3077
|
"tenant_id",
|
|
3047
3078
|
"varchar(255)",
|
|
@@ -3070,7 +3101,7 @@ async function no(t) {
|
|
|
3070
3101
|
const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3071
3102
|
__proto__: null,
|
|
3072
3103
|
down: no,
|
|
3073
|
-
up:
|
|
3104
|
+
up: ro
|
|
3074
3105
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3075
3106
|
async function so(t) {
|
|
3076
3107
|
}
|
|
@@ -3121,16 +3152,16 @@ const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3121
3152
|
down: No,
|
|
3122
3153
|
up: yo
|
|
3123
3154
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3124
|
-
async function
|
|
3155
|
+
async function Co(t) {
|
|
3125
3156
|
await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
|
|
3126
3157
|
}
|
|
3127
|
-
async function
|
|
3158
|
+
async function bo(t) {
|
|
3128
3159
|
await t.schema.alterTable("logins").dropColumn("nonce").execute();
|
|
3129
3160
|
}
|
|
3130
3161
|
const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3131
3162
|
__proto__: null,
|
|
3132
|
-
down:
|
|
3133
|
-
up:
|
|
3163
|
+
down: bo,
|
|
3164
|
+
up: Co
|
|
3134
3165
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3135
3166
|
async function To(t) {
|
|
3136
3167
|
}
|
|
@@ -3217,19 +3248,19 @@ async function Lo(t) {
|
|
|
3217
3248
|
async function Eo(t) {
|
|
3218
3249
|
await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
|
|
3219
3250
|
}
|
|
3220
|
-
const
|
|
3251
|
+
const Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3221
3252
|
__proto__: null,
|
|
3222
3253
|
down: Eo,
|
|
3223
3254
|
up: Lo
|
|
3224
3255
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3225
|
-
async function
|
|
3256
|
+
async function zo(t) {
|
|
3226
3257
|
}
|
|
3227
3258
|
async function Ro(t) {
|
|
3228
3259
|
}
|
|
3229
3260
|
const Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3230
3261
|
__proto__: null,
|
|
3231
3262
|
down: Ro,
|
|
3232
|
-
up:
|
|
3263
|
+
up: zo
|
|
3233
3264
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3234
3265
|
async function Ko(t) {
|
|
3235
3266
|
await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
|
|
@@ -3288,12 +3319,12 @@ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3288
3319
|
async function ts(t) {
|
|
3289
3320
|
await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
|
|
3290
3321
|
}
|
|
3291
|
-
async function
|
|
3322
|
+
async function as(t) {
|
|
3292
3323
|
await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
|
|
3293
3324
|
}
|
|
3294
|
-
const
|
|
3325
|
+
const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3295
3326
|
__proto__: null,
|
|
3296
|
-
down:
|
|
3327
|
+
down: as,
|
|
3297
3328
|
up: ts
|
|
3298
3329
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3299
3330
|
async function ns(t) {
|
|
@@ -3376,15 +3407,15 @@ const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3376
3407
|
down: Ns,
|
|
3377
3408
|
up: ys
|
|
3378
3409
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3379
|
-
async function bs(t) {
|
|
3380
|
-
}
|
|
3381
3410
|
async function Cs(t) {
|
|
3411
|
+
}
|
|
3412
|
+
async function bs(t) {
|
|
3382
3413
|
await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
|
|
3383
3414
|
}
|
|
3384
3415
|
const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3385
3416
|
__proto__: null,
|
|
3386
|
-
down:
|
|
3387
|
-
up:
|
|
3417
|
+
down: bs,
|
|
3418
|
+
up: Cs
|
|
3388
3419
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3389
3420
|
async function Ts(t) {
|
|
3390
3421
|
await t.schema.createTable("refresh_tokens").addColumn(
|
|
@@ -3408,31 +3439,42 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3408
3439
|
__proto__: null,
|
|
3409
3440
|
down: Ss,
|
|
3410
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
|
|
3411
3453
|
}, Symbol.toStringTag, { value: "Module" })), Le = {
|
|
3412
|
-
m1_init:
|
|
3413
|
-
m2_magicLink:
|
|
3414
|
-
m3_updateAt:
|
|
3415
|
-
m4_logTable:
|
|
3416
|
-
m5_userProfile:
|
|
3417
|
-
m6_sessions:
|
|
3418
|
-
m7_passwords:
|
|
3419
|
-
m8_logsTableNewFields:
|
|
3420
|
-
m9_passwordTableNewField:
|
|
3421
|
-
n01_codesTable:
|
|
3422
|
-
n11_universalLoginSession:
|
|
3423
|
-
n12_userFields:
|
|
3424
|
-
n13_userEmailIndex:
|
|
3425
|
-
n14_profileDataField:
|
|
3426
|
-
n15_userEmailIndex:
|
|
3427
|
-
n16_userLocale:
|
|
3428
|
-
n17_signingKeys:
|
|
3429
|
-
n18_logsFields:
|
|
3430
|
-
n19_connectionsUserinfo:
|
|
3431
|
-
n20_missingFields:
|
|
3432
|
-
n21_sessionDeletedAt:
|
|
3433
|
-
n22_dropLogsFields:
|
|
3434
|
-
n23_dropUsersFields:
|
|
3435
|
-
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,
|
|
3436
3478
|
n25_logDescMaxLength: tn,
|
|
3437
3479
|
n26_logsTableExtraFields: nn,
|
|
3438
3480
|
n27_usersTableNameIndex: ln,
|
|
@@ -3440,7 +3482,7 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3440
3482
|
n29_increaseOtpStateLength: fn,
|
|
3441
3483
|
n30_increaseTicketStateLength: gn,
|
|
3442
3484
|
n31_branding: Nn,
|
|
3443
|
-
n32_indexesAndNotNull:
|
|
3485
|
+
n32_indexesAndNotNull: bn,
|
|
3444
3486
|
n33_vendorIdInUniversalLoginSession: Sn,
|
|
3445
3487
|
n34_auth0ClientInUniversalLoginSession: $n,
|
|
3446
3488
|
n35_increaseUniversalSessionStateLength: Pn,
|
|
@@ -3451,7 +3493,7 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3451
3493
|
n40_userId: Wn,
|
|
3452
3494
|
n41_hooks: Hn,
|
|
3453
3495
|
n42_userIdIndexes: Zn,
|
|
3454
|
-
n43_userIdIndexes:
|
|
3496
|
+
n43_userIdIndexes: ao,
|
|
3455
3497
|
n44_codes: oo,
|
|
3456
3498
|
n45_hookProperties: lo,
|
|
3457
3499
|
n46_loginAuth0Client: mo,
|
|
@@ -3463,13 +3505,13 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3463
3505
|
n52_cert: Io,
|
|
3464
3506
|
n53_codes_primary_key: jo,
|
|
3465
3507
|
n54_cleanup_tables: Fo,
|
|
3466
|
-
n55_logs_index:
|
|
3508
|
+
n55_logs_index: Jo,
|
|
3467
3509
|
n56_application_fields: Uo,
|
|
3468
3510
|
n57_prompt_settings: Qo,
|
|
3469
3511
|
n58_connection_client_id: qo,
|
|
3470
3512
|
n59_connection_options: Xo,
|
|
3471
3513
|
n60_users_metadata: es,
|
|
3472
|
-
n61_userLocales:
|
|
3514
|
+
n61_userLocales: rs,
|
|
3473
3515
|
n62_prompt: ss,
|
|
3474
3516
|
n63_connection_cleanup: cs,
|
|
3475
3517
|
n64_act_as: ms,
|
|
@@ -3477,14 +3519,15 @@ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3477
3519
|
n66_email_providers: ws,
|
|
3478
3520
|
n67_drop_tickets: vs,
|
|
3479
3521
|
n68_login_useragents: xs,
|
|
3480
|
-
n70_refresh_tokens: Os
|
|
3522
|
+
n70_refresh_tokens: Os,
|
|
3523
|
+
n71_session_new_fields: Is
|
|
3481
3524
|
};
|
|
3482
|
-
async function
|
|
3525
|
+
async function As(t, e = !1) {
|
|
3483
3526
|
e && console.log("migrating...");
|
|
3484
|
-
const
|
|
3527
|
+
const a = new Fe(Le), r = new ve({
|
|
3485
3528
|
db: t,
|
|
3486
|
-
provider:
|
|
3487
|
-
}), { error: o, results: n } = await
|
|
3529
|
+
provider: a
|
|
3530
|
+
}), { error: o, results: n } = await r.migrateToLatest();
|
|
3488
3531
|
if (n == null || n.forEach((s) => {
|
|
3489
3532
|
s.status === "Success" ? e && console.log(
|
|
3490
3533
|
`migration "${s.migrationName}" was executed successfully`
|
|
@@ -3492,41 +3535,41 @@ async function Ps(t, e = !1) {
|
|
|
3492
3535
|
}), o)
|
|
3493
3536
|
throw console.error("failed to migrate"), console.error(o), o;
|
|
3494
3537
|
}
|
|
3495
|
-
async function
|
|
3538
|
+
async function Fs(t) {
|
|
3496
3539
|
console.log("migrating...");
|
|
3497
|
-
const e = new Fe(Le),
|
|
3540
|
+
const e = new Fe(Le), a = new ve({
|
|
3498
3541
|
db: t,
|
|
3499
3542
|
provider: e
|
|
3500
|
-
}), { error:
|
|
3543
|
+
}), { error: r, results: o } = await a.migrateDown();
|
|
3501
3544
|
if (o == null || o.forEach((n) => {
|
|
3502
3545
|
n.status === "Success" ? console.log(`migration "${n.migrationName}" was reverted successfully`) : n.status === "Error" && console.error(`failed to execute migration "${n.migrationName}"`);
|
|
3503
|
-
}),
|
|
3504
|
-
throw console.error("failed to migrate"), console.error(
|
|
3546
|
+
}), r)
|
|
3547
|
+
throw console.error("failed to migrate"), console.error(r), r;
|
|
3505
3548
|
}
|
|
3506
|
-
function
|
|
3549
|
+
function Ls(t) {
|
|
3507
3550
|
return {
|
|
3508
3551
|
applications: Dt(t),
|
|
3509
3552
|
branding: qt(t),
|
|
3510
3553
|
clients: Et(t),
|
|
3511
3554
|
codes: Tt(t),
|
|
3512
3555
|
connections: Lt(t),
|
|
3513
|
-
emailProviders:
|
|
3556
|
+
emailProviders: wa(t),
|
|
3514
3557
|
domains: Qt(t),
|
|
3515
|
-
hooks:
|
|
3558
|
+
hooks: ea(t),
|
|
3516
3559
|
keys: Ut(t),
|
|
3517
|
-
logins:
|
|
3560
|
+
logins: ua(t),
|
|
3518
3561
|
logs: ct(t),
|
|
3519
3562
|
passwords: yt(t),
|
|
3520
|
-
promptSettings:
|
|
3521
|
-
refreshTokens:
|
|
3563
|
+
promptSettings: fa(t),
|
|
3564
|
+
refreshTokens: xa(t),
|
|
3522
3565
|
sessions: _t(t),
|
|
3523
3566
|
tenants: nt(t),
|
|
3524
|
-
themes:
|
|
3567
|
+
themes: sa(t),
|
|
3525
3568
|
users: Xe(t)
|
|
3526
3569
|
};
|
|
3527
3570
|
}
|
|
3528
3571
|
export {
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3572
|
+
Ls as default,
|
|
3573
|
+
Fs as migrateDown,
|
|
3574
|
+
As as migrateToLatest
|
|
3532
3575
|
};
|