@authhero/kysely-adapter 10.109.0 → 10.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kysely-adapter.cjs +6 -6
- package/dist/kysely-adapter.mjs +614 -614
- package/package.json +1 -1
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var yr = Object.defineProperty;
|
|
2
|
+
var Ja = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var me = (t, e, a) =>
|
|
7
|
-
var i = (t, e, a) => (
|
|
8
|
-
import { parseUserId as
|
|
5
|
+
var vr = (t, e, a) => e in t ? yr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
6
|
+
var me = (t, e, a) => vr(t, typeof e != "symbol" ? e + "" : e, a), oa = (t, e, a) => e.has(t) || Ja("Cannot " + a);
|
|
7
|
+
var i = (t, e, a) => (oa(t, e, "read from private field"), a ? a.call(t) : e.get(t)), T = (t, e, a) => e.has(t) ? Ja("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), b = (t, e, a, n) => (oa(t, e, "write to private field"), n ? n.call(t, a) : e.set(t, a), a), N = (t, e, a) => (oa(t, e, "access private method"), a);
|
|
8
|
+
import { parseUserId as Nr, flowSchema as Xt, codeSchema as Cr, loginSessionSchema as xr, LoginSessionState as pn, promptSettingSchema as Tr, formSchema as Rt, resourceServerSchema as br } from "@authhero/adapter-interfaces";
|
|
9
9
|
import "@hono/zod-openapi";
|
|
10
10
|
var ut = class extends Error {
|
|
11
11
|
/**
|
|
@@ -33,7 +33,7 @@ var ut = class extends Error {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
let Sr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",
|
|
36
|
+
let Sr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Or = (t) => crypto.getRandomValues(new Uint8Array(t)), kr = (t, e, a) => {
|
|
37
37
|
let n = (2 << Math.log2(t.length - 1)) - 1, r = -~(1.6 * n * e / t.length);
|
|
38
38
|
return (o = e) => {
|
|
39
39
|
let s = "";
|
|
@@ -43,13 +43,13 @@ let Sr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", br
|
|
|
43
43
|
if (s += t[u[l] & n] || "", s.length >= o) return s;
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
},
|
|
46
|
+
}, Er = (t, e = 21) => kr(t, e | 0, Or), K = (t = 21) => {
|
|
47
47
|
let e = "", a = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
48
48
|
for (; t--; )
|
|
49
49
|
e += Sr[a[t] & 63];
|
|
50
50
|
return e;
|
|
51
51
|
};
|
|
52
|
-
function
|
|
52
|
+
function Ir(t, e) {
|
|
53
53
|
return async (a, n) => {
|
|
54
54
|
const { identities: r, phone_verified: o, password: s, ...u } = n, l = {
|
|
55
55
|
...u,
|
|
@@ -110,40 +110,40 @@ function Er(t, e) {
|
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function S(t) {
|
|
114
114
|
if (t == null || typeof t != "object")
|
|
115
115
|
return t;
|
|
116
116
|
if (Array.isArray(t))
|
|
117
117
|
return t.map(
|
|
118
118
|
(a) => (
|
|
119
119
|
// Only recurse into objects; leave primitives untouched
|
|
120
|
-
a !== null && typeof a == "object" ?
|
|
120
|
+
a !== null && typeof a == "object" ? S(a) : a
|
|
121
121
|
)
|
|
122
122
|
);
|
|
123
123
|
const e = { ...t };
|
|
124
124
|
for (const a in e) {
|
|
125
125
|
const n = e[a];
|
|
126
126
|
n === null ? delete e[a] : n !== null && typeof n == "object" && (Array.isArray(n) ? e[a] = n.map(
|
|
127
|
-
(r) => r !== null && typeof r == "object" ?
|
|
128
|
-
) : e[a] =
|
|
127
|
+
(r) => r !== null && typeof r == "object" ? S(r) : r
|
|
128
|
+
) : e[a] = S(n));
|
|
129
129
|
}
|
|
130
130
|
return e;
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const $r = [
|
|
133
133
|
"email",
|
|
134
134
|
"email_verified",
|
|
135
135
|
"phone_number",
|
|
136
136
|
"phone_verified",
|
|
137
137
|
"username"
|
|
138
138
|
];
|
|
139
|
-
function
|
|
139
|
+
function zt(t, e = !1) {
|
|
140
140
|
const a = {
|
|
141
141
|
connection: t.connection,
|
|
142
142
|
provider: t.provider,
|
|
143
|
-
user_id:
|
|
143
|
+
user_id: Nr(t.user_id).id,
|
|
144
144
|
isSocial: !!t.is_social
|
|
145
145
|
};
|
|
146
|
-
for (const n of
|
|
146
|
+
for (const n of $r)
|
|
147
147
|
t[n] !== void 0 && t[n] !== null && (a[n] = n.endsWith("_verified") ? !!t[n] : t[n]);
|
|
148
148
|
if (!e) {
|
|
149
149
|
let n = {};
|
|
@@ -160,7 +160,7 @@ function Rt(t, e = !1) {
|
|
|
160
160
|
}
|
|
161
161
|
return a;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Ar(t) {
|
|
164
164
|
return async (e, a) => {
|
|
165
165
|
const [n, r] = await Promise.all([
|
|
166
166
|
t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).selectAll().executeTakeFirst(),
|
|
@@ -178,11 +178,11 @@ function $r(t) {
|
|
|
178
178
|
user_metadata: JSON.parse(n.user_metadata),
|
|
179
179
|
address: n.address ? JSON.parse(n.address) : void 0,
|
|
180
180
|
identities: [
|
|
181
|
-
|
|
182
|
-
...r.map((l) =>
|
|
181
|
+
zt(n, !0),
|
|
182
|
+
...r.map((l) => zt(l))
|
|
183
183
|
]
|
|
184
184
|
};
|
|
185
|
-
return
|
|
185
|
+
return S(u);
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
function q(t, e, a, n) {
|
|
@@ -257,7 +257,7 @@ function q(t, e, a, n) {
|
|
|
257
257
|
function W(t) {
|
|
258
258
|
return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Dr(t) {
|
|
261
261
|
return async (e, a = {}) => {
|
|
262
262
|
const { page: n = 0, per_page: r = 50, include_totals: o = !1, sort: s, q: u } = a;
|
|
263
263
|
let l = t.selectFrom("users").where("users.tenant_id", "=", e);
|
|
@@ -269,7 +269,7 @@ function Ar(t) {
|
|
|
269
269
|
const x = f.filter(
|
|
270
270
|
(O) => O.linked_to === v.user_id
|
|
271
271
|
);
|
|
272
|
-
return
|
|
272
|
+
return S({
|
|
273
273
|
...v,
|
|
274
274
|
email_verified: v.email_verified === 1,
|
|
275
275
|
phone_verified: v.phone_verified !== null ? v.phone_verified === 1 : void 0,
|
|
@@ -278,8 +278,8 @@ function Ar(t) {
|
|
|
278
278
|
user_metadata: JSON.parse(v.user_metadata),
|
|
279
279
|
address: v.address ? JSON.parse(v.address) : void 0,
|
|
280
280
|
identities: [
|
|
281
|
-
|
|
282
|
-
...x.map((O) =>
|
|
281
|
+
zt(v, !0),
|
|
282
|
+
...x.map((O) => zt(O))
|
|
283
283
|
]
|
|
284
284
|
});
|
|
285
285
|
});
|
|
@@ -299,7 +299,7 @@ function Ar(t) {
|
|
|
299
299
|
};
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function Pr(t) {
|
|
303
303
|
return async (e, a) => (await t.deleteFrom("mfa_enrollments").where("mfa_enrollments.tenant_id", "=", e).where(
|
|
304
304
|
"mfa_enrollments.user_id",
|
|
305
305
|
"in",
|
|
@@ -319,7 +319,7 @@ function dt(t, e = "", a = {}) {
|
|
|
319
319
|
}
|
|
320
320
|
return a;
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function gn(t, e) {
|
|
323
323
|
const a = {};
|
|
324
324
|
for (const [n, r] of Object.entries(t)) {
|
|
325
325
|
const o = e.find(
|
|
@@ -337,7 +337,7 @@ function pn(t, e) {
|
|
|
337
337
|
}
|
|
338
338
|
return a;
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function Rr(t) {
|
|
341
341
|
return async (e, a, n) => {
|
|
342
342
|
const r = dt({
|
|
343
343
|
...n,
|
|
@@ -350,26 +350,26 @@ function Pr(t) {
|
|
|
350
350
|
return (await t.updateTable("users").set(r).where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1;
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function zr(t) {
|
|
354
354
|
return async (e, a, n, r) => {
|
|
355
355
|
const o = { linked_to: null };
|
|
356
356
|
return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", `${n}|${r}`).where("users.linked_to", "=", `${a}`).execute()).length === 1;
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Fr(t, e) {
|
|
360
360
|
return {
|
|
361
|
-
create:
|
|
362
|
-
remove:
|
|
363
|
-
get:
|
|
364
|
-
list:
|
|
365
|
-
update:
|
|
361
|
+
create: Ir(t, e),
|
|
362
|
+
remove: Pr(t),
|
|
363
|
+
get: Ar(t),
|
|
364
|
+
list: Dr(t),
|
|
365
|
+
update: Rr(t),
|
|
366
366
|
// TODO - think about this more when other issues fixed
|
|
367
|
-
unlink:
|
|
367
|
+
unlink: zr(t)
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Lr(t) {
|
|
371
371
|
return async (e, a) => {
|
|
372
|
-
const n = (/* @__PURE__ */ new Date()).toISOString(), r =
|
|
372
|
+
const n = (/* @__PURE__ */ new Date()).toISOString(), r = Xt.parse({
|
|
373
373
|
id: `af_${K()}`,
|
|
374
374
|
...a,
|
|
375
375
|
actions: a.actions || [],
|
|
@@ -393,7 +393,7 @@ function Re(t, e) {
|
|
|
393
393
|
return e;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function wn(t, e, a = { ...t }) {
|
|
397
397
|
for (const n in e)
|
|
398
398
|
n in t && (a[n] = Re(
|
|
399
399
|
t[n],
|
|
@@ -401,7 +401,7 @@ function gn(t, e, a = { ...t }) {
|
|
|
401
401
|
));
|
|
402
402
|
return a;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function Mr(t) {
|
|
405
405
|
return async (e, a) => {
|
|
406
406
|
const n = await t.selectFrom("flows").selectAll().where("flows.id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
|
|
407
407
|
if (!n) return null;
|
|
@@ -409,10 +409,10 @@ function Lr(t) {
|
|
|
409
409
|
...n,
|
|
410
410
|
actions: Re(n.actions, [])
|
|
411
411
|
};
|
|
412
|
-
return
|
|
412
|
+
return Xt.parse(S(r));
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function jr(t) {
|
|
416
416
|
return async (e, a = {}) => {
|
|
417
417
|
const { page: n = 0, per_page: r = 50, include_totals: o = !1, q: s } = a;
|
|
418
418
|
let u = t.selectFrom("flows").where("tenant_id", "=", e);
|
|
@@ -422,7 +422,7 @@ function Mr(t) {
|
|
|
422
422
|
...f,
|
|
423
423
|
actions: Re(f.actions, [])
|
|
424
424
|
};
|
|
425
|
-
return
|
|
425
|
+
return Xt.parse(S(h));
|
|
426
426
|
});
|
|
427
427
|
if (!o)
|
|
428
428
|
return {
|
|
@@ -440,7 +440,7 @@ function Mr(t) {
|
|
|
440
440
|
};
|
|
441
441
|
};
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Jr(t) {
|
|
444
444
|
return async (e, a, n) => {
|
|
445
445
|
const r = {
|
|
446
446
|
...n,
|
|
@@ -450,53 +450,53 @@ function jr(t) {
|
|
|
450
450
|
const { numUpdatedRows: o } = await t.updateTable("flows").set(r).where("id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
|
|
451
451
|
if (o === 0n) return null;
|
|
452
452
|
const s = await t.selectFrom("flows").selectAll().where("id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
|
|
453
|
-
return s ?
|
|
453
|
+
return s ? Xt.parse({
|
|
454
454
|
...s,
|
|
455
455
|
actions: s.actions ? JSON.parse(s.actions) : []
|
|
456
456
|
}) : null;
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function qr(t) {
|
|
460
460
|
return async (e, a) => {
|
|
461
461
|
var r;
|
|
462
462
|
return (((r = (await t.deleteFrom("flows").where("id", "=", a).where("tenant_id", "=", e).execute())[0]) == null ? void 0 : r.numDeletedRows) ?? 0n) > 0n;
|
|
463
463
|
};
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Wr(t) {
|
|
466
466
|
return {
|
|
467
|
-
create:
|
|
468
|
-
get:
|
|
469
|
-
list:
|
|
470
|
-
update:
|
|
471
|
-
remove:
|
|
467
|
+
create: Lr(t),
|
|
468
|
+
get: Mr(t),
|
|
469
|
+
list: jr(t),
|
|
470
|
+
update: Jr(t),
|
|
471
|
+
remove: qr(t)
|
|
472
472
|
};
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function It(t, e, a = { ...t }) {
|
|
475
475
|
for (const n of e)
|
|
476
476
|
t[n] !== void 0 && (a[n] = JSON.stringify(t[n]));
|
|
477
477
|
return a;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function yn(t, e, a = t) {
|
|
480
480
|
for (const n of e)
|
|
481
481
|
t[n] !== void 0 && (a[n] = t[n] ? 1 : 0);
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function Br(t) {
|
|
484
484
|
const e = {};
|
|
485
485
|
for (const a in t)
|
|
486
486
|
t[a] !== void 0 && t[a] !== null && (e[a] = t[a]);
|
|
487
487
|
return e;
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function vn(t) {
|
|
490
490
|
const e = {
|
|
491
491
|
...t
|
|
492
492
|
};
|
|
493
493
|
return t.session_cookie && typeof t.session_cookie == "string" && (e.session_cookie = JSON.parse(t.session_cookie)), t.enabled_locales && typeof t.enabled_locales == "string" && (e.enabled_locales = JSON.parse(t.enabled_locales)), t.error_page && typeof t.error_page == "string" && (e.error_page = JSON.parse(t.error_page)), t.flags && typeof t.flags == "string" && (e.flags = JSON.parse(t.flags)), t.sandbox_versions_available && typeof t.sandbox_versions_available == "string" && (e.sandbox_versions_available = JSON.parse(
|
|
494
494
|
t.sandbox_versions_available
|
|
495
|
-
)), t.change_password && typeof t.change_password == "string" && (e.change_password = JSON.parse(t.change_password)), t.guardian_mfa_page && typeof t.guardian_mfa_page == "string" && (e.guardian_mfa_page = JSON.parse(t.guardian_mfa_page)), t.sessions && typeof t.sessions == "string" && (e.sessions = JSON.parse(t.sessions)), t.oidc_logout && typeof t.oidc_logout == "string" && (e.oidc_logout = JSON.parse(t.oidc_logout)), t.device_flow && typeof t.device_flow == "string" && (e.device_flow = JSON.parse(t.device_flow)), t.default_token_quota && typeof t.default_token_quota == "string" && (e.default_token_quota = JSON.parse(t.default_token_quota)), t.allowed_logout_urls && typeof t.allowed_logout_urls == "string" && (e.allowed_logout_urls = JSON.parse(t.allowed_logout_urls)), t.acr_values_supported && typeof t.acr_values_supported == "string" && (e.acr_values_supported = JSON.parse(t.acr_values_supported)), t.mtls && typeof t.mtls == "string" && (e.mtls = JSON.parse(t.mtls)), t.mfa && typeof t.mfa == "string" && (e.mfa = JSON.parse(t.mfa)), t.allow_organization_name_in_authentication_api !== void 0 && (e.allow_organization_name_in_authentication_api = t.allow_organization_name_in_authentication_api === 1), t.customize_mfa_in_postlogin_action !== void 0 && (e.customize_mfa_in_postlogin_action = t.customize_mfa_in_postlogin_action === 1), t.pushed_authorization_requests_supported !== void 0 && (e.pushed_authorization_requests_supported = t.pushed_authorization_requests_supported === 1), t.authorization_response_iss_parameter_supported !== void 0 && (e.authorization_response_iss_parameter_supported = t.authorization_response_iss_parameter_supported === 1),
|
|
495
|
+
)), t.change_password && typeof t.change_password == "string" && (e.change_password = JSON.parse(t.change_password)), t.guardian_mfa_page && typeof t.guardian_mfa_page == "string" && (e.guardian_mfa_page = JSON.parse(t.guardian_mfa_page)), t.sessions && typeof t.sessions == "string" && (e.sessions = JSON.parse(t.sessions)), t.oidc_logout && typeof t.oidc_logout == "string" && (e.oidc_logout = JSON.parse(t.oidc_logout)), t.device_flow && typeof t.device_flow == "string" && (e.device_flow = JSON.parse(t.device_flow)), t.default_token_quota && typeof t.default_token_quota == "string" && (e.default_token_quota = JSON.parse(t.default_token_quota)), t.allowed_logout_urls && typeof t.allowed_logout_urls == "string" && (e.allowed_logout_urls = JSON.parse(t.allowed_logout_urls)), t.acr_values_supported && typeof t.acr_values_supported == "string" && (e.acr_values_supported = JSON.parse(t.acr_values_supported)), t.mtls && typeof t.mtls == "string" && (e.mtls = JSON.parse(t.mtls)), t.mfa && typeof t.mfa == "string" && (e.mfa = JSON.parse(t.mfa)), t.allow_organization_name_in_authentication_api !== void 0 && (e.allow_organization_name_in_authentication_api = t.allow_organization_name_in_authentication_api === 1), t.customize_mfa_in_postlogin_action !== void 0 && (e.customize_mfa_in_postlogin_action = t.customize_mfa_in_postlogin_action === 1), t.pushed_authorization_requests_supported !== void 0 && (e.pushed_authorization_requests_supported = t.pushed_authorization_requests_supported === 1), t.authorization_response_iss_parameter_supported !== void 0 && (e.authorization_response_iss_parameter_supported = t.authorization_response_iss_parameter_supported === 1), S(e);
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Nn(t) {
|
|
498
498
|
const e = { ...t };
|
|
499
|
-
return
|
|
499
|
+
return It(
|
|
500
500
|
t,
|
|
501
501
|
[
|
|
502
502
|
"session_cookie",
|
|
@@ -516,9 +516,9 @@ function vn(t) {
|
|
|
516
516
|
"mfa"
|
|
517
517
|
],
|
|
518
518
|
e
|
|
519
|
-
), t.allow_organization_name_in_authentication_api !== void 0 && (e.allow_organization_name_in_authentication_api = t.allow_organization_name_in_authentication_api ? 1 : 0), t.customize_mfa_in_postlogin_action !== void 0 && (e.customize_mfa_in_postlogin_action = t.customize_mfa_in_postlogin_action ? 1 : 0), t.pushed_authorization_requests_supported !== void 0 && (e.pushed_authorization_requests_supported = t.pushed_authorization_requests_supported ? 1 : 0), t.authorization_response_iss_parameter_supported !== void 0 && (e.authorization_response_iss_parameter_supported = t.authorization_response_iss_parameter_supported ? 1 : 0),
|
|
519
|
+
), t.allow_organization_name_in_authentication_api !== void 0 && (e.allow_organization_name_in_authentication_api = t.allow_organization_name_in_authentication_api ? 1 : 0), t.customize_mfa_in_postlogin_action !== void 0 && (e.customize_mfa_in_postlogin_action = t.customize_mfa_in_postlogin_action ? 1 : 0), t.pushed_authorization_requests_supported !== void 0 && (e.pushed_authorization_requests_supported = t.pushed_authorization_requests_supported ? 1 : 0), t.authorization_response_iss_parameter_supported !== void 0 && (e.authorization_response_iss_parameter_supported = t.authorization_response_iss_parameter_supported ? 1 : 0), Br(e);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function Ur(t) {
|
|
522
522
|
return async (e) => {
|
|
523
523
|
var r, o;
|
|
524
524
|
const a = {
|
|
@@ -526,7 +526,7 @@ function Br(t) {
|
|
|
526
526
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
527
527
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
528
528
|
...e
|
|
529
|
-
}, n =
|
|
529
|
+
}, n = Nn(a);
|
|
530
530
|
try {
|
|
531
531
|
await t.insertInto("tenants").values(n).execute();
|
|
532
532
|
} catch (s) {
|
|
@@ -537,13 +537,13 @@ function Br(t) {
|
|
|
537
537
|
return a;
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function Kr(t) {
|
|
541
541
|
return async (e) => {
|
|
542
542
|
const a = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
|
|
543
|
-
return a ?
|
|
543
|
+
return a ? vn(a) : null;
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Qr(t) {
|
|
547
547
|
return async (e) => {
|
|
548
548
|
let a = t.selectFrom("tenants");
|
|
549
549
|
const { page: n = 0, per_page: r = 50, include_totals: o = !1, sort: s, q: u } = e;
|
|
@@ -552,7 +552,7 @@ function Kr(t) {
|
|
|
552
552
|
a = a.orderBy(h(s.sort_by), s.sort_order);
|
|
553
553
|
}
|
|
554
554
|
u && (a = q(t, a, u, ["friendly_name"]));
|
|
555
|
-
const m = (await a.offset(n * r).limit(r).selectAll().execute()).map(
|
|
555
|
+
const m = (await a.offset(n * r).limit(r).selectAll().execute()).map(vn);
|
|
556
556
|
if (!o)
|
|
557
557
|
return {
|
|
558
558
|
tenants: m
|
|
@@ -566,36 +566,36 @@ function Kr(t) {
|
|
|
566
566
|
};
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Vr(t) {
|
|
570
570
|
return async (e, a) => {
|
|
571
571
|
const r = {
|
|
572
|
-
...
|
|
572
|
+
...Nn(a),
|
|
573
573
|
id: e,
|
|
574
574
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
575
575
|
};
|
|
576
576
|
await t.updateTable("tenants").set(r).where("id", "=", e).execute();
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function Gr(t) {
|
|
580
580
|
return async (e) => (await t.deleteFrom("tenants").where("tenants.id", "=", e).execute()).length === 1;
|
|
581
581
|
}
|
|
582
|
-
function
|
|
582
|
+
function Hr(t) {
|
|
583
583
|
return {
|
|
584
|
-
create:
|
|
585
|
-
get:
|
|
586
|
-
list:
|
|
587
|
-
update:
|
|
588
|
-
remove:
|
|
584
|
+
create: Ur(t),
|
|
585
|
+
get: Kr(t),
|
|
586
|
+
list: Qr(t),
|
|
587
|
+
update: Vr(t),
|
|
588
|
+
remove: Gr(t)
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function qa(t) {
|
|
592
592
|
return t ? JSON.stringify(t) : void 0;
|
|
593
593
|
}
|
|
594
|
-
const
|
|
595
|
-
function
|
|
594
|
+
const Yr = 256;
|
|
595
|
+
function Xr(t) {
|
|
596
596
|
return async (e, a) => {
|
|
597
597
|
var u, l, _;
|
|
598
|
-
const n = (u = a.user_agent) == null ? void 0 : u.slice(0,
|
|
598
|
+
const n = (u = a.user_agent) == null ? void 0 : u.slice(0, Yr), r = a.log_id || K(), { location_info: o, ...s } = a;
|
|
599
599
|
return await t.insertInto("logs").values({
|
|
600
600
|
...s,
|
|
601
601
|
log_id: r,
|
|
@@ -604,8 +604,8 @@ function Yr(t) {
|
|
|
604
604
|
description: (l = a.description) == null ? void 0 : l.substring(0, 256),
|
|
605
605
|
isMobile: a.isMobile ? 1 : 0,
|
|
606
606
|
scope: a.scope,
|
|
607
|
-
auth0_client:
|
|
608
|
-
details: (_ =
|
|
607
|
+
auth0_client: qa(a.auth0_client),
|
|
608
|
+
details: (_ = qa(a.details)) == null ? void 0 : _.substring(0, 8192),
|
|
609
609
|
// Extract location_info fields for separate columns
|
|
610
610
|
country_code: o == null ? void 0 : o.country_code,
|
|
611
611
|
city_name: o == null ? void 0 : o.city_name,
|
|
@@ -620,7 +620,7 @@ function Yr(t) {
|
|
|
620
620
|
};
|
|
621
621
|
};
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function Wa(t) {
|
|
624
624
|
if (!t)
|
|
625
625
|
return "";
|
|
626
626
|
try {
|
|
@@ -629,13 +629,13 @@ function qa(t) {
|
|
|
629
629
|
return t;
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Cn(t) {
|
|
633
633
|
return {
|
|
634
634
|
...t,
|
|
635
635
|
client_id: t.client_id,
|
|
636
636
|
client_name: "",
|
|
637
|
-
auth0_client:
|
|
638
|
-
details:
|
|
637
|
+
auth0_client: Wa(t.auth0_client),
|
|
638
|
+
details: Wa(t.details),
|
|
639
639
|
isMobile: !!t.isMobile,
|
|
640
640
|
scope: t.scope || void 0,
|
|
641
641
|
log_id: t.log_id,
|
|
@@ -650,7 +650,7 @@ function Nn(t) {
|
|
|
650
650
|
} : void 0
|
|
651
651
|
};
|
|
652
652
|
}
|
|
653
|
-
function
|
|
653
|
+
function Zr(t) {
|
|
654
654
|
return async (e, a = {}) => {
|
|
655
655
|
const { page: n = 0, per_page: r = 50, include_totals: o = !1, sort: s, q: u } = a;
|
|
656
656
|
let l = t.selectFrom("logs").where("logs.tenant_id", "=", e);
|
|
@@ -661,7 +661,7 @@ function Xr(t) {
|
|
|
661
661
|
_ = _.orderBy(h(s.sort_by), s.sort_order);
|
|
662
662
|
}
|
|
663
663
|
_ = _.offset(n * r).limit(r);
|
|
664
|
-
const d = (await _.selectAll().execute()).map(
|
|
664
|
+
const d = (await _.selectAll().execute()).map(Cn);
|
|
665
665
|
if (!o)
|
|
666
666
|
return {
|
|
667
667
|
logs: d,
|
|
@@ -678,20 +678,20 @@ function Xr(t) {
|
|
|
678
678
|
};
|
|
679
679
|
};
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function eo(t) {
|
|
682
682
|
return async (e, a) => {
|
|
683
683
|
const n = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.log_id", "=", a).selectAll().executeTakeFirst();
|
|
684
|
-
return n ?
|
|
684
|
+
return n ? Cn(n) : null;
|
|
685
685
|
};
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function to(t) {
|
|
688
688
|
return {
|
|
689
|
-
create:
|
|
690
|
-
list:
|
|
691
|
-
get:
|
|
689
|
+
create: Xr(t),
|
|
690
|
+
list: Zr(t),
|
|
691
|
+
get: eo(t)
|
|
692
692
|
};
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function xn(t) {
|
|
695
695
|
if (t != null) {
|
|
696
696
|
if (typeof t == "number")
|
|
697
697
|
return new Date(t).toISOString();
|
|
@@ -703,8 +703,8 @@ function Cn(t) {
|
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
return
|
|
706
|
+
function Nt(t, e = (/* @__PURE__ */ new Date(0)).toISOString()) {
|
|
707
|
+
return xn(t) ?? e;
|
|
708
708
|
}
|
|
709
709
|
function P(t) {
|
|
710
710
|
if (!t || t === "")
|
|
@@ -712,18 +712,18 @@ function P(t) {
|
|
|
712
712
|
const e = new Date(t);
|
|
713
713
|
return isNaN(e.getTime()) ? null : e.getTime();
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function Ea() {
|
|
716
716
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
717
717
|
}
|
|
718
718
|
function Fe(t, e, a = []) {
|
|
719
719
|
const n = {};
|
|
720
720
|
for (const r of e) {
|
|
721
721
|
const o = r.replace(/_ts$/, "");
|
|
722
|
-
n[o] =
|
|
722
|
+
n[o] = Nt(t[r]);
|
|
723
723
|
}
|
|
724
724
|
for (const r of a) {
|
|
725
725
|
const o = r.replace(/_ts$/, "");
|
|
726
|
-
n[o] =
|
|
726
|
+
n[o] = xn(t[r]);
|
|
727
727
|
}
|
|
728
728
|
return n;
|
|
729
729
|
}
|
|
@@ -774,7 +774,7 @@ function ao(t) {
|
|
|
774
774
|
}
|
|
775
775
|
function no(t) {
|
|
776
776
|
return async (e, a) => {
|
|
777
|
-
const n = Date.now(), r =
|
|
777
|
+
const n = Date.now(), r = Ea(), o = {
|
|
778
778
|
...a,
|
|
779
779
|
created_at: r,
|
|
780
780
|
updated_at: r,
|
|
@@ -841,20 +841,20 @@ function so(t) {
|
|
|
841
841
|
expires_at_ts: Q,
|
|
842
842
|
idle_expires_at_ts: te,
|
|
843
843
|
authenticated_at_ts: Y,
|
|
844
|
-
last_interaction_at_ts:
|
|
845
|
-
used_at_ts:
|
|
846
|
-
revoked_at_ts:
|
|
847
|
-
...
|
|
848
|
-
} = y,
|
|
844
|
+
last_interaction_at_ts: Se,
|
|
845
|
+
used_at_ts: ja,
|
|
846
|
+
revoked_at_ts: pr,
|
|
847
|
+
...gr
|
|
848
|
+
} = y, wr = Fe(
|
|
849
849
|
{
|
|
850
850
|
created_at_ts: J,
|
|
851
851
|
updated_at_ts: R,
|
|
852
852
|
expires_at_ts: Q,
|
|
853
853
|
idle_expires_at_ts: te,
|
|
854
854
|
authenticated_at_ts: Y,
|
|
855
|
-
last_interaction_at_ts:
|
|
856
|
-
used_at_ts:
|
|
857
|
-
revoked_at_ts:
|
|
855
|
+
last_interaction_at_ts: Se,
|
|
856
|
+
used_at_ts: ja,
|
|
857
|
+
revoked_at_ts: pr
|
|
858
858
|
},
|
|
859
859
|
[
|
|
860
860
|
"created_at_ts",
|
|
@@ -865,8 +865,8 @@ function so(t) {
|
|
|
865
865
|
["expires_at_ts", "idle_expires_at_ts", "used_at_ts", "revoked_at_ts"]
|
|
866
866
|
);
|
|
867
867
|
return {
|
|
868
|
-
...pr,
|
|
869
868
|
...gr,
|
|
869
|
+
...wr,
|
|
870
870
|
device: JSON.parse(x),
|
|
871
871
|
clients: JSON.parse(O)
|
|
872
872
|
};
|
|
@@ -959,7 +959,7 @@ function ho(t) {
|
|
|
959
959
|
s && (u = q(t, u, s, ["code", "login_id"]));
|
|
960
960
|
const m = (await u.offset(n * r).limit(r).selectAll().execute()).map((f) => {
|
|
961
961
|
const { tenant_id: h, ...y } = f;
|
|
962
|
-
return
|
|
962
|
+
return Cr.parse(S(y));
|
|
963
963
|
});
|
|
964
964
|
if (!o)
|
|
965
965
|
return {
|
|
@@ -997,7 +997,7 @@ function go(t) {
|
|
|
997
997
|
let r = t.selectFrom("codes").where("codes.code_id", "=", a).where("codes.code_type", "=", n);
|
|
998
998
|
e.length && (r = r.where("codes.tenant_id", "=", e));
|
|
999
999
|
const o = await r.selectAll().executeTakeFirst();
|
|
1000
|
-
return o ?
|
|
1000
|
+
return o ? S(o) : null;
|
|
1001
1001
|
};
|
|
1002
1002
|
}
|
|
1003
1003
|
function wo(t) {
|
|
@@ -1026,24 +1026,24 @@ const No = 17, Co = {
|
|
|
1026
1026
|
guardian_factor: "gfa_",
|
|
1027
1027
|
invite: "inv_"
|
|
1028
1028
|
};
|
|
1029
|
-
function
|
|
1030
|
-
const n =
|
|
1029
|
+
function $t(t) {
|
|
1030
|
+
const n = Er("0123456789abcdefghijklmnopqrstuvwxyz", No)();
|
|
1031
1031
|
return `${Co[t]}${n}`;
|
|
1032
1032
|
}
|
|
1033
1033
|
function xo() {
|
|
1034
|
-
return
|
|
1034
|
+
return $t("organization");
|
|
1035
1035
|
}
|
|
1036
1036
|
function To() {
|
|
1037
|
-
return
|
|
1038
|
-
}
|
|
1039
|
-
function So() {
|
|
1040
|
-
return It("hook");
|
|
1037
|
+
return $t("connection");
|
|
1041
1038
|
}
|
|
1042
1039
|
function bo() {
|
|
1043
|
-
return
|
|
1040
|
+
return $t("hook");
|
|
1041
|
+
}
|
|
1042
|
+
function So() {
|
|
1043
|
+
return $t("resource_server");
|
|
1044
1044
|
}
|
|
1045
1045
|
function Oo() {
|
|
1046
|
-
return
|
|
1046
|
+
return $t("invite");
|
|
1047
1047
|
}
|
|
1048
1048
|
function ko(t) {
|
|
1049
1049
|
return async (e, a) => {
|
|
@@ -1063,16 +1063,16 @@ function ko(t) {
|
|
|
1063
1063
|
}).execute(), o;
|
|
1064
1064
|
};
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function Ia(t) {
|
|
1067
1067
|
const { is_system: e, ...a } = t;
|
|
1068
|
-
return
|
|
1068
|
+
return S({
|
|
1069
1069
|
...a,
|
|
1070
1070
|
is_system: e ? !0 : void 0,
|
|
1071
1071
|
options: JSON.parse(t.options)
|
|
1072
1072
|
});
|
|
1073
1073
|
}
|
|
1074
1074
|
function Eo(t) {
|
|
1075
|
-
return t.map(
|
|
1075
|
+
return t.map(Ia);
|
|
1076
1076
|
}
|
|
1077
1077
|
function Io(t) {
|
|
1078
1078
|
return async (e, a = {}) => {
|
|
@@ -1102,7 +1102,7 @@ function $o(t) {
|
|
|
1102
1102
|
function Ao(t) {
|
|
1103
1103
|
return async (e, a) => {
|
|
1104
1104
|
const n = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).selectAll().executeTakeFirst();
|
|
1105
|
-
return n ?
|
|
1105
|
+
return n ? Ia(n) : null;
|
|
1106
1106
|
};
|
|
1107
1107
|
}
|
|
1108
1108
|
function Do(t) {
|
|
@@ -1148,7 +1148,7 @@ function Ro(t) {
|
|
|
1148
1148
|
...n,
|
|
1149
1149
|
tenant_id: e
|
|
1150
1150
|
};
|
|
1151
|
-
return
|
|
1151
|
+
return yn(
|
|
1152
1152
|
n,
|
|
1153
1153
|
[
|
|
1154
1154
|
"global",
|
|
@@ -1197,7 +1197,7 @@ function zo(t) {
|
|
|
1197
1197
|
if (!n)
|
|
1198
1198
|
return null;
|
|
1199
1199
|
const { tenant_id: r, ...o } = n;
|
|
1200
|
-
return
|
|
1200
|
+
return S({
|
|
1201
1201
|
...o,
|
|
1202
1202
|
// Convert integer fields back to booleans
|
|
1203
1203
|
global: !!n.global,
|
|
@@ -1241,7 +1241,7 @@ function zo(t) {
|
|
|
1241
1241
|
function Fo(t) {
|
|
1242
1242
|
return async (e) => {
|
|
1243
1243
|
const a = await t.selectFrom("clients").where("clients.client_id", "=", e).selectAll().executeTakeFirst();
|
|
1244
|
-
return a ?
|
|
1244
|
+
return a ? S({
|
|
1245
1245
|
...a,
|
|
1246
1246
|
// Convert integer fields back to booleans
|
|
1247
1247
|
global: !!a.global,
|
|
@@ -1337,7 +1337,7 @@ function jo(t) {
|
|
|
1337
1337
|
...n,
|
|
1338
1338
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1339
1339
|
};
|
|
1340
|
-
return
|
|
1340
|
+
return yn(
|
|
1341
1341
|
n,
|
|
1342
1342
|
[
|
|
1343
1343
|
"global",
|
|
@@ -1352,7 +1352,7 @@ function jo(t) {
|
|
|
1352
1352
|
"require_proof_of_possession"
|
|
1353
1353
|
],
|
|
1354
1354
|
r
|
|
1355
|
-
),
|
|
1355
|
+
), It(
|
|
1356
1356
|
n,
|
|
1357
1357
|
[
|
|
1358
1358
|
"callbacks",
|
|
@@ -1401,7 +1401,7 @@ function qo(t) {
|
|
|
1401
1401
|
if (r.length === 0)
|
|
1402
1402
|
return [];
|
|
1403
1403
|
const o = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "in", r).selectAll().execute(), s = new Map(
|
|
1404
|
-
o.map((u) => [u.id,
|
|
1404
|
+
o.map((u) => [u.id, Ia(u)])
|
|
1405
1405
|
);
|
|
1406
1406
|
return r.map((u) => s.get(u)).filter((u) => u !== void 0);
|
|
1407
1407
|
};
|
|
@@ -1469,7 +1469,7 @@ function Vo(t) {
|
|
|
1469
1469
|
created_at: n,
|
|
1470
1470
|
updated_at: n
|
|
1471
1471
|
};
|
|
1472
|
-
return await t.insertInto("client_grants").values(l).execute(),
|
|
1472
|
+
return await t.insertInto("client_grants").values(l).execute(), S({
|
|
1473
1473
|
id: r,
|
|
1474
1474
|
tenant_id: e,
|
|
1475
1475
|
...u,
|
|
@@ -1502,7 +1502,7 @@ function Go(t) {
|
|
|
1502
1502
|
created_at: n.created_at,
|
|
1503
1503
|
updated_at: n.updated_at
|
|
1504
1504
|
};
|
|
1505
|
-
return
|
|
1505
|
+
return S(r);
|
|
1506
1506
|
};
|
|
1507
1507
|
}
|
|
1508
1508
|
function Ho(t) {
|
|
@@ -1514,8 +1514,8 @@ function Ho(t) {
|
|
|
1514
1514
|
if (x && !J && O) {
|
|
1515
1515
|
const R = !!x[1], Q = x[2], { ref: te } = t.dynamic, Y = te(`client_grants.${Q}`);
|
|
1516
1516
|
if (Q === "allow_any_organization") {
|
|
1517
|
-
const
|
|
1518
|
-
R ? l = l.where(Y, "!=",
|
|
1517
|
+
const Se = O === "true" ? 1 : 0;
|
|
1518
|
+
R ? l = l.where(Y, "!=", Se) : l = l.where(Y, "=", Se);
|
|
1519
1519
|
} else
|
|
1520
1520
|
R ? l = l.where(Y, "!=", O) : l = l.where(Y, "=", O);
|
|
1521
1521
|
} else
|
|
@@ -1543,7 +1543,7 @@ function Ho(t) {
|
|
|
1543
1543
|
created_at: h.created_at,
|
|
1544
1544
|
updated_at: h.updated_at
|
|
1545
1545
|
};
|
|
1546
|
-
return
|
|
1546
|
+
return S(y);
|
|
1547
1547
|
});
|
|
1548
1548
|
if (!o)
|
|
1549
1549
|
return {
|
|
@@ -1743,7 +1743,7 @@ function ds(t) {
|
|
|
1743
1743
|
font_url: _,
|
|
1744
1744
|
...m
|
|
1745
1745
|
} = a;
|
|
1746
|
-
return
|
|
1746
|
+
return S({
|
|
1747
1747
|
...m,
|
|
1748
1748
|
colors: {
|
|
1749
1749
|
primary: r,
|
|
@@ -1760,7 +1760,7 @@ function ds(t) {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
function _s(t) {
|
|
1762
1762
|
return async (e, a) => {
|
|
1763
|
-
var s, u, l, _, m, d, f, h, y, v, x, O, J, R, Q, te, Y,
|
|
1763
|
+
var s, u, l, _, m, d, f, h, y, v, x, O, J, R, Q, te, Y, Se;
|
|
1764
1764
|
const { colors: n, font: r, ...o } = a;
|
|
1765
1765
|
try {
|
|
1766
1766
|
await t.insertInto("branding").values({
|
|
@@ -1781,7 +1781,7 @@ function _s(t) {
|
|
|
1781
1781
|
colors_page_background_start: (J = (O = a.colors) == null ? void 0 : O.page_background) == null ? void 0 : J.start,
|
|
1782
1782
|
colors_page_background_end: (Q = (R = a.colors) == null ? void 0 : R.page_background) == null ? void 0 : Q.end,
|
|
1783
1783
|
colors_page_background_angle_dev: (Y = (te = a.colors) == null ? void 0 : te.page_background) == null ? void 0 : Y.angle_deg,
|
|
1784
|
-
font_url: (
|
|
1784
|
+
font_url: (Se = a.font) == null ? void 0 : Se.url
|
|
1785
1785
|
}).where("tenant_id", "=", e).execute();
|
|
1786
1786
|
}
|
|
1787
1787
|
};
|
|
@@ -1847,7 +1847,7 @@ function ws(t) {
|
|
|
1847
1847
|
"created_at_ts",
|
|
1848
1848
|
"updated_at_ts"
|
|
1849
1849
|
]);
|
|
1850
|
-
return
|
|
1850
|
+
return S({
|
|
1851
1851
|
...J,
|
|
1852
1852
|
...R,
|
|
1853
1853
|
enabled: !!y,
|
|
@@ -1884,7 +1884,7 @@ function ys(t) {
|
|
|
1884
1884
|
"created_at_ts",
|
|
1885
1885
|
"updated_at_ts"
|
|
1886
1886
|
]);
|
|
1887
|
-
return
|
|
1887
|
+
return S({
|
|
1888
1888
|
...u,
|
|
1889
1889
|
...l,
|
|
1890
1890
|
enabled: !!u.enabled,
|
|
@@ -1897,7 +1897,7 @@ function vs(t) {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
function Ns(t) {
|
|
1899
1899
|
return async (e, a) => {
|
|
1900
|
-
const n = Date.now(), r = a.hook_id ||
|
|
1900
|
+
const n = Date.now(), r = a.hook_id || bo(), { hook_id: o, enabled: s, synchronous: u, ...l } = a;
|
|
1901
1901
|
return await t.insertInto("hooks").values({
|
|
1902
1902
|
...l,
|
|
1903
1903
|
hook_id: r,
|
|
@@ -1950,10 +1950,10 @@ function Ts(t) {
|
|
|
1950
1950
|
return await t.insertInto("themes").values(dt(o)).execute(), r;
|
|
1951
1951
|
};
|
|
1952
1952
|
}
|
|
1953
|
-
function
|
|
1953
|
+
function bs(t) {
|
|
1954
1954
|
return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).executeTakeFirst()).numDeletedRows > 0;
|
|
1955
1955
|
}
|
|
1956
|
-
function
|
|
1956
|
+
function Ss(t) {
|
|
1957
1957
|
return async (e, a) => {
|
|
1958
1958
|
const n = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).selectAll().executeTakeFirst();
|
|
1959
1959
|
if (!n)
|
|
@@ -1968,8 +1968,8 @@ function bs(t) {
|
|
|
1968
1968
|
fonts_subtitle_bold: !!n.fonts_subtitle_bold,
|
|
1969
1969
|
fonts_title_bold: !!n.fonts_title_bold
|
|
1970
1970
|
};
|
|
1971
|
-
return
|
|
1972
|
-
|
|
1971
|
+
return S(
|
|
1972
|
+
gn(r, [
|
|
1973
1973
|
"widget",
|
|
1974
1974
|
"colors",
|
|
1975
1975
|
"borders",
|
|
@@ -1991,8 +1991,8 @@ function Os(t) {
|
|
|
1991
1991
|
function ks(t) {
|
|
1992
1992
|
return {
|
|
1993
1993
|
create: Ts(t),
|
|
1994
|
-
get:
|
|
1995
|
-
remove:
|
|
1994
|
+
get: Ss(t),
|
|
1995
|
+
remove: bs(t),
|
|
1996
1996
|
update: Os(t)
|
|
1997
1997
|
};
|
|
1998
1998
|
}
|
|
@@ -2004,12 +2004,12 @@ function Es(t) {
|
|
|
2004
2004
|
{ created_at_ts: r, updated_at_ts: o, expires_at_ts: s },
|
|
2005
2005
|
["created_at_ts", "updated_at_ts", "expires_at_ts"]
|
|
2006
2006
|
);
|
|
2007
|
-
return
|
|
2008
|
-
|
|
2009
|
-
|
|
2007
|
+
return xr.parse(
|
|
2008
|
+
gn(
|
|
2009
|
+
S({
|
|
2010
2010
|
...u,
|
|
2011
2011
|
...l,
|
|
2012
|
-
state: n.state ||
|
|
2012
|
+
state: n.state || pn.PENDING,
|
|
2013
2013
|
state_data: n.state_data,
|
|
2014
2014
|
failure_reason: n.failure_reason
|
|
2015
2015
|
}),
|
|
@@ -2018,27 +2018,27 @@ function Es(t) {
|
|
|
2018
2018
|
);
|
|
2019
2019
|
};
|
|
2020
2020
|
}
|
|
2021
|
-
function
|
|
2021
|
+
function Dt(t) {
|
|
2022
2022
|
const e = new Error(t);
|
|
2023
2023
|
return e.source = "ulid", e;
|
|
2024
2024
|
}
|
|
2025
|
-
const
|
|
2025
|
+
const $a = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", ft = $a.length, Ba = Math.pow(2, 48) - 1, Is = 10, $s = 16;
|
|
2026
2026
|
function As(t) {
|
|
2027
2027
|
let e = Math.floor(t() * ft);
|
|
2028
|
-
return e === ft && (e = ft - 1),
|
|
2028
|
+
return e === ft && (e = ft - 1), $a.charAt(e);
|
|
2029
2029
|
}
|
|
2030
2030
|
function Ds(t, e) {
|
|
2031
2031
|
if (isNaN(t))
|
|
2032
2032
|
throw new Error(t + " must be a number");
|
|
2033
|
-
if (t >
|
|
2034
|
-
throw
|
|
2033
|
+
if (t > Ba)
|
|
2034
|
+
throw Dt("cannot encode time greater than " + Ba);
|
|
2035
2035
|
if (t < 0)
|
|
2036
|
-
throw
|
|
2036
|
+
throw Dt("time must be positive");
|
|
2037
2037
|
if (Number.isInteger(Number(t)) === !1)
|
|
2038
|
-
throw
|
|
2038
|
+
throw Dt("time must be an integer");
|
|
2039
2039
|
let a, n = "";
|
|
2040
2040
|
for (; e > 0; e--)
|
|
2041
|
-
a = t % ft, n =
|
|
2041
|
+
a = t % ft, n = $a.charAt(a) + n, t = (t - a) / ft;
|
|
2042
2042
|
return n;
|
|
2043
2043
|
}
|
|
2044
2044
|
function Ps(t, e) {
|
|
@@ -2067,24 +2067,24 @@ function Rs(t = !1, e) {
|
|
|
2067
2067
|
}
|
|
2068
2068
|
return () => Math.random();
|
|
2069
2069
|
}
|
|
2070
|
-
throw
|
|
2070
|
+
throw Dt("secure crypto unusable, insecure Math.random not allowed");
|
|
2071
2071
|
}
|
|
2072
2072
|
function zs(t) {
|
|
2073
2073
|
return t || (t = Rs()), function(a) {
|
|
2074
2074
|
return isNaN(a) && (a = Date.now()), Ds(a, Is) + Ps($s, t);
|
|
2075
2075
|
};
|
|
2076
2076
|
}
|
|
2077
|
-
const
|
|
2077
|
+
const Tn = zs();
|
|
2078
2078
|
function Fs(t) {
|
|
2079
2079
|
return async (e, a) => {
|
|
2080
2080
|
var u;
|
|
2081
|
-
const n =
|
|
2082
|
-
id:
|
|
2081
|
+
const n = Ea(), r = {
|
|
2082
|
+
id: Tn(),
|
|
2083
2083
|
...a,
|
|
2084
2084
|
authorization_url: (u = a.authorization_url) == null ? void 0 : u.slice(0, 1024),
|
|
2085
2085
|
created_at: n,
|
|
2086
2086
|
updated_at: n,
|
|
2087
|
-
state: a.state ||
|
|
2087
|
+
state: a.state || pn.PENDING,
|
|
2088
2088
|
state_data: a.state_data,
|
|
2089
2089
|
failure_reason: a.failure_reason
|
|
2090
2090
|
}, o = Date.now(), s = dt(r);
|
|
@@ -2124,7 +2124,7 @@ function js(t) {
|
|
|
2124
2124
|
function Js(t) {
|
|
2125
2125
|
return async (e) => {
|
|
2126
2126
|
const [a] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
|
|
2127
|
-
return
|
|
2127
|
+
return S({
|
|
2128
2128
|
identifier_first: !!(a != null && a.identifier_first),
|
|
2129
2129
|
password_first: !!(a != null && a.password_first),
|
|
2130
2130
|
webauthn_platform_first_factor: !!(a != null && a.webauthn_platform_first_factor),
|
|
@@ -2132,8 +2132,8 @@ function Js(t) {
|
|
|
2132
2132
|
});
|
|
2133
2133
|
};
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2136
|
-
return
|
|
2135
|
+
function Ua(t) {
|
|
2136
|
+
return S({
|
|
2137
2137
|
...t,
|
|
2138
2138
|
webauthn_platform_first_factor: t.webauthn_platform_first_factor ? !!t.webauthn_platform_first_factor : void 0,
|
|
2139
2139
|
identifier_first: t.identifier_first ? !!t.identifier_first : void 0,
|
|
@@ -2144,13 +2144,13 @@ function Ba(t) {
|
|
|
2144
2144
|
function qs(t) {
|
|
2145
2145
|
return async (e, a) => {
|
|
2146
2146
|
try {
|
|
2147
|
-
const n =
|
|
2147
|
+
const n = Tr.parse(a);
|
|
2148
2148
|
await t.insertInto("prompt_settings").values({
|
|
2149
|
-
...
|
|
2149
|
+
...Ua(n),
|
|
2150
2150
|
tenant_id: e
|
|
2151
2151
|
}).execute();
|
|
2152
2152
|
} catch {
|
|
2153
|
-
await t.updateTable("prompt_settings").set(
|
|
2153
|
+
await t.updateTable("prompt_settings").set(Ua(a)).where("tenant_id", "=", e).execute();
|
|
2154
2154
|
}
|
|
2155
2155
|
};
|
|
2156
2156
|
}
|
|
@@ -2172,7 +2172,7 @@ function Bs(t) {
|
|
|
2172
2172
|
enabled: s,
|
|
2173
2173
|
...u
|
|
2174
2174
|
} = a;
|
|
2175
|
-
return
|
|
2175
|
+
return S({
|
|
2176
2176
|
...u,
|
|
2177
2177
|
credentials: JSON.parse(r),
|
|
2178
2178
|
settings: JSON.parse(o),
|
|
@@ -2251,7 +2251,7 @@ function Gs(t) {
|
|
|
2251
2251
|
}
|
|
2252
2252
|
function Hs(t) {
|
|
2253
2253
|
return async (e, a) => {
|
|
2254
|
-
const n =
|
|
2254
|
+
const n = Ea(), r = {
|
|
2255
2255
|
...a,
|
|
2256
2256
|
created_at: n
|
|
2257
2257
|
}, {
|
|
@@ -2429,7 +2429,7 @@ function ai(t) {
|
|
|
2429
2429
|
}
|
|
2430
2430
|
function ni(t) {
|
|
2431
2431
|
return async (e, a) => {
|
|
2432
|
-
const n =
|
|
2432
|
+
const n = Rt.parse({
|
|
2433
2433
|
id: K(),
|
|
2434
2434
|
...a,
|
|
2435
2435
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2442,7 +2442,7 @@ function ni(t) {
|
|
|
2442
2442
|
start: JSON.stringify(n.start || {}),
|
|
2443
2443
|
ending: JSON.stringify(n.ending || {}),
|
|
2444
2444
|
tenant_id: e
|
|
2445
|
-
}).execute(),
|
|
2445
|
+
}).execute(), Rt.parse(n);
|
|
2446
2446
|
};
|
|
2447
2447
|
}
|
|
2448
2448
|
function ri(t) {
|
|
@@ -2467,7 +2467,7 @@ function ri(t) {
|
|
|
2467
2467
|
h.ending = JSON.parse(h.ending);
|
|
2468
2468
|
} catch {
|
|
2469
2469
|
}
|
|
2470
|
-
return
|
|
2470
|
+
return Rt.parse(S(h));
|
|
2471
2471
|
});
|
|
2472
2472
|
if (!o)
|
|
2473
2473
|
return {
|
|
@@ -2511,7 +2511,7 @@ function si(t) {
|
|
|
2511
2511
|
r.ending = JSON.parse(r.ending);
|
|
2512
2512
|
} catch {
|
|
2513
2513
|
}
|
|
2514
|
-
return
|
|
2514
|
+
return Rt.parse(S(r));
|
|
2515
2515
|
};
|
|
2516
2516
|
}
|
|
2517
2517
|
function ii(t) {
|
|
@@ -2520,7 +2520,7 @@ function ii(t) {
|
|
|
2520
2520
|
...n,
|
|
2521
2521
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2522
2522
|
};
|
|
2523
|
-
|
|
2523
|
+
It(n, ["nodes", "start", "ending"], r);
|
|
2524
2524
|
const { numUpdatedRows: o } = await t.updateTable("forms").set(r).where("id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
|
|
2525
2525
|
return o > 0;
|
|
2526
2526
|
};
|
|
@@ -2537,11 +2537,11 @@ function ci(t) {
|
|
|
2537
2537
|
function ui(t) {
|
|
2538
2538
|
return async (e, a) => {
|
|
2539
2539
|
const n = (/* @__PURE__ */ new Date()).toISOString(), r = {
|
|
2540
|
-
id:
|
|
2540
|
+
id: So(),
|
|
2541
2541
|
...a,
|
|
2542
2542
|
created_at: n,
|
|
2543
2543
|
updated_at: n
|
|
2544
|
-
}, o =
|
|
2544
|
+
}, o = br.parse(r), {
|
|
2545
2545
|
verificationKey: s,
|
|
2546
2546
|
scopes: u,
|
|
2547
2547
|
options: l,
|
|
@@ -2563,7 +2563,7 @@ function ui(t) {
|
|
|
2563
2563
|
created_at: n,
|
|
2564
2564
|
updated_at: n
|
|
2565
2565
|
};
|
|
2566
|
-
return await t.insertInto("resource_servers").values(y).execute(),
|
|
2566
|
+
return await t.insertInto("resource_servers").values(y).execute(), S(o);
|
|
2567
2567
|
};
|
|
2568
2568
|
}
|
|
2569
2569
|
function li(t) {
|
|
@@ -2590,7 +2590,7 @@ function li(t) {
|
|
|
2590
2590
|
// Convert verification_key back to verificationKey for API
|
|
2591
2591
|
verificationKey: o
|
|
2592
2592
|
};
|
|
2593
|
-
return
|
|
2593
|
+
return S(h);
|
|
2594
2594
|
};
|
|
2595
2595
|
}
|
|
2596
2596
|
function di(t) {
|
|
@@ -2629,7 +2629,7 @@ function di(t) {
|
|
|
2629
2629
|
// Convert verification_key back to verificationKey for API
|
|
2630
2630
|
verificationKey: y
|
|
2631
2631
|
};
|
|
2632
|
-
return
|
|
2632
|
+
return S(Y);
|
|
2633
2633
|
});
|
|
2634
2634
|
if (!o)
|
|
2635
2635
|
return {
|
|
@@ -2864,7 +2864,7 @@ function Ti(t) {
|
|
|
2864
2864
|
list: xi(t)
|
|
2865
2865
|
};
|
|
2866
2866
|
}
|
|
2867
|
-
function
|
|
2867
|
+
function bi(t) {
|
|
2868
2868
|
return async (e, a, n, r) => {
|
|
2869
2869
|
const o = (/* @__PURE__ */ new Date()).toISOString();
|
|
2870
2870
|
try {
|
|
@@ -2882,7 +2882,7 @@ function Si(t) {
|
|
|
2882
2882
|
}
|
|
2883
2883
|
};
|
|
2884
2884
|
}
|
|
2885
|
-
function
|
|
2885
|
+
function Si(t) {
|
|
2886
2886
|
return async (e, a, n, r) => {
|
|
2887
2887
|
try {
|
|
2888
2888
|
let o = t.deleteFrom("user_permissions").where("tenant_id", "=", e).where("user_id", "=", a).where(
|
|
@@ -2936,8 +2936,8 @@ function Oi(t) {
|
|
|
2936
2936
|
}
|
|
2937
2937
|
function ki(t) {
|
|
2938
2938
|
return {
|
|
2939
|
-
create:
|
|
2940
|
-
remove:
|
|
2939
|
+
create: bi(t),
|
|
2940
|
+
remove: Si(t),
|
|
2941
2941
|
list: Oi(t)
|
|
2942
2942
|
};
|
|
2943
2943
|
}
|
|
@@ -3038,7 +3038,7 @@ function Ri(t) {
|
|
|
3038
3038
|
function zi(t) {
|
|
3039
3039
|
return async (e, a) => {
|
|
3040
3040
|
let n = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
3041
|
-
return n || (n = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("name", "=", a).executeTakeFirst()), n ?
|
|
3041
|
+
return n || (n = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("name", "=", a).executeTakeFirst()), n ? S({
|
|
3042
3042
|
...n,
|
|
3043
3043
|
branding: n.branding ? JSON.parse(n.branding) : {},
|
|
3044
3044
|
metadata: n.metadata ? JSON.parse(n.metadata) : {},
|
|
@@ -3047,28 +3047,28 @@ function zi(t) {
|
|
|
3047
3047
|
}) : null;
|
|
3048
3048
|
};
|
|
3049
3049
|
}
|
|
3050
|
-
function
|
|
3050
|
+
function Ft(t) {
|
|
3051
3051
|
return typeof t > "u" || t === void 0;
|
|
3052
3052
|
}
|
|
3053
3053
|
function re(t) {
|
|
3054
3054
|
return typeof t == "string";
|
|
3055
3055
|
}
|
|
3056
|
-
function
|
|
3056
|
+
function Aa(t) {
|
|
3057
3057
|
return typeof t == "number";
|
|
3058
3058
|
}
|
|
3059
|
-
function
|
|
3059
|
+
function bn(t) {
|
|
3060
3060
|
return typeof t == "boolean";
|
|
3061
3061
|
}
|
|
3062
3062
|
function Sn(t) {
|
|
3063
3063
|
return t === null;
|
|
3064
3064
|
}
|
|
3065
|
-
function
|
|
3065
|
+
function On(t) {
|
|
3066
3066
|
return typeof t == "bigint";
|
|
3067
3067
|
}
|
|
3068
3068
|
function Le(t) {
|
|
3069
3069
|
return typeof t == "function";
|
|
3070
3070
|
}
|
|
3071
|
-
function
|
|
3071
|
+
function Zt(t) {
|
|
3072
3072
|
return typeof t == "object" && t !== null;
|
|
3073
3073
|
}
|
|
3074
3074
|
function Fi(t) {
|
|
@@ -3077,7 +3077,7 @@ function Fi(t) {
|
|
|
3077
3077
|
function c(t) {
|
|
3078
3078
|
return Object.freeze(t);
|
|
3079
3079
|
}
|
|
3080
|
-
function
|
|
3080
|
+
function At(t) {
|
|
3081
3081
|
return ve(t) ? t : [t];
|
|
3082
3082
|
}
|
|
3083
3083
|
function ve(t) {
|
|
@@ -3093,7 +3093,7 @@ const U = c({
|
|
|
3093
3093
|
name: t
|
|
3094
3094
|
});
|
|
3095
3095
|
}
|
|
3096
|
-
}),
|
|
3096
|
+
}), _a = c({
|
|
3097
3097
|
is(t) {
|
|
3098
3098
|
return t.kind === "SchemableIdentifierNode";
|
|
3099
3099
|
},
|
|
@@ -3110,7 +3110,7 @@ const U = c({
|
|
|
3110
3110
|
identifier: U.create(e)
|
|
3111
3111
|
});
|
|
3112
3112
|
}
|
|
3113
|
-
}),
|
|
3113
|
+
}), be = c({
|
|
3114
3114
|
is(t) {
|
|
3115
3115
|
return t.kind === "AliasNode";
|
|
3116
3116
|
},
|
|
@@ -3128,24 +3128,24 @@ const U = c({
|
|
|
3128
3128
|
create(t) {
|
|
3129
3129
|
return c({
|
|
3130
3130
|
kind: "TableNode",
|
|
3131
|
-
table:
|
|
3131
|
+
table: _a.create(t)
|
|
3132
3132
|
});
|
|
3133
3133
|
},
|
|
3134
3134
|
createWithSchema(t, e) {
|
|
3135
3135
|
return c({
|
|
3136
3136
|
kind: "TableNode",
|
|
3137
|
-
table:
|
|
3137
|
+
table: _a.createWithSchema(t, e)
|
|
3138
3138
|
});
|
|
3139
3139
|
}
|
|
3140
3140
|
});
|
|
3141
3141
|
function H(t) {
|
|
3142
|
-
return
|
|
3142
|
+
return Zt(t) && Le(t.toOperationNode);
|
|
3143
3143
|
}
|
|
3144
3144
|
function Li(t) {
|
|
3145
|
-
return
|
|
3145
|
+
return Zt(t) && "expressionType" in t && H(t);
|
|
3146
3146
|
}
|
|
3147
3147
|
function Mi(t) {
|
|
3148
|
-
return
|
|
3148
|
+
return Zt(t) && "expression" in t && re(t.alias) && H(t);
|
|
3149
3149
|
}
|
|
3150
3150
|
const oe = c({
|
|
3151
3151
|
is(t) {
|
|
@@ -3186,7 +3186,7 @@ const oe = c({
|
|
|
3186
3186
|
right: e
|
|
3187
3187
|
});
|
|
3188
3188
|
}
|
|
3189
|
-
}),
|
|
3189
|
+
}), sa = c({
|
|
3190
3190
|
is(t) {
|
|
3191
3191
|
return t.kind === "OnNode";
|
|
3192
3192
|
},
|
|
@@ -3219,13 +3219,13 @@ const oe = c({
|
|
|
3219
3219
|
kind: "JoinNode",
|
|
3220
3220
|
joinType: t,
|
|
3221
3221
|
table: e,
|
|
3222
|
-
on:
|
|
3222
|
+
on: sa.create(a)
|
|
3223
3223
|
});
|
|
3224
3224
|
},
|
|
3225
3225
|
cloneWithOn(t, e) {
|
|
3226
3226
|
return c({
|
|
3227
3227
|
...t,
|
|
3228
|
-
on: t.on ?
|
|
3228
|
+
on: t.on ? sa.cloneWithOperation(t.on, "And", e) : sa.create(e)
|
|
3229
3229
|
});
|
|
3230
3230
|
}
|
|
3231
3231
|
}), lt = c({
|
|
@@ -3291,14 +3291,14 @@ const oe = c({
|
|
|
3291
3291
|
"#",
|
|
3292
3292
|
"<<",
|
|
3293
3293
|
">>"
|
|
3294
|
-
],
|
|
3294
|
+
], kn = ["->", "->>"], qi = [
|
|
3295
3295
|
...ji,
|
|
3296
3296
|
...Ji,
|
|
3297
3297
|
"&&",
|
|
3298
3298
|
"||"
|
|
3299
3299
|
], Wi = ["exists", "not exists"], Bi = ["not", "-", ...Wi], Ui = [
|
|
3300
3300
|
...qi,
|
|
3301
|
-
...
|
|
3301
|
+
...kn,
|
|
3302
3302
|
...Bi,
|
|
3303
3303
|
"between",
|
|
3304
3304
|
"between symmetric"
|
|
@@ -3313,10 +3313,10 @@ const oe = c({
|
|
|
3313
3313
|
});
|
|
3314
3314
|
}
|
|
3315
3315
|
});
|
|
3316
|
-
function
|
|
3317
|
-
return re(t) &&
|
|
3316
|
+
function Ka(t) {
|
|
3317
|
+
return re(t) && kn.includes(t);
|
|
3318
3318
|
}
|
|
3319
|
-
const
|
|
3319
|
+
const Da = c({
|
|
3320
3320
|
is(t) {
|
|
3321
3321
|
return t.kind === "ColumnNode";
|
|
3322
3322
|
},
|
|
@@ -3326,7 +3326,7 @@ const Aa = c({
|
|
|
3326
3326
|
column: U.create(t)
|
|
3327
3327
|
});
|
|
3328
3328
|
}
|
|
3329
|
-
}),
|
|
3329
|
+
}), En = c({
|
|
3330
3330
|
is(t) {
|
|
3331
3331
|
return t.kind === "SelectAllNode";
|
|
3332
3332
|
},
|
|
@@ -3335,7 +3335,7 @@ const Aa = c({
|
|
|
3335
3335
|
kind: "SelectAllNode"
|
|
3336
3336
|
});
|
|
3337
3337
|
}
|
|
3338
|
-
}),
|
|
3338
|
+
}), ea = c({
|
|
3339
3339
|
is(t) {
|
|
3340
3340
|
return t.kind === "ReferenceNode";
|
|
3341
3341
|
},
|
|
@@ -3350,14 +3350,14 @@ const Aa = c({
|
|
|
3350
3350
|
return c({
|
|
3351
3351
|
kind: "ReferenceNode",
|
|
3352
3352
|
table: t,
|
|
3353
|
-
column:
|
|
3353
|
+
column: En.create()
|
|
3354
3354
|
});
|
|
3355
3355
|
}
|
|
3356
3356
|
});
|
|
3357
|
-
function
|
|
3358
|
-
return
|
|
3357
|
+
function In(t) {
|
|
3358
|
+
return Zt(t) && H(t) && re(t.dynamicReference);
|
|
3359
3359
|
}
|
|
3360
|
-
const
|
|
3360
|
+
const ma = c({
|
|
3361
3361
|
is(t) {
|
|
3362
3362
|
return t.kind === "OrderByItemNode";
|
|
3363
3363
|
},
|
|
@@ -3392,42 +3392,42 @@ const _a = c({
|
|
|
3392
3392
|
function Ki(t) {
|
|
3393
3393
|
return t === "asc" || t === "desc";
|
|
3394
3394
|
}
|
|
3395
|
-
function
|
|
3395
|
+
function Pa(t) {
|
|
3396
3396
|
if (t.length === 2)
|
|
3397
|
-
return [
|
|
3397
|
+
return [ia(t[0], t[1])];
|
|
3398
3398
|
if (t.length === 1) {
|
|
3399
3399
|
const [e] = t;
|
|
3400
|
-
return Array.isArray(e) ? e.map((a) =>
|
|
3400
|
+
return Array.isArray(e) ? e.map((a) => ia(a)) : [ia(e)];
|
|
3401
3401
|
}
|
|
3402
3402
|
throw new Error(`Invalid number of arguments at order by! expected 1-2, received ${t.length}`);
|
|
3403
3403
|
}
|
|
3404
|
-
function
|
|
3404
|
+
function ia(t, e) {
|
|
3405
3405
|
const a = Qi(t);
|
|
3406
|
-
if (
|
|
3406
|
+
if (ma.is(a)) {
|
|
3407
3407
|
if (e)
|
|
3408
3408
|
throw new Error("Cannot specify direction twice!");
|
|
3409
3409
|
return a;
|
|
3410
3410
|
}
|
|
3411
|
-
return
|
|
3411
|
+
return ma.create(a, $n(e));
|
|
3412
3412
|
}
|
|
3413
3413
|
function Qi(t) {
|
|
3414
|
-
if (
|
|
3415
|
-
return
|
|
3416
|
-
if (
|
|
3414
|
+
if (ra(t))
|
|
3415
|
+
return na(t);
|
|
3416
|
+
if (In(t))
|
|
3417
3417
|
return t.toOperationNode();
|
|
3418
3418
|
const [e, a] = t.split(" ");
|
|
3419
3419
|
if (a) {
|
|
3420
3420
|
if (!Ki(a))
|
|
3421
3421
|
throw new Error(`Invalid order by direction: ${a}`);
|
|
3422
|
-
return
|
|
3422
|
+
return ma.create(Ce(e), $n(a));
|
|
3423
3423
|
}
|
|
3424
3424
|
return Ce(t);
|
|
3425
3425
|
}
|
|
3426
|
-
function
|
|
3426
|
+
function $n(t) {
|
|
3427
3427
|
if (t)
|
|
3428
3428
|
return t === "asc" || t === "desc" ? B.createWithSql(t) : t.toOperationNode();
|
|
3429
3429
|
}
|
|
3430
|
-
const
|
|
3430
|
+
const Lt = c({
|
|
3431
3431
|
is(t) {
|
|
3432
3432
|
return t.kind === "JSONReferenceNode";
|
|
3433
3433
|
},
|
|
@@ -3444,7 +3444,7 @@ const Ft = c({
|
|
|
3444
3444
|
traversal: e
|
|
3445
3445
|
});
|
|
3446
3446
|
}
|
|
3447
|
-
}),
|
|
3447
|
+
}), An = c({
|
|
3448
3448
|
is(t) {
|
|
3449
3449
|
return t.kind === "JSONOperatorChainNode";
|
|
3450
3450
|
},
|
|
@@ -3482,26 +3482,26 @@ const Ft = c({
|
|
|
3482
3482
|
function Vi(t) {
|
|
3483
3483
|
return re(t) ? Ce(t) : t.toOperationNode();
|
|
3484
3484
|
}
|
|
3485
|
-
function
|
|
3485
|
+
function Ct(t) {
|
|
3486
3486
|
return ve(t) ? t.map((e) => V(e)) : [V(t)];
|
|
3487
3487
|
}
|
|
3488
3488
|
function V(t) {
|
|
3489
|
-
return
|
|
3489
|
+
return ra(t) ? na(t) : Vi(t);
|
|
3490
3490
|
}
|
|
3491
3491
|
function Gi(t, e) {
|
|
3492
3492
|
const a = Ce(t);
|
|
3493
|
-
if (
|
|
3494
|
-
return
|
|
3493
|
+
if (Ka(e))
|
|
3494
|
+
return Lt.create(a, An.create(ze.create(e)));
|
|
3495
3495
|
const n = e.slice(0, -1);
|
|
3496
|
-
if (
|
|
3497
|
-
return
|
|
3496
|
+
if (Ka(n))
|
|
3497
|
+
return Lt.create(a, gt.create(ze.create(n)));
|
|
3498
3498
|
throw new Error(`Invalid JSON operator: ${e}`);
|
|
3499
3499
|
}
|
|
3500
3500
|
function Ce(t) {
|
|
3501
3501
|
const e = ".";
|
|
3502
3502
|
if (!t.includes(e))
|
|
3503
|
-
return
|
|
3504
|
-
const a = t.split(e).map(
|
|
3503
|
+
return ea.create(Da.create(t));
|
|
3504
|
+
const a = t.split(e).map(Dn);
|
|
3505
3505
|
if (a.length === 3)
|
|
3506
3506
|
return Yi(a);
|
|
3507
3507
|
if (a.length === 2)
|
|
@@ -3511,20 +3511,20 @@ function Ce(t) {
|
|
|
3511
3511
|
function Hi(t) {
|
|
3512
3512
|
const e = " as ";
|
|
3513
3513
|
if (t.includes(e)) {
|
|
3514
|
-
const [a, n] = t.split(e).map(
|
|
3515
|
-
return
|
|
3514
|
+
const [a, n] = t.split(e).map(Dn);
|
|
3515
|
+
return be.create(Ce(a), U.create(n));
|
|
3516
3516
|
} else
|
|
3517
3517
|
return Ce(t);
|
|
3518
3518
|
}
|
|
3519
3519
|
function Yi(t) {
|
|
3520
3520
|
const [e, a, n] = t;
|
|
3521
|
-
return
|
|
3521
|
+
return ea.create(Da.create(n), ye.createWithSchema(e, a));
|
|
3522
3522
|
}
|
|
3523
3523
|
function Xi(t) {
|
|
3524
3524
|
const [e, a] = t;
|
|
3525
|
-
return
|
|
3525
|
+
return ea.create(Da.create(a), ye.create(e));
|
|
3526
3526
|
}
|
|
3527
|
-
function
|
|
3527
|
+
function Dn(t) {
|
|
3528
3528
|
return t.trim();
|
|
3529
3529
|
}
|
|
3530
3530
|
const Zi = c({
|
|
@@ -3569,20 +3569,20 @@ function tc(t) {
|
|
|
3569
3569
|
return ve(t) ? ac(t) : j(t);
|
|
3570
3570
|
}
|
|
3571
3571
|
function j(t) {
|
|
3572
|
-
return
|
|
3573
|
-
}
|
|
3574
|
-
function Pa(t) {
|
|
3575
|
-
return $a(t) || Tn(t) || Sn(t);
|
|
3572
|
+
return ra(t) ? na(t) : xe.create(t);
|
|
3576
3573
|
}
|
|
3577
3574
|
function Ra(t) {
|
|
3578
|
-
|
|
3575
|
+
return Aa(t) || bn(t) || Sn(t);
|
|
3576
|
+
}
|
|
3577
|
+
function za(t) {
|
|
3578
|
+
if (!Ra(t))
|
|
3579
3579
|
throw new Error(`unsafe immediate value ${JSON.stringify(t)}`);
|
|
3580
3580
|
return xe.createImmediate(t);
|
|
3581
3581
|
}
|
|
3582
3582
|
function ac(t) {
|
|
3583
|
-
return t.some(
|
|
3583
|
+
return t.some(ra) ? ec.create(t.map((e) => j(e))) : Zi.create(t);
|
|
3584
3584
|
}
|
|
3585
|
-
const
|
|
3585
|
+
const xt = c({
|
|
3586
3586
|
is(t) {
|
|
3587
3587
|
return t.kind === "ParensNode";
|
|
3588
3588
|
},
|
|
@@ -3595,43 +3595,43 @@ const Ct = c({
|
|
|
3595
3595
|
});
|
|
3596
3596
|
function ee(t) {
|
|
3597
3597
|
if (t.length === 3)
|
|
3598
|
-
return
|
|
3598
|
+
return Fa(t[0], t[1], t[2]);
|
|
3599
3599
|
if (t.length === 1)
|
|
3600
3600
|
return j(t[0]);
|
|
3601
3601
|
throw new Error(`invalid arguments: ${JSON.stringify(t)}`);
|
|
3602
3602
|
}
|
|
3603
|
-
function
|
|
3604
|
-
return nc(e) &&
|
|
3603
|
+
function Fa(t, e, a) {
|
|
3604
|
+
return nc(e) && Pn(a) ? lt.create(V(t), fa(e), xe.createImmediate(a)) : lt.create(V(t), fa(e), tc(a));
|
|
3605
3605
|
}
|
|
3606
|
-
function
|
|
3607
|
-
return lt.create(V(t),
|
|
3606
|
+
function Tt(t, e, a) {
|
|
3607
|
+
return lt.create(V(t), fa(e), V(a));
|
|
3608
3608
|
}
|
|
3609
|
-
function
|
|
3610
|
-
return
|
|
3609
|
+
function Qa(t, e) {
|
|
3610
|
+
return ha(Object.entries(t).filter(([, a]) => !Ft(a)).map(([a, n]) => Fa(a, Pn(n) ? "is" : "=", n)), e);
|
|
3611
3611
|
}
|
|
3612
|
-
function
|
|
3612
|
+
function ha(t, e, a = !0) {
|
|
3613
3613
|
const n = e === "and" ? Ne.create : _t.create;
|
|
3614
3614
|
if (t.length === 0)
|
|
3615
3615
|
return lt.create(xe.createImmediate(1), ze.create("="), xe.createImmediate(e === "and" ? 1 : 0));
|
|
3616
|
-
let r =
|
|
3616
|
+
let r = Va(t[0]);
|
|
3617
3617
|
for (let o = 1; o < t.length; ++o)
|
|
3618
|
-
r = n(r,
|
|
3619
|
-
return t.length > 1 && a ?
|
|
3618
|
+
r = n(r, Va(t[o]));
|
|
3619
|
+
return t.length > 1 && a ? xt.create(r) : r;
|
|
3620
3620
|
}
|
|
3621
3621
|
function nc(t) {
|
|
3622
3622
|
return t === "is" || t === "is not";
|
|
3623
3623
|
}
|
|
3624
|
-
function
|
|
3625
|
-
return Sn(t) ||
|
|
3624
|
+
function Pn(t) {
|
|
3625
|
+
return Sn(t) || bn(t);
|
|
3626
3626
|
}
|
|
3627
|
-
function
|
|
3627
|
+
function fa(t) {
|
|
3628
3628
|
if (re(t) && Ui.includes(t))
|
|
3629
3629
|
return ze.create(t);
|
|
3630
3630
|
if (H(t))
|
|
3631
3631
|
return t.toOperationNode();
|
|
3632
3632
|
throw new Error(`invalid operator ${JSON.stringify(t)}`);
|
|
3633
3633
|
}
|
|
3634
|
-
function
|
|
3634
|
+
function Va(t) {
|
|
3635
3635
|
return H(t) ? t.toOperationNode() : t;
|
|
3636
3636
|
}
|
|
3637
3637
|
const Te = c({
|
|
@@ -3650,7 +3650,7 @@ const Te = c({
|
|
|
3650
3650
|
items: c([...t.items, ...e])
|
|
3651
3651
|
});
|
|
3652
3652
|
}
|
|
3653
|
-
}),
|
|
3653
|
+
}), Ga = c({
|
|
3654
3654
|
is(t) {
|
|
3655
3655
|
return t.kind === "PartitionByNode";
|
|
3656
3656
|
},
|
|
@@ -3666,7 +3666,7 @@ const Te = c({
|
|
|
3666
3666
|
items: c([...t.items, ...e])
|
|
3667
3667
|
});
|
|
3668
3668
|
}
|
|
3669
|
-
}),
|
|
3669
|
+
}), pa = c({
|
|
3670
3670
|
is(t) {
|
|
3671
3671
|
return t.kind === "OverNode";
|
|
3672
3672
|
},
|
|
@@ -3684,10 +3684,10 @@ const Te = c({
|
|
|
3684
3684
|
cloneWithPartitionByItems(t, e) {
|
|
3685
3685
|
return c({
|
|
3686
3686
|
...t,
|
|
3687
|
-
partitionBy: t.partitionBy ?
|
|
3687
|
+
partitionBy: t.partitionBy ? Ga.cloneWithItems(t.partitionBy, e) : Ga.create(e)
|
|
3688
3688
|
});
|
|
3689
3689
|
}
|
|
3690
|
-
}),
|
|
3690
|
+
}), Mt = c({
|
|
3691
3691
|
is(t) {
|
|
3692
3692
|
return t.kind === "FromNode";
|
|
3693
3693
|
},
|
|
@@ -3703,7 +3703,7 @@ const Te = c({
|
|
|
3703
3703
|
froms: c([...t.froms, ...e])
|
|
3704
3704
|
});
|
|
3705
3705
|
}
|
|
3706
|
-
}),
|
|
3706
|
+
}), Ha = c({
|
|
3707
3707
|
is(t) {
|
|
3708
3708
|
return t.kind === "GroupByNode";
|
|
3709
3709
|
},
|
|
@@ -3719,7 +3719,7 @@ const Te = c({
|
|
|
3719
3719
|
items: c([...t.items, ...e])
|
|
3720
3720
|
});
|
|
3721
3721
|
}
|
|
3722
|
-
}),
|
|
3722
|
+
}), Ya = c({
|
|
3723
3723
|
is(t) {
|
|
3724
3724
|
return t.kind === "HavingNode";
|
|
3725
3725
|
},
|
|
@@ -3748,7 +3748,7 @@ const Te = c({
|
|
|
3748
3748
|
createFrom(t, e) {
|
|
3749
3749
|
return c({
|
|
3750
3750
|
kind: "SelectQueryNode",
|
|
3751
|
-
from:
|
|
3751
|
+
from: Mt.create(t),
|
|
3752
3752
|
...e && { with: e }
|
|
3753
3753
|
});
|
|
3754
3754
|
},
|
|
@@ -3779,7 +3779,7 @@ const Te = c({
|
|
|
3779
3779
|
cloneWithGroupByItems(t, e) {
|
|
3780
3780
|
return c({
|
|
3781
3781
|
...t,
|
|
3782
|
-
groupBy: t.groupBy ?
|
|
3782
|
+
groupBy: t.groupBy ? Ha.cloneWithItems(t.groupBy, e) : Ha.create(e)
|
|
3783
3783
|
});
|
|
3784
3784
|
},
|
|
3785
3785
|
cloneWithLimit(t, e) {
|
|
@@ -3803,7 +3803,7 @@ const Te = c({
|
|
|
3803
3803
|
cloneWithHaving(t, e) {
|
|
3804
3804
|
return c({
|
|
3805
3805
|
...t,
|
|
3806
|
-
having: t.having ?
|
|
3806
|
+
having: t.having ? Ya.cloneWithOperation(t.having, "And", e) : Ya.create(e)
|
|
3807
3807
|
});
|
|
3808
3808
|
},
|
|
3809
3809
|
cloneWithSetOperations(t, e) {
|
|
@@ -3857,7 +3857,7 @@ var X;
|
|
|
3857
3857
|
const yt = class yt {
|
|
3858
3858
|
constructor(e) {
|
|
3859
3859
|
T(this, X);
|
|
3860
|
-
|
|
3860
|
+
b(this, X, c(e));
|
|
3861
3861
|
}
|
|
3862
3862
|
on(...e) {
|
|
3863
3863
|
return new yt({
|
|
@@ -3874,7 +3874,7 @@ const yt = class yt {
|
|
|
3874
3874
|
onRef(e, a, n) {
|
|
3875
3875
|
return new yt({
|
|
3876
3876
|
...i(this, X),
|
|
3877
|
-
joinNode: pt.cloneWithOn(i(this, X).joinNode,
|
|
3877
|
+
joinNode: pt.cloneWithOn(i(this, X).joinNode, Tt(e, a, n))
|
|
3878
3878
|
});
|
|
3879
3879
|
}
|
|
3880
3880
|
/**
|
|
@@ -3898,8 +3898,8 @@ const yt = class yt {
|
|
|
3898
3898
|
}
|
|
3899
3899
|
};
|
|
3900
3900
|
X = new WeakMap();
|
|
3901
|
-
let
|
|
3902
|
-
Me(
|
|
3901
|
+
let jt = yt;
|
|
3902
|
+
Me(jt, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
|
|
3903
3903
|
const rc = c({
|
|
3904
3904
|
is(t) {
|
|
3905
3905
|
return t.kind === "PartitionByItemNode";
|
|
@@ -3912,13 +3912,13 @@ const rc = c({
|
|
|
3912
3912
|
}
|
|
3913
3913
|
});
|
|
3914
3914
|
function oc(t) {
|
|
3915
|
-
return
|
|
3915
|
+
return Ct(t).map(rc.create);
|
|
3916
3916
|
}
|
|
3917
3917
|
var Oe;
|
|
3918
|
-
const
|
|
3918
|
+
const Kt = class Kt {
|
|
3919
3919
|
constructor(e) {
|
|
3920
3920
|
T(this, Oe);
|
|
3921
|
-
|
|
3921
|
+
b(this, Oe, c(e));
|
|
3922
3922
|
}
|
|
3923
3923
|
/**
|
|
3924
3924
|
* Adds an order by clause item inside the over function.
|
|
@@ -3942,13 +3942,13 @@ const Ut = class Ut {
|
|
|
3942
3942
|
* ```
|
|
3943
3943
|
*/
|
|
3944
3944
|
orderBy(e, a) {
|
|
3945
|
-
return new
|
|
3946
|
-
overNode:
|
|
3945
|
+
return new Kt({
|
|
3946
|
+
overNode: pa.cloneWithOrderByItems(i(this, Oe).overNode, Pa([e, a]))
|
|
3947
3947
|
});
|
|
3948
3948
|
}
|
|
3949
3949
|
partitionBy(e) {
|
|
3950
|
-
return new
|
|
3951
|
-
overNode:
|
|
3950
|
+
return new Kt({
|
|
3951
|
+
overNode: pa.cloneWithPartitionByItems(i(this, Oe).overNode, oc(e))
|
|
3952
3952
|
});
|
|
3953
3953
|
}
|
|
3954
3954
|
/**
|
|
@@ -3963,8 +3963,8 @@ const Ut = class Ut {
|
|
|
3963
3963
|
}
|
|
3964
3964
|
};
|
|
3965
3965
|
Oe = new WeakMap();
|
|
3966
|
-
let
|
|
3967
|
-
Me(
|
|
3966
|
+
let Jt = Kt;
|
|
3967
|
+
Me(Jt, "don't await OverBuilder instances. They are never executed directly and are always just a part of a query.");
|
|
3968
3968
|
const wt = c({
|
|
3969
3969
|
is(t) {
|
|
3970
3970
|
return t.kind === "SelectionNode";
|
|
@@ -3978,26 +3978,26 @@ const wt = c({
|
|
|
3978
3978
|
createSelectAll() {
|
|
3979
3979
|
return c({
|
|
3980
3980
|
kind: "SelectionNode",
|
|
3981
|
-
selection:
|
|
3981
|
+
selection: En.create()
|
|
3982
3982
|
});
|
|
3983
3983
|
},
|
|
3984
3984
|
createSelectAllFromTable(t) {
|
|
3985
3985
|
return c({
|
|
3986
3986
|
kind: "SelectionNode",
|
|
3987
|
-
selection:
|
|
3987
|
+
selection: ea.createSelectAll(t)
|
|
3988
3988
|
});
|
|
3989
3989
|
}
|
|
3990
3990
|
});
|
|
3991
|
-
function Pn(t) {
|
|
3992
|
-
return Le(t) ? Pn(t(ta())) : ve(t) ? t.map((e) => Ya(e)) : [Ya(t)];
|
|
3993
|
-
}
|
|
3994
|
-
function Ya(t) {
|
|
3995
|
-
return re(t) ? wt.create(Hi(t)) : En(t) ? wt.create(t.toOperationNode()) : wt.create(Bn(t));
|
|
3996
|
-
}
|
|
3997
3991
|
function Rn(t) {
|
|
3998
|
-
return t ?
|
|
3992
|
+
return Le(t) ? Rn(t(aa())) : ve(t) ? t.map((e) => Xa(e)) : [Xa(t)];
|
|
3999
3993
|
}
|
|
4000
3994
|
function Xa(t) {
|
|
3995
|
+
return re(t) ? wt.create(Hi(t)) : In(t) ? wt.create(t.toOperationNode()) : wt.create(Un(t));
|
|
3996
|
+
}
|
|
3997
|
+
function zn(t) {
|
|
3998
|
+
return t ? Array.isArray(t) ? t.map(Za) : [Za(t)] : [wt.createSelectAll()];
|
|
3999
|
+
}
|
|
4000
|
+
function Za(t) {
|
|
4001
4001
|
if (re(t))
|
|
4002
4002
|
return wt.createSelectAllFromTable(Z(t));
|
|
4003
4003
|
throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`);
|
|
@@ -4044,7 +4044,7 @@ const sc = c({
|
|
|
4044
4044
|
cloneWithFromItems(t, e) {
|
|
4045
4045
|
return c({
|
|
4046
4046
|
...t,
|
|
4047
|
-
from: t.from ?
|
|
4047
|
+
from: t.from ? Mt.cloneWithFroms(t.from, e) : Mt.create(e)
|
|
4048
4048
|
});
|
|
4049
4049
|
},
|
|
4050
4050
|
cloneWithUpdates(t, e) {
|
|
@@ -4059,7 +4059,7 @@ const sc = c({
|
|
|
4059
4059
|
limit: e
|
|
4060
4060
|
});
|
|
4061
4061
|
}
|
|
4062
|
-
}),
|
|
4062
|
+
}), en = c({
|
|
4063
4063
|
is(t) {
|
|
4064
4064
|
return t.kind === "UsingNode";
|
|
4065
4065
|
},
|
|
@@ -4082,7 +4082,7 @@ const sc = c({
|
|
|
4082
4082
|
create(t, e) {
|
|
4083
4083
|
return c({
|
|
4084
4084
|
kind: "DeleteQueryNode",
|
|
4085
|
-
from:
|
|
4085
|
+
from: Mt.create(t),
|
|
4086
4086
|
...e && { with: e }
|
|
4087
4087
|
});
|
|
4088
4088
|
},
|
|
@@ -4113,7 +4113,7 @@ const sc = c({
|
|
|
4113
4113
|
cloneWithUsing(t, e) {
|
|
4114
4114
|
return c({
|
|
4115
4115
|
...t,
|
|
4116
|
-
using: t.using !== void 0 ?
|
|
4116
|
+
using: t.using !== void 0 ? en.cloneWithTables(t.using, e) : en.create(e)
|
|
4117
4117
|
});
|
|
4118
4118
|
}
|
|
4119
4119
|
}), Ke = c({
|
|
@@ -4132,7 +4132,7 @@ const sc = c({
|
|
|
4132
4132
|
where: e === "And" ? Ne.create(t.where, a) : _t.create(t.where, a)
|
|
4133
4133
|
});
|
|
4134
4134
|
}
|
|
4135
|
-
}),
|
|
4135
|
+
}), tn = c({
|
|
4136
4136
|
is(t) {
|
|
4137
4137
|
return t.kind === "ReturningNode";
|
|
4138
4138
|
},
|
|
@@ -4159,7 +4159,7 @@ const sc = c({
|
|
|
4159
4159
|
options: e
|
|
4160
4160
|
});
|
|
4161
4161
|
}
|
|
4162
|
-
}),
|
|
4162
|
+
}), ta = c({
|
|
4163
4163
|
is(t) {
|
|
4164
4164
|
return t.kind === "WhenNode";
|
|
4165
4165
|
},
|
|
@@ -4203,11 +4203,11 @@ const sc = c({
|
|
|
4203
4203
|
...t,
|
|
4204
4204
|
whens: t.whens ? c([
|
|
4205
4205
|
...t.whens.slice(0, -1),
|
|
4206
|
-
|
|
4206
|
+
ta.cloneWithResult(t.whens[t.whens.length - 1], e)
|
|
4207
4207
|
]) : void 0
|
|
4208
4208
|
});
|
|
4209
4209
|
}
|
|
4210
|
-
}),
|
|
4210
|
+
}), an = c({
|
|
4211
4211
|
is(t) {
|
|
4212
4212
|
return t.kind === "OutputNode";
|
|
4213
4213
|
},
|
|
@@ -4248,7 +4248,7 @@ const sc = c({
|
|
|
4248
4248
|
cloneWithReturning(t, e) {
|
|
4249
4249
|
return c({
|
|
4250
4250
|
...t,
|
|
4251
|
-
returning: t.returning ?
|
|
4251
|
+
returning: t.returning ? tn.cloneWithSelections(t.returning, e) : tn.create(e)
|
|
4252
4252
|
});
|
|
4253
4253
|
},
|
|
4254
4254
|
cloneWithoutReturning(t) {
|
|
@@ -4278,7 +4278,7 @@ const sc = c({
|
|
|
4278
4278
|
cloneWithOutput(t, e) {
|
|
4279
4279
|
return c({
|
|
4280
4280
|
...t,
|
|
4281
|
-
output: t.output ?
|
|
4281
|
+
output: t.output ? an.cloneWithSelections(t.output, e) : an.create(e)
|
|
4282
4282
|
});
|
|
4283
4283
|
}
|
|
4284
4284
|
});
|
|
@@ -4308,9 +4308,9 @@ const mc = c({
|
|
|
4308
4308
|
}
|
|
4309
4309
|
});
|
|
4310
4310
|
function hc(t, e) {
|
|
4311
|
-
if (
|
|
4311
|
+
if (!Aa(t) && !On(t))
|
|
4312
4312
|
throw new Error(`Invalid top expression: ${t}`);
|
|
4313
|
-
if (!
|
|
4313
|
+
if (!Ft(e) && !fc(e))
|
|
4314
4314
|
throw new Error(`Invalid top modifiers: ${e}`);
|
|
4315
4315
|
return mc.create(t, e);
|
|
4316
4316
|
}
|
|
@@ -4327,7 +4327,7 @@ const pc = c({
|
|
|
4327
4327
|
limit: t
|
|
4328
4328
|
});
|
|
4329
4329
|
}
|
|
4330
|
-
}),
|
|
4330
|
+
}), nn = [
|
|
4331
4331
|
"A",
|
|
4332
4332
|
"B",
|
|
4333
4333
|
"C",
|
|
@@ -4398,7 +4398,7 @@ function gc(t) {
|
|
|
4398
4398
|
return e;
|
|
4399
4399
|
}
|
|
4400
4400
|
function wc() {
|
|
4401
|
-
return
|
|
4401
|
+
return nn[~~(Math.random() * nn.length)];
|
|
4402
4402
|
}
|
|
4403
4403
|
function se() {
|
|
4404
4404
|
return new yc();
|
|
@@ -4409,15 +4409,15 @@ class yc {
|
|
|
4409
4409
|
T(this, He);
|
|
4410
4410
|
}
|
|
4411
4411
|
get queryId() {
|
|
4412
|
-
return i(this, He) === void 0 &&
|
|
4412
|
+
return i(this, He) === void 0 && b(this, He, gc(8)), i(this, He);
|
|
4413
4413
|
}
|
|
4414
4414
|
}
|
|
4415
4415
|
He = new WeakMap();
|
|
4416
|
-
var
|
|
4416
|
+
var Qt;
|
|
4417
4417
|
class vc {
|
|
4418
4418
|
constructor() {
|
|
4419
4419
|
me(this, "nodeStack", []);
|
|
4420
|
-
T(this,
|
|
4420
|
+
T(this, Qt, c({
|
|
4421
4421
|
AliasNode: this.transformAlias.bind(this),
|
|
4422
4422
|
ColumnNode: this.transformColumn.bind(this),
|
|
4423
4423
|
IdentifierNode: this.transformIdentifier.bind(this),
|
|
@@ -4521,7 +4521,7 @@ class vc {
|
|
|
4521
4521
|
return this.nodeStack.pop(), c(a);
|
|
4522
4522
|
}
|
|
4523
4523
|
transformNodeImpl(e) {
|
|
4524
|
-
return i(this,
|
|
4524
|
+
return i(this, Qt)[e.kind](e);
|
|
4525
4525
|
}
|
|
4526
4526
|
transformNodeList(e) {
|
|
4527
4527
|
return e && c(e.map((a) => this.transformNode(a)));
|
|
@@ -5252,7 +5252,7 @@ class vc {
|
|
|
5252
5252
|
return e;
|
|
5253
5253
|
}
|
|
5254
5254
|
}
|
|
5255
|
-
|
|
5255
|
+
Qt = new WeakMap();
|
|
5256
5256
|
const Nc = c({
|
|
5257
5257
|
AlterTableNode: !0,
|
|
5258
5258
|
CreateIndexNode: !0,
|
|
@@ -5275,7 +5275,7 @@ const Nc = c({
|
|
|
5275
5275
|
json_agg: !0,
|
|
5276
5276
|
to_json: !0
|
|
5277
5277
|
};
|
|
5278
|
-
var Ye, ke, Ee, $,
|
|
5278
|
+
var Ye, ke, Ee, $, ga, Fn, Ln, Mn, We, wa, jn;
|
|
5279
5279
|
class xc extends vc {
|
|
5280
5280
|
constructor(a) {
|
|
5281
5281
|
super();
|
|
@@ -5283,15 +5283,15 @@ class xc extends vc {
|
|
|
5283
5283
|
T(this, Ye);
|
|
5284
5284
|
T(this, ke, /* @__PURE__ */ new Set());
|
|
5285
5285
|
T(this, Ee, /* @__PURE__ */ new Set());
|
|
5286
|
-
|
|
5286
|
+
b(this, Ye, a);
|
|
5287
5287
|
}
|
|
5288
5288
|
transformNodeImpl(a) {
|
|
5289
|
-
if (!N(this, $,
|
|
5289
|
+
if (!N(this, $, Fn).call(this, a))
|
|
5290
5290
|
return super.transformNodeImpl(a);
|
|
5291
|
-
const n = N(this, $,
|
|
5291
|
+
const n = N(this, $, Mn).call(this, a);
|
|
5292
5292
|
for (const s of n)
|
|
5293
5293
|
i(this, Ee).add(s);
|
|
5294
|
-
const r = N(this, $,
|
|
5294
|
+
const r = N(this, $, Ln).call(this, a);
|
|
5295
5295
|
for (const s of r)
|
|
5296
5296
|
i(this, ke).add(s);
|
|
5297
5297
|
const o = super.transformNodeImpl(a);
|
|
@@ -5318,63 +5318,63 @@ class xc extends vc {
|
|
|
5318
5318
|
transformAggregateFunction(a) {
|
|
5319
5319
|
return {
|
|
5320
5320
|
...super.transformAggregateFunction({ ...a, aggregated: [] }),
|
|
5321
|
-
aggregated: N(this, $,
|
|
5321
|
+
aggregated: N(this, $, ga).call(this, a, "aggregated")
|
|
5322
5322
|
};
|
|
5323
5323
|
}
|
|
5324
5324
|
transformFunction(a) {
|
|
5325
5325
|
return {
|
|
5326
5326
|
...super.transformFunction({ ...a, arguments: [] }),
|
|
5327
|
-
arguments: N(this, $,
|
|
5327
|
+
arguments: N(this, $, ga).call(this, a, "arguments")
|
|
5328
5328
|
};
|
|
5329
5329
|
}
|
|
5330
5330
|
}
|
|
5331
|
-
Ye = new WeakMap(), ke = new WeakMap(), Ee = new WeakMap(), $ = new WeakSet(),
|
|
5331
|
+
Ye = new WeakMap(), ke = new WeakMap(), Ee = new WeakMap(), $ = new WeakSet(), ga = function(a, n) {
|
|
5332
5332
|
return Cc[a.func] ? a[n].map((r) => !ye.is(r) || r.table.schema ? this.transformNode(r) : {
|
|
5333
5333
|
...r,
|
|
5334
5334
|
table: this.transformIdentifier(r.table.identifier)
|
|
5335
5335
|
}) : this.transformNodeList(a[n]);
|
|
5336
|
-
}, zn = function(a) {
|
|
5337
|
-
return a.kind in Nc;
|
|
5338
5336
|
}, Fn = function(a) {
|
|
5337
|
+
return a.kind in Nc;
|
|
5338
|
+
}, Ln = function(a) {
|
|
5339
5339
|
const n = /* @__PURE__ */ new Set();
|
|
5340
|
-
if ("name" in a && a.name &&
|
|
5340
|
+
if ("name" in a && a.name && _a.is(a.name) && N(this, $, wa).call(this, a.name, n), "from" in a && a.from)
|
|
5341
5341
|
for (const r of a.from.froms)
|
|
5342
5342
|
N(this, $, We).call(this, r, n);
|
|
5343
5343
|
if ("into" in a && a.into && N(this, $, We).call(this, a.into, n), "table" in a && a.table && N(this, $, We).call(this, a.table, n), "joins" in a && a.joins)
|
|
5344
5344
|
for (const r of a.joins)
|
|
5345
5345
|
N(this, $, We).call(this, r.table, n);
|
|
5346
5346
|
return "using" in a && a.using && N(this, $, We).call(this, a.using, n), n;
|
|
5347
|
-
},
|
|
5347
|
+
}, Mn = function(a) {
|
|
5348
5348
|
const n = /* @__PURE__ */ new Set();
|
|
5349
|
-
return "with" in a && a.with && N(this, $,
|
|
5349
|
+
return "with" in a && a.with && N(this, $, jn).call(this, a.with, n), n;
|
|
5350
5350
|
}, We = function(a, n) {
|
|
5351
|
-
const r = ye.is(a) ? a :
|
|
5352
|
-
r && N(this, $,
|
|
5353
|
-
},
|
|
5351
|
+
const r = ye.is(a) ? a : be.is(a) && ye.is(a.node) ? a.node : null;
|
|
5352
|
+
r && N(this, $, wa).call(this, r.table, n);
|
|
5353
|
+
}, wa = function(a, n) {
|
|
5354
5354
|
const r = a.identifier.name;
|
|
5355
5355
|
!i(this, ke).has(r) && !i(this, Ee).has(r) && n.add(r);
|
|
5356
|
-
},
|
|
5356
|
+
}, jn = function(a, n) {
|
|
5357
5357
|
for (const r of a.expressions) {
|
|
5358
5358
|
const o = r.name.table.table.identifier.name;
|
|
5359
5359
|
i(this, Ee).has(o) || n.add(o);
|
|
5360
5360
|
}
|
|
5361
5361
|
};
|
|
5362
|
-
var
|
|
5363
|
-
class
|
|
5362
|
+
var bt;
|
|
5363
|
+
class Jn {
|
|
5364
5364
|
constructor(e) {
|
|
5365
|
-
T(this,
|
|
5366
|
-
|
|
5365
|
+
T(this, bt);
|
|
5366
|
+
b(this, bt, new xc(e));
|
|
5367
5367
|
}
|
|
5368
5368
|
transformQuery(e) {
|
|
5369
|
-
return i(this,
|
|
5369
|
+
return i(this, bt).transformNode(e.node);
|
|
5370
5370
|
}
|
|
5371
5371
|
async transformResult(e) {
|
|
5372
5372
|
return e.result;
|
|
5373
5373
|
}
|
|
5374
5374
|
}
|
|
5375
|
-
|
|
5375
|
+
bt = new WeakMap();
|
|
5376
5376
|
var St, Xe, Ze;
|
|
5377
|
-
class
|
|
5377
|
+
class rn {
|
|
5378
5378
|
constructor() {
|
|
5379
5379
|
T(this, St);
|
|
5380
5380
|
T(this, Xe);
|
|
@@ -5385,8 +5385,8 @@ class nn {
|
|
|
5385
5385
|
me(this, "reject", (e) => {
|
|
5386
5386
|
i(this, Ze) && i(this, Ze).call(this, e);
|
|
5387
5387
|
});
|
|
5388
|
-
|
|
5389
|
-
|
|
5388
|
+
b(this, St, new Promise((e, a) => {
|
|
5389
|
+
b(this, Ze, a), b(this, Xe, e);
|
|
5390
5390
|
}));
|
|
5391
5391
|
}
|
|
5392
5392
|
get promise() {
|
|
@@ -5394,17 +5394,17 @@ class nn {
|
|
|
5394
5394
|
}
|
|
5395
5395
|
}
|
|
5396
5396
|
St = new WeakMap(), Xe = new WeakMap(), Ze = new WeakMap();
|
|
5397
|
-
const
|
|
5397
|
+
const on = /* @__PURE__ */ new Set();
|
|
5398
5398
|
function Tc(t) {
|
|
5399
|
-
|
|
5399
|
+
on.has(t) || (on.add(t), console.log(t));
|
|
5400
5400
|
}
|
|
5401
|
-
const
|
|
5402
|
-
var Ie,
|
|
5403
|
-
class
|
|
5404
|
-
constructor(e =
|
|
5405
|
-
T(this,
|
|
5401
|
+
const bc = c([]);
|
|
5402
|
+
var Ie, Ot, ya;
|
|
5403
|
+
class Sc {
|
|
5404
|
+
constructor(e = bc) {
|
|
5405
|
+
T(this, Ot);
|
|
5406
5406
|
T(this, Ie);
|
|
5407
|
-
|
|
5407
|
+
b(this, Ie, e);
|
|
5408
5408
|
}
|
|
5409
5409
|
get plugins() {
|
|
5410
5410
|
return i(this, Ie);
|
|
@@ -5426,23 +5426,23 @@ class bc {
|
|
|
5426
5426
|
}
|
|
5427
5427
|
async executeQuery(e, a) {
|
|
5428
5428
|
return await this.provideConnection(async (n) => {
|
|
5429
|
-
const r = await n.executeQuery(e), o = await N(this,
|
|
5429
|
+
const r = await n.executeQuery(e), o = await N(this, Ot, ya).call(this, r, a);
|
|
5430
5430
|
return Oc(r, o), o;
|
|
5431
5431
|
});
|
|
5432
5432
|
}
|
|
5433
5433
|
async *stream(e, a, n) {
|
|
5434
|
-
const r = new
|
|
5434
|
+
const r = new rn(), o = new rn();
|
|
5435
5435
|
this.provideConnection(async (u) => (r.resolve(u), await o.promise)).catch((u) => r.reject(u));
|
|
5436
5436
|
const s = await r.promise;
|
|
5437
5437
|
try {
|
|
5438
5438
|
for await (const u of s.streamQuery(e, a))
|
|
5439
|
-
yield await N(this,
|
|
5439
|
+
yield await N(this, Ot, ya).call(this, u, n);
|
|
5440
5440
|
} finally {
|
|
5441
5441
|
o.resolve();
|
|
5442
5442
|
}
|
|
5443
5443
|
}
|
|
5444
5444
|
}
|
|
5445
|
-
Ie = new WeakMap(),
|
|
5445
|
+
Ie = new WeakMap(), Ot = new WeakSet(), ya = async function(e, a) {
|
|
5446
5446
|
for (const n of i(this, Ie))
|
|
5447
5447
|
e = await n.transformResult({ result: e, queryId: a });
|
|
5448
5448
|
return e;
|
|
@@ -5451,7 +5451,7 @@ function Oc(t, e) {
|
|
|
5451
5451
|
const { numAffectedRows: a } = t;
|
|
5452
5452
|
a === void 0 && t.numUpdatedOrDeletedRows === void 0 || a !== void 0 && e.numAffectedRows !== void 0 || Tc("kysely:warning: outdated driver/plugin detected! QueryResult.numUpdatedOrDeletedRows is deprecated and will be removed in a future release.");
|
|
5453
5453
|
}
|
|
5454
|
-
class Qe extends
|
|
5454
|
+
class Qe extends Sc {
|
|
5455
5455
|
get adapter() {
|
|
5456
5456
|
throw new Error("this query cannot be compiled to SQL");
|
|
5457
5457
|
}
|
|
@@ -5477,15 +5477,15 @@ class Qe extends bc {
|
|
|
5477
5477
|
return new Qe([]);
|
|
5478
5478
|
}
|
|
5479
5479
|
}
|
|
5480
|
-
const
|
|
5480
|
+
const qn = new Qe();
|
|
5481
5481
|
function kc(t, e) {
|
|
5482
|
-
return new
|
|
5483
|
-
joinNode: pt.create(t,
|
|
5482
|
+
return new jt({
|
|
5483
|
+
joinNode: pt.create(t, Bt(e))
|
|
5484
5484
|
});
|
|
5485
5485
|
}
|
|
5486
5486
|
function Ec() {
|
|
5487
|
-
return new
|
|
5488
|
-
overNode:
|
|
5487
|
+
return new Jt({
|
|
5488
|
+
overNode: pa.create()
|
|
5489
5489
|
});
|
|
5490
5490
|
}
|
|
5491
5491
|
function je(t, e) {
|
|
@@ -5499,7 +5499,7 @@ function Ic(t, e, a) {
|
|
|
5499
5499
|
return a(kc(t, e)).toOperationNode();
|
|
5500
5500
|
}
|
|
5501
5501
|
function $c(t, e, a, n) {
|
|
5502
|
-
return pt.createWithOn(t,
|
|
5502
|
+
return pt.createWithOn(t, Bt(e), Tt(a, "=", n));
|
|
5503
5503
|
}
|
|
5504
5504
|
const Ac = c({
|
|
5505
5505
|
is(t) {
|
|
@@ -5523,7 +5523,7 @@ const Ac = c({
|
|
|
5523
5523
|
}
|
|
5524
5524
|
});
|
|
5525
5525
|
function Pc(t) {
|
|
5526
|
-
return t = Le(t) ? t(
|
|
5526
|
+
return t = Le(t) ? t(aa()) : t, Ct(t).map(Dc.create);
|
|
5527
5527
|
}
|
|
5528
5528
|
const Rc = c({
|
|
5529
5529
|
is(t) {
|
|
@@ -5539,25 +5539,25 @@ const Rc = c({
|
|
|
5539
5539
|
}
|
|
5540
5540
|
});
|
|
5541
5541
|
function Je(t, e, a) {
|
|
5542
|
-
return Le(e) && (e = e(
|
|
5542
|
+
return Le(e) && (e = e(Ma())), ve(e) || (e = [e]), e.map((n) => Rc.create(t, na(n), a));
|
|
5543
5543
|
}
|
|
5544
5544
|
var de;
|
|
5545
|
-
const
|
|
5545
|
+
const Vt = class Vt {
|
|
5546
5546
|
constructor(e) {
|
|
5547
5547
|
T(this, de);
|
|
5548
|
-
|
|
5548
|
+
b(this, de, e);
|
|
5549
5549
|
}
|
|
5550
5550
|
/** @private */
|
|
5551
5551
|
get expressionType() {
|
|
5552
5552
|
}
|
|
5553
5553
|
as(e) {
|
|
5554
|
-
return new
|
|
5554
|
+
return new La(this, e);
|
|
5555
5555
|
}
|
|
5556
5556
|
or(...e) {
|
|
5557
|
-
return new
|
|
5557
|
+
return new va(_t.create(i(this, de), ee(e)));
|
|
5558
5558
|
}
|
|
5559
5559
|
and(...e) {
|
|
5560
|
-
return new
|
|
5560
|
+
return new Na(Ne.create(i(this, de), ee(e)));
|
|
5561
5561
|
}
|
|
5562
5562
|
/**
|
|
5563
5563
|
* Change the output type of the expression.
|
|
@@ -5566,7 +5566,7 @@ const Qt = class Qt {
|
|
|
5566
5566
|
* returns a copy of this `ExpressionWrapper` with a new output type.
|
|
5567
5567
|
*/
|
|
5568
5568
|
$castTo() {
|
|
5569
|
-
return new
|
|
5569
|
+
return new Vt(i(this, de));
|
|
5570
5570
|
}
|
|
5571
5571
|
/**
|
|
5572
5572
|
* Omit null from the expression's type.
|
|
@@ -5578,20 +5578,20 @@ const Qt = class Qt {
|
|
|
5578
5578
|
* returns a copy of `this` with a new output type.
|
|
5579
5579
|
*/
|
|
5580
5580
|
$notNull() {
|
|
5581
|
-
return new
|
|
5581
|
+
return new Vt(i(this, de));
|
|
5582
5582
|
}
|
|
5583
5583
|
toOperationNode() {
|
|
5584
5584
|
return i(this, de);
|
|
5585
5585
|
}
|
|
5586
5586
|
};
|
|
5587
5587
|
de = new WeakMap();
|
|
5588
|
-
let k =
|
|
5588
|
+
let k = Vt;
|
|
5589
5589
|
var et, pe;
|
|
5590
|
-
class
|
|
5590
|
+
class La {
|
|
5591
5591
|
constructor(e, a) {
|
|
5592
5592
|
T(this, et);
|
|
5593
5593
|
T(this, pe);
|
|
5594
|
-
|
|
5594
|
+
b(this, et, e), b(this, pe, a);
|
|
5595
5595
|
}
|
|
5596
5596
|
/** @private */
|
|
5597
5597
|
get expression() {
|
|
@@ -5602,24 +5602,24 @@ class Fa {
|
|
|
5602
5602
|
return i(this, pe);
|
|
5603
5603
|
}
|
|
5604
5604
|
toOperationNode() {
|
|
5605
|
-
return
|
|
5605
|
+
return be.create(i(this, et).toOperationNode(), H(i(this, pe)) ? i(this, pe).toOperationNode() : U.create(i(this, pe)));
|
|
5606
5606
|
}
|
|
5607
5607
|
}
|
|
5608
5608
|
et = new WeakMap(), pe = new WeakMap();
|
|
5609
5609
|
var $e;
|
|
5610
|
-
const
|
|
5610
|
+
const Gt = class Gt {
|
|
5611
5611
|
constructor(e) {
|
|
5612
5612
|
T(this, $e);
|
|
5613
|
-
|
|
5613
|
+
b(this, $e, e);
|
|
5614
5614
|
}
|
|
5615
5615
|
/** @private */
|
|
5616
5616
|
get expressionType() {
|
|
5617
5617
|
}
|
|
5618
5618
|
as(e) {
|
|
5619
|
-
return new
|
|
5619
|
+
return new La(this, e);
|
|
5620
5620
|
}
|
|
5621
5621
|
or(...e) {
|
|
5622
|
-
return new
|
|
5622
|
+
return new Gt(_t.create(i(this, $e), ee(e)));
|
|
5623
5623
|
}
|
|
5624
5624
|
/**
|
|
5625
5625
|
* Change the output type of the expression.
|
|
@@ -5628,28 +5628,28 @@ const Vt = class Vt {
|
|
|
5628
5628
|
* returns a copy of this `OrWrapper` with a new output type.
|
|
5629
5629
|
*/
|
|
5630
5630
|
$castTo() {
|
|
5631
|
-
return new
|
|
5631
|
+
return new Gt(i(this, $e));
|
|
5632
5632
|
}
|
|
5633
5633
|
toOperationNode() {
|
|
5634
|
-
return
|
|
5634
|
+
return xt.create(i(this, $e));
|
|
5635
5635
|
}
|
|
5636
5636
|
};
|
|
5637
5637
|
$e = new WeakMap();
|
|
5638
|
-
let
|
|
5638
|
+
let va = Gt;
|
|
5639
5639
|
var Ae;
|
|
5640
|
-
const
|
|
5640
|
+
const Ht = class Ht {
|
|
5641
5641
|
constructor(e) {
|
|
5642
5642
|
T(this, Ae);
|
|
5643
|
-
|
|
5643
|
+
b(this, Ae, e);
|
|
5644
5644
|
}
|
|
5645
5645
|
/** @private */
|
|
5646
5646
|
get expressionType() {
|
|
5647
5647
|
}
|
|
5648
5648
|
as(e) {
|
|
5649
|
-
return new
|
|
5649
|
+
return new La(this, e);
|
|
5650
5650
|
}
|
|
5651
5651
|
and(...e) {
|
|
5652
|
-
return new
|
|
5652
|
+
return new Ht(Ne.create(i(this, Ae), ee(e)));
|
|
5653
5653
|
}
|
|
5654
5654
|
/**
|
|
5655
5655
|
* Change the output type of the expression.
|
|
@@ -5658,14 +5658,14 @@ const Gt = class Gt {
|
|
|
5658
5658
|
* returns a copy of this `AndWrapper` with a new output type.
|
|
5659
5659
|
*/
|
|
5660
5660
|
$castTo() {
|
|
5661
|
-
return new
|
|
5661
|
+
return new Ht(i(this, Ae));
|
|
5662
5662
|
}
|
|
5663
5663
|
toOperationNode() {
|
|
5664
|
-
return
|
|
5664
|
+
return xt.create(i(this, Ae));
|
|
5665
5665
|
}
|
|
5666
5666
|
};
|
|
5667
5667
|
Ae = new WeakMap();
|
|
5668
|
-
let
|
|
5668
|
+
let Na = Ht;
|
|
5669
5669
|
const zc = {
|
|
5670
5670
|
is(t) {
|
|
5671
5671
|
return t.kind === "FetchNode";
|
|
@@ -5679,7 +5679,7 @@ const zc = {
|
|
|
5679
5679
|
}
|
|
5680
5680
|
};
|
|
5681
5681
|
function Fc(t, e) {
|
|
5682
|
-
if (
|
|
5682
|
+
if (!Aa(t) && !On(t))
|
|
5683
5683
|
throw new Error(`Invalid fetch row count: ${t}`);
|
|
5684
5684
|
if (!Lc(e))
|
|
5685
5685
|
throw new Error(`Invalid fetch modifier: ${e}`);
|
|
@@ -5692,7 +5692,7 @@ var p;
|
|
|
5692
5692
|
const C = class C {
|
|
5693
5693
|
constructor(e) {
|
|
5694
5694
|
T(this, p);
|
|
5695
|
-
|
|
5695
|
+
b(this, p, c(e));
|
|
5696
5696
|
}
|
|
5697
5697
|
get expressionType() {
|
|
5698
5698
|
}
|
|
@@ -5708,7 +5708,7 @@ const C = class C {
|
|
|
5708
5708
|
whereRef(e, a, n) {
|
|
5709
5709
|
return new C({
|
|
5710
5710
|
...i(this, p),
|
|
5711
|
-
queryNode: A.cloneWithWhere(i(this, p).queryNode,
|
|
5711
|
+
queryNode: A.cloneWithWhere(i(this, p).queryNode, Tt(e, a, n))
|
|
5712
5712
|
});
|
|
5713
5713
|
}
|
|
5714
5714
|
having(...e) {
|
|
@@ -5720,19 +5720,19 @@ const C = class C {
|
|
|
5720
5720
|
havingRef(e, a, n) {
|
|
5721
5721
|
return new C({
|
|
5722
5722
|
...i(this, p),
|
|
5723
|
-
queryNode: E.cloneWithHaving(i(this, p).queryNode,
|
|
5723
|
+
queryNode: E.cloneWithHaving(i(this, p).queryNode, Tt(e, a, n))
|
|
5724
5724
|
});
|
|
5725
5725
|
}
|
|
5726
5726
|
select(e) {
|
|
5727
5727
|
return new C({
|
|
5728
5728
|
...i(this, p),
|
|
5729
|
-
queryNode: E.cloneWithSelections(i(this, p).queryNode,
|
|
5729
|
+
queryNode: E.cloneWithSelections(i(this, p).queryNode, Rn(e))
|
|
5730
5730
|
});
|
|
5731
5731
|
}
|
|
5732
5732
|
distinctOn(e) {
|
|
5733
5733
|
return new C({
|
|
5734
5734
|
...i(this, p),
|
|
5735
|
-
queryNode: E.cloneWithDistinctOn(i(this, p).queryNode,
|
|
5735
|
+
queryNode: E.cloneWithDistinctOn(i(this, p).queryNode, Ct(e))
|
|
5736
5736
|
});
|
|
5737
5737
|
}
|
|
5738
5738
|
modifyFront(e) {
|
|
@@ -5756,25 +5756,25 @@ const C = class C {
|
|
|
5756
5756
|
forUpdate(e) {
|
|
5757
5757
|
return new C({
|
|
5758
5758
|
...i(this, p),
|
|
5759
|
-
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForUpdate", e ?
|
|
5759
|
+
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForUpdate", e ? At(e).map(Z) : void 0))
|
|
5760
5760
|
});
|
|
5761
5761
|
}
|
|
5762
5762
|
forShare(e) {
|
|
5763
5763
|
return new C({
|
|
5764
5764
|
...i(this, p),
|
|
5765
|
-
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForShare", e ?
|
|
5765
|
+
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForShare", e ? At(e).map(Z) : void 0))
|
|
5766
5766
|
});
|
|
5767
5767
|
}
|
|
5768
5768
|
forKeyShare(e) {
|
|
5769
5769
|
return new C({
|
|
5770
5770
|
...i(this, p),
|
|
5771
|
-
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForKeyShare", e ?
|
|
5771
|
+
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForKeyShare", e ? At(e).map(Z) : void 0))
|
|
5772
5772
|
});
|
|
5773
5773
|
}
|
|
5774
5774
|
forNoKeyUpdate(e) {
|
|
5775
5775
|
return new C({
|
|
5776
5776
|
...i(this, p),
|
|
5777
|
-
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForNoKeyUpdate", e ?
|
|
5777
|
+
queryNode: A.cloneWithEndModifier(i(this, p).queryNode, oe.create("ForNoKeyUpdate", e ? At(e).map(Z) : void 0))
|
|
5778
5778
|
});
|
|
5779
5779
|
}
|
|
5780
5780
|
skipLocked() {
|
|
@@ -5792,7 +5792,7 @@ const C = class C {
|
|
|
5792
5792
|
selectAll(e) {
|
|
5793
5793
|
return new C({
|
|
5794
5794
|
...i(this, p),
|
|
5795
|
-
queryNode: E.cloneWithSelections(i(this, p).queryNode,
|
|
5795
|
+
queryNode: E.cloneWithSelections(i(this, p).queryNode, zn(e))
|
|
5796
5796
|
});
|
|
5797
5797
|
}
|
|
5798
5798
|
innerJoin(...e) {
|
|
@@ -5834,7 +5834,7 @@ const C = class C {
|
|
|
5834
5834
|
orderBy(...e) {
|
|
5835
5835
|
return new C({
|
|
5836
5836
|
...i(this, p),
|
|
5837
|
-
queryNode: E.cloneWithOrderByItems(i(this, p).queryNode,
|
|
5837
|
+
queryNode: E.cloneWithOrderByItems(i(this, p).queryNode, Pa(e))
|
|
5838
5838
|
});
|
|
5839
5839
|
}
|
|
5840
5840
|
groupBy(e) {
|
|
@@ -5904,7 +5904,7 @@ const C = class C {
|
|
|
5904
5904
|
});
|
|
5905
5905
|
}
|
|
5906
5906
|
as(e) {
|
|
5907
|
-
return new
|
|
5907
|
+
return new Wn(this, e);
|
|
5908
5908
|
}
|
|
5909
5909
|
clearSelect() {
|
|
5910
5910
|
return new C({
|
|
@@ -6001,17 +6001,17 @@ const C = class C {
|
|
|
6001
6001
|
}
|
|
6002
6002
|
};
|
|
6003
6003
|
p = new WeakMap();
|
|
6004
|
-
let
|
|
6005
|
-
Me(
|
|
6004
|
+
let qt = C;
|
|
6005
|
+
Me(qt, "don't await SelectQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");
|
|
6006
6006
|
function Mc(t) {
|
|
6007
|
-
return new
|
|
6007
|
+
return new qt(t);
|
|
6008
6008
|
}
|
|
6009
6009
|
var tt, at;
|
|
6010
|
-
class
|
|
6010
|
+
class Wn {
|
|
6011
6011
|
constructor(e, a) {
|
|
6012
6012
|
T(this, tt);
|
|
6013
6013
|
T(this, at);
|
|
6014
|
-
|
|
6014
|
+
b(this, tt, e), b(this, at, a);
|
|
6015
6015
|
}
|
|
6016
6016
|
get expression() {
|
|
6017
6017
|
return i(this, tt);
|
|
@@ -6023,11 +6023,11 @@ class qn {
|
|
|
6023
6023
|
return !0;
|
|
6024
6024
|
}
|
|
6025
6025
|
toOperationNode() {
|
|
6026
|
-
return
|
|
6026
|
+
return be.create(i(this, tt).toOperationNode(), U.create(i(this, at)));
|
|
6027
6027
|
}
|
|
6028
6028
|
}
|
|
6029
6029
|
tt = new WeakMap(), at = new WeakMap();
|
|
6030
|
-
Me(
|
|
6030
|
+
Me(Wn, "don't await AliasedSelectQueryBuilder instances directly. AliasedSelectQueryBuilder should never be executed directly since it's always a part of another query.");
|
|
6031
6031
|
const fe = c({
|
|
6032
6032
|
is(t) {
|
|
6033
6033
|
return t.kind === "AggregateFunctionNode";
|
|
@@ -6069,7 +6069,7 @@ const fe = c({
|
|
|
6069
6069
|
over: e
|
|
6070
6070
|
});
|
|
6071
6071
|
}
|
|
6072
|
-
}),
|
|
6072
|
+
}), sn = c({
|
|
6073
6073
|
is(t) {
|
|
6074
6074
|
return t.kind === "FunctionNode";
|
|
6075
6075
|
},
|
|
@@ -6085,7 +6085,7 @@ var D;
|
|
|
6085
6085
|
const le = class le {
|
|
6086
6086
|
constructor(e) {
|
|
6087
6087
|
T(this, D);
|
|
6088
|
-
|
|
6088
|
+
b(this, D, c(e));
|
|
6089
6089
|
}
|
|
6090
6090
|
/** @private */
|
|
6091
6091
|
get expressionType() {
|
|
@@ -6171,7 +6171,7 @@ const le = class le {
|
|
|
6171
6171
|
orderBy(e, a) {
|
|
6172
6172
|
return new le({
|
|
6173
6173
|
...i(this, D),
|
|
6174
|
-
aggregateFunctionNode: fe.cloneWithOrderBy(i(this, D).aggregateFunctionNode,
|
|
6174
|
+
aggregateFunctionNode: fe.cloneWithOrderBy(i(this, D).aggregateFunctionNode, Pa([e, a]))
|
|
6175
6175
|
});
|
|
6176
6176
|
}
|
|
6177
6177
|
filterWhere(...e) {
|
|
@@ -6215,7 +6215,7 @@ const le = class le {
|
|
|
6215
6215
|
filterWhereRef(e, a, n) {
|
|
6216
6216
|
return new le({
|
|
6217
6217
|
...i(this, D),
|
|
6218
|
-
aggregateFunctionNode: fe.cloneWithFilter(i(this, D).aggregateFunctionNode,
|
|
6218
|
+
aggregateFunctionNode: fe.cloneWithFilter(i(this, D).aggregateFunctionNode, Tt(e, a, n))
|
|
6219
6219
|
});
|
|
6220
6220
|
}
|
|
6221
6221
|
/**
|
|
@@ -6307,7 +6307,7 @@ class jc {
|
|
|
6307
6307
|
constructor(e, a) {
|
|
6308
6308
|
T(this, nt);
|
|
6309
6309
|
T(this, rt);
|
|
6310
|
-
|
|
6310
|
+
b(this, nt, e), b(this, rt, a);
|
|
6311
6311
|
}
|
|
6312
6312
|
/** @private */
|
|
6313
6313
|
get expression() {
|
|
@@ -6318,13 +6318,13 @@ class jc {
|
|
|
6318
6318
|
return i(this, rt);
|
|
6319
6319
|
}
|
|
6320
6320
|
toOperationNode() {
|
|
6321
|
-
return
|
|
6321
|
+
return be.create(i(this, nt).toOperationNode(), U.create(i(this, rt)));
|
|
6322
6322
|
}
|
|
6323
6323
|
}
|
|
6324
6324
|
nt = new WeakMap(), rt = new WeakMap();
|
|
6325
6325
|
function Jc() {
|
|
6326
|
-
const t = (a, n) => new k(
|
|
6327
|
-
aggregateFunctionNode: fe.create(a, n ?
|
|
6326
|
+
const t = (a, n) => new k(sn.create(a, Ct(n ?? []))), e = (a, n) => new Ve({
|
|
6327
|
+
aggregateFunctionNode: fe.create(a, n ? Ct(n) : void 0)
|
|
6328
6328
|
});
|
|
6329
6329
|
return Object.assign(t, {
|
|
6330
6330
|
agg: e,
|
|
@@ -6339,7 +6339,7 @@ function Jc() {
|
|
|
6339
6339
|
},
|
|
6340
6340
|
countAll(a) {
|
|
6341
6341
|
return new Ve({
|
|
6342
|
-
aggregateFunctionNode: fe.create("count",
|
|
6342
|
+
aggregateFunctionNode: fe.create("count", zn(a))
|
|
6343
6343
|
});
|
|
6344
6344
|
},
|
|
6345
6345
|
max(a) {
|
|
@@ -6362,7 +6362,7 @@ function Jc() {
|
|
|
6362
6362
|
});
|
|
6363
6363
|
},
|
|
6364
6364
|
toJson(a) {
|
|
6365
|
-
return new k(
|
|
6365
|
+
return new k(sn.create("to_json", [
|
|
6366
6366
|
re(a) ? Z(a) : a.toOperationNode()
|
|
6367
6367
|
]));
|
|
6368
6368
|
}
|
|
@@ -6404,7 +6404,7 @@ const _e = c({
|
|
|
6404
6404
|
...t,
|
|
6405
6405
|
when: t.when ? c([
|
|
6406
6406
|
...t.when.slice(0, -1),
|
|
6407
|
-
|
|
6407
|
+
ta.cloneWithResult(t.when[t.when.length - 1], e)
|
|
6408
6408
|
]) : void 0
|
|
6409
6409
|
});
|
|
6410
6410
|
},
|
|
@@ -6419,26 +6419,26 @@ var ot;
|
|
|
6419
6419
|
class Bc {
|
|
6420
6420
|
constructor(e) {
|
|
6421
6421
|
T(this, ot);
|
|
6422
|
-
|
|
6422
|
+
b(this, ot, c(e));
|
|
6423
6423
|
}
|
|
6424
6424
|
when(...e) {
|
|
6425
|
-
return new
|
|
6425
|
+
return new Bn({
|
|
6426
6426
|
...i(this, ot),
|
|
6427
|
-
node: _e.cloneWithWhen(i(this, ot).node,
|
|
6427
|
+
node: _e.cloneWithWhen(i(this, ot).node, ta.create(ee(e)))
|
|
6428
6428
|
});
|
|
6429
6429
|
}
|
|
6430
6430
|
}
|
|
6431
6431
|
ot = new WeakMap();
|
|
6432
6432
|
var st;
|
|
6433
|
-
class
|
|
6433
|
+
class Bn {
|
|
6434
6434
|
constructor(e) {
|
|
6435
6435
|
T(this, st);
|
|
6436
|
-
|
|
6436
|
+
b(this, st, c(e));
|
|
6437
6437
|
}
|
|
6438
6438
|
then(e) {
|
|
6439
6439
|
return new Uc({
|
|
6440
6440
|
...i(this, st),
|
|
6441
|
-
node: _e.cloneWithThen(i(this, st).node,
|
|
6441
|
+
node: _e.cloneWithThen(i(this, st).node, Ra(e) ? za(e) : j(e))
|
|
6442
6442
|
});
|
|
6443
6443
|
}
|
|
6444
6444
|
}
|
|
@@ -6447,19 +6447,19 @@ var ae;
|
|
|
6447
6447
|
class Uc {
|
|
6448
6448
|
constructor(e) {
|
|
6449
6449
|
T(this, ae);
|
|
6450
|
-
|
|
6450
|
+
b(this, ae, c(e));
|
|
6451
6451
|
}
|
|
6452
6452
|
when(...e) {
|
|
6453
|
-
return new
|
|
6453
|
+
return new Bn({
|
|
6454
6454
|
...i(this, ae),
|
|
6455
|
-
node: _e.cloneWithWhen(i(this, ae).node,
|
|
6455
|
+
node: _e.cloneWithWhen(i(this, ae).node, ta.create(ee(e)))
|
|
6456
6456
|
});
|
|
6457
6457
|
}
|
|
6458
6458
|
else(e) {
|
|
6459
6459
|
return new Kc({
|
|
6460
6460
|
...i(this, ae),
|
|
6461
6461
|
node: _e.cloneWith(i(this, ae).node, {
|
|
6462
|
-
else:
|
|
6462
|
+
else: Ra(e) ? za(e) : j(e)
|
|
6463
6463
|
})
|
|
6464
6464
|
});
|
|
6465
6465
|
}
|
|
@@ -6475,7 +6475,7 @@ var it;
|
|
|
6475
6475
|
class Kc {
|
|
6476
6476
|
constructor(e) {
|
|
6477
6477
|
T(this, it);
|
|
6478
|
-
|
|
6478
|
+
b(this, it, c(e));
|
|
6479
6479
|
}
|
|
6480
6480
|
end() {
|
|
6481
6481
|
return new k(_e.cloneWith(i(this, it).node, { isStatement: !1 }));
|
|
@@ -6485,7 +6485,7 @@ class Kc {
|
|
|
6485
6485
|
}
|
|
6486
6486
|
}
|
|
6487
6487
|
it = new WeakMap();
|
|
6488
|
-
const
|
|
6488
|
+
const cn = c({
|
|
6489
6489
|
is(t) {
|
|
6490
6490
|
return t.kind === "JSONPathLegNode";
|
|
6491
6491
|
},
|
|
@@ -6497,12 +6497,12 @@ const sn = c({
|
|
|
6497
6497
|
});
|
|
6498
6498
|
}
|
|
6499
6499
|
});
|
|
6500
|
-
var ne,
|
|
6501
|
-
class
|
|
6500
|
+
var ne, kt, xa;
|
|
6501
|
+
class Ca {
|
|
6502
6502
|
constructor(e) {
|
|
6503
|
-
T(this,
|
|
6503
|
+
T(this, kt);
|
|
6504
6504
|
T(this, ne);
|
|
6505
|
-
|
|
6505
|
+
b(this, ne, e);
|
|
6506
6506
|
}
|
|
6507
6507
|
/**
|
|
6508
6508
|
* Access an element of a JSON array in a specific location.
|
|
@@ -6572,7 +6572,7 @@ class Na {
|
|
|
6572
6572
|
* ```
|
|
6573
6573
|
*/
|
|
6574
6574
|
at(e) {
|
|
6575
|
-
return N(this,
|
|
6575
|
+
return N(this, kt, xa).call(this, "ArrayLocation", e);
|
|
6576
6576
|
}
|
|
6577
6577
|
/**
|
|
6578
6578
|
* Access a property of a JSON object.
|
|
@@ -6624,18 +6624,18 @@ class Na {
|
|
|
6624
6624
|
* ```
|
|
6625
6625
|
*/
|
|
6626
6626
|
key(e) {
|
|
6627
|
-
return N(this,
|
|
6627
|
+
return N(this, kt, xa).call(this, "Member", e);
|
|
6628
6628
|
}
|
|
6629
6629
|
}
|
|
6630
|
-
ne = new WeakMap(),
|
|
6631
|
-
return
|
|
6630
|
+
ne = new WeakMap(), kt = new WeakSet(), xa = function(e, a) {
|
|
6631
|
+
return Lt.is(i(this, ne)) ? new Wt(Lt.cloneWithTraversal(i(this, ne), gt.is(i(this, ne).traversal) ? gt.cloneWithLeg(i(this, ne).traversal, cn.create(e, a)) : An.cloneWithValue(i(this, ne).traversal, xe.createImmediate(a)))) : new Wt(gt.cloneWithLeg(i(this, ne), cn.create(e, a)));
|
|
6632
6632
|
};
|
|
6633
6633
|
var De;
|
|
6634
|
-
const
|
|
6634
|
+
const Yt = class Yt extends Ca {
|
|
6635
6635
|
constructor(a) {
|
|
6636
6636
|
super(a);
|
|
6637
6637
|
T(this, De);
|
|
6638
|
-
|
|
6638
|
+
b(this, De, a);
|
|
6639
6639
|
}
|
|
6640
6640
|
/** @private */
|
|
6641
6641
|
get expressionType() {
|
|
@@ -6650,23 +6650,23 @@ const Ht = class Ht extends Na {
|
|
|
6650
6650
|
* returns a copy of this `JSONPathBuilder` with a new output type.
|
|
6651
6651
|
*/
|
|
6652
6652
|
$castTo() {
|
|
6653
|
-
return new
|
|
6653
|
+
return new Yt(i(this, De));
|
|
6654
6654
|
}
|
|
6655
6655
|
$notNull() {
|
|
6656
|
-
return new
|
|
6656
|
+
return new Yt(i(this, De));
|
|
6657
6657
|
}
|
|
6658
6658
|
toOperationNode() {
|
|
6659
6659
|
return i(this, De);
|
|
6660
6660
|
}
|
|
6661
6661
|
};
|
|
6662
6662
|
De = new WeakMap();
|
|
6663
|
-
let
|
|
6663
|
+
let Wt = Yt;
|
|
6664
6664
|
var ct, ge;
|
|
6665
6665
|
class Qc {
|
|
6666
6666
|
constructor(e, a) {
|
|
6667
6667
|
T(this, ct);
|
|
6668
6668
|
T(this, ge);
|
|
6669
|
-
|
|
6669
|
+
b(this, ct, e), b(this, ge, a);
|
|
6670
6670
|
}
|
|
6671
6671
|
/** @private */
|
|
6672
6672
|
get expression() {
|
|
@@ -6677,11 +6677,11 @@ class Qc {
|
|
|
6677
6677
|
return i(this, ge);
|
|
6678
6678
|
}
|
|
6679
6679
|
toOperationNode() {
|
|
6680
|
-
return
|
|
6680
|
+
return be.create(i(this, ct).toOperationNode(), H(i(this, ge)) ? i(this, ge).toOperationNode() : U.create(i(this, ge)));
|
|
6681
6681
|
}
|
|
6682
6682
|
}
|
|
6683
6683
|
ct = new WeakMap(), ge = new WeakMap();
|
|
6684
|
-
const
|
|
6684
|
+
const un = c({
|
|
6685
6685
|
is(t) {
|
|
6686
6686
|
return t.kind === "TupleNode";
|
|
6687
6687
|
},
|
|
@@ -6780,9 +6780,9 @@ const Zc = c({
|
|
|
6780
6780
|
});
|
|
6781
6781
|
}
|
|
6782
6782
|
});
|
|
6783
|
-
function
|
|
6783
|
+
function Ma(t = qn) {
|
|
6784
6784
|
function e(r, o, s) {
|
|
6785
|
-
return new k(
|
|
6785
|
+
return new k(Fa(r, o, s));
|
|
6786
6786
|
}
|
|
6787
6787
|
function a(r, o) {
|
|
6788
6788
|
return new k(Wc(r, o));
|
|
@@ -6799,14 +6799,14 @@ function La(t = Jn) {
|
|
|
6799
6799
|
},
|
|
6800
6800
|
case(r) {
|
|
6801
6801
|
return new Bc({
|
|
6802
|
-
node: _e.create(
|
|
6802
|
+
node: _e.create(Ft(r) ? void 0 : V(r))
|
|
6803
6803
|
});
|
|
6804
6804
|
},
|
|
6805
6805
|
ref(r, o) {
|
|
6806
|
-
return
|
|
6806
|
+
return Ft(o) ? new k(Ce(r)) : new Ca(Gi(r, o));
|
|
6807
6807
|
},
|
|
6808
6808
|
jsonPath() {
|
|
6809
|
-
return new
|
|
6809
|
+
return new Ca(gt.create());
|
|
6810
6810
|
},
|
|
6811
6811
|
table(r) {
|
|
6812
6812
|
return new k(Z(r));
|
|
@@ -6815,13 +6815,13 @@ function La(t = Jn) {
|
|
|
6815
6815
|
return new k(j(r));
|
|
6816
6816
|
},
|
|
6817
6817
|
refTuple(...r) {
|
|
6818
|
-
return new k(
|
|
6818
|
+
return new k(un.create(r.map(V)));
|
|
6819
6819
|
},
|
|
6820
6820
|
tuple(...r) {
|
|
6821
|
-
return new k(
|
|
6821
|
+
return new k(un.create(r.map(j)));
|
|
6822
6822
|
},
|
|
6823
6823
|
lit(r) {
|
|
6824
|
-
return new k(
|
|
6824
|
+
return new k(za(r));
|
|
6825
6825
|
},
|
|
6826
6826
|
unary: a,
|
|
6827
6827
|
not(r) {
|
|
@@ -6840,75 +6840,75 @@ function La(t = Jn) {
|
|
|
6840
6840
|
return new k(lt.create(V(r), ze.create("between symmetric"), Ne.create(j(o), j(s))));
|
|
6841
6841
|
},
|
|
6842
6842
|
and(r) {
|
|
6843
|
-
return ve(r) ? new k(
|
|
6843
|
+
return ve(r) ? new k(ha(r, "and")) : new k(Qa(r, "and"));
|
|
6844
6844
|
},
|
|
6845
6845
|
or(r) {
|
|
6846
|
-
return ve(r) ? new k(
|
|
6846
|
+
return ve(r) ? new k(ha(r, "or")) : new k(Qa(r, "or"));
|
|
6847
6847
|
},
|
|
6848
6848
|
parens(...r) {
|
|
6849
6849
|
const o = ee(r);
|
|
6850
|
-
return
|
|
6850
|
+
return xt.is(o) ? new k(o) : new k(xt.create(o));
|
|
6851
6851
|
},
|
|
6852
6852
|
cast(r, o) {
|
|
6853
6853
|
return new k(Zc.create(V(r), Xc(o)));
|
|
6854
6854
|
},
|
|
6855
6855
|
withSchema(r) {
|
|
6856
|
-
return
|
|
6856
|
+
return Ma(t.withPluginAtFront(new Jn(r)));
|
|
6857
6857
|
}
|
|
6858
6858
|
});
|
|
6859
6859
|
return n.fn = Jc(), n.eb = n, n;
|
|
6860
6860
|
}
|
|
6861
|
-
function ta(t) {
|
|
6862
|
-
return La();
|
|
6863
|
-
}
|
|
6864
6861
|
function aa(t) {
|
|
6862
|
+
return Ma();
|
|
6863
|
+
}
|
|
6864
|
+
function na(t) {
|
|
6865
6865
|
if (H(t))
|
|
6866
6866
|
return t.toOperationNode();
|
|
6867
6867
|
if (Le(t))
|
|
6868
|
-
return t(
|
|
6868
|
+
return t(aa()).toOperationNode();
|
|
6869
6869
|
throw new Error(`invalid expression: ${JSON.stringify(t)}`);
|
|
6870
6870
|
}
|
|
6871
|
-
function
|
|
6871
|
+
function Un(t) {
|
|
6872
6872
|
if (H(t))
|
|
6873
6873
|
return t.toOperationNode();
|
|
6874
6874
|
if (Le(t))
|
|
6875
|
-
return t(
|
|
6875
|
+
return t(aa()).toOperationNode();
|
|
6876
6876
|
throw new Error(`invalid aliased expression: ${JSON.stringify(t)}`);
|
|
6877
6877
|
}
|
|
6878
|
-
function
|
|
6878
|
+
function ra(t) {
|
|
6879
6879
|
return Li(t) || Mi(t) || Le(t);
|
|
6880
6880
|
}
|
|
6881
6881
|
function eu(t) {
|
|
6882
|
-
return ve(t) ? t.map((e) =>
|
|
6882
|
+
return ve(t) ? t.map((e) => Bt(e)) : [Bt(t)];
|
|
6883
6883
|
}
|
|
6884
|
-
function
|
|
6885
|
-
return re(t) ? tu(t) :
|
|
6884
|
+
function Bt(t) {
|
|
6885
|
+
return re(t) ? tu(t) : Un(t);
|
|
6886
6886
|
}
|
|
6887
6887
|
function tu(t) {
|
|
6888
6888
|
const e = " as ";
|
|
6889
6889
|
if (t.includes(e)) {
|
|
6890
|
-
const [a, n] = t.split(e).map(
|
|
6891
|
-
return
|
|
6890
|
+
const [a, n] = t.split(e).map(Kn);
|
|
6891
|
+
return be.create(Z(a), U.create(n));
|
|
6892
6892
|
} else
|
|
6893
6893
|
return Z(t);
|
|
6894
6894
|
}
|
|
6895
6895
|
function Z(t) {
|
|
6896
6896
|
const e = ".";
|
|
6897
6897
|
if (t.includes(e)) {
|
|
6898
|
-
const [a, n] = t.split(e).map(
|
|
6898
|
+
const [a, n] = t.split(e).map(Kn);
|
|
6899
6899
|
return ye.createWithSchema(a, n);
|
|
6900
6900
|
} else
|
|
6901
6901
|
return ye.create(t);
|
|
6902
6902
|
}
|
|
6903
|
-
function
|
|
6903
|
+
function Kn(t) {
|
|
6904
6904
|
return t.trim();
|
|
6905
6905
|
}
|
|
6906
|
-
var M, G,
|
|
6906
|
+
var M, G, Pt, Ta, ba;
|
|
6907
6907
|
const vt = class vt {
|
|
6908
6908
|
constructor(e) {
|
|
6909
6909
|
T(this, G);
|
|
6910
6910
|
T(this, M);
|
|
6911
|
-
|
|
6911
|
+
b(this, M, c(e));
|
|
6912
6912
|
}
|
|
6913
6913
|
get expressionType() {
|
|
6914
6914
|
}
|
|
@@ -6916,7 +6916,7 @@ const vt = class vt {
|
|
|
6916
6916
|
return !0;
|
|
6917
6917
|
}
|
|
6918
6918
|
as(e) {
|
|
6919
|
-
return new
|
|
6919
|
+
return new Qn(this, e);
|
|
6920
6920
|
}
|
|
6921
6921
|
$castTo() {
|
|
6922
6922
|
return new vt({ ...i(this, M) });
|
|
@@ -6931,35 +6931,35 @@ const vt = class vt {
|
|
|
6931
6931
|
});
|
|
6932
6932
|
}
|
|
6933
6933
|
toOperationNode() {
|
|
6934
|
-
return N(this, G,
|
|
6934
|
+
return N(this, G, Ta).call(this, N(this, G, Pt).call(this));
|
|
6935
6935
|
}
|
|
6936
6936
|
compile(e) {
|
|
6937
|
-
return N(this, G,
|
|
6937
|
+
return N(this, G, ba).call(this, N(this, G, Pt).call(this, e));
|
|
6938
6938
|
}
|
|
6939
6939
|
async execute(e) {
|
|
6940
|
-
const a = N(this, G,
|
|
6941
|
-
return a.executeQuery(N(this, G,
|
|
6940
|
+
const a = N(this, G, Pt).call(this, e);
|
|
6941
|
+
return a.executeQuery(N(this, G, ba).call(this, a), i(this, M).queryId);
|
|
6942
6942
|
}
|
|
6943
6943
|
};
|
|
6944
|
-
M = new WeakMap(), G = new WeakSet(),
|
|
6945
|
-
const a = e !== void 0 ? e.getExecutor() :
|
|
6944
|
+
M = new WeakMap(), G = new WeakSet(), Pt = function(e) {
|
|
6945
|
+
const a = e !== void 0 ? e.getExecutor() : qn;
|
|
6946
6946
|
return i(this, M).plugins !== void 0 ? a.withPlugins(i(this, M).plugins) : a;
|
|
6947
|
-
}, xa = function(e) {
|
|
6948
|
-
return e.transformQuery(i(this, M).rawNode, i(this, M).queryId);
|
|
6949
6947
|
}, Ta = function(e) {
|
|
6950
|
-
return e.
|
|
6948
|
+
return e.transformQuery(i(this, M).rawNode, i(this, M).queryId);
|
|
6949
|
+
}, ba = function(e) {
|
|
6950
|
+
return e.compileQuery(N(this, G, Ta).call(this, e), i(this, M).queryId);
|
|
6951
6951
|
};
|
|
6952
|
-
let
|
|
6952
|
+
let Ut = vt;
|
|
6953
6953
|
function he(t) {
|
|
6954
|
-
return new
|
|
6954
|
+
return new Ut(t);
|
|
6955
6955
|
}
|
|
6956
|
-
Me(
|
|
6956
|
+
Me(Ut, "don't await RawBuilder instances directly. To execute the query you need to call `execute`");
|
|
6957
6957
|
var Pe, we;
|
|
6958
|
-
class
|
|
6958
|
+
class Qn {
|
|
6959
6959
|
constructor(e, a) {
|
|
6960
6960
|
T(this, Pe);
|
|
6961
6961
|
T(this, we);
|
|
6962
|
-
|
|
6962
|
+
b(this, Pe, e), b(this, we, a);
|
|
6963
6963
|
}
|
|
6964
6964
|
get expression() {
|
|
6965
6965
|
return i(this, Pe);
|
|
@@ -6971,14 +6971,14 @@ class Kn {
|
|
|
6971
6971
|
return i(this, Pe);
|
|
6972
6972
|
}
|
|
6973
6973
|
toOperationNode() {
|
|
6974
|
-
return
|
|
6974
|
+
return be.create(i(this, Pe).toOperationNode(), H(i(this, we)) ? i(this, we).toOperationNode() : U.create(i(this, we)));
|
|
6975
6975
|
}
|
|
6976
6976
|
}
|
|
6977
6977
|
Pe = new WeakMap(), we = new WeakMap();
|
|
6978
|
-
Me(
|
|
6978
|
+
Me(Qn, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
|
|
6979
6979
|
const w = Object.assign((t, ...e) => he({
|
|
6980
6980
|
queryId: se(),
|
|
6981
|
-
rawNode: B.create(t, (e == null ? void 0 : e.map(
|
|
6981
|
+
rawNode: B.create(t, (e == null ? void 0 : e.map(ln)) ?? [])
|
|
6982
6982
|
}), {
|
|
6983
6983
|
ref(t) {
|
|
6984
6984
|
return he({
|
|
@@ -7026,14 +7026,14 @@ const w = Object.assign((t, ...e) => he({
|
|
|
7026
7026
|
join(t, e = w`, `) {
|
|
7027
7027
|
const a = new Array(2 * t.length - 1), n = e.toOperationNode();
|
|
7028
7028
|
for (let r = 0; r < t.length; ++r)
|
|
7029
|
-
a[2 * r] =
|
|
7029
|
+
a[2 * r] = ln(t[r]), r !== t.length - 1 && (a[2 * r + 1] = n);
|
|
7030
7030
|
return he({
|
|
7031
7031
|
queryId: se(),
|
|
7032
7032
|
rawNode: B.createWithChildren(a)
|
|
7033
7033
|
});
|
|
7034
7034
|
}
|
|
7035
7035
|
});
|
|
7036
|
-
function
|
|
7036
|
+
function ln(t) {
|
|
7037
7037
|
return H(t) ? t.toOperationNode() : j(t);
|
|
7038
7038
|
}
|
|
7039
7039
|
class au {
|
|
@@ -7044,13 +7044,13 @@ class au {
|
|
|
7044
7044
|
return e.result;
|
|
7045
7045
|
}
|
|
7046
7046
|
}
|
|
7047
|
-
const nu = "kysely_migration",
|
|
7048
|
-
var I, g, mt, ie, ce, Be,
|
|
7049
|
-
class
|
|
7047
|
+
const nu = "kysely_migration", dn = "kysely_migration_lock", ru = !1, ca = "migration_lock", ou = c({ __noMigrations__: !0 });
|
|
7048
|
+
var I, g, mt, ie, ce, Be, Gn, ue, Hn, Yn, Xn, Zn, er, Sa, Ue, Oa, tr, ar, nr, ka, rr, or, sr, ir, cr, ht;
|
|
7049
|
+
class Vn {
|
|
7050
7050
|
constructor(e) {
|
|
7051
7051
|
T(this, g);
|
|
7052
7052
|
T(this, I);
|
|
7053
|
-
|
|
7053
|
+
b(this, I, c(e));
|
|
7054
7054
|
}
|
|
7055
7055
|
/**
|
|
7056
7056
|
* Returns a {@link MigrationInfo} object for each migration.
|
|
@@ -7059,7 +7059,7 @@ class Qn {
|
|
|
7059
7059
|
*/
|
|
7060
7060
|
async getMigrations() {
|
|
7061
7061
|
const e = await N(this, g, Ue).call(this, i(this, g, ce)) ? await i(this, I).db.withPlugin(i(this, g, ue)).selectFrom(i(this, g, ce)).select(["name", "timestamp"]).$narrowType().execute() : [];
|
|
7062
|
-
return (await N(this, g,
|
|
7062
|
+
return (await N(this, g, ka).call(this)).map(({ name: n, ...r }) => {
|
|
7063
7063
|
const o = e.find((s) => s.name === n);
|
|
7064
7064
|
return {
|
|
7065
7065
|
name: n,
|
|
@@ -7250,23 +7250,23 @@ class Qn {
|
|
|
7250
7250
|
}
|
|
7251
7251
|
I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
7252
7252
|
try {
|
|
7253
|
-
return await N(this, g,
|
|
7253
|
+
return await N(this, g, Hn).call(this), await N(this, g, tr).call(this, e);
|
|
7254
7254
|
} catch (a) {
|
|
7255
|
-
return a instanceof
|
|
7255
|
+
return a instanceof ua ? a.resultSet : { error: a };
|
|
7256
7256
|
}
|
|
7257
7257
|
}, ie = function() {
|
|
7258
7258
|
return i(this, I).migrationTableSchema;
|
|
7259
7259
|
}, ce = function() {
|
|
7260
7260
|
return i(this, I).migrationTableName ?? nu;
|
|
7261
7261
|
}, Be = function() {
|
|
7262
|
-
return i(this, I).migrationLockTableName ??
|
|
7263
|
-
},
|
|
7262
|
+
return i(this, I).migrationLockTableName ?? dn;
|
|
7263
|
+
}, Gn = function() {
|
|
7264
7264
|
return i(this, I).allowUnorderedMigrations ?? ru;
|
|
7265
7265
|
}, ue = function() {
|
|
7266
|
-
return i(this, g, ie) ? new
|
|
7267
|
-
}, Gn = async function() {
|
|
7268
|
-
await N(this, g, Hn).call(this), await N(this, g, Yn).call(this), await N(this, g, Xn).call(this), await N(this, g, Zn).call(this);
|
|
7266
|
+
return i(this, g, ie) ? new Jn(i(this, g, ie)) : new au();
|
|
7269
7267
|
}, Hn = async function() {
|
|
7268
|
+
await N(this, g, Yn).call(this), await N(this, g, Xn).call(this), await N(this, g, Zn).call(this), await N(this, g, er).call(this);
|
|
7269
|
+
}, Yn = async function() {
|
|
7270
7270
|
if (i(this, g, ie) && !await N(this, g, Sa).call(this))
|
|
7271
7271
|
try {
|
|
7272
7272
|
await N(this, g, ht).call(this, i(this, I).db.schema.createSchema(i(this, g, ie)));
|
|
@@ -7274,7 +7274,7 @@ I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
|
7274
7274
|
if (!await N(this, g, Sa).call(this))
|
|
7275
7275
|
throw e;
|
|
7276
7276
|
}
|
|
7277
|
-
},
|
|
7277
|
+
}, Xn = async function() {
|
|
7278
7278
|
if (!await N(this, g, Ue).call(this, i(this, g, ce)))
|
|
7279
7279
|
try {
|
|
7280
7280
|
i(this, g, ie) && await N(this, g, ht).call(this, i(this, I).db.schema.createSchema(i(this, g, ie))), await N(this, g, ht).call(this, i(this, I).db.schema.withPlugin(i(this, g, ue)).createTable(i(this, g, ce)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
|
|
@@ -7282,7 +7282,7 @@ I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
|
7282
7282
|
if (!await N(this, g, Ue).call(this, i(this, g, ce)))
|
|
7283
7283
|
throw e;
|
|
7284
7284
|
}
|
|
7285
|
-
},
|
|
7285
|
+
}, Zn = async function() {
|
|
7286
7286
|
if (!await N(this, g, Ue).call(this, i(this, g, Be)))
|
|
7287
7287
|
try {
|
|
7288
7288
|
await N(this, g, ht).call(this, i(this, I).db.schema.withPlugin(i(this, g, ue)).createTable(i(this, g, Be)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
|
|
@@ -7290,12 +7290,12 @@ I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
|
7290
7290
|
if (!await N(this, g, Ue).call(this, i(this, g, Be)))
|
|
7291
7291
|
throw e;
|
|
7292
7292
|
}
|
|
7293
|
-
},
|
|
7294
|
-
if (!await N(this, g,
|
|
7293
|
+
}, er = async function() {
|
|
7294
|
+
if (!await N(this, g, Oa).call(this))
|
|
7295
7295
|
try {
|
|
7296
|
-
await i(this, I).db.withPlugin(i(this, g, ue)).insertInto(i(this, g, Be)).values({ id:
|
|
7296
|
+
await i(this, I).db.withPlugin(i(this, g, ue)).insertInto(i(this, g, Be)).values({ id: ca, is_locked: 0 }).execute();
|
|
7297
7297
|
} catch (e) {
|
|
7298
|
-
if (!await N(this, g,
|
|
7298
|
+
if (!await N(this, g, Oa).call(this))
|
|
7299
7299
|
throw e;
|
|
7300
7300
|
}
|
|
7301
7301
|
}, Sa = async function() {
|
|
@@ -7305,56 +7305,56 @@ I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
|
7305
7305
|
return (await i(this, I).db.introspection.getTables({
|
|
7306
7306
|
withInternalKyselyTables: !0
|
|
7307
7307
|
})).some((r) => r.name === e && (!a || r.schema === a));
|
|
7308
|
-
},
|
|
7309
|
-
return !!await i(this, I).db.withPlugin(i(this, g, ue)).selectFrom(i(this, g, Be)).where("id", "=",
|
|
7310
|
-
},
|
|
7308
|
+
}, Oa = async function() {
|
|
7309
|
+
return !!await i(this, I).db.withPlugin(i(this, g, ue)).selectFrom(i(this, g, Be)).where("id", "=", ca).select("id").executeTakeFirst();
|
|
7310
|
+
}, tr = async function(e) {
|
|
7311
7311
|
const a = i(this, I).db.getExecutor().adapter, n = c({
|
|
7312
|
-
lockTable: i(this, I).migrationLockTableName ??
|
|
7313
|
-
lockRowId:
|
|
7312
|
+
lockTable: i(this, I).migrationLockTableName ?? dn,
|
|
7313
|
+
lockRowId: ca,
|
|
7314
7314
|
lockTableSchema: i(this, I).migrationTableSchema
|
|
7315
7315
|
}), r = async (o) => {
|
|
7316
7316
|
try {
|
|
7317
7317
|
await a.acquireMigrationLock(o, n);
|
|
7318
|
-
const s = await N(this, g,
|
|
7318
|
+
const s = await N(this, g, ar).call(this, o);
|
|
7319
7319
|
if (s.migrations.length === 0)
|
|
7320
7320
|
return { results: [] };
|
|
7321
7321
|
const { direction: u, step: l } = e(s);
|
|
7322
|
-
return l <= 0 ? { results: [] } : u === "Down" ? await N(this, g,
|
|
7322
|
+
return l <= 0 ? { results: [] } : u === "Down" ? await N(this, g, ir).call(this, o, s, l) : u === "Up" ? await N(this, g, cr).call(this, o, s, l) : { results: [] };
|
|
7323
7323
|
} finally {
|
|
7324
7324
|
await a.releaseMigrationLock(o, n);
|
|
7325
7325
|
}
|
|
7326
7326
|
};
|
|
7327
7327
|
return a.supportsTransactionalDdl ? i(this, I).db.transaction().execute(r) : i(this, I).db.connection().execute(r);
|
|
7328
|
-
},
|
|
7329
|
-
const a = await N(this, g,
|
|
7330
|
-
N(this, g,
|
|
7331
|
-
const r = N(this, g,
|
|
7328
|
+
}, ar = async function(e) {
|
|
7329
|
+
const a = await N(this, g, ka).call(this), n = await N(this, g, rr).call(this, e);
|
|
7330
|
+
N(this, g, or).call(this, a, n), i(this, g, Gn) || N(this, g, sr).call(this, a, n);
|
|
7331
|
+
const r = N(this, g, nr).call(this, a, n);
|
|
7332
7332
|
return c({
|
|
7333
7333
|
migrations: a,
|
|
7334
7334
|
executedMigrations: n,
|
|
7335
7335
|
lastMigration: Fi(n),
|
|
7336
7336
|
pendingMigrations: r
|
|
7337
7337
|
});
|
|
7338
|
-
},
|
|
7338
|
+
}, nr = function(e, a) {
|
|
7339
7339
|
return e.filter((n) => !a.includes(n.name));
|
|
7340
|
-
},
|
|
7340
|
+
}, ka = async function() {
|
|
7341
7341
|
const e = await i(this, I).provider.getMigrations();
|
|
7342
7342
|
return Object.keys(e).sort().map((a) => ({
|
|
7343
7343
|
...e[a],
|
|
7344
7344
|
name: a
|
|
7345
7345
|
}));
|
|
7346
|
-
},
|
|
7346
|
+
}, rr = async function(e) {
|
|
7347
7347
|
const a = await e.withPlugin(i(this, g, ue)).selectFrom(i(this, g, ce)).select(["name", "timestamp"]).$narrowType().execute(), n = i(this, I).nameComparator || ((r, o) => r.localeCompare(o));
|
|
7348
7348
|
return a.sort((r, o) => r.timestamp === o.timestamp ? n(r.name, o.name) : new Date(r.timestamp).getTime() - new Date(o.timestamp).getTime()).map((r) => r.name);
|
|
7349
|
-
},
|
|
7349
|
+
}, or = function(e, a) {
|
|
7350
7350
|
for (const n of a)
|
|
7351
7351
|
if (!e.some((r) => r.name === n))
|
|
7352
7352
|
throw new Error(`corrupted migrations: previously executed migration ${n} is missing`);
|
|
7353
|
-
},
|
|
7353
|
+
}, sr = function(e, a) {
|
|
7354
7354
|
for (let n = 0; n < a.length; ++n)
|
|
7355
7355
|
if (e[n].name !== a[n])
|
|
7356
7356
|
throw new Error(`corrupted migrations: expected previously executed migration ${a[n]} to be at index ${n} but ${e[n].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
|
|
7357
|
-
},
|
|
7357
|
+
}, ir = async function(e, a, n) {
|
|
7358
7358
|
const r = a.executedMigrations.slice().reverse().slice(0, n).map((s) => a.migrations.find((u) => u.name === s)), o = r.map((s) => ({
|
|
7359
7359
|
migrationName: s.name,
|
|
7360
7360
|
direction: "Down",
|
|
@@ -7373,14 +7373,14 @@ I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
|
7373
7373
|
migrationName: u.name,
|
|
7374
7374
|
direction: "Down",
|
|
7375
7375
|
status: "Error"
|
|
7376
|
-
}, new
|
|
7376
|
+
}, new ua({
|
|
7377
7377
|
error: l,
|
|
7378
7378
|
results: o
|
|
7379
7379
|
});
|
|
7380
7380
|
}
|
|
7381
7381
|
}
|
|
7382
7382
|
return { results: o };
|
|
7383
|
-
},
|
|
7383
|
+
}, cr = async function(e, a, n) {
|
|
7384
7384
|
const o = a.pendingMigrations.slice(0, n).map((s) => ({
|
|
7385
7385
|
migrationName: s.name,
|
|
7386
7386
|
direction: "Up",
|
|
@@ -7402,7 +7402,7 @@ I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
|
7402
7402
|
migrationName: u.name,
|
|
7403
7403
|
direction: "Up",
|
|
7404
7404
|
status: "Error"
|
|
7405
|
-
}, new
|
|
7405
|
+
}, new ua({
|
|
7406
7406
|
error: l,
|
|
7407
7407
|
results: o
|
|
7408
7408
|
});
|
|
@@ -7412,18 +7412,18 @@ I = new WeakMap(), g = new WeakSet(), mt = async function(e) {
|
|
|
7412
7412
|
}, ht = async function(e) {
|
|
7413
7413
|
i(this, I).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
|
|
7414
7414
|
};
|
|
7415
|
-
var
|
|
7416
|
-
class
|
|
7415
|
+
var Et;
|
|
7416
|
+
class ua extends Error {
|
|
7417
7417
|
constructor(a) {
|
|
7418
7418
|
super();
|
|
7419
|
-
T(this,
|
|
7420
|
-
|
|
7419
|
+
T(this, Et);
|
|
7420
|
+
b(this, Et, a);
|
|
7421
7421
|
}
|
|
7422
7422
|
get resultSet() {
|
|
7423
|
-
return i(this,
|
|
7423
|
+
return i(this, Et);
|
|
7424
7424
|
}
|
|
7425
7425
|
}
|
|
7426
|
-
|
|
7426
|
+
Et = new WeakMap();
|
|
7427
7427
|
function su(t) {
|
|
7428
7428
|
return async (e, a) => {
|
|
7429
7429
|
let n = t.selectFrom("organizations").selectAll().where("tenant_id", "=", e);
|
|
@@ -7460,7 +7460,7 @@ function su(t) {
|
|
|
7460
7460
|
s = Number((d == null ? void 0 : d.count) || 0);
|
|
7461
7461
|
}
|
|
7462
7462
|
const u = o.map(
|
|
7463
|
-
(m) =>
|
|
7463
|
+
(m) => S({
|
|
7464
7464
|
...m,
|
|
7465
7465
|
branding: m.branding ? JSON.parse(m.branding) : {},
|
|
7466
7466
|
metadata: m.metadata ? JSON.parse(m.metadata) : {},
|
|
@@ -7486,7 +7486,7 @@ function cu(t) {
|
|
|
7486
7486
|
...l,
|
|
7487
7487
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7488
7488
|
};
|
|
7489
|
-
return
|
|
7489
|
+
return It(
|
|
7490
7490
|
n,
|
|
7491
7491
|
["branding", "metadata", "enabled_connections", "token_quota"],
|
|
7492
7492
|
_
|
|
@@ -7644,7 +7644,7 @@ function pu(t) {
|
|
|
7644
7644
|
}
|
|
7645
7645
|
function gu(t) {
|
|
7646
7646
|
return async (e, a) => {
|
|
7647
|
-
const n = Oo(), r = (/* @__PURE__ */ new Date()).toISOString(), o = a.ttl_sec || 604800, s = new Date(Date.now() + o * 1e3).toISOString(), u =
|
|
7647
|
+
const n = Oo(), r = (/* @__PURE__ */ new Date()).toISOString(), o = a.ttl_sec || 604800, s = new Date(Date.now() + o * 1e3).toISOString(), u = It(
|
|
7648
7648
|
{
|
|
7649
7649
|
id: n,
|
|
7650
7650
|
tenant_id: e,
|
|
@@ -7696,14 +7696,14 @@ function wu(t) {
|
|
|
7696
7696
|
const n = await t.selectFrom("invites").selectAll().where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
|
|
7697
7697
|
if (!n)
|
|
7698
7698
|
return null;
|
|
7699
|
-
const r =
|
|
7699
|
+
const r = wn(n, {
|
|
7700
7700
|
inviter: {},
|
|
7701
7701
|
invitee: {},
|
|
7702
7702
|
app_metadata: {},
|
|
7703
7703
|
user_metadata: {},
|
|
7704
7704
|
roles: []
|
|
7705
7705
|
});
|
|
7706
|
-
return
|
|
7706
|
+
return S({
|
|
7707
7707
|
...r,
|
|
7708
7708
|
send_invitation_email: n.send_invitation_email === 1
|
|
7709
7709
|
});
|
|
@@ -7717,14 +7717,14 @@ function yu(t) {
|
|
|
7717
7717
|
n = n.offset(s);
|
|
7718
7718
|
}
|
|
7719
7719
|
const o = (await n.execute()).map((s) => {
|
|
7720
|
-
const u =
|
|
7720
|
+
const u = wn(s, {
|
|
7721
7721
|
inviter: {},
|
|
7722
7722
|
invitee: {},
|
|
7723
7723
|
app_metadata: {},
|
|
7724
7724
|
user_metadata: {},
|
|
7725
7725
|
roles: []
|
|
7726
7726
|
});
|
|
7727
|
-
return
|
|
7727
|
+
return S({
|
|
7728
7728
|
...u,
|
|
7729
7729
|
send_invitation_email: s.send_invitation_email === 1
|
|
7730
7730
|
});
|
|
@@ -7757,7 +7757,7 @@ function Cu(t) {
|
|
|
7757
7757
|
update: Nu(t)
|
|
7758
7758
|
};
|
|
7759
7759
|
}
|
|
7760
|
-
const
|
|
7760
|
+
const _n = [
|
|
7761
7761
|
"s",
|
|
7762
7762
|
// SUCCESS_LOGIN
|
|
7763
7763
|
"seacft",
|
|
@@ -7775,10 +7775,10 @@ const dn = [
|
|
|
7775
7775
|
"signup_pwd_leak",
|
|
7776
7776
|
"reset_pwd_leak"
|
|
7777
7777
|
];
|
|
7778
|
-
function
|
|
7778
|
+
function mn(t) {
|
|
7779
7779
|
return `${t.slice(0, 4)}-${t.slice(4, 6)}-${t.slice(6, 8)}`;
|
|
7780
7780
|
}
|
|
7781
|
-
function
|
|
7781
|
+
function hn(t) {
|
|
7782
7782
|
return t.toISOString().split("T")[0];
|
|
7783
7783
|
}
|
|
7784
7784
|
function Tu(t) {
|
|
@@ -7786,11 +7786,11 @@ function Tu(t) {
|
|
|
7786
7786
|
async getDaily(e, a = {}) {
|
|
7787
7787
|
const { from: n, to: r } = a, o = /* @__PURE__ */ new Date(), s = new Date(o);
|
|
7788
7788
|
s.setDate(s.getDate() - 30);
|
|
7789
|
-
const u = n ?
|
|
7789
|
+
const u = n ? mn(n) : hn(s), l = r ? mn(r) : hn(o), _ = w`DATE(logs.date)`;
|
|
7790
7790
|
return (await t.selectFrom("logs").where("tenant_id", "=", e).where(_, ">=", u).where(_, "<=", l).select((d) => [
|
|
7791
7791
|
_.as("date"),
|
|
7792
7792
|
d.fn.sum(
|
|
7793
|
-
d.case().when("type", "in",
|
|
7793
|
+
d.case().when("type", "in", _n).then(1).else(0).end()
|
|
7794
7794
|
).as("logins"),
|
|
7795
7795
|
d.fn.sum(d.case().when("type", "=", "ss").then(1).else(0).end()).as("signups"),
|
|
7796
7796
|
d.fn.sum(
|
|
@@ -7809,11 +7809,11 @@ function Tu(t) {
|
|
|
7809
7809
|
},
|
|
7810
7810
|
async getActiveUsers(e) {
|
|
7811
7811
|
const a = /* @__PURE__ */ new Date();
|
|
7812
|
-
return a.setDate(a.getDate() - 30), (await t.selectFrom("logs").where("tenant_id", "=", e).where("date", ">=", a.toISOString()).where("type", "in",
|
|
7812
|
+
return a.setDate(a.getDate() - 30), (await t.selectFrom("logs").where("tenant_id", "=", e).where("date", ">=", a.toISOString()).where("type", "in", _n).where("user_id", "is not", null).select((r) => r.fn.count("user_id").distinct().as("count")).executeTakeFirstOrThrow()).count || 0;
|
|
7813
7813
|
}
|
|
7814
7814
|
};
|
|
7815
7815
|
}
|
|
7816
|
-
function
|
|
7816
|
+
function bu(t) {
|
|
7817
7817
|
return {
|
|
7818
7818
|
async get(e, a, n) {
|
|
7819
7819
|
const r = await t.selectFrom("custom_text").selectAll().where("tenant_id", "=", e).where("prompt", "=", a).where("language", "=", n).executeTakeFirst();
|
|
@@ -7850,9 +7850,9 @@ function Su(t) {
|
|
|
7850
7850
|
}
|
|
7851
7851
|
};
|
|
7852
7852
|
}
|
|
7853
|
-
function
|
|
7853
|
+
function Su(t) {
|
|
7854
7854
|
return async (e, a) => {
|
|
7855
|
-
const n = Date.now(), r =
|
|
7855
|
+
const n = Date.now(), r = Tn();
|
|
7856
7856
|
return await t.insertInto("mfa_enrollments").values({
|
|
7857
7857
|
id: r,
|
|
7858
7858
|
tenant_id: e,
|
|
@@ -7875,7 +7875,7 @@ function bu(t) {
|
|
|
7875
7875
|
};
|
|
7876
7876
|
};
|
|
7877
7877
|
}
|
|
7878
|
-
function
|
|
7878
|
+
function ur(t) {
|
|
7879
7879
|
return async (e, a) => {
|
|
7880
7880
|
const n = await t.selectFrom("mfa_enrollments").where("mfa_enrollments.tenant_id", "=", e).where("mfa_enrollments.id", "=", a).selectAll().executeTakeFirst();
|
|
7881
7881
|
return n ? {
|
|
@@ -7885,8 +7885,8 @@ function cr(t) {
|
|
|
7885
7885
|
phone_number: n.phone_number ?? void 0,
|
|
7886
7886
|
totp_secret: n.totp_secret ?? void 0,
|
|
7887
7887
|
confirmed: n.confirmed === 1,
|
|
7888
|
-
created_at:
|
|
7889
|
-
updated_at:
|
|
7888
|
+
created_at: Nt(n.created_at_ts),
|
|
7889
|
+
updated_at: Nt(n.updated_at_ts)
|
|
7890
7890
|
} : null;
|
|
7891
7891
|
};
|
|
7892
7892
|
}
|
|
@@ -7898,8 +7898,8 @@ function Ou(t) {
|
|
|
7898
7898
|
phone_number: r.phone_number ?? void 0,
|
|
7899
7899
|
totp_secret: r.totp_secret ?? void 0,
|
|
7900
7900
|
confirmed: r.confirmed === 1,
|
|
7901
|
-
created_at:
|
|
7902
|
-
updated_at:
|
|
7901
|
+
created_at: Nt(r.created_at_ts),
|
|
7902
|
+
updated_at: Nt(r.updated_at_ts)
|
|
7903
7903
|
}));
|
|
7904
7904
|
}
|
|
7905
7905
|
function ku(t) {
|
|
@@ -7908,7 +7908,7 @@ function ku(t) {
|
|
|
7908
7908
|
updated_at_ts: Date.now()
|
|
7909
7909
|
};
|
|
7910
7910
|
n.phone_number !== void 0 && (o.phone_number = n.phone_number), n.totp_secret !== void 0 && (o.totp_secret = n.totp_secret), n.confirmed !== void 0 && (o.confirmed = n.confirmed ? 1 : 0), await t.updateTable("mfa_enrollments").set(o).where("mfa_enrollments.tenant_id", "=", e).where("mfa_enrollments.id", "=", a).execute();
|
|
7911
|
-
const s = await
|
|
7911
|
+
const s = await ur(t)(e, a);
|
|
7912
7912
|
if (!s)
|
|
7913
7913
|
throw new Error(`MFA enrollment ${a} not found`);
|
|
7914
7914
|
return s;
|
|
@@ -7919,14 +7919,14 @@ function Eu(t) {
|
|
|
7919
7919
|
}
|
|
7920
7920
|
function Iu(t) {
|
|
7921
7921
|
return {
|
|
7922
|
-
create:
|
|
7923
|
-
get:
|
|
7922
|
+
create: Su(t),
|
|
7923
|
+
get: ur(t),
|
|
7924
7924
|
list: Ou(t),
|
|
7925
7925
|
update: ku(t),
|
|
7926
7926
|
remove: Eu(t)
|
|
7927
7927
|
};
|
|
7928
7928
|
}
|
|
7929
|
-
class
|
|
7929
|
+
class lr {
|
|
7930
7930
|
constructor(e) {
|
|
7931
7931
|
me(this, "migrations");
|
|
7932
7932
|
this.migrations = e;
|
|
@@ -8213,7 +8213,7 @@ const Tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8213
8213
|
down: xl,
|
|
8214
8214
|
up: Cl
|
|
8215
8215
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8216
|
-
async function
|
|
8216
|
+
async function bl(t) {
|
|
8217
8217
|
await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
8218
8218
|
"tenant_id",
|
|
8219
8219
|
"varchar(255)",
|
|
@@ -8228,13 +8228,13 @@ async function Sl(t) {
|
|
|
8228
8228
|
(e) => e.references("connections.id").onDelete("cascade")
|
|
8229
8229
|
).execute();
|
|
8230
8230
|
}
|
|
8231
|
-
async function
|
|
8231
|
+
async function Sl(t) {
|
|
8232
8232
|
await t.schema.dropTable("keys").execute();
|
|
8233
8233
|
}
|
|
8234
8234
|
const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8235
8235
|
__proto__: null,
|
|
8236
|
-
down:
|
|
8237
|
-
up:
|
|
8236
|
+
down: Sl,
|
|
8237
|
+
up: bl
|
|
8238
8238
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8239
8239
|
async function kl(t) {
|
|
8240
8240
|
}
|
|
@@ -8414,14 +8414,14 @@ const Td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8414
8414
|
down: xd,
|
|
8415
8415
|
up: Cd
|
|
8416
8416
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8417
|
-
async function Sd(t) {
|
|
8418
|
-
}
|
|
8419
8417
|
async function bd(t) {
|
|
8420
8418
|
}
|
|
8419
|
+
async function Sd(t) {
|
|
8420
|
+
}
|
|
8421
8421
|
const Od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8422
8422
|
__proto__: null,
|
|
8423
|
-
down:
|
|
8424
|
-
up:
|
|
8423
|
+
down: Sd,
|
|
8424
|
+
up: bd
|
|
8425
8425
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8426
8426
|
async function kd(t) {
|
|
8427
8427
|
await t.schema.createTable("authentication_codes").addColumn(
|
|
@@ -8628,7 +8628,7 @@ const T_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8628
8628
|
down: x_,
|
|
8629
8629
|
up: C_
|
|
8630
8630
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8631
|
-
async function
|
|
8631
|
+
async function b_(t) {
|
|
8632
8632
|
await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
|
|
8633
8633
|
"tenant_id",
|
|
8634
8634
|
"varchar(255)",
|
|
@@ -8644,7 +8644,7 @@ async function S_(t) {
|
|
|
8644
8644
|
"code_type"
|
|
8645
8645
|
]).execute();
|
|
8646
8646
|
}
|
|
8647
|
-
async function
|
|
8647
|
+
async function S_(t) {
|
|
8648
8648
|
await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
|
|
8649
8649
|
"tenant_id",
|
|
8650
8650
|
"varchar(255)",
|
|
@@ -8659,8 +8659,8 @@ async function b_(t) {
|
|
|
8659
8659
|
}
|
|
8660
8660
|
const O_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8661
8661
|
__proto__: null,
|
|
8662
|
-
down:
|
|
8663
|
-
up:
|
|
8662
|
+
down: S_,
|
|
8663
|
+
up: b_
|
|
8664
8664
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8665
8665
|
async function k_(t) {
|
|
8666
8666
|
await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
|
|
@@ -8894,10 +8894,10 @@ const Tm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8894
8894
|
down: xm,
|
|
8895
8895
|
up: Cm
|
|
8896
8896
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8897
|
-
async function
|
|
8897
|
+
async function bm(t) {
|
|
8898
8898
|
await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
|
|
8899
8899
|
}
|
|
8900
|
-
async function
|
|
8900
|
+
async function Sm(t) {
|
|
8901
8901
|
await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
8902
8902
|
"sessions_user_id_constraint",
|
|
8903
8903
|
["user_id", "tenant_id"],
|
|
@@ -8918,8 +8918,8 @@ async function bm(t) {
|
|
|
8918
8918
|
}
|
|
8919
8919
|
const Om = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8920
8920
|
__proto__: null,
|
|
8921
|
-
down:
|
|
8922
|
-
up:
|
|
8921
|
+
down: Sm,
|
|
8922
|
+
up: bm
|
|
8923
8923
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
8924
8924
|
async function km(t) {
|
|
8925
8925
|
await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
|
|
@@ -9170,7 +9170,7 @@ const Th = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
9170
9170
|
down: xh,
|
|
9171
9171
|
up: Ch
|
|
9172
9172
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9173
|
-
async function
|
|
9173
|
+
async function bh(t) {
|
|
9174
9174
|
await t.schema.createTable("themes").addColumn(
|
|
9175
9175
|
"tenant_id",
|
|
9176
9176
|
"varchar(255)",
|
|
@@ -9245,13 +9245,13 @@ async function Sh(t) {
|
|
|
9245
9245
|
(e) => e.notNull()
|
|
9246
9246
|
).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("themes_pkey", ["tenant_id", "themeId"]).execute(), await t.schema.createIndex("themes_tenant_id_idx").on("themes").column("tenant_id").execute();
|
|
9247
9247
|
}
|
|
9248
|
-
async function
|
|
9248
|
+
async function Sh(t) {
|
|
9249
9249
|
await t.schema.dropTable("themes").execute();
|
|
9250
9250
|
}
|
|
9251
9251
|
const Oh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9252
9252
|
__proto__: null,
|
|
9253
|
-
down:
|
|
9254
|
-
up:
|
|
9253
|
+
down: Sh,
|
|
9254
|
+
up: bh
|
|
9255
9255
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9256
9256
|
async function kh(t) {
|
|
9257
9257
|
await t.schema.createTable("resource_servers").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("identifier", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("scopes", "varchar(4096)").addColumn("signing_alg", "varchar(64)").addColumn("signing_secret", "varchar(2048)").addColumn("token_lifetime", "integer").addColumn("token_lifetime_for_web", "integer").addColumn("skip_consent_for_verifiable_first_party_clients", "integer").addColumn("allow_offline_access", "integer").addColumn("verification_key", "varchar(4096)").addColumn("options", "varchar(4096)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("resource_servers_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("resource_servers_tenant_identifier_uq").on("resource_servers").columns(["tenant_id", "identifier"]).unique().execute(), await t.schema.createTable("roles").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(50)", (e) => e.notNull()).addColumn("description", "varchar(255)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("roles_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("roles_tenant_name_uq").on("roles").columns(["tenant_id", "name"]).unique().execute();
|
|
@@ -9441,7 +9441,7 @@ const Yh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
9441
9441
|
down: Hh,
|
|
9442
9442
|
up: Gh
|
|
9443
9443
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9444
|
-
async function
|
|
9444
|
+
async function dr(t) {
|
|
9445
9445
|
try {
|
|
9446
9446
|
return await w`SELECT VERSION()`.execute(t), "mysql";
|
|
9447
9447
|
} catch {
|
|
@@ -9449,7 +9449,7 @@ async function lr(t) {
|
|
|
9449
9449
|
}
|
|
9450
9450
|
}
|
|
9451
9451
|
async function Xh(t) {
|
|
9452
|
-
await
|
|
9452
|
+
await dr(t) === "mysql" ? await Zh(t) : await ef(t);
|
|
9453
9453
|
}
|
|
9454
9454
|
async function Zh(t) {
|
|
9455
9455
|
await t.transaction().execute(async (e) => {
|
|
@@ -9599,7 +9599,7 @@ async function ef(t) {
|
|
|
9599
9599
|
});
|
|
9600
9600
|
}
|
|
9601
9601
|
async function tf(t) {
|
|
9602
|
-
await
|
|
9602
|
+
await dr(t) === "mysql" ? await af(t) : await nf(t);
|
|
9603
9603
|
}
|
|
9604
9604
|
async function af(t) {
|
|
9605
9605
|
await t.transaction().execute(async (e) => {
|
|
@@ -9744,12 +9744,12 @@ async function Tf(t) {
|
|
|
9744
9744
|
(e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
|
|
9745
9745
|
).addColumn("idle_session_lifetime", "integer").addColumn("session_lifetime", "integer").addColumn("session_cookie", "text").addColumn("enable_client_connections", "integer").addColumn("default_redirection_uri", "text").addColumn("enabled_locales", "text").addColumn("default_directory", "varchar(255)").addColumn("error_page", "text").addColumn("flags", "text").addColumn("friendly_name", "varchar(255)").addColumn("picture_url", "text").addColumn("support_email", "varchar(255)").addColumn("support_url", "text").addColumn("sandbox_version", "varchar(50)").addColumn("sandbox_versions_available", "text").addColumn("change_password", "text").addColumn("guardian_mfa_page", "text").addColumn("default_audience", "varchar(255)").addColumn("default_organization", "varchar(255)").addColumn("sessions", "text").execute();
|
|
9746
9746
|
}
|
|
9747
|
-
async function
|
|
9747
|
+
async function bf(t) {
|
|
9748
9748
|
await t.schema.dropTable("tenant_settings").execute();
|
|
9749
9749
|
}
|
|
9750
|
-
const
|
|
9750
|
+
const Sf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9751
9751
|
__proto__: null,
|
|
9752
|
-
down:
|
|
9752
|
+
down: bf,
|
|
9753
9753
|
up: Tf
|
|
9754
9754
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9755
9755
|
async function Of(t) {
|
|
@@ -10175,7 +10175,7 @@ const _p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10175
10175
|
down: dp,
|
|
10176
10176
|
up: lp
|
|
10177
10177
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10178
|
-
async function
|
|
10178
|
+
async function _r(t) {
|
|
10179
10179
|
try {
|
|
10180
10180
|
return await w`SELECT VERSION()`.execute(t), "mysql";
|
|
10181
10181
|
} catch {
|
|
@@ -10197,7 +10197,7 @@ async function L(t, e, a) {
|
|
|
10197
10197
|
}
|
|
10198
10198
|
}
|
|
10199
10199
|
async function mp(t) {
|
|
10200
|
-
const e = await
|
|
10200
|
+
const e = await _r(t);
|
|
10201
10201
|
console.log("Dropping indexes that depend on old date columns...");
|
|
10202
10202
|
try {
|
|
10203
10203
|
await w`DROP INDEX IF EXISTS login_sessions_state_updated_idx`.execute(
|
|
@@ -10211,7 +10211,7 @@ async function mp(t) {
|
|
|
10211
10211
|
console.log("Dropping old date columns..."), await L(t, "refresh_tokens", "created_at"), await L(t, "refresh_tokens", "expires_at"), await L(t, "refresh_tokens", "idle_expires_at"), await L(t, "refresh_tokens", "last_exchanged_at"), await L(t, "sessions", "created_at"), await L(t, "sessions", "updated_at"), await L(t, "sessions", "expires_at"), await L(t, "sessions", "idle_expires_at"), await L(t, "sessions", "authenticated_at"), await L(t, "sessions", "last_interaction_at"), await L(t, "sessions", "used_at"), await L(t, "sessions", "revoked_at"), await L(t, "login_sessions", "created_at"), await L(t, "login_sessions", "updated_at"), await L(t, "login_sessions", "expires_at"), e === "mysql" && (console.log("Increasing ID column sizes for ULID support..."), await t.schema.alterTable("login_sessions").modifyColumn("id", "varchar(26)").execute(), await t.schema.alterTable("login_sessions").modifyColumn("session_id", "varchar(26)").execute(), await t.schema.alterTable("login_sessions").modifyColumn("csrf_token", "varchar(26)").execute(), await t.schema.alterTable("sessions").modifyColumn("id", "varchar(26)").execute(), await t.schema.alterTable("sessions").modifyColumn("login_session_id", "varchar(26)").execute(), await t.schema.alterTable("refresh_tokens").modifyColumn("id", "varchar(26)").execute(), await t.schema.alterTable("refresh_tokens").modifyColumn("session_id", "varchar(26)").execute()), console.log("Migration completed successfully");
|
|
10212
10212
|
}
|
|
10213
10213
|
async function hp(t) {
|
|
10214
|
-
await
|
|
10214
|
+
await _r(t) === "mysql" && (console.log("Restoring ID column sizes to varchar(21)..."), await t.schema.alterTable("login_sessions").modifyColumn("id", "varchar(21)").execute(), await t.schema.alterTable("login_sessions").modifyColumn("session_id", "varchar(21)").execute(), await t.schema.alterTable("login_sessions").modifyColumn("csrf_token", "varchar(21)").execute(), await t.schema.alterTable("sessions").modifyColumn("id", "varchar(21)").execute(), await t.schema.alterTable("sessions").modifyColumn("login_session_id", "varchar(21)").execute(), await t.schema.alterTable("refresh_tokens").modifyColumn("id", "varchar(21)").execute(), await t.schema.alterTable("refresh_tokens").modifyColumn("session_id", "varchar(21)").execute()), console.log("Re-adding old date columns (data will be empty)..."), await t.schema.alterTable("refresh_tokens").addColumn("created_at", "varchar(35)").execute(), await t.schema.alterTable("refresh_tokens").addColumn("expires_at", "varchar(35)").execute(), await t.schema.alterTable("refresh_tokens").addColumn("idle_expires_at", "varchar(35)").execute(), await t.schema.alterTable("refresh_tokens").addColumn("last_exchanged_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("created_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("updated_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("expires_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("idle_expires_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("authenticated_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("last_interaction_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("used_at", "varchar(35)").execute(), await t.schema.alterTable("sessions").addColumn("revoked_at", "varchar(35)").execute(), await t.schema.alterTable("login_sessions").addColumn("created_at", "varchar(35)").execute(), await t.schema.alterTable("login_sessions").addColumn("updated_at", "varchar(35)").execute(), await t.schema.alterTable("login_sessions").addColumn("expires_at", "varchar(35)").execute(), console.log("Rollback completed");
|
|
10215
10215
|
}
|
|
10216
10216
|
const fp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10217
10217
|
__proto__: null,
|
|
@@ -10251,7 +10251,7 @@ const Tp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10251
10251
|
down: xp,
|
|
10252
10252
|
up: Cp
|
|
10253
10253
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10254
|
-
async function
|
|
10254
|
+
async function bp(t) {
|
|
10255
10255
|
try {
|
|
10256
10256
|
await t.schema.alterTable("login_sessions").addColumn("authParams_max_age", "integer").execute(), console.log(" Added column authParams_max_age to login_sessions");
|
|
10257
10257
|
} catch (e) {
|
|
@@ -10267,7 +10267,7 @@ async function Sp(t) {
|
|
|
10267
10267
|
);
|
|
10268
10268
|
}
|
|
10269
10269
|
}
|
|
10270
|
-
async function
|
|
10270
|
+
async function Sp(t) {
|
|
10271
10271
|
try {
|
|
10272
10272
|
await t.schema.alterTable("login_sessions").dropColumn("authParams_max_age").execute();
|
|
10273
10273
|
} catch (e) {
|
|
@@ -10285,8 +10285,8 @@ async function bp(t) {
|
|
|
10285
10285
|
}
|
|
10286
10286
|
const Op = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10287
10287
|
__proto__: null,
|
|
10288
|
-
down:
|
|
10289
|
-
up:
|
|
10288
|
+
down: Sp,
|
|
10289
|
+
up: bp
|
|
10290
10290
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10291
10291
|
async function kp(t) {
|
|
10292
10292
|
await t.schema.alterTable("clients").addColumn("auth0_conformant", "integer", (e) => e.defaultTo(1)).execute();
|
|
@@ -10351,7 +10351,7 @@ async function jp(t) {
|
|
|
10351
10351
|
return "sqlite";
|
|
10352
10352
|
}
|
|
10353
10353
|
}
|
|
10354
|
-
async function
|
|
10354
|
+
async function la(t, e, a, n) {
|
|
10355
10355
|
try {
|
|
10356
10356
|
await t.schema.alterTable(e).addColumn(a, w.raw(n)).execute();
|
|
10357
10357
|
} catch (r) {
|
|
@@ -10366,7 +10366,7 @@ async function ua(t, e, a, n) {
|
|
|
10366
10366
|
}
|
|
10367
10367
|
async function Jp(t) {
|
|
10368
10368
|
const e = await jp(t);
|
|
10369
|
-
await
|
|
10369
|
+
await la(t, "hooks", "template_id", "text"), await la(t, "hooks", "created_at_ts", "bigint"), await la(t, "hooks", "updated_at_ts", "bigint"), e === "mysql" ? await w`
|
|
10370
10370
|
UPDATE hooks
|
|
10371
10371
|
SET created_at_ts = UNIX_TIMESTAMP(created_at) * 1000,
|
|
10372
10372
|
updated_at_ts = UNIX_TIMESTAMP(updated_at) * 1000
|
|
@@ -10378,7 +10378,7 @@ async function Jp(t) {
|
|
|
10378
10378
|
WHERE created_at_ts IS NULL AND created_at IS NOT NULL
|
|
10379
10379
|
`.execute(t), e === "mysql" && (await t.schema.alterTable("hooks").modifyColumn("created_at", "varchar(255)").execute(), await t.schema.alterTable("hooks").modifyColumn("updated_at", "varchar(255)").execute());
|
|
10380
10380
|
}
|
|
10381
|
-
async function
|
|
10381
|
+
async function da(t, e, a) {
|
|
10382
10382
|
try {
|
|
10383
10383
|
await t.schema.alterTable(e).dropColumn(a).execute();
|
|
10384
10384
|
} catch (n) {
|
|
@@ -10388,21 +10388,21 @@ async function la(t, e, a) {
|
|
|
10388
10388
|
}
|
|
10389
10389
|
}
|
|
10390
10390
|
async function qp(t) {
|
|
10391
|
-
await
|
|
10391
|
+
await da(t, "hooks", "template_id"), await da(t, "hooks", "created_at_ts"), await da(t, "hooks", "updated_at_ts");
|
|
10392
10392
|
}
|
|
10393
10393
|
const Wp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10394
10394
|
__proto__: null,
|
|
10395
10395
|
down: qp,
|
|
10396
10396
|
up: Jp
|
|
10397
10397
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10398
|
-
async function
|
|
10398
|
+
async function mr(t) {
|
|
10399
10399
|
try {
|
|
10400
10400
|
return await w`SELECT VERSION()`.execute(t), "mysql";
|
|
10401
10401
|
} catch {
|
|
10402
10402
|
return "sqlite";
|
|
10403
10403
|
}
|
|
10404
10404
|
}
|
|
10405
|
-
async function
|
|
10405
|
+
async function fn(t, e, a) {
|
|
10406
10406
|
try {
|
|
10407
10407
|
await t.schema.alterTable(e).dropColumn(a).execute();
|
|
10408
10408
|
} catch (n) {
|
|
@@ -10418,7 +10418,7 @@ async function hn(t, e, a) {
|
|
|
10418
10418
|
}
|
|
10419
10419
|
async function Bp(t) {
|
|
10420
10420
|
var o, s, u, l, _;
|
|
10421
|
-
const e = await
|
|
10421
|
+
const e = await mr(t);
|
|
10422
10422
|
console.log(
|
|
10423
10423
|
"Running preflight integrity check on hooks timestamp columns..."
|
|
10424
10424
|
);
|
|
@@ -10449,14 +10449,14 @@ async function Bp(t) {
|
|
|
10449
10449
|
" Preflight length check passed — all values fit within new column sizes."
|
|
10450
10450
|
);
|
|
10451
10451
|
}
|
|
10452
|
-
console.log("Dropping old date columns from hooks..."), await
|
|
10452
|
+
console.log("Dropping old date columns from hooks..."), await fn(t, "hooks", "created_at"), await fn(t, "hooks", "updated_at"), e === "mysql" && (console.log("Fixing hook column types..."), await t.schema.alterTable("hooks").modifyColumn(
|
|
10453
10453
|
"hook_id",
|
|
10454
10454
|
"varchar(21)",
|
|
10455
10455
|
(m) => m.notNull().primaryKey()
|
|
10456
10456
|
).execute(), await t.schema.alterTable("hooks").modifyColumn("form_id", "varchar(128)").execute(), await t.schema.alterTable("hooks").modifyColumn("template_id", "varchar(64)").execute());
|
|
10457
10457
|
}
|
|
10458
10458
|
async function Up(t) {
|
|
10459
|
-
const e = await
|
|
10459
|
+
const e = await mr(t);
|
|
10460
10460
|
await t.schema.alterTable("hooks").addColumn("created_at", "varchar(255)").execute(), await t.schema.alterTable("hooks").addColumn("updated_at", "varchar(255)").execute(), e === "mysql" ? await w`
|
|
10461
10461
|
UPDATE hooks
|
|
10462
10462
|
SET created_at = DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(created_at_ts / 1000), @@session.time_zone, '+00:00'), '%Y-%m-%dT%H:%i:%s.000Z'),
|
|
@@ -10533,7 +10533,7 @@ const Xp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10533
10533
|
down: Yp,
|
|
10534
10534
|
up: Hp
|
|
10535
10535
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10536
|
-
async function
|
|
10536
|
+
async function hr(t) {
|
|
10537
10537
|
try {
|
|
10538
10538
|
return await w`SELECT VERSION()`.execute(t), "mysql";
|
|
10539
10539
|
} catch {
|
|
@@ -10541,10 +10541,10 @@ async function mr(t) {
|
|
|
10541
10541
|
}
|
|
10542
10542
|
}
|
|
10543
10543
|
async function Zp(t) {
|
|
10544
|
-
await
|
|
10544
|
+
await hr(t) === "mysql" ? (await t.schema.alterTable("refresh_tokens").modifyColumn("login_id", "varchar(26)", (a) => a.notNull()).execute(), await t.schema.dropIndex("idx_refresh_tokens_session_id").execute(), await t.schema.alterTable("refresh_tokens").dropColumn("session_id").execute()) : (await t.schema.dropIndex("idx_refresh_tokens_session_id").execute(), await t.schema.alterTable("refresh_tokens").dropColumn("session_id").execute());
|
|
10545
10545
|
}
|
|
10546
10546
|
async function eg(t) {
|
|
10547
|
-
await
|
|
10547
|
+
await hr(t) === "mysql" ? (await t.schema.alterTable("refresh_tokens").addColumn("session_id", "varchar(26)").execute(), await t.schema.createIndex("idx_refresh_tokens_session_id").on("refresh_tokens").column("session_id").execute(), await t.schema.alterTable("refresh_tokens").modifyColumn("login_id", "varchar(26)").execute()) : await t.schema.alterTable("refresh_tokens").addColumn("session_id", "varchar(21)").execute();
|
|
10548
10548
|
}
|
|
10549
10549
|
const tg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10550
10550
|
__proto__: null,
|
|
@@ -10598,7 +10598,7 @@ const mg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10598
10598
|
__proto__: null,
|
|
10599
10599
|
down: _g,
|
|
10600
10600
|
up: dg
|
|
10601
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
10601
|
+
}, Symbol.toStringTag, { value: "Module" })), fr = {
|
|
10602
10602
|
m1_init: Du,
|
|
10603
10603
|
m2_magicLink: zu,
|
|
10604
10604
|
m3_updateAt: Mu,
|
|
@@ -10703,7 +10703,7 @@ const mg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10703
10703
|
o004_login_sessions_id_index: gf,
|
|
10704
10704
|
o005_connections_tenant_index: vf,
|
|
10705
10705
|
o006_remove_redundant_user_organizations_tenant_index: xf,
|
|
10706
|
-
o007_tenant_settings:
|
|
10706
|
+
o007_tenant_settings: Sf,
|
|
10707
10707
|
o008_merge_tenant_settings_into_tenants: Ef,
|
|
10708
10708
|
o009_create_invites_table: Af,
|
|
10709
10709
|
o010_add_log_id_to_logs: Rf,
|
|
@@ -10738,7 +10738,7 @@ const mg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10738
10738
|
};
|
|
10739
10739
|
async function gg(t, e = !1) {
|
|
10740
10740
|
e && console.log("migrating...");
|
|
10741
|
-
const a = new
|
|
10741
|
+
const a = new lr(fr), n = new Vn({
|
|
10742
10742
|
db: t,
|
|
10743
10743
|
provider: a
|
|
10744
10744
|
}), { error: r, results: o } = await n.migrateToLatest();
|
|
@@ -10751,7 +10751,7 @@ async function gg(t, e = !1) {
|
|
|
10751
10751
|
}
|
|
10752
10752
|
async function wg(t) {
|
|
10753
10753
|
console.log("migrating...");
|
|
10754
|
-
const e = new
|
|
10754
|
+
const e = new lr(fr), a = new Vn({
|
|
10755
10755
|
db: t,
|
|
10756
10756
|
provider: e
|
|
10757
10757
|
}), { error: n, results: r } = await a.migrateDown();
|
|
@@ -10770,13 +10770,13 @@ function yg(t, e = { useTransactions: !0 }) {
|
|
|
10770
10770
|
connections: Po(t),
|
|
10771
10771
|
emailProviders: Vs(t),
|
|
10772
10772
|
customDomains: ls(t),
|
|
10773
|
-
flows:
|
|
10773
|
+
flows: Wr(t),
|
|
10774
10774
|
forms: ci(t),
|
|
10775
10775
|
hooks: xs(t),
|
|
10776
10776
|
invites: Cu(t),
|
|
10777
10777
|
keys: ns(t),
|
|
10778
10778
|
loginSessions: js(t),
|
|
10779
|
-
logs:
|
|
10779
|
+
logs: to(t),
|
|
10780
10780
|
mfaEnrollments: Iu(t),
|
|
10781
10781
|
passwords: mo(t),
|
|
10782
10782
|
promptSettings: Ws(t),
|
|
@@ -10788,11 +10788,11 @@ function yg(t, e = { useTransactions: !0 }) {
|
|
|
10788
10788
|
roles: vi(t),
|
|
10789
10789
|
sessions: io(t),
|
|
10790
10790
|
sessionCleanup: ai(t),
|
|
10791
|
-
tenants:
|
|
10791
|
+
tenants: Hr(t),
|
|
10792
10792
|
themes: ks(t),
|
|
10793
10793
|
universalLoginTemplates: gs(t),
|
|
10794
|
-
customText:
|
|
10795
|
-
users:
|
|
10794
|
+
customText: bu(t),
|
|
10795
|
+
users: Fr(t, e),
|
|
10796
10796
|
organizations: uu(t),
|
|
10797
10797
|
userOrganizations: pu(t),
|
|
10798
10798
|
stats: Tu(t)
|