@authhero/kysely-adapter 10.52.0 → 10.53.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.
@@ -1,11 +1,11 @@
1
- var Fr = Object.defineProperty;
1
+ var jr = Object.defineProperty;
2
2
  var Nn = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var jr = (t, e, n) => e in t ? Fr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var oe = (t, e, n) => jr(t, typeof e != "symbol" ? e + "" : e, n), Kt = (t, e, n) => e.has(t) || Nn("Cannot " + n);
5
+ var Lr = (t, e, n) => e in t ? jr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
+ var oe = (t, e, n) => Lr(t, typeof e != "symbol" ? e + "" : e, n), Kt = (t, e, n) => e.has(t) || Nn("Cannot " + n);
7
7
  var i = (t, e, n) => (Kt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? Nn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), b = (t, e, n, r) => (Kt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Kt(t, e, "access private method"), n);
8
- import { parseUserId as _n, codeSchema as Lr, connectionSchema as Jr, loginSessionSchema as Mr, promptSettingSchema as qr, formSchema as xt, resourceServerSchema as Br } from "@authhero/adapter-interfaces";
8
+ import { parseUserId as _n, codeSchema as Jr, connectionSchema as Mr, loginSessionSchema as qr, promptSettingSchema as Br, formSchema as xt, resourceServerSchema as Wr } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var dt = class extends Error {
11
11
  constructor(e = 500, n) {
@@ -23,7 +23,7 @@ var dt = class extends Error {
23
23
  });
24
24
  }
25
25
  };
26
- function Wr(t) {
26
+ function Kr(t) {
27
27
  return async (e, n) => {
28
28
  const { identities: r, ...a } = n, o = {
29
29
  ...a,
@@ -88,7 +88,7 @@ function Wn(t) {
88
88
  }
89
89
  };
90
90
  }
91
- function Kr(t) {
91
+ function Ur(t) {
92
92
  return async (e, n) => {
93
93
  const [r, a] = await Promise.all([
94
94
  t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", n).selectAll().executeTakeFirst(),
@@ -171,7 +171,7 @@ function J(t, e, n, r) {
171
171
  function F(t) {
172
172
  return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
173
173
  }
174
- function Ur(t) {
174
+ function Qr(t) {
175
175
  return async (e, n = {}) => {
176
176
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
177
177
  let l = t.selectFrom("users").where("users.tenant_id", "=", e);
@@ -216,7 +216,7 @@ function Ur(t) {
216
216
  };
217
217
  };
218
218
  }
219
- function Qr(t) {
219
+ function Vr(t) {
220
220
  return async (e, n) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", n).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", n).execute()).length === 1);
221
221
  }
222
222
  function et(t, e = "", n = {}) {
@@ -245,7 +245,7 @@ function Kn(t, e) {
245
245
  }
246
246
  return n;
247
247
  }
248
- function Vr(t) {
248
+ function Gr(t) {
249
249
  return async (e, n, r) => {
250
250
  const a = et({
251
251
  ...r,
@@ -256,25 +256,25 @@ function Vr(t) {
256
256
  return (await t.updateTable("users").set(a).where("users.tenant_id", "=", e).where("users.user_id", "=", n).execute()).length === 1;
257
257
  };
258
258
  }
259
- function Gr(t) {
259
+ function Yr(t) {
260
260
  return async (e, n, r, a) => {
261
261
  const o = { linked_to: null };
262
262
  return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", `${r}|${a}`).where("users.linked_to", "=", `${n}`).execute()).length === 1;
263
263
  };
264
264
  }
265
- function Yr(t) {
265
+ function Hr(t) {
266
266
  return {
267
- create: Wr(t),
268
- remove: Qr(t),
269
- get: Kr(t),
270
- list: Ur(t),
271
- update: Vr(t),
267
+ create: Kr(t),
268
+ remove: Vr(t),
269
+ get: Ur(t),
270
+ list: Qr(t),
271
+ update: Gr(t),
272
272
  // TODO - think about this more when other issues fixed
273
- unlink: Gr(t)
273
+ unlink: Yr(t)
274
274
  };
275
275
  }
276
- const Hr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
277
- let Xr = (t) => crypto.getRandomValues(new Uint8Array(t)), Zr = (t, e, n) => {
276
+ const Xr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
277
+ let Zr = (t) => crypto.getRandomValues(new Uint8Array(t)), ea = (t, e, n) => {
278
278
  let r = (2 << Math.log2(t.length - 1)) - 1, a = -~(1.6 * r * e / t.length);
279
279
  return (o = e) => {
280
280
  let u = "";
@@ -284,10 +284,10 @@ let Xr = (t) => crypto.getRandomValues(new Uint8Array(t)), Zr = (t, e, n) => {
284
284
  if (u += t[c[l] & r] || "", u.length === o) return u;
285
285
  }
286
286
  };
287
- }, ea = (t, e = 21) => Zr(t, e, Xr), re = (t = 21) => {
287
+ }, ta = (t, e = 21) => ea(t, e, Zr), re = (t = 21) => {
288
288
  let e = "", n = crypto.getRandomValues(new Uint8Array(t));
289
289
  for (; t--; )
290
- e += Hr[n[t] & 63];
290
+ e += Xr[n[t] & 63];
291
291
  return e;
292
292
  };
293
293
  function Ft(t, e, n = { ...t }) {
@@ -295,13 +295,17 @@ function Ft(t, e, n = { ...t }) {
295
295
  t[r] !== void 0 && (n[r] = JSON.stringify(t[r]));
296
296
  return n;
297
297
  }
298
- function ta(t) {
298
+ function Un(t, e, n = t) {
299
+ for (const r of e)
300
+ t[r] !== void 0 && (n[r] = t[r] ? 1 : 0);
301
+ }
302
+ function na(t) {
299
303
  const e = {};
300
304
  for (const n in t)
301
305
  t[n] !== void 0 && t[n] !== null && (e[n] = t[n]);
302
306
  return e;
303
307
  }
304
- function Un(t) {
308
+ function Qn(t) {
305
309
  const e = {
306
310
  ...t
307
311
  };
@@ -309,7 +313,7 @@ function Un(t) {
309
313
  t.sandbox_versions_available
310
314
  )), 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.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), T(e);
311
315
  }
312
- function Qn(t) {
316
+ function Vn(t) {
313
317
  const e = { ...t };
314
318
  return Ft(
315
319
  t,
@@ -330,26 +334,26 @@ function Qn(t) {
330
334
  "mtls"
331
335
  ],
332
336
  e
333
- ), 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), ta(e);
337
+ ), 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), na(e);
334
338
  }
335
- function na(t) {
339
+ function ra(t) {
336
340
  return async (e) => {
337
341
  const n = {
338
342
  id: e.id || re(),
339
343
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
340
344
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
341
345
  ...e
342
- }, r = Qn(n);
346
+ }, r = Vn(n);
343
347
  return await t.insertInto("tenants").values(r).execute(), n;
344
348
  };
345
349
  }
346
- function ra(t) {
350
+ function aa(t) {
347
351
  return async (e) => {
348
352
  const n = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
349
- return n ? Un(n) : null;
353
+ return n ? Qn(n) : null;
350
354
  };
351
355
  }
352
- function aa(t) {
356
+ function oa(t) {
353
357
  return async (e) => {
354
358
  let n = t.selectFrom("tenants");
355
359
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = e;
@@ -360,7 +364,7 @@ function aa(t) {
360
364
  c && (n = n.where(
361
365
  (f) => f.or([f("friendly_name", "like", `%${c}%`)])
362
366
  ));
363
- const g = (await n.offset(r * a).limit(a).selectAll().execute()).map(Un);
367
+ const g = (await n.offset(r * a).limit(a).selectAll().execute()).map(Qn);
364
368
  if (!o)
365
369
  return {
366
370
  tenants: g
@@ -374,39 +378,39 @@ function aa(t) {
374
378
  };
375
379
  };
376
380
  }
377
- function oa(t) {
381
+ function ia(t) {
378
382
  return async (e, n) => {
379
383
  const a = {
380
- ...Qn(n),
384
+ ...Vn(n),
381
385
  id: e,
382
386
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
383
387
  };
384
388
  await t.updateTable("tenants").set(a).where("id", "=", e).execute();
385
389
  };
386
390
  }
387
- function ia(t) {
391
+ function sa(t) {
388
392
  return async (e) => (await t.deleteFrom("tenants").where("tenants.id", "=", e).execute()).length === 1;
389
393
  }
390
- function sa(t) {
394
+ function ua(t) {
391
395
  return {
392
- create: na(t),
393
- get: ra(t),
394
- list: aa(t),
395
- update: oa(t),
396
- remove: ia(t)
396
+ create: ra(t),
397
+ get: aa(t),
398
+ list: oa(t),
399
+ update: ia(t),
400
+ remove: sa(t)
397
401
  };
398
402
  }
399
403
  function vn(t) {
400
404
  return t ? JSON.stringify(t) : void 0;
401
405
  }
402
- const ua = 1024;
403
- function ca(t) {
406
+ const ca = 1024;
407
+ function la(t) {
404
408
  return async (e, n) => {
405
409
  var a, o, u;
406
410
  const r = {
407
411
  id: re(),
408
412
  ...n,
409
- user_agent: n.user_agent.slice(0, ua)
413
+ user_agent: n.user_agent.slice(0, ca)
410
414
  };
411
415
  return await t.insertInto("logs").values({
412
416
  ...r,
@@ -429,7 +433,7 @@ function Cn(t) {
429
433
  return t;
430
434
  }
431
435
  }
432
- function Vn(t) {
436
+ function Gn(t) {
433
437
  return {
434
438
  ...t,
435
439
  client_id: t.client_id,
@@ -442,7 +446,7 @@ function Vn(t) {
442
446
  _id: t.id
443
447
  };
444
448
  }
445
- function la(t) {
449
+ function da(t) {
446
450
  return async (e, n = {}) => {
447
451
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
448
452
  let l = t.selectFrom("logs").where("logs.tenant_id", "=", e);
@@ -453,7 +457,7 @@ function la(t) {
453
457
  h = h.orderBy(f(u.sort_by), u.sort_order);
454
458
  }
455
459
  h = h.offset(r * a).limit(a);
456
- const d = (await h.selectAll().execute()).map(Vn);
460
+ const d = (await h.selectAll().execute()).map(Gn);
457
461
  if (!o)
458
462
  return {
459
463
  logs: d,
@@ -470,20 +474,20 @@ function la(t) {
470
474
  };
471
475
  };
472
476
  }
473
- function da(t) {
477
+ function _a(t) {
474
478
  return async (e, n) => {
475
479
  const r = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", n).selectAll().executeTakeFirst();
476
- return r ? Vn(r) : null;
480
+ return r ? Gn(r) : null;
477
481
  };
478
482
  }
479
- function _a(t) {
483
+ function ma(t) {
480
484
  return {
481
- create: ca(t),
482
- list: la(t),
483
- get: da(t)
485
+ create: la(t),
486
+ list: da(t),
487
+ get: _a(t)
484
488
  };
485
489
  }
486
- function ma(t) {
490
+ function ha(t) {
487
491
  return async (e, n) => {
488
492
  const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", n).selectAll().executeTakeFirst();
489
493
  if (!r)
@@ -496,7 +500,7 @@ function ma(t) {
496
500
  };
497
501
  };
498
502
  }
499
- function ha(t) {
503
+ function fa(t) {
500
504
  return async (e, n) => {
501
505
  const r = {
502
506
  ...n,
@@ -513,10 +517,10 @@ function ha(t) {
513
517
  }).execute(), r;
514
518
  };
515
519
  }
516
- function fa(t) {
520
+ function pa(t) {
517
521
  return async (e, n) => !!(await t.deleteFrom("sessions").where("tenant_id", "=", e).where("sessions.id", "=", n).execute()).length;
518
522
  }
519
- function pa(t) {
523
+ function ga(t) {
520
524
  return async (e, n, r) => {
521
525
  const a = {
522
526
  ...r,
@@ -527,7 +531,7 @@ function pa(t) {
527
531
  return !!(await t.updateTable("sessions").set(a).where("tenant_id", "=", e).where("sessions.id", "=", n).execute()).length;
528
532
  };
529
533
  }
530
- function ga(t) {
534
+ function ya(t) {
531
535
  return async (e, n = {}) => {
532
536
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
533
537
  let l = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
@@ -559,16 +563,16 @@ function ga(t) {
559
563
  };
560
564
  };
561
565
  }
562
- function ya(t) {
566
+ function wa(t) {
563
567
  return {
564
- create: ha(t),
565
- get: ma(t),
566
- list: ga(t),
567
- remove: fa(t),
568
- update: pa(t)
568
+ create: fa(t),
569
+ get: ha(t),
570
+ list: ya(t),
571
+ remove: pa(t),
572
+ update: ga(t)
569
573
  };
570
574
  }
571
- function wa(t) {
575
+ function Na(t) {
572
576
  return async (e, n) => {
573
577
  const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", n).selectAll().executeTakeFirst();
574
578
  if (!r)
@@ -577,7 +581,7 @@ function wa(t) {
577
581
  return o;
578
582
  };
579
583
  }
580
- function Na(t) {
584
+ function va(t) {
581
585
  return async (e, n) => {
582
586
  const r = {
583
587
  ...n,
@@ -590,27 +594,27 @@ function Na(t) {
590
594
  }).execute(), r;
591
595
  };
592
596
  }
593
- function va(t) {
597
+ function Ca(t) {
594
598
  return async (e, n) => (await t.updateTable("passwords").set({
595
599
  password: n.password,
596
600
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
597
601
  }).where("tenant_id", "=", e).where("user_id", "=", n.user_id).execute()).length === 1;
598
602
  }
599
- function Ca(t) {
603
+ function xa(t) {
600
604
  return {
601
- create: Na(t),
602
- update: va(t),
603
- get: wa(t)
605
+ create: va(t),
606
+ update: Ca(t),
607
+ get: Na(t)
604
608
  };
605
609
  }
606
- function xa(t) {
610
+ function ba(t) {
607
611
  return async (e, n = {}) => {
608
612
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
609
613
  let c = t.selectFrom("codes").where("codes.tenant_id", "=", e);
610
614
  u && (c = J(t, c, u, ["code", "login_id"]));
611
615
  const g = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
612
616
  const { tenant_id: f, ...v } = y;
613
- return Lr.parse(T(v));
617
+ return Jr.parse(T(v));
614
618
  });
615
619
  if (!o)
616
620
  return {
@@ -628,7 +632,7 @@ function xa(t) {
628
632
  };
629
633
  };
630
634
  }
631
- function ba(t) {
635
+ function Oa(t) {
632
636
  return async (e, n) => {
633
637
  const r = {
634
638
  ...n,
@@ -640,10 +644,10 @@ function ba(t) {
640
644
  }).execute(), r;
641
645
  };
642
646
  }
643
- function Oa(t) {
647
+ function Ta(t) {
644
648
  return async (e, n) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
645
649
  }
646
- function Ta(t) {
650
+ function Sa(t) {
647
651
  return async (e, n, r) => {
648
652
  let a = t.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", r);
649
653
  e.length && (a = a.where("codes.tenant_id", "=", e));
@@ -651,19 +655,19 @@ function Ta(t) {
651
655
  return o ? T(o) : null;
652
656
  };
653
657
  }
654
- function Sa(t) {
658
+ function ka(t) {
655
659
  return async (e, n) => (await t.updateTable("codes").set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where("codes.tenant_id", "=", e).where("codes.code_id", "=", n).executeTakeFirst()).numUpdatedRows > 0;
656
660
  }
657
- function ka(t) {
661
+ function Ea(t) {
658
662
  return {
659
- create: ba(t),
660
- list: xa(t),
661
- remove: Oa(t),
662
- used: Sa(t),
663
- get: Ta(t)
663
+ create: Oa(t),
664
+ list: ba(t),
665
+ remove: Ta(t),
666
+ used: ka(t),
667
+ get: Sa(t)
664
668
  };
665
669
  }
666
- const Ea = 17, Ia = {
670
+ const Ia = 17, Aa = {
667
671
  organization: "org_",
668
672
  connection: "con_",
669
673
  action: "act_",
@@ -673,25 +677,25 @@ const Ea = 17, Ia = {
673
677
  guardian_factor: "gfa_"
674
678
  };
675
679
  function jt(t) {
676
- const r = ea("0123456789abcdefghijklmnopqrstuvwxyz", Ea)();
677
- return `${Ia[t]}${r}`;
680
+ const r = ta("0123456789abcdefghijklmnopqrstuvwxyz", Ia)();
681
+ return `${Aa[t]}${r}`;
678
682
  }
679
- function Aa() {
683
+ function Pa() {
680
684
  return jt("organization");
681
685
  }
682
- function Pa() {
686
+ function $a() {
683
687
  return jt("connection");
684
688
  }
685
- function $a() {
689
+ function Da() {
686
690
  return jt("hook");
687
691
  }
688
- function Da() {
692
+ function za() {
689
693
  return jt("resource_server");
690
694
  }
691
- function za(t) {
695
+ function Ra(t) {
692
696
  return async (e, n) => {
693
697
  const r = {
694
- id: n.id || Pa(),
698
+ id: n.id || $a(),
695
699
  ...n,
696
700
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
697
701
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -704,7 +708,7 @@ function za(t) {
704
708
  }).execute(), r;
705
709
  };
706
710
  }
707
- function Ra(t) {
711
+ function Fa(t) {
708
712
  return async (e, n = {}) => {
709
713
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
710
714
  let c = t.selectFrom("connections").where("connections.tenant_id", "=", e);
@@ -731,10 +735,10 @@ function Ra(t) {
731
735
  };
732
736
  };
733
737
  }
734
- function Fa(t) {
738
+ function ja(t) {
735
739
  return async (e, n) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
736
740
  }
737
- function ja(t) {
741
+ function La(t) {
738
742
  return async (e, n) => {
739
743
  const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
740
744
  return r ? T({
@@ -743,7 +747,7 @@ function ja(t) {
743
747
  }) : null;
744
748
  };
745
749
  }
746
- function La(t) {
750
+ function Ja(t) {
747
751
  return async (e, n, r) => {
748
752
  const a = {
749
753
  ...r,
@@ -755,16 +759,16 @@ function La(t) {
755
759
  }).where("connections.id", "=", n).where("connections.tenant_id", "=", e).execute(), !0;
756
760
  };
757
761
  }
758
- function Ja(t) {
762
+ function Ma(t) {
759
763
  return {
760
- create: za(t),
761
- get: ja(t),
762
- list: Ra(t),
763
- remove: Fa(t),
764
- update: La(t)
764
+ create: Ra(t),
765
+ get: La(t),
766
+ list: Fa(t),
767
+ remove: ja(t),
768
+ update: Ja(t)
765
769
  };
766
770
  }
767
- function Ma(t) {
771
+ function qa(t) {
768
772
  return async (e, n) => {
769
773
  const r = {
770
774
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -780,21 +784,25 @@ function Ma(t) {
780
784
  custom_login_page_on: n.custom_login_page_on ?? !1,
781
785
  require_pushed_authorization_requests: n.require_pushed_authorization_requests ?? !1,
782
786
  require_proof_of_possession: n.require_proof_of_possession ?? !1
783
- };
784
- return await t.insertInto("clients").values({
787
+ }, a = {
785
788
  ...r,
786
- tenant_id: e,
787
- // Convert boolean fields to integers for SQL storage
788
- global: n.global ? 1 : 0,
789
- is_first_party: n.is_first_party ? 1 : 0,
790
- oidc_conformant: n.oidc_conformant ? 1 : 0,
791
- sso: n.sso ? 1 : 0,
792
- sso_disabled: n.sso_disabled ? 1 : 0,
793
- cross_origin_authentication: n.cross_origin_authentication ? 1 : 0,
794
- custom_login_page_on: n.custom_login_page_on ? 1 : 0,
795
- require_pushed_authorization_requests: n.require_pushed_authorization_requests ? 1 : 0,
796
- require_proof_of_possession: n.require_proof_of_possession ? 1 : 0,
797
- // Convert array/object fields to JSON strings for SQL storage
789
+ tenant_id: e
790
+ };
791
+ return Un(
792
+ r,
793
+ [
794
+ "global",
795
+ "is_first_party",
796
+ "oidc_conformant",
797
+ "sso",
798
+ "sso_disabled",
799
+ "cross_origin_authentication",
800
+ "custom_login_page_on",
801
+ "require_pushed_authorization_requests",
802
+ "require_proof_of_possession"
803
+ ],
804
+ a
805
+ ), Object.assign(a, {
798
806
  callbacks: JSON.stringify(n.callbacks || []),
799
807
  allowed_origins: JSON.stringify(n.allowed_origins || []),
800
808
  web_origins: JSON.stringify(n.web_origins || []),
@@ -820,10 +828,10 @@ function Ma(t) {
820
828
  n.signed_request_object || {}
821
829
  ),
822
830
  token_quota: JSON.stringify(n.token_quota || {})
823
- }).execute(), r;
831
+ }), await t.insertInto("clients").values(a).execute(), r;
824
832
  };
825
833
  }
826
- function qa(t) {
834
+ function Ba(t) {
827
835
  return async (e, n) => {
828
836
  const r = await t.selectFrom("clients").where("clients.tenant_id", "=", e).where("clients.client_id", "=", n).selectAll().executeTakeFirst();
829
837
  if (!r)
@@ -868,7 +876,7 @@ function qa(t) {
868
876
  });
869
877
  };
870
878
  }
871
- function Ba(t) {
879
+ function Wa(t) {
872
880
  return async (e, n) => {
873
881
  let r = t.selectFrom("clients").where("clients.tenant_id", "=", e);
874
882
  return n != null && n.per_page && (r = r.limit(n.per_page)), n != null && n.page && (n != null && n.per_page) && (r = r.offset((n.page - 1) * n.per_page)), {
@@ -912,16 +920,30 @@ function Ba(t) {
912
920
  };
913
921
  };
914
922
  }
915
- function Wa(t) {
923
+ function Ka(t) {
916
924
  return async (e, n) => (await t.deleteFrom("clients").where("clients.tenant_id", "=", e).where("clients.client_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
917
925
  }
918
- function Ka(t) {
926
+ function Ua(t) {
919
927
  return async (e, n, r) => {
920
928
  const a = {
921
929
  ...r,
922
930
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
923
931
  };
924
- return r.global !== void 0 && (a.global = r.global ? 1 : 0), r.is_first_party !== void 0 && (a.is_first_party = r.is_first_party ? 1 : 0), r.oidc_conformant !== void 0 && (a.oidc_conformant = r.oidc_conformant ? 1 : 0), r.sso !== void 0 && (a.sso = r.sso ? 1 : 0), r.sso_disabled !== void 0 && (a.sso_disabled = r.sso_disabled ? 1 : 0), r.cross_origin_authentication !== void 0 && (a.cross_origin_authentication = r.cross_origin_authentication ? 1 : 0), r.custom_login_page_on !== void 0 && (a.custom_login_page_on = r.custom_login_page_on ? 1 : 0), r.require_pushed_authorization_requests !== void 0 && (a.require_pushed_authorization_requests = r.require_pushed_authorization_requests ? 1 : 0), r.require_proof_of_possession !== void 0 && (a.require_proof_of_possession = r.require_proof_of_possession ? 1 : 0), Ft(
932
+ return Un(
933
+ r,
934
+ [
935
+ "global",
936
+ "is_first_party",
937
+ "oidc_conformant",
938
+ "sso",
939
+ "sso_disabled",
940
+ "cross_origin_authentication",
941
+ "custom_login_page_on",
942
+ "require_pushed_authorization_requests",
943
+ "require_proof_of_possession"
944
+ ],
945
+ a
946
+ ), Ft(
925
947
  r,
926
948
  [
927
949
  "callbacks",
@@ -950,16 +972,16 @@ function Ka(t) {
950
972
  ), (await t.updateTable("clients").set(a).where("clients.tenant_id", "=", e).where("clients.client_id", "=", n).executeTakeFirst()).numUpdatedRows > 0;
951
973
  };
952
974
  }
953
- function Ua(t) {
975
+ function Qa(t) {
954
976
  return {
955
- create: Ma(t),
956
- get: qa(t),
957
- list: Ba(t),
958
- remove: Wa(t),
959
- update: Ka(t)
977
+ create: qa(t),
978
+ get: Ba(t),
979
+ list: Wa(t),
980
+ remove: Ka(t),
981
+ update: Ua(t)
960
982
  };
961
983
  }
962
- function Qa(t) {
984
+ function Va(t) {
963
985
  return async (e, n) => {
964
986
  const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), { scope: o, authorization_details_types: u, ...c } = n, l = {
965
987
  id: a,
@@ -987,7 +1009,7 @@ function Qa(t) {
987
1009
  });
988
1010
  };
989
1011
  }
990
- function Va(t) {
1012
+ function Ga(t) {
991
1013
  return async (e, n) => {
992
1014
  const r = await t.selectFrom("client_grants").selectAll().where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst();
993
1015
  if (!r)
@@ -1009,7 +1031,7 @@ function Va(t) {
1009
1031
  return T(a);
1010
1032
  };
1011
1033
  }
1012
- function Ga(t) {
1034
+ function Ya(t) {
1013
1035
  return async (e, n = {}) => {
1014
1036
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u, sort: c } = n;
1015
1037
  let l = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
@@ -1065,10 +1087,10 @@ function Ga(t) {
1065
1087
  };
1066
1088
  };
1067
1089
  }
1068
- function Ya(t) {
1090
+ function Ha(t) {
1069
1091
  return async (e, n) => ((await t.deleteFrom("client_grants").where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst()).numDeletedRows ?? 0n) > 0n;
1070
1092
  }
1071
- function Ha(t) {
1093
+ function Xa(t) {
1072
1094
  return async (e, n, r) => {
1073
1095
  const a = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...c } = r, l = {
1074
1096
  ...c,
@@ -1079,16 +1101,16 @@ function Ha(t) {
1079
1101
  )), c.allow_any_organization !== void 0 && (l.allow_any_organization = c.allow_any_organization ? 1 : 0), c.is_system !== void 0 && (l.is_system = c.is_system ? 1 : 0), ((await t.updateTable("client_grants").set(l).where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst()).numUpdatedRows ?? 0n) > 0n;
1080
1102
  };
1081
1103
  }
1082
- function Xa(t) {
1104
+ function Za(t) {
1083
1105
  return {
1084
- create: Qa(t),
1085
- get: Va(t),
1086
- list: Ga(t),
1087
- remove: Ya(t),
1088
- update: Ha(t)
1106
+ create: Va(t),
1107
+ get: Ga(t),
1108
+ list: Ya(t),
1109
+ remove: Ha(t),
1110
+ update: Xa(t)
1089
1111
  };
1090
1112
  }
1091
- function Za(t) {
1113
+ function eo(t) {
1092
1114
  return {
1093
1115
  get: async (e) => {
1094
1116
  const n = await t.selectFrom("clients").selectAll().where("client_id", "=", e).executeTakeFirst();
@@ -1112,7 +1134,7 @@ function Za(t) {
1112
1134
  require_proof_of_possession: !!n.require_proof_of_possession,
1113
1135
  // Parse JSON string fields back to objects/arrays
1114
1136
  connections: a.map(
1115
- (c) => Jr.parse(
1137
+ (c) => Mr.parse(
1116
1138
  T({
1117
1139
  ...c,
1118
1140
  options: c.options ? JSON.parse(c.options) : {}
@@ -1145,7 +1167,7 @@ function Za(t) {
1145
1167
  }
1146
1168
  };
1147
1169
  }
1148
- function eo(t) {
1170
+ function to(t) {
1149
1171
  return async (e = {}) => {
1150
1172
  const {
1151
1173
  page: n = 0,
@@ -1187,22 +1209,22 @@ function eo(t) {
1187
1209
  };
1188
1210
  };
1189
1211
  }
1190
- function to(t) {
1212
+ function no(t) {
1191
1213
  return async (e) => {
1192
1214
  await t.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
1193
1215
  };
1194
1216
  }
1195
- function no(t) {
1217
+ function ro(t) {
1196
1218
  return async (e, n) => !!(await t.updateTable("keys").set(n).where("kid", "=", e).execute()).length;
1197
1219
  }
1198
- function ro(t) {
1220
+ function ao(t) {
1199
1221
  return {
1200
- create: to(t),
1201
- list: eo(t),
1202
- update: no(t)
1222
+ create: no(t),
1223
+ list: to(t),
1224
+ update: ro(t)
1203
1225
  };
1204
1226
  }
1205
- function ao(t) {
1227
+ function oo(t) {
1206
1228
  return async (e, n) => {
1207
1229
  const r = {
1208
1230
  custom_domain_id: re(),
@@ -1219,16 +1241,16 @@ function ao(t) {
1219
1241
  }).execute(), r;
1220
1242
  };
1221
1243
  }
1222
- function oo(t) {
1244
+ function io(t) {
1223
1245
  return async (e) => (await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).selectAll().execute()).map((r) => ({
1224
1246
  ...r,
1225
1247
  primary: r.primary === 1
1226
1248
  }));
1227
1249
  }
1228
- function io(t) {
1250
+ function so(t) {
1229
1251
  return async (e, n) => (await t.deleteFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", n).execute()).length > 0;
1230
1252
  }
1231
- function so(t) {
1253
+ function uo(t) {
1232
1254
  return async (e, n) => {
1233
1255
  const r = await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", n).selectAll().executeTakeFirst();
1234
1256
  return r ? {
@@ -1237,7 +1259,7 @@ function so(t) {
1237
1259
  } : null;
1238
1260
  };
1239
1261
  }
1240
- function uo(t) {
1262
+ function co(t) {
1241
1263
  return async (e, n, r) => {
1242
1264
  const a = {
1243
1265
  ...r,
@@ -1247,7 +1269,7 @@ function uo(t) {
1247
1269
  return (await t.updateTable("custom_domains").set(a).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", n).execute()).length > 0;
1248
1270
  };
1249
1271
  }
1250
- function co(t) {
1272
+ function lo(t) {
1251
1273
  return async (e) => {
1252
1274
  const n = await t.selectFrom("custom_domains").where("custom_domains.domain", "=", e).selectAll().executeTakeFirst();
1253
1275
  return n ? {
@@ -1256,17 +1278,17 @@ function co(t) {
1256
1278
  } : null;
1257
1279
  };
1258
1280
  }
1259
- function lo(t) {
1281
+ function _o(t) {
1260
1282
  return {
1261
- create: ao(t),
1262
- get: so(t),
1263
- getByDomain: co(t),
1264
- list: oo(t),
1265
- remove: io(t),
1266
- update: uo(t)
1283
+ create: oo(t),
1284
+ get: uo(t),
1285
+ getByDomain: lo(t),
1286
+ list: io(t),
1287
+ remove: so(t),
1288
+ update: co(t)
1267
1289
  };
1268
1290
  }
1269
- function _o(t) {
1291
+ function mo(t) {
1270
1292
  return async (e) => {
1271
1293
  const [n] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
1272
1294
  if (!n)
@@ -1296,7 +1318,7 @@ function _o(t) {
1296
1318
  });
1297
1319
  };
1298
1320
  }
1299
- function mo(t) {
1321
+ function ho(t) {
1300
1322
  return async (e, n) => {
1301
1323
  var u, c, l, h, g, d, y, f, v, x, E, D, ae, U, pe, Nt, ge, nt;
1302
1324
  const { colors: r, font: a, ...o } = n;
@@ -1324,13 +1346,13 @@ function mo(t) {
1324
1346
  }
1325
1347
  };
1326
1348
  }
1327
- function ho(t) {
1349
+ function fo(t) {
1328
1350
  return {
1329
- get: _o(t),
1330
- set: mo(t)
1351
+ get: mo(t),
1352
+ set: ho(t)
1331
1353
  };
1332
1354
  }
1333
- function fo(t) {
1355
+ function po(t) {
1334
1356
  return async (e, n = {}) => {
1335
1357
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1336
1358
  let c = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
@@ -1359,7 +1381,7 @@ function fo(t) {
1359
1381
  };
1360
1382
  };
1361
1383
  }
1362
- function po(t) {
1384
+ function go(t) {
1363
1385
  return async (e, n) => {
1364
1386
  const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
1365
1387
  return r ? T({
@@ -1369,13 +1391,13 @@ function po(t) {
1369
1391
  }) : null;
1370
1392
  };
1371
1393
  }
1372
- function go(t) {
1394
+ function yo(t) {
1373
1395
  return async (e, n) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
1374
1396
  }
1375
- function yo(t) {
1397
+ function wo(t) {
1376
1398
  return async (e, n) => {
1377
1399
  const r = {
1378
- hook_id: n.hook_id || $a(),
1400
+ hook_id: n.hook_id || Da(),
1379
1401
  ...n,
1380
1402
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
1381
1403
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -1388,7 +1410,7 @@ function yo(t) {
1388
1410
  }).execute(), r;
1389
1411
  };
1390
1412
  }
1391
- function wo(t) {
1413
+ function No(t) {
1392
1414
  return async (e, n, r) => {
1393
1415
  const a = {
1394
1416
  ...r,
@@ -1399,16 +1421,16 @@ function wo(t) {
1399
1421
  return await t.updateTable("hooks").set(a).where("hooks.hook_id", "=", n).where("hooks.tenant_id", "=", e).execute(), !0;
1400
1422
  };
1401
1423
  }
1402
- function No(t) {
1424
+ function vo(t) {
1403
1425
  return {
1404
- create: yo(t),
1405
- get: po(t),
1406
- list: fo(t),
1407
- update: wo(t),
1408
- remove: go(t)
1426
+ create: wo(t),
1427
+ get: go(t),
1428
+ list: po(t),
1429
+ update: No(t),
1430
+ remove: yo(t)
1409
1431
  };
1410
1432
  }
1411
- function vo(t) {
1433
+ function Co(t) {
1412
1434
  return async (e, n) => {
1413
1435
  const r = {
1414
1436
  themeId: re(),
@@ -1422,10 +1444,10 @@ function vo(t) {
1422
1444
  return await t.insertInto("themes").values(et(a)).execute(), r;
1423
1445
  };
1424
1446
  }
1425
- function Co(t) {
1447
+ function xo(t) {
1426
1448
  return async (e, n) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", n).executeTakeFirst()).numDeletedRows > 0;
1427
1449
  }
1428
- function xo(t) {
1450
+ function bo(t) {
1429
1451
  return async (e, n) => {
1430
1452
  const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", n).selectAll().executeTakeFirst();
1431
1453
  if (!r)
@@ -1451,7 +1473,7 @@ function xo(t) {
1451
1473
  );
1452
1474
  };
1453
1475
  }
1454
- function bo(t) {
1476
+ function Oo(t) {
1455
1477
  return async (e, n, r) => {
1456
1478
  const a = et({
1457
1479
  ...r,
@@ -1460,18 +1482,18 @@ function bo(t) {
1460
1482
  return await t.updateTable("themes").set(a).where("themes.themeId", "=", n).where("themes.tenant_id", "=", e).execute(), !0;
1461
1483
  };
1462
1484
  }
1463
- function Oo(t) {
1485
+ function To(t) {
1464
1486
  return {
1465
- create: vo(t),
1466
- get: xo(t),
1467
- remove: Co(t),
1468
- update: bo(t)
1487
+ create: Co(t),
1488
+ get: bo(t),
1489
+ remove: xo(t),
1490
+ update: Oo(t)
1469
1491
  };
1470
1492
  }
1471
- function To(t) {
1493
+ function So(t) {
1472
1494
  return async (e, n) => {
1473
1495
  const r = await t.selectFrom("login_sessions").where("login_sessions.id", "=", n).selectAll().executeTakeFirst();
1474
- return r ? Mr.parse(
1496
+ return r ? qr.parse(
1475
1497
  Kn(
1476
1498
  T({
1477
1499
  ...r,
@@ -1482,7 +1504,7 @@ function To(t) {
1482
1504
  ) : null;
1483
1505
  };
1484
1506
  }
1485
- function So(t) {
1507
+ function ko(t) {
1486
1508
  return async (e, n) => {
1487
1509
  var a;
1488
1510
  const r = {
@@ -1499,25 +1521,25 @@ function So(t) {
1499
1521
  }).execute(), r;
1500
1522
  };
1501
1523
  }
1502
- function ko(t) {
1524
+ function Eo(t) {
1503
1525
  return async (e, n, r) => (await t.updateTable("login_sessions").set(
1504
1526
  et({
1505
1527
  ...r
1506
1528
  })
1507
1529
  ).where("login_sessions.id", "=", n).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
1508
1530
  }
1509
- function Eo(t) {
1531
+ function Io(t) {
1510
1532
  return async (e, n) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", n).execute()).length > 0;
1511
1533
  }
1512
- function Io(t) {
1534
+ function Ao(t) {
1513
1535
  return {
1514
- create: So(t),
1515
- get: To(t),
1516
- update: ko(t),
1517
- remove: Eo(t)
1536
+ create: ko(t),
1537
+ get: So(t),
1538
+ update: Eo(t),
1539
+ remove: Io(t)
1518
1540
  };
1519
1541
  }
1520
- function Ao(t) {
1542
+ function Po(t) {
1521
1543
  return async (e) => {
1522
1544
  const [n] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
1523
1545
  return T({
@@ -1537,10 +1559,10 @@ function xn(t) {
1537
1559
  universal_login_experience: t.universal_login_experience
1538
1560
  });
1539
1561
  }
1540
- function Po(t) {
1562
+ function $o(t) {
1541
1563
  return async (e, n) => {
1542
1564
  try {
1543
- const r = qr.parse(n);
1565
+ const r = Br.parse(n);
1544
1566
  await t.insertInto("prompt_settings").values({
1545
1567
  ...xn(r),
1546
1568
  tenant_id: e
@@ -1550,13 +1572,13 @@ function Po(t) {
1550
1572
  }
1551
1573
  };
1552
1574
  }
1553
- function $o(t) {
1575
+ function Do(t) {
1554
1576
  return {
1555
- get: Ao(t),
1556
- set: Po(t)
1577
+ get: Po(t),
1578
+ set: $o(t)
1557
1579
  };
1558
1580
  }
1559
- function Do(t) {
1581
+ function zo(t) {
1560
1582
  return async (e) => {
1561
1583
  const [n] = await t.selectFrom("email_providers").where("email_providers.tenant_id", "=", e).selectAll().execute();
1562
1584
  if (!n)
@@ -1576,7 +1598,7 @@ function Do(t) {
1576
1598
  });
1577
1599
  };
1578
1600
  }
1579
- function zo(t) {
1601
+ function Ro(t) {
1580
1602
  return async (e, n) => {
1581
1603
  const { credentials: r, settings: a, enabled: o, ...u } = n;
1582
1604
  await t.updateTable("email_providers").set({
@@ -1587,7 +1609,7 @@ function zo(t) {
1587
1609
  }).where("tenant_id", "=", e).execute();
1588
1610
  };
1589
1611
  }
1590
- function Ro(t) {
1612
+ function Fo(t) {
1591
1613
  return async (e, n) => {
1592
1614
  const { credentials: r, settings: a, enabled: o, ...u } = n;
1593
1615
  await t.insertInto("email_providers").values({
@@ -1601,14 +1623,14 @@ function Ro(t) {
1601
1623
  }).execute();
1602
1624
  };
1603
1625
  }
1604
- function Fo(t) {
1626
+ function jo(t) {
1605
1627
  return {
1606
- get: Do(t),
1607
- create: Ro(t),
1608
- update: zo(t)
1628
+ get: zo(t),
1629
+ create: Fo(t),
1630
+ update: Ro(t)
1609
1631
  };
1610
1632
  }
1611
- function jo(t) {
1633
+ function Lo(t) {
1612
1634
  return async (e, n) => {
1613
1635
  const r = await t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e).where("refresh_tokens.id", "=", n).selectAll().executeTakeFirst();
1614
1636
  return r ? {
@@ -1619,7 +1641,7 @@ function jo(t) {
1619
1641
  } : null;
1620
1642
  };
1621
1643
  }
1622
- function Lo(t) {
1644
+ function Jo(t) {
1623
1645
  return async (e, n) => {
1624
1646
  const r = {
1625
1647
  ...n,
@@ -1634,10 +1656,10 @@ function Lo(t) {
1634
1656
  }).execute(), { ...n, ...r };
1635
1657
  };
1636
1658
  }
1637
- function Jo(t) {
1659
+ function Mo(t) {
1638
1660
  return async (e, n) => !!(await t.deleteFrom("refresh_tokens").where("tenant_id", "=", e).where("refresh_tokens.id", "=", n).execute()).length;
1639
1661
  }
1640
- function Mo(t) {
1662
+ function qo(t) {
1641
1663
  return async (e, n, r) => {
1642
1664
  const a = {
1643
1665
  ...r,
@@ -1648,7 +1670,7 @@ function Mo(t) {
1648
1670
  return !!(await t.updateTable("refresh_tokens").set(a).where("tenant_id", "=", e).where("refresh_tokens.id", "=", n).execute()).length;
1649
1671
  };
1650
1672
  }
1651
- function qo(t) {
1673
+ function Bo(t) {
1652
1674
  return async (e, n = {}) => {
1653
1675
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
1654
1676
  let l = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
@@ -1681,16 +1703,16 @@ function qo(t) {
1681
1703
  };
1682
1704
  };
1683
1705
  }
1684
- function Bo(t) {
1706
+ function Wo(t) {
1685
1707
  return {
1686
- create: Lo(t),
1687
- get: jo(t),
1688
- list: qo(t),
1689
- remove: Jo(t),
1690
- update: Mo(t)
1708
+ create: Jo(t),
1709
+ get: Lo(t),
1710
+ list: Bo(t),
1711
+ remove: Mo(t),
1712
+ update: qo(t)
1691
1713
  };
1692
1714
  }
1693
- function Wo(t) {
1715
+ function Ko(t) {
1694
1716
  return async () => {
1695
1717
  const e = new Date(Date.now() - 864e5).toISOString(), n = new Date(
1696
1718
  Date.now() - 1e3 * 60 * 60 * 24 * 7
@@ -1720,7 +1742,7 @@ function Wo(t) {
1720
1742
  ).execute(), console.log("cleanup complete");
1721
1743
  };
1722
1744
  }
1723
- function Ko(t) {
1745
+ function Uo(t) {
1724
1746
  return async (e, n) => {
1725
1747
  const r = xt.parse({
1726
1748
  id: re(),
@@ -1738,7 +1760,7 @@ function Ko(t) {
1738
1760
  }).execute(), xt.parse(r);
1739
1761
  };
1740
1762
  }
1741
- function Uo(t) {
1763
+ function Qo(t) {
1742
1764
  return async (e, n = {}) => {
1743
1765
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1744
1766
  let c = t.selectFrom("forms").where("tenant_id", "=", e);
@@ -1778,13 +1800,13 @@ function Uo(t) {
1778
1800
  };
1779
1801
  };
1780
1802
  }
1781
- function Qo(t) {
1803
+ function Vo(t) {
1782
1804
  return async (e, n) => {
1783
1805
  const { numDeletedRows: r } = await t.deleteFrom("forms").where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1784
1806
  return r > 0;
1785
1807
  };
1786
1808
  }
1787
- function Vo(t) {
1809
+ function Go(t) {
1788
1810
  return async (e, n) => {
1789
1811
  const r = await t.selectFrom("forms").selectAll().where("forms.id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1790
1812
  if (!r) return null;
@@ -1807,7 +1829,7 @@ function Vo(t) {
1807
1829
  return xt.parse(T(a));
1808
1830
  };
1809
1831
  }
1810
- function Go(t) {
1832
+ function Yo(t) {
1811
1833
  return async (e, n, r) => {
1812
1834
  const a = {
1813
1835
  ...r,
@@ -1818,23 +1840,23 @@ function Go(t) {
1818
1840
  return o > 0;
1819
1841
  };
1820
1842
  }
1821
- function Yo(t) {
1843
+ function Ho(t) {
1822
1844
  return {
1823
- create: Ko(t),
1824
- get: Vo(t),
1825
- list: Uo(t),
1826
- remove: Qo(t),
1827
- update: Go(t)
1845
+ create: Uo(t),
1846
+ get: Go(t),
1847
+ list: Qo(t),
1848
+ remove: Vo(t),
1849
+ update: Yo(t)
1828
1850
  };
1829
1851
  }
1830
- function Ho(t) {
1852
+ function Xo(t) {
1831
1853
  return async (e, n) => {
1832
1854
  const r = (/* @__PURE__ */ new Date()).toISOString(), a = {
1833
- id: Da(),
1855
+ id: za(),
1834
1856
  ...n,
1835
1857
  created_at: r,
1836
1858
  updated_at: r
1837
- }, o = Br.parse(a), {
1859
+ }, o = Wr.parse(a), {
1838
1860
  verificationKey: u,
1839
1861
  scopes: c,
1840
1862
  options: l,
@@ -1855,7 +1877,7 @@ function Ho(t) {
1855
1877
  return await t.insertInto("resource_servers").values(y).execute(), T(o);
1856
1878
  };
1857
1879
  }
1858
- function Xo(t) {
1880
+ function Zo(t) {
1859
1881
  return async (e, n) => {
1860
1882
  const r = await t.selectFrom("resource_servers").selectAll().where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
1861
1883
  if (!r) return null;
@@ -1878,7 +1900,7 @@ function Xo(t) {
1878
1900
  return T(d);
1879
1901
  };
1880
1902
  }
1881
- function Zo(t) {
1903
+ function ei(t) {
1882
1904
  return async (e, n = {}) => {
1883
1905
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1884
1906
  let c = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
@@ -1928,13 +1950,13 @@ function Zo(t) {
1928
1950
  };
1929
1951
  };
1930
1952
  }
1931
- function ei(t) {
1953
+ function ti(t) {
1932
1954
  return async (e, n) => {
1933
1955
  const r = await t.deleteFrom("resource_servers").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
1934
1956
  return Number(r.numDeletedRows) > 0;
1935
1957
  };
1936
1958
  }
1937
- function ti(t) {
1959
+ function ni(t) {
1938
1960
  return async (e, n, r) => {
1939
1961
  const {
1940
1962
  verificationKey: a,
@@ -1956,16 +1978,16 @@ function ti(t) {
1956
1978
  return Number(d.numUpdatedRows) > 0;
1957
1979
  };
1958
1980
  }
1959
- function ni(t) {
1981
+ function ri(t) {
1960
1982
  return {
1961
- create: Ho(t),
1962
- get: Xo(t),
1963
- list: Zo(t),
1964
- remove: ei(t),
1965
- update: ti(t)
1983
+ create: Xo(t),
1984
+ get: Zo(t),
1985
+ list: ei(t),
1986
+ remove: ti(t),
1987
+ update: ni(t)
1966
1988
  };
1967
1989
  }
1968
- function ri(t) {
1990
+ function ai(t) {
1969
1991
  return async (e, n) => {
1970
1992
  const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), o = {
1971
1993
  id: a,
@@ -1982,7 +2004,7 @@ function ri(t) {
1982
2004
  };
1983
2005
  };
1984
2006
  }
1985
- function ai(t) {
2007
+ function oi(t) {
1986
2008
  return async (e, n) => {
1987
2009
  const r = await t.selectFrom("roles").selectAll().where("roles.tenant_id", "=", e).where("roles.id", "=", n).executeTakeFirst();
1988
2010
  return r ? {
@@ -1990,7 +2012,7 @@ function ai(t) {
1990
2012
  } : null;
1991
2013
  };
1992
2014
  }
1993
- function oi(t) {
2015
+ function ii(t) {
1994
2016
  return async (e, n) => {
1995
2017
  let r = t.selectFrom("roles").where("roles.tenant_id", "=", e);
1996
2018
  const { page: a = 0, per_page: o = 50, include_totals: u = !1 } = n;
@@ -2012,7 +2034,7 @@ function oi(t) {
2012
2034
  };
2013
2035
  };
2014
2036
  }
2015
- function ii(t) {
2037
+ function si(t) {
2016
2038
  return async (e, n, r) => {
2017
2039
  const a = {
2018
2040
  ...r,
@@ -2021,22 +2043,22 @@ function ii(t) {
2021
2043
  return Number(o.numUpdatedRows) > 0;
2022
2044
  };
2023
2045
  }
2024
- function si(t) {
2046
+ function ui(t) {
2025
2047
  return async (e, n) => {
2026
2048
  const r = await t.deleteFrom("roles").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2027
2049
  return Number(r.numDeletedRows) > 0;
2028
2050
  };
2029
2051
  }
2030
- function ui(t) {
2052
+ function ci(t) {
2031
2053
  return {
2032
- create: ri(t),
2033
- get: ai(t),
2034
- list: oi(t),
2035
- update: ii(t),
2036
- remove: si(t)
2054
+ create: ai(t),
2055
+ get: oi(t),
2056
+ list: ii(t),
2057
+ update: si(t),
2058
+ remove: ui(t)
2037
2059
  };
2038
2060
  }
2039
- function ci(t) {
2061
+ function li(t) {
2040
2062
  return async (e, n, r) => {
2041
2063
  if (r.length === 0) return !0;
2042
2064
  const a = (/* @__PURE__ */ new Date()).toISOString();
@@ -2067,7 +2089,7 @@ function ci(t) {
2067
2089
  }
2068
2090
  };
2069
2091
  }
2070
- function li(t) {
2092
+ function di(t) {
2071
2093
  return async (e, n, r) => {
2072
2094
  if (r.length === 0) return !0;
2073
2095
  try {
@@ -2085,7 +2107,7 @@ function li(t) {
2085
2107
  }
2086
2108
  };
2087
2109
  }
2088
- function di(t) {
2110
+ function _i(t) {
2089
2111
  return async (e, n, r = {}) => {
2090
2112
  const { page: a = 0, per_page: o = 50, include_totals: u = !1 } = r;
2091
2113
  let c = t.selectFrom("role_permissions").leftJoin(
@@ -2119,14 +2141,14 @@ function di(t) {
2119
2141
  return u && await c.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), g;
2120
2142
  };
2121
2143
  }
2122
- function _i(t) {
2144
+ function mi(t) {
2123
2145
  return {
2124
- assign: ci(t),
2125
- remove: li(t),
2126
- list: di(t)
2146
+ assign: li(t),
2147
+ remove: di(t),
2148
+ list: _i(t)
2127
2149
  };
2128
2150
  }
2129
- function mi(t) {
2151
+ function hi(t) {
2130
2152
  return async (e, n, r, a) => {
2131
2153
  const o = (/* @__PURE__ */ new Date()).toISOString();
2132
2154
  try {
@@ -2144,7 +2166,7 @@ function mi(t) {
2144
2166
  }
2145
2167
  };
2146
2168
  }
2147
- function hi(t) {
2169
+ function fi(t) {
2148
2170
  return async (e, n, r, a) => {
2149
2171
  try {
2150
2172
  let o = t.deleteFrom("user_permissions").where("tenant_id", "=", e).where("user_id", "=", n).where(
@@ -2158,7 +2180,7 @@ function hi(t) {
2158
2180
  }
2159
2181
  };
2160
2182
  }
2161
- function fi(t) {
2183
+ function pi(t) {
2162
2184
  return async (e, n, r, a) => {
2163
2185
  let o = t.selectFrom("user_permissions").leftJoin(
2164
2186
  "resource_servers",
@@ -2196,22 +2218,22 @@ function fi(t) {
2196
2218
  }));
2197
2219
  };
2198
2220
  }
2199
- function pi(t) {
2221
+ function gi(t) {
2200
2222
  return {
2201
- create: mi(t),
2202
- remove: hi(t),
2203
- list: fi(t)
2223
+ create: hi(t),
2224
+ remove: fi(t),
2225
+ list: pi(t)
2204
2226
  };
2205
2227
  }
2206
- function gi(t) {
2207
- const e = pi(t);
2228
+ function yi(t) {
2229
+ const e = gi(t);
2208
2230
  return {
2209
2231
  create: (n, r, a, o) => e.create(n, r, a, o),
2210
2232
  remove: (n, r, a, o) => e.remove(n, r, a, o),
2211
2233
  list: (n, r, a, o) => e.list(n, r, a, o)
2212
2234
  };
2213
2235
  }
2214
- function yi(t) {
2236
+ function wi(t) {
2215
2237
  return async (e, n, r, a) => {
2216
2238
  let o = t.selectFrom("user_roles as ur").innerJoin(
2217
2239
  "roles as r",
@@ -2226,7 +2248,7 @@ function yi(t) {
2226
2248
  return a !== void 0 && (o = o.where("ur.organization_id", "=", a)), await o.execute();
2227
2249
  };
2228
2250
  }
2229
- function wi(t) {
2251
+ function Ni(t) {
2230
2252
  return async (e, n, r, a) => {
2231
2253
  const o = (/* @__PURE__ */ new Date()).toISOString();
2232
2254
  try {
@@ -2242,7 +2264,7 @@ function wi(t) {
2242
2264
  }
2243
2265
  };
2244
2266
  }
2245
- function Ni(t) {
2267
+ function vi(t) {
2246
2268
  return async (e, n, r, a) => {
2247
2269
  try {
2248
2270
  let o = t.deleteFrom("user_roles").where("tenant_id", "=", e).where("user_id", "=", n).where("role_id", "=", r);
@@ -2252,26 +2274,26 @@ function Ni(t) {
2252
2274
  }
2253
2275
  };
2254
2276
  }
2255
- function vi(t) {
2277
+ function Ci(t) {
2256
2278
  return {
2257
- list: yi(t),
2258
- create: wi(t),
2259
- remove: Ni(t)
2279
+ list: wi(t),
2280
+ create: Ni(t),
2281
+ remove: vi(t)
2260
2282
  };
2261
2283
  }
2262
- function Ci(t) {
2263
- const e = vi(t);
2284
+ function xi(t) {
2285
+ const e = Ci(t);
2264
2286
  return {
2265
2287
  list: (n, r, a, o) => e.list(n, r, a, o),
2266
2288
  create: (n, r, a, o) => e.create(n, r, a, o),
2267
2289
  remove: (n, r, a, o) => e.remove(n, r, a, o)
2268
2290
  };
2269
2291
  }
2270
- function xi(t) {
2292
+ function bi(t) {
2271
2293
  return async (e, n) => {
2272
2294
  const r = {
2273
2295
  ...n,
2274
- id: n.id || Aa(),
2296
+ id: n.id || Pa(),
2275
2297
  tenant_id: e,
2276
2298
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
2277
2299
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -2297,7 +2319,7 @@ function xi(t) {
2297
2319
  };
2298
2320
  };
2299
2321
  }
2300
- function bi(t) {
2322
+ function Oi(t) {
2301
2323
  return async (e, n) => {
2302
2324
  const r = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2303
2325
  return r ? T({
@@ -2309,7 +2331,7 @@ function bi(t) {
2309
2331
  }) : null;
2310
2332
  };
2311
2333
  }
2312
- function Oi(t) {
2334
+ function Ti(t) {
2313
2335
  return async (e, n) => {
2314
2336
  let r = t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).orderBy("created_at", "desc");
2315
2337
  if (n != null && n.per_page && (r = r.limit(n.per_page)), n != null && n.page) {
@@ -2333,10 +2355,10 @@ function Oi(t) {
2333
2355
  };
2334
2356
  };
2335
2357
  }
2336
- function Ti(t) {
2358
+ function Si(t) {
2337
2359
  return async (e, n) => (await t.deleteFrom("organizations").where("tenant_id", "=", e).where("id", "=", n).execute()).length > 0;
2338
2360
  }
2339
- function Si(t) {
2361
+ function ki(t) {
2340
2362
  return async (e, n, r) => {
2341
2363
  const { branding: a, metadata: o, enabled_connections: u, token_quota: c, ...l } = r, h = {
2342
2364
  ...l,
@@ -2349,16 +2371,16 @@ function Si(t) {
2349
2371
  ), (await t.updateTable("organizations").set(h).where("tenant_id", "=", e).where("id", "=", n).execute()).length > 0;
2350
2372
  };
2351
2373
  }
2352
- function ki(t) {
2374
+ function Ei(t) {
2353
2375
  return {
2354
- create: xi(t),
2355
- get: bi(t),
2356
- list: Oi(t),
2357
- remove: Ti(t),
2358
- update: Si(t)
2376
+ create: bi(t),
2377
+ get: Oi(t),
2378
+ list: Ti(t),
2379
+ remove: Si(t),
2380
+ update: ki(t)
2359
2381
  };
2360
2382
  }
2361
- function Ei(t) {
2383
+ function Ii(t) {
2362
2384
  return async (e, n) => {
2363
2385
  const r = {
2364
2386
  id: re(),
@@ -2380,7 +2402,7 @@ function Ei(t) {
2380
2402
  };
2381
2403
  };
2382
2404
  }
2383
- function Ii(t) {
2405
+ function Ai(t) {
2384
2406
  return async (e, n) => {
2385
2407
  const r = await t.selectFrom("user_organizations").selectAll().where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
2386
2408
  return r ? {
@@ -2392,7 +2414,7 @@ function Ii(t) {
2392
2414
  } : null;
2393
2415
  };
2394
2416
  }
2395
- function Ai(t) {
2417
+ function Pi(t) {
2396
2418
  return async (e, n) => {
2397
2419
  const r = (n == null ? void 0 : n.page) || 0, a = (n == null ? void 0 : n.per_page) || 50, o = r * a;
2398
2420
  let u = t.selectFrom("user_organizations").selectAll().where("tenant_id", "=", e);
@@ -2432,7 +2454,7 @@ function Ai(t) {
2432
2454
  };
2433
2455
  };
2434
2456
  }
2435
- function Pi(t) {
2457
+ function $i(t) {
2436
2458
  return async (e, n, r) => {
2437
2459
  const a = (r == null ? void 0 : r.page) || 0, o = (r == null ? void 0 : r.per_page) || 50, u = a * o;
2438
2460
  let c = t.selectFrom("user_organizations").innerJoin(
@@ -2477,10 +2499,10 @@ function Pi(t) {
2477
2499
  };
2478
2500
  };
2479
2501
  }
2480
- function $i(t) {
2502
+ function Di(t) {
2481
2503
  return async (e, n) => (await t.deleteFrom("user_organizations").where("id", "=", n).where("tenant_id", "=", e).execute()).length > 0;
2482
2504
  }
2483
- function Di(t) {
2505
+ function zi(t) {
2484
2506
  return async (e, n, r) => {
2485
2507
  const a = {
2486
2508
  ...r,
@@ -2489,15 +2511,15 @@ function Di(t) {
2489
2511
  return (await t.updateTable("user_organizations").set(a).where("id", "=", n).where("tenant_id", "=", e).execute()).length > 0;
2490
2512
  };
2491
2513
  }
2492
- function zi(t) {
2514
+ function Ri(t) {
2493
2515
  return {
2494
2516
  // CRUD operations
2495
- create: Ei(t),
2496
- get: Ii(t),
2497
- list: Ai(t),
2498
- listUserOrganizations: Pi(t),
2499
- remove: $i(t),
2500
- update: Di(t)
2517
+ create: Ii(t),
2518
+ get: Ai(t),
2519
+ list: Pi(t),
2520
+ listUserOrganizations: $i(t),
2521
+ remove: Di(t),
2522
+ update: zi(t)
2501
2523
  };
2502
2524
  }
2503
2525
  function bt(t) {
@@ -2509,13 +2531,13 @@ function G(t) {
2509
2531
  function mn(t) {
2510
2532
  return typeof t == "number";
2511
2533
  }
2512
- function Gn(t) {
2534
+ function Yn(t) {
2513
2535
  return typeof t == "boolean";
2514
2536
  }
2515
- function Yn(t) {
2537
+ function Hn(t) {
2516
2538
  return t === null;
2517
2539
  }
2518
- function Hn(t) {
2540
+ function Xn(t) {
2519
2541
  return typeof t == "bigint";
2520
2542
  }
2521
2543
  function Ee(t) {
@@ -2524,7 +2546,7 @@ function Ee(t) {
2524
2546
  function Lt(t) {
2525
2547
  return typeof t == "object" && t !== null;
2526
2548
  }
2527
- function Ri(t) {
2549
+ function Fi(t) {
2528
2550
  return t[t.length - 1];
2529
2551
  }
2530
2552
  function s(t) {
@@ -2594,10 +2616,10 @@ const R = s({
2594
2616
  function M(t) {
2595
2617
  return Lt(t) && Ee(t.toOperationNode);
2596
2618
  }
2597
- function Fi(t) {
2619
+ function ji(t) {
2598
2620
  return Lt(t) && "expressionType" in t && M(t);
2599
2621
  }
2600
- function ji(t) {
2622
+ function Li(t) {
2601
2623
  return Lt(t) && "expression" in t && G(t.alias) && M(t);
2602
2624
  }
2603
2625
  const Y = s({
@@ -2693,7 +2715,7 @@ const Y = s({
2693
2715
  rightOperand: n
2694
2716
  });
2695
2717
  }
2696
- }), Li = [
2718
+ }), Ji = [
2697
2719
  "=",
2698
2720
  "==",
2699
2721
  "!=",
@@ -2732,7 +2754,7 @@ const Y = s({
2732
2754
  "regexp",
2733
2755
  "is distinct from",
2734
2756
  "is not distinct from"
2735
- ], Ji = [
2757
+ ], Mi = [
2736
2758
  "+",
2737
2759
  "-",
2738
2760
  "*",
@@ -2744,15 +2766,15 @@ const Y = s({
2744
2766
  "#",
2745
2767
  "<<",
2746
2768
  ">>"
2747
- ], Xn = ["->", "->>"], Mi = [
2748
- ...Li,
2769
+ ], Zn = ["->", "->>"], qi = [
2749
2770
  ...Ji,
2771
+ ...Mi,
2750
2772
  "&&",
2751
2773
  "||"
2752
- ], qi = ["exists", "not exists"], Bi = ["not", "-", ...qi], Wi = [
2753
- ...Mi,
2754
- ...Xn,
2755
- ...Bi,
2774
+ ], Bi = ["exists", "not exists"], Wi = ["not", "-", ...Bi], Ki = [
2775
+ ...qi,
2776
+ ...Zn,
2777
+ ...Wi,
2756
2778
  "between",
2757
2779
  "between symmetric"
2758
2780
  ], ke = s({
@@ -2767,7 +2789,7 @@ const Y = s({
2767
2789
  }
2768
2790
  });
2769
2791
  function bn(t) {
2770
- return G(t) && Xn.includes(t);
2792
+ return G(t) && Zn.includes(t);
2771
2793
  }
2772
2794
  const hn = s({
2773
2795
  is(t) {
@@ -2779,7 +2801,7 @@ const hn = s({
2779
2801
  column: R.create(t)
2780
2802
  });
2781
2803
  }
2782
- }), Zn = s({
2804
+ }), er = s({
2783
2805
  is(t) {
2784
2806
  return t.kind === "SelectAllNode";
2785
2807
  },
@@ -2803,11 +2825,11 @@ const hn = s({
2803
2825
  return s({
2804
2826
  kind: "ReferenceNode",
2805
2827
  table: t,
2806
- column: Zn.create()
2828
+ column: er.create()
2807
2829
  });
2808
2830
  }
2809
2831
  });
2810
- function er(t) {
2832
+ function tr(t) {
2811
2833
  return Lt(t) && M(t) && G(t.dynamicReference);
2812
2834
  }
2813
2835
  const Ht = s({
@@ -2842,10 +2864,10 @@ const Ht = s({
2842
2864
  return z.create(new Array(t.length + 1).fill(""), t);
2843
2865
  }
2844
2866
  });
2845
- function Ki(t) {
2867
+ function Ui(t) {
2846
2868
  return t === "asc" || t === "desc";
2847
2869
  }
2848
- function tr(t) {
2870
+ function nr(t) {
2849
2871
  if (t.length === 2)
2850
2872
  return [Qt(t[0], t[1])];
2851
2873
  if (t.length === 1) {
@@ -2855,28 +2877,28 @@ function tr(t) {
2855
2877
  throw new Error(`Invalid number of arguments at order by! expected 1-2, received ${t.length}`);
2856
2878
  }
2857
2879
  function Qt(t, e) {
2858
- const n = Ui(t);
2880
+ const n = Qi(t);
2859
2881
  if (Ht.is(n)) {
2860
2882
  if (e)
2861
2883
  throw new Error("Cannot specify direction twice!");
2862
2884
  return n;
2863
2885
  }
2864
- return Ht.create(n, nr(e));
2886
+ return Ht.create(n, rr(e));
2865
2887
  }
2866
- function Ui(t) {
2888
+ function Qi(t) {
2867
2889
  if (Wt(t))
2868
2890
  return Bt(t);
2869
- if (er(t))
2891
+ if (tr(t))
2870
2892
  return t.toOperationNode();
2871
2893
  const [e, n] = t.split(" ");
2872
2894
  if (n) {
2873
- if (!Ki(n))
2895
+ if (!Ui(n))
2874
2896
  throw new Error(`Invalid order by direction: ${n}`);
2875
- return Ht.create(me(e), nr(n));
2897
+ return Ht.create(me(e), rr(n));
2876
2898
  }
2877
2899
  return me(t);
2878
2900
  }
2879
- function nr(t) {
2901
+ function rr(t) {
2880
2902
  if (t)
2881
2903
  return t === "asc" || t === "desc" ? z.createWithSql(t) : t.toOperationNode();
2882
2904
  }
@@ -2897,7 +2919,7 @@ const Ot = s({
2897
2919
  traversal: e
2898
2920
  });
2899
2921
  }
2900
- }), rr = s({
2922
+ }), ar = s({
2901
2923
  is(t) {
2902
2924
  return t.kind === "JSONOperatorChainNode";
2903
2925
  },
@@ -2932,19 +2954,19 @@ const Ot = s({
2932
2954
  });
2933
2955
  }
2934
2956
  });
2935
- function Qi(t) {
2957
+ function Vi(t) {
2936
2958
  return G(t) ? me(t) : t.toOperationNode();
2937
2959
  }
2938
2960
  function _t(t) {
2939
2961
  return de(t) ? t.map((e) => j(e)) : [j(t)];
2940
2962
  }
2941
2963
  function j(t) {
2942
- return Wt(t) ? Bt(t) : Qi(t);
2964
+ return Wt(t) ? Bt(t) : Vi(t);
2943
2965
  }
2944
- function Vi(t, e) {
2966
+ function Gi(t, e) {
2945
2967
  const n = me(t);
2946
2968
  if (bn(e))
2947
- return Ot.create(n, rr.create(ke.create(e)));
2969
+ return Ot.create(n, ar.create(ke.create(e)));
2948
2970
  const r = e.slice(0, -1);
2949
2971
  if (bn(r))
2950
2972
  return Ot.create(n, it.create(ke.create(r)));
@@ -2954,33 +2976,33 @@ function me(t) {
2954
2976
  const e = ".";
2955
2977
  if (!t.includes(e))
2956
2978
  return Jt.create(hn.create(t));
2957
- const n = t.split(e).map(ar);
2979
+ const n = t.split(e).map(or);
2958
2980
  if (n.length === 3)
2959
- return Yi(n);
2960
- if (n.length === 2)
2961
2981
  return Hi(n);
2982
+ if (n.length === 2)
2983
+ return Xi(n);
2962
2984
  throw new Error(`invalid column reference ${t}`);
2963
2985
  }
2964
- function Gi(t) {
2986
+ function Yi(t) {
2965
2987
  const e = " as ";
2966
2988
  if (t.includes(e)) {
2967
- const [n, r] = t.split(e).map(ar);
2989
+ const [n, r] = t.split(e).map(or);
2968
2990
  return fe.create(me(n), R.create(r));
2969
2991
  } else
2970
2992
  return me(t);
2971
2993
  }
2972
- function Yi(t) {
2994
+ function Hi(t) {
2973
2995
  const [e, n, r] = t;
2974
2996
  return Jt.create(hn.create(r), Se.createWithSchema(e, n));
2975
2997
  }
2976
- function Hi(t) {
2998
+ function Xi(t) {
2977
2999
  const [e, n] = t;
2978
3000
  return Jt.create(hn.create(n), Se.create(e));
2979
3001
  }
2980
- function ar(t) {
3002
+ function or(t) {
2981
3003
  return t.trim();
2982
3004
  }
2983
- const Xi = s({
3005
+ const Zi = s({
2984
3006
  is(t) {
2985
3007
  return t.kind === "PrimitiveValueListNode";
2986
3008
  },
@@ -2990,7 +3012,7 @@ const Xi = s({
2990
3012
  values: s([...t])
2991
3013
  });
2992
3014
  }
2993
- }), Zi = s({
3015
+ }), es = s({
2994
3016
  is(t) {
2995
3017
  return t.kind === "ValueListNode";
2996
3018
  },
@@ -3018,22 +3040,22 @@ const Xi = s({
3018
3040
  });
3019
3041
  }
3020
3042
  });
3021
- function es(t) {
3022
- return de(t) ? ts(t) : $(t);
3043
+ function ts(t) {
3044
+ return de(t) ? ns(t) : $(t);
3023
3045
  }
3024
3046
  function $(t) {
3025
3047
  return Wt(t) ? Bt(t) : he.create(t);
3026
3048
  }
3027
3049
  function fn(t) {
3028
- return mn(t) || Gn(t) || Yn(t);
3050
+ return mn(t) || Yn(t) || Hn(t);
3029
3051
  }
3030
3052
  function pn(t) {
3031
3053
  if (!fn(t))
3032
3054
  throw new Error(`unsafe immediate value ${JSON.stringify(t)}`);
3033
3055
  return he.createImmediate(t);
3034
3056
  }
3035
- function ts(t) {
3036
- return t.some(Wt) ? Zi.create(t.map((e) => $(e))) : Xi.create(t);
3057
+ function ns(t) {
3058
+ return t.some(Wt) ? es.create(t.map((e) => $(e))) : Zi.create(t);
3037
3059
  }
3038
3060
  const mt = s({
3039
3061
  is(t) {
@@ -3054,13 +3076,13 @@ function K(t) {
3054
3076
  throw new Error(`invalid arguments: ${JSON.stringify(t)}`);
3055
3077
  }
3056
3078
  function gn(t, e, n) {
3057
- return ns(e) && or(n) ? Xe.create(j(t), Zt(e), he.createImmediate(n)) : Xe.create(j(t), Zt(e), es(n));
3079
+ return rs(e) && ir(n) ? Xe.create(j(t), Zt(e), he.createImmediate(n)) : Xe.create(j(t), Zt(e), ts(n));
3058
3080
  }
3059
3081
  function ht(t, e, n) {
3060
3082
  return Xe.create(j(t), Zt(e), j(n));
3061
3083
  }
3062
3084
  function On(t, e) {
3063
- return Xt(Object.entries(t).filter(([, n]) => !bt(n)).map(([n, r]) => gn(n, or(r) ? "is" : "=", r)), e);
3085
+ return Xt(Object.entries(t).filter(([, n]) => !bt(n)).map(([n, r]) => gn(n, ir(r) ? "is" : "=", r)), e);
3064
3086
  }
3065
3087
  function Xt(t, e, n = !0) {
3066
3088
  const r = e === "and" ? _e.create : tt.create;
@@ -3071,14 +3093,14 @@ function Xt(t, e, n = !0) {
3071
3093
  a = r(a, Tn(t[o]));
3072
3094
  return t.length > 1 && n ? mt.create(a) : a;
3073
3095
  }
3074
- function ns(t) {
3096
+ function rs(t) {
3075
3097
  return t === "is" || t === "is not";
3076
3098
  }
3077
- function or(t) {
3078
- return Yn(t) || Gn(t);
3099
+ function ir(t) {
3100
+ return Hn(t) || Yn(t);
3079
3101
  }
3080
3102
  function Zt(t) {
3081
- if (G(t) && Wi.includes(t))
3103
+ if (G(t) && Ki.includes(t))
3082
3104
  return ke.create(t);
3083
3105
  if (M(t))
3084
3106
  return t.toOperationNode();
@@ -3359,7 +3381,7 @@ const ct = class ct {
3359
3381
  B = new WeakMap();
3360
3382
  let St = ct;
3361
3383
  Ie(St, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3362
- const rs = s({
3384
+ const as = s({
3363
3385
  is(t) {
3364
3386
  return t.kind === "PartitionByItemNode";
3365
3387
  },
@@ -3370,8 +3392,8 @@ const rs = s({
3370
3392
  });
3371
3393
  }
3372
3394
  });
3373
- function as(t) {
3374
- return _t(t).map(rs.create);
3395
+ function os(t) {
3396
+ return _t(t).map(as.create);
3375
3397
  }
3376
3398
  var we;
3377
3399
  const Pt = class Pt {
@@ -3402,12 +3424,12 @@ const Pt = class Pt {
3402
3424
  */
3403
3425
  orderBy(e, n) {
3404
3426
  return new Pt({
3405
- overNode: en.cloneWithOrderByItems(i(this, we).overNode, tr([e, n]))
3427
+ overNode: en.cloneWithOrderByItems(i(this, we).overNode, nr([e, n]))
3406
3428
  });
3407
3429
  }
3408
3430
  partitionBy(e) {
3409
3431
  return new Pt({
3410
- overNode: en.cloneWithPartitionByItems(i(this, we).overNode, as(e))
3432
+ overNode: en.cloneWithPartitionByItems(i(this, we).overNode, os(e))
3411
3433
  });
3412
3434
  }
3413
3435
  /**
@@ -3437,7 +3459,7 @@ const st = s({
3437
3459
  createSelectAll() {
3438
3460
  return s({
3439
3461
  kind: "SelectionNode",
3440
- selection: Zn.create()
3462
+ selection: er.create()
3441
3463
  });
3442
3464
  },
3443
3465
  createSelectAllFromTable(t) {
@@ -3447,13 +3469,13 @@ const st = s({
3447
3469
  });
3448
3470
  }
3449
3471
  });
3450
- function ir(t) {
3451
- return Ee(t) ? ir(t(qt())) : de(t) ? t.map((e) => In(e)) : [In(t)];
3472
+ function sr(t) {
3473
+ return Ee(t) ? sr(t(qt())) : de(t) ? t.map((e) => In(e)) : [In(t)];
3452
3474
  }
3453
3475
  function In(t) {
3454
- return G(t) ? st.create(Gi(t)) : er(t) ? st.create(t.toOperationNode()) : st.create(pr(t));
3476
+ return G(t) ? st.create(Yi(t)) : tr(t) ? st.create(t.toOperationNode()) : st.create(gr(t));
3455
3477
  }
3456
- function sr(t) {
3478
+ function ur(t) {
3457
3479
  return t ? Array.isArray(t) ? t.map(An) : [An(t)] : [st.createSelectAll()];
3458
3480
  }
3459
3481
  function An(t) {
@@ -3461,7 +3483,7 @@ function An(t) {
3461
3483
  return st.createSelectAllFromTable(W(t));
3462
3484
  throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`);
3463
3485
  }
3464
- const os = s({
3486
+ const is = s({
3465
3487
  is(t) {
3466
3488
  return t.kind === "InsertQueryNode";
3467
3489
  },
@@ -3484,7 +3506,7 @@ const os = s({
3484
3506
  ...e
3485
3507
  });
3486
3508
  }
3487
- }), is = s({
3509
+ }), ss = s({
3488
3510
  is(t) {
3489
3511
  return t.kind === "UpdateQueryNode";
3490
3512
  },
@@ -3534,7 +3556,7 @@ const os = s({
3534
3556
  tables: s([...t.tables, ...e])
3535
3557
  });
3536
3558
  }
3537
- }), ss = s({
3559
+ }), us = s({
3538
3560
  is(t) {
3539
3561
  return t.kind === "DeleteQueryNode";
3540
3562
  },
@@ -3607,7 +3629,7 @@ const os = s({
3607
3629
  selections: t.selections ? s([...t.selections, ...e]) : s(e)
3608
3630
  });
3609
3631
  }
3610
- }), us = s({
3632
+ }), cs = s({
3611
3633
  is(t) {
3612
3634
  return t.kind === "ExplainNode";
3613
3635
  },
@@ -3634,7 +3656,7 @@ const os = s({
3634
3656
  result: e
3635
3657
  });
3636
3658
  }
3637
- }), cs = s({
3659
+ }), ls = s({
3638
3660
  is(t) {
3639
3661
  return t.kind === "MergeQueryNode";
3640
3662
  },
@@ -3684,7 +3706,7 @@ const os = s({
3684
3706
  }
3685
3707
  }), q = s({
3686
3708
  is(t) {
3687
- return O.is(t) || os.is(t) || is.is(t) || ss.is(t) || cs.is(t);
3709
+ return O.is(t) || is.is(t) || ss.is(t) || us.is(t) || ls.is(t);
3688
3710
  },
3689
3711
  cloneWithWhere(t, e) {
3690
3712
  return s({
@@ -3719,7 +3741,7 @@ const os = s({
3719
3741
  cloneWithExplain(t, e, n) {
3720
3742
  return s({
3721
3743
  ...t,
3722
- explain: us.create(e, n == null ? void 0 : n.toOperationNode())
3744
+ explain: cs.create(e, n == null ? void 0 : n.toOperationNode())
3723
3745
  });
3724
3746
  },
3725
3747
  cloneWithTop(t, e) {
@@ -3735,7 +3757,7 @@ const os = s({
3735
3757
  });
3736
3758
  }
3737
3759
  });
3738
- class ls extends Error {
3760
+ class ds extends Error {
3739
3761
  constructor(n) {
3740
3762
  super("no result");
3741
3763
  /**
@@ -3745,10 +3767,10 @@ class ls extends Error {
3745
3767
  this.node = n;
3746
3768
  }
3747
3769
  }
3748
- function ds(t) {
3770
+ function _s(t) {
3749
3771
  return Object.prototype.hasOwnProperty.call(t, "prototype");
3750
3772
  }
3751
- const _s = s({
3773
+ const ms = s({
3752
3774
  is(t) {
3753
3775
  return t.kind === "TopNode";
3754
3776
  },
@@ -3760,17 +3782,17 @@ const _s = s({
3760
3782
  });
3761
3783
  }
3762
3784
  });
3763
- function ms(t, e) {
3764
- if (!mn(t) && !Hn(t))
3785
+ function hs(t, e) {
3786
+ if (!mn(t) && !Xn(t))
3765
3787
  throw new Error(`Invalid top expression: ${t}`);
3766
- if (!bt(e) && !hs(e))
3788
+ if (!bt(e) && !fs(e))
3767
3789
  throw new Error(`Invalid top modifiers: ${e}`);
3768
- return _s.create(t, e);
3790
+ return ms.create(t, e);
3769
3791
  }
3770
- function hs(t) {
3792
+ function fs(t) {
3771
3793
  return t === "percent" || t === "with ties" || t === "percent with ties";
3772
3794
  }
3773
- const fs = s({
3795
+ const ps = s({
3774
3796
  is(t) {
3775
3797
  return t.kind === "LimitNode";
3776
3798
  },
@@ -3844,30 +3866,30 @@ const fs = s({
3844
3866
  "8",
3845
3867
  "9"
3846
3868
  ];
3847
- function ps(t) {
3869
+ function gs(t) {
3848
3870
  let e = "";
3849
3871
  for (let n = 0; n < t; ++n)
3850
- e += gs();
3872
+ e += ys();
3851
3873
  return e;
3852
3874
  }
3853
- function gs() {
3875
+ function ys() {
3854
3876
  return zn[~~(Math.random() * zn.length)];
3855
3877
  }
3856
3878
  function H() {
3857
- return new ys();
3879
+ return new ws();
3858
3880
  }
3859
3881
  var Le;
3860
- class ys {
3882
+ class ws {
3861
3883
  constructor() {
3862
3884
  C(this, Le);
3863
3885
  }
3864
3886
  get queryId() {
3865
- return i(this, Le) === void 0 && b(this, Le, ps(8)), i(this, Le);
3887
+ return i(this, Le) === void 0 && b(this, Le, gs(8)), i(this, Le);
3866
3888
  }
3867
3889
  }
3868
3890
  Le = new WeakMap();
3869
3891
  var $t;
3870
- class ws {
3892
+ class Ns {
3871
3893
  constructor() {
3872
3894
  oe(this, "nodeStack", []);
3873
3895
  C(this, $t, s({
@@ -4701,7 +4723,7 @@ class ws {
4701
4723
  }
4702
4724
  }
4703
4725
  $t = new WeakMap();
4704
- const Ns = s({
4726
+ const vs = s({
4705
4727
  AlterTableNode: !0,
4706
4728
  CreateIndexNode: !0,
4707
4729
  CreateSchemaNode: !0,
@@ -4720,8 +4742,8 @@ const Ns = s({
4720
4742
  UpdateQueryNode: !0,
4721
4743
  MergeQueryNode: !0
4722
4744
  });
4723
- var Je, Ne, ve, I, ur, cr, lr, $e, tn, dr;
4724
- class vs extends ws {
4745
+ var Je, Ne, ve, I, cr, lr, dr, $e, tn, _r;
4746
+ class Cs extends Ns {
4725
4747
  constructor(n) {
4726
4748
  super();
4727
4749
  C(this, I);
@@ -4731,12 +4753,12 @@ class vs extends ws {
4731
4753
  b(this, Je, n);
4732
4754
  }
4733
4755
  transformNodeImpl(n) {
4734
- if (!w(this, I, ur).call(this, n))
4756
+ if (!w(this, I, cr).call(this, n))
4735
4757
  return super.transformNodeImpl(n);
4736
- const r = w(this, I, lr).call(this, n);
4758
+ const r = w(this, I, dr).call(this, n);
4737
4759
  for (const u of r)
4738
4760
  i(this, ve).add(u);
4739
- const a = w(this, I, cr).call(this, n);
4761
+ const a = w(this, I, lr).call(this, n);
4740
4762
  for (const u of a)
4741
4763
  i(this, Ne).add(u);
4742
4764
  const o = super.transformNodeImpl(n);
@@ -4761,9 +4783,9 @@ class vs extends ws {
4761
4783
  };
4762
4784
  }
4763
4785
  }
4764
- Je = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), ur = function(n) {
4765
- return n.kind in Ns;
4766
- }, cr = function(n) {
4786
+ Je = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), cr = function(n) {
4787
+ return n.kind in vs;
4788
+ }, lr = function(n) {
4767
4789
  const r = /* @__PURE__ */ new Set();
4768
4790
  if ("name" in n && n.name && Yt.is(n.name) && w(this, I, tn).call(this, n.name, r), "from" in n && n.from)
4769
4791
  for (const a of n.from.froms)
@@ -4772,26 +4794,26 @@ Je = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), u
4772
4794
  for (const a of n.joins)
4773
4795
  w(this, I, $e).call(this, a.table, r);
4774
4796
  return "using" in n && n.using && w(this, I, $e).call(this, n.using, r), r;
4775
- }, lr = function(n) {
4797
+ }, dr = function(n) {
4776
4798
  const r = /* @__PURE__ */ new Set();
4777
- return "with" in n && n.with && w(this, I, dr).call(this, n.with, r), r;
4799
+ return "with" in n && n.with && w(this, I, _r).call(this, n.with, r), r;
4778
4800
  }, $e = function(n, r) {
4779
4801
  const a = Se.is(n) ? n : fe.is(n) && Se.is(n.node) ? n.node : null;
4780
4802
  a && w(this, I, tn).call(this, a.table, r);
4781
4803
  }, tn = function(n, r) {
4782
4804
  const a = n.identifier.name;
4783
4805
  !i(this, Ne).has(a) && !i(this, ve).has(a) && r.add(a);
4784
- }, dr = function(n, r) {
4806
+ }, _r = function(n, r) {
4785
4807
  for (const a of n.expressions) {
4786
4808
  const o = a.name.table.table.identifier.name;
4787
4809
  i(this, ve).has(o) || r.add(o);
4788
4810
  }
4789
4811
  };
4790
4812
  var ft;
4791
- class _r {
4813
+ class mr {
4792
4814
  constructor(e) {
4793
4815
  C(this, ft);
4794
- b(this, ft, new vs(e));
4816
+ b(this, ft, new Cs(e));
4795
4817
  }
4796
4818
  transformQuery(e) {
4797
4819
  return i(this, ft).transformNode(e.node);
@@ -4823,13 +4845,13 @@ class Rn {
4823
4845
  }
4824
4846
  pt = new WeakMap(), Me = new WeakMap(), qe = new WeakMap();
4825
4847
  const Fn = /* @__PURE__ */ new Set();
4826
- function Cs(t) {
4848
+ function xs(t) {
4827
4849
  Fn.has(t) || (Fn.add(t), console.log(t));
4828
4850
  }
4829
- const xs = s([]);
4851
+ const bs = s([]);
4830
4852
  var Ce, gt, nn;
4831
- class bs {
4832
- constructor(e = xs) {
4853
+ class Os {
4854
+ constructor(e = bs) {
4833
4855
  C(this, gt);
4834
4856
  C(this, Ce);
4835
4857
  b(this, Ce, e);
@@ -4855,7 +4877,7 @@ class bs {
4855
4877
  async executeQuery(e, n) {
4856
4878
  return await this.provideConnection(async (r) => {
4857
4879
  const a = await r.executeQuery(e), o = await w(this, gt, nn).call(this, a, n);
4858
- return Os(a, o), o;
4880
+ return Ts(a, o), o;
4859
4881
  });
4860
4882
  }
4861
4883
  async *stream(e, n, r) {
@@ -4875,11 +4897,11 @@ Ce = new WeakMap(), gt = new WeakSet(), nn = async function(e, n) {
4875
4897
  e = await r.transformResult({ result: e, queryId: n });
4876
4898
  return e;
4877
4899
  };
4878
- function Os(t, e) {
4900
+ function Ts(t, e) {
4879
4901
  const { numAffectedRows: n } = t;
4880
- n === void 0 && t.numUpdatedOrDeletedRows === void 0 || n !== void 0 && e.numAffectedRows !== void 0 || Cs("kysely:warning: outdated driver/plugin detected! QueryResult.numUpdatedOrDeletedRows is deprecated and will be removed in a future release.");
4902
+ n === void 0 && t.numUpdatedOrDeletedRows === void 0 || n !== void 0 && e.numAffectedRows !== void 0 || xs("kysely:warning: outdated driver/plugin detected! QueryResult.numUpdatedOrDeletedRows is deprecated and will be removed in a future release.");
4881
4903
  }
4882
- class Fe extends bs {
4904
+ class Fe extends Os {
4883
4905
  get adapter() {
4884
4906
  throw new Error("this query cannot be compiled to SQL");
4885
4907
  }
@@ -4905,31 +4927,31 @@ class Fe extends bs {
4905
4927
  return new Fe([]);
4906
4928
  }
4907
4929
  }
4908
- const mr = new Fe();
4909
- function Ts(t, e) {
4930
+ const hr = new Fe();
4931
+ function Ss(t, e) {
4910
4932
  return new St({
4911
4933
  joinNode: ot.create(t, It(e))
4912
4934
  });
4913
4935
  }
4914
- function Ss() {
4936
+ function ks() {
4915
4937
  return new kt({
4916
4938
  overNode: en.create()
4917
4939
  });
4918
4940
  }
4919
4941
  function Ae(t, e) {
4920
4942
  if (e.length === 3)
4921
- return Es(t, e[0], e[1], e[2]);
4943
+ return Is(t, e[0], e[1], e[2]);
4922
4944
  if (e.length === 2)
4923
- return ks(t, e[0], e[1]);
4945
+ return Es(t, e[0], e[1]);
4924
4946
  throw new Error("not implemented");
4925
4947
  }
4926
- function ks(t, e, n) {
4927
- return n(Ts(t, e)).toOperationNode();
4948
+ function Es(t, e, n) {
4949
+ return n(Ss(t, e)).toOperationNode();
4928
4950
  }
4929
- function Es(t, e, n, r) {
4951
+ function Is(t, e, n, r) {
4930
4952
  return ot.createWithOn(t, It(e), ht(n, "=", r));
4931
4953
  }
4932
- const Is = s({
4954
+ const As = s({
4933
4955
  is(t) {
4934
4956
  return t.kind === "OffsetNode";
4935
4957
  },
@@ -4939,7 +4961,7 @@ const Is = s({
4939
4961
  offset: t
4940
4962
  });
4941
4963
  }
4942
- }), As = s({
4964
+ }), Ps = s({
4943
4965
  is(t) {
4944
4966
  return t.kind === "GroupByItemNode";
4945
4967
  },
@@ -4950,10 +4972,10 @@ const Is = s({
4950
4972
  });
4951
4973
  }
4952
4974
  });
4953
- function Ps(t) {
4954
- return t = Ee(t) ? t(qt()) : t, _t(t).map(As.create);
4975
+ function $s(t) {
4976
+ return t = Ee(t) ? t(qt()) : t, _t(t).map(Ps.create);
4955
4977
  }
4956
- const $s = s({
4978
+ const Ds = s({
4957
4979
  is(t) {
4958
4980
  return t.kind === "SetOperationNode";
4959
4981
  },
@@ -4967,7 +4989,7 @@ const $s = s({
4967
4989
  }
4968
4990
  });
4969
4991
  function Pe(t, e, n) {
4970
- return Ee(e) && (e = e(wn())), de(e) || (e = [e]), e.map((r) => $s.create(t, Bt(r), n));
4992
+ return Ee(e) && (e = e(wn())), de(e) || (e = [e]), e.map((r) => Ds.create(t, Bt(r), n));
4971
4993
  }
4972
4994
  var te;
4973
4995
  const Dt = class Dt {
@@ -5094,7 +5116,7 @@ const Rt = class Rt {
5094
5116
  };
5095
5117
  be = new WeakMap();
5096
5118
  let an = Rt;
5097
- const Ds = {
5119
+ const zs = {
5098
5120
  is(t) {
5099
5121
  return t.kind === "FetchNode";
5100
5122
  },
@@ -5106,14 +5128,14 @@ const Ds = {
5106
5128
  };
5107
5129
  }
5108
5130
  };
5109
- function zs(t, e) {
5110
- if (!mn(t) && !Hn(t))
5131
+ function Rs(t, e) {
5132
+ if (!mn(t) && !Xn(t))
5111
5133
  throw new Error(`Invalid fetch row count: ${t}`);
5112
- if (!Rs(e))
5134
+ if (!Fs(e))
5113
5135
  throw new Error(`Invalid fetch modifier: ${e}`);
5114
- return Ds.create(t, e);
5136
+ return zs.create(t, e);
5115
5137
  }
5116
- function Rs(t) {
5138
+ function Fs(t) {
5117
5139
  return t === "only" || t === "with ties";
5118
5140
  }
5119
5141
  var _;
@@ -5154,7 +5176,7 @@ const N = class N {
5154
5176
  select(e) {
5155
5177
  return new N({
5156
5178
  ...i(this, _),
5157
- queryNode: O.cloneWithSelections(i(this, _).queryNode, ir(e))
5179
+ queryNode: O.cloneWithSelections(i(this, _).queryNode, sr(e))
5158
5180
  });
5159
5181
  }
5160
5182
  distinctOn(e) {
@@ -5220,7 +5242,7 @@ const N = class N {
5220
5242
  selectAll(e) {
5221
5243
  return new N({
5222
5244
  ...i(this, _),
5223
- queryNode: O.cloneWithSelections(i(this, _).queryNode, sr(e))
5245
+ queryNode: O.cloneWithSelections(i(this, _).queryNode, ur(e))
5224
5246
  });
5225
5247
  }
5226
5248
  innerJoin(...e) {
@@ -5262,37 +5284,37 @@ const N = class N {
5262
5284
  orderBy(...e) {
5263
5285
  return new N({
5264
5286
  ...i(this, _),
5265
- queryNode: O.cloneWithOrderByItems(i(this, _).queryNode, tr(e))
5287
+ queryNode: O.cloneWithOrderByItems(i(this, _).queryNode, nr(e))
5266
5288
  });
5267
5289
  }
5268
5290
  groupBy(e) {
5269
5291
  return new N({
5270
5292
  ...i(this, _),
5271
- queryNode: O.cloneWithGroupByItems(i(this, _).queryNode, Ps(e))
5293
+ queryNode: O.cloneWithGroupByItems(i(this, _).queryNode, $s(e))
5272
5294
  });
5273
5295
  }
5274
5296
  limit(e) {
5275
5297
  return new N({
5276
5298
  ...i(this, _),
5277
- queryNode: O.cloneWithLimit(i(this, _).queryNode, fs.create($(e)))
5299
+ queryNode: O.cloneWithLimit(i(this, _).queryNode, ps.create($(e)))
5278
5300
  });
5279
5301
  }
5280
5302
  offset(e) {
5281
5303
  return new N({
5282
5304
  ...i(this, _),
5283
- queryNode: O.cloneWithOffset(i(this, _).queryNode, Is.create($(e)))
5305
+ queryNode: O.cloneWithOffset(i(this, _).queryNode, As.create($(e)))
5284
5306
  });
5285
5307
  }
5286
5308
  fetch(e, n = "only") {
5287
5309
  return new N({
5288
5310
  ...i(this, _),
5289
- queryNode: O.cloneWithFetch(i(this, _).queryNode, zs(e, n))
5311
+ queryNode: O.cloneWithFetch(i(this, _).queryNode, Rs(e, n))
5290
5312
  });
5291
5313
  }
5292
5314
  top(e, n) {
5293
5315
  return new N({
5294
5316
  ...i(this, _),
5295
- queryNode: q.cloneWithTop(i(this, _).queryNode, ms(e, n))
5317
+ queryNode: q.cloneWithTop(i(this, _).queryNode, hs(e, n))
5296
5318
  });
5297
5319
  }
5298
5320
  union(e) {
@@ -5332,7 +5354,7 @@ const N = class N {
5332
5354
  });
5333
5355
  }
5334
5356
  as(e) {
5335
- return new hr(this, e);
5357
+ return new fr(this, e);
5336
5358
  }
5337
5359
  clearSelect() {
5338
5360
  return new N({
@@ -5410,10 +5432,10 @@ const N = class N {
5410
5432
  const [e] = await this.execute();
5411
5433
  return e;
5412
5434
  }
5413
- async executeTakeFirstOrThrow(e = ls) {
5435
+ async executeTakeFirstOrThrow(e = ds) {
5414
5436
  const n = await this.executeTakeFirst();
5415
5437
  if (n === void 0)
5416
- throw ds(e) ? new e(this.toOperationNode()) : e(this.toOperationNode());
5438
+ throw _s(e) ? new e(this.toOperationNode()) : e(this.toOperationNode());
5417
5439
  return n;
5418
5440
  }
5419
5441
  async *stream(e = 100) {
@@ -5431,11 +5453,11 @@ const N = class N {
5431
5453
  _ = new WeakMap();
5432
5454
  let Et = N;
5433
5455
  Ie(Et, "don't await SelectQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");
5434
- function Fs(t) {
5456
+ function js(t) {
5435
5457
  return new Et(t);
5436
5458
  }
5437
5459
  var We, Ke;
5438
- class hr {
5460
+ class fr {
5439
5461
  constructor(e, n) {
5440
5462
  C(this, We);
5441
5463
  C(this, Ke);
@@ -5455,7 +5477,7 @@ class hr {
5455
5477
  }
5456
5478
  }
5457
5479
  We = new WeakMap(), Ke = new WeakMap();
5458
- Ie(hr, "don't await AliasedSelectQueryBuilder instances directly. AliasedSelectQueryBuilder should never be executed directly since it's always a part of another query.");
5480
+ Ie(fr, "don't await AliasedSelectQueryBuilder instances directly. AliasedSelectQueryBuilder should never be executed directly since it's always a part of another query.");
5459
5481
  const ye = s({
5460
5482
  is(t) {
5461
5483
  return t.kind === "AggregateFunctionNode";
@@ -5538,7 +5560,7 @@ const se = class se {
5538
5560
  * ```
5539
5561
  */
5540
5562
  as(e) {
5541
- return new js(this, e);
5563
+ return new Ls(this, e);
5542
5564
  }
5543
5565
  /**
5544
5566
  * Adds a `distinct` clause inside the function.
@@ -5654,7 +5676,7 @@ const se = class se {
5654
5676
  * ```
5655
5677
  */
5656
5678
  over(e) {
5657
- const n = Ss();
5679
+ const n = ks();
5658
5680
  return new se({
5659
5681
  ...i(this, A),
5660
5682
  aggregateFunctionNode: ye.cloneWithOver(i(this, A).aggregateFunctionNode, (e ? e(n) : n).toOperationNode())
@@ -5696,7 +5718,7 @@ A = new WeakMap();
5696
5718
  let je = se;
5697
5719
  Ie(je, "don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");
5698
5720
  var Ue, Qe;
5699
- class js {
5721
+ class Ls {
5700
5722
  constructor(e, n) {
5701
5723
  C(this, Ue);
5702
5724
  C(this, Qe);
@@ -5715,7 +5737,7 @@ class js {
5715
5737
  }
5716
5738
  }
5717
5739
  Ue = new WeakMap(), Qe = new WeakMap();
5718
- function Ls() {
5740
+ function Js() {
5719
5741
  const t = (n, r) => new S(jn.create(n, _t(r ?? []))), e = (n, r) => new je({
5720
5742
  aggregateFunctionNode: ye.create(n, r ? _t(r) : void 0)
5721
5743
  });
@@ -5732,7 +5754,7 @@ function Ls() {
5732
5754
  },
5733
5755
  countAll(n) {
5734
5756
  return new je({
5735
- aggregateFunctionNode: ye.create("count", sr(n))
5757
+ aggregateFunctionNode: ye.create("count", ur(n))
5736
5758
  });
5737
5759
  },
5738
5760
  max(n) {
@@ -5761,7 +5783,7 @@ function Ls() {
5761
5783
  }
5762
5784
  });
5763
5785
  }
5764
- const Js = s({
5786
+ const Ms = s({
5765
5787
  is(t) {
5766
5788
  return t.kind === "UnaryOperationNode";
5767
5789
  },
@@ -5773,8 +5795,8 @@ const Js = s({
5773
5795
  });
5774
5796
  }
5775
5797
  });
5776
- function Ms(t, e) {
5777
- return Js.create(ke.create(t), j(e));
5798
+ function qs(t, e) {
5799
+ return Ms.create(ke.create(t), j(e));
5778
5800
  }
5779
5801
  const ne = s({
5780
5802
  is(t) {
@@ -5809,13 +5831,13 @@ const ne = s({
5809
5831
  }
5810
5832
  });
5811
5833
  var Ve;
5812
- class qs {
5834
+ class Bs {
5813
5835
  constructor(e) {
5814
5836
  C(this, Ve);
5815
5837
  b(this, Ve, s(e));
5816
5838
  }
5817
5839
  when(...e) {
5818
- return new fr({
5840
+ return new pr({
5819
5841
  ...i(this, Ve),
5820
5842
  node: ne.cloneWithWhen(i(this, Ve).node, Mt.create(K(e)))
5821
5843
  });
@@ -5823,13 +5845,13 @@ class qs {
5823
5845
  }
5824
5846
  Ve = new WeakMap();
5825
5847
  var Ge;
5826
- class fr {
5848
+ class pr {
5827
5849
  constructor(e) {
5828
5850
  C(this, Ge);
5829
5851
  b(this, Ge, s(e));
5830
5852
  }
5831
5853
  then(e) {
5832
- return new Bs({
5854
+ return new Ws({
5833
5855
  ...i(this, Ge),
5834
5856
  node: ne.cloneWithThen(i(this, Ge).node, fn(e) ? pn(e) : $(e))
5835
5857
  });
@@ -5837,19 +5859,19 @@ class fr {
5837
5859
  }
5838
5860
  Ge = new WeakMap();
5839
5861
  var Q;
5840
- class Bs {
5862
+ class Ws {
5841
5863
  constructor(e) {
5842
5864
  C(this, Q);
5843
5865
  b(this, Q, s(e));
5844
5866
  }
5845
5867
  when(...e) {
5846
- return new fr({
5868
+ return new pr({
5847
5869
  ...i(this, Q),
5848
5870
  node: ne.cloneWithWhen(i(this, Q).node, Mt.create(K(e)))
5849
5871
  });
5850
5872
  }
5851
5873
  else(e) {
5852
- return new Ws({
5874
+ return new Ks({
5853
5875
  ...i(this, Q),
5854
5876
  node: ne.cloneWith(i(this, Q).node, {
5855
5877
  else: fn(e) ? pn(e) : $(e)
@@ -5865,7 +5887,7 @@ class Bs {
5865
5887
  }
5866
5888
  Q = new WeakMap();
5867
5889
  var Ye;
5868
- class Ws {
5890
+ class Ks {
5869
5891
  constructor(e) {
5870
5892
  C(this, Ye);
5871
5893
  b(this, Ye, s(e));
@@ -6018,7 +6040,7 @@ class ut {
6018
6040
  }
6019
6041
  }
6020
6042
  V = new WeakMap(), yt = new WeakSet(), on = function(e, n) {
6021
- return Ot.is(i(this, V)) ? new Jn(Ot.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, Ln.create(e, n)) : rr.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new Jn(it.cloneWithLeg(i(this, V), Ln.create(e, n)));
6043
+ return Ot.is(i(this, V)) ? new Jn(Ot.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, Ln.create(e, n)) : ar.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new Jn(it.cloneWithLeg(i(this, V), Ln.create(e, n)));
6022
6044
  };
6023
6045
  var Oe;
6024
6046
  class Jn extends ut {
@@ -6031,7 +6053,7 @@ class Jn extends ut {
6031
6053
  get expressionType() {
6032
6054
  }
6033
6055
  as(n) {
6034
- return new Ks(this, n);
6056
+ return new Us(this, n);
6035
6057
  }
6036
6058
  /**
6037
6059
  * Change the output type of the json path.
@@ -6051,7 +6073,7 @@ class Jn extends ut {
6051
6073
  }
6052
6074
  Oe = new WeakMap();
6053
6075
  var He, ce;
6054
- class Ks {
6076
+ class Us {
6055
6077
  constructor(e, n) {
6056
6078
  C(this, He);
6057
6079
  C(this, ce);
@@ -6080,7 +6102,7 @@ const Mn = s({
6080
6102
  values: s(t)
6081
6103
  });
6082
6104
  }
6083
- }), Us = [
6105
+ }), Qs = [
6084
6106
  "varchar",
6085
6107
  "char",
6086
6108
  "text",
@@ -6112,7 +6134,7 @@ const Mn = s({
6112
6134
  "jsonb",
6113
6135
  "blob",
6114
6136
  "varbinary"
6115
- ], Qs = [
6137
+ ], Vs = [
6116
6138
  /^varchar\(\d+\)$/,
6117
6139
  /^char\(\d+\)$/,
6118
6140
  /^decimal\(\d+, \d+\)$/,
@@ -6124,7 +6146,7 @@ const Mn = s({
6124
6146
  /^timestamp\(\d+\)$/,
6125
6147
  /^timestamptz\(\d+\)$/,
6126
6148
  /^varbinary\(\d+\)$/
6127
- ], Vs = s({
6149
+ ], Gs = s({
6128
6150
  is(t) {
6129
6151
  return t.kind === "DataTypeNode";
6130
6152
  },
@@ -6135,17 +6157,17 @@ const Mn = s({
6135
6157
  });
6136
6158
  }
6137
6159
  });
6138
- function Gs(t) {
6139
- return !!(Us.includes(t) || Qs.some((e) => e.test(t)));
6140
- }
6141
6160
  function Ys(t) {
6161
+ return !!(Qs.includes(t) || Vs.some((e) => e.test(t)));
6162
+ }
6163
+ function Hs(t) {
6142
6164
  if (M(t))
6143
6165
  return t.toOperationNode();
6144
- if (Gs(t))
6145
- return Vs.create(t);
6166
+ if (Ys(t))
6167
+ return Gs.create(t);
6146
6168
  throw new Error(`invalid column data type ${JSON.stringify(t)}`);
6147
6169
  }
6148
- const Hs = s({
6170
+ const Xs = s({
6149
6171
  is(t) {
6150
6172
  return t.kind === "CastNode";
6151
6173
  },
@@ -6157,30 +6179,30 @@ const Hs = s({
6157
6179
  });
6158
6180
  }
6159
6181
  });
6160
- function wn(t = mr) {
6182
+ function wn(t = hr) {
6161
6183
  function e(a, o, u) {
6162
6184
  return new S(gn(a, o, u));
6163
6185
  }
6164
6186
  function n(a, o) {
6165
- return new S(Ms(a, o));
6187
+ return new S(qs(a, o));
6166
6188
  }
6167
6189
  const r = Object.assign(e, {
6168
6190
  fn: void 0,
6169
6191
  eb: void 0,
6170
6192
  selectFrom(a) {
6171
- return Fs({
6193
+ return js({
6172
6194
  queryId: H(),
6173
6195
  executor: t,
6174
- queryNode: O.createFrom(Xs(a))
6196
+ queryNode: O.createFrom(Zs(a))
6175
6197
  });
6176
6198
  },
6177
6199
  case(a) {
6178
- return new qs({
6200
+ return new Bs({
6179
6201
  node: ne.create(bt(a) ? void 0 : j(a))
6180
6202
  });
6181
6203
  },
6182
6204
  ref(a, o) {
6183
- return bt(o) ? new S(me(a)) : new ut(Vi(a, o));
6205
+ return bt(o) ? new S(me(a)) : new ut(Gi(a, o));
6184
6206
  },
6185
6207
  jsonPath() {
6186
6208
  return new ut(it.create());
@@ -6227,13 +6249,13 @@ function wn(t = mr) {
6227
6249
  return mt.is(o) ? new S(o) : new S(mt.create(o));
6228
6250
  },
6229
6251
  cast(a, o) {
6230
- return new S(Hs.create(j(a), Ys(o)));
6252
+ return new S(Xs.create(j(a), Hs(o)));
6231
6253
  },
6232
6254
  withSchema(a) {
6233
- return wn(t.withPluginAtFront(new _r(a)));
6255
+ return wn(t.withPluginAtFront(new mr(a)));
6234
6256
  }
6235
6257
  });
6236
- return r.fn = Ls(), r.eb = r, r;
6258
+ return r.fn = Js(), r.eb = r, r;
6237
6259
  }
6238
6260
  function qt(t) {
6239
6261
  return wn();
@@ -6245,7 +6267,7 @@ function Bt(t) {
6245
6267
  return t(qt()).toOperationNode();
6246
6268
  throw new Error(`invalid expression: ${JSON.stringify(t)}`);
6247
6269
  }
6248
- function pr(t) {
6270
+ function gr(t) {
6249
6271
  if (M(t))
6250
6272
  return t.toOperationNode();
6251
6273
  if (Ee(t))
@@ -6253,18 +6275,18 @@ function pr(t) {
6253
6275
  throw new Error(`invalid aliased expression: ${JSON.stringify(t)}`);
6254
6276
  }
6255
6277
  function Wt(t) {
6256
- return Fi(t) || ji(t) || Ee(t);
6278
+ return ji(t) || Li(t) || Ee(t);
6257
6279
  }
6258
- function Xs(t) {
6280
+ function Zs(t) {
6259
6281
  return de(t) ? t.map((e) => It(e)) : [It(t)];
6260
6282
  }
6261
6283
  function It(t) {
6262
- return G(t) ? Zs(t) : pr(t);
6284
+ return G(t) ? eu(t) : gr(t);
6263
6285
  }
6264
- function Zs(t) {
6286
+ function eu(t) {
6265
6287
  const e = " as ";
6266
6288
  if (t.includes(e)) {
6267
- const [n, r] = t.split(e).map(gr);
6289
+ const [n, r] = t.split(e).map(yr);
6268
6290
  return fe.create(W(n), R.create(r));
6269
6291
  } else
6270
6292
  return W(t);
@@ -6272,12 +6294,12 @@ function Zs(t) {
6272
6294
  function W(t) {
6273
6295
  const e = ".";
6274
6296
  if (t.includes(e)) {
6275
- const [n, r] = t.split(e).map(gr);
6297
+ const [n, r] = t.split(e).map(yr);
6276
6298
  return Se.createWithSchema(n, r);
6277
6299
  } else
6278
6300
  return Se.create(t);
6279
6301
  }
6280
- function gr(t) {
6302
+ function yr(t) {
6281
6303
  return t.trim();
6282
6304
  }
6283
6305
  var P, L, Ct, sn, un;
@@ -6293,7 +6315,7 @@ const lt = class lt {
6293
6315
  return !0;
6294
6316
  }
6295
6317
  as(e) {
6296
- return new yr(this, e);
6318
+ return new wr(this, e);
6297
6319
  }
6298
6320
  $castTo() {
6299
6321
  return new lt({ ...i(this, P) });
@@ -6319,7 +6341,7 @@ const lt = class lt {
6319
6341
  }
6320
6342
  };
6321
6343
  P = new WeakMap(), L = new WeakSet(), Ct = function(e) {
6322
- const n = e !== void 0 ? e.getExecutor() : mr;
6344
+ const n = e !== void 0 ? e.getExecutor() : hr;
6323
6345
  return i(this, P).plugins !== void 0 ? n.withPlugins(i(this, P).plugins) : n;
6324
6346
  }, sn = function(e) {
6325
6347
  return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
@@ -6332,7 +6354,7 @@ function ie(t) {
6332
6354
  }
6333
6355
  Ie(At, "don't await RawBuilder instances directly. To execute the query you need to call `execute`");
6334
6356
  var Te, le;
6335
- class yr {
6357
+ class wr {
6336
6358
  constructor(e, n) {
6337
6359
  C(this, Te);
6338
6360
  C(this, le);
@@ -6352,7 +6374,7 @@ class yr {
6352
6374
  }
6353
6375
  }
6354
6376
  Te = new WeakMap(), le = new WeakMap();
6355
- Ie(yr, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6377
+ Ie(wr, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6356
6378
  const p = Object.assign((t, ...e) => ie({
6357
6379
  queryId: H(),
6358
6380
  rawNode: z.create(t, (e == null ? void 0 : e.map(qn)) ?? [])
@@ -6413,7 +6435,7 @@ const p = Object.assign((t, ...e) => ie({
6413
6435
  function qn(t) {
6414
6436
  return M(t) ? t.toOperationNode() : $(t);
6415
6437
  }
6416
- class eu {
6438
+ class tu {
6417
6439
  transformQuery(e) {
6418
6440
  return e.node;
6419
6441
  }
@@ -6421,9 +6443,9 @@ class eu {
6421
6443
  return e.result;
6422
6444
  }
6423
6445
  }
6424
- const tu = "kysely_migration", Bn = "kysely_migration_lock", nu = !1, Vt = "migration_lock", ru = s({ __noMigrations__: !0 });
6425
- var k, m, rt, X, Z, De, Nr, ee, vr, Cr, xr, br, Or, cn, ze, ln, Tr, Sr, kr, dn, Er, Ir, Ar, Pr, $r, at;
6426
- class wr {
6446
+ const nu = "kysely_migration", Bn = "kysely_migration_lock", ru = !1, Vt = "migration_lock", au = s({ __noMigrations__: !0 });
6447
+ var k, m, rt, X, Z, De, vr, ee, Cr, xr, br, Or, Tr, cn, ze, ln, Sr, kr, Er, dn, Ir, Ar, Pr, $r, Dr, at;
6448
+ class Nr {
6427
6449
  constructor(e) {
6428
6450
  C(this, m);
6429
6451
  C(this, k);
@@ -6520,7 +6542,7 @@ class wr {
6520
6542
  */
6521
6543
  async migrateTo(e) {
6522
6544
  return w(this, m, rt).call(this, ({ migrations: n, executedMigrations: r, pendingMigrations: a }) => {
6523
- if (e === ru)
6545
+ if (e === au)
6524
6546
  return { direction: "Down", step: 1 / 0 };
6525
6547
  if (!n.find((c) => c.name === e))
6526
6548
  throw new Error(`migration "${e}" doesn't exist`);
@@ -6572,23 +6594,23 @@ class wr {
6572
6594
  }
6573
6595
  k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6574
6596
  try {
6575
- return await w(this, m, vr).call(this), await w(this, m, Tr).call(this, e);
6597
+ return await w(this, m, Cr).call(this), await w(this, m, Sr).call(this, e);
6576
6598
  } catch (n) {
6577
6599
  return n instanceof Gt ? n.resultSet : { error: n };
6578
6600
  }
6579
6601
  }, X = function() {
6580
6602
  return i(this, k).migrationTableSchema;
6581
6603
  }, Z = function() {
6582
- return i(this, k).migrationTableName ?? tu;
6604
+ return i(this, k).migrationTableName ?? nu;
6583
6605
  }, De = function() {
6584
6606
  return i(this, k).migrationLockTableName ?? Bn;
6585
- }, Nr = function() {
6586
- return i(this, k).allowUnorderedMigrations ?? nu;
6607
+ }, vr = function() {
6608
+ return i(this, k).allowUnorderedMigrations ?? ru;
6587
6609
  }, ee = function() {
6588
- return i(this, m, X) ? new _r(i(this, m, X)) : new eu();
6589
- }, vr = async function() {
6590
- await w(this, m, Cr).call(this), await w(this, m, xr).call(this), await w(this, m, br).call(this), await w(this, m, Or).call(this);
6610
+ return i(this, m, X) ? new mr(i(this, m, X)) : new tu();
6591
6611
  }, Cr = async function() {
6612
+ await w(this, m, xr).call(this), await w(this, m, br).call(this), await w(this, m, Or).call(this), await w(this, m, Tr).call(this);
6613
+ }, xr = async function() {
6592
6614
  if (i(this, m, X) && !await w(this, m, cn).call(this))
6593
6615
  try {
6594
6616
  await w(this, m, at).call(this, i(this, k).db.schema.createSchema(i(this, m, X)));
@@ -6596,7 +6618,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6596
6618
  if (!await w(this, m, cn).call(this))
6597
6619
  throw e;
6598
6620
  }
6599
- }, xr = async function() {
6621
+ }, br = async function() {
6600
6622
  if (!await w(this, m, ze).call(this, i(this, m, Z)))
6601
6623
  try {
6602
6624
  i(this, m, X) && await w(this, m, at).call(this, i(this, k).db.schema.createSchema(i(this, m, X))), await w(this, m, at).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, Z)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
@@ -6604,7 +6626,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6604
6626
  if (!await w(this, m, ze).call(this, i(this, m, Z)))
6605
6627
  throw e;
6606
6628
  }
6607
- }, br = async function() {
6629
+ }, Or = async function() {
6608
6630
  if (!await w(this, m, ze).call(this, i(this, m, De)))
6609
6631
  try {
6610
6632
  await w(this, m, at).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, De)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
@@ -6612,7 +6634,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6612
6634
  if (!await w(this, m, ze).call(this, i(this, m, De)))
6613
6635
  throw e;
6614
6636
  }
6615
- }, Or = async function() {
6637
+ }, Tr = async function() {
6616
6638
  if (!await w(this, m, ln).call(this))
6617
6639
  try {
6618
6640
  await i(this, k).db.withPlugin(i(this, m, ee)).insertInto(i(this, m, De)).values({ id: Vt, is_locked: 0 }).execute();
@@ -6629,7 +6651,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6629
6651
  })).some((a) => a.name === e && (!n || a.schema === n));
6630
6652
  }, ln = async function() {
6631
6653
  return !!await i(this, k).db.withPlugin(i(this, m, ee)).selectFrom(i(this, m, De)).where("id", "=", Vt).select("id").executeTakeFirst();
6632
- }, Tr = async function(e) {
6654
+ }, Sr = async function(e) {
6633
6655
  const n = i(this, k).db.getExecutor().adapter, r = s({
6634
6656
  lockTable: i(this, k).migrationLockTableName ?? Bn,
6635
6657
  lockRowId: Vt,
@@ -6637,27 +6659,27 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6637
6659
  }), a = async (o) => {
6638
6660
  try {
6639
6661
  await n.acquireMigrationLock(o, r);
6640
- const u = await w(this, m, Sr).call(this, o);
6662
+ const u = await w(this, m, kr).call(this, o);
6641
6663
  if (u.migrations.length === 0)
6642
6664
  return { results: [] };
6643
6665
  const { direction: c, step: l } = e(u);
6644
- return l <= 0 ? { results: [] } : c === "Down" ? await w(this, m, Pr).call(this, o, u, l) : c === "Up" ? await w(this, m, $r).call(this, o, u, l) : { results: [] };
6666
+ return l <= 0 ? { results: [] } : c === "Down" ? await w(this, m, $r).call(this, o, u, l) : c === "Up" ? await w(this, m, Dr).call(this, o, u, l) : { results: [] };
6645
6667
  } finally {
6646
6668
  await n.releaseMigrationLock(o, r);
6647
6669
  }
6648
6670
  };
6649
6671
  return n.supportsTransactionalDdl ? i(this, k).db.transaction().execute(a) : i(this, k).db.connection().execute(a);
6650
- }, Sr = async function(e) {
6651
- const n = await w(this, m, dn).call(this), r = await w(this, m, Er).call(this, e);
6652
- w(this, m, Ir).call(this, n, r), i(this, m, Nr) || w(this, m, Ar).call(this, n, r);
6653
- const a = w(this, m, kr).call(this, n, r);
6672
+ }, kr = async function(e) {
6673
+ const n = await w(this, m, dn).call(this), r = await w(this, m, Ir).call(this, e);
6674
+ w(this, m, Ar).call(this, n, r), i(this, m, vr) || w(this, m, Pr).call(this, n, r);
6675
+ const a = w(this, m, Er).call(this, n, r);
6654
6676
  return s({
6655
6677
  migrations: n,
6656
6678
  executedMigrations: r,
6657
- lastMigration: Ri(r),
6679
+ lastMigration: Fi(r),
6658
6680
  pendingMigrations: a
6659
6681
  });
6660
- }, kr = function(e, n) {
6682
+ }, Er = function(e, n) {
6661
6683
  return e.filter((r) => !n.includes(r.name));
6662
6684
  }, dn = async function() {
6663
6685
  const e = await i(this, k).provider.getMigrations();
@@ -6665,17 +6687,17 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6665
6687
  ...e[n],
6666
6688
  name: n
6667
6689
  }));
6668
- }, Er = async function(e) {
6690
+ }, Ir = async function(e) {
6669
6691
  return (await e.withPlugin(i(this, m, ee)).selectFrom(i(this, m, Z)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
6670
- }, Ir = function(e, n) {
6692
+ }, Ar = function(e, n) {
6671
6693
  for (const r of n)
6672
6694
  if (!e.some((a) => a.name === r))
6673
6695
  throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
6674
- }, Ar = function(e, n) {
6696
+ }, Pr = function(e, n) {
6675
6697
  for (let r = 0; r < n.length; ++r)
6676
6698
  if (e[r].name !== n[r])
6677
6699
  throw new Error(`corrupted migrations: expected previously executed migration ${n[r]} to be at index ${r} but ${e[r].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
6678
- }, Pr = async function(e, n, r) {
6700
+ }, $r = async function(e, n, r) {
6679
6701
  const a = n.executedMigrations.slice().reverse().slice(0, r).map((u) => n.migrations.find((c) => c.name === u)), o = a.map((u) => ({
6680
6702
  migrationName: u.name,
6681
6703
  direction: "Down",
@@ -6701,7 +6723,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6701
6723
  }
6702
6724
  }
6703
6725
  return { results: o };
6704
- }, $r = async function(e, n, r) {
6726
+ }, Dr = async function(e, n, r) {
6705
6727
  const o = n.pendingMigrations.slice(0, r).map((u) => ({
6706
6728
  migrationName: u.name,
6707
6729
  direction: "Up",
@@ -6745,7 +6767,7 @@ class Gt extends Error {
6745
6767
  }
6746
6768
  }
6747
6769
  wt = new WeakMap();
6748
- class Dr {
6770
+ class zr {
6749
6771
  constructor(e) {
6750
6772
  oe(this, "migrations");
6751
6773
  this.migrations = e;
@@ -6754,7 +6776,7 @@ class Dr {
6754
6776
  return this.migrations;
6755
6777
  }
6756
6778
  }
6757
- async function au(t) {
6779
+ async function ou(t) {
6758
6780
  await t.schema.createTable("tenants").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)").addColumn("audience", "varchar(255)").addColumn("sender_email", "varchar(255)").addColumn("sender_name", "varchar(255)").addColumn("language", "varchar(255)").addColumn("logo", "varchar(255)").addColumn("primary_color", "varchar(255)").addColumn("secondary_color", "varchar(255)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createTable("users").addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn(
6759
6781
  "tenant_id",
6760
6782
  "varchar(255)",
@@ -6826,35 +6848,35 @@ async function au(t) {
6826
6848
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
6827
6849
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("email_service", "varchar(255)").addColumn("email_api_key", "varchar(255)").addColumn("dkim_private_key", "varchar(2048)").addColumn("dkim_public_key", "varchar(2048)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute();
6828
6850
  }
6829
- async function ou(t) {
6851
+ async function iu(t) {
6830
6852
  await t.schema.dropTable("domains").execute(), await t.schema.dropTable("members").execute(), await t.schema.dropTable("users").execute(), await t.schema.dropTable("connections").execute(), await t.schema.dropTable("applications").execute(), await t.schema.dropTable("migrations").execute(), await t.schema.dropTable("tenants").execute();
6831
6853
  }
6832
- const iu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6854
+ const su = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6833
6855
  __proto__: null,
6834
- down: ou,
6835
- up: au
6856
+ down: iu,
6857
+ up: ou
6836
6858
  }, Symbol.toStringTag, { value: "Module" }));
6837
- async function su(t) {
6859
+ async function uu(t) {
6838
6860
  await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
6839
6861
  }
6840
- async function uu(t) {
6862
+ async function cu(t) {
6841
6863
  await t.schema.alterTable("tenants").dropColumn("support_url").execute();
6842
6864
  }
6843
- const cu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6865
+ const lu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6844
6866
  __proto__: null,
6845
- down: uu,
6846
- up: su
6867
+ down: cu,
6868
+ up: uu
6847
6869
  }, Symbol.toStringTag, { value: "Module" }));
6848
- async function lu(t) {
6849
- }
6850
6870
  async function du(t) {
6851
6871
  }
6852
- const _u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6872
+ async function _u(t) {
6873
+ }
6874
+ const mu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6853
6875
  __proto__: null,
6854
- down: du,
6855
- up: lu
6876
+ down: _u,
6877
+ up: du
6856
6878
  }, Symbol.toStringTag, { value: "Module" }));
6857
- async function mu(t) {
6879
+ async function hu(t) {
6858
6880
  await t.schema.createTable("logs").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("category", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addForeignKeyConstraint(
6859
6881
  "tenant_id_constraint",
6860
6882
  ["tenant_id"],
@@ -6863,24 +6885,24 @@ async function mu(t) {
6863
6885
  (e) => e.onDelete("cascade")
6864
6886
  ).addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (e) => e.notNull()).addColumn("date", "varchar(25)", (e) => e.notNull()).addColumn("client_id", "varchar(255)").addColumn("client_name", "varchar(255)").addColumn("user_agent", "varchar(255)").addColumn("description", "varchar(255)").addColumn("details", "varchar(2048)").execute();
6865
6887
  }
6866
- async function hu(t) {
6888
+ async function fu(t) {
6867
6889
  await t.schema.dropTable("logs").execute();
6868
6890
  }
6869
- const fu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6891
+ const pu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6870
6892
  __proto__: null,
6871
- down: hu,
6872
- up: mu
6893
+ down: fu,
6894
+ up: hu
6873
6895
  }, Symbol.toStringTag, { value: "Module" }));
6874
- async function pu(t) {
6875
- }
6876
6896
  async function gu(t) {
6877
6897
  }
6878
- const yu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6898
+ async function yu(t) {
6899
+ }
6900
+ const wu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6879
6901
  __proto__: null,
6880
- down: gu,
6881
- up: pu
6902
+ down: yu,
6903
+ up: gu
6882
6904
  }, Symbol.toStringTag, { value: "Module" }));
6883
- async function wu(t) {
6905
+ async function Nu(t) {
6884
6906
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
6885
6907
  "user_id_constraint",
6886
6908
  ["user_id", "tenant_id"],
@@ -6905,15 +6927,15 @@ async function wu(t) {
6905
6927
  (e) => e.references("applications.id").onDelete("cascade").notNull()
6906
6928
  ).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("send", "varchar(255)").addColumn("nonce", "varchar(255)").addColumn("state", "varchar(1024)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute(), await t.schema.createIndex("otps_email_index").on("otps").column("email").execute(), await t.schema.createIndex("otps_expires_at_index").on("otps").column("expires_at").execute();
6907
6929
  }
6908
- async function Nu(t) {
6930
+ async function vu(t) {
6909
6931
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
6910
6932
  }
6911
- const vu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6933
+ const Cu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6912
6934
  __proto__: null,
6913
- down: Nu,
6914
- up: wu
6935
+ down: vu,
6936
+ up: Nu
6915
6937
  }, Symbol.toStringTag, { value: "Module" }));
6916
- async function Cu(t) {
6938
+ async function xu(t) {
6917
6939
  await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
6918
6940
  "user_id_constraint",
6919
6941
  ["user_id", "tenant_id"],
@@ -6928,24 +6950,24 @@ async function Cu(t) {
6928
6950
  (e) => e.onDelete("cascade")
6929
6951
  ).addColumn("type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute(), await t.schema.createIndex("codes_expires_at_index").on("codes").column("expires_at").execute();
6930
6952
  }
6931
- async function xu(t) {
6953
+ async function bu(t) {
6932
6954
  await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
6933
6955
  }
6934
- const bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6956
+ const Ou = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6935
6957
  __proto__: null,
6936
- down: xu,
6937
- up: Cu
6958
+ down: bu,
6959
+ up: xu
6938
6960
  }, Symbol.toStringTag, { value: "Module" }));
6939
- async function Ou(t) {
6940
- }
6941
6961
  async function Tu(t) {
6942
6962
  }
6943
- const Su = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6963
+ async function Su(t) {
6964
+ }
6965
+ const ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6944
6966
  __proto__: null,
6945
- down: Tu,
6946
- up: Ou
6967
+ down: Su,
6968
+ up: Tu
6947
6969
  }, Symbol.toStringTag, { value: "Module" }));
6948
- async function ku(t) {
6970
+ async function Eu(t) {
6949
6971
  await t.schema.alterTable("passwords").addColumn(
6950
6972
  "password",
6951
6973
  "varchar(255)",
@@ -6953,86 +6975,86 @@ async function ku(t) {
6953
6975
  (e) => e.notNull()
6954
6976
  ).execute();
6955
6977
  }
6956
- async function Eu(t) {
6978
+ async function Iu(t) {
6957
6979
  await t.schema.alterTable("passwords").dropColumn("password").execute();
6958
6980
  }
6959
- const Iu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6981
+ const Au = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6960
6982
  __proto__: null,
6961
- down: Eu,
6962
- up: ku
6983
+ down: Iu,
6984
+ up: Eu
6963
6985
  }, Symbol.toStringTag, { value: "Module" }));
6964
- async function Au(t) {
6965
- }
6966
6986
  async function Pu(t) {
6967
6987
  }
6968
- const $u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6988
+ async function $u(t) {
6989
+ }
6990
+ const Du = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6969
6991
  __proto__: null,
6970
- down: Pu,
6971
- up: Au
6992
+ down: $u,
6993
+ up: Pu
6972
6994
  }, Symbol.toStringTag, { value: "Module" }));
6973
- async function Du(t) {
6974
- }
6975
6995
  async function zu(t) {
6976
6996
  }
6977
- const Ru = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6997
+ async function Ru(t) {
6998
+ }
6999
+ const Fu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6978
7000
  __proto__: null,
6979
- down: zu,
6980
- up: Du
7001
+ down: Ru,
7002
+ up: zu
6981
7003
  }, Symbol.toStringTag, { value: "Module" }));
6982
- async function Fu(t) {
6983
- }
6984
7004
  async function ju(t) {
6985
7005
  }
6986
- const Lu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7006
+ async function Lu(t) {
7007
+ }
7008
+ const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6987
7009
  __proto__: null,
6988
- down: ju,
6989
- up: Fu
7010
+ down: Lu,
7011
+ up: ju
6990
7012
  }, Symbol.toStringTag, { value: "Module" }));
6991
- async function Ju(t) {
7013
+ async function Mu(t) {
6992
7014
  await t.schema.createIndex("users_email_index").on("users").column("email").execute();
6993
7015
  }
6994
- async function Mu(t) {
7016
+ async function qu(t) {
6995
7017
  await t.schema.dropIndex("users_email_index").execute();
6996
7018
  }
6997
- const qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7019
+ const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6998
7020
  __proto__: null,
6999
- down: Mu,
7000
- up: Ju
7021
+ down: qu,
7022
+ up: Mu
7001
7023
  }, Symbol.toStringTag, { value: "Module" }));
7002
- async function Bu(t) {
7024
+ async function Wu(t) {
7003
7025
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
7004
7026
  }
7005
- async function Wu(t) {
7027
+ async function Ku(t) {
7006
7028
  await t.schema.alterTable("users").dropColumn("profileData").execute();
7007
7029
  }
7008
- const Ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7030
+ const Uu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7009
7031
  __proto__: null,
7010
- down: Wu,
7011
- up: Bu
7032
+ down: Ku,
7033
+ up: Wu
7012
7034
  }, Symbol.toStringTag, { value: "Module" }));
7013
- async function Uu(t) {
7035
+ async function Qu(t) {
7014
7036
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
7015
7037
  }
7016
- async function Qu(t) {
7038
+ async function Vu(t) {
7017
7039
  await t.schema.dropIndex("users_linked_to_index");
7018
7040
  }
7019
- const Vu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7041
+ const Gu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7020
7042
  __proto__: null,
7021
- down: Qu,
7022
- up: Uu
7043
+ down: Vu,
7044
+ up: Qu
7023
7045
  }, Symbol.toStringTag, { value: "Module" }));
7024
- async function Gu(t) {
7046
+ async function Yu(t) {
7025
7047
  await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
7026
7048
  }
7027
- async function Yu(t) {
7049
+ async function Hu(t) {
7028
7050
  await t.schema.alterTable("users").dropColumn("locale").execute();
7029
7051
  }
7030
- const Hu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7052
+ const Xu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7031
7053
  __proto__: null,
7032
- down: Yu,
7033
- up: Gu
7054
+ down: Hu,
7055
+ up: Yu
7034
7056
  }, Symbol.toStringTag, { value: "Module" }));
7035
- async function Xu(t) {
7057
+ async function Zu(t) {
7036
7058
  await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
7037
7059
  "tenant_id",
7038
7060
  "varchar(255)",
@@ -7047,202 +7069,202 @@ async function Xu(t) {
7047
7069
  (e) => e.references("connections.id").onDelete("cascade")
7048
7070
  ).execute();
7049
7071
  }
7050
- async function Zu(t) {
7072
+ async function ec(t) {
7051
7073
  await t.schema.dropTable("keys").execute();
7052
7074
  }
7053
- const ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7075
+ const tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7054
7076
  __proto__: null,
7055
- down: Zu,
7056
- up: Xu
7077
+ down: ec,
7078
+ up: Zu
7057
7079
  }, Symbol.toStringTag, { value: "Module" }));
7058
- async function tc(t) {
7059
- }
7060
7080
  async function nc(t) {
7061
7081
  }
7062
- const rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7082
+ async function rc(t) {
7083
+ }
7084
+ const ac = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7063
7085
  __proto__: null,
7064
- down: nc,
7065
- up: tc
7086
+ down: rc,
7087
+ up: nc
7066
7088
  }, Symbol.toStringTag, { value: "Module" }));
7067
- async function ac(t) {
7068
- }
7069
7089
  async function oc(t) {
7070
7090
  }
7071
- const ic = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7091
+ async function ic(t) {
7092
+ }
7093
+ const sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7072
7094
  __proto__: null,
7073
- down: oc,
7074
- up: ac
7095
+ down: ic,
7096
+ up: oc
7075
7097
  }, Symbol.toStringTag, { value: "Module" }));
7076
- async function sc(t) {
7098
+ async function uc(t) {
7077
7099
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
7078
7100
  }
7079
- async function uc(t) {
7101
+ async function cc(t) {
7080
7102
  await t.schema.alterTable("otps").dropColumn("audience").execute();
7081
7103
  }
7082
- const cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7104
+ const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7083
7105
  __proto__: null,
7084
- down: uc,
7085
- up: sc
7106
+ down: cc,
7107
+ up: uc
7086
7108
  }, Symbol.toStringTag, { value: "Module" }));
7087
- async function lc(t) {
7088
- }
7089
7109
  async function dc(t) {
7090
7110
  }
7091
- const _c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7111
+ async function _c(t) {
7112
+ }
7113
+ const mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7092
7114
  __proto__: null,
7093
- down: dc,
7094
- up: lc
7115
+ down: _c,
7116
+ up: dc
7095
7117
  }, Symbol.toStringTag, { value: "Module" }));
7096
- async function mc(t) {
7118
+ async function hc(t) {
7097
7119
  await t.schema.alterTable("logs").dropColumn("category").execute();
7098
7120
  }
7099
- async function hc(t) {
7121
+ async function fc(t) {
7100
7122
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
7101
7123
  }
7102
- const fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7124
+ const pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7103
7125
  __proto__: null,
7104
- down: hc,
7105
- up: mc
7126
+ down: fc,
7127
+ up: hc
7106
7128
  }, Symbol.toStringTag, { value: "Module" }));
7107
- async function pc(t) {
7129
+ async function gc(t) {
7108
7130
  await t.schema.alterTable("users").dropColumn("tags").execute();
7109
7131
  }
7110
- async function gc(t) {
7132
+ async function yc(t) {
7111
7133
  await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
7112
7134
  }
7113
- const yc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7135
+ const wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7114
7136
  __proto__: null,
7115
- down: gc,
7116
- up: pc
7137
+ down: yc,
7138
+ up: gc
7117
7139
  }, Symbol.toStringTag, { value: "Module" }));
7118
- async function wc(t) {
7140
+ async function Nc(t) {
7119
7141
  await t.schema.createIndex("logs_user_id").on("logs").column("user_id").execute(), await t.schema.createIndex("logs_tenant_id").on("logs").column("tenant_id").execute(), await t.schema.createIndex("logs_date").on("logs").column("date").execute();
7120
7142
  }
7121
- async function Nc(t) {
7143
+ async function vc(t) {
7122
7144
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
7123
7145
  }
7124
- const vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7146
+ const Cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7125
7147
  __proto__: null,
7126
- down: Nc,
7127
- up: wc
7148
+ down: vc,
7149
+ up: Nc
7128
7150
  }, Symbol.toStringTag, { value: "Module" }));
7129
- async function Cc(t) {
7151
+ async function xc(t) {
7130
7152
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
7131
7153
  }
7132
- async function xc(t) {
7154
+ async function bc(t) {
7133
7155
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
7134
7156
  }
7135
- const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7157
+ const Oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7136
7158
  __proto__: null,
7137
- down: xc,
7138
- up: Cc
7159
+ down: bc,
7160
+ up: xc
7139
7161
  }, Symbol.toStringTag, { value: "Module" }));
7140
- async function Oc(t) {
7162
+ async function Tc(t) {
7141
7163
  await t.schema.alterTable("logs").addColumn("user_name", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("auth0_client", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("isMobile", "boolean").execute(), await t.schema.alterTable("logs").addColumn("connection", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("connection_id", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("audience", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("scope", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy_type", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("hostname", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("session_connection", "varchar(255)").execute();
7142
7164
  }
7143
- async function Tc(t) {
7165
+ async function Sc(t) {
7144
7166
  await t.schema.alterTable("logs").dropColumn("user_name").execute(), await t.schema.alterTable("logs").dropColumn("auth0_client").execute(), await t.schema.alterTable("logs").dropColumn("isMobile").execute(), await t.schema.alterTable("logs").dropColumn("connection").execute(), await t.schema.alterTable("logs").dropColumn("connection_id").execute(), await t.schema.alterTable("logs").dropColumn("audience").execute(), await t.schema.alterTable("logs").dropColumn("scope").execute(), await t.schema.alterTable("logs").dropColumn("strategy").execute(), await t.schema.alterTable("logs").dropColumn("strategy_type").execute(), await t.schema.alterTable("logs").dropColumn("hostname").execute(), await t.schema.alterTable("logs").dropColumn("session_connection").execute();
7145
7167
  }
7146
- const Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7168
+ const kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7147
7169
  __proto__: null,
7148
- down: Tc,
7149
- up: Oc
7170
+ down: Sc,
7171
+ up: Tc
7150
7172
  }, Symbol.toStringTag, { value: "Module" }));
7151
- async function kc(t) {
7173
+ async function Ec(t) {
7152
7174
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
7153
7175
  }
7154
- async function Ec(t) {
7176
+ async function Ic(t) {
7155
7177
  await t.schema.dropIndex("users_name_index").execute();
7156
7178
  }
7157
- const Ic = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7179
+ const Ac = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7158
7180
  __proto__: null,
7159
- down: Ec,
7160
- up: kc
7181
+ down: Ic,
7182
+ up: Ec
7161
7183
  }, Symbol.toStringTag, { value: "Module" }));
7162
- async function Ac(t) {
7163
- }
7164
7184
  async function Pc(t) {
7185
+ }
7186
+ async function $c(t) {
7165
7187
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
7166
7188
  }
7167
- const $c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7189
+ const Dc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7168
7190
  __proto__: null,
7169
- down: Pc,
7170
- up: Ac
7191
+ down: $c,
7192
+ up: Pc
7171
7193
  }, Symbol.toStringTag, { value: "Module" }));
7172
- async function Dc(t) {
7194
+ async function zc(t) {
7173
7195
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
7174
7196
  }
7175
- async function zc(t) {
7197
+ async function Rc(t) {
7176
7198
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
7177
7199
  }
7178
- const Rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7200
+ const Fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7179
7201
  __proto__: null,
7180
- down: zc,
7181
- up: Dc
7202
+ down: Rc,
7203
+ up: zc
7182
7204
  }, Symbol.toStringTag, { value: "Module" }));
7183
- async function Fc(t) {
7205
+ async function jc(t) {
7184
7206
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
7185
7207
  }
7186
- async function jc(t) {
7208
+ async function Lc(t) {
7187
7209
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
7188
7210
  }
7189
- const Lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7211
+ const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7190
7212
  __proto__: null,
7191
- down: jc,
7192
- up: Fc
7213
+ down: Lc,
7214
+ up: jc
7193
7215
  }, Symbol.toStringTag, { value: "Module" }));
7194
- async function Jc(t) {
7216
+ async function Mc(t) {
7195
7217
  await t.schema.createTable("branding").addColumn(
7196
7218
  "tenant_id",
7197
7219
  "varchar(255)",
7198
7220
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
7199
7221
  ).addColumn("logo_url", "varchar(512)").addColumn("favicon_url", "varchar(512)").addColumn("font_url", "varchar(512)").addColumn("colors_primary", "varchar(8)").addColumn("colors_page_background_type", "varchar(32)").addColumn("colors_page_background_start", "varchar(8)").addColumn("colors_page_background_end", "varchar(8)").addColumn("colors_page_background_angle_dev", "integer").execute();
7200
7222
  }
7201
- async function Mc(t) {
7223
+ async function qc(t) {
7202
7224
  await t.schema.dropTable("branding").execute();
7203
7225
  }
7204
- const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7226
+ const Bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7205
7227
  __proto__: null,
7206
- down: Mc,
7207
- up: Jc
7228
+ down: qc,
7229
+ up: Mc
7208
7230
  }, Symbol.toStringTag, { value: "Module" }));
7209
- async function Bc(t) {
7210
- }
7211
7231
  async function Wc(t) {
7212
7232
  }
7213
- const Kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7233
+ async function Kc(t) {
7234
+ }
7235
+ const Uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7214
7236
  __proto__: null,
7215
- down: Wc,
7216
- up: Bc
7237
+ down: Kc,
7238
+ up: Wc
7217
7239
  }, Symbol.toStringTag, { value: "Module" }));
7218
- async function Uc(t) {
7219
- }
7220
7240
  async function Qc(t) {
7221
7241
  }
7222
- const Vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7242
+ async function Vc(t) {
7243
+ }
7244
+ const Gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7223
7245
  __proto__: null,
7224
- down: Qc,
7225
- up: Uc
7246
+ down: Vc,
7247
+ up: Qc
7226
7248
  }, Symbol.toStringTag, { value: "Module" }));
7227
- async function Gc(t) {
7228
- }
7229
7249
  async function Yc(t) {
7230
7250
  }
7231
- const Hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7251
+ async function Hc(t) {
7252
+ }
7253
+ const Xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7232
7254
  __proto__: null,
7233
- down: Yc,
7234
- up: Gc
7255
+ down: Hc,
7256
+ up: Yc
7235
7257
  }, Symbol.toStringTag, { value: "Module" }));
7236
- async function Xc(t) {
7237
- }
7238
7258
  async function Zc(t) {
7239
7259
  }
7240
- const el = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7260
+ async function el(t) {
7261
+ }
7262
+ const tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7241
7263
  __proto__: null,
7242
- down: Zc,
7243
- up: Xc
7264
+ down: el,
7265
+ up: Zc
7244
7266
  }, Symbol.toStringTag, { value: "Module" }));
7245
- async function tl(t) {
7267
+ async function nl(t) {
7246
7268
  await t.schema.createTable("authentication_codes").addColumn(
7247
7269
  "tenant_id",
7248
7270
  "varchar(255)",
@@ -7253,55 +7275,55 @@ async function tl(t) {
7253
7275
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7254
7276
  ).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7255
7277
  }
7256
- async function nl(t) {
7278
+ async function rl(t) {
7257
7279
  await t.schema.dropTable("authentication_codes").execute();
7258
7280
  }
7259
- const rl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7281
+ const al = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7260
7282
  __proto__: null,
7261
- down: nl,
7262
- up: tl
7283
+ down: rl,
7284
+ up: nl
7263
7285
  }, Symbol.toStringTag, { value: "Module" }));
7264
- async function al(t) {
7265
- }
7266
7286
  async function ol(t) {
7267
7287
  }
7268
- const il = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7288
+ async function il(t) {
7289
+ }
7290
+ const sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7269
7291
  __proto__: null,
7270
- down: ol,
7271
- up: al
7292
+ down: il,
7293
+ up: ol
7272
7294
  }, Symbol.toStringTag, { value: "Module" }));
7273
- async function sl(t) {
7295
+ async function ul(t) {
7274
7296
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
7275
7297
  }
7276
- async function ul(t) {
7298
+ async function cl(t) {
7277
7299
  await t.schema.alterTable("otps").dropColumn("ip").execute();
7278
7300
  }
7279
- const cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7301
+ const ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7280
7302
  __proto__: null,
7281
- down: ul,
7282
- up: sl
7303
+ down: cl,
7304
+ up: ul
7283
7305
  }, Symbol.toStringTag, { value: "Module" }));
7284
- async function ll(t) {
7306
+ async function dl(t) {
7285
7307
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
7286
7308
  }
7287
- async function dl(t) {
7309
+ async function _l(t) {
7288
7310
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
7289
7311
  }
7290
- const _l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7312
+ const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7291
7313
  __proto__: null,
7292
- down: dl,
7293
- up: ll
7314
+ down: _l,
7315
+ up: dl
7294
7316
  }, Symbol.toStringTag, { value: "Module" }));
7295
- async function ml(t) {
7296
- }
7297
7317
  async function hl(t) {
7298
7318
  }
7299
- const fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7319
+ async function fl(t) {
7320
+ }
7321
+ const pl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7300
7322
  __proto__: null,
7301
- down: hl,
7302
- up: ml
7323
+ down: fl,
7324
+ up: hl
7303
7325
  }, Symbol.toStringTag, { value: "Module" }));
7304
- async function pl(t) {
7326
+ async function gl(t) {
7305
7327
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
7306
7328
  "tenant_id",
7307
7329
  "varchar(255)",
@@ -7312,33 +7334,33 @@ async function pl(t) {
7312
7334
  (e) => e.defaultTo(!1).notNull()
7313
7335
  ).addColumn("priority", "integer").execute();
7314
7336
  }
7315
- async function gl(t) {
7337
+ async function yl(t) {
7316
7338
  await t.schema.dropTable("hooks").execute();
7317
7339
  }
7318
- const yl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7340
+ const wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7319
7341
  __proto__: null,
7320
- down: gl,
7321
- up: pl
7342
+ down: yl,
7343
+ up: gl
7322
7344
  }, Symbol.toStringTag, { value: "Module" }));
7323
- async function wl(t) {
7324
- }
7325
7345
  async function Nl(t) {
7326
7346
  }
7327
- const vl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7347
+ async function vl(t) {
7348
+ }
7349
+ const Cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7328
7350
  __proto__: null,
7329
- down: Nl,
7330
- up: wl
7351
+ down: vl,
7352
+ up: Nl
7331
7353
  }, Symbol.toStringTag, { value: "Module" }));
7332
- async function Cl(t) {
7333
- }
7334
7354
  async function xl(t) {
7335
7355
  }
7336
- const bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7356
+ async function bl(t) {
7357
+ }
7358
+ const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7337
7359
  __proto__: null,
7338
- down: xl,
7339
- up: Cl
7360
+ down: bl,
7361
+ up: xl
7340
7362
  }, Symbol.toStringTag, { value: "Module" }));
7341
- async function Ol(t) {
7363
+ async function Tl(t) {
7342
7364
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7343
7365
  "tenant_id",
7344
7366
  "varchar(255)",
@@ -7355,7 +7377,7 @@ async function Ol(t) {
7355
7377
  (e) => e.onDelete("cascade")
7356
7378
  ).addColumn("code_type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7357
7379
  }
7358
- async function Tl(t) {
7380
+ async function Sl(t) {
7359
7381
  await t.schema.dropTable("logins").execute(), await t.schema.alterTable("passwords").dropColumn("algorithm").execute(), await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("tenant_id", "varchar(255)").addForeignKeyConstraint(
7360
7382
  "codes_user_id_tenant_id_constraint",
7361
7383
  ["user_id", "tenant_id"],
@@ -7364,90 +7386,90 @@ async function Tl(t) {
7364
7386
  (e) => e.onDelete("cascade")
7365
7387
  ).addColumn("type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7366
7388
  }
7367
- const Sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7389
+ const kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7368
7390
  __proto__: null,
7369
- down: Tl,
7370
- up: Ol
7391
+ down: Sl,
7392
+ up: Tl
7371
7393
  }, Symbol.toStringTag, { value: "Module" }));
7372
- async function kl(t) {
7373
- }
7374
7394
  async function El(t) {
7375
7395
  }
7376
- const Il = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7396
+ async function Il(t) {
7397
+ }
7398
+ const Al = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7377
7399
  __proto__: null,
7378
- down: El,
7379
- up: kl
7400
+ down: Il,
7401
+ up: El
7380
7402
  }, Symbol.toStringTag, { value: "Module" }));
7381
- async function Al(t) {
7403
+ async function Pl(t) {
7382
7404
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
7383
7405
  }
7384
- async function Pl(t) {
7406
+ async function $l(t) {
7385
7407
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
7386
7408
  }
7387
- const $l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7409
+ const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7388
7410
  __proto__: null,
7389
- down: Pl,
7390
- up: Al
7411
+ down: $l,
7412
+ up: Pl
7391
7413
  }, Symbol.toStringTag, { value: "Module" }));
7392
- async function Dl(t) {
7414
+ async function zl(t) {
7393
7415
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
7394
7416
  }
7395
- async function zl(t) {
7417
+ async function Rl(t) {
7396
7418
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
7397
7419
  }
7398
- const Rl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7420
+ const Fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7399
7421
  __proto__: null,
7400
- down: zl,
7401
- up: Dl
7422
+ down: Rl,
7423
+ up: zl
7402
7424
  }, Symbol.toStringTag, { value: "Module" }));
7403
- async function Fl(t) {
7404
- }
7405
7425
  async function jl(t) {
7406
7426
  }
7407
- const Ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7427
+ async function Ll(t) {
7428
+ }
7429
+ const Jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7408
7430
  __proto__: null,
7409
- down: jl,
7410
- up: Fl
7431
+ down: Ll,
7432
+ up: jl
7411
7433
  }, Symbol.toStringTag, { value: "Module" }));
7412
- async function Jl(t) {
7413
- }
7414
7434
  async function Ml(t) {
7415
7435
  }
7416
- const ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7436
+ async function ql(t) {
7437
+ }
7438
+ const Bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7417
7439
  __proto__: null,
7418
- down: Ml,
7419
- up: Jl
7440
+ down: ql,
7441
+ up: Ml
7420
7442
  }, Symbol.toStringTag, { value: "Module" }));
7421
- async function Bl(t) {
7443
+ async function Wl(t) {
7422
7444
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
7423
7445
  }
7424
- async function Wl(t) {
7446
+ async function Kl(t) {
7425
7447
  await t.schema.alterTable("logins").dropColumn("nonce").execute();
7426
7448
  }
7427
- const Kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7449
+ const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7428
7450
  __proto__: null,
7429
- down: Wl,
7430
- up: Bl
7451
+ down: Kl,
7452
+ up: Wl
7431
7453
  }, Symbol.toStringTag, { value: "Module" }));
7432
- async function Ul(t) {
7433
- }
7434
7454
  async function Ql(t) {
7435
7455
  }
7436
- const Vl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7456
+ async function Vl(t) {
7457
+ }
7458
+ const Gl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7437
7459
  __proto__: null,
7438
- down: Ql,
7439
- up: Ul
7460
+ down: Vl,
7461
+ up: Ql
7440
7462
  }, Symbol.toStringTag, { value: "Module" }));
7441
- async function Gl(t) {
7442
- }
7443
7463
  async function Yl(t) {
7444
7464
  }
7445
- const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7465
+ async function Hl(t) {
7466
+ }
7467
+ const Xl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7446
7468
  __proto__: null,
7447
- down: Yl,
7448
- up: Gl
7469
+ down: Hl,
7470
+ up: Yl
7449
7471
  }, Symbol.toStringTag, { value: "Module" }));
7450
- async function Xl(t) {
7472
+ async function Zl(t) {
7451
7473
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
7452
7474
  "tenant_id",
7453
7475
  "varchar(255)",
@@ -7463,7 +7485,7 @@ async function Xl(t) {
7463
7485
  "code_type"
7464
7486
  ]).execute();
7465
7487
  }
7466
- async function Zl(t) {
7488
+ async function ed(t) {
7467
7489
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7468
7490
  "tenant_id",
7469
7491
  "varchar(255)",
@@ -7476,15 +7498,15 @@ async function Zl(t) {
7476
7498
  (e) => e.onDelete("cascade")
7477
7499
  ).addColumn("code_type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7478
7500
  }
7479
- const ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7501
+ const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7480
7502
  __proto__: null,
7481
- down: Zl,
7482
- up: Xl
7503
+ down: ed,
7504
+ up: Zl
7483
7505
  }, Symbol.toStringTag, { value: "Module" }));
7484
- async function td(t) {
7506
+ async function nd(t) {
7485
7507
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
7486
7508
  }
7487
- async function nd(t) {
7509
+ async function rd(t) {
7488
7510
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
7489
7511
  "tenant_id",
7490
7512
  "varchar(255)",
@@ -7503,32 +7525,32 @@ async function nd(t) {
7503
7525
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7504
7526
  ).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7505
7527
  }
7506
- const rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7528
+ const ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7507
7529
  __proto__: null,
7508
- down: nd,
7509
- up: td
7530
+ down: rd,
7531
+ up: nd
7510
7532
  }, Symbol.toStringTag, { value: "Module" }));
7511
- async function ad(t) {
7533
+ async function od(t) {
7512
7534
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
7513
7535
  }
7514
- async function od(t) {
7536
+ async function id(t) {
7515
7537
  await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
7516
7538
  }
7517
- const id = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7539
+ const sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7518
7540
  __proto__: null,
7519
- down: od,
7520
- up: ad
7541
+ down: id,
7542
+ up: od
7521
7543
  }, Symbol.toStringTag, { value: "Module" }));
7522
- async function sd(t) {
7523
- }
7524
7544
  async function ud(t) {
7525
7545
  }
7526
- const cd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7546
+ async function cd(t) {
7547
+ }
7548
+ const ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7527
7549
  __proto__: null,
7528
- down: ud,
7529
- up: sd
7550
+ down: cd,
7551
+ up: ud
7530
7552
  }, Symbol.toStringTag, { value: "Module" }));
7531
- async function ld(t) {
7553
+ async function dd(t) {
7532
7554
  await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
7533
7555
  "universal_login_experience",
7534
7556
  "varchar(16)",
@@ -7547,95 +7569,95 @@ async function ld(t) {
7547
7569
  (e) => e.defaultTo(!1).notNull()
7548
7570
  ).execute();
7549
7571
  }
7550
- async function dd(t) {
7572
+ async function _d(t) {
7551
7573
  await t.schema.dropTable("prompt_settings").execute();
7552
7574
  }
7553
- const _d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7575
+ const md = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7554
7576
  __proto__: null,
7555
- down: dd,
7556
- up: ld
7577
+ down: _d,
7578
+ up: dd
7557
7579
  }, Symbol.toStringTag, { value: "Module" }));
7558
- async function md(t) {
7559
- }
7560
7580
  async function hd(t) {
7561
7581
  }
7562
- const fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7582
+ async function fd(t) {
7583
+ }
7584
+ const pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7563
7585
  __proto__: null,
7564
- down: hd,
7565
- up: md
7586
+ down: fd,
7587
+ up: hd
7566
7588
  }, Symbol.toStringTag, { value: "Module" }));
7567
- async function pd(t) {
7568
- }
7569
7589
  async function gd(t) {
7570
7590
  }
7571
- const yd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7591
+ async function yd(t) {
7592
+ }
7593
+ const wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7572
7594
  __proto__: null,
7573
- down: gd,
7574
- up: pd
7595
+ down: yd,
7596
+ up: gd
7575
7597
  }, Symbol.toStringTag, { value: "Module" }));
7576
- async function wd(t) {
7577
- }
7578
7598
  async function Nd(t) {
7579
7599
  }
7580
- const vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7600
+ async function vd(t) {
7601
+ }
7602
+ const Cd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7581
7603
  __proto__: null,
7582
- down: Nd,
7583
- up: wd
7604
+ down: vd,
7605
+ up: Nd
7584
7606
  }, Symbol.toStringTag, { value: "Module" }));
7585
- async function Cd(t) {
7607
+ async function xd(t) {
7586
7608
  await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
7587
7609
  }
7588
- async function xd(t) {
7610
+ async function bd(t) {
7589
7611
  await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
7590
7612
  }
7591
- const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7613
+ const Od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7592
7614
  __proto__: null,
7593
- down: xd,
7594
- up: Cd
7615
+ down: bd,
7616
+ up: xd
7595
7617
  }, Symbol.toStringTag, { value: "Module" }));
7596
- async function Od(t) {
7618
+ async function Td(t) {
7597
7619
  await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
7598
7620
  }
7599
- async function Td(t) {
7621
+ async function Sd(t) {
7600
7622
  await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
7601
7623
  }
7602
- const Sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7624
+ const kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7603
7625
  __proto__: null,
7604
- down: Td,
7605
- up: Od
7626
+ down: Sd,
7627
+ up: Td
7606
7628
  }, Symbol.toStringTag, { value: "Module" }));
7607
- async function kd(t) {
7608
- }
7609
7629
  async function Ed(t) {
7610
7630
  }
7611
- const Id = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7631
+ async function Id(t) {
7632
+ }
7633
+ const Ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7612
7634
  __proto__: null,
7613
- down: Ed,
7614
- up: kd
7635
+ down: Id,
7636
+ up: Ed
7615
7637
  }, Symbol.toStringTag, { value: "Module" }));
7616
- async function Ad(t) {
7638
+ async function Pd(t) {
7617
7639
  await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
7618
7640
  }
7619
- async function Pd(t) {
7641
+ async function $d(t) {
7620
7642
  await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
7621
7643
  }
7622
- const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7644
+ const Dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7623
7645
  __proto__: null,
7624
- down: Pd,
7625
- up: Ad
7646
+ down: $d,
7647
+ up: Pd
7626
7648
  }, Symbol.toStringTag, { value: "Module" }));
7627
- async function Dd(t) {
7649
+ async function zd(t) {
7628
7650
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
7629
7651
  }
7630
- async function zd(t) {
7652
+ async function Rd(t) {
7631
7653
  await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
7632
7654
  }
7633
- const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7655
+ const Fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7634
7656
  __proto__: null,
7635
- down: zd,
7636
- up: Dd
7657
+ down: Rd,
7658
+ up: zd
7637
7659
  }, Symbol.toStringTag, { value: "Module" }));
7638
- async function Fd(t) {
7660
+ async function jd(t) {
7639
7661
  await t.schema.createTable("email_providers").addColumn("tenant_id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("enabled", "boolean", (e) => e.notNull()).addColumn("default_from_address", "varchar(255)").addColumn(
7640
7662
  "credentials",
7641
7663
  "varchar(2048)",
@@ -7646,18 +7668,18 @@ async function Fd(t) {
7646
7668
  (e) => e.notNull().defaultTo("{}")
7647
7669
  ).addColumn("created_at", "varchar(29)", (e) => e.notNull()).addColumn("updated_at", "varchar(29)", (e) => e.notNull()).execute();
7648
7670
  }
7649
- async function jd(t) {
7671
+ async function Ld(t) {
7650
7672
  await t.schema.dropTable("email_providers").execute();
7651
7673
  }
7652
- const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7674
+ const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7653
7675
  __proto__: null,
7654
- down: jd,
7655
- up: Fd
7676
+ down: Ld,
7677
+ up: jd
7656
7678
  }, Symbol.toStringTag, { value: "Module" }));
7657
- async function Jd(t) {
7679
+ async function Md(t) {
7658
7680
  await t.schema.dropTable("tickets").execute();
7659
7681
  }
7660
- async function Md(t) {
7682
+ async function qd(t) {
7661
7683
  await t.schema.createTable("tickets").addColumn(
7662
7684
  "tenant_id",
7663
7685
  "varchar(255)",
@@ -7668,22 +7690,22 @@ async function Md(t) {
7668
7690
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7669
7691
  ).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(1024)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7670
7692
  }
7671
- const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7693
+ const Bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7672
7694
  __proto__: null,
7673
- down: Md,
7674
- up: Jd
7695
+ down: qd,
7696
+ up: Md
7675
7697
  }, Symbol.toStringTag, { value: "Module" }));
7676
- async function Bd(t) {
7677
- }
7678
7698
  async function Wd(t) {
7699
+ }
7700
+ async function Kd(t) {
7679
7701
  await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
7680
7702
  }
7681
- const Kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7703
+ const Ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7682
7704
  __proto__: null,
7683
- down: Wd,
7684
- up: Bd
7705
+ down: Kd,
7706
+ up: Wd
7685
7707
  }, Symbol.toStringTag, { value: "Module" }));
7686
- async function Ud(t) {
7708
+ async function Qd(t) {
7687
7709
  await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
7688
7710
  "client_id",
7689
7711
  "varchar(21)",
@@ -7696,27 +7718,27 @@ async function Ud(t) {
7696
7718
  (e) => e.onDelete("cascade")
7697
7719
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
7698
7720
  }
7699
- async function Qd(t) {
7721
+ async function Vd(t) {
7700
7722
  await t.schema.dropTable("refresh_tokens").execute();
7701
7723
  }
7702
- const Vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7724
+ const Gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7703
7725
  __proto__: null,
7704
- down: Qd,
7705
- up: Ud
7726
+ down: Vd,
7727
+ up: Qd
7706
7728
  }, Symbol.toStringTag, { value: "Module" }));
7707
- async function Gd(t) {
7708
- }
7709
7729
  async function Yd(t) {
7710
7730
  }
7711
- const Hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7731
+ async function Hd(t) {
7732
+ }
7733
+ const Xd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7712
7734
  __proto__: null,
7713
- down: Yd,
7714
- up: Gd
7735
+ down: Hd,
7736
+ up: Yd
7715
7737
  }, Symbol.toStringTag, { value: "Module" }));
7716
- async function Xd(t) {
7738
+ async function Zd(t) {
7717
7739
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
7718
7740
  }
7719
- async function Zd(t) {
7741
+ async function e_(t) {
7720
7742
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
7721
7743
  "sessions_user_id_constraint",
7722
7744
  ["user_id", "tenant_id"],
@@ -7735,12 +7757,12 @@ async function Zd(t) {
7735
7757
  (e) => e.onDelete("cascade")
7736
7758
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
7737
7759
  }
7738
- const e_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7760
+ const t_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7739
7761
  __proto__: null,
7740
- down: Zd,
7741
- up: Xd
7762
+ down: e_,
7763
+ up: Zd
7742
7764
  }, Symbol.toStringTag, { value: "Module" }));
7743
- async function t_(t) {
7765
+ async function n_(t) {
7744
7766
  await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
7745
7767
  "sessions_2_user_id_constraint",
7746
7768
  ["user_id", "tenant_id"],
@@ -7759,15 +7781,15 @@ async function t_(t) {
7759
7781
  (e) => e.onDelete("cascade")
7760
7782
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
7761
7783
  }
7762
- async function n_(t) {
7784
+ async function r_(t) {
7763
7785
  await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
7764
7786
  }
7765
- const r_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7787
+ const a_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7766
7788
  __proto__: null,
7767
- down: n_,
7768
- up: t_
7789
+ down: r_,
7790
+ up: n_
7769
7791
  }, Symbol.toStringTag, { value: "Module" }));
7770
- async function a_(t) {
7792
+ async function o_(t) {
7771
7793
  await t.schema.createTable("custom_domains").addColumn(
7772
7794
  "custom_domain_id",
7773
7795
  "varchar(21)",
@@ -7778,49 +7800,49 @@ async function a_(t) {
7778
7800
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
7779
7801
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("primary", "boolean", (e) => e.notNull()).addColumn("status", "varchar(50)", (e) => e.notNull()).addColumn("type", "varchar(50)", (e) => e.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute(), await t.schema.dropTable("domains").execute();
7780
7802
  }
7781
- async function o_(t) {
7803
+ async function i_(t) {
7782
7804
  await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("domains").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
7783
7805
  "tenant_id",
7784
7806
  "varchar(255)",
7785
7807
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
7786
7808
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("email_service", "varchar(255)").addColumn("email_api_key", "varchar(255)").addColumn("dkim_private_key", "varchar(2048)").addColumn("dkim_public_key", "varchar(2048)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute();
7787
7809
  }
7788
- const i_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7810
+ const s_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7789
7811
  __proto__: null,
7790
- down: o_,
7791
- up: a_
7812
+ down: i_,
7813
+ up: o_
7792
7814
  }, Symbol.toStringTag, { value: "Module" }));
7793
- async function s_(t) {
7794
- }
7795
7815
  async function u_(t) {
7816
+ }
7817
+ async function c_(t) {
7796
7818
  await t.schema.alterTable("logins").dropColumn("authParams_organization").dropColumn("authorization_url").execute();
7797
7819
  }
7798
- const c_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7820
+ const l_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7799
7821
  __proto__: null,
7800
- down: u_,
7801
- up: s_
7822
+ down: c_,
7823
+ up: u_
7802
7824
  }, Symbol.toStringTag, { value: "Module" }));
7803
- async function l_(t) {
7825
+ async function d_(t) {
7804
7826
  await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(2048)").execute();
7805
7827
  }
7806
- async function d_(t) {
7828
+ async function __(t) {
7807
7829
  await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(1024)").execute();
7808
7830
  }
7809
- const __ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7831
+ const m_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7810
7832
  __proto__: null,
7811
- down: d_,
7812
- up: l_
7833
+ down: __,
7834
+ up: d_
7813
7835
  }, Symbol.toStringTag, { value: "Module" }));
7814
- async function m_(t) {
7815
- }
7816
7836
  async function h_(t) {
7817
7837
  }
7818
- const f_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7838
+ async function f_(t) {
7839
+ }
7840
+ const p_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7819
7841
  __proto__: null,
7820
- down: h_,
7821
- up: m_
7842
+ down: f_,
7843
+ up: h_
7822
7844
  }, Symbol.toStringTag, { value: "Module" }));
7823
- async function p_(t) {
7845
+ async function g_(t) {
7824
7846
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
7825
7847
  "sessions_user_id_constraint",
7826
7848
  ["user_id", "tenant_id"],
@@ -7847,25 +7869,25 @@ async function p_(t) {
7847
7869
  (e) => e.onDelete("cascade")
7848
7870
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
7849
7871
  }
7850
- async function g_(t) {
7872
+ async function y_(t) {
7851
7873
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("login_sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
7852
7874
  }
7853
- const y_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7875
+ const w_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7854
7876
  __proto__: null,
7855
- down: g_,
7856
- up: p_
7877
+ down: y_,
7878
+ up: g_
7857
7879
  }, Symbol.toStringTag, { value: "Module" }));
7858
- async function w_(t) {
7880
+ async function N_(t) {
7859
7881
  await t.schema.dropTable("logins").execute(), await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
7860
7882
  }
7861
- async function N_(t) {
7883
+ async function v_(t) {
7862
7884
  }
7863
- const v_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7885
+ const C_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7864
7886
  __proto__: null,
7865
- down: N_,
7866
- up: w_
7887
+ down: v_,
7888
+ up: N_
7867
7889
  }, Symbol.toStringTag, { value: "Module" }));
7868
- async function C_(t) {
7890
+ async function x_(t) {
7869
7891
  await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("custom_domains").addColumn(
7870
7892
  "custom_domain_id",
7871
7893
  "varchar(256)",
@@ -7876,120 +7898,120 @@ async function C_(t) {
7876
7898
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
7877
7899
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("primary", "boolean", (e) => e.notNull()).addColumn("status", "varchar(50)", (e) => e.notNull()).addColumn("type", "varchar(50)", (e) => e.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute();
7878
7900
  }
7879
- async function x_(t) {
7901
+ async function b_(t) {
7880
7902
  }
7881
- const b_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7903
+ const O_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7882
7904
  __proto__: null,
7883
- down: x_,
7884
- up: C_
7905
+ down: b_,
7906
+ up: x_
7885
7907
  }, Symbol.toStringTag, { value: "Module" }));
7886
- async function O_(t) {
7887
- }
7888
7908
  async function T_(t) {
7909
+ }
7910
+ async function S_(t) {
7889
7911
  await t.schema.alterTable("users").dropColumn("phone_number").dropColumn("phone_verified").dropColumn("username").execute();
7890
7912
  }
7891
- const S_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7913
+ const k_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7892
7914
  __proto__: null,
7893
- down: T_,
7894
- up: O_
7915
+ down: S_,
7916
+ up: T_
7895
7917
  }, Symbol.toStringTag, { value: "Module" }));
7896
- async function k_(t) {
7918
+ async function E_(t) {
7897
7919
  await t.schema.createTable("forms").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(255)", (e) => e.notNull()).addColumn("messages", "varchar(255)").addColumn("languages", "varchar(255)").addColumn("translations", "varchar(4096)").addColumn("nodes", "varchar(4096)").addColumn("start", "varchar(255)").addColumn("ending", "varchar(255)").addColumn("style", "varchar(1042)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createIndex("forms_tenant_id_idx").on("forms").column("tenant_id").execute();
7898
7920
  }
7899
- async function E_(t) {
7921
+ async function I_(t) {
7900
7922
  await t.schema.dropTable("forms").execute();
7901
7923
  }
7902
- const I_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7924
+ const A_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7903
7925
  __proto__: null,
7904
- down: E_,
7905
- up: k_
7926
+ down: I_,
7927
+ up: E_
7906
7928
  }, Symbol.toStringTag, { value: "Module" }));
7907
- async function A_(t) {
7929
+ async function P_(t) {
7908
7930
  await t.schema.alterTable("hooks").addColumn("form_id", "text").execute(), await t.schema.alterTable("hooks").addColumn("url_tmp", "varchar(512)").execute(), await t.updateTable("hooks").set((e) => ({ url_tmp: e.ref("url") })).execute(), await t.schema.alterTable("hooks").dropColumn("url").execute(), await t.schema.alterTable("hooks").renameColumn("url_tmp", "url").execute();
7909
7931
  }
7910
- async function P_(t) {
7932
+ async function $_(t) {
7911
7933
  await t.schema.dropTable("hooks").ifExists().execute(), await t.schema.createTable("hooks").addColumn("hook_id", "text", (e) => e.primaryKey()).addColumn("tenant_id", "text", (e) => e.notNull()).addColumn("trigger_id", "text", (e) => e.notNull()).addColumn("enabled", "integer", (e) => e.notNull().defaultTo(0)).addColumn("url", "varchar(512)", (e) => e.notNull()).addColumn("synchronous", "integer", (e) => e.notNull().defaultTo(0)).addColumn("priority", "integer").addColumn("created_at", "text", (e) => e.notNull()).addColumn("updated_at", "text", (e) => e.notNull()).execute();
7912
7934
  }
7913
- const $_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7935
+ const D_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7914
7936
  __proto__: null,
7915
- down: P_,
7916
- up: A_
7937
+ down: $_,
7938
+ up: P_
7917
7939
  }, Symbol.toStringTag, { value: "Module" }));
7918
- async function D_(t) {
7940
+ async function z_(t) {
7919
7941
  await t.schema.alterTable("login_sessions").addColumn(
7920
7942
  "login_completed",
7921
7943
  "boolean",
7922
7944
  (e) => e.notNull().defaultTo(0)
7923
7945
  ).execute();
7924
7946
  }
7925
- async function z_(t) {
7947
+ async function R_(t) {
7926
7948
  await t.schema.alterTable("login_sessions").dropColumn("login_completed").execute();
7927
7949
  }
7928
- const R_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7950
+ const F_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7929
7951
  __proto__: null,
7930
- down: z_,
7931
- up: D_
7952
+ down: R_,
7953
+ up: z_
7932
7954
  }, Symbol.toStringTag, { value: "Module" }));
7933
- async function F_(t) {
7955
+ async function j_(t) {
7934
7956
  await t.schema.alterTable("sessions").addColumn(
7935
7957
  "login_session_id",
7936
7958
  "varchar(21)",
7937
7959
  (e) => e.references("login_sessions.id").onDelete("set null")
7938
7960
  ).execute();
7939
7961
  }
7940
- async function j_(t) {
7962
+ async function L_(t) {
7941
7963
  await t.schema.alterTable("sessions").dropColumn("login_session_id").execute();
7942
7964
  }
7943
- const L_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7965
+ const J_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7944
7966
  __proto__: null,
7945
- down: j_,
7946
- up: F_
7967
+ down: L_,
7968
+ up: j_
7947
7969
  }, Symbol.toStringTag, { value: "Module" }));
7948
- async function J_(t) {
7970
+ async function M_(t) {
7949
7971
  await t.schema.createIndex("IDX_sessions_login_session_id").on("sessions").column("login_session_id").execute();
7950
7972
  }
7951
- async function M_(t) {
7973
+ async function q_(t) {
7952
7974
  await t.schema.dropIndex("IDX_sessions_login_session_id").on("sessions").execute();
7953
7975
  }
7954
- const q_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7976
+ const B_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7955
7977
  __proto__: null,
7956
- down: M_,
7957
- up: J_
7978
+ down: q_,
7979
+ up: M_
7958
7980
  }, Symbol.toStringTag, { value: "Module" }));
7959
- async function B_(t) {
7981
+ async function W_(t) {
7960
7982
  await t.schema.alterTable("codes").addColumn("code_challenge", "varchar(128)").execute(), await t.schema.alterTable("codes").addColumn("code_challenge_method", "varchar(5)").execute();
7961
7983
  }
7962
- async function W_(t) {
7984
+ async function K_(t) {
7963
7985
  await t.schema.alterTable("codes").dropColumn("code_challenge").execute(), await t.schema.alterTable("codes").dropColumn("code_challenge_method").execute();
7964
7986
  }
7965
- const K_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7987
+ const U_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7966
7988
  __proto__: null,
7967
- down: W_,
7968
- up: B_
7989
+ down: K_,
7990
+ up: W_
7969
7991
  }, Symbol.toStringTag, { value: "Module" }));
7970
- async function U_(t) {
7992
+ async function Q_(t) {
7971
7993
  await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
7972
7994
  }
7973
- async function Q_(t) {
7995
+ async function V_(t) {
7974
7996
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
7975
7997
  }
7976
- const V_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7998
+ const G_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7977
7999
  __proto__: null,
7978
- down: Q_,
7979
- up: U_
8000
+ down: V_,
8001
+ up: Q_
7980
8002
  }, Symbol.toStringTag, { value: "Module" }));
7981
- async function G_(t) {
8003
+ async function Y_(t) {
7982
8004
  await t.schema.alterTable("codes").addColumn("nonce", "varchar(1024)").execute(), await t.schema.alterTable("codes").addColumn("state", "varchar(2048)").execute();
7983
8005
  }
7984
- async function Y_(t) {
8006
+ async function H_(t) {
7985
8007
  await t.schema.alterTable("codes").dropColumn("nonce").execute(), await t.schema.alterTable("codes").dropColumn("state").execute();
7986
8008
  }
7987
- const H_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8009
+ const X_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7988
8010
  __proto__: null,
7989
- down: Y_,
7990
- up: G_
8011
+ down: H_,
8012
+ up: Y_
7991
8013
  }, Symbol.toStringTag, { value: "Module" }));
7992
- async function X_(t) {
8014
+ async function Z_(t) {
7993
8015
  await t.schema.createTable("themes").addColumn(
7994
8016
  "tenant_id",
7995
8017
  "varchar(255)",
@@ -8064,26 +8086,26 @@ async function X_(t) {
8064
8086
  (e) => e.notNull()
8065
8087
  ).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();
8066
8088
  }
8067
- async function Z_(t) {
8089
+ async function em(t) {
8068
8090
  await t.schema.dropTable("themes").execute();
8069
8091
  }
8070
- const em = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8092
+ const tm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8071
8093
  __proto__: null,
8072
- down: Z_,
8073
- up: X_
8094
+ down: em,
8095
+ up: Z_
8074
8096
  }, Symbol.toStringTag, { value: "Module" }));
8075
- async function tm(t) {
8097
+ async function nm(t) {
8076
8098
  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();
8077
8099
  }
8078
- async function nm(t) {
8100
+ async function rm(t) {
8079
8101
  await t.schema.dropTable("roles").execute(), await t.schema.dropTable("resource_servers").execute();
8080
8102
  }
8081
- const rm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8103
+ const am = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8082
8104
  __proto__: null,
8083
- down: nm,
8084
- up: tm
8105
+ down: rm,
8106
+ up: nm
8085
8107
  }, Symbol.toStringTag, { value: "Module" }));
8086
- async function am(t) {
8108
+ async function om(t) {
8087
8109
  await t.schema.createTable("role_permissions").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("role_id", "varchar(21)", (e) => e.notNull()).addColumn(
8088
8110
  "resource_server_identifier",
8089
8111
  "varchar(191)",
@@ -8104,66 +8126,66 @@ async function am(t) {
8104
8126
  "permission_name"
8105
8127
  ]).execute(), await t.schema.createIndex("user_permissions_user_fk").on("user_permissions").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_permissions_permission_fk").on("user_permissions").columns(["tenant_id", "resource_server_identifier", "permission_name"]).execute();
8106
8128
  }
8107
- async function om(t) {
8129
+ async function im(t) {
8108
8130
  await t.schema.dropTable("user_permissions").execute(), await t.schema.dropTable("role_permissions").execute();
8109
8131
  }
8110
- const im = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8132
+ const sm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8111
8133
  __proto__: null,
8112
- down: om,
8113
- up: am
8134
+ down: im,
8135
+ up: om
8114
8136
  }, Symbol.toStringTag, { value: "Module" }));
8115
- async function sm(t) {
8137
+ async function um(t) {
8116
8138
  await t.schema.createTable("user_roles").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn("role_id", "varchar(21)", (e) => e.notNull()).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("user_roles_pk", [
8117
8139
  "tenant_id",
8118
8140
  "user_id",
8119
8141
  "role_id"
8120
8142
  ]).execute(), await t.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute();
8121
8143
  }
8122
- async function um(t) {
8144
+ async function cm(t) {
8123
8145
  await t.schema.dropTable("user_roles").execute();
8124
8146
  }
8125
- const cm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8147
+ const lm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8126
8148
  __proto__: null,
8127
- down: um,
8128
- up: sm
8149
+ down: cm,
8150
+ up: um
8129
8151
  }, Symbol.toStringTag, { value: "Module" }));
8130
- async function lm(t) {
8131
- }
8132
8152
  async function dm(t) {
8153
+ }
8154
+ async function _m(t) {
8133
8155
  await t.schema.alterTable("keys").dropColumn("connection").execute(), await t.schema.alterTable("keys").modifyColumn("cert", "varchar(2048)").execute(), await t.schema.alterTable("keys").modifyColumn("pkcs7", "varchar(2048)").execute(), await t.schema.alterTable("keys").dropColumn("type").execute();
8134
8156
  }
8135
- const _m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8157
+ const mm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8136
8158
  __proto__: null,
8137
- down: dm,
8138
- up: lm
8159
+ down: _m,
8160
+ up: dm
8139
8161
  }, Symbol.toStringTag, { value: "Module" }));
8140
- async function mm(t) {
8162
+ async function hm(t) {
8141
8163
  await t.schema.createTable("organizations").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(256)", (e) => e.notNull()).addColumn("display_name", "varchar(256)").addColumn("branding", "text").addColumn("metadata", "text").addColumn("enabled_connections", "text").addColumn("token_quota", "text").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute(), await t.schema.createIndex("idx_organizations_tenant_id").on("organizations").column("tenant_id").execute(), await t.schema.createIndex("idx_organizations_tenant_name_unique").on("organizations").columns(["tenant_id", "name"]).unique().execute();
8142
8164
  }
8143
- async function hm(t) {
8165
+ async function fm(t) {
8144
8166
  await t.schema.dropTable("organizations").execute();
8145
8167
  }
8146
- const fm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8168
+ const pm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8147
8169
  __proto__: null,
8148
- down: hm,
8149
- up: mm
8170
+ down: fm,
8171
+ up: hm
8150
8172
  }, Symbol.toStringTag, { value: "Module" }));
8151
- async function pm(t) {
8173
+ async function gm(t) {
8152
8174
  await t.schema.createTable("user_organizations").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn("organization_id", "varchar(21)", (e) => e.notNull()).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addUniqueConstraint("user_organizations_unique", [
8153
8175
  "tenant_id",
8154
8176
  "user_id",
8155
8177
  "organization_id"
8156
8178
  ]).execute(), await t.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute(), await t.schema.createIndex("idx_user_organizations_user_id").on("user_organizations").column("user_id").execute(), await t.schema.createIndex("idx_user_organizations_organization_id").on("user_organizations").column("organization_id").execute();
8157
8179
  }
8158
- async function gm(t) {
8180
+ async function ym(t) {
8159
8181
  await t.schema.dropTable("user_organizations").execute();
8160
8182
  }
8161
- const ym = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8183
+ const wm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8162
8184
  __proto__: null,
8163
- down: gm,
8164
- up: pm
8185
+ down: ym,
8186
+ up: gm
8165
8187
  }, Symbol.toStringTag, { value: "Module" }));
8166
- async function wm(t) {
8188
+ async function Nm(t) {
8167
8189
  await t.schema.dropTable("user_permissions").execute(), await t.schema.dropTable("user_roles").execute(), await t.schema.createTable("user_permissions").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn(
8168
8190
  "resource_server_identifier",
8169
8191
  "varchar(21)",
@@ -8189,7 +8211,7 @@ async function wm(t) {
8189
8211
  "organization_id"
8190
8212
  ]).execute(), await t.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute(), await t.schema.createIndex("user_roles_organization_fk").on("user_roles").column("organization_id").execute();
8191
8213
  }
8192
- async function Nm(t) {
8214
+ async function vm(t) {
8193
8215
  await t.schema.dropTable("user_permissions").execute(), await t.schema.dropTable("user_roles").execute(), await t.schema.createTable("user_permissions").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn(
8194
8216
  "resource_server_identifier",
8195
8217
  "varchar(191)",
@@ -8205,12 +8227,12 @@ async function Nm(t) {
8205
8227
  "role_id"
8206
8228
  ]).execute(), await t.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute();
8207
8229
  }
8208
- const vm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8230
+ const Cm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8209
8231
  __proto__: null,
8210
- down: Nm,
8211
- up: wm
8232
+ down: vm,
8233
+ up: Nm
8212
8234
  }, Symbol.toStringTag, { value: "Module" }));
8213
- async function Cm(t) {
8235
+ async function xm(t) {
8214
8236
  await t.schema.createTable("clients").addColumn("client_id", "varchar(191)", (e) => e.notNull()).addColumn(
8215
8237
  "tenant_id",
8216
8238
  "varchar(191)",
@@ -8252,25 +8274,25 @@ async function Cm(t) {
8252
8274
  "client_id"
8253
8275
  ]).execute();
8254
8276
  }
8255
- async function xm(t) {
8277
+ async function bm(t) {
8256
8278
  await t.schema.dropTable("clients").execute();
8257
8279
  }
8258
- const bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8280
+ const Om = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8259
8281
  __proto__: null,
8260
- down: xm,
8261
- up: Cm
8282
+ down: bm,
8283
+ up: xm
8262
8284
  }, Symbol.toStringTag, { value: "Module" }));
8263
- async function zr(t) {
8285
+ async function Rr(t) {
8264
8286
  try {
8265
8287
  return await p`SELECT VERSION()`.execute(t), "mysql";
8266
8288
  } catch {
8267
8289
  return "sqlite";
8268
8290
  }
8269
8291
  }
8270
- async function Om(t) {
8271
- await zr(t) === "mysql" ? await Tm(t) : await Sm(t);
8272
- }
8273
8292
  async function Tm(t) {
8293
+ await Rr(t) === "mysql" ? await Sm(t) : await km(t);
8294
+ }
8295
+ async function Sm(t) {
8274
8296
  await t.transaction().execute(async (e) => {
8275
8297
  const n = await p`
8276
8298
  SELECT
@@ -8351,7 +8373,7 @@ async function Tm(t) {
8351
8373
  FROM login_sessions_backup`.execute(e), await p`DROP TABLE sessions_backup`.execute(e), await p`DROP TABLE login_sessions_backup`.execute(e), await p`DROP TABLE refresh_tokens_backup`.execute(e);
8352
8374
  });
8353
8375
  }
8354
- async function Sm(t) {
8376
+ async function km(t) {
8355
8377
  await t.transaction().execute(async (e) => {
8356
8378
  const n = [
8357
8379
  "sessions_backup",
@@ -8417,10 +8439,10 @@ async function Sm(t) {
8417
8439
  FROM login_sessions_backup`.execute(e), await p`DROP TABLE sessions_backup`.execute(e), await p`DROP TABLE login_sessions_backup`.execute(e), await p`DROP TABLE refresh_tokens_backup`.execute(e);
8418
8440
  });
8419
8441
  }
8420
- async function km(t) {
8421
- await zr(t) === "mysql" ? await Em(t) : await Im(t);
8422
- }
8423
8442
  async function Em(t) {
8443
+ await Rr(t) === "mysql" ? await Im(t) : await Am(t);
8444
+ }
8445
+ async function Im(t) {
8424
8446
  await t.transaction().execute(async (e) => {
8425
8447
  await p`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8426
8448
  e
@@ -8437,7 +8459,7 @@ async function Em(t) {
8437
8459
  );
8438
8460
  });
8439
8461
  }
8440
- async function Im(t) {
8462
+ async function Am(t) {
8441
8463
  await t.transaction().execute(async (e) => {
8442
8464
  await p`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8443
8465
  e
@@ -8467,12 +8489,12 @@ async function Im(t) {
8467
8489
  FROM login_sessions_temp`.execute(e), await p`DROP TABLE login_sessions_temp`.execute(e);
8468
8490
  });
8469
8491
  }
8470
- const Am = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8492
+ const Pm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8471
8493
  __proto__: null,
8472
- down: km,
8473
- up: Om
8494
+ down: Em,
8495
+ up: Tm
8474
8496
  }, Symbol.toStringTag, { value: "Module" }));
8475
- async function Pm(t) {
8497
+ async function $m(t) {
8476
8498
  await t.schema.createTable("client_grants").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn(
8477
8499
  "tenant_id",
8478
8500
  "varchar(191)",
@@ -8489,89 +8511,89 @@ async function Pm(t) {
8489
8511
  (e) => e.onDelete("cascade")
8490
8512
  ).execute(), await t.schema.createIndex("uq_client_grants_tenant_client_audience").on("client_grants").columns(["tenant_id", "client_id", "audience"]).unique().execute(), await t.schema.createIndex("idx_client_grants_audience").on("client_grants").columns(["audience"]).execute();
8491
8513
  }
8492
- async function $m(t) {
8514
+ async function Dm(t) {
8493
8515
  await t.schema.dropTable("client_grants").execute();
8494
8516
  }
8495
- const Dm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8517
+ const zm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8496
8518
  __proto__: null,
8497
- down: $m,
8498
- up: Pm
8519
+ down: Dm,
8520
+ up: $m
8499
8521
  }, Symbol.toStringTag, { value: "Module" }));
8500
- async function zm(t) {
8522
+ async function Rm(t) {
8501
8523
  await t.schema.dropTable("applications").execute();
8502
8524
  }
8503
- async function Rm(t) {
8525
+ async function Fm(t) {
8504
8526
  await t.schema.createTable("applications").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn(
8505
8527
  "tenant_id",
8506
8528
  "varchar(191)",
8507
8529
  (e) => e.notNull().references("tenants.id").onDelete("cascade")
8508
8530
  ).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("client_secret", "varchar(255)").addColumn("callbacks", "text", (e) => e.defaultTo("[]")).addColumn("allowed_origins", "text", (e) => e.defaultTo("[]")).addColumn("web_origins", "text", (e) => e.defaultTo("[]")).addColumn("allowed_logout_urls", "text", (e) => e.defaultTo("[]")).addColumn("allowed_clients", "text", (e) => e.defaultTo("[]")).addColumn("disable_sign_ups", "integer", (e) => e.defaultTo(0)).addColumn("addons", "text", (e) => e.defaultTo("{}")).addColumn("client_metadata", "text", (e) => e.defaultTo("{}")).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("pk_applications", ["tenant_id", "id"]).execute(), await t.schema.createIndex("idx_applications_tenant_id").on("applications").columns(["tenant_id"]).execute();
8509
8531
  }
8510
- const Fm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8532
+ const jm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8511
8533
  __proto__: null,
8512
- down: Rm,
8513
- up: zm
8534
+ down: Fm,
8535
+ up: Rm
8514
8536
  }, Symbol.toStringTag, { value: "Module" }));
8515
- async function jm(t) {
8537
+ async function Lm(t) {
8516
8538
  await t.schema.createIndex("users_phone_tenant_provider_index").on("users").columns(["tenant_id", "phone_number", "provider"]).execute();
8517
8539
  }
8518
- async function Lm(t) {
8540
+ async function Jm(t) {
8519
8541
  await t.schema.dropIndex("users_phone_tenant_provider_index").execute();
8520
8542
  }
8521
- const Jm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8543
+ const Mm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8522
8544
  __proto__: null,
8523
- down: Lm,
8524
- up: jm
8545
+ down: Jm,
8546
+ up: Lm
8525
8547
  }, Symbol.toStringTag, { value: "Module" }));
8526
- async function Mm(t) {
8548
+ async function qm(t) {
8527
8549
  await t.schema.createIndex("login_sessions_id_index").on("login_sessions").column("id").execute();
8528
8550
  }
8529
- async function qm(t) {
8551
+ async function Bm(t) {
8530
8552
  await t.schema.dropIndex("login_sessions_id_index").execute();
8531
8553
  }
8532
- const Bm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8554
+ const Wm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8533
8555
  __proto__: null,
8534
- down: qm,
8535
- up: Mm
8556
+ down: Bm,
8557
+ up: qm
8536
8558
  }, Symbol.toStringTag, { value: "Module" }));
8537
- async function Wm(t) {
8559
+ async function Km(t) {
8538
8560
  await t.schema.createIndex("connections_tenant_id_index").on("connections").column("tenant_id").execute();
8539
8561
  }
8540
- async function Km(t) {
8562
+ async function Um(t) {
8541
8563
  await t.schema.dropIndex("connections_tenant_id_index").execute();
8542
8564
  }
8543
- const Um = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8565
+ const Qm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8544
8566
  __proto__: null,
8545
- down: Km,
8546
- up: Wm
8567
+ down: Um,
8568
+ up: Km
8547
8569
  }, Symbol.toStringTag, { value: "Module" }));
8548
- async function Qm(t) {
8570
+ async function Vm(t) {
8549
8571
  await t.schema.dropIndex("idx_user_organizations_tenant_id").execute();
8550
8572
  }
8551
- async function Vm(t) {
8573
+ async function Gm(t) {
8552
8574
  await t.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute();
8553
8575
  }
8554
- const Gm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8576
+ const Ym = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8555
8577
  __proto__: null,
8556
- down: Vm,
8557
- up: Qm
8578
+ down: Gm,
8579
+ up: Vm
8558
8580
  }, Symbol.toStringTag, { value: "Module" }));
8559
- async function Ym(t) {
8581
+ async function Hm(t) {
8560
8582
  await t.schema.createTable("tenant_settings").addColumn(
8561
8583
  "tenant_id",
8562
8584
  "varchar(191)",
8563
8585
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
8564
8586
  ).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();
8565
8587
  }
8566
- async function Hm(t) {
8588
+ async function Xm(t) {
8567
8589
  await t.schema.dropTable("tenant_settings").execute();
8568
8590
  }
8569
- const Xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8591
+ const Zm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8570
8592
  __proto__: null,
8571
- down: Hm,
8572
- up: Ym
8593
+ down: Xm,
8594
+ up: Hm
8573
8595
  }, Symbol.toStringTag, { value: "Module" }));
8574
- async function Zm(t) {
8596
+ async function eh(t) {
8575
8597
  if (await t.schema.alterTable("tenants").addColumn("idle_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("session_cookie", "text").execute(), await t.schema.alterTable("tenants").addColumn("allowed_logout_urls", "text").execute(), await t.schema.alterTable("tenants").addColumn("ephemeral_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("idle_ephemeral_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("default_redirection_uri", "text").execute(), await t.schema.alterTable("tenants").addColumn("enabled_locales", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_directory", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("error_page", "text").execute(), await t.schema.alterTable("tenants").addColumn("flags", "text").execute(), await t.schema.alterTable("tenants").addColumn("friendly_name", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("picture_url", "text").execute(), await t.schema.alterTable("tenants").addColumn("support_email", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("sandbox_version", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("sandbox_versions_available", "text").execute(), await t.schema.alterTable("tenants").addColumn("legacy_sandbox_version", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("change_password", "text").execute(), await t.schema.alterTable("tenants").addColumn("guardian_mfa_page", "text").execute(), await t.schema.alterTable("tenants").addColumn("device_flow", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_token_quota", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_audience", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("default_organization", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("sessions", "text").execute(), await t.schema.alterTable("tenants").addColumn("oidc_logout", "text").execute(), await t.schema.alterTable("tenants").addColumn("allow_organization_name_in_authentication_api", "integer").execute(), await t.schema.alterTable("tenants").addColumn("customize_mfa_in_postlogin_action", "integer").execute(), await t.schema.alterTable("tenants").addColumn("acr_values_supported", "text").execute(), await t.schema.alterTable("tenants").addColumn("mtls", "text").execute(), await t.schema.alterTable("tenants").addColumn("pushed_authorization_requests_supported", "integer").execute(), await t.schema.alterTable("tenants").addColumn("authorization_response_iss_parameter_supported", "integer").execute(), await t.updateTable("tenants").set({
8576
8598
  friendly_name: p`name`
8577
8599
  }).execute(), await t.schema.alterTable("tenants").dropColumn("language").execute(), await t.schema.alterTable("tenants").dropColumn("logo").execute(), await t.schema.alterTable("tenants").dropColumn("primary_color").execute(), await t.schema.alterTable("tenants").dropColumn("secondary_color").execute(), await t.schema.alterTable("tenants").dropColumn("name").execute(), (await t.selectFrom("tenant_settings").select("tenant_id").limit(1).execute()).length > 0) {
@@ -8602,7 +8624,7 @@ async function Zm(t) {
8602
8624
  }
8603
8625
  await t.schema.dropTable("tenant_settings").execute();
8604
8626
  }
8605
- async function eh(t) {
8627
+ async function th(t) {
8606
8628
  await t.schema.createTable("tenant_settings").addColumn(
8607
8629
  "tenant_id",
8608
8630
  "varchar(191)",
@@ -8659,121 +8681,121 @@ async function eh(t) {
8659
8681
  name: p`COALESCE(friendly_name, id)`
8660
8682
  }).execute(), await t.schema.alterTable("tenants").addColumn("language", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("logo", "text").execute(), await t.schema.alterTable("tenants").addColumn("primary_color", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("secondary_color", "varchar(50)").execute();
8661
8683
  }
8662
- const th = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8684
+ const nh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8663
8685
  __proto__: null,
8664
- down: eh,
8665
- up: Zm
8666
- }, Symbol.toStringTag, { value: "Module" })), Rr = {
8667
- m1_init: iu,
8668
- m2_magicLink: cu,
8669
- m3_updateAt: _u,
8670
- m4_logTable: fu,
8671
- m5_userProfile: yu,
8672
- m6_sessions: vu,
8673
- m7_passwords: bu,
8674
- m8_logsTableNewFields: Su,
8675
- m9_passwordTableNewField: Iu,
8676
- n01_codesTable: $u,
8677
- n11_universalLoginSession: Ru,
8678
- n12_userFields: Lu,
8679
- n13_userEmailIndex: qu,
8680
- n14_profileDataField: Ku,
8681
- n15_userEmailIndex: Vu,
8682
- n16_userLocale: Hu,
8683
- n17_signingKeys: ec,
8684
- n18_logsFields: rc,
8685
- n19_connectionsUserinfo: ic,
8686
- n20_missingFields: cc,
8687
- n21_sessionDeletedAt: _c,
8688
- n22_dropLogsFields: fc,
8689
- n23_dropUsersFields: yc,
8690
- n24_logsIndexes: vc,
8691
- n25_logDescMaxLength: bc,
8692
- n26_logsTableExtraFields: Sc,
8693
- n27_usersTableNameIndex: Ic,
8694
- n28_usersEmailConstrain: $c,
8695
- n29_increaseOtpStateLength: Rc,
8696
- n30_increaseTicketStateLength: Lc,
8697
- n31_branding: qc,
8698
- n32_indexesAndNotNull: Kc,
8699
- n33_vendorIdInUniversalLoginSession: Vc,
8700
- n34_auth0ClientInUniversalLoginSession: Hc,
8701
- n35_increaseUniversalSessionStateLength: el,
8702
- n36_authenticationCodes: rl,
8703
- n37_disableSignUps: il,
8704
- n38_otpIpAddress: cl,
8705
- n39_increaseUserAgentLength: _l,
8706
- n40_userId: fl,
8707
- n41_hooks: yl,
8708
- n42_userIdIndexes: vl,
8709
- n43_userIdIndexes: bl,
8710
- n44_codes: Sl,
8711
- n45_hookProperties: Il,
8712
- n46_loginAuth0Client: $l,
8713
- n47_loginAuth0Client: Rl,
8714
- n48_saml: Ll,
8715
- n49_removeFields: ql,
8716
- n50_authParamsNonce: Kl,
8717
- n51_connectionid: Vl,
8718
- n52_cert: Hl,
8719
- n53_codes_primary_key: ed,
8720
- n54_cleanup_tables: rd,
8721
- n55_logs_index: id,
8722
- n56_application_fields: cd,
8723
- n57_prompt_settings: _d,
8724
- n58_connection_client_id: fd,
8725
- n59_connection_options: yd,
8726
- n60_users_metadata: vd,
8727
- n61_userLocales: bd,
8728
- n62_prompt: Sd,
8729
- n63_connection_cleanup: Id,
8730
- n64_act_as: $d,
8731
- n65_code_verifier: Rd,
8732
- n66_email_providers: Ld,
8733
- n67_drop_tickets: qd,
8734
- n68_login_useragents: Kd,
8735
- n70_refresh_tokens: Vd,
8736
- n71_session_new_fields: Hd,
8737
- n72_session_primary_key: e_,
8738
- n73_drop_sessions: r_,
8739
- n74_custom_domains: i_,
8740
- n75_organizations: c_,
8741
- n76_authorization_url_length: __,
8742
- n77_drop_sessions: f_,
8743
- n78_login_sessions: y_,
8744
- n79_drop_sessions_2: v_,
8745
- n80_recreate_custom_domains: b_,
8746
- n81_phone: S_,
8747
- n82_forms: I_,
8748
- n83_addFormsIdToHooks: $_,
8749
- n84_login_completed: R_,
8750
- n85_add_login_session_id_to_sessions: L_,
8751
- n86_index_sessions_login_session_id: q_,
8752
- n87_code_challenge: K_,
8753
- n88_add_redirect_uri_to_codes: V_,
8754
- n89_add_nonce_and_state_to_codes: H_,
8755
- n90_themes: em,
8756
- n91_resource_servers_rules_permissions: rm,
8757
- n92_role_permissions: im,
8758
- n93_add_permissions_to_roles: cm,
8759
- n94_keys_connection_and_extend_columns: _m,
8760
- n95_create_organizations_table: fm,
8761
- n96_create_user_organizations_table: ym,
8762
- n97_add_organization_to_user_permissions_and_roles: vm,
8763
- n98_clients: bm,
8764
- n99_update_client_foreign_keys: Am,
8765
- o001_client_grants: Dm,
8766
- o002_drop_applications: Fm,
8767
- o003_phone_number_index: Jm,
8768
- o004_login_sessions_id_index: Bm,
8769
- o005_connections_tenant_index: Um,
8770
- o006_remove_redundant_user_organizations_tenant_index: Gm,
8771
- o007_tenant_settings: Xm,
8772
- o008_merge_tenant_settings_into_tenants: th
8686
+ down: th,
8687
+ up: eh
8688
+ }, Symbol.toStringTag, { value: "Module" })), Fr = {
8689
+ m1_init: su,
8690
+ m2_magicLink: lu,
8691
+ m3_updateAt: mu,
8692
+ m4_logTable: pu,
8693
+ m5_userProfile: wu,
8694
+ m6_sessions: Cu,
8695
+ m7_passwords: Ou,
8696
+ m8_logsTableNewFields: ku,
8697
+ m9_passwordTableNewField: Au,
8698
+ n01_codesTable: Du,
8699
+ n11_universalLoginSession: Fu,
8700
+ n12_userFields: Ju,
8701
+ n13_userEmailIndex: Bu,
8702
+ n14_profileDataField: Uu,
8703
+ n15_userEmailIndex: Gu,
8704
+ n16_userLocale: Xu,
8705
+ n17_signingKeys: tc,
8706
+ n18_logsFields: ac,
8707
+ n19_connectionsUserinfo: sc,
8708
+ n20_missingFields: lc,
8709
+ n21_sessionDeletedAt: mc,
8710
+ n22_dropLogsFields: pc,
8711
+ n23_dropUsersFields: wc,
8712
+ n24_logsIndexes: Cc,
8713
+ n25_logDescMaxLength: Oc,
8714
+ n26_logsTableExtraFields: kc,
8715
+ n27_usersTableNameIndex: Ac,
8716
+ n28_usersEmailConstrain: Dc,
8717
+ n29_increaseOtpStateLength: Fc,
8718
+ n30_increaseTicketStateLength: Jc,
8719
+ n31_branding: Bc,
8720
+ n32_indexesAndNotNull: Uc,
8721
+ n33_vendorIdInUniversalLoginSession: Gc,
8722
+ n34_auth0ClientInUniversalLoginSession: Xc,
8723
+ n35_increaseUniversalSessionStateLength: tl,
8724
+ n36_authenticationCodes: al,
8725
+ n37_disableSignUps: sl,
8726
+ n38_otpIpAddress: ll,
8727
+ n39_increaseUserAgentLength: ml,
8728
+ n40_userId: pl,
8729
+ n41_hooks: wl,
8730
+ n42_userIdIndexes: Cl,
8731
+ n43_userIdIndexes: Ol,
8732
+ n44_codes: kl,
8733
+ n45_hookProperties: Al,
8734
+ n46_loginAuth0Client: Dl,
8735
+ n47_loginAuth0Client: Fl,
8736
+ n48_saml: Jl,
8737
+ n49_removeFields: Bl,
8738
+ n50_authParamsNonce: Ul,
8739
+ n51_connectionid: Gl,
8740
+ n52_cert: Xl,
8741
+ n53_codes_primary_key: td,
8742
+ n54_cleanup_tables: ad,
8743
+ n55_logs_index: sd,
8744
+ n56_application_fields: ld,
8745
+ n57_prompt_settings: md,
8746
+ n58_connection_client_id: pd,
8747
+ n59_connection_options: wd,
8748
+ n60_users_metadata: Cd,
8749
+ n61_userLocales: Od,
8750
+ n62_prompt: kd,
8751
+ n63_connection_cleanup: Ad,
8752
+ n64_act_as: Dd,
8753
+ n65_code_verifier: Fd,
8754
+ n66_email_providers: Jd,
8755
+ n67_drop_tickets: Bd,
8756
+ n68_login_useragents: Ud,
8757
+ n70_refresh_tokens: Gd,
8758
+ n71_session_new_fields: Xd,
8759
+ n72_session_primary_key: t_,
8760
+ n73_drop_sessions: a_,
8761
+ n74_custom_domains: s_,
8762
+ n75_organizations: l_,
8763
+ n76_authorization_url_length: m_,
8764
+ n77_drop_sessions: p_,
8765
+ n78_login_sessions: w_,
8766
+ n79_drop_sessions_2: C_,
8767
+ n80_recreate_custom_domains: O_,
8768
+ n81_phone: k_,
8769
+ n82_forms: A_,
8770
+ n83_addFormsIdToHooks: D_,
8771
+ n84_login_completed: F_,
8772
+ n85_add_login_session_id_to_sessions: J_,
8773
+ n86_index_sessions_login_session_id: B_,
8774
+ n87_code_challenge: U_,
8775
+ n88_add_redirect_uri_to_codes: G_,
8776
+ n89_add_nonce_and_state_to_codes: X_,
8777
+ n90_themes: tm,
8778
+ n91_resource_servers_rules_permissions: am,
8779
+ n92_role_permissions: sm,
8780
+ n93_add_permissions_to_roles: lm,
8781
+ n94_keys_connection_and_extend_columns: mm,
8782
+ n95_create_organizations_table: pm,
8783
+ n96_create_user_organizations_table: wm,
8784
+ n97_add_organization_to_user_permissions_and_roles: Cm,
8785
+ n98_clients: Om,
8786
+ n99_update_client_foreign_keys: Pm,
8787
+ o001_client_grants: zm,
8788
+ o002_drop_applications: jm,
8789
+ o003_phone_number_index: Mm,
8790
+ o004_login_sessions_id_index: Wm,
8791
+ o005_connections_tenant_index: Qm,
8792
+ o006_remove_redundant_user_organizations_tenant_index: Ym,
8793
+ o007_tenant_settings: Zm,
8794
+ o008_merge_tenant_settings_into_tenants: nh
8773
8795
  };
8774
- async function ih(t, e = !1) {
8796
+ async function sh(t, e = !1) {
8775
8797
  e && console.log("migrating...");
8776
- const n = new Dr(Rr), r = new wr({
8798
+ const n = new zr(Fr), r = new Nr({
8777
8799
  db: t,
8778
8800
  provider: n
8779
8801
  }), { error: a, results: o } = await r.migrateToLatest();
@@ -8784,9 +8806,9 @@ async function ih(t, e = !1) {
8784
8806
  }), a)
8785
8807
  throw console.error("failed to migrate"), console.error(a), a;
8786
8808
  }
8787
- async function sh(t) {
8809
+ async function uh(t) {
8788
8810
  console.log("migrating...");
8789
- const e = new Dr(Rr), n = new wr({
8811
+ const e = new zr(Fr), n = new Nr({
8790
8812
  db: t,
8791
8813
  provider: e
8792
8814
  }), { error: r, results: a } = await n.migrateDown();
@@ -8795,40 +8817,40 @@ async function sh(t) {
8795
8817
  }), r)
8796
8818
  throw console.error("failed to migrate"), console.error(r), r;
8797
8819
  }
8798
- function uh(t) {
8820
+ function ch(t) {
8799
8821
  return {
8800
- branding: ho(t),
8801
- cleanup: Wo(t),
8802
- clients: Ua(t),
8803
- clientGrants: Xa(t),
8804
- legacyClients: Za(t),
8805
- codes: ka(t),
8806
- connections: Ja(t),
8807
- emailProviders: Fo(t),
8808
- customDomains: lo(t),
8809
- forms: Yo(t),
8810
- hooks: No(t),
8811
- keys: ro(t),
8812
- loginSessions: Io(t),
8813
- logs: _a(t),
8814
- passwords: Ca(t),
8815
- promptSettings: $o(t),
8816
- refreshTokens: Bo(t),
8817
- resourceServers: ni(t),
8818
- rolePermissions: _i(t),
8819
- userPermissions: gi(t),
8820
- userRoles: Ci(t),
8821
- roles: ui(t),
8822
- sessions: ya(t),
8823
- tenants: sa(t),
8824
- themes: Oo(t),
8825
- users: Yr(t),
8826
- organizations: ki(t),
8827
- userOrganizations: zi(t)
8822
+ branding: fo(t),
8823
+ cleanup: Ko(t),
8824
+ clients: Qa(t),
8825
+ clientGrants: Za(t),
8826
+ legacyClients: eo(t),
8827
+ codes: Ea(t),
8828
+ connections: Ma(t),
8829
+ emailProviders: jo(t),
8830
+ customDomains: _o(t),
8831
+ forms: Ho(t),
8832
+ hooks: vo(t),
8833
+ keys: ao(t),
8834
+ loginSessions: Ao(t),
8835
+ logs: ma(t),
8836
+ passwords: xa(t),
8837
+ promptSettings: Do(t),
8838
+ refreshTokens: Wo(t),
8839
+ resourceServers: ri(t),
8840
+ rolePermissions: mi(t),
8841
+ userPermissions: yi(t),
8842
+ userRoles: xi(t),
8843
+ roles: ci(t),
8844
+ sessions: wa(t),
8845
+ tenants: ua(t),
8846
+ themes: To(t),
8847
+ users: Hr(t),
8848
+ organizations: Ei(t),
8849
+ userOrganizations: Ri(t)
8828
8850
  };
8829
8851
  }
8830
8852
  export {
8831
- uh as default,
8832
- sh as migrateDown,
8833
- ih as migrateToLatest
8853
+ ch as default,
8854
+ uh as migrateDown,
8855
+ sh as migrateToLatest
8834
8856
  };