@authhero/kysely-adapter 12.2.0 → 12.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kysely-adapter.cjs +1 -1
- package/dist/kysely-adapter.d.ts +2 -0
- package/dist/kysely-adapter.mjs +914 -863
- package/dist/types/migrate/migrations/2026-08-11T12:00:00_page_hooks.d.ts +4 -0
- package/dist/types/migrate/migrations/index.d.ts +2 -0
- package/dist/types/src/db.d.ts +2 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { customAlphabet as e, nanoid as t } from "nanoid";
|
|
2
2
|
import { booleanToInt as n, convertDatesToAdapter as r, dbDateToIso as i, dbDateToIsoRequired as a, getCountAsInt as o, isoToDbDate as s, nowIso as c, removeNullProperties as l, removeUndefinedAndNull as u, stringifyProperties as d } from "@authhero/adapter-interfaces/sql";
|
|
3
3
|
import { sql as f } from "kysely";
|
|
4
|
-
import { LoginSessionState as p,
|
|
4
|
+
import { LoginSessionState as p, MONDAY_EPOCH_SHIFT_MS as m, WEEK_MS as h, buildSessionRetention as g, clientGrantSchema as _, clientRegistrationTokenTypeSchema as v, codeSchema as y, decodeCursor as ee, emailTemplateSchema as te, encodeCursor as ne, flowSchema as b, formSchema as x, handlerConfigSchema as re, isPlainObject as ie, loginSessionSchema as ae, matchSchema as oe, migrationProviderTypeSchema as se, parseUserId as ce, resourceServerSchema as le, rolloutInsertSchema as ue, rolloutSchema as de, sanitizeLuceneQuery as S, scimMappingEntrySchema as fe, sessionRetentionWindow as pe, tenantOperationEventInsertSchema as me, tenantOperationEventSchema as he, tenantOperationInsertSchema as ge, tenantOperationSchema as _e } from "@authhero/adapter-interfaces";
|
|
5
5
|
import { HTTPException as C } from "hono/http-exception";
|
|
6
6
|
import "@hono/zod-openapi";
|
|
7
|
-
import { Migrator as
|
|
7
|
+
import { Migrator as ve } from "kysely/migration";
|
|
8
8
|
//#region \0rolldown/runtime.js
|
|
9
|
-
var
|
|
9
|
+
var ye = Object.defineProperty, w = (e, t) => {
|
|
10
10
|
let n = {};
|
|
11
|
-
for (var r in e)
|
|
11
|
+
for (var r in e) ye(n, r, {
|
|
12
12
|
get: e[r],
|
|
13
13
|
enumerable: !0
|
|
14
14
|
});
|
|
15
|
-
return t ||
|
|
16
|
-
},
|
|
15
|
+
return t || ye(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
16
|
+
}, be = 17, xe = {
|
|
17
17
|
organization: "org_",
|
|
18
18
|
connection: "con_",
|
|
19
19
|
action: "act_",
|
|
@@ -26,38 +26,38 @@ var he = Object.defineProperty, w = (e, t) => {
|
|
|
26
26
|
invite: "inv_"
|
|
27
27
|
};
|
|
28
28
|
function T(t) {
|
|
29
|
-
let n = e("0123456789abcdefghijklmnopqrstuvwxyz",
|
|
30
|
-
return `${
|
|
29
|
+
let n = e("0123456789abcdefghijklmnopqrstuvwxyz", be)();
|
|
30
|
+
return `${xe[t]}${n}`;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Se() {
|
|
33
33
|
return T("organization");
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Ce() {
|
|
36
36
|
return T("connection");
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function we() {
|
|
39
39
|
return T("action");
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Te() {
|
|
42
42
|
return T("action_version");
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Ee() {
|
|
45
45
|
return T("hook");
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function De() {
|
|
48
48
|
return T("resource_server");
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Oe() {
|
|
51
51
|
return T("hook_code");
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function ke() {
|
|
54
54
|
return T("invite");
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/actions/create.ts
|
|
58
|
-
function
|
|
58
|
+
function Ae(e) {
|
|
59
59
|
return async (t, n, r) => {
|
|
60
|
-
let i = r?.importMetadata, a = Date.now(), o = i?.created_at ? new Date(i.created_at).getTime() : a, s = i?.updated_at ? new Date(i.updated_at).getTime() : o, c = i?.id ??
|
|
60
|
+
let i = r?.importMetadata, a = Date.now(), o = i?.created_at ? new Date(i.created_at).getTime() : a, s = i?.updated_at ? new Date(i.updated_at).getTime() : o, c = i?.id ?? we();
|
|
61
61
|
return await e.insertInto("actions").values({
|
|
62
62
|
id: c,
|
|
63
63
|
tenant_id: t,
|
|
@@ -98,7 +98,7 @@ function E(e) {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function je(e) {
|
|
102
102
|
return async (t, n) => {
|
|
103
103
|
let i = await e.selectFrom("actions").where("actions.tenant_id", "=", t).where("actions.id", "=", n).selectAll().executeTakeFirst();
|
|
104
104
|
if (!i) return null;
|
|
@@ -123,7 +123,7 @@ function De(e) {
|
|
|
123
123
|
}
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/helpers/filter.ts
|
|
126
|
-
function
|
|
126
|
+
function Me(e) {
|
|
127
127
|
return f`coalesce(${f.ref(e.column)}, ${f.lit(e.defaultValue)})`;
|
|
128
128
|
}
|
|
129
129
|
function D(e) {
|
|
@@ -135,7 +135,7 @@ function O(e, t, n, r, i = [], a = {}) {
|
|
|
135
135
|
return t === void 0 ? e : typeof t == "string" ? t : t.column;
|
|
136
136
|
}, l = (e) => {
|
|
137
137
|
let t = a[e];
|
|
138
|
-
return t === void 0 || typeof t == "string" ? s(t ?? e) :
|
|
138
|
+
return t === void 0 || typeof t == "string" ? s(t ?? e) : Me(t);
|
|
139
139
|
}, u = (e, t) => {
|
|
140
140
|
let n = a[e];
|
|
141
141
|
if (n === void 0 || typeof n == "string") return t;
|
|
@@ -208,7 +208,7 @@ function k(e) {
|
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Ne(e) {
|
|
212
212
|
return async (t, n = {}) => {
|
|
213
213
|
let { page: i = 0, per_page: a = 50, include_totals: s = !1, q: c } = n, l = e.selectFrom("actions").where("actions.tenant_id", "=", t);
|
|
214
214
|
c && (l = O(e, l, c, ["name"]));
|
|
@@ -248,7 +248,7 @@ function ke(e) {
|
|
|
248
248
|
}
|
|
249
249
|
//#endregion
|
|
250
250
|
//#region src/actions/update.ts
|
|
251
|
-
function
|
|
251
|
+
function Pe(e) {
|
|
252
252
|
if (!e) return [];
|
|
253
253
|
try {
|
|
254
254
|
let t = JSON.parse(e);
|
|
@@ -257,11 +257,11 @@ function Ae(e) {
|
|
|
257
257
|
return [];
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Fe(e) {
|
|
261
261
|
return async (t, n, r) => {
|
|
262
262
|
let i = { updated_at_ts: Date.now() };
|
|
263
263
|
if (r.name !== void 0 && (i.name = r.name), r.code !== void 0 && (i.code = r.code), r.runtime !== void 0 && (i.runtime = r.runtime), r.secrets !== void 0) {
|
|
264
|
-
let a = await e.selectFrom("actions").where("actions.id", "=", n).where("actions.tenant_id", "=", t).select("secrets").executeTakeFirst(), o = new Map(
|
|
264
|
+
let a = await e.selectFrom("actions").where("actions.id", "=", n).where("actions.tenant_id", "=", t).select("secrets").executeTakeFirst(), o = new Map(Pe(a?.secrets).map((e) => [e.name, e])), s = r.secrets.map((e) => e.value === void 0 ? {
|
|
265
265
|
name: e.name,
|
|
266
266
|
value: o.get(e.name)?.value
|
|
267
267
|
} : e);
|
|
@@ -276,23 +276,23 @@ function je(e) {
|
|
|
276
276
|
}
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region src/actions/remove.ts
|
|
279
|
-
function
|
|
279
|
+
function Ie(e) {
|
|
280
280
|
return async (t, n) => (await e.deleteFrom("actions").where("actions.id", "=", n).where("actions.tenant_id", "=", t).executeTakeFirst()).numDeletedRows > 0;
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/actions/index.ts
|
|
284
|
-
function
|
|
284
|
+
function Le(e) {
|
|
285
285
|
return {
|
|
286
|
-
create:
|
|
287
|
-
get:
|
|
288
|
-
list:
|
|
289
|
-
update:
|
|
290
|
-
remove:
|
|
286
|
+
create: Ae(e),
|
|
287
|
+
get: je(e),
|
|
288
|
+
list: Ne(e),
|
|
289
|
+
update: Fe(e),
|
|
290
|
+
remove: Ie(e)
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
//#endregion
|
|
294
294
|
//#region src/actionExecutions/create.ts
|
|
295
|
-
function
|
|
295
|
+
function Re(e) {
|
|
296
296
|
return async (t, n) => {
|
|
297
297
|
let r = Date.now();
|
|
298
298
|
return await e.insertInto("action_executions").values({
|
|
@@ -318,14 +318,14 @@ function Pe(e) {
|
|
|
318
318
|
}
|
|
319
319
|
//#endregion
|
|
320
320
|
//#region src/actionExecutions/get.ts
|
|
321
|
-
function
|
|
321
|
+
function ze(e) {
|
|
322
322
|
if (e) try {
|
|
323
323
|
return JSON.parse(e);
|
|
324
324
|
} catch {
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Be(e) {
|
|
329
329
|
return async (t, n) => {
|
|
330
330
|
let r = await e.selectFrom("action_executions").where("action_executions.tenant_id", "=", t).where("action_executions.id", "=", n).selectAll().executeTakeFirst();
|
|
331
331
|
return r ? {
|
|
@@ -333,8 +333,8 @@ function Ie(e) {
|
|
|
333
333
|
tenant_id: r.tenant_id,
|
|
334
334
|
trigger_id: r.trigger_id,
|
|
335
335
|
status: r.status,
|
|
336
|
-
results:
|
|
337
|
-
logs:
|
|
336
|
+
results: ze(r.results) ?? [],
|
|
337
|
+
logs: ze(r.logs),
|
|
338
338
|
created_at: new Date(Number(r.created_at_ts)).toISOString(),
|
|
339
339
|
updated_at: new Date(Number(r.updated_at_ts)).toISOString()
|
|
340
340
|
} : null;
|
|
@@ -343,19 +343,19 @@ function Ie(e) {
|
|
|
343
343
|
//#endregion
|
|
344
344
|
//#region src/actionExecutions/cleanup.ts
|
|
345
345
|
var A = 5e4;
|
|
346
|
-
async function
|
|
346
|
+
async function Ve(e) {
|
|
347
347
|
try {
|
|
348
348
|
return await f`SELECT VERSION()`.execute(e), "mysql";
|
|
349
349
|
} catch {
|
|
350
350
|
return "sqlite";
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function He(e) {
|
|
354
354
|
let t;
|
|
355
355
|
return async (n) => {
|
|
356
356
|
let r = Date.parse(n);
|
|
357
357
|
if (Number.isNaN(r)) throw Error(`Invalid olderThan date: ${n}`);
|
|
358
|
-
if (t ??= await
|
|
358
|
+
if (t ??= await Ve(e), t === "sqlite") {
|
|
359
359
|
let t = await e.deleteFrom("action_executions").where("created_at_ts", "<", r).executeTakeFirst();
|
|
360
360
|
return Number(t.numDeletedRows);
|
|
361
361
|
}
|
|
@@ -369,39 +369,39 @@ function Re(e) {
|
|
|
369
369
|
}
|
|
370
370
|
//#endregion
|
|
371
371
|
//#region src/actionExecutions/index.ts
|
|
372
|
-
function
|
|
372
|
+
function Ue(e) {
|
|
373
373
|
return {
|
|
374
|
-
create:
|
|
375
|
-
get:
|
|
376
|
-
cleanup:
|
|
374
|
+
create: Re(e),
|
|
375
|
+
get: Be(e),
|
|
376
|
+
cleanup: He(e)
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
//#endregion
|
|
380
380
|
//#region src/actionVersions/index.ts
|
|
381
|
-
function
|
|
381
|
+
function We(e) {
|
|
382
382
|
if (e) try {
|
|
383
383
|
return JSON.parse(e);
|
|
384
384
|
} catch {
|
|
385
385
|
return;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Ge(e) {
|
|
389
389
|
let { created_at_ts: t, updated_at_ts: n, secrets: r, dependencies: i, supported_triggers: a, deployed: o, runtime: s, ...c } = e;
|
|
390
390
|
return {
|
|
391
391
|
...c,
|
|
392
392
|
runtime: s ?? void 0,
|
|
393
393
|
deployed: !!o,
|
|
394
|
-
secrets:
|
|
395
|
-
dependencies:
|
|
396
|
-
supported_triggers:
|
|
394
|
+
secrets: We(r),
|
|
395
|
+
dependencies: We(i),
|
|
396
|
+
supported_triggers: We(a),
|
|
397
397
|
created_at: new Date(Number(t)).toISOString(),
|
|
398
398
|
updated_at: new Date(Number(n)).toISOString()
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function Ke(e) {
|
|
402
402
|
return {
|
|
403
403
|
async create(t, n, r) {
|
|
404
|
-
let i = r?.importMetadata, a = Date.now(), o = i?.created_at ? new Date(i.created_at).getTime() : a, s = i?.updated_at ? new Date(i.updated_at).getTime() : i ? o : a, c = i?.id ??
|
|
404
|
+
let i = r?.importMetadata, a = Date.now(), o = i?.created_at ? new Date(i.created_at).getTime() : a, s = i?.updated_at ? new Date(i.updated_at).getTime() : i ? o : a, c = i?.id ?? Te(), l = n.deployed !== !1, u = await e.transaction().execute(async (e) => {
|
|
405
405
|
let r = ((await e.selectFrom("action_versions").where("tenant_id", "=", t).where("action_id", "=", n.action_id).select("number").orderBy("number", "desc").limit(1).executeTakeFirst())?.number ?? 0) + 1;
|
|
406
406
|
return l && await e.updateTable("action_versions").set(i ? { deployed: 0 } : {
|
|
407
407
|
deployed: 0,
|
|
@@ -438,10 +438,10 @@ function Ve(e) {
|
|
|
438
438
|
},
|
|
439
439
|
async get(t, n, r) {
|
|
440
440
|
let i = await e.selectFrom("action_versions").where("tenant_id", "=", t).where("action_id", "=", n).where("id", "=", r).selectAll().executeTakeFirst();
|
|
441
|
-
return i ?
|
|
441
|
+
return i ? Ge(i) : null;
|
|
442
442
|
},
|
|
443
443
|
async list(t, n, r = {}) {
|
|
444
|
-
let { page: i = 0, per_page: a = 50, include_totals: s = !1 } = r, c = e.selectFrom("action_versions").where("tenant_id", "=", t).where("action_id", "=", n), l = (await c.orderBy("number", "desc").offset(i * a).limit(a).selectAll().execute()).map(
|
|
444
|
+
let { page: i = 0, per_page: a = 50, include_totals: s = !1 } = r, c = e.selectFrom("action_versions").where("tenant_id", "=", t).where("action_id", "=", n), l = (await c.orderBy("number", "desc").offset(i * a).limit(a).selectAll().execute()).map(Ge);
|
|
445
445
|
if (!s) return {
|
|
446
446
|
versions: l,
|
|
447
447
|
start: 0,
|
|
@@ -464,7 +464,7 @@ function Ve(e) {
|
|
|
464
464
|
}
|
|
465
465
|
//#endregion
|
|
466
466
|
//#region src/outbox/create.ts
|
|
467
|
-
async function
|
|
467
|
+
async function j(e, t, n, r) {
|
|
468
468
|
await e.insertInto("outbox_events").values({
|
|
469
469
|
id: n,
|
|
470
470
|
tenant_id: t,
|
|
@@ -483,15 +483,15 @@ async function M(e, t, n, r) {
|
|
|
483
483
|
error: null
|
|
484
484
|
}).execute();
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function qe(e) {
|
|
487
487
|
return async (n, r) => {
|
|
488
488
|
let i = t();
|
|
489
|
-
return await
|
|
489
|
+
return await j(e, n, i, r), i;
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/users/create.ts
|
|
494
|
-
function
|
|
494
|
+
function Je(e) {
|
|
495
495
|
return async (n, r, i) => {
|
|
496
496
|
let a = i?.importMetadata, { identities: o, phone_verified: s, password: c, last_login: l, last_ip: u, login_count: d, ...f } = r, p = (/* @__PURE__ */ new Date()).toISOString(), m = {
|
|
497
497
|
...f,
|
|
@@ -526,7 +526,7 @@ function Ue(e) {
|
|
|
526
526
|
};
|
|
527
527
|
await e.insertInto("passwords").values(r).execute();
|
|
528
528
|
}
|
|
529
|
-
for (let t of i?.outboxEvents ?? []) await
|
|
529
|
+
for (let t of i?.outboxEvents ?? []) await j(e, n, t.id, t);
|
|
530
530
|
};
|
|
531
531
|
try {
|
|
532
532
|
e.isTransaction ? await h(e) : await e.transaction().execute(h);
|
|
@@ -551,21 +551,21 @@ function Ue(e) {
|
|
|
551
551
|
}
|
|
552
552
|
//#endregion
|
|
553
553
|
//#region src/users/user-to-identity.ts
|
|
554
|
-
var
|
|
554
|
+
var Ye = [
|
|
555
555
|
"email",
|
|
556
556
|
"email_verified",
|
|
557
557
|
"phone_number",
|
|
558
558
|
"phone_verified",
|
|
559
559
|
"username"
|
|
560
560
|
];
|
|
561
|
-
function
|
|
561
|
+
function M(e, t = !1) {
|
|
562
562
|
let n = {
|
|
563
563
|
connection: e.connection,
|
|
564
564
|
provider: e.provider,
|
|
565
|
-
user_id:
|
|
565
|
+
user_id: ce(e.user_id).id,
|
|
566
566
|
isSocial: !!e.is_social
|
|
567
567
|
};
|
|
568
|
-
for (let t of
|
|
568
|
+
for (let t of Ye) e[t] !== void 0 && e[t] !== null && (n[t] = t.endsWith("_verified") ? !!e[t] : e[t]);
|
|
569
569
|
if (!t) {
|
|
570
570
|
let t = {};
|
|
571
571
|
try {
|
|
@@ -583,7 +583,7 @@ function N(e, t = !1) {
|
|
|
583
583
|
}
|
|
584
584
|
//#endregion
|
|
585
585
|
//#region src/users/get.ts
|
|
586
|
-
function
|
|
586
|
+
function Xe(e) {
|
|
587
587
|
return async (t, n) => {
|
|
588
588
|
let [r, i] = await Promise.all([e.selectFrom("users").leftJoin("user_activity", (e) => e.onRef("user_activity.tenant_id", "=", "users.tenant_id").onRef("user_activity.user_id", "=", "users.user_id")).where("users.tenant_id", "=", t).where("users.user_id", "=", n).selectAll("users").select([
|
|
589
589
|
"user_activity.last_login",
|
|
@@ -605,21 +605,21 @@ function Ge(e) {
|
|
|
605
605
|
app_metadata: JSON.parse(r.app_metadata),
|
|
606
606
|
user_metadata: JSON.parse(r.user_metadata),
|
|
607
607
|
address: r.address ? JSON.parse(r.address) : void 0,
|
|
608
|
-
identities: [
|
|
608
|
+
identities: [M(r, !0), ...i.map((e) => M(e))]
|
|
609
609
|
});
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
612
|
//#endregion
|
|
613
613
|
//#region src/helpers/paginate.ts
|
|
614
|
-
function
|
|
614
|
+
function N(e) {
|
|
615
615
|
return e?.from !== void 0 || e?.take !== void 0;
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function Ze(e, t) {
|
|
618
618
|
let n = typeof e == "number" && Number.isFinite(e) ? Math.floor(e) : NaN;
|
|
619
619
|
return n >= 1 ? n : t;
|
|
620
620
|
}
|
|
621
|
-
async function
|
|
622
|
-
let { sortColumn: r, sortOrder: i } = n, a = n.idColumn ?? "id", o =
|
|
621
|
+
async function P(e, t, n) {
|
|
622
|
+
let { sortColumn: r, sortOrder: i } = n, a = n.idColumn ?? "id", o = Ze(t?.take, 50), s = e.orderBy(f.ref(r), i).orderBy(f.ref(a), i), c = t?.from ? ee(t.from) : null;
|
|
623
623
|
if (c && c.k !== n.sortKey) throw new C(400, { message: "The `from` cursor was issued under a different sort and cannot be used with this request" });
|
|
624
624
|
if (c) if (c.s === void 0 || c.s === null) s = s.where(f.ref(a), i === "asc" ? ">" : "<", c.i);
|
|
625
625
|
else {
|
|
@@ -629,7 +629,7 @@ async function F(e, t, n) {
|
|
|
629
629
|
let l = await s.limit(o + 1).execute(), u = l.length > o, d = u ? l.slice(0, o) : l, p;
|
|
630
630
|
if (u && d.length > 0) {
|
|
631
631
|
let e = d[d.length - 1], t = r.split(".").pop(), i = a.split(".").pop(), o = e[t];
|
|
632
|
-
p =
|
|
632
|
+
p = ne({
|
|
633
633
|
s: typeof o == "string" || typeof o == "number" || o === null ? o : String(o),
|
|
634
634
|
i: String(e[i]),
|
|
635
635
|
...n.sortKey !== void 0 && { k: n.sortKey }
|
|
@@ -643,7 +643,7 @@ async function F(e, t, n) {
|
|
|
643
643
|
}
|
|
644
644
|
//#endregion
|
|
645
645
|
//#region src/users/list.ts
|
|
646
|
-
var
|
|
646
|
+
var Qe = [
|
|
647
647
|
"user_id",
|
|
648
648
|
"email",
|
|
649
649
|
"email_verified",
|
|
@@ -666,20 +666,20 @@ var qe = [
|
|
|
666
666
|
"login_count",
|
|
667
667
|
"created_at",
|
|
668
668
|
"updated_at"
|
|
669
|
-
],
|
|
669
|
+
], $e = new Set([
|
|
670
670
|
"last_login",
|
|
671
671
|
"last_ip",
|
|
672
672
|
"login_count"
|
|
673
|
-
]),
|
|
673
|
+
]), et = Object.fromEntries(Qe.map((e) => [e, e === "login_count" ? {
|
|
674
674
|
column: "user_activity.login_count",
|
|
675
675
|
defaultValue: 0
|
|
676
|
-
} :
|
|
676
|
+
} : $e.has(e) ? `user_activity.${e}` : `users.${e}`])), tt = [
|
|
677
677
|
"email",
|
|
678
678
|
"name",
|
|
679
679
|
"phone_number",
|
|
680
680
|
"user_id"
|
|
681
681
|
];
|
|
682
|
-
async function
|
|
682
|
+
async function nt(e, t, n) {
|
|
683
683
|
let r = n.map((e) => e.user_id), i = r.length ? await e.selectFrom("users").selectAll().where("users.tenant_id", "=", t).where("users.linked_to", "in", r).orderBy("created_at", "asc").execute() : [];
|
|
684
684
|
return n.map((e) => {
|
|
685
685
|
let t = i.filter((t) => t.linked_to === e.user_id);
|
|
@@ -693,20 +693,20 @@ async function Ze(e, t, n) {
|
|
|
693
693
|
app_metadata: JSON.parse(e.app_metadata),
|
|
694
694
|
user_metadata: JSON.parse(e.user_metadata),
|
|
695
695
|
address: e.address ? JSON.parse(e.address) : void 0,
|
|
696
|
-
identities: [
|
|
696
|
+
identities: [M(e, !0), ...t.map((e) => M(e))]
|
|
697
697
|
});
|
|
698
698
|
});
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function rt(e) {
|
|
701
701
|
return async (t, n = {}) => {
|
|
702
702
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: s, q: c } = n, l = e.selectFrom("users").leftJoin("user_activity", (e) => e.onRef("user_activity.tenant_id", "=", "users.tenant_id").onRef("user_activity.user_id", "=", "users.user_id")).where("users.tenant_id", "=", t);
|
|
703
703
|
if (c) {
|
|
704
|
-
let t = S(c,
|
|
705
|
-
t && (l = O(e, l, t,
|
|
704
|
+
let t = S(c, Qe);
|
|
705
|
+
t && (l = O(e, l, t, tt, [], et));
|
|
706
706
|
}
|
|
707
|
-
if (
|
|
707
|
+
if (N(n)) {
|
|
708
708
|
if (s?.sort_by && s.sort_by !== "created_at") throw new C(400, { message: `Sorting by ${s.sort_by} is not supported with checkpoint pagination (from/take); only created_at is` });
|
|
709
|
-
let r = s?.sort_order === "asc" ? "asc" : "desc", { rows: i, limit: a, next: o } = await
|
|
709
|
+
let r = s?.sort_order === "asc" ? "asc" : "desc", { rows: i, limit: a, next: o } = await P(l.where("users.linked_to", "is", null).selectAll("users").select([
|
|
710
710
|
"user_activity.last_login",
|
|
711
711
|
"user_activity.last_ip",
|
|
712
712
|
"user_activity.login_count"
|
|
@@ -715,7 +715,7 @@ function Qe(e) {
|
|
|
715
715
|
sortOrder: r,
|
|
716
716
|
idColumn: "users.user_id",
|
|
717
717
|
sortKey: `created_at:${r}`
|
|
718
|
-
}), c = await
|
|
718
|
+
}), c = await nt(e, t, i);
|
|
719
719
|
return {
|
|
720
720
|
users: c,
|
|
721
721
|
start: 0,
|
|
@@ -725,13 +725,13 @@ function Qe(e) {
|
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
727
|
if (s && s.sort_by) {
|
|
728
|
-
let t =
|
|
728
|
+
let t = et[s.sort_by];
|
|
729
729
|
if (t) {
|
|
730
730
|
let { ref: n } = e.dynamic;
|
|
731
|
-
l = l.orderBy(typeof t == "string" ? n(t) :
|
|
731
|
+
l = l.orderBy(typeof t == "string" ? n(t) : Me(t), s.sort_order);
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
let u = await
|
|
734
|
+
let u = await nt(e, t, await l.offset(r * i).limit(i).selectAll("users").select([
|
|
735
735
|
"user_activity.last_login",
|
|
736
736
|
"user_activity.last_ip",
|
|
737
737
|
"user_activity.login_count"
|
|
@@ -753,12 +753,12 @@ function Qe(e) {
|
|
|
753
753
|
}
|
|
754
754
|
//#endregion
|
|
755
755
|
//#region src/users/remove.ts
|
|
756
|
-
function
|
|
756
|
+
function it(e) {
|
|
757
757
|
return async (t, n, r) => {
|
|
758
758
|
let i = async (e) => {
|
|
759
759
|
await e.deleteFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.user_id", "in", (e) => e.selectFrom("users").select("users.user_id").where("users.tenant_id", "=", t).where((e) => e.or([e("users.user_id", "=", n), e("users.linked_to", "=", n)]))).execute(), await e.deleteFrom("users").where("users.tenant_id", "=", t).where("users.linked_to", "=", n).execute();
|
|
760
760
|
let i = await e.deleteFrom("users").where("users.tenant_id", "=", t).where("users.user_id", "=", n).execute();
|
|
761
|
-
for (let n of r?.outboxEvents ?? []) await
|
|
761
|
+
for (let n of r?.outboxEvents ?? []) await j(e, t, n.id, n);
|
|
762
762
|
return i.length === 1;
|
|
763
763
|
};
|
|
764
764
|
return r?.outboxEvents?.length && !e.isTransaction ? e.transaction().execute(i) : i(e);
|
|
@@ -766,14 +766,14 @@ function $e(e) {
|
|
|
766
766
|
}
|
|
767
767
|
//#endregion
|
|
768
768
|
//#region src/utils/flatten.ts
|
|
769
|
-
function
|
|
769
|
+
function F(e, t = "", n = {}) {
|
|
770
770
|
for (let r in e) if (Object.prototype.hasOwnProperty.call(e, r)) {
|
|
771
771
|
let i = t ? `${t}_${r}` : r, a = e[r];
|
|
772
|
-
typeof a == "object" && a && !Array.isArray(a) ?
|
|
772
|
+
typeof a == "object" && a && !Array.isArray(a) ? F(a, i, n) : typeof a == "boolean" ? n[i] = +!!a : n[i] = a;
|
|
773
773
|
}
|
|
774
774
|
return n;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function at(e, t) {
|
|
777
777
|
let n = {};
|
|
778
778
|
for (let [r, i] of Object.entries(e)) {
|
|
779
779
|
let e = t.find((e) => r.startsWith(`${e}_`));
|
|
@@ -790,7 +790,7 @@ function et(e, t) {
|
|
|
790
790
|
}
|
|
791
791
|
//#endregion
|
|
792
792
|
//#region src/userActivity/index.ts
|
|
793
|
-
function
|
|
793
|
+
function ot(e) {
|
|
794
794
|
return {
|
|
795
795
|
user_id: e.user_id,
|
|
796
796
|
last_login: e.last_login ?? void 0,
|
|
@@ -800,18 +800,18 @@ function tt(e) {
|
|
|
800
800
|
last_password_reset: e.last_password_reset ?? void 0
|
|
801
801
|
};
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function st(e) {
|
|
804
804
|
let t = {};
|
|
805
805
|
return e.last_login !== void 0 && (t.last_login = e.last_login), e.last_ip !== void 0 && (t.last_ip = e.last_ip), e.login_count !== void 0 && (t.login_count = e.login_count), e.failed_logins !== void 0 && (t.failed_logins = JSON.stringify(e.failed_logins)), e.last_password_reset !== void 0 && (t.last_password_reset = e.last_password_reset), t;
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function ct(e) {
|
|
808
808
|
return {
|
|
809
809
|
async get(t, n) {
|
|
810
810
|
let r = await e.selectFrom("user_activity").where("tenant_id", "=", t).where("user_id", "=", n).selectAll().executeTakeFirst();
|
|
811
|
-
return r ?
|
|
811
|
+
return r ? ot(r) : null;
|
|
812
812
|
},
|
|
813
813
|
async upsert(t, n, r) {
|
|
814
|
-
let i =
|
|
814
|
+
let i = st(r);
|
|
815
815
|
if (await e.selectFrom("user_activity").where("tenant_id", "=", t).where("user_id", "=", n).select("user_id").executeTakeFirst()) {
|
|
816
816
|
if (Object.keys(i).length === 0) return;
|
|
817
817
|
await e.updateTable("user_activity").set(i).where("tenant_id", "=", t).where("user_id", "=", n).execute();
|
|
@@ -833,9 +833,9 @@ function rt(e) {
|
|
|
833
833
|
}
|
|
834
834
|
//#endregion
|
|
835
835
|
//#region src/users/update.ts
|
|
836
|
-
function
|
|
836
|
+
function lt(e) {
|
|
837
837
|
return async (t, n, r, i) => {
|
|
838
|
-
let { last_login: a, last_ip: o, login_count: s, ...c } = r, l =
|
|
838
|
+
let { last_login: a, last_ip: o, login_count: s, ...c } = r, l = F({
|
|
839
839
|
...c,
|
|
840
840
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
841
841
|
app_metadata: r.app_metadata ? JSON.stringify(r.app_metadata) : void 0,
|
|
@@ -846,12 +846,12 @@ function it(e) {
|
|
|
846
846
|
}), u = async (e) => {
|
|
847
847
|
let [r] = await e.updateTable("users").set(l).where("users.tenant_id", "=", t).where("users.user_id", "=", n).execute();
|
|
848
848
|
if (!r || r.numUpdatedRows === 0n) return !1;
|
|
849
|
-
(a !== void 0 || o !== void 0 || s !== void 0) && await
|
|
849
|
+
(a !== void 0 || o !== void 0 || s !== void 0) && await ct(e).upsert(t, n, {
|
|
850
850
|
last_login: a,
|
|
851
851
|
last_ip: o,
|
|
852
852
|
login_count: s
|
|
853
853
|
});
|
|
854
|
-
for (let n of i?.outboxEvents ?? []) await
|
|
854
|
+
for (let n of i?.outboxEvents ?? []) await j(e, t, n.id, n);
|
|
855
855
|
return !0;
|
|
856
856
|
};
|
|
857
857
|
return e.isTransaction ? u(e) : e.transaction().execute(u);
|
|
@@ -859,26 +859,26 @@ function it(e) {
|
|
|
859
859
|
}
|
|
860
860
|
//#endregion
|
|
861
861
|
//#region src/users/unlink.ts
|
|
862
|
-
function
|
|
862
|
+
function ut(e) {
|
|
863
863
|
return async (t, n, r, i) => (await e.updateTable("users").set({ linked_to: null }).where("users.tenant_id", "=", t).where("users.user_id", "=", `${r}|${i}`).where("users.linked_to", "=", `${n}`).execute()).length === 1;
|
|
864
864
|
}
|
|
865
865
|
//#endregion
|
|
866
866
|
//#region src/users/index.ts
|
|
867
|
-
function
|
|
868
|
-
let t =
|
|
867
|
+
function dt(e) {
|
|
868
|
+
let t = Je(e);
|
|
869
869
|
return {
|
|
870
870
|
create: t,
|
|
871
871
|
rawCreate: t,
|
|
872
|
-
remove:
|
|
873
|
-
get:
|
|
874
|
-
list:
|
|
875
|
-
update:
|
|
876
|
-
unlink:
|
|
872
|
+
remove: it(e),
|
|
873
|
+
get: Xe(e),
|
|
874
|
+
list: rt(e),
|
|
875
|
+
update: lt(e),
|
|
876
|
+
unlink: ut(e)
|
|
877
877
|
};
|
|
878
878
|
}
|
|
879
879
|
//#endregion
|
|
880
880
|
//#region src/flows/create.ts
|
|
881
|
-
function
|
|
881
|
+
function ft(e) {
|
|
882
882
|
return async (n, r, i) => {
|
|
883
883
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = b.parse({
|
|
884
884
|
id: a?.id ?? `af_${t()}`,
|
|
@@ -896,7 +896,7 @@ function st(e) {
|
|
|
896
896
|
}
|
|
897
897
|
//#endregion
|
|
898
898
|
//#region src/helpers/parse.ts
|
|
899
|
-
function
|
|
899
|
+
function I(e, t) {
|
|
900
900
|
if (!e) return t;
|
|
901
901
|
try {
|
|
902
902
|
return JSON.parse(e);
|
|
@@ -904,7 +904,7 @@ function L(e, t) {
|
|
|
904
904
|
return t;
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function pt(e) {
|
|
908
908
|
if (e) try {
|
|
909
909
|
let t = JSON.parse(e);
|
|
910
910
|
return t && typeof t == "object" && !Array.isArray(t) ? t : void 0;
|
|
@@ -912,33 +912,33 @@ function ct(e) {
|
|
|
912
912
|
return;
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
function
|
|
916
|
-
for (let r in t) r in e && (n[r] =
|
|
915
|
+
function mt(e, t, n = { ...e }) {
|
|
916
|
+
for (let r in t) r in e && (n[r] = I(e[r], t[r]));
|
|
917
917
|
return n;
|
|
918
918
|
}
|
|
919
919
|
//#endregion
|
|
920
920
|
//#region src/flows/get.ts
|
|
921
|
-
function
|
|
921
|
+
function ht(e) {
|
|
922
922
|
return async (t, n) => {
|
|
923
923
|
let r = await e.selectFrom("flows").selectAll().where("flows.id", "=", n).where("tenant_id", "=", t).executeTakeFirst();
|
|
924
924
|
if (!r) return null;
|
|
925
925
|
let i = {
|
|
926
926
|
...r,
|
|
927
|
-
actions:
|
|
927
|
+
actions: I(r.actions, [])
|
|
928
928
|
};
|
|
929
929
|
return b.parse(l(i));
|
|
930
930
|
};
|
|
931
931
|
}
|
|
932
932
|
//#endregion
|
|
933
933
|
//#region src/flows/list.ts
|
|
934
|
-
function
|
|
934
|
+
function gt(e) {
|
|
935
935
|
return async (t, n = {}) => {
|
|
936
936
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, q: s } = n, c = e.selectFrom("flows").where("tenant_id", "=", t);
|
|
937
937
|
s && (c = O(e, c, s, []));
|
|
938
938
|
let u = (await c.offset(r * i).limit(i).selectAll().execute()).map((e) => {
|
|
939
939
|
let t = {
|
|
940
940
|
...e,
|
|
941
|
-
actions:
|
|
941
|
+
actions: I(e.actions, [])
|
|
942
942
|
};
|
|
943
943
|
return b.parse(l(t));
|
|
944
944
|
});
|
|
@@ -959,7 +959,7 @@ function dt(e) {
|
|
|
959
959
|
}
|
|
960
960
|
//#endregion
|
|
961
961
|
//#region src/flows/update.ts
|
|
962
|
-
function
|
|
962
|
+
function _t(e) {
|
|
963
963
|
return async (t, n, r) => {
|
|
964
964
|
let i = {
|
|
965
965
|
...r,
|
|
@@ -977,27 +977,27 @@ function ft(e) {
|
|
|
977
977
|
}
|
|
978
978
|
//#endregion
|
|
979
979
|
//#region src/flows/remove.ts
|
|
980
|
-
function
|
|
980
|
+
function vt(e) {
|
|
981
981
|
return async (t, n) => ((await e.deleteFrom("flows").where("id", "=", n).where("tenant_id", "=", t).execute())[0]?.numDeletedRows ?? 0n) > 0n;
|
|
982
982
|
}
|
|
983
983
|
//#endregion
|
|
984
984
|
//#region src/flows/index.ts
|
|
985
|
-
function
|
|
985
|
+
function yt(e) {
|
|
986
986
|
return {
|
|
987
|
-
create:
|
|
988
|
-
get:
|
|
989
|
-
list:
|
|
990
|
-
update:
|
|
991
|
-
remove:
|
|
987
|
+
create: ft(e),
|
|
988
|
+
get: ht(e),
|
|
989
|
+
list: gt(e),
|
|
990
|
+
update: _t(e),
|
|
991
|
+
remove: vt(e)
|
|
992
992
|
};
|
|
993
993
|
}
|
|
994
994
|
//#endregion
|
|
995
995
|
//#region src/tenants/utils.ts
|
|
996
|
-
function
|
|
996
|
+
function bt(e) {
|
|
997
997
|
let t = { ...e };
|
|
998
998
|
return e.session_cookie && typeof e.session_cookie == "string" && (t.session_cookie = JSON.parse(e.session_cookie)), e.enabled_locales && typeof e.enabled_locales == "string" && (t.enabled_locales = JSON.parse(e.enabled_locales)), e.error_page && typeof e.error_page == "string" && (t.error_page = JSON.parse(e.error_page)), e.flags && typeof e.flags == "string" && (t.flags = JSON.parse(e.flags)), e.sandbox_versions_available && typeof e.sandbox_versions_available == "string" && (t.sandbox_versions_available = JSON.parse(e.sandbox_versions_available)), e.change_password && typeof e.change_password == "string" && (t.change_password = JSON.parse(e.change_password)), e.guardian_mfa_page && typeof e.guardian_mfa_page == "string" && (t.guardian_mfa_page = JSON.parse(e.guardian_mfa_page)), e.sessions && typeof e.sessions == "string" && (t.sessions = JSON.parse(e.sessions)), e.oidc_logout && typeof e.oidc_logout == "string" && (t.oidc_logout = JSON.parse(e.oidc_logout)), e.device_flow && typeof e.device_flow == "string" && (t.device_flow = JSON.parse(e.device_flow)), e.default_token_quota && typeof e.default_token_quota == "string" && (t.default_token_quota = JSON.parse(e.default_token_quota)), e.allowed_logout_urls && typeof e.allowed_logout_urls == "string" && (t.allowed_logout_urls = JSON.parse(e.allowed_logout_urls)), e.acr_values_supported && typeof e.acr_values_supported == "string" && (t.acr_values_supported = JSON.parse(e.acr_values_supported)), e.mtls && typeof e.mtls == "string" && (t.mtls = JSON.parse(e.mtls)), e.mfa && typeof e.mfa == "string" && (t.mfa = JSON.parse(e.mfa)), e.attack_protection && typeof e.attack_protection == "string" && (t.attack_protection = JSON.parse(e.attack_protection)), e.allow_organization_name_in_authentication_api !== void 0 && (t.allow_organization_name_in_authentication_api = e.allow_organization_name_in_authentication_api === 1), e.customize_mfa_in_postlogin_action !== void 0 && (t.customize_mfa_in_postlogin_action = e.customize_mfa_in_postlogin_action === 1), e.pushed_authorization_requests_supported !== void 0 && (t.pushed_authorization_requests_supported = e.pushed_authorization_requests_supported === 1), e.authorization_response_iss_parameter_supported !== void 0 && (t.authorization_response_iss_parameter_supported = e.authorization_response_iss_parameter_supported === 1), l(t);
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function xt(e) {
|
|
1001
1001
|
let t = { ...e };
|
|
1002
1002
|
return d(e, [
|
|
1003
1003
|
"session_cookie",
|
|
@@ -1020,14 +1020,14 @@ function gt(e) {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
//#endregion
|
|
1022
1022
|
//#region src/tenants/create.ts
|
|
1023
|
-
function
|
|
1023
|
+
function St(e) {
|
|
1024
1024
|
return async (n, r) => {
|
|
1025
1025
|
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
1026
1026
|
...n,
|
|
1027
1027
|
id: i?.id ?? n.id ?? t(),
|
|
1028
1028
|
created_at: i?.created_at ?? a,
|
|
1029
1029
|
updated_at: i?.updated_at ?? a
|
|
1030
|
-
}, s =
|
|
1030
|
+
}, s = xt(o);
|
|
1031
1031
|
try {
|
|
1032
1032
|
await e.insertInto("tenants").values(s).execute();
|
|
1033
1033
|
} catch (e) {
|
|
@@ -1039,15 +1039,15 @@ function _t(e) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
//#endregion
|
|
1041
1041
|
//#region src/tenants/get.ts
|
|
1042
|
-
function
|
|
1042
|
+
function Ct(e) {
|
|
1043
1043
|
return async (t) => {
|
|
1044
1044
|
let n = await e.selectFrom("tenants").where("tenants.id", "=", t).selectAll().executeTakeFirst();
|
|
1045
|
-
return n ?
|
|
1045
|
+
return n ? bt(n) : null;
|
|
1046
1046
|
};
|
|
1047
1047
|
}
|
|
1048
1048
|
//#endregion
|
|
1049
1049
|
//#region src/tenants/list.ts
|
|
1050
|
-
function
|
|
1050
|
+
function wt(e) {
|
|
1051
1051
|
return async (t) => {
|
|
1052
1052
|
let n = e.selectFrom("tenants"), { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: s, q: c } = t || {};
|
|
1053
1053
|
if (s && s.sort_by) {
|
|
@@ -1055,7 +1055,7 @@ function yt(e) {
|
|
|
1055
1055
|
n = n.orderBy(t(s.sort_by), s.sort_order);
|
|
1056
1056
|
}
|
|
1057
1057
|
c && (n = O(e, n, c, ["friendly_name"]));
|
|
1058
|
-
let l = (await n.offset(r * i).limit(i).selectAll().execute()).map(
|
|
1058
|
+
let l = (await n.offset(r * i).limit(i).selectAll().execute()).map(bt);
|
|
1059
1059
|
if (!a) return { tenants: l };
|
|
1060
1060
|
let { count: u } = await n.select((e) => e.fn.countAll().as("count")).executeTakeFirstOrThrow(), d = o(u);
|
|
1061
1061
|
return {
|
|
@@ -1068,10 +1068,10 @@ function yt(e) {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
//#endregion
|
|
1070
1070
|
//#region src/tenants/update.ts
|
|
1071
|
-
function
|
|
1071
|
+
function Tt(e) {
|
|
1072
1072
|
return async (t, n) => {
|
|
1073
1073
|
let r = {
|
|
1074
|
-
...
|
|
1074
|
+
...xt(n),
|
|
1075
1075
|
id: t,
|
|
1076
1076
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1077
1077
|
};
|
|
@@ -1080,29 +1080,29 @@ function bt(e) {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
//#endregion
|
|
1082
1082
|
//#region src/tenants/remove.ts
|
|
1083
|
-
function
|
|
1083
|
+
function Et(e) {
|
|
1084
1084
|
return async (t) => (await e.deleteFrom("tenants").where("tenants.id", "=", t).execute()).length === 1;
|
|
1085
1085
|
}
|
|
1086
1086
|
//#endregion
|
|
1087
1087
|
//#region src/tenants/index.ts
|
|
1088
|
-
function
|
|
1088
|
+
function Dt(e) {
|
|
1089
1089
|
return {
|
|
1090
|
-
create:
|
|
1091
|
-
get:
|
|
1092
|
-
list:
|
|
1093
|
-
update:
|
|
1094
|
-
remove:
|
|
1090
|
+
create: St(e),
|
|
1091
|
+
get: Ct(e),
|
|
1092
|
+
list: wt(e),
|
|
1093
|
+
update: Tt(e),
|
|
1094
|
+
remove: Et(e)
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
1097
|
//#endregion
|
|
1098
1098
|
//#region src/logs/create.ts
|
|
1099
|
-
function
|
|
1099
|
+
function Ot(e) {
|
|
1100
1100
|
return e ? JSON.stringify(e) : void 0;
|
|
1101
1101
|
}
|
|
1102
|
-
var
|
|
1103
|
-
function
|
|
1102
|
+
var kt = 256;
|
|
1103
|
+
function At(e) {
|
|
1104
1104
|
return async (n, r) => {
|
|
1105
|
-
let i = r.user_agent?.slice(0,
|
|
1105
|
+
let i = r.user_agent?.slice(0, kt), a = r.log_id || t(), { location_info: o, ...s } = r;
|
|
1106
1106
|
return await e.insertInto("logs").values({
|
|
1107
1107
|
...s,
|
|
1108
1108
|
log_id: a,
|
|
@@ -1111,8 +1111,8 @@ function Tt(e) {
|
|
|
1111
1111
|
description: r.description?.substring(0, 256),
|
|
1112
1112
|
isMobile: +!!r.isMobile,
|
|
1113
1113
|
scope: r.scope,
|
|
1114
|
-
auth0_client:
|
|
1115
|
-
details:
|
|
1114
|
+
auth0_client: Ot(r.auth0_client),
|
|
1115
|
+
details: Ot(r.details)?.substring(0, 8192),
|
|
1116
1116
|
country_code: o?.country_code,
|
|
1117
1117
|
city_name: o?.city_name,
|
|
1118
1118
|
latitude: o?.latitude,
|
|
@@ -1128,7 +1128,7 @@ function Tt(e) {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
//#endregion
|
|
1130
1130
|
//#region src/logs/logs.ts
|
|
1131
|
-
function
|
|
1131
|
+
function jt(e) {
|
|
1132
1132
|
if (!e) return "";
|
|
1133
1133
|
try {
|
|
1134
1134
|
return JSON.parse(e);
|
|
@@ -1136,13 +1136,13 @@ function Et(e) {
|
|
|
1136
1136
|
return e;
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function Mt(e) {
|
|
1140
1140
|
return {
|
|
1141
1141
|
...e,
|
|
1142
1142
|
client_id: e.client_id,
|
|
1143
1143
|
client_name: e.client_name || "",
|
|
1144
|
-
auth0_client:
|
|
1145
|
-
details:
|
|
1144
|
+
auth0_client: jt(e.auth0_client),
|
|
1145
|
+
details: jt(e.details),
|
|
1146
1146
|
isMobile: !!e.isMobile,
|
|
1147
1147
|
scope: e.scope || void 0,
|
|
1148
1148
|
log_id: e.log_id,
|
|
@@ -1158,7 +1158,7 @@ function Dt(e) {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
//#endregion
|
|
1160
1160
|
//#region src/logs/list.ts
|
|
1161
|
-
var
|
|
1161
|
+
var Nt = [
|
|
1162
1162
|
"user_id",
|
|
1163
1163
|
"ip",
|
|
1164
1164
|
"type",
|
|
@@ -1184,25 +1184,25 @@ var Ot = [
|
|
|
1184
1184
|
"time_zone",
|
|
1185
1185
|
"continent_code"
|
|
1186
1186
|
];
|
|
1187
|
-
function
|
|
1187
|
+
function Pt(e) {
|
|
1188
1188
|
return async (t, n = {}) => {
|
|
1189
1189
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: s, q: c, from_date: l, to_date: u } = n, d = e.selectFrom("logs").where("logs.tenant_id", "=", t);
|
|
1190
1190
|
if (c) {
|
|
1191
|
-
let t = S(c,
|
|
1191
|
+
let t = S(c, Nt);
|
|
1192
1192
|
t && (d = O(e, d, t, [
|
|
1193
1193
|
"user_id",
|
|
1194
1194
|
"ip",
|
|
1195
1195
|
"description"
|
|
1196
1196
|
], ["description"]));
|
|
1197
1197
|
}
|
|
1198
|
-
if (typeof l == "number" && Number.isFinite(l) && (d = d.where("logs.date", ">=", (/* @__PURE__ */ new Date(Math.floor(l) * 1e3)).toISOString())), typeof u == "number" && Number.isFinite(u) && (d = d.where("logs.date", "<=", (/* @__PURE__ */ new Date(Math.floor(u) * 1e3 + 999)).toISOString())),
|
|
1198
|
+
if (typeof l == "number" && Number.isFinite(l) && (d = d.where("logs.date", ">=", (/* @__PURE__ */ new Date(Math.floor(l) * 1e3)).toISOString())), typeof u == "number" && Number.isFinite(u) && (d = d.where("logs.date", "<=", (/* @__PURE__ */ new Date(Math.floor(u) * 1e3 + 999)).toISOString())), N(n)) {
|
|
1199
1199
|
if (s?.sort_by && s.sort_by !== "date") throw new C(400, { message: `Sorting by ${s.sort_by} is not supported with checkpoint pagination (from/take); only date is` });
|
|
1200
|
-
let e = s?.sort_order === "asc" ? "asc" : "desc", { rows: t, limit: r, next: i } = await
|
|
1200
|
+
let e = s?.sort_order === "asc" ? "asc" : "desc", { rows: t, limit: r, next: i } = await P(d.selectAll(), n, {
|
|
1201
1201
|
sortColumn: "date",
|
|
1202
1202
|
sortOrder: e,
|
|
1203
1203
|
idColumn: "log_id",
|
|
1204
1204
|
sortKey: `date:${e}`
|
|
1205
|
-
}), a = t.map(
|
|
1205
|
+
}), a = t.map(Mt);
|
|
1206
1206
|
return {
|
|
1207
1207
|
logs: a,
|
|
1208
1208
|
start: 0,
|
|
@@ -1217,7 +1217,7 @@ function kt(e) {
|
|
|
1217
1217
|
f = f.orderBy(t(s.sort_by), s.sort_order);
|
|
1218
1218
|
}
|
|
1219
1219
|
f = f.offset(r * i).limit(i);
|
|
1220
|
-
let p = (await f.selectAll().execute()).map(
|
|
1220
|
+
let p = (await f.selectAll().execute()).map(Mt);
|
|
1221
1221
|
if (!a) return {
|
|
1222
1222
|
logs: p,
|
|
1223
1223
|
start: 0,
|
|
@@ -1235,24 +1235,24 @@ function kt(e) {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
//#endregion
|
|
1237
1237
|
//#region src/logs/get.ts
|
|
1238
|
-
function
|
|
1238
|
+
function Ft(e) {
|
|
1239
1239
|
return async (t, n) => {
|
|
1240
1240
|
let r = await e.selectFrom("logs").where("logs.tenant_id", "=", t).where("logs.log_id", "=", n).selectAll().executeTakeFirst();
|
|
1241
|
-
return r ?
|
|
1241
|
+
return r ? Mt(r) : null;
|
|
1242
1242
|
};
|
|
1243
1243
|
}
|
|
1244
1244
|
//#endregion
|
|
1245
1245
|
//#region src/logs/index.ts
|
|
1246
|
-
function
|
|
1246
|
+
function It(e) {
|
|
1247
1247
|
return {
|
|
1248
|
-
create:
|
|
1249
|
-
list:
|
|
1250
|
-
get:
|
|
1248
|
+
create: At(e),
|
|
1249
|
+
list: Pt(e),
|
|
1250
|
+
get: Ft(e)
|
|
1251
1251
|
};
|
|
1252
1252
|
}
|
|
1253
1253
|
//#endregion
|
|
1254
1254
|
//#region src/sessions/get.ts
|
|
1255
|
-
function
|
|
1255
|
+
function Lt(e) {
|
|
1256
1256
|
return async (t, n) => {
|
|
1257
1257
|
let i = await e.selectFrom("sessions").where("sessions.tenant_id", "=", t).where("sessions.id", "=", n).selectAll().executeTakeFirst();
|
|
1258
1258
|
if (!i) return null;
|
|
@@ -1286,7 +1286,7 @@ function Mt(e) {
|
|
|
1286
1286
|
}
|
|
1287
1287
|
//#endregion
|
|
1288
1288
|
//#region src/sessions/create.ts
|
|
1289
|
-
function
|
|
1289
|
+
function Rt(e) {
|
|
1290
1290
|
return async (t, n) => {
|
|
1291
1291
|
let r = Date.now(), i = c(), a = {
|
|
1292
1292
|
...n,
|
|
@@ -1318,12 +1318,12 @@ function Nt(e) {
|
|
|
1318
1318
|
}
|
|
1319
1319
|
//#endregion
|
|
1320
1320
|
//#region src/sessions/remove.ts
|
|
1321
|
-
function
|
|
1321
|
+
function zt(e) {
|
|
1322
1322
|
return async (t, n) => !!(await e.deleteFrom("sessions").where("tenant_id", "=", t).where("sessions.id", "=", n).execute()).length;
|
|
1323
1323
|
}
|
|
1324
1324
|
//#endregion
|
|
1325
1325
|
//#region src/sessions/update.ts
|
|
1326
|
-
function
|
|
1326
|
+
function Bt(e) {
|
|
1327
1327
|
return async (t, n, r) => {
|
|
1328
1328
|
let i = Date.now(), a = {
|
|
1329
1329
|
updated_at_ts: i,
|
|
@@ -1344,7 +1344,7 @@ function Ft(e) {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
//#endregion
|
|
1346
1346
|
//#region src/sessions/list.ts
|
|
1347
|
-
function
|
|
1347
|
+
function Vt(e) {
|
|
1348
1348
|
return async (t, n = {}) => {
|
|
1349
1349
|
let { page: i = 0, per_page: a = 50, include_totals: s = !1, sort: c, q: l } = n, u = e.selectFrom("sessions").where("sessions.tenant_id", "=", t);
|
|
1350
1350
|
l && (u = O(e, u, l, ["user_id", "session_id"]));
|
|
@@ -1399,18 +1399,18 @@ function It(e) {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
//#endregion
|
|
1401
1401
|
//#region src/sessions/index.ts
|
|
1402
|
-
function
|
|
1402
|
+
function Ht(e) {
|
|
1403
1403
|
return {
|
|
1404
|
-
create:
|
|
1405
|
-
get:
|
|
1406
|
-
list:
|
|
1407
|
-
remove:
|
|
1408
|
-
update:
|
|
1404
|
+
create: Rt(e),
|
|
1405
|
+
get: Lt(e),
|
|
1406
|
+
list: Vt(e),
|
|
1407
|
+
remove: zt(e),
|
|
1408
|
+
update: Bt(e)
|
|
1409
1409
|
};
|
|
1410
1410
|
}
|
|
1411
1411
|
//#endregion
|
|
1412
1412
|
//#region src/passwords/get.ts
|
|
1413
|
-
function
|
|
1413
|
+
function Ut(e) {
|
|
1414
1414
|
return async (t, n) => {
|
|
1415
1415
|
let r = await e.selectFrom("passwords").where("passwords.tenant_id", "=", t).where("passwords.user_id", "=", n).where("passwords.is_current", "=", 1).selectAll().executeTakeFirst();
|
|
1416
1416
|
if (!r) return null;
|
|
@@ -1423,7 +1423,7 @@ function Rt(e) {
|
|
|
1423
1423
|
}
|
|
1424
1424
|
//#endregion
|
|
1425
1425
|
//#region src/passwords/create.ts
|
|
1426
|
-
function
|
|
1426
|
+
function Wt(e) {
|
|
1427
1427
|
return async (n, r, i) => {
|
|
1428
1428
|
let a = i?.importMetadata, o = a?.id || r.id || t(), s = r.is_current ?? !0, c = (/* @__PURE__ */ new Date()).toISOString(), l = {
|
|
1429
1429
|
...r,
|
|
@@ -1441,7 +1441,7 @@ function zt(e) {
|
|
|
1441
1441
|
}
|
|
1442
1442
|
//#endregion
|
|
1443
1443
|
//#region src/passwords/update.ts
|
|
1444
|
-
function
|
|
1444
|
+
function Gt(e) {
|
|
1445
1445
|
return async (t, n) => {
|
|
1446
1446
|
let r = e.updateTable("passwords").set({
|
|
1447
1447
|
password: n.password,
|
|
@@ -1454,7 +1454,7 @@ function Bt(e) {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
//#endregion
|
|
1456
1456
|
//#region src/passwords/list.ts
|
|
1457
|
-
function
|
|
1457
|
+
function Kt(e) {
|
|
1458
1458
|
return async (t, n, r) => {
|
|
1459
1459
|
let i = e.selectFrom("passwords").where("passwords.tenant_id", "=", t).where("passwords.user_id", "=", n).orderBy("created_at", "desc");
|
|
1460
1460
|
return r && (i = i.limit(r)), (await i.selectAll().execute()).map(({ tenant_id: e, ...t }) => ({
|
|
@@ -1465,23 +1465,23 @@ function Vt(e) {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
//#endregion
|
|
1467
1467
|
//#region src/passwords/index.ts
|
|
1468
|
-
function
|
|
1468
|
+
function qt(e) {
|
|
1469
1469
|
return {
|
|
1470
|
-
create:
|
|
1471
|
-
update:
|
|
1472
|
-
get:
|
|
1473
|
-
list:
|
|
1470
|
+
create: Wt(e),
|
|
1471
|
+
update: Gt(e),
|
|
1472
|
+
get: Ut(e),
|
|
1473
|
+
list: Kt(e)
|
|
1474
1474
|
};
|
|
1475
1475
|
}
|
|
1476
1476
|
//#endregion
|
|
1477
1477
|
//#region src/codes/list.ts
|
|
1478
|
-
function
|
|
1478
|
+
function Jt(e) {
|
|
1479
1479
|
return async (t, n = {}) => {
|
|
1480
1480
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, q: s } = n, c = e.selectFrom("codes").where("codes.tenant_id", "=", t);
|
|
1481
1481
|
s && (c = O(e, c, s, ["code", "login_id"]));
|
|
1482
1482
|
let u = (await c.offset(r * i).limit(i).selectAll().execute()).map((e) => {
|
|
1483
1483
|
let { tenant_id: t, ...n } = e;
|
|
1484
|
-
return
|
|
1484
|
+
return y.parse(l(n));
|
|
1485
1485
|
});
|
|
1486
1486
|
if (!a) return {
|
|
1487
1487
|
codes: u,
|
|
@@ -1500,13 +1500,13 @@ function Ut(e) {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
//#endregion
|
|
1502
1502
|
//#region src/codes/expires-at-ts.ts
|
|
1503
|
-
function
|
|
1503
|
+
function Yt(e) {
|
|
1504
1504
|
let t = new Date(e).getTime();
|
|
1505
1505
|
return Number.isNaN(t) ? 0 : t;
|
|
1506
1506
|
}
|
|
1507
1507
|
//#endregion
|
|
1508
1508
|
//#region src/codes/create.ts
|
|
1509
|
-
function
|
|
1509
|
+
function Xt(e) {
|
|
1510
1510
|
return async (t, n) => {
|
|
1511
1511
|
let r = {
|
|
1512
1512
|
...n,
|
|
@@ -1515,18 +1515,18 @@ function Gt(e) {
|
|
|
1515
1515
|
return await e.insertInto("codes").values({
|
|
1516
1516
|
...r,
|
|
1517
1517
|
tenant_id: t,
|
|
1518
|
-
expires_at_ts:
|
|
1518
|
+
expires_at_ts: Yt(r.expires_at)
|
|
1519
1519
|
}).execute(), r;
|
|
1520
1520
|
};
|
|
1521
1521
|
}
|
|
1522
1522
|
//#endregion
|
|
1523
1523
|
//#region src/codes/remove.ts
|
|
1524
|
-
function
|
|
1524
|
+
function Zt(e) {
|
|
1525
1525
|
return async (t, n) => (await e.deleteFrom("codes").where("codes.tenant_id", "=", t).where("codes.code_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
1526
1526
|
}
|
|
1527
1527
|
//#endregion
|
|
1528
1528
|
//#region src/codes/get.ts
|
|
1529
|
-
function
|
|
1529
|
+
function Qt(e) {
|
|
1530
1530
|
return async (t, n, r) => {
|
|
1531
1531
|
let i = e.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", r);
|
|
1532
1532
|
t.length && (i = i.where("codes.tenant_id", "=", t));
|
|
@@ -1536,44 +1536,44 @@ function qt(e) {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
//#endregion
|
|
1538
1538
|
//#region src/codes/used.ts
|
|
1539
|
-
function
|
|
1539
|
+
function $t(e) {
|
|
1540
1540
|
return async (t, n) => (await e.updateTable("codes").set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where("codes.tenant_id", "=", t).where("codes.code_id", "=", n).executeTakeFirst()).numUpdatedRows > 0;
|
|
1541
1541
|
}
|
|
1542
1542
|
//#endregion
|
|
1543
1543
|
//#region src/codes/consume.ts
|
|
1544
|
-
function
|
|
1544
|
+
function en(e) {
|
|
1545
1545
|
return async (t, n) => (await e.updateTable("codes").set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where("codes.tenant_id", "=", t).where("codes.code_id", "=", n).where("codes.used_at", "is", null).executeTakeFirst()).numUpdatedRows > 0;
|
|
1546
1546
|
}
|
|
1547
1547
|
//#endregion
|
|
1548
1548
|
//#region src/codes/cleanup.ts
|
|
1549
|
-
function
|
|
1549
|
+
function tn(e) {
|
|
1550
1550
|
return async (t) => {
|
|
1551
|
-
let n = await e.deleteFrom("codes").where("expires_at_ts", "<",
|
|
1551
|
+
let n = await e.deleteFrom("codes").where("expires_at_ts", "<", Yt(t)).executeTakeFirst(), r = await e.deleteFrom("codes").where("expires_at_ts", "is", null).where("expires_at", "<", t).executeTakeFirst();
|
|
1552
1552
|
return Number(n.numDeletedRows) + Number(r.numDeletedRows);
|
|
1553
1553
|
};
|
|
1554
1554
|
}
|
|
1555
1555
|
//#endregion
|
|
1556
1556
|
//#region src/codes/index.ts
|
|
1557
|
-
function
|
|
1557
|
+
function nn(e) {
|
|
1558
1558
|
return {
|
|
1559
|
-
create:
|
|
1560
|
-
list:
|
|
1561
|
-
remove:
|
|
1562
|
-
used:
|
|
1563
|
-
consume:
|
|
1564
|
-
get:
|
|
1565
|
-
cleanup:
|
|
1559
|
+
create: Xt(e),
|
|
1560
|
+
list: Jt(e),
|
|
1561
|
+
remove: Zt(e),
|
|
1562
|
+
used: $t(e),
|
|
1563
|
+
consume: en(e),
|
|
1564
|
+
get: Qt(e),
|
|
1565
|
+
cleanup: tn(e)
|
|
1566
1566
|
};
|
|
1567
1567
|
}
|
|
1568
1568
|
//#endregion
|
|
1569
1569
|
//#region src/connections/create.ts
|
|
1570
|
-
function
|
|
1570
|
+
function rn(e) {
|
|
1571
1571
|
return async (t, n, r) => {
|
|
1572
1572
|
let i = r?.importMetadata, { is_system: a, ...o } = n;
|
|
1573
1573
|
delete o.enabled_clients;
|
|
1574
1574
|
let s = (/* @__PURE__ */ new Date()).toISOString(), c = {
|
|
1575
1575
|
...o,
|
|
1576
|
-
id: i?.id ?? o.id ??
|
|
1576
|
+
id: i?.id ?? o.id ?? Ce(),
|
|
1577
1577
|
is_system: a ? !0 : void 0,
|
|
1578
1578
|
created_at: i?.created_at ?? s,
|
|
1579
1579
|
updated_at: i?.updated_at ?? s
|
|
@@ -1588,7 +1588,7 @@ function Qt(e) {
|
|
|
1588
1588
|
}
|
|
1589
1589
|
//#endregion
|
|
1590
1590
|
//#region src/connections/transform.ts
|
|
1591
|
-
function
|
|
1591
|
+
function L(e) {
|
|
1592
1592
|
let { is_system: t, ...n } = e;
|
|
1593
1593
|
return l({
|
|
1594
1594
|
...n,
|
|
@@ -1596,16 +1596,16 @@ function $t(e) {
|
|
|
1596
1596
|
options: typeof e.options == "string" ? JSON.parse(e.options) : {}
|
|
1597
1597
|
});
|
|
1598
1598
|
}
|
|
1599
|
-
function
|
|
1600
|
-
return e.map(
|
|
1599
|
+
function an(e) {
|
|
1600
|
+
return e.map(L);
|
|
1601
1601
|
}
|
|
1602
1602
|
//#endregion
|
|
1603
1603
|
//#region src/connections/list.ts
|
|
1604
|
-
function
|
|
1604
|
+
function on(e) {
|
|
1605
1605
|
return async (t, n = {}) => {
|
|
1606
1606
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, q: s } = n, c = e.selectFrom("connections").where("connections.tenant_id", "=", t);
|
|
1607
1607
|
s && (c = O(e, c, s, ["user_id", "ip"]));
|
|
1608
|
-
let l =
|
|
1608
|
+
let l = an(await c.offset(r * i).limit(i).selectAll().execute());
|
|
1609
1609
|
if (!a) return {
|
|
1610
1610
|
connections: l,
|
|
1611
1611
|
start: 0,
|
|
@@ -1623,20 +1623,20 @@ function tn(e) {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
//#endregion
|
|
1625
1625
|
//#region src/connections/remove.ts
|
|
1626
|
-
function
|
|
1626
|
+
function sn(e) {
|
|
1627
1627
|
return async (t, n) => (await e.deleteFrom("connections").where("connections.tenant_id", "=", t).where("connections.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
1628
1628
|
}
|
|
1629
1629
|
//#endregion
|
|
1630
1630
|
//#region src/connections/get.ts
|
|
1631
|
-
function
|
|
1631
|
+
function cn(e) {
|
|
1632
1632
|
return async (t, n) => {
|
|
1633
1633
|
let r = await e.selectFrom("connections").where("connections.tenant_id", "=", t).where("connections.id", "=", n).selectAll().executeTakeFirst();
|
|
1634
|
-
return r ?
|
|
1634
|
+
return r ? L(r) : null;
|
|
1635
1635
|
};
|
|
1636
1636
|
}
|
|
1637
1637
|
//#endregion
|
|
1638
1638
|
//#region src/connections/update.ts
|
|
1639
|
-
function
|
|
1639
|
+
function ln(e) {
|
|
1640
1640
|
return async (t, n, r) => {
|
|
1641
1641
|
let { is_system: i, ...a } = r;
|
|
1642
1642
|
delete a.enabled_clients;
|
|
@@ -1653,18 +1653,18 @@ function an(e) {
|
|
|
1653
1653
|
}
|
|
1654
1654
|
//#endregion
|
|
1655
1655
|
//#region src/connections/index.ts
|
|
1656
|
-
function
|
|
1656
|
+
function un(e) {
|
|
1657
1657
|
return {
|
|
1658
|
-
create:
|
|
1659
|
-
get:
|
|
1660
|
-
list:
|
|
1661
|
-
remove:
|
|
1662
|
-
update:
|
|
1658
|
+
create: rn(e),
|
|
1659
|
+
get: cn(e),
|
|
1660
|
+
list: on(e),
|
|
1661
|
+
remove: sn(e),
|
|
1662
|
+
update: ln(e)
|
|
1663
1663
|
};
|
|
1664
1664
|
}
|
|
1665
1665
|
//#endregion
|
|
1666
1666
|
//#region src/clients/create.ts
|
|
1667
|
-
function
|
|
1667
|
+
function dn(e) {
|
|
1668
1668
|
return async (r, i, a) => {
|
|
1669
1669
|
let o = a?.importMetadata, s = o?.id ?? i.client_id ?? t(), c = (/* @__PURE__ */ new Date()).toISOString(), l = {
|
|
1670
1670
|
...i,
|
|
@@ -1729,7 +1729,7 @@ function sn(e) {
|
|
|
1729
1729
|
}
|
|
1730
1730
|
//#endregion
|
|
1731
1731
|
//#region src/clients/get.ts
|
|
1732
|
-
function
|
|
1732
|
+
function fn(e) {
|
|
1733
1733
|
return async (t, n) => {
|
|
1734
1734
|
let r = await e.selectFrom("clients").where("clients.tenant_id", "=", t).where("clients.client_id", "=", n).selectAll().executeTakeFirst();
|
|
1735
1735
|
if (!r) return null;
|
|
@@ -1775,7 +1775,7 @@ function cn(e) {
|
|
|
1775
1775
|
}
|
|
1776
1776
|
//#endregion
|
|
1777
1777
|
//#region src/clients/getByClientId.ts
|
|
1778
|
-
function
|
|
1778
|
+
function pn(e) {
|
|
1779
1779
|
return async (t) => {
|
|
1780
1780
|
let n = await e.selectFrom("clients").where("clients.client_id", "=", t).selectAll().executeTakeFirst();
|
|
1781
1781
|
return n ? l({
|
|
@@ -1819,7 +1819,7 @@ function ln(e) {
|
|
|
1819
1819
|
}
|
|
1820
1820
|
//#endregion
|
|
1821
1821
|
//#region src/clients/list.ts
|
|
1822
|
-
function
|
|
1822
|
+
function mn(e) {
|
|
1823
1823
|
return l({
|
|
1824
1824
|
...e,
|
|
1825
1825
|
global: !!e.global,
|
|
@@ -1858,7 +1858,7 @@ function un(e) {
|
|
|
1858
1858
|
registration_metadata: e.registration_metadata ? JSON.parse(e.registration_metadata) : void 0
|
|
1859
1859
|
});
|
|
1860
1860
|
}
|
|
1861
|
-
function
|
|
1861
|
+
function hn(e) {
|
|
1862
1862
|
return async (t, n) => {
|
|
1863
1863
|
let r = e.selectFrom("clients").where("clients.tenant_id", "=", t), i = new Set(["owner_user_id", "registration_type"]);
|
|
1864
1864
|
if (n?.q) {
|
|
@@ -1868,12 +1868,12 @@ function dn(e) {
|
|
|
1868
1868
|
r = r.where(t, "=", e[2]);
|
|
1869
1869
|
} else r = r.where((e) => e.or([e("name", "like", `%${n.q}%`), e("client_id", "like", `%${n.q}%`)]));
|
|
1870
1870
|
}
|
|
1871
|
-
if (
|
|
1872
|
-
let { rows: e, limit: t, next: i } = await
|
|
1871
|
+
if (N(n)) {
|
|
1872
|
+
let { rows: e, limit: t, next: i } = await P(r.selectAll(), n, {
|
|
1873
1873
|
sortColumn: "created_at",
|
|
1874
1874
|
sortOrder: "desc",
|
|
1875
1875
|
idColumn: "client_id"
|
|
1876
|
-
}), a = e.map(
|
|
1876
|
+
}), a = e.map(mn);
|
|
1877
1877
|
return {
|
|
1878
1878
|
clients: a,
|
|
1879
1879
|
totals: {
|
|
@@ -1906,7 +1906,7 @@ function dn(e) {
|
|
|
1906
1906
|
let a = await r.executeTakeFirst();
|
|
1907
1907
|
c = Number(a?.count || 0);
|
|
1908
1908
|
}
|
|
1909
|
-
let l = s.map(
|
|
1909
|
+
let l = s.map(mn);
|
|
1910
1910
|
return {
|
|
1911
1911
|
clients: l,
|
|
1912
1912
|
totals: {
|
|
@@ -1920,12 +1920,12 @@ function dn(e) {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
//#endregion
|
|
1922
1922
|
//#region src/clients/remove.ts
|
|
1923
|
-
function
|
|
1923
|
+
function gn(e) {
|
|
1924
1924
|
return async (t, n) => (await e.deleteFrom("clients").where("clients.tenant_id", "=", t).where("clients.client_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
1925
1925
|
}
|
|
1926
1926
|
//#endregion
|
|
1927
1927
|
//#region src/clients/update.ts
|
|
1928
|
-
function
|
|
1928
|
+
function _n(e) {
|
|
1929
1929
|
return async (t, r, i) => {
|
|
1930
1930
|
let a = {
|
|
1931
1931
|
...i,
|
|
@@ -1972,31 +1972,31 @@ function pn(e) {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
//#endregion
|
|
1974
1974
|
//#region src/clients/index.ts
|
|
1975
|
-
function
|
|
1975
|
+
function vn(e) {
|
|
1976
1976
|
return {
|
|
1977
|
-
create:
|
|
1978
|
-
get:
|
|
1979
|
-
getByClientId:
|
|
1980
|
-
list:
|
|
1981
|
-
remove:
|
|
1982
|
-
update:
|
|
1977
|
+
create: dn(e),
|
|
1978
|
+
get: fn(e),
|
|
1979
|
+
getByClientId: pn(e),
|
|
1980
|
+
list: hn(e),
|
|
1981
|
+
remove: gn(e),
|
|
1982
|
+
update: _n(e)
|
|
1983
1983
|
};
|
|
1984
1984
|
}
|
|
1985
1985
|
//#endregion
|
|
1986
1986
|
//#region src/clientConnections/listByClient.ts
|
|
1987
|
-
function
|
|
1987
|
+
function yn(e) {
|
|
1988
1988
|
return async (t, n) => {
|
|
1989
1989
|
let r = await e.selectFrom("clients").where("clients.tenant_id", "=", t).where("clients.client_id", "=", n).select("connections").executeTakeFirst();
|
|
1990
1990
|
if (!r) return [];
|
|
1991
1991
|
let i = JSON.parse(r.connections || "[]");
|
|
1992
1992
|
if (i.length === 0) return [];
|
|
1993
|
-
let a = await e.selectFrom("connections").where("connections.tenant_id", "=", t).where("connections.id", "in", i).selectAll().execute(), o = new Map(a.map((e) => [e.id,
|
|
1993
|
+
let a = await e.selectFrom("connections").where("connections.tenant_id", "=", t).where("connections.id", "in", i).selectAll().execute(), o = new Map(a.map((e) => [e.id, L(e)]));
|
|
1994
1994
|
return i.map((e) => o.get(e)).filter((e) => e !== void 0);
|
|
1995
1995
|
};
|
|
1996
1996
|
}
|
|
1997
1997
|
//#endregion
|
|
1998
1998
|
//#region src/clientConnections/updateByClient.ts
|
|
1999
|
-
function
|
|
1999
|
+
function bn(e) {
|
|
2000
2000
|
return async (t, n, r) => (await e.updateTable("clients").set({
|
|
2001
2001
|
connections: JSON.stringify(r),
|
|
2002
2002
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -2004,7 +2004,7 @@ function gn(e) {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
//#endregion
|
|
2006
2006
|
//#region src/clientConnections/listByConnection.ts
|
|
2007
|
-
function
|
|
2007
|
+
function xn(e) {
|
|
2008
2008
|
return async (t, n) => {
|
|
2009
2009
|
let r = await e.selectFrom("clients").where("clients.tenant_id", "=", t).select(["client_id", "connections"]).execute(), i = [];
|
|
2010
2010
|
for (let e of r) JSON.parse(e.connections || "[]").includes(n) && i.push(e.client_id);
|
|
@@ -2013,7 +2013,7 @@ function _n(e) {
|
|
|
2013
2013
|
}
|
|
2014
2014
|
//#endregion
|
|
2015
2015
|
//#region src/clientConnections/addClientToConnection.ts
|
|
2016
|
-
function
|
|
2016
|
+
function Sn(e) {
|
|
2017
2017
|
return async (t, n, r) => {
|
|
2018
2018
|
let i = await e.selectFrom("clients").where("clients.tenant_id", "=", t).where("clients.client_id", "=", r).select("connections").executeTakeFirst();
|
|
2019
2019
|
if (!i) return !1;
|
|
@@ -2026,7 +2026,7 @@ function vn(e) {
|
|
|
2026
2026
|
}
|
|
2027
2027
|
//#endregion
|
|
2028
2028
|
//#region src/clientConnections/removeClientFromConnection.ts
|
|
2029
|
-
function
|
|
2029
|
+
function Cn(e) {
|
|
2030
2030
|
return async (t, n, r) => {
|
|
2031
2031
|
let i = await e.selectFrom("clients").where("clients.tenant_id", "=", t).where("clients.client_id", "=", r).select("connections").executeTakeFirst();
|
|
2032
2032
|
if (!i) return !1;
|
|
@@ -2039,18 +2039,18 @@ function yn(e) {
|
|
|
2039
2039
|
}
|
|
2040
2040
|
//#endregion
|
|
2041
2041
|
//#region src/clientConnections/index.ts
|
|
2042
|
-
function
|
|
2042
|
+
function wn(e) {
|
|
2043
2043
|
return {
|
|
2044
|
-
listByClient:
|
|
2045
|
-
updateByClient:
|
|
2046
|
-
listByConnection:
|
|
2047
|
-
addClientToConnection:
|
|
2048
|
-
removeClientFromConnection:
|
|
2044
|
+
listByClient: yn(e),
|
|
2045
|
+
updateByClient: bn(e),
|
|
2046
|
+
listByConnection: xn(e),
|
|
2047
|
+
addClientToConnection: Sn(e),
|
|
2048
|
+
removeClientFromConnection: Cn(e)
|
|
2049
2049
|
};
|
|
2050
2050
|
}
|
|
2051
2051
|
//#endregion
|
|
2052
2052
|
//#region src/clientGrants/create.ts
|
|
2053
|
-
function
|
|
2053
|
+
function Tn(e) {
|
|
2054
2054
|
return async (n, r, i) => {
|
|
2055
2055
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = a?.id ?? t(), c = a?.created_at ?? o, u = a?.updated_at ?? a?.created_at ?? o, { scope: d, authorization_details_types: f, ...p } = r, m = {
|
|
2056
2056
|
id: s,
|
|
@@ -2078,7 +2078,7 @@ function xn(e) {
|
|
|
2078
2078
|
}
|
|
2079
2079
|
//#endregion
|
|
2080
2080
|
//#region src/clientGrants/get.ts
|
|
2081
|
-
function
|
|
2081
|
+
function En(e) {
|
|
2082
2082
|
return async (t, n) => {
|
|
2083
2083
|
let r = await e.selectFrom("client_grants").selectAll().where("client_grants.tenant_id", "=", t).where("client_grants.id", "=", n).executeTakeFirst();
|
|
2084
2084
|
return r ? l({
|
|
@@ -2098,8 +2098,8 @@ function Sn(e) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
//#endregion
|
|
2100
2100
|
//#region src/clientGrants/list.ts
|
|
2101
|
-
function
|
|
2102
|
-
return
|
|
2101
|
+
function Dn(e) {
|
|
2102
|
+
return _.parse(l({
|
|
2103
2103
|
...e,
|
|
2104
2104
|
scope: e.scope ? JSON.parse(e.scope) : [],
|
|
2105
2105
|
allow_any_organization: !!e.allow_any_organization,
|
|
@@ -2107,7 +2107,7 @@ function Cn(e) {
|
|
|
2107
2107
|
authorization_details_types: e.authorization_details_types ? JSON.parse(e.authorization_details_types) : []
|
|
2108
2108
|
}));
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2110
|
+
function On(e) {
|
|
2111
2111
|
return async (t, n = {}) => {
|
|
2112
2112
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, q: s, sort: c } = n, l = e.selectFrom("client_grants").where("client_grants.tenant_id", "=", t);
|
|
2113
2113
|
if (s) {
|
|
@@ -2120,11 +2120,11 @@ function wn(e) {
|
|
|
2120
2120
|
} else l = l.where(o, t ? "!=" : "=", a);
|
|
2121
2121
|
} else l = O(e, l, t, []);
|
|
2122
2122
|
}
|
|
2123
|
-
if (
|
|
2124
|
-
let { rows: e, limit: t, next: r } = await
|
|
2123
|
+
if (N(n)) {
|
|
2124
|
+
let { rows: e, limit: t, next: r } = await P(l.selectAll(), n, {
|
|
2125
2125
|
sortColumn: "created_at",
|
|
2126
2126
|
sortOrder: "desc"
|
|
2127
|
-
}), i = e.map(
|
|
2127
|
+
}), i = e.map(Dn);
|
|
2128
2128
|
return {
|
|
2129
2129
|
client_grants: i,
|
|
2130
2130
|
start: 0,
|
|
@@ -2138,7 +2138,7 @@ function wn(e) {
|
|
|
2138
2138
|
let { ref: t } = e.dynamic;
|
|
2139
2139
|
u = u.orderBy(t(c.sort_by), c.sort_order);
|
|
2140
2140
|
} else u = u.orderBy("client_grants.created_at", "desc");
|
|
2141
|
-
let d = (await u.selectAll().limit(i).offset(r * i).execute()).map(
|
|
2141
|
+
let d = (await u.selectAll().limit(i).offset(r * i).execute()).map(Dn);
|
|
2142
2142
|
if (!a) return {
|
|
2143
2143
|
client_grants: d,
|
|
2144
2144
|
start: 0,
|
|
@@ -2156,12 +2156,12 @@ function wn(e) {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
//#endregion
|
|
2158
2158
|
//#region src/clientGrants/remove.ts
|
|
2159
|
-
function
|
|
2159
|
+
function kn(e) {
|
|
2160
2160
|
return async (t, n) => ((await e.deleteFrom("client_grants").where("client_grants.tenant_id", "=", t).where("client_grants.id", "=", n).executeTakeFirst()).numDeletedRows ?? 0n) > 0n;
|
|
2161
2161
|
}
|
|
2162
2162
|
//#endregion
|
|
2163
2163
|
//#region src/clientGrants/update.ts
|
|
2164
|
-
function
|
|
2164
|
+
function An(e) {
|
|
2165
2165
|
return async (t, n, r) => {
|
|
2166
2166
|
let i = (/* @__PURE__ */ new Date()).toISOString(), { scope: a, authorization_details_types: o, ...s } = r, c = {
|
|
2167
2167
|
...s,
|
|
@@ -2172,18 +2172,18 @@ function En(e) {
|
|
|
2172
2172
|
}
|
|
2173
2173
|
//#endregion
|
|
2174
2174
|
//#region src/clientGrants/index.ts
|
|
2175
|
-
function
|
|
2175
|
+
function jn(e) {
|
|
2176
2176
|
return {
|
|
2177
|
-
create:
|
|
2178
|
-
get:
|
|
2179
|
-
list:
|
|
2180
|
-
remove:
|
|
2181
|
-
update:
|
|
2177
|
+
create: Tn(e),
|
|
2178
|
+
get: En(e),
|
|
2179
|
+
list: On(e),
|
|
2180
|
+
remove: kn(e),
|
|
2181
|
+
update: An(e)
|
|
2182
2182
|
};
|
|
2183
2183
|
}
|
|
2184
2184
|
//#endregion
|
|
2185
2185
|
//#region src/clientRegistrationTokens/create.ts
|
|
2186
|
-
function
|
|
2186
|
+
function Mn(e) {
|
|
2187
2187
|
return async (t, n) => {
|
|
2188
2188
|
let r = Date.now();
|
|
2189
2189
|
return await e.insertInto("client_registration_tokens").values({
|
|
@@ -2214,12 +2214,12 @@ function On(e) {
|
|
|
2214
2214
|
}
|
|
2215
2215
|
//#endregion
|
|
2216
2216
|
//#region src/clientRegistrationTokens/row-mapper.ts
|
|
2217
|
-
function
|
|
2218
|
-
let t =
|
|
2217
|
+
function Nn(e) {
|
|
2218
|
+
let t = v.safeParse(e);
|
|
2219
2219
|
if (!t.success) throw Error(`Unknown client_registration_tokens.type: ${e}`);
|
|
2220
2220
|
return t.data;
|
|
2221
2221
|
}
|
|
2222
|
-
function
|
|
2222
|
+
function Pn(e) {
|
|
2223
2223
|
if (!e) return;
|
|
2224
2224
|
let t;
|
|
2225
2225
|
try {
|
|
@@ -2227,16 +2227,16 @@ function An(e) {
|
|
|
2227
2227
|
} catch {
|
|
2228
2228
|
return;
|
|
2229
2229
|
}
|
|
2230
|
-
return
|
|
2230
|
+
return ie(t) ? t : void 0;
|
|
2231
2231
|
}
|
|
2232
2232
|
function R(e) {
|
|
2233
2233
|
return {
|
|
2234
2234
|
id: e.id,
|
|
2235
2235
|
token_hash: e.token_hash,
|
|
2236
|
-
type:
|
|
2236
|
+
type: Nn(e.type),
|
|
2237
2237
|
client_id: e.client_id ?? void 0,
|
|
2238
2238
|
sub: e.sub ?? void 0,
|
|
2239
|
-
constraints:
|
|
2239
|
+
constraints: Pn(e.constraints),
|
|
2240
2240
|
single_use: !!e.single_use,
|
|
2241
2241
|
expires_at: i(e.expires_at_ts),
|
|
2242
2242
|
used_at: i(e.used_at_ts),
|
|
@@ -2246,7 +2246,7 @@ function R(e) {
|
|
|
2246
2246
|
}
|
|
2247
2247
|
//#endregion
|
|
2248
2248
|
//#region src/clientRegistrationTokens/get.ts
|
|
2249
|
-
function
|
|
2249
|
+
function Fn(e) {
|
|
2250
2250
|
return async (t, n) => {
|
|
2251
2251
|
let r = await e.selectFrom("client_registration_tokens").where("tenant_id", "=", t).where("id", "=", n).selectAll().executeTakeFirst();
|
|
2252
2252
|
return r ? R(r) : null;
|
|
@@ -2254,7 +2254,7 @@ function jn(e) {
|
|
|
2254
2254
|
}
|
|
2255
2255
|
//#endregion
|
|
2256
2256
|
//#region src/clientRegistrationTokens/getByHash.ts
|
|
2257
|
-
function
|
|
2257
|
+
function In(e) {
|
|
2258
2258
|
return async (t, n) => {
|
|
2259
2259
|
let r = await e.selectFrom("client_registration_tokens").where("tenant_id", "=", t).where("token_hash", "=", n).selectAll().executeTakeFirst();
|
|
2260
2260
|
return r ? R(r) : null;
|
|
@@ -2262,22 +2262,22 @@ function Mn(e) {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
//#endregion
|
|
2264
2264
|
//#region src/clientRegistrationTokens/listByClient.ts
|
|
2265
|
-
function
|
|
2265
|
+
function Ln(e) {
|
|
2266
2266
|
return async (t, n) => (await e.selectFrom("client_registration_tokens").where("tenant_id", "=", t).where("client_id", "=", n).orderBy("created_at_ts", "desc").selectAll().execute()).map(R);
|
|
2267
2267
|
}
|
|
2268
2268
|
//#endregion
|
|
2269
2269
|
//#region src/clientRegistrationTokens/markUsed.ts
|
|
2270
|
-
function
|
|
2270
|
+
function Rn(e) {
|
|
2271
2271
|
return async (t, n, r) => (await e.updateTable("client_registration_tokens").set({ used_at_ts: s(r) }).where("tenant_id", "=", t).where("id", "=", n).where("used_at_ts", "is", null).executeTakeFirst()).numUpdatedRows > 0;
|
|
2272
2272
|
}
|
|
2273
2273
|
//#endregion
|
|
2274
2274
|
//#region src/clientRegistrationTokens/revoke.ts
|
|
2275
|
-
function
|
|
2275
|
+
function zn(e) {
|
|
2276
2276
|
return async (t, n, r) => (await e.updateTable("client_registration_tokens").set({ revoked_at_ts: s(r) }).where("tenant_id", "=", t).where("id", "=", n).where("revoked_at_ts", "is", null).executeTakeFirst()).numUpdatedRows > 0;
|
|
2277
2277
|
}
|
|
2278
2278
|
//#endregion
|
|
2279
2279
|
//#region src/clientRegistrationTokens/revokeByClient.ts
|
|
2280
|
-
function
|
|
2280
|
+
function Bn(e) {
|
|
2281
2281
|
return async (t, n, r) => {
|
|
2282
2282
|
let i = await e.updateTable("client_registration_tokens").set({ revoked_at_ts: s(r) }).where("tenant_id", "=", t).where("client_id", "=", n).where("revoked_at_ts", "is", null).executeTakeFirst();
|
|
2283
2283
|
return Number(i.numUpdatedRows);
|
|
@@ -2285,26 +2285,26 @@ function In(e) {
|
|
|
2285
2285
|
}
|
|
2286
2286
|
//#endregion
|
|
2287
2287
|
//#region src/clientRegistrationTokens/remove.ts
|
|
2288
|
-
function
|
|
2288
|
+
function Vn(e) {
|
|
2289
2289
|
return async (t, n) => (await e.deleteFrom("client_registration_tokens").where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
2290
2290
|
}
|
|
2291
2291
|
//#endregion
|
|
2292
2292
|
//#region src/clientRegistrationTokens/index.ts
|
|
2293
|
-
function
|
|
2293
|
+
function Hn(e) {
|
|
2294
2294
|
return {
|
|
2295
|
-
create:
|
|
2296
|
-
get:
|
|
2297
|
-
getByHash:
|
|
2298
|
-
listByClient:
|
|
2299
|
-
markUsed:
|
|
2300
|
-
revoke:
|
|
2301
|
-
revokeByClient:
|
|
2302
|
-
remove:
|
|
2295
|
+
create: Mn(e),
|
|
2296
|
+
get: Fn(e),
|
|
2297
|
+
getByHash: In(e),
|
|
2298
|
+
listByClient: Ln(e),
|
|
2299
|
+
markUsed: Rn(e),
|
|
2300
|
+
revoke: zn(e),
|
|
2301
|
+
revokeByClient: Bn(e),
|
|
2302
|
+
remove: Vn(e)
|
|
2303
2303
|
};
|
|
2304
2304
|
}
|
|
2305
2305
|
//#endregion
|
|
2306
2306
|
//#region src/keys/list.ts
|
|
2307
|
-
function
|
|
2307
|
+
function Un(e) {
|
|
2308
2308
|
return async (t = {}) => {
|
|
2309
2309
|
let { page: n = 0, per_page: r = 100, include_totals: i = !1, sort: a, q: s } = t, c = e.selectFrom("keys").where((e) => e.or([e("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()), e("revoked_at", "is", null)]));
|
|
2310
2310
|
s && (c = O(e, c, s, [
|
|
@@ -2333,7 +2333,7 @@ function zn(e) {
|
|
|
2333
2333
|
}
|
|
2334
2334
|
//#endregion
|
|
2335
2335
|
//#region src/keys/create.ts
|
|
2336
|
-
function
|
|
2336
|
+
function Wn(e) {
|
|
2337
2337
|
return async (t, n) => {
|
|
2338
2338
|
let r = n?.importMetadata;
|
|
2339
2339
|
await e.insertInto("keys").values({
|
|
@@ -2345,21 +2345,21 @@ function Bn(e) {
|
|
|
2345
2345
|
}
|
|
2346
2346
|
//#endregion
|
|
2347
2347
|
//#region src/keys/update.ts
|
|
2348
|
-
function
|
|
2348
|
+
function Gn(e) {
|
|
2349
2349
|
return async (t, n) => !!(await e.updateTable("keys").set(n).where("kid", "=", t).execute()).length;
|
|
2350
2350
|
}
|
|
2351
2351
|
//#endregion
|
|
2352
2352
|
//#region src/keys/index.ts
|
|
2353
|
-
function
|
|
2353
|
+
function Kn(e) {
|
|
2354
2354
|
return {
|
|
2355
|
-
create:
|
|
2356
|
-
list:
|
|
2357
|
-
update:
|
|
2355
|
+
create: Wn(e),
|
|
2356
|
+
list: Un(e),
|
|
2357
|
+
update: Gn(e)
|
|
2358
2358
|
};
|
|
2359
2359
|
}
|
|
2360
2360
|
//#endregion
|
|
2361
2361
|
//#region src/customDomains/create.ts
|
|
2362
|
-
function
|
|
2362
|
+
function qn(e) {
|
|
2363
2363
|
return async (n, r, i) => {
|
|
2364
2364
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = {
|
|
2365
2365
|
status: "pending",
|
|
@@ -2379,35 +2379,35 @@ function Un(e) {
|
|
|
2379
2379
|
}
|
|
2380
2380
|
//#endregion
|
|
2381
2381
|
//#region src/customDomains/list.ts
|
|
2382
|
-
function
|
|
2382
|
+
function Jn(e) {
|
|
2383
2383
|
return async (t) => (await e.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", t).selectAll().execute()).map((e) => ({
|
|
2384
2384
|
...e,
|
|
2385
2385
|
primary: e.primary === 1,
|
|
2386
|
-
domain_metadata:
|
|
2387
|
-
verification:
|
|
2386
|
+
domain_metadata: I(e.domain_metadata, void 0),
|
|
2387
|
+
verification: I(e.verification, void 0)
|
|
2388
2388
|
}));
|
|
2389
2389
|
}
|
|
2390
2390
|
//#endregion
|
|
2391
2391
|
//#region src/customDomains/remove.ts
|
|
2392
|
-
function
|
|
2392
|
+
function Yn(e) {
|
|
2393
2393
|
return async (t, n) => (await e.deleteFrom("custom_domains").where("custom_domains.tenant_id", "=", t).where("custom_domains.custom_domain_id", "=", n).execute()).length > 0;
|
|
2394
2394
|
}
|
|
2395
2395
|
//#endregion
|
|
2396
2396
|
//#region src/customDomains/get.ts
|
|
2397
|
-
function
|
|
2397
|
+
function Xn(e) {
|
|
2398
2398
|
return async (t, n) => {
|
|
2399
2399
|
let r = await e.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", t).where("custom_domains.custom_domain_id", "=", n).selectAll().executeTakeFirst();
|
|
2400
2400
|
return r ? {
|
|
2401
2401
|
...r,
|
|
2402
2402
|
primary: r.primary === 1,
|
|
2403
|
-
domain_metadata:
|
|
2404
|
-
verification:
|
|
2403
|
+
domain_metadata: I(r.domain_metadata, void 0),
|
|
2404
|
+
verification: I(r.verification, void 0)
|
|
2405
2405
|
} : null;
|
|
2406
2406
|
};
|
|
2407
2407
|
}
|
|
2408
2408
|
//#endregion
|
|
2409
2409
|
//#region src/customDomains/update.ts
|
|
2410
|
-
function
|
|
2410
|
+
function Zn(e) {
|
|
2411
2411
|
return async (t, n, r) => {
|
|
2412
2412
|
let { verification: i, domain_metadata: a, primary: o, ...s } = r, c = {
|
|
2413
2413
|
...s,
|
|
@@ -2421,31 +2421,31 @@ function qn(e) {
|
|
|
2421
2421
|
}
|
|
2422
2422
|
//#endregion
|
|
2423
2423
|
//#region src/customDomains/getByDomain.ts
|
|
2424
|
-
function
|
|
2424
|
+
function Qn(e) {
|
|
2425
2425
|
return async (t) => {
|
|
2426
2426
|
let n = await e.selectFrom("custom_domains").where("custom_domains.domain", "=", t).selectAll().executeTakeFirst();
|
|
2427
2427
|
return n ? {
|
|
2428
2428
|
...n,
|
|
2429
2429
|
primary: n.primary === 1,
|
|
2430
|
-
domain_metadata:
|
|
2430
|
+
domain_metadata: I(n.domain_metadata, void 0)
|
|
2431
2431
|
} : null;
|
|
2432
2432
|
};
|
|
2433
2433
|
}
|
|
2434
2434
|
//#endregion
|
|
2435
2435
|
//#region src/customDomains/index.ts
|
|
2436
|
-
function
|
|
2436
|
+
function $n(e) {
|
|
2437
2437
|
return {
|
|
2438
|
-
create:
|
|
2439
|
-
get:
|
|
2440
|
-
getByDomain:
|
|
2441
|
-
list:
|
|
2442
|
-
remove:
|
|
2443
|
-
update:
|
|
2438
|
+
create: qn(e),
|
|
2439
|
+
get: Xn(e),
|
|
2440
|
+
getByDomain: Qn(e),
|
|
2441
|
+
list: Jn(e),
|
|
2442
|
+
remove: Yn(e),
|
|
2443
|
+
update: Zn(e)
|
|
2444
2444
|
};
|
|
2445
2445
|
}
|
|
2446
2446
|
//#endregion
|
|
2447
2447
|
//#region src/branding/get.ts
|
|
2448
|
-
function
|
|
2448
|
+
function er(e) {
|
|
2449
2449
|
return async (t) => {
|
|
2450
2450
|
let [n] = await e.selectFrom("branding").where("branding.tenant_id", "=", t).selectAll().execute();
|
|
2451
2451
|
if (!n) return null;
|
|
@@ -2467,7 +2467,7 @@ function Xn(e) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
//#endregion
|
|
2469
2469
|
//#region src/branding/set.ts
|
|
2470
|
-
function
|
|
2470
|
+
function tr(e) {
|
|
2471
2471
|
return async (t, n) => {
|
|
2472
2472
|
let { colors: r, font: i, ...a } = n, o = r?.page_background, s = o && typeof o == "object" ? o : void 0;
|
|
2473
2473
|
try {
|
|
@@ -2496,15 +2496,15 @@ function Zn(e) {
|
|
|
2496
2496
|
}
|
|
2497
2497
|
//#endregion
|
|
2498
2498
|
//#region src/branding/index.ts
|
|
2499
|
-
function
|
|
2499
|
+
function nr(e) {
|
|
2500
2500
|
return {
|
|
2501
|
-
get:
|
|
2502
|
-
set:
|
|
2501
|
+
get: er(e),
|
|
2502
|
+
set: tr(e)
|
|
2503
2503
|
};
|
|
2504
2504
|
}
|
|
2505
2505
|
//#endregion
|
|
2506
2506
|
//#region src/universalLoginTemplates/get.ts
|
|
2507
|
-
function
|
|
2507
|
+
function rr(e) {
|
|
2508
2508
|
return async (t) => {
|
|
2509
2509
|
let n = await e.selectFrom("universal_login_templates").select(["body"]).where("tenant_id", "=", t).executeTakeFirst();
|
|
2510
2510
|
return n ? { body: n.body } : null;
|
|
@@ -2512,7 +2512,7 @@ function $n(e) {
|
|
|
2512
2512
|
}
|
|
2513
2513
|
//#endregion
|
|
2514
2514
|
//#region src/universalLoginTemplates/set.ts
|
|
2515
|
-
function
|
|
2515
|
+
function ir(e) {
|
|
2516
2516
|
return async (t, n, r) => {
|
|
2517
2517
|
let i = r?.importMetadata, a = Date.now(), o = i?.created_at ? new Date(i.created_at).getTime() : a, s = i?.updated_at ? new Date(i.updated_at).getTime() : a;
|
|
2518
2518
|
try {
|
|
@@ -2533,23 +2533,23 @@ function er(e) {
|
|
|
2533
2533
|
}
|
|
2534
2534
|
//#endregion
|
|
2535
2535
|
//#region src/universalLoginTemplates/delete.ts
|
|
2536
|
-
function
|
|
2536
|
+
function ar(e) {
|
|
2537
2537
|
return async (t) => {
|
|
2538
2538
|
await e.deleteFrom("universal_login_templates").where("tenant_id", "=", t).execute();
|
|
2539
2539
|
};
|
|
2540
2540
|
}
|
|
2541
2541
|
//#endregion
|
|
2542
2542
|
//#region src/universalLoginTemplates/index.ts
|
|
2543
|
-
function
|
|
2543
|
+
function or(e) {
|
|
2544
2544
|
return {
|
|
2545
|
-
get:
|
|
2546
|
-
set:
|
|
2547
|
-
delete:
|
|
2545
|
+
get: rr(e),
|
|
2546
|
+
set: ir(e),
|
|
2547
|
+
delete: ar(e)
|
|
2548
2548
|
};
|
|
2549
2549
|
}
|
|
2550
2550
|
//#endregion
|
|
2551
2551
|
//#region src/hooks/list.ts
|
|
2552
|
-
function
|
|
2552
|
+
function sr(e) {
|
|
2553
2553
|
return async (t, n = {}) => {
|
|
2554
2554
|
let { page: i = 0, per_page: a = 50, include_totals: s = !1, sort: c, q: u } = n, d = e.selectFrom("hooks").where("hooks.tenant_id", "=", t);
|
|
2555
2555
|
if (u && (d = O(e, d, u, [
|
|
@@ -2571,7 +2571,7 @@ function rr(e) {
|
|
|
2571
2571
|
...u,
|
|
2572
2572
|
enabled: !!n,
|
|
2573
2573
|
synchronous: !!i,
|
|
2574
|
-
metadata:
|
|
2574
|
+
metadata: pt(s)
|
|
2575
2575
|
});
|
|
2576
2576
|
});
|
|
2577
2577
|
if (!s) return {
|
|
@@ -2591,7 +2591,7 @@ function rr(e) {
|
|
|
2591
2591
|
}
|
|
2592
2592
|
//#endregion
|
|
2593
2593
|
//#region src/hooks/get.ts
|
|
2594
|
-
function
|
|
2594
|
+
function cr(e) {
|
|
2595
2595
|
return async (t, n) => {
|
|
2596
2596
|
let i = await e.selectFrom("hooks").where("hooks.tenant_id", "=", t).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
|
|
2597
2597
|
if (!i) return null;
|
|
@@ -2604,20 +2604,20 @@ function ir(e) {
|
|
|
2604
2604
|
...d,
|
|
2605
2605
|
enabled: !!u.enabled,
|
|
2606
2606
|
synchronous: !!u.synchronous,
|
|
2607
|
-
metadata:
|
|
2607
|
+
metadata: pt(c)
|
|
2608
2608
|
});
|
|
2609
2609
|
};
|
|
2610
2610
|
}
|
|
2611
2611
|
//#endregion
|
|
2612
2612
|
//#region src/hooks/remove.ts
|
|
2613
|
-
function
|
|
2613
|
+
function lr(e) {
|
|
2614
2614
|
return async (t, n) => (await e.deleteFrom("hooks").where("hooks.tenant_id", "=", t).where("hooks.hook_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
2615
2615
|
}
|
|
2616
2616
|
//#endregion
|
|
2617
2617
|
//#region src/hooks/create.ts
|
|
2618
|
-
function
|
|
2618
|
+
function ur(e) {
|
|
2619
2619
|
return async (t, n, r) => {
|
|
2620
|
-
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = i?.created_at ?? a, s = i?.updated_at ?? a, c = i?.id ?? (n.hook_id ||
|
|
2620
|
+
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = i?.created_at ?? a, s = i?.updated_at ?? a, c = i?.id ?? (n.hook_id || Ee()), { hook_id: l, enabled: u, synchronous: d, metadata: f, ...p } = n;
|
|
2621
2621
|
return await e.insertInto("hooks").values({
|
|
2622
2622
|
...p,
|
|
2623
2623
|
hook_id: c,
|
|
@@ -2640,7 +2640,7 @@ function or(e) {
|
|
|
2640
2640
|
}
|
|
2641
2641
|
//#endregion
|
|
2642
2642
|
//#region src/hooks/update.ts
|
|
2643
|
-
function
|
|
2643
|
+
function dr(e) {
|
|
2644
2644
|
return async (t, n, r) => {
|
|
2645
2645
|
let { hook_id: i, metadata: a, ...o } = r, s = {
|
|
2646
2646
|
...o,
|
|
@@ -2654,20 +2654,20 @@ function sr(e) {
|
|
|
2654
2654
|
}
|
|
2655
2655
|
//#endregion
|
|
2656
2656
|
//#region src/hooks/index.ts
|
|
2657
|
-
function
|
|
2657
|
+
function fr(e) {
|
|
2658
2658
|
return {
|
|
2659
|
-
create:
|
|
2660
|
-
get:
|
|
2661
|
-
list:
|
|
2662
|
-
update:
|
|
2663
|
-
remove:
|
|
2659
|
+
create: ur(e),
|
|
2660
|
+
get: cr(e),
|
|
2661
|
+
list: sr(e),
|
|
2662
|
+
update: dr(e),
|
|
2663
|
+
remove: lr(e)
|
|
2664
2664
|
};
|
|
2665
2665
|
}
|
|
2666
2666
|
//#endregion
|
|
2667
2667
|
//#region src/hook-code/create.ts
|
|
2668
|
-
function
|
|
2668
|
+
function pr(e) {
|
|
2669
2669
|
return async (t, n, r) => {
|
|
2670
|
-
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = i?.created_at ?? a, s = i?.updated_at ?? a, c = i?.id ??
|
|
2670
|
+
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = i?.created_at ?? a, s = i?.updated_at ?? a, c = i?.id ?? Oe();
|
|
2671
2671
|
return await e.insertInto("hook_code").values({
|
|
2672
2672
|
id: c,
|
|
2673
2673
|
tenant_id: t,
|
|
@@ -2687,7 +2687,7 @@ function lr(e) {
|
|
|
2687
2687
|
}
|
|
2688
2688
|
//#endregion
|
|
2689
2689
|
//#region src/hook-code/get.ts
|
|
2690
|
-
function
|
|
2690
|
+
function mr(e) {
|
|
2691
2691
|
return async (t, n) => {
|
|
2692
2692
|
let i = await e.selectFrom("hook_code").where("hook_code.tenant_id", "=", t).where("hook_code.id", "=", n).selectAll().executeTakeFirst();
|
|
2693
2693
|
if (!i) return null;
|
|
@@ -2711,7 +2711,7 @@ function ur(e) {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
//#endregion
|
|
2713
2713
|
//#region src/hook-code/update.ts
|
|
2714
|
-
function
|
|
2714
|
+
function hr(e) {
|
|
2715
2715
|
return async (t, n, r) => {
|
|
2716
2716
|
let i = { updated_at_ts: Date.now() };
|
|
2717
2717
|
return r.code !== void 0 && (i.code = r.code), r.secrets !== void 0 && (i.secrets = JSON.stringify(r.secrets)), (await e.updateTable("hook_code").set(i).where("hook_code.id", "=", n).where("hook_code.tenant_id", "=", t).executeTakeFirst()).numUpdatedRows > 0;
|
|
@@ -2719,22 +2719,22 @@ function dr(e) {
|
|
|
2719
2719
|
}
|
|
2720
2720
|
//#endregion
|
|
2721
2721
|
//#region src/hook-code/remove.ts
|
|
2722
|
-
function
|
|
2722
|
+
function gr(e) {
|
|
2723
2723
|
return async (t, n) => (await e.deleteFrom("hook_code").where("hook_code.tenant_id", "=", t).where("hook_code.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
2724
2724
|
}
|
|
2725
2725
|
//#endregion
|
|
2726
2726
|
//#region src/hook-code/index.ts
|
|
2727
|
-
function
|
|
2727
|
+
function _r(e) {
|
|
2728
2728
|
return {
|
|
2729
|
-
create:
|
|
2730
|
-
get:
|
|
2731
|
-
update:
|
|
2732
|
-
remove:
|
|
2729
|
+
create: pr(e),
|
|
2730
|
+
get: mr(e),
|
|
2731
|
+
update: hr(e),
|
|
2732
|
+
remove: gr(e)
|
|
2733
2733
|
};
|
|
2734
2734
|
}
|
|
2735
2735
|
//#endregion
|
|
2736
2736
|
//#region src/themes/create.ts
|
|
2737
|
-
function
|
|
2737
|
+
function vr(e) {
|
|
2738
2738
|
return async (n, r, i, a) => {
|
|
2739
2739
|
let o = a?.importMetadata, s = (/* @__PURE__ */ new Date()).toISOString(), c = {
|
|
2740
2740
|
themeId: o?.id || i || t(),
|
|
@@ -2745,20 +2745,20 @@ function mr(e) {
|
|
|
2745
2745
|
...c,
|
|
2746
2746
|
tenant_id: n
|
|
2747
2747
|
};
|
|
2748
|
-
return await e.insertInto("themes").values(
|
|
2748
|
+
return await e.insertInto("themes").values(F(l)).execute(), c;
|
|
2749
2749
|
};
|
|
2750
2750
|
}
|
|
2751
2751
|
//#endregion
|
|
2752
2752
|
//#region src/themes/remove.ts
|
|
2753
|
-
function
|
|
2753
|
+
function yr(e) {
|
|
2754
2754
|
return async (t, n) => (await e.deleteFrom("themes").where("themes.tenant_id", "=", t).where("themes.themeId", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
2755
2755
|
}
|
|
2756
2756
|
//#endregion
|
|
2757
2757
|
//#region src/themes/get.ts
|
|
2758
|
-
function
|
|
2758
|
+
function br(e) {
|
|
2759
2759
|
return async (t, n) => {
|
|
2760
2760
|
let r = await e.selectFrom("themes").where("themes.tenant_id", "=", t).where("themes.themeId", "=", n).selectAll().executeTakeFirst();
|
|
2761
|
-
return r ? l(
|
|
2761
|
+
return r ? l(at({
|
|
2762
2762
|
...r,
|
|
2763
2763
|
borders_show_widget_shadow: !!r.borders_show_widget_shadow,
|
|
2764
2764
|
fonts_body_text_bold: !!r.fonts_body_text_bold,
|
|
@@ -2778,9 +2778,9 @@ function gr(e) {
|
|
|
2778
2778
|
}
|
|
2779
2779
|
//#endregion
|
|
2780
2780
|
//#region src/themes/update.ts
|
|
2781
|
-
function
|
|
2781
|
+
function xr(e) {
|
|
2782
2782
|
return async (t, n, r) => {
|
|
2783
|
-
let { themeId: i, ...a } = r, o =
|
|
2783
|
+
let { themeId: i, ...a } = r, o = F({
|
|
2784
2784
|
...a,
|
|
2785
2785
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2786
2786
|
});
|
|
@@ -2789,17 +2789,17 @@ function _r(e) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
//#endregion
|
|
2791
2791
|
//#region src/themes/index.ts
|
|
2792
|
-
function
|
|
2792
|
+
function Sr(e) {
|
|
2793
2793
|
return {
|
|
2794
|
-
create:
|
|
2795
|
-
get:
|
|
2796
|
-
remove:
|
|
2797
|
-
update:
|
|
2794
|
+
create: vr(e),
|
|
2795
|
+
get: br(e),
|
|
2796
|
+
remove: yr(e),
|
|
2797
|
+
update: xr(e)
|
|
2798
2798
|
};
|
|
2799
2799
|
}
|
|
2800
2800
|
//#endregion
|
|
2801
2801
|
//#region src/loginSessions/get.ts
|
|
2802
|
-
function
|
|
2802
|
+
function Cr(e) {
|
|
2803
2803
|
return async (t, n) => {
|
|
2804
2804
|
let i = await e.selectFrom("login_sessions").where("login_sessions.id", "=", n).selectAll().executeTakeFirst();
|
|
2805
2805
|
if (!i) return null;
|
|
@@ -2811,40 +2811,40 @@ function yr(e) {
|
|
|
2811
2811
|
"created_at_ts",
|
|
2812
2812
|
"updated_at_ts",
|
|
2813
2813
|
"expires_at_ts"
|
|
2814
|
-
]), f =
|
|
2814
|
+
]), f = at(l({
|
|
2815
2815
|
...u,
|
|
2816
2816
|
...d,
|
|
2817
2817
|
state: i.state || p.PENDING,
|
|
2818
2818
|
state_data: i.state_data,
|
|
2819
2819
|
failure_reason: i.failure_reason
|
|
2820
2820
|
}), ["auth_strategy"]);
|
|
2821
|
-
return f.authParams = typeof c == "string" && c.length > 0 ? JSON.parse(c) : {},
|
|
2821
|
+
return f.authParams = typeof c == "string" && c.length > 0 ? JSON.parse(c) : {}, ae.parse(f);
|
|
2822
2822
|
};
|
|
2823
2823
|
}
|
|
2824
2824
|
//#endregion
|
|
2825
2825
|
//#region src/utils/ulid.ts
|
|
2826
|
-
var
|
|
2827
|
-
function
|
|
2826
|
+
var wr = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", z = 32, Tr = 10, Er = 16;
|
|
2827
|
+
function Dr(e) {
|
|
2828
2828
|
let t = "";
|
|
2829
|
-
for (let n =
|
|
2829
|
+
for (let n = Tr; n > 0; n--) t = wr.charAt(e % z) + t, e = Math.floor(e / z);
|
|
2830
2830
|
return t;
|
|
2831
2831
|
}
|
|
2832
|
-
function
|
|
2833
|
-
let e = new Uint8Array(
|
|
2832
|
+
function Or() {
|
|
2833
|
+
let e = new Uint8Array(Er);
|
|
2834
2834
|
crypto.getRandomValues(e);
|
|
2835
2835
|
let t = "";
|
|
2836
|
-
for (let n = 0; n <
|
|
2836
|
+
for (let n = 0; n < Er; n++) t += wr.charAt(e[n] % z);
|
|
2837
2837
|
return t;
|
|
2838
2838
|
}
|
|
2839
|
-
function
|
|
2840
|
-
return
|
|
2839
|
+
function kr() {
|
|
2840
|
+
return Dr(Date.now()) + Or();
|
|
2841
2841
|
}
|
|
2842
2842
|
//#endregion
|
|
2843
2843
|
//#region src/loginSessions/create.ts
|
|
2844
|
-
function
|
|
2844
|
+
function Ar(e) {
|
|
2845
2845
|
return async (t, n) => {
|
|
2846
2846
|
let r = c(), i = {
|
|
2847
|
-
id:
|
|
2847
|
+
id: kr(),
|
|
2848
2848
|
...n,
|
|
2849
2849
|
authorization_url: n.authorization_url?.slice(0, 1024),
|
|
2850
2850
|
created_at: r,
|
|
@@ -2852,7 +2852,7 @@ function Er(e) {
|
|
|
2852
2852
|
state: n.state || p.PENDING,
|
|
2853
2853
|
state_data: n.state_data,
|
|
2854
2854
|
failure_reason: n.failure_reason
|
|
2855
|
-
}, { authParams: a, ...o } = i, s = Date.now(), l =
|
|
2855
|
+
}, { authParams: a, ...o } = i, s = Date.now(), l = F(o);
|
|
2856
2856
|
return delete l.created_at, delete l.updated_at, delete l.expires_at, await e.insertInto("login_sessions").values({
|
|
2857
2857
|
...l,
|
|
2858
2858
|
tenant_id: t,
|
|
@@ -2865,7 +2865,7 @@ function Er(e) {
|
|
|
2865
2865
|
}
|
|
2866
2866
|
//#endregion
|
|
2867
2867
|
//#region src/loginSessions/update.ts
|
|
2868
|
-
function
|
|
2868
|
+
function jr(e) {
|
|
2869
2869
|
return async (t, n, r) => {
|
|
2870
2870
|
let { created_at: i, updated_at: a, expires_at: o, authParams: c, ...l } = r, u = {};
|
|
2871
2871
|
if (c !== void 0) {
|
|
@@ -2875,7 +2875,7 @@ function Dr(e) {
|
|
|
2875
2875
|
...c
|
|
2876
2876
|
}) };
|
|
2877
2877
|
}
|
|
2878
|
-
let d =
|
|
2878
|
+
let d = F(l);
|
|
2879
2879
|
return delete d.created_at_ts, delete d.updated_at_ts, delete d.expires_at_ts, delete d.id, delete d.tenant_id, (await e.updateTable("login_sessions").set({
|
|
2880
2880
|
...d,
|
|
2881
2881
|
...u,
|
|
@@ -2886,22 +2886,22 @@ function Dr(e) {
|
|
|
2886
2886
|
}
|
|
2887
2887
|
//#endregion
|
|
2888
2888
|
//#region src/loginSessions/remove.ts
|
|
2889
|
-
function
|
|
2889
|
+
function Mr(e) {
|
|
2890
2890
|
return async (t, n) => (await e.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", t).where("login_sessions.id", "=", n).execute()).length > 0;
|
|
2891
2891
|
}
|
|
2892
2892
|
//#endregion
|
|
2893
2893
|
//#region src/loginSessions/index.ts
|
|
2894
|
-
function
|
|
2894
|
+
function Nr(e) {
|
|
2895
2895
|
return {
|
|
2896
|
-
create:
|
|
2897
|
-
get:
|
|
2898
|
-
update:
|
|
2899
|
-
remove:
|
|
2896
|
+
create: Ar(e),
|
|
2897
|
+
get: Cr(e),
|
|
2898
|
+
update: jr(e),
|
|
2899
|
+
remove: Mr(e)
|
|
2900
2900
|
};
|
|
2901
2901
|
}
|
|
2902
2902
|
//#endregion
|
|
2903
2903
|
//#region src/promptSettings/get.ts
|
|
2904
|
-
function
|
|
2904
|
+
function Pr(e) {
|
|
2905
2905
|
return async (t) => {
|
|
2906
2906
|
let [n] = await e.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", t).selectAll().execute();
|
|
2907
2907
|
return l({
|
|
@@ -2915,13 +2915,13 @@ function Ar(e) {
|
|
|
2915
2915
|
}
|
|
2916
2916
|
//#endregion
|
|
2917
2917
|
//#region src/promptSettings/set.ts
|
|
2918
|
-
function
|
|
2918
|
+
function Fr(e) {
|
|
2919
2919
|
let t = {};
|
|
2920
2920
|
return typeof e.identifier_first == "boolean" && (t.identifier_first = +!!e.identifier_first), typeof e.password_first == "boolean" && (t.password_first = +!!e.password_first), typeof e.webauthn_platform_first_factor == "boolean" && (t.webauthn_platform_first_factor = +!!e.webauthn_platform_first_factor), typeof e.show_last_used_connection == "boolean" && (t.show_last_used_connection = +!!e.show_last_used_connection), e.universal_login_experience && (t.universal_login_experience = e.universal_login_experience), t;
|
|
2921
2921
|
}
|
|
2922
|
-
function
|
|
2922
|
+
function Ir(e) {
|
|
2923
2923
|
return async (t, n) => {
|
|
2924
|
-
let r =
|
|
2924
|
+
let r = Fr(n);
|
|
2925
2925
|
try {
|
|
2926
2926
|
await e.insertInto("prompt_settings").values({
|
|
2927
2927
|
tenant_id: t,
|
|
@@ -2939,15 +2939,15 @@ function Mr(e) {
|
|
|
2939
2939
|
}
|
|
2940
2940
|
//#endregion
|
|
2941
2941
|
//#region src/promptSettings/index.ts
|
|
2942
|
-
function
|
|
2942
|
+
function Lr(e) {
|
|
2943
2943
|
return {
|
|
2944
|
-
get:
|
|
2945
|
-
set:
|
|
2944
|
+
get: Pr(e),
|
|
2945
|
+
set: Ir(e)
|
|
2946
2946
|
};
|
|
2947
2947
|
}
|
|
2948
2948
|
//#endregion
|
|
2949
2949
|
//#region src/emailProvideres/get.ts
|
|
2950
|
-
function
|
|
2950
|
+
function Rr(e) {
|
|
2951
2951
|
return async (t) => {
|
|
2952
2952
|
let [n] = await e.selectFrom("email_providers").where("email_providers.tenant_id", "=", t).selectAll().execute();
|
|
2953
2953
|
if (!n) return null;
|
|
@@ -2962,7 +2962,7 @@ function Pr(e) {
|
|
|
2962
2962
|
}
|
|
2963
2963
|
//#endregion
|
|
2964
2964
|
//#region src/emailProvideres/update.ts
|
|
2965
|
-
function
|
|
2965
|
+
function zr(e) {
|
|
2966
2966
|
return async (t, n) => {
|
|
2967
2967
|
let { credentials: r, settings: i, enabled: a, ...o } = n;
|
|
2968
2968
|
await e.updateTable("email_providers").set({
|
|
@@ -2975,7 +2975,7 @@ function Fr(e) {
|
|
|
2975
2975
|
}
|
|
2976
2976
|
//#endregion
|
|
2977
2977
|
//#region src/emailProvideres/create.ts
|
|
2978
|
-
function
|
|
2978
|
+
function Br(e) {
|
|
2979
2979
|
return async (t, n, r) => {
|
|
2980
2980
|
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), { credentials: o, settings: s, enabled: c, ...l } = n;
|
|
2981
2981
|
await e.insertInto("email_providers").values({
|
|
@@ -2991,24 +2991,24 @@ function Ir(e) {
|
|
|
2991
2991
|
}
|
|
2992
2992
|
//#endregion
|
|
2993
2993
|
//#region src/emailProvideres/remove.ts
|
|
2994
|
-
function
|
|
2994
|
+
function Vr(e) {
|
|
2995
2995
|
return async (t) => {
|
|
2996
2996
|
await e.deleteFrom("email_providers").where("tenant_id", "=", t).execute();
|
|
2997
2997
|
};
|
|
2998
2998
|
}
|
|
2999
2999
|
//#endregion
|
|
3000
3000
|
//#region src/emailProvideres/index.ts
|
|
3001
|
-
function
|
|
3001
|
+
function Hr(e) {
|
|
3002
3002
|
return {
|
|
3003
|
-
get:
|
|
3004
|
-
create:
|
|
3005
|
-
update:
|
|
3006
|
-
remove:
|
|
3003
|
+
get: Rr(e),
|
|
3004
|
+
create: Br(e),
|
|
3005
|
+
update: zr(e),
|
|
3006
|
+
remove: Vr(e)
|
|
3007
3007
|
};
|
|
3008
3008
|
}
|
|
3009
3009
|
//#endregion
|
|
3010
3010
|
//#region src/emailTemplates/row.ts
|
|
3011
|
-
function
|
|
3011
|
+
function Ur(e) {
|
|
3012
3012
|
let t = {
|
|
3013
3013
|
template: e.template,
|
|
3014
3014
|
body: e.body,
|
|
@@ -3022,20 +3022,20 @@ function zr(e) {
|
|
|
3022
3022
|
}
|
|
3023
3023
|
//#endregion
|
|
3024
3024
|
//#region src/emailTemplates/get.ts
|
|
3025
|
-
function
|
|
3025
|
+
function Wr(e) {
|
|
3026
3026
|
return async (t, n) => {
|
|
3027
3027
|
let r = await e.selectFrom("email_templates").where("tenant_id", "=", t).where("template", "=", n).selectAll().executeTakeFirst();
|
|
3028
|
-
return r ?
|
|
3028
|
+
return r ? te.parse(Ur(r)) : null;
|
|
3029
3029
|
};
|
|
3030
3030
|
}
|
|
3031
3031
|
//#endregion
|
|
3032
3032
|
//#region src/emailTemplates/list.ts
|
|
3033
|
-
function
|
|
3034
|
-
return async (t) => (await e.selectFrom("email_templates").where("tenant_id", "=", t).orderBy("template", "asc").selectAll().execute()).map((e) =>
|
|
3033
|
+
function Gr(e) {
|
|
3034
|
+
return async (t) => (await e.selectFrom("email_templates").where("tenant_id", "=", t).orderBy("template", "asc").selectAll().execute()).map((e) => te.parse(Ur(e)));
|
|
3035
3035
|
}
|
|
3036
3036
|
//#endregion
|
|
3037
3037
|
//#region src/emailTemplates/create.ts
|
|
3038
|
-
function
|
|
3038
|
+
function Kr(e) {
|
|
3039
3039
|
return async (t, n, r) => {
|
|
3040
3040
|
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = i?.created_at ?? a, s = i?.updated_at ?? i?.created_at ?? a;
|
|
3041
3041
|
return await e.insertInto("email_templates").values({
|
|
@@ -3056,7 +3056,7 @@ function Hr(e) {
|
|
|
3056
3056
|
}
|
|
3057
3057
|
//#endregion
|
|
3058
3058
|
//#region src/emailTemplates/update.ts
|
|
3059
|
-
function
|
|
3059
|
+
function qr(e) {
|
|
3060
3060
|
return async (t, n, r) => {
|
|
3061
3061
|
let i = {};
|
|
3062
3062
|
if (r.body !== void 0 && (i.body = r.body), r.from !== void 0 && (i.from = r.from), r.subject !== void 0 && (i.subject = r.subject), r.syntax !== void 0 && (i.syntax = r.syntax), r.resultUrl !== void 0 && (i.result_url = r.resultUrl), r.urlLifetimeInSeconds !== void 0 && (i.url_lifetime_in_seconds = r.urlLifetimeInSeconds), r.includeEmailInRedirect !== void 0 && (i.include_email_in_redirect = +!!r.includeEmailInRedirect), r.enabled !== void 0 && (i.enabled = +!!r.enabled), Object.keys(i).length === 0) return await e.selectFrom("email_templates").where("tenant_id", "=", t).where("template", "=", n).select("template").executeTakeFirst() !== void 0;
|
|
@@ -3067,7 +3067,7 @@ function Ur(e) {
|
|
|
3067
3067
|
}
|
|
3068
3068
|
//#endregion
|
|
3069
3069
|
//#region src/emailTemplates/remove.ts
|
|
3070
|
-
function
|
|
3070
|
+
function Jr(e) {
|
|
3071
3071
|
return async (t, n) => {
|
|
3072
3072
|
let r = await e.deleteFrom("email_templates").where("tenant_id", "=", t).where("template", "=", n).executeTakeFirst();
|
|
3073
3073
|
return Number(r.numDeletedRows ?? 0) > 0;
|
|
@@ -3075,18 +3075,18 @@ function Wr(e) {
|
|
|
3075
3075
|
}
|
|
3076
3076
|
//#endregion
|
|
3077
3077
|
//#region src/emailTemplates/index.ts
|
|
3078
|
-
function
|
|
3078
|
+
function Yr(e) {
|
|
3079
3079
|
return {
|
|
3080
|
-
get:
|
|
3081
|
-
list:
|
|
3082
|
-
create:
|
|
3083
|
-
update:
|
|
3084
|
-
remove:
|
|
3080
|
+
get: Wr(e),
|
|
3081
|
+
list: Gr(e),
|
|
3082
|
+
create: Kr(e),
|
|
3083
|
+
update: qr(e),
|
|
3084
|
+
remove: Jr(e)
|
|
3085
3085
|
};
|
|
3086
3086
|
}
|
|
3087
3087
|
//#endregion
|
|
3088
3088
|
//#region src/refreshTokens/get.ts
|
|
3089
|
-
function
|
|
3089
|
+
function Xr(e) {
|
|
3090
3090
|
return async (t, n) => {
|
|
3091
3091
|
let i = await e.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", t).where("refresh_tokens.id", "=", n).selectAll().executeTakeFirst();
|
|
3092
3092
|
if (!i) return null;
|
|
@@ -3115,7 +3115,7 @@ function Kr(e) {
|
|
|
3115
3115
|
}
|
|
3116
3116
|
//#endregion
|
|
3117
3117
|
//#region src/refreshTokens/getByLookup.ts
|
|
3118
|
-
function
|
|
3118
|
+
function Zr(e) {
|
|
3119
3119
|
return async (t, n) => {
|
|
3120
3120
|
let i = await e.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", t).where("refresh_tokens.token_lookup", "=", n).selectAll().executeTakeFirst();
|
|
3121
3121
|
if (!i) return null;
|
|
@@ -3144,7 +3144,7 @@ function qr(e) {
|
|
|
3144
3144
|
}
|
|
3145
3145
|
//#endregion
|
|
3146
3146
|
//#region src/refreshTokens/create.ts
|
|
3147
|
-
function
|
|
3147
|
+
function Qr(e) {
|
|
3148
3148
|
return async (t, n) => {
|
|
3149
3149
|
let r = c(), i = {
|
|
3150
3150
|
...n,
|
|
@@ -3174,12 +3174,12 @@ function Jr(e) {
|
|
|
3174
3174
|
}
|
|
3175
3175
|
//#endregion
|
|
3176
3176
|
//#region src/refreshTokens/remove.ts
|
|
3177
|
-
function
|
|
3177
|
+
function $r(e) {
|
|
3178
3178
|
return async (t, n) => !!(await e.deleteFrom("refresh_tokens").where("tenant_id", "=", t).where("refresh_tokens.id", "=", n).execute()).length;
|
|
3179
3179
|
}
|
|
3180
3180
|
//#endregion
|
|
3181
3181
|
//#region src/refreshTokens/revokeByLoginSession.ts
|
|
3182
|
-
function
|
|
3182
|
+
function ei(e) {
|
|
3183
3183
|
return async (t, n, r) => {
|
|
3184
3184
|
let i = s(r), a = await e.updateTable("refresh_tokens").set({ revoked_at_ts: i }).where("tenant_id", "=", t).where("login_id", "=", n).where("revoked_at_ts", "is", null).executeTakeFirst();
|
|
3185
3185
|
return Number(a.numUpdatedRows ?? 0);
|
|
@@ -3187,7 +3187,7 @@ function Xr(e) {
|
|
|
3187
3187
|
}
|
|
3188
3188
|
//#endregion
|
|
3189
3189
|
//#region src/refreshTokens/revokeFamily.ts
|
|
3190
|
-
function
|
|
3190
|
+
function ti(e) {
|
|
3191
3191
|
return async (t, n, r) => {
|
|
3192
3192
|
let i = s(r), a = await e.updateTable("refresh_tokens").set({ revoked_at_ts: i }).where("tenant_id", "=", t).where("family_id", "=", n).where("revoked_at_ts", "is", null).executeTakeFirst();
|
|
3193
3193
|
return Number(a.numUpdatedRows ?? 0);
|
|
@@ -3195,7 +3195,7 @@ function Zr(e) {
|
|
|
3195
3195
|
}
|
|
3196
3196
|
//#endregion
|
|
3197
3197
|
//#region src/refreshTokens/update.ts
|
|
3198
|
-
function
|
|
3198
|
+
function ni(e) {
|
|
3199
3199
|
return async (t, n, r, i) => {
|
|
3200
3200
|
let { created_at: a, expires_at: o, idle_expires_at: c, last_exchanged_at: l, revoked_at: u, rotated_at: d, device: f, resource_servers: p, rotating: m, ...h } = r, g = {
|
|
3201
3201
|
...h,
|
|
@@ -3216,7 +3216,7 @@ function Qr(e) {
|
|
|
3216
3216
|
}
|
|
3217
3217
|
//#endregion
|
|
3218
3218
|
//#region src/refreshTokens/list.ts
|
|
3219
|
-
function
|
|
3219
|
+
function ri(e) {
|
|
3220
3220
|
return async (t, n = {}) => {
|
|
3221
3221
|
let { page: i = 0, per_page: a = 50, include_totals: s = !1, sort: c, q: l } = n, u = e.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", t);
|
|
3222
3222
|
l && (u = O(e, u, l, ["token", "login_id"]));
|
|
@@ -3266,24 +3266,24 @@ function $r(e) {
|
|
|
3266
3266
|
}
|
|
3267
3267
|
//#endregion
|
|
3268
3268
|
//#region src/refreshTokens/index.ts
|
|
3269
|
-
function
|
|
3269
|
+
function ii(e) {
|
|
3270
3270
|
return {
|
|
3271
|
-
create:
|
|
3272
|
-
get:
|
|
3273
|
-
getByLookup:
|
|
3274
|
-
list:
|
|
3275
|
-
remove:
|
|
3276
|
-
revokeByLoginSession:
|
|
3277
|
-
revokeFamily:
|
|
3278
|
-
update:
|
|
3271
|
+
create: Qr(e),
|
|
3272
|
+
get: Xr(e),
|
|
3273
|
+
getByLookup: Zr(e),
|
|
3274
|
+
list: ri(e),
|
|
3275
|
+
remove: $r(e),
|
|
3276
|
+
revokeByLoginSession: ei(e),
|
|
3277
|
+
revokeFamily: ti(e),
|
|
3278
|
+
update: ni(e)
|
|
3279
3279
|
};
|
|
3280
3280
|
}
|
|
3281
3281
|
//#endregion
|
|
3282
3282
|
//#region src/cleanup.ts
|
|
3283
|
-
var
|
|
3284
|
-
function
|
|
3283
|
+
var ai = 10080 * 60 * 1e3;
|
|
3284
|
+
function oi(e) {
|
|
3285
3285
|
return async (t) => {
|
|
3286
|
-
let { tenant_id: n, user_id: r } = t || {}, i = Date.now() -
|
|
3286
|
+
let { tenant_id: n, user_id: r } = t || {}, i = Date.now() - ai, a = 1e3;
|
|
3287
3287
|
try {
|
|
3288
3288
|
let t = 0;
|
|
3289
3289
|
for (;;) {
|
|
@@ -3314,7 +3314,7 @@ function ni(e) {
|
|
|
3314
3314
|
}
|
|
3315
3315
|
//#endregion
|
|
3316
3316
|
//#region src/forms/create.ts
|
|
3317
|
-
function
|
|
3317
|
+
function si(e) {
|
|
3318
3318
|
return async (n, r, i) => {
|
|
3319
3319
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = x.parse({
|
|
3320
3320
|
id: a?.id ?? t(),
|
|
@@ -3333,7 +3333,7 @@ function ri(e) {
|
|
|
3333
3333
|
}
|
|
3334
3334
|
//#endregion
|
|
3335
3335
|
//#region src/forms/list.ts
|
|
3336
|
-
function
|
|
3336
|
+
function ci(e) {
|
|
3337
3337
|
return async (t, n = {}) => {
|
|
3338
3338
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, q: s } = n, c = e.selectFrom("forms").where("tenant_id", "=", t);
|
|
3339
3339
|
s && (c = O(e, c, s, []));
|
|
@@ -3367,7 +3367,7 @@ function ii(e) {
|
|
|
3367
3367
|
}
|
|
3368
3368
|
//#endregion
|
|
3369
3369
|
//#region src/forms/remove.ts
|
|
3370
|
-
function
|
|
3370
|
+
function li(e) {
|
|
3371
3371
|
return async (t, n) => {
|
|
3372
3372
|
let { numDeletedRows: r } = await e.deleteFrom("forms").where("id", "=", n).where("tenant_id", "=", t).executeTakeFirst();
|
|
3373
3373
|
return r > 0;
|
|
@@ -3375,7 +3375,7 @@ function ai(e) {
|
|
|
3375
3375
|
}
|
|
3376
3376
|
//#endregion
|
|
3377
3377
|
//#region src/forms/get.ts
|
|
3378
|
-
function
|
|
3378
|
+
function ui(e) {
|
|
3379
3379
|
return async (t, n) => {
|
|
3380
3380
|
let r = await e.selectFrom("forms").selectAll().where("forms.id", "=", n).where("tenant_id", "=", t).executeTakeFirst();
|
|
3381
3381
|
if (!r) return null;
|
|
@@ -3394,7 +3394,7 @@ function oi(e) {
|
|
|
3394
3394
|
}
|
|
3395
3395
|
//#endregion
|
|
3396
3396
|
//#region src/forms/update.ts
|
|
3397
|
-
function
|
|
3397
|
+
function di(e) {
|
|
3398
3398
|
return async (t, n, r) => {
|
|
3399
3399
|
let i = {
|
|
3400
3400
|
...r,
|
|
@@ -3411,25 +3411,25 @@ function si(e) {
|
|
|
3411
3411
|
}
|
|
3412
3412
|
//#endregion
|
|
3413
3413
|
//#region src/forms/index.ts
|
|
3414
|
-
function
|
|
3414
|
+
function fi(e) {
|
|
3415
3415
|
return {
|
|
3416
|
-
create:
|
|
3417
|
-
get:
|
|
3418
|
-
list:
|
|
3419
|
-
remove:
|
|
3420
|
-
update:
|
|
3416
|
+
create: si(e),
|
|
3417
|
+
get: ui(e),
|
|
3418
|
+
list: ci(e),
|
|
3419
|
+
remove: li(e),
|
|
3420
|
+
update: di(e)
|
|
3421
3421
|
};
|
|
3422
3422
|
}
|
|
3423
3423
|
//#endregion
|
|
3424
3424
|
//#region src/resourceServers/create.ts
|
|
3425
|
-
function
|
|
3425
|
+
function pi(e) {
|
|
3426
3426
|
return async (t, n, r) => {
|
|
3427
3427
|
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = i?.created_at ?? a, s = i?.updated_at ?? a, c = {
|
|
3428
3428
|
...n,
|
|
3429
|
-
id: i?.id ?? n.id ??
|
|
3429
|
+
id: i?.id ?? n.id ?? De(),
|
|
3430
3430
|
created_at: o,
|
|
3431
3431
|
updated_at: s
|
|
3432
|
-
}, u =
|
|
3432
|
+
}, u = le.parse(c), { verificationKey: d, scopes: f, options: p, skip_consent_for_verifiable_first_party_clients: m, allow_offline_access: h, is_system: g, metadata: _, ...v } = u, y = {
|
|
3433
3433
|
...v,
|
|
3434
3434
|
tenant_id: t,
|
|
3435
3435
|
scopes: f ? JSON.stringify(f) : "[]",
|
|
@@ -3447,7 +3447,7 @@ function li(e) {
|
|
|
3447
3447
|
}
|
|
3448
3448
|
//#endregion
|
|
3449
3449
|
//#region src/resourceServers/get.ts
|
|
3450
|
-
function
|
|
3450
|
+
function mi(e) {
|
|
3451
3451
|
return async (t, n) => {
|
|
3452
3452
|
let r = await e.selectFrom("resource_servers").selectAll().where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst();
|
|
3453
3453
|
if (!r) return null;
|
|
@@ -3466,7 +3466,7 @@ function ui(e) {
|
|
|
3466
3466
|
}
|
|
3467
3467
|
//#endregion
|
|
3468
3468
|
//#region src/resourceServers/list.ts
|
|
3469
|
-
function
|
|
3469
|
+
function hi(e) {
|
|
3470
3470
|
return async (t, n = {}) => {
|
|
3471
3471
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, q: s } = n, c = e.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", t);
|
|
3472
3472
|
if (s) {
|
|
@@ -3506,7 +3506,7 @@ function di(e) {
|
|
|
3506
3506
|
}
|
|
3507
3507
|
//#endregion
|
|
3508
3508
|
//#region src/resourceServers/remove.ts
|
|
3509
|
-
function
|
|
3509
|
+
function gi(e) {
|
|
3510
3510
|
return async (t, n) => {
|
|
3511
3511
|
let r = await e.deleteFrom("resource_servers").where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst();
|
|
3512
3512
|
return Number(r.numDeletedRows) > 0;
|
|
@@ -3514,7 +3514,7 @@ function fi(e) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
//#endregion
|
|
3516
3516
|
//#region src/resourceServers/update.ts
|
|
3517
|
-
function
|
|
3517
|
+
function _i(e) {
|
|
3518
3518
|
return async (t, n, r) => {
|
|
3519
3519
|
let { verificationKey: i, scopes: a, options: o, skip_consent_for_verifiable_first_party_clients: s, allow_offline_access: c, is_system: l, metadata: u, ...d } = r, f = {
|
|
3520
3520
|
...d,
|
|
@@ -3534,18 +3534,18 @@ function pi(e) {
|
|
|
3534
3534
|
}
|
|
3535
3535
|
//#endregion
|
|
3536
3536
|
//#region src/resourceServers/index.ts
|
|
3537
|
-
function
|
|
3537
|
+
function vi(e) {
|
|
3538
3538
|
return {
|
|
3539
|
-
create:
|
|
3540
|
-
get:
|
|
3541
|
-
list:
|
|
3542
|
-
remove:
|
|
3543
|
-
update:
|
|
3539
|
+
create: pi(e),
|
|
3540
|
+
get: mi(e),
|
|
3541
|
+
list: hi(e),
|
|
3542
|
+
remove: gi(e),
|
|
3543
|
+
update: _i(e)
|
|
3544
3544
|
};
|
|
3545
3545
|
}
|
|
3546
3546
|
//#endregion
|
|
3547
3547
|
//#region src/roles/create.ts
|
|
3548
|
-
function
|
|
3548
|
+
function yi(e) {
|
|
3549
3549
|
return async (n, r, i) => {
|
|
3550
3550
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = a?.created_at ?? o, c = a?.updated_at ?? o, l = a?.id || r.id || t(), { is_system: u, id: d, metadata: f, ...p } = r, m = {
|
|
3551
3551
|
id: l,
|
|
@@ -3568,7 +3568,7 @@ function hi(e) {
|
|
|
3568
3568
|
}
|
|
3569
3569
|
//#endregion
|
|
3570
3570
|
//#region src/roles/get.ts
|
|
3571
|
-
function
|
|
3571
|
+
function bi(e) {
|
|
3572
3572
|
return async (t, n) => {
|
|
3573
3573
|
let r = await e.selectFrom("roles").selectAll().where("roles.tenant_id", "=", t).where("roles.id", "=", n).executeTakeFirst();
|
|
3574
3574
|
if (!r) return null;
|
|
@@ -3582,7 +3582,7 @@ function gi(e) {
|
|
|
3582
3582
|
}
|
|
3583
3583
|
//#endregion
|
|
3584
3584
|
//#region src/roles/list.ts
|
|
3585
|
-
function
|
|
3585
|
+
function xi(e) {
|
|
3586
3586
|
return async (t, n) => {
|
|
3587
3587
|
let r = e.selectFrom("roles").where("roles.tenant_id", "=", t), { page: i = 0, per_page: a = 50, include_totals: s = !1 } = n;
|
|
3588
3588
|
n.q && (r = O(e, r, n.q, ["name"]));
|
|
@@ -3611,7 +3611,7 @@ function _i(e) {
|
|
|
3611
3611
|
}
|
|
3612
3612
|
//#endregion
|
|
3613
3613
|
//#region src/roles/update.ts
|
|
3614
|
-
function
|
|
3614
|
+
function Si(e) {
|
|
3615
3615
|
return async (t, n, r) => {
|
|
3616
3616
|
let { is_system: i, metadata: a, ...o } = r, s = {
|
|
3617
3617
|
...o,
|
|
@@ -3624,7 +3624,7 @@ function vi(e) {
|
|
|
3624
3624
|
}
|
|
3625
3625
|
//#endregion
|
|
3626
3626
|
//#region src/roles/remove.ts
|
|
3627
|
-
function
|
|
3627
|
+
function Ci(e) {
|
|
3628
3628
|
return async (t, n) => {
|
|
3629
3629
|
let r = await e.deleteFrom("roles").where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst();
|
|
3630
3630
|
return Number(r.numDeletedRows) > 0;
|
|
@@ -3632,18 +3632,23 @@ function yi(e) {
|
|
|
3632
3632
|
}
|
|
3633
3633
|
//#endregion
|
|
3634
3634
|
//#region src/roles/index.ts
|
|
3635
|
-
function
|
|
3635
|
+
function wi(e) {
|
|
3636
3636
|
return {
|
|
3637
|
-
create:
|
|
3638
|
-
get:
|
|
3639
|
-
list:
|
|
3640
|
-
update:
|
|
3641
|
-
remove:
|
|
3637
|
+
create: yi(e),
|
|
3638
|
+
get: bi(e),
|
|
3639
|
+
list: xi(e),
|
|
3640
|
+
update: Si(e),
|
|
3641
|
+
remove: Ci(e)
|
|
3642
3642
|
};
|
|
3643
3643
|
}
|
|
3644
3644
|
//#endregion
|
|
3645
3645
|
//#region src/role-permissions/assign.ts
|
|
3646
|
-
function
|
|
3646
|
+
function Ti(e) {
|
|
3647
|
+
if (typeof e != "object" || !e) return !1;
|
|
3648
|
+
let { code: t, message: n } = e;
|
|
3649
|
+
return t === "SQLITE_CONSTRAINT" || t === "SQLITE_CONSTRAINT_PRIMARYKEY" || t === "SQLITE_CONSTRAINT_UNIQUE" || t === "ER_DUP_ENTRY" || t === "23505" ? !0 : typeof n == "string" && (n.includes("UNIQUE constraint failed") || n.includes("Duplicate entry") || n.includes("duplicate key") || n.includes("AlreadyExists"));
|
|
3650
|
+
}
|
|
3651
|
+
function Ei(e) {
|
|
3647
3652
|
return async (t, n, r, i) => {
|
|
3648
3653
|
if (r.length === 0) return !0;
|
|
3649
3654
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -3660,7 +3665,7 @@ function xi(e) {
|
|
|
3660
3665
|
try {
|
|
3661
3666
|
await e.insertInto("role_permissions").values(r).execute();
|
|
3662
3667
|
} catch (e) {
|
|
3663
|
-
if (e
|
|
3668
|
+
if (Ti(e)) continue;
|
|
3664
3669
|
throw e;
|
|
3665
3670
|
}
|
|
3666
3671
|
}
|
|
@@ -3672,11 +3677,11 @@ function xi(e) {
|
|
|
3672
3677
|
}
|
|
3673
3678
|
//#endregion
|
|
3674
3679
|
//#region src/role-permissions/remove.ts
|
|
3675
|
-
function
|
|
3680
|
+
function Di(e) {
|
|
3676
3681
|
return async (t, n, r) => {
|
|
3677
3682
|
if (r.length === 0) return !0;
|
|
3678
3683
|
try {
|
|
3679
|
-
return
|
|
3684
|
+
return await Promise.all(r.map((r) => e.deleteFrom("role_permissions").where("tenant_id", "=", t).where("role_id", "=", n).where("resource_server_identifier", "=", r.resource_server_identifier).where("permission_name", "=", r.permission_name).executeTakeFirst())), !0;
|
|
3680
3685
|
} catch (e) {
|
|
3681
3686
|
return console.error("Error removing role permissions:", e), !1;
|
|
3682
3687
|
}
|
|
@@ -3684,7 +3689,7 @@ function Si(e) {
|
|
|
3684
3689
|
}
|
|
3685
3690
|
//#endregion
|
|
3686
3691
|
//#region src/role-permissions/list.ts
|
|
3687
|
-
function
|
|
3692
|
+
function Oi(e) {
|
|
3688
3693
|
return async (t, n, r = {}) => {
|
|
3689
3694
|
let { page: i = 0, per_page: a = 50, include_totals: o = !1 } = r, s = e.selectFrom("role_permissions").leftJoin("resource_servers", (e) => e.onRef("role_permissions.tenant_id", "=", "resource_servers.tenant_id").onRef("role_permissions.resource_server_identifier", "=", "resource_servers.id")).select([
|
|
3690
3695
|
"role_permissions.role_id",
|
|
@@ -3705,16 +3710,16 @@ function Ci(e) {
|
|
|
3705
3710
|
}
|
|
3706
3711
|
//#endregion
|
|
3707
3712
|
//#region src/role-permissions/index.ts
|
|
3708
|
-
function
|
|
3713
|
+
function ki(e) {
|
|
3709
3714
|
return {
|
|
3710
|
-
assign:
|
|
3711
|
-
remove:
|
|
3712
|
-
list:
|
|
3715
|
+
assign: Ei(e),
|
|
3716
|
+
remove: Di(e),
|
|
3717
|
+
list: Oi(e)
|
|
3713
3718
|
};
|
|
3714
3719
|
}
|
|
3715
3720
|
//#endregion
|
|
3716
3721
|
//#region src/grants/create.ts
|
|
3717
|
-
function
|
|
3722
|
+
function Ai(e) {
|
|
3718
3723
|
return async (n, r) => {
|
|
3719
3724
|
let i = (/* @__PURE__ */ new Date()).toISOString(), a = r.scope ?? [], o = r.audience ?? "", s = await e.selectFrom("grants").where("tenant_id", "=", n).where("user_id", "=", r.user_id).where("client_id", "=", r.clientID).where("audience", "=", o).selectAll().executeTakeFirst();
|
|
3720
3725
|
if (s) {
|
|
@@ -3751,7 +3756,7 @@ function Ti(e) {
|
|
|
3751
3756
|
}
|
|
3752
3757
|
//#endregion
|
|
3753
3758
|
//#region src/grants/get.ts
|
|
3754
|
-
function
|
|
3759
|
+
function ji(e) {
|
|
3755
3760
|
return async (t, n, r, i) => {
|
|
3756
3761
|
let a = await e.selectFrom("grants").where("tenant_id", "=", t).where("user_id", "=", n).where("client_id", "=", r).where("audience", "=", i ?? "").selectAll().executeTakeFirst();
|
|
3757
3762
|
return a ? {
|
|
@@ -3765,7 +3770,7 @@ function Ei(e) {
|
|
|
3765
3770
|
}
|
|
3766
3771
|
//#endregion
|
|
3767
3772
|
//#region src/grants/list.ts
|
|
3768
|
-
function
|
|
3773
|
+
function Mi(e) {
|
|
3769
3774
|
return async (t, n = {}) => {
|
|
3770
3775
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: s, q: c } = n, l = e.selectFrom("grants").where("grants.tenant_id", "=", t);
|
|
3771
3776
|
c && (l = O(e, l, c, [
|
|
@@ -3803,26 +3808,26 @@ function Di(e) {
|
|
|
3803
3808
|
}
|
|
3804
3809
|
//#endregion
|
|
3805
3810
|
//#region src/grants/remove.ts
|
|
3806
|
-
function
|
|
3811
|
+
function Ni(e) {
|
|
3807
3812
|
return async (t, n) => (await e.deleteFrom("grants").where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
3808
3813
|
}
|
|
3809
|
-
function
|
|
3814
|
+
function Pi(e) {
|
|
3810
3815
|
return async (t, n) => (await e.deleteFrom("grants").where("tenant_id", "=", t).where("user_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
3811
3816
|
}
|
|
3812
3817
|
//#endregion
|
|
3813
3818
|
//#region src/grants/index.ts
|
|
3814
|
-
function
|
|
3819
|
+
function Fi(e) {
|
|
3815
3820
|
return {
|
|
3816
|
-
create:
|
|
3817
|
-
get:
|
|
3818
|
-
list:
|
|
3819
|
-
remove:
|
|
3820
|
-
removeByUser:
|
|
3821
|
+
create: Ai(e),
|
|
3822
|
+
get: ji(e),
|
|
3823
|
+
list: Mi(e),
|
|
3824
|
+
remove: Ni(e),
|
|
3825
|
+
removeByUser: Pi(e)
|
|
3821
3826
|
};
|
|
3822
3827
|
}
|
|
3823
3828
|
//#endregion
|
|
3824
3829
|
//#region src/user-permissions/create.ts
|
|
3825
|
-
function
|
|
3830
|
+
function Ii(e) {
|
|
3826
3831
|
return async (t, n, r, i, a) => {
|
|
3827
3832
|
let o = a?.importMetadata, s = (/* @__PURE__ */ new Date()).toISOString();
|
|
3828
3833
|
try {
|
|
@@ -3842,7 +3847,7 @@ function ji(e) {
|
|
|
3842
3847
|
}
|
|
3843
3848
|
//#endregion
|
|
3844
3849
|
//#region src/user-permissions/remove.ts
|
|
3845
|
-
function
|
|
3850
|
+
function Li(e) {
|
|
3846
3851
|
return async (t, n, r, i) => {
|
|
3847
3852
|
try {
|
|
3848
3853
|
let a = e.deleteFrom("user_permissions").where("tenant_id", "=", t).where("user_id", "=", n).where("resource_server_identifier", "=", r.resource_server_identifier).where("permission_name", "=", r.permission_name);
|
|
@@ -3854,7 +3859,7 @@ function Mi(e) {
|
|
|
3854
3859
|
}
|
|
3855
3860
|
//#endregion
|
|
3856
3861
|
//#region src/user-permissions/list.ts
|
|
3857
|
-
function
|
|
3862
|
+
function Ri(e) {
|
|
3858
3863
|
return async (t, n, r, i) => {
|
|
3859
3864
|
let a = e.selectFrom("user_permissions").leftJoin("resource_servers", (e) => e.onRef("user_permissions.tenant_id", "=", "resource_servers.tenant_id").onRef("user_permissions.resource_server_identifier", "=", "resource_servers.id")).select([
|
|
3860
3865
|
"user_permissions.resource_server_identifier",
|
|
@@ -3877,17 +3882,17 @@ function Ni(e) {
|
|
|
3877
3882
|
}
|
|
3878
3883
|
//#endregion
|
|
3879
3884
|
//#region src/user-permissions/index.ts
|
|
3880
|
-
function
|
|
3885
|
+
function zi(e) {
|
|
3881
3886
|
return {
|
|
3882
|
-
create:
|
|
3883
|
-
remove:
|
|
3884
|
-
list:
|
|
3887
|
+
create: Ii(e),
|
|
3888
|
+
remove: Li(e),
|
|
3889
|
+
list: Ri(e)
|
|
3885
3890
|
};
|
|
3886
3891
|
}
|
|
3887
3892
|
//#endregion
|
|
3888
3893
|
//#region src/user-permissions/adapter.ts
|
|
3889
|
-
function
|
|
3890
|
-
let t =
|
|
3894
|
+
function Bi(e) {
|
|
3895
|
+
let t = zi(e);
|
|
3891
3896
|
return {
|
|
3892
3897
|
create: (e, n, r, i) => t.create(e, n, r, i),
|
|
3893
3898
|
remove: (e, n, r, i) => t.remove(e, n, r, i),
|
|
@@ -3896,7 +3901,7 @@ function Fi(e) {
|
|
|
3896
3901
|
}
|
|
3897
3902
|
//#endregion
|
|
3898
3903
|
//#region src/user-roles/list.ts
|
|
3899
|
-
function
|
|
3904
|
+
function Vi(e) {
|
|
3900
3905
|
return async (t, n, r, i) => {
|
|
3901
3906
|
let a = e.selectFrom("user_roles as ur").innerJoin("roles as r", (e) => e.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")).select([
|
|
3902
3907
|
"r.id",
|
|
@@ -3910,11 +3915,11 @@ function Ii(e) {
|
|
|
3910
3915
|
}
|
|
3911
3916
|
//#endregion
|
|
3912
3917
|
//#region src/user-roles/list-users.ts
|
|
3913
|
-
function
|
|
3918
|
+
function Hi(e) {
|
|
3914
3919
|
return async (t, n, r) => {
|
|
3915
3920
|
let i = e.selectFrom("user_roles").select("user_id").distinct().where("tenant_id", "=", t).where("role_id", "=", n);
|
|
3916
|
-
if (
|
|
3917
|
-
let { rows: e, limit: t, next: n } = await
|
|
3921
|
+
if (N(r)) {
|
|
3922
|
+
let { rows: e, limit: t, next: n } = await P(i, r, {
|
|
3918
3923
|
sortColumn: "user_id",
|
|
3919
3924
|
sortOrder: "asc",
|
|
3920
3925
|
idColumn: "user_id"
|
|
@@ -3938,7 +3943,7 @@ function Li(e) {
|
|
|
3938
3943
|
}
|
|
3939
3944
|
//#endregion
|
|
3940
3945
|
//#region src/user-roles/create.ts
|
|
3941
|
-
function
|
|
3946
|
+
function Ui(e) {
|
|
3942
3947
|
return async (t, n, r, i, a) => {
|
|
3943
3948
|
let o = a?.importMetadata, s = (/* @__PURE__ */ new Date()).toISOString();
|
|
3944
3949
|
try {
|
|
@@ -3956,7 +3961,7 @@ function Ri(e) {
|
|
|
3956
3961
|
}
|
|
3957
3962
|
//#endregion
|
|
3958
3963
|
//#region src/user-roles/remove.ts
|
|
3959
|
-
function
|
|
3964
|
+
function Wi(e) {
|
|
3960
3965
|
return async (t, n, r, i) => {
|
|
3961
3966
|
try {
|
|
3962
3967
|
let a = e.deleteFrom("user_roles").where("tenant_id", "=", t).where("user_id", "=", n).where("role_id", "=", r);
|
|
@@ -3968,18 +3973,18 @@ function zi(e) {
|
|
|
3968
3973
|
}
|
|
3969
3974
|
//#endregion
|
|
3970
3975
|
//#region src/user-roles/index.ts
|
|
3971
|
-
function
|
|
3976
|
+
function Gi(e) {
|
|
3972
3977
|
return {
|
|
3973
|
-
list:
|
|
3974
|
-
listUsers:
|
|
3975
|
-
create:
|
|
3976
|
-
remove:
|
|
3978
|
+
list: Vi(e),
|
|
3979
|
+
listUsers: Hi(e),
|
|
3980
|
+
create: Ui(e),
|
|
3981
|
+
remove: Wi(e)
|
|
3977
3982
|
};
|
|
3978
3983
|
}
|
|
3979
3984
|
//#endregion
|
|
3980
3985
|
//#region src/user-roles/adapter.ts
|
|
3981
|
-
function
|
|
3982
|
-
let t =
|
|
3986
|
+
function Ki(e) {
|
|
3987
|
+
let t = Gi(e);
|
|
3983
3988
|
return {
|
|
3984
3989
|
list: (e, n, r, i) => t.list(e, n, r, i),
|
|
3985
3990
|
listUsers: (e, n, r) => t.listUsers(e, n, r),
|
|
@@ -3989,11 +3994,11 @@ function Vi(e) {
|
|
|
3989
3994
|
}
|
|
3990
3995
|
//#endregion
|
|
3991
3996
|
//#region src/organizations/create.ts
|
|
3992
|
-
function
|
|
3997
|
+
function qi(e) {
|
|
3993
3998
|
return async (t, n, r) => {
|
|
3994
3999
|
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
3995
4000
|
...n,
|
|
3996
|
-
id: i?.id || n.id ||
|
|
4001
|
+
id: i?.id || n.id || Se(),
|
|
3997
4002
|
tenant_id: t,
|
|
3998
4003
|
created_at: i?.created_at ?? a,
|
|
3999
4004
|
updated_at: i?.updated_at ?? a,
|
|
@@ -4017,7 +4022,7 @@ function Hi(e) {
|
|
|
4017
4022
|
}
|
|
4018
4023
|
//#endregion
|
|
4019
4024
|
//#region src/organizations/get.ts
|
|
4020
|
-
function
|
|
4025
|
+
function Ji(e) {
|
|
4021
4026
|
return async (t, n) => {
|
|
4022
4027
|
let r = await e.selectFrom("organizations").selectAll().where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst();
|
|
4023
4028
|
return r ||= await e.selectFrom("organizations").selectAll().where("tenant_id", "=", t).where("name", "=", n).executeTakeFirst(), r ? l({
|
|
@@ -4032,15 +4037,15 @@ function Ui(e) {
|
|
|
4032
4037
|
//#endregion
|
|
4033
4038
|
//#region src/organizations/list.ts
|
|
4034
4039
|
var B = ["name", "display_name"];
|
|
4035
|
-
function
|
|
4040
|
+
function Yi(e) {
|
|
4036
4041
|
return async (t, n) => {
|
|
4037
4042
|
let r = e.selectFrom("organizations").where("tenant_id", "=", t);
|
|
4038
4043
|
if (n?.q) {
|
|
4039
4044
|
let t = S(n.q, B);
|
|
4040
4045
|
t && (r = O(e, r, t, B));
|
|
4041
4046
|
}
|
|
4042
|
-
if (
|
|
4043
|
-
let { rows: e, limit: t, next: i } = await
|
|
4047
|
+
if (N(n)) {
|
|
4048
|
+
let { rows: e, limit: t, next: i } = await P(r.selectAll(), n, {
|
|
4044
4049
|
sortColumn: "created_at",
|
|
4045
4050
|
sortOrder: "desc"
|
|
4046
4051
|
}), a = e.map((e) => l({
|
|
@@ -4097,12 +4102,12 @@ function Wi(e) {
|
|
|
4097
4102
|
}
|
|
4098
4103
|
//#endregion
|
|
4099
4104
|
//#region src/organizations/remove.ts
|
|
4100
|
-
function
|
|
4105
|
+
function Xi(e) {
|
|
4101
4106
|
return async (t, n) => (await e.deleteFrom("organizations").where("tenant_id", "=", t).where("id", "=", n).execute()).length > 0;
|
|
4102
4107
|
}
|
|
4103
4108
|
//#endregion
|
|
4104
4109
|
//#region src/organizations/update.ts
|
|
4105
|
-
function
|
|
4110
|
+
function Zi(e) {
|
|
4106
4111
|
return async (t, n, r) => {
|
|
4107
4112
|
let { branding: i, metadata: a, enabled_connections: o, token_quota: s, ...c } = r, l = {
|
|
4108
4113
|
...c,
|
|
@@ -4118,13 +4123,13 @@ function Ki(e) {
|
|
|
4118
4123
|
}
|
|
4119
4124
|
//#endregion
|
|
4120
4125
|
//#region src/organizations/index.ts
|
|
4121
|
-
function
|
|
4126
|
+
function Qi(e) {
|
|
4122
4127
|
return {
|
|
4123
|
-
create:
|
|
4124
|
-
get:
|
|
4125
|
-
list:
|
|
4126
|
-
remove:
|
|
4127
|
-
update:
|
|
4128
|
+
create: qi(e),
|
|
4129
|
+
get: Ji(e),
|
|
4130
|
+
list: Yi(e),
|
|
4131
|
+
remove: Xi(e),
|
|
4132
|
+
update: Zi(e)
|
|
4128
4133
|
};
|
|
4129
4134
|
}
|
|
4130
4135
|
//#endregion
|
|
@@ -4150,7 +4155,7 @@ async function H(e, t, n) {
|
|
|
4150
4155
|
strategy: typeof r.strategy == "string" ? r.strategy : void 0
|
|
4151
4156
|
};
|
|
4152
4157
|
}
|
|
4153
|
-
function
|
|
4158
|
+
function $i(e) {
|
|
4154
4159
|
return {
|
|
4155
4160
|
async create(t, n, r, i) {
|
|
4156
4161
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = {
|
|
@@ -4193,7 +4198,7 @@ function Ji(e) {
|
|
|
4193
4198
|
}
|
|
4194
4199
|
//#endregion
|
|
4195
4200
|
//#region src/user-organizations/create.ts
|
|
4196
|
-
function
|
|
4201
|
+
function ea(e) {
|
|
4197
4202
|
return async (n, r, i) => {
|
|
4198
4203
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = {
|
|
4199
4204
|
id: a?.id ?? t(),
|
|
@@ -4213,7 +4218,7 @@ function Yi(e) {
|
|
|
4213
4218
|
}
|
|
4214
4219
|
//#endregion
|
|
4215
4220
|
//#region src/user-organizations/get.ts
|
|
4216
|
-
function
|
|
4221
|
+
function ta(e) {
|
|
4217
4222
|
return async (t, n) => {
|
|
4218
4223
|
let r = await e.selectFrom("user_organizations").selectAll().where("id", "=", n).where("tenant_id", "=", t).executeTakeFirst();
|
|
4219
4224
|
return r ? {
|
|
@@ -4227,7 +4232,7 @@ function Xi(e) {
|
|
|
4227
4232
|
}
|
|
4228
4233
|
//#endregion
|
|
4229
4234
|
//#region src/user-organizations/list.ts
|
|
4230
|
-
function
|
|
4235
|
+
function na(e) {
|
|
4231
4236
|
return async (t, n) => {
|
|
4232
4237
|
let r = e.selectFrom("user_organizations").selectAll().where("tenant_id", "=", t);
|
|
4233
4238
|
if (n?.q) {
|
|
@@ -4246,8 +4251,8 @@ function Zi(e) {
|
|
|
4246
4251
|
created_at: e.created_at,
|
|
4247
4252
|
updated_at: e.updated_at
|
|
4248
4253
|
});
|
|
4249
|
-
if (
|
|
4250
|
-
let { rows: e, limit: t, next: a } = await
|
|
4254
|
+
if (N(n)) {
|
|
4255
|
+
let { rows: e, limit: t, next: a } = await P(r, n, {
|
|
4251
4256
|
sortColumn: "created_at",
|
|
4252
4257
|
sortOrder: "desc"
|
|
4253
4258
|
});
|
|
@@ -4280,7 +4285,7 @@ function Zi(e) {
|
|
|
4280
4285
|
}
|
|
4281
4286
|
//#endregion
|
|
4282
4287
|
//#region src/user-organizations/listUserOrganizations.ts
|
|
4283
|
-
function
|
|
4288
|
+
function ra(e) {
|
|
4284
4289
|
return async (t, n, r) => {
|
|
4285
4290
|
let i = r?.page || 0, a = r?.per_page || 50, o = i * a, s = e.selectFrom("user_organizations").innerJoin("organizations", (e) => e.onRef("organizations.id", "=", "user_organizations.organization_id").on("organizations.tenant_id", "=", t)).select([
|
|
4286
4291
|
"organizations.id",
|
|
@@ -4317,12 +4322,12 @@ function Qi(e) {
|
|
|
4317
4322
|
}
|
|
4318
4323
|
//#endregion
|
|
4319
4324
|
//#region src/user-organizations/remove.ts
|
|
4320
|
-
function
|
|
4325
|
+
function ia(e) {
|
|
4321
4326
|
return async (t, n) => (await e.deleteFrom("user_organizations").where("id", "=", n).where("tenant_id", "=", t).execute()).length > 0;
|
|
4322
4327
|
}
|
|
4323
4328
|
//#endregion
|
|
4324
4329
|
//#region src/user-organizations/update.ts
|
|
4325
|
-
function
|
|
4330
|
+
function aa(e) {
|
|
4326
4331
|
return async (t, n, r) => {
|
|
4327
4332
|
let i = {
|
|
4328
4333
|
...r,
|
|
@@ -4333,21 +4338,21 @@ function ea(e) {
|
|
|
4333
4338
|
}
|
|
4334
4339
|
//#endregion
|
|
4335
4340
|
//#region src/user-organizations/index.ts
|
|
4336
|
-
function
|
|
4341
|
+
function oa(e) {
|
|
4337
4342
|
return {
|
|
4338
|
-
create:
|
|
4339
|
-
get:
|
|
4340
|
-
list:
|
|
4341
|
-
listUserOrganizations:
|
|
4342
|
-
remove:
|
|
4343
|
-
update:
|
|
4343
|
+
create: ea(e),
|
|
4344
|
+
get: ta(e),
|
|
4345
|
+
list: na(e),
|
|
4346
|
+
listUserOrganizations: ra(e),
|
|
4347
|
+
remove: ia(e),
|
|
4348
|
+
update: aa(e)
|
|
4344
4349
|
};
|
|
4345
4350
|
}
|
|
4346
4351
|
//#endregion
|
|
4347
4352
|
//#region src/invites/create.ts
|
|
4348
|
-
function
|
|
4353
|
+
function sa(e) {
|
|
4349
4354
|
return async (t, n, r) => {
|
|
4350
|
-
let i = r?.importMetadata, a = i?.id ?? n.id ??
|
|
4355
|
+
let i = r?.importMetadata, a = i?.id ?? n.id ?? ke(), o = i?.created_at ?? (/* @__PURE__ */ new Date()).toISOString(), s = n.ttl_sec || 604800, c = new Date(new Date(o).getTime() + s * 1e3).toISOString(), l = {
|
|
4351
4356
|
id: a,
|
|
4352
4357
|
tenant_id: t,
|
|
4353
4358
|
organization_id: n.organization_id,
|
|
@@ -4391,11 +4396,11 @@ function na(e) {
|
|
|
4391
4396
|
}
|
|
4392
4397
|
//#endregion
|
|
4393
4398
|
//#region src/invites/get.ts
|
|
4394
|
-
function
|
|
4399
|
+
function ca(e) {
|
|
4395
4400
|
return async (t, n) => {
|
|
4396
4401
|
let r = await e.selectFrom("invites").selectAll().where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst();
|
|
4397
4402
|
return r ? l({
|
|
4398
|
-
...
|
|
4403
|
+
...mt(r, {
|
|
4399
4404
|
inviter: {},
|
|
4400
4405
|
invitee: {},
|
|
4401
4406
|
app_metadata: {},
|
|
@@ -4408,7 +4413,7 @@ function ra(e) {
|
|
|
4408
4413
|
}
|
|
4409
4414
|
//#endregion
|
|
4410
4415
|
//#region src/invites/list.ts
|
|
4411
|
-
function
|
|
4416
|
+
function la(e) {
|
|
4412
4417
|
return async (t, n) => {
|
|
4413
4418
|
let r = e.selectFrom("invites").selectAll().where("tenant_id", "=", t).orderBy("created_at", "desc");
|
|
4414
4419
|
if (n?.per_page && (r = r.limit(n.per_page)), n?.page) {
|
|
@@ -4416,7 +4421,7 @@ function ia(e) {
|
|
|
4416
4421
|
r = r.offset(e);
|
|
4417
4422
|
}
|
|
4418
4423
|
let i = (await r.execute()).map((e) => l({
|
|
4419
|
-
...
|
|
4424
|
+
...mt(e, {
|
|
4420
4425
|
inviter: {},
|
|
4421
4426
|
invitee: {},
|
|
4422
4427
|
app_metadata: {},
|
|
@@ -4435,12 +4440,12 @@ function ia(e) {
|
|
|
4435
4440
|
}
|
|
4436
4441
|
//#endregion
|
|
4437
4442
|
//#region src/invites/remove.ts
|
|
4438
|
-
function
|
|
4443
|
+
function ua(e) {
|
|
4439
4444
|
return async (t, n) => (await e.deleteFrom("invites").where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst()).numDeletedRows > 0n;
|
|
4440
4445
|
}
|
|
4441
4446
|
//#endregion
|
|
4442
4447
|
//#region src/invites/update.ts
|
|
4443
|
-
function
|
|
4448
|
+
function da(e) {
|
|
4444
4449
|
return async (t, n, r) => {
|
|
4445
4450
|
let i = {};
|
|
4446
4451
|
return r.inviter !== void 0 && (i.inviter = JSON.stringify(r.inviter)), r.invitee !== void 0 && (i.invitee = JSON.stringify(r.invitee)), r.client_id !== void 0 && (i.client_id = r.client_id), r.connection_id !== void 0 && (i.connection_id = r.connection_id), r.app_metadata !== void 0 && (i.app_metadata = JSON.stringify(r.app_metadata)), r.user_metadata !== void 0 && (i.user_metadata = JSON.stringify(r.user_metadata)), r.roles !== void 0 && (i.roles = JSON.stringify(r.roles)), r.ttl_sec !== void 0 && (i.ttl_sec = r.ttl_sec, i.expires_at = new Date(Date.now() + r.ttl_sec * 1e3).toISOString()), r.send_invitation_email !== void 0 && (i.send_invitation_email = +!!r.send_invitation_email), Object.keys(i).length === 0 ? !0 : (await e.updateTable("invites").set(i).where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst()).numUpdatedRows > 0n;
|
|
@@ -4448,35 +4453,35 @@ function oa(e) {
|
|
|
4448
4453
|
}
|
|
4449
4454
|
//#endregion
|
|
4450
4455
|
//#region src/invites/index.ts
|
|
4451
|
-
function
|
|
4456
|
+
function fa(e) {
|
|
4452
4457
|
return {
|
|
4453
|
-
create:
|
|
4454
|
-
get:
|
|
4455
|
-
list:
|
|
4456
|
-
remove:
|
|
4457
|
-
update:
|
|
4458
|
+
create: sa(e),
|
|
4459
|
+
get: ca(e),
|
|
4460
|
+
list: la(e),
|
|
4461
|
+
remove: ua(e),
|
|
4462
|
+
update: da(e)
|
|
4458
4463
|
};
|
|
4459
4464
|
}
|
|
4460
4465
|
//#endregion
|
|
4461
4466
|
//#region src/stats/index.ts
|
|
4462
|
-
var
|
|
4463
|
-
function
|
|
4467
|
+
var pa = ["s"], ma = ["pwd_leak"];
|
|
4468
|
+
function ha(e) {
|
|
4464
4469
|
return /^\d{8}$/.test(e) ? `${e.slice(0, 4)}-${e.slice(4, 6)}-${e.slice(6, 8)}` : e;
|
|
4465
4470
|
}
|
|
4466
|
-
function
|
|
4471
|
+
function ga(e) {
|
|
4467
4472
|
return e.toISOString().split("T")[0];
|
|
4468
4473
|
}
|
|
4469
|
-
function
|
|
4474
|
+
function _a(e) {
|
|
4470
4475
|
return {
|
|
4471
4476
|
async getDaily(t, n = {}) {
|
|
4472
4477
|
let { from: r, to: i } = n, a = /* @__PURE__ */ new Date(), o = new Date(a);
|
|
4473
4478
|
o.setDate(o.getDate() - 30);
|
|
4474
|
-
let s = r ?
|
|
4479
|
+
let s = r ? ha(r) : ga(o), c = i ? ha(i) : ga(a), l = f`DATE(logs.date)`;
|
|
4475
4480
|
return (await e.selectFrom("logs").where("tenant_id", "=", t).where(l, ">=", s).where(l, "<=", c).select((e) => [
|
|
4476
4481
|
l.as("date"),
|
|
4477
|
-
e.fn.sum(e.case().when("type", "in",
|
|
4482
|
+
e.fn.sum(e.case().when("type", "in", pa).then(1).else(0).end()).as("logins"),
|
|
4478
4483
|
e.fn.sum(e.case().when("type", "=", "ss").then(1).else(0).end()).as("signups"),
|
|
4479
|
-
e.fn.sum(e.case().when("type", "in",
|
|
4484
|
+
e.fn.sum(e.case().when("type", "in", ma).then(1).else(0).end()).as("leaked_passwords"),
|
|
4480
4485
|
e.fn.min("date").as("first_event"),
|
|
4481
4486
|
e.fn.max("date").as("last_event")
|
|
4482
4487
|
]).groupBy(l).orderBy("date", "asc").execute()).map((e) => ({
|
|
@@ -4490,13 +4495,13 @@ function fa(e) {
|
|
|
4490
4495
|
},
|
|
4491
4496
|
async getActiveUsers(t) {
|
|
4492
4497
|
let n = /* @__PURE__ */ new Date();
|
|
4493
|
-
return n.setDate(n.getDate() - 30), (await e.selectFrom("logs").where("tenant_id", "=", t).where("date", ">=", n.toISOString()).where("type", "in",
|
|
4498
|
+
return n.setDate(n.getDate() - 30), (await e.selectFrom("logs").where("tenant_id", "=", t).where("date", ">=", n.toISOString()).where("type", "in", pa).where("user_id", "is not", null).select((e) => e.fn.count("user_id").distinct().as("count")).executeTakeFirstOrThrow()).count || 0;
|
|
4494
4499
|
}
|
|
4495
4500
|
};
|
|
4496
4501
|
}
|
|
4497
4502
|
//#endregion
|
|
4498
4503
|
//#region src/analytics/index.ts
|
|
4499
|
-
var
|
|
4504
|
+
var va = {
|
|
4500
4505
|
"active-users": ["s", "seacft"],
|
|
4501
4506
|
logins: [
|
|
4502
4507
|
"s",
|
|
@@ -4526,7 +4531,7 @@ var pa = {
|
|
|
4526
4531
|
"fvr"
|
|
4527
4532
|
],
|
|
4528
4533
|
"codes-sent": ["cls", "cs"]
|
|
4529
|
-
},
|
|
4534
|
+
}, ya = {
|
|
4530
4535
|
"active-users": {
|
|
4531
4536
|
alias: "active_users",
|
|
4532
4537
|
type: "UInt64",
|
|
@@ -4583,7 +4588,7 @@ var pa = {
|
|
|
4583
4588
|
agg: "count"
|
|
4584
4589
|
}
|
|
4585
4590
|
};
|
|
4586
|
-
async function
|
|
4591
|
+
async function ba(e) {
|
|
4587
4592
|
try {
|
|
4588
4593
|
return await f`SELECT @@version_comment`.execute(e), "mysql";
|
|
4589
4594
|
} catch {
|
|
@@ -4605,7 +4610,7 @@ function U(e, t) {
|
|
|
4605
4610
|
let i = r.hour === "24" ? "00" : r.hour, a = Date.UTC(Number(r.year), Number(r.month) - 1, Number(r.day), Number(i), Number(r.minute), Number(r.second)), o = Math.round((a - t.getTime()) / 6e4), s = o >= 0 ? "+" : "-", c = Math.abs(o);
|
|
4606
4611
|
return `${s}${String(Math.floor(c / 60)).padStart(2, "0")}:${String(c % 60).padStart(2, "0")}`;
|
|
4607
4612
|
}
|
|
4608
|
-
var
|
|
4613
|
+
var xa = [
|
|
4609
4614
|
"January",
|
|
4610
4615
|
"February",
|
|
4611
4616
|
"March",
|
|
@@ -4619,22 +4624,22 @@ var ga = [
|
|
|
4619
4624
|
"November",
|
|
4620
4625
|
"December"
|
|
4621
4626
|
];
|
|
4622
|
-
function
|
|
4627
|
+
function Sa(e, t) {
|
|
4623
4628
|
let n = t.getUTCFullYear(), r = U(e, new Date(Date.UTC(n, 0, 1)));
|
|
4624
4629
|
for (let t = 1; t < 12; t++) {
|
|
4625
4630
|
let i = U(e, new Date(Date.UTC(n, t, 1)));
|
|
4626
|
-
if (i !== r) throw Error(`Timezone '${e}' is DST-varying (offset ${r} in January vs ${i} in ${
|
|
4631
|
+
if (i !== r) throw Error(`Timezone '${e}' is DST-varying (offset ${r} in January vs ${i} in ${xa[t]}) and cannot be bucketed with a single fixed offset by the SQL analytics adapter. Use a fixed-offset zone (e.g. 'UTC' or '+02:00').`);
|
|
4627
4632
|
}
|
|
4628
4633
|
}
|
|
4629
|
-
function
|
|
4634
|
+
function Ca(e) {
|
|
4630
4635
|
let t = e.startsWith("-") ? -1 : 1, [n, r] = e.slice(1).split(":");
|
|
4631
4636
|
return t * (Number(n) * 60 + Number(r));
|
|
4632
4637
|
}
|
|
4633
|
-
function
|
|
4638
|
+
function wa(e, t) {
|
|
4634
4639
|
let n;
|
|
4635
4640
|
if (t === "+00:00") n = f`${f.ref("logs.date")}`;
|
|
4636
4641
|
else {
|
|
4637
|
-
let e =
|
|
4642
|
+
let e = Ca(t), r = `${e >= 0 ? "+" : "-"}${Math.abs(e)} minutes`;
|
|
4638
4643
|
n = f`datetime(${f.ref("logs.date")}, ${r})`;
|
|
4639
4644
|
}
|
|
4640
4645
|
switch (e) {
|
|
@@ -4645,7 +4650,7 @@ function ya(e, t) {
|
|
|
4645
4650
|
default: throw Error(`Unsupported interval '${e}' for SQL analytics adapter`);
|
|
4646
4651
|
}
|
|
4647
4652
|
}
|
|
4648
|
-
function
|
|
4653
|
+
function Ta(e, t) {
|
|
4649
4654
|
if (t === "+00:00") switch (e) {
|
|
4650
4655
|
case "hour": return f`substring(${f.ref("logs.date")}, 1, 13)`;
|
|
4651
4656
|
case "day": return f`substring(${f.ref("logs.date")}, 1, 10)`;
|
|
@@ -4656,7 +4661,7 @@ function ba(e, t) {
|
|
|
4656
4661
|
}
|
|
4657
4662
|
default: throw Error(`Unsupported interval '${e}' for SQL analytics adapter`);
|
|
4658
4663
|
}
|
|
4659
|
-
let n =
|
|
4664
|
+
let n = Ca(t), r = f`date_add(str_to_date(substring(${f.ref("logs.date")}, 1, 19), '%Y-%m-%dT%H:%i:%s'), interval ${f.lit(n)} minute)`;
|
|
4660
4665
|
switch (e) {
|
|
4661
4666
|
case "hour": return f`date_format(${r}, '%Y-%m-%dT%H')`;
|
|
4662
4667
|
case "day": return f`date_format(${r}, '%Y-%m-%d')`;
|
|
@@ -4665,12 +4670,12 @@ function ba(e, t) {
|
|
|
4665
4670
|
default: throw Error(`Unsupported interval '${e}' for SQL analytics adapter`);
|
|
4666
4671
|
}
|
|
4667
4672
|
}
|
|
4668
|
-
function
|
|
4669
|
-
|
|
4673
|
+
function Ea(e, t, n, r) {
|
|
4674
|
+
Sa(t, n);
|
|
4670
4675
|
let i = U(t, n);
|
|
4671
|
-
return r === "mysql" ?
|
|
4676
|
+
return r === "mysql" ? Ta(e, i) : wa(e, i);
|
|
4672
4677
|
}
|
|
4673
|
-
function
|
|
4678
|
+
function Da(e) {
|
|
4674
4679
|
switch (e) {
|
|
4675
4680
|
case "connection": return "logs.connection";
|
|
4676
4681
|
case "client_id": return "logs.client_id";
|
|
@@ -4679,65 +4684,82 @@ function Sa(e) {
|
|
|
4679
4684
|
case "time": throw Error("time dimension is handled separately");
|
|
4680
4685
|
}
|
|
4681
4686
|
}
|
|
4682
|
-
function
|
|
4683
|
-
let t = null, n = () => (t ||=
|
|
4684
|
-
return {
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
let e
|
|
4687
|
+
function Oa(e) {
|
|
4688
|
+
let t = null, n = () => (t ||= ba(e), t);
|
|
4689
|
+
return {
|
|
4690
|
+
async query(t, r, i) {
|
|
4691
|
+
let a = Date.now(), o = va[r], s = ya[r], c = await n(), l = [], u = e.selectFrom("logs").where("tenant_id", "=", t);
|
|
4692
|
+
u = u.where("date", ">=", i.from).where("date", "<", i.to), u = u.where("type", "in", o), i.filters.connection?.length && (u = u.where("connection", "in", i.filters.connection)), i.filters.client_id?.length && (u = u.where("client_id", "in", i.filters.client_id)), i.filters.user_type?.length && (u = u.where("strategy_type", "in", i.filters.user_type)), i.filters.user_id?.length && (u = u.where("user_id", "in", i.filters.user_id));
|
|
4693
|
+
let d = [], p = [];
|
|
4694
|
+
for (let e of i.group_by) if (e === "time") {
|
|
4695
|
+
let e = Ea(i.interval, i.tz, new Date(i.from), c);
|
|
4696
|
+
p.push({
|
|
4697
|
+
alias: "time",
|
|
4698
|
+
expr: e
|
|
4699
|
+
}), d.push(e), l.push({
|
|
4700
|
+
name: "time",
|
|
4701
|
+
type: i.interval === "hour" ? "DateTime" : "Date"
|
|
4702
|
+
});
|
|
4703
|
+
} else {
|
|
4704
|
+
let t = Da(e);
|
|
4705
|
+
p.push({
|
|
4706
|
+
alias: e,
|
|
4707
|
+
expr: f`${f.ref(t)}`
|
|
4708
|
+
}), d.push(f`${f.ref(t)}`), l.push({
|
|
4709
|
+
name: e,
|
|
4710
|
+
type: "String"
|
|
4711
|
+
});
|
|
4712
|
+
}
|
|
4713
|
+
let m = s.agg === "uniq" ? f`COUNT(DISTINCT ${f.ref("logs.user_id")})` : f`COUNT(*)`;
|
|
4690
4714
|
p.push({
|
|
4691
|
-
alias:
|
|
4692
|
-
expr:
|
|
4693
|
-
}),
|
|
4694
|
-
name:
|
|
4695
|
-
type:
|
|
4715
|
+
alias: s.alias,
|
|
4716
|
+
expr: m
|
|
4717
|
+
}), l.push({
|
|
4718
|
+
name: s.alias,
|
|
4719
|
+
type: s.type
|
|
4696
4720
|
});
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4721
|
+
let h = u.select(p.map(({ alias: e, expr: t }) => t.as(e)));
|
|
4722
|
+
if (d.length > 0 && (h = h.groupBy(d)), i.order_by) {
|
|
4723
|
+
let e = i.order_by.startsWith("-"), t = e ? i.order_by.slice(1) : i.order_by;
|
|
4724
|
+
h = h.orderBy(t, e ? "desc" : "asc");
|
|
4725
|
+
} else h = i.group_by.length > 0 && i.group_by[0] === "time" ? h.orderBy("time", "asc") : h.orderBy(s.alias, "desc");
|
|
4726
|
+
h = h.limit(i.limit).offset(i.offset);
|
|
4727
|
+
let g = (await h.execute()).map((e) => {
|
|
4728
|
+
let t = {};
|
|
4729
|
+
for (let n of l) {
|
|
4730
|
+
let r = e[n.name];
|
|
4731
|
+
t[n.name] = n.type === "UInt64" ? Number(r) || 0 : r ?? "";
|
|
4732
|
+
}
|
|
4733
|
+
return t;
|
|
4705
4734
|
});
|
|
4735
|
+
return {
|
|
4736
|
+
meta: l,
|
|
4737
|
+
data: g,
|
|
4738
|
+
rows: g.length,
|
|
4739
|
+
rows_before_limit_at_least: g.length,
|
|
4740
|
+
statistics: { elapsed: (Date.now() - a) / 1e3 }
|
|
4741
|
+
};
|
|
4742
|
+
},
|
|
4743
|
+
async sessionRetention(t, r) {
|
|
4744
|
+
let i = Date.now(), { sinceMs: a } = pe(r.weeks, i), o = await n(), s = (e) => {
|
|
4745
|
+
let t = e === "used_at_ts" ? f`(COALESCE(${f.ref("used_at_ts")}, ${f.ref("created_at_ts")}) + ${f.lit(m)})` : f`(${f.ref(e)} + ${f.lit(m)})`;
|
|
4746
|
+
return o === "mysql" ? f`${t} DIV ${f.lit(h)}` : f`${t} / ${f.lit(h)}`;
|
|
4747
|
+
};
|
|
4748
|
+
return g((await e.selectFrom("sessions").where("tenant_id", "=", t).where("created_at_ts", ">=", a).select([
|
|
4749
|
+
s("created_at_ts").as("created_week"),
|
|
4750
|
+
s("used_at_ts").as("used_week"),
|
|
4751
|
+
f`COUNT(*)`.as("count")
|
|
4752
|
+
]).groupBy([s("created_at_ts"), s("used_at_ts")]).execute()).map((e) => ({
|
|
4753
|
+
created_week: Math.floor(Number(e.created_week)),
|
|
4754
|
+
used_week: Math.floor(Number(e.used_week)),
|
|
4755
|
+
count: Number(e.count)
|
|
4756
|
+
})), r.weeks, i);
|
|
4706
4757
|
}
|
|
4707
|
-
|
|
4708
|
-
p.push({
|
|
4709
|
-
alias: s.alias,
|
|
4710
|
-
expr: m
|
|
4711
|
-
}), l.push({
|
|
4712
|
-
name: s.alias,
|
|
4713
|
-
type: s.type
|
|
4714
|
-
});
|
|
4715
|
-
let h = u.select(p.map(({ alias: e, expr: t }) => t.as(e)));
|
|
4716
|
-
if (d.length > 0 && (h = h.groupBy(d)), i.order_by) {
|
|
4717
|
-
let e = i.order_by.startsWith("-"), t = e ? i.order_by.slice(1) : i.order_by;
|
|
4718
|
-
h = h.orderBy(t, e ? "desc" : "asc");
|
|
4719
|
-
} else h = i.group_by.length > 0 && i.group_by[0] === "time" ? h.orderBy("time", "asc") : h.orderBy(s.alias, "desc");
|
|
4720
|
-
h = h.limit(i.limit).offset(i.offset);
|
|
4721
|
-
let g = (await h.execute()).map((e) => {
|
|
4722
|
-
let t = {};
|
|
4723
|
-
for (let n of l) {
|
|
4724
|
-
let r = e[n.name];
|
|
4725
|
-
t[n.name] = n.type === "UInt64" ? Number(r) || 0 : r ?? "";
|
|
4726
|
-
}
|
|
4727
|
-
return t;
|
|
4728
|
-
});
|
|
4729
|
-
return {
|
|
4730
|
-
meta: l,
|
|
4731
|
-
data: g,
|
|
4732
|
-
rows: g.length,
|
|
4733
|
-
rows_before_limit_at_least: g.length,
|
|
4734
|
-
statistics: { elapsed: (Date.now() - a) / 1e3 }
|
|
4735
|
-
};
|
|
4736
|
-
} };
|
|
4758
|
+
};
|
|
4737
4759
|
}
|
|
4738
4760
|
//#endregion
|
|
4739
4761
|
//#region src/customText/index.ts
|
|
4740
|
-
function
|
|
4762
|
+
function ka(e) {
|
|
4741
4763
|
return {
|
|
4742
4764
|
async get(t, n, r) {
|
|
4743
4765
|
let i = await e.selectFrom("custom_text").selectAll().where("tenant_id", "=", t).where("prompt", "=", n).where("language", "=", r).executeTakeFirst();
|
|
@@ -4776,9 +4798,9 @@ function wa(e) {
|
|
|
4776
4798
|
}
|
|
4777
4799
|
//#endregion
|
|
4778
4800
|
//#region src/authenticationMethods/create.ts
|
|
4779
|
-
function
|
|
4801
|
+
function Aa(e) {
|
|
4780
4802
|
return async (t, n, r) => {
|
|
4781
|
-
let i = r?.importMetadata, a = i?.created_at ? new Date(i.created_at).getTime() : Date.now(), o = i?.updated_at ? new Date(i.updated_at).getTime() : a, s = i?.id ??
|
|
4803
|
+
let i = r?.importMetadata, a = i?.created_at ? new Date(i.created_at).getTime() : Date.now(), o = i?.updated_at ? new Date(i.updated_at).getTime() : a, s = i?.id ?? kr();
|
|
4782
4804
|
return await e.insertInto("authentication_methods").values({
|
|
4783
4805
|
id: s,
|
|
4784
4806
|
tenant_id: t,
|
|
@@ -4815,7 +4837,7 @@ function Ta(e) {
|
|
|
4815
4837
|
}
|
|
4816
4838
|
//#endregion
|
|
4817
4839
|
//#region src/authenticationMethods/get.ts
|
|
4818
|
-
function
|
|
4840
|
+
function ja(e) {
|
|
4819
4841
|
return async (t, n) => {
|
|
4820
4842
|
let r = await e.selectFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", n).selectAll().executeTakeFirst();
|
|
4821
4843
|
return r ? {
|
|
@@ -4838,7 +4860,7 @@ function Ea(e) {
|
|
|
4838
4860
|
}
|
|
4839
4861
|
//#endregion
|
|
4840
4862
|
//#region src/authenticationMethods/getByCredentialId.ts
|
|
4841
|
-
function
|
|
4863
|
+
function Ma(e) {
|
|
4842
4864
|
return async (t, n) => {
|
|
4843
4865
|
let r = await e.selectFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.credential_id", "=", n).selectAll().executeTakeFirst();
|
|
4844
4866
|
return r ? {
|
|
@@ -4861,7 +4883,7 @@ function Da(e) {
|
|
|
4861
4883
|
}
|
|
4862
4884
|
//#endregion
|
|
4863
4885
|
//#region src/authenticationMethods/list.ts
|
|
4864
|
-
function
|
|
4886
|
+
function Na(e) {
|
|
4865
4887
|
return async (t, n) => (await e.selectFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.user_id", "=", n).selectAll().execute()).map((e) => ({
|
|
4866
4888
|
id: e.id,
|
|
4867
4889
|
user_id: e.user_id,
|
|
@@ -4881,35 +4903,35 @@ function Oa(e) {
|
|
|
4881
4903
|
}
|
|
4882
4904
|
//#endregion
|
|
4883
4905
|
//#region src/authenticationMethods/update.ts
|
|
4884
|
-
function
|
|
4906
|
+
function Pa(e) {
|
|
4885
4907
|
return async (t, n, r) => {
|
|
4886
4908
|
let i = { updated_at_ts: Date.now() };
|
|
4887
4909
|
r.phone_number !== void 0 && (i.phone_number = r.phone_number), r.totp_secret !== void 0 && (i.totp_secret = r.totp_secret), r.credential_id !== void 0 && (i.credential_id = r.credential_id), r.public_key !== void 0 && (i.public_key = r.public_key), r.sign_count !== void 0 && (i.sign_count = r.sign_count), r.credential_backed_up !== void 0 && (i.credential_backed_up = +!!r.credential_backed_up), r.transports !== void 0 && (i.transports = JSON.stringify(r.transports)), r.friendly_name !== void 0 && (i.friendly_name = r.friendly_name), r.confirmed !== void 0 && (i.confirmed = +!!r.confirmed), await e.updateTable("authentication_methods").set(i).where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", n).execute();
|
|
4888
|
-
let a = await
|
|
4910
|
+
let a = await ja(e)(t, n);
|
|
4889
4911
|
if (!a) throw Error(`Authentication method ${n} not found`);
|
|
4890
4912
|
return a;
|
|
4891
4913
|
};
|
|
4892
4914
|
}
|
|
4893
4915
|
//#endregion
|
|
4894
4916
|
//#region src/authenticationMethods/remove.ts
|
|
4895
|
-
function
|
|
4917
|
+
function Fa(e) {
|
|
4896
4918
|
return async (t, n) => (await e.deleteFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
4897
4919
|
}
|
|
4898
4920
|
//#endregion
|
|
4899
4921
|
//#region src/authenticationMethods/index.ts
|
|
4900
|
-
function
|
|
4922
|
+
function Ia(e) {
|
|
4901
4923
|
return {
|
|
4902
|
-
create:
|
|
4903
|
-
get:
|
|
4904
|
-
getByCredentialId:
|
|
4905
|
-
list:
|
|
4906
|
-
update:
|
|
4907
|
-
remove:
|
|
4924
|
+
create: Aa(e),
|
|
4925
|
+
get: ja(e),
|
|
4926
|
+
getByCredentialId: Ma(e),
|
|
4927
|
+
list: Na(e),
|
|
4928
|
+
update: Pa(e),
|
|
4929
|
+
remove: Fa(e)
|
|
4908
4930
|
};
|
|
4909
4931
|
}
|
|
4910
4932
|
//#endregion
|
|
4911
4933
|
//#region src/outbox/getByIds.ts
|
|
4912
|
-
function
|
|
4934
|
+
function La(e) {
|
|
4913
4935
|
return async (t) => t.length === 0 ? [] : (await e.selectFrom("outbox_events").selectAll().where("id", "in", t).execute()).map((e) => ({
|
|
4914
4936
|
...JSON.parse(e.payload),
|
|
4915
4937
|
id: e.id,
|
|
@@ -4922,7 +4944,7 @@ function Ma(e) {
|
|
|
4922
4944
|
}
|
|
4923
4945
|
//#endregion
|
|
4924
4946
|
//#region src/outbox/getUnprocessed.ts
|
|
4925
|
-
function
|
|
4947
|
+
function Ra(e) {
|
|
4926
4948
|
return async (t) => {
|
|
4927
4949
|
let n = (/* @__PURE__ */ new Date()).toISOString();
|
|
4928
4950
|
return (await e.selectFrom("outbox_events").selectAll().where("processed_at", "is", null).where((e) => e.or([e("next_retry_at", "is", null), e("next_retry_at", "<=", n)])).where((e) => e.or([e("claimed_by", "is", null), e("claim_expires_at", "<=", n)])).orderBy("created_at", "asc").orderBy("id", "asc").limit(t).execute()).map((e) => ({
|
|
@@ -4938,7 +4960,7 @@ function Na(e) {
|
|
|
4938
4960
|
}
|
|
4939
4961
|
//#endregion
|
|
4940
4962
|
//#region src/outbox/claimEvents.ts
|
|
4941
|
-
function
|
|
4963
|
+
function za(e) {
|
|
4942
4964
|
return async (t, n, r) => {
|
|
4943
4965
|
if (t.length === 0) return [];
|
|
4944
4966
|
let i = (/* @__PURE__ */ new Date()).toISOString(), a = new Date(Date.now() + r).toISOString();
|
|
@@ -4950,7 +4972,7 @@ function Pa(e) {
|
|
|
4950
4972
|
}
|
|
4951
4973
|
//#endregion
|
|
4952
4974
|
//#region src/outbox/markProcessed.ts
|
|
4953
|
-
function
|
|
4975
|
+
function Ba(e) {
|
|
4954
4976
|
return async (t) => {
|
|
4955
4977
|
if (t.length === 0) return;
|
|
4956
4978
|
let n = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -4959,7 +4981,7 @@ function Fa(e) {
|
|
|
4959
4981
|
}
|
|
4960
4982
|
//#endregion
|
|
4961
4983
|
//#region src/outbox/markRetry.ts
|
|
4962
|
-
function
|
|
4984
|
+
function Va(e) {
|
|
4963
4985
|
return async (t, n, r) => {
|
|
4964
4986
|
await e.updateTable("outbox_events").set({
|
|
4965
4987
|
error: n,
|
|
@@ -4972,7 +4994,7 @@ function Ia(e) {
|
|
|
4972
4994
|
}
|
|
4973
4995
|
//#endregion
|
|
4974
4996
|
//#region src/outbox/deadLetter.ts
|
|
4975
|
-
function
|
|
4997
|
+
function Ha(e) {
|
|
4976
4998
|
return async (t, n) => {
|
|
4977
4999
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
4978
5000
|
await e.updateTable("outbox_events").set({
|
|
@@ -4984,7 +5006,7 @@ function La(e) {
|
|
|
4984
5006
|
}
|
|
4985
5007
|
//#endregion
|
|
4986
5008
|
//#region src/outbox/listFailed.ts
|
|
4987
|
-
function
|
|
5009
|
+
function Ua(e) {
|
|
4988
5010
|
return async (t, n = {}) => {
|
|
4989
5011
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1 } = n, o = (await e.selectFrom("outbox_events").selectAll().where("tenant_id", "=", t).where("dead_lettered_at", "is not", null).orderBy("dead_lettered_at", "desc").orderBy("id", "asc").offset(r * i).limit(i).execute()).flatMap((e) => {
|
|
4990
5012
|
let t;
|
|
@@ -5019,7 +5041,7 @@ function Ra(e) {
|
|
|
5019
5041
|
}
|
|
5020
5042
|
//#endregion
|
|
5021
5043
|
//#region src/outbox/replay.ts
|
|
5022
|
-
function
|
|
5044
|
+
function Wa(e) {
|
|
5023
5045
|
return async (t, n) => {
|
|
5024
5046
|
let r = await e.updateTable("outbox_events").set({
|
|
5025
5047
|
processed_at: null,
|
|
@@ -5034,7 +5056,7 @@ function za(e) {
|
|
|
5034
5056
|
}
|
|
5035
5057
|
//#endregion
|
|
5036
5058
|
//#region src/outbox/cleanup.ts
|
|
5037
|
-
function
|
|
5059
|
+
function Ga(e) {
|
|
5038
5060
|
return async (t) => {
|
|
5039
5061
|
let n = await e.deleteFrom("outbox_events").where("processed_at", "is not", null).where("processed_at", "<", t).executeTakeFirst();
|
|
5040
5062
|
return Number(n.numDeletedRows);
|
|
@@ -5042,18 +5064,18 @@ function Ba(e) {
|
|
|
5042
5064
|
}
|
|
5043
5065
|
//#endregion
|
|
5044
5066
|
//#region src/outbox/index.ts
|
|
5045
|
-
function
|
|
5067
|
+
function Ka(e) {
|
|
5046
5068
|
return {
|
|
5047
|
-
create:
|
|
5048
|
-
getByIds:
|
|
5049
|
-
getUnprocessed:
|
|
5050
|
-
claimEvents:
|
|
5051
|
-
markProcessed:
|
|
5052
|
-
markRetry:
|
|
5053
|
-
deadLetter:
|
|
5054
|
-
listFailed:
|
|
5055
|
-
replay:
|
|
5056
|
-
cleanup:
|
|
5069
|
+
create: qe(e),
|
|
5070
|
+
getByIds: La(e),
|
|
5071
|
+
getUnprocessed: Ra(e),
|
|
5072
|
+
claimEvents: za(e),
|
|
5073
|
+
markProcessed: Ba(e),
|
|
5074
|
+
markRetry: Va(e),
|
|
5075
|
+
deadLetter: Ha(e),
|
|
5076
|
+
listFailed: Ua(e),
|
|
5077
|
+
replay: Wa(e),
|
|
5078
|
+
cleanup: Ga(e)
|
|
5057
5079
|
};
|
|
5058
5080
|
}
|
|
5059
5081
|
//#endregion
|
|
@@ -5071,7 +5093,7 @@ function W(e) {
|
|
|
5071
5093
|
updated_at: e.updated_at
|
|
5072
5094
|
};
|
|
5073
5095
|
}
|
|
5074
|
-
function
|
|
5096
|
+
function qa(e) {
|
|
5075
5097
|
return {
|
|
5076
5098
|
async create(n, r, i) {
|
|
5077
5099
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = {
|
|
@@ -5110,7 +5132,7 @@ function G(e) {
|
|
|
5110
5132
|
return {
|
|
5111
5133
|
id: e.id,
|
|
5112
5134
|
name: e.name,
|
|
5113
|
-
provider:
|
|
5135
|
+
provider: se.parse(e.provider),
|
|
5114
5136
|
connection: e.connection,
|
|
5115
5137
|
enabled: e.enabled === 1,
|
|
5116
5138
|
credentials: JSON.parse(e.credentials),
|
|
@@ -5118,7 +5140,7 @@ function G(e) {
|
|
|
5118
5140
|
updated_at: e.updated_at
|
|
5119
5141
|
};
|
|
5120
5142
|
}
|
|
5121
|
-
function
|
|
5143
|
+
function Ja(e) {
|
|
5122
5144
|
return {
|
|
5123
5145
|
async create(n, r, i) {
|
|
5124
5146
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = a?.id ?? r.id ?? `mig_${t()}`, c = r.enabled ?? !0, l = {
|
|
@@ -5158,28 +5180,28 @@ function K(e) {
|
|
|
5158
5180
|
tenant_id: e.tenant_id,
|
|
5159
5181
|
custom_domain_id: e.custom_domain_id,
|
|
5160
5182
|
priority: e.priority,
|
|
5161
|
-
match:
|
|
5162
|
-
handlers:
|
|
5183
|
+
match: Ya(e.match),
|
|
5184
|
+
handlers: Xa(e.handlers),
|
|
5163
5185
|
created_at: e.created_at,
|
|
5164
5186
|
updated_at: e.updated_at
|
|
5165
5187
|
};
|
|
5166
5188
|
}
|
|
5167
|
-
function
|
|
5189
|
+
function Ya(e) {
|
|
5168
5190
|
if (!e) return { path: "/*" };
|
|
5169
5191
|
try {
|
|
5170
|
-
let t = JSON.parse(e), n =
|
|
5192
|
+
let t = JSON.parse(e), n = oe.safeParse(t);
|
|
5171
5193
|
if (n.success) return n.data;
|
|
5172
5194
|
} catch {}
|
|
5173
5195
|
return { path: "/*" };
|
|
5174
5196
|
}
|
|
5175
|
-
function
|
|
5197
|
+
function Xa(e) {
|
|
5176
5198
|
if (!e) return [];
|
|
5177
5199
|
try {
|
|
5178
5200
|
let t = JSON.parse(e);
|
|
5179
5201
|
if (!Array.isArray(t)) return [];
|
|
5180
5202
|
let n = [];
|
|
5181
5203
|
for (let e of t) {
|
|
5182
|
-
let t =
|
|
5204
|
+
let t = re.safeParse(e);
|
|
5183
5205
|
t.success && n.push(t.data);
|
|
5184
5206
|
}
|
|
5185
5207
|
return n;
|
|
@@ -5242,7 +5264,7 @@ function q(e) {
|
|
|
5242
5264
|
}
|
|
5243
5265
|
//#endregion
|
|
5244
5266
|
//#region src/proxyRoutes/resolve-host.ts
|
|
5245
|
-
async function
|
|
5267
|
+
async function Za(e, t) {
|
|
5246
5268
|
let n = t.indexOf(":"), r = n === -1 ? t : t.slice(0, n), i = (r.endsWith(".") ? r.slice(0, -1) : r).toLowerCase(), a = await e.selectFrom("custom_domains").where("domain", "=", i).select([
|
|
5247
5269
|
"custom_domain_id",
|
|
5248
5270
|
"tenant_id",
|
|
@@ -5259,22 +5281,22 @@ async function Ka(e, t) {
|
|
|
5259
5281
|
}
|
|
5260
5282
|
//#endregion
|
|
5261
5283
|
//#region src/proxyRoutes/index.ts
|
|
5262
|
-
function
|
|
5284
|
+
function Qa(e) {
|
|
5263
5285
|
return {
|
|
5264
5286
|
proxyRoutes: q(e),
|
|
5265
|
-
resolveHost: (t) =>
|
|
5287
|
+
resolveHost: (t) => Za(e, t)
|
|
5266
5288
|
};
|
|
5267
5289
|
}
|
|
5268
5290
|
//#endregion
|
|
5269
5291
|
//#region src/scim/adapter.ts
|
|
5270
|
-
function
|
|
5292
|
+
function $a(e) {
|
|
5271
5293
|
if (!e) return [];
|
|
5272
5294
|
try {
|
|
5273
5295
|
let t = JSON.parse(e);
|
|
5274
5296
|
if (!Array.isArray(t)) return [];
|
|
5275
5297
|
let n = [];
|
|
5276
5298
|
for (let e of t) {
|
|
5277
|
-
let t =
|
|
5299
|
+
let t = fe.safeParse(e);
|
|
5278
5300
|
t.success && n.push(t.data);
|
|
5279
5301
|
}
|
|
5280
5302
|
return n;
|
|
@@ -5282,7 +5304,7 @@ function Ja(e) {
|
|
|
5282
5304
|
return [];
|
|
5283
5305
|
}
|
|
5284
5306
|
}
|
|
5285
|
-
function
|
|
5307
|
+
function eo(e) {
|
|
5286
5308
|
if (!e) return [];
|
|
5287
5309
|
try {
|
|
5288
5310
|
let t = JSON.parse(e);
|
|
@@ -5291,16 +5313,16 @@ function Ya(e) {
|
|
|
5291
5313
|
return [];
|
|
5292
5314
|
}
|
|
5293
5315
|
}
|
|
5294
|
-
function
|
|
5316
|
+
function to(e) {
|
|
5295
5317
|
return {
|
|
5296
5318
|
connection_id: e.connection_id,
|
|
5297
5319
|
user_id_attribute: e.user_id_attribute,
|
|
5298
|
-
mapping:
|
|
5320
|
+
mapping: $a(e.mapping),
|
|
5299
5321
|
created_at: e.created_at,
|
|
5300
5322
|
updated_at: e.updated_at
|
|
5301
5323
|
};
|
|
5302
5324
|
}
|
|
5303
|
-
function
|
|
5325
|
+
function no(e) {
|
|
5304
5326
|
return {
|
|
5305
5327
|
async create(t, n) {
|
|
5306
5328
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5321,7 +5343,7 @@ function Za(e) {
|
|
|
5321
5343
|
},
|
|
5322
5344
|
async get(t, n) {
|
|
5323
5345
|
let r = await e.selectFrom("scim_configurations").where("tenant_id", "=", t).where("connection_id", "=", n).selectAll().executeTakeFirst();
|
|
5324
|
-
return r ?
|
|
5346
|
+
return r ? to(r) : null;
|
|
5325
5347
|
},
|
|
5326
5348
|
async update(t, n, r) {
|
|
5327
5349
|
let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
@@ -5340,13 +5362,13 @@ function J(e) {
|
|
|
5340
5362
|
token_id: e.token_id,
|
|
5341
5363
|
connection_id: e.connection_id,
|
|
5342
5364
|
token_hash: e.token_hash,
|
|
5343
|
-
scopes:
|
|
5365
|
+
scopes: eo(e.scopes),
|
|
5344
5366
|
valid_until: e.valid_until ?? void 0,
|
|
5345
5367
|
created_at: e.created_at,
|
|
5346
5368
|
last_used_at: e.last_used_at ?? void 0
|
|
5347
5369
|
};
|
|
5348
5370
|
}
|
|
5349
|
-
function
|
|
5371
|
+
function ro(e) {
|
|
5350
5372
|
return {
|
|
5351
5373
|
async create(t, n) {
|
|
5352
5374
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5389,7 +5411,7 @@ function Qa(e) {
|
|
|
5389
5411
|
}
|
|
5390
5412
|
};
|
|
5391
5413
|
}
|
|
5392
|
-
function
|
|
5414
|
+
function io(e) {
|
|
5393
5415
|
return {
|
|
5394
5416
|
connection_id: e.connection_id,
|
|
5395
5417
|
external_id: e.external_id,
|
|
@@ -5397,7 +5419,7 @@ function $a(e) {
|
|
|
5397
5419
|
created_at: e.created_at
|
|
5398
5420
|
};
|
|
5399
5421
|
}
|
|
5400
|
-
function
|
|
5422
|
+
function ao(e) {
|
|
5401
5423
|
return {
|
|
5402
5424
|
async create(t, n) {
|
|
5403
5425
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5416,11 +5438,11 @@ function eo(e) {
|
|
|
5416
5438
|
},
|
|
5417
5439
|
async getByExternalId(t, n, r) {
|
|
5418
5440
|
let i = await e.selectFrom("scim_external_ids").where("tenant_id", "=", t).where("connection_id", "=", n).where("external_id", "=", r).selectAll().executeTakeFirst();
|
|
5419
|
-
return i ?
|
|
5441
|
+
return i ? io(i) : null;
|
|
5420
5442
|
},
|
|
5421
5443
|
async getByUserId(t, n, r) {
|
|
5422
5444
|
let i = await e.selectFrom("scim_external_ids").where("tenant_id", "=", t).where("connection_id", "=", n).where("user_id", "=", r).selectAll().executeTakeFirst();
|
|
5423
|
-
return i ?
|
|
5445
|
+
return i ? io(i) : null;
|
|
5424
5446
|
},
|
|
5425
5447
|
async remove(t, n, r) {
|
|
5426
5448
|
let i = await e.deleteFrom("scim_external_ids").where("tenant_id", "=", t).where("connection_id", "=", n).where("user_id", "=", r).executeTakeFirst();
|
|
@@ -5431,7 +5453,7 @@ function eo(e) {
|
|
|
5431
5453
|
//#endregion
|
|
5432
5454
|
//#region src/tenantOperations/index.ts
|
|
5433
5455
|
function Y(e) {
|
|
5434
|
-
return
|
|
5456
|
+
return _e.parse({
|
|
5435
5457
|
id: e.id,
|
|
5436
5458
|
tenant_id: e.tenant_id,
|
|
5437
5459
|
rollout_id: e.rollout_id,
|
|
@@ -5449,10 +5471,10 @@ function Y(e) {
|
|
|
5449
5471
|
finished_at: e.finished_at
|
|
5450
5472
|
});
|
|
5451
5473
|
}
|
|
5452
|
-
function
|
|
5474
|
+
function oo(e) {
|
|
5453
5475
|
return {
|
|
5454
5476
|
async create(n) {
|
|
5455
|
-
let r =
|
|
5477
|
+
let r = ge.parse(n), i = (/* @__PURE__ */ new Date()).toISOString(), a = {
|
|
5456
5478
|
id: `op_${t()}`,
|
|
5457
5479
|
tenant_id: r.tenant_id,
|
|
5458
5480
|
rollout_id: r.rollout_id ?? null,
|
|
@@ -5504,27 +5526,27 @@ function to(e) {
|
|
|
5504
5526
|
}
|
|
5505
5527
|
//#endregion
|
|
5506
5528
|
//#region src/utils/monotonic-id.ts
|
|
5507
|
-
var
|
|
5508
|
-
function
|
|
5529
|
+
var so = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", X = 32, co = 10, lo = 4, uo = 10;
|
|
5530
|
+
function fo(e, t) {
|
|
5509
5531
|
let n = "";
|
|
5510
|
-
for (let r = t; r > 0; r--) n =
|
|
5532
|
+
for (let r = t; r > 0; r--) n = so.charAt(e % X) + n, e = Math.floor(e / X);
|
|
5511
5533
|
return n;
|
|
5512
5534
|
}
|
|
5513
|
-
function
|
|
5514
|
-
let e = new Uint8Array(
|
|
5535
|
+
function po() {
|
|
5536
|
+
let e = new Uint8Array(uo);
|
|
5515
5537
|
crypto.getRandomValues(e);
|
|
5516
5538
|
let t = "";
|
|
5517
|
-
for (let n = 0; n <
|
|
5539
|
+
for (let n = 0; n < uo; n++) t += so.charAt(e[n] % X);
|
|
5518
5540
|
return t;
|
|
5519
5541
|
}
|
|
5520
|
-
var
|
|
5521
|
-
function
|
|
5542
|
+
var mo = 0, Z = 0;
|
|
5543
|
+
function ho() {
|
|
5522
5544
|
let e = Date.now();
|
|
5523
|
-
return e ===
|
|
5545
|
+
return e === mo ? Z++ : (mo = e, Z = 0), fo(e, co) + fo(Z, lo) + po();
|
|
5524
5546
|
}
|
|
5525
5547
|
//#endregion
|
|
5526
5548
|
//#region src/tenantOperationEvents/index.ts
|
|
5527
|
-
function
|
|
5549
|
+
function go(e) {
|
|
5528
5550
|
if (!e) return null;
|
|
5529
5551
|
try {
|
|
5530
5552
|
let t = JSON.parse(e);
|
|
@@ -5532,22 +5554,22 @@ function uo(e) {
|
|
|
5532
5554
|
} catch {}
|
|
5533
5555
|
return null;
|
|
5534
5556
|
}
|
|
5535
|
-
function
|
|
5536
|
-
return
|
|
5557
|
+
function _o(e) {
|
|
5558
|
+
return he.parse({
|
|
5537
5559
|
id: e.id,
|
|
5538
5560
|
operation_id: e.operation_id,
|
|
5539
5561
|
step: e.step,
|
|
5540
5562
|
outcome: e.outcome,
|
|
5541
|
-
detail:
|
|
5563
|
+
detail: go(e.detail),
|
|
5542
5564
|
attempt: e.attempt,
|
|
5543
5565
|
created_at: e.created_at
|
|
5544
5566
|
});
|
|
5545
5567
|
}
|
|
5546
|
-
function
|
|
5568
|
+
function vo(e) {
|
|
5547
5569
|
return {
|
|
5548
5570
|
async create(t) {
|
|
5549
|
-
let n =
|
|
5550
|
-
id: `evt_${
|
|
5571
|
+
let n = me.parse(t), r = {
|
|
5572
|
+
id: `evt_${ho()}`,
|
|
5551
5573
|
operation_id: n.operation_id,
|
|
5552
5574
|
step: n.step,
|
|
5553
5575
|
outcome: n.outcome,
|
|
@@ -5555,12 +5577,12 @@ function po(e) {
|
|
|
5555
5577
|
attempt: n.attempt,
|
|
5556
5578
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5557
5579
|
};
|
|
5558
|
-
return await e.insertInto("tenant_operation_events").values(r).execute(),
|
|
5580
|
+
return await e.insertInto("tenant_operation_events").values(r).execute(), _o(r);
|
|
5559
5581
|
},
|
|
5560
5582
|
async listByOperation(t, n = {}) {
|
|
5561
5583
|
let r = n.page ?? 0, i = n.per_page ?? 100, a = await e.selectFrom("tenant_operation_events").where("operation_id", "=", t).selectAll().orderBy("created_at", "asc").orderBy("id", "asc").offset(r * i).limit(i).execute();
|
|
5562
5584
|
return {
|
|
5563
|
-
events: a.map(
|
|
5585
|
+
events: a.map(_o),
|
|
5564
5586
|
start: r * i,
|
|
5565
5587
|
limit: i,
|
|
5566
5588
|
length: a.length
|
|
@@ -5570,7 +5592,7 @@ function po(e) {
|
|
|
5570
5592
|
}
|
|
5571
5593
|
//#endregion
|
|
5572
5594
|
//#region src/rollouts/index.ts
|
|
5573
|
-
function
|
|
5595
|
+
function yo(e) {
|
|
5574
5596
|
if (!e) return null;
|
|
5575
5597
|
try {
|
|
5576
5598
|
return JSON.parse(e);
|
|
@@ -5578,26 +5600,26 @@ function mo(e) {
|
|
|
5578
5600
|
return null;
|
|
5579
5601
|
}
|
|
5580
5602
|
}
|
|
5581
|
-
function
|
|
5582
|
-
return
|
|
5603
|
+
function bo(e) {
|
|
5604
|
+
return de.parse({
|
|
5583
5605
|
id: e.id,
|
|
5584
5606
|
kind: e.kind,
|
|
5585
5607
|
status: e.status,
|
|
5586
5608
|
target_worker_version: e.target_worker_version,
|
|
5587
5609
|
target_database_version: e.target_database_version,
|
|
5588
5610
|
wave_size: e.wave_size,
|
|
5589
|
-
canary_tenant_ids:
|
|
5590
|
-
filter:
|
|
5611
|
+
canary_tenant_ids: yo(e.canary_tenant_ids),
|
|
5612
|
+
filter: yo(e.filter),
|
|
5591
5613
|
initiated_by: e.initiated_by,
|
|
5592
5614
|
created_at: e.created_at,
|
|
5593
5615
|
updated_at: e.updated_at,
|
|
5594
5616
|
finished_at: e.finished_at
|
|
5595
5617
|
});
|
|
5596
5618
|
}
|
|
5597
|
-
function
|
|
5619
|
+
function xo(e) {
|
|
5598
5620
|
return {
|
|
5599
5621
|
async create(n) {
|
|
5600
|
-
let r =
|
|
5622
|
+
let r = ue.parse(n), i = (/* @__PURE__ */ new Date()).toISOString(), a = {
|
|
5601
5623
|
id: `rol_${t()}`,
|
|
5602
5624
|
kind: r.kind,
|
|
5603
5625
|
status: "pending",
|
|
@@ -5611,16 +5633,16 @@ function go(e) {
|
|
|
5611
5633
|
updated_at: i,
|
|
5612
5634
|
finished_at: null
|
|
5613
5635
|
};
|
|
5614
|
-
return await e.insertInto("rollouts").values(a).execute(),
|
|
5636
|
+
return await e.insertInto("rollouts").values(a).execute(), bo(a);
|
|
5615
5637
|
},
|
|
5616
5638
|
async get(t) {
|
|
5617
5639
|
let n = await e.selectFrom("rollouts").where("id", "=", t).selectAll().executeTakeFirst();
|
|
5618
|
-
return n ?
|
|
5640
|
+
return n ? bo(n) : null;
|
|
5619
5641
|
},
|
|
5620
5642
|
async list(t = {}) {
|
|
5621
5643
|
let n = t.page ?? 0, r = t.per_page ?? 50, i = await e.selectFrom("rollouts").selectAll().orderBy("created_at", "desc").orderBy("id", "desc").offset(n * r).limit(r).execute();
|
|
5622
5644
|
return {
|
|
5623
|
-
rollouts: i.map(
|
|
5645
|
+
rollouts: i.map(bo),
|
|
5624
5646
|
start: n * r,
|
|
5625
5647
|
limit: r,
|
|
5626
5648
|
length: i.length
|
|
@@ -5640,7 +5662,7 @@ function go(e) {
|
|
|
5640
5662
|
}
|
|
5641
5663
|
//#endregion
|
|
5642
5664
|
//#region migrate/ReferenceMigrationProvider.ts
|
|
5643
|
-
var
|
|
5665
|
+
var So = class {
|
|
5644
5666
|
migrations;
|
|
5645
5667
|
constructor(e) {
|
|
5646
5668
|
this.migrations = e;
|
|
@@ -5648,10 +5670,10 @@ var _o = class {
|
|
|
5648
5670
|
async getMigrations() {
|
|
5649
5671
|
return this.migrations;
|
|
5650
5672
|
}
|
|
5651
|
-
},
|
|
5652
|
-
down: () =>
|
|
5653
|
-
up: () =>
|
|
5654
|
-
}),
|
|
5673
|
+
}, Co = /* @__PURE__ */ w({
|
|
5674
|
+
down: () => Do,
|
|
5675
|
+
up: () => Eo
|
|
5676
|
+
}), wo = [
|
|
5655
5677
|
{
|
|
5656
5678
|
table: "authentication_methods",
|
|
5657
5679
|
name: "fk_authentication_methods_tenants",
|
|
@@ -5917,7 +5939,7 @@ var _o = class {
|
|
|
5917
5939
|
onDelete: "cascade"
|
|
5918
5940
|
}
|
|
5919
5941
|
];
|
|
5920
|
-
async function
|
|
5942
|
+
async function To(e) {
|
|
5921
5943
|
try {
|
|
5922
5944
|
return await f`select sqlite_version()`.execute(e), !0;
|
|
5923
5945
|
} catch {
|
|
@@ -5926,14 +5948,14 @@ async function bo(e) {
|
|
|
5926
5948
|
}
|
|
5927
5949
|
function Q(e, t) {
|
|
5928
5950
|
let n = e;
|
|
5929
|
-
for (let e of
|
|
5951
|
+
for (let e of wo) e.table === t && (n = n.addForeignKeyConstraint(e.name, e.columns, e.references, e.referencedColumns, (t) => {
|
|
5930
5952
|
let n = t;
|
|
5931
5953
|
return e.onDelete && (n = n.onDelete(e.onDelete)), e.onUpdate && (n = n.onUpdate(e.onUpdate)), n;
|
|
5932
5954
|
}));
|
|
5933
5955
|
return n;
|
|
5934
5956
|
}
|
|
5935
|
-
async function
|
|
5936
|
-
let t = await
|
|
5957
|
+
async function Eo(e) {
|
|
5958
|
+
let t = await To(e);
|
|
5937
5959
|
await e.schema.createTable("tenants").addColumn("id", f`varchar(255)`, (e) => e.notNull()).addColumn("audience", f`varchar(255)`).addColumn("sender_email", f`varchar(255)`).addColumn("sender_name", f`varchar(255)`).addColumn("created_at", f`varchar(255)`, (e) => e.notNull()).addColumn("updated_at", f`varchar(255)`, (e) => e.notNull()).addColumn("support_url", f`varchar(255)`).addColumn("idle_session_lifetime", f`int`).addColumn("session_lifetime", f`int`).addColumn("session_cookie", f`text`).addColumn("allowed_logout_urls", f`text`).addColumn("ephemeral_session_lifetime", f`int`).addColumn("idle_ephemeral_session_lifetime", f`int`).addColumn("default_redirection_uri", f`text`).addColumn("enabled_locales", f`text`).addColumn("default_directory", f`varchar(255)`).addColumn("error_page", f`text`).addColumn("flags", f`text`).addColumn("friendly_name", f`varchar(255)`).addColumn("picture_url", f`text`).addColumn("support_email", f`varchar(255)`).addColumn("sandbox_version", f`varchar(50)`).addColumn("sandbox_versions_available", f`text`).addColumn("legacy_sandbox_version", f`varchar(50)`).addColumn("change_password", f`text`).addColumn("guardian_mfa_page", f`text`).addColumn("device_flow", f`text`).addColumn("default_token_quota", f`text`).addColumn("default_audience", f`varchar(255)`).addColumn("default_organization", f`varchar(255)`).addColumn("sessions", f`text`).addColumn("oidc_logout", f`text`).addColumn("allow_organization_name_in_authentication_api", f`int`).addColumn("customize_mfa_in_postlogin_action", f`int`).addColumn("acr_values_supported", f`text`).addColumn("mtls", f`text`).addColumn("pushed_authorization_requests_supported", f`int`).addColumn("authorization_response_iss_parameter_supported", f`int`).addColumn("mfa", f`text`).addColumn("attack_protection", f`text`).addColumn("default_client_id", f`varchar(255)`).addColumn("deployment_type", f`varchar(16)`, (e) => e.notNull().defaultTo("shared")).addColumn("provisioning_state", f`varchar(16)`, (e) => e.notNull().defaultTo("ready")).addColumn("provisioning_error", f`varchar(2048)`).addColumn("provisioning_state_changed_at", f`varchar(35)`).addColumn("bundle_configuration", f`varchar(64)`).addColumn("worker_version", f`varchar(64)`).addColumn("worker_script_name", f`varchar(255)`).addColumn("storage_kind", f`varchar(32)`).addColumn("d1_database_id", f`varchar(64)`).addColumn("database_version", f`varchar(64)`).addPrimaryKeyConstraint("tenants_pk", ["id"]).execute(), await e.schema.createTable("action_executions").addColumn("id", f`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", f`varchar(191)`, (e) => e.notNull()).addColumn("trigger_id", f`varchar(64)`, (e) => e.notNull()).addColumn("status", f`varchar(32)`, (e) => e.notNull()).addColumn("results", f`text`, (e) => e.notNull()).addColumn("logs", f`text`).addColumn("created_at_ts", f`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", f`bigint`, (e) => e.notNull()).addPrimaryKeyConstraint("action_executions_pk", ["id"]).execute(), await e.schema.createTable("action_versions").addColumn("id", f`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", f`varchar(191)`, (e) => e.notNull()).addColumn("action_id", f`varchar(255)`, (e) => e.notNull()).addColumn("number", f`int`, (e) => e.notNull()).addColumn("code", f`text`, (e) => e.notNull()).addColumn("runtime", f`varchar(50)`).addColumn("secrets", f`text`).addColumn("dependencies", f`text`).addColumn("supported_triggers", f`text`).addColumn("deployed", f`int`, (e) => e.notNull().defaultTo(0)).addColumn("created_at_ts", f`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", f`bigint`, (e) => e.notNull()).addPrimaryKeyConstraint("action_versions_pk", ["id"]).execute(), await e.schema.createTable("actions").addColumn("id", f`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", f`varchar(191)`, (e) => e.notNull()).addColumn("name", f`varchar(255)`, (e) => e.notNull()).addColumn("code", f`text`, (e) => e.notNull()).addColumn("runtime", f`varchar(50)`).addColumn("status", f`varchar(50)`, (e) => e.defaultTo("built")).addColumn("secrets", f`text`).addColumn("dependencies", f`text`).addColumn("supported_triggers", f`text`).addColumn("deployed_at_ts", f`bigint`).addColumn("created_at_ts", f`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", f`bigint`, (e) => e.notNull()).addColumn("is_system", f`int`, (e) => e.notNull().defaultTo(0)).addColumn("inherit", f`int`, (e) => e.notNull().defaultTo(0)).addPrimaryKeyConstraint("actions_pk", ["id"]).execute();
|
|
5938
5960
|
{
|
|
5939
5961
|
let n = e.schema.createTable("authentication_methods").addColumn("id", f`varchar(26)`, (e) => e.notNull()).addColumn("tenant_id", f`varchar(191)`, (e) => e.notNull()).addColumn("user_id", f`varchar(255)`, (e) => e.notNull()).addColumn("type", f`varchar(32)`, (e) => e.notNull()).addColumn("phone_number", f`varchar(32)`).addColumn("totp_secret", f`varchar(255)`).addColumn("confirmed", f`int`, (e) => e.notNull().defaultTo(0)).addColumn("created_at_ts", f`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", f`bigint`, (e) => e.notNull()).addColumn("credential_id", f`varchar(512)`).addColumn("public_key", f`text`).addColumn("sign_count", f`int`).addColumn("credential_backed_up", f`int`).addColumn("transports", f`varchar(512)`).addColumn("friendly_name", f`varchar(255)`).addPrimaryKeyConstraint("authentication_methods_pk", ["id"]);
|
|
@@ -6120,40 +6142,40 @@ async function xo(e) {
|
|
|
6120
6142
|
"tenant_id",
|
|
6121
6143
|
"phone_number",
|
|
6122
6144
|
"provider"
|
|
6123
|
-
]).execute(), await e.schema.createIndex("users_user_id_tenant_id").on("users").columns(["user_id", "tenant_id"]).execute(), t && (await e.schema.createIndex("FK_codes_user_id_tenant_id_constraint").on("codes").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("grants_user_id_constraint").on("grants").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("login_sessions_session_fk").on("login_sessions").columns(["tenant_id", "session_id"]).execute(), await e.schema.createIndex("organization_connections_organization_fk").on("organization_connections").columns(["organization_id"]).execute(), await e.schema.createIndex("password_history_user_id_tenant_id_constraint").on("passwords").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("refresh_tokens_client_fk").on("refresh_tokens").columns(["tenant_id", "client_id"]).execute(), await e.schema.createIndex("sessions_user_fk").on("sessions").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("user_activity_user_id_constraint").on("user_activity").columns(["user_id", "tenant_id"]).execute()), !t) for (let t of
|
|
6145
|
+
]).execute(), await e.schema.createIndex("users_user_id_tenant_id").on("users").columns(["user_id", "tenant_id"]).execute(), t && (await e.schema.createIndex("FK_codes_user_id_tenant_id_constraint").on("codes").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("grants_user_id_constraint").on("grants").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("login_sessions_session_fk").on("login_sessions").columns(["tenant_id", "session_id"]).execute(), await e.schema.createIndex("organization_connections_organization_fk").on("organization_connections").columns(["organization_id"]).execute(), await e.schema.createIndex("password_history_user_id_tenant_id_constraint").on("passwords").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("refresh_tokens_client_fk").on("refresh_tokens").columns(["tenant_id", "client_id"]).execute(), await e.schema.createIndex("sessions_user_fk").on("sessions").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("user_activity_user_id_constraint").on("user_activity").columns(["user_id", "tenant_id"]).execute()), !t) for (let t of wo) await e.schema.alterTable(t.table).addForeignKeyConstraint(t.name, t.columns, t.references, t.referencedColumns, (e) => {
|
|
6124
6146
|
let n = e;
|
|
6125
6147
|
return t.onDelete && (n = n.onDelete(t.onDelete)), t.onUpdate && (n = n.onUpdate(t.onUpdate)), n;
|
|
6126
6148
|
}).execute();
|
|
6127
6149
|
}
|
|
6128
|
-
async function
|
|
6150
|
+
async function Do(e) {
|
|
6129
6151
|
await e.schema.dropTable("user_roles").ifExists().execute(), await e.schema.dropTable("user_permissions").ifExists().execute(), await e.schema.dropTable("user_organizations").ifExists().execute(), await e.schema.dropTable("user_activity").ifExists().execute(), await e.schema.dropTable("universal_login_templates").ifExists().execute(), await e.schema.dropTable("themes").ifExists().execute(), await e.schema.dropTable("tenant_operation_events").ifExists().execute(), await e.schema.dropTable("tenant_operations").ifExists().execute(), await e.schema.dropTable("rollouts").ifExists().execute(), await e.schema.dropTable("roles").ifExists().execute(), await e.schema.dropTable("role_permissions").ifExists().execute(), await e.schema.dropTable("resource_servers").ifExists().execute(), await e.schema.dropTable("refresh_tokens").ifExists().execute(), await e.schema.dropTable("proxy_routes").ifExists().execute(), await e.schema.dropTable("prompt_settings").ifExists().execute(), await e.schema.dropTable("passwords").ifExists().execute(), await e.schema.dropTable("outbox_events").ifExists().execute(), await e.schema.dropTable("organization_connections").ifExists().execute(), await e.schema.dropTable("organizations").ifExists().execute(), await e.schema.dropTable("migrations").ifExists().execute(), await e.schema.dropTable("migration_sources").ifExists().execute(), await e.schema.dropTable("logs").ifExists().execute(), await e.schema.dropTable("login_sessions").ifExists().execute(), await e.schema.dropTable("sessions").ifExists().execute(), await e.schema.dropTable("log_streams").ifExists().execute(), await e.schema.dropTable("keys").ifExists().execute(), await e.schema.dropTable("invites").ifExists().execute(), await e.schema.dropTable("hooks").ifExists().execute(), await e.schema.dropTable("hook_code").ifExists().execute(), await e.schema.dropTable("grants").ifExists().execute(), await e.schema.dropTable("forms").ifExists().execute(), await e.schema.dropTable("flows").ifExists().execute(), await e.schema.dropTable("email_templates").ifExists().execute(), await e.schema.dropTable("email_providers").ifExists().execute(), await e.schema.dropTable("custom_text").ifExists().execute(), await e.schema.dropTable("custom_domains").ifExists().execute(), await e.schema.dropTable("control_plane_comm_keys").ifExists().execute(), await e.schema.dropTable("connections").ifExists().execute(), await e.schema.dropTable("codes").ifExists().execute(), await e.schema.dropTable("users").ifExists().execute(), await e.schema.dropTable("client_registration_tokens").ifExists().execute(), await e.schema.dropTable("client_grants").ifExists().execute(), await e.schema.dropTable("clients").ifExists().execute(), await e.schema.dropTable("branding").ifExists().execute(), await e.schema.dropTable("authentication_methods").ifExists().execute(), await e.schema.dropTable("actions").ifExists().execute(), await e.schema.dropTable("action_versions").ifExists().execute(), await e.schema.dropTable("action_executions").ifExists().execute(), await e.schema.dropTable("tenants").ifExists().execute();
|
|
6130
6152
|
}
|
|
6131
6153
|
//#endregion
|
|
6132
6154
|
//#region migrate/log.ts
|
|
6133
|
-
var
|
|
6134
|
-
function
|
|
6135
|
-
|
|
6155
|
+
var Oo = !1;
|
|
6156
|
+
function ko(e) {
|
|
6157
|
+
Oo = e;
|
|
6136
6158
|
}
|
|
6137
6159
|
function $(...e) {
|
|
6138
|
-
|
|
6160
|
+
Oo && console.log(...e);
|
|
6139
6161
|
}
|
|
6140
|
-
function
|
|
6162
|
+
function Ao(...e) {
|
|
6141
6163
|
console.warn(...e);
|
|
6142
6164
|
}
|
|
6143
6165
|
//#endregion
|
|
6144
6166
|
//#region migrate/migrations/2026-07-16T15:00:00_codes_expires_at_ts.ts
|
|
6145
|
-
var
|
|
6146
|
-
down: () =>
|
|
6147
|
-
up: () =>
|
|
6148
|
-
}),
|
|
6149
|
-
async function
|
|
6167
|
+
var jo = /* @__PURE__ */ w({
|
|
6168
|
+
down: () => Ho,
|
|
6169
|
+
up: () => zo
|
|
6170
|
+
}), Mo = 5e4, No = 500;
|
|
6171
|
+
async function Po(e) {
|
|
6150
6172
|
try {
|
|
6151
6173
|
return await f`SELECT VERSION()`.execute(e), "mysql";
|
|
6152
6174
|
} catch {
|
|
6153
6175
|
return "sqlite";
|
|
6154
6176
|
}
|
|
6155
6177
|
}
|
|
6156
|
-
async function
|
|
6178
|
+
async function Fo(e, t, n) {
|
|
6157
6179
|
try {
|
|
6158
6180
|
await e.schema.alterTable(t).addColumn(n, "bigint").execute();
|
|
6159
6181
|
} catch (e) {
|
|
@@ -6164,7 +6186,7 @@ async function Ao(e, t, n) {
|
|
|
6164
6186
|
throw e;
|
|
6165
6187
|
}
|
|
6166
6188
|
}
|
|
6167
|
-
async function
|
|
6189
|
+
async function Io(e, t, n, r) {
|
|
6168
6190
|
try {
|
|
6169
6191
|
await e.schema.createIndex(t).on(n).column(r).execute();
|
|
6170
6192
|
} catch (e) {
|
|
@@ -6175,21 +6197,21 @@ async function jo(e, t, n, r) {
|
|
|
6175
6197
|
throw e;
|
|
6176
6198
|
}
|
|
6177
6199
|
}
|
|
6178
|
-
async function
|
|
6200
|
+
async function Lo(e, t) {
|
|
6179
6201
|
let n = (/* @__PURE__ */ new Date()).toISOString(), r = 0;
|
|
6180
6202
|
if (t === "sqlite") {
|
|
6181
6203
|
let t = await e.deleteFrom("codes").where("expires_at", "<", n).executeTakeFirst();
|
|
6182
6204
|
r = Number(t.numDeletedRows);
|
|
6183
6205
|
} else {
|
|
6184
|
-
let t =
|
|
6185
|
-
for (; t >=
|
|
6186
|
-
let i = await e.deleteFrom("codes").where("expires_at", "<", n).limit(
|
|
6206
|
+
let t = Mo;
|
|
6207
|
+
for (; t >= Mo;) {
|
|
6208
|
+
let i = await e.deleteFrom("codes").where("expires_at", "<", n).limit(Mo).executeTakeFirst();
|
|
6187
6209
|
t = Number(i.numDeletedRows), r += t, t > 0 && $(` Pruned ${r} expired codes row(s)...`);
|
|
6188
6210
|
}
|
|
6189
6211
|
}
|
|
6190
6212
|
return r;
|
|
6191
6213
|
}
|
|
6192
|
-
async function
|
|
6214
|
+
async function Ro(e) {
|
|
6193
6215
|
let t = 0;
|
|
6194
6216
|
for (;;) {
|
|
6195
6217
|
let n = await e.selectFrom("codes").select([
|
|
@@ -6197,33 +6219,33 @@ async function No(e) {
|
|
|
6197
6219
|
"code_type",
|
|
6198
6220
|
"tenant_id",
|
|
6199
6221
|
"expires_at"
|
|
6200
|
-
]).where("expires_at_ts", "is", null).limit(
|
|
6222
|
+
]).where("expires_at_ts", "is", null).limit(No).execute();
|
|
6201
6223
|
if (n.length === 0) break;
|
|
6202
6224
|
for (let t of n) {
|
|
6203
6225
|
let n = Date.parse(t.expires_at);
|
|
6204
6226
|
await e.updateTable("codes").set({ expires_at_ts: Number.isNaN(n) ? 0 : n }).where("code_id", "=", t.code_id).where("code_type", "=", t.code_type).where("tenant_id", "=", t.tenant_id).execute();
|
|
6205
6227
|
}
|
|
6206
|
-
if (t += n.length, n.length <
|
|
6228
|
+
if (t += n.length, n.length < No) break;
|
|
6207
6229
|
}
|
|
6208
6230
|
return t;
|
|
6209
6231
|
}
|
|
6210
|
-
async function
|
|
6211
|
-
let t = await
|
|
6232
|
+
async function zo(e) {
|
|
6233
|
+
let t = await Po(e);
|
|
6212
6234
|
try {
|
|
6213
|
-
let n = await
|
|
6235
|
+
let n = await Lo(e, t);
|
|
6214
6236
|
$(n === 0 ? " No expired codes to prune" : ` Pruned ${n} expired codes row(s) total`);
|
|
6215
6237
|
} catch (e) {
|
|
6216
|
-
|
|
6238
|
+
Ao(` Warning: Could not prune expired codes: ${e instanceof Error ? e.message : String(e)}`);
|
|
6217
6239
|
}
|
|
6218
|
-
await
|
|
6240
|
+
await Fo(e, "codes", "expires_at_ts"), await Io(e, "idx_codes_expires_at_ts", "codes", "expires_at_ts");
|
|
6219
6241
|
try {
|
|
6220
|
-
let t = await
|
|
6242
|
+
let t = await Ro(e);
|
|
6221
6243
|
$(t === 0 ? " No codes rows needed an expires_at_ts backfill" : ` Backfilled expires_at_ts for ${t} codes row(s)`);
|
|
6222
6244
|
} catch (e) {
|
|
6223
|
-
|
|
6245
|
+
Ao(` Warning: Could not backfill codes.expires_at_ts: ${e instanceof Error ? e.message : String(e)}`);
|
|
6224
6246
|
}
|
|
6225
6247
|
}
|
|
6226
|
-
async function
|
|
6248
|
+
async function Bo(e, t, n) {
|
|
6227
6249
|
try {
|
|
6228
6250
|
await e.schema.dropIndex(t).on(n).execute();
|
|
6229
6251
|
} catch (e) {
|
|
@@ -6231,7 +6253,7 @@ async function Fo(e, t, n) {
|
|
|
6231
6253
|
throw e;
|
|
6232
6254
|
}
|
|
6233
6255
|
}
|
|
6234
|
-
async function
|
|
6256
|
+
async function Vo(e, t, n) {
|
|
6235
6257
|
try {
|
|
6236
6258
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
6237
6259
|
} catch (e) {
|
|
@@ -6239,16 +6261,16 @@ async function Io(e, t, n) {
|
|
|
6239
6261
|
throw e;
|
|
6240
6262
|
}
|
|
6241
6263
|
}
|
|
6242
|
-
async function
|
|
6243
|
-
await
|
|
6264
|
+
async function Ho(e) {
|
|
6265
|
+
await Bo(e, "idx_codes_expires_at_ts", "codes"), await Vo(e, "codes", "expires_at_ts");
|
|
6244
6266
|
}
|
|
6245
6267
|
//#endregion
|
|
6246
6268
|
//#region migrate/migrations/2026-08-04T12:00:00_scim_inbound_provisioning.ts
|
|
6247
|
-
var
|
|
6248
|
-
down: () =>
|
|
6249
|
-
up: () =>
|
|
6269
|
+
var Uo = /* @__PURE__ */ w({
|
|
6270
|
+
down: () => Go,
|
|
6271
|
+
up: () => Wo
|
|
6250
6272
|
});
|
|
6251
|
-
async function
|
|
6273
|
+
async function Wo(e) {
|
|
6252
6274
|
await e.schema.createTable("scim_configurations").addColumn("connection_id", f`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", f`varchar(255)`, (e) => e.notNull()).addColumn("user_id_attribute", f`varchar(255)`, (e) => e.notNull().defaultTo("externalId")).addColumn("mapping", f`text`, (e) => e.notNull()).addColumn("created_at", f`varchar(35)`, (e) => e.notNull()).addColumn("updated_at", f`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("scim_configurations_pk", ["tenant_id", "connection_id"]).execute(), await e.schema.createTable("scim_tokens").addColumn("token_id", f`varchar(64)`, (e) => e.notNull()).addColumn("tenant_id", f`varchar(255)`, (e) => e.notNull()).addColumn("connection_id", f`varchar(255)`, (e) => e.notNull()).addColumn("token_hash", f`varchar(128)`, (e) => e.notNull()).addColumn("scopes", f`text`, (e) => e.notNull()).addColumn("valid_until", f`varchar(35)`).addColumn("created_at", f`varchar(35)`, (e) => e.notNull()).addColumn("last_used_at", f`varchar(35)`).addPrimaryKeyConstraint("scim_tokens_pk", ["tenant_id", "token_id"]).execute(), await e.schema.createIndex("scim_tokens_tenant_connection_idx").on("scim_tokens").columns(["tenant_id", "connection_id"]).execute(), await e.schema.createIndex("scim_tokens_tenant_hash_idx").on("scim_tokens").columns(["tenant_id", "token_hash"]).unique().execute(), await e.schema.createTable("scim_external_ids").addColumn("tenant_id", f`varchar(255)`, (e) => e.notNull()).addColumn("connection_id", f`varchar(255)`, (e) => e.notNull()).addColumn("external_id", f`varchar(255)`, (e) => e.notNull()).addColumn("user_id", f`varchar(255)`, (e) => e.notNull()).addColumn("created_at", f`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("scim_external_ids_pk", [
|
|
6253
6275
|
"tenant_id",
|
|
6254
6276
|
"connection_id",
|
|
@@ -6259,16 +6281,16 @@ async function zo(e) {
|
|
|
6259
6281
|
"external_id"
|
|
6260
6282
|
]).unique().execute();
|
|
6261
6283
|
}
|
|
6262
|
-
async function
|
|
6284
|
+
async function Go(e) {
|
|
6263
6285
|
await e.schema.dropTable("scim_external_ids").ifExists().execute(), await e.schema.dropTable("scim_tokens").ifExists().execute(), await e.schema.dropTable("scim_configurations").ifExists().execute();
|
|
6264
6286
|
}
|
|
6265
6287
|
//#endregion
|
|
6266
6288
|
//#region migrate/migrations/2026-08-05T12:00:00_user_blocked.ts
|
|
6267
|
-
var
|
|
6268
|
-
down: () =>
|
|
6269
|
-
up: () =>
|
|
6289
|
+
var Ko = /* @__PURE__ */ w({
|
|
6290
|
+
down: () => Xo,
|
|
6291
|
+
up: () => Jo
|
|
6270
6292
|
});
|
|
6271
|
-
async function
|
|
6293
|
+
async function qo(e, t, n) {
|
|
6272
6294
|
try {
|
|
6273
6295
|
await e.schema.alterTable(t).addColumn(n, f`tinyint(1)`).execute();
|
|
6274
6296
|
} catch (e) {
|
|
@@ -6276,10 +6298,10 @@ async function Ho(e, t, n) {
|
|
|
6276
6298
|
throw e;
|
|
6277
6299
|
}
|
|
6278
6300
|
}
|
|
6279
|
-
async function
|
|
6280
|
-
await
|
|
6301
|
+
async function Jo(e) {
|
|
6302
|
+
await qo(e, "users", "blocked");
|
|
6281
6303
|
}
|
|
6282
|
-
async function
|
|
6304
|
+
async function Yo(e, t, n) {
|
|
6283
6305
|
try {
|
|
6284
6306
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
6285
6307
|
} catch (e) {
|
|
@@ -6287,16 +6309,16 @@ async function Wo(e, t, n) {
|
|
|
6287
6309
|
throw e;
|
|
6288
6310
|
}
|
|
6289
6311
|
}
|
|
6290
|
-
async function
|
|
6291
|
-
await
|
|
6312
|
+
async function Xo(e) {
|
|
6313
|
+
await Yo(e, "users", "blocked");
|
|
6292
6314
|
}
|
|
6293
6315
|
//#endregion
|
|
6294
6316
|
//#region migrate/migrations/2026-08-09T12:00:00_prompt_settings_last_used.ts
|
|
6295
|
-
var
|
|
6296
|
-
down: () =>
|
|
6297
|
-
up: () =>
|
|
6317
|
+
var Zo = /* @__PURE__ */ w({
|
|
6318
|
+
down: () => ts,
|
|
6319
|
+
up: () => $o
|
|
6298
6320
|
});
|
|
6299
|
-
async function
|
|
6321
|
+
async function Qo(e, t, n) {
|
|
6300
6322
|
try {
|
|
6301
6323
|
await e.schema.alterTable(t).addColumn(n, f`tinyint(1)`).execute();
|
|
6302
6324
|
} catch (e) {
|
|
@@ -6304,10 +6326,10 @@ async function qo(e, t, n) {
|
|
|
6304
6326
|
throw e;
|
|
6305
6327
|
}
|
|
6306
6328
|
}
|
|
6307
|
-
async function
|
|
6308
|
-
await
|
|
6329
|
+
async function $o(e) {
|
|
6330
|
+
await Qo(e, "prompt_settings", "show_last_used_connection");
|
|
6309
6331
|
}
|
|
6310
|
-
async function
|
|
6332
|
+
async function es(e, t, n) {
|
|
6311
6333
|
try {
|
|
6312
6334
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
6313
6335
|
} catch (e) {
|
|
@@ -6315,16 +6337,16 @@ async function Yo(e, t, n) {
|
|
|
6315
6337
|
throw e;
|
|
6316
6338
|
}
|
|
6317
6339
|
}
|
|
6318
|
-
async function
|
|
6319
|
-
await
|
|
6340
|
+
async function ts(e) {
|
|
6341
|
+
await es(e, "prompt_settings", "show_last_used_connection");
|
|
6320
6342
|
}
|
|
6321
6343
|
//#endregion
|
|
6322
6344
|
//#region migrate/migrations/2026-08-10T12:00:00_action_executions_created_at_index.ts
|
|
6323
|
-
var
|
|
6324
|
-
down: () =>
|
|
6325
|
-
up: () =>
|
|
6345
|
+
var ns = /* @__PURE__ */ w({
|
|
6346
|
+
down: () => as,
|
|
6347
|
+
up: () => is
|
|
6326
6348
|
});
|
|
6327
|
-
async function
|
|
6349
|
+
async function rs(e, t, n, r) {
|
|
6328
6350
|
try {
|
|
6329
6351
|
await e.schema.createIndex(t).on(n).column(r).execute();
|
|
6330
6352
|
} catch (e) {
|
|
@@ -6335,10 +6357,10 @@ async function Qo(e, t, n, r) {
|
|
|
6335
6357
|
throw e;
|
|
6336
6358
|
}
|
|
6337
6359
|
}
|
|
6338
|
-
async function
|
|
6339
|
-
await
|
|
6360
|
+
async function is(e) {
|
|
6361
|
+
await rs(e, "idx_action_executions_created_at_ts", "action_executions", "created_at_ts");
|
|
6340
6362
|
}
|
|
6341
|
-
async function
|
|
6363
|
+
async function as(e) {
|
|
6342
6364
|
try {
|
|
6343
6365
|
await e.schema.dropIndex("idx_action_executions_created_at_ts").on("action_executions").execute();
|
|
6344
6366
|
} catch (e) {
|
|
@@ -6347,32 +6369,61 @@ async function es(e) {
|
|
|
6347
6369
|
}
|
|
6348
6370
|
}
|
|
6349
6371
|
//#endregion
|
|
6372
|
+
//#region migrate/migrations/2026-08-11T12:00:00_page_hooks.ts
|
|
6373
|
+
var os = /* @__PURE__ */ w({
|
|
6374
|
+
down: () => us,
|
|
6375
|
+
up: () => cs
|
|
6376
|
+
});
|
|
6377
|
+
async function ss(e, t, n, r) {
|
|
6378
|
+
try {
|
|
6379
|
+
await e.schema.alterTable(t).addColumn(n, r).execute();
|
|
6380
|
+
} catch (e) {
|
|
6381
|
+
if (e instanceof Error && (e.message.includes("1060") || e.message.toLowerCase().includes("duplicate column"))) return;
|
|
6382
|
+
throw e;
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
async function cs(e) {
|
|
6386
|
+
await ss(e, "hooks", "page_id", f`varchar(64)`), await ss(e, "hooks", "permission_required", f`varchar(255)`);
|
|
6387
|
+
}
|
|
6388
|
+
async function ls(e, t, n) {
|
|
6389
|
+
try {
|
|
6390
|
+
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
6391
|
+
} catch (e) {
|
|
6392
|
+
if (e instanceof Error && e.message.includes("1091")) return;
|
|
6393
|
+
throw e;
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
async function us(e) {
|
|
6397
|
+
await ls(e, "hooks", "permission_required"), await ls(e, "hooks", "page_id");
|
|
6398
|
+
}
|
|
6399
|
+
//#endregion
|
|
6350
6400
|
//#region migrate/migrations/index.ts
|
|
6351
|
-
var
|
|
6352
|
-
"2026-07-16T14:00:00_baseline":
|
|
6353
|
-
"2026-07-16T15:00:00_codes_expires_at_ts":
|
|
6354
|
-
"2026-08-04T12:00:00_scim_inbound_provisioning":
|
|
6355
|
-
"2026-08-05T12:00:00_user_blocked":
|
|
6356
|
-
"2026-08-09T12:00:00_prompt_settings_last_used":
|
|
6357
|
-
"2026-08-10T12:00:00_action_executions_created_at_index":
|
|
6401
|
+
var ds = {
|
|
6402
|
+
"2026-07-16T14:00:00_baseline": Co,
|
|
6403
|
+
"2026-07-16T15:00:00_codes_expires_at_ts": jo,
|
|
6404
|
+
"2026-08-04T12:00:00_scim_inbound_provisioning": Uo,
|
|
6405
|
+
"2026-08-05T12:00:00_user_blocked": Ko,
|
|
6406
|
+
"2026-08-09T12:00:00_prompt_settings_last_used": Zo,
|
|
6407
|
+
"2026-08-10T12:00:00_action_executions_created_at_index": ns,
|
|
6408
|
+
"2026-08-11T12:00:00_page_hooks": os
|
|
6358
6409
|
};
|
|
6359
6410
|
//#endregion
|
|
6360
6411
|
//#region migrate/migrate.ts
|
|
6361
|
-
async function
|
|
6362
|
-
|
|
6363
|
-
let { error: n, results: r } = await new
|
|
6412
|
+
async function fs(e, t = !1) {
|
|
6413
|
+
ko(t), t && console.log("migrating...");
|
|
6414
|
+
let { error: n, results: r } = await new ve({
|
|
6364
6415
|
db: e,
|
|
6365
|
-
provider: new
|
|
6416
|
+
provider: new So(ds)
|
|
6366
6417
|
}).migrateToLatest();
|
|
6367
6418
|
if (r?.forEach((e) => {
|
|
6368
6419
|
e.status === "Success" ? t && console.log(`migration "${e.migrationName}" was executed successfully`) : e.status === "Error" && console.error(`failed to execute migration "${e.migrationName}"`);
|
|
6369
6420
|
}), n) throw console.error("failed to migrate"), console.error(n), n;
|
|
6370
6421
|
}
|
|
6371
|
-
async function
|
|
6372
|
-
|
|
6373
|
-
let { error: n, results: r } = await new
|
|
6422
|
+
async function ps(e, t = !1) {
|
|
6423
|
+
ko(t), t && console.log("migrating...");
|
|
6424
|
+
let { error: n, results: r } = await new ve({
|
|
6374
6425
|
db: e,
|
|
6375
|
-
provider: new
|
|
6426
|
+
provider: new So(ds)
|
|
6376
6427
|
}).migrateDown();
|
|
6377
6428
|
if (r?.forEach((e) => {
|
|
6378
6429
|
e.status === "Success" ? t && console.log(`migration "${e.migrationName}" was reverted successfully`) : e.status === "Error" && console.error(`failed to execute migration "${e.migrationName}"`);
|
|
@@ -6380,64 +6431,64 @@ async function rs(e, t = !1) {
|
|
|
6380
6431
|
}
|
|
6381
6432
|
//#endregion
|
|
6382
6433
|
//#region src/index.ts
|
|
6383
|
-
function
|
|
6434
|
+
function ms(e, t = { useTransactions: !0 }) {
|
|
6384
6435
|
let n = {
|
|
6385
|
-
actions:
|
|
6386
|
-
actionExecutions:
|
|
6387
|
-
actionVersions:
|
|
6388
|
-
branding:
|
|
6389
|
-
clients:
|
|
6390
|
-
clientConnections:
|
|
6391
|
-
clientGrants:
|
|
6392
|
-
clientRegistrationTokens:
|
|
6393
|
-
codes:
|
|
6394
|
-
connections:
|
|
6395
|
-
emailProviders:
|
|
6396
|
-
emailTemplates:
|
|
6397
|
-
customDomains:
|
|
6398
|
-
flows:
|
|
6399
|
-
forms:
|
|
6400
|
-
hookCode:
|
|
6401
|
-
hooks:
|
|
6402
|
-
invites:
|
|
6403
|
-
keys:
|
|
6404
|
-
loginSessions:
|
|
6405
|
-
logs:
|
|
6406
|
-
logStreams:
|
|
6407
|
-
migrationSources:
|
|
6408
|
-
authenticationMethods:
|
|
6409
|
-
passwords:
|
|
6410
|
-
promptSettings:
|
|
6436
|
+
actions: Le(e),
|
|
6437
|
+
actionExecutions: Ue(e),
|
|
6438
|
+
actionVersions: Ke(e),
|
|
6439
|
+
branding: nr(e),
|
|
6440
|
+
clients: vn(e),
|
|
6441
|
+
clientConnections: wn(e),
|
|
6442
|
+
clientGrants: jn(e),
|
|
6443
|
+
clientRegistrationTokens: Hn(e),
|
|
6444
|
+
codes: nn(e),
|
|
6445
|
+
connections: un(e),
|
|
6446
|
+
emailProviders: Hr(e),
|
|
6447
|
+
emailTemplates: Yr(e),
|
|
6448
|
+
customDomains: $n(e),
|
|
6449
|
+
flows: yt(e),
|
|
6450
|
+
forms: fi(e),
|
|
6451
|
+
hookCode: _r(e),
|
|
6452
|
+
hooks: fr(e),
|
|
6453
|
+
invites: fa(e),
|
|
6454
|
+
keys: Kn(e),
|
|
6455
|
+
loginSessions: Nr(e),
|
|
6456
|
+
logs: It(e),
|
|
6457
|
+
logStreams: qa(e),
|
|
6458
|
+
migrationSources: Ja(e),
|
|
6459
|
+
authenticationMethods: Ia(e),
|
|
6460
|
+
passwords: qt(e),
|
|
6461
|
+
promptSettings: Lr(e),
|
|
6411
6462
|
proxyRoutes: q(e),
|
|
6412
|
-
scimConfigurations:
|
|
6413
|
-
scimTokens:
|
|
6414
|
-
scimExternalIds:
|
|
6415
|
-
refreshTokens:
|
|
6416
|
-
resourceServers:
|
|
6417
|
-
rolePermissions:
|
|
6418
|
-
grants:
|
|
6419
|
-
userPermissions:
|
|
6420
|
-
userRoles:
|
|
6421
|
-
roles:
|
|
6422
|
-
sessions:
|
|
6423
|
-
sessionCleanup:
|
|
6424
|
-
tenants:
|
|
6425
|
-
tenantOperations:
|
|
6426
|
-
tenantOperationEvents:
|
|
6427
|
-
rollouts:
|
|
6428
|
-
themes:
|
|
6429
|
-
universalLoginTemplates:
|
|
6430
|
-
customText:
|
|
6431
|
-
users:
|
|
6432
|
-
userActivity:
|
|
6433
|
-
organizations:
|
|
6434
|
-
organizationConnections:
|
|
6435
|
-
userOrganizations:
|
|
6436
|
-
stats:
|
|
6437
|
-
analytics:
|
|
6438
|
-
outbox:
|
|
6463
|
+
scimConfigurations: no(e),
|
|
6464
|
+
scimTokens: ro(e),
|
|
6465
|
+
scimExternalIds: ao(e),
|
|
6466
|
+
refreshTokens: ii(e),
|
|
6467
|
+
resourceServers: vi(e),
|
|
6468
|
+
rolePermissions: ki(e),
|
|
6469
|
+
grants: Fi(e),
|
|
6470
|
+
userPermissions: Bi(e),
|
|
6471
|
+
userRoles: Ki(e),
|
|
6472
|
+
roles: wi(e),
|
|
6473
|
+
sessions: Ht(e),
|
|
6474
|
+
sessionCleanup: oi(e),
|
|
6475
|
+
tenants: Dt(e),
|
|
6476
|
+
tenantOperations: oo(e),
|
|
6477
|
+
tenantOperationEvents: vo(e),
|
|
6478
|
+
rollouts: xo(e),
|
|
6479
|
+
themes: Sr(e),
|
|
6480
|
+
universalLoginTemplates: or(e),
|
|
6481
|
+
customText: ka(e),
|
|
6482
|
+
users: dt(e),
|
|
6483
|
+
userActivity: ct(e),
|
|
6484
|
+
organizations: Qi(e),
|
|
6485
|
+
organizationConnections: $i(e),
|
|
6486
|
+
userOrganizations: oa(e),
|
|
6487
|
+
stats: _a(e),
|
|
6488
|
+
analytics: Oa(e),
|
|
6489
|
+
outbox: Ka(e),
|
|
6439
6490
|
async transaction(r) {
|
|
6440
|
-
return t.useTransactions === !1 ? r(n) : e.transaction().execute(async (e) => r(
|
|
6491
|
+
return t.useTransactions === !1 ? r(n) : e.transaction().execute(async (e) => r(ms(e, {
|
|
6441
6492
|
...t,
|
|
6442
6493
|
useTransactions: !1
|
|
6443
6494
|
})));
|
|
@@ -6446,4 +6497,4 @@ function is(e, t = { useTransactions: !0 }) {
|
|
|
6446
6497
|
return n;
|
|
6447
6498
|
}
|
|
6448
6499
|
//#endregion
|
|
6449
|
-
export {
|
|
6500
|
+
export { Qa as createProxyDataAdapter, q as createProxyRoutesAdapter, ms as default, ps as migrateDown, fs as migrateToLatest };
|