@authhero/kysely-adapter 10.37.1 → 10.38.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 +302 -0
- package/dist/kysely-adapter.mjs +1438 -1338
- package/package.json +3 -3
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ee = Object.defineProperty;
|
|
2
2
|
var ue = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var Re = (t, e,
|
|
6
|
-
var R = (t, e,
|
|
7
|
-
var d = (t, e,
|
|
5
|
+
var Re = (t, e, a) => e in t ? Ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
6
|
+
var R = (t, e, a) => Re(t, typeof e != "symbol" ? e + "" : e, a), X = (t, e, a) => e.has(t) || ue("Cannot " + a);
|
|
7
|
+
var d = (t, e, a) => (X(t, e, "read from private field"), a ? a.call(t) : e.get(t)), O = (t, e, a) => e.has(t) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), K = (t, e, a, r) => (X(t, e, "write to private field"), r ? r.call(t, a) : e.set(t, a), a), p = (t, e, a) => (X(t, e, "access private method"), a);
|
|
8
8
|
import { parseUserId as ie, codeSchema as Ke, connectionSchema as Ue, loginSessionSchema as Be, promptSettingSchema as Qe, formSchema as G, resourceServerSchema as qe } from "@authhero/adapter-interfaces";
|
|
9
9
|
import "@hono/zod-openapi";
|
|
10
|
-
var
|
|
11
|
-
constructor(e = 500,
|
|
12
|
-
super(
|
|
10
|
+
var H = class extends Error {
|
|
11
|
+
constructor(e = 500, a) {
|
|
12
|
+
super(a == null ? void 0 : a.message, { cause: a == null ? void 0 : a.cause });
|
|
13
13
|
R(this, "res");
|
|
14
14
|
R(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,22 +24,22 @@ var te = class extends Error {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
function Ve(t) {
|
|
27
|
-
return async (e,
|
|
28
|
-
const { identities:
|
|
27
|
+
return async (e, a) => {
|
|
28
|
+
const { identities: r, ...n } = a, o = {
|
|
29
29
|
...n,
|
|
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(o).execute();
|
|
41
41
|
} catch (s) {
|
|
42
|
-
throw s.code === "SQLITE_CONSTRAINT_UNIQUE" || s.message.includes("AlreadyExists") ? new
|
|
42
|
+
throw s.code === "SQLITE_CONSTRAINT_UNIQUE" || s.message.includes("AlreadyExists") ? new H(409, { message: "User already exists" }) : new H(500, { message: `${s.code}, ${s.message}` });
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
45
|
...o,
|
|
@@ -55,17 +55,17 @@ function y(t) {
|
|
|
55
55
|
return t;
|
|
56
56
|
if (Array.isArray(t))
|
|
57
57
|
return t.map(
|
|
58
|
-
(
|
|
58
|
+
(a) => (
|
|
59
59
|
// Only recurse into objects; leave primitives untouched
|
|
60
|
-
|
|
60
|
+
a !== null && typeof a == "object" ? y(a) : a
|
|
61
61
|
)
|
|
62
62
|
);
|
|
63
63
|
const e = { ...t };
|
|
64
|
-
for (const
|
|
65
|
-
const
|
|
66
|
-
|
|
64
|
+
for (const a in e) {
|
|
65
|
+
const r = e[a];
|
|
66
|
+
r === null ? delete e[a] : r !== null && typeof r == "object" && (Array.isArray(r) ? e[a] = r.map(
|
|
67
67
|
(n) => n !== null && typeof n == "object" ? y(n) : n
|
|
68
|
-
) : e[
|
|
68
|
+
) : e[a] = y(r));
|
|
69
69
|
}
|
|
70
70
|
return e;
|
|
71
71
|
}
|
|
@@ -73,8 +73,8 @@ function pe(t) {
|
|
|
73
73
|
let e = {};
|
|
74
74
|
try {
|
|
75
75
|
e = JSON.parse(t.profileData || "{}");
|
|
76
|
-
} catch (
|
|
77
|
-
console.error("Error parsing profileData",
|
|
76
|
+
} catch (a) {
|
|
77
|
+
console.error("Error parsing profileData", a);
|
|
78
78
|
}
|
|
79
79
|
return {
|
|
80
80
|
connection: t.connection,
|
|
@@ -89,26 +89,26 @@ function pe(t) {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
function We(t) {
|
|
92
|
-
return async (e,
|
|
93
|
-
const [
|
|
94
|
-
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=",
|
|
95
|
-
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=",
|
|
92
|
+
return async (e, a) => {
|
|
93
|
+
const [r, n] = await Promise.all([
|
|
94
|
+
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).selectAll().executeTakeFirst(),
|
|
95
|
+
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", a).selectAll().execute()
|
|
96
96
|
]);
|
|
97
|
-
if (!
|
|
97
|
+
if (!r)
|
|
98
98
|
return null;
|
|
99
|
-
const { tenant_id: o, ...s } =
|
|
99
|
+
const { tenant_id: o, ...s } = r, i = {
|
|
100
100
|
...s,
|
|
101
|
-
email:
|
|
102
|
-
email_verified:
|
|
103
|
-
is_social:
|
|
104
|
-
app_metadata: JSON.parse(
|
|
105
|
-
user_metadata: JSON.parse(
|
|
101
|
+
email: r.email || "",
|
|
102
|
+
email_verified: r.email_verified === 1,
|
|
103
|
+
is_social: r.is_social === 1,
|
|
104
|
+
app_metadata: JSON.parse(r.app_metadata),
|
|
105
|
+
user_metadata: JSON.parse(r.user_metadata),
|
|
106
106
|
identities: [
|
|
107
107
|
{
|
|
108
|
-
connection:
|
|
109
|
-
provider:
|
|
110
|
-
user_id: ie(
|
|
111
|
-
isSocial: !!
|
|
108
|
+
connection: r.connection,
|
|
109
|
+
provider: r.provider,
|
|
110
|
+
user_id: ie(r.user_id).id,
|
|
111
|
+
isSocial: !!r.is_social
|
|
112
112
|
},
|
|
113
113
|
...n.map(pe)
|
|
114
114
|
]
|
|
@@ -116,25 +116,25 @@ function We(t) {
|
|
|
116
116
|
return y(i);
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
-
function T(t, e,
|
|
120
|
-
return
|
|
121
|
-
let s = o.startsWith("-"), i = null, c = "",
|
|
119
|
+
function T(t, e, a, r) {
|
|
120
|
+
return a.split(/\s+/).map((o) => o.replace(/^([^:]+)=/g, "$1:")).map((o) => {
|
|
121
|
+
let s = o.startsWith("-"), i = null, c = "", u = !1, m;
|
|
122
122
|
if (o.startsWith("-_exists_:"))
|
|
123
|
-
i = o.substring(10),
|
|
123
|
+
i = o.substring(10), u = !0, s = !0;
|
|
124
124
|
else if (o.startsWith("_exists_:"))
|
|
125
|
-
i = o.substring(9),
|
|
125
|
+
i = o.substring(9), u = !0, s = !1;
|
|
126
126
|
else if (o.includes(":")) {
|
|
127
|
-
const
|
|
128
|
-
i =
|
|
127
|
+
const _ = s ? o.substring(1) : o, h = _.indexOf(":");
|
|
128
|
+
i = _.substring(0, h), c = _.substring(h + 1), u = !1, c.startsWith(">=") ? (m = ">=", c = c.substring(2)) : c.startsWith(">") ? (m = ">", c = c.substring(1)) : c.startsWith("<=") ? (m = "<=", c = c.substring(2)) : c.startsWith("<") ? (m = "<", c = c.substring(1)) : m = "=";
|
|
129
129
|
} else
|
|
130
|
-
i = null, c = o,
|
|
131
|
-
return { key: i, value: c, isNegation: s, isExistsQuery:
|
|
132
|
-
}).forEach(({ key: o, value: s, isNegation: i, isExistsQuery: c, operator:
|
|
130
|
+
i = null, c = o, u = !1;
|
|
131
|
+
return { key: i, value: c, isNegation: s, isExistsQuery: u, operator: m };
|
|
132
|
+
}).forEach(({ key: o, value: s, isNegation: i, isExistsQuery: c, operator: u }) => {
|
|
133
133
|
if (o)
|
|
134
134
|
if (c)
|
|
135
135
|
i ? e = e.where(o, "is", null) : e = e.where(o, "is not", null);
|
|
136
136
|
else if (i)
|
|
137
|
-
switch (
|
|
137
|
+
switch (u) {
|
|
138
138
|
case ">":
|
|
139
139
|
e = e.where(o, "<=", s);
|
|
140
140
|
break;
|
|
@@ -151,12 +151,12 @@ function T(t, e, r, a) {
|
|
|
151
151
|
e = e.where(o, "!=", s);
|
|
152
152
|
}
|
|
153
153
|
else
|
|
154
|
-
e = e.where(o,
|
|
154
|
+
e = e.where(o, u, s);
|
|
155
155
|
else if (s) {
|
|
156
|
-
const { ref:
|
|
156
|
+
const { ref: m } = t.dynamic;
|
|
157
157
|
e = e.where(
|
|
158
|
-
(
|
|
159
|
-
|
|
158
|
+
(_) => _.or(
|
|
159
|
+
r.map((h) => _(m(h), "like", `%${s}%`))
|
|
160
160
|
)
|
|
161
161
|
);
|
|
162
162
|
}
|
|
@@ -166,14 +166,14 @@ function x(t) {
|
|
|
166
166
|
return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
|
|
167
167
|
}
|
|
168
168
|
function Ge(t) {
|
|
169
|
-
return async (e,
|
|
170
|
-
const { page:
|
|
169
|
+
return async (e, a = {}) => {
|
|
170
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
|
|
171
171
|
let c = t.selectFrom("users").where("users.tenant_id", "=", e);
|
|
172
172
|
if (i && (c = T(t, c, i, ["email", "name"])), s && s.sort_by) {
|
|
173
173
|
const { ref: w } = t.dynamic;
|
|
174
174
|
c = c.orderBy(w(s.sort_by), s.sort_order);
|
|
175
175
|
}
|
|
176
|
-
const
|
|
176
|
+
const m = await c.offset(r * n).limit(n).selectAll().execute(), _ = m.map((w) => w.user_id), h = _.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", _).execute() : [], f = m.map((w) => {
|
|
177
177
|
const b = h.filter(
|
|
178
178
|
(D) => D.linked_to === w.user_id
|
|
179
179
|
);
|
|
@@ -204,56 +204,56 @@ function Ge(t) {
|
|
|
204
204
|
const { count: g } = await c.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
205
205
|
return {
|
|
206
206
|
users: f,
|
|
207
|
-
start:
|
|
207
|
+
start: r * n,
|
|
208
208
|
limit: n,
|
|
209
209
|
length: x(g)
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
213
|
function He(t) {
|
|
214
|
-
return async (e,
|
|
214
|
+
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);
|
|
215
215
|
}
|
|
216
|
-
function
|
|
217
|
-
for (let
|
|
218
|
-
if (Object.prototype.hasOwnProperty.call(t,
|
|
219
|
-
const n = e ? `${e}_${
|
|
220
|
-
typeof o == "object" && o !== null && !Array.isArray(o) ?
|
|
216
|
+
function E(t, e = "", a = {}) {
|
|
217
|
+
for (let r in t)
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(t, r)) {
|
|
219
|
+
const n = e ? `${e}_${r}` : r, o = t[r];
|
|
220
|
+
typeof o == "object" && o !== null && !Array.isArray(o) ? E(o, n, a) : typeof o == "boolean" ? a[n] = o ? 1 : 0 : a[n] = o;
|
|
221
221
|
}
|
|
222
|
-
return
|
|
222
|
+
return a;
|
|
223
223
|
}
|
|
224
224
|
function ge(t, e) {
|
|
225
|
-
const
|
|
226
|
-
for (const [
|
|
225
|
+
const a = {};
|
|
226
|
+
for (const [r, n] of Object.entries(t)) {
|
|
227
227
|
const o = e.find(
|
|
228
|
-
(s) =>
|
|
228
|
+
(s) => r.startsWith(`${s}_`)
|
|
229
229
|
);
|
|
230
230
|
if (!o)
|
|
231
|
-
r
|
|
231
|
+
a[r] = n;
|
|
232
232
|
else {
|
|
233
|
-
const s =
|
|
234
|
-
|
|
235
|
-
...
|
|
233
|
+
const s = r.slice(o.length + 1);
|
|
234
|
+
a[o] = {
|
|
235
|
+
...a[o],
|
|
236
236
|
[s]: n
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
return
|
|
240
|
+
return a;
|
|
241
241
|
}
|
|
242
242
|
function Ye(t) {
|
|
243
|
-
return async (e,
|
|
244
|
-
const n =
|
|
245
|
-
...
|
|
243
|
+
return async (e, a, r) => {
|
|
244
|
+
const n = E({
|
|
245
|
+
...r,
|
|
246
246
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
247
|
-
app_metadata:
|
|
248
|
-
user_metadata:
|
|
247
|
+
app_metadata: r.app_metadata ? JSON.stringify(r.app_metadata) : void 0,
|
|
248
|
+
user_metadata: r.user_metadata ? JSON.stringify(r.user_metadata) : void 0
|
|
249
249
|
});
|
|
250
|
-
return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=",
|
|
250
|
+
return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1;
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
253
|
function Xe(t) {
|
|
254
|
-
return async (e,
|
|
254
|
+
return async (e, a, r, n) => {
|
|
255
255
|
const o = { linked_to: null };
|
|
256
|
-
return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", `${
|
|
256
|
+
return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", `${r}|${n}`).where("users.linked_to", "=", `${a}`).execute()).length === 1;
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
function Ze(t) {
|
|
@@ -268,60 +268,60 @@ function Ze(t) {
|
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
const et = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
271
|
-
let
|
|
272
|
-
let e = "",
|
|
271
|
+
let S = (t = 21) => {
|
|
272
|
+
let e = "", a = crypto.getRandomValues(new Uint8Array(t));
|
|
273
273
|
for (; t--; )
|
|
274
|
-
e += et[
|
|
274
|
+
e += et[a[t] & 63];
|
|
275
275
|
return e;
|
|
276
276
|
};
|
|
277
277
|
function tt(t) {
|
|
278
278
|
return async (e) => {
|
|
279
|
-
const
|
|
280
|
-
id: e.id ||
|
|
279
|
+
const a = {
|
|
280
|
+
id: e.id || S(),
|
|
281
281
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
282
282
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
283
283
|
...e
|
|
284
284
|
};
|
|
285
|
-
return await t.insertInto("tenants").values(
|
|
285
|
+
return await t.insertInto("tenants").values(a).execute(), a;
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function at(t) {
|
|
289
289
|
return async (e) => {
|
|
290
|
-
const
|
|
291
|
-
return
|
|
290
|
+
const a = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
|
|
291
|
+
return a ? y(a) : null;
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function rt(t) {
|
|
295
295
|
return async (e) => {
|
|
296
|
-
let
|
|
297
|
-
const { page:
|
|
296
|
+
let a = t.selectFrom("tenants");
|
|
297
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = e;
|
|
298
298
|
if (s && s.sort_by) {
|
|
299
299
|
const { ref: f } = t.dynamic;
|
|
300
|
-
|
|
300
|
+
a = a.orderBy(f(s.sort_by), s.sort_order);
|
|
301
301
|
}
|
|
302
|
-
i && (
|
|
303
|
-
const
|
|
302
|
+
i && (a = a.where((f) => f.or([f("name", "like", `%${i}%`)])));
|
|
303
|
+
const m = (await a.offset(r * n).limit(n).selectAll().execute()).map(y);
|
|
304
304
|
if (!o)
|
|
305
305
|
return {
|
|
306
|
-
tenants:
|
|
306
|
+
tenants: m
|
|
307
307
|
};
|
|
308
|
-
const { count:
|
|
308
|
+
const { count: _ } = await a.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), h = x(_);
|
|
309
309
|
return {
|
|
310
|
-
tenants:
|
|
311
|
-
start:
|
|
310
|
+
tenants: m,
|
|
311
|
+
start: r * n,
|
|
312
312
|
limit: n,
|
|
313
313
|
length: h
|
|
314
314
|
};
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
function nt(t) {
|
|
318
|
-
return async (e,
|
|
319
|
-
const
|
|
320
|
-
...
|
|
318
|
+
return async (e, a) => {
|
|
319
|
+
const r = {
|
|
320
|
+
...a,
|
|
321
321
|
id: e,
|
|
322
322
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
323
323
|
};
|
|
324
|
-
await t.updateTable("tenants").set(
|
|
324
|
+
await t.updateTable("tenants").set(r).where("id", "=", e).execute();
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
327
|
function ot(t) {
|
|
@@ -330,8 +330,8 @@ function ot(t) {
|
|
|
330
330
|
function st(t) {
|
|
331
331
|
return {
|
|
332
332
|
create: tt(t),
|
|
333
|
-
get:
|
|
334
|
-
list:
|
|
333
|
+
get: at(t),
|
|
334
|
+
list: rt(t),
|
|
335
335
|
update: nt(t),
|
|
336
336
|
remove: ot(t)
|
|
337
337
|
};
|
|
@@ -341,23 +341,23 @@ function me(t) {
|
|
|
341
341
|
}
|
|
342
342
|
const it = 1024;
|
|
343
343
|
function lt(t) {
|
|
344
|
-
return async (e,
|
|
344
|
+
return async (e, a) => {
|
|
345
345
|
var n, o, s;
|
|
346
|
-
const
|
|
347
|
-
id:
|
|
348
|
-
...
|
|
349
|
-
user_agent:
|
|
346
|
+
const r = {
|
|
347
|
+
id: S(),
|
|
348
|
+
...a,
|
|
349
|
+
user_agent: a.user_agent.slice(0, it)
|
|
350
350
|
};
|
|
351
351
|
return await t.insertInto("logs").values({
|
|
352
|
-
...
|
|
352
|
+
...r,
|
|
353
353
|
// Truncate long strings to avoid database errors
|
|
354
|
-
description: (n =
|
|
355
|
-
isMobile:
|
|
354
|
+
description: (n = r.description) == null ? void 0 : n.substring(0, 256),
|
|
355
|
+
isMobile: a.isMobile ? 1 : 0,
|
|
356
356
|
tenant_id: e,
|
|
357
|
-
scope: (o =
|
|
358
|
-
auth0_client: me(
|
|
359
|
-
details: (s = me(
|
|
360
|
-
}).execute(),
|
|
357
|
+
scope: (o = a.scope) == null ? void 0 : o.join(","),
|
|
358
|
+
auth0_client: me(a.auth0_client),
|
|
359
|
+
details: (s = me(a.details)) == null ? void 0 : s.substring(0, 8192)
|
|
360
|
+
}).execute(), r;
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
363
|
function _e(t) {
|
|
@@ -383,37 +383,37 @@ function we(t) {
|
|
|
383
383
|
};
|
|
384
384
|
}
|
|
385
385
|
function ct(t) {
|
|
386
|
-
return async (e,
|
|
387
|
-
const { page:
|
|
386
|
+
return async (e, a = {}) => {
|
|
387
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
|
|
388
388
|
let c = t.selectFrom("logs").where("logs.tenant_id", "=", e);
|
|
389
389
|
i && (c = T(t, c, i, ["user_id", "ip"]));
|
|
390
|
-
let
|
|
390
|
+
let u = c;
|
|
391
391
|
if (s && s.sort_by) {
|
|
392
392
|
const { ref: f } = t.dynamic;
|
|
393
|
-
|
|
393
|
+
u = u.orderBy(f(s.sort_by), s.sort_order);
|
|
394
394
|
}
|
|
395
|
-
|
|
396
|
-
const
|
|
395
|
+
u = u.offset(r * n).limit(n);
|
|
396
|
+
const _ = (await u.selectAll().execute()).map(we);
|
|
397
397
|
if (!o)
|
|
398
398
|
return {
|
|
399
|
-
logs:
|
|
399
|
+
logs: _,
|
|
400
400
|
start: 0,
|
|
401
401
|
limit: 0,
|
|
402
402
|
length: 0
|
|
403
403
|
};
|
|
404
404
|
const { count: h } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
405
405
|
return {
|
|
406
|
-
logs:
|
|
407
|
-
start:
|
|
406
|
+
logs: _,
|
|
407
|
+
start: r * n,
|
|
408
408
|
limit: n,
|
|
409
409
|
length: x(h)
|
|
410
410
|
};
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
413
|
function dt(t) {
|
|
414
|
-
return async (e,
|
|
415
|
-
const
|
|
416
|
-
return
|
|
414
|
+
return async (e, a) => {
|
|
415
|
+
const r = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", a).selectAll().executeTakeFirst();
|
|
416
|
+
return r ? we(r) : null;
|
|
417
417
|
};
|
|
418
418
|
}
|
|
419
419
|
function ut(t) {
|
|
@@ -424,11 +424,11 @@ function ut(t) {
|
|
|
424
424
|
};
|
|
425
425
|
}
|
|
426
426
|
function mt(t) {
|
|
427
|
-
return async (e,
|
|
428
|
-
const
|
|
429
|
-
if (!
|
|
427
|
+
return async (e, a) => {
|
|
428
|
+
const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", a).selectAll().executeTakeFirst();
|
|
429
|
+
if (!r)
|
|
430
430
|
return null;
|
|
431
|
-
const { tenant_id: n, device: o, clients: s, ...i } =
|
|
431
|
+
const { tenant_id: n, device: o, clients: s, ...i } = r;
|
|
432
432
|
return {
|
|
433
433
|
...i,
|
|
434
434
|
device: JSON.parse(o),
|
|
@@ -437,63 +437,63 @@ function mt(t) {
|
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
439
|
function _t(t) {
|
|
440
|
-
return async (e,
|
|
441
|
-
const
|
|
442
|
-
...
|
|
440
|
+
return async (e, a) => {
|
|
441
|
+
const r = {
|
|
442
|
+
...a,
|
|
443
443
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
444
444
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
445
445
|
authenticated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
446
446
|
last_interaction_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
447
447
|
};
|
|
448
448
|
return await t.insertInto("sessions").values({
|
|
449
|
-
...
|
|
449
|
+
...r,
|
|
450
450
|
tenant_id: e,
|
|
451
|
-
device: JSON.stringify(
|
|
452
|
-
clients: JSON.stringify(
|
|
453
|
-
}).execute(),
|
|
451
|
+
device: JSON.stringify(a.device),
|
|
452
|
+
clients: JSON.stringify(a.clients)
|
|
453
|
+
}).execute(), r;
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
456
|
function ht(t) {
|
|
457
|
-
return async (e,
|
|
457
|
+
return async (e, a) => !!(await t.deleteFrom("sessions").where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
|
|
458
458
|
}
|
|
459
459
|
function ft(t) {
|
|
460
|
-
return async (e,
|
|
460
|
+
return async (e, a, r) => {
|
|
461
461
|
const n = {
|
|
462
|
-
...
|
|
462
|
+
...r,
|
|
463
463
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
464
|
-
device:
|
|
465
|
-
clients:
|
|
464
|
+
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
465
|
+
clients: r.clients ? JSON.stringify(r.clients) : void 0
|
|
466
466
|
};
|
|
467
|
-
return !!(await t.updateTable("sessions").set(n).where("tenant_id", "=", e).where("sessions.id", "=",
|
|
467
|
+
return !!(await t.updateTable("sessions").set(n).where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
470
|
function pt(t) {
|
|
471
|
-
return async (e,
|
|
472
|
-
const { page:
|
|
471
|
+
return async (e, a = {}) => {
|
|
472
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
|
|
473
473
|
let c = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
|
|
474
474
|
i && (c = T(t, c, i, ["user_id", "session_id"]));
|
|
475
|
-
let
|
|
475
|
+
let u = c;
|
|
476
476
|
if (s && s.sort_by) {
|
|
477
477
|
const { ref: g } = t.dynamic;
|
|
478
|
-
|
|
478
|
+
u = u.orderBy(g(s.sort_by), s.sort_order);
|
|
479
479
|
}
|
|
480
|
-
|
|
481
|
-
const
|
|
480
|
+
u = u.offset(r * n).limit(n);
|
|
481
|
+
const _ = (await u.selectAll().execute()).map((g) => ({
|
|
482
482
|
...g,
|
|
483
483
|
device: JSON.parse(g.device),
|
|
484
484
|
clients: JSON.parse(g.clients)
|
|
485
485
|
}));
|
|
486
486
|
if (!o)
|
|
487
487
|
return {
|
|
488
|
-
sessions:
|
|
488
|
+
sessions: _,
|
|
489
489
|
start: 0,
|
|
490
490
|
limit: 0,
|
|
491
491
|
length: 0
|
|
492
492
|
};
|
|
493
493
|
const { count: h } = await c.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = x(h);
|
|
494
494
|
return {
|
|
495
|
-
sessions:
|
|
496
|
-
start:
|
|
495
|
+
sessions: _,
|
|
496
|
+
start: r * n,
|
|
497
497
|
limit: n,
|
|
498
498
|
length: f
|
|
499
499
|
};
|
|
@@ -509,32 +509,32 @@ function gt(t) {
|
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
function wt(t) {
|
|
512
|
-
return async (e,
|
|
513
|
-
const
|
|
514
|
-
if (!
|
|
512
|
+
return async (e, a) => {
|
|
513
|
+
const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", a).selectAll().executeTakeFirst();
|
|
514
|
+
if (!r)
|
|
515
515
|
return null;
|
|
516
|
-
const { tenant_id: n, ...o } =
|
|
516
|
+
const { tenant_id: n, ...o } = r;
|
|
517
517
|
return o;
|
|
518
518
|
};
|
|
519
519
|
}
|
|
520
520
|
function yt(t) {
|
|
521
|
-
return async (e,
|
|
522
|
-
const
|
|
523
|
-
...
|
|
521
|
+
return async (e, a) => {
|
|
522
|
+
const r = {
|
|
523
|
+
...a,
|
|
524
524
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
525
525
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
526
526
|
};
|
|
527
527
|
return await t.insertInto("passwords").values({
|
|
528
|
-
...
|
|
528
|
+
...r,
|
|
529
529
|
tenant_id: e
|
|
530
|
-
}).execute(),
|
|
530
|
+
}).execute(), r;
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
533
|
function vt(t) {
|
|
534
|
-
return async (e,
|
|
535
|
-
password:
|
|
534
|
+
return async (e, a) => (await t.updateTable("passwords").set({
|
|
535
|
+
password: a.password,
|
|
536
536
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
537
|
-
}).where("tenant_id", "=", e).where("user_id", "=",
|
|
537
|
+
}).where("tenant_id", "=", e).where("user_id", "=", a.user_id).execute()).length === 1;
|
|
538
538
|
}
|
|
539
539
|
function Nt(t) {
|
|
540
540
|
return {
|
|
@@ -544,55 +544,55 @@ function Nt(t) {
|
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
546
|
function Ct(t) {
|
|
547
|
-
return async (e,
|
|
548
|
-
const { page:
|
|
547
|
+
return async (e, a = {}) => {
|
|
548
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, q: s } = a;
|
|
549
549
|
let i = t.selectFrom("codes").where("codes.tenant_id", "=", e);
|
|
550
550
|
s && (i = T(t, i, s, ["code", "login_id"]));
|
|
551
|
-
const
|
|
551
|
+
const m = (await i.offset(r * n).limit(n).selectAll().execute()).map((h) => {
|
|
552
552
|
const { tenant_id: f, ...g } = h;
|
|
553
553
|
return Ke.parse(y(g));
|
|
554
554
|
});
|
|
555
555
|
if (!o)
|
|
556
556
|
return {
|
|
557
|
-
codes:
|
|
557
|
+
codes: m,
|
|
558
558
|
start: 0,
|
|
559
559
|
limit: 0,
|
|
560
560
|
length: 0
|
|
561
561
|
};
|
|
562
|
-
const { count:
|
|
562
|
+
const { count: _ } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
563
563
|
return {
|
|
564
|
-
codes:
|
|
565
|
-
start:
|
|
564
|
+
codes: m,
|
|
565
|
+
start: r * n,
|
|
566
566
|
limit: n,
|
|
567
|
-
length: x(
|
|
567
|
+
length: x(_)
|
|
568
568
|
};
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
571
|
function bt(t) {
|
|
572
|
-
return async (e,
|
|
573
|
-
const
|
|
574
|
-
...
|
|
572
|
+
return async (e, a) => {
|
|
573
|
+
const r = {
|
|
574
|
+
...a,
|
|
575
575
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
576
576
|
};
|
|
577
577
|
return await t.insertInto("codes").values({
|
|
578
|
-
...
|
|
578
|
+
...r,
|
|
579
579
|
tenant_id: e
|
|
580
|
-
}).execute(),
|
|
580
|
+
}).execute(), r;
|
|
581
581
|
};
|
|
582
582
|
}
|
|
583
583
|
function xt(t) {
|
|
584
|
-
return async (e,
|
|
584
|
+
return async (e, a) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
585
585
|
}
|
|
586
586
|
function Tt(t) {
|
|
587
|
-
return async (e,
|
|
588
|
-
let n = t.selectFrom("codes").where("codes.code_id", "=",
|
|
587
|
+
return async (e, a, r) => {
|
|
588
|
+
let n = t.selectFrom("codes").where("codes.code_id", "=", a).where("codes.code_type", "=", r);
|
|
589
589
|
e.length && (n = n.where("codes.tenant_id", "=", e));
|
|
590
590
|
const o = await n.selectAll().executeTakeFirst();
|
|
591
591
|
return o ? y(o) : null;
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
594
|
function St(t) {
|
|
595
|
-
return async (e,
|
|
595
|
+
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;
|
|
596
596
|
}
|
|
597
597
|
function Ot(t) {
|
|
598
598
|
return {
|
|
@@ -604,24 +604,24 @@ function Ot(t) {
|
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
function kt(t) {
|
|
607
|
-
return async (e,
|
|
608
|
-
const
|
|
607
|
+
return async (e, a) => {
|
|
608
|
+
const r = {
|
|
609
609
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
610
610
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
611
|
-
...r,
|
|
612
|
-
disable_sign_ups: r.disable_sign_ups ?? !1
|
|
613
|
-
}, n = JSON.stringify(r.allowed_origins), o = JSON.stringify(r.callbacks), s = JSON.stringify(r.web_origins), i = JSON.stringify(r.allowed_logout_urls), c = JSON.stringify(r.allowed_clients);
|
|
614
|
-
return await t.insertInto("applications").values({
|
|
615
611
|
...a,
|
|
612
|
+
disable_sign_ups: a.disable_sign_ups ?? !1
|
|
613
|
+
}, n = JSON.stringify(a.allowed_origins), o = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), i = JSON.stringify(a.allowed_logout_urls), c = JSON.stringify(a.allowed_clients);
|
|
614
|
+
return await t.insertInto("applications").values({
|
|
615
|
+
...r,
|
|
616
616
|
tenant_id: e,
|
|
617
|
-
disable_sign_ups:
|
|
618
|
-
addons:
|
|
617
|
+
disable_sign_ups: a.disable_sign_ups ? 1 : 0,
|
|
618
|
+
addons: a.addons ? JSON.stringify(a.addons) : "{}",
|
|
619
619
|
callbacks: o,
|
|
620
620
|
allowed_origins: n,
|
|
621
621
|
web_origins: s,
|
|
622
622
|
allowed_logout_urls: i,
|
|
623
623
|
allowed_clients: c
|
|
624
|
-
}).execute(),
|
|
624
|
+
}).execute(), r;
|
|
625
625
|
};
|
|
626
626
|
}
|
|
627
627
|
function $t(t) {
|
|
@@ -639,36 +639,36 @@ function $t(t) {
|
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
function It(t) {
|
|
642
|
-
return async (e,
|
|
643
|
-
const
|
|
644
|
-
return
|
|
645
|
-
...
|
|
646
|
-
disable_sign_ups: !!
|
|
647
|
-
addons: JSON.parse(
|
|
648
|
-
callbacks: JSON.parse(
|
|
649
|
-
allowed_origins: JSON.parse(
|
|
650
|
-
web_origins: JSON.parse(
|
|
651
|
-
allowed_logout_urls: JSON.parse(
|
|
642
|
+
return async (e, a) => {
|
|
643
|
+
const r = await t.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", a).selectAll().executeTakeFirst();
|
|
644
|
+
return r ? y({
|
|
645
|
+
...r,
|
|
646
|
+
disable_sign_ups: !!r.disable_sign_ups,
|
|
647
|
+
addons: JSON.parse(r.addons),
|
|
648
|
+
callbacks: JSON.parse(r.callbacks),
|
|
649
|
+
allowed_origins: JSON.parse(r.allowed_origins),
|
|
650
|
+
web_origins: JSON.parse(r.web_origins),
|
|
651
|
+
allowed_logout_urls: JSON.parse(r.allowed_logout_urls)
|
|
652
652
|
}) : null;
|
|
653
653
|
};
|
|
654
654
|
}
|
|
655
655
|
function Dt(t) {
|
|
656
|
-
return async (e,
|
|
656
|
+
return async (e, a) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
657
657
|
}
|
|
658
658
|
function Pt(t) {
|
|
659
|
-
return async (e,
|
|
659
|
+
return async (e, a, r) => {
|
|
660
660
|
const n = {
|
|
661
|
-
...
|
|
661
|
+
...r,
|
|
662
662
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
663
|
-
allowed_origins:
|
|
664
|
-
callbacks:
|
|
665
|
-
web_origins:
|
|
666
|
-
allowed_logout_urls:
|
|
667
|
-
allowed_clients:
|
|
668
|
-
addons:
|
|
669
|
-
disable_sign_ups:
|
|
663
|
+
allowed_origins: r.allowed_origins ? JSON.stringify(r.allowed_origins) : void 0,
|
|
664
|
+
callbacks: r.callbacks ? JSON.stringify(r.callbacks) : void 0,
|
|
665
|
+
web_origins: r.web_origins ? JSON.stringify(r.web_origins) : void 0,
|
|
666
|
+
allowed_logout_urls: r.allowed_logout_urls ? JSON.stringify(r.allowed_logout_urls) : void 0,
|
|
667
|
+
allowed_clients: r.allowed_clients ? JSON.stringify(r.allowed_clients) : void 0,
|
|
668
|
+
addons: r.addons ? JSON.stringify(r.addons) : "{}",
|
|
669
|
+
disable_sign_ups: r.disable_sign_ups ? 1 : 0
|
|
670
670
|
};
|
|
671
|
-
return await t.updateTable("applications").set(n).where("applications.id", "=",
|
|
671
|
+
return await t.updateTable("applications").set(n).where("applications.id", "=", a).where("applications.tenant_id", "=", e).execute(), !0;
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
674
|
function jt(t) {
|
|
@@ -681,27 +681,27 @@ function jt(t) {
|
|
|
681
681
|
};
|
|
682
682
|
}
|
|
683
683
|
function Ft(t) {
|
|
684
|
-
return async (e,
|
|
685
|
-
const
|
|
686
|
-
id:
|
|
687
|
-
...
|
|
684
|
+
return async (e, a) => {
|
|
685
|
+
const r = {
|
|
686
|
+
id: S(),
|
|
687
|
+
...a,
|
|
688
688
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
689
689
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
690
690
|
};
|
|
691
691
|
return await t.insertInto("connections").values({
|
|
692
|
-
...
|
|
692
|
+
...r,
|
|
693
693
|
// The connection options will have many different properties depending on the strategy
|
|
694
|
-
options: JSON.stringify(
|
|
694
|
+
options: JSON.stringify(r.options || {}),
|
|
695
695
|
tenant_id: e
|
|
696
|
-
}).execute(),
|
|
696
|
+
}).execute(), r;
|
|
697
697
|
};
|
|
698
698
|
}
|
|
699
|
-
function
|
|
700
|
-
return async (e,
|
|
701
|
-
const { page:
|
|
699
|
+
function At(t) {
|
|
700
|
+
return async (e, a = {}) => {
|
|
701
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, q: s } = a;
|
|
702
702
|
let i = t.selectFrom("connections").where("connections.tenant_id", "=", e);
|
|
703
703
|
s && (i = T(t, i, s, ["user_id", "ip"]));
|
|
704
|
-
const
|
|
704
|
+
const m = (await i.offset(r * n).limit(n).selectAll().execute()).map(
|
|
705
705
|
(h) => y({
|
|
706
706
|
...h,
|
|
707
707
|
options: JSON.parse(h.options)
|
|
@@ -709,65 +709,65 @@ function Mt(t) {
|
|
|
709
709
|
);
|
|
710
710
|
if (!o)
|
|
711
711
|
return {
|
|
712
|
-
connections:
|
|
712
|
+
connections: m,
|
|
713
713
|
start: 0,
|
|
714
714
|
limit: 0,
|
|
715
715
|
length: 0
|
|
716
716
|
};
|
|
717
|
-
const { count:
|
|
717
|
+
const { count: _ } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
718
718
|
return {
|
|
719
|
-
connections:
|
|
720
|
-
start:
|
|
719
|
+
connections: m,
|
|
720
|
+
start: r * n,
|
|
721
721
|
limit: n,
|
|
722
|
-
length: x(
|
|
722
|
+
length: x(_)
|
|
723
723
|
};
|
|
724
724
|
};
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
return async (e,
|
|
726
|
+
function Mt(t) {
|
|
727
|
+
return async (e, a) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
728
728
|
}
|
|
729
729
|
function zt(t) {
|
|
730
|
-
return async (e,
|
|
731
|
-
const
|
|
732
|
-
return
|
|
733
|
-
...
|
|
734
|
-
options: JSON.parse(
|
|
730
|
+
return async (e, a) => {
|
|
731
|
+
const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).selectAll().executeTakeFirst();
|
|
732
|
+
return r ? y({
|
|
733
|
+
...r,
|
|
734
|
+
options: JSON.parse(r.options)
|
|
735
735
|
}) : null;
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
|
-
function
|
|
739
|
-
return async (e,
|
|
738
|
+
function Jt(t) {
|
|
739
|
+
return async (e, a, r) => {
|
|
740
740
|
const n = {
|
|
741
|
-
...
|
|
741
|
+
...r,
|
|
742
742
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
743
743
|
};
|
|
744
744
|
return await t.updateTable("connections").set({
|
|
745
745
|
...n,
|
|
746
746
|
options: n.options ? JSON.stringify(n.options) : void 0
|
|
747
|
-
}).where("connections.id", "=",
|
|
747
|
+
}).where("connections.id", "=", a).where("connections.tenant_id", "=", e).execute(), !0;
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function Lt(t) {
|
|
751
751
|
return {
|
|
752
752
|
create: Ft(t),
|
|
753
753
|
get: zt(t),
|
|
754
|
-
list:
|
|
755
|
-
remove:
|
|
756
|
-
update:
|
|
754
|
+
list: At(t),
|
|
755
|
+
remove: Mt(t),
|
|
756
|
+
update: Jt(t)
|
|
757
757
|
};
|
|
758
758
|
}
|
|
759
|
-
function
|
|
759
|
+
function Et(t) {
|
|
760
760
|
return {
|
|
761
761
|
get: async (e) => {
|
|
762
|
-
const
|
|
763
|
-
if (!r)
|
|
764
|
-
return null;
|
|
765
|
-
const a = await t.selectFrom("tenants").selectAll().where("id", "=", r.tenant_id).executeTakeFirst();
|
|
762
|
+
const a = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
|
|
766
763
|
if (!a)
|
|
767
|
-
|
|
768
|
-
const
|
|
764
|
+
return null;
|
|
765
|
+
const r = await t.selectFrom("tenants").selectAll().where("id", "=", a.tenant_id).executeTakeFirst();
|
|
766
|
+
if (!r)
|
|
767
|
+
throw new H(404, { message: "Tenant not found" });
|
|
768
|
+
const n = await t.selectFrom("connections").where("tenant_id", "=", a.tenant_id).selectAll().execute();
|
|
769
769
|
return {
|
|
770
|
-
...
|
|
770
|
+
...a,
|
|
771
771
|
connections: n.map(
|
|
772
772
|
(s) => Ue.parse(
|
|
773
773
|
y({
|
|
@@ -776,15 +776,15 @@ function Jt(t) {
|
|
|
776
776
|
})
|
|
777
777
|
)
|
|
778
778
|
),
|
|
779
|
-
addons:
|
|
780
|
-
callbacks:
|
|
781
|
-
allowed_origins:
|
|
782
|
-
web_origins:
|
|
783
|
-
allowed_logout_urls:
|
|
784
|
-
allowed_clients:
|
|
785
|
-
tenant: y(
|
|
779
|
+
addons: a.addons ? JSON.parse(a.addons) : {},
|
|
780
|
+
callbacks: a.callbacks ? JSON.parse(a.callbacks) : [],
|
|
781
|
+
allowed_origins: a.allowed_origins ? JSON.parse(a.allowed_origins) : [],
|
|
782
|
+
web_origins: a.web_origins ? JSON.parse(a.web_origins) : [],
|
|
783
|
+
allowed_logout_urls: a.allowed_logout_urls ? JSON.parse(a.allowed_logout_urls) : [],
|
|
784
|
+
allowed_clients: a.allowed_clients ? JSON.parse(a.allowed_clients) : [],
|
|
785
|
+
tenant: y(r),
|
|
786
786
|
// this is really an integer in the database
|
|
787
|
-
disable_sign_ups: !!
|
|
787
|
+
disable_sign_ups: !!a.disable_sign_ups
|
|
788
788
|
};
|
|
789
789
|
}
|
|
790
790
|
};
|
|
@@ -792,8 +792,8 @@ function Jt(t) {
|
|
|
792
792
|
function Rt(t) {
|
|
793
793
|
return async (e = {}) => {
|
|
794
794
|
const {
|
|
795
|
-
page:
|
|
796
|
-
per_page:
|
|
795
|
+
page: a = 0,
|
|
796
|
+
per_page: r = 100,
|
|
797
797
|
include_totals: n = !1,
|
|
798
798
|
sort: o,
|
|
799
799
|
q: s
|
|
@@ -812,21 +812,21 @@ function Rt(t) {
|
|
|
812
812
|
"type"
|
|
813
813
|
]));
|
|
814
814
|
let c = i.select((f) => f.fn.count("kid").as("count"));
|
|
815
|
-
const
|
|
816
|
-
i = i.limit(
|
|
817
|
-
const
|
|
815
|
+
const u = a * r;
|
|
816
|
+
i = i.limit(r).offset(u), o && (i = i.orderBy(o.sort_by, o.sort_order));
|
|
817
|
+
const m = await i.selectAll().execute();
|
|
818
818
|
if (!n)
|
|
819
819
|
return {
|
|
820
|
-
signingKeys:
|
|
820
|
+
signingKeys: m,
|
|
821
821
|
start: 0,
|
|
822
822
|
limit: 0,
|
|
823
823
|
length: 0
|
|
824
824
|
};
|
|
825
|
-
const
|
|
825
|
+
const _ = await c.executeTakeFirst(), h = x((_ == null ? void 0 : _.count) ?? 0);
|
|
826
826
|
return {
|
|
827
|
-
signingKeys:
|
|
828
|
-
start:
|
|
829
|
-
limit:
|
|
827
|
+
signingKeys: m,
|
|
828
|
+
start: u,
|
|
829
|
+
limit: r,
|
|
830
830
|
length: h
|
|
831
831
|
};
|
|
832
832
|
};
|
|
@@ -837,7 +837,7 @@ function Kt(t) {
|
|
|
837
837
|
};
|
|
838
838
|
}
|
|
839
839
|
function Ut(t) {
|
|
840
|
-
return async (e,
|
|
840
|
+
return async (e, a) => !!(await t.updateTable("keys").set(a).where("kid", "=", e).execute()).length;
|
|
841
841
|
}
|
|
842
842
|
function Bt(t) {
|
|
843
843
|
return {
|
|
@@ -847,56 +847,56 @@ function Bt(t) {
|
|
|
847
847
|
};
|
|
848
848
|
}
|
|
849
849
|
function Qt(t) {
|
|
850
|
-
return async (e,
|
|
851
|
-
const
|
|
852
|
-
custom_domain_id:
|
|
850
|
+
return async (e, a) => {
|
|
851
|
+
const r = {
|
|
852
|
+
custom_domain_id: S(),
|
|
853
853
|
status: "pending",
|
|
854
854
|
primary: !1,
|
|
855
|
-
...
|
|
855
|
+
...a
|
|
856
856
|
};
|
|
857
857
|
return await t.insertInto("custom_domains").values({
|
|
858
|
-
...
|
|
858
|
+
...r,
|
|
859
859
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
860
860
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
861
861
|
tenant_id: e,
|
|
862
|
-
primary:
|
|
863
|
-
}).execute(),
|
|
862
|
+
primary: r.primary ? 1 : 0
|
|
863
|
+
}).execute(), r;
|
|
864
864
|
};
|
|
865
865
|
}
|
|
866
866
|
function qt(t) {
|
|
867
|
-
return async (e) => (await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).selectAll().execute()).map((
|
|
868
|
-
...
|
|
869
|
-
primary:
|
|
867
|
+
return async (e) => (await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).selectAll().execute()).map((r) => ({
|
|
868
|
+
...r,
|
|
869
|
+
primary: r.primary === 1
|
|
870
870
|
}));
|
|
871
871
|
}
|
|
872
872
|
function Vt(t) {
|
|
873
|
-
return async (e,
|
|
873
|
+
return async (e, a) => (await t.deleteFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).execute()).length > 0;
|
|
874
874
|
}
|
|
875
875
|
function Wt(t) {
|
|
876
|
-
return async (e,
|
|
877
|
-
const
|
|
878
|
-
return
|
|
879
|
-
...
|
|
880
|
-
primary:
|
|
876
|
+
return async (e, a) => {
|
|
877
|
+
const r = await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).selectAll().executeTakeFirst();
|
|
878
|
+
return r ? {
|
|
879
|
+
...r,
|
|
880
|
+
primary: r.primary === 1
|
|
881
881
|
} : null;
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
884
|
function Gt(t) {
|
|
885
|
-
return async (e,
|
|
885
|
+
return async (e, a, r) => {
|
|
886
886
|
const n = {
|
|
887
|
-
...
|
|
887
|
+
...r,
|
|
888
888
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
889
|
-
primary:
|
|
889
|
+
primary: r.primary ? 1 : 0
|
|
890
890
|
};
|
|
891
|
-
return (await t.updateTable("custom_domains").set(n).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=",
|
|
891
|
+
return (await t.updateTable("custom_domains").set(n).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).execute()).length > 0;
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
894
|
function Ht(t) {
|
|
895
895
|
return async (e) => {
|
|
896
|
-
const
|
|
897
|
-
return
|
|
898
|
-
...
|
|
899
|
-
primary:
|
|
896
|
+
const a = await t.selectFrom("custom_domains").where("custom_domains.domain", "=", e).selectAll().executeTakeFirst();
|
|
897
|
+
return a ? {
|
|
898
|
+
...a,
|
|
899
|
+
primary: a.primary === 1
|
|
900
900
|
} : null;
|
|
901
901
|
};
|
|
902
902
|
}
|
|
@@ -912,21 +912,21 @@ function Yt(t) {
|
|
|
912
912
|
}
|
|
913
913
|
function Xt(t) {
|
|
914
914
|
return async (e) => {
|
|
915
|
-
const [
|
|
916
|
-
if (!
|
|
915
|
+
const [a] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
|
|
916
|
+
if (!a)
|
|
917
917
|
return null;
|
|
918
918
|
const {
|
|
919
|
-
tenant_id:
|
|
919
|
+
tenant_id: r,
|
|
920
920
|
colors_primary: n,
|
|
921
921
|
colors_page_background_type: o,
|
|
922
922
|
colors_page_background_start: s,
|
|
923
923
|
colors_page_background_end: i,
|
|
924
924
|
colors_page_background_angle_dev: c,
|
|
925
|
-
font_url:
|
|
926
|
-
...
|
|
927
|
-
} =
|
|
925
|
+
font_url: u,
|
|
926
|
+
...m
|
|
927
|
+
} = a;
|
|
928
928
|
return y({
|
|
929
|
-
...
|
|
929
|
+
...m,
|
|
930
930
|
colors: {
|
|
931
931
|
primary: n,
|
|
932
932
|
page_background: {
|
|
@@ -936,50 +936,50 @@ function Xt(t) {
|
|
|
936
936
|
angle_deg: c
|
|
937
937
|
}
|
|
938
938
|
},
|
|
939
|
-
font:
|
|
939
|
+
font: u ? { url: u } : void 0
|
|
940
940
|
});
|
|
941
941
|
};
|
|
942
942
|
}
|
|
943
943
|
function Zt(t) {
|
|
944
|
-
return async (e,
|
|
945
|
-
var s, i, c,
|
|
946
|
-
const { colors:
|
|
944
|
+
return async (e, a) => {
|
|
945
|
+
var s, i, c, u, m, _, h, f, g, w, b, D, A, P, V, le, ce, de;
|
|
946
|
+
const { colors: r, font: n, ...o } = a;
|
|
947
947
|
try {
|
|
948
948
|
await t.insertInto("branding").values({
|
|
949
949
|
...o,
|
|
950
|
-
colors_primary:
|
|
951
|
-
colors_page_background_type: (i = (s =
|
|
952
|
-
colors_page_background_start: (
|
|
953
|
-
colors_page_background_end: (
|
|
954
|
-
colors_page_background_angle_dev: (f = (h =
|
|
955
|
-
font_url: (g =
|
|
950
|
+
colors_primary: r == null ? void 0 : r.primary,
|
|
951
|
+
colors_page_background_type: (i = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : i.type,
|
|
952
|
+
colors_page_background_start: (u = (c = a.colors) == null ? void 0 : c.page_background) == null ? void 0 : u.start,
|
|
953
|
+
colors_page_background_end: (_ = (m = a.colors) == null ? void 0 : m.page_background) == null ? void 0 : _.end,
|
|
954
|
+
colors_page_background_angle_dev: (f = (h = a.colors) == null ? void 0 : h.page_background) == null ? void 0 : f.angle_deg,
|
|
955
|
+
font_url: (g = a.font) == null ? void 0 : g.url,
|
|
956
956
|
tenant_id: e
|
|
957
957
|
}).execute();
|
|
958
958
|
} catch {
|
|
959
959
|
await t.updateTable("branding").set({
|
|
960
960
|
...o,
|
|
961
|
-
colors_primary:
|
|
962
|
-
colors_page_background_type: (b = (w =
|
|
963
|
-
colors_page_background_start: (
|
|
964
|
-
colors_page_background_end: (V = (P =
|
|
965
|
-
colors_page_background_angle_dev: (ce = (le =
|
|
966
|
-
font_url: (de =
|
|
961
|
+
colors_primary: r == null ? void 0 : r.primary,
|
|
962
|
+
colors_page_background_type: (b = (w = a.colors) == null ? void 0 : w.page_background) == null ? void 0 : b.type,
|
|
963
|
+
colors_page_background_start: (A = (D = a.colors) == null ? void 0 : D.page_background) == null ? void 0 : A.start,
|
|
964
|
+
colors_page_background_end: (V = (P = a.colors) == null ? void 0 : P.page_background) == null ? void 0 : V.end,
|
|
965
|
+
colors_page_background_angle_dev: (ce = (le = a.colors) == null ? void 0 : le.page_background) == null ? void 0 : ce.angle_deg,
|
|
966
|
+
font_url: (de = a.font) == null ? void 0 : de.url
|
|
967
967
|
}).where("tenant_id", "=", e).execute();
|
|
968
968
|
}
|
|
969
969
|
};
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function ea(t) {
|
|
972
972
|
return {
|
|
973
973
|
get: Xt(t),
|
|
974
974
|
set: Zt(t)
|
|
975
975
|
};
|
|
976
976
|
}
|
|
977
|
-
function
|
|
978
|
-
return async (e,
|
|
979
|
-
const { page:
|
|
977
|
+
function ta(t) {
|
|
978
|
+
return async (e, a = {}) => {
|
|
979
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, q: s } = a;
|
|
980
980
|
let i = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
|
|
981
981
|
s && (i = T(t, i, s, ["url", "form_id"]));
|
|
982
|
-
const
|
|
982
|
+
const m = (await i.offset(r * n).limit(n).selectAll().execute()).map((h) => {
|
|
983
983
|
const { tenant_id: f, enabled: g, synchronous: w, ...b } = h;
|
|
984
984
|
return y({
|
|
985
985
|
...b,
|
|
@@ -989,100 +989,100 @@ function tr(t) {
|
|
|
989
989
|
});
|
|
990
990
|
if (!o)
|
|
991
991
|
return {
|
|
992
|
-
hooks:
|
|
992
|
+
hooks: m,
|
|
993
993
|
start: 0,
|
|
994
994
|
limit: 0,
|
|
995
995
|
length: 0
|
|
996
996
|
};
|
|
997
|
-
const { count:
|
|
997
|
+
const { count: _ } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
998
998
|
return {
|
|
999
|
-
hooks:
|
|
1000
|
-
start:
|
|
999
|
+
hooks: m,
|
|
1000
|
+
start: r * n,
|
|
1001
1001
|
limit: n,
|
|
1002
|
-
length: x(
|
|
1002
|
+
length: x(_)
|
|
1003
1003
|
};
|
|
1004
1004
|
};
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return async (e,
|
|
1008
|
-
const
|
|
1009
|
-
return
|
|
1010
|
-
...
|
|
1011
|
-
enabled: !!
|
|
1012
|
-
synchronous: !!
|
|
1006
|
+
function aa(t) {
|
|
1007
|
+
return async (e, a) => {
|
|
1008
|
+
const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).selectAll().executeTakeFirst();
|
|
1009
|
+
return r ? y({
|
|
1010
|
+
...r,
|
|
1011
|
+
enabled: !!r.enabled,
|
|
1012
|
+
synchronous: !!r.synchronous
|
|
1013
1013
|
}) : null;
|
|
1014
1014
|
};
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1017
|
-
return async (e,
|
|
1016
|
+
function ra(t) {
|
|
1017
|
+
return async (e, a) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1020
|
-
return async (e,
|
|
1021
|
-
const
|
|
1022
|
-
hook_id:
|
|
1023
|
-
...
|
|
1019
|
+
function na(t) {
|
|
1020
|
+
return async (e, a) => {
|
|
1021
|
+
const r = {
|
|
1022
|
+
hook_id: S(),
|
|
1023
|
+
...a,
|
|
1024
1024
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1025
1025
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1026
1026
|
};
|
|
1027
1027
|
return await t.insertInto("hooks").values({
|
|
1028
|
-
...
|
|
1028
|
+
...r,
|
|
1029
1029
|
tenant_id: e,
|
|
1030
|
-
enabled:
|
|
1031
|
-
synchronous:
|
|
1032
|
-
}).execute(),
|
|
1030
|
+
enabled: a.enabled ? 1 : 0,
|
|
1031
|
+
synchronous: a.synchronous ? 1 : 0
|
|
1032
|
+
}).execute(), r;
|
|
1033
1033
|
};
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1036
|
-
return async (e,
|
|
1035
|
+
function oa(t) {
|
|
1036
|
+
return async (e, a, r) => {
|
|
1037
1037
|
const n = {
|
|
1038
|
-
...
|
|
1038
|
+
...r,
|
|
1039
1039
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1040
|
-
enabled:
|
|
1041
|
-
synchronous:
|
|
1040
|
+
enabled: r.enabled !== void 0 ? r.enabled ? 1 : 0 : void 0,
|
|
1041
|
+
synchronous: r.enabled !== void 0 ? r.synchronous ? 1 : 0 : void 0
|
|
1042
1042
|
};
|
|
1043
|
-
return await t.updateTable("hooks").set(n).where("hooks.hook_id", "=",
|
|
1043
|
+
return await t.updateTable("hooks").set(n).where("hooks.hook_id", "=", a).where("hooks.tenant_id", "=", e).execute(), !0;
|
|
1044
1044
|
};
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1046
|
+
function sa(t) {
|
|
1047
1047
|
return {
|
|
1048
|
-
create:
|
|
1049
|
-
get:
|
|
1050
|
-
list:
|
|
1051
|
-
update:
|
|
1052
|
-
remove:
|
|
1048
|
+
create: na(t),
|
|
1049
|
+
get: aa(t),
|
|
1050
|
+
list: ta(t),
|
|
1051
|
+
update: oa(t),
|
|
1052
|
+
remove: ra(t)
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1056
|
-
return async (e,
|
|
1057
|
-
const
|
|
1058
|
-
themeId:
|
|
1055
|
+
function ia(t) {
|
|
1056
|
+
return async (e, a) => {
|
|
1057
|
+
const r = {
|
|
1058
|
+
themeId: S(),
|
|
1059
1059
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1060
1060
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1061
|
-
...
|
|
1061
|
+
...a
|
|
1062
1062
|
}, n = {
|
|
1063
|
-
...
|
|
1063
|
+
...r,
|
|
1064
1064
|
tenant_id: e
|
|
1065
1065
|
};
|
|
1066
|
-
return await t.insertInto("themes").values(
|
|
1066
|
+
return await t.insertInto("themes").values(E(n)).execute(), r;
|
|
1067
1067
|
};
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
return async (e,
|
|
1069
|
+
function la(t) {
|
|
1070
|
+
return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1073
|
-
return async (e,
|
|
1074
|
-
const
|
|
1075
|
-
if (!
|
|
1072
|
+
function ca(t) {
|
|
1073
|
+
return async (e, a) => {
|
|
1074
|
+
const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).selectAll().executeTakeFirst();
|
|
1075
|
+
if (!r)
|
|
1076
1076
|
return null;
|
|
1077
1077
|
const n = {
|
|
1078
|
-
...
|
|
1079
|
-
borders_show_widget_shadow: !!
|
|
1080
|
-
fonts_body_text_bold: !!
|
|
1081
|
-
fonts_buttons_text_bold: !!
|
|
1082
|
-
fonts_input_labels_bold: !!
|
|
1083
|
-
fonts_links_bold: !!
|
|
1084
|
-
fonts_subtitle_bold: !!
|
|
1085
|
-
fonts_title_bold: !!
|
|
1078
|
+
...r,
|
|
1079
|
+
borders_show_widget_shadow: !!r.borders_show_widget_shadow,
|
|
1080
|
+
fonts_body_text_bold: !!r.fonts_body_text_bold,
|
|
1081
|
+
fonts_buttons_text_bold: !!r.fonts_buttons_text_bold,
|
|
1082
|
+
fonts_input_labels_bold: !!r.fonts_input_labels_bold,
|
|
1083
|
+
fonts_links_bold: !!r.fonts_links_bold,
|
|
1084
|
+
fonts_subtitle_bold: !!r.fonts_subtitle_bold,
|
|
1085
|
+
fonts_title_bold: !!r.fonts_title_bold
|
|
1086
1086
|
};
|
|
1087
1087
|
return y(
|
|
1088
1088
|
ge(n, [
|
|
@@ -1095,80 +1095,80 @@ function cr(t) {
|
|
|
1095
1095
|
);
|
|
1096
1096
|
};
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
return async (e,
|
|
1100
|
-
const n =
|
|
1101
|
-
...
|
|
1098
|
+
function da(t) {
|
|
1099
|
+
return async (e, a, r) => {
|
|
1100
|
+
const n = E({
|
|
1101
|
+
...r,
|
|
1102
1102
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1103
1103
|
});
|
|
1104
|
-
return await t.updateTable("themes").set(n).where("themes.themeId", "=",
|
|
1104
|
+
return await t.updateTable("themes").set(n).where("themes.themeId", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
|
|
1105
1105
|
};
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1107
|
+
function ua(t) {
|
|
1108
1108
|
return {
|
|
1109
|
-
create:
|
|
1110
|
-
get:
|
|
1111
|
-
remove:
|
|
1112
|
-
update:
|
|
1109
|
+
create: ia(t),
|
|
1110
|
+
get: ca(t),
|
|
1111
|
+
remove: la(t),
|
|
1112
|
+
update: da(t)
|
|
1113
1113
|
};
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return async (e,
|
|
1117
|
-
const
|
|
1118
|
-
return
|
|
1115
|
+
function ma(t) {
|
|
1116
|
+
return async (e, a) => {
|
|
1117
|
+
const r = await t.selectFrom("login_sessions").where("login_sessions.id", "=", a).selectAll().executeTakeFirst();
|
|
1118
|
+
return r ? Be.parse(
|
|
1119
1119
|
ge(
|
|
1120
1120
|
y({
|
|
1121
|
-
...
|
|
1122
|
-
login_completed: !!
|
|
1121
|
+
...r,
|
|
1122
|
+
login_completed: !!r.login_completed
|
|
1123
1123
|
}),
|
|
1124
1124
|
["authParams"]
|
|
1125
1125
|
)
|
|
1126
1126
|
) : null;
|
|
1127
1127
|
};
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return async (e,
|
|
1129
|
+
function _a(t) {
|
|
1130
|
+
return async (e, a) => {
|
|
1131
1131
|
var n;
|
|
1132
|
-
const
|
|
1133
|
-
id:
|
|
1134
|
-
...
|
|
1135
|
-
authorization_url: (n =
|
|
1132
|
+
const r = {
|
|
1133
|
+
id: S(),
|
|
1134
|
+
...a,
|
|
1135
|
+
authorization_url: (n = a.authorization_url) == null ? void 0 : n.slice(0, 1024),
|
|
1136
1136
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1137
1137
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1138
|
-
login_completed: !!
|
|
1138
|
+
login_completed: !!a.login_completed
|
|
1139
1139
|
};
|
|
1140
1140
|
return await t.insertInto("login_sessions").values({
|
|
1141
|
-
...
|
|
1141
|
+
...E(r),
|
|
1142
1142
|
tenant_id: e
|
|
1143
|
-
}).execute(),
|
|
1143
|
+
}).execute(), r;
|
|
1144
1144
|
};
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return async (e,
|
|
1148
|
-
|
|
1149
|
-
...
|
|
1146
|
+
function ha(t) {
|
|
1147
|
+
return async (e, a, r) => (await t.updateTable("login_sessions").set(
|
|
1148
|
+
E({
|
|
1149
|
+
...r
|
|
1150
1150
|
})
|
|
1151
|
-
).where("login_sessions.id", "=",
|
|
1151
|
+
).where("login_sessions.id", "=", a).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
|
|
1152
1152
|
}
|
|
1153
|
-
function
|
|
1154
|
-
return async (e,
|
|
1153
|
+
function fa(t) {
|
|
1154
|
+
return async (e, a) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", a).execute()).length > 0;
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function pa(t) {
|
|
1157
1157
|
return {
|
|
1158
|
-
create:
|
|
1159
|
-
get:
|
|
1160
|
-
update:
|
|
1161
|
-
remove:
|
|
1158
|
+
create: _a(t),
|
|
1159
|
+
get: ma(t),
|
|
1160
|
+
update: ha(t),
|
|
1161
|
+
remove: fa(t)
|
|
1162
1162
|
};
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1164
|
+
function ga(t) {
|
|
1165
1165
|
return async (e) => {
|
|
1166
|
-
const [
|
|
1166
|
+
const [a] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
|
|
1167
1167
|
return y({
|
|
1168
|
-
identifier_first: !!(
|
|
1169
|
-
password_first: !!(
|
|
1170
|
-
webauthn_platform_first_factor: !!(
|
|
1171
|
-
universal_login_experience: (
|
|
1168
|
+
identifier_first: !!(a != null && a.identifier_first),
|
|
1169
|
+
password_first: !!(a != null && a.password_first),
|
|
1170
|
+
webauthn_platform_first_factor: !!(a != null && a.webauthn_platform_first_factor),
|
|
1171
|
+
universal_login_experience: (a == null ? void 0 : a.universal_login_experience) || "new"
|
|
1172
1172
|
});
|
|
1173
1173
|
};
|
|
1174
1174
|
}
|
|
@@ -1181,37 +1181,37 @@ function he(t) {
|
|
|
1181
1181
|
universal_login_experience: t.universal_login_experience
|
|
1182
1182
|
});
|
|
1183
1183
|
}
|
|
1184
|
-
function
|
|
1185
|
-
return async (e,
|
|
1184
|
+
function wa(t) {
|
|
1185
|
+
return async (e, a) => {
|
|
1186
1186
|
try {
|
|
1187
|
-
const
|
|
1187
|
+
const r = Qe.parse(a);
|
|
1188
1188
|
await t.insertInto("prompt_settings").values({
|
|
1189
|
-
...he(
|
|
1189
|
+
...he(r),
|
|
1190
1190
|
tenant_id: e
|
|
1191
1191
|
}).execute();
|
|
1192
1192
|
} catch {
|
|
1193
|
-
await t.updateTable("prompt_settings").set(he(
|
|
1193
|
+
await t.updateTable("prompt_settings").set(he(a)).where("tenant_id", "=", e).execute();
|
|
1194
1194
|
}
|
|
1195
1195
|
};
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
1197
|
+
function ya(t) {
|
|
1198
1198
|
return {
|
|
1199
|
-
get:
|
|
1200
|
-
set:
|
|
1199
|
+
get: ga(t),
|
|
1200
|
+
set: wa(t)
|
|
1201
1201
|
};
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function va(t) {
|
|
1204
1204
|
return async (e) => {
|
|
1205
|
-
const [
|
|
1206
|
-
if (!
|
|
1205
|
+
const [a] = await t.selectFrom("email_providers").where("email_providers.tenant_id", "=", e).selectAll().execute();
|
|
1206
|
+
if (!a)
|
|
1207
1207
|
return null;
|
|
1208
1208
|
const {
|
|
1209
|
-
tenant_id:
|
|
1209
|
+
tenant_id: r,
|
|
1210
1210
|
credentials: n,
|
|
1211
1211
|
settings: o,
|
|
1212
1212
|
enabled: s,
|
|
1213
1213
|
...i
|
|
1214
|
-
} =
|
|
1214
|
+
} = a;
|
|
1215
1215
|
return y({
|
|
1216
1216
|
...i,
|
|
1217
1217
|
credentials: JSON.parse(n),
|
|
@@ -1220,24 +1220,24 @@ function vr(t) {
|
|
|
1220
1220
|
});
|
|
1221
1221
|
};
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1224
|
-
return async (e,
|
|
1225
|
-
const { credentials:
|
|
1223
|
+
function Na(t) {
|
|
1224
|
+
return async (e, a) => {
|
|
1225
|
+
const { credentials: r, settings: n, enabled: o, ...s } = a;
|
|
1226
1226
|
await t.updateTable("email_providers").set({
|
|
1227
1227
|
...s,
|
|
1228
|
-
credentials:
|
|
1228
|
+
credentials: r ? JSON.stringify(r) : void 0,
|
|
1229
1229
|
settings: n ? JSON.stringify(n) : void 0,
|
|
1230
1230
|
enabled: o !== void 0 ? o ? 1 : 0 : void 0
|
|
1231
1231
|
}).where("tenant_id", "=", e).execute();
|
|
1232
1232
|
};
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1235
|
-
return async (e,
|
|
1236
|
-
const { credentials:
|
|
1234
|
+
function Ca(t) {
|
|
1235
|
+
return async (e, a) => {
|
|
1236
|
+
const { credentials: r, settings: n, enabled: o, ...s } = a;
|
|
1237
1237
|
await t.insertInto("email_providers").values({
|
|
1238
1238
|
...s,
|
|
1239
1239
|
enabled: o ? 1 : 0,
|
|
1240
|
-
credentials: JSON.stringify(
|
|
1240
|
+
credentials: JSON.stringify(r),
|
|
1241
1241
|
settings: JSON.stringify(n),
|
|
1242
1242
|
tenant_id: e,
|
|
1243
1243
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1245,65 +1245,65 @@ function Cr(t) {
|
|
|
1245
1245
|
}).execute();
|
|
1246
1246
|
};
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function ba(t) {
|
|
1249
1249
|
return {
|
|
1250
|
-
get:
|
|
1251
|
-
create:
|
|
1252
|
-
update:
|
|
1250
|
+
get: va(t),
|
|
1251
|
+
create: Ca(t),
|
|
1252
|
+
update: Na(t)
|
|
1253
1253
|
};
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1256
|
-
return async (e,
|
|
1257
|
-
const
|
|
1258
|
-
return
|
|
1259
|
-
...
|
|
1260
|
-
rotating: !!
|
|
1261
|
-
device:
|
|
1262
|
-
resource_servers:
|
|
1255
|
+
function xa(t) {
|
|
1256
|
+
return async (e, a) => {
|
|
1257
|
+
const r = await t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e).where("refresh_tokens.id", "=", a).selectAll().executeTakeFirst();
|
|
1258
|
+
return r ? {
|
|
1259
|
+
...r,
|
|
1260
|
+
rotating: !!r.rotating,
|
|
1261
|
+
device: r.device ? JSON.parse(r.device) : {},
|
|
1262
|
+
resource_servers: r.resource_servers ? JSON.parse(r.resource_servers) : []
|
|
1263
1263
|
} : null;
|
|
1264
1264
|
};
|
|
1265
1265
|
}
|
|
1266
|
-
function
|
|
1267
|
-
return async (e,
|
|
1268
|
-
const
|
|
1269
|
-
...
|
|
1266
|
+
function Ta(t) {
|
|
1267
|
+
return async (e, a) => {
|
|
1268
|
+
const r = {
|
|
1269
|
+
...a,
|
|
1270
1270
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1271
1271
|
};
|
|
1272
1272
|
return await t.insertInto("refresh_tokens").values({
|
|
1273
|
-
...
|
|
1273
|
+
...r,
|
|
1274
1274
|
tenant_id: e,
|
|
1275
|
-
rotating:
|
|
1276
|
-
device: JSON.stringify(
|
|
1277
|
-
resource_servers: JSON.stringify(
|
|
1278
|
-
}).execute(), { ...
|
|
1275
|
+
rotating: a.rotating ? 1 : 0,
|
|
1276
|
+
device: JSON.stringify(a.device),
|
|
1277
|
+
resource_servers: JSON.stringify(a.resource_servers)
|
|
1278
|
+
}).execute(), { ...a, ...r };
|
|
1279
1279
|
};
|
|
1280
1280
|
}
|
|
1281
|
-
function
|
|
1282
|
-
return async (e,
|
|
1281
|
+
function Sa(t) {
|
|
1282
|
+
return async (e, a) => !!(await t.deleteFrom("refresh_tokens").where("tenant_id", "=", e).where("refresh_tokens.id", "=", a).execute()).length;
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1285
|
-
return async (e,
|
|
1284
|
+
function Oa(t) {
|
|
1285
|
+
return async (e, a, r) => {
|
|
1286
1286
|
const n = {
|
|
1287
|
-
...
|
|
1288
|
-
device:
|
|
1289
|
-
resource_servers:
|
|
1290
|
-
rotating:
|
|
1287
|
+
...r,
|
|
1288
|
+
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
1289
|
+
resource_servers: r.resource_servers ? JSON.stringify(r.resource_servers) : void 0,
|
|
1290
|
+
rotating: r.rotating ? 1 : 0
|
|
1291
1291
|
};
|
|
1292
|
-
return !!(await t.updateTable("refresh_tokens").set(n).where("tenant_id", "=", e).where("refresh_tokens.id", "=",
|
|
1292
|
+
return !!(await t.updateTable("refresh_tokens").set(n).where("tenant_id", "=", e).where("refresh_tokens.id", "=", a).execute()).length;
|
|
1293
1293
|
};
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1296
|
-
return async (e,
|
|
1297
|
-
const { page:
|
|
1295
|
+
function ka(t) {
|
|
1296
|
+
return async (e, a = {}) => {
|
|
1297
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
|
|
1298
1298
|
let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
|
|
1299
1299
|
i && (c = T(t, c, i, ["token", "session_id"]));
|
|
1300
|
-
let
|
|
1300
|
+
let u = c;
|
|
1301
1301
|
if (s && s.sort_by) {
|
|
1302
1302
|
const { ref: g } = t.dynamic;
|
|
1303
|
-
|
|
1303
|
+
u = u.orderBy(g(s.sort_by), s.sort_order);
|
|
1304
1304
|
}
|
|
1305
|
-
|
|
1306
|
-
const
|
|
1305
|
+
u = u.offset(r * n).limit(n);
|
|
1306
|
+
const _ = (await u.selectAll().execute()).map((g) => ({
|
|
1307
1307
|
...g,
|
|
1308
1308
|
rotating: !!g.rotating,
|
|
1309
1309
|
device: g.device ? JSON.parse(g.device) : {},
|
|
@@ -1311,46 +1311,46 @@ function kr(t) {
|
|
|
1311
1311
|
}));
|
|
1312
1312
|
if (!o)
|
|
1313
1313
|
return {
|
|
1314
|
-
refresh_tokens:
|
|
1314
|
+
refresh_tokens: _,
|
|
1315
1315
|
start: 0,
|
|
1316
1316
|
limit: 0,
|
|
1317
1317
|
length: 0
|
|
1318
1318
|
};
|
|
1319
1319
|
const { count: h } = await c.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = x(h);
|
|
1320
1320
|
return {
|
|
1321
|
-
refresh_tokens:
|
|
1322
|
-
start:
|
|
1321
|
+
refresh_tokens: _,
|
|
1322
|
+
start: r * n,
|
|
1323
1323
|
limit: n,
|
|
1324
1324
|
length: f
|
|
1325
1325
|
};
|
|
1326
1326
|
};
|
|
1327
1327
|
}
|
|
1328
|
-
function $
|
|
1328
|
+
function $a(t) {
|
|
1329
1329
|
return {
|
|
1330
|
-
create:
|
|
1331
|
-
get:
|
|
1332
|
-
list:
|
|
1333
|
-
remove:
|
|
1334
|
-
update:
|
|
1330
|
+
create: Ta(t),
|
|
1331
|
+
get: xa(t),
|
|
1332
|
+
list: ka(t),
|
|
1333
|
+
remove: Sa(t),
|
|
1334
|
+
update: Oa(t)
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Ia(t) {
|
|
1338
1338
|
return async () => {
|
|
1339
|
-
const e = new Date(Date.now() - 864e5).toISOString(),
|
|
1339
|
+
const e = new Date(Date.now() - 864e5).toISOString(), a = new Date(
|
|
1340
1340
|
Date.now() - 1e3 * 60 * 60 * 24 * 7
|
|
1341
|
-
).toISOString(),
|
|
1341
|
+
).toISOString(), r = new Date(
|
|
1342
1342
|
Date.now() - 1e3 * 60 * 60 * 24 * 30 * 3
|
|
1343
1343
|
).toISOString();
|
|
1344
|
-
console.log("delete codes"), await t.deleteFrom("codes").where("created_at", "<", e).limit(1e5).execute(), console.log("delete sessions"), await t.deleteFrom("login_sessions").where("created_at", "<",
|
|
1344
|
+
console.log("delete codes"), await t.deleteFrom("codes").where("created_at", "<", e).limit(1e5).execute(), console.log("delete sessions"), await t.deleteFrom("login_sessions").where("created_at", "<", a).where("session_id", "is", null).limit(1e5).execute(), console.log("delete logs"), await t.deleteFrom("logs").where("date", "<", r).limit(1e5).execute(), console.log("delete refresh tokens"), await t.deleteFrom("refresh_tokens").where(
|
|
1345
1345
|
(o) => o.or([
|
|
1346
|
-
o("expires_at", "<",
|
|
1347
|
-
o("idle_expires_at", "<",
|
|
1346
|
+
o("expires_at", "<", a),
|
|
1347
|
+
o("idle_expires_at", "<", a)
|
|
1348
1348
|
])
|
|
1349
1349
|
).limit(1e4).execute(), console.log("delete sessions");
|
|
1350
1350
|
const n = await t.selectFrom("sessions").select("id").where(
|
|
1351
1351
|
(o) => o.or([
|
|
1352
|
-
o("expires_at", "<",
|
|
1353
|
-
o("idle_expires_at", "<",
|
|
1352
|
+
o("expires_at", "<", a),
|
|
1353
|
+
o("idle_expires_at", "<", a)
|
|
1354
1354
|
])
|
|
1355
1355
|
).where(
|
|
1356
1356
|
"id",
|
|
@@ -1364,30 +1364,30 @@ function Ir(t) {
|
|
|
1364
1364
|
).execute(), console.log("cleanup complete");
|
|
1365
1365
|
};
|
|
1366
1366
|
}
|
|
1367
|
-
function
|
|
1368
|
-
return async (e,
|
|
1369
|
-
const
|
|
1370
|
-
id:
|
|
1371
|
-
...
|
|
1367
|
+
function Da(t) {
|
|
1368
|
+
return async (e, a) => {
|
|
1369
|
+
const r = G.parse({
|
|
1370
|
+
id: S(),
|
|
1371
|
+
...a,
|
|
1372
1372
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1373
1373
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1374
1374
|
});
|
|
1375
1375
|
return await t.insertInto("forms").values({
|
|
1376
|
-
...
|
|
1376
|
+
...r,
|
|
1377
1377
|
// Store complex objects as JSON strings
|
|
1378
|
-
nodes: JSON.stringify(
|
|
1379
|
-
start: JSON.stringify(
|
|
1380
|
-
ending: JSON.stringify(
|
|
1378
|
+
nodes: JSON.stringify(r.nodes || []),
|
|
1379
|
+
start: JSON.stringify(r.start || {}),
|
|
1380
|
+
ending: JSON.stringify(r.ending || {}),
|
|
1381
1381
|
tenant_id: e
|
|
1382
|
-
}).execute(), G.parse(
|
|
1382
|
+
}).execute(), G.parse(r);
|
|
1383
1383
|
};
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1386
|
-
return async (e,
|
|
1387
|
-
const { page:
|
|
1385
|
+
function Pa(t) {
|
|
1386
|
+
return async (e, a = {}) => {
|
|
1387
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, q: s } = a;
|
|
1388
1388
|
let i = t.selectFrom("forms").where("tenant_id", "=", e);
|
|
1389
1389
|
s && (i = T(t, i, s, []));
|
|
1390
|
-
const
|
|
1390
|
+
const m = (await i.offset(r * n).limit(n).selectAll().execute()).map((h) => {
|
|
1391
1391
|
const f = { ...h };
|
|
1392
1392
|
if (typeof f.nodes == "string")
|
|
1393
1393
|
try {
|
|
@@ -1408,31 +1408,31 @@ function Pr(t) {
|
|
|
1408
1408
|
});
|
|
1409
1409
|
if (!o)
|
|
1410
1410
|
return {
|
|
1411
|
-
forms:
|
|
1411
|
+
forms: m,
|
|
1412
1412
|
start: 0,
|
|
1413
1413
|
limit: 0,
|
|
1414
1414
|
length: 0
|
|
1415
1415
|
};
|
|
1416
|
-
const { count:
|
|
1416
|
+
const { count: _ } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
1417
1417
|
return {
|
|
1418
|
-
forms:
|
|
1419
|
-
start:
|
|
1418
|
+
forms: m,
|
|
1419
|
+
start: r * n,
|
|
1420
1420
|
limit: n,
|
|
1421
|
-
length: x(
|
|
1421
|
+
length: x(_)
|
|
1422
1422
|
};
|
|
1423
1423
|
};
|
|
1424
1424
|
}
|
|
1425
|
-
function
|
|
1426
|
-
return async (e,
|
|
1427
|
-
const { numDeletedRows:
|
|
1428
|
-
return
|
|
1425
|
+
function ja(t) {
|
|
1426
|
+
return async (e, a) => {
|
|
1427
|
+
const { numDeletedRows: r } = await t.deleteFrom("forms").where("id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
|
|
1428
|
+
return r > 0;
|
|
1429
1429
|
};
|
|
1430
1430
|
}
|
|
1431
|
-
function
|
|
1432
|
-
return async (e,
|
|
1433
|
-
const
|
|
1434
|
-
if (!
|
|
1435
|
-
const n = { ...
|
|
1431
|
+
function Fa(t) {
|
|
1432
|
+
return async (e, a) => {
|
|
1433
|
+
const r = await t.selectFrom("forms").selectAll().where("forms.id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
|
|
1434
|
+
if (!r) return null;
|
|
1435
|
+
const n = { ...r };
|
|
1436
1436
|
if (typeof n.nodes == "string")
|
|
1437
1437
|
try {
|
|
1438
1438
|
n.nodes = JSON.parse(n.nodes);
|
|
@@ -1451,106 +1451,106 @@ function Fr(t) {
|
|
|
1451
1451
|
return G.parse(y(n));
|
|
1452
1452
|
};
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1455
|
-
return async (e,
|
|
1454
|
+
function Aa(t) {
|
|
1455
|
+
return async (e, a, r) => {
|
|
1456
1456
|
const n = {
|
|
1457
|
-
...
|
|
1457
|
+
...r,
|
|
1458
1458
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1459
1459
|
};
|
|
1460
|
-
|
|
1461
|
-
const { numUpdatedRows: o } = await t.updateTable("forms").set(n).where("id", "=",
|
|
1460
|
+
r.nodes && (n.nodes = JSON.stringify(r.nodes)), r.start && (n.start = JSON.stringify(r.start)), r.ending && (n.ending = JSON.stringify(r.ending));
|
|
1461
|
+
const { numUpdatedRows: o } = await t.updateTable("forms").set(n).where("id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
|
|
1462
1462
|
return o > 0;
|
|
1463
1463
|
};
|
|
1464
1464
|
}
|
|
1465
|
-
function
|
|
1465
|
+
function Ma(t) {
|
|
1466
1466
|
return {
|
|
1467
|
-
create:
|
|
1468
|
-
get:
|
|
1469
|
-
list:
|
|
1470
|
-
remove:
|
|
1471
|
-
update:
|
|
1467
|
+
create: Da(t),
|
|
1468
|
+
get: Fa(t),
|
|
1469
|
+
list: Pa(t),
|
|
1470
|
+
remove: ja(t),
|
|
1471
|
+
update: Aa(t)
|
|
1472
1472
|
};
|
|
1473
1473
|
}
|
|
1474
|
-
function
|
|
1475
|
-
return async (e,
|
|
1476
|
-
const
|
|
1477
|
-
id:
|
|
1478
|
-
...
|
|
1479
|
-
created_at:
|
|
1480
|
-
updated_at:
|
|
1474
|
+
function za(t) {
|
|
1475
|
+
return async (e, a) => {
|
|
1476
|
+
const r = (/* @__PURE__ */ new Date()).toISOString(), n = {
|
|
1477
|
+
id: S(),
|
|
1478
|
+
...a,
|
|
1479
|
+
created_at: r,
|
|
1480
|
+
updated_at: r
|
|
1481
1481
|
}, o = qe.parse(n), {
|
|
1482
1482
|
verificationKey: s,
|
|
1483
1483
|
scopes: i,
|
|
1484
1484
|
options: c,
|
|
1485
|
-
skip_consent_for_verifiable_first_party_clients:
|
|
1486
|
-
allow_offline_access:
|
|
1487
|
-
...
|
|
1485
|
+
skip_consent_for_verifiable_first_party_clients: u,
|
|
1486
|
+
allow_offline_access: m,
|
|
1487
|
+
..._
|
|
1488
1488
|
} = o, h = {
|
|
1489
|
-
...
|
|
1489
|
+
..._,
|
|
1490
1490
|
tenant_id: e,
|
|
1491
1491
|
scopes: i ? JSON.stringify(i) : "[]",
|
|
1492
1492
|
options: c ? JSON.stringify(c) : "{}",
|
|
1493
|
-
skip_consent_for_verifiable_first_party_clients:
|
|
1494
|
-
allow_offline_access:
|
|
1493
|
+
skip_consent_for_verifiable_first_party_clients: u ? 1 : 0,
|
|
1494
|
+
allow_offline_access: m ? 1 : 0,
|
|
1495
1495
|
verification_key: s,
|
|
1496
|
-
created_at:
|
|
1497
|
-
updated_at:
|
|
1496
|
+
created_at: r,
|
|
1497
|
+
updated_at: r
|
|
1498
1498
|
};
|
|
1499
1499
|
return await t.insertInto("resource_servers").values(h).execute(), y(o);
|
|
1500
1500
|
};
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1503
|
-
return async (e,
|
|
1504
|
-
const
|
|
1505
|
-
if (!
|
|
1506
|
-
const n =
|
|
1502
|
+
function Ja(t) {
|
|
1503
|
+
return async (e, a) => {
|
|
1504
|
+
const r = await t.selectFrom("resource_servers").selectAll().where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
1505
|
+
if (!r) return null;
|
|
1506
|
+
const n = r, {
|
|
1507
1507
|
verification_key: o,
|
|
1508
1508
|
scopes: s,
|
|
1509
1509
|
options: i,
|
|
1510
1510
|
skip_consent_for_verifiable_first_party_clients: c,
|
|
1511
|
-
allow_offline_access:
|
|
1512
|
-
...
|
|
1513
|
-
} = n,
|
|
1514
|
-
...
|
|
1511
|
+
allow_offline_access: u,
|
|
1512
|
+
...m
|
|
1513
|
+
} = n, _ = {
|
|
1514
|
+
...m,
|
|
1515
1515
|
scopes: s ? JSON.parse(s) : [],
|
|
1516
1516
|
options: i ? JSON.parse(i) : {},
|
|
1517
1517
|
skip_consent_for_verifiable_first_party_clients: !!c,
|
|
1518
|
-
allow_offline_access: !!
|
|
1518
|
+
allow_offline_access: !!u,
|
|
1519
1519
|
// Convert verification_key back to verificationKey for API
|
|
1520
1520
|
verificationKey: o
|
|
1521
1521
|
};
|
|
1522
|
-
return y(
|
|
1522
|
+
return y(_);
|
|
1523
1523
|
};
|
|
1524
1524
|
}
|
|
1525
|
-
function
|
|
1526
|
-
return async (e,
|
|
1527
|
-
const { page:
|
|
1525
|
+
function La(t) {
|
|
1526
|
+
return async (e, a = {}) => {
|
|
1527
|
+
const { page: r = 0, per_page: n = 50, include_totals: o = !1, q: s } = a;
|
|
1528
1528
|
let i = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
|
|
1529
1529
|
if (s) {
|
|
1530
1530
|
const h = s.trim(), f = h.split(/\s+/), g = f.length === 1 ? f[0] : void 0, w = g ? g.match(/^(-)?(name|identifier):(.*)$/) : null, b = w ? w[3] : "", D = /^(>=|>|<=|<)/.test(b || "");
|
|
1531
1531
|
if (w && !D) {
|
|
1532
|
-
const
|
|
1533
|
-
i =
|
|
1532
|
+
const A = !!w[1], P = w[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
|
|
1533
|
+
i = A ? i.where(P, "not like", `%${b}%`) : i.where(P, "like", `%${b}%`);
|
|
1534
1534
|
} else
|
|
1535
1535
|
i = T(t, i, h, [
|
|
1536
1536
|
"resource_servers.name",
|
|
1537
1537
|
"resource_servers.identifier"
|
|
1538
1538
|
]);
|
|
1539
1539
|
}
|
|
1540
|
-
const
|
|
1540
|
+
const m = (await i.offset(r * n).limit(n).selectAll().execute()).map((h) => {
|
|
1541
1541
|
const f = h, {
|
|
1542
1542
|
verification_key: g,
|
|
1543
1543
|
scopes: w,
|
|
1544
1544
|
options: b,
|
|
1545
1545
|
skip_consent_for_verifiable_first_party_clients: D,
|
|
1546
|
-
allow_offline_access:
|
|
1546
|
+
allow_offline_access: A,
|
|
1547
1547
|
...P
|
|
1548
1548
|
} = f, V = {
|
|
1549
1549
|
...P,
|
|
1550
1550
|
scopes: w ? JSON.parse(w) : [],
|
|
1551
1551
|
options: b ? JSON.parse(b) : {},
|
|
1552
1552
|
skip_consent_for_verifiable_first_party_clients: !!D,
|
|
1553
|
-
allow_offline_access: !!
|
|
1553
|
+
allow_offline_access: !!A,
|
|
1554
1554
|
// Convert verification_key back to verificationKey for API
|
|
1555
1555
|
verificationKey: g
|
|
1556
1556
|
};
|
|
@@ -1558,84 +1558,84 @@ function Er(t) {
|
|
|
1558
1558
|
});
|
|
1559
1559
|
if (!o)
|
|
1560
1560
|
return {
|
|
1561
|
-
resource_servers:
|
|
1561
|
+
resource_servers: m,
|
|
1562
1562
|
start: 0,
|
|
1563
1563
|
limit: 0,
|
|
1564
1564
|
length: 0
|
|
1565
1565
|
};
|
|
1566
|
-
const { count:
|
|
1566
|
+
const { count: _ } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
1567
1567
|
return {
|
|
1568
|
-
resource_servers:
|
|
1569
|
-
start:
|
|
1568
|
+
resource_servers: m,
|
|
1569
|
+
start: r * n,
|
|
1570
1570
|
limit: n,
|
|
1571
|
-
length: x(
|
|
1571
|
+
length: x(_)
|
|
1572
1572
|
};
|
|
1573
1573
|
};
|
|
1574
1574
|
}
|
|
1575
|
-
function
|
|
1576
|
-
return async (e,
|
|
1577
|
-
const
|
|
1578
|
-
return Number(
|
|
1575
|
+
function Ea(t) {
|
|
1576
|
+
return async (e, a) => {
|
|
1577
|
+
const r = await t.deleteFrom("resource_servers").where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
1578
|
+
return Number(r.numDeletedRows) > 0;
|
|
1579
1579
|
};
|
|
1580
1580
|
}
|
|
1581
|
-
function
|
|
1582
|
-
return async (e,
|
|
1581
|
+
function Ra(t) {
|
|
1582
|
+
return async (e, a, r) => {
|
|
1583
1583
|
const {
|
|
1584
1584
|
verificationKey: n,
|
|
1585
1585
|
scopes: o,
|
|
1586
1586
|
options: s,
|
|
1587
1587
|
skip_consent_for_verifiable_first_party_clients: i,
|
|
1588
1588
|
allow_offline_access: c,
|
|
1589
|
-
...
|
|
1590
|
-
} =
|
|
1591
|
-
...
|
|
1589
|
+
...u
|
|
1590
|
+
} = r, m = {
|
|
1591
|
+
...u,
|
|
1592
1592
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1593
1593
|
};
|
|
1594
|
-
n !== void 0 && (
|
|
1595
|
-
const
|
|
1596
|
-
return Number(
|
|
1594
|
+
n !== void 0 && (m.verification_key = n), o !== void 0 && (m.scopes = JSON.stringify(o)), s !== void 0 && (m.options = JSON.stringify(s)), i !== void 0 && (m.skip_consent_for_verifiable_first_party_clients = i ? 1 : 0), c !== void 0 && (m.allow_offline_access = c ? 1 : 0);
|
|
1595
|
+
const _ = await t.updateTable("resource_servers").set(m).where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
1596
|
+
return Number(_.numUpdatedRows) > 0;
|
|
1597
1597
|
};
|
|
1598
1598
|
}
|
|
1599
|
-
function
|
|
1599
|
+
function Ka(t) {
|
|
1600
1600
|
return {
|
|
1601
|
-
create:
|
|
1602
|
-
get:
|
|
1603
|
-
list:
|
|
1604
|
-
remove:
|
|
1605
|
-
update:
|
|
1601
|
+
create: za(t),
|
|
1602
|
+
get: Ja(t),
|
|
1603
|
+
list: La(t),
|
|
1604
|
+
remove: Ea(t),
|
|
1605
|
+
update: Ra(t)
|
|
1606
1606
|
};
|
|
1607
1607
|
}
|
|
1608
|
-
function
|
|
1609
|
-
return async (e,
|
|
1610
|
-
const
|
|
1608
|
+
function Ua(t) {
|
|
1609
|
+
return async (e, a) => {
|
|
1610
|
+
const r = (/* @__PURE__ */ new Date()).toISOString(), n = S(), o = {
|
|
1611
1611
|
id: n,
|
|
1612
|
-
...
|
|
1612
|
+
...a,
|
|
1613
1613
|
tenant_id: e,
|
|
1614
|
-
created_at:
|
|
1615
|
-
updated_at:
|
|
1614
|
+
created_at: r,
|
|
1615
|
+
updated_at: r
|
|
1616
1616
|
};
|
|
1617
1617
|
return await t.insertInto("roles").values(o).execute(), {
|
|
1618
1618
|
id: n,
|
|
1619
|
-
...
|
|
1620
|
-
created_at:
|
|
1621
|
-
updated_at:
|
|
1619
|
+
...a,
|
|
1620
|
+
created_at: r,
|
|
1621
|
+
updated_at: r
|
|
1622
1622
|
};
|
|
1623
1623
|
};
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1626
|
-
return async (e,
|
|
1627
|
-
const
|
|
1628
|
-
return
|
|
1629
|
-
...
|
|
1625
|
+
function Ba(t) {
|
|
1626
|
+
return async (e, a) => {
|
|
1627
|
+
const r = await t.selectFrom("roles").selectAll().where("roles.tenant_id", "=", e).where("roles.id", "=", a).executeTakeFirst();
|
|
1628
|
+
return r ? {
|
|
1629
|
+
...r
|
|
1630
1630
|
} : null;
|
|
1631
1631
|
};
|
|
1632
1632
|
}
|
|
1633
|
-
function
|
|
1634
|
-
return async (e,
|
|
1635
|
-
let
|
|
1636
|
-
const { page: n = 0, per_page: o = 50, include_totals: s = !1 } =
|
|
1637
|
-
|
|
1638
|
-
const c = await
|
|
1633
|
+
function Qa(t) {
|
|
1634
|
+
return async (e, a) => {
|
|
1635
|
+
let r = t.selectFrom("roles").where("roles.tenant_id", "=", e);
|
|
1636
|
+
const { page: n = 0, per_page: o = 50, include_totals: s = !1 } = a;
|
|
1637
|
+
a.q && (r = T(t, r, a.q, ["name"]));
|
|
1638
|
+
const c = await r.offset(n * o).limit(o).selectAll().execute();
|
|
1639
1639
|
if (!s)
|
|
1640
1640
|
return {
|
|
1641
1641
|
roles: c,
|
|
@@ -1643,48 +1643,48 @@ function Qr(t) {
|
|
|
1643
1643
|
limit: o,
|
|
1644
1644
|
length: c.length
|
|
1645
1645
|
};
|
|
1646
|
-
const { count:
|
|
1646
|
+
const { count: u } = await r.select((m) => m.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
1647
1647
|
return {
|
|
1648
1648
|
roles: c,
|
|
1649
1649
|
start: n * o,
|
|
1650
1650
|
limit: o,
|
|
1651
|
-
length: x(
|
|
1651
|
+
length: x(u)
|
|
1652
1652
|
};
|
|
1653
1653
|
};
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1656
|
-
return async (e,
|
|
1655
|
+
function qa(t) {
|
|
1656
|
+
return async (e, a, r) => {
|
|
1657
1657
|
const n = {
|
|
1658
|
-
...
|
|
1658
|
+
...r,
|
|
1659
1659
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1660
|
-
}, o = await t.updateTable("roles").set(n).where("roles.tenant_id", "=", e).where("roles.id", "=",
|
|
1660
|
+
}, o = await t.updateTable("roles").set(n).where("roles.tenant_id", "=", e).where("roles.id", "=", a).executeTakeFirst();
|
|
1661
1661
|
return Number(o.numUpdatedRows) > 0;
|
|
1662
1662
|
};
|
|
1663
1663
|
}
|
|
1664
|
-
function
|
|
1665
|
-
return async (e,
|
|
1666
|
-
const
|
|
1667
|
-
return Number(
|
|
1664
|
+
function Va(t) {
|
|
1665
|
+
return async (e, a) => {
|
|
1666
|
+
const r = await t.deleteFrom("roles").where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
1667
|
+
return Number(r.numDeletedRows) > 0;
|
|
1668
1668
|
};
|
|
1669
1669
|
}
|
|
1670
|
-
function
|
|
1670
|
+
function Wa(t) {
|
|
1671
1671
|
return {
|
|
1672
|
-
create:
|
|
1673
|
-
get:
|
|
1674
|
-
list:
|
|
1675
|
-
update:
|
|
1676
|
-
remove:
|
|
1672
|
+
create: Ua(t),
|
|
1673
|
+
get: Ba(t),
|
|
1674
|
+
list: Qa(t),
|
|
1675
|
+
update: qa(t),
|
|
1676
|
+
remove: Va(t)
|
|
1677
1677
|
};
|
|
1678
1678
|
}
|
|
1679
|
-
function
|
|
1680
|
-
return async (e,
|
|
1681
|
-
if (
|
|
1679
|
+
function Ga(t) {
|
|
1680
|
+
return async (e, a, r) => {
|
|
1681
|
+
if (r.length === 0) return !0;
|
|
1682
1682
|
const n = (/* @__PURE__ */ new Date()).toISOString();
|
|
1683
1683
|
try {
|
|
1684
|
-
for (const o of
|
|
1685
|
-
if (o.role_id !==
|
|
1684
|
+
for (const o of r) {
|
|
1685
|
+
if (o.role_id !== a)
|
|
1686
1686
|
throw new Error(
|
|
1687
|
-
`Permission role_id ${o.role_id} does not match expected role_id ${
|
|
1687
|
+
`Permission role_id ${o.role_id} does not match expected role_id ${a}`
|
|
1688
1688
|
);
|
|
1689
1689
|
const s = {
|
|
1690
1690
|
tenant_id: e,
|
|
@@ -1707,13 +1707,13 @@ function Gr(t) {
|
|
|
1707
1707
|
}
|
|
1708
1708
|
};
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
return async (e,
|
|
1712
|
-
if (
|
|
1710
|
+
function Ha(t) {
|
|
1711
|
+
return async (e, a, r) => {
|
|
1712
|
+
if (r.length === 0) return !0;
|
|
1713
1713
|
try {
|
|
1714
1714
|
return (await Promise.all(
|
|
1715
|
-
|
|
1716
|
-
(o) => t.deleteFrom("role_permissions").where("tenant_id", "=", e).where("role_id", "=",
|
|
1715
|
+
r.map(
|
|
1716
|
+
(o) => t.deleteFrom("role_permissions").where("tenant_id", "=", e).where("role_id", "=", a).where(
|
|
1717
1717
|
"resource_server_identifier",
|
|
1718
1718
|
"=",
|
|
1719
1719
|
o.resource_server_identifier
|
|
@@ -1725,12 +1725,12 @@ function Hr(t) {
|
|
|
1725
1725
|
}
|
|
1726
1726
|
};
|
|
1727
1727
|
}
|
|
1728
|
-
function
|
|
1729
|
-
return async (e,
|
|
1730
|
-
const { page: n = 0, per_page: o = 50, include_totals: s = !1 } =
|
|
1728
|
+
function Ya(t) {
|
|
1729
|
+
return async (e, a, r = {}) => {
|
|
1730
|
+
const { page: n = 0, per_page: o = 50, include_totals: s = !1 } = r;
|
|
1731
1731
|
let i = t.selectFrom("role_permissions").leftJoin(
|
|
1732
1732
|
"resource_servers",
|
|
1733
|
-
(
|
|
1733
|
+
(_) => _.onRef(
|
|
1734
1734
|
"role_permissions.tenant_id",
|
|
1735
1735
|
"=",
|
|
1736
1736
|
"resource_servers.tenant_id"
|
|
@@ -1745,36 +1745,36 @@ function Yr(t) {
|
|
|
1745
1745
|
"role_permissions.permission_name",
|
|
1746
1746
|
"role_permissions.created_at",
|
|
1747
1747
|
"resource_servers.name as resource_server_name"
|
|
1748
|
-
]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=",
|
|
1749
|
-
const
|
|
1750
|
-
role_id:
|
|
1751
|
-
resource_server_identifier:
|
|
1752
|
-
resource_server_name:
|
|
1748
|
+
]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=", a);
|
|
1749
|
+
const m = (await i.offset(n * o).limit(o).execute()).map((_) => ({
|
|
1750
|
+
role_id: _.role_id,
|
|
1751
|
+
resource_server_identifier: _.resource_server_identifier,
|
|
1752
|
+
resource_server_name: _.resource_server_name || _.resource_server_identifier,
|
|
1753
1753
|
// Fallback to identifier if name is null
|
|
1754
|
-
permission_name:
|
|
1754
|
+
permission_name: _.permission_name,
|
|
1755
1755
|
description: null,
|
|
1756
1756
|
// No description available from role_permissions directly
|
|
1757
|
-
created_at:
|
|
1757
|
+
created_at: _.created_at
|
|
1758
1758
|
}));
|
|
1759
|
-
return s && await i.select((
|
|
1759
|
+
return s && await i.select((_) => _.fn.countAll().as("count")).executeTakeFirstOrThrow(), m;
|
|
1760
1760
|
};
|
|
1761
1761
|
}
|
|
1762
|
-
function
|
|
1762
|
+
function Xa(t) {
|
|
1763
1763
|
return {
|
|
1764
|
-
assign:
|
|
1765
|
-
remove:
|
|
1766
|
-
list:
|
|
1764
|
+
assign: Ga(t),
|
|
1765
|
+
remove: Ha(t),
|
|
1766
|
+
list: Ya(t)
|
|
1767
1767
|
};
|
|
1768
1768
|
}
|
|
1769
|
-
function
|
|
1770
|
-
return async (e,
|
|
1771
|
-
if (
|
|
1769
|
+
function Za(t) {
|
|
1770
|
+
return async (e, a, r) => {
|
|
1771
|
+
if (r.length === 0) return !0;
|
|
1772
1772
|
const n = (/* @__PURE__ */ new Date()).toISOString();
|
|
1773
1773
|
try {
|
|
1774
|
-
for (const o of
|
|
1774
|
+
for (const o of r) {
|
|
1775
1775
|
const s = {
|
|
1776
1776
|
tenant_id: e,
|
|
1777
|
-
user_id:
|
|
1777
|
+
user_id: a,
|
|
1778
1778
|
resource_server_identifier: o.resource_server_identifier,
|
|
1779
1779
|
permission_name: o.permission_name,
|
|
1780
1780
|
created_at: n
|
|
@@ -1793,12 +1793,12 @@ function Zr(t) {
|
|
|
1793
1793
|
}
|
|
1794
1794
|
};
|
|
1795
1795
|
}
|
|
1796
|
-
function
|
|
1797
|
-
return async (e,
|
|
1798
|
-
if (
|
|
1796
|
+
function er(t) {
|
|
1797
|
+
return async (e, a, r) => {
|
|
1798
|
+
if (r.length === 0) return !0;
|
|
1799
1799
|
try {
|
|
1800
|
-
for (const n of
|
|
1801
|
-
await t.deleteFrom("user_permissions").where("tenant_id", "=", e).where("user_id", "=",
|
|
1800
|
+
for (const n of r)
|
|
1801
|
+
await t.deleteFrom("user_permissions").where("tenant_id", "=", e).where("user_id", "=", a).where(
|
|
1802
1802
|
"resource_server_identifier",
|
|
1803
1803
|
"=",
|
|
1804
1804
|
n.resource_server_identifier
|
|
@@ -1809,8 +1809,8 @@ function ea(t) {
|
|
|
1809
1809
|
}
|
|
1810
1810
|
};
|
|
1811
1811
|
}
|
|
1812
|
-
function
|
|
1813
|
-
return async (e,
|
|
1812
|
+
function tr(t) {
|
|
1813
|
+
return async (e, a, r) => (await t.selectFrom("user_permissions").leftJoin(
|
|
1814
1814
|
"resource_servers",
|
|
1815
1815
|
(o) => o.onRef(
|
|
1816
1816
|
"user_permissions.tenant_id",
|
|
@@ -1827,7 +1827,7 @@ function ta(t) {
|
|
|
1827
1827
|
"resource_servers.name as resource_server_name",
|
|
1828
1828
|
"user_permissions.user_id",
|
|
1829
1829
|
"user_permissions.created_at"
|
|
1830
|
-
]).where("user_permissions.tenant_id", "=", e).where("user_permissions.user_id", "=",
|
|
1830
|
+
]).where("user_permissions.tenant_id", "=", e).where("user_permissions.user_id", "=", a).execute()).map((o) => ({
|
|
1831
1831
|
resource_server_identifier: o.resource_server_identifier,
|
|
1832
1832
|
permission_name: o.permission_name,
|
|
1833
1833
|
description: null,
|
|
@@ -1838,15 +1838,15 @@ function ta(t) {
|
|
|
1838
1838
|
created_at: o.created_at
|
|
1839
1839
|
}));
|
|
1840
1840
|
}
|
|
1841
|
-
function
|
|
1841
|
+
function ar(t) {
|
|
1842
1842
|
return {
|
|
1843
|
-
assign:
|
|
1844
|
-
remove:
|
|
1845
|
-
list:
|
|
1843
|
+
assign: Za(t),
|
|
1844
|
+
remove: er(t),
|
|
1845
|
+
list: tr(t)
|
|
1846
1846
|
};
|
|
1847
1847
|
}
|
|
1848
|
-
function
|
|
1849
|
-
return async (e,
|
|
1848
|
+
function rr(t) {
|
|
1849
|
+
return async (e, a) => await t.selectFrom("user_roles as ur").innerJoin(
|
|
1850
1850
|
"roles as r",
|
|
1851
1851
|
(n) => n.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
|
|
1852
1852
|
).select([
|
|
@@ -1855,16 +1855,16 @@ function aa(t) {
|
|
|
1855
1855
|
"r.description",
|
|
1856
1856
|
"r.created_at",
|
|
1857
1857
|
"r.updated_at"
|
|
1858
|
-
]).where("ur.tenant_id", "=", e).where("ur.user_id", "=",
|
|
1858
|
+
]).where("ur.tenant_id", "=", e).where("ur.user_id", "=", a).execute();
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1861
|
-
return async (e,
|
|
1862
|
-
if (
|
|
1860
|
+
function nr(t) {
|
|
1861
|
+
return async (e, a, r) => {
|
|
1862
|
+
if (r.length === 0) return !0;
|
|
1863
1863
|
const n = (/* @__PURE__ */ new Date()).toISOString();
|
|
1864
1864
|
try {
|
|
1865
|
-
for (const o of
|
|
1865
|
+
for (const o of r)
|
|
1866
1866
|
try {
|
|
1867
|
-
await t.insertInto("user_roles").values({ tenant_id: e, user_id:
|
|
1867
|
+
await t.insertInto("user_roles").values({ tenant_id: e, user_id: a, role_id: o, created_at: n }).execute();
|
|
1868
1868
|
} catch (s) {
|
|
1869
1869
|
if (s.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || s.code === "SQLITE_CONSTRAINT_UNIQUE")
|
|
1870
1870
|
continue;
|
|
@@ -1876,39 +1876,126 @@ function na(t) {
|
|
|
1876
1876
|
}
|
|
1877
1877
|
};
|
|
1878
1878
|
}
|
|
1879
|
-
function
|
|
1880
|
-
return async (e,
|
|
1879
|
+
function or(t) {
|
|
1880
|
+
return async (e, a, r) => {
|
|
1881
1881
|
try {
|
|
1882
|
-
return
|
|
1882
|
+
return r.length && await t.deleteFrom("user_roles").where("tenant_id", "=", e).where("user_id", "=", a).where((n) => n("role_id", "in", r)).execute(), !0;
|
|
1883
1883
|
} catch (n) {
|
|
1884
1884
|
return console.error("Error removing user roles:", n), !1;
|
|
1885
1885
|
}
|
|
1886
1886
|
};
|
|
1887
1887
|
}
|
|
1888
|
-
function
|
|
1888
|
+
function sr(t) {
|
|
1889
1889
|
return {
|
|
1890
|
-
list:
|
|
1891
|
-
assign:
|
|
1892
|
-
remove:
|
|
1890
|
+
list: rr(t),
|
|
1891
|
+
assign: nr(t),
|
|
1892
|
+
remove: or(t)
|
|
1893
1893
|
};
|
|
1894
1894
|
}
|
|
1895
|
-
function
|
|
1896
|
-
return
|
|
1895
|
+
function ir(t) {
|
|
1896
|
+
return async (e, a) => {
|
|
1897
|
+
const r = {
|
|
1898
|
+
...a,
|
|
1899
|
+
id: a.id || S(),
|
|
1900
|
+
tenant_id: e,
|
|
1901
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1902
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1903
|
+
branding: JSON.stringify(a.branding || {}),
|
|
1904
|
+
metadata: JSON.stringify(a.metadata || {}),
|
|
1905
|
+
enabled_connections: JSON.stringify(
|
|
1906
|
+
a.enabled_connections || []
|
|
1907
|
+
),
|
|
1908
|
+
token_quota: JSON.stringify(a.token_quota || {})
|
|
1909
|
+
};
|
|
1910
|
+
try {
|
|
1911
|
+
await t.insertInto("organizations").values(r).execute();
|
|
1912
|
+
} catch (n) {
|
|
1913
|
+
throw n.code === "SQLITE_CONSTRAINT_UNIQUE" || n.message.includes("AlreadyExists") ? new H(409, {
|
|
1914
|
+
message: "Organization already exists"
|
|
1915
|
+
}) : n;
|
|
1916
|
+
}
|
|
1917
|
+
return {
|
|
1918
|
+
...a,
|
|
1919
|
+
id: r.id,
|
|
1920
|
+
created_at: r.created_at,
|
|
1921
|
+
updated_at: r.updated_at
|
|
1922
|
+
};
|
|
1923
|
+
};
|
|
1897
1924
|
}
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1925
|
+
function lr(t) {
|
|
1926
|
+
return async (e, a) => {
|
|
1927
|
+
const r = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
1928
|
+
return r ? y({
|
|
1929
|
+
...r,
|
|
1930
|
+
branding: r.branding ? JSON.parse(r.branding) : {},
|
|
1931
|
+
metadata: r.metadata ? JSON.parse(r.metadata) : {},
|
|
1932
|
+
enabled_connections: r.enabled_connections ? JSON.parse(r.enabled_connections) : [],
|
|
1933
|
+
token_quota: r.token_quota ? JSON.parse(r.token_quota) : {}
|
|
1934
|
+
}) : null;
|
|
1935
|
+
};
|
|
1900
1936
|
}
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1937
|
+
function cr(t) {
|
|
1938
|
+
return async (e, a) => {
|
|
1939
|
+
let r = t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).orderBy("created_at", "desc");
|
|
1940
|
+
if (a != null && a.per_page && (r = r.limit(a.per_page)), a != null && a.page) {
|
|
1941
|
+
const s = (a.page - 1) * (a.per_page || 10);
|
|
1942
|
+
r = r.offset(s);
|
|
1943
|
+
}
|
|
1944
|
+
const o = (await r.execute()).map(
|
|
1945
|
+
(s) => y({
|
|
1946
|
+
...s,
|
|
1947
|
+
branding: s.branding ? JSON.parse(s.branding) : {},
|
|
1948
|
+
metadata: s.metadata ? JSON.parse(s.metadata) : {},
|
|
1949
|
+
enabled_connections: s.enabled_connections ? JSON.parse(s.enabled_connections) : [],
|
|
1950
|
+
token_quota: s.token_quota ? JSON.parse(s.token_quota) : {}
|
|
1951
|
+
})
|
|
1952
|
+
);
|
|
1953
|
+
return {
|
|
1954
|
+
organizations: o,
|
|
1955
|
+
start: a != null && a.page ? (a.page - 1) * (a.per_page || 10) : 0,
|
|
1956
|
+
limit: (a == null ? void 0 : a.per_page) || o.length,
|
|
1957
|
+
length: o.length
|
|
1958
|
+
};
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1961
|
+
function dr(t) {
|
|
1962
|
+
return async (e, a) => (await t.deleteFrom("organizations").where("tenant_id", "=", e).where("id", "=", a).execute()).length > 0;
|
|
1963
|
+
}
|
|
1964
|
+
function ur(t) {
|
|
1965
|
+
return async (e, a, r) => {
|
|
1966
|
+
const { branding: n, metadata: o, enabled_connections: s, token_quota: i, ...c } = r, u = {
|
|
1967
|
+
...c,
|
|
1968
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1969
|
+
};
|
|
1970
|
+
return n !== void 0 && (u.branding = JSON.stringify(n)), o !== void 0 && (u.metadata = JSON.stringify(o)), s !== void 0 && (u.enabled_connections = JSON.stringify(s)), i !== void 0 && (u.token_quota = JSON.stringify(i)), (await t.updateTable("organizations").set(u).where("tenant_id", "=", e).where("id", "=", a).execute()).length > 0;
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
function mr(t) {
|
|
1974
|
+
return {
|
|
1975
|
+
create: ir(t),
|
|
1976
|
+
get: lr(t),
|
|
1977
|
+
list: cr(t),
|
|
1978
|
+
remove: dr(t),
|
|
1979
|
+
update: ur(t)
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
function _r(t) {
|
|
1983
|
+
return t[t.length - 1];
|
|
1984
|
+
}
|
|
1985
|
+
function C(t) {
|
|
1986
|
+
return Object.freeze(t);
|
|
1987
|
+
}
|
|
1988
|
+
const W = C({
|
|
1989
|
+
is(t) {
|
|
1990
|
+
return t.kind === "IdentifierNode";
|
|
1991
|
+
},
|
|
1992
|
+
create(t) {
|
|
1906
1993
|
return C({
|
|
1907
1994
|
kind: "IdentifierNode",
|
|
1908
1995
|
name: t
|
|
1909
1996
|
});
|
|
1910
1997
|
}
|
|
1911
|
-
}),
|
|
1998
|
+
}), ae = C({
|
|
1912
1999
|
is(t) {
|
|
1913
2000
|
return t.kind === "SchemableIdentifierNode";
|
|
1914
2001
|
},
|
|
@@ -1925,7 +2012,7 @@ const W = C({
|
|
|
1925
2012
|
identifier: W.create(e)
|
|
1926
2013
|
});
|
|
1927
2014
|
}
|
|
1928
|
-
}),
|
|
2015
|
+
}), hr = C({
|
|
1929
2016
|
is(t) {
|
|
1930
2017
|
return t.kind === "AliasNode";
|
|
1931
2018
|
},
|
|
@@ -1936,28 +2023,28 @@ const W = C({
|
|
|
1936
2023
|
alias: e
|
|
1937
2024
|
});
|
|
1938
2025
|
}
|
|
1939
|
-
}),
|
|
2026
|
+
}), Z = C({
|
|
1940
2027
|
is(t) {
|
|
1941
2028
|
return t.kind === "TableNode";
|
|
1942
2029
|
},
|
|
1943
2030
|
create(t) {
|
|
1944
2031
|
return C({
|
|
1945
2032
|
kind: "TableNode",
|
|
1946
|
-
table:
|
|
2033
|
+
table: ae.create(t)
|
|
1947
2034
|
});
|
|
1948
2035
|
},
|
|
1949
2036
|
createWithSchema(t, e) {
|
|
1950
2037
|
return C({
|
|
1951
2038
|
kind: "TableNode",
|
|
1952
|
-
table:
|
|
2039
|
+
table: ae.createWithSchema(t, e)
|
|
1953
2040
|
});
|
|
1954
2041
|
}
|
|
1955
2042
|
});
|
|
1956
|
-
var
|
|
1957
|
-
class
|
|
2043
|
+
var Y;
|
|
2044
|
+
class fr {
|
|
1958
2045
|
constructor() {
|
|
1959
2046
|
R(this, "nodeStack", []);
|
|
1960
|
-
|
|
2047
|
+
O(this, Y, C({
|
|
1961
2048
|
AliasNode: this.transformAlias.bind(this),
|
|
1962
2049
|
ColumnNode: this.transformColumn.bind(this),
|
|
1963
2050
|
IdentifierNode: this.transformIdentifier.bind(this),
|
|
@@ -2057,14 +2144,14 @@ class ca {
|
|
|
2057
2144
|
if (!e)
|
|
2058
2145
|
return e;
|
|
2059
2146
|
this.nodeStack.push(e);
|
|
2060
|
-
const
|
|
2061
|
-
return this.nodeStack.pop(), C(
|
|
2147
|
+
const a = this.transformNodeImpl(e);
|
|
2148
|
+
return this.nodeStack.pop(), C(a);
|
|
2062
2149
|
}
|
|
2063
2150
|
transformNodeImpl(e) {
|
|
2064
|
-
return d(this,
|
|
2151
|
+
return d(this, Y)[e.kind](e);
|
|
2065
2152
|
}
|
|
2066
2153
|
transformNodeList(e) {
|
|
2067
|
-
return e && C(e.map((
|
|
2154
|
+
return e && C(e.map((a) => this.transformNode(a)));
|
|
2068
2155
|
}
|
|
2069
2156
|
transformSelectQuery(e) {
|
|
2070
2157
|
return {
|
|
@@ -2787,8 +2874,8 @@ class ca {
|
|
|
2787
2874
|
return e;
|
|
2788
2875
|
}
|
|
2789
2876
|
}
|
|
2790
|
-
|
|
2791
|
-
const
|
|
2877
|
+
Y = new WeakMap();
|
|
2878
|
+
const pr = C({
|
|
2792
2879
|
AlterTableNode: !0,
|
|
2793
2880
|
CreateIndexNode: !0,
|
|
2794
2881
|
CreateSchemaNode: !0,
|
|
@@ -2807,78 +2894,78 @@ const da = C({
|
|
|
2807
2894
|
UpdateQueryNode: !0,
|
|
2808
2895
|
MergeQueryNode: !0
|
|
2809
2896
|
});
|
|
2810
|
-
var
|
|
2811
|
-
class
|
|
2812
|
-
constructor(
|
|
2897
|
+
var L, j, F, N, ye, ve, Ne, M, re, Ce;
|
|
2898
|
+
class gr extends fr {
|
|
2899
|
+
constructor(a) {
|
|
2813
2900
|
super();
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
K(this,
|
|
2819
|
-
}
|
|
2820
|
-
transformNodeImpl(
|
|
2821
|
-
if (!p(this, N, ye).call(this,
|
|
2822
|
-
return super.transformNodeImpl(
|
|
2823
|
-
const
|
|
2824
|
-
for (const s of
|
|
2901
|
+
O(this, N);
|
|
2902
|
+
O(this, L);
|
|
2903
|
+
O(this, j, /* @__PURE__ */ new Set());
|
|
2904
|
+
O(this, F, /* @__PURE__ */ new Set());
|
|
2905
|
+
K(this, L, a);
|
|
2906
|
+
}
|
|
2907
|
+
transformNodeImpl(a) {
|
|
2908
|
+
if (!p(this, N, ye).call(this, a))
|
|
2909
|
+
return super.transformNodeImpl(a);
|
|
2910
|
+
const r = p(this, N, Ne).call(this, a);
|
|
2911
|
+
for (const s of r)
|
|
2825
2912
|
d(this, F).add(s);
|
|
2826
|
-
const n = p(this, N, ve).call(this,
|
|
2913
|
+
const n = p(this, N, ve).call(this, a);
|
|
2827
2914
|
for (const s of n)
|
|
2828
2915
|
d(this, j).add(s);
|
|
2829
|
-
const o = super.transformNodeImpl(
|
|
2916
|
+
const o = super.transformNodeImpl(a);
|
|
2830
2917
|
for (const s of n)
|
|
2831
2918
|
d(this, j).delete(s);
|
|
2832
|
-
for (const s of
|
|
2919
|
+
for (const s of r)
|
|
2833
2920
|
d(this, F).delete(s);
|
|
2834
2921
|
return o;
|
|
2835
2922
|
}
|
|
2836
|
-
transformSchemableIdentifier(
|
|
2837
|
-
const
|
|
2838
|
-
return
|
|
2839
|
-
...
|
|
2840
|
-
schema: W.create(d(this,
|
|
2923
|
+
transformSchemableIdentifier(a) {
|
|
2924
|
+
const r = super.transformSchemableIdentifier(a);
|
|
2925
|
+
return r.schema || !d(this, j).has(a.identifier.name) ? r : {
|
|
2926
|
+
...r,
|
|
2927
|
+
schema: W.create(d(this, L))
|
|
2841
2928
|
};
|
|
2842
2929
|
}
|
|
2843
|
-
transformReferences(
|
|
2844
|
-
const
|
|
2845
|
-
return
|
|
2846
|
-
...
|
|
2847
|
-
table:
|
|
2848
|
-
};
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
|
|
2852
|
-
return
|
|
2853
|
-
}, ve = function(
|
|
2854
|
-
const
|
|
2855
|
-
if ("name" in
|
|
2856
|
-
for (const n of
|
|
2857
|
-
p(this, N,
|
|
2858
|
-
if ("into" in
|
|
2859
|
-
for (const n of
|
|
2860
|
-
p(this, N,
|
|
2861
|
-
return "using" in
|
|
2862
|
-
}, Ne = function(
|
|
2863
|
-
const
|
|
2864
|
-
return "with" in
|
|
2865
|
-
},
|
|
2866
|
-
const n =
|
|
2867
|
-
n && p(this, N,
|
|
2868
|
-
},
|
|
2869
|
-
const n =
|
|
2870
|
-
!d(this, j).has(n) && !d(this, F).has(n) &&
|
|
2871
|
-
}, Ce = function(
|
|
2872
|
-
for (const n of
|
|
2930
|
+
transformReferences(a) {
|
|
2931
|
+
const r = super.transformReferences(a);
|
|
2932
|
+
return r.table.table.schema ? r : {
|
|
2933
|
+
...r,
|
|
2934
|
+
table: Z.createWithSchema(d(this, L), r.table.table.identifier.name)
|
|
2935
|
+
};
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
L = new WeakMap(), j = new WeakMap(), F = new WeakMap(), N = new WeakSet(), ye = function(a) {
|
|
2939
|
+
return a.kind in pr;
|
|
2940
|
+
}, ve = function(a) {
|
|
2941
|
+
const r = /* @__PURE__ */ new Set();
|
|
2942
|
+
if ("name" in a && a.name && ae.is(a.name) && p(this, N, re).call(this, a.name, r), "from" in a && a.from)
|
|
2943
|
+
for (const n of a.from.froms)
|
|
2944
|
+
p(this, N, M).call(this, n, r);
|
|
2945
|
+
if ("into" in a && a.into && p(this, N, M).call(this, a.into, r), "table" in a && a.table && p(this, N, M).call(this, a.table, r), "joins" in a && a.joins)
|
|
2946
|
+
for (const n of a.joins)
|
|
2947
|
+
p(this, N, M).call(this, n.table, r);
|
|
2948
|
+
return "using" in a && a.using && p(this, N, M).call(this, a.using, r), r;
|
|
2949
|
+
}, Ne = function(a) {
|
|
2950
|
+
const r = /* @__PURE__ */ new Set();
|
|
2951
|
+
return "with" in a && a.with && p(this, N, Ce).call(this, a.with, r), r;
|
|
2952
|
+
}, M = function(a, r) {
|
|
2953
|
+
const n = Z.is(a) ? a : hr.is(a) && Z.is(a.node) ? a.node : null;
|
|
2954
|
+
n && p(this, N, re).call(this, n.table, r);
|
|
2955
|
+
}, re = function(a, r) {
|
|
2956
|
+
const n = a.identifier.name;
|
|
2957
|
+
!d(this, j).has(n) && !d(this, F).has(n) && r.add(n);
|
|
2958
|
+
}, Ce = function(a, r) {
|
|
2959
|
+
for (const n of a.expressions) {
|
|
2873
2960
|
const o = n.name.table.table.identifier.name;
|
|
2874
|
-
d(this, F).has(o) ||
|
|
2961
|
+
d(this, F).has(o) || r.add(o);
|
|
2875
2962
|
}
|
|
2876
2963
|
};
|
|
2877
2964
|
var Q;
|
|
2878
|
-
class
|
|
2965
|
+
class wr {
|
|
2879
2966
|
constructor(e) {
|
|
2880
|
-
|
|
2881
|
-
K(this, Q, new
|
|
2967
|
+
O(this, Q);
|
|
2968
|
+
K(this, Q, new gr(e));
|
|
2882
2969
|
}
|
|
2883
2970
|
transformQuery(e) {
|
|
2884
2971
|
return d(this, Q).transformNode(e.node);
|
|
@@ -2888,7 +2975,7 @@ class ma {
|
|
|
2888
2975
|
}
|
|
2889
2976
|
}
|
|
2890
2977
|
Q = new WeakMap();
|
|
2891
|
-
class
|
|
2978
|
+
class yr {
|
|
2892
2979
|
transformQuery(e) {
|
|
2893
2980
|
return e.node;
|
|
2894
2981
|
}
|
|
@@ -2896,12 +2983,12 @@ class _a {
|
|
|
2896
2983
|
return e.result;
|
|
2897
2984
|
}
|
|
2898
2985
|
}
|
|
2899
|
-
const
|
|
2900
|
-
var v, l, U, k, $, z, xe, I, Te, Se, Oe, ke, $e, ne,
|
|
2986
|
+
const vr = "kysely_migration", fe = "kysely_migration_lock", Nr = !1, ee = "migration_lock", Cr = C({ __noMigrations__: !0 });
|
|
2987
|
+
var v, l, U, k, $, z, xe, I, Te, Se, Oe, ke, $e, ne, J, oe, Ie, De, Pe, se, je, Fe, Ae, Me, ze, B;
|
|
2901
2988
|
class be {
|
|
2902
2989
|
constructor(e) {
|
|
2903
|
-
|
|
2904
|
-
|
|
2990
|
+
O(this, l);
|
|
2991
|
+
O(this, v);
|
|
2905
2992
|
K(this, v, C(e));
|
|
2906
2993
|
}
|
|
2907
2994
|
/**
|
|
@@ -2910,11 +2997,11 @@ class be {
|
|
|
2910
2997
|
* The returned array is sorted by migration name.
|
|
2911
2998
|
*/
|
|
2912
2999
|
async getMigrations() {
|
|
2913
|
-
const e = await p(this, l,
|
|
2914
|
-
return (await p(this, l, se).call(this)).map(({ name:
|
|
2915
|
-
const o = e.find((s) => s.name ===
|
|
3000
|
+
const e = await p(this, l, J).call(this, d(this, l, $)) ? await d(this, v).db.withPlugin(d(this, l, I)).selectFrom(d(this, l, $)).select(["name", "timestamp"]).execute() : [];
|
|
3001
|
+
return (await p(this, l, se).call(this)).map(({ name: r, ...n }) => {
|
|
3002
|
+
const o = e.find((s) => s.name === r);
|
|
2916
3003
|
return {
|
|
2917
|
-
name:
|
|
3004
|
+
name: r,
|
|
2918
3005
|
migration: n,
|
|
2919
3006
|
executedAt: o ? new Date(o.timestamp) : void 0
|
|
2920
3007
|
};
|
|
@@ -2994,16 +3081,16 @@ class be {
|
|
|
2994
3081
|
* ```
|
|
2995
3082
|
*/
|
|
2996
3083
|
async migrateTo(e) {
|
|
2997
|
-
return p(this, l, U).call(this, ({ migrations:
|
|
2998
|
-
if (e ===
|
|
3084
|
+
return p(this, l, U).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: n }) => {
|
|
3085
|
+
if (e === Cr)
|
|
2999
3086
|
return { direction: "Down", step: 1 / 0 };
|
|
3000
|
-
if (!
|
|
3087
|
+
if (!a.find((i) => i.name === e))
|
|
3001
3088
|
throw new Error(`migration "${e}" doesn't exist`);
|
|
3002
|
-
const o =
|
|
3089
|
+
const o = r.indexOf(e), s = n.findIndex((i) => i.name === e);
|
|
3003
3090
|
if (o !== -1)
|
|
3004
3091
|
return {
|
|
3005
3092
|
direction: "Down",
|
|
3006
|
-
step:
|
|
3093
|
+
step: r.length - o - 1
|
|
3007
3094
|
};
|
|
3008
3095
|
if (s !== -1)
|
|
3009
3096
|
return { direction: "Up", step: s + 1 };
|
|
@@ -3048,19 +3135,19 @@ class be {
|
|
|
3048
3135
|
v = new WeakMap(), l = new WeakSet(), U = async function(e) {
|
|
3049
3136
|
try {
|
|
3050
3137
|
return await p(this, l, Te).call(this), await p(this, l, Ie).call(this, e);
|
|
3051
|
-
} catch (
|
|
3052
|
-
return
|
|
3138
|
+
} catch (a) {
|
|
3139
|
+
return a instanceof te ? a.resultSet : { error: a };
|
|
3053
3140
|
}
|
|
3054
3141
|
}, k = function() {
|
|
3055
3142
|
return d(this, v).migrationTableSchema;
|
|
3056
3143
|
}, $ = function() {
|
|
3057
|
-
return d(this, v).migrationTableName ??
|
|
3144
|
+
return d(this, v).migrationTableName ?? vr;
|
|
3058
3145
|
}, z = function() {
|
|
3059
3146
|
return d(this, v).migrationLockTableName ?? fe;
|
|
3060
3147
|
}, xe = function() {
|
|
3061
|
-
return d(this, v).allowUnorderedMigrations ??
|
|
3148
|
+
return d(this, v).allowUnorderedMigrations ?? Nr;
|
|
3062
3149
|
}, I = function() {
|
|
3063
|
-
return d(this, l, k) ? new
|
|
3150
|
+
return d(this, l, k) ? new wr(d(this, l, k)) : new yr();
|
|
3064
3151
|
}, Te = async function() {
|
|
3065
3152
|
await p(this, l, Se).call(this), await p(this, l, Oe).call(this), await p(this, l, ke).call(this), await p(this, l, $e).call(this);
|
|
3066
3153
|
}, Se = async function() {
|
|
@@ -3072,86 +3159,86 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
|
|
|
3072
3159
|
throw e;
|
|
3073
3160
|
}
|
|
3074
3161
|
}, Oe = async function() {
|
|
3075
|
-
if (!await p(this, l,
|
|
3162
|
+
if (!await p(this, l, J).call(this, d(this, l, $)))
|
|
3076
3163
|
try {
|
|
3077
3164
|
d(this, l, k) && await p(this, l, B).call(this, d(this, v).db.schema.createSchema(d(this, l, k))), await p(this, l, B).call(this, d(this, v).db.schema.withPlugin(d(this, l, I)).createTable(d(this, l, $)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
|
|
3078
3165
|
} catch (e) {
|
|
3079
|
-
if (!await p(this, l,
|
|
3166
|
+
if (!await p(this, l, J).call(this, d(this, l, $)))
|
|
3080
3167
|
throw e;
|
|
3081
3168
|
}
|
|
3082
3169
|
}, ke = async function() {
|
|
3083
|
-
if (!await p(this, l,
|
|
3170
|
+
if (!await p(this, l, J).call(this, d(this, l, z)))
|
|
3084
3171
|
try {
|
|
3085
3172
|
await p(this, l, B).call(this, d(this, v).db.schema.withPlugin(d(this, l, I)).createTable(d(this, l, z)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
|
|
3086
3173
|
} catch (e) {
|
|
3087
|
-
if (!await p(this, l,
|
|
3174
|
+
if (!await p(this, l, J).call(this, d(this, l, z)))
|
|
3088
3175
|
throw e;
|
|
3089
3176
|
}
|
|
3090
3177
|
}, $e = async function() {
|
|
3091
3178
|
if (!await p(this, l, oe).call(this))
|
|
3092
3179
|
try {
|
|
3093
|
-
await d(this, v).db.withPlugin(d(this, l, I)).insertInto(d(this, l, z)).values({ id:
|
|
3180
|
+
await d(this, v).db.withPlugin(d(this, l, I)).insertInto(d(this, l, z)).values({ id: ee, is_locked: 0 }).execute();
|
|
3094
3181
|
} catch (e) {
|
|
3095
3182
|
if (!await p(this, l, oe).call(this))
|
|
3096
3183
|
throw e;
|
|
3097
3184
|
}
|
|
3098
3185
|
}, ne = async function() {
|
|
3099
|
-
return (await d(this, v).db.introspection.getSchemas()).some((
|
|
3100
|
-
},
|
|
3101
|
-
const
|
|
3186
|
+
return (await d(this, v).db.introspection.getSchemas()).some((a) => a.name === d(this, l, k));
|
|
3187
|
+
}, J = async function(e) {
|
|
3188
|
+
const a = d(this, l, k);
|
|
3102
3189
|
return (await d(this, v).db.introspection.getTables({
|
|
3103
3190
|
withInternalKyselyTables: !0
|
|
3104
|
-
})).some((n) => n.name === e && (!
|
|
3191
|
+
})).some((n) => n.name === e && (!a || n.schema === a));
|
|
3105
3192
|
}, oe = async function() {
|
|
3106
|
-
return !!await d(this, v).db.withPlugin(d(this, l, I)).selectFrom(d(this, l, z)).where("id", "=",
|
|
3193
|
+
return !!await d(this, v).db.withPlugin(d(this, l, I)).selectFrom(d(this, l, z)).where("id", "=", ee).select("id").executeTakeFirst();
|
|
3107
3194
|
}, Ie = async function(e) {
|
|
3108
|
-
const
|
|
3195
|
+
const a = d(this, v).db.getExecutor().adapter, r = C({
|
|
3109
3196
|
lockTable: d(this, v).migrationLockTableName ?? fe,
|
|
3110
|
-
lockRowId:
|
|
3197
|
+
lockRowId: ee,
|
|
3111
3198
|
lockTableSchema: d(this, v).migrationTableSchema
|
|
3112
3199
|
}), n = async (o) => {
|
|
3113
3200
|
try {
|
|
3114
|
-
await
|
|
3201
|
+
await a.acquireMigrationLock(o, r);
|
|
3115
3202
|
const s = await p(this, l, De).call(this, o);
|
|
3116
3203
|
if (s.migrations.length === 0)
|
|
3117
3204
|
return { results: [] };
|
|
3118
3205
|
const { direction: i, step: c } = e(s);
|
|
3119
|
-
return c <= 0 ? { results: [] } : i === "Down" ? await p(this, l,
|
|
3206
|
+
return c <= 0 ? { results: [] } : i === "Down" ? await p(this, l, Me).call(this, o, s, c) : i === "Up" ? await p(this, l, ze).call(this, o, s, c) : { results: [] };
|
|
3120
3207
|
} finally {
|
|
3121
|
-
await
|
|
3208
|
+
await a.releaseMigrationLock(o, r);
|
|
3122
3209
|
}
|
|
3123
3210
|
};
|
|
3124
|
-
return
|
|
3211
|
+
return a.supportsTransactionalDdl ? d(this, v).db.transaction().execute(n) : d(this, v).db.connection().execute(n);
|
|
3125
3212
|
}, De = async function(e) {
|
|
3126
|
-
const
|
|
3127
|
-
p(this, l, Fe).call(this,
|
|
3128
|
-
const n = p(this, l, Pe).call(this,
|
|
3213
|
+
const a = await p(this, l, se).call(this), r = await p(this, l, je).call(this, e);
|
|
3214
|
+
p(this, l, Fe).call(this, a, r), d(this, l, xe) || p(this, l, Ae).call(this, a, r);
|
|
3215
|
+
const n = p(this, l, Pe).call(this, a, r);
|
|
3129
3216
|
return C({
|
|
3130
|
-
migrations:
|
|
3131
|
-
executedMigrations:
|
|
3132
|
-
lastMigration:
|
|
3217
|
+
migrations: a,
|
|
3218
|
+
executedMigrations: r,
|
|
3219
|
+
lastMigration: _r(r),
|
|
3133
3220
|
pendingMigrations: n
|
|
3134
3221
|
});
|
|
3135
|
-
}, Pe = function(e,
|
|
3136
|
-
return e.filter((
|
|
3222
|
+
}, Pe = function(e, a) {
|
|
3223
|
+
return e.filter((r) => !a.includes(r.name));
|
|
3137
3224
|
}, se = async function() {
|
|
3138
3225
|
const e = await d(this, v).provider.getMigrations();
|
|
3139
|
-
return Object.keys(e).sort().map((
|
|
3140
|
-
...e[
|
|
3141
|
-
name:
|
|
3226
|
+
return Object.keys(e).sort().map((a) => ({
|
|
3227
|
+
...e[a],
|
|
3228
|
+
name: a
|
|
3142
3229
|
}));
|
|
3143
3230
|
}, je = async function(e) {
|
|
3144
|
-
return (await e.withPlugin(d(this, l, I)).selectFrom(d(this, l, $)).select("name").orderBy(["timestamp", "name"]).execute()).map((
|
|
3145
|
-
}, Fe = function(e,
|
|
3146
|
-
for (const
|
|
3147
|
-
if (!e.some((n) => n.name ===
|
|
3148
|
-
throw new Error(`corrupted migrations: previously executed migration ${
|
|
3149
|
-
},
|
|
3150
|
-
for (let
|
|
3151
|
-
if (e[
|
|
3152
|
-
throw new Error(`corrupted migrations: expected previously executed migration ${r
|
|
3153
|
-
},
|
|
3154
|
-
const n =
|
|
3231
|
+
return (await e.withPlugin(d(this, l, I)).selectFrom(d(this, l, $)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
|
|
3232
|
+
}, Fe = function(e, a) {
|
|
3233
|
+
for (const r of a)
|
|
3234
|
+
if (!e.some((n) => n.name === r))
|
|
3235
|
+
throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
|
|
3236
|
+
}, Ae = function(e, a) {
|
|
3237
|
+
for (let r = 0; r < a.length; ++r)
|
|
3238
|
+
if (e[r].name !== a[r])
|
|
3239
|
+
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.`);
|
|
3240
|
+
}, Me = async function(e, a, r) {
|
|
3241
|
+
const n = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((i) => i.name === s)), o = n.map((s) => ({
|
|
3155
3242
|
migrationName: s.name,
|
|
3156
3243
|
direction: "Down",
|
|
3157
3244
|
status: "NotExecuted"
|
|
@@ -3169,21 +3256,21 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
|
|
|
3169
3256
|
migrationName: i.name,
|
|
3170
3257
|
direction: "Down",
|
|
3171
3258
|
status: "Error"
|
|
3172
|
-
}, new
|
|
3259
|
+
}, new te({
|
|
3173
3260
|
error: c,
|
|
3174
3261
|
results: o
|
|
3175
3262
|
});
|
|
3176
3263
|
}
|
|
3177
3264
|
}
|
|
3178
3265
|
return { results: o };
|
|
3179
|
-
}, ze = async function(e,
|
|
3180
|
-
const o =
|
|
3266
|
+
}, ze = async function(e, a, r) {
|
|
3267
|
+
const o = a.pendingMigrations.slice(0, r).map((s) => ({
|
|
3181
3268
|
migrationName: s.name,
|
|
3182
3269
|
direction: "Up",
|
|
3183
3270
|
status: "NotExecuted"
|
|
3184
3271
|
}));
|
|
3185
3272
|
for (let s = 0; s < o.length; s++) {
|
|
3186
|
-
const i =
|
|
3273
|
+
const i = a.pendingMigrations[s];
|
|
3187
3274
|
try {
|
|
3188
3275
|
await i.up(e), await e.withPlugin(d(this, l, I)).insertInto(d(this, l, $)).values({
|
|
3189
3276
|
name: i.name,
|
|
@@ -3198,7 +3285,7 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
|
|
|
3198
3285
|
migrationName: i.name,
|
|
3199
3286
|
direction: "Up",
|
|
3200
3287
|
status: "Error"
|
|
3201
|
-
}, new
|
|
3288
|
+
}, new te({
|
|
3202
3289
|
error: c,
|
|
3203
3290
|
results: o
|
|
3204
3291
|
});
|
|
@@ -3209,18 +3296,18 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
|
|
|
3209
3296
|
d(this, v).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
|
|
3210
3297
|
};
|
|
3211
3298
|
var q;
|
|
3212
|
-
class
|
|
3213
|
-
constructor(
|
|
3299
|
+
class te extends Error {
|
|
3300
|
+
constructor(a) {
|
|
3214
3301
|
super();
|
|
3215
|
-
|
|
3216
|
-
K(this, q,
|
|
3302
|
+
O(this, q);
|
|
3303
|
+
K(this, q, a);
|
|
3217
3304
|
}
|
|
3218
3305
|
get resultSet() {
|
|
3219
3306
|
return d(this, q);
|
|
3220
3307
|
}
|
|
3221
3308
|
}
|
|
3222
3309
|
q = new WeakMap();
|
|
3223
|
-
class
|
|
3310
|
+
class Je {
|
|
3224
3311
|
constructor(e) {
|
|
3225
3312
|
R(this, "migrations");
|
|
3226
3313
|
this.migrations = e;
|
|
@@ -3229,7 +3316,7 @@ class Le {
|
|
|
3229
3316
|
return this.migrations;
|
|
3230
3317
|
}
|
|
3231
3318
|
}
|
|
3232
|
-
async function
|
|
3319
|
+
async function br(t) {
|
|
3233
3320
|
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(
|
|
3234
3321
|
"tenant_id",
|
|
3235
3322
|
"varchar(255)",
|
|
@@ -3301,35 +3388,35 @@ async function ga(t) {
|
|
|
3301
3388
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
3302
3389
|
).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();
|
|
3303
3390
|
}
|
|
3304
|
-
async function
|
|
3391
|
+
async function xr(t) {
|
|
3305
3392
|
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();
|
|
3306
3393
|
}
|
|
3307
|
-
const
|
|
3394
|
+
const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3308
3395
|
__proto__: null,
|
|
3309
|
-
down:
|
|
3310
|
-
up:
|
|
3396
|
+
down: xr,
|
|
3397
|
+
up: br
|
|
3311
3398
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3312
|
-
async function
|
|
3399
|
+
async function Sr(t) {
|
|
3313
3400
|
await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
|
|
3314
3401
|
}
|
|
3315
|
-
async function
|
|
3402
|
+
async function Or(t) {
|
|
3316
3403
|
await t.schema.alterTable("tenants").dropColumn("support_url").execute();
|
|
3317
3404
|
}
|
|
3318
|
-
const
|
|
3405
|
+
const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3319
3406
|
__proto__: null,
|
|
3320
|
-
down:
|
|
3321
|
-
up:
|
|
3407
|
+
down: Or,
|
|
3408
|
+
up: Sr
|
|
3322
3409
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3323
|
-
async function
|
|
3410
|
+
async function $r(t) {
|
|
3324
3411
|
}
|
|
3325
|
-
async function
|
|
3412
|
+
async function Ir(t) {
|
|
3326
3413
|
}
|
|
3327
|
-
const
|
|
3414
|
+
const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3328
3415
|
__proto__: null,
|
|
3329
|
-
down:
|
|
3330
|
-
up:
|
|
3416
|
+
down: Ir,
|
|
3417
|
+
up: $r
|
|
3331
3418
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3332
|
-
async function
|
|
3419
|
+
async function Pr(t) {
|
|
3333
3420
|
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(
|
|
3334
3421
|
"tenant_id_constraint",
|
|
3335
3422
|
["tenant_id"],
|
|
@@ -3338,24 +3425,24 @@ async function Sa(t) {
|
|
|
3338
3425
|
(e) => e.onDelete("cascade")
|
|
3339
3426
|
).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();
|
|
3340
3427
|
}
|
|
3341
|
-
async function
|
|
3428
|
+
async function jr(t) {
|
|
3342
3429
|
await t.schema.dropTable("logs").execute();
|
|
3343
3430
|
}
|
|
3344
|
-
const
|
|
3431
|
+
const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3345
3432
|
__proto__: null,
|
|
3346
|
-
down:
|
|
3347
|
-
up:
|
|
3433
|
+
down: jr,
|
|
3434
|
+
up: Pr
|
|
3348
3435
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3349
|
-
async function
|
|
3436
|
+
async function Ar(t) {
|
|
3350
3437
|
}
|
|
3351
|
-
async function
|
|
3438
|
+
async function Mr(t) {
|
|
3352
3439
|
}
|
|
3353
|
-
const
|
|
3440
|
+
const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3354
3441
|
__proto__: null,
|
|
3355
|
-
down:
|
|
3356
|
-
up:
|
|
3442
|
+
down: Mr,
|
|
3443
|
+
up: Ar
|
|
3357
3444
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3358
|
-
async function
|
|
3445
|
+
async function Jr(t) {
|
|
3359
3446
|
await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
3360
3447
|
"user_id_constraint",
|
|
3361
3448
|
["user_id", "tenant_id"],
|
|
@@ -3380,15 +3467,15 @@ async function Pa(t) {
|
|
|
3380
3467
|
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
3381
3468
|
).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();
|
|
3382
3469
|
}
|
|
3383
|
-
async function
|
|
3470
|
+
async function Lr(t) {
|
|
3384
3471
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
|
|
3385
3472
|
}
|
|
3386
|
-
const
|
|
3473
|
+
const Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3387
3474
|
__proto__: null,
|
|
3388
|
-
down:
|
|
3389
|
-
up:
|
|
3475
|
+
down: Lr,
|
|
3476
|
+
up: Jr
|
|
3390
3477
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3391
|
-
async function
|
|
3478
|
+
async function Rr(t) {
|
|
3392
3479
|
await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
|
|
3393
3480
|
"user_id_constraint",
|
|
3394
3481
|
["user_id", "tenant_id"],
|
|
@@ -3403,24 +3490,24 @@ async function Ma(t) {
|
|
|
3403
3490
|
(e) => e.onDelete("cascade")
|
|
3404
3491
|
).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();
|
|
3405
3492
|
}
|
|
3406
|
-
async function
|
|
3493
|
+
async function Kr(t) {
|
|
3407
3494
|
await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
|
|
3408
3495
|
}
|
|
3409
|
-
const
|
|
3496
|
+
const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3410
3497
|
__proto__: null,
|
|
3411
|
-
down:
|
|
3412
|
-
up:
|
|
3498
|
+
down: Kr,
|
|
3499
|
+
up: Rr
|
|
3413
3500
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3414
|
-
async function
|
|
3501
|
+
async function Br(t) {
|
|
3415
3502
|
}
|
|
3416
|
-
async function
|
|
3503
|
+
async function Qr(t) {
|
|
3417
3504
|
}
|
|
3418
|
-
const
|
|
3505
|
+
const qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3419
3506
|
__proto__: null,
|
|
3420
|
-
down:
|
|
3421
|
-
up:
|
|
3507
|
+
down: Qr,
|
|
3508
|
+
up: Br
|
|
3422
3509
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3423
|
-
async function
|
|
3510
|
+
async function Vr(t) {
|
|
3424
3511
|
await t.schema.alterTable("passwords").addColumn(
|
|
3425
3512
|
"password",
|
|
3426
3513
|
"varchar(255)",
|
|
@@ -3428,68 +3515,46 @@ async function Ra(t) {
|
|
|
3428
3515
|
(e) => e.notNull()
|
|
3429
3516
|
).execute();
|
|
3430
3517
|
}
|
|
3431
|
-
async function
|
|
3518
|
+
async function Wr(t) {
|
|
3432
3519
|
await t.schema.alterTable("passwords").dropColumn("password").execute();
|
|
3433
3520
|
}
|
|
3434
|
-
const
|
|
3435
|
-
__proto__: null,
|
|
3436
|
-
down: Ka,
|
|
3437
|
-
up: Ra
|
|
3438
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
3439
|
-
async function Ba(t) {
|
|
3440
|
-
}
|
|
3441
|
-
async function Qa(t) {
|
|
3442
|
-
}
|
|
3443
|
-
const qa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3444
|
-
__proto__: null,
|
|
3445
|
-
down: Qa,
|
|
3446
|
-
up: Ba
|
|
3447
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
3448
|
-
async function Va(t) {
|
|
3449
|
-
}
|
|
3450
|
-
async function Wa(t) {
|
|
3451
|
-
}
|
|
3452
|
-
const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3521
|
+
const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3453
3522
|
__proto__: null,
|
|
3454
|
-
down:
|
|
3455
|
-
up:
|
|
3523
|
+
down: Wr,
|
|
3524
|
+
up: Vr
|
|
3456
3525
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3457
|
-
async function
|
|
3526
|
+
async function Hr(t) {
|
|
3458
3527
|
}
|
|
3459
|
-
async function
|
|
3528
|
+
async function Yr(t) {
|
|
3460
3529
|
}
|
|
3461
|
-
const
|
|
3530
|
+
const Xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3462
3531
|
__proto__: null,
|
|
3463
|
-
down:
|
|
3464
|
-
up:
|
|
3532
|
+
down: Yr,
|
|
3533
|
+
up: Hr
|
|
3465
3534
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3466
|
-
async function
|
|
3467
|
-
await t.schema.createIndex("users_email_index").on("users").column("email").execute();
|
|
3535
|
+
async function Zr(t) {
|
|
3468
3536
|
}
|
|
3469
3537
|
async function en(t) {
|
|
3470
|
-
await t.schema.dropIndex("users_email_index").execute();
|
|
3471
3538
|
}
|
|
3472
3539
|
const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3473
3540
|
__proto__: null,
|
|
3474
3541
|
down: en,
|
|
3475
|
-
up:
|
|
3542
|
+
up: Zr
|
|
3476
3543
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3477
|
-
async function rn(t) {
|
|
3478
|
-
await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
|
|
3479
|
-
}
|
|
3480
3544
|
async function an(t) {
|
|
3481
|
-
|
|
3545
|
+
}
|
|
3546
|
+
async function rn(t) {
|
|
3482
3547
|
}
|
|
3483
3548
|
const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3484
3549
|
__proto__: null,
|
|
3485
|
-
down:
|
|
3486
|
-
up:
|
|
3550
|
+
down: rn,
|
|
3551
|
+
up: an
|
|
3487
3552
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3488
3553
|
async function on(t) {
|
|
3489
|
-
await t.schema.createIndex("
|
|
3554
|
+
await t.schema.createIndex("users_email_index").on("users").column("email").execute();
|
|
3490
3555
|
}
|
|
3491
3556
|
async function sn(t) {
|
|
3492
|
-
await t.schema.dropIndex("
|
|
3557
|
+
await t.schema.dropIndex("users_email_index").execute();
|
|
3493
3558
|
}
|
|
3494
3559
|
const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3495
3560
|
__proto__: null,
|
|
@@ -3497,10 +3562,10 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3497
3562
|
up: on
|
|
3498
3563
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3499
3564
|
async function cn(t) {
|
|
3500
|
-
await t.schema.alterTable("users").addColumn("
|
|
3565
|
+
await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
|
|
3501
3566
|
}
|
|
3502
3567
|
async function dn(t) {
|
|
3503
|
-
await t.schema.alterTable("users").dropColumn("
|
|
3568
|
+
await t.schema.alterTable("users").dropColumn("profileData").execute();
|
|
3504
3569
|
}
|
|
3505
3570
|
const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3506
3571
|
__proto__: null,
|
|
@@ -3508,22 +3573,10 @@ const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3508
3573
|
up: cn
|
|
3509
3574
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3510
3575
|
async function mn(t) {
|
|
3511
|
-
await t.schema.
|
|
3512
|
-
"tenant_id",
|
|
3513
|
-
"varchar(255)",
|
|
3514
|
-
(e) => e.references("tenants.id").onDelete("cascade")
|
|
3515
|
-
).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("revoked_at", "varchar(255)").addColumn("cert", "varchar(4096)").addColumn("pkcs7", "varchar(4096)").addColumn("fingerprint", "varchar(256)").addColumn("thumbprint", "varchar(256)").addColumn("current_since", "varchar(256)").addColumn("current_until", "varchar(256)").addColumn(
|
|
3516
|
-
"type",
|
|
3517
|
-
"varchar(50)",
|
|
3518
|
-
(e) => e.notNull().defaultTo("jwt_signing")
|
|
3519
|
-
).addColumn(
|
|
3520
|
-
"connection",
|
|
3521
|
-
"varchar(255)",
|
|
3522
|
-
(e) => e.references("connections.id").onDelete("cascade")
|
|
3523
|
-
).execute();
|
|
3576
|
+
await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
|
|
3524
3577
|
}
|
|
3525
3578
|
async function _n(t) {
|
|
3526
|
-
await t.schema.
|
|
3579
|
+
await t.schema.dropIndex("users_linked_to_index");
|
|
3527
3580
|
}
|
|
3528
3581
|
const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3529
3582
|
__proto__: null,
|
|
@@ -3531,8 +3584,10 @@ const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3531
3584
|
up: mn
|
|
3532
3585
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3533
3586
|
async function fn(t) {
|
|
3587
|
+
await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
|
|
3534
3588
|
}
|
|
3535
3589
|
async function pn(t) {
|
|
3590
|
+
await t.schema.alterTable("users").dropColumn("locale").execute();
|
|
3536
3591
|
}
|
|
3537
3592
|
const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3538
3593
|
__proto__: null,
|
|
@@ -3540,8 +3595,22 @@ const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3540
3595
|
up: fn
|
|
3541
3596
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3542
3597
|
async function wn(t) {
|
|
3598
|
+
await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3599
|
+
"tenant_id",
|
|
3600
|
+
"varchar(255)",
|
|
3601
|
+
(e) => e.references("tenants.id").onDelete("cascade")
|
|
3602
|
+
).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("revoked_at", "varchar(255)").addColumn("cert", "varchar(4096)").addColumn("pkcs7", "varchar(4096)").addColumn("fingerprint", "varchar(256)").addColumn("thumbprint", "varchar(256)").addColumn("current_since", "varchar(256)").addColumn("current_until", "varchar(256)").addColumn(
|
|
3603
|
+
"type",
|
|
3604
|
+
"varchar(50)",
|
|
3605
|
+
(e) => e.notNull().defaultTo("jwt_signing")
|
|
3606
|
+
).addColumn(
|
|
3607
|
+
"connection",
|
|
3608
|
+
"varchar(255)",
|
|
3609
|
+
(e) => e.references("connections.id").onDelete("cascade")
|
|
3610
|
+
).execute();
|
|
3543
3611
|
}
|
|
3544
3612
|
async function yn(t) {
|
|
3613
|
+
await t.schema.dropTable("keys").execute();
|
|
3545
3614
|
}
|
|
3546
3615
|
const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3547
3616
|
__proto__: null,
|
|
@@ -3549,10 +3618,8 @@ const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3549
3618
|
up: wn
|
|
3550
3619
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3551
3620
|
async function Nn(t) {
|
|
3552
|
-
await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
|
|
3553
3621
|
}
|
|
3554
3622
|
async function Cn(t) {
|
|
3555
|
-
await t.schema.alterTable("otps").dropColumn("audience").execute();
|
|
3556
3623
|
}
|
|
3557
3624
|
const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3558
3625
|
__proto__: null,
|
|
@@ -3569,10 +3636,10 @@ const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3569
3636
|
up: xn
|
|
3570
3637
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3571
3638
|
async function On(t) {
|
|
3572
|
-
await t.schema.alterTable("
|
|
3639
|
+
await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
|
|
3573
3640
|
}
|
|
3574
3641
|
async function kn(t) {
|
|
3575
|
-
await t.schema.alterTable("
|
|
3642
|
+
await t.schema.alterTable("otps").dropColumn("audience").execute();
|
|
3576
3643
|
}
|
|
3577
3644
|
const $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3578
3645
|
__proto__: null,
|
|
@@ -3580,10 +3647,8 @@ const $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3580
3647
|
up: On
|
|
3581
3648
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3582
3649
|
async function In(t) {
|
|
3583
|
-
await t.schema.alterTable("users").dropColumn("tags").execute();
|
|
3584
3650
|
}
|
|
3585
3651
|
async function Dn(t) {
|
|
3586
|
-
await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
|
|
3587
3652
|
}
|
|
3588
3653
|
const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3589
3654
|
__proto__: null,
|
|
@@ -3591,43 +3656,43 @@ const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3591
3656
|
up: In
|
|
3592
3657
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3593
3658
|
async function jn(t) {
|
|
3594
|
-
await t.schema.
|
|
3659
|
+
await t.schema.alterTable("logs").dropColumn("category").execute();
|
|
3595
3660
|
}
|
|
3596
3661
|
async function Fn(t) {
|
|
3597
|
-
await t.schema.
|
|
3662
|
+
await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
|
|
3598
3663
|
}
|
|
3599
|
-
const
|
|
3664
|
+
const An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3600
3665
|
__proto__: null,
|
|
3601
3666
|
down: Fn,
|
|
3602
3667
|
up: jn
|
|
3603
3668
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3604
|
-
async function
|
|
3605
|
-
await t.schema.alterTable("
|
|
3669
|
+
async function Mn(t) {
|
|
3670
|
+
await t.schema.alterTable("users").dropColumn("tags").execute();
|
|
3606
3671
|
}
|
|
3607
3672
|
async function zn(t) {
|
|
3608
|
-
await t.schema.alterTable("
|
|
3673
|
+
await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
|
|
3609
3674
|
}
|
|
3610
|
-
const
|
|
3675
|
+
const Jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3611
3676
|
__proto__: null,
|
|
3612
3677
|
down: zn,
|
|
3613
|
-
up:
|
|
3678
|
+
up: Mn
|
|
3614
3679
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3615
|
-
async function
|
|
3616
|
-
await t.schema.
|
|
3680
|
+
async function Ln(t) {
|
|
3681
|
+
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();
|
|
3617
3682
|
}
|
|
3618
|
-
async function
|
|
3619
|
-
await t.schema.
|
|
3683
|
+
async function En(t) {
|
|
3684
|
+
await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
|
|
3620
3685
|
}
|
|
3621
3686
|
const Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3622
3687
|
__proto__: null,
|
|
3623
|
-
down:
|
|
3624
|
-
up:
|
|
3688
|
+
down: En,
|
|
3689
|
+
up: Ln
|
|
3625
3690
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3626
3691
|
async function Kn(t) {
|
|
3627
|
-
await t.schema.
|
|
3692
|
+
await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
|
|
3628
3693
|
}
|
|
3629
3694
|
async function Un(t) {
|
|
3630
|
-
await t.schema.
|
|
3695
|
+
await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
|
|
3631
3696
|
}
|
|
3632
3697
|
const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3633
3698
|
__proto__: null,
|
|
@@ -3635,9 +3700,10 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3635
3700
|
up: Kn
|
|
3636
3701
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3637
3702
|
async function Qn(t) {
|
|
3703
|
+
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();
|
|
3638
3704
|
}
|
|
3639
3705
|
async function qn(t) {
|
|
3640
|
-
await t.schema.alterTable("
|
|
3706
|
+
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();
|
|
3641
3707
|
}
|
|
3642
3708
|
const Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3643
3709
|
__proto__: null,
|
|
@@ -3645,10 +3711,10 @@ const Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3645
3711
|
up: Qn
|
|
3646
3712
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3647
3713
|
async function Wn(t) {
|
|
3648
|
-
await t.schema.
|
|
3714
|
+
await t.schema.createIndex("users_name_index").on("users").column("name").execute();
|
|
3649
3715
|
}
|
|
3650
3716
|
async function Gn(t) {
|
|
3651
|
-
await t.schema.
|
|
3717
|
+
await t.schema.dropIndex("users_name_index").execute();
|
|
3652
3718
|
}
|
|
3653
3719
|
const Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3654
3720
|
__proto__: null,
|
|
@@ -3656,10 +3722,9 @@ const Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3656
3722
|
up: Wn
|
|
3657
3723
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3658
3724
|
async function Yn(t) {
|
|
3659
|
-
await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
|
|
3660
3725
|
}
|
|
3661
3726
|
async function Xn(t) {
|
|
3662
|
-
await t.schema.alterTable("
|
|
3727
|
+
await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
|
|
3663
3728
|
}
|
|
3664
3729
|
const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3665
3730
|
__proto__: null,
|
|
@@ -3667,32 +3732,36 @@ const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3667
3732
|
up: Yn
|
|
3668
3733
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3669
3734
|
async function eo(t) {
|
|
3670
|
-
await t.schema.
|
|
3671
|
-
"tenant_id",
|
|
3672
|
-
"varchar(255)",
|
|
3673
|
-
(e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
|
|
3674
|
-
).addColumn("logo_url", "varchar(512)").addColumn("favicon_url", "varchar(512)").addColumn("font_url", "varchar(512)").addColumn("colors_primary", "varchar(8)").addColumn("colors_page_background_type", "varchar(32)").addColumn("colors_page_background_start", "varchar(8)").addColumn("colors_page_background_end", "varchar(8)").addColumn("colors_page_background_angle_dev", "integer").execute();
|
|
3735
|
+
await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
|
|
3675
3736
|
}
|
|
3676
3737
|
async function to(t) {
|
|
3677
|
-
await t.schema.
|
|
3738
|
+
await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
|
|
3678
3739
|
}
|
|
3679
|
-
const
|
|
3740
|
+
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3680
3741
|
__proto__: null,
|
|
3681
3742
|
down: to,
|
|
3682
3743
|
up: eo
|
|
3683
3744
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3684
|
-
async function
|
|
3745
|
+
async function ro(t) {
|
|
3746
|
+
await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
|
|
3685
3747
|
}
|
|
3686
3748
|
async function no(t) {
|
|
3749
|
+
await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
|
|
3687
3750
|
}
|
|
3688
3751
|
const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3689
3752
|
__proto__: null,
|
|
3690
3753
|
down: no,
|
|
3691
|
-
up:
|
|
3754
|
+
up: ro
|
|
3692
3755
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3693
3756
|
async function so(t) {
|
|
3757
|
+
await t.schema.createTable("branding").addColumn(
|
|
3758
|
+
"tenant_id",
|
|
3759
|
+
"varchar(255)",
|
|
3760
|
+
(e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
|
|
3761
|
+
).addColumn("logo_url", "varchar(512)").addColumn("favicon_url", "varchar(512)").addColumn("font_url", "varchar(512)").addColumn("colors_primary", "varchar(8)").addColumn("colors_page_background_type", "varchar(32)").addColumn("colors_page_background_start", "varchar(8)").addColumn("colors_page_background_end", "varchar(8)").addColumn("colors_page_background_angle_dev", "integer").execute();
|
|
3694
3762
|
}
|
|
3695
3763
|
async function io(t) {
|
|
3764
|
+
await t.schema.dropTable("branding").execute();
|
|
3696
3765
|
}
|
|
3697
3766
|
const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3698
3767
|
__proto__: null,
|
|
@@ -3718,18 +3787,8 @@ const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3718
3787
|
up: _o
|
|
3719
3788
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3720
3789
|
async function po(t) {
|
|
3721
|
-
await t.schema.createTable("authentication_codes").addColumn(
|
|
3722
|
-
"tenant_id",
|
|
3723
|
-
"varchar(255)",
|
|
3724
|
-
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
3725
|
-
).addColumn("code", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3726
|
-
"client_id",
|
|
3727
|
-
"varchar(255)",
|
|
3728
|
-
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
3729
|
-
).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").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();
|
|
3730
3790
|
}
|
|
3731
3791
|
async function go(t) {
|
|
3732
|
-
await t.schema.dropTable("authentication_codes").execute();
|
|
3733
3792
|
}
|
|
3734
3793
|
const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3735
3794
|
__proto__: null,
|
|
@@ -3746,10 +3805,18 @@ const No = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3746
3805
|
up: yo
|
|
3747
3806
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3748
3807
|
async function Co(t) {
|
|
3749
|
-
await t.schema.
|
|
3808
|
+
await t.schema.createTable("authentication_codes").addColumn(
|
|
3809
|
+
"tenant_id",
|
|
3810
|
+
"varchar(255)",
|
|
3811
|
+
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
3812
|
+
).addColumn("code", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3813
|
+
"client_id",
|
|
3814
|
+
"varchar(255)",
|
|
3815
|
+
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
3816
|
+
).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").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();
|
|
3750
3817
|
}
|
|
3751
3818
|
async function bo(t) {
|
|
3752
|
-
await t.schema.
|
|
3819
|
+
await t.schema.dropTable("authentication_codes").execute();
|
|
3753
3820
|
}
|
|
3754
3821
|
const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3755
3822
|
__proto__: null,
|
|
@@ -3757,10 +3824,8 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3757
3824
|
up: Co
|
|
3758
3825
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3759
3826
|
async function To(t) {
|
|
3760
|
-
await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
|
|
3761
3827
|
}
|
|
3762
3828
|
async function So(t) {
|
|
3763
|
-
await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
|
|
3764
3829
|
}
|
|
3765
3830
|
const Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3766
3831
|
__proto__: null,
|
|
@@ -3768,8 +3833,10 @@ const Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3768
3833
|
up: To
|
|
3769
3834
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3770
3835
|
async function ko(t) {
|
|
3836
|
+
await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
|
|
3771
3837
|
}
|
|
3772
3838
|
async function $o(t) {
|
|
3839
|
+
await t.schema.alterTable("otps").dropColumn("ip").execute();
|
|
3773
3840
|
}
|
|
3774
3841
|
const Io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3775
3842
|
__proto__: null,
|
|
@@ -3777,6 +3844,26 @@ const Io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3777
3844
|
up: ko
|
|
3778
3845
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3779
3846
|
async function Do(t) {
|
|
3847
|
+
await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
|
|
3848
|
+
}
|
|
3849
|
+
async function Po(t) {
|
|
3850
|
+
await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
|
|
3851
|
+
}
|
|
3852
|
+
const jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3853
|
+
__proto__: null,
|
|
3854
|
+
down: Po,
|
|
3855
|
+
up: Do
|
|
3856
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3857
|
+
async function Fo(t) {
|
|
3858
|
+
}
|
|
3859
|
+
async function Ao(t) {
|
|
3860
|
+
}
|
|
3861
|
+
const Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3862
|
+
__proto__: null,
|
|
3863
|
+
down: Ao,
|
|
3864
|
+
up: Fo
|
|
3865
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3866
|
+
async function zo(t) {
|
|
3780
3867
|
await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
|
|
3781
3868
|
"tenant_id",
|
|
3782
3869
|
"varchar(255)",
|
|
@@ -3787,33 +3874,33 @@ async function Do(t) {
|
|
|
3787
3874
|
(e) => e.defaultTo(!1).notNull()
|
|
3788
3875
|
).addColumn("priority", "integer").execute();
|
|
3789
3876
|
}
|
|
3790
|
-
async function
|
|
3877
|
+
async function Jo(t) {
|
|
3791
3878
|
await t.schema.dropTable("hooks").execute();
|
|
3792
3879
|
}
|
|
3793
|
-
const
|
|
3880
|
+
const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3794
3881
|
__proto__: null,
|
|
3795
|
-
down:
|
|
3796
|
-
up:
|
|
3882
|
+
down: Jo,
|
|
3883
|
+
up: zo
|
|
3797
3884
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3798
|
-
async function
|
|
3885
|
+
async function Eo(t) {
|
|
3799
3886
|
}
|
|
3800
|
-
async function
|
|
3887
|
+
async function Ro(t) {
|
|
3801
3888
|
}
|
|
3802
|
-
const
|
|
3889
|
+
const Ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3803
3890
|
__proto__: null,
|
|
3804
|
-
down:
|
|
3805
|
-
up:
|
|
3891
|
+
down: Ro,
|
|
3892
|
+
up: Eo
|
|
3806
3893
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3807
|
-
async function
|
|
3894
|
+
async function Uo(t) {
|
|
3808
3895
|
}
|
|
3809
|
-
async function
|
|
3896
|
+
async function Bo(t) {
|
|
3810
3897
|
}
|
|
3811
|
-
const
|
|
3898
|
+
const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3812
3899
|
__proto__: null,
|
|
3813
|
-
down:
|
|
3814
|
-
up:
|
|
3900
|
+
down: Bo,
|
|
3901
|
+
up: Uo
|
|
3815
3902
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3816
|
-
async function
|
|
3903
|
+
async function qo(t) {
|
|
3817
3904
|
await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3818
3905
|
"tenant_id",
|
|
3819
3906
|
"varchar(255)",
|
|
@@ -3830,7 +3917,7 @@ async function Jo(t) {
|
|
|
3830
3917
|
(e) => e.onDelete("cascade")
|
|
3831
3918
|
).addColumn("code_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();
|
|
3832
3919
|
}
|
|
3833
|
-
async function
|
|
3920
|
+
async function Vo(t) {
|
|
3834
3921
|
await t.schema.dropTable("logins").execute(), await t.schema.alterTable("passwords").dropColumn("algorithm").execute(), await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("tenant_id", "varchar(255)").addForeignKeyConstraint(
|
|
3835
3922
|
"codes_user_id_tenant_id_constraint",
|
|
3836
3923
|
["user_id", "tenant_id"],
|
|
@@ -3839,36 +3926,14 @@ async function Ro(t) {
|
|
|
3839
3926
|
(e) => e.onDelete("cascade")
|
|
3840
3927
|
).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();
|
|
3841
3928
|
}
|
|
3842
|
-
const Ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3843
|
-
__proto__: null,
|
|
3844
|
-
down: Ro,
|
|
3845
|
-
up: Jo
|
|
3846
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
3847
|
-
async function Uo(t) {
|
|
3848
|
-
}
|
|
3849
|
-
async function Bo(t) {
|
|
3850
|
-
}
|
|
3851
|
-
const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3852
|
-
__proto__: null,
|
|
3853
|
-
down: Bo,
|
|
3854
|
-
up: Uo
|
|
3855
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
3856
|
-
async function qo(t) {
|
|
3857
|
-
await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
|
|
3858
|
-
}
|
|
3859
|
-
async function Vo(t) {
|
|
3860
|
-
await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
|
|
3861
|
-
}
|
|
3862
3929
|
const Wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3863
3930
|
__proto__: null,
|
|
3864
3931
|
down: Vo,
|
|
3865
3932
|
up: qo
|
|
3866
3933
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3867
3934
|
async function Go(t) {
|
|
3868
|
-
await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
|
|
3869
3935
|
}
|
|
3870
3936
|
async function Ho(t) {
|
|
3871
|
-
await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
|
|
3872
3937
|
}
|
|
3873
3938
|
const Yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3874
3939
|
__proto__: null,
|
|
@@ -3876,8 +3941,10 @@ const Yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3876
3941
|
up: Go
|
|
3877
3942
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3878
3943
|
async function Xo(t) {
|
|
3944
|
+
await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
|
|
3879
3945
|
}
|
|
3880
3946
|
async function Zo(t) {
|
|
3947
|
+
await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
|
|
3881
3948
|
}
|
|
3882
3949
|
const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3883
3950
|
__proto__: null,
|
|
@@ -3885,19 +3952,19 @@ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3885
3952
|
up: Xo
|
|
3886
3953
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3887
3954
|
async function ts(t) {
|
|
3955
|
+
await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
|
|
3888
3956
|
}
|
|
3889
|
-
async function
|
|
3957
|
+
async function as(t) {
|
|
3958
|
+
await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
|
|
3890
3959
|
}
|
|
3891
|
-
const
|
|
3960
|
+
const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3892
3961
|
__proto__: null,
|
|
3893
|
-
down:
|
|
3962
|
+
down: as,
|
|
3894
3963
|
up: ts
|
|
3895
3964
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3896
3965
|
async function ns(t) {
|
|
3897
|
-
await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
|
|
3898
3966
|
}
|
|
3899
3967
|
async function os(t) {
|
|
3900
|
-
await t.schema.alterTable("logins").dropColumn("nonce").execute();
|
|
3901
3968
|
}
|
|
3902
3969
|
const ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3903
3970
|
__proto__: null,
|
|
@@ -3914,8 +3981,10 @@ const cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3914
3981
|
up: is
|
|
3915
3982
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3916
3983
|
async function ds(t) {
|
|
3984
|
+
await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
|
|
3917
3985
|
}
|
|
3918
3986
|
async function us(t) {
|
|
3987
|
+
await t.schema.alterTable("logins").dropColumn("nonce").execute();
|
|
3919
3988
|
}
|
|
3920
3989
|
const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3921
3990
|
__proto__: null,
|
|
@@ -3923,6 +3992,24 @@ const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3923
3992
|
up: ds
|
|
3924
3993
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3925
3994
|
async function _s(t) {
|
|
3995
|
+
}
|
|
3996
|
+
async function hs(t) {
|
|
3997
|
+
}
|
|
3998
|
+
const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3999
|
+
__proto__: null,
|
|
4000
|
+
down: hs,
|
|
4001
|
+
up: _s
|
|
4002
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4003
|
+
async function ps(t) {
|
|
4004
|
+
}
|
|
4005
|
+
async function gs(t) {
|
|
4006
|
+
}
|
|
4007
|
+
const ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4008
|
+
__proto__: null,
|
|
4009
|
+
down: gs,
|
|
4010
|
+
up: ps
|
|
4011
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4012
|
+
async function ys(t) {
|
|
3926
4013
|
await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
|
|
3927
4014
|
"tenant_id",
|
|
3928
4015
|
"varchar(255)",
|
|
@@ -3938,7 +4025,7 @@ async function _s(t) {
|
|
|
3938
4025
|
"code_type"
|
|
3939
4026
|
]).execute();
|
|
3940
4027
|
}
|
|
3941
|
-
async function
|
|
4028
|
+
async function vs(t) {
|
|
3942
4029
|
await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
3943
4030
|
"tenant_id",
|
|
3944
4031
|
"varchar(255)",
|
|
@@ -3951,15 +4038,15 @@ async function hs(t) {
|
|
|
3951
4038
|
(e) => e.onDelete("cascade")
|
|
3952
4039
|
).addColumn("code_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();
|
|
3953
4040
|
}
|
|
3954
|
-
const
|
|
4041
|
+
const Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3955
4042
|
__proto__: null,
|
|
3956
|
-
down:
|
|
3957
|
-
up:
|
|
4043
|
+
down: vs,
|
|
4044
|
+
up: ys
|
|
3958
4045
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3959
|
-
async function
|
|
4046
|
+
async function Cs(t) {
|
|
3960
4047
|
await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
|
|
3961
4048
|
}
|
|
3962
|
-
async function
|
|
4049
|
+
async function bs(t) {
|
|
3963
4050
|
await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
|
|
3964
4051
|
"tenant_id",
|
|
3965
4052
|
"varchar(255)",
|
|
@@ -3978,32 +4065,32 @@ async function gs(t) {
|
|
|
3978
4065
|
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
3979
4066
|
).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").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();
|
|
3980
4067
|
}
|
|
3981
|
-
const
|
|
4068
|
+
const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3982
4069
|
__proto__: null,
|
|
3983
|
-
down:
|
|
3984
|
-
up:
|
|
4070
|
+
down: bs,
|
|
4071
|
+
up: Cs
|
|
3985
4072
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3986
|
-
async function
|
|
4073
|
+
async function Ts(t) {
|
|
3987
4074
|
await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
|
|
3988
4075
|
}
|
|
3989
|
-
async function
|
|
4076
|
+
async function Ss(t) {
|
|
3990
4077
|
await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
|
|
3991
4078
|
}
|
|
3992
|
-
const
|
|
4079
|
+
const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3993
4080
|
__proto__: null,
|
|
3994
|
-
down:
|
|
3995
|
-
up:
|
|
4081
|
+
down: Ss,
|
|
4082
|
+
up: Ts
|
|
3996
4083
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3997
|
-
async function
|
|
4084
|
+
async function ks(t) {
|
|
3998
4085
|
}
|
|
3999
|
-
async function
|
|
4086
|
+
async function $s(t) {
|
|
4000
4087
|
}
|
|
4001
|
-
const
|
|
4088
|
+
const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4002
4089
|
__proto__: null,
|
|
4003
|
-
down:
|
|
4004
|
-
up:
|
|
4090
|
+
down: $s,
|
|
4091
|
+
up: ks
|
|
4005
4092
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4006
|
-
async function
|
|
4093
|
+
async function Ds(t) {
|
|
4007
4094
|
await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
|
|
4008
4095
|
"universal_login_experience",
|
|
4009
4096
|
"varchar(16)",
|
|
@@ -4022,26 +4109,8 @@ async function Ts(t) {
|
|
|
4022
4109
|
(e) => e.defaultTo(!1).notNull()
|
|
4023
4110
|
).execute();
|
|
4024
4111
|
}
|
|
4025
|
-
async function Ss(t) {
|
|
4026
|
-
await t.schema.dropTable("prompt_settings").execute();
|
|
4027
|
-
}
|
|
4028
|
-
const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4029
|
-
__proto__: null,
|
|
4030
|
-
down: Ss,
|
|
4031
|
-
up: Ts
|
|
4032
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
4033
|
-
async function ks(t) {
|
|
4034
|
-
}
|
|
4035
|
-
async function $s(t) {
|
|
4036
|
-
}
|
|
4037
|
-
const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4038
|
-
__proto__: null,
|
|
4039
|
-
down: $s,
|
|
4040
|
-
up: ks
|
|
4041
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
4042
|
-
async function Ds(t) {
|
|
4043
|
-
}
|
|
4044
4112
|
async function Ps(t) {
|
|
4113
|
+
await t.schema.dropTable("prompt_settings").execute();
|
|
4045
4114
|
}
|
|
4046
4115
|
const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4047
4116
|
__proto__: null,
|
|
@@ -4050,38 +4119,36 @@ const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4050
4119
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4051
4120
|
async function Fs(t) {
|
|
4052
4121
|
}
|
|
4053
|
-
async function
|
|
4122
|
+
async function As(t) {
|
|
4054
4123
|
}
|
|
4055
|
-
const
|
|
4124
|
+
const Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4056
4125
|
__proto__: null,
|
|
4057
|
-
down:
|
|
4126
|
+
down: As,
|
|
4058
4127
|
up: Fs
|
|
4059
4128
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4060
4129
|
async function zs(t) {
|
|
4061
|
-
await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
|
|
4062
4130
|
}
|
|
4063
|
-
async function
|
|
4064
|
-
await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
|
|
4131
|
+
async function Js(t) {
|
|
4065
4132
|
}
|
|
4066
|
-
const
|
|
4133
|
+
const Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4067
4134
|
__proto__: null,
|
|
4068
|
-
down:
|
|
4135
|
+
down: Js,
|
|
4069
4136
|
up: zs
|
|
4070
4137
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4071
|
-
async function
|
|
4072
|
-
await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
|
|
4138
|
+
async function Es(t) {
|
|
4073
4139
|
}
|
|
4074
4140
|
async function Rs(t) {
|
|
4075
|
-
await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
|
|
4076
4141
|
}
|
|
4077
4142
|
const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4078
4143
|
__proto__: null,
|
|
4079
4144
|
down: Rs,
|
|
4080
|
-
up:
|
|
4145
|
+
up: Es
|
|
4081
4146
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4082
4147
|
async function Us(t) {
|
|
4148
|
+
await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
|
|
4083
4149
|
}
|
|
4084
4150
|
async function Bs(t) {
|
|
4151
|
+
await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
|
|
4085
4152
|
}
|
|
4086
4153
|
const Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4087
4154
|
__proto__: null,
|
|
@@ -4089,10 +4156,10 @@ const Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4089
4156
|
up: Us
|
|
4090
4157
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4091
4158
|
async function qs(t) {
|
|
4092
|
-
await t.schema.alterTable("logins").addColumn("
|
|
4159
|
+
await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
|
|
4093
4160
|
}
|
|
4094
4161
|
async function Vs(t) {
|
|
4095
|
-
await t.schema.alterTable("logins").dropColumn("
|
|
4162
|
+
await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
|
|
4096
4163
|
}
|
|
4097
4164
|
const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4098
4165
|
__proto__: null,
|
|
@@ -4100,10 +4167,8 @@ const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4100
4167
|
up: qs
|
|
4101
4168
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4102
4169
|
async function Gs(t) {
|
|
4103
|
-
await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
|
|
4104
4170
|
}
|
|
4105
4171
|
async function Hs(t) {
|
|
4106
|
-
await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
|
|
4107
4172
|
}
|
|
4108
4173
|
const Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4109
4174
|
__proto__: null,
|
|
@@ -4111,6 +4176,28 @@ const Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4111
4176
|
up: Gs
|
|
4112
4177
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4113
4178
|
async function Xs(t) {
|
|
4179
|
+
await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
|
|
4180
|
+
}
|
|
4181
|
+
async function Zs(t) {
|
|
4182
|
+
await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
|
|
4183
|
+
}
|
|
4184
|
+
const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4185
|
+
__proto__: null,
|
|
4186
|
+
down: Zs,
|
|
4187
|
+
up: Xs
|
|
4188
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4189
|
+
async function ti(t) {
|
|
4190
|
+
await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
|
|
4191
|
+
}
|
|
4192
|
+
async function ai(t) {
|
|
4193
|
+
await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
|
|
4194
|
+
}
|
|
4195
|
+
const ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4196
|
+
__proto__: null,
|
|
4197
|
+
down: ai,
|
|
4198
|
+
up: ti
|
|
4199
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4200
|
+
async function ni(t) {
|
|
4114
4201
|
await t.schema.createTable("email_providers").addColumn("tenant_id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("enabled", "boolean", (e) => e.notNull()).addColumn("default_from_address", "varchar(255)").addColumn(
|
|
4115
4202
|
"credentials",
|
|
4116
4203
|
"varchar(2048)",
|
|
@@ -4121,18 +4208,18 @@ async function Xs(t) {
|
|
|
4121
4208
|
(e) => e.notNull().defaultTo("{}")
|
|
4122
4209
|
).addColumn("created_at", "varchar(29)", (e) => e.notNull()).addColumn("updated_at", "varchar(29)", (e) => e.notNull()).execute();
|
|
4123
4210
|
}
|
|
4124
|
-
async function
|
|
4211
|
+
async function oi(t) {
|
|
4125
4212
|
await t.schema.dropTable("email_providers").execute();
|
|
4126
4213
|
}
|
|
4127
|
-
const
|
|
4214
|
+
const si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4128
4215
|
__proto__: null,
|
|
4129
|
-
down:
|
|
4130
|
-
up:
|
|
4216
|
+
down: oi,
|
|
4217
|
+
up: ni
|
|
4131
4218
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4132
|
-
async function
|
|
4219
|
+
async function ii(t) {
|
|
4133
4220
|
await t.schema.dropTable("tickets").execute();
|
|
4134
4221
|
}
|
|
4135
|
-
async function
|
|
4222
|
+
async function li(t) {
|
|
4136
4223
|
await t.schema.createTable("tickets").addColumn(
|
|
4137
4224
|
"tenant_id",
|
|
4138
4225
|
"varchar(255)",
|
|
@@ -4143,22 +4230,22 @@ async function ri(t) {
|
|
|
4143
4230
|
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
4144
4231
|
).addColumn("email", "varchar(255)", (e) => e.notNull()).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();
|
|
4145
4232
|
}
|
|
4146
|
-
const
|
|
4233
|
+
const ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4147
4234
|
__proto__: null,
|
|
4148
|
-
down:
|
|
4149
|
-
up:
|
|
4235
|
+
down: li,
|
|
4236
|
+
up: ii
|
|
4150
4237
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4151
|
-
async function
|
|
4238
|
+
async function di(t) {
|
|
4152
4239
|
}
|
|
4153
|
-
async function
|
|
4240
|
+
async function ui(t) {
|
|
4154
4241
|
await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
|
|
4155
4242
|
}
|
|
4156
|
-
const
|
|
4243
|
+
const mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4157
4244
|
__proto__: null,
|
|
4158
|
-
down:
|
|
4159
|
-
up:
|
|
4245
|
+
down: ui,
|
|
4246
|
+
up: di
|
|
4160
4247
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4161
|
-
async function
|
|
4248
|
+
async function _i(t) {
|
|
4162
4249
|
await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
|
|
4163
4250
|
"client_id",
|
|
4164
4251
|
"varchar(21)",
|
|
@@ -4171,27 +4258,27 @@ async function ii(t) {
|
|
|
4171
4258
|
(e) => e.onDelete("cascade")
|
|
4172
4259
|
).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();
|
|
4173
4260
|
}
|
|
4174
|
-
async function
|
|
4261
|
+
async function hi(t) {
|
|
4175
4262
|
await t.schema.dropTable("refresh_tokens").execute();
|
|
4176
4263
|
}
|
|
4177
|
-
const
|
|
4264
|
+
const fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4178
4265
|
__proto__: null,
|
|
4179
|
-
down:
|
|
4180
|
-
up:
|
|
4266
|
+
down: hi,
|
|
4267
|
+
up: _i
|
|
4181
4268
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4182
|
-
async function
|
|
4269
|
+
async function pi(t) {
|
|
4183
4270
|
}
|
|
4184
|
-
async function
|
|
4271
|
+
async function gi(t) {
|
|
4185
4272
|
}
|
|
4186
|
-
const
|
|
4273
|
+
const wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4187
4274
|
__proto__: null,
|
|
4188
|
-
down:
|
|
4189
|
-
up:
|
|
4275
|
+
down: gi,
|
|
4276
|
+
up: pi
|
|
4190
4277
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4191
|
-
async function
|
|
4278
|
+
async function yi(t) {
|
|
4192
4279
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
|
|
4193
4280
|
}
|
|
4194
|
-
async function
|
|
4281
|
+
async function vi(t) {
|
|
4195
4282
|
await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
4196
4283
|
"sessions_user_id_constraint",
|
|
4197
4284
|
["user_id", "tenant_id"],
|
|
@@ -4210,12 +4297,12 @@ async function hi(t) {
|
|
|
4210
4297
|
(e) => e.onDelete("cascade")
|
|
4211
4298
|
).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();
|
|
4212
4299
|
}
|
|
4213
|
-
const
|
|
4300
|
+
const Ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4214
4301
|
__proto__: null,
|
|
4215
|
-
down:
|
|
4216
|
-
up:
|
|
4302
|
+
down: vi,
|
|
4303
|
+
up: yi
|
|
4217
4304
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4218
|
-
async function
|
|
4305
|
+
async function Ci(t) {
|
|
4219
4306
|
await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
4220
4307
|
"sessions_2_user_id_constraint",
|
|
4221
4308
|
["user_id", "tenant_id"],
|
|
@@ -4234,15 +4321,15 @@ async function pi(t) {
|
|
|
4234
4321
|
(e) => e.onDelete("cascade")
|
|
4235
4322
|
).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();
|
|
4236
4323
|
}
|
|
4237
|
-
async function
|
|
4324
|
+
async function bi(t) {
|
|
4238
4325
|
await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
|
|
4239
4326
|
}
|
|
4240
|
-
const
|
|
4327
|
+
const xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4241
4328
|
__proto__: null,
|
|
4242
|
-
down:
|
|
4243
|
-
up:
|
|
4329
|
+
down: bi,
|
|
4330
|
+
up: Ci
|
|
4244
4331
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4245
|
-
async function
|
|
4332
|
+
async function Ti(t) {
|
|
4246
4333
|
await t.schema.createTable("custom_domains").addColumn(
|
|
4247
4334
|
"custom_domain_id",
|
|
4248
4335
|
"varchar(21)",
|
|
@@ -4253,49 +4340,49 @@ async function yi(t) {
|
|
|
4253
4340
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
4254
4341
|
).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("primary", "boolean", (e) => e.notNull()).addColumn("status", "varchar(50)", (e) => e.notNull()).addColumn("type", "varchar(50)", (e) => e.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute(), await t.schema.dropTable("domains").execute();
|
|
4255
4342
|
}
|
|
4256
|
-
async function
|
|
4343
|
+
async function Si(t) {
|
|
4257
4344
|
await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("domains").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
|
|
4258
4345
|
"tenant_id",
|
|
4259
4346
|
"varchar(255)",
|
|
4260
4347
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
4261
4348
|
).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();
|
|
4262
4349
|
}
|
|
4263
|
-
const
|
|
4350
|
+
const Oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4264
4351
|
__proto__: null,
|
|
4265
|
-
down:
|
|
4266
|
-
up:
|
|
4352
|
+
down: Si,
|
|
4353
|
+
up: Ti
|
|
4267
4354
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4268
|
-
async function
|
|
4355
|
+
async function ki(t) {
|
|
4269
4356
|
}
|
|
4270
|
-
async function
|
|
4357
|
+
async function $i(t) {
|
|
4271
4358
|
await t.schema.alterTable("logins").dropColumn("authParams_organization").dropColumn("authorization_url").execute();
|
|
4272
4359
|
}
|
|
4273
|
-
const
|
|
4360
|
+
const Ii = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4274
4361
|
__proto__: null,
|
|
4275
|
-
down:
|
|
4276
|
-
up:
|
|
4362
|
+
down: $i,
|
|
4363
|
+
up: ki
|
|
4277
4364
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4278
|
-
async function
|
|
4365
|
+
async function Di(t) {
|
|
4279
4366
|
await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(2048)").execute();
|
|
4280
4367
|
}
|
|
4281
|
-
async function
|
|
4368
|
+
async function Pi(t) {
|
|
4282
4369
|
await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(1024)").execute();
|
|
4283
4370
|
}
|
|
4284
|
-
const
|
|
4371
|
+
const ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4285
4372
|
__proto__: null,
|
|
4286
|
-
down:
|
|
4287
|
-
up:
|
|
4373
|
+
down: Pi,
|
|
4374
|
+
up: Di
|
|
4288
4375
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4289
|
-
async function
|
|
4376
|
+
async function Fi(t) {
|
|
4290
4377
|
}
|
|
4291
|
-
async function
|
|
4378
|
+
async function Ai(t) {
|
|
4292
4379
|
}
|
|
4293
|
-
const
|
|
4380
|
+
const Mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4294
4381
|
__proto__: null,
|
|
4295
|
-
down:
|
|
4296
|
-
up:
|
|
4382
|
+
down: Ai,
|
|
4383
|
+
up: Fi
|
|
4297
4384
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4298
|
-
async function
|
|
4385
|
+
async function zi(t) {
|
|
4299
4386
|
await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
4300
4387
|
"sessions_user_id_constraint",
|
|
4301
4388
|
["user_id", "tenant_id"],
|
|
@@ -4322,25 +4409,25 @@ async function Di(t) {
|
|
|
4322
4409
|
(e) => e.onDelete("cascade")
|
|
4323
4410
|
).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();
|
|
4324
4411
|
}
|
|
4325
|
-
async function
|
|
4412
|
+
async function Ji(t) {
|
|
4326
4413
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("login_sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
|
|
4327
4414
|
}
|
|
4328
|
-
const
|
|
4415
|
+
const Li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4329
4416
|
__proto__: null,
|
|
4330
|
-
down:
|
|
4331
|
-
up:
|
|
4417
|
+
down: Ji,
|
|
4418
|
+
up: zi
|
|
4332
4419
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4333
|
-
async function
|
|
4420
|
+
async function Ei(t) {
|
|
4334
4421
|
await t.schema.dropTable("logins").execute(), await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
|
|
4335
4422
|
}
|
|
4336
|
-
async function
|
|
4423
|
+
async function Ri(t) {
|
|
4337
4424
|
}
|
|
4338
|
-
const
|
|
4425
|
+
const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4339
4426
|
__proto__: null,
|
|
4340
|
-
down:
|
|
4341
|
-
up:
|
|
4427
|
+
down: Ri,
|
|
4428
|
+
up: Ei
|
|
4342
4429
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4343
|
-
async function
|
|
4430
|
+
async function Ui(t) {
|
|
4344
4431
|
await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("custom_domains").addColumn(
|
|
4345
4432
|
"custom_domain_id",
|
|
4346
4433
|
"varchar(256)",
|
|
@@ -4351,28 +4438,7 @@ async function zi(t) {
|
|
|
4351
4438
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
4352
4439
|
).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("primary", "boolean", (e) => e.notNull()).addColumn("status", "varchar(50)", (e) => e.notNull()).addColumn("type", "varchar(50)", (e) => e.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute();
|
|
4353
4440
|
}
|
|
4354
|
-
async function Li(t) {
|
|
4355
|
-
}
|
|
4356
|
-
const Ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4357
|
-
__proto__: null,
|
|
4358
|
-
down: Li,
|
|
4359
|
-
up: zi
|
|
4360
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
4361
|
-
async function Ji(t) {
|
|
4362
|
-
}
|
|
4363
|
-
async function Ri(t) {
|
|
4364
|
-
await t.schema.alterTable("users").dropColumn("phone_number").dropColumn("phone_verified").dropColumn("username").execute();
|
|
4365
|
-
}
|
|
4366
|
-
const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4367
|
-
__proto__: null,
|
|
4368
|
-
down: Ri,
|
|
4369
|
-
up: Ji
|
|
4370
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
4371
|
-
async function Ui(t) {
|
|
4372
|
-
await t.schema.createTable("forms").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(255)", (e) => e.notNull()).addColumn("messages", "varchar(255)").addColumn("languages", "varchar(255)").addColumn("translations", "varchar(4096)").addColumn("nodes", "varchar(4096)").addColumn("start", "varchar(255)").addColumn("ending", "varchar(255)").addColumn("style", "varchar(1042)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createIndex("forms_tenant_id_idx").on("forms").column("tenant_id").execute();
|
|
4373
|
-
}
|
|
4374
4441
|
async function Bi(t) {
|
|
4375
|
-
await t.schema.dropTable("forms").execute();
|
|
4376
4442
|
}
|
|
4377
4443
|
const Qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4378
4444
|
__proto__: null,
|
|
@@ -4380,10 +4446,9 @@ const Qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4380
4446
|
up: Ui
|
|
4381
4447
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4382
4448
|
async function qi(t) {
|
|
4383
|
-
await t.schema.alterTable("hooks").addColumn("form_id", "text").execute(), await t.schema.alterTable("hooks").addColumn("url_tmp", "varchar(512)").execute(), await t.updateTable("hooks").set((e) => ({ url_tmp: e.ref("url") })).execute(), await t.schema.alterTable("hooks").dropColumn("url").execute(), await t.schema.alterTable("hooks").renameColumn("url_tmp", "url").execute();
|
|
4384
4449
|
}
|
|
4385
4450
|
async function Vi(t) {
|
|
4386
|
-
await t.schema.
|
|
4451
|
+
await t.schema.alterTable("users").dropColumn("phone_number").dropColumn("phone_verified").dropColumn("username").execute();
|
|
4387
4452
|
}
|
|
4388
4453
|
const Wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4389
4454
|
__proto__: null,
|
|
@@ -4391,14 +4456,10 @@ const Wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4391
4456
|
up: qi
|
|
4392
4457
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4393
4458
|
async function Gi(t) {
|
|
4394
|
-
await t.schema.
|
|
4395
|
-
"login_completed",
|
|
4396
|
-
"boolean",
|
|
4397
|
-
(e) => e.notNull().defaultTo(0)
|
|
4398
|
-
).execute();
|
|
4459
|
+
await t.schema.createTable("forms").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(255)", (e) => e.notNull()).addColumn("messages", "varchar(255)").addColumn("languages", "varchar(255)").addColumn("translations", "varchar(4096)").addColumn("nodes", "varchar(4096)").addColumn("start", "varchar(255)").addColumn("ending", "varchar(255)").addColumn("style", "varchar(1042)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createIndex("forms_tenant_id_idx").on("forms").column("tenant_id").execute();
|
|
4399
4460
|
}
|
|
4400
4461
|
async function Hi(t) {
|
|
4401
|
-
await t.schema.
|
|
4462
|
+
await t.schema.dropTable("forms").execute();
|
|
4402
4463
|
}
|
|
4403
4464
|
const Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4404
4465
|
__proto__: null,
|
|
@@ -4406,14 +4467,10 @@ const Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4406
4467
|
up: Gi
|
|
4407
4468
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4408
4469
|
async function Xi(t) {
|
|
4409
|
-
await t.schema.alterTable("
|
|
4410
|
-
"login_session_id",
|
|
4411
|
-
"varchar(21)",
|
|
4412
|
-
(e) => e.references("login_sessions.id").onDelete("set null")
|
|
4413
|
-
).execute();
|
|
4470
|
+
await t.schema.alterTable("hooks").addColumn("form_id", "text").execute(), await t.schema.alterTable("hooks").addColumn("url_tmp", "varchar(512)").execute(), await t.updateTable("hooks").set((e) => ({ url_tmp: e.ref("url") })).execute(), await t.schema.alterTable("hooks").dropColumn("url").execute(), await t.schema.alterTable("hooks").renameColumn("url_tmp", "url").execute();
|
|
4414
4471
|
}
|
|
4415
4472
|
async function Zi(t) {
|
|
4416
|
-
await t.schema.
|
|
4473
|
+
await t.schema.dropTable("hooks").ifExists().execute(), await t.schema.createTable("hooks").addColumn("hook_id", "text", (e) => e.primaryKey()).addColumn("tenant_id", "text", (e) => e.notNull()).addColumn("trigger_id", "text", (e) => e.notNull()).addColumn("enabled", "integer", (e) => e.notNull().defaultTo(0)).addColumn("url", "varchar(512)", (e) => e.notNull()).addColumn("synchronous", "integer", (e) => e.notNull().defaultTo(0)).addColumn("priority", "integer").addColumn("created_at", "text", (e) => e.notNull()).addColumn("updated_at", "text", (e) => e.notNull()).execute();
|
|
4417
4474
|
}
|
|
4418
4475
|
const el = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4419
4476
|
__proto__: null,
|
|
@@ -4421,21 +4478,29 @@ const el = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4421
4478
|
up: Xi
|
|
4422
4479
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4423
4480
|
async function tl(t) {
|
|
4424
|
-
await t.schema.
|
|
4481
|
+
await t.schema.alterTable("login_sessions").addColumn(
|
|
4482
|
+
"login_completed",
|
|
4483
|
+
"boolean",
|
|
4484
|
+
(e) => e.notNull().defaultTo(0)
|
|
4485
|
+
).execute();
|
|
4425
4486
|
}
|
|
4426
|
-
async function
|
|
4427
|
-
await t.schema.
|
|
4487
|
+
async function al(t) {
|
|
4488
|
+
await t.schema.alterTable("login_sessions").dropColumn("login_completed").execute();
|
|
4428
4489
|
}
|
|
4429
|
-
const
|
|
4490
|
+
const rl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4430
4491
|
__proto__: null,
|
|
4431
|
-
down:
|
|
4492
|
+
down: al,
|
|
4432
4493
|
up: tl
|
|
4433
4494
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4434
4495
|
async function nl(t) {
|
|
4435
|
-
await t.schema.alterTable("
|
|
4496
|
+
await t.schema.alterTable("sessions").addColumn(
|
|
4497
|
+
"login_session_id",
|
|
4498
|
+
"varchar(21)",
|
|
4499
|
+
(e) => e.references("login_sessions.id").onDelete("set null")
|
|
4500
|
+
).execute();
|
|
4436
4501
|
}
|
|
4437
4502
|
async function ol(t) {
|
|
4438
|
-
await t.schema.alterTable("
|
|
4503
|
+
await t.schema.alterTable("sessions").dropColumn("login_session_id").execute();
|
|
4439
4504
|
}
|
|
4440
4505
|
const sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4441
4506
|
__proto__: null,
|
|
@@ -4443,10 +4508,10 @@ const sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4443
4508
|
up: nl
|
|
4444
4509
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4445
4510
|
async function il(t) {
|
|
4446
|
-
await t.schema.
|
|
4511
|
+
await t.schema.createIndex("IDX_sessions_login_session_id").on("sessions").column("login_session_id").execute();
|
|
4447
4512
|
}
|
|
4448
4513
|
async function ll(t) {
|
|
4449
|
-
await t.schema.
|
|
4514
|
+
await t.schema.dropIndex("IDX_sessions_login_session_id").on("sessions").execute();
|
|
4450
4515
|
}
|
|
4451
4516
|
const cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4452
4517
|
__proto__: null,
|
|
@@ -4454,10 +4519,10 @@ const cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4454
4519
|
up: il
|
|
4455
4520
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4456
4521
|
async function dl(t) {
|
|
4457
|
-
await t.schema.alterTable("codes").addColumn("
|
|
4522
|
+
await t.schema.alterTable("codes").addColumn("code_challenge", "varchar(128)").execute(), await t.schema.alterTable("codes").addColumn("code_challenge_method", "varchar(5)").execute();
|
|
4458
4523
|
}
|
|
4459
4524
|
async function ul(t) {
|
|
4460
|
-
await t.schema.alterTable("codes").dropColumn("
|
|
4525
|
+
await t.schema.alterTable("codes").dropColumn("code_challenge").execute(), await t.schema.alterTable("codes").dropColumn("code_challenge_method").execute();
|
|
4461
4526
|
}
|
|
4462
4527
|
const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4463
4528
|
__proto__: null,
|
|
@@ -4465,6 +4530,28 @@ const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4465
4530
|
up: dl
|
|
4466
4531
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4467
4532
|
async function _l(t) {
|
|
4533
|
+
await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
|
|
4534
|
+
}
|
|
4535
|
+
async function hl(t) {
|
|
4536
|
+
await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
|
|
4537
|
+
}
|
|
4538
|
+
const fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4539
|
+
__proto__: null,
|
|
4540
|
+
down: hl,
|
|
4541
|
+
up: _l
|
|
4542
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4543
|
+
async function pl(t) {
|
|
4544
|
+
await t.schema.alterTable("codes").addColumn("nonce", "varchar(1024)").execute(), await t.schema.alterTable("codes").addColumn("state", "varchar(2048)").execute();
|
|
4545
|
+
}
|
|
4546
|
+
async function gl(t) {
|
|
4547
|
+
await t.schema.alterTable("codes").dropColumn("nonce").execute(), await t.schema.alterTable("codes").dropColumn("state").execute();
|
|
4548
|
+
}
|
|
4549
|
+
const wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4550
|
+
__proto__: null,
|
|
4551
|
+
down: gl,
|
|
4552
|
+
up: pl
|
|
4553
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4554
|
+
async function yl(t) {
|
|
4468
4555
|
await t.schema.createTable("themes").addColumn(
|
|
4469
4556
|
"tenant_id",
|
|
4470
4557
|
"varchar(255)",
|
|
@@ -4539,26 +4626,26 @@ async function _l(t) {
|
|
|
4539
4626
|
(e) => e.notNull()
|
|
4540
4627
|
).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("themes_pkey", ["tenant_id", "themeId"]).execute(), await t.schema.createIndex("themes_tenant_id_idx").on("themes").column("tenant_id").execute();
|
|
4541
4628
|
}
|
|
4542
|
-
async function
|
|
4629
|
+
async function vl(t) {
|
|
4543
4630
|
await t.schema.dropTable("themes").execute();
|
|
4544
4631
|
}
|
|
4545
|
-
const
|
|
4632
|
+
const Nl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4546
4633
|
__proto__: null,
|
|
4547
|
-
down:
|
|
4548
|
-
up:
|
|
4634
|
+
down: vl,
|
|
4635
|
+
up: yl
|
|
4549
4636
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4550
|
-
async function
|
|
4637
|
+
async function Cl(t) {
|
|
4551
4638
|
await t.schema.createTable("resource_servers").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("identifier", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("scopes", "varchar(4096)").addColumn("signing_alg", "varchar(64)").addColumn("signing_secret", "varchar(2048)").addColumn("token_lifetime", "integer").addColumn("token_lifetime_for_web", "integer").addColumn("skip_consent_for_verifiable_first_party_clients", "integer").addColumn("allow_offline_access", "integer").addColumn("verification_key", "varchar(4096)").addColumn("options", "varchar(4096)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("resource_servers_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("resource_servers_tenant_identifier_uq").on("resource_servers").columns(["tenant_id", "identifier"]).unique().execute(), await t.schema.createTable("roles").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(50)", (e) => e.notNull()).addColumn("description", "varchar(255)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("roles_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("roles_tenant_name_uq").on("roles").columns(["tenant_id", "name"]).unique().execute();
|
|
4552
4639
|
}
|
|
4553
|
-
async function
|
|
4640
|
+
async function bl(t) {
|
|
4554
4641
|
await t.schema.dropTable("roles").execute(), await t.schema.dropTable("resource_servers").execute();
|
|
4555
4642
|
}
|
|
4556
|
-
const
|
|
4643
|
+
const xl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4557
4644
|
__proto__: null,
|
|
4558
|
-
down:
|
|
4559
|
-
up:
|
|
4645
|
+
down: bl,
|
|
4646
|
+
up: Cl
|
|
4560
4647
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4561
|
-
async function
|
|
4648
|
+
async function Tl(t) {
|
|
4562
4649
|
await t.schema.createTable("role_permissions").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("role_id", "varchar(21)", (e) => e.notNull()).addColumn(
|
|
4563
4650
|
"resource_server_identifier",
|
|
4564
4651
|
"varchar(191)",
|
|
@@ -4579,139 +4666,151 @@ async function yl(t) {
|
|
|
4579
4666
|
"permission_name"
|
|
4580
4667
|
]).execute(), await t.schema.createIndex("user_permissions_user_fk").on("user_permissions").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_permissions_permission_fk").on("user_permissions").columns(["tenant_id", "resource_server_identifier", "permission_name"]).execute();
|
|
4581
4668
|
}
|
|
4582
|
-
async function
|
|
4669
|
+
async function Sl(t) {
|
|
4583
4670
|
await t.schema.dropTable("user_permissions").execute(), await t.schema.dropTable("role_permissions").execute();
|
|
4584
4671
|
}
|
|
4585
|
-
const
|
|
4672
|
+
const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4586
4673
|
__proto__: null,
|
|
4587
|
-
down:
|
|
4588
|
-
up:
|
|
4674
|
+
down: Sl,
|
|
4675
|
+
up: Tl
|
|
4589
4676
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4590
|
-
async function
|
|
4677
|
+
async function kl(t) {
|
|
4591
4678
|
await t.schema.createTable("user_roles").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn("role_id", "varchar(21)", (e) => e.notNull()).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("user_roles_pk", [
|
|
4592
4679
|
"tenant_id",
|
|
4593
4680
|
"user_id",
|
|
4594
4681
|
"role_id"
|
|
4595
4682
|
]).execute(), await t.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute();
|
|
4596
4683
|
}
|
|
4597
|
-
async function
|
|
4684
|
+
async function $l(t) {
|
|
4598
4685
|
await t.schema.dropTable("user_roles").execute();
|
|
4599
4686
|
}
|
|
4600
|
-
const
|
|
4687
|
+
const Il = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4601
4688
|
__proto__: null,
|
|
4602
|
-
down:
|
|
4603
|
-
up:
|
|
4689
|
+
down: $l,
|
|
4690
|
+
up: kl
|
|
4604
4691
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4605
|
-
async function
|
|
4692
|
+
async function Dl(t) {
|
|
4606
4693
|
}
|
|
4607
|
-
async function
|
|
4694
|
+
async function Pl(t) {
|
|
4608
4695
|
await t.schema.alterTable("keys").dropColumn("connection").execute(), await t.schema.alterTable("keys").modifyColumn("cert", "varchar(2048)").execute(), await t.schema.alterTable("keys").modifyColumn("pkcs7", "varchar(2048)").execute(), await t.schema.alterTable("keys").dropColumn("type").execute();
|
|
4609
4696
|
}
|
|
4610
|
-
const
|
|
4697
|
+
const jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4611
4698
|
__proto__: null,
|
|
4612
|
-
down:
|
|
4613
|
-
up:
|
|
4614
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4699
|
+
down: Pl,
|
|
4700
|
+
up: Dl
|
|
4701
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4702
|
+
async function Fl(t) {
|
|
4703
|
+
await t.schema.createTable("organizations").addColumn("id", "varchar(256)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(256)", (e) => e.notNull()).addColumn("name", "varchar(256)", (e) => e.notNull()).addColumn("display_name", "varchar(256)").addColumn("branding", "text").addColumn("metadata", "text").addColumn("enabled_connections", "text").addColumn("token_quota", "text").addColumn("created_at", "varchar(256)", (e) => e.notNull()).addColumn("updated_at", "varchar(256)", (e) => e.notNull()).execute(), await t.schema.createIndex("idx_organizations_tenant_id").on("organizations").column("tenant_id").execute(), await t.schema.createIndex("idx_organizations_tenant_name_unique").on("organizations").columns(["tenant_id", "name"]).unique().execute();
|
|
4704
|
+
}
|
|
4705
|
+
async function Al(t) {
|
|
4706
|
+
await t.schema.dropTable("organizations").execute();
|
|
4707
|
+
}
|
|
4708
|
+
const Ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4709
|
+
__proto__: null,
|
|
4710
|
+
down: Al,
|
|
4711
|
+
up: Fl
|
|
4712
|
+
}, Symbol.toStringTag, { value: "Module" })), Le = {
|
|
4713
|
+
m1_init: Tr,
|
|
4714
|
+
m2_magicLink: kr,
|
|
4715
|
+
m3_updateAt: Dr,
|
|
4716
|
+
m4_logTable: Fr,
|
|
4717
|
+
m5_userProfile: zr,
|
|
4718
|
+
m6_sessions: Er,
|
|
4719
|
+
m7_passwords: Ur,
|
|
4720
|
+
m8_logsTableNewFields: qr,
|
|
4721
|
+
m9_passwordTableNewField: Gr,
|
|
4722
|
+
n01_codesTable: Xr,
|
|
4723
|
+
n11_universalLoginSession: tn,
|
|
4724
|
+
n12_userFields: nn,
|
|
4725
|
+
n13_userEmailIndex: ln,
|
|
4726
|
+
n14_profileDataField: un,
|
|
4727
|
+
n15_userEmailIndex: hn,
|
|
4728
|
+
n16_userLocale: gn,
|
|
4729
|
+
n17_signingKeys: vn,
|
|
4730
|
+
n18_logsFields: bn,
|
|
4731
|
+
n19_connectionsUserinfo: Sn,
|
|
4732
|
+
n20_missingFields: $n,
|
|
4733
|
+
n21_sessionDeletedAt: Pn,
|
|
4734
|
+
n22_dropLogsFields: An,
|
|
4735
|
+
n23_dropUsersFields: Jn,
|
|
4736
|
+
n24_logsIndexes: Rn,
|
|
4737
|
+
n25_logDescMaxLength: Bn,
|
|
4738
|
+
n26_logsTableExtraFields: Vn,
|
|
4739
|
+
n27_usersTableNameIndex: Hn,
|
|
4740
|
+
n28_usersEmailConstrain: Zn,
|
|
4741
|
+
n29_increaseOtpStateLength: ao,
|
|
4742
|
+
n30_increaseTicketStateLength: oo,
|
|
4743
|
+
n31_branding: lo,
|
|
4744
|
+
n32_indexesAndNotNull: mo,
|
|
4745
|
+
n33_vendorIdInUniversalLoginSession: fo,
|
|
4746
|
+
n34_auth0ClientInUniversalLoginSession: wo,
|
|
4747
|
+
n35_increaseUniversalSessionStateLength: No,
|
|
4748
|
+
n36_authenticationCodes: xo,
|
|
4749
|
+
n37_disableSignUps: Oo,
|
|
4750
|
+
n38_otpIpAddress: Io,
|
|
4751
|
+
n39_increaseUserAgentLength: jo,
|
|
4752
|
+
n40_userId: Mo,
|
|
4753
|
+
n41_hooks: Lo,
|
|
4754
|
+
n42_userIdIndexes: Ko,
|
|
4755
|
+
n43_userIdIndexes: Qo,
|
|
4756
|
+
n44_codes: Wo,
|
|
4757
|
+
n45_hookProperties: Yo,
|
|
4758
|
+
n46_loginAuth0Client: es,
|
|
4759
|
+
n47_loginAuth0Client: rs,
|
|
4760
|
+
n48_saml: ss,
|
|
4761
|
+
n49_removeFields: cs,
|
|
4762
|
+
n50_authParamsNonce: ms,
|
|
4763
|
+
n51_connectionid: fs,
|
|
4764
|
+
n52_cert: ws,
|
|
4765
|
+
n53_codes_primary_key: Ns,
|
|
4766
|
+
n54_cleanup_tables: xs,
|
|
4767
|
+
n55_logs_index: Os,
|
|
4768
|
+
n56_application_fields: Is,
|
|
4769
|
+
n57_prompt_settings: js,
|
|
4770
|
+
n58_connection_client_id: Ms,
|
|
4771
|
+
n59_connection_options: Ls,
|
|
4772
|
+
n60_users_metadata: Ks,
|
|
4773
|
+
n61_userLocales: Qs,
|
|
4774
|
+
n62_prompt: Ws,
|
|
4775
|
+
n63_connection_cleanup: Ys,
|
|
4776
|
+
n64_act_as: ei,
|
|
4777
|
+
n65_code_verifier: ri,
|
|
4778
|
+
n66_email_providers: si,
|
|
4779
|
+
n67_drop_tickets: ci,
|
|
4780
|
+
n68_login_useragents: mi,
|
|
4781
|
+
n70_refresh_tokens: fi,
|
|
4782
|
+
n71_session_new_fields: wi,
|
|
4783
|
+
n72_session_primary_key: Ni,
|
|
4784
|
+
n73_drop_sessions: xi,
|
|
4785
|
+
n74_custom_domains: Oi,
|
|
4786
|
+
n75_organizations: Ii,
|
|
4787
|
+
n76_authorization_url_length: ji,
|
|
4788
|
+
n77_drop_sessions: Mi,
|
|
4789
|
+
n78_login_sessions: Li,
|
|
4790
|
+
n79_drop_sessions_2: Ki,
|
|
4791
|
+
n80_recreate_custom_domains: Qi,
|
|
4792
|
+
n81_phone: Wi,
|
|
4793
|
+
n82_forms: Yi,
|
|
4794
|
+
n83_addFormsIdToHooks: el,
|
|
4795
|
+
n84_login_completed: rl,
|
|
4796
|
+
n85_add_login_session_id_to_sessions: sl,
|
|
4797
|
+
n86_index_sessions_login_session_id: cl,
|
|
4798
|
+
n87_code_challenge: ml,
|
|
4799
|
+
n88_add_redirect_uri_to_codes: fl,
|
|
4800
|
+
n89_add_nonce_and_state_to_codes: wl,
|
|
4801
|
+
n90_themes: Nl,
|
|
4802
|
+
n91_resource_servers_rules_permissions: xl,
|
|
4803
|
+
n92_role_permissions: Ol,
|
|
4804
|
+
n93_add_permissions_to_roles: Il,
|
|
4805
|
+
n94_keys_connection_and_extend_columns: jl,
|
|
4806
|
+
n95_create_organizations_table: Ml
|
|
4708
4807
|
};
|
|
4709
|
-
async function
|
|
4808
|
+
async function Rl(t, e = !1) {
|
|
4710
4809
|
e && console.log("migrating...");
|
|
4711
|
-
const
|
|
4810
|
+
const a = new Je(Le), r = new be({
|
|
4712
4811
|
db: t,
|
|
4713
|
-
provider:
|
|
4714
|
-
}), { error: n, results: o } = await
|
|
4812
|
+
provider: a
|
|
4813
|
+
}), { error: n, results: o } = await r.migrateToLatest();
|
|
4715
4814
|
if (o == null || o.forEach((s) => {
|
|
4716
4815
|
s.status === "Success" ? e && console.log(
|
|
4717
4816
|
`migration "${s.migrationName}" was executed successfully`
|
|
@@ -4719,48 +4818,49 @@ async function Pl(t, e = !1) {
|
|
|
4719
4818
|
}), n)
|
|
4720
4819
|
throw console.error("failed to migrate"), console.error(n), n;
|
|
4721
4820
|
}
|
|
4722
|
-
async function
|
|
4821
|
+
async function Kl(t) {
|
|
4723
4822
|
console.log("migrating...");
|
|
4724
|
-
const e = new Le
|
|
4823
|
+
const e = new Je(Le), a = new be({
|
|
4725
4824
|
db: t,
|
|
4726
4825
|
provider: e
|
|
4727
|
-
}), { error:
|
|
4826
|
+
}), { error: r, results: n } = await a.migrateDown();
|
|
4728
4827
|
if (n == null || n.forEach((o) => {
|
|
4729
4828
|
o.status === "Success" ? console.log(`migration "${o.migrationName}" was reverted successfully`) : o.status === "Error" && console.error(`failed to execute migration "${o.migrationName}"`);
|
|
4730
|
-
}),
|
|
4731
|
-
throw console.error("failed to migrate"), console.error(
|
|
4829
|
+
}), r)
|
|
4830
|
+
throw console.error("failed to migrate"), console.error(r), r;
|
|
4732
4831
|
}
|
|
4733
|
-
function
|
|
4832
|
+
function Ul(t) {
|
|
4734
4833
|
return {
|
|
4735
4834
|
applications: jt(t),
|
|
4736
|
-
branding:
|
|
4737
|
-
cleanup:
|
|
4738
|
-
clients:
|
|
4835
|
+
branding: ea(t),
|
|
4836
|
+
cleanup: Ia(t),
|
|
4837
|
+
clients: Et(t),
|
|
4739
4838
|
codes: Ot(t),
|
|
4740
|
-
connections:
|
|
4741
|
-
emailProviders:
|
|
4839
|
+
connections: Lt(t),
|
|
4840
|
+
emailProviders: ba(t),
|
|
4742
4841
|
customDomains: Yt(t),
|
|
4743
|
-
forms:
|
|
4744
|
-
hooks:
|
|
4842
|
+
forms: Ma(t),
|
|
4843
|
+
hooks: sa(t),
|
|
4745
4844
|
keys: Bt(t),
|
|
4746
|
-
loginSessions:
|
|
4845
|
+
loginSessions: pa(t),
|
|
4747
4846
|
logs: ut(t),
|
|
4748
4847
|
passwords: Nt(t),
|
|
4749
|
-
promptSettings:
|
|
4750
|
-
refreshTokens: $
|
|
4751
|
-
resourceServers:
|
|
4752
|
-
rolePermissions:
|
|
4753
|
-
userPermissions:
|
|
4754
|
-
userRoles:
|
|
4755
|
-
roles:
|
|
4848
|
+
promptSettings: ya(t),
|
|
4849
|
+
refreshTokens: $a(t),
|
|
4850
|
+
resourceServers: Ka(t),
|
|
4851
|
+
rolePermissions: Xa(t),
|
|
4852
|
+
userPermissions: ar(t),
|
|
4853
|
+
userRoles: sr(t),
|
|
4854
|
+
roles: Wa(t),
|
|
4756
4855
|
sessions: gt(t),
|
|
4757
4856
|
tenants: st(t),
|
|
4758
|
-
themes:
|
|
4759
|
-
users: Ze(t)
|
|
4857
|
+
themes: ua(t),
|
|
4858
|
+
users: Ze(t),
|
|
4859
|
+
organizations: mr(t)
|
|
4760
4860
|
};
|
|
4761
4861
|
}
|
|
4762
4862
|
export {
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4863
|
+
Ul as default,
|
|
4864
|
+
Kl as migrateDown,
|
|
4865
|
+
Rl as migrateToLatest
|
|
4766
4866
|
};
|