@authhero/kysely-adapter 8.1.0 → 8.2.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 +2 -2
- package/dist/kysely-adapter.mjs +787 -769
- package/package.json +3 -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 Je = (t, e,
|
|
6
|
-
var j = (t, e,
|
|
7
|
-
var d = (t, e,
|
|
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), K = (t, e, a) => e.has(t) || de("Cannot " + a);
|
|
7
|
+
var d = (t, e, a) => (K(t, e, "read from private field"), a ? a.call(t) : e.get(t)), y = (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) => (K(t, e, "write to private field"), r ? r.call(t, a) : e.set(t, a), a), u = (t, e, a) => (K(t, e, "access private method"), a);
|
|
8
8
|
import { parseUserId as Y, codeSchema as ze, connectionSchema as Re, loginSchema as Ke, promptSettingSchema as Ue } 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();
|
|
@@ -50,18 +50,18 @@ function Be(t) {
|
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function _(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(_) : e[a] = _(e[a]));
|
|
57
57
|
return e;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function fe(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,35 +76,35 @@ 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, c = {
|
|
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
|
-
...o.map(
|
|
100
|
+
...o.map(fe)
|
|
101
101
|
]
|
|
102
102
|
};
|
|
103
|
-
return
|
|
103
|
+
return _(c);
|
|
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("-"), c, l, g, m;
|
|
109
109
|
return n.startsWith("-_exists_:") ? (c = n.substring(10), g = !0, s = !0) : n.startsWith("_exists_:") ? (c = n.substring(9), g = !0, s = !1) : n.includes(":") ? (s = n.startsWith("-"), [c, l] = s ? n.substring(1).split(":") : n.split(":"), g = !1, l.startsWith(">=") ? (m = ">=", l = l.substring(2)) : l.startsWith(">") ? (m = ">", l = l.substring(1)) : l.startsWith("<=") ? (m = "<=", l = l.substring(2)) : l.startsWith("<") ? (m = "<", l = l.substring(1)) : m = "=") : (c = null, l = n, g = !1), { key: c, value: l, isNegation: s, isExistsQuery: g, operator: m };
|
|
110
110
|
}).forEach(({ key: n, value: s, isNegation: c, isExistsQuery: l, operator: g }) => {
|
|
@@ -134,31 +134,31 @@ function T(t, e, r, a) {
|
|
|
134
134
|
const { ref: m } = t.dynamic;
|
|
135
135
|
e = e.where(
|
|
136
136
|
(w) => w.or(
|
|
137
|
-
|
|
137
|
+
r.map((x) => w(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), c = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], l = n.map((m) => {
|
|
158
158
|
const w = c.filter(
|
|
159
159
|
(x) => x.linked_to === m.user_id
|
|
160
160
|
);
|
|
161
|
-
return
|
|
161
|
+
return _({
|
|
162
162
|
...m,
|
|
163
163
|
email_verified: m.email_verified === 1,
|
|
164
164
|
is_social: m.is_social === 1,
|
|
@@ -171,39 +171,39 @@ function Ve(t) {
|
|
|
171
171
|
user_id: Y(m.user_id).id,
|
|
172
172
|
isSocial: !!m.is_social
|
|
173
173
|
},
|
|
174
|
-
...w.map(
|
|
174
|
+
...w.map(fe)
|
|
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: l,
|
|
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 qe(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 We(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: We(
|
|
196
|
+
...r,
|
|
197
|
+
email_verified: We(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 ? _(a) : null;
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
function tt(t) {
|
|
@@ -247,37 +247,37 @@ 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: c } = t.dynamic;
|
|
253
|
-
|
|
253
|
+
a = a.orderBy(c(e.sort.sort_by), e.sort.sort_order);
|
|
254
254
|
}
|
|
255
|
-
e.q && (
|
|
256
|
-
const o = await
|
|
255
|
+
e.q && (a = a.where((c) => c.or([c("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((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = b(n);
|
|
262
262
|
return {
|
|
263
|
-
tenants: o.map(
|
|
263
|
+
tenants: o.map(_),
|
|
264
264
|
start: (e.page - 1) * e.per_page,
|
|
265
265
|
limit: e.per_page,
|
|
266
266
|
length: s
|
|
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: c } = t.dynamic;
|
|
349
349
|
o = o.orderBy(
|
|
350
|
-
c(
|
|
351
|
-
|
|
350
|
+
c(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((c) => c.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 ct(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 lt(t) {
|
|
@@ -375,11 +375,11 @@ function lt(t) {
|
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
377
|
function dt(t) {
|
|
378
|
-
return async (e,
|
|
379
|
-
const
|
|
380
|
-
if (!
|
|
378
|
+
return async (e, a) => {
|
|
379
|
+
const r = await t.selectFrom("sessions_2").where("sessions_2.tenant_id", "=", e).where("sessions_2.id", "=", a).where("sessions_2.revoked_at", "is", null).selectAll().executeTakeFirst();
|
|
380
|
+
if (!r)
|
|
381
381
|
return null;
|
|
382
|
-
const { tenant_id: o, device: n, clients: s, ...c } =
|
|
382
|
+
const { tenant_id: o, device: n, clients: s, ...c } = r;
|
|
383
383
|
return {
|
|
384
384
|
...c,
|
|
385
385
|
device: JSON.parse(n),
|
|
@@ -388,99 +388,99 @@ function dt(t) {
|
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
function ut(t) {
|
|
391
|
-
return async (e,
|
|
392
|
-
const
|
|
393
|
-
...
|
|
391
|
+
return async (e, a) => {
|
|
392
|
+
const r = {
|
|
393
|
+
...a,
|
|
394
394
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
395
395
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
396
396
|
authenticated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
397
397
|
last_interaction_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
398
398
|
};
|
|
399
|
-
return await t.insertInto("
|
|
400
|
-
...
|
|
399
|
+
return await t.insertInto("sessions_2").values({
|
|
400
|
+
...r,
|
|
401
401
|
tenant_id: e,
|
|
402
|
-
device: JSON.stringify(
|
|
403
|
-
clients: JSON.stringify(
|
|
404
|
-
}).execute(),
|
|
402
|
+
device: JSON.stringify(a.device),
|
|
403
|
+
clients: JSON.stringify(a.clients)
|
|
404
|
+
}).execute(), r;
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
function mt(t) {
|
|
408
|
-
return async (e,
|
|
408
|
+
return async (e, a) => !!(await t.deleteFrom("sessions_2").where("tenant_id", "=", e).where("sessions_2.id", "=", a).execute()).length;
|
|
409
409
|
}
|
|
410
410
|
function ht(t) {
|
|
411
|
-
return async (e,
|
|
411
|
+
return async (e, a, r) => {
|
|
412
412
|
const o = {
|
|
413
|
-
...
|
|
413
|
+
...r,
|
|
414
414
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
415
|
-
device:
|
|
416
|
-
clients:
|
|
415
|
+
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
416
|
+
clients: r.clients ? JSON.stringify(r.clients) : void 0
|
|
417
417
|
};
|
|
418
|
-
return !!(await t.updateTable("
|
|
418
|
+
return !!(await t.updateTable("sessions_2").set(o).where("tenant_id", "=", e).where("sessions_2.id", "=", a).execute()).length;
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
return async (e,
|
|
421
|
+
function _t(t) {
|
|
422
|
+
return async (e, a = {
|
|
423
423
|
page: 0,
|
|
424
424
|
per_page: 50,
|
|
425
425
|
include_totals: !1
|
|
426
426
|
}) => {
|
|
427
|
-
let
|
|
428
|
-
|
|
429
|
-
let o =
|
|
430
|
-
if (
|
|
427
|
+
let r = t.selectFrom("sessions_2").where("sessions_2.tenant_id", "=", e);
|
|
428
|
+
a.q && (r = T(t, r, a.q, ["user_id", "session_id"]));
|
|
429
|
+
let o = r;
|
|
430
|
+
if (a.sort && a.sort.sort_by) {
|
|
431
431
|
const { ref: l } = t.dynamic;
|
|
432
432
|
o = o.orderBy(
|
|
433
|
-
l(
|
|
434
|
-
|
|
433
|
+
l(a.sort.sort_by),
|
|
434
|
+
a.sort.sort_order
|
|
435
435
|
);
|
|
436
436
|
}
|
|
437
|
-
o = o.offset(
|
|
438
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
437
|
+
o = o.offset(a.page * a.per_page).limit(a.per_page);
|
|
438
|
+
const n = await o.selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), c = b(s);
|
|
439
439
|
return {
|
|
440
440
|
sessions: n.map((l) => ({
|
|
441
441
|
...l,
|
|
442
442
|
device: JSON.parse(l.device),
|
|
443
443
|
clients: JSON.parse(l.clients)
|
|
444
444
|
})),
|
|
445
|
-
start:
|
|
446
|
-
limit:
|
|
445
|
+
start: a.page * a.per_page,
|
|
446
|
+
limit: a.per_page,
|
|
447
447
|
length: c
|
|
448
448
|
};
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function ft(t) {
|
|
452
452
|
return {
|
|
453
453
|
create: ut(t),
|
|
454
454
|
get: dt(t),
|
|
455
|
-
list:
|
|
455
|
+
list: _t(t),
|
|
456
456
|
remove: mt(t),
|
|
457
457
|
update: ht(t)
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
460
|
function pt(t) {
|
|
461
|
-
return async (e,
|
|
462
|
-
const
|
|
461
|
+
return async (e, a) => {
|
|
462
|
+
const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", a).selectAll().executeTakeFirstOrThrow(), { tenant_id: o, ...n } = r;
|
|
463
463
|
return n;
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
466
|
function gt(t) {
|
|
467
|
-
return async (e,
|
|
468
|
-
const
|
|
469
|
-
...
|
|
467
|
+
return async (e, a) => {
|
|
468
|
+
const r = {
|
|
469
|
+
...a,
|
|
470
470
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
471
471
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
472
472
|
};
|
|
473
473
|
return await t.insertInto("passwords").values({
|
|
474
|
-
...
|
|
474
|
+
...r,
|
|
475
475
|
tenant_id: e
|
|
476
|
-
}).execute(),
|
|
476
|
+
}).execute(), r;
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
479
|
function yt(t) {
|
|
480
|
-
return async (e,
|
|
481
|
-
password:
|
|
480
|
+
return async (e, a) => (await t.updateTable("passwords").set({
|
|
481
|
+
password: a.password,
|
|
482
482
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
483
|
-
}).where("tenant_id", "=", e).where("user_id", "=",
|
|
483
|
+
}).where("tenant_id", "=", e).where("user_id", "=", a.user_id).execute()).length === 1;
|
|
484
484
|
}
|
|
485
485
|
function wt(t) {
|
|
486
486
|
return {
|
|
@@ -490,78 +490,78 @@ function wt(t) {
|
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
function Nt(t) {
|
|
493
|
-
return async (e,
|
|
493
|
+
return async (e, a = {
|
|
494
494
|
page: 0,
|
|
495
495
|
per_page: 50,
|
|
496
496
|
include_totals: !1
|
|
497
497
|
}) => {
|
|
498
|
-
let
|
|
499
|
-
|
|
500
|
-
const n = await
|
|
498
|
+
let r = t.selectFrom("codes").where("codes.tenant_id", "=", e);
|
|
499
|
+
a.q && (r = T(t, r, a.q, ["code", "login_id"]));
|
|
500
|
+
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();
|
|
501
501
|
return {
|
|
502
502
|
codes: n.map((l) => {
|
|
503
503
|
const { tenant_id: g, ...m } = l;
|
|
504
|
-
return ze.parse(
|
|
504
|
+
return ze.parse(_(m));
|
|
505
505
|
}),
|
|
506
|
-
start:
|
|
507
|
-
limit:
|
|
508
|
-
length:
|
|
506
|
+
start: a.page * a.per_page,
|
|
507
|
+
limit: a.per_page,
|
|
508
|
+
length: b(s)
|
|
509
509
|
};
|
|
510
510
|
};
|
|
511
511
|
}
|
|
512
512
|
function vt(t) {
|
|
513
|
-
return async (e,
|
|
514
|
-
const
|
|
515
|
-
...
|
|
513
|
+
return async (e, a) => {
|
|
514
|
+
const r = {
|
|
515
|
+
...a,
|
|
516
516
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
517
517
|
};
|
|
518
518
|
return await t.insertInto("codes").values({
|
|
519
|
-
...
|
|
519
|
+
...r,
|
|
520
520
|
tenant_id: e
|
|
521
|
-
}).execute(),
|
|
521
|
+
}).execute(), r;
|
|
522
522
|
};
|
|
523
523
|
}
|
|
524
|
-
function bt(t) {
|
|
525
|
-
return async (e, r) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", r).executeTakeFirst()).numDeletedRows > 0;
|
|
526
|
-
}
|
|
527
524
|
function Ct(t) {
|
|
528
|
-
return async (e,
|
|
529
|
-
|
|
525
|
+
return async (e, a) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
526
|
+
}
|
|
527
|
+
function bt(t) {
|
|
528
|
+
return async (e, a, r) => {
|
|
529
|
+
let o = t.selectFrom("codes").where("codes.code_id", "=", a).where("codes.code_type", "=", r);
|
|
530
530
|
e.length && (o = o.where("codes.tenant_id", "=", e));
|
|
531
531
|
const n = await o.selectAll().executeTakeFirst();
|
|
532
|
-
return n ?
|
|
532
|
+
return n ? _(n) : null;
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
535
|
function xt(t) {
|
|
536
|
-
return async (e,
|
|
536
|
+
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;
|
|
537
537
|
}
|
|
538
538
|
function Tt(t) {
|
|
539
539
|
return {
|
|
540
540
|
create: vt(t),
|
|
541
541
|
list: Nt(t),
|
|
542
|
-
remove:
|
|
542
|
+
remove: Ct(t),
|
|
543
543
|
used: xt(t),
|
|
544
|
-
get:
|
|
544
|
+
get: bt(t)
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
547
|
function St(t) {
|
|
548
|
-
return async (e,
|
|
549
|
-
const
|
|
548
|
+
return async (e, a) => {
|
|
549
|
+
const r = {
|
|
550
550
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
551
551
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
552
|
-
...
|
|
553
|
-
}, o = JSON.stringify(
|
|
552
|
+
...a
|
|
553
|
+
}, o = JSON.stringify(a.allowed_origins), n = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), c = JSON.stringify(a.allowed_logout_urls), l = JSON.stringify(a.allowed_clients);
|
|
554
554
|
return await t.insertInto("applications").values({
|
|
555
|
-
...
|
|
555
|
+
...r,
|
|
556
556
|
tenant_id: e,
|
|
557
|
-
disable_sign_ups:
|
|
558
|
-
addons:
|
|
557
|
+
disable_sign_ups: a.disable_sign_ups ? 1 : 0,
|
|
558
|
+
addons: a.addons ? JSON.stringify(a.addons) : "{}",
|
|
559
559
|
callbacks: n,
|
|
560
560
|
allowed_origins: o,
|
|
561
561
|
web_origins: s,
|
|
562
562
|
allowed_logout_urls: c,
|
|
563
563
|
allowed_clients: l
|
|
564
|
-
}).execute(),
|
|
564
|
+
}).execute(), r;
|
|
565
565
|
};
|
|
566
566
|
}
|
|
567
567
|
function Ot(t) {
|
|
@@ -579,107 +579,107 @@ function Ot(t) {
|
|
|
579
579
|
});
|
|
580
580
|
}
|
|
581
581
|
function kt(t) {
|
|
582
|
-
return async (e,
|
|
583
|
-
const
|
|
584
|
-
return
|
|
585
|
-
...
|
|
586
|
-
disable_sign_ups: !!
|
|
587
|
-
addons: JSON.parse(
|
|
588
|
-
callbacks: JSON.parse(
|
|
589
|
-
allowed_origins: JSON.parse(
|
|
590
|
-
web_origins: JSON.parse(
|
|
591
|
-
allowed_logout_urls: JSON.parse(
|
|
582
|
+
return async (e, a) => {
|
|
583
|
+
const r = await t.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", a).selectAll().executeTakeFirst();
|
|
584
|
+
return r ? _({
|
|
585
|
+
...r,
|
|
586
|
+
disable_sign_ups: !!r.disable_sign_ups,
|
|
587
|
+
addons: JSON.parse(r.addons),
|
|
588
|
+
callbacks: JSON.parse(r.callbacks),
|
|
589
|
+
allowed_origins: JSON.parse(r.allowed_origins),
|
|
590
|
+
web_origins: JSON.parse(r.web_origins),
|
|
591
|
+
allowed_logout_urls: JSON.parse(r.allowed_logout_urls)
|
|
592
592
|
}) : null;
|
|
593
593
|
};
|
|
594
594
|
}
|
|
595
595
|
function $t(t) {
|
|
596
|
-
return async (e,
|
|
596
|
+
return async (e, a) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
597
597
|
}
|
|
598
|
-
function
|
|
599
|
-
return async (e,
|
|
598
|
+
function Dt(t) {
|
|
599
|
+
return async (e, a, r) => {
|
|
600
600
|
const o = {
|
|
601
|
-
...
|
|
601
|
+
...r,
|
|
602
602
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
603
|
-
allowed_origins:
|
|
604
|
-
callbacks:
|
|
605
|
-
web_origins:
|
|
606
|
-
allowed_logout_urls:
|
|
607
|
-
allowed_clients:
|
|
608
|
-
addons:
|
|
609
|
-
disable_sign_ups:
|
|
603
|
+
allowed_origins: r.allowed_origins ? JSON.stringify(r.allowed_origins) : void 0,
|
|
604
|
+
callbacks: r.callbacks ? JSON.stringify(r.callbacks) : void 0,
|
|
605
|
+
web_origins: r.web_origins ? JSON.stringify(r.web_origins) : void 0,
|
|
606
|
+
allowed_logout_urls: r.allowed_logout_urls ? JSON.stringify(r.allowed_logout_urls) : void 0,
|
|
607
|
+
allowed_clients: r.allowed_clients ? JSON.stringify(r.allowed_clients) : void 0,
|
|
608
|
+
addons: r.addons ? JSON.stringify(r.addons) : "{}",
|
|
609
|
+
disable_sign_ups: r.disable_sign_ups ? 1 : 0
|
|
610
610
|
};
|
|
611
|
-
return await t.updateTable("applications").set(o).where("applications.id", "=",
|
|
611
|
+
return await t.updateTable("applications").set(o).where("applications.id", "=", a).where("applications.tenant_id", "=", e).execute(), !0;
|
|
612
612
|
};
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function It(t) {
|
|
615
615
|
return {
|
|
616
616
|
create: St(t),
|
|
617
617
|
list: Ot(t),
|
|
618
618
|
get: kt(t),
|
|
619
619
|
remove: $t(t),
|
|
620
|
-
update:
|
|
620
|
+
update: Dt(t)
|
|
621
621
|
};
|
|
622
622
|
}
|
|
623
623
|
function Pt(t) {
|
|
624
|
-
return async (e,
|
|
625
|
-
const
|
|
624
|
+
return async (e, a) => {
|
|
625
|
+
const r = {
|
|
626
626
|
id: k(),
|
|
627
|
-
...
|
|
627
|
+
...a,
|
|
628
628
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
629
629
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
630
630
|
};
|
|
631
631
|
return await t.insertInto("connections").values({
|
|
632
|
-
...
|
|
632
|
+
...r,
|
|
633
633
|
// The connection options will have many different properties depending on the strategy
|
|
634
|
-
options: JSON.stringify(
|
|
634
|
+
options: JSON.stringify(r.options || {}),
|
|
635
635
|
tenant_id: e
|
|
636
|
-
}).execute(),
|
|
636
|
+
}).execute(), r;
|
|
637
637
|
};
|
|
638
638
|
}
|
|
639
639
|
function jt(t) {
|
|
640
|
-
return async (e,
|
|
640
|
+
return async (e, a = {
|
|
641
641
|
page: 0,
|
|
642
642
|
per_page: 50,
|
|
643
643
|
include_totals: !1
|
|
644
644
|
}) => {
|
|
645
|
-
let
|
|
646
|
-
|
|
647
|
-
const s = (await
|
|
648
|
-
(l) =>
|
|
645
|
+
let r = t.selectFrom("connections").where("connections.tenant_id", "=", e);
|
|
646
|
+
a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
|
|
647
|
+
const s = (await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute()).map(
|
|
648
|
+
(l) => _({
|
|
649
649
|
...l,
|
|
650
650
|
options: JSON.parse(l.options)
|
|
651
651
|
})
|
|
652
|
-
), { count: c } = await
|
|
652
|
+
), { count: c } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
653
653
|
return {
|
|
654
654
|
connections: s,
|
|
655
|
-
start:
|
|
656
|
-
limit:
|
|
657
|
-
length:
|
|
655
|
+
start: a.page * a.per_page,
|
|
656
|
+
limit: a.per_page,
|
|
657
|
+
length: b(c)
|
|
658
658
|
};
|
|
659
659
|
};
|
|
660
660
|
}
|
|
661
661
|
function Mt(t) {
|
|
662
|
-
return async (e,
|
|
662
|
+
return async (e, a) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
663
663
|
}
|
|
664
664
|
function At(t) {
|
|
665
|
-
return async (e,
|
|
666
|
-
const
|
|
667
|
-
return
|
|
668
|
-
...
|
|
669
|
-
options: JSON.parse(
|
|
665
|
+
return async (e, a) => {
|
|
666
|
+
const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).selectAll().executeTakeFirst();
|
|
667
|
+
return r ? _({
|
|
668
|
+
...r,
|
|
669
|
+
options: JSON.parse(r.options)
|
|
670
670
|
}) : null;
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
673
|
function Ft(t) {
|
|
674
|
-
return async (e,
|
|
674
|
+
return async (e, a, r) => {
|
|
675
675
|
const o = {
|
|
676
|
-
...
|
|
676
|
+
...r,
|
|
677
677
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
678
678
|
};
|
|
679
679
|
return await t.updateTable("connections").set({
|
|
680
680
|
...o,
|
|
681
681
|
options: o.options ? JSON.stringify(o.options) : void 0
|
|
682
|
-
}).where("connections.id", "=",
|
|
682
|
+
}).where("connections.id", "=", a).where("connections.tenant_id", "=", e).execute(), !0;
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
685
|
function Lt(t) {
|
|
@@ -694,42 +694,42 @@ function Lt(t) {
|
|
|
694
694
|
function Et(t) {
|
|
695
695
|
return {
|
|
696
696
|
get: async (e) => {
|
|
697
|
-
const
|
|
698
|
-
if (!r)
|
|
699
|
-
return null;
|
|
700
|
-
const a = await t.selectFrom("tenants").selectAll().where("id", "=", r.tenant_id).executeTakeFirst();
|
|
697
|
+
const a = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
|
|
701
698
|
if (!a)
|
|
699
|
+
return null;
|
|
700
|
+
const r = await t.selectFrom("tenants").selectAll().where("id", "=", a.tenant_id).executeTakeFirst();
|
|
701
|
+
if (!r)
|
|
702
702
|
throw new V(404, { message: "Tenant not found" });
|
|
703
|
-
const o = await t.selectFrom("connections").where("tenant_id", "=",
|
|
703
|
+
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();
|
|
704
704
|
return {
|
|
705
|
-
...
|
|
705
|
+
...a,
|
|
706
706
|
connections: o.map(
|
|
707
707
|
(c) => Re.parse(
|
|
708
|
-
|
|
708
|
+
_({
|
|
709
709
|
...c,
|
|
710
710
|
options: c.options ? JSON.parse(c.options) : {}
|
|
711
711
|
})
|
|
712
712
|
)
|
|
713
713
|
),
|
|
714
714
|
domains: n,
|
|
715
|
-
addons:
|
|
716
|
-
callbacks:
|
|
717
|
-
allowed_origins:
|
|
718
|
-
web_origins:
|
|
719
|
-
allowed_logout_urls:
|
|
720
|
-
allowed_clients:
|
|
721
|
-
tenant:
|
|
715
|
+
addons: a.addons ? JSON.parse(a.addons) : {},
|
|
716
|
+
callbacks: a.callbacks ? JSON.parse(a.callbacks) : [],
|
|
717
|
+
allowed_origins: a.allowed_origins ? JSON.parse(a.allowed_origins) : [],
|
|
718
|
+
web_origins: a.web_origins ? JSON.parse(a.web_origins) : [],
|
|
719
|
+
allowed_logout_urls: a.allowed_logout_urls ? JSON.parse(a.allowed_logout_urls) : [],
|
|
720
|
+
allowed_clients: a.allowed_clients ? JSON.parse(a.allowed_clients) : [],
|
|
721
|
+
tenant: _(r),
|
|
722
722
|
// this is really an integer in the database
|
|
723
|
-
disable_sign_ups: !!
|
|
723
|
+
disable_sign_ups: !!a.disable_sign_ups
|
|
724
724
|
};
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
728
|
function Jt(t) {
|
|
729
729
|
return async () => await t.selectFrom("keys").where(
|
|
730
|
-
(
|
|
731
|
-
|
|
732
|
-
|
|
730
|
+
(a) => a.or([
|
|
731
|
+
a("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
|
|
732
|
+
a("revoked_at", "is", null)
|
|
733
733
|
])
|
|
734
734
|
).selectAll().execute();
|
|
735
735
|
}
|
|
@@ -739,7 +739,7 @@ function zt(t) {
|
|
|
739
739
|
};
|
|
740
740
|
}
|
|
741
741
|
function Rt(t) {
|
|
742
|
-
return async (e,
|
|
742
|
+
return async (e, a) => !!(await t.updateTable("keys").set(a).where("kid", "=", e).execute()).length;
|
|
743
743
|
}
|
|
744
744
|
function Kt(t) {
|
|
745
745
|
return {
|
|
@@ -749,27 +749,27 @@ function Kt(t) {
|
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
751
|
function Ut(t) {
|
|
752
|
-
return async (e,
|
|
753
|
-
const
|
|
752
|
+
return async (e, a) => {
|
|
753
|
+
const r = {
|
|
754
754
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
755
755
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
756
756
|
tenant_id: e,
|
|
757
757
|
id: k(),
|
|
758
|
-
...
|
|
758
|
+
...a
|
|
759
759
|
};
|
|
760
|
-
return await t.insertInto("domains").values(
|
|
760
|
+
return await t.insertInto("domains").values(r).execute(), r;
|
|
761
761
|
};
|
|
762
762
|
}
|
|
763
763
|
function Bt(t) {
|
|
764
|
-
return async (e,
|
|
765
|
-
let
|
|
766
|
-
|
|
767
|
-
const n = await
|
|
764
|
+
return async (e, a) => {
|
|
765
|
+
let r = t.selectFrom("domains").where("domains.tenant_id", "=", e);
|
|
766
|
+
a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
|
|
767
|
+
const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
768
768
|
return {
|
|
769
769
|
domains: n,
|
|
770
|
-
start:
|
|
771
|
-
limit:
|
|
772
|
-
length:
|
|
770
|
+
start: a.page * a.per_page,
|
|
771
|
+
limit: a.per_page,
|
|
772
|
+
length: b(s)
|
|
773
773
|
};
|
|
774
774
|
};
|
|
775
775
|
}
|
|
@@ -781,11 +781,11 @@ function Qt(t) {
|
|
|
781
781
|
}
|
|
782
782
|
function Vt(t) {
|
|
783
783
|
return async (e) => {
|
|
784
|
-
const [
|
|
785
|
-
if (!
|
|
784
|
+
const [a] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
|
|
785
|
+
if (!a)
|
|
786
786
|
return null;
|
|
787
787
|
const {
|
|
788
|
-
tenant_id:
|
|
788
|
+
tenant_id: r,
|
|
789
789
|
colors_primary: o,
|
|
790
790
|
colors_page_background_type: n,
|
|
791
791
|
colors_page_background_start: s,
|
|
@@ -793,8 +793,8 @@ function Vt(t) {
|
|
|
793
793
|
colors_page_background_angle_dev: l,
|
|
794
794
|
font_url: g,
|
|
795
795
|
...m
|
|
796
|
-
} =
|
|
797
|
-
return
|
|
796
|
+
} = a;
|
|
797
|
+
return _({
|
|
798
798
|
...m,
|
|
799
799
|
colors: {
|
|
800
800
|
primary: o,
|
|
@@ -810,29 +810,29 @@ function Vt(t) {
|
|
|
810
810
|
};
|
|
811
811
|
}
|
|
812
812
|
function qt(t) {
|
|
813
|
-
return async (e,
|
|
814
|
-
var s, c, l, g, m, w, x, Z, ee, te,
|
|
815
|
-
const { colors:
|
|
813
|
+
return async (e, a) => {
|
|
814
|
+
var s, c, l, g, m, w, x, Z, ee, te, ae, re, ne, oe, se, ie, ce, le;
|
|
815
|
+
const { colors: r, font: o, ...n } = a;
|
|
816
816
|
try {
|
|
817
817
|
await t.insertInto("branding").values({
|
|
818
818
|
...n,
|
|
819
|
-
colors_primary:
|
|
820
|
-
colors_page_background_type: (c = (s =
|
|
821
|
-
colors_page_background_start: (g = (l =
|
|
822
|
-
colors_page_background_end: (w = (m =
|
|
823
|
-
colors_page_background_angle_dev: (Z = (x =
|
|
824
|
-
font_url: (ee =
|
|
819
|
+
colors_primary: r == null ? void 0 : r.primary,
|
|
820
|
+
colors_page_background_type: (c = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : c.type,
|
|
821
|
+
colors_page_background_start: (g = (l = a.colors) == null ? void 0 : l.page_background) == null ? void 0 : g.start,
|
|
822
|
+
colors_page_background_end: (w = (m = a.colors) == null ? void 0 : m.page_background) == null ? void 0 : w.end,
|
|
823
|
+
colors_page_background_angle_dev: (Z = (x = a.colors) == null ? void 0 : x.page_background) == null ? void 0 : Z.angle_deg,
|
|
824
|
+
font_url: (ee = a.font) == null ? void 0 : ee.url,
|
|
825
825
|
tenant_id: e
|
|
826
826
|
}).execute();
|
|
827
827
|
} catch {
|
|
828
828
|
await t.updateTable("branding").set({
|
|
829
829
|
...n,
|
|
830
|
-
colors_primary:
|
|
831
|
-
colors_page_background_type: (
|
|
832
|
-
colors_page_background_start: (ne = (
|
|
833
|
-
colors_page_background_end: (se = (oe =
|
|
834
|
-
colors_page_background_angle_dev: (ce = (ie =
|
|
835
|
-
font_url: (le =
|
|
830
|
+
colors_primary: r == null ? void 0 : r.primary,
|
|
831
|
+
colors_page_background_type: (ae = (te = a.colors) == null ? void 0 : te.page_background) == null ? void 0 : ae.type,
|
|
832
|
+
colors_page_background_start: (ne = (re = a.colors) == null ? void 0 : re.page_background) == null ? void 0 : ne.start,
|
|
833
|
+
colors_page_background_end: (se = (oe = a.colors) == null ? void 0 : oe.page_background) == null ? void 0 : se.end,
|
|
834
|
+
colors_page_background_angle_dev: (ce = (ie = a.colors) == null ? void 0 : ie.page_background) == null ? void 0 : ce.angle_deg,
|
|
835
|
+
font_url: (le = a.font) == null ? void 0 : le.url
|
|
836
836
|
}).where("tenant_id", "=", e).execute();
|
|
837
837
|
}
|
|
838
838
|
};
|
|
@@ -844,70 +844,70 @@ function Wt(t) {
|
|
|
844
844
|
};
|
|
845
845
|
}
|
|
846
846
|
function Gt(t) {
|
|
847
|
-
return async (e,
|
|
847
|
+
return async (e, a = {
|
|
848
848
|
page: 0,
|
|
849
849
|
per_page: 50,
|
|
850
850
|
include_totals: !1
|
|
851
851
|
}) => {
|
|
852
|
-
let
|
|
853
|
-
|
|
854
|
-
const n = await
|
|
852
|
+
let r = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
|
|
853
|
+
a.q && (r = T(t, r, a.q, ["url"]));
|
|
854
|
+
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();
|
|
855
855
|
return {
|
|
856
856
|
hooks: n.map((l) => {
|
|
857
857
|
const { tenant_id: g, enabled: m, synchronous: w, ...x } = l;
|
|
858
|
-
return
|
|
858
|
+
return _({
|
|
859
859
|
...x,
|
|
860
860
|
enabled: !!m,
|
|
861
861
|
synchronous: !!w
|
|
862
862
|
});
|
|
863
863
|
}),
|
|
864
|
-
start:
|
|
865
|
-
limit:
|
|
866
|
-
length:
|
|
864
|
+
start: a.page * a.per_page,
|
|
865
|
+
limit: a.per_page,
|
|
866
|
+
length: b(s)
|
|
867
867
|
};
|
|
868
868
|
};
|
|
869
869
|
}
|
|
870
870
|
function Ht(t) {
|
|
871
|
-
return async (e,
|
|
872
|
-
const
|
|
873
|
-
return
|
|
874
|
-
...
|
|
875
|
-
enabled: !!
|
|
876
|
-
synchronous: !!
|
|
871
|
+
return async (e, a) => {
|
|
872
|
+
const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).selectAll().executeTakeFirst();
|
|
873
|
+
return r ? _({
|
|
874
|
+
...r,
|
|
875
|
+
enabled: !!r.enabled,
|
|
876
|
+
synchronous: !!r.synchronous
|
|
877
877
|
}) : null;
|
|
878
878
|
};
|
|
879
879
|
}
|
|
880
880
|
function Xt(t) {
|
|
881
|
-
return async (e,
|
|
881
|
+
return async (e, a) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
882
882
|
}
|
|
883
883
|
function Yt(t) {
|
|
884
|
-
return async (e,
|
|
885
|
-
const
|
|
884
|
+
return async (e, a) => {
|
|
885
|
+
const r = {
|
|
886
886
|
hook_id: k(),
|
|
887
|
-
...
|
|
887
|
+
...a,
|
|
888
888
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
889
889
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
890
890
|
};
|
|
891
891
|
return await t.insertInto("hooks").values({
|
|
892
|
-
...
|
|
892
|
+
...r,
|
|
893
893
|
tenant_id: e,
|
|
894
|
-
enabled:
|
|
895
|
-
synchronous:
|
|
896
|
-
}).execute(),
|
|
894
|
+
enabled: a.enabled ? 1 : 0,
|
|
895
|
+
synchronous: a.synchronous ? 1 : 0
|
|
896
|
+
}).execute(), r;
|
|
897
897
|
};
|
|
898
898
|
}
|
|
899
899
|
function Zt(t) {
|
|
900
|
-
return async (e,
|
|
900
|
+
return async (e, a, r) => {
|
|
901
901
|
const o = {
|
|
902
|
-
...
|
|
902
|
+
...r,
|
|
903
903
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
904
|
-
enabled:
|
|
905
|
-
synchronous:
|
|
904
|
+
enabled: r.enabled !== void 0 ? r.enabled ? 1 : 0 : void 0,
|
|
905
|
+
synchronous: r.enabled !== void 0 ? r.synchronous ? 1 : 0 : void 0
|
|
906
906
|
};
|
|
907
|
-
return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=",
|
|
907
|
+
return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=", a).where("hooks.tenant_id", "=", e).execute(), !0;
|
|
908
908
|
};
|
|
909
909
|
}
|
|
910
|
-
function
|
|
910
|
+
function ea(t) {
|
|
911
911
|
return {
|
|
912
912
|
create: Yt(t),
|
|
913
913
|
get: Ht(t),
|
|
@@ -916,115 +916,115 @@ function er(t) {
|
|
|
916
916
|
remove: Xt(t)
|
|
917
917
|
};
|
|
918
918
|
}
|
|
919
|
-
function J(t, e = "",
|
|
920
|
-
for (let
|
|
921
|
-
if (Object.prototype.hasOwnProperty.call(t,
|
|
922
|
-
const o = e ? `${e}_${
|
|
923
|
-
typeof t[
|
|
919
|
+
function J(t, e = "", a = {}) {
|
|
920
|
+
for (let r in t)
|
|
921
|
+
if (Object.prototype.hasOwnProperty.call(t, r)) {
|
|
922
|
+
const o = e ? `${e}_${r}` : r;
|
|
923
|
+
typeof t[r] == "object" && t[r] !== null && !Array.isArray(t[r]) ? J(t[r], o, a) : a[o] = t[r];
|
|
924
924
|
}
|
|
925
|
-
return
|
|
925
|
+
return a;
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
const
|
|
929
|
-
for (const [
|
|
927
|
+
function ta(t, e) {
|
|
928
|
+
const a = {};
|
|
929
|
+
for (const [r, o] of Object.entries(t)) {
|
|
930
930
|
const n = e.find(
|
|
931
|
-
(s) =>
|
|
931
|
+
(s) => r.startsWith(`${s}_`)
|
|
932
932
|
);
|
|
933
933
|
if (!n)
|
|
934
|
-
r
|
|
934
|
+
a[r] = o;
|
|
935
935
|
else {
|
|
936
|
-
const s =
|
|
937
|
-
|
|
938
|
-
...
|
|
936
|
+
const s = r.slice(n.length + 1);
|
|
937
|
+
a[n] = {
|
|
938
|
+
...a[n],
|
|
939
939
|
[s]: o
|
|
940
940
|
};
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
|
-
return
|
|
943
|
+
return a;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
946
|
-
return async (e,
|
|
947
|
-
const
|
|
945
|
+
function aa(t) {
|
|
946
|
+
return async (e, a) => {
|
|
947
|
+
const r = {
|
|
948
948
|
themeId: k(),
|
|
949
|
-
...
|
|
949
|
+
...a,
|
|
950
950
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
951
951
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
952
952
|
};
|
|
953
|
-
return await t.insertInto("themes").values({ ...J(
|
|
953
|
+
return await t.insertInto("themes").values({ ...J(r), tenant_id: e }).execute(), r;
|
|
954
954
|
};
|
|
955
955
|
}
|
|
956
|
-
function
|
|
957
|
-
return async (e,
|
|
956
|
+
function ra(t) {
|
|
957
|
+
return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
958
958
|
}
|
|
959
|
-
function
|
|
960
|
-
return async (e,
|
|
961
|
-
const
|
|
962
|
-
return
|
|
959
|
+
function na(t) {
|
|
960
|
+
return async (e, a) => {
|
|
961
|
+
const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).selectAll().executeTakeFirst();
|
|
962
|
+
return r ? _(r) : null;
|
|
963
963
|
};
|
|
964
964
|
}
|
|
965
|
-
function
|
|
966
|
-
return async (e,
|
|
965
|
+
function oa(t) {
|
|
966
|
+
return async (e, a, r) => {
|
|
967
967
|
const o = J({
|
|
968
|
-
...
|
|
968
|
+
...r,
|
|
969
969
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
970
970
|
});
|
|
971
|
-
return await t.updateTable("themes").set(o).where("themes.id", "=",
|
|
971
|
+
return await t.updateTable("themes").set(o).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
|
|
972
972
|
};
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function sa(t) {
|
|
975
975
|
return {
|
|
976
|
-
create:
|
|
977
|
-
get:
|
|
978
|
-
remove:
|
|
979
|
-
update:
|
|
976
|
+
create: aa(t),
|
|
977
|
+
get: na(t),
|
|
978
|
+
remove: ra(t),
|
|
979
|
+
update: oa(t)
|
|
980
980
|
};
|
|
981
981
|
}
|
|
982
|
-
function
|
|
983
|
-
return async (e,
|
|
984
|
-
const
|
|
982
|
+
function ia(t) {
|
|
983
|
+
return async (e, a) => {
|
|
984
|
+
const r = (/* @__PURE__ */ new Date()).toISOString(), o = await t.selectFrom("logins").where("logins.expires_at", ">", r).where("logins.login_id", "=", a).selectAll().executeTakeFirst();
|
|
985
985
|
return o ? Ke.parse(
|
|
986
|
-
|
|
986
|
+
ta(_(o), ["authParams"])
|
|
987
987
|
) : null;
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
|
-
function
|
|
991
|
-
return async (e,
|
|
992
|
-
const
|
|
990
|
+
function ca(t) {
|
|
991
|
+
return async (e, a) => {
|
|
992
|
+
const r = {
|
|
993
993
|
login_id: k(),
|
|
994
|
-
...
|
|
994
|
+
...a,
|
|
995
995
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
996
996
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
997
997
|
};
|
|
998
|
-
return await t.insertInto("logins").values({ ...J(
|
|
998
|
+
return await t.insertInto("logins").values({ ...J(r), tenant_id: e }).execute(), r;
|
|
999
999
|
};
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1002
|
-
return async (e,
|
|
1001
|
+
function la(t) {
|
|
1002
|
+
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;
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1005
|
-
return async (e,
|
|
1004
|
+
function da(t) {
|
|
1005
|
+
return async (e, a) => (await t.deleteFrom("logins").where("logins.tenant_id", "=", e).where("logins.login_id", "=", a).execute()).length > 0;
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function ua(t) {
|
|
1008
1008
|
return {
|
|
1009
|
-
create:
|
|
1010
|
-
get:
|
|
1011
|
-
update:
|
|
1012
|
-
remove:
|
|
1009
|
+
create: ca(t),
|
|
1010
|
+
get: ia(t),
|
|
1011
|
+
update: la(t),
|
|
1012
|
+
remove: da(t)
|
|
1013
1013
|
};
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1015
|
+
function ma(t) {
|
|
1016
1016
|
return async (e) => {
|
|
1017
|
-
const [
|
|
1018
|
-
return
|
|
1019
|
-
identifier_first: !!(
|
|
1020
|
-
password_first: !!(
|
|
1021
|
-
webauthn_platform_first_factor: !!(
|
|
1022
|
-
universal_login_experience: (
|
|
1017
|
+
const [a] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
|
|
1018
|
+
return _({
|
|
1019
|
+
identifier_first: !!(a != null && a.identifier_first),
|
|
1020
|
+
password_first: !!(a != null && a.password_first),
|
|
1021
|
+
webauthn_platform_first_factor: !!(a != null && a.webauthn_platform_first_factor),
|
|
1022
|
+
universal_login_experience: (a == null ? void 0 : a.universal_login_experience) || "new"
|
|
1023
1023
|
});
|
|
1024
1024
|
};
|
|
1025
1025
|
}
|
|
1026
1026
|
function he(t) {
|
|
1027
|
-
return
|
|
1027
|
+
return _({
|
|
1028
1028
|
...t,
|
|
1029
1029
|
webauthn_platform_first_factor: t.webauthn_platform_first_factor ? !!t.webauthn_platform_first_factor : void 0,
|
|
1030
1030
|
identifier_first: t.identifier_first ? !!t.identifier_first : void 0,
|
|
@@ -1032,38 +1032,38 @@ function he(t) {
|
|
|
1032
1032
|
universal_login_experience: t.universal_login_experience
|
|
1033
1033
|
});
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1036
|
-
return async (e,
|
|
1035
|
+
function ha(t) {
|
|
1036
|
+
return async (e, a) => {
|
|
1037
1037
|
try {
|
|
1038
|
-
const
|
|
1038
|
+
const r = Ue.parse(a);
|
|
1039
1039
|
await t.insertInto("prompt_settings").values({
|
|
1040
|
-
...he(
|
|
1040
|
+
...he(r),
|
|
1041
1041
|
tenant_id: e
|
|
1042
1042
|
}).execute();
|
|
1043
1043
|
} catch {
|
|
1044
|
-
await t.updateTable("prompt_settings").set(he(
|
|
1044
|
+
await t.updateTable("prompt_settings").set(he(a)).where("tenant_id", "=", e).execute();
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1048
|
+
function _a(t) {
|
|
1049
1049
|
return {
|
|
1050
|
-
get:
|
|
1051
|
-
set:
|
|
1050
|
+
get: ma(t),
|
|
1051
|
+
set: ha(t)
|
|
1052
1052
|
};
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1054
|
+
function fa(t) {
|
|
1055
1055
|
return async (e) => {
|
|
1056
|
-
const [
|
|
1057
|
-
if (!
|
|
1056
|
+
const [a] = await t.selectFrom("email_providers").where("email_providers.tenant_id", "=", e).selectAll().execute();
|
|
1057
|
+
if (!a)
|
|
1058
1058
|
return null;
|
|
1059
1059
|
const {
|
|
1060
|
-
tenant_id:
|
|
1060
|
+
tenant_id: r,
|
|
1061
1061
|
credentials: o,
|
|
1062
1062
|
settings: n,
|
|
1063
1063
|
enabled: s,
|
|
1064
1064
|
...c
|
|
1065
|
-
} =
|
|
1066
|
-
return
|
|
1065
|
+
} = a;
|
|
1066
|
+
return _({
|
|
1067
1067
|
...c,
|
|
1068
1068
|
credentials: JSON.parse(o),
|
|
1069
1069
|
settings: JSON.parse(n),
|
|
@@ -1071,24 +1071,24 @@ function _r(t) {
|
|
|
1071
1071
|
});
|
|
1072
1072
|
};
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
return async (e,
|
|
1076
|
-
const { credentials:
|
|
1074
|
+
function pa(t) {
|
|
1075
|
+
return async (e, a) => {
|
|
1076
|
+
const { credentials: r, settings: o, enabled: n, ...s } = a;
|
|
1077
1077
|
await t.updateTable("email_providers").set({
|
|
1078
1078
|
...s,
|
|
1079
|
-
credentials:
|
|
1079
|
+
credentials: r ? JSON.stringify(r) : void 0,
|
|
1080
1080
|
settings: o ? JSON.stringify(o) : void 0,
|
|
1081
1081
|
enabled: n !== void 0 ? n ? 1 : 0 : void 0
|
|
1082
1082
|
}).where("tenant_id", "=", e).execute();
|
|
1083
1083
|
};
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1086
|
-
return async (e,
|
|
1087
|
-
const { credentials:
|
|
1085
|
+
function ga(t) {
|
|
1086
|
+
return async (e, a) => {
|
|
1087
|
+
const { credentials: r, settings: o, enabled: n, ...s } = a;
|
|
1088
1088
|
await t.insertInto("email_providers").values({
|
|
1089
1089
|
...s,
|
|
1090
1090
|
enabled: n ? 1 : 0,
|
|
1091
|
-
credentials: JSON.stringify(
|
|
1091
|
+
credentials: JSON.stringify(r),
|
|
1092
1092
|
settings: JSON.stringify(o),
|
|
1093
1093
|
tenant_id: e,
|
|
1094
1094
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1096,71 +1096,71 @@ function gr(t) {
|
|
|
1096
1096
|
}).execute();
|
|
1097
1097
|
};
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function ya(t) {
|
|
1100
1100
|
return {
|
|
1101
|
-
get:
|
|
1102
|
-
create:
|
|
1103
|
-
update:
|
|
1101
|
+
get: fa(t),
|
|
1102
|
+
create: ga(t),
|
|
1103
|
+
update: pa(t)
|
|
1104
1104
|
};
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1107
|
-
return async (e,
|
|
1108
|
-
const
|
|
1109
|
-
return
|
|
1110
|
-
...
|
|
1111
|
-
rotating: !!
|
|
1112
|
-
device:
|
|
1113
|
-
resource_servers:
|
|
1106
|
+
function wa(t) {
|
|
1107
|
+
return async (e, a) => {
|
|
1108
|
+
const r = await t.selectFrom("refresh_tokens_2").where("refresh_tokens_2.tenant_id", "=", e).where("refresh_tokens_2.id", "=", a).selectAll().executeTakeFirst();
|
|
1109
|
+
return r ? {
|
|
1110
|
+
...r,
|
|
1111
|
+
rotating: !!r.rotating,
|
|
1112
|
+
device: r.device ? JSON.parse(r.device) : {},
|
|
1113
|
+
resource_servers: r.resource_servers ? JSON.parse(r.resource_servers) : []
|
|
1114
1114
|
} : null;
|
|
1115
1115
|
};
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return async (e,
|
|
1119
|
-
const
|
|
1120
|
-
...
|
|
1117
|
+
function Na(t) {
|
|
1118
|
+
return async (e, a) => {
|
|
1119
|
+
const r = {
|
|
1120
|
+
...a,
|
|
1121
1121
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1122
1122
|
};
|
|
1123
|
-
return await t.insertInto("
|
|
1124
|
-
...
|
|
1123
|
+
return await t.insertInto("refresh_tokens_2").values({
|
|
1124
|
+
...r,
|
|
1125
1125
|
tenant_id: e,
|
|
1126
|
-
rotating:
|
|
1127
|
-
device: JSON.stringify(
|
|
1128
|
-
resource_servers: JSON.stringify(
|
|
1129
|
-
}).execute(), { ...
|
|
1126
|
+
rotating: a.rotating ? 1 : 0,
|
|
1127
|
+
device: JSON.stringify(a.device),
|
|
1128
|
+
resource_servers: JSON.stringify(a.resource_servers)
|
|
1129
|
+
}).execute(), { ...a, ...r };
|
|
1130
1130
|
};
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return async (e,
|
|
1132
|
+
function va(t) {
|
|
1133
|
+
return async (e, a) => !!(await t.deleteFrom("refresh_tokens_2").where("tenant_id", "=", e).where("refresh_tokens_2.id", "=", a).execute()).length;
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1136
|
-
return async (e,
|
|
1135
|
+
function Ca(t) {
|
|
1136
|
+
return async (e, a, r) => {
|
|
1137
1137
|
const o = {
|
|
1138
|
-
...
|
|
1139
|
-
device:
|
|
1140
|
-
resource_servers:
|
|
1141
|
-
rotating:
|
|
1138
|
+
...r,
|
|
1139
|
+
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
1140
|
+
resource_servers: r.resource_servers ? JSON.stringify(r.resource_servers) : void 0,
|
|
1141
|
+
rotating: r.rotating ? 1 : 0
|
|
1142
1142
|
};
|
|
1143
|
-
return !!(await t.updateTable("
|
|
1143
|
+
return !!(await t.updateTable("refresh_tokens_2").set(o).where("tenant_id", "=", e).where("refresh_tokens_2.id", "=", a).execute()).length;
|
|
1144
1144
|
};
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return async (e,
|
|
1146
|
+
function ba(t) {
|
|
1147
|
+
return async (e, a = {
|
|
1148
1148
|
page: 0,
|
|
1149
1149
|
per_page: 50,
|
|
1150
1150
|
include_totals: !1
|
|
1151
1151
|
}) => {
|
|
1152
|
-
let
|
|
1153
|
-
|
|
1154
|
-
let o =
|
|
1155
|
-
if (
|
|
1152
|
+
let r = t.selectFrom("refresh_tokens_2").where("refresh_tokens_2.tenant_id", "=", e);
|
|
1153
|
+
a.q && (r = T(t, r, a.q, ["token", "session_id"]));
|
|
1154
|
+
let o = r;
|
|
1155
|
+
if (a.sort && a.sort.sort_by) {
|
|
1156
1156
|
const { ref: l } = t.dynamic;
|
|
1157
1157
|
o = o.orderBy(
|
|
1158
|
-
l(
|
|
1159
|
-
|
|
1158
|
+
l(a.sort.sort_by),
|
|
1159
|
+
a.sort.sort_order
|
|
1160
1160
|
);
|
|
1161
1161
|
}
|
|
1162
|
-
o = o.offset(
|
|
1163
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
1162
|
+
o = o.offset(a.page * a.per_page).limit(a.per_page);
|
|
1163
|
+
const n = await o.selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), c = b(s);
|
|
1164
1164
|
return {
|
|
1165
1165
|
refresh_tokens: n.map((l) => ({
|
|
1166
1166
|
...l,
|
|
@@ -1168,22 +1168,22 @@ function Cr(t) {
|
|
|
1168
1168
|
device: l.device ? JSON.parse(l.device) : {},
|
|
1169
1169
|
resource_servers: l.resource_servers ? JSON.parse(l.resource_servers) : []
|
|
1170
1170
|
})),
|
|
1171
|
-
start:
|
|
1172
|
-
limit:
|
|
1171
|
+
start: a.page * a.per_page,
|
|
1172
|
+
limit: a.per_page,
|
|
1173
1173
|
length: c
|
|
1174
1174
|
};
|
|
1175
1175
|
};
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function xa(t) {
|
|
1178
1178
|
return {
|
|
1179
|
-
create:
|
|
1180
|
-
get:
|
|
1181
|
-
list:
|
|
1182
|
-
remove:
|
|
1183
|
-
update:
|
|
1179
|
+
create: Na(t),
|
|
1180
|
+
get: wa(t),
|
|
1181
|
+
list: ba(t),
|
|
1182
|
+
remove: va(t),
|
|
1183
|
+
update: Ca(t)
|
|
1184
1184
|
};
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function Ta(t) {
|
|
1187
1187
|
return t[t.length - 1];
|
|
1188
1188
|
}
|
|
1189
1189
|
function p(t) {
|
|
@@ -1216,7 +1216,7 @@ const z = p({
|
|
|
1216
1216
|
identifier: z.create(e)
|
|
1217
1217
|
});
|
|
1218
1218
|
}
|
|
1219
|
-
}),
|
|
1219
|
+
}), Sa = p({
|
|
1220
1220
|
is(t) {
|
|
1221
1221
|
return t.kind === "AliasNode";
|
|
1222
1222
|
},
|
|
@@ -1245,7 +1245,7 @@ const z = p({
|
|
|
1245
1245
|
}
|
|
1246
1246
|
});
|
|
1247
1247
|
var R;
|
|
1248
|
-
class
|
|
1248
|
+
class Oa {
|
|
1249
1249
|
constructor() {
|
|
1250
1250
|
j(this, "nodeStack", []);
|
|
1251
1251
|
y(this, R, p({
|
|
@@ -1348,14 +1348,14 @@ class Or {
|
|
|
1348
1348
|
if (!e)
|
|
1349
1349
|
return e;
|
|
1350
1350
|
this.nodeStack.push(e);
|
|
1351
|
-
const
|
|
1352
|
-
return this.nodeStack.pop(), p(
|
|
1351
|
+
const a = this.transformNodeImpl(e);
|
|
1352
|
+
return this.nodeStack.pop(), p(a);
|
|
1353
1353
|
}
|
|
1354
1354
|
transformNodeImpl(e) {
|
|
1355
1355
|
return d(this, R)[e.kind](e);
|
|
1356
1356
|
}
|
|
1357
1357
|
transformNodeList(e) {
|
|
1358
|
-
return e && p(e.map((
|
|
1358
|
+
return e && p(e.map((a) => this.transformNode(a)));
|
|
1359
1359
|
}
|
|
1360
1360
|
transformSelectQuery(e) {
|
|
1361
1361
|
return {
|
|
@@ -2079,7 +2079,7 @@ class Or {
|
|
|
2079
2079
|
}
|
|
2080
2080
|
}
|
|
2081
2081
|
R = new WeakMap();
|
|
2082
|
-
const
|
|
2082
|
+
const ka = p({
|
|
2083
2083
|
AlterTableNode: !0,
|
|
2084
2084
|
CreateIndexNode: !0,
|
|
2085
2085
|
CreateSchemaNode: !0,
|
|
@@ -2098,78 +2098,78 @@ const kr = p({
|
|
|
2098
2098
|
UpdateQueryNode: !0,
|
|
2099
2099
|
MergeQueryNode: !0
|
|
2100
2100
|
});
|
|
2101
|
-
var P, S, O,
|
|
2102
|
-
class $
|
|
2103
|
-
constructor(
|
|
2101
|
+
var P, S, O, f, ge, ye, we, $, W, Ne;
|
|
2102
|
+
class $a extends Oa {
|
|
2103
|
+
constructor(a) {
|
|
2104
2104
|
super();
|
|
2105
|
-
y(this,
|
|
2105
|
+
y(this, f);
|
|
2106
2106
|
y(this, P);
|
|
2107
2107
|
y(this, S, /* @__PURE__ */ new Set());
|
|
2108
2108
|
y(this, O, /* @__PURE__ */ new Set());
|
|
2109
|
-
M(this, P,
|
|
2109
|
+
M(this, P, a);
|
|
2110
2110
|
}
|
|
2111
|
-
transformNodeImpl(
|
|
2112
|
-
if (!u(this,
|
|
2113
|
-
return super.transformNodeImpl(
|
|
2114
|
-
const
|
|
2115
|
-
for (const s of
|
|
2111
|
+
transformNodeImpl(a) {
|
|
2112
|
+
if (!u(this, f, ge).call(this, a))
|
|
2113
|
+
return super.transformNodeImpl(a);
|
|
2114
|
+
const r = u(this, f, we).call(this, a);
|
|
2115
|
+
for (const s of r)
|
|
2116
2116
|
d(this, O).add(s);
|
|
2117
|
-
const o = u(this,
|
|
2117
|
+
const o = u(this, f, ye).call(this, a);
|
|
2118
2118
|
for (const s of o)
|
|
2119
2119
|
d(this, S).add(s);
|
|
2120
|
-
const n = super.transformNodeImpl(
|
|
2120
|
+
const n = super.transformNodeImpl(a);
|
|
2121
2121
|
for (const s of o)
|
|
2122
2122
|
d(this, S).delete(s);
|
|
2123
|
-
for (const s of
|
|
2123
|
+
for (const s of r)
|
|
2124
2124
|
d(this, O).delete(s);
|
|
2125
2125
|
return n;
|
|
2126
2126
|
}
|
|
2127
|
-
transformSchemableIdentifier(
|
|
2128
|
-
const
|
|
2129
|
-
return
|
|
2130
|
-
...
|
|
2127
|
+
transformSchemableIdentifier(a) {
|
|
2128
|
+
const r = super.transformSchemableIdentifier(a);
|
|
2129
|
+
return r.schema || !d(this, S).has(a.identifier.name) ? r : {
|
|
2130
|
+
...r,
|
|
2131
2131
|
schema: z.create(d(this, P))
|
|
2132
2132
|
};
|
|
2133
2133
|
}
|
|
2134
|
-
transformReferences(
|
|
2135
|
-
const
|
|
2136
|
-
return
|
|
2137
|
-
...
|
|
2138
|
-
table: U.createWithSchema(d(this, P),
|
|
2139
|
-
};
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
P = new WeakMap(), S = new WeakMap(), O = new WeakMap(),
|
|
2143
|
-
return
|
|
2144
|
-
}, ye = function(
|
|
2145
|
-
const
|
|
2146
|
-
if ("name" in
|
|
2147
|
-
for (const o of
|
|
2148
|
-
u(this,
|
|
2149
|
-
if ("into" in
|
|
2150
|
-
for (const o of
|
|
2151
|
-
u(this,
|
|
2152
|
-
return "using" in
|
|
2153
|
-
}, we = function(
|
|
2154
|
-
const
|
|
2155
|
-
return "with" in
|
|
2156
|
-
}, $ = function(
|
|
2157
|
-
const o = U.is(
|
|
2158
|
-
o && u(this,
|
|
2159
|
-
}, W = function(
|
|
2160
|
-
const o =
|
|
2161
|
-
!d(this, S).has(o) && !d(this, O).has(o) &&
|
|
2162
|
-
}, Ne = function(
|
|
2163
|
-
for (const o of
|
|
2134
|
+
transformReferences(a) {
|
|
2135
|
+
const r = super.transformReferences(a);
|
|
2136
|
+
return r.table.table.schema ? r : {
|
|
2137
|
+
...r,
|
|
2138
|
+
table: U.createWithSchema(d(this, P), r.table.table.identifier.name)
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
P = new WeakMap(), S = new WeakMap(), O = new WeakMap(), f = new WeakSet(), ge = function(a) {
|
|
2143
|
+
return a.kind in ka;
|
|
2144
|
+
}, ye = function(a) {
|
|
2145
|
+
const r = /* @__PURE__ */ new Set();
|
|
2146
|
+
if ("name" in a && a.name && q.is(a.name) && u(this, f, W).call(this, a.name, r), "from" in a && a.from)
|
|
2147
|
+
for (const o of a.from.froms)
|
|
2148
|
+
u(this, f, $).call(this, o, r);
|
|
2149
|
+
if ("into" in a && a.into && u(this, f, $).call(this, a.into, r), "table" in a && a.table && u(this, f, $).call(this, a.table, r), "joins" in a && a.joins)
|
|
2150
|
+
for (const o of a.joins)
|
|
2151
|
+
u(this, f, $).call(this, o.table, r);
|
|
2152
|
+
return "using" in a && a.using && u(this, f, $).call(this, a.using, r), r;
|
|
2153
|
+
}, we = function(a) {
|
|
2154
|
+
const r = /* @__PURE__ */ new Set();
|
|
2155
|
+
return "with" in a && a.with && u(this, f, Ne).call(this, a.with, r), r;
|
|
2156
|
+
}, $ = function(a, r) {
|
|
2157
|
+
const o = U.is(a) ? a : Sa.is(a) && U.is(a.node) ? a.node : null;
|
|
2158
|
+
o && u(this, f, W).call(this, o.table, r);
|
|
2159
|
+
}, W = function(a, r) {
|
|
2160
|
+
const o = a.identifier.name;
|
|
2161
|
+
!d(this, S).has(o) && !d(this, O).has(o) && r.add(o);
|
|
2162
|
+
}, Ne = function(a, r) {
|
|
2163
|
+
for (const o of a.expressions) {
|
|
2164
2164
|
const n = o.name.table.table.identifier.name;
|
|
2165
|
-
d(this, O).has(n) ||
|
|
2165
|
+
d(this, O).has(n) || r.add(n);
|
|
2166
2166
|
}
|
|
2167
2167
|
};
|
|
2168
2168
|
var L;
|
|
2169
|
-
class
|
|
2169
|
+
class Da {
|
|
2170
2170
|
constructor(e) {
|
|
2171
2171
|
y(this, L);
|
|
2172
|
-
M(this, L, new $
|
|
2172
|
+
M(this, L, new $a(e));
|
|
2173
2173
|
}
|
|
2174
2174
|
transformQuery(e) {
|
|
2175
2175
|
return d(this, L).transformNode(e.node);
|
|
@@ -2179,7 +2179,7 @@ class Ir {
|
|
|
2179
2179
|
}
|
|
2180
2180
|
}
|
|
2181
2181
|
L = new WeakMap();
|
|
2182
|
-
class
|
|
2182
|
+
class Ia {
|
|
2183
2183
|
transformQuery(e) {
|
|
2184
2184
|
return e.node;
|
|
2185
2185
|
}
|
|
@@ -2187,8 +2187,8 @@ class Dr {
|
|
|
2187
2187
|
return e.result;
|
|
2188
2188
|
}
|
|
2189
2189
|
}
|
|
2190
|
-
const
|
|
2191
|
-
var h, i, A, N, v,
|
|
2190
|
+
const Pa = "kysely_migration", _e = "kysely_migration_lock", ja = !1, B = "migration_lock", Ma = p({ __noMigrations__: !0 });
|
|
2191
|
+
var h, i, A, N, v, D, Ce, C, be, xe, Te, Se, Oe, G, I, H, ke, $e, De, X, Ie, Pe, je, Me, Ae, F;
|
|
2192
2192
|
class ve {
|
|
2193
2193
|
constructor(e) {
|
|
2194
2194
|
y(this, i);
|
|
@@ -2201,11 +2201,11 @@ class ve {
|
|
|
2201
2201
|
* The returned array is sorted by migration name.
|
|
2202
2202
|
*/
|
|
2203
2203
|
async getMigrations() {
|
|
2204
|
-
const e = await u(this, i,
|
|
2205
|
-
return (await u(this, i, X).call(this)).map(({ name:
|
|
2206
|
-
const n = e.find((s) => s.name ===
|
|
2204
|
+
const e = await u(this, i, I).call(this, d(this, i, v)) ? await d(this, h).db.withPlugin(d(this, i, C)).selectFrom(d(this, i, v)).select(["name", "timestamp"]).execute() : [];
|
|
2205
|
+
return (await u(this, i, X).call(this)).map(({ name: r, ...o }) => {
|
|
2206
|
+
const n = e.find((s) => s.name === r);
|
|
2207
2207
|
return {
|
|
2208
|
-
name:
|
|
2208
|
+
name: r,
|
|
2209
2209
|
migration: o,
|
|
2210
2210
|
executedAt: n ? new Date(n.timestamp) : void 0
|
|
2211
2211
|
};
|
|
@@ -2285,16 +2285,16 @@ class ve {
|
|
|
2285
2285
|
* ```
|
|
2286
2286
|
*/
|
|
2287
2287
|
async migrateTo(e) {
|
|
2288
|
-
return u(this, i, A).call(this, ({ migrations:
|
|
2289
|
-
if (e ===
|
|
2288
|
+
return u(this, i, A).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: o }) => {
|
|
2289
|
+
if (e === Ma)
|
|
2290
2290
|
return { direction: "Down", step: 1 / 0 };
|
|
2291
|
-
if (!
|
|
2291
|
+
if (!a.find((c) => c.name === e))
|
|
2292
2292
|
throw new Error(`migration "${e}" doesn't exist`);
|
|
2293
|
-
const n =
|
|
2293
|
+
const n = r.indexOf(e), s = o.findIndex((c) => c.name === e);
|
|
2294
2294
|
if (n !== -1)
|
|
2295
2295
|
return {
|
|
2296
2296
|
direction: "Down",
|
|
2297
|
-
step:
|
|
2297
|
+
step: r.length - n - 1
|
|
2298
2298
|
};
|
|
2299
2299
|
if (s !== -1)
|
|
2300
2300
|
return { direction: "Up", step: s + 1 };
|
|
@@ -2338,21 +2338,21 @@ class ve {
|
|
|
2338
2338
|
}
|
|
2339
2339
|
h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
2340
2340
|
try {
|
|
2341
|
-
return await u(this, i,
|
|
2342
|
-
} catch (
|
|
2343
|
-
return
|
|
2341
|
+
return await u(this, i, be).call(this), await u(this, i, ke).call(this, e);
|
|
2342
|
+
} catch (a) {
|
|
2343
|
+
return a instanceof Q ? a.resultSet : { error: a };
|
|
2344
2344
|
}
|
|
2345
2345
|
}, N = function() {
|
|
2346
2346
|
return d(this, h).migrationTableSchema;
|
|
2347
2347
|
}, v = function() {
|
|
2348
|
-
return d(this, h).migrationTableName ??
|
|
2349
|
-
},
|
|
2350
|
-
return d(this, h).migrationLockTableName ??
|
|
2351
|
-
},
|
|
2352
|
-
return d(this, h).allowUnorderedMigrations ??
|
|
2353
|
-
},
|
|
2354
|
-
return d(this, i, N) ? new
|
|
2355
|
-
},
|
|
2348
|
+
return d(this, h).migrationTableName ?? Pa;
|
|
2349
|
+
}, D = function() {
|
|
2350
|
+
return d(this, h).migrationLockTableName ?? _e;
|
|
2351
|
+
}, Ce = function() {
|
|
2352
|
+
return d(this, h).allowUnorderedMigrations ?? ja;
|
|
2353
|
+
}, C = function() {
|
|
2354
|
+
return d(this, i, N) ? new Da(d(this, i, N)) : new Ia();
|
|
2355
|
+
}, be = async function() {
|
|
2356
2356
|
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);
|
|
2357
2357
|
}, xe = async function() {
|
|
2358
2358
|
if (d(this, i, N) && !await u(this, i, G).call(this))
|
|
@@ -2363,86 +2363,86 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2363
2363
|
throw e;
|
|
2364
2364
|
}
|
|
2365
2365
|
}, Te = async function() {
|
|
2366
|
-
if (!await u(this, i,
|
|
2366
|
+
if (!await u(this, i, I).call(this, d(this, i, v)))
|
|
2367
2367
|
try {
|
|
2368
|
-
d(this, i, N) && await u(this, i, F).call(this, d(this, h).db.schema.createSchema(d(this, i, N))), await u(this, i, F).call(this, d(this, h).db.schema.withPlugin(d(this, i,
|
|
2368
|
+
d(this, i, N) && await u(this, i, F).call(this, d(this, h).db.schema.createSchema(d(this, i, N))), await u(this, i, F).call(this, d(this, h).db.schema.withPlugin(d(this, i, C)).createTable(d(this, i, v)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
|
|
2369
2369
|
} catch (e) {
|
|
2370
|
-
if (!await u(this, i,
|
|
2370
|
+
if (!await u(this, i, I).call(this, d(this, i, v)))
|
|
2371
2371
|
throw e;
|
|
2372
2372
|
}
|
|
2373
2373
|
}, Se = async function() {
|
|
2374
|
-
if (!await u(this, i,
|
|
2374
|
+
if (!await u(this, i, I).call(this, d(this, i, D)))
|
|
2375
2375
|
try {
|
|
2376
|
-
await u(this, i, F).call(this, d(this, h).db.schema.withPlugin(d(this, i,
|
|
2376
|
+
await u(this, i, F).call(this, d(this, h).db.schema.withPlugin(d(this, i, C)).createTable(d(this, i, D)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
|
|
2377
2377
|
} catch (e) {
|
|
2378
|
-
if (!await u(this, i,
|
|
2378
|
+
if (!await u(this, i, I).call(this, d(this, i, D)))
|
|
2379
2379
|
throw e;
|
|
2380
2380
|
}
|
|
2381
2381
|
}, Oe = async function() {
|
|
2382
2382
|
if (!await u(this, i, H).call(this))
|
|
2383
2383
|
try {
|
|
2384
|
-
await d(this, h).db.withPlugin(d(this, i,
|
|
2384
|
+
await d(this, h).db.withPlugin(d(this, i, C)).insertInto(d(this, i, D)).values({ id: B, is_locked: 0 }).execute();
|
|
2385
2385
|
} catch (e) {
|
|
2386
2386
|
if (!await u(this, i, H).call(this))
|
|
2387
2387
|
throw e;
|
|
2388
2388
|
}
|
|
2389
2389
|
}, G = async function() {
|
|
2390
|
-
return (await d(this, h).db.introspection.getSchemas()).some((
|
|
2391
|
-
},
|
|
2392
|
-
const
|
|
2390
|
+
return (await d(this, h).db.introspection.getSchemas()).some((a) => a.name === d(this, i, N));
|
|
2391
|
+
}, I = async function(e) {
|
|
2392
|
+
const a = d(this, i, N);
|
|
2393
2393
|
return (await d(this, h).db.introspection.getTables({
|
|
2394
2394
|
withInternalKyselyTables: !0
|
|
2395
|
-
})).some((o) => o.name === e && (!
|
|
2395
|
+
})).some((o) => o.name === e && (!a || o.schema === a));
|
|
2396
2396
|
}, H = async function() {
|
|
2397
|
-
return !!await d(this, h).db.withPlugin(d(this, i,
|
|
2397
|
+
return !!await d(this, h).db.withPlugin(d(this, i, C)).selectFrom(d(this, i, D)).where("id", "=", B).select("id").executeTakeFirst();
|
|
2398
2398
|
}, ke = async function(e) {
|
|
2399
|
-
const
|
|
2400
|
-
lockTable: d(this, h).migrationLockTableName ??
|
|
2399
|
+
const a = d(this, h).db.getExecutor().adapter, r = p({
|
|
2400
|
+
lockTable: d(this, h).migrationLockTableName ?? _e,
|
|
2401
2401
|
lockRowId: B,
|
|
2402
2402
|
lockTableSchema: d(this, h).migrationTableSchema
|
|
2403
2403
|
}), o = async (n) => {
|
|
2404
2404
|
try {
|
|
2405
|
-
await
|
|
2405
|
+
await a.acquireMigrationLock(n, r);
|
|
2406
2406
|
const s = await u(this, i, $e).call(this, n);
|
|
2407
2407
|
if (s.migrations.length === 0)
|
|
2408
2408
|
return { results: [] };
|
|
2409
2409
|
const { direction: c, step: l } = e(s);
|
|
2410
2410
|
return l <= 0 ? { results: [] } : c === "Down" ? await u(this, i, Me).call(this, n, s, l) : c === "Up" ? await u(this, i, Ae).call(this, n, s, l) : { results: [] };
|
|
2411
2411
|
} finally {
|
|
2412
|
-
await
|
|
2412
|
+
await a.releaseMigrationLock(n, r);
|
|
2413
2413
|
}
|
|
2414
2414
|
};
|
|
2415
|
-
return
|
|
2415
|
+
return a.supportsTransactionalDdl ? d(this, h).db.transaction().execute(o) : d(this, h).db.connection().execute(o);
|
|
2416
2416
|
}, $e = async function(e) {
|
|
2417
|
-
const
|
|
2418
|
-
u(this, i, Pe).call(this,
|
|
2419
|
-
const o = u(this, i,
|
|
2417
|
+
const a = await u(this, i, X).call(this), r = await u(this, i, Ie).call(this, e);
|
|
2418
|
+
u(this, i, Pe).call(this, a, r), d(this, i, Ce) || u(this, i, je).call(this, a, r);
|
|
2419
|
+
const o = u(this, i, De).call(this, a, r);
|
|
2420
2420
|
return p({
|
|
2421
|
-
migrations:
|
|
2422
|
-
executedMigrations:
|
|
2423
|
-
lastMigration:
|
|
2421
|
+
migrations: a,
|
|
2422
|
+
executedMigrations: r,
|
|
2423
|
+
lastMigration: Ta(r),
|
|
2424
2424
|
pendingMigrations: o
|
|
2425
2425
|
});
|
|
2426
|
-
},
|
|
2427
|
-
return e.filter((
|
|
2426
|
+
}, De = function(e, a) {
|
|
2427
|
+
return e.filter((r) => !a.includes(r.name));
|
|
2428
2428
|
}, X = async function() {
|
|
2429
2429
|
const e = await d(this, h).provider.getMigrations();
|
|
2430
|
-
return Object.keys(e).sort().map((
|
|
2431
|
-
...e[
|
|
2432
|
-
name:
|
|
2430
|
+
return Object.keys(e).sort().map((a) => ({
|
|
2431
|
+
...e[a],
|
|
2432
|
+
name: a
|
|
2433
2433
|
}));
|
|
2434
|
-
},
|
|
2435
|
-
return (await e.withPlugin(d(this, i,
|
|
2436
|
-
}, Pe = function(e,
|
|
2437
|
-
for (const
|
|
2438
|
-
if (!e.some((o) => o.name ===
|
|
2439
|
-
throw new Error(`corrupted migrations: previously executed migration ${
|
|
2440
|
-
}, je = function(e,
|
|
2441
|
-
for (let
|
|
2442
|
-
if (e[
|
|
2443
|
-
throw new Error(`corrupted migrations: expected previously executed migration ${r
|
|
2444
|
-
}, Me = async function(e,
|
|
2445
|
-
const o =
|
|
2434
|
+
}, Ie = async function(e) {
|
|
2435
|
+
return (await e.withPlugin(d(this, i, C)).selectFrom(d(this, i, v)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
|
|
2436
|
+
}, Pe = function(e, a) {
|
|
2437
|
+
for (const r of a)
|
|
2438
|
+
if (!e.some((o) => o.name === r))
|
|
2439
|
+
throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
|
|
2440
|
+
}, je = function(e, a) {
|
|
2441
|
+
for (let r = 0; r < a.length; ++r)
|
|
2442
|
+
if (e[r].name !== a[r])
|
|
2443
|
+
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.`);
|
|
2444
|
+
}, Me = async function(e, a, r) {
|
|
2445
|
+
const o = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((c) => c.name === s)), n = o.map((s) => ({
|
|
2446
2446
|
migrationName: s.name,
|
|
2447
2447
|
direction: "Down",
|
|
2448
2448
|
status: "NotExecuted"
|
|
@@ -2450,7 +2450,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2450
2450
|
for (let s = 0; s < n.length; ++s) {
|
|
2451
2451
|
const c = o[s];
|
|
2452
2452
|
try {
|
|
2453
|
-
c.down && (await c.down(e), await e.withPlugin(d(this, i,
|
|
2453
|
+
c.down && (await c.down(e), await e.withPlugin(d(this, i, C)).deleteFrom(d(this, i, v)).where("name", "=", c.name).execute(), n[s] = {
|
|
2454
2454
|
migrationName: c.name,
|
|
2455
2455
|
direction: "Down",
|
|
2456
2456
|
status: "Success"
|
|
@@ -2467,16 +2467,16 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
2469
|
return { results: n };
|
|
2470
|
-
}, Ae = async function(e,
|
|
2471
|
-
const n =
|
|
2470
|
+
}, Ae = async function(e, a, r) {
|
|
2471
|
+
const n = a.pendingMigrations.slice(0, r).map((s) => ({
|
|
2472
2472
|
migrationName: s.name,
|
|
2473
2473
|
direction: "Up",
|
|
2474
2474
|
status: "NotExecuted"
|
|
2475
2475
|
}));
|
|
2476
2476
|
for (let s = 0; s < n.length; s++) {
|
|
2477
|
-
const c =
|
|
2477
|
+
const c = a.pendingMigrations[s];
|
|
2478
2478
|
try {
|
|
2479
|
-
await c.up(e), await e.withPlugin(d(this, i,
|
|
2479
|
+
await c.up(e), await e.withPlugin(d(this, i, C)).insertInto(d(this, i, v)).values({
|
|
2480
2480
|
name: c.name,
|
|
2481
2481
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2482
2482
|
}).execute(), n[s] = {
|
|
@@ -2501,10 +2501,10 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
|
|
|
2501
2501
|
};
|
|
2502
2502
|
var E;
|
|
2503
2503
|
class Q extends Error {
|
|
2504
|
-
constructor(
|
|
2504
|
+
constructor(a) {
|
|
2505
2505
|
super();
|
|
2506
2506
|
y(this, E);
|
|
2507
|
-
M(this, E,
|
|
2507
|
+
M(this, E, a);
|
|
2508
2508
|
}
|
|
2509
2509
|
get resultSet() {
|
|
2510
2510
|
return d(this, E);
|
|
@@ -2520,7 +2520,7 @@ class Fe {
|
|
|
2520
2520
|
return this.migrations;
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
|
-
async function
|
|
2523
|
+
async function Aa(t) {
|
|
2524
2524
|
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(
|
|
2525
2525
|
"tenant_id",
|
|
2526
2526
|
"varchar(255)",
|
|
@@ -2588,35 +2588,35 @@ async function Ar(t) {
|
|
|
2588
2588
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
2589
2589
|
).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();
|
|
2590
2590
|
}
|
|
2591
|
-
async function
|
|
2591
|
+
async function Fa(t) {
|
|
2592
2592
|
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();
|
|
2593
2593
|
}
|
|
2594
|
-
const
|
|
2594
|
+
const La = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2595
2595
|
__proto__: null,
|
|
2596
|
-
down:
|
|
2597
|
-
up:
|
|
2596
|
+
down: Fa,
|
|
2597
|
+
up: Aa
|
|
2598
2598
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2599
|
-
async function
|
|
2599
|
+
async function Ea(t) {
|
|
2600
2600
|
await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
|
|
2601
2601
|
}
|
|
2602
|
-
async function
|
|
2602
|
+
async function Ja(t) {
|
|
2603
2603
|
await t.schema.alterTable("tenants").dropColumn("support_url").execute();
|
|
2604
2604
|
}
|
|
2605
|
-
const
|
|
2605
|
+
const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2606
2606
|
__proto__: null,
|
|
2607
|
-
down:
|
|
2608
|
-
up:
|
|
2607
|
+
down: Ja,
|
|
2608
|
+
up: Ea
|
|
2609
2609
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2610
|
-
async function
|
|
2610
|
+
async function Ra(t) {
|
|
2611
2611
|
}
|
|
2612
|
-
async function
|
|
2612
|
+
async function Ka(t) {
|
|
2613
2613
|
}
|
|
2614
|
-
const
|
|
2614
|
+
const Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2615
2615
|
__proto__: null,
|
|
2616
|
-
down:
|
|
2617
|
-
up:
|
|
2616
|
+
down: Ka,
|
|
2617
|
+
up: Ra
|
|
2618
2618
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2619
|
-
async function
|
|
2619
|
+
async function Ba(t) {
|
|
2620
2620
|
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(
|
|
2621
2621
|
"tenant_id_constraint",
|
|
2622
2622
|
["tenant_id"],
|
|
@@ -2625,24 +2625,24 @@ async function Br(t) {
|
|
|
2625
2625
|
(e) => e.onDelete("cascade")
|
|
2626
2626
|
).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();
|
|
2627
2627
|
}
|
|
2628
|
-
async function
|
|
2628
|
+
async function Qa(t) {
|
|
2629
2629
|
await t.schema.dropTable("logs").execute();
|
|
2630
2630
|
}
|
|
2631
|
-
const
|
|
2631
|
+
const Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2632
2632
|
__proto__: null,
|
|
2633
|
-
down:
|
|
2634
|
-
up:
|
|
2633
|
+
down: Qa,
|
|
2634
|
+
up: Ba
|
|
2635
2635
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2636
|
-
async function
|
|
2636
|
+
async function qa(t) {
|
|
2637
2637
|
}
|
|
2638
|
-
async function
|
|
2638
|
+
async function Wa(t) {
|
|
2639
2639
|
}
|
|
2640
|
-
const
|
|
2640
|
+
const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2641
2641
|
__proto__: null,
|
|
2642
|
-
down:
|
|
2643
|
-
up:
|
|
2642
|
+
down: Wa,
|
|
2643
|
+
up: qa
|
|
2644
2644
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2645
|
-
async function
|
|
2645
|
+
async function Ha(t) {
|
|
2646
2646
|
await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
2647
2647
|
"user_id_constraint",
|
|
2648
2648
|
["user_id", "tenant_id"],
|
|
@@ -2667,15 +2667,15 @@ async function Hr(t) {
|
|
|
2667
2667
|
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
2668
2668
|
).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();
|
|
2669
2669
|
}
|
|
2670
|
-
async function
|
|
2670
|
+
async function Xa(t) {
|
|
2671
2671
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
|
|
2672
2672
|
}
|
|
2673
|
-
const
|
|
2673
|
+
const Ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2674
2674
|
__proto__: null,
|
|
2675
|
-
down:
|
|
2676
|
-
up:
|
|
2675
|
+
down: Xa,
|
|
2676
|
+
up: Ha
|
|
2677
2677
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2678
|
-
async function
|
|
2678
|
+
async function Za(t) {
|
|
2679
2679
|
await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
|
|
2680
2680
|
"user_id_constraint",
|
|
2681
2681
|
["user_id", "tenant_id"],
|
|
@@ -2690,24 +2690,24 @@ async function Zr(t) {
|
|
|
2690
2690
|
(e) => e.onDelete("cascade")
|
|
2691
2691
|
).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();
|
|
2692
2692
|
}
|
|
2693
|
-
async function
|
|
2693
|
+
async function er(t) {
|
|
2694
2694
|
await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
|
|
2695
2695
|
}
|
|
2696
|
-
const
|
|
2696
|
+
const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2697
2697
|
__proto__: null,
|
|
2698
|
-
down:
|
|
2699
|
-
up:
|
|
2698
|
+
down: er,
|
|
2699
|
+
up: Za
|
|
2700
2700
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2701
|
-
async function
|
|
2701
|
+
async function ar(t) {
|
|
2702
2702
|
}
|
|
2703
|
-
async function
|
|
2703
|
+
async function rr(t) {
|
|
2704
2704
|
}
|
|
2705
|
-
const
|
|
2705
|
+
const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2706
2706
|
__proto__: null,
|
|
2707
|
-
down:
|
|
2708
|
-
up:
|
|
2707
|
+
down: rr,
|
|
2708
|
+
up: ar
|
|
2709
2709
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2710
|
-
async function
|
|
2710
|
+
async function or(t) {
|
|
2711
2711
|
await t.schema.alterTable("passwords").addColumn(
|
|
2712
2712
|
"password",
|
|
2713
2713
|
"varchar(255)",
|
|
@@ -2715,172 +2715,172 @@ async function oa(t) {
|
|
|
2715
2715
|
(e) => e.notNull()
|
|
2716
2716
|
).execute();
|
|
2717
2717
|
}
|
|
2718
|
-
async function
|
|
2718
|
+
async function sr(t) {
|
|
2719
2719
|
await t.schema.alterTable("passwords").dropColumn("password").execute();
|
|
2720
2720
|
}
|
|
2721
|
-
const
|
|
2721
|
+
const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2722
2722
|
__proto__: null,
|
|
2723
|
-
down:
|
|
2724
|
-
up:
|
|
2723
|
+
down: sr,
|
|
2724
|
+
up: or
|
|
2725
2725
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2726
|
-
async function
|
|
2726
|
+
async function cr(t) {
|
|
2727
2727
|
}
|
|
2728
|
-
async function
|
|
2728
|
+
async function lr(t) {
|
|
2729
2729
|
}
|
|
2730
|
-
const
|
|
2730
|
+
const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2731
2731
|
__proto__: null,
|
|
2732
|
-
down:
|
|
2733
|
-
up:
|
|
2732
|
+
down: lr,
|
|
2733
|
+
up: cr
|
|
2734
2734
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2735
|
-
async function
|
|
2735
|
+
async function ur(t) {
|
|
2736
2736
|
}
|
|
2737
|
-
async function
|
|
2737
|
+
async function mr(t) {
|
|
2738
2738
|
}
|
|
2739
|
-
const
|
|
2739
|
+
const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2740
2740
|
__proto__: null,
|
|
2741
|
-
down:
|
|
2742
|
-
up:
|
|
2741
|
+
down: mr,
|
|
2742
|
+
up: ur
|
|
2743
2743
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2744
|
-
async function
|
|
2744
|
+
async function _r(t) {
|
|
2745
2745
|
}
|
|
2746
|
-
async function
|
|
2746
|
+
async function fr(t) {
|
|
2747
2747
|
}
|
|
2748
|
-
const
|
|
2748
|
+
const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2749
2749
|
__proto__: null,
|
|
2750
|
-
down:
|
|
2751
|
-
up:
|
|
2750
|
+
down: fr,
|
|
2751
|
+
up: _r
|
|
2752
2752
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2753
|
-
async function
|
|
2753
|
+
async function gr(t) {
|
|
2754
2754
|
await t.schema.createIndex("users_email_index").on("users").column("email").execute();
|
|
2755
2755
|
}
|
|
2756
|
-
async function
|
|
2756
|
+
async function yr(t) {
|
|
2757
2757
|
await t.schema.dropIndex("users_email_index").execute();
|
|
2758
2758
|
}
|
|
2759
|
-
const
|
|
2759
|
+
const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2760
2760
|
__proto__: null,
|
|
2761
|
-
down:
|
|
2762
|
-
up:
|
|
2761
|
+
down: yr,
|
|
2762
|
+
up: gr
|
|
2763
2763
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2764
|
-
async function
|
|
2764
|
+
async function Nr(t) {
|
|
2765
2765
|
await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
|
|
2766
2766
|
}
|
|
2767
|
-
async function
|
|
2767
|
+
async function vr(t) {
|
|
2768
2768
|
await t.schema.alterTable("users").dropColumn("profileData").execute();
|
|
2769
2769
|
}
|
|
2770
|
-
const
|
|
2770
|
+
const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2771
2771
|
__proto__: null,
|
|
2772
|
-
down:
|
|
2773
|
-
up:
|
|
2772
|
+
down: vr,
|
|
2773
|
+
up: Nr
|
|
2774
2774
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2775
|
-
async function
|
|
2775
|
+
async function br(t) {
|
|
2776
2776
|
await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
|
|
2777
2777
|
}
|
|
2778
|
-
async function
|
|
2778
|
+
async function xr(t) {
|
|
2779
2779
|
await t.schema.dropIndex("users_linked_to_index");
|
|
2780
2780
|
}
|
|
2781
|
-
const
|
|
2781
|
+
const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2782
2782
|
__proto__: null,
|
|
2783
|
-
down:
|
|
2784
|
-
up:
|
|
2783
|
+
down: xr,
|
|
2784
|
+
up: br
|
|
2785
2785
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2786
|
-
async function
|
|
2786
|
+
async function Sr(t) {
|
|
2787
2787
|
await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
|
|
2788
2788
|
}
|
|
2789
|
-
async function
|
|
2789
|
+
async function Or(t) {
|
|
2790
2790
|
await t.schema.alterTable("users").dropColumn("locale").execute();
|
|
2791
2791
|
}
|
|
2792
|
-
const
|
|
2792
|
+
const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2793
2793
|
__proto__: null,
|
|
2794
|
-
down:
|
|
2795
|
-
up:
|
|
2794
|
+
down: Or,
|
|
2795
|
+
up: Sr
|
|
2796
2796
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2797
|
-
async function $
|
|
2797
|
+
async function $r(t) {
|
|
2798
2798
|
await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
2799
2799
|
"tenant_id",
|
|
2800
2800
|
"varchar(255)",
|
|
2801
2801
|
(e) => e.references("tenants.id").onDelete("cascade")
|
|
2802
2802
|
).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();
|
|
2803
2803
|
}
|
|
2804
|
-
async function
|
|
2804
|
+
async function Dr(t) {
|
|
2805
2805
|
await t.schema.dropTable("keys").execute();
|
|
2806
2806
|
}
|
|
2807
|
-
const
|
|
2807
|
+
const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2808
2808
|
__proto__: null,
|
|
2809
|
-
down:
|
|
2810
|
-
up: $
|
|
2809
|
+
down: Dr,
|
|
2810
|
+
up: $r
|
|
2811
2811
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2812
|
-
async function
|
|
2812
|
+
async function Pr(t) {
|
|
2813
2813
|
}
|
|
2814
|
-
async function
|
|
2814
|
+
async function jr(t) {
|
|
2815
2815
|
}
|
|
2816
|
-
const
|
|
2816
|
+
const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2817
2817
|
__proto__: null,
|
|
2818
|
-
down:
|
|
2819
|
-
up:
|
|
2818
|
+
down: jr,
|
|
2819
|
+
up: Pr
|
|
2820
2820
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2821
|
-
async function
|
|
2821
|
+
async function Ar(t) {
|
|
2822
2822
|
}
|
|
2823
|
-
async function
|
|
2823
|
+
async function Fr(t) {
|
|
2824
2824
|
}
|
|
2825
|
-
const
|
|
2825
|
+
const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2826
2826
|
__proto__: null,
|
|
2827
|
-
down:
|
|
2828
|
-
up:
|
|
2827
|
+
down: Fr,
|
|
2828
|
+
up: Ar
|
|
2829
2829
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2830
|
-
async function
|
|
2830
|
+
async function Er(t) {
|
|
2831
2831
|
await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
|
|
2832
2832
|
}
|
|
2833
|
-
async function
|
|
2833
|
+
async function Jr(t) {
|
|
2834
2834
|
await t.schema.alterTable("otps").dropColumn("audience").execute();
|
|
2835
2835
|
}
|
|
2836
|
-
const
|
|
2836
|
+
const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2837
2837
|
__proto__: null,
|
|
2838
|
-
down:
|
|
2839
|
-
up:
|
|
2838
|
+
down: Jr,
|
|
2839
|
+
up: Er
|
|
2840
2840
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2841
|
-
async function
|
|
2841
|
+
async function Rr(t) {
|
|
2842
2842
|
}
|
|
2843
|
-
async function
|
|
2843
|
+
async function Kr(t) {
|
|
2844
2844
|
}
|
|
2845
|
-
const
|
|
2845
|
+
const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2846
2846
|
__proto__: null,
|
|
2847
|
-
down:
|
|
2848
|
-
up:
|
|
2847
|
+
down: Kr,
|
|
2848
|
+
up: Rr
|
|
2849
2849
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2850
|
-
async function
|
|
2850
|
+
async function Br(t) {
|
|
2851
2851
|
await t.schema.alterTable("logs").dropColumn("category").execute();
|
|
2852
2852
|
}
|
|
2853
|
-
async function
|
|
2853
|
+
async function Qr(t) {
|
|
2854
2854
|
await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
|
|
2855
2855
|
}
|
|
2856
|
-
const
|
|
2856
|
+
const Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2857
2857
|
__proto__: null,
|
|
2858
|
-
down:
|
|
2859
|
-
up:
|
|
2858
|
+
down: Qr,
|
|
2859
|
+
up: Br
|
|
2860
2860
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2861
|
-
async function
|
|
2861
|
+
async function qr(t) {
|
|
2862
2862
|
await t.schema.alterTable("users").dropColumn("tags").execute();
|
|
2863
2863
|
}
|
|
2864
|
-
async function
|
|
2864
|
+
async function Wr(t) {
|
|
2865
2865
|
await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
|
|
2866
2866
|
}
|
|
2867
|
-
const
|
|
2867
|
+
const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2868
2868
|
__proto__: null,
|
|
2869
|
-
down:
|
|
2870
|
-
up:
|
|
2869
|
+
down: Wr,
|
|
2870
|
+
up: qr
|
|
2871
2871
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2872
|
-
async function
|
|
2872
|
+
async function Hr(t) {
|
|
2873
2873
|
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();
|
|
2874
2874
|
}
|
|
2875
|
-
async function
|
|
2875
|
+
async function Xr(t) {
|
|
2876
2876
|
await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
|
|
2877
2877
|
}
|
|
2878
|
-
const
|
|
2878
|
+
const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2879
2879
|
__proto__: null,
|
|
2880
|
-
down:
|
|
2881
|
-
up:
|
|
2880
|
+
down: Xr,
|
|
2881
|
+
up: Hr
|
|
2882
2882
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2883
|
-
async function
|
|
2883
|
+
async function Zr(t) {
|
|
2884
2884
|
await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
|
|
2885
2885
|
}
|
|
2886
2886
|
async function en(t) {
|
|
@@ -2889,18 +2889,18 @@ async function en(t) {
|
|
|
2889
2889
|
const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2890
2890
|
__proto__: null,
|
|
2891
2891
|
down: en,
|
|
2892
|
-
up:
|
|
2892
|
+
up: Zr
|
|
2893
2893
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2894
|
-
async function
|
|
2894
|
+
async function an(t) {
|
|
2895
2895
|
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();
|
|
2896
2896
|
}
|
|
2897
|
-
async function
|
|
2897
|
+
async function rn(t) {
|
|
2898
2898
|
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();
|
|
2899
2899
|
}
|
|
2900
2900
|
const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2901
2901
|
__proto__: null,
|
|
2902
|
-
down:
|
|
2903
|
-
up:
|
|
2902
|
+
down: rn,
|
|
2903
|
+
up: an
|
|
2904
2904
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2905
2905
|
async function on(t) {
|
|
2906
2906
|
await t.schema.createIndex("users_name_index").on("users").column("name").execute();
|
|
@@ -2929,12 +2929,12 @@ async function mn(t) {
|
|
|
2929
2929
|
async function hn(t) {
|
|
2930
2930
|
await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
|
|
2931
2931
|
}
|
|
2932
|
-
const
|
|
2932
|
+
const _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2933
2933
|
__proto__: null,
|
|
2934
2934
|
down: hn,
|
|
2935
2935
|
up: mn
|
|
2936
2936
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2937
|
-
async function
|
|
2937
|
+
async function fn(t) {
|
|
2938
2938
|
await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
|
|
2939
2939
|
}
|
|
2940
2940
|
async function pn(t) {
|
|
@@ -2943,7 +2943,7 @@ async function pn(t) {
|
|
|
2943
2943
|
const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2944
2944
|
__proto__: null,
|
|
2945
2945
|
down: pn,
|
|
2946
|
-
up:
|
|
2946
|
+
up: fn
|
|
2947
2947
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2948
2948
|
async function yn(t) {
|
|
2949
2949
|
await t.schema.createTable("branding").addColumn(
|
|
@@ -2962,11 +2962,11 @@ const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2962
2962
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2963
2963
|
async function vn(t) {
|
|
2964
2964
|
}
|
|
2965
|
-
async function
|
|
2965
|
+
async function Cn(t) {
|
|
2966
2966
|
}
|
|
2967
|
-
const
|
|
2967
|
+
const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2968
2968
|
__proto__: null,
|
|
2969
|
-
down:
|
|
2969
|
+
down: Cn,
|
|
2970
2970
|
up: vn
|
|
2971
2971
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2972
2972
|
async function xn(t) {
|
|
@@ -2987,14 +2987,14 @@ const $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2987
2987
|
down: kn,
|
|
2988
2988
|
up: On
|
|
2989
2989
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2990
|
-
async function In(t) {
|
|
2991
|
-
}
|
|
2992
2990
|
async function Dn(t) {
|
|
2993
2991
|
}
|
|
2992
|
+
async function In(t) {
|
|
2993
|
+
}
|
|
2994
2994
|
const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2995
2995
|
__proto__: null,
|
|
2996
|
-
down:
|
|
2997
|
-
up:
|
|
2996
|
+
down: In,
|
|
2997
|
+
up: Dn
|
|
2998
2998
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2999
2999
|
async function jn(t) {
|
|
3000
3000
|
await t.schema.createTable("authentication_codes").addColumn(
|
|
@@ -3087,12 +3087,12 @@ async function eo(t) {
|
|
|
3087
3087
|
}
|
|
3088
3088
|
async function to(t) {
|
|
3089
3089
|
}
|
|
3090
|
-
const
|
|
3090
|
+
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3091
3091
|
__proto__: null,
|
|
3092
3092
|
down: to,
|
|
3093
3093
|
up: eo
|
|
3094
3094
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3095
|
-
async function
|
|
3095
|
+
async function ro(t) {
|
|
3096
3096
|
await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3097
3097
|
"tenant_id",
|
|
3098
3098
|
"varchar(255)",
|
|
@@ -3121,7 +3121,7 @@ async function no(t) {
|
|
|
3121
3121
|
const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3122
3122
|
__proto__: null,
|
|
3123
3123
|
down: no,
|
|
3124
|
-
up:
|
|
3124
|
+
up: ro
|
|
3125
3125
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3126
3126
|
async function so(t) {
|
|
3127
3127
|
}
|
|
@@ -3146,12 +3146,12 @@ const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3146
3146
|
async function ho(t) {
|
|
3147
3147
|
await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
|
|
3148
3148
|
}
|
|
3149
|
-
async function
|
|
3149
|
+
async function _o(t) {
|
|
3150
3150
|
await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
|
|
3151
3151
|
}
|
|
3152
|
-
const
|
|
3152
|
+
const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3153
3153
|
__proto__: null,
|
|
3154
|
-
down:
|
|
3154
|
+
down: _o,
|
|
3155
3155
|
up: ho
|
|
3156
3156
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3157
3157
|
async function po(t) {
|
|
@@ -3172,16 +3172,16 @@ const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3172
3172
|
down: No,
|
|
3173
3173
|
up: wo
|
|
3174
3174
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3175
|
-
async function
|
|
3175
|
+
async function Co(t) {
|
|
3176
3176
|
await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
|
|
3177
3177
|
}
|
|
3178
|
-
async function
|
|
3178
|
+
async function bo(t) {
|
|
3179
3179
|
await t.schema.alterTable("logins").dropColumn("nonce").execute();
|
|
3180
3180
|
}
|
|
3181
3181
|
const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3182
3182
|
__proto__: null,
|
|
3183
|
-
down:
|
|
3184
|
-
up:
|
|
3183
|
+
down: bo,
|
|
3184
|
+
up: Co
|
|
3185
3185
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3186
3186
|
async function To(t) {
|
|
3187
3187
|
}
|
|
@@ -3196,12 +3196,12 @@ async function ko(t) {
|
|
|
3196
3196
|
}
|
|
3197
3197
|
async function $o(t) {
|
|
3198
3198
|
}
|
|
3199
|
-
const
|
|
3199
|
+
const Do = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3200
3200
|
__proto__: null,
|
|
3201
3201
|
down: $o,
|
|
3202
3202
|
up: ko
|
|
3203
3203
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3204
|
-
async function
|
|
3204
|
+
async function Io(t) {
|
|
3205
3205
|
await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
|
|
3206
3206
|
"tenant_id",
|
|
3207
3207
|
"varchar(255)",
|
|
@@ -3233,7 +3233,7 @@ async function Po(t) {
|
|
|
3233
3233
|
const jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3234
3234
|
__proto__: null,
|
|
3235
3235
|
down: Po,
|
|
3236
|
-
up:
|
|
3236
|
+
up: Io
|
|
3237
3237
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3238
3238
|
async function Mo(t) {
|
|
3239
3239
|
await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
|
|
@@ -3339,12 +3339,12 @@ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3339
3339
|
async function ts(t) {
|
|
3340
3340
|
await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
|
|
3341
3341
|
}
|
|
3342
|
-
async function
|
|
3342
|
+
async function as(t) {
|
|
3343
3343
|
await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
|
|
3344
3344
|
}
|
|
3345
|
-
const
|
|
3345
|
+
const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3346
3346
|
__proto__: null,
|
|
3347
|
-
down:
|
|
3347
|
+
down: as,
|
|
3348
3348
|
up: ts
|
|
3349
3349
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3350
3350
|
async function ns(t) {
|
|
@@ -3381,12 +3381,12 @@ const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3381
3381
|
async function hs(t) {
|
|
3382
3382
|
await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
|
|
3383
3383
|
}
|
|
3384
|
-
async function
|
|
3384
|
+
async function _s(t) {
|
|
3385
3385
|
await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
|
|
3386
3386
|
}
|
|
3387
|
-
const
|
|
3387
|
+
const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3388
3388
|
__proto__: null,
|
|
3389
|
-
down:
|
|
3389
|
+
down: _s,
|
|
3390
3390
|
up: hs
|
|
3391
3391
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3392
3392
|
async function ps(t) {
|
|
@@ -3427,15 +3427,15 @@ const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3427
3427
|
down: Ns,
|
|
3428
3428
|
up: ws
|
|
3429
3429
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3430
|
-
async function bs(t) {
|
|
3431
|
-
}
|
|
3432
3430
|
async function Cs(t) {
|
|
3431
|
+
}
|
|
3432
|
+
async function bs(t) {
|
|
3433
3433
|
await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
|
|
3434
3434
|
}
|
|
3435
3435
|
const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3436
3436
|
__proto__: null,
|
|
3437
|
-
down:
|
|
3438
|
-
up:
|
|
3437
|
+
down: bs,
|
|
3438
|
+
up: Cs
|
|
3439
3439
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3440
3440
|
async function Ts(t) {
|
|
3441
3441
|
await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
|
|
@@ -3462,52 +3462,70 @@ async function ks(t) {
|
|
|
3462
3462
|
}
|
|
3463
3463
|
async function $s(t) {
|
|
3464
3464
|
}
|
|
3465
|
-
const
|
|
3465
|
+
const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3466
3466
|
__proto__: null,
|
|
3467
3467
|
down: $s,
|
|
3468
3468
|
up: ks
|
|
3469
3469
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3470
|
-
async function
|
|
3470
|
+
async function Is(t) {
|
|
3471
|
+
await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
3472
|
+
"user_id_constraint",
|
|
3473
|
+
["user_id", "tenant_id"],
|
|
3474
|
+
"users",
|
|
3475
|
+
["user_id", "tenant_id"],
|
|
3476
|
+
(e) => e.onDelete("cascade")
|
|
3477
|
+
).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("authenticated_at", "varchar(35)").addColumn("last_interaction_at", "varchar(35)").addColumn("used_at", "varchar(35)").addColumn("revoked_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("clients", "varchar(1024)", (e) => e.notNull()).execute(), await t.schema.createTable("refresh_tokens_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
|
|
3478
|
+
"client_id",
|
|
3479
|
+
"varchar(21)",
|
|
3480
|
+
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
3481
|
+
).addColumn("tenant_id", "varchar(255)").addColumn("session_id", "varchar(21)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
3482
|
+
"user_id_constraint",
|
|
3483
|
+
["user_id", "tenant_id"],
|
|
3484
|
+
"users",
|
|
3485
|
+
["user_id", "tenant_id"],
|
|
3486
|
+
(e) => e.onDelete("cascade")
|
|
3487
|
+
).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
|
|
3471
3488
|
}
|
|
3472
3489
|
async function Ps(t) {
|
|
3490
|
+
await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
|
|
3473
3491
|
}
|
|
3474
3492
|
const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3475
3493
|
__proto__: null,
|
|
3476
3494
|
down: Ps,
|
|
3477
|
-
up:
|
|
3495
|
+
up: Is
|
|
3478
3496
|
}, Symbol.toStringTag, { value: "Module" })), Le = {
|
|
3479
|
-
m1_init:
|
|
3480
|
-
m2_magicLink:
|
|
3481
|
-
m3_updateAt:
|
|
3482
|
-
m4_logTable:
|
|
3483
|
-
m5_userProfile:
|
|
3484
|
-
m6_sessions:
|
|
3485
|
-
m7_passwords:
|
|
3486
|
-
m8_logsTableNewFields:
|
|
3487
|
-
m9_passwordTableNewField:
|
|
3488
|
-
n01_codesTable:
|
|
3489
|
-
n11_universalLoginSession:
|
|
3490
|
-
n12_userFields:
|
|
3491
|
-
n13_userEmailIndex:
|
|
3492
|
-
n14_profileDataField:
|
|
3493
|
-
n15_userEmailIndex:
|
|
3494
|
-
n16_userLocale:
|
|
3495
|
-
n17_signingKeys:
|
|
3496
|
-
n18_logsFields:
|
|
3497
|
-
n19_connectionsUserinfo:
|
|
3498
|
-
n20_missingFields:
|
|
3499
|
-
n21_sessionDeletedAt:
|
|
3500
|
-
n22_dropLogsFields:
|
|
3501
|
-
n23_dropUsersFields:
|
|
3502
|
-
n24_logsIndexes:
|
|
3497
|
+
m1_init: La,
|
|
3498
|
+
m2_magicLink: za,
|
|
3499
|
+
m3_updateAt: Ua,
|
|
3500
|
+
m4_logTable: Va,
|
|
3501
|
+
m5_userProfile: Ga,
|
|
3502
|
+
m6_sessions: Ya,
|
|
3503
|
+
m7_passwords: tr,
|
|
3504
|
+
m8_logsTableNewFields: nr,
|
|
3505
|
+
m9_passwordTableNewField: ir,
|
|
3506
|
+
n01_codesTable: dr,
|
|
3507
|
+
n11_universalLoginSession: hr,
|
|
3508
|
+
n12_userFields: pr,
|
|
3509
|
+
n13_userEmailIndex: wr,
|
|
3510
|
+
n14_profileDataField: Cr,
|
|
3511
|
+
n15_userEmailIndex: Tr,
|
|
3512
|
+
n16_userLocale: kr,
|
|
3513
|
+
n17_signingKeys: Ir,
|
|
3514
|
+
n18_logsFields: Mr,
|
|
3515
|
+
n19_connectionsUserinfo: Lr,
|
|
3516
|
+
n20_missingFields: zr,
|
|
3517
|
+
n21_sessionDeletedAt: Ur,
|
|
3518
|
+
n22_dropLogsFields: Vr,
|
|
3519
|
+
n23_dropUsersFields: Gr,
|
|
3520
|
+
n24_logsIndexes: Yr,
|
|
3503
3521
|
n25_logDescMaxLength: tn,
|
|
3504
3522
|
n26_logsTableExtraFields: nn,
|
|
3505
3523
|
n27_usersTableNameIndex: cn,
|
|
3506
3524
|
n28_usersEmailConstrain: un,
|
|
3507
|
-
n29_increaseOtpStateLength:
|
|
3525
|
+
n29_increaseOtpStateLength: _n,
|
|
3508
3526
|
n30_increaseTicketStateLength: gn,
|
|
3509
3527
|
n31_branding: Nn,
|
|
3510
|
-
n32_indexesAndNotNull:
|
|
3528
|
+
n32_indexesAndNotNull: bn,
|
|
3511
3529
|
n33_vendorIdInUniversalLoginSession: Sn,
|
|
3512
3530
|
n34_auth0ClientInUniversalLoginSession: $n,
|
|
3513
3531
|
n35_increaseUniversalSessionStateLength: Pn,
|
|
@@ -3518,16 +3536,16 @@ const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3518
3536
|
n40_userId: qn,
|
|
3519
3537
|
n41_hooks: Hn,
|
|
3520
3538
|
n42_userIdIndexes: Zn,
|
|
3521
|
-
n43_userIdIndexes:
|
|
3539
|
+
n43_userIdIndexes: ao,
|
|
3522
3540
|
n44_codes: oo,
|
|
3523
3541
|
n45_hookProperties: co,
|
|
3524
3542
|
n46_loginAuth0Client: mo,
|
|
3525
|
-
n47_loginAuth0Client:
|
|
3543
|
+
n47_loginAuth0Client: fo,
|
|
3526
3544
|
n48_saml: yo,
|
|
3527
3545
|
n49_removeFields: vo,
|
|
3528
3546
|
n50_authParamsNonce: xo,
|
|
3529
3547
|
n51_connectionid: Oo,
|
|
3530
|
-
n52_cert:
|
|
3548
|
+
n52_cert: Do,
|
|
3531
3549
|
n53_codes_primary_key: jo,
|
|
3532
3550
|
n54_cleanup_tables: Fo,
|
|
3533
3551
|
n55_logs_index: Jo,
|
|
@@ -3536,24 +3554,24 @@ const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3536
3554
|
n58_connection_client_id: Wo,
|
|
3537
3555
|
n59_connection_options: Xo,
|
|
3538
3556
|
n60_users_metadata: es,
|
|
3539
|
-
n61_userLocales:
|
|
3557
|
+
n61_userLocales: rs,
|
|
3540
3558
|
n62_prompt: ss,
|
|
3541
3559
|
n63_connection_cleanup: ls,
|
|
3542
3560
|
n64_act_as: ms,
|
|
3543
|
-
n65_code_verifier:
|
|
3561
|
+
n65_code_verifier: fs,
|
|
3544
3562
|
n66_email_providers: ys,
|
|
3545
3563
|
n67_drop_tickets: vs,
|
|
3546
3564
|
n68_login_useragents: xs,
|
|
3547
3565
|
n70_refresh_tokens: Os,
|
|
3548
|
-
n71_session_new_fields:
|
|
3566
|
+
n71_session_new_fields: Ds,
|
|
3549
3567
|
n72_session_primary_key: js
|
|
3550
3568
|
};
|
|
3551
3569
|
async function Es(t, e = !1) {
|
|
3552
3570
|
e && console.log("migrating...");
|
|
3553
|
-
const
|
|
3571
|
+
const a = new Fe(Le), r = new ve({
|
|
3554
3572
|
db: t,
|
|
3555
|
-
provider:
|
|
3556
|
-
}), { error: o, results: n } = await
|
|
3573
|
+
provider: a
|
|
3574
|
+
}), { error: o, results: n } = await r.migrateToLatest();
|
|
3557
3575
|
if (n == null || n.forEach((s) => {
|
|
3558
3576
|
s.status === "Success" ? e && console.log(
|
|
3559
3577
|
`migration "${s.migrationName}" was executed successfully`
|
|
@@ -3563,34 +3581,34 @@ async function Es(t, e = !1) {
|
|
|
3563
3581
|
}
|
|
3564
3582
|
async function Js(t) {
|
|
3565
3583
|
console.log("migrating...");
|
|
3566
|
-
const e = new Fe(Le),
|
|
3584
|
+
const e = new Fe(Le), a = new ve({
|
|
3567
3585
|
db: t,
|
|
3568
3586
|
provider: e
|
|
3569
|
-
}), { error:
|
|
3587
|
+
}), { error: r, results: o } = await a.migrateDown();
|
|
3570
3588
|
if (o == null || o.forEach((n) => {
|
|
3571
3589
|
n.status === "Success" ? console.log(`migration "${n.migrationName}" was reverted successfully`) : n.status === "Error" && console.error(`failed to execute migration "${n.migrationName}"`);
|
|
3572
|
-
}),
|
|
3573
|
-
throw console.error("failed to migrate"), console.error(
|
|
3590
|
+
}), r)
|
|
3591
|
+
throw console.error("failed to migrate"), console.error(r), r;
|
|
3574
3592
|
}
|
|
3575
3593
|
function zs(t) {
|
|
3576
3594
|
return {
|
|
3577
|
-
applications:
|
|
3595
|
+
applications: It(t),
|
|
3578
3596
|
branding: Wt(t),
|
|
3579
3597
|
clients: Et(t),
|
|
3580
3598
|
codes: Tt(t),
|
|
3581
3599
|
connections: Lt(t),
|
|
3582
|
-
emailProviders:
|
|
3600
|
+
emailProviders: ya(t),
|
|
3583
3601
|
domains: Qt(t),
|
|
3584
|
-
hooks:
|
|
3602
|
+
hooks: ea(t),
|
|
3585
3603
|
keys: Kt(t),
|
|
3586
|
-
logins:
|
|
3604
|
+
logins: ua(t),
|
|
3587
3605
|
logs: lt(t),
|
|
3588
3606
|
passwords: wt(t),
|
|
3589
|
-
promptSettings:
|
|
3590
|
-
refreshTokens:
|
|
3591
|
-
sessions:
|
|
3607
|
+
promptSettings: _a(t),
|
|
3608
|
+
refreshTokens: xa(t),
|
|
3609
|
+
sessions: ft(t),
|
|
3592
3610
|
tenants: nt(t),
|
|
3593
|
-
themes:
|
|
3611
|
+
themes: sa(t),
|
|
3594
3612
|
users: Xe(t)
|
|
3595
3613
|
};
|
|
3596
3614
|
}
|