@authhero/kysely-adapter 10.32.0 → 10.34.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 +240 -275
- package/dist/kysely-adapter.mjs +1327 -1198
- package/package.json +3 -3
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Je = Object.defineProperty;
|
|
2
2
|
var ue = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var Re = (t, e,
|
|
6
|
-
var z = (t, e,
|
|
7
|
-
var d = (t, e,
|
|
8
|
-
import { parseUserId as
|
|
5
|
+
var Re = (t, e, r) => e in t ? Je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
6
|
+
var z = (t, e, r) => Re(t, typeof e != "symbol" ? e + "" : e, r), q = (t, e, r) => e.has(t) || ue("Cannot " + r);
|
|
7
|
+
var d = (t, e, r) => (q(t, e, "read from private field"), r ? r.call(t) : e.get(t)), N = (t, e, r) => e.has(t) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), L = (t, e, r, a) => (q(t, e, "write to private field"), a ? a.call(t, r) : e.set(t, r), r), m = (t, e, r) => (q(t, e, "access private method"), r);
|
|
8
|
+
import { parseUserId as re, codeSchema as Ke, connectionSchema as Ue, loginSessionSchema as Be, promptSettingSchema as Qe, formSchema as B, resourceServerSchema as qe } from "@authhero/adapter-interfaces";
|
|
9
9
|
import "@hono/zod-openapi";
|
|
10
10
|
var H = class extends Error {
|
|
11
|
-
constructor(e = 500,
|
|
12
|
-
super(
|
|
11
|
+
constructor(e = 500, r) {
|
|
12
|
+
super(r == null ? void 0 : r.message, { cause: r == null ? void 0 : r.cause });
|
|
13
13
|
z(this, "res");
|
|
14
14
|
z(this, "status");
|
|
15
|
-
this.res =
|
|
15
|
+
this.res = r == null ? void 0 : r.res, this.status = e;
|
|
16
16
|
}
|
|
17
17
|
getResponse() {
|
|
18
18
|
return this.res ? new Response(this.res.body, {
|
|
@@ -23,18 +23,18 @@ var H = class extends Error {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
function
|
|
27
|
-
return async (e,
|
|
28
|
-
const { identities:
|
|
26
|
+
function Ve(t) {
|
|
27
|
+
return async (e, r) => {
|
|
28
|
+
const { identities: a, ...o } = r, n = {
|
|
29
29
|
...o,
|
|
30
30
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
31
31
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32
32
|
login_count: 0,
|
|
33
33
|
tenant_id: e,
|
|
34
|
-
email_verified:
|
|
35
|
-
is_social:
|
|
36
|
-
app_metadata: JSON.stringify(
|
|
37
|
-
user_metadata: JSON.stringify(
|
|
34
|
+
email_verified: r.email_verified ? 1 : 0,
|
|
35
|
+
is_social: r.is_social ? 1 : 0,
|
|
36
|
+
app_metadata: JSON.stringify(r.app_metadata),
|
|
37
|
+
user_metadata: JSON.stringify(r.user_metadata)
|
|
38
38
|
};
|
|
39
39
|
try {
|
|
40
40
|
await t.insertInto("users").values(n).execute();
|
|
@@ -52,21 +52,21 @@ function Ge(t) {
|
|
|
52
52
|
}
|
|
53
53
|
function p(t) {
|
|
54
54
|
const e = { ...t };
|
|
55
|
-
for (const
|
|
56
|
-
e[
|
|
55
|
+
for (const r in e)
|
|
56
|
+
e[r] === null ? delete e[r] : typeof e[r] == "object" && (Array.isArray(e[r]) ? e[r] = e[r].map(p) : e[r] = p(e[r]));
|
|
57
57
|
return e;
|
|
58
58
|
}
|
|
59
59
|
function pe(t) {
|
|
60
60
|
let e = {};
|
|
61
61
|
try {
|
|
62
62
|
e = JSON.parse(t.profileData || "{}");
|
|
63
|
-
} catch (
|
|
64
|
-
console.error("Error parsing profileData",
|
|
63
|
+
} catch (r) {
|
|
64
|
+
console.error("Error parsing profileData", r);
|
|
65
65
|
}
|
|
66
66
|
return {
|
|
67
67
|
connection: t.connection,
|
|
68
68
|
provider: t.provider,
|
|
69
|
-
user_id:
|
|
69
|
+
user_id: re(t.user_id).id,
|
|
70
70
|
isSocial: !!t.is_social,
|
|
71
71
|
profileData: {
|
|
72
72
|
email: t.email,
|
|
@@ -75,27 +75,27 @@ function pe(t) {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return async (e,
|
|
80
|
-
const [
|
|
81
|
-
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=",
|
|
82
|
-
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=",
|
|
78
|
+
function We(t) {
|
|
79
|
+
return async (e, r) => {
|
|
80
|
+
const [a, o] = await Promise.all([
|
|
81
|
+
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", r).selectAll().executeTakeFirst(),
|
|
82
|
+
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", r).selectAll().execute()
|
|
83
83
|
]);
|
|
84
|
-
if (!
|
|
84
|
+
if (!a)
|
|
85
85
|
return null;
|
|
86
|
-
const { tenant_id: n, ...s } =
|
|
86
|
+
const { tenant_id: n, ...s } = a, l = {
|
|
87
87
|
...s,
|
|
88
|
-
email:
|
|
89
|
-
email_verified:
|
|
90
|
-
is_social:
|
|
91
|
-
app_metadata: JSON.parse(
|
|
92
|
-
user_metadata: JSON.parse(
|
|
88
|
+
email: a.email || "",
|
|
89
|
+
email_verified: a.email_verified === 1,
|
|
90
|
+
is_social: a.is_social === 1,
|
|
91
|
+
app_metadata: JSON.parse(a.app_metadata),
|
|
92
|
+
user_metadata: JSON.parse(a.user_metadata),
|
|
93
93
|
identities: [
|
|
94
94
|
{
|
|
95
|
-
connection:
|
|
96
|
-
provider:
|
|
97
|
-
user_id:
|
|
98
|
-
isSocial: !!
|
|
95
|
+
connection: a.connection,
|
|
96
|
+
provider: a.provider,
|
|
97
|
+
user_id: re(a.user_id).id,
|
|
98
|
+
isSocial: !!a.is_social
|
|
99
99
|
},
|
|
100
100
|
...o.map(pe)
|
|
101
101
|
]
|
|
@@ -103,25 +103,25 @@ function He(t) {
|
|
|
103
103
|
return p(l);
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
return
|
|
108
|
-
let s = n.startsWith("-"), l = null,
|
|
106
|
+
function C(t, e, r, a) {
|
|
107
|
+
return r.split(/\s+/).map((n) => n.replace(/^([^:]+)=/g, "$1:")).map((n) => {
|
|
108
|
+
let s = n.startsWith("-"), l = null, c = "", _ = !1, u;
|
|
109
109
|
if (n.startsWith("-_exists_:"))
|
|
110
|
-
l = n.substring(10),
|
|
110
|
+
l = n.substring(10), _ = !0, s = !0;
|
|
111
111
|
else if (n.startsWith("_exists_:"))
|
|
112
|
-
l = n.substring(9),
|
|
112
|
+
l = n.substring(9), _ = !0, s = !1;
|
|
113
113
|
else if (n.includes(":")) {
|
|
114
|
-
const h = s ? n.substring(1) : n,
|
|
115
|
-
l = h.substring(0,
|
|
114
|
+
const h = s ? n.substring(1) : n, g = h.indexOf(":");
|
|
115
|
+
l = h.substring(0, g), c = h.substring(g + 1), _ = !1, c.startsWith(">=") ? (u = ">=", c = c.substring(2)) : c.startsWith(">") ? (u = ">", c = c.substring(1)) : c.startsWith("<=") ? (u = "<=", c = c.substring(2)) : c.startsWith("<") ? (u = "<", c = c.substring(1)) : u = "=";
|
|
116
116
|
} else
|
|
117
|
-
l = null,
|
|
118
|
-
return { key: l, value:
|
|
119
|
-
}).forEach(({ key: n, value: s, isNegation: l, isExistsQuery:
|
|
117
|
+
l = null, c = n, _ = !1;
|
|
118
|
+
return { key: l, value: c, isNegation: s, isExistsQuery: _, operator: u };
|
|
119
|
+
}).forEach(({ key: n, value: s, isNegation: l, isExistsQuery: c, operator: _ }) => {
|
|
120
120
|
if (n)
|
|
121
|
-
if (
|
|
121
|
+
if (c)
|
|
122
122
|
l ? e = e.where(n, "is", null) : e = e.where(n, "is not", null);
|
|
123
123
|
else if (l)
|
|
124
|
-
switch (
|
|
124
|
+
switch (_) {
|
|
125
125
|
case ">":
|
|
126
126
|
e = e.where(n, "<=", s);
|
|
127
127
|
break;
|
|
@@ -138,12 +138,12 @@ function N(t, e, a, r) {
|
|
|
138
138
|
e = e.where(n, "!=", s);
|
|
139
139
|
}
|
|
140
140
|
else
|
|
141
|
-
e = e.where(n,
|
|
141
|
+
e = e.where(n, _, s);
|
|
142
142
|
else if (s) {
|
|
143
143
|
const { ref: u } = t.dynamic;
|
|
144
144
|
e = e.where(
|
|
145
145
|
(h) => h.or(
|
|
146
|
-
|
|
146
|
+
a.map((g) => h(u(g), "like", `%${s}%`))
|
|
147
147
|
)
|
|
148
148
|
);
|
|
149
149
|
}
|
|
@@ -152,20 +152,20 @@ function N(t, e, a, r) {
|
|
|
152
152
|
function v(t) {
|
|
153
153
|
return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
return async (e,
|
|
155
|
+
function Ge(t) {
|
|
156
|
+
return async (e, r = {
|
|
157
157
|
page: 0,
|
|
158
158
|
per_page: 50,
|
|
159
159
|
include_totals: !1
|
|
160
160
|
}) => {
|
|
161
|
-
let
|
|
162
|
-
if (
|
|
161
|
+
let a = t.selectFrom("users").where("users.tenant_id", "=", e);
|
|
162
|
+
if (r.q && (a = C(t, a, r.q, ["email", "name"])), r.sort && r.sort.sort_by) {
|
|
163
163
|
const { ref: u } = t.dynamic;
|
|
164
|
-
|
|
164
|
+
a = a.orderBy(u(r.sort.sort_by), r.sort.sort_order);
|
|
165
165
|
}
|
|
166
|
-
const n = await
|
|
166
|
+
const n = await a.offset(r.page * r.per_page).limit(r.per_page).selectAll().execute(), s = n.map((u) => u.user_id), l = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], c = n.map((u) => {
|
|
167
167
|
const h = l.filter(
|
|
168
|
-
(
|
|
168
|
+
(g) => g.linked_to === u.user_id
|
|
169
169
|
);
|
|
170
170
|
return p({
|
|
171
171
|
...u,
|
|
@@ -177,120 +177,120 @@ function Xe(t) {
|
|
|
177
177
|
{
|
|
178
178
|
connection: u.connection,
|
|
179
179
|
provider: u.provider,
|
|
180
|
-
user_id:
|
|
180
|
+
user_id: re(u.user_id).id,
|
|
181
181
|
isSocial: !!u.is_social
|
|
182
182
|
},
|
|
183
183
|
...h.map(pe)
|
|
184
184
|
]
|
|
185
185
|
});
|
|
186
|
-
}), { count:
|
|
186
|
+
}), { count: _ } = await a.select((u) => u.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
187
187
|
return {
|
|
188
|
-
users:
|
|
189
|
-
start:
|
|
190
|
-
limit:
|
|
191
|
-
length: v(
|
|
188
|
+
users: c,
|
|
189
|
+
start: r.page * r.per_page,
|
|
190
|
+
limit: r.per_page,
|
|
191
|
+
length: v(_)
|
|
192
192
|
};
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
return async (e,
|
|
195
|
+
function He(t) {
|
|
196
|
+
return async (e, r) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", r).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", r).execute()).length === 1);
|
|
197
197
|
}
|
|
198
|
-
function A(t, e = "",
|
|
199
|
-
for (let
|
|
200
|
-
if (Object.prototype.hasOwnProperty.call(t,
|
|
201
|
-
const o = e ? `${e}_${
|
|
202
|
-
typeof n == "object" && n !== null && !Array.isArray(n) ? A(n, o,
|
|
198
|
+
function A(t, e = "", r = {}) {
|
|
199
|
+
for (let a in t)
|
|
200
|
+
if (Object.prototype.hasOwnProperty.call(t, a)) {
|
|
201
|
+
const o = e ? `${e}_${a}` : a, n = t[a];
|
|
202
|
+
typeof n == "object" && n !== null && !Array.isArray(n) ? A(n, o, r) : typeof n == "boolean" ? r[o] = n ? 1 : 0 : r[o] = n;
|
|
203
203
|
}
|
|
204
|
-
return
|
|
204
|
+
return r;
|
|
205
205
|
}
|
|
206
206
|
function ge(t, e) {
|
|
207
|
-
const
|
|
208
|
-
for (const [
|
|
207
|
+
const r = {};
|
|
208
|
+
for (const [a, o] of Object.entries(t)) {
|
|
209
209
|
const n = e.find(
|
|
210
|
-
(s) =>
|
|
210
|
+
(s) => a.startsWith(`${s}_`)
|
|
211
211
|
);
|
|
212
212
|
if (!n)
|
|
213
|
-
a
|
|
213
|
+
r[a] = o;
|
|
214
214
|
else {
|
|
215
|
-
const s =
|
|
216
|
-
|
|
217
|
-
...
|
|
215
|
+
const s = a.slice(n.length + 1);
|
|
216
|
+
r[n] = {
|
|
217
|
+
...r[n],
|
|
218
218
|
[s]: o
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
return
|
|
222
|
+
return r;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
return async (e,
|
|
224
|
+
function Xe(t) {
|
|
225
|
+
return async (e, r, a) => {
|
|
226
226
|
const o = A({
|
|
227
|
-
...
|
|
227
|
+
...a,
|
|
228
228
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
229
|
-
app_metadata:
|
|
230
|
-
user_metadata:
|
|
229
|
+
app_metadata: a.app_metadata ? JSON.stringify(a.app_metadata) : void 0,
|
|
230
|
+
user_metadata: a.user_metadata ? JSON.stringify(a.user_metadata) : void 0
|
|
231
231
|
});
|
|
232
|
-
return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=",
|
|
232
|
+
return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", r).execute()).length === 1;
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
return async (e,
|
|
235
|
+
function Ye(t) {
|
|
236
|
+
return async (e, r, a, o) => {
|
|
237
237
|
const n = { linked_to: null };
|
|
238
|
-
return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", `${
|
|
238
|
+
return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", `${a}|${o}`).where("users.linked_to", "=", `${r}`).execute()).length === 1;
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Ze(t) {
|
|
242
242
|
return {
|
|
243
|
-
create:
|
|
244
|
-
remove:
|
|
245
|
-
get:
|
|
246
|
-
list:
|
|
247
|
-
update:
|
|
243
|
+
create: Ve(t),
|
|
244
|
+
remove: He(t),
|
|
245
|
+
get: We(t),
|
|
246
|
+
list: Ge(t),
|
|
247
|
+
update: Xe(t),
|
|
248
248
|
// TODO - think about this more when other issues fixed
|
|
249
|
-
unlink:
|
|
249
|
+
unlink: Ye(t)
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
const
|
|
253
|
-
let
|
|
254
|
-
let e = "",
|
|
252
|
+
const et = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
253
|
+
let b = (t = 21) => {
|
|
254
|
+
let e = "", r = crypto.getRandomValues(new Uint8Array(t));
|
|
255
255
|
for (; t--; )
|
|
256
|
-
e +=
|
|
256
|
+
e += et[r[t] & 63];
|
|
257
257
|
return e;
|
|
258
258
|
};
|
|
259
|
-
function
|
|
259
|
+
function tt(t) {
|
|
260
260
|
return async (e) => {
|
|
261
|
-
const
|
|
262
|
-
id: e.id ||
|
|
261
|
+
const r = {
|
|
262
|
+
id: e.id || b(),
|
|
263
263
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
264
264
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
265
265
|
...e
|
|
266
266
|
};
|
|
267
|
-
return await t.insertInto("tenants").values(
|
|
267
|
+
return await t.insertInto("tenants").values(r).execute(), r;
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function rt(t) {
|
|
271
271
|
return async (e) => {
|
|
272
|
-
const
|
|
273
|
-
return
|
|
272
|
+
const r = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
|
|
273
|
+
return r ? p(r) : null;
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function at(t) {
|
|
277
277
|
return async (e = {
|
|
278
278
|
page: 0,
|
|
279
279
|
per_page: 50,
|
|
280
280
|
include_totals: !1
|
|
281
281
|
}) => {
|
|
282
|
-
let
|
|
282
|
+
let r = t.selectFrom("tenants");
|
|
283
283
|
if (e.sort && e.sort.sort_by) {
|
|
284
284
|
const { ref: l } = t.dynamic;
|
|
285
|
-
|
|
285
|
+
r = r.orderBy(l(e.sort.sort_by), e.sort.sort_order);
|
|
286
286
|
}
|
|
287
|
-
e.q && (
|
|
288
|
-
const o = await
|
|
287
|
+
e.q && (r = r.where((l) => l.or([l("name", "like", `%${e.q}%`)])));
|
|
288
|
+
const o = await r.offset(e.page * e.per_page).limit(e.per_page).selectAll().execute();
|
|
289
289
|
if (!e.include_totals)
|
|
290
290
|
return {
|
|
291
291
|
tenants: o
|
|
292
292
|
};
|
|
293
|
-
const { count: n } = await
|
|
293
|
+
const { count: n } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = v(n);
|
|
294
294
|
return {
|
|
295
295
|
tenants: o.map(p),
|
|
296
296
|
start: (e.page - 1) * e.per_page,
|
|
@@ -299,50 +299,50 @@ function ot(t) {
|
|
|
299
299
|
};
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
return async (e,
|
|
304
|
-
const
|
|
305
|
-
...
|
|
302
|
+
function nt(t) {
|
|
303
|
+
return async (e, r) => {
|
|
304
|
+
const a = {
|
|
305
|
+
...r,
|
|
306
306
|
id: e,
|
|
307
307
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
308
308
|
};
|
|
309
|
-
await t.updateTable("tenants").set(
|
|
309
|
+
await t.updateTable("tenants").set(a).where("id", "=", e).execute();
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function ot(t) {
|
|
313
313
|
return async (e) => (await t.deleteFrom("tenants").where("tenants.id", "=", e).execute()).length === 1;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function st(t) {
|
|
316
316
|
return {
|
|
317
|
-
create:
|
|
318
|
-
get:
|
|
319
|
-
list:
|
|
320
|
-
update:
|
|
321
|
-
remove:
|
|
317
|
+
create: tt(t),
|
|
318
|
+
get: rt(t),
|
|
319
|
+
list: at(t),
|
|
320
|
+
update: nt(t),
|
|
321
|
+
remove: ot(t)
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
324
|
function me(t) {
|
|
325
325
|
return t ? JSON.stringify(t) : void 0;
|
|
326
326
|
}
|
|
327
|
-
const
|
|
328
|
-
function
|
|
329
|
-
return async (e,
|
|
327
|
+
const it = 1024;
|
|
328
|
+
function lt(t) {
|
|
329
|
+
return async (e, r) => {
|
|
330
330
|
var o, n, s;
|
|
331
|
-
const
|
|
332
|
-
id:
|
|
333
|
-
...
|
|
334
|
-
user_agent:
|
|
331
|
+
const a = {
|
|
332
|
+
id: b(),
|
|
333
|
+
...r,
|
|
334
|
+
user_agent: r.user_agent.slice(0, it)
|
|
335
335
|
};
|
|
336
336
|
return await t.insertInto("logs").values({
|
|
337
|
-
...
|
|
337
|
+
...a,
|
|
338
338
|
// Truncate long strings to avoid database errors
|
|
339
|
-
description: (o =
|
|
340
|
-
isMobile:
|
|
339
|
+
description: (o = a.description) == null ? void 0 : o.substring(0, 256),
|
|
340
|
+
isMobile: r.isMobile ? 1 : 0,
|
|
341
341
|
tenant_id: e,
|
|
342
|
-
scope: (n =
|
|
343
|
-
auth0_client: me(
|
|
344
|
-
details: (s = me(
|
|
345
|
-
}).execute(),
|
|
342
|
+
scope: (n = r.scope) == null ? void 0 : n.join(","),
|
|
343
|
+
auth0_client: me(r.auth0_client),
|
|
344
|
+
details: (s = me(r.details)) == null ? void 0 : s.substring(0, 8192)
|
|
345
|
+
}).execute(), a;
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
348
|
function _e(t) {
|
|
@@ -367,51 +367,51 @@ function we(t) {
|
|
|
367
367
|
_id: t.id
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
return async (e,
|
|
370
|
+
function ct(t) {
|
|
371
|
+
return async (e, r = {
|
|
372
372
|
page: 0,
|
|
373
373
|
per_page: 50,
|
|
374
374
|
include_totals: !1
|
|
375
375
|
}) => {
|
|
376
|
-
let
|
|
377
|
-
|
|
378
|
-
let o =
|
|
379
|
-
if (
|
|
376
|
+
let a = t.selectFrom("logs").where("logs.tenant_id", "=", e);
|
|
377
|
+
r.q && (a = C(t, a, r.q, ["user_id", "ip"]));
|
|
378
|
+
let o = a;
|
|
379
|
+
if (r.sort && r.sort.sort_by) {
|
|
380
380
|
const { ref: l } = t.dynamic;
|
|
381
381
|
o = o.orderBy(
|
|
382
|
-
l(
|
|
383
|
-
|
|
382
|
+
l(r.sort.sort_by),
|
|
383
|
+
r.sort.sort_order
|
|
384
384
|
);
|
|
385
385
|
}
|
|
386
|
-
o = o.offset(
|
|
387
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
386
|
+
o = o.offset(r.page * r.per_page).limit(r.per_page);
|
|
387
|
+
const n = await o.selectAll().execute(), { count: s } = await a.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
388
388
|
return {
|
|
389
389
|
logs: n.map(we),
|
|
390
|
-
start:
|
|
391
|
-
limit:
|
|
390
|
+
start: r.page * r.per_page,
|
|
391
|
+
limit: r.per_page,
|
|
392
392
|
length: v(s)
|
|
393
393
|
};
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
|
-
function
|
|
397
|
-
return async (e,
|
|
398
|
-
const
|
|
399
|
-
return
|
|
396
|
+
function dt(t) {
|
|
397
|
+
return async (e, r) => {
|
|
398
|
+
const a = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", r).selectAll().executeTakeFirst();
|
|
399
|
+
return a ? we(a) : null;
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function ut(t) {
|
|
403
403
|
return {
|
|
404
|
-
create:
|
|
405
|
-
list:
|
|
406
|
-
get:
|
|
404
|
+
create: lt(t),
|
|
405
|
+
list: ct(t),
|
|
406
|
+
get: dt(t)
|
|
407
407
|
};
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
return async (e,
|
|
411
|
-
const
|
|
412
|
-
if (!
|
|
409
|
+
function mt(t) {
|
|
410
|
+
return async (e, r) => {
|
|
411
|
+
const a = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", r).selectAll().executeTakeFirst();
|
|
412
|
+
if (!a)
|
|
413
413
|
return null;
|
|
414
|
-
const { tenant_id: o, device: n, clients: s, ...l } =
|
|
414
|
+
const { tenant_id: o, device: n, clients: s, ...l } = a;
|
|
415
415
|
return {
|
|
416
416
|
...l,
|
|
417
417
|
device: JSON.parse(n),
|
|
@@ -419,188 +419,188 @@ function ht(t) {
|
|
|
419
419
|
};
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
return async (e,
|
|
424
|
-
const
|
|
425
|
-
...
|
|
422
|
+
function _t(t) {
|
|
423
|
+
return async (e, r) => {
|
|
424
|
+
const a = {
|
|
425
|
+
...r,
|
|
426
426
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
427
427
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
428
428
|
authenticated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
429
429
|
last_interaction_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
430
430
|
};
|
|
431
431
|
return await t.insertInto("sessions").values({
|
|
432
|
-
...
|
|
432
|
+
...a,
|
|
433
433
|
tenant_id: e,
|
|
434
|
-
device: JSON.stringify(
|
|
435
|
-
clients: JSON.stringify(
|
|
436
|
-
}).execute(),
|
|
434
|
+
device: JSON.stringify(r.device),
|
|
435
|
+
clients: JSON.stringify(r.clients)
|
|
436
|
+
}).execute(), a;
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
return async (e,
|
|
439
|
+
function ht(t) {
|
|
440
|
+
return async (e, r) => !!(await t.deleteFrom("sessions").where("tenant_id", "=", e).where("sessions.id", "=", r).execute()).length;
|
|
441
441
|
}
|
|
442
|
-
function
|
|
443
|
-
return async (e,
|
|
442
|
+
function ft(t) {
|
|
443
|
+
return async (e, r, a) => {
|
|
444
444
|
const o = {
|
|
445
|
-
...
|
|
445
|
+
...a,
|
|
446
446
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
447
|
-
device:
|
|
448
|
-
clients:
|
|
447
|
+
device: a.device ? JSON.stringify(a.device) : void 0,
|
|
448
|
+
clients: a.clients ? JSON.stringify(a.clients) : void 0
|
|
449
449
|
};
|
|
450
|
-
return !!(await t.updateTable("sessions").set(o).where("tenant_id", "=", e).where("sessions.id", "=",
|
|
450
|
+
return !!(await t.updateTable("sessions").set(o).where("tenant_id", "=", e).where("sessions.id", "=", r).execute()).length;
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
|
-
function
|
|
454
|
-
return async (e,
|
|
453
|
+
function pt(t) {
|
|
454
|
+
return async (e, r = {
|
|
455
455
|
page: 0,
|
|
456
456
|
per_page: 50,
|
|
457
457
|
include_totals: !1
|
|
458
458
|
}) => {
|
|
459
|
-
let
|
|
460
|
-
|
|
461
|
-
let o =
|
|
462
|
-
if (
|
|
463
|
-
const { ref:
|
|
459
|
+
let a = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
|
|
460
|
+
r.q && (a = C(t, a, r.q, ["user_id", "session_id"]));
|
|
461
|
+
let o = a;
|
|
462
|
+
if (r.sort && r.sort.sort_by) {
|
|
463
|
+
const { ref: c } = t.dynamic;
|
|
464
464
|
o = o.orderBy(
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
c(r.sort.sort_by),
|
|
466
|
+
r.sort.sort_order
|
|
467
467
|
);
|
|
468
468
|
}
|
|
469
|
-
o = o.offset(
|
|
470
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
469
|
+
o = o.offset(r.page * r.per_page).limit(r.per_page);
|
|
470
|
+
const n = await o.selectAll().execute(), { count: s } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = v(s);
|
|
471
471
|
return {
|
|
472
|
-
sessions: n.map((
|
|
473
|
-
...
|
|
474
|
-
device: JSON.parse(
|
|
475
|
-
clients: JSON.parse(
|
|
472
|
+
sessions: n.map((c) => ({
|
|
473
|
+
...c,
|
|
474
|
+
device: JSON.parse(c.device),
|
|
475
|
+
clients: JSON.parse(c.clients)
|
|
476
476
|
})),
|
|
477
|
-
start:
|
|
478
|
-
limit:
|
|
477
|
+
start: r.page * r.per_page,
|
|
478
|
+
limit: r.per_page,
|
|
479
479
|
length: l
|
|
480
480
|
};
|
|
481
481
|
};
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function gt(t) {
|
|
484
484
|
return {
|
|
485
|
-
create:
|
|
486
|
-
get:
|
|
487
|
-
list:
|
|
488
|
-
remove:
|
|
489
|
-
update:
|
|
485
|
+
create: _t(t),
|
|
486
|
+
get: mt(t),
|
|
487
|
+
list: pt(t),
|
|
488
|
+
remove: ht(t),
|
|
489
|
+
update: ft(t)
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
function
|
|
493
|
-
return async (e,
|
|
494
|
-
const
|
|
495
|
-
if (!
|
|
492
|
+
function wt(t) {
|
|
493
|
+
return async (e, r) => {
|
|
494
|
+
const a = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", r).selectAll().executeTakeFirst();
|
|
495
|
+
if (!a)
|
|
496
496
|
return null;
|
|
497
|
-
const { tenant_id: o, ...n } =
|
|
497
|
+
const { tenant_id: o, ...n } = a;
|
|
498
498
|
return n;
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
|
-
function
|
|
502
|
-
return async (e,
|
|
503
|
-
const
|
|
504
|
-
...
|
|
501
|
+
function yt(t) {
|
|
502
|
+
return async (e, r) => {
|
|
503
|
+
const a = {
|
|
504
|
+
...r,
|
|
505
505
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
506
506
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
507
507
|
};
|
|
508
508
|
return await t.insertInto("passwords").values({
|
|
509
|
-
...
|
|
509
|
+
...a,
|
|
510
510
|
tenant_id: e
|
|
511
|
-
}).execute(),
|
|
511
|
+
}).execute(), a;
|
|
512
512
|
};
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
return async (e,
|
|
516
|
-
password:
|
|
514
|
+
function vt(t) {
|
|
515
|
+
return async (e, r) => (await t.updateTable("passwords").set({
|
|
516
|
+
password: r.password,
|
|
517
517
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
518
|
-
}).where("tenant_id", "=", e).where("user_id", "=",
|
|
518
|
+
}).where("tenant_id", "=", e).where("user_id", "=", r.user_id).execute()).length === 1;
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function Nt(t) {
|
|
521
521
|
return {
|
|
522
|
-
create:
|
|
523
|
-
update:
|
|
524
|
-
get:
|
|
522
|
+
create: yt(t),
|
|
523
|
+
update: vt(t),
|
|
524
|
+
get: wt(t)
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
return async (e,
|
|
527
|
+
function Ct(t) {
|
|
528
|
+
return async (e, r = {
|
|
529
529
|
page: 0,
|
|
530
530
|
per_page: 50,
|
|
531
531
|
include_totals: !1
|
|
532
532
|
}) => {
|
|
533
|
-
let
|
|
534
|
-
|
|
535
|
-
const n = await
|
|
533
|
+
let a = t.selectFrom("codes").where("codes.tenant_id", "=", e);
|
|
534
|
+
r.q && (a = C(t, a, r.q, ["code", "login_id"]));
|
|
535
|
+
const n = await a.offset(r.page * r.per_page).limit(r.per_page).selectAll().execute(), { count: s } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
536
536
|
return {
|
|
537
|
-
codes: n.map((
|
|
538
|
-
const { tenant_id:
|
|
537
|
+
codes: n.map((c) => {
|
|
538
|
+
const { tenant_id: _, ...u } = c;
|
|
539
539
|
return Ke.parse(p(u));
|
|
540
540
|
}),
|
|
541
|
-
start:
|
|
542
|
-
limit:
|
|
541
|
+
start: r.page * r.per_page,
|
|
542
|
+
limit: r.per_page,
|
|
543
543
|
length: v(s)
|
|
544
544
|
};
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
return async (e,
|
|
549
|
-
const
|
|
550
|
-
...
|
|
547
|
+
function bt(t) {
|
|
548
|
+
return async (e, r) => {
|
|
549
|
+
const a = {
|
|
550
|
+
...r,
|
|
551
551
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
552
552
|
};
|
|
553
553
|
return await t.insertInto("codes").values({
|
|
554
|
-
...
|
|
554
|
+
...a,
|
|
555
555
|
tenant_id: e
|
|
556
|
-
}).execute(),
|
|
556
|
+
}).execute(), a;
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
return async (e,
|
|
559
|
+
function xt(t) {
|
|
560
|
+
return async (e, r) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", r).executeTakeFirst()).numDeletedRows > 0;
|
|
561
561
|
}
|
|
562
|
-
function
|
|
563
|
-
return async (e,
|
|
564
|
-
let o = t.selectFrom("codes").where("codes.code_id", "=",
|
|
562
|
+
function Tt(t) {
|
|
563
|
+
return async (e, r, a) => {
|
|
564
|
+
let o = t.selectFrom("codes").where("codes.code_id", "=", r).where("codes.code_type", "=", a);
|
|
565
565
|
e.length && (o = o.where("codes.tenant_id", "=", e));
|
|
566
566
|
const n = await o.selectAll().executeTakeFirst();
|
|
567
567
|
return n ? p(n) : null;
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
return async (e,
|
|
570
|
+
function St(t) {
|
|
571
|
+
return async (e, r) => (await t.updateTable("codes").set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where("codes.tenant_id", "=", e).where("codes.code_id", "=", r).executeTakeFirst()).numUpdatedRows > 0;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Ot(t) {
|
|
574
574
|
return {
|
|
575
|
-
create:
|
|
576
|
-
list:
|
|
577
|
-
remove:
|
|
578
|
-
used:
|
|
579
|
-
get:
|
|
575
|
+
create: bt(t),
|
|
576
|
+
list: Ct(t),
|
|
577
|
+
remove: xt(t),
|
|
578
|
+
used: St(t),
|
|
579
|
+
get: Tt(t)
|
|
580
580
|
};
|
|
581
581
|
}
|
|
582
|
-
function
|
|
583
|
-
return async (e,
|
|
584
|
-
const
|
|
582
|
+
function kt(t) {
|
|
583
|
+
return async (e, r) => {
|
|
584
|
+
const a = {
|
|
585
585
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
586
586
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
587
|
-
...a,
|
|
588
|
-
disable_sign_ups: a.disable_sign_ups ?? !1
|
|
589
|
-
}, o = JSON.stringify(a.allowed_origins), n = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), l = JSON.stringify(a.allowed_logout_urls), i = JSON.stringify(a.allowed_clients);
|
|
590
|
-
return await t.insertInto("applications").values({
|
|
591
587
|
...r,
|
|
588
|
+
disable_sign_ups: r.disable_sign_ups ?? !1
|
|
589
|
+
}, o = JSON.stringify(r.allowed_origins), n = JSON.stringify(r.callbacks), s = JSON.stringify(r.web_origins), l = JSON.stringify(r.allowed_logout_urls), c = JSON.stringify(r.allowed_clients);
|
|
590
|
+
return await t.insertInto("applications").values({
|
|
591
|
+
...a,
|
|
592
592
|
tenant_id: e,
|
|
593
|
-
disable_sign_ups:
|
|
594
|
-
addons:
|
|
593
|
+
disable_sign_ups: r.disable_sign_ups ? 1 : 0,
|
|
594
|
+
addons: r.addons ? JSON.stringify(r.addons) : "{}",
|
|
595
595
|
callbacks: n,
|
|
596
596
|
allowed_origins: o,
|
|
597
597
|
web_origins: s,
|
|
598
598
|
allowed_logout_urls: l,
|
|
599
|
-
allowed_clients:
|
|
600
|
-
}).execute(),
|
|
599
|
+
allowed_clients: c
|
|
600
|
+
}).execute(), a;
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function $t(t) {
|
|
604
604
|
return async (e) => ({
|
|
605
605
|
applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((n) => ({
|
|
606
606
|
...n,
|
|
@@ -614,254 +614,254 @@ function It(t) {
|
|
|
614
614
|
}))
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
|
-
function
|
|
618
|
-
return async (e,
|
|
619
|
-
const
|
|
620
|
-
return
|
|
621
|
-
...
|
|
622
|
-
disable_sign_ups: !!
|
|
623
|
-
addons: JSON.parse(
|
|
624
|
-
callbacks: JSON.parse(
|
|
625
|
-
allowed_origins: JSON.parse(
|
|
626
|
-
web_origins: JSON.parse(
|
|
627
|
-
allowed_logout_urls: JSON.parse(
|
|
617
|
+
function It(t) {
|
|
618
|
+
return async (e, r) => {
|
|
619
|
+
const a = await t.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", r).selectAll().executeTakeFirst();
|
|
620
|
+
return a ? p({
|
|
621
|
+
...a,
|
|
622
|
+
disable_sign_ups: !!a.disable_sign_ups,
|
|
623
|
+
addons: JSON.parse(a.addons),
|
|
624
|
+
callbacks: JSON.parse(a.callbacks),
|
|
625
|
+
allowed_origins: JSON.parse(a.allowed_origins),
|
|
626
|
+
web_origins: JSON.parse(a.web_origins),
|
|
627
|
+
allowed_logout_urls: JSON.parse(a.allowed_logout_urls)
|
|
628
628
|
}) : null;
|
|
629
629
|
};
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
return async (e,
|
|
631
|
+
function Dt(t) {
|
|
632
|
+
return async (e, r) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", r).executeTakeFirst()).numDeletedRows > 0;
|
|
633
633
|
}
|
|
634
|
-
function
|
|
635
|
-
return async (e,
|
|
634
|
+
function Pt(t) {
|
|
635
|
+
return async (e, r, a) => {
|
|
636
636
|
const o = {
|
|
637
|
-
...
|
|
637
|
+
...a,
|
|
638
638
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
639
|
-
allowed_origins:
|
|
640
|
-
callbacks:
|
|
641
|
-
web_origins:
|
|
642
|
-
allowed_logout_urls:
|
|
643
|
-
allowed_clients:
|
|
644
|
-
addons:
|
|
645
|
-
disable_sign_ups:
|
|
639
|
+
allowed_origins: a.allowed_origins ? JSON.stringify(a.allowed_origins) : void 0,
|
|
640
|
+
callbacks: a.callbacks ? JSON.stringify(a.callbacks) : void 0,
|
|
641
|
+
web_origins: a.web_origins ? JSON.stringify(a.web_origins) : void 0,
|
|
642
|
+
allowed_logout_urls: a.allowed_logout_urls ? JSON.stringify(a.allowed_logout_urls) : void 0,
|
|
643
|
+
allowed_clients: a.allowed_clients ? JSON.stringify(a.allowed_clients) : void 0,
|
|
644
|
+
addons: a.addons ? JSON.stringify(a.addons) : "{}",
|
|
645
|
+
disable_sign_ups: a.disable_sign_ups ? 1 : 0
|
|
646
646
|
};
|
|
647
|
-
return await t.updateTable("applications").set(o).where("applications.id", "=",
|
|
647
|
+
return await t.updateTable("applications").set(o).where("applications.id", "=", r).where("applications.tenant_id", "=", e).execute(), !0;
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function jt(t) {
|
|
651
651
|
return {
|
|
652
|
-
create:
|
|
653
|
-
list:
|
|
654
|
-
get:
|
|
655
|
-
remove:
|
|
656
|
-
update:
|
|
652
|
+
create: kt(t),
|
|
653
|
+
list: $t(t),
|
|
654
|
+
get: It(t),
|
|
655
|
+
remove: Dt(t),
|
|
656
|
+
update: Pt(t)
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
|
-
function
|
|
660
|
-
return async (e,
|
|
661
|
-
const
|
|
662
|
-
id:
|
|
663
|
-
...
|
|
659
|
+
function Ft(t) {
|
|
660
|
+
return async (e, r) => {
|
|
661
|
+
const a = {
|
|
662
|
+
id: b(),
|
|
663
|
+
...r,
|
|
664
664
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
665
665
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
666
666
|
};
|
|
667
667
|
return await t.insertInto("connections").values({
|
|
668
|
-
...
|
|
668
|
+
...a,
|
|
669
669
|
// The connection options will have many different properties depending on the strategy
|
|
670
|
-
options: JSON.stringify(
|
|
670
|
+
options: JSON.stringify(a.options || {}),
|
|
671
671
|
tenant_id: e
|
|
672
|
-
}).execute(),
|
|
672
|
+
}).execute(), a;
|
|
673
673
|
};
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
return async (e,
|
|
675
|
+
function Mt(t) {
|
|
676
|
+
return async (e, r = {
|
|
677
677
|
page: 0,
|
|
678
678
|
per_page: 50,
|
|
679
679
|
include_totals: !1
|
|
680
680
|
}) => {
|
|
681
|
-
let
|
|
682
|
-
|
|
683
|
-
const s = (await
|
|
684
|
-
(
|
|
685
|
-
...
|
|
686
|
-
options: JSON.parse(
|
|
681
|
+
let a = t.selectFrom("connections").where("connections.tenant_id", "=", e);
|
|
682
|
+
r.q && (a = C(t, a, r.q, ["user_id", "ip"]));
|
|
683
|
+
const s = (await a.offset(r.page * r.per_page).limit(r.per_page).selectAll().execute()).map(
|
|
684
|
+
(c) => p({
|
|
685
|
+
...c,
|
|
686
|
+
options: JSON.parse(c.options)
|
|
687
687
|
})
|
|
688
|
-
), { count: l } = await
|
|
688
|
+
), { count: l } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
689
689
|
return {
|
|
690
690
|
connections: s,
|
|
691
|
-
start:
|
|
692
|
-
limit:
|
|
691
|
+
start: r.page * r.per_page,
|
|
692
|
+
limit: r.per_page,
|
|
693
693
|
length: v(l)
|
|
694
694
|
};
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
|
-
function
|
|
698
|
-
return async (e,
|
|
697
|
+
function At(t) {
|
|
698
|
+
return async (e, r) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", r).executeTakeFirst()).numDeletedRows > 0;
|
|
699
699
|
}
|
|
700
|
-
function
|
|
701
|
-
return async (e,
|
|
702
|
-
const
|
|
703
|
-
return
|
|
704
|
-
...
|
|
705
|
-
options: JSON.parse(
|
|
700
|
+
function zt(t) {
|
|
701
|
+
return async (e, r) => {
|
|
702
|
+
const a = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", r).selectAll().executeTakeFirst();
|
|
703
|
+
return a ? p({
|
|
704
|
+
...a,
|
|
705
|
+
options: JSON.parse(a.options)
|
|
706
706
|
}) : null;
|
|
707
707
|
};
|
|
708
708
|
}
|
|
709
|
-
function
|
|
710
|
-
return async (e,
|
|
709
|
+
function Lt(t) {
|
|
710
|
+
return async (e, r, a) => {
|
|
711
711
|
const o = {
|
|
712
|
-
...
|
|
712
|
+
...a,
|
|
713
713
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
714
714
|
};
|
|
715
715
|
return await t.updateTable("connections").set({
|
|
716
716
|
...o,
|
|
717
717
|
options: o.options ? JSON.stringify(o.options) : void 0
|
|
718
|
-
}).where("connections.id", "=",
|
|
718
|
+
}).where("connections.id", "=", r).where("connections.tenant_id", "=", e).execute(), !0;
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function Et(t) {
|
|
722
722
|
return {
|
|
723
|
-
create:
|
|
724
|
-
get:
|
|
725
|
-
list:
|
|
726
|
-
remove:
|
|
727
|
-
update:
|
|
723
|
+
create: Ft(t),
|
|
724
|
+
get: zt(t),
|
|
725
|
+
list: Mt(t),
|
|
726
|
+
remove: At(t),
|
|
727
|
+
update: Lt(t)
|
|
728
728
|
};
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function Jt(t) {
|
|
731
731
|
return {
|
|
732
732
|
get: async (e) => {
|
|
733
|
-
const
|
|
734
|
-
if (!a)
|
|
735
|
-
return null;
|
|
736
|
-
const r = await t.selectFrom("tenants").selectAll().where("id", "=", a.tenant_id).executeTakeFirst();
|
|
733
|
+
const r = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
|
|
737
734
|
if (!r)
|
|
735
|
+
return null;
|
|
736
|
+
const a = await t.selectFrom("tenants").selectAll().where("id", "=", r.tenant_id).executeTakeFirst();
|
|
737
|
+
if (!a)
|
|
738
738
|
throw new H(404, { message: "Tenant not found" });
|
|
739
|
-
const o = await t.selectFrom("connections").where("tenant_id", "=",
|
|
739
|
+
const o = await t.selectFrom("connections").where("tenant_id", "=", r.tenant_id).selectAll().execute();
|
|
740
740
|
return {
|
|
741
|
-
...
|
|
741
|
+
...r,
|
|
742
742
|
connections: o.map(
|
|
743
|
-
(s) =>
|
|
743
|
+
(s) => Ue.parse(
|
|
744
744
|
p({
|
|
745
745
|
...s,
|
|
746
746
|
options: s.options ? JSON.parse(s.options) : {}
|
|
747
747
|
})
|
|
748
748
|
)
|
|
749
749
|
),
|
|
750
|
-
addons:
|
|
751
|
-
callbacks:
|
|
752
|
-
allowed_origins:
|
|
753
|
-
web_origins:
|
|
754
|
-
allowed_logout_urls:
|
|
755
|
-
allowed_clients:
|
|
756
|
-
tenant: p(
|
|
750
|
+
addons: r.addons ? JSON.parse(r.addons) : {},
|
|
751
|
+
callbacks: r.callbacks ? JSON.parse(r.callbacks) : [],
|
|
752
|
+
allowed_origins: r.allowed_origins ? JSON.parse(r.allowed_origins) : [],
|
|
753
|
+
web_origins: r.web_origins ? JSON.parse(r.web_origins) : [],
|
|
754
|
+
allowed_logout_urls: r.allowed_logout_urls ? JSON.parse(r.allowed_logout_urls) : [],
|
|
755
|
+
allowed_clients: r.allowed_clients ? JSON.parse(r.allowed_clients) : [],
|
|
756
|
+
tenant: p(a),
|
|
757
757
|
// this is really an integer in the database
|
|
758
|
-
disable_sign_ups: !!
|
|
758
|
+
disable_sign_ups: !!r.disable_sign_ups
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
761
|
};
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function Rt(t) {
|
|
764
764
|
return async () => await t.selectFrom("keys").where(
|
|
765
|
-
(
|
|
766
|
-
|
|
767
|
-
|
|
765
|
+
(r) => r.or([
|
|
766
|
+
r("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
|
|
767
|
+
r("revoked_at", "is", null)
|
|
768
768
|
])
|
|
769
769
|
).selectAll().execute();
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Kt(t) {
|
|
772
772
|
return async (e) => {
|
|
773
773
|
await t.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
|
|
774
774
|
};
|
|
775
775
|
}
|
|
776
|
-
function
|
|
777
|
-
return async (e,
|
|
776
|
+
function Ut(t) {
|
|
777
|
+
return async (e, r) => !!(await t.updateTable("keys").set(r).where("kid", "=", e).execute()).length;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Bt(t) {
|
|
780
780
|
return {
|
|
781
|
-
create:
|
|
782
|
-
list:
|
|
783
|
-
update:
|
|
781
|
+
create: Kt(t),
|
|
782
|
+
list: Rt(t),
|
|
783
|
+
update: Ut(t)
|
|
784
784
|
};
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
return async (e,
|
|
788
|
-
const
|
|
789
|
-
custom_domain_id:
|
|
786
|
+
function Qt(t) {
|
|
787
|
+
return async (e, r) => {
|
|
788
|
+
const a = {
|
|
789
|
+
custom_domain_id: b(),
|
|
790
790
|
status: "pending",
|
|
791
791
|
primary: !1,
|
|
792
|
-
...
|
|
792
|
+
...r
|
|
793
793
|
};
|
|
794
794
|
return await t.insertInto("custom_domains").values({
|
|
795
|
-
...
|
|
795
|
+
...a,
|
|
796
796
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
797
797
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
798
798
|
tenant_id: e,
|
|
799
|
-
primary:
|
|
800
|
-
}).execute(),
|
|
799
|
+
primary: a.primary ? 1 : 0
|
|
800
|
+
}).execute(), a;
|
|
801
801
|
};
|
|
802
802
|
}
|
|
803
|
-
function
|
|
804
|
-
return async (e) => (await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).selectAll().execute()).map((
|
|
805
|
-
...
|
|
806
|
-
primary:
|
|
803
|
+
function qt(t) {
|
|
804
|
+
return async (e) => (await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).selectAll().execute()).map((a) => ({
|
|
805
|
+
...a,
|
|
806
|
+
primary: a.primary === 1
|
|
807
807
|
}));
|
|
808
808
|
}
|
|
809
|
-
function
|
|
810
|
-
return async (e,
|
|
809
|
+
function Vt(t) {
|
|
810
|
+
return async (e, r) => (await t.deleteFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", r).execute()).length > 0;
|
|
811
811
|
}
|
|
812
|
-
function
|
|
813
|
-
return async (e,
|
|
814
|
-
const
|
|
815
|
-
return
|
|
816
|
-
...
|
|
817
|
-
primary:
|
|
812
|
+
function Wt(t) {
|
|
813
|
+
return async (e, r) => {
|
|
814
|
+
const a = await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", r).selectAll().executeTakeFirst();
|
|
815
|
+
return a ? {
|
|
816
|
+
...a,
|
|
817
|
+
primary: a.primary === 1
|
|
818
818
|
} : null;
|
|
819
819
|
};
|
|
820
820
|
}
|
|
821
|
-
function
|
|
822
|
-
return async (e,
|
|
821
|
+
function Gt(t) {
|
|
822
|
+
return async (e, r, a) => {
|
|
823
823
|
const o = {
|
|
824
|
-
...
|
|
824
|
+
...a,
|
|
825
825
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
826
|
-
primary:
|
|
826
|
+
primary: a.primary ? 1 : 0
|
|
827
827
|
};
|
|
828
|
-
return (await t.updateTable("custom_domains").set(o).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=",
|
|
828
|
+
return (await t.updateTable("custom_domains").set(o).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", r).execute()).length > 0;
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function Ht(t) {
|
|
832
832
|
return async (e) => {
|
|
833
|
-
const
|
|
834
|
-
return
|
|
835
|
-
...
|
|
836
|
-
primary:
|
|
833
|
+
const r = await t.selectFrom("custom_domains").where("custom_domains.domain", "=", e).selectAll().executeTakeFirst();
|
|
834
|
+
return r ? {
|
|
835
|
+
...r,
|
|
836
|
+
primary: r.primary === 1
|
|
837
837
|
} : null;
|
|
838
838
|
};
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function Xt(t) {
|
|
841
841
|
return {
|
|
842
|
-
create:
|
|
843
|
-
get:
|
|
844
|
-
getByDomain:
|
|
845
|
-
list:
|
|
846
|
-
remove:
|
|
847
|
-
update:
|
|
842
|
+
create: Qt(t),
|
|
843
|
+
get: Wt(t),
|
|
844
|
+
getByDomain: Ht(t),
|
|
845
|
+
list: qt(t),
|
|
846
|
+
remove: Vt(t),
|
|
847
|
+
update: Gt(t)
|
|
848
848
|
};
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function Yt(t) {
|
|
851
851
|
return async (e) => {
|
|
852
|
-
const [
|
|
853
|
-
if (!
|
|
852
|
+
const [r] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
|
|
853
|
+
if (!r)
|
|
854
854
|
return null;
|
|
855
855
|
const {
|
|
856
|
-
tenant_id:
|
|
856
|
+
tenant_id: a,
|
|
857
857
|
colors_primary: o,
|
|
858
858
|
colors_page_background_type: n,
|
|
859
859
|
colors_page_background_start: s,
|
|
860
860
|
colors_page_background_end: l,
|
|
861
|
-
colors_page_background_angle_dev:
|
|
862
|
-
font_url:
|
|
861
|
+
colors_page_background_angle_dev: c,
|
|
862
|
+
font_url: _,
|
|
863
863
|
...u
|
|
864
|
-
} =
|
|
864
|
+
} = r;
|
|
865
865
|
return p({
|
|
866
866
|
...u,
|
|
867
867
|
colors: {
|
|
@@ -870,151 +870,151 @@ function ea(t) {
|
|
|
870
870
|
type: n,
|
|
871
871
|
start: s,
|
|
872
872
|
end: l,
|
|
873
|
-
angle_deg:
|
|
873
|
+
angle_deg: c
|
|
874
874
|
}
|
|
875
875
|
},
|
|
876
|
-
font:
|
|
876
|
+
font: _ ? { url: _ } : void 0
|
|
877
877
|
});
|
|
878
878
|
};
|
|
879
879
|
}
|
|
880
|
-
function
|
|
881
|
-
return async (e,
|
|
882
|
-
var s, l,
|
|
883
|
-
const { colors:
|
|
880
|
+
function Zt(t) {
|
|
881
|
+
return async (e, r) => {
|
|
882
|
+
var s, l, c, _, u, h, g, I, D, O, ae, ne, oe, se, ie, le, ce, de;
|
|
883
|
+
const { colors: a, font: o, ...n } = r;
|
|
884
884
|
try {
|
|
885
885
|
await t.insertInto("branding").values({
|
|
886
886
|
...n,
|
|
887
|
-
colors_primary:
|
|
888
|
-
colors_page_background_type: (l = (s =
|
|
889
|
-
colors_page_background_start: (
|
|
890
|
-
colors_page_background_end: (h = (u =
|
|
891
|
-
colors_page_background_angle_dev: (
|
|
892
|
-
font_url: (
|
|
887
|
+
colors_primary: a == null ? void 0 : a.primary,
|
|
888
|
+
colors_page_background_type: (l = (s = r.colors) == null ? void 0 : s.page_background) == null ? void 0 : l.type,
|
|
889
|
+
colors_page_background_start: (_ = (c = r.colors) == null ? void 0 : c.page_background) == null ? void 0 : _.start,
|
|
890
|
+
colors_page_background_end: (h = (u = r.colors) == null ? void 0 : u.page_background) == null ? void 0 : h.end,
|
|
891
|
+
colors_page_background_angle_dev: (I = (g = r.colors) == null ? void 0 : g.page_background) == null ? void 0 : I.angle_deg,
|
|
892
|
+
font_url: (D = r.font) == null ? void 0 : D.url,
|
|
893
893
|
tenant_id: e
|
|
894
894
|
}).execute();
|
|
895
895
|
} catch {
|
|
896
896
|
await t.updateTable("branding").set({
|
|
897
897
|
...n,
|
|
898
|
-
colors_primary:
|
|
899
|
-
colors_page_background_type: (
|
|
900
|
-
colors_page_background_start: (oe = (ne =
|
|
901
|
-
colors_page_background_end: (ie = (se =
|
|
902
|
-
colors_page_background_angle_dev: (ce = (le =
|
|
903
|
-
font_url: (de =
|
|
898
|
+
colors_primary: a == null ? void 0 : a.primary,
|
|
899
|
+
colors_page_background_type: (ae = (O = r.colors) == null ? void 0 : O.page_background) == null ? void 0 : ae.type,
|
|
900
|
+
colors_page_background_start: (oe = (ne = r.colors) == null ? void 0 : ne.page_background) == null ? void 0 : oe.start,
|
|
901
|
+
colors_page_background_end: (ie = (se = r.colors) == null ? void 0 : se.page_background) == null ? void 0 : ie.end,
|
|
902
|
+
colors_page_background_angle_dev: (ce = (le = r.colors) == null ? void 0 : le.page_background) == null ? void 0 : ce.angle_deg,
|
|
903
|
+
font_url: (de = r.font) == null ? void 0 : de.url
|
|
904
904
|
}).where("tenant_id", "=", e).execute();
|
|
905
905
|
}
|
|
906
906
|
};
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function er(t) {
|
|
909
909
|
return {
|
|
910
|
-
get:
|
|
911
|
-
set:
|
|
910
|
+
get: Yt(t),
|
|
911
|
+
set: Zt(t)
|
|
912
912
|
};
|
|
913
913
|
}
|
|
914
|
-
function
|
|
915
|
-
return async (e,
|
|
914
|
+
function tr(t) {
|
|
915
|
+
return async (e, r = {
|
|
916
916
|
page: 0,
|
|
917
917
|
per_page: 50,
|
|
918
918
|
include_totals: !1
|
|
919
919
|
}) => {
|
|
920
|
-
let
|
|
921
|
-
|
|
922
|
-
const n = await
|
|
920
|
+
let a = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
|
|
921
|
+
r.q && (a = C(t, a, r.q, ["url", "form_id"]));
|
|
922
|
+
const n = await a.offset(r.page * r.per_page).limit(r.per_page).selectAll().execute(), { count: s } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
923
923
|
return {
|
|
924
|
-
hooks: n.map((
|
|
925
|
-
const { tenant_id:
|
|
924
|
+
hooks: n.map((c) => {
|
|
925
|
+
const { tenant_id: _, enabled: u, synchronous: h, ...g } = c;
|
|
926
926
|
return p({
|
|
927
|
-
...
|
|
927
|
+
...g,
|
|
928
928
|
enabled: !!u,
|
|
929
929
|
synchronous: !!h
|
|
930
930
|
});
|
|
931
931
|
}),
|
|
932
|
-
start:
|
|
933
|
-
limit:
|
|
932
|
+
start: r.page * r.per_page,
|
|
933
|
+
limit: r.per_page,
|
|
934
934
|
length: v(s)
|
|
935
935
|
};
|
|
936
936
|
};
|
|
937
937
|
}
|
|
938
|
-
function
|
|
939
|
-
return async (e,
|
|
940
|
-
const
|
|
941
|
-
return
|
|
942
|
-
...
|
|
943
|
-
enabled: !!
|
|
944
|
-
synchronous: !!
|
|
938
|
+
function rr(t) {
|
|
939
|
+
return async (e, r) => {
|
|
940
|
+
const a = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", r).selectAll().executeTakeFirst();
|
|
941
|
+
return a ? p({
|
|
942
|
+
...a,
|
|
943
|
+
enabled: !!a.enabled,
|
|
944
|
+
synchronous: !!a.synchronous
|
|
945
945
|
}) : null;
|
|
946
946
|
};
|
|
947
947
|
}
|
|
948
|
-
function
|
|
949
|
-
return async (e,
|
|
948
|
+
function ar(t) {
|
|
949
|
+
return async (e, r) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", r).executeTakeFirst()).numDeletedRows > 0;
|
|
950
950
|
}
|
|
951
|
-
function
|
|
952
|
-
return async (e,
|
|
953
|
-
const
|
|
954
|
-
hook_id:
|
|
955
|
-
...
|
|
951
|
+
function nr(t) {
|
|
952
|
+
return async (e, r) => {
|
|
953
|
+
const a = {
|
|
954
|
+
hook_id: b(),
|
|
955
|
+
...r,
|
|
956
956
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
957
957
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
958
958
|
};
|
|
959
959
|
return await t.insertInto("hooks").values({
|
|
960
|
-
...
|
|
960
|
+
...a,
|
|
961
961
|
tenant_id: e,
|
|
962
|
-
enabled:
|
|
963
|
-
synchronous:
|
|
964
|
-
}).execute(),
|
|
962
|
+
enabled: r.enabled ? 1 : 0,
|
|
963
|
+
synchronous: r.synchronous ? 1 : 0
|
|
964
|
+
}).execute(), a;
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
|
-
function
|
|
968
|
-
return async (e,
|
|
967
|
+
function or(t) {
|
|
968
|
+
return async (e, r, a) => {
|
|
969
969
|
const o = {
|
|
970
|
-
...
|
|
970
|
+
...a,
|
|
971
971
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
972
|
-
enabled:
|
|
973
|
-
synchronous:
|
|
972
|
+
enabled: a.enabled !== void 0 ? a.enabled ? 1 : 0 : void 0,
|
|
973
|
+
synchronous: a.enabled !== void 0 ? a.synchronous ? 1 : 0 : void 0
|
|
974
974
|
};
|
|
975
|
-
return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=",
|
|
975
|
+
return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=", r).where("hooks.tenant_id", "=", e).execute(), !0;
|
|
976
976
|
};
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function sr(t) {
|
|
979
979
|
return {
|
|
980
|
-
create:
|
|
981
|
-
get:
|
|
982
|
-
list:
|
|
983
|
-
update:
|
|
984
|
-
remove:
|
|
980
|
+
create: nr(t),
|
|
981
|
+
get: rr(t),
|
|
982
|
+
list: tr(t),
|
|
983
|
+
update: or(t),
|
|
984
|
+
remove: ar(t)
|
|
985
985
|
};
|
|
986
986
|
}
|
|
987
|
-
function
|
|
988
|
-
return async (e,
|
|
989
|
-
const
|
|
990
|
-
themeId:
|
|
987
|
+
function ir(t) {
|
|
988
|
+
return async (e, r) => {
|
|
989
|
+
const a = {
|
|
990
|
+
themeId: b(),
|
|
991
991
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
992
992
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
993
|
-
...
|
|
993
|
+
...r
|
|
994
994
|
}, o = {
|
|
995
|
-
...
|
|
995
|
+
...a,
|
|
996
996
|
tenant_id: e
|
|
997
997
|
};
|
|
998
|
-
return await t.insertInto("themes").values(A(o)).execute(),
|
|
998
|
+
return await t.insertInto("themes").values(A(o)).execute(), a;
|
|
999
999
|
};
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1002
|
-
return async (e,
|
|
1001
|
+
function lr(t) {
|
|
1002
|
+
return async (e, r) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", r).executeTakeFirst()).numDeletedRows > 0;
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1005
|
-
return async (e,
|
|
1006
|
-
const
|
|
1007
|
-
if (!
|
|
1004
|
+
function cr(t) {
|
|
1005
|
+
return async (e, r) => {
|
|
1006
|
+
const a = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", r).selectAll().executeTakeFirst();
|
|
1007
|
+
if (!a)
|
|
1008
1008
|
return null;
|
|
1009
1009
|
const o = {
|
|
1010
|
-
...
|
|
1011
|
-
borders_show_widget_shadow: !!
|
|
1012
|
-
fonts_body_text_bold: !!
|
|
1013
|
-
fonts_buttons_text_bold: !!
|
|
1014
|
-
fonts_input_labels_bold: !!
|
|
1015
|
-
fonts_links_bold: !!
|
|
1016
|
-
fonts_subtitle_bold: !!
|
|
1017
|
-
fonts_title_bold: !!
|
|
1010
|
+
...a,
|
|
1011
|
+
borders_show_widget_shadow: !!a.borders_show_widget_shadow,
|
|
1012
|
+
fonts_body_text_bold: !!a.fonts_body_text_bold,
|
|
1013
|
+
fonts_buttons_text_bold: !!a.fonts_buttons_text_bold,
|
|
1014
|
+
fonts_input_labels_bold: !!a.fonts_input_labels_bold,
|
|
1015
|
+
fonts_links_bold: !!a.fonts_links_bold,
|
|
1016
|
+
fonts_subtitle_bold: !!a.fonts_subtitle_bold,
|
|
1017
|
+
fonts_title_bold: !!a.fonts_title_bold
|
|
1018
1018
|
};
|
|
1019
1019
|
return p(
|
|
1020
1020
|
ge(o, [
|
|
@@ -1027,80 +1027,80 @@ function ua(t) {
|
|
|
1027
1027
|
);
|
|
1028
1028
|
};
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1031
|
-
return async (e,
|
|
1030
|
+
function dr(t) {
|
|
1031
|
+
return async (e, r, a) => {
|
|
1032
1032
|
const o = A({
|
|
1033
|
-
...
|
|
1033
|
+
...a,
|
|
1034
1034
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1035
1035
|
});
|
|
1036
|
-
return await t.updateTable("themes").set(o).where("themes.themeId", "=",
|
|
1036
|
+
return await t.updateTable("themes").set(o).where("themes.themeId", "=", r).where("themes.tenant_id", "=", e).execute(), !0;
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function ur(t) {
|
|
1040
1040
|
return {
|
|
1041
|
-
create:
|
|
1042
|
-
get:
|
|
1043
|
-
remove:
|
|
1044
|
-
update:
|
|
1041
|
+
create: ir(t),
|
|
1042
|
+
get: cr(t),
|
|
1043
|
+
remove: lr(t),
|
|
1044
|
+
update: dr(t)
|
|
1045
1045
|
};
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1048
|
-
return async (e,
|
|
1049
|
-
const
|
|
1050
|
-
return
|
|
1047
|
+
function mr(t) {
|
|
1048
|
+
return async (e, r) => {
|
|
1049
|
+
const a = await t.selectFrom("login_sessions").where("login_sessions.id", "=", r).selectAll().executeTakeFirst();
|
|
1050
|
+
return a ? Be.parse(
|
|
1051
1051
|
ge(
|
|
1052
1052
|
p({
|
|
1053
|
-
...
|
|
1054
|
-
login_completed: !!
|
|
1053
|
+
...a,
|
|
1054
|
+
login_completed: !!a.login_completed
|
|
1055
1055
|
}),
|
|
1056
1056
|
["authParams"]
|
|
1057
1057
|
)
|
|
1058
1058
|
) : null;
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1062
|
-
return async (e,
|
|
1061
|
+
function _r(t) {
|
|
1062
|
+
return async (e, r) => {
|
|
1063
1063
|
var o;
|
|
1064
|
-
const
|
|
1065
|
-
id:
|
|
1066
|
-
...
|
|
1067
|
-
authorization_url: (o =
|
|
1064
|
+
const a = {
|
|
1065
|
+
id: b(),
|
|
1066
|
+
...r,
|
|
1067
|
+
authorization_url: (o = r.authorization_url) == null ? void 0 : o.slice(0, 1024),
|
|
1068
1068
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1069
1069
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1070
|
-
login_completed: !!
|
|
1070
|
+
login_completed: !!r.login_completed
|
|
1071
1071
|
};
|
|
1072
1072
|
return await t.insertInto("login_sessions").values({
|
|
1073
|
-
...A(
|
|
1073
|
+
...A(a),
|
|
1074
1074
|
tenant_id: e
|
|
1075
|
-
}).execute(),
|
|
1075
|
+
}).execute(), a;
|
|
1076
1076
|
};
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1079
|
-
return async (e,
|
|
1078
|
+
function hr(t) {
|
|
1079
|
+
return async (e, r, a) => (await t.updateTable("login_sessions").set(
|
|
1080
1080
|
A({
|
|
1081
|
-
...
|
|
1081
|
+
...a
|
|
1082
1082
|
})
|
|
1083
|
-
).where("login_sessions.id", "=",
|
|
1083
|
+
).where("login_sessions.id", "=", r).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1086
|
-
return async (e,
|
|
1085
|
+
function fr(t) {
|
|
1086
|
+
return async (e, r) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", r).execute()).length > 0;
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1088
|
+
function pr(t) {
|
|
1089
1089
|
return {
|
|
1090
|
-
create:
|
|
1091
|
-
get:
|
|
1092
|
-
update:
|
|
1093
|
-
remove:
|
|
1090
|
+
create: _r(t),
|
|
1091
|
+
get: mr(t),
|
|
1092
|
+
update: hr(t),
|
|
1093
|
+
remove: fr(t)
|
|
1094
1094
|
};
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1096
|
+
function gr(t) {
|
|
1097
1097
|
return async (e) => {
|
|
1098
|
-
const [
|
|
1098
|
+
const [r] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
|
|
1099
1099
|
return p({
|
|
1100
|
-
identifier_first: !!(
|
|
1101
|
-
password_first: !!(
|
|
1102
|
-
webauthn_platform_first_factor: !!(
|
|
1103
|
-
universal_login_experience: (
|
|
1100
|
+
identifier_first: !!(r != null && r.identifier_first),
|
|
1101
|
+
password_first: !!(r != null && r.password_first),
|
|
1102
|
+
webauthn_platform_first_factor: !!(r != null && r.webauthn_platform_first_factor),
|
|
1103
|
+
universal_login_experience: (r == null ? void 0 : r.universal_login_experience) || "new"
|
|
1104
1104
|
});
|
|
1105
1105
|
};
|
|
1106
1106
|
}
|
|
@@ -1113,37 +1113,37 @@ function he(t) {
|
|
|
1113
1113
|
universal_login_experience: t.universal_login_experience
|
|
1114
1114
|
});
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return async (e,
|
|
1116
|
+
function wr(t) {
|
|
1117
|
+
return async (e, r) => {
|
|
1118
1118
|
try {
|
|
1119
|
-
const
|
|
1119
|
+
const a = Qe.parse(r);
|
|
1120
1120
|
await t.insertInto("prompt_settings").values({
|
|
1121
|
-
...he(
|
|
1121
|
+
...he(a),
|
|
1122
1122
|
tenant_id: e
|
|
1123
1123
|
}).execute();
|
|
1124
1124
|
} catch {
|
|
1125
|
-
await t.updateTable("prompt_settings").set(he(
|
|
1125
|
+
await t.updateTable("prompt_settings").set(he(r)).where("tenant_id", "=", e).execute();
|
|
1126
1126
|
}
|
|
1127
1127
|
};
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function yr(t) {
|
|
1130
1130
|
return {
|
|
1131
|
-
get:
|
|
1132
|
-
set:
|
|
1131
|
+
get: gr(t),
|
|
1132
|
+
set: wr(t)
|
|
1133
1133
|
};
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function vr(t) {
|
|
1136
1136
|
return async (e) => {
|
|
1137
|
-
const [
|
|
1138
|
-
if (!
|
|
1137
|
+
const [r] = await t.selectFrom("email_providers").where("email_providers.tenant_id", "=", e).selectAll().execute();
|
|
1138
|
+
if (!r)
|
|
1139
1139
|
return null;
|
|
1140
1140
|
const {
|
|
1141
|
-
tenant_id:
|
|
1141
|
+
tenant_id: a,
|
|
1142
1142
|
credentials: o,
|
|
1143
1143
|
settings: n,
|
|
1144
1144
|
enabled: s,
|
|
1145
1145
|
...l
|
|
1146
|
-
} =
|
|
1146
|
+
} = r;
|
|
1147
1147
|
return p({
|
|
1148
1148
|
...l,
|
|
1149
1149
|
credentials: JSON.parse(o),
|
|
@@ -1152,24 +1152,24 @@ function Ca(t) {
|
|
|
1152
1152
|
});
|
|
1153
1153
|
};
|
|
1154
1154
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return async (e,
|
|
1157
|
-
const { credentials:
|
|
1155
|
+
function Nr(t) {
|
|
1156
|
+
return async (e, r) => {
|
|
1157
|
+
const { credentials: a, settings: o, enabled: n, ...s } = r;
|
|
1158
1158
|
await t.updateTable("email_providers").set({
|
|
1159
1159
|
...s,
|
|
1160
|
-
credentials:
|
|
1160
|
+
credentials: a ? JSON.stringify(a) : void 0,
|
|
1161
1161
|
settings: o ? JSON.stringify(o) : void 0,
|
|
1162
1162
|
enabled: n !== void 0 ? n ? 1 : 0 : void 0
|
|
1163
1163
|
}).where("tenant_id", "=", e).execute();
|
|
1164
1164
|
};
|
|
1165
1165
|
}
|
|
1166
|
-
function
|
|
1167
|
-
return async (e,
|
|
1168
|
-
const { credentials:
|
|
1166
|
+
function Cr(t) {
|
|
1167
|
+
return async (e, r) => {
|
|
1168
|
+
const { credentials: a, settings: o, enabled: n, ...s } = r;
|
|
1169
1169
|
await t.insertInto("email_providers").values({
|
|
1170
1170
|
...s,
|
|
1171
1171
|
enabled: n ? 1 : 0,
|
|
1172
|
-
credentials: JSON.stringify(
|
|
1172
|
+
credentials: JSON.stringify(a),
|
|
1173
1173
|
settings: JSON.stringify(o),
|
|
1174
1174
|
tenant_id: e,
|
|
1175
1175
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1177,110 +1177,110 @@ function xa(t) {
|
|
|
1177
1177
|
}).execute();
|
|
1178
1178
|
};
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function br(t) {
|
|
1181
1181
|
return {
|
|
1182
|
-
get:
|
|
1183
|
-
create:
|
|
1184
|
-
update:
|
|
1182
|
+
get: vr(t),
|
|
1183
|
+
create: Cr(t),
|
|
1184
|
+
update: Nr(t)
|
|
1185
1185
|
};
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1188
|
-
return async (e,
|
|
1189
|
-
const
|
|
1190
|
-
return
|
|
1191
|
-
...
|
|
1192
|
-
rotating: !!
|
|
1193
|
-
device:
|
|
1194
|
-
resource_servers:
|
|
1187
|
+
function xr(t) {
|
|
1188
|
+
return async (e, r) => {
|
|
1189
|
+
const a = await t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e).where("refresh_tokens.id", "=", r).selectAll().executeTakeFirst();
|
|
1190
|
+
return a ? {
|
|
1191
|
+
...a,
|
|
1192
|
+
rotating: !!a.rotating,
|
|
1193
|
+
device: a.device ? JSON.parse(a.device) : {},
|
|
1194
|
+
resource_servers: a.resource_servers ? JSON.parse(a.resource_servers) : []
|
|
1195
1195
|
} : null;
|
|
1196
1196
|
};
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return async (e,
|
|
1200
|
-
const
|
|
1201
|
-
...
|
|
1198
|
+
function Tr(t) {
|
|
1199
|
+
return async (e, r) => {
|
|
1200
|
+
const a = {
|
|
1201
|
+
...r,
|
|
1202
1202
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1203
1203
|
};
|
|
1204
1204
|
return await t.insertInto("refresh_tokens").values({
|
|
1205
|
-
...
|
|
1205
|
+
...a,
|
|
1206
1206
|
tenant_id: e,
|
|
1207
|
-
rotating:
|
|
1208
|
-
device: JSON.stringify(
|
|
1209
|
-
resource_servers: JSON.stringify(
|
|
1210
|
-
}).execute(), { ...
|
|
1207
|
+
rotating: r.rotating ? 1 : 0,
|
|
1208
|
+
device: JSON.stringify(r.device),
|
|
1209
|
+
resource_servers: JSON.stringify(r.resource_servers)
|
|
1210
|
+
}).execute(), { ...r, ...a };
|
|
1211
1211
|
};
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return async (e,
|
|
1213
|
+
function Sr(t) {
|
|
1214
|
+
return async (e, r) => !!(await t.deleteFrom("refresh_tokens").where("tenant_id", "=", e).where("refresh_tokens.id", "=", r).execute()).length;
|
|
1215
1215
|
}
|
|
1216
|
-
function
|
|
1217
|
-
return async (e,
|
|
1216
|
+
function Or(t) {
|
|
1217
|
+
return async (e, r, a) => {
|
|
1218
1218
|
const o = {
|
|
1219
|
-
...
|
|
1220
|
-
device:
|
|
1221
|
-
resource_servers:
|
|
1222
|
-
rotating:
|
|
1219
|
+
...a,
|
|
1220
|
+
device: a.device ? JSON.stringify(a.device) : void 0,
|
|
1221
|
+
resource_servers: a.resource_servers ? JSON.stringify(a.resource_servers) : void 0,
|
|
1222
|
+
rotating: a.rotating ? 1 : 0
|
|
1223
1223
|
};
|
|
1224
|
-
return !!(await t.updateTable("refresh_tokens").set(o).where("tenant_id", "=", e).where("refresh_tokens.id", "=",
|
|
1224
|
+
return !!(await t.updateTable("refresh_tokens").set(o).where("tenant_id", "=", e).where("refresh_tokens.id", "=", r).execute()).length;
|
|
1225
1225
|
};
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1228
|
-
return async (e,
|
|
1227
|
+
function kr(t) {
|
|
1228
|
+
return async (e, r = {
|
|
1229
1229
|
page: 0,
|
|
1230
1230
|
per_page: 50,
|
|
1231
1231
|
include_totals: !1
|
|
1232
1232
|
}) => {
|
|
1233
|
-
let
|
|
1234
|
-
|
|
1235
|
-
let o =
|
|
1236
|
-
if (
|
|
1237
|
-
const { ref:
|
|
1233
|
+
let a = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
|
|
1234
|
+
r.q && (a = C(t, a, r.q, ["token", "session_id"]));
|
|
1235
|
+
let o = a;
|
|
1236
|
+
if (r.sort && r.sort.sort_by) {
|
|
1237
|
+
const { ref: c } = t.dynamic;
|
|
1238
1238
|
o = o.orderBy(
|
|
1239
|
-
|
|
1240
|
-
|
|
1239
|
+
c(r.sort.sort_by),
|
|
1240
|
+
r.sort.sort_order
|
|
1241
1241
|
);
|
|
1242
1242
|
}
|
|
1243
|
-
o = o.offset(
|
|
1244
|
-
const n = await o.selectAll().execute(), { count: s } = await
|
|
1243
|
+
o = o.offset(r.page * r.per_page).limit(r.per_page);
|
|
1244
|
+
const n = await o.selectAll().execute(), { count: s } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = v(s);
|
|
1245
1245
|
return {
|
|
1246
|
-
refresh_tokens: n.map((
|
|
1247
|
-
...
|
|
1248
|
-
rotating: !!
|
|
1249
|
-
device:
|
|
1250
|
-
resource_servers:
|
|
1246
|
+
refresh_tokens: n.map((c) => ({
|
|
1247
|
+
...c,
|
|
1248
|
+
rotating: !!c.rotating,
|
|
1249
|
+
device: c.device ? JSON.parse(c.device) : {},
|
|
1250
|
+
resource_servers: c.resource_servers ? JSON.parse(c.resource_servers) : []
|
|
1251
1251
|
})),
|
|
1252
|
-
start:
|
|
1253
|
-
limit:
|
|
1252
|
+
start: r.page * r.per_page,
|
|
1253
|
+
limit: r.per_page,
|
|
1254
1254
|
length: l
|
|
1255
1255
|
};
|
|
1256
1256
|
};
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1258
|
+
function $r(t) {
|
|
1259
1259
|
return {
|
|
1260
|
-
create:
|
|
1261
|
-
get:
|
|
1262
|
-
list:
|
|
1263
|
-
remove:
|
|
1264
|
-
update:
|
|
1260
|
+
create: Tr(t),
|
|
1261
|
+
get: xr(t),
|
|
1262
|
+
list: kr(t),
|
|
1263
|
+
remove: Sr(t),
|
|
1264
|
+
update: Or(t)
|
|
1265
1265
|
};
|
|
1266
1266
|
}
|
|
1267
|
-
function
|
|
1267
|
+
function Ir(t) {
|
|
1268
1268
|
return async () => {
|
|
1269
|
-
const e = new Date(Date.now() - 864e5).toISOString(),
|
|
1269
|
+
const e = new Date(Date.now() - 864e5).toISOString(), r = new Date(
|
|
1270
1270
|
Date.now() - 1e3 * 60 * 60 * 24 * 7
|
|
1271
|
-
).toISOString(),
|
|
1271
|
+
).toISOString(), a = new Date(
|
|
1272
1272
|
Date.now() - 1e3 * 60 * 60 * 24 * 30 * 3
|
|
1273
1273
|
).toISOString();
|
|
1274
|
-
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", "<",
|
|
1274
|
+
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", "<", r).where("session_id", "is", null).limit(1e5).execute(), console.log("delete logs"), await t.deleteFrom("logs").where("date", "<", a).limit(1e5).execute(), console.log("delete refresh tokens"), await t.deleteFrom("refresh_tokens").where(
|
|
1275
1275
|
(n) => n.or([
|
|
1276
|
-
n("expires_at", "<",
|
|
1277
|
-
n("idle_expires_at", "<",
|
|
1276
|
+
n("expires_at", "<", r),
|
|
1277
|
+
n("idle_expires_at", "<", r)
|
|
1278
1278
|
])
|
|
1279
1279
|
).limit(1e4).execute(), console.log("delete sessions");
|
|
1280
1280
|
const o = await t.selectFrom("sessions").select("id").where(
|
|
1281
1281
|
(n) => n.or([
|
|
1282
|
-
n("expires_at", "<",
|
|
1283
|
-
n("idle_expires_at", "<",
|
|
1282
|
+
n("expires_at", "<", r),
|
|
1283
|
+
n("idle_expires_at", "<", r)
|
|
1284
1284
|
])
|
|
1285
1285
|
).where(
|
|
1286
1286
|
"id",
|
|
@@ -1294,70 +1294,70 @@ function ja(t) {
|
|
|
1294
1294
|
).execute(), console.log("cleanup complete");
|
|
1295
1295
|
};
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1298
|
-
return async (e,
|
|
1299
|
-
const
|
|
1300
|
-
id:
|
|
1301
|
-
...
|
|
1297
|
+
function Dr(t) {
|
|
1298
|
+
return async (e, r) => {
|
|
1299
|
+
const a = B.parse({
|
|
1300
|
+
id: b(),
|
|
1301
|
+
...r,
|
|
1302
1302
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1303
1303
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1304
1304
|
});
|
|
1305
1305
|
return await t.insertInto("forms").values({
|
|
1306
|
-
...
|
|
1306
|
+
...a,
|
|
1307
1307
|
// Store complex objects as JSON strings
|
|
1308
|
-
nodes: JSON.stringify(
|
|
1309
|
-
start: JSON.stringify(
|
|
1310
|
-
ending: JSON.stringify(
|
|
1308
|
+
nodes: JSON.stringify(a.nodes || []),
|
|
1309
|
+
start: JSON.stringify(a.start || {}),
|
|
1310
|
+
ending: JSON.stringify(a.ending || {}),
|
|
1311
1311
|
tenant_id: e
|
|
1312
|
-
}).execute(),
|
|
1312
|
+
}).execute(), B.parse(a);
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1316
|
-
return async (e,
|
|
1315
|
+
function Pr(t) {
|
|
1316
|
+
return async (e, r = {
|
|
1317
1317
|
page: 0,
|
|
1318
1318
|
per_page: 50,
|
|
1319
1319
|
include_totals: !1
|
|
1320
1320
|
}) => {
|
|
1321
|
-
let
|
|
1322
|
-
|
|
1323
|
-
const s = (await
|
|
1324
|
-
const
|
|
1325
|
-
if (typeof
|
|
1321
|
+
let a = t.selectFrom("forms").where("tenant_id", "=", e);
|
|
1322
|
+
r != null && r.q && (a = C(t, a, r.q, []));
|
|
1323
|
+
const s = (await a.offset(r.page * r.per_page).limit(r.per_page).selectAll().execute()).map((c) => {
|
|
1324
|
+
const _ = { ...c };
|
|
1325
|
+
if (typeof _.nodes == "string")
|
|
1326
1326
|
try {
|
|
1327
|
-
|
|
1327
|
+
_.nodes = JSON.parse(_.nodes);
|
|
1328
1328
|
} catch {
|
|
1329
1329
|
}
|
|
1330
|
-
if (typeof
|
|
1330
|
+
if (typeof _.start == "string")
|
|
1331
1331
|
try {
|
|
1332
|
-
|
|
1332
|
+
_.start = JSON.parse(_.start);
|
|
1333
1333
|
} catch {
|
|
1334
1334
|
}
|
|
1335
|
-
if (typeof
|
|
1335
|
+
if (typeof _.ending == "string")
|
|
1336
1336
|
try {
|
|
1337
|
-
|
|
1337
|
+
_.ending = JSON.parse(_.ending);
|
|
1338
1338
|
} catch {
|
|
1339
1339
|
}
|
|
1340
|
-
return
|
|
1341
|
-
}), { count: l } = await
|
|
1340
|
+
return B.parse(p(_));
|
|
1341
|
+
}), { count: l } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
1342
1342
|
return {
|
|
1343
1343
|
forms: s,
|
|
1344
|
-
start:
|
|
1345
|
-
limit:
|
|
1344
|
+
start: r.page * r.per_page,
|
|
1345
|
+
limit: r.per_page,
|
|
1346
1346
|
length: v(l)
|
|
1347
1347
|
};
|
|
1348
1348
|
};
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1351
|
-
return async (e,
|
|
1352
|
-
const { numDeletedRows:
|
|
1353
|
-
return
|
|
1350
|
+
function jr(t) {
|
|
1351
|
+
return async (e, r) => {
|
|
1352
|
+
const { numDeletedRows: a } = await t.deleteFrom("forms").where("id", "=", r).where("tenant_id", "=", e).executeTakeFirst();
|
|
1353
|
+
return a > 0;
|
|
1354
1354
|
};
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1357
|
-
return async (e,
|
|
1358
|
-
const
|
|
1359
|
-
if (!
|
|
1360
|
-
const o = { ...
|
|
1356
|
+
function Fr(t) {
|
|
1357
|
+
return async (e, r) => {
|
|
1358
|
+
const a = await t.selectFrom("forms").selectAll().where("forms.id", "=", r).where("tenant_id", "=", e).executeTakeFirst();
|
|
1359
|
+
if (!a) return null;
|
|
1360
|
+
const o = { ...a };
|
|
1361
1361
|
if (typeof o.nodes == "string")
|
|
1362
1362
|
try {
|
|
1363
1363
|
o.nodes = JSON.parse(o.nodes);
|
|
@@ -1373,344 +1373,446 @@ function Aa(t) {
|
|
|
1373
1373
|
o.ending = JSON.parse(o.ending);
|
|
1374
1374
|
} catch {
|
|
1375
1375
|
}
|
|
1376
|
-
return
|
|
1376
|
+
return B.parse(p(o));
|
|
1377
1377
|
};
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1380
|
-
return async (e,
|
|
1379
|
+
function Mr(t) {
|
|
1380
|
+
return async (e, r, a) => {
|
|
1381
1381
|
const o = {
|
|
1382
|
-
...
|
|
1382
|
+
...a,
|
|
1383
1383
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1384
1384
|
};
|
|
1385
|
-
|
|
1386
|
-
const { numUpdatedRows: n } = await t.updateTable("forms").set(o).where("id", "=",
|
|
1385
|
+
a.nodes && (o.nodes = JSON.stringify(a.nodes)), a.start && (o.start = JSON.stringify(a.start)), a.ending && (o.ending = JSON.stringify(a.ending));
|
|
1386
|
+
const { numUpdatedRows: n } = await t.updateTable("forms").set(o).where("id", "=", r).where("tenant_id", "=", e).executeTakeFirst();
|
|
1387
1387
|
return n > 0;
|
|
1388
1388
|
};
|
|
1389
1389
|
}
|
|
1390
|
-
function
|
|
1390
|
+
function Ar(t) {
|
|
1391
1391
|
return {
|
|
1392
|
-
create:
|
|
1393
|
-
get:
|
|
1394
|
-
list:
|
|
1395
|
-
remove:
|
|
1396
|
-
update:
|
|
1392
|
+
create: Dr(t),
|
|
1393
|
+
get: Fr(t),
|
|
1394
|
+
list: Pr(t),
|
|
1395
|
+
remove: jr(t),
|
|
1396
|
+
update: Mr(t)
|
|
1397
1397
|
};
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1400
|
-
return async (e,
|
|
1401
|
-
const
|
|
1402
|
-
id:
|
|
1403
|
-
...
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
...
|
|
1399
|
+
function zr(t) {
|
|
1400
|
+
return async (e, r) => {
|
|
1401
|
+
const a = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
1402
|
+
id: b(),
|
|
1403
|
+
...r,
|
|
1404
|
+
created_at: a,
|
|
1405
|
+
updated_at: a
|
|
1406
|
+
}, n = qe.parse(o), {
|
|
1407
|
+
verificationKey: s,
|
|
1408
|
+
scopes: l,
|
|
1409
|
+
options: c,
|
|
1410
|
+
skip_consent_for_verifiable_first_party_clients: _,
|
|
1411
|
+
allow_offline_access: u,
|
|
1412
|
+
...h
|
|
1413
|
+
} = n, g = {
|
|
1414
|
+
...h,
|
|
1413
1415
|
tenant_id: e,
|
|
1414
|
-
scopes:
|
|
1415
|
-
options:
|
|
1416
|
-
skip_consent_for_verifiable_first_party_clients:
|
|
1417
|
-
allow_offline_access:
|
|
1418
|
-
verification_key:
|
|
1419
|
-
|
|
1420
|
-
|
|
1416
|
+
scopes: l ? JSON.stringify(l) : "[]",
|
|
1417
|
+
options: c ? JSON.stringify(c) : "{}",
|
|
1418
|
+
skip_consent_for_verifiable_first_party_clients: _ ? 1 : 0,
|
|
1419
|
+
allow_offline_access: u ? 1 : 0,
|
|
1420
|
+
verification_key: s,
|
|
1421
|
+
created_at: a,
|
|
1422
|
+
updated_at: a
|
|
1423
|
+
};
|
|
1424
|
+
return await t.insertInto("resource_servers").values(g).execute(), n;
|
|
1421
1425
|
};
|
|
1422
1426
|
}
|
|
1423
|
-
function
|
|
1424
|
-
return async (e,
|
|
1425
|
-
const
|
|
1426
|
-
if (!
|
|
1427
|
-
const o =
|
|
1427
|
+
function Lr(t) {
|
|
1428
|
+
return async (e, r) => {
|
|
1429
|
+
const a = await t.selectFrom("resource_servers").selectAll().where("tenant_id", "=", e).where("id", "=", r).executeTakeFirst();
|
|
1430
|
+
if (!a) return null;
|
|
1431
|
+
const o = a, {
|
|
1428
1432
|
verification_key: n,
|
|
1429
1433
|
scopes: s,
|
|
1430
1434
|
options: l,
|
|
1431
|
-
skip_consent_for_verifiable_first_party_clients:
|
|
1432
|
-
allow_offline_access:
|
|
1435
|
+
skip_consent_for_verifiable_first_party_clients: c,
|
|
1436
|
+
allow_offline_access: _,
|
|
1433
1437
|
...u
|
|
1434
1438
|
} = o;
|
|
1435
1439
|
return {
|
|
1436
1440
|
...u,
|
|
1437
1441
|
scopes: s ? JSON.parse(s) : [],
|
|
1438
1442
|
options: l ? JSON.parse(l) : {},
|
|
1439
|
-
skip_consent_for_verifiable_first_party_clients: !!
|
|
1440
|
-
allow_offline_access: !!
|
|
1443
|
+
skip_consent_for_verifiable_first_party_clients: !!c,
|
|
1444
|
+
allow_offline_access: !!_,
|
|
1441
1445
|
// Convert verification_key back to verificationKey for API
|
|
1442
1446
|
verificationKey: n
|
|
1443
1447
|
};
|
|
1444
1448
|
};
|
|
1445
1449
|
}
|
|
1446
|
-
function
|
|
1447
|
-
return async (e,
|
|
1448
|
-
let
|
|
1449
|
-
if (
|
|
1450
|
-
const
|
|
1451
|
-
if (h && !
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1450
|
+
function Er(t) {
|
|
1451
|
+
return async (e, r = { page: 0, per_page: 50, include_totals: !1 }) => {
|
|
1452
|
+
let a = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
|
|
1453
|
+
if (r.q) {
|
|
1454
|
+
const c = r.q.trim(), _ = c.split(/\s+/), u = _.length === 1 ? _[0] : void 0, h = u ? u.match(/^(-)?(name|identifier):(.*)$/) : null, g = h ? h[3] : "", I = /^(>=|>|<=|<)/.test(g || "");
|
|
1455
|
+
if (h && !I) {
|
|
1456
|
+
const D = !!h[1], O = h[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
|
|
1457
|
+
a = D ? a.where(O, "not like", `%${g}%`) : a.where(O, "like", `%${g}%`);
|
|
1454
1458
|
} else
|
|
1455
|
-
|
|
1459
|
+
a = C(t, a, c, [
|
|
1456
1460
|
"resource_servers.name",
|
|
1457
1461
|
"resource_servers.identifier"
|
|
1458
1462
|
]);
|
|
1459
1463
|
}
|
|
1460
|
-
const s = (await
|
|
1461
|
-
const
|
|
1464
|
+
const s = (await a.offset(r.page * r.per_page).limit(r.per_page).selectAll().execute()).map((c) => {
|
|
1465
|
+
const _ = c, {
|
|
1462
1466
|
verification_key: u,
|
|
1463
1467
|
scopes: h,
|
|
1464
|
-
options:
|
|
1465
|
-
skip_consent_for_verifiable_first_party_clients:
|
|
1466
|
-
allow_offline_access:
|
|
1468
|
+
options: g,
|
|
1469
|
+
skip_consent_for_verifiable_first_party_clients: I,
|
|
1470
|
+
allow_offline_access: D,
|
|
1467
1471
|
...O
|
|
1468
|
-
} =
|
|
1472
|
+
} = _;
|
|
1469
1473
|
return {
|
|
1470
1474
|
...O,
|
|
1471
1475
|
scopes: h ? JSON.parse(h) : [],
|
|
1472
|
-
options:
|
|
1473
|
-
skip_consent_for_verifiable_first_party_clients: !!
|
|
1474
|
-
allow_offline_access: !!
|
|
1476
|
+
options: g ? JSON.parse(g) : {},
|
|
1477
|
+
skip_consent_for_verifiable_first_party_clients: !!I,
|
|
1478
|
+
allow_offline_access: !!D,
|
|
1475
1479
|
// Convert verification_key back to verificationKey for API
|
|
1476
1480
|
verificationKey: u
|
|
1477
1481
|
};
|
|
1478
|
-
}), { count: l } = await
|
|
1482
|
+
}), { count: l } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
1479
1483
|
return {
|
|
1480
1484
|
resource_servers: s,
|
|
1481
|
-
start:
|
|
1482
|
-
limit:
|
|
1485
|
+
start: r.page * r.per_page,
|
|
1486
|
+
limit: r.per_page,
|
|
1483
1487
|
length: v(l)
|
|
1484
1488
|
};
|
|
1485
1489
|
};
|
|
1486
1490
|
}
|
|
1487
|
-
function
|
|
1488
|
-
return async (e,
|
|
1489
|
-
const
|
|
1490
|
-
return Number(
|
|
1491
|
+
function Jr(t) {
|
|
1492
|
+
return async (e, r) => {
|
|
1493
|
+
const a = await t.deleteFrom("resource_servers").where("tenant_id", "=", e).where("id", "=", r).executeTakeFirst();
|
|
1494
|
+
return Number(a.numDeletedRows) > 0;
|
|
1491
1495
|
};
|
|
1492
1496
|
}
|
|
1493
|
-
function
|
|
1494
|
-
return async (e,
|
|
1497
|
+
function Rr(t) {
|
|
1498
|
+
return async (e, r, a) => {
|
|
1495
1499
|
const {
|
|
1496
1500
|
verificationKey: o,
|
|
1497
1501
|
scopes: n,
|
|
1498
1502
|
options: s,
|
|
1499
1503
|
skip_consent_for_verifiable_first_party_clients: l,
|
|
1500
|
-
allow_offline_access:
|
|
1501
|
-
...
|
|
1502
|
-
} =
|
|
1503
|
-
|
|
1504
|
-
|
|
1504
|
+
allow_offline_access: c,
|
|
1505
|
+
..._
|
|
1506
|
+
} = a, u = {
|
|
1507
|
+
..._,
|
|
1508
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1509
|
+
};
|
|
1510
|
+
o !== void 0 && (u.verification_key = o), n !== void 0 && (u.scopes = JSON.stringify(n)), s !== void 0 && (u.options = JSON.stringify(s)), l !== void 0 && (u.skip_consent_for_verifiable_first_party_clients = l ? 1 : 0), c !== void 0 && (u.allow_offline_access = c ? 1 : 0);
|
|
1511
|
+
const h = await t.updateTable("resource_servers").set(u).where("tenant_id", "=", e).where("id", "=", r).executeTakeFirst();
|
|
1505
1512
|
return Number(h.numUpdatedRows) > 0;
|
|
1506
1513
|
};
|
|
1507
1514
|
}
|
|
1508
|
-
function
|
|
1515
|
+
function Kr(t) {
|
|
1509
1516
|
return {
|
|
1510
|
-
create:
|
|
1511
|
-
get:
|
|
1512
|
-
list:
|
|
1513
|
-
remove:
|
|
1514
|
-
update:
|
|
1517
|
+
create: zr(t),
|
|
1518
|
+
get: Lr(t),
|
|
1519
|
+
list: Er(t),
|
|
1520
|
+
remove: Jr(t),
|
|
1521
|
+
update: Rr(t)
|
|
1515
1522
|
};
|
|
1516
1523
|
}
|
|
1517
|
-
function
|
|
1518
|
-
return async (e,
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1524
|
+
function Ur(t) {
|
|
1525
|
+
return async (e, r) => {
|
|
1526
|
+
const a = (/* @__PURE__ */ new Date()).toISOString(), o = b(), n = {
|
|
1527
|
+
id: o,
|
|
1528
|
+
...r,
|
|
1521
1529
|
tenant_id: e,
|
|
1522
|
-
|
|
1530
|
+
created_at: a,
|
|
1531
|
+
updated_at: a
|
|
1532
|
+
};
|
|
1533
|
+
return await t.insertInto("roles").values(n).execute(), {
|
|
1534
|
+
id: o,
|
|
1535
|
+
...r,
|
|
1536
|
+
created_at: a,
|
|
1537
|
+
updated_at: a
|
|
1523
1538
|
};
|
|
1524
|
-
return await t.insertInto("rules").values(l).execute(), o;
|
|
1525
1539
|
};
|
|
1526
1540
|
}
|
|
1527
|
-
function
|
|
1528
|
-
return async (e,
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
...s,
|
|
1534
|
-
enabled: !!n
|
|
1535
|
-
};
|
|
1541
|
+
function Br(t) {
|
|
1542
|
+
return async (e, r) => {
|
|
1543
|
+
const a = await t.selectFrom("roles").selectAll().where("roles.tenant_id", "=", e).where("roles.id", "=", r).executeTakeFirst();
|
|
1544
|
+
return a ? {
|
|
1545
|
+
...a
|
|
1546
|
+
} : null;
|
|
1536
1547
|
};
|
|
1537
1548
|
}
|
|
1538
|
-
function
|
|
1539
|
-
return async (e,
|
|
1540
|
-
let
|
|
1541
|
-
|
|
1542
|
-
const
|
|
1543
|
-
const m = i, { enabled: u, ...h } = m;
|
|
1544
|
-
return {
|
|
1545
|
-
...h,
|
|
1546
|
-
enabled: !!u
|
|
1547
|
-
};
|
|
1548
|
-
}), { count: l } = await r.select((i) => i.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
1549
|
+
function Qr(t) {
|
|
1550
|
+
return async (e, r = { page: 0, per_page: 50, include_totals: !1 }) => {
|
|
1551
|
+
let a = t.selectFrom("roles").where("roles.tenant_id", "=", e);
|
|
1552
|
+
r.q && (a = C(t, a, r.q, ["name"]));
|
|
1553
|
+
const n = await a.offset(r.page * r.per_page).limit(r.per_page).selectAll().execute(), { count: s } = await a.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
|
|
1549
1554
|
return {
|
|
1550
|
-
|
|
1551
|
-
start:
|
|
1552
|
-
limit:
|
|
1553
|
-
length: v(
|
|
1555
|
+
roles: n,
|
|
1556
|
+
start: r.page * r.per_page,
|
|
1557
|
+
limit: r.per_page,
|
|
1558
|
+
length: v(s)
|
|
1554
1559
|
};
|
|
1555
1560
|
};
|
|
1556
1561
|
}
|
|
1557
|
-
function
|
|
1558
|
-
return async (e, a) => {
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1562
|
+
function qr(t) {
|
|
1563
|
+
return async (e, r, a) => {
|
|
1564
|
+
const o = {
|
|
1565
|
+
...a,
|
|
1566
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1567
|
+
}, n = await t.updateTable("roles").set(o).where("roles.tenant_id", "=", e).where("roles.id", "=", r).executeTakeFirst();
|
|
1568
|
+
return Number(n.numUpdatedRows) > 0;
|
|
1561
1569
|
};
|
|
1562
1570
|
}
|
|
1563
|
-
function
|
|
1564
|
-
return async (e,
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
const l = await t.updateTable("rules").set(s).where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
1568
|
-
return Number(l.numUpdatedRows) > 0;
|
|
1571
|
+
function Vr(t) {
|
|
1572
|
+
return async (e, r) => {
|
|
1573
|
+
const a = await t.deleteFrom("roles").where("tenant_id", "=", e).where("id", "=", r).executeTakeFirst();
|
|
1574
|
+
return Number(a.numDeletedRows) > 0;
|
|
1569
1575
|
};
|
|
1570
1576
|
}
|
|
1571
|
-
function
|
|
1577
|
+
function Wr(t) {
|
|
1572
1578
|
return {
|
|
1573
|
-
create:
|
|
1574
|
-
get:
|
|
1575
|
-
list:
|
|
1576
|
-
|
|
1577
|
-
|
|
1579
|
+
create: Ur(t),
|
|
1580
|
+
get: Br(t),
|
|
1581
|
+
list: Qr(t),
|
|
1582
|
+
update: qr(t),
|
|
1583
|
+
remove: Vr(t)
|
|
1578
1584
|
};
|
|
1579
1585
|
}
|
|
1580
|
-
function
|
|
1581
|
-
return async (e, a) => {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1586
|
+
function Gr(t) {
|
|
1587
|
+
return async (e, r, a) => {
|
|
1588
|
+
if (a.length === 0) return !0;
|
|
1589
|
+
const o = (/* @__PURE__ */ new Date()).toISOString();
|
|
1590
|
+
try {
|
|
1591
|
+
for (const n of a) {
|
|
1592
|
+
if (n.role_id !== r)
|
|
1593
|
+
throw new Error(
|
|
1594
|
+
`Permission role_id ${n.role_id} does not match expected role_id ${r}`
|
|
1595
|
+
);
|
|
1596
|
+
const s = {
|
|
1597
|
+
tenant_id: e,
|
|
1598
|
+
role_id: n.role_id,
|
|
1599
|
+
resource_server_identifier: n.resource_server_identifier,
|
|
1600
|
+
permission_name: n.permission_name,
|
|
1601
|
+
created_at: o
|
|
1602
|
+
};
|
|
1603
|
+
try {
|
|
1604
|
+
await t.insertInto("role_permissions").values(s).execute();
|
|
1605
|
+
} catch (l) {
|
|
1606
|
+
if (l.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || l.code === "SQLITE_CONSTRAINT_UNIQUE")
|
|
1607
|
+
continue;
|
|
1608
|
+
throw l;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
return !0;
|
|
1612
|
+
} catch (n) {
|
|
1613
|
+
return console.error("Error assigning role permissions:", n), !1;
|
|
1614
|
+
}
|
|
1589
1615
|
};
|
|
1590
1616
|
}
|
|
1591
|
-
function
|
|
1592
|
-
return async (e, a) => {
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1617
|
+
function Hr(t) {
|
|
1618
|
+
return async (e, r, a) => {
|
|
1619
|
+
if (a.length === 0) return !0;
|
|
1620
|
+
try {
|
|
1621
|
+
return (await Promise.all(
|
|
1622
|
+
a.map(
|
|
1623
|
+
(n) => t.deleteFrom("role_permissions").where("tenant_id", "=", e).where("role_id", "=", r).where(
|
|
1624
|
+
"resource_server_identifier",
|
|
1625
|
+
"=",
|
|
1626
|
+
n.resource_server_identifier
|
|
1627
|
+
).where("permission_name", "=", n.permission_name).executeTakeFirst()
|
|
1628
|
+
)
|
|
1629
|
+
)).some((n) => Number(n.numDeletedRows) > 0);
|
|
1630
|
+
} catch (o) {
|
|
1631
|
+
return console.error("Error removing role permissions:", o), !1;
|
|
1632
|
+
}
|
|
1600
1633
|
};
|
|
1601
1634
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return async (e, a = { page: 0, per_page: 50, include_totals: !1 }) =>
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
"
|
|
1607
|
-
"
|
|
1608
|
-
"
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1635
|
+
function Xr(t) {
|
|
1636
|
+
return async (e, r, a = { page: 0, per_page: 50, include_totals: !1 }) => (await t.selectFrom("role_permissions").leftJoin(
|
|
1637
|
+
"resource_servers",
|
|
1638
|
+
(s) => s.onRef(
|
|
1639
|
+
"role_permissions.tenant_id",
|
|
1640
|
+
"=",
|
|
1641
|
+
"resource_servers.tenant_id"
|
|
1642
|
+
).onRef(
|
|
1643
|
+
"role_permissions.resource_server_identifier",
|
|
1644
|
+
"=",
|
|
1645
|
+
"resource_servers.id"
|
|
1646
|
+
)
|
|
1647
|
+
).select([
|
|
1648
|
+
"role_permissions.role_id",
|
|
1649
|
+
"role_permissions.resource_server_identifier",
|
|
1650
|
+
"role_permissions.permission_name",
|
|
1651
|
+
"role_permissions.created_at",
|
|
1652
|
+
"resource_servers.name as resource_server_name"
|
|
1653
|
+
]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=", r).offset(a.page * a.per_page).limit(a.per_page).execute()).map((s) => ({
|
|
1654
|
+
role_id: s.role_id,
|
|
1655
|
+
resource_server_identifier: s.resource_server_identifier,
|
|
1656
|
+
resource_server_name: s.resource_server_name || s.resource_server_identifier,
|
|
1657
|
+
// Fallback to identifier if name is null
|
|
1658
|
+
permission_name: s.permission_name,
|
|
1659
|
+
description: null,
|
|
1660
|
+
// No description available from role_permissions directly
|
|
1661
|
+
created_at: s.created_at
|
|
1662
|
+
}));
|
|
1663
|
+
}
|
|
1664
|
+
function Yr(t) {
|
|
1665
|
+
return {
|
|
1666
|
+
assign: Gr(t),
|
|
1667
|
+
remove: Hr(t),
|
|
1668
|
+
list: Xr(t)
|
|
1623
1669
|
};
|
|
1624
1670
|
}
|
|
1625
|
-
function
|
|
1626
|
-
return async (e,
|
|
1627
|
-
|
|
1628
|
-
o
|
|
1629
|
-
|
|
1630
|
-
|
|
1671
|
+
function Zr(t) {
|
|
1672
|
+
return async (e, r, a) => {
|
|
1673
|
+
if (a.length === 0) return !0;
|
|
1674
|
+
const o = (/* @__PURE__ */ new Date()).toISOString();
|
|
1675
|
+
try {
|
|
1676
|
+
for (const n of a) {
|
|
1677
|
+
const s = {
|
|
1678
|
+
tenant_id: e,
|
|
1679
|
+
user_id: r,
|
|
1680
|
+
resource_server_identifier: n.resource_server_identifier,
|
|
1681
|
+
permission_name: n.permission_name,
|
|
1682
|
+
created_at: o
|
|
1683
|
+
};
|
|
1684
|
+
try {
|
|
1685
|
+
await t.insertInto("user_permissions").values(s).execute();
|
|
1686
|
+
} catch (l) {
|
|
1687
|
+
if (l.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || l.code === "SQLITE_CONSTRAINT_UNIQUE")
|
|
1688
|
+
continue;
|
|
1689
|
+
throw l;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
return !0;
|
|
1693
|
+
} catch (n) {
|
|
1694
|
+
return console.error("Error assigning user permissions:", n), !1;
|
|
1695
|
+
}
|
|
1631
1696
|
};
|
|
1632
1697
|
}
|
|
1633
|
-
function
|
|
1634
|
-
return async (e, a) => {
|
|
1635
|
-
|
|
1636
|
-
|
|
1698
|
+
function ea(t) {
|
|
1699
|
+
return async (e, r, a) => {
|
|
1700
|
+
if (a.length === 0) return !0;
|
|
1701
|
+
try {
|
|
1702
|
+
for (const o of a)
|
|
1703
|
+
await t.deleteFrom("user_permissions").where("tenant_id", "=", e).where("user_id", "=", r).where(
|
|
1704
|
+
"resource_server_identifier",
|
|
1705
|
+
"=",
|
|
1706
|
+
o.resource_server_identifier
|
|
1707
|
+
).where("permission_name", "=", o.permission_name).execute();
|
|
1708
|
+
return !0;
|
|
1709
|
+
} catch (o) {
|
|
1710
|
+
return console.error("Error removing user permissions:", o), !1;
|
|
1711
|
+
}
|
|
1637
1712
|
};
|
|
1638
1713
|
}
|
|
1639
|
-
function
|
|
1714
|
+
function ta(t) {
|
|
1715
|
+
return async (e, r, a) => (await t.selectFrom("user_permissions").leftJoin(
|
|
1716
|
+
"resource_servers",
|
|
1717
|
+
(n) => n.onRef(
|
|
1718
|
+
"user_permissions.tenant_id",
|
|
1719
|
+
"=",
|
|
1720
|
+
"resource_servers.tenant_id"
|
|
1721
|
+
).onRef(
|
|
1722
|
+
"user_permissions.resource_server_identifier",
|
|
1723
|
+
"=",
|
|
1724
|
+
"resource_servers.id"
|
|
1725
|
+
)
|
|
1726
|
+
).select([
|
|
1727
|
+
"user_permissions.resource_server_identifier",
|
|
1728
|
+
"user_permissions.permission_name",
|
|
1729
|
+
"resource_servers.name as resource_server_name",
|
|
1730
|
+
"user_permissions.user_id",
|
|
1731
|
+
"user_permissions.created_at"
|
|
1732
|
+
]).where("user_permissions.tenant_id", "=", e).where("user_permissions.user_id", "=", r).execute()).map((n) => ({
|
|
1733
|
+
resource_server_identifier: n.resource_server_identifier,
|
|
1734
|
+
permission_name: n.permission_name,
|
|
1735
|
+
description: null,
|
|
1736
|
+
// No description available from user_permissions directly
|
|
1737
|
+
resource_server_name: n.resource_server_name || n.resource_server_identifier,
|
|
1738
|
+
// Fallback to identifier if name is null
|
|
1739
|
+
user_id: n.user_id,
|
|
1740
|
+
created_at: n.created_at
|
|
1741
|
+
}));
|
|
1742
|
+
}
|
|
1743
|
+
function ra(t) {
|
|
1640
1744
|
return {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
list:
|
|
1644
|
-
update: er(t),
|
|
1645
|
-
remove: tr(t)
|
|
1745
|
+
assign: Zr(t),
|
|
1746
|
+
remove: ea(t),
|
|
1747
|
+
list: ta(t)
|
|
1646
1748
|
};
|
|
1647
1749
|
}
|
|
1648
|
-
function
|
|
1750
|
+
function aa(t) {
|
|
1649
1751
|
return t[t.length - 1];
|
|
1650
1752
|
}
|
|
1651
|
-
function
|
|
1753
|
+
function y(t) {
|
|
1652
1754
|
return Object.freeze(t);
|
|
1653
1755
|
}
|
|
1654
|
-
const
|
|
1756
|
+
const U = y({
|
|
1655
1757
|
is(t) {
|
|
1656
1758
|
return t.kind === "IdentifierNode";
|
|
1657
1759
|
},
|
|
1658
1760
|
create(t) {
|
|
1659
|
-
return
|
|
1761
|
+
return y({
|
|
1660
1762
|
kind: "IdentifierNode",
|
|
1661
1763
|
name: t
|
|
1662
1764
|
});
|
|
1663
1765
|
}
|
|
1664
|
-
}), X =
|
|
1766
|
+
}), X = y({
|
|
1665
1767
|
is(t) {
|
|
1666
1768
|
return t.kind === "SchemableIdentifierNode";
|
|
1667
1769
|
},
|
|
1668
1770
|
create(t) {
|
|
1669
|
-
return
|
|
1771
|
+
return y({
|
|
1670
1772
|
kind: "SchemableIdentifierNode",
|
|
1671
|
-
identifier:
|
|
1773
|
+
identifier: U.create(t)
|
|
1672
1774
|
});
|
|
1673
1775
|
},
|
|
1674
1776
|
createWithSchema(t, e) {
|
|
1675
|
-
return
|
|
1777
|
+
return y({
|
|
1676
1778
|
kind: "SchemableIdentifierNode",
|
|
1677
|
-
schema:
|
|
1678
|
-
identifier:
|
|
1779
|
+
schema: U.create(t),
|
|
1780
|
+
identifier: U.create(e)
|
|
1679
1781
|
});
|
|
1680
1782
|
}
|
|
1681
|
-
}),
|
|
1783
|
+
}), na = y({
|
|
1682
1784
|
is(t) {
|
|
1683
1785
|
return t.kind === "AliasNode";
|
|
1684
1786
|
},
|
|
1685
1787
|
create(t, e) {
|
|
1686
|
-
return
|
|
1788
|
+
return y({
|
|
1687
1789
|
kind: "AliasNode",
|
|
1688
1790
|
node: t,
|
|
1689
1791
|
alias: e
|
|
1690
1792
|
});
|
|
1691
1793
|
}
|
|
1692
|
-
}), V =
|
|
1794
|
+
}), V = y({
|
|
1693
1795
|
is(t) {
|
|
1694
1796
|
return t.kind === "TableNode";
|
|
1695
1797
|
},
|
|
1696
1798
|
create(t) {
|
|
1697
|
-
return
|
|
1799
|
+
return y({
|
|
1698
1800
|
kind: "TableNode",
|
|
1699
1801
|
table: X.create(t)
|
|
1700
1802
|
});
|
|
1701
1803
|
},
|
|
1702
1804
|
createWithSchema(t, e) {
|
|
1703
|
-
return
|
|
1805
|
+
return y({
|
|
1704
1806
|
kind: "TableNode",
|
|
1705
1807
|
table: X.createWithSchema(t, e)
|
|
1706
1808
|
});
|
|
1707
1809
|
}
|
|
1708
1810
|
});
|
|
1709
1811
|
var Q;
|
|
1710
|
-
class
|
|
1812
|
+
class oa {
|
|
1711
1813
|
constructor() {
|
|
1712
1814
|
z(this, "nodeStack", []);
|
|
1713
|
-
|
|
1815
|
+
N(this, Q, y({
|
|
1714
1816
|
AliasNode: this.transformAlias.bind(this),
|
|
1715
1817
|
ColumnNode: this.transformColumn.bind(this),
|
|
1716
1818
|
IdentifierNode: this.transformIdentifier.bind(this),
|
|
@@ -1810,14 +1912,14 @@ class or {
|
|
|
1810
1912
|
if (!e)
|
|
1811
1913
|
return e;
|
|
1812
1914
|
this.nodeStack.push(e);
|
|
1813
|
-
const
|
|
1814
|
-
return this.nodeStack.pop(),
|
|
1915
|
+
const r = this.transformNodeImpl(e);
|
|
1916
|
+
return this.nodeStack.pop(), y(r);
|
|
1815
1917
|
}
|
|
1816
1918
|
transformNodeImpl(e) {
|
|
1817
1919
|
return d(this, Q)[e.kind](e);
|
|
1818
1920
|
}
|
|
1819
1921
|
transformNodeList(e) {
|
|
1820
|
-
return e &&
|
|
1922
|
+
return e && y(e.map((r) => this.transformNode(r)));
|
|
1821
1923
|
}
|
|
1822
1924
|
transformSelectQuery(e) {
|
|
1823
1925
|
return {
|
|
@@ -1916,7 +2018,7 @@ class or {
|
|
|
1916
2018
|
transformRaw(e) {
|
|
1917
2019
|
return {
|
|
1918
2020
|
kind: "RawNode",
|
|
1919
|
-
sqlFragments:
|
|
2021
|
+
sqlFragments: y([...e.sqlFragments]),
|
|
1920
2022
|
parameters: this.transformNodeList(e.parameters)
|
|
1921
2023
|
};
|
|
1922
2024
|
}
|
|
@@ -2541,7 +2643,7 @@ class or {
|
|
|
2541
2643
|
}
|
|
2542
2644
|
}
|
|
2543
2645
|
Q = new WeakMap();
|
|
2544
|
-
const
|
|
2646
|
+
const sa = y({
|
|
2545
2647
|
AlterTableNode: !0,
|
|
2546
2648
|
CreateIndexNode: !0,
|
|
2547
2649
|
CreateSchemaNode: !0,
|
|
@@ -2560,78 +2662,78 @@ const sr = w({
|
|
|
2560
2662
|
UpdateQueryNode: !0,
|
|
2561
2663
|
MergeQueryNode: !0
|
|
2562
2664
|
});
|
|
2563
|
-
var M, k, $,
|
|
2564
|
-
class
|
|
2565
|
-
constructor(
|
|
2665
|
+
var M, k, $, w, ye, ve, Ne, P, Y, Ce;
|
|
2666
|
+
class ia extends oa {
|
|
2667
|
+
constructor(r) {
|
|
2566
2668
|
super();
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
L(this, M,
|
|
2572
|
-
}
|
|
2573
|
-
transformNodeImpl(
|
|
2574
|
-
if (!
|
|
2575
|
-
return super.transformNodeImpl(
|
|
2576
|
-
const
|
|
2577
|
-
for (const s of
|
|
2669
|
+
N(this, w);
|
|
2670
|
+
N(this, M);
|
|
2671
|
+
N(this, k, /* @__PURE__ */ new Set());
|
|
2672
|
+
N(this, $, /* @__PURE__ */ new Set());
|
|
2673
|
+
L(this, M, r);
|
|
2674
|
+
}
|
|
2675
|
+
transformNodeImpl(r) {
|
|
2676
|
+
if (!m(this, w, ye).call(this, r))
|
|
2677
|
+
return super.transformNodeImpl(r);
|
|
2678
|
+
const a = m(this, w, Ne).call(this, r);
|
|
2679
|
+
for (const s of a)
|
|
2578
2680
|
d(this, $).add(s);
|
|
2579
|
-
const o =
|
|
2681
|
+
const o = m(this, w, ve).call(this, r);
|
|
2580
2682
|
for (const s of o)
|
|
2581
2683
|
d(this, k).add(s);
|
|
2582
|
-
const n = super.transformNodeImpl(
|
|
2684
|
+
const n = super.transformNodeImpl(r);
|
|
2583
2685
|
for (const s of o)
|
|
2584
2686
|
d(this, k).delete(s);
|
|
2585
|
-
for (const s of
|
|
2687
|
+
for (const s of a)
|
|
2586
2688
|
d(this, $).delete(s);
|
|
2587
2689
|
return n;
|
|
2588
2690
|
}
|
|
2589
|
-
transformSchemableIdentifier(
|
|
2590
|
-
const
|
|
2591
|
-
return
|
|
2592
|
-
...
|
|
2593
|
-
schema:
|
|
2691
|
+
transformSchemableIdentifier(r) {
|
|
2692
|
+
const a = super.transformSchemableIdentifier(r);
|
|
2693
|
+
return a.schema || !d(this, k).has(r.identifier.name) ? a : {
|
|
2694
|
+
...a,
|
|
2695
|
+
schema: U.create(d(this, M))
|
|
2594
2696
|
};
|
|
2595
2697
|
}
|
|
2596
|
-
transformReferences(
|
|
2597
|
-
const
|
|
2598
|
-
return
|
|
2599
|
-
...
|
|
2600
|
-
table: V.createWithSchema(d(this, M),
|
|
2601
|
-
};
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
M = new WeakMap(), k = new WeakMap(), $ = new WeakMap(),
|
|
2605
|
-
return
|
|
2606
|
-
}, ve = function(
|
|
2607
|
-
const
|
|
2608
|
-
if ("name" in
|
|
2609
|
-
for (const o of
|
|
2610
|
-
|
|
2611
|
-
if ("into" in
|
|
2612
|
-
for (const o of
|
|
2613
|
-
|
|
2614
|
-
return "using" in
|
|
2615
|
-
}, Ne = function(
|
|
2616
|
-
const
|
|
2617
|
-
return "with" in
|
|
2618
|
-
},
|
|
2619
|
-
const o = V.is(
|
|
2620
|
-
o &&
|
|
2621
|
-
}, Y = function(
|
|
2622
|
-
const o =
|
|
2623
|
-
!d(this, k).has(o) && !d(this, $).has(o) &&
|
|
2624
|
-
}, Ce = function(
|
|
2625
|
-
for (const o of
|
|
2698
|
+
transformReferences(r) {
|
|
2699
|
+
const a = super.transformReferences(r);
|
|
2700
|
+
return a.table.table.schema ? a : {
|
|
2701
|
+
...a,
|
|
2702
|
+
table: V.createWithSchema(d(this, M), a.table.table.identifier.name)
|
|
2703
|
+
};
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
M = new WeakMap(), k = new WeakMap(), $ = new WeakMap(), w = new WeakSet(), ye = function(r) {
|
|
2707
|
+
return r.kind in sa;
|
|
2708
|
+
}, ve = function(r) {
|
|
2709
|
+
const a = /* @__PURE__ */ new Set();
|
|
2710
|
+
if ("name" in r && r.name && X.is(r.name) && m(this, w, Y).call(this, r.name, a), "from" in r && r.from)
|
|
2711
|
+
for (const o of r.from.froms)
|
|
2712
|
+
m(this, w, P).call(this, o, a);
|
|
2713
|
+
if ("into" in r && r.into && m(this, w, P).call(this, r.into, a), "table" in r && r.table && m(this, w, P).call(this, r.table, a), "joins" in r && r.joins)
|
|
2714
|
+
for (const o of r.joins)
|
|
2715
|
+
m(this, w, P).call(this, o.table, a);
|
|
2716
|
+
return "using" in r && r.using && m(this, w, P).call(this, r.using, a), a;
|
|
2717
|
+
}, Ne = function(r) {
|
|
2718
|
+
const a = /* @__PURE__ */ new Set();
|
|
2719
|
+
return "with" in r && r.with && m(this, w, Ce).call(this, r.with, a), a;
|
|
2720
|
+
}, P = function(r, a) {
|
|
2721
|
+
const o = V.is(r) ? r : na.is(r) && V.is(r.node) ? r.node : null;
|
|
2722
|
+
o && m(this, w, Y).call(this, o.table, a);
|
|
2723
|
+
}, Y = function(r, a) {
|
|
2724
|
+
const o = r.identifier.name;
|
|
2725
|
+
!d(this, k).has(o) && !d(this, $).has(o) && a.add(o);
|
|
2726
|
+
}, Ce = function(r, a) {
|
|
2727
|
+
for (const o of r.expressions) {
|
|
2626
2728
|
const n = o.name.table.table.identifier.name;
|
|
2627
|
-
d(this, $).has(n) ||
|
|
2729
|
+
d(this, $).has(n) || a.add(n);
|
|
2628
2730
|
}
|
|
2629
2731
|
};
|
|
2630
2732
|
var R;
|
|
2631
|
-
class
|
|
2733
|
+
class la {
|
|
2632
2734
|
constructor(e) {
|
|
2633
|
-
|
|
2634
|
-
L(this, R, new
|
|
2735
|
+
N(this, R);
|
|
2736
|
+
L(this, R, new ia(e));
|
|
2635
2737
|
}
|
|
2636
2738
|
transformQuery(e) {
|
|
2637
2739
|
return d(this, R).transformNode(e.node);
|
|
@@ -2641,7 +2743,7 @@ class lr {
|
|
|
2641
2743
|
}
|
|
2642
2744
|
}
|
|
2643
2745
|
R = new WeakMap();
|
|
2644
|
-
class
|
|
2746
|
+
class ca {
|
|
2645
2747
|
transformQuery(e) {
|
|
2646
2748
|
return e.node;
|
|
2647
2749
|
}
|
|
@@ -2649,13 +2751,13 @@ class cr {
|
|
|
2649
2751
|
return e.result;
|
|
2650
2752
|
}
|
|
2651
2753
|
}
|
|
2652
|
-
const
|
|
2653
|
-
var f,
|
|
2754
|
+
const da = "kysely_migration", fe = "kysely_migration_lock", ua = !1, W = "migration_lock", ma = y({ __noMigrations__: !0 });
|
|
2755
|
+
var f, i, E, x, T, j, xe, S, Te, Se, Oe, ke, $e, Z, F, ee, Ie, De, Pe, te, je, Fe, Me, Ae, ze, J;
|
|
2654
2756
|
class be {
|
|
2655
2757
|
constructor(e) {
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
L(this, f,
|
|
2758
|
+
N(this, i);
|
|
2759
|
+
N(this, f);
|
|
2760
|
+
L(this, f, y(e));
|
|
2659
2761
|
}
|
|
2660
2762
|
/**
|
|
2661
2763
|
* Returns a {@link MigrationInfo} object for each migration.
|
|
@@ -2663,11 +2765,11 @@ class be {
|
|
|
2663
2765
|
* The returned array is sorted by migration name.
|
|
2664
2766
|
*/
|
|
2665
2767
|
async getMigrations() {
|
|
2666
|
-
const e = await
|
|
2667
|
-
return (await
|
|
2668
|
-
const n = e.find((s) => s.name ===
|
|
2768
|
+
const e = await m(this, i, F).call(this, d(this, i, T)) ? await d(this, f).db.withPlugin(d(this, i, S)).selectFrom(d(this, i, T)).select(["name", "timestamp"]).execute() : [];
|
|
2769
|
+
return (await m(this, i, te).call(this)).map(({ name: a, ...o }) => {
|
|
2770
|
+
const n = e.find((s) => s.name === a);
|
|
2669
2771
|
return {
|
|
2670
|
-
name:
|
|
2772
|
+
name: a,
|
|
2671
2773
|
migration: o,
|
|
2672
2774
|
executedAt: n ? new Date(n.timestamp) : void 0
|
|
2673
2775
|
};
|
|
@@ -2721,7 +2823,7 @@ class be {
|
|
|
2721
2823
|
* ```
|
|
2722
2824
|
*/
|
|
2723
2825
|
async migrateToLatest() {
|
|
2724
|
-
return
|
|
2826
|
+
return m(this, i, E).call(this, () => ({ direction: "Up", step: 1 / 0 }));
|
|
2725
2827
|
}
|
|
2726
2828
|
/**
|
|
2727
2829
|
* Migrate up/down to a specific migration.
|
|
@@ -2747,16 +2849,16 @@ class be {
|
|
|
2747
2849
|
* ```
|
|
2748
2850
|
*/
|
|
2749
2851
|
async migrateTo(e) {
|
|
2750
|
-
return
|
|
2751
|
-
if (e ===
|
|
2852
|
+
return m(this, i, E).call(this, ({ migrations: r, executedMigrations: a, pendingMigrations: o }) => {
|
|
2853
|
+
if (e === ma)
|
|
2752
2854
|
return { direction: "Down", step: 1 / 0 };
|
|
2753
|
-
if (!
|
|
2855
|
+
if (!r.find((l) => l.name === e))
|
|
2754
2856
|
throw new Error(`migration "${e}" doesn't exist`);
|
|
2755
|
-
const n =
|
|
2857
|
+
const n = a.indexOf(e), s = o.findIndex((l) => l.name === e);
|
|
2756
2858
|
if (n !== -1)
|
|
2757
2859
|
return {
|
|
2758
2860
|
direction: "Down",
|
|
2759
|
-
step:
|
|
2861
|
+
step: a.length - n - 1
|
|
2760
2862
|
};
|
|
2761
2863
|
if (s !== -1)
|
|
2762
2864
|
return { direction: "Up", step: s + 1 };
|
|
@@ -2778,7 +2880,7 @@ class be {
|
|
|
2778
2880
|
* ```
|
|
2779
2881
|
*/
|
|
2780
2882
|
async migrateUp() {
|
|
2781
|
-
return
|
|
2883
|
+
return m(this, i, E).call(this, () => ({ direction: "Up", step: 1 }));
|
|
2782
2884
|
}
|
|
2783
2885
|
/**
|
|
2784
2886
|
* Migrate one step down.
|
|
@@ -2795,116 +2897,116 @@ class be {
|
|
|
2795
2897
|
* ```
|
|
2796
2898
|
*/
|
|
2797
2899
|
async migrateDown() {
|
|
2798
|
-
return
|
|
2900
|
+
return m(this, i, E).call(this, () => ({ direction: "Down", step: 1 }));
|
|
2799
2901
|
}
|
|
2800
2902
|
}
|
|
2801
|
-
f = new WeakMap(),
|
|
2903
|
+
f = new WeakMap(), i = new WeakSet(), E = async function(e) {
|
|
2802
2904
|
try {
|
|
2803
|
-
return await
|
|
2804
|
-
} catch (
|
|
2805
|
-
return
|
|
2905
|
+
return await m(this, i, Te).call(this), await m(this, i, Ie).call(this, e);
|
|
2906
|
+
} catch (r) {
|
|
2907
|
+
return r instanceof G ? r.resultSet : { error: r };
|
|
2806
2908
|
}
|
|
2807
2909
|
}, x = function() {
|
|
2808
2910
|
return d(this, f).migrationTableSchema;
|
|
2809
2911
|
}, T = function() {
|
|
2810
|
-
return d(this, f).migrationTableName ??
|
|
2811
|
-
},
|
|
2912
|
+
return d(this, f).migrationTableName ?? da;
|
|
2913
|
+
}, j = function() {
|
|
2812
2914
|
return d(this, f).migrationLockTableName ?? fe;
|
|
2813
2915
|
}, xe = function() {
|
|
2814
|
-
return d(this, f).allowUnorderedMigrations ??
|
|
2916
|
+
return d(this, f).allowUnorderedMigrations ?? ua;
|
|
2815
2917
|
}, S = function() {
|
|
2816
|
-
return d(this,
|
|
2918
|
+
return d(this, i, x) ? new la(d(this, i, x)) : new ca();
|
|
2817
2919
|
}, Te = async function() {
|
|
2818
|
-
await
|
|
2920
|
+
await m(this, i, Se).call(this), await m(this, i, Oe).call(this), await m(this, i, ke).call(this), await m(this, i, $e).call(this);
|
|
2819
2921
|
}, Se = async function() {
|
|
2820
|
-
if (d(this,
|
|
2922
|
+
if (d(this, i, x) && !await m(this, i, Z).call(this))
|
|
2821
2923
|
try {
|
|
2822
|
-
await
|
|
2924
|
+
await m(this, i, J).call(this, d(this, f).db.schema.createSchema(d(this, i, x)));
|
|
2823
2925
|
} catch (e) {
|
|
2824
|
-
if (!await
|
|
2926
|
+
if (!await m(this, i, Z).call(this))
|
|
2825
2927
|
throw e;
|
|
2826
2928
|
}
|
|
2827
2929
|
}, Oe = async function() {
|
|
2828
|
-
if (!await
|
|
2930
|
+
if (!await m(this, i, F).call(this, d(this, i, T)))
|
|
2829
2931
|
try {
|
|
2830
|
-
d(this,
|
|
2932
|
+
d(this, i, x) && await m(this, i, J).call(this, d(this, f).db.schema.createSchema(d(this, i, x))), await m(this, i, J).call(this, d(this, f).db.schema.withPlugin(d(this, i, S)).createTable(d(this, i, T)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
|
|
2831
2933
|
} catch (e) {
|
|
2832
|
-
if (!await
|
|
2934
|
+
if (!await m(this, i, F).call(this, d(this, i, T)))
|
|
2833
2935
|
throw e;
|
|
2834
2936
|
}
|
|
2835
2937
|
}, ke = async function() {
|
|
2836
|
-
if (!await
|
|
2938
|
+
if (!await m(this, i, F).call(this, d(this, i, j)))
|
|
2837
2939
|
try {
|
|
2838
|
-
await
|
|
2940
|
+
await m(this, i, J).call(this, d(this, f).db.schema.withPlugin(d(this, i, S)).createTable(d(this, i, j)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
|
|
2839
2941
|
} catch (e) {
|
|
2840
|
-
if (!await
|
|
2942
|
+
if (!await m(this, i, F).call(this, d(this, i, j)))
|
|
2841
2943
|
throw e;
|
|
2842
2944
|
}
|
|
2843
2945
|
}, $e = async function() {
|
|
2844
|
-
if (!await
|
|
2946
|
+
if (!await m(this, i, ee).call(this))
|
|
2845
2947
|
try {
|
|
2846
|
-
await d(this, f).db.withPlugin(d(this,
|
|
2948
|
+
await d(this, f).db.withPlugin(d(this, i, S)).insertInto(d(this, i, j)).values({ id: W, is_locked: 0 }).execute();
|
|
2847
2949
|
} catch (e) {
|
|
2848
|
-
if (!await
|
|
2950
|
+
if (!await m(this, i, ee).call(this))
|
|
2849
2951
|
throw e;
|
|
2850
2952
|
}
|
|
2851
2953
|
}, Z = async function() {
|
|
2852
|
-
return (await d(this, f).db.introspection.getSchemas()).some((
|
|
2954
|
+
return (await d(this, f).db.introspection.getSchemas()).some((r) => r.name === d(this, i, x));
|
|
2853
2955
|
}, F = async function(e) {
|
|
2854
|
-
const
|
|
2956
|
+
const r = d(this, i, x);
|
|
2855
2957
|
return (await d(this, f).db.introspection.getTables({
|
|
2856
2958
|
withInternalKyselyTables: !0
|
|
2857
|
-
})).some((o) => o.name === e && (!
|
|
2959
|
+
})).some((o) => o.name === e && (!r || o.schema === r));
|
|
2858
2960
|
}, ee = async function() {
|
|
2859
|
-
return !!await d(this, f).db.withPlugin(d(this,
|
|
2860
|
-
},
|
|
2861
|
-
const
|
|
2961
|
+
return !!await d(this, f).db.withPlugin(d(this, i, S)).selectFrom(d(this, i, j)).where("id", "=", W).select("id").executeTakeFirst();
|
|
2962
|
+
}, Ie = async function(e) {
|
|
2963
|
+
const r = d(this, f).db.getExecutor().adapter, a = y({
|
|
2862
2964
|
lockTable: d(this, f).migrationLockTableName ?? fe,
|
|
2863
2965
|
lockRowId: W,
|
|
2864
2966
|
lockTableSchema: d(this, f).migrationTableSchema
|
|
2865
2967
|
}), o = async (n) => {
|
|
2866
2968
|
try {
|
|
2867
|
-
await
|
|
2868
|
-
const s = await
|
|
2969
|
+
await r.acquireMigrationLock(n, a);
|
|
2970
|
+
const s = await m(this, i, De).call(this, n);
|
|
2869
2971
|
if (s.migrations.length === 0)
|
|
2870
2972
|
return { results: [] };
|
|
2871
|
-
const { direction: l, step:
|
|
2872
|
-
return
|
|
2973
|
+
const { direction: l, step: c } = e(s);
|
|
2974
|
+
return c <= 0 ? { results: [] } : l === "Down" ? await m(this, i, Ae).call(this, n, s, c) : l === "Up" ? await m(this, i, ze).call(this, n, s, c) : { results: [] };
|
|
2873
2975
|
} finally {
|
|
2874
|
-
await
|
|
2976
|
+
await r.releaseMigrationLock(n, a);
|
|
2875
2977
|
}
|
|
2876
2978
|
};
|
|
2877
|
-
return
|
|
2878
|
-
},
|
|
2879
|
-
const
|
|
2880
|
-
|
|
2881
|
-
const o =
|
|
2882
|
-
return
|
|
2883
|
-
migrations:
|
|
2884
|
-
executedMigrations:
|
|
2885
|
-
lastMigration:
|
|
2979
|
+
return r.supportsTransactionalDdl ? d(this, f).db.transaction().execute(o) : d(this, f).db.connection().execute(o);
|
|
2980
|
+
}, De = async function(e) {
|
|
2981
|
+
const r = await m(this, i, te).call(this), a = await m(this, i, je).call(this, e);
|
|
2982
|
+
m(this, i, Fe).call(this, r, a), d(this, i, xe) || m(this, i, Me).call(this, r, a);
|
|
2983
|
+
const o = m(this, i, Pe).call(this, r, a);
|
|
2984
|
+
return y({
|
|
2985
|
+
migrations: r,
|
|
2986
|
+
executedMigrations: a,
|
|
2987
|
+
lastMigration: aa(a),
|
|
2886
2988
|
pendingMigrations: o
|
|
2887
2989
|
});
|
|
2888
|
-
},
|
|
2889
|
-
return e.filter((
|
|
2990
|
+
}, Pe = function(e, r) {
|
|
2991
|
+
return e.filter((a) => !r.includes(a.name));
|
|
2890
2992
|
}, te = async function() {
|
|
2891
2993
|
const e = await d(this, f).provider.getMigrations();
|
|
2892
|
-
return Object.keys(e).sort().map((
|
|
2893
|
-
...e[
|
|
2894
|
-
name:
|
|
2994
|
+
return Object.keys(e).sort().map((r) => ({
|
|
2995
|
+
...e[r],
|
|
2996
|
+
name: r
|
|
2895
2997
|
}));
|
|
2896
|
-
},
|
|
2897
|
-
return (await e.withPlugin(d(this,
|
|
2898
|
-
}, Fe = function(e,
|
|
2899
|
-
for (const
|
|
2900
|
-
if (!e.some((o) => o.name ===
|
|
2901
|
-
throw new Error(`corrupted migrations: previously executed migration ${
|
|
2902
|
-
}, Me = function(e,
|
|
2903
|
-
for (let
|
|
2904
|
-
if (e[
|
|
2905
|
-
throw new Error(`corrupted migrations: expected previously executed migration ${a
|
|
2906
|
-
}, Ae = async function(e,
|
|
2907
|
-
const o =
|
|
2998
|
+
}, je = async function(e) {
|
|
2999
|
+
return (await e.withPlugin(d(this, i, S)).selectFrom(d(this, i, T)).select("name").orderBy(["timestamp", "name"]).execute()).map((a) => a.name);
|
|
3000
|
+
}, Fe = function(e, r) {
|
|
3001
|
+
for (const a of r)
|
|
3002
|
+
if (!e.some((o) => o.name === a))
|
|
3003
|
+
throw new Error(`corrupted migrations: previously executed migration ${a} is missing`);
|
|
3004
|
+
}, Me = function(e, r) {
|
|
3005
|
+
for (let a = 0; a < r.length; ++a)
|
|
3006
|
+
if (e[a].name !== r[a])
|
|
3007
|
+
throw new Error(`corrupted migrations: expected previously executed migration ${r[a]} to be at index ${a} but ${e[a].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
|
|
3008
|
+
}, Ae = async function(e, r, a) {
|
|
3009
|
+
const o = r.executedMigrations.slice().reverse().slice(0, a).map((s) => r.migrations.find((l) => l.name === s)), n = o.map((s) => ({
|
|
2908
3010
|
migrationName: s.name,
|
|
2909
3011
|
direction: "Down",
|
|
2910
3012
|
status: "NotExecuted"
|
|
@@ -2912,33 +3014,33 @@ f = new WeakMap(), c = new WeakSet(), J = async function(e) {
|
|
|
2912
3014
|
for (let s = 0; s < n.length; ++s) {
|
|
2913
3015
|
const l = o[s];
|
|
2914
3016
|
try {
|
|
2915
|
-
l.down && (await l.down(e), await e.withPlugin(d(this,
|
|
3017
|
+
l.down && (await l.down(e), await e.withPlugin(d(this, i, S)).deleteFrom(d(this, i, T)).where("name", "=", l.name).execute(), n[s] = {
|
|
2916
3018
|
migrationName: l.name,
|
|
2917
3019
|
direction: "Down",
|
|
2918
3020
|
status: "Success"
|
|
2919
3021
|
});
|
|
2920
|
-
} catch (
|
|
3022
|
+
} catch (c) {
|
|
2921
3023
|
throw n[s] = {
|
|
2922
3024
|
migrationName: l.name,
|
|
2923
3025
|
direction: "Down",
|
|
2924
3026
|
status: "Error"
|
|
2925
3027
|
}, new G({
|
|
2926
|
-
error:
|
|
3028
|
+
error: c,
|
|
2927
3029
|
results: n
|
|
2928
3030
|
});
|
|
2929
3031
|
}
|
|
2930
3032
|
}
|
|
2931
3033
|
return { results: n };
|
|
2932
|
-
}, ze = async function(e,
|
|
2933
|
-
const n =
|
|
3034
|
+
}, ze = async function(e, r, a) {
|
|
3035
|
+
const n = r.pendingMigrations.slice(0, a).map((s) => ({
|
|
2934
3036
|
migrationName: s.name,
|
|
2935
3037
|
direction: "Up",
|
|
2936
3038
|
status: "NotExecuted"
|
|
2937
3039
|
}));
|
|
2938
3040
|
for (let s = 0; s < n.length; s++) {
|
|
2939
|
-
const l =
|
|
3041
|
+
const l = r.pendingMigrations[s];
|
|
2940
3042
|
try {
|
|
2941
|
-
await l.up(e), await e.withPlugin(d(this,
|
|
3043
|
+
await l.up(e), await e.withPlugin(d(this, i, S)).insertInto(d(this, i, T)).values({
|
|
2942
3044
|
name: l.name,
|
|
2943
3045
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2944
3046
|
}).execute(), n[s] = {
|
|
@@ -2946,27 +3048,27 @@ f = new WeakMap(), c = new WeakSet(), J = async function(e) {
|
|
|
2946
3048
|
direction: "Up",
|
|
2947
3049
|
status: "Success"
|
|
2948
3050
|
};
|
|
2949
|
-
} catch (
|
|
3051
|
+
} catch (c) {
|
|
2950
3052
|
throw n[s] = {
|
|
2951
3053
|
migrationName: l.name,
|
|
2952
3054
|
direction: "Up",
|
|
2953
3055
|
status: "Error"
|
|
2954
3056
|
}, new G({
|
|
2955
|
-
error:
|
|
3057
|
+
error: c,
|
|
2956
3058
|
results: n
|
|
2957
3059
|
});
|
|
2958
3060
|
}
|
|
2959
3061
|
}
|
|
2960
3062
|
return { results: n };
|
|
2961
|
-
},
|
|
3063
|
+
}, J = async function(e) {
|
|
2962
3064
|
d(this, f).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
|
|
2963
3065
|
};
|
|
2964
3066
|
var K;
|
|
2965
3067
|
class G extends Error {
|
|
2966
|
-
constructor(
|
|
3068
|
+
constructor(r) {
|
|
2967
3069
|
super();
|
|
2968
|
-
|
|
2969
|
-
L(this, K,
|
|
3070
|
+
N(this, K);
|
|
3071
|
+
L(this, K, r);
|
|
2970
3072
|
}
|
|
2971
3073
|
get resultSet() {
|
|
2972
3074
|
return d(this, K);
|
|
@@ -2982,7 +3084,7 @@ class Le {
|
|
|
2982
3084
|
return this.migrations;
|
|
2983
3085
|
}
|
|
2984
3086
|
}
|
|
2985
|
-
async function
|
|
3087
|
+
async function _a(t) {
|
|
2986
3088
|
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(
|
|
2987
3089
|
"tenant_id",
|
|
2988
3090
|
"varchar(255)",
|
|
@@ -3054,35 +3156,35 @@ async function _r(t) {
|
|
|
3054
3156
|
(e) => e.references("tenants.id").onDelete("cascade").notNull()
|
|
3055
3157
|
).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();
|
|
3056
3158
|
}
|
|
3057
|
-
async function
|
|
3159
|
+
async function ha(t) {
|
|
3058
3160
|
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();
|
|
3059
3161
|
}
|
|
3060
|
-
const
|
|
3162
|
+
const fa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3061
3163
|
__proto__: null,
|
|
3062
|
-
down:
|
|
3063
|
-
up:
|
|
3164
|
+
down: ha,
|
|
3165
|
+
up: _a
|
|
3064
3166
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3065
|
-
async function
|
|
3167
|
+
async function pa(t) {
|
|
3066
3168
|
await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
|
|
3067
3169
|
}
|
|
3068
|
-
async function
|
|
3170
|
+
async function ga(t) {
|
|
3069
3171
|
await t.schema.alterTable("tenants").dropColumn("support_url").execute();
|
|
3070
3172
|
}
|
|
3071
|
-
const
|
|
3173
|
+
const wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3072
3174
|
__proto__: null,
|
|
3073
|
-
down:
|
|
3074
|
-
up:
|
|
3175
|
+
down: ga,
|
|
3176
|
+
up: pa
|
|
3075
3177
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3076
|
-
async function
|
|
3178
|
+
async function ya(t) {
|
|
3077
3179
|
}
|
|
3078
|
-
async function
|
|
3180
|
+
async function va(t) {
|
|
3079
3181
|
}
|
|
3080
|
-
const
|
|
3182
|
+
const Na = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3081
3183
|
__proto__: null,
|
|
3082
|
-
down:
|
|
3083
|
-
up:
|
|
3184
|
+
down: va,
|
|
3185
|
+
up: ya
|
|
3084
3186
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3085
|
-
async function
|
|
3187
|
+
async function Ca(t) {
|
|
3086
3188
|
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(
|
|
3087
3189
|
"tenant_id_constraint",
|
|
3088
3190
|
["tenant_id"],
|
|
@@ -3091,24 +3193,24 @@ async function Cr(t) {
|
|
|
3091
3193
|
(e) => e.onDelete("cascade")
|
|
3092
3194
|
).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();
|
|
3093
3195
|
}
|
|
3094
|
-
async function
|
|
3196
|
+
async function ba(t) {
|
|
3095
3197
|
await t.schema.dropTable("logs").execute();
|
|
3096
3198
|
}
|
|
3097
|
-
const
|
|
3199
|
+
const xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3098
3200
|
__proto__: null,
|
|
3099
|
-
down:
|
|
3100
|
-
up:
|
|
3201
|
+
down: ba,
|
|
3202
|
+
up: Ca
|
|
3101
3203
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3102
|
-
async function
|
|
3204
|
+
async function Ta(t) {
|
|
3103
3205
|
}
|
|
3104
|
-
async function
|
|
3206
|
+
async function Sa(t) {
|
|
3105
3207
|
}
|
|
3106
|
-
const
|
|
3208
|
+
const Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3107
3209
|
__proto__: null,
|
|
3108
|
-
down:
|
|
3109
|
-
up:
|
|
3210
|
+
down: Sa,
|
|
3211
|
+
up: Ta
|
|
3110
3212
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3111
|
-
async function
|
|
3213
|
+
async function ka(t) {
|
|
3112
3214
|
await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
3113
3215
|
"user_id_constraint",
|
|
3114
3216
|
["user_id", "tenant_id"],
|
|
@@ -3133,15 +3235,15 @@ async function kr(t) {
|
|
|
3133
3235
|
(e) => e.references("applications.id").onDelete("cascade").notNull()
|
|
3134
3236
|
).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();
|
|
3135
3237
|
}
|
|
3136
|
-
async function $
|
|
3238
|
+
async function $a(t) {
|
|
3137
3239
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
|
|
3138
3240
|
}
|
|
3139
|
-
const
|
|
3241
|
+
const Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3140
3242
|
__proto__: null,
|
|
3141
|
-
down: $
|
|
3142
|
-
up:
|
|
3243
|
+
down: $a,
|
|
3244
|
+
up: ka
|
|
3143
3245
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3144
|
-
async function
|
|
3246
|
+
async function Da(t) {
|
|
3145
3247
|
await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
|
|
3146
3248
|
"user_id_constraint",
|
|
3147
3249
|
["user_id", "tenant_id"],
|
|
@@ -3156,24 +3258,24 @@ async function Ir(t) {
|
|
|
3156
3258
|
(e) => e.onDelete("cascade")
|
|
3157
3259
|
).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();
|
|
3158
3260
|
}
|
|
3159
|
-
async function
|
|
3261
|
+
async function Pa(t) {
|
|
3160
3262
|
await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
|
|
3161
3263
|
}
|
|
3162
|
-
const
|
|
3264
|
+
const ja = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3163
3265
|
__proto__: null,
|
|
3164
|
-
down:
|
|
3165
|
-
up:
|
|
3266
|
+
down: Pa,
|
|
3267
|
+
up: Da
|
|
3166
3268
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3167
|
-
async function
|
|
3269
|
+
async function Fa(t) {
|
|
3168
3270
|
}
|
|
3169
|
-
async function
|
|
3271
|
+
async function Ma(t) {
|
|
3170
3272
|
}
|
|
3171
|
-
const
|
|
3273
|
+
const Aa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3172
3274
|
__proto__: null,
|
|
3173
|
-
down:
|
|
3174
|
-
up:
|
|
3275
|
+
down: Ma,
|
|
3276
|
+
up: Fa
|
|
3175
3277
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3176
|
-
async function
|
|
3278
|
+
async function za(t) {
|
|
3177
3279
|
await t.schema.alterTable("passwords").addColumn(
|
|
3178
3280
|
"password",
|
|
3179
3281
|
"varchar(255)",
|
|
@@ -3181,72 +3283,72 @@ async function zr(t) {
|
|
|
3181
3283
|
(e) => e.notNull()
|
|
3182
3284
|
).execute();
|
|
3183
3285
|
}
|
|
3184
|
-
async function
|
|
3286
|
+
async function La(t) {
|
|
3185
3287
|
await t.schema.alterTable("passwords").dropColumn("password").execute();
|
|
3186
3288
|
}
|
|
3187
|
-
const
|
|
3289
|
+
const Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3188
3290
|
__proto__: null,
|
|
3189
|
-
down:
|
|
3190
|
-
up:
|
|
3291
|
+
down: La,
|
|
3292
|
+
up: za
|
|
3191
3293
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3192
|
-
async function
|
|
3294
|
+
async function Ja(t) {
|
|
3193
3295
|
}
|
|
3194
|
-
async function
|
|
3296
|
+
async function Ra(t) {
|
|
3195
3297
|
}
|
|
3196
|
-
const
|
|
3298
|
+
const Ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3197
3299
|
__proto__: null,
|
|
3198
|
-
down:
|
|
3199
|
-
up:
|
|
3300
|
+
down: Ra,
|
|
3301
|
+
up: Ja
|
|
3200
3302
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3201
|
-
async function
|
|
3303
|
+
async function Ua(t) {
|
|
3202
3304
|
}
|
|
3203
|
-
async function
|
|
3305
|
+
async function Ba(t) {
|
|
3204
3306
|
}
|
|
3205
|
-
const
|
|
3307
|
+
const Qa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3206
3308
|
__proto__: null,
|
|
3207
|
-
down:
|
|
3208
|
-
up:
|
|
3309
|
+
down: Ba,
|
|
3310
|
+
up: Ua
|
|
3209
3311
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3210
|
-
async function
|
|
3312
|
+
async function qa(t) {
|
|
3211
3313
|
}
|
|
3212
|
-
async function
|
|
3314
|
+
async function Va(t) {
|
|
3213
3315
|
}
|
|
3214
|
-
const
|
|
3316
|
+
const Wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3215
3317
|
__proto__: null,
|
|
3216
|
-
down:
|
|
3217
|
-
up:
|
|
3318
|
+
down: Va,
|
|
3319
|
+
up: qa
|
|
3218
3320
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3219
|
-
async function
|
|
3321
|
+
async function Ga(t) {
|
|
3220
3322
|
await t.schema.createIndex("users_email_index").on("users").column("email").execute();
|
|
3221
3323
|
}
|
|
3222
|
-
async function
|
|
3324
|
+
async function Ha(t) {
|
|
3223
3325
|
await t.schema.dropIndex("users_email_index").execute();
|
|
3224
3326
|
}
|
|
3225
|
-
const
|
|
3327
|
+
const Xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3226
3328
|
__proto__: null,
|
|
3227
|
-
down:
|
|
3228
|
-
up:
|
|
3329
|
+
down: Ha,
|
|
3330
|
+
up: Ga
|
|
3229
3331
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3230
|
-
async function
|
|
3332
|
+
async function Ya(t) {
|
|
3231
3333
|
await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
|
|
3232
3334
|
}
|
|
3233
|
-
async function
|
|
3335
|
+
async function Za(t) {
|
|
3234
3336
|
await t.schema.alterTable("users").dropColumn("profileData").execute();
|
|
3235
3337
|
}
|
|
3236
3338
|
const en = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3237
3339
|
__proto__: null,
|
|
3238
|
-
down:
|
|
3239
|
-
up:
|
|
3340
|
+
down: Za,
|
|
3341
|
+
up: Ya
|
|
3240
3342
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3241
3343
|
async function tn(t) {
|
|
3242
3344
|
await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
|
|
3243
3345
|
}
|
|
3244
|
-
async function
|
|
3346
|
+
async function rn(t) {
|
|
3245
3347
|
await t.schema.dropIndex("users_linked_to_index");
|
|
3246
3348
|
}
|
|
3247
|
-
const
|
|
3349
|
+
const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3248
3350
|
__proto__: null,
|
|
3249
|
-
down:
|
|
3351
|
+
down: rn,
|
|
3250
3352
|
up: tn
|
|
3251
3353
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3252
3354
|
async function nn(t) {
|
|
@@ -3338,24 +3440,24 @@ const kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3338
3440
|
async function $n(t) {
|
|
3339
3441
|
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();
|
|
3340
3442
|
}
|
|
3341
|
-
async function
|
|
3443
|
+
async function In(t) {
|
|
3342
3444
|
await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
|
|
3343
3445
|
}
|
|
3344
|
-
const
|
|
3446
|
+
const Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3345
3447
|
__proto__: null,
|
|
3346
|
-
down:
|
|
3448
|
+
down: In,
|
|
3347
3449
|
up: $n
|
|
3348
3450
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3349
|
-
async function
|
|
3451
|
+
async function Pn(t) {
|
|
3350
3452
|
await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
|
|
3351
3453
|
}
|
|
3352
|
-
async function
|
|
3454
|
+
async function jn(t) {
|
|
3353
3455
|
await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
|
|
3354
3456
|
}
|
|
3355
3457
|
const Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3356
3458
|
__proto__: null,
|
|
3357
|
-
down:
|
|
3358
|
-
up:
|
|
3459
|
+
down: jn,
|
|
3460
|
+
up: Pn
|
|
3359
3461
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3360
3462
|
async function Mn(t) {
|
|
3361
3463
|
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();
|
|
@@ -3371,12 +3473,12 @@ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3371
3473
|
async function Ln(t) {
|
|
3372
3474
|
await t.schema.createIndex("users_name_index").on("users").column("name").execute();
|
|
3373
3475
|
}
|
|
3374
|
-
async function
|
|
3476
|
+
async function En(t) {
|
|
3375
3477
|
await t.schema.dropIndex("users_name_index").execute();
|
|
3376
3478
|
}
|
|
3377
|
-
const
|
|
3479
|
+
const Jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3378
3480
|
__proto__: null,
|
|
3379
|
-
down:
|
|
3481
|
+
down: En,
|
|
3380
3482
|
up: Ln
|
|
3381
3483
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3382
3484
|
async function Rn(t) {
|
|
@@ -3384,12 +3486,12 @@ async function Rn(t) {
|
|
|
3384
3486
|
async function Kn(t) {
|
|
3385
3487
|
await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
|
|
3386
3488
|
}
|
|
3387
|
-
const
|
|
3489
|
+
const Un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3388
3490
|
__proto__: null,
|
|
3389
3491
|
down: Kn,
|
|
3390
3492
|
up: Rn
|
|
3391
3493
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3392
|
-
async function
|
|
3494
|
+
async function Bn(t) {
|
|
3393
3495
|
await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
|
|
3394
3496
|
}
|
|
3395
3497
|
async function Qn(t) {
|
|
@@ -3398,7 +3500,7 @@ async function Qn(t) {
|
|
|
3398
3500
|
const qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3399
3501
|
__proto__: null,
|
|
3400
3502
|
down: Qn,
|
|
3401
|
-
up:
|
|
3503
|
+
up: Bn
|
|
3402
3504
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3403
3505
|
async function Vn(t) {
|
|
3404
3506
|
await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
|
|
@@ -3435,14 +3537,14 @@ const to = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3435
3537
|
down: eo,
|
|
3436
3538
|
up: Zn
|
|
3437
3539
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3438
|
-
async function ao(t) {
|
|
3439
|
-
}
|
|
3440
3540
|
async function ro(t) {
|
|
3441
3541
|
}
|
|
3542
|
+
async function ao(t) {
|
|
3543
|
+
}
|
|
3442
3544
|
const no = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3443
3545
|
__proto__: null,
|
|
3444
|
-
down:
|
|
3445
|
-
up:
|
|
3546
|
+
down: ao,
|
|
3547
|
+
up: ro
|
|
3446
3548
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3447
3549
|
async function oo(t) {
|
|
3448
3550
|
}
|
|
@@ -3540,23 +3642,23 @@ const $o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3540
3642
|
down: ko,
|
|
3541
3643
|
up: Oo
|
|
3542
3644
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3543
|
-
async function Do(t) {
|
|
3544
|
-
}
|
|
3545
3645
|
async function Io(t) {
|
|
3546
3646
|
}
|
|
3547
|
-
|
|
3647
|
+
async function Do(t) {
|
|
3648
|
+
}
|
|
3649
|
+
const Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3548
3650
|
__proto__: null,
|
|
3549
|
-
down:
|
|
3550
|
-
up:
|
|
3651
|
+
down: Do,
|
|
3652
|
+
up: Io
|
|
3551
3653
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3552
|
-
async function
|
|
3654
|
+
async function jo(t) {
|
|
3553
3655
|
}
|
|
3554
3656
|
async function Fo(t) {
|
|
3555
3657
|
}
|
|
3556
3658
|
const Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3557
3659
|
__proto__: null,
|
|
3558
3660
|
down: Fo,
|
|
3559
|
-
up:
|
|
3661
|
+
up: jo
|
|
3560
3662
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3561
3663
|
async function Ao(t) {
|
|
3562
3664
|
await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
@@ -3589,24 +3691,24 @@ const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3589
3691
|
down: zo,
|
|
3590
3692
|
up: Ao
|
|
3591
3693
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3592
|
-
async function Jo(t) {
|
|
3593
|
-
}
|
|
3594
3694
|
async function Eo(t) {
|
|
3595
3695
|
}
|
|
3696
|
+
async function Jo(t) {
|
|
3697
|
+
}
|
|
3596
3698
|
const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3597
3699
|
__proto__: null,
|
|
3598
|
-
down:
|
|
3599
|
-
up:
|
|
3700
|
+
down: Jo,
|
|
3701
|
+
up: Eo
|
|
3600
3702
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3601
3703
|
async function Ko(t) {
|
|
3602
3704
|
await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
|
|
3603
3705
|
}
|
|
3604
|
-
async function
|
|
3706
|
+
async function Uo(t) {
|
|
3605
3707
|
await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
|
|
3606
3708
|
}
|
|
3607
|
-
const
|
|
3709
|
+
const Bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3608
3710
|
__proto__: null,
|
|
3609
|
-
down:
|
|
3711
|
+
down: Uo,
|
|
3610
3712
|
up: Ko
|
|
3611
3713
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3612
3714
|
async function Qo(t) {
|
|
@@ -3644,19 +3746,19 @@ async function es(t) {
|
|
|
3644
3746
|
async function ts(t) {
|
|
3645
3747
|
await t.schema.alterTable("logins").dropColumn("nonce").execute();
|
|
3646
3748
|
}
|
|
3647
|
-
const
|
|
3749
|
+
const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3648
3750
|
__proto__: null,
|
|
3649
3751
|
down: ts,
|
|
3650
3752
|
up: es
|
|
3651
3753
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3652
|
-
async function
|
|
3754
|
+
async function as(t) {
|
|
3653
3755
|
}
|
|
3654
3756
|
async function ns(t) {
|
|
3655
3757
|
}
|
|
3656
3758
|
const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3657
3759
|
__proto__: null,
|
|
3658
3760
|
down: ns,
|
|
3659
|
-
up:
|
|
3761
|
+
up: as
|
|
3660
3762
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3661
3763
|
async function ss(t) {
|
|
3662
3764
|
}
|
|
@@ -3793,16 +3895,16 @@ const $s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3793
3895
|
down: ks,
|
|
3794
3896
|
up: Os
|
|
3795
3897
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3796
|
-
async function Ds(t) {
|
|
3797
|
-
}
|
|
3798
3898
|
async function Is(t) {
|
|
3799
3899
|
}
|
|
3800
|
-
|
|
3900
|
+
async function Ds(t) {
|
|
3901
|
+
}
|
|
3902
|
+
const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3801
3903
|
__proto__: null,
|
|
3802
|
-
down:
|
|
3803
|
-
up:
|
|
3904
|
+
down: Ds,
|
|
3905
|
+
up: Is
|
|
3804
3906
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3805
|
-
async function
|
|
3907
|
+
async function js(t) {
|
|
3806
3908
|
await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
|
|
3807
3909
|
}
|
|
3808
3910
|
async function Fs(t) {
|
|
@@ -3811,7 +3913,7 @@ async function Fs(t) {
|
|
|
3811
3913
|
const Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3812
3914
|
__proto__: null,
|
|
3813
3915
|
down: Fs,
|
|
3814
|
-
up:
|
|
3916
|
+
up: js
|
|
3815
3917
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3816
3918
|
async function As(t) {
|
|
3817
3919
|
await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
|
|
@@ -3824,24 +3926,24 @@ const Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3824
3926
|
down: zs,
|
|
3825
3927
|
up: As
|
|
3826
3928
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3827
|
-
async function Js(t) {
|
|
3828
|
-
}
|
|
3829
3929
|
async function Es(t) {
|
|
3830
3930
|
}
|
|
3931
|
+
async function Js(t) {
|
|
3932
|
+
}
|
|
3831
3933
|
const Rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3832
3934
|
__proto__: null,
|
|
3833
|
-
down:
|
|
3834
|
-
up:
|
|
3935
|
+
down: Js,
|
|
3936
|
+
up: Es
|
|
3835
3937
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3836
3938
|
async function Ks(t) {
|
|
3837
3939
|
await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
|
|
3838
3940
|
}
|
|
3839
|
-
async function
|
|
3941
|
+
async function Us(t) {
|
|
3840
3942
|
await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
|
|
3841
3943
|
}
|
|
3842
|
-
const
|
|
3944
|
+
const Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3843
3945
|
__proto__: null,
|
|
3844
|
-
down:
|
|
3946
|
+
down: Us,
|
|
3845
3947
|
up: Ks
|
|
3846
3948
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3847
3949
|
async function Qs(t) {
|
|
@@ -3898,12 +4000,12 @@ async function ei(t) {
|
|
|
3898
4000
|
async function ti(t) {
|
|
3899
4001
|
await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
|
|
3900
4002
|
}
|
|
3901
|
-
const
|
|
4003
|
+
const ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3902
4004
|
__proto__: null,
|
|
3903
4005
|
down: ti,
|
|
3904
4006
|
up: ei
|
|
3905
4007
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3906
|
-
async function
|
|
4008
|
+
async function ai(t) {
|
|
3907
4009
|
await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
|
|
3908
4010
|
"client_id",
|
|
3909
4011
|
"varchar(21)",
|
|
@@ -3922,7 +4024,7 @@ async function ni(t) {
|
|
|
3922
4024
|
const oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3923
4025
|
__proto__: null,
|
|
3924
4026
|
down: ni,
|
|
3925
|
-
up:
|
|
4027
|
+
up: ai
|
|
3926
4028
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3927
4029
|
async function si(t) {
|
|
3928
4030
|
}
|
|
@@ -4075,17 +4177,17 @@ const $i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4075
4177
|
down: ki,
|
|
4076
4178
|
up: Oi
|
|
4077
4179
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4078
|
-
async function
|
|
4180
|
+
async function Ii(t) {
|
|
4079
4181
|
await t.schema.dropTable("logins").execute(), await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
|
|
4080
4182
|
}
|
|
4081
|
-
async function
|
|
4183
|
+
async function Di(t) {
|
|
4082
4184
|
}
|
|
4083
|
-
const
|
|
4185
|
+
const Pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4084
4186
|
__proto__: null,
|
|
4085
|
-
down:
|
|
4086
|
-
up:
|
|
4187
|
+
down: Di,
|
|
4188
|
+
up: Ii
|
|
4087
4189
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4088
|
-
async function
|
|
4190
|
+
async function ji(t) {
|
|
4089
4191
|
await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("custom_domains").addColumn(
|
|
4090
4192
|
"custom_domain_id",
|
|
4091
4193
|
"varchar(256)",
|
|
@@ -4101,7 +4203,7 @@ async function Fi(t) {
|
|
|
4101
4203
|
const Mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4102
4204
|
__proto__: null,
|
|
4103
4205
|
down: Fi,
|
|
4104
|
-
up:
|
|
4206
|
+
up: ji
|
|
4105
4207
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4106
4208
|
async function Ai(t) {
|
|
4107
4209
|
}
|
|
@@ -4113,26 +4215,26 @@ const Li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4113
4215
|
down: zi,
|
|
4114
4216
|
up: Ai
|
|
4115
4217
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4116
|
-
async function
|
|
4218
|
+
async function Ei(t) {
|
|
4117
4219
|
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();
|
|
4118
4220
|
}
|
|
4119
|
-
async function
|
|
4221
|
+
async function Ji(t) {
|
|
4120
4222
|
await t.schema.dropTable("forms").execute();
|
|
4121
4223
|
}
|
|
4122
4224
|
const Ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4123
4225
|
__proto__: null,
|
|
4124
|
-
down:
|
|
4125
|
-
up:
|
|
4226
|
+
down: Ji,
|
|
4227
|
+
up: Ei
|
|
4126
4228
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4127
4229
|
async function Ki(t) {
|
|
4128
4230
|
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();
|
|
4129
4231
|
}
|
|
4130
|
-
async function
|
|
4232
|
+
async function Ui(t) {
|
|
4131
4233
|
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();
|
|
4132
4234
|
}
|
|
4133
|
-
const
|
|
4235
|
+
const Bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4134
4236
|
__proto__: null,
|
|
4135
|
-
down:
|
|
4237
|
+
down: Ui,
|
|
4136
4238
|
up: Ki
|
|
4137
4239
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4138
4240
|
async function Qi(t) {
|
|
@@ -4182,12 +4284,12 @@ async function el(t) {
|
|
|
4182
4284
|
async function tl(t) {
|
|
4183
4285
|
await t.schema.alterTable("codes").dropColumn("code_challenge").execute(), await t.schema.alterTable("codes").dropColumn("code_challenge_method").execute();
|
|
4184
4286
|
}
|
|
4185
|
-
const
|
|
4287
|
+
const rl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4186
4288
|
__proto__: null,
|
|
4187
4289
|
down: tl,
|
|
4188
4290
|
up: el
|
|
4189
4291
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4190
|
-
async function
|
|
4292
|
+
async function al(t) {
|
|
4191
4293
|
await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
|
|
4192
4294
|
}
|
|
4193
4295
|
async function nl(t) {
|
|
@@ -4196,7 +4298,7 @@ async function nl(t) {
|
|
|
4196
4298
|
const ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4197
4299
|
__proto__: null,
|
|
4198
4300
|
down: nl,
|
|
4199
|
-
up:
|
|
4301
|
+
up: al
|
|
4200
4302
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4201
4303
|
async function sl(t) {
|
|
4202
4304
|
await t.schema.alterTable("codes").addColumn("nonce", "varchar(1024)").execute(), await t.schema.alterTable("codes").addColumn("state", "varchar(2048)").execute();
|
|
@@ -4293,35 +4395,60 @@ const ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4293
4395
|
up: cl
|
|
4294
4396
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4295
4397
|
async function ml(t) {
|
|
4296
|
-
await t.schema.createTable("resource_servers").addColumn("id", "varchar(21)", (e) => e.
|
|
4297
|
-
"resource_server_identifier",
|
|
4298
|
-
"varchar(191)",
|
|
4299
|
-
(e) => e.notNull()
|
|
4300
|
-
).addColumn("resource_server_name", "varchar(255)", (e) => e.notNull()).addColumn("sources", "varchar(4096)").execute(), await t.schema.createIndex("permissions_tenant_identifier_name_uq").on("permissions").columns(["tenant_id", "resource_server_identifier", "permission_name"]).unique().execute();
|
|
4398
|
+
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(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (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(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (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();
|
|
4301
4399
|
}
|
|
4302
4400
|
async function _l(t) {
|
|
4303
|
-
await t.schema.dropTable("
|
|
4401
|
+
await t.schema.dropTable("roles").execute(), await t.schema.dropTable("resource_servers").execute();
|
|
4304
4402
|
}
|
|
4305
4403
|
const hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4306
4404
|
__proto__: null,
|
|
4307
4405
|
down: _l,
|
|
4308
4406
|
up: ml
|
|
4309
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4407
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4408
|
+
async function fl(t) {
|
|
4409
|
+
await t.schema.createTable("role_permissions").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("role_id", "varchar(21)", (e) => e.notNull()).addColumn(
|
|
4410
|
+
"resource_server_identifier",
|
|
4411
|
+
"varchar(191)",
|
|
4412
|
+
(e) => e.notNull()
|
|
4413
|
+
).addColumn("permission_name", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addPrimaryKeyConstraint("role_permissions_pk", [
|
|
4414
|
+
"tenant_id",
|
|
4415
|
+
"role_id",
|
|
4416
|
+
"resource_server_identifier",
|
|
4417
|
+
"permission_name"
|
|
4418
|
+
]).execute(), await t.schema.createIndex("role_permissions_role_fk").on("role_permissions").columns(["tenant_id", "role_id"]).execute(), await t.schema.createIndex("role_permissions_permission_fk").on("role_permissions").columns(["tenant_id", "resource_server_identifier", "permission_name"]).execute(), await t.schema.createTable("user_permissions").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn(
|
|
4419
|
+
"resource_server_identifier",
|
|
4420
|
+
"varchar(191)",
|
|
4421
|
+
(e) => e.notNull()
|
|
4422
|
+
).addColumn("permission_name", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addPrimaryKeyConstraint("user_permissions_pk", [
|
|
4423
|
+
"tenant_id",
|
|
4424
|
+
"user_id",
|
|
4425
|
+
"resource_server_identifier",
|
|
4426
|
+
"permission_name"
|
|
4427
|
+
]).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();
|
|
4428
|
+
}
|
|
4429
|
+
async function pl(t) {
|
|
4430
|
+
await t.schema.dropTable("user_permissions").execute(), await t.schema.dropTable("role_permissions").execute();
|
|
4431
|
+
}
|
|
4432
|
+
const gl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4433
|
+
__proto__: null,
|
|
4434
|
+
down: pl,
|
|
4435
|
+
up: fl
|
|
4436
|
+
}, Symbol.toStringTag, { value: "Module" })), Ee = {
|
|
4437
|
+
m1_init: fa,
|
|
4438
|
+
m2_magicLink: wa,
|
|
4439
|
+
m3_updateAt: Na,
|
|
4440
|
+
m4_logTable: xa,
|
|
4441
|
+
m5_userProfile: Oa,
|
|
4442
|
+
m6_sessions: Ia,
|
|
4443
|
+
m7_passwords: ja,
|
|
4444
|
+
m8_logsTableNewFields: Aa,
|
|
4445
|
+
m9_passwordTableNewField: Ea,
|
|
4446
|
+
n01_codesTable: Ka,
|
|
4447
|
+
n11_universalLoginSession: Qa,
|
|
4448
|
+
n12_userFields: Wa,
|
|
4449
|
+
n13_userEmailIndex: Xa,
|
|
4323
4450
|
n14_profileDataField: en,
|
|
4324
|
-
n15_userEmailIndex:
|
|
4451
|
+
n15_userEmailIndex: an,
|
|
4325
4452
|
n16_userLocale: sn,
|
|
4326
4453
|
n17_signingKeys: dn,
|
|
4327
4454
|
n18_logsFields: _n,
|
|
@@ -4330,11 +4457,11 @@ const hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4330
4457
|
n21_sessionDeletedAt: Cn,
|
|
4331
4458
|
n22_dropLogsFields: Tn,
|
|
4332
4459
|
n23_dropUsersFields: kn,
|
|
4333
|
-
n24_logsIndexes:
|
|
4460
|
+
n24_logsIndexes: Dn,
|
|
4334
4461
|
n25_logDescMaxLength: Fn,
|
|
4335
4462
|
n26_logsTableExtraFields: zn,
|
|
4336
|
-
n27_usersTableNameIndex:
|
|
4337
|
-
n28_usersEmailConstrain:
|
|
4463
|
+
n27_usersTableNameIndex: Jn,
|
|
4464
|
+
n28_usersEmailConstrain: Un,
|
|
4338
4465
|
n29_increaseOtpStateLength: qn,
|
|
4339
4466
|
n30_increaseTicketStateLength: Gn,
|
|
4340
4467
|
n31_branding: Yn,
|
|
@@ -4348,15 +4475,15 @@ const hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4348
4475
|
n39_increaseUserAgentLength: bo,
|
|
4349
4476
|
n40_userId: So,
|
|
4350
4477
|
n41_hooks: $o,
|
|
4351
|
-
n42_userIdIndexes:
|
|
4478
|
+
n42_userIdIndexes: Po,
|
|
4352
4479
|
n43_userIdIndexes: Mo,
|
|
4353
4480
|
n44_codes: Lo,
|
|
4354
4481
|
n45_hookProperties: Ro,
|
|
4355
|
-
n46_loginAuth0Client:
|
|
4482
|
+
n46_loginAuth0Client: Bo,
|
|
4356
4483
|
n47_loginAuth0Client: Vo,
|
|
4357
4484
|
n48_saml: Ho,
|
|
4358
4485
|
n49_removeFields: Zo,
|
|
4359
|
-
n50_authParamsNonce:
|
|
4486
|
+
n50_authParamsNonce: rs,
|
|
4360
4487
|
n51_connectionid: os,
|
|
4361
4488
|
n52_cert: ls,
|
|
4362
4489
|
n53_codes_primary_key: us,
|
|
@@ -4366,15 +4493,15 @@ const hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4366
4493
|
n57_prompt_settings: bs,
|
|
4367
4494
|
n58_connection_client_id: Ss,
|
|
4368
4495
|
n59_connection_options: $s,
|
|
4369
|
-
n60_users_metadata:
|
|
4496
|
+
n60_users_metadata: Ps,
|
|
4370
4497
|
n61_userLocales: Ms,
|
|
4371
4498
|
n62_prompt: Ls,
|
|
4372
4499
|
n63_connection_cleanup: Rs,
|
|
4373
|
-
n64_act_as:
|
|
4500
|
+
n64_act_as: Bs,
|
|
4374
4501
|
n65_code_verifier: Vs,
|
|
4375
4502
|
n66_email_providers: Hs,
|
|
4376
4503
|
n67_drop_tickets: Zs,
|
|
4377
|
-
n68_login_useragents:
|
|
4504
|
+
n68_login_useragents: ri,
|
|
4378
4505
|
n70_refresh_tokens: oi,
|
|
4379
4506
|
n71_session_new_fields: li,
|
|
4380
4507
|
n72_session_primary_key: ui,
|
|
@@ -4384,26 +4511,27 @@ const hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4384
4511
|
n76_authorization_url_length: bi,
|
|
4385
4512
|
n77_drop_sessions: Si,
|
|
4386
4513
|
n78_login_sessions: $i,
|
|
4387
|
-
n79_drop_sessions_2:
|
|
4514
|
+
n79_drop_sessions_2: Pi,
|
|
4388
4515
|
n80_recreate_custom_domains: Mi,
|
|
4389
4516
|
n81_phone: Li,
|
|
4390
4517
|
n82_forms: Ri,
|
|
4391
|
-
n83_addFormsIdToHooks:
|
|
4518
|
+
n83_addFormsIdToHooks: Bi,
|
|
4392
4519
|
n84_login_completed: Vi,
|
|
4393
4520
|
n85_add_login_session_id_to_sessions: Hi,
|
|
4394
4521
|
n86_index_sessions_login_session_id: Zi,
|
|
4395
|
-
n87_code_challenge:
|
|
4522
|
+
n87_code_challenge: rl,
|
|
4396
4523
|
n88_add_redirect_uri_to_codes: ol,
|
|
4397
4524
|
n89_add_nonce_and_state_to_codes: ll,
|
|
4398
4525
|
n90_themes: ul,
|
|
4399
|
-
n91_resource_servers_rules_permissions: hl
|
|
4526
|
+
n91_resource_servers_rules_permissions: hl,
|
|
4527
|
+
n92_role_permissions: gl
|
|
4400
4528
|
};
|
|
4401
|
-
async function
|
|
4529
|
+
async function Cl(t, e = !1) {
|
|
4402
4530
|
e && console.log("migrating...");
|
|
4403
|
-
const
|
|
4531
|
+
const r = new Le(Ee), a = new be({
|
|
4404
4532
|
db: t,
|
|
4405
|
-
provider:
|
|
4406
|
-
}), { error: o, results: n } = await
|
|
4533
|
+
provider: r
|
|
4534
|
+
}), { error: o, results: n } = await a.migrateToLatest();
|
|
4407
4535
|
if (n == null || n.forEach((s) => {
|
|
4408
4536
|
s.status === "Success" ? e && console.log(
|
|
4409
4537
|
`migration "${s.migrationName}" was executed successfully`
|
|
@@ -4411,46 +4539,47 @@ async function yl(t, e = !1) {
|
|
|
4411
4539
|
}), o)
|
|
4412
4540
|
throw console.error("failed to migrate"), console.error(o), o;
|
|
4413
4541
|
}
|
|
4414
|
-
async function
|
|
4542
|
+
async function bl(t) {
|
|
4415
4543
|
console.log("migrating...");
|
|
4416
|
-
const e = new Le(
|
|
4544
|
+
const e = new Le(Ee), r = new be({
|
|
4417
4545
|
db: t,
|
|
4418
4546
|
provider: e
|
|
4419
|
-
}), { error:
|
|
4547
|
+
}), { error: a, results: o } = await r.migrateDown();
|
|
4420
4548
|
if (o == null || o.forEach((n) => {
|
|
4421
4549
|
n.status === "Success" ? console.log(`migration "${n.migrationName}" was reverted successfully`) : n.status === "Error" && console.error(`failed to execute migration "${n.migrationName}"`);
|
|
4422
|
-
}),
|
|
4423
|
-
throw console.error("failed to migrate"), console.error(
|
|
4550
|
+
}), a)
|
|
4551
|
+
throw console.error("failed to migrate"), console.error(a), a;
|
|
4424
4552
|
}
|
|
4425
|
-
function
|
|
4553
|
+
function xl(t) {
|
|
4426
4554
|
return {
|
|
4427
|
-
applications:
|
|
4428
|
-
branding:
|
|
4429
|
-
cleanup:
|
|
4430
|
-
clients:
|
|
4431
|
-
codes:
|
|
4432
|
-
connections:
|
|
4433
|
-
emailProviders:
|
|
4434
|
-
customDomains:
|
|
4435
|
-
forms:
|
|
4436
|
-
hooks:
|
|
4437
|
-
keys:
|
|
4438
|
-
loginSessions:
|
|
4439
|
-
logs:
|
|
4440
|
-
passwords:
|
|
4441
|
-
promptSettings:
|
|
4442
|
-
refreshTokens:
|
|
4443
|
-
resourceServers:
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4555
|
+
applications: jt(t),
|
|
4556
|
+
branding: er(t),
|
|
4557
|
+
cleanup: Ir(t),
|
|
4558
|
+
clients: Jt(t),
|
|
4559
|
+
codes: Ot(t),
|
|
4560
|
+
connections: Et(t),
|
|
4561
|
+
emailProviders: br(t),
|
|
4562
|
+
customDomains: Xt(t),
|
|
4563
|
+
forms: Ar(t),
|
|
4564
|
+
hooks: sr(t),
|
|
4565
|
+
keys: Bt(t),
|
|
4566
|
+
loginSessions: pr(t),
|
|
4567
|
+
logs: ut(t),
|
|
4568
|
+
passwords: Nt(t),
|
|
4569
|
+
promptSettings: yr(t),
|
|
4570
|
+
refreshTokens: $r(t),
|
|
4571
|
+
resourceServers: Kr(t),
|
|
4572
|
+
rolePermissions: Yr(t),
|
|
4573
|
+
userPermissions: ra(t),
|
|
4574
|
+
roles: Wr(t),
|
|
4575
|
+
sessions: gt(t),
|
|
4576
|
+
tenants: st(t),
|
|
4577
|
+
themes: ur(t),
|
|
4578
|
+
users: Ze(t)
|
|
4450
4579
|
};
|
|
4451
4580
|
}
|
|
4452
4581
|
export {
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4582
|
+
xl as default,
|
|
4583
|
+
bl as migrateDown,
|
|
4584
|
+
Cl as migrateToLatest
|
|
4456
4585
|
};
|