@authhero/kysely-adapter 0.20.1 → 0.22.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.
@@ -4,8 +4,8 @@ var Kn = (t) => {
4
4
  };
5
5
  var Hr = (t, e, n) => e in t ? Gr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
6
  var ut = (t, e, n) => Hr(t, typeof e != "symbol" ? e + "" : e, n), bn = (t, e, n) => e.has(t) || Kn("Cannot " + n);
7
- var v = (t, e, n) => (bn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), re = (t, e, n) => e.has(t) ? Kn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), ht = (t, e, n, r) => (bn(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), C = (t, e, n) => (bn(t, e, "access private method"), n);
8
- var Cn = class extends Error {
7
+ var v = (t, e, n) => (bn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), re = (t, e, n) => e.has(t) ? Kn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), ht = (t, e, n, r) => (bn(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), T = (t, e, n) => (bn(t, e, "access private method"), n);
8
+ var Tn = class extends Error {
9
9
  constructor(e = 500, n) {
10
10
  super(n == null ? void 0 : n.message, { cause: n == null ? void 0 : n.cause });
11
11
  ut(this, "res");
@@ -36,7 +36,7 @@ function Yr(t) {
36
36
  try {
37
37
  await t.insertInto("users").values(s).execute();
38
38
  } catch (o) {
39
- throw o.code === "SQLITE_CONSTRAINT_UNIQUE" || o.message.includes("AlreadyExists") ? new Cn(409, { message: "User already exists" }) : (console.log(o.message), new Cn(500, { message: `${o.code}, ${o.message}` }));
39
+ throw o.code === "SQLITE_CONSTRAINT_UNIQUE" || o.message.includes("AlreadyExists") ? new Tn(409, { message: "User already exists" }) : new Tn(500, { message: `${o.code}, ${o.message}` });
40
40
  }
41
41
  return {
42
42
  ...s,
@@ -77,20 +77,20 @@ function ta(t) {
77
77
  return;
78
78
  t.ZodType.prototype.openapi = function(a, s) {
79
79
  var o, d, c, l, u, Z;
80
- const R = typeof a == "string" ? s : a, J = R ?? {}, { param: _e } = J, We = Xr(J, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof a == "string" ? { refId: a } : void 0), ye = Object.assign(Object.assign(Object.assign({}, (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata), We), !((l = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || l === void 0) && l.param || _e ? {
80
+ const R = typeof a == "string" ? s : a, W = R ?? {}, { param: _e } = W, Je = Xr(W, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof a == "string" ? { refId: a } : void 0), ye = Object.assign(Object.assign(Object.assign({}, (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata), Je), !((l = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || l === void 0) && l.param || _e ? {
81
81
  param: Object.assign(Object.assign({}, (Z = (u = this._def.openapi) === null || u === void 0 ? void 0 : u.metadata) === null || Z === void 0 ? void 0 : Z.param), _e)
82
82
  } : void 0), ve = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(ge).length > 0 ? { _internal: ge } : void 0), Object.keys(ye).length > 0 ? { metadata: ye } : void 0) }));
83
83
  if (ea(this, "ZodObject")) {
84
- const Je = this.extend;
84
+ const We = this.extend;
85
85
  ve.extend = function(...qe) {
86
- var ee, te, ne, be, $e, Ae;
87
- const Pe = Je.apply(this, qe);
88
- return Pe._def.openapi = {
86
+ var ee, te, ne, be, $e, Pe;
87
+ const Ae = We.apply(this, qe);
88
+ return Ae._def.openapi = {
89
89
  _internal: {
90
90
  extendedFrom: !((te = (ee = this._def.openapi) === null || ee === void 0 ? void 0 : ee._internal) === null || te === void 0) && te.refId ? { refId: (be = (ne = this._def.openapi) === null || ne === void 0 ? void 0 : ne._internal) === null || be === void 0 ? void 0 : be.refId, schema: this } : ($e = this._def.openapi) === null || $e === void 0 ? void 0 : $e._internal.extendedFrom
91
91
  },
92
- metadata: (Ae = Pe._def.openapi) === null || Ae === void 0 ? void 0 : Ae.metadata
93
- }, Pe;
92
+ metadata: (Pe = Ae._def.openapi) === null || Pe === void 0 ? void 0 : Pe.metadata
93
+ }, Ae;
94
94
  };
95
95
  }
96
96
  return ve;
@@ -392,7 +392,7 @@ class U {
392
392
  const r = [];
393
393
  for (const a of n) {
394
394
  if (a.status === "aborted")
395
- return T;
395
+ return C;
396
396
  a.status === "dirty" && e.dirty(), r.push(a.value);
397
397
  }
398
398
  return { status: e.value, value: r };
@@ -413,13 +413,13 @@ class U {
413
413
  for (const a of n) {
414
414
  const { key: s, value: o } = a;
415
415
  if (s.status === "aborted" || o.status === "aborted")
416
- return T;
416
+ return C;
417
417
  s.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), s.value !== "__proto__" && (typeof o.value < "u" || a.alwaysSet) && (r[s.value] = o.value);
418
418
  }
419
419
  return { status: e.value, value: r };
420
420
  }
421
421
  }
422
- const T = Object.freeze({
422
+ const C = Object.freeze({
423
423
  status: "aborted"
424
424
  }), rn = (t) => ({ status: "dirty", value: t }), V = (t) => ({ status: "valid", value: t }), Sn = (t) => t.status === "aborted", jn = (t) => t.status === "dirty", wt = (t) => t.status === "valid", xt = (t) => typeof Promise < "u" && t instanceof Promise;
425
425
  function an(t, e, n, r) {
@@ -443,7 +443,7 @@ class ie {
443
443
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
444
444
  }
445
445
  }
446
- const Wn = (t, e) => {
446
+ const Jn = (t, e) => {
447
447
  if (wt(e))
448
448
  return { success: !0, data: e.value };
449
449
  if (!t.common.issues.length)
@@ -533,7 +533,7 @@ class j {
533
533
  data: e,
534
534
  parsedType: xe(e)
535
535
  }, s = this._parseSync({ data: e, path: a.path, parent: a });
536
- return Wn(a, s);
536
+ return Jn(a, s);
537
537
  }
538
538
  async parseAsync(e, n) {
539
539
  const r = await this.safeParseAsync(e, n);
@@ -554,7 +554,7 @@ class j {
554
554
  data: e,
555
555
  parsedType: xe(e)
556
556
  }, a = this._parse({ data: e, path: r.path, parent: r }), s = await (xt(a) ? a : Promise.resolve(a));
557
- return Wn(r, s);
557
+ return Jn(r, s);
558
558
  }
559
559
  refine(e, n) {
560
560
  const r = (a) => typeof n == "string" || typeof n > "u" ? { message: n } : typeof n == "function" ? n(a) : n;
@@ -595,7 +595,7 @@ class j {
595
595
  return ot.create(this, this._def);
596
596
  }
597
597
  or(e) {
598
- return Ct.create([this, e], this._def);
598
+ return Tt.create([this, e], this._def);
599
599
  }
600
600
  and(e) {
601
601
  return Ot.create(this, e, this._def);
@@ -644,7 +644,7 @@ class j {
644
644
  return Ht.create(this, e);
645
645
  }
646
646
  readonly() {
647
- return At.create(this);
647
+ return Pt.create(this);
648
648
  }
649
649
  isOptional() {
650
650
  return this.safeParse(void 0).success;
@@ -679,7 +679,7 @@ class q extends j {
679
679
  code: h.invalid_type,
680
680
  expected: g.string,
681
681
  received: a.parsedType
682
- }), T;
682
+ }), C;
683
683
  }
684
684
  const n = new U();
685
685
  let r;
@@ -1044,7 +1044,7 @@ class ke extends j {
1044
1044
  code: h.invalid_type,
1045
1045
  expected: g.number,
1046
1046
  received: a.parsedType
1047
- }), T;
1047
+ }), C;
1048
1048
  }
1049
1049
  let n;
1050
1050
  const r = new U();
@@ -1205,7 +1205,7 @@ ke.create = (t) => new ke({
1205
1205
  coerce: (t == null ? void 0 : t.coerce) || !1,
1206
1206
  ...O(t)
1207
1207
  });
1208
- class Te extends j {
1208
+ class Ce extends j {
1209
1209
  constructor() {
1210
1210
  super(...arguments), this.min = this.gte, this.max = this.lte;
1211
1211
  }
@@ -1216,7 +1216,7 @@ class Te extends j {
1216
1216
  code: h.invalid_type,
1217
1217
  expected: g.bigint,
1218
1218
  received: a.parsedType
1219
- }), T;
1219
+ }), C;
1220
1220
  }
1221
1221
  let n;
1222
1222
  const r = new U();
@@ -1253,7 +1253,7 @@ class Te extends j {
1253
1253
  return this.setLimit("max", e, !1, b.toString(n));
1254
1254
  }
1255
1255
  setLimit(e, n, r, a) {
1256
- return new Te({
1256
+ return new Ce({
1257
1257
  ...this._def,
1258
1258
  checks: [
1259
1259
  ...this._def.checks,
@@ -1267,7 +1267,7 @@ class Te extends j {
1267
1267
  });
1268
1268
  }
1269
1269
  _addCheck(e) {
1270
- return new Te({
1270
+ return new Ce({
1271
1271
  ...this._def,
1272
1272
  checks: [...this._def.checks, e]
1273
1273
  });
@@ -1324,9 +1324,9 @@ class Te extends j {
1324
1324
  return e;
1325
1325
  }
1326
1326
  }
1327
- Te.create = (t) => {
1327
+ Ce.create = (t) => {
1328
1328
  var e;
1329
- return new Te({
1329
+ return new Ce({
1330
1330
  checks: [],
1331
1331
  typeName: x.ZodBigInt,
1332
1332
  coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
@@ -1341,7 +1341,7 @@ class Nt extends j {
1341
1341
  code: h.invalid_type,
1342
1342
  expected: g.boolean,
1343
1343
  received: n.parsedType
1344
- }), T;
1344
+ }), C;
1345
1345
  }
1346
1346
  return V(e.data);
1347
1347
  }
@@ -1359,13 +1359,13 @@ class ze extends j {
1359
1359
  code: h.invalid_type,
1360
1360
  expected: g.date,
1361
1361
  received: a.parsedType
1362
- }), T;
1362
+ }), C;
1363
1363
  }
1364
1364
  if (isNaN(e.data.getTime())) {
1365
1365
  const a = this._getOrReturnCtx(e);
1366
1366
  return f(a, {
1367
1367
  code: h.invalid_date
1368
- }), T;
1368
+ }), C;
1369
1369
  }
1370
1370
  const n = new U();
1371
1371
  let r;
@@ -1437,7 +1437,7 @@ class sn extends j {
1437
1437
  code: h.invalid_type,
1438
1438
  expected: g.symbol,
1439
1439
  received: n.parsedType
1440
- }), T;
1440
+ }), C;
1441
1441
  }
1442
1442
  return V(e.data);
1443
1443
  }
@@ -1454,7 +1454,7 @@ class kt extends j {
1454
1454
  code: h.invalid_type,
1455
1455
  expected: g.undefined,
1456
1456
  received: n.parsedType
1457
- }), T;
1457
+ }), C;
1458
1458
  }
1459
1459
  return V(e.data);
1460
1460
  }
@@ -1463,7 +1463,7 @@ kt.create = (t) => new kt({
1463
1463
  typeName: x.ZodUndefined,
1464
1464
  ...O(t)
1465
1465
  });
1466
- class Tt extends j {
1466
+ class Ct extends j {
1467
1467
  _parse(e) {
1468
1468
  if (this._getType(e) !== g.null) {
1469
1469
  const n = this._getOrReturnCtx(e);
@@ -1471,12 +1471,12 @@ class Tt extends j {
1471
1471
  code: h.invalid_type,
1472
1472
  expected: g.null,
1473
1473
  received: n.parsedType
1474
- }), T;
1474
+ }), C;
1475
1475
  }
1476
1476
  return V(e.data);
1477
1477
  }
1478
1478
  }
1479
- Tt.create = (t) => new Tt({
1479
+ Ct.create = (t) => new Ct({
1480
1480
  typeName: x.ZodNull,
1481
1481
  ...O(t)
1482
1482
  });
@@ -1511,7 +1511,7 @@ class me extends j {
1511
1511
  code: h.invalid_type,
1512
1512
  expected: g.never,
1513
1513
  received: n.parsedType
1514
- }), T;
1514
+ }), C;
1515
1515
  }
1516
1516
  }
1517
1517
  me.create = (t) => new me({
@@ -1526,7 +1526,7 @@ class on extends j {
1526
1526
  code: h.invalid_type,
1527
1527
  expected: g.void,
1528
1528
  received: n.parsedType
1529
- }), T;
1529
+ }), C;
1530
1530
  }
1531
1531
  return V(e.data);
1532
1532
  }
@@ -1543,7 +1543,7 @@ class G extends j {
1543
1543
  code: h.invalid_type,
1544
1544
  expected: g.array,
1545
1545
  received: n.parsedType
1546
- }), T;
1546
+ }), C;
1547
1547
  if (a.exactLength !== null) {
1548
1548
  const o = n.data.length > a.exactLength.value, d = n.data.length < a.exactLength.value;
1549
1549
  (o || d) && (f(n, {
@@ -1609,13 +1609,13 @@ G.create = (t, e) => new G({
1609
1609
  ...O(e)
1610
1610
  });
1611
1611
  function Ge(t) {
1612
- if (t instanceof P) {
1612
+ if (t instanceof A) {
1613
1613
  const e = {};
1614
1614
  for (const n in t.shape) {
1615
1615
  const r = t.shape[n];
1616
1616
  e[n] = ae.create(Ge(r));
1617
1617
  }
1618
- return new P({
1618
+ return new A({
1619
1619
  ...t._def,
1620
1620
  shape: () => e
1621
1621
  });
@@ -1624,7 +1624,7 @@ function Ge(t) {
1624
1624
  type: Ge(t.element)
1625
1625
  }) : t instanceof ae ? ae.create(Ge(t.unwrap())) : t instanceof Oe ? Oe.create(Ge(t.unwrap())) : t instanceof oe ? oe.create(t.items.map((e) => Ge(e))) : t;
1626
1626
  }
1627
- class P extends j {
1627
+ class A extends j {
1628
1628
  constructor() {
1629
1629
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1630
1630
  }
@@ -1641,7 +1641,7 @@ class P extends j {
1641
1641
  code: h.invalid_type,
1642
1642
  expected: g.object,
1643
1643
  received: c.parsedType
1644
- }), T;
1644
+ }), C;
1645
1645
  }
1646
1646
  const { status: n, ctx: r } = this._processInputParams(e), { shape: a, keys: s } = this._getCached(), o = [];
1647
1647
  if (!(this._def.catchall instanceof me && this._def.unknownKeys === "strip"))
@@ -1701,7 +1701,7 @@ class P extends j {
1701
1701
  return this._def.shape();
1702
1702
  }
1703
1703
  strict(e) {
1704
- return b.errToObj, new P({
1704
+ return b.errToObj, new A({
1705
1705
  ...this._def,
1706
1706
  unknownKeys: "strict",
1707
1707
  ...e !== void 0 ? {
@@ -1718,13 +1718,13 @@ class P extends j {
1718
1718
  });
1719
1719
  }
1720
1720
  strip() {
1721
- return new P({
1721
+ return new A({
1722
1722
  ...this._def,
1723
1723
  unknownKeys: "strip"
1724
1724
  });
1725
1725
  }
1726
1726
  passthrough() {
1727
- return new P({
1727
+ return new A({
1728
1728
  ...this._def,
1729
1729
  unknownKeys: "passthrough"
1730
1730
  });
@@ -1747,7 +1747,7 @@ class P extends j {
1747
1747
  // }) as any;
1748
1748
  // };
1749
1749
  extend(e) {
1750
- return new P({
1750
+ return new A({
1751
1751
  ...this._def,
1752
1752
  shape: () => ({
1753
1753
  ...this._def.shape(),
@@ -1761,7 +1761,7 @@ class P extends j {
1761
1761
  * upgrade if you are experiencing issues.
1762
1762
  */
1763
1763
  merge(e) {
1764
- return new P({
1764
+ return new A({
1765
1765
  unknownKeys: e._def.unknownKeys,
1766
1766
  catchall: e._def.catchall,
1767
1767
  shape: () => ({
@@ -1831,7 +1831,7 @@ class P extends j {
1831
1831
  // return merged;
1832
1832
  // }
1833
1833
  catchall(e) {
1834
- return new P({
1834
+ return new A({
1835
1835
  ...this._def,
1836
1836
  catchall: e
1837
1837
  });
@@ -1840,7 +1840,7 @@ class P extends j {
1840
1840
  const n = {};
1841
1841
  return E.objectKeys(e).forEach((r) => {
1842
1842
  e[r] && this.shape[r] && (n[r] = this.shape[r]);
1843
- }), new P({
1843
+ }), new A({
1844
1844
  ...this._def,
1845
1845
  shape: () => n
1846
1846
  });
@@ -1849,7 +1849,7 @@ class P extends j {
1849
1849
  const n = {};
1850
1850
  return E.objectKeys(this.shape).forEach((r) => {
1851
1851
  e[r] || (n[r] = this.shape[r]);
1852
- }), new P({
1852
+ }), new A({
1853
1853
  ...this._def,
1854
1854
  shape: () => n
1855
1855
  });
@@ -1865,7 +1865,7 @@ class P extends j {
1865
1865
  return E.objectKeys(this.shape).forEach((r) => {
1866
1866
  const a = this.shape[r];
1867
1867
  e && !e[r] ? n[r] = a : n[r] = a.optional();
1868
- }), new P({
1868
+ }), new A({
1869
1869
  ...this._def,
1870
1870
  shape: () => n
1871
1871
  });
@@ -1881,7 +1881,7 @@ class P extends j {
1881
1881
  a = a._def.innerType;
1882
1882
  n[r] = a;
1883
1883
  }
1884
- }), new P({
1884
+ }), new A({
1885
1885
  ...this._def,
1886
1886
  shape: () => n
1887
1887
  });
@@ -1890,28 +1890,28 @@ class P extends j {
1890
1890
  return sr(E.objectKeys(this.shape));
1891
1891
  }
1892
1892
  }
1893
- P.create = (t, e) => new P({
1893
+ A.create = (t, e) => new A({
1894
1894
  shape: () => t,
1895
1895
  unknownKeys: "strip",
1896
1896
  catchall: me.create(),
1897
1897
  typeName: x.ZodObject,
1898
1898
  ...O(e)
1899
1899
  });
1900
- P.strictCreate = (t, e) => new P({
1900
+ A.strictCreate = (t, e) => new A({
1901
1901
  shape: () => t,
1902
1902
  unknownKeys: "strict",
1903
1903
  catchall: me.create(),
1904
1904
  typeName: x.ZodObject,
1905
1905
  ...O(e)
1906
1906
  });
1907
- P.lazycreate = (t, e) => new P({
1907
+ A.lazycreate = (t, e) => new A({
1908
1908
  shape: t,
1909
1909
  unknownKeys: "strip",
1910
1910
  catchall: me.create(),
1911
1911
  typeName: x.ZodObject,
1912
1912
  ...O(e)
1913
1913
  });
1914
- class Ct extends j {
1914
+ class Tt extends j {
1915
1915
  _parse(e) {
1916
1916
  const { ctx: n } = this._processInputParams(e), r = this._def.options;
1917
1917
  function a(s) {
@@ -1925,7 +1925,7 @@ class Ct extends j {
1925
1925
  return f(n, {
1926
1926
  code: h.invalid_union,
1927
1927
  unionErrors: o
1928
- }), T;
1928
+ }), C;
1929
1929
  }
1930
1930
  if (n.common.async)
1931
1931
  return Promise.all(r.map(async (s) => {
@@ -1972,19 +1972,19 @@ class Ct extends j {
1972
1972
  return f(n, {
1973
1973
  code: h.invalid_union,
1974
1974
  unionErrors: d
1975
- }), T;
1975
+ }), C;
1976
1976
  }
1977
1977
  }
1978
1978
  get options() {
1979
1979
  return this._def.options;
1980
1980
  }
1981
1981
  }
1982
- Ct.create = (t, e) => new Ct({
1982
+ Tt.create = (t, e) => new Tt({
1983
1983
  options: t,
1984
1984
  typeName: x.ZodUnion,
1985
1985
  ...O(e)
1986
1986
  });
1987
- const we = (t) => t instanceof jt ? we(t.schema) : t instanceof Y ? we(t.innerType()) : t instanceof It ? [t.value] : t instanceof Ce ? t.options : t instanceof Zt ? E.objectValues(t.enum) : t instanceof Et ? we(t._def.innerType) : t instanceof kt ? [void 0] : t instanceof Tt ? [null] : t instanceof ae ? [void 0, ...we(t.unwrap())] : t instanceof Oe ? [null, ...we(t.unwrap())] : t instanceof zn || t instanceof At ? we(t.unwrap()) : t instanceof $t ? we(t._def.innerType) : [];
1987
+ const we = (t) => t instanceof jt ? we(t.schema) : t instanceof Y ? we(t.innerType()) : t instanceof It ? [t.value] : t instanceof Te ? t.options : t instanceof Zt ? E.objectValues(t.enum) : t instanceof Et ? we(t._def.innerType) : t instanceof kt ? [void 0] : t instanceof Ct ? [null] : t instanceof ae ? [void 0, ...we(t.unwrap())] : t instanceof Oe ? [null, ...we(t.unwrap())] : t instanceof zn || t instanceof Pt ? we(t.unwrap()) : t instanceof $t ? we(t._def.innerType) : [];
1988
1988
  class yn extends j {
1989
1989
  _parse(e) {
1990
1990
  const { ctx: n } = this._processInputParams(e);
@@ -1993,7 +1993,7 @@ class yn extends j {
1993
1993
  code: h.invalid_type,
1994
1994
  expected: g.object,
1995
1995
  received: n.parsedType
1996
- }), T;
1996
+ }), C;
1997
1997
  const r = this.discriminator, a = n.data[r], s = this.optionsMap.get(a);
1998
1998
  return s ? n.common.async ? s._parseAsync({
1999
1999
  data: n.data,
@@ -2007,7 +2007,7 @@ class yn extends j {
2007
2007
  code: h.invalid_union_discriminator,
2008
2008
  options: Array.from(this.optionsMap.keys()),
2009
2009
  path: [r]
2010
- }), T);
2010
+ }), C);
2011
2011
  }
2012
2012
  get discriminator() {
2013
2013
  return this._def.discriminator;
@@ -2077,11 +2077,11 @@ class Ot extends j {
2077
2077
  _parse(e) {
2078
2078
  const { status: n, ctx: r } = this._processInputParams(e), a = (s, o) => {
2079
2079
  if (Sn(s) || Sn(o))
2080
- return T;
2080
+ return C;
2081
2081
  const d = In(s.value, o.value);
2082
2082
  return d.valid ? ((jn(s) || jn(o)) && n.dirty(), { status: n.value, value: d.data }) : (f(r, {
2083
2083
  code: h.invalid_intersection_types
2084
- }), T);
2084
+ }), C);
2085
2085
  };
2086
2086
  return r.common.async ? Promise.all([
2087
2087
  this._def.left._parseAsync({
@@ -2119,7 +2119,7 @@ class oe extends j {
2119
2119
  code: h.invalid_type,
2120
2120
  expected: g.array,
2121
2121
  received: r.parsedType
2122
- }), T;
2122
+ }), C;
2123
2123
  if (r.data.length < this._def.items.length)
2124
2124
  return f(r, {
2125
2125
  code: h.too_small,
@@ -2127,7 +2127,7 @@ class oe extends j {
2127
2127
  inclusive: !0,
2128
2128
  exact: !1,
2129
2129
  type: "array"
2130
- }), T;
2130
+ }), C;
2131
2131
  !this._def.rest && r.data.length > this._def.items.length && (f(r, {
2132
2132
  code: h.too_big,
2133
2133
  maximum: this._def.items.length,
@@ -2175,7 +2175,7 @@ class St extends j {
2175
2175
  code: h.invalid_type,
2176
2176
  expected: g.object,
2177
2177
  received: r.parsedType
2178
- }), T;
2178
+ }), C;
2179
2179
  const a = [], s = this._def.keyType, o = this._def.valueType;
2180
2180
  for (const d in r.data)
2181
2181
  a.push({
@@ -2216,7 +2216,7 @@ class dn extends j {
2216
2216
  code: h.invalid_type,
2217
2217
  expected: g.map,
2218
2218
  received: r.parsedType
2219
- }), T;
2219
+ }), C;
2220
2220
  const a = this._def.keyType, s = this._def.valueType, o = [...r.data.entries()].map(([d, c], l) => ({
2221
2221
  key: a._parse(new ie(r, d, r.path, [l, "key"])),
2222
2222
  value: s._parse(new ie(r, c, r.path, [l, "value"]))
@@ -2227,7 +2227,7 @@ class dn extends j {
2227
2227
  for (const c of o) {
2228
2228
  const l = await c.key, u = await c.value;
2229
2229
  if (l.status === "aborted" || u.status === "aborted")
2230
- return T;
2230
+ return C;
2231
2231
  (l.status === "dirty" || u.status === "dirty") && n.dirty(), d.set(l.value, u.value);
2232
2232
  }
2233
2233
  return { status: n.value, value: d };
@@ -2237,7 +2237,7 @@ class dn extends j {
2237
2237
  for (const c of o) {
2238
2238
  const l = c.key, u = c.value;
2239
2239
  if (l.status === "aborted" || u.status === "aborted")
2240
- return T;
2240
+ return C;
2241
2241
  (l.status === "dirty" || u.status === "dirty") && n.dirty(), d.set(l.value, u.value);
2242
2242
  }
2243
2243
  return { status: n.value, value: d };
@@ -2258,7 +2258,7 @@ class Ue extends j {
2258
2258
  code: h.invalid_type,
2259
2259
  expected: g.set,
2260
2260
  received: r.parsedType
2261
- }), T;
2261
+ }), C;
2262
2262
  const a = this._def;
2263
2263
  a.minSize !== null && r.data.size < a.minSize.value && (f(r, {
2264
2264
  code: h.too_small,
@@ -2280,7 +2280,7 @@ class Ue extends j {
2280
2280
  const l = /* @__PURE__ */ new Set();
2281
2281
  for (const u of c) {
2282
2282
  if (u.status === "aborted")
2283
- return T;
2283
+ return C;
2284
2284
  u.status === "dirty" && n.dirty(), l.add(u.value);
2285
2285
  }
2286
2286
  return { status: n.value, value: l };
@@ -2325,7 +2325,7 @@ class nt extends j {
2325
2325
  code: h.invalid_type,
2326
2326
  expected: g.function,
2327
2327
  received: n.parsedType
2328
- }), T;
2328
+ }), C;
2329
2329
  function r(d, c) {
2330
2330
  return nn({
2331
2331
  data: d,
@@ -2437,7 +2437,7 @@ class It extends j {
2437
2437
  received: n.data,
2438
2438
  code: h.invalid_literal,
2439
2439
  expected: this._def.value
2440
- }), T;
2440
+ }), C;
2441
2441
  }
2442
2442
  return { status: "valid", value: e.data };
2443
2443
  }
@@ -2451,13 +2451,13 @@ It.create = (t, e) => new It({
2451
2451
  ...O(e)
2452
2452
  });
2453
2453
  function sr(t, e) {
2454
- return new Ce({
2454
+ return new Te({
2455
2455
  values: t,
2456
2456
  typeName: x.ZodEnum,
2457
2457
  ...O(e)
2458
2458
  });
2459
2459
  }
2460
- class Ce extends j {
2460
+ class Te extends j {
2461
2461
  constructor() {
2462
2462
  super(...arguments), ft.set(this, void 0);
2463
2463
  }
@@ -2468,7 +2468,7 @@ class Ce extends j {
2468
2468
  expected: E.joinValues(r),
2469
2469
  received: n.parsedType,
2470
2470
  code: h.invalid_type
2471
- }), T;
2471
+ }), C;
2472
2472
  }
2473
2473
  if (an(this, ft) || tr(this, ft, new Set(this._def.values)), !an(this, ft).has(e.data)) {
2474
2474
  const n = this._getOrReturnCtx(e), r = this._def.values;
@@ -2476,7 +2476,7 @@ class Ce extends j {
2476
2476
  received: n.data,
2477
2477
  code: h.invalid_enum_value,
2478
2478
  options: r
2479
- }), T;
2479
+ }), C;
2480
2480
  }
2481
2481
  return V(e.data);
2482
2482
  }
@@ -2502,20 +2502,20 @@ class Ce extends j {
2502
2502
  return e;
2503
2503
  }
2504
2504
  extract(e, n = this._def) {
2505
- return Ce.create(e, {
2505
+ return Te.create(e, {
2506
2506
  ...this._def,
2507
2507
  ...n
2508
2508
  });
2509
2509
  }
2510
2510
  exclude(e, n = this._def) {
2511
- return Ce.create(this.options.filter((r) => !e.includes(r)), {
2511
+ return Te.create(this.options.filter((r) => !e.includes(r)), {
2512
2512
  ...this._def,
2513
2513
  ...n
2514
2514
  });
2515
2515
  }
2516
2516
  }
2517
2517
  ft = /* @__PURE__ */ new WeakMap();
2518
- Ce.create = sr;
2518
+ Te.create = sr;
2519
2519
  class Zt extends j {
2520
2520
  constructor() {
2521
2521
  super(...arguments), _t.set(this, void 0);
@@ -2528,7 +2528,7 @@ class Zt extends j {
2528
2528
  expected: E.joinValues(a),
2529
2529
  received: r.parsedType,
2530
2530
  code: h.invalid_type
2531
- }), T;
2531
+ }), C;
2532
2532
  }
2533
2533
  if (an(this, _t) || tr(this, _t, new Set(E.getValidEnumValues(this._def.values))), !an(this, _t).has(e.data)) {
2534
2534
  const a = E.objectValues(n);
@@ -2536,7 +2536,7 @@ class Zt extends j {
2536
2536
  received: r.data,
2537
2537
  code: h.invalid_enum_value,
2538
2538
  options: a
2539
- }), T;
2539
+ }), C;
2540
2540
  }
2541
2541
  return V(e.data);
2542
2542
  }
@@ -2561,7 +2561,7 @@ class ot extends j {
2561
2561
  code: h.invalid_type,
2562
2562
  expected: g.promise,
2563
2563
  received: n.parsedType
2564
- }), T;
2564
+ }), C;
2565
2565
  const r = n.parsedType === g.promise ? n.data : Promise.resolve(n.data);
2566
2566
  return V(r.then((a) => this._def.type.parseAsync(a, {
2567
2567
  path: n.path,
@@ -2595,23 +2595,23 @@ class Y extends j {
2595
2595
  if (r.common.async)
2596
2596
  return Promise.resolve(o).then(async (d) => {
2597
2597
  if (n.value === "aborted")
2598
- return T;
2598
+ return C;
2599
2599
  const c = await this._def.schema._parseAsync({
2600
2600
  data: d,
2601
2601
  path: r.path,
2602
2602
  parent: r
2603
2603
  });
2604
- return c.status === "aborted" ? T : c.status === "dirty" || n.value === "dirty" ? rn(c.value) : c;
2604
+ return c.status === "aborted" ? C : c.status === "dirty" || n.value === "dirty" ? rn(c.value) : c;
2605
2605
  });
2606
2606
  {
2607
2607
  if (n.value === "aborted")
2608
- return T;
2608
+ return C;
2609
2609
  const d = this._def.schema._parseSync({
2610
2610
  data: o,
2611
2611
  path: r.path,
2612
2612
  parent: r
2613
2613
  });
2614
- return d.status === "aborted" ? T : d.status === "dirty" || n.value === "dirty" ? rn(d.value) : d;
2614
+ return d.status === "aborted" ? C : d.status === "dirty" || n.value === "dirty" ? rn(d.value) : d;
2615
2615
  }
2616
2616
  }
2617
2617
  if (a.type === "refinement") {
@@ -2629,9 +2629,9 @@ class Y extends j {
2629
2629
  path: r.path,
2630
2630
  parent: r
2631
2631
  });
2632
- return d.status === "aborted" ? T : (d.status === "dirty" && n.dirty(), o(d.value), { status: n.value, value: d.value });
2632
+ return d.status === "aborted" ? C : (d.status === "dirty" && n.dirty(), o(d.value), { status: n.value, value: d.value });
2633
2633
  } else
2634
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((d) => d.status === "aborted" ? T : (d.status === "dirty" && n.dirty(), o(d.value).then(() => ({ status: n.value, value: d.value }))));
2634
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((d) => d.status === "aborted" ? C : (d.status === "dirty" && n.dirty(), o(d.value).then(() => ({ status: n.value, value: d.value }))));
2635
2635
  }
2636
2636
  if (a.type === "transform")
2637
2637
  if (r.common.async === !1) {
@@ -2760,7 +2760,7 @@ class cn extends j {
2760
2760
  code: h.invalid_type,
2761
2761
  expected: g.nan,
2762
2762
  received: n.parsedType
2763
- }), T;
2763
+ }), C;
2764
2764
  }
2765
2765
  return { status: "valid", value: e.data };
2766
2766
  }
@@ -2793,7 +2793,7 @@ class Ht extends j {
2793
2793
  path: r.path,
2794
2794
  parent: r
2795
2795
  });
2796
- return a.status === "aborted" ? T : a.status === "dirty" ? (n.dirty(), rn(a.value)) : this._def.out._parseAsync({
2796
+ return a.status === "aborted" ? C : a.status === "dirty" ? (n.dirty(), rn(a.value)) : this._def.out._parseAsync({
2797
2797
  data: a.value,
2798
2798
  path: r.path,
2799
2799
  parent: r
@@ -2805,7 +2805,7 @@ class Ht extends j {
2805
2805
  path: r.path,
2806
2806
  parent: r
2807
2807
  });
2808
- return a.status === "aborted" ? T : a.status === "dirty" ? (n.dirty(), {
2808
+ return a.status === "aborted" ? C : a.status === "dirty" ? (n.dirty(), {
2809
2809
  status: "dirty",
2810
2810
  value: a.value
2811
2811
  }) : this._def.out._parseSync({
@@ -2823,7 +2823,7 @@ class Ht extends j {
2823
2823
  });
2824
2824
  }
2825
2825
  }
2826
- class At extends j {
2826
+ class Pt extends j {
2827
2827
  _parse(e) {
2828
2828
  const n = this._def.innerType._parse(e), r = (a) => (wt(a) && (a.value = Object.freeze(a.value)), a);
2829
2829
  return xt(n) ? n.then((a) => r(a)) : r(n);
@@ -2832,7 +2832,7 @@ class At extends j {
2832
2832
  return this._def.innerType;
2833
2833
  }
2834
2834
  }
2835
- At.create = (t, e) => new At({
2835
+ Pt.create = (t, e) => new Pt({
2836
2836
  innerType: t,
2837
2837
  typeName: x.ZodReadonly,
2838
2838
  ...O(e)
@@ -2847,7 +2847,7 @@ function ir(t, e = {}, n) {
2847
2847
  }) : it.create();
2848
2848
  }
2849
2849
  const wa = {
2850
- object: P.lazycreate
2850
+ object: A.lazycreate
2851
2851
  };
2852
2852
  var x;
2853
2853
  (function(t) {
@@ -2855,16 +2855,16 @@ var x;
2855
2855
  })(x || (x = {}));
2856
2856
  const xa = (t, e = {
2857
2857
  message: `Input not instance of ${t.name}`
2858
- }) => ir((n) => n instanceof t, e), or = q.create, dr = ke.create, Na = cn.create, ka = Te.create, cr = Nt.create, Ta = ze.create, Ca = sn.create, Oa = kt.create, Sa = Tt.create, ja = it.create, Ia = Me.create, Za = me.create, Ea = on.create, $a = G.create, Aa = P.create, Pa = P.strictCreate, Da = Ct.create, Ra = yn.create, Ma = Ot.create, La = oe.create, za = St.create, Ua = dn.create, Fa = Ue.create, Va = nt.create, Ba = jt.create, Ka = It.create, Wa = Ce.create, Ja = Zt.create, qa = ot.create, Jn = Y.create, Qa = ae.create, Ga = Oe.create, Ha = Y.createWithPreprocess, Ya = Ht.create, Xa = () => or().optional(), es = () => dr().optional(), ts = () => cr().optional(), ns = {
2858
+ }) => ir((n) => n instanceof t, e), or = q.create, dr = ke.create, Na = cn.create, ka = Ce.create, cr = Nt.create, Ca = ze.create, Ta = sn.create, Oa = kt.create, Sa = Ct.create, ja = it.create, Ia = Me.create, Za = me.create, Ea = on.create, $a = G.create, Pa = A.create, Aa = A.strictCreate, Da = Tt.create, Ra = yn.create, Ma = Ot.create, La = oe.create, za = St.create, Ua = dn.create, Fa = Ue.create, Va = nt.create, Ba = jt.create, Ka = It.create, Ja = Te.create, Wa = Zt.create, qa = ot.create, Wn = Y.create, Qa = ae.create, Ga = Oe.create, Ha = Y.createWithPreprocess, Ya = Ht.create, Xa = () => or().optional(), es = () => dr().optional(), ts = () => cr().optional(), ns = {
2859
2859
  string: (t) => q.create({ ...t, coerce: !0 }),
2860
2860
  number: (t) => ke.create({ ...t, coerce: !0 }),
2861
2861
  boolean: (t) => Nt.create({
2862
2862
  ...t,
2863
2863
  coerce: !0
2864
2864
  }),
2865
- bigint: (t) => Te.create({ ...t, coerce: !0 }),
2865
+ bigint: (t) => Ce.create({ ...t, coerce: !0 }),
2866
2866
  date: (t) => ze.create({ ...t, coerce: !0 })
2867
- }, rs = T;
2867
+ }, rs = C;
2868
2868
  var i = /* @__PURE__ */ Object.freeze({
2869
2869
  __proto__: null,
2870
2870
  defaultErrorMap: st,
@@ -2874,7 +2874,7 @@ var i = /* @__PURE__ */ Object.freeze({
2874
2874
  EMPTY_PATH: aa,
2875
2875
  addIssueToContext: f,
2876
2876
  ParseStatus: U,
2877
- INVALID: T,
2877
+ INVALID: C,
2878
2878
  DIRTY: rn,
2879
2879
  OK: V,
2880
2880
  isAborted: Sn,
@@ -2893,19 +2893,19 @@ var i = /* @__PURE__ */ Object.freeze({
2893
2893
  datetimeRegex: ar,
2894
2894
  ZodString: q,
2895
2895
  ZodNumber: ke,
2896
- ZodBigInt: Te,
2896
+ ZodBigInt: Ce,
2897
2897
  ZodBoolean: Nt,
2898
2898
  ZodDate: ze,
2899
2899
  ZodSymbol: sn,
2900
2900
  ZodUndefined: kt,
2901
- ZodNull: Tt,
2901
+ ZodNull: Ct,
2902
2902
  ZodAny: it,
2903
2903
  ZodUnknown: Me,
2904
2904
  ZodNever: me,
2905
2905
  ZodVoid: on,
2906
2906
  ZodArray: G,
2907
- ZodObject: P,
2908
- ZodUnion: Ct,
2907
+ ZodObject: A,
2908
+ ZodUnion: Tt,
2909
2909
  ZodDiscriminatedUnion: yn,
2910
2910
  ZodIntersection: Ot,
2911
2911
  ZodTuple: oe,
@@ -2915,7 +2915,7 @@ var i = /* @__PURE__ */ Object.freeze({
2915
2915
  ZodFunction: nt,
2916
2916
  ZodLazy: jt,
2917
2917
  ZodLiteral: It,
2918
- ZodEnum: Ce,
2918
+ ZodEnum: Te,
2919
2919
  ZodNativeEnum: Zt,
2920
2920
  ZodPromise: ot,
2921
2921
  ZodEffects: Y,
@@ -2928,7 +2928,7 @@ var i = /* @__PURE__ */ Object.freeze({
2928
2928
  BRAND: ba,
2929
2929
  ZodBranded: zn,
2930
2930
  ZodPipeline: Ht,
2931
- ZodReadonly: At,
2931
+ ZodReadonly: Pt,
2932
2932
  custom: ir,
2933
2933
  Schema: j,
2934
2934
  ZodSchema: j,
@@ -2941,10 +2941,10 @@ var i = /* @__PURE__ */ Object.freeze({
2941
2941
  array: $a,
2942
2942
  bigint: ka,
2943
2943
  boolean: cr,
2944
- date: Ta,
2944
+ date: Ca,
2945
2945
  discriminatedUnion: Ra,
2946
- effect: Jn,
2947
- enum: Wa,
2946
+ effect: Wn,
2947
+ enum: Ja,
2948
2948
  function: Va,
2949
2949
  instanceof: xa,
2950
2950
  intersection: Ma,
@@ -2952,12 +2952,12 @@ var i = /* @__PURE__ */ Object.freeze({
2952
2952
  literal: Ka,
2953
2953
  map: Ua,
2954
2954
  nan: Na,
2955
- nativeEnum: Ja,
2955
+ nativeEnum: Wa,
2956
2956
  never: Za,
2957
2957
  null: Sa,
2958
2958
  nullable: Ga,
2959
2959
  number: dr,
2960
- object: Aa,
2960
+ object: Pa,
2961
2961
  oboolean: ts,
2962
2962
  onumber: es,
2963
2963
  optional: Qa,
@@ -2967,10 +2967,10 @@ var i = /* @__PURE__ */ Object.freeze({
2967
2967
  promise: qa,
2968
2968
  record: za,
2969
2969
  set: Fa,
2970
- strictObject: Pa,
2970
+ strictObject: Aa,
2971
2971
  string: or,
2972
- symbol: Ca,
2973
- transformer: Jn,
2972
+ symbol: Ta,
2973
+ transformer: Wn,
2974
2974
  tuple: La,
2975
2975
  undefined: Oa,
2976
2976
  union: Da,
@@ -3247,6 +3247,7 @@ const gs = i.enum([
3247
3247
  description: "The connection that the code is connected to"
3248
3248
  }),
3249
3249
  code_type: gs,
3250
+ code_verifier: i.string().optional(),
3250
3251
  expires_at: i.string(),
3251
3252
  used_at: i.string().optional(),
3252
3253
  user_id: i.string().optional()
@@ -3340,7 +3341,7 @@ const Ns = i.object({
3340
3341
  }),
3341
3342
  created_at: i.string(),
3342
3343
  updated_at: i.string()
3343
- }), Ts = i.enum([
3344
+ }), Cs = i.enum([
3344
3345
  "cls",
3345
3346
  // CODE_LINK_SENT
3346
3347
  "fsa",
@@ -3389,7 +3390,7 @@ const Ns = i.object({
3389
3390
  // SUCCESS_VERIFICATION_EMAIL
3390
3391
  "svr"
3391
3392
  // SUCCESS_VERIFICATION_EMAIL_REQUEST
3392
- ]), Cs = i.object({
3393
+ ]), Ts = i.object({
3393
3394
  name: i.string(),
3394
3395
  version: i.string(),
3395
3396
  env: i.object({
@@ -3397,7 +3398,7 @@ const Ns = i.object({
3397
3398
  }).optional()
3398
3399
  });
3399
3400
  i.object({
3400
- type: Ts,
3401
+ type: Cs,
3401
3402
  date: i.string(),
3402
3403
  description: i.string().optional(),
3403
3404
  log_id: i.string().optional(),
@@ -3418,7 +3419,7 @@ i.object({
3418
3419
  strategy: i.string().optional(),
3419
3420
  strategy_type: i.string().optional(),
3420
3421
  hostname: i.string().optional(),
3421
- auth0_client: Cs.optional()
3422
+ auth0_client: Ts.optional()
3422
3423
  });
3423
3424
  const Os = i.object({
3424
3425
  user_id: i.string(),
@@ -3559,7 +3560,7 @@ const js = i.object({
3559
3560
  logo_position: i.enum(["center"]),
3560
3561
  logo_url: i.string(),
3561
3562
  social_buttons_layout: i.enum(["bottom"])
3562
- }), As = i.object({
3563
+ }), Ps = i.object({
3563
3564
  borders: js,
3564
3565
  colors: Is,
3565
3566
  displayName: i.string(),
@@ -3567,15 +3568,46 @@ const js = i.object({
3567
3568
  page_background: Es,
3568
3569
  widget: $s
3569
3570
  });
3570
- As.extend({
3571
+ Ps.extend({
3571
3572
  themeId: i.string()
3572
3573
  });
3573
- const Ps = i.object({
3574
+ const As = i.object({
3574
3575
  universal_login_experience: i.enum(["new", "classic"]).default("new"),
3575
3576
  identifier_first: i.boolean().default(!0),
3576
3577
  password_first: i.boolean().default(!1),
3577
3578
  webauthn_platform_first_factor: i.boolean()
3578
3579
  });
3580
+ i.object({
3581
+ name: i.string(),
3582
+ enabled: i.boolean().optional().default(!0),
3583
+ default_from_address: i.string().optional(),
3584
+ credentials: i.union([
3585
+ i.object({
3586
+ accessKeyId: i.string(),
3587
+ secretAccessKey: i.string(),
3588
+ region: i.string()
3589
+ }),
3590
+ i.object({
3591
+ smtp_host: i.array(i.string()),
3592
+ smtp_port: i.number(),
3593
+ smtp_user: i.string(),
3594
+ smtp_pass: i.string()
3595
+ }),
3596
+ i.object({
3597
+ api_key: i.string(),
3598
+ domain: i.string().optional()
3599
+ }),
3600
+ i.object({
3601
+ connectionString: i.string()
3602
+ }),
3603
+ i.object({
3604
+ tenantId: i.string(),
3605
+ clientId: i.string(),
3606
+ clientSecret: i.string()
3607
+ })
3608
+ ]),
3609
+ settings: i.object({}).optional()
3610
+ });
3579
3611
  function Vn(t) {
3580
3612
  const [e, n] = t.split("|");
3581
3613
  if (!e || !n)
@@ -3763,7 +3795,7 @@ function Ks(t) {
3763
3795
  return n ? M(n) : null;
3764
3796
  };
3765
3797
  }
3766
- function Ws(t) {
3798
+ function Js(t) {
3767
3799
  return async (e) => {
3768
3800
  let n = t.selectFrom("tenants");
3769
3801
  if (e.sort && e.sort.sort_by) {
@@ -3785,7 +3817,7 @@ function Ws(t) {
3785
3817
  };
3786
3818
  };
3787
3819
  }
3788
- function Js(t) {
3820
+ function Ws(t) {
3789
3821
  return async (e, n) => {
3790
3822
  const r = {
3791
3823
  ...n,
@@ -3802,8 +3834,8 @@ function Qs(t) {
3802
3834
  return {
3803
3835
  create: Bs(t),
3804
3836
  get: Ks(t),
3805
- list: Ws(t),
3806
- update: Js(t),
3837
+ list: Js(t),
3838
+ update: Ws(t),
3807
3839
  remove: qs(t)
3808
3840
  };
3809
3841
  }
@@ -3939,68 +3971,12 @@ function ii(t) {
3939
3971
  };
3940
3972
  }
3941
3973
  function oi(t) {
3942
- return async (e, n) => {
3943
- const r = await t.selectFrom("tickets").where("tickets.tenant_id", "=", e).where("tickets.id", "=", n).where("tickets.used_at", "is", null).selectAll().executeTakeFirst();
3944
- if (!r)
3945
- return null;
3946
- const {
3947
- nonce: a,
3948
- state: s,
3949
- scope: o,
3950
- response_type: d,
3951
- response_mode: c,
3952
- redirect_uri: l,
3953
- ...u
3954
- } = r;
3955
- return {
3956
- ...u,
3957
- authParams: {
3958
- nonce: a,
3959
- state: s,
3960
- scope: o,
3961
- response_type: d,
3962
- response_mode: c,
3963
- redirect_uri: l
3964
- },
3965
- created_at: new Date(r.created_at),
3966
- expires_at: new Date(r.expires_at),
3967
- used_at: r.used_at ? new Date(r.used_at) : void 0
3968
- };
3969
- };
3970
- }
3971
- function di(t) {
3972
- return async (e) => {
3973
- const { authParams: n, ...r } = e, a = {
3974
- ...r,
3975
- ...n,
3976
- created_at: e.created_at.toISOString(),
3977
- expires_at: e.expires_at.toISOString(),
3978
- used_at: e.used_at ? e.used_at.toISOString() : void 0
3979
- };
3980
- await t.insertInto("tickets").values(a).execute();
3981
- };
3982
- }
3983
- function ci(t) {
3984
- return async (e, n) => {
3985
- await t.updateTable("tickets").set({
3986
- used_at: (/* @__PURE__ */ new Date()).toISOString()
3987
- }).where("tickets.tenant_id", "=", e).where("tickets.id", "=", n).execute();
3988
- };
3989
- }
3990
- function li(t) {
3991
- return {
3992
- create: di(t),
3993
- get: oi(t),
3994
- remove: ci(t)
3995
- };
3996
- }
3997
- function ui(t) {
3998
3974
  return async (e, n) => {
3999
3975
  const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", n).selectAll().executeTakeFirstOrThrow(), { tenant_id: a, ...s } = r;
4000
3976
  return s;
4001
3977
  };
4002
3978
  }
4003
- function hi(t) {
3979
+ function di(t) {
4004
3980
  return async (e, n) => {
4005
3981
  const r = {
4006
3982
  ...n,
@@ -4013,20 +3989,20 @@ function hi(t) {
4013
3989
  }).execute(), r;
4014
3990
  };
4015
3991
  }
4016
- function pi(t) {
3992
+ function ci(t) {
4017
3993
  return async (e, n) => (await t.updateTable("passwords").set({
4018
3994
  password: n.password,
4019
3995
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
4020
3996
  }).where("tenant_id", "=", e).where("user_id", "=", n.user_id).execute()).length === 1;
4021
3997
  }
4022
- function mi(t) {
3998
+ function li(t) {
4023
3999
  return {
4024
- create: hi(t),
4025
- update: pi(t),
4026
- get: ui(t)
4000
+ create: di(t),
4001
+ update: ci(t),
4002
+ get: oi(t)
4027
4003
  };
4028
4004
  }
4029
- function fi(t) {
4005
+ function ui(t) {
4030
4006
  return async (e, n) => {
4031
4007
  let r = t.selectFrom("codes").where("codes.tenant_id", "=", e);
4032
4008
  n.q && (r = Be(t, r, n.q, ["code", "login_id"]));
@@ -4042,7 +4018,7 @@ function fi(t) {
4042
4018
  };
4043
4019
  };
4044
4020
  }
4045
- function _i(t) {
4021
+ function hi(t) {
4046
4022
  return async (e, n) => {
4047
4023
  const r = {
4048
4024
  ...n,
@@ -4054,10 +4030,10 @@ function _i(t) {
4054
4030
  }).execute(), r;
4055
4031
  };
4056
4032
  }
4057
- function gi(t) {
4033
+ function pi(t) {
4058
4034
  return async (e, n) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4059
4035
  }
4060
- function yi(t) {
4036
+ function mi(t) {
4061
4037
  return async (e, n, r) => {
4062
4038
  let a = t.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", r).where("codes.expires_at", ">", (/* @__PURE__ */ new Date()).toISOString());
4063
4039
  e.length && (a = a.where("codes.tenant_id", "=", e));
@@ -4065,15 +4041,15 @@ function yi(t) {
4065
4041
  return s ? M(s) : null;
4066
4042
  };
4067
4043
  }
4068
- function vi(t) {
4044
+ function fi(t) {
4069
4045
  return {
4070
- create: _i(t),
4071
- list: fi(t),
4072
- remove: gi(t),
4073
- get: yi(t)
4046
+ create: hi(t),
4047
+ list: ui(t),
4048
+ remove: pi(t),
4049
+ get: mi(t)
4074
4050
  };
4075
4051
  }
4076
- function bi(t) {
4052
+ function _i(t) {
4077
4053
  return async (e, n) => {
4078
4054
  const r = {
4079
4055
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4093,7 +4069,7 @@ function bi(t) {
4093
4069
  }).execute(), r;
4094
4070
  };
4095
4071
  }
4096
- function wi(t) {
4072
+ function gi(t) {
4097
4073
  return async (e) => ({
4098
4074
  applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((s) => ({
4099
4075
  ...s,
@@ -4107,7 +4083,7 @@ function wi(t) {
4107
4083
  }))
4108
4084
  });
4109
4085
  }
4110
- function xi(t) {
4086
+ function yi(t) {
4111
4087
  return async (e, n) => {
4112
4088
  const r = await t.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", n).selectAll().executeTakeFirst();
4113
4089
  return r ? M({
@@ -4121,10 +4097,10 @@ function xi(t) {
4121
4097
  }) : null;
4122
4098
  };
4123
4099
  }
4124
- function Ni(t) {
4100
+ function vi(t) {
4125
4101
  return async (e, n) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4126
4102
  }
4127
- function ki(t) {
4103
+ function bi(t) {
4128
4104
  return async (e, n, r) => {
4129
4105
  const a = {
4130
4106
  ...r,
@@ -4140,16 +4116,16 @@ function ki(t) {
4140
4116
  return await t.updateTable("applications").set(a).where("applications.id", "=", n).where("applications.tenant_id", "=", e).execute(), !0;
4141
4117
  };
4142
4118
  }
4143
- function Ti(t) {
4119
+ function wi(t) {
4144
4120
  return {
4145
- create: bi(t),
4146
- list: wi(t),
4147
- get: xi(t),
4148
- remove: Ni(t),
4149
- update: ki(t)
4121
+ create: _i(t),
4122
+ list: gi(t),
4123
+ get: yi(t),
4124
+ remove: vi(t),
4125
+ update: bi(t)
4150
4126
  };
4151
4127
  }
4152
- function Ci(t) {
4128
+ function xi(t) {
4153
4129
  return async (e, n) => {
4154
4130
  const r = {
4155
4131
  id: Ke(),
@@ -4165,7 +4141,7 @@ function Ci(t) {
4165
4141
  }).execute(), r;
4166
4142
  };
4167
4143
  }
4168
- function Oi(t, e) {
4144
+ function Ni(t, e) {
4169
4145
  var n = {};
4170
4146
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
4171
4147
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -4173,7 +4149,7 @@ function Oi(t, e) {
4173
4149
  e.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[a]) && (n[r[a]] = t[r[a]]);
4174
4150
  return n;
4175
4151
  }
4176
- function Si(t, e) {
4152
+ function ki(t, e) {
4177
4153
  var n;
4178
4154
  return ((n = t == null ? void 0 : t._def) === null || n === void 0 ? void 0 : n.typeName) === e;
4179
4155
  }
@@ -4184,25 +4160,25 @@ function mt(t, e) {
4184
4160
  return a._def.openapi = this._def.openapi, a;
4185
4161
  };
4186
4162
  }
4187
- function ji(t) {
4163
+ function Ci(t) {
4188
4164
  if (typeof t.ZodType.prototype.openapi < "u")
4189
4165
  return;
4190
4166
  t.ZodType.prototype.openapi = function(a, s) {
4191
4167
  var o, d, c, l, u, Z;
4192
- const R = typeof a == "string" ? s : a, J = R ?? {}, { param: _e } = J, We = Oi(J, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof a == "string" ? { refId: a } : void 0), ye = Object.assign(Object.assign(Object.assign({}, (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata), We), !((l = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || l === void 0) && l.param || _e ? {
4168
+ const R = typeof a == "string" ? s : a, W = R ?? {}, { param: _e } = W, Je = Ni(W, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof a == "string" ? { refId: a } : void 0), ye = Object.assign(Object.assign(Object.assign({}, (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata), Je), !((l = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || l === void 0) && l.param || _e ? {
4193
4169
  param: Object.assign(Object.assign({}, (Z = (u = this._def.openapi) === null || u === void 0 ? void 0 : u.metadata) === null || Z === void 0 ? void 0 : Z.param), _e)
4194
4170
  } : void 0), ve = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(ge).length > 0 ? { _internal: ge } : void 0), Object.keys(ye).length > 0 ? { metadata: ye } : void 0) }));
4195
- if (Si(this, "ZodObject")) {
4196
- const Je = this.extend;
4171
+ if (ki(this, "ZodObject")) {
4172
+ const We = this.extend;
4197
4173
  ve.extend = function(...qe) {
4198
- var ee, te, ne, be, $e, Ae;
4199
- const Pe = Je.apply(this, qe);
4200
- return Pe._def.openapi = {
4174
+ var ee, te, ne, be, $e, Pe;
4175
+ const Ae = We.apply(this, qe);
4176
+ return Ae._def.openapi = {
4201
4177
  _internal: {
4202
4178
  extendedFrom: !((te = (ee = this._def.openapi) === null || ee === void 0 ? void 0 : ee._internal) === null || te === void 0) && te.refId ? { refId: (be = (ne = this._def.openapi) === null || ne === void 0 ? void 0 : ne._internal) === null || be === void 0 ? void 0 : be.refId, schema: this } : ($e = this._def.openapi) === null || $e === void 0 ? void 0 : $e._internal.extendedFrom
4203
4179
  },
4204
- metadata: (Ae = Pe._def.openapi) === null || Ae === void 0 ? void 0 : Ae.metadata
4205
- }, Pe;
4180
+ metadata: (Pe = Ae._def.openapi) === null || Pe === void 0 ? void 0 : Pe.metadata
4181
+ }, Ae;
4206
4182
  };
4207
4183
  }
4208
4184
  return ve;
@@ -4330,8 +4306,8 @@ const y = $.arrayToEnum([
4330
4306
  "invalid_intersection_types",
4331
4307
  "not_multiple_of",
4332
4308
  "not_finite"
4333
- ]), Ii = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
4334
- class W extends Error {
4309
+ ]), Ti = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
4310
+ class J extends Error {
4335
4311
  constructor(e) {
4336
4312
  super(), this.issues = [], this.addIssue = (r) => {
4337
4313
  this.issues = [...this.issues, r];
@@ -4368,7 +4344,7 @@ class W extends Error {
4368
4344
  return a(this), r;
4369
4345
  }
4370
4346
  static assert(e) {
4371
- if (!(e instanceof W))
4347
+ if (!(e instanceof J))
4372
4348
  throw new Error(`Not a ZodError: ${e}`);
4373
4349
  }
4374
4350
  toString() {
@@ -4390,7 +4366,7 @@ class W extends Error {
4390
4366
  return this.flatten();
4391
4367
  }
4392
4368
  }
4393
- W.create = (t) => new W(t);
4369
+ J.create = (t) => new J(t);
4394
4370
  const dt = (t, e) => {
4395
4371
  let n;
4396
4372
  switch (t.code) {
@@ -4448,7 +4424,7 @@ const dt = (t, e) => {
4448
4424
  return { message: n };
4449
4425
  };
4450
4426
  let yr = dt;
4451
- function Zi(t) {
4427
+ function Oi(t) {
4452
4428
  yr = t;
4453
4429
  }
4454
4430
  function ln() {
@@ -4474,7 +4450,7 @@ const un = (t) => {
4474
4450
  path: s,
4475
4451
  message: d
4476
4452
  };
4477
- }, Ei = [];
4453
+ }, Si = [];
4478
4454
  function _(t, e) {
4479
4455
  const n = ln(), r = un({
4480
4456
  issueData: e,
@@ -4533,7 +4509,7 @@ class F {
4533
4509
  }
4534
4510
  const k = Object.freeze({
4535
4511
  status: "aborted"
4536
- }), tt = (t) => ({ status: "dirty", value: t }), B = (t) => ({ status: "valid", value: t }), En = (t) => t.status === "aborted", $n = (t) => t.status === "dirty", Pt = (t) => t.status === "valid", Dt = (t) => typeof Promise < "u" && t instanceof Promise;
4512
+ }), tt = (t) => ({ status: "dirty", value: t }), B = (t) => ({ status: "valid", value: t }), En = (t) => t.status === "aborted", $n = (t) => t.status === "dirty", At = (t) => t.status === "valid", Dt = (t) => typeof Promise < "u" && t instanceof Promise;
4537
4513
  function hn(t, e, n, r) {
4538
4514
  if (typeof e == "function" ? t !== e || !r : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4539
4515
  return e.get(t);
@@ -4556,7 +4532,7 @@ class de {
4556
4532
  }
4557
4533
  }
4558
4534
  const Gn = (t, e) => {
4559
- if (Pt(e))
4535
+ if (At(e))
4560
4536
  return { success: !0, data: e.value };
4561
4537
  if (!t.common.issues.length)
4562
4538
  throw new Error("Validation failed but no issues detected.");
@@ -4565,7 +4541,7 @@ const Gn = (t, e) => {
4565
4541
  get error() {
4566
4542
  if (this._error)
4567
4543
  return this._error;
4568
- const n = new W(t.common.issues);
4544
+ const n = new J(t.common.issues);
4569
4545
  return this._error = n, this._error;
4570
4546
  }
4571
4547
  };
@@ -4722,7 +4698,7 @@ class I {
4722
4698
  }
4723
4699
  default(e) {
4724
4700
  const n = typeof e == "function" ? e : () => e;
4725
- return new Wt({
4701
+ return new Jt({
4726
4702
  ...S(this._def),
4727
4703
  innerType: this,
4728
4704
  defaultValue: n,
@@ -4738,7 +4714,7 @@ class I {
4738
4714
  }
4739
4715
  catch(e) {
4740
4716
  const n = typeof e == "function" ? e : () => e;
4741
- return new Jt({
4717
+ return new Wt({
4742
4718
  ...S(this._def),
4743
4719
  innerType: this,
4744
4720
  catchValue: n,
@@ -4765,14 +4741,14 @@ class I {
4765
4741
  return this.safeParse(null).success;
4766
4742
  }
4767
4743
  }
4768
- const $i = /^c[^\s-]{8,}$/i, Ai = /^[0-9a-z]+$/, Pi = /^[0-9A-HJKMNP-TV-Z]{26}$/, Di = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Ri = /^[a-z0-9_-]{21}$/i, Mi = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Li = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, zi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
4744
+ const ji = /^c[^\s-]{8,}$/i, Ii = /^[0-9a-z]+$/, Zi = /^[0-9A-HJKMNP-TV-Z]{26}$/, Ei = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, $i = /^[a-z0-9_-]{21}$/i, Pi = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ai = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Di = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
4769
4745
  let xn;
4770
- const Ui = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Fi = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Vi = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, br = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Bi = new RegExp(`^${br}$`);
4746
+ const Ri = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Mi = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Li = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, br = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", zi = new RegExp(`^${br}$`);
4771
4747
  function wr(t) {
4772
4748
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
4773
4749
  return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
4774
4750
  }
4775
- function Ki(t) {
4751
+ function Ui(t) {
4776
4752
  return new RegExp(`^${wr(t)}$`);
4777
4753
  }
4778
4754
  function xr(t) {
@@ -4780,8 +4756,8 @@ function xr(t) {
4780
4756
  const n = [];
4781
4757
  return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
4782
4758
  }
4783
- function Wi(t, e) {
4784
- return !!((e === "v4" || !e) && Ui.test(t) || (e === "v6" || !e) && Fi.test(t));
4759
+ function Fi(t, e) {
4760
+ return !!((e === "v4" || !e) && Ri.test(t) || (e === "v6" || !e) && Mi.test(t));
4785
4761
  }
4786
4762
  class Q extends I {
4787
4763
  _parse(e) {
@@ -4832,43 +4808,43 @@ class Q extends I {
4832
4808
  message: s.message
4833
4809
  }), r.dirty());
4834
4810
  } else if (s.kind === "email")
4835
- Li.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4811
+ Ai.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4836
4812
  validation: "email",
4837
4813
  code: p.invalid_string,
4838
4814
  message: s.message
4839
4815
  }), r.dirty());
4840
4816
  else if (s.kind === "emoji")
4841
- xn || (xn = new RegExp(zi, "u")), xn.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4817
+ xn || (xn = new RegExp(Di, "u")), xn.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4842
4818
  validation: "emoji",
4843
4819
  code: p.invalid_string,
4844
4820
  message: s.message
4845
4821
  }), r.dirty());
4846
4822
  else if (s.kind === "uuid")
4847
- Di.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4823
+ Ei.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4848
4824
  validation: "uuid",
4849
4825
  code: p.invalid_string,
4850
4826
  message: s.message
4851
4827
  }), r.dirty());
4852
4828
  else if (s.kind === "nanoid")
4853
- Ri.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4829
+ $i.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4854
4830
  validation: "nanoid",
4855
4831
  code: p.invalid_string,
4856
4832
  message: s.message
4857
4833
  }), r.dirty());
4858
4834
  else if (s.kind === "cuid")
4859
- $i.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4835
+ ji.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4860
4836
  validation: "cuid",
4861
4837
  code: p.invalid_string,
4862
4838
  message: s.message
4863
4839
  }), r.dirty());
4864
4840
  else if (s.kind === "cuid2")
4865
- Ai.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4841
+ Ii.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4866
4842
  validation: "cuid2",
4867
4843
  code: p.invalid_string,
4868
4844
  message: s.message
4869
4845
  }), r.dirty());
4870
4846
  else if (s.kind === "ulid")
4871
- Pi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4847
+ Zi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4872
4848
  validation: "ulid",
4873
4849
  code: p.invalid_string,
4874
4850
  message: s.message
@@ -4903,23 +4879,23 @@ class Q extends I {
4903
4879
  code: p.invalid_string,
4904
4880
  validation: "datetime",
4905
4881
  message: s.message
4906
- }), r.dirty()) : s.kind === "date" ? Bi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4882
+ }), r.dirty()) : s.kind === "date" ? zi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4907
4883
  code: p.invalid_string,
4908
4884
  validation: "date",
4909
4885
  message: s.message
4910
- }), r.dirty()) : s.kind === "time" ? Ki(s).test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4886
+ }), r.dirty()) : s.kind === "time" ? Ui(s).test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4911
4887
  code: p.invalid_string,
4912
4888
  validation: "time",
4913
4889
  message: s.message
4914
- }), r.dirty()) : s.kind === "duration" ? Mi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4890
+ }), r.dirty()) : s.kind === "duration" ? Pi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4915
4891
  validation: "duration",
4916
4892
  code: p.invalid_string,
4917
4893
  message: s.message
4918
- }), r.dirty()) : s.kind === "ip" ? Wi(e.data, s.version) || (a = this._getOrReturnCtx(e, a), _(a, {
4894
+ }), r.dirty()) : s.kind === "ip" ? Fi(e.data, s.version) || (a = this._getOrReturnCtx(e, a), _(a, {
4919
4895
  validation: "ip",
4920
4896
  code: p.invalid_string,
4921
4897
  message: s.message
4922
- }), r.dirty()) : s.kind === "base64" ? Vi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4898
+ }), r.dirty()) : s.kind === "base64" ? Li.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4923
4899
  validation: "base64",
4924
4900
  code: p.invalid_string,
4925
4901
  message: s.message
@@ -5141,7 +5117,7 @@ Q.create = (t) => {
5141
5117
  ...S(t)
5142
5118
  });
5143
5119
  };
5144
- function Ji(t, e) {
5120
+ function Vi(t, e) {
5145
5121
  const n = (t.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, a = n > r ? n : r, s = parseInt(t.toFixed(a).replace(".", "")), o = parseInt(e.toFixed(a).replace(".", ""));
5146
5122
  return s % o / Math.pow(10, a);
5147
5123
  }
@@ -5180,7 +5156,7 @@ class Se extends I {
5180
5156
  inclusive: s.inclusive,
5181
5157
  exact: !1,
5182
5158
  message: s.message
5183
- }), a.dirty()) : s.kind === "multipleOf" ? Ji(e.data, s.value) !== 0 && (r = this._getOrReturnCtx(e, r), _(r, {
5159
+ }), a.dirty()) : s.kind === "multipleOf" ? Vi(e.data, s.value) !== 0 && (r = this._getOrReturnCtx(e, r), _(r, {
5184
5160
  code: p.not_multiple_of,
5185
5161
  multipleOf: s.value,
5186
5162
  message: s.message
@@ -6033,7 +6009,7 @@ class zt extends I {
6033
6009
  for (const d of s)
6034
6010
  if (d.result.status === "dirty")
6035
6011
  return n.common.issues.push(...d.ctx.common.issues), d.result;
6036
- const o = s.map((d) => new W(d.ctx.common.issues));
6012
+ const o = s.map((d) => new J(d.ctx.common.issues));
6037
6013
  return _(n, {
6038
6014
  code: p.invalid_union,
6039
6015
  unionErrors: o
@@ -6080,7 +6056,7 @@ class zt extends I {
6080
6056
  }
6081
6057
  if (s)
6082
6058
  return n.common.issues.push(...s.ctx.common.issues), s.result;
6083
- const d = o.map((c) => new W(c));
6059
+ const d = o.map((c) => new J(c));
6084
6060
  return _(n, {
6085
6061
  code: p.invalid_union,
6086
6062
  unionErrors: d
@@ -6096,7 +6072,7 @@ zt.create = (t, e) => new zt({
6096
6072
  typeName: N.ZodUnion,
6097
6073
  ...S(e)
6098
6074
  });
6099
- const le = (t) => t instanceof Vt ? le(t.schema) : t instanceof X ? le(t.innerType()) : t instanceof Bt ? [t.value] : t instanceof Ie ? t.options : t instanceof Kt ? $.objectValues(t.enum) : t instanceof Wt ? le(t._def.innerType) : t instanceof Mt ? [void 0] : t instanceof Lt ? [null] : t instanceof se ? [void 0, ...le(t.unwrap())] : t instanceof Ze ? [null, ...le(t.unwrap())] : t instanceof Bn || t instanceof qt ? le(t.unwrap()) : t instanceof Jt ? le(t._def.innerType) : [];
6075
+ const le = (t) => t instanceof Vt ? le(t.schema) : t instanceof X ? le(t.innerType()) : t instanceof Bt ? [t.value] : t instanceof Ie ? t.options : t instanceof Kt ? $.objectValues(t.enum) : t instanceof Jt ? le(t._def.innerType) : t instanceof Mt ? [void 0] : t instanceof Lt ? [null] : t instanceof se ? [void 0, ...le(t.unwrap())] : t instanceof Ze ? [null, ...le(t.unwrap())] : t instanceof Bn || t instanceof qt ? le(t.unwrap()) : t instanceof Wt ? le(t._def.innerType) : [];
6100
6076
  class vn extends I {
6101
6077
  _parse(e) {
6102
6078
  const { ctx: n } = this._processInputParams(e);
@@ -6159,14 +6135,14 @@ class vn extends I {
6159
6135
  });
6160
6136
  }
6161
6137
  }
6162
- function An(t, e) {
6138
+ function Pn(t, e) {
6163
6139
  const n = Ne(t), r = Ne(e);
6164
6140
  if (t === e)
6165
6141
  return { valid: !0, data: t };
6166
6142
  if (n === y.object && r === y.object) {
6167
6143
  const a = $.objectKeys(e), s = $.objectKeys(t).filter((d) => a.indexOf(d) !== -1), o = { ...t, ...e };
6168
6144
  for (const d of s) {
6169
- const c = An(t[d], e[d]);
6145
+ const c = Pn(t[d], e[d]);
6170
6146
  if (!c.valid)
6171
6147
  return { valid: !1 };
6172
6148
  o[d] = c.data;
@@ -6177,7 +6153,7 @@ function An(t, e) {
6177
6153
  return { valid: !1 };
6178
6154
  const a = [];
6179
6155
  for (let s = 0; s < t.length; s++) {
6180
- const o = t[s], d = e[s], c = An(o, d);
6156
+ const o = t[s], d = e[s], c = Pn(o, d);
6181
6157
  if (!c.valid)
6182
6158
  return { valid: !1 };
6183
6159
  a.push(c.data);
@@ -6190,7 +6166,7 @@ class Ut extends I {
6190
6166
  const { status: n, ctx: r } = this._processInputParams(e), a = (s, o) => {
6191
6167
  if (En(s) || En(o))
6192
6168
  return k;
6193
- const d = An(s.value, o.value);
6169
+ const d = Pn(s.value, o.value);
6194
6170
  return d.valid ? (($n(s) || $n(o)) && n.dirty(), { status: n.value, value: d.data }) : (_(r, {
6195
6171
  code: p.invalid_intersection_types
6196
6172
  }), k);
@@ -6474,11 +6450,11 @@ class rt extends I {
6474
6450
  if (this._def.returns instanceof lt) {
6475
6451
  const d = this;
6476
6452
  return B(async function(...c) {
6477
- const l = new W([]), u = await d._def.args.parseAsync(c, s).catch((J) => {
6478
- throw l.addIssue(r(c, J)), l;
6453
+ const l = new J([]), u = await d._def.args.parseAsync(c, s).catch((W) => {
6454
+ throw l.addIssue(r(c, W)), l;
6479
6455
  }), Z = await Reflect.apply(o, this, u);
6480
- return await d._def.returns._def.type.parseAsync(Z, s).catch((J) => {
6481
- throw l.addIssue(a(Z, J)), l;
6456
+ return await d._def.returns._def.type.parseAsync(Z, s).catch((W) => {
6457
+ throw l.addIssue(a(Z, W)), l;
6482
6458
  });
6483
6459
  });
6484
6460
  } else {
@@ -6486,10 +6462,10 @@ class rt extends I {
6486
6462
  return B(function(...c) {
6487
6463
  const l = d._def.args.safeParse(c, s);
6488
6464
  if (!l.success)
6489
- throw new W([r(c, l.error)]);
6465
+ throw new J([r(c, l.error)]);
6490
6466
  const u = Reflect.apply(o, this, l.data), Z = d._def.returns.safeParse(u, s);
6491
6467
  if (!Z.success)
6492
- throw new W([a(u, Z.error)]);
6468
+ throw new J([a(u, Z.error)]);
6493
6469
  return Z.data;
6494
6470
  });
6495
6471
  }
@@ -6752,14 +6728,14 @@ class X extends I {
6752
6728
  path: r.path,
6753
6729
  parent: r
6754
6730
  });
6755
- if (!Pt(o))
6731
+ if (!At(o))
6756
6732
  return o;
6757
6733
  const d = a.transform(o.value, s);
6758
6734
  if (d instanceof Promise)
6759
6735
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
6760
6736
  return { status: n.value, value: d };
6761
6737
  } else
6762
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => Pt(o) ? Promise.resolve(a.transform(o.value, s)).then((d) => ({ status: n.value, value: d })) : o);
6738
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => At(o) ? Promise.resolve(a.transform(o.value, s)).then((d) => ({ status: n.value, value: d })) : o);
6763
6739
  $.assertNever(a);
6764
6740
  }
6765
6741
  }
@@ -6801,7 +6777,7 @@ Ze.create = (t, e) => new Ze({
6801
6777
  typeName: N.ZodNullable,
6802
6778
  ...S(e)
6803
6779
  });
6804
- class Wt extends I {
6780
+ class Jt extends I {
6805
6781
  _parse(e) {
6806
6782
  const { ctx: n } = this._processInputParams(e);
6807
6783
  let r = n.data;
@@ -6815,13 +6791,13 @@ class Wt extends I {
6815
6791
  return this._def.innerType;
6816
6792
  }
6817
6793
  }
6818
- Wt.create = (t, e) => new Wt({
6794
+ Jt.create = (t, e) => new Jt({
6819
6795
  innerType: t,
6820
6796
  typeName: N.ZodDefault,
6821
6797
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
6822
6798
  ...S(e)
6823
6799
  });
6824
- class Jt extends I {
6800
+ class Wt extends I {
6825
6801
  _parse(e) {
6826
6802
  const { ctx: n } = this._processInputParams(e), r = {
6827
6803
  ...n,
@@ -6840,7 +6816,7 @@ class Jt extends I {
6840
6816
  status: "valid",
6841
6817
  value: s.status === "valid" ? s.value : this._def.catchValue({
6842
6818
  get error() {
6843
- return new W(r.common.issues);
6819
+ return new J(r.common.issues);
6844
6820
  },
6845
6821
  input: r.data
6846
6822
  })
@@ -6848,7 +6824,7 @@ class Jt extends I {
6848
6824
  status: "valid",
6849
6825
  value: a.status === "valid" ? a.value : this._def.catchValue({
6850
6826
  get error() {
6851
- return new W(r.common.issues);
6827
+ return new J(r.common.issues);
6852
6828
  },
6853
6829
  input: r.data
6854
6830
  })
@@ -6858,7 +6834,7 @@ class Jt extends I {
6858
6834
  return this._def.innerType;
6859
6835
  }
6860
6836
  }
6861
- Jt.create = (t, e) => new Jt({
6837
+ Wt.create = (t, e) => new Wt({
6862
6838
  innerType: t,
6863
6839
  typeName: N.ZodCatch,
6864
6840
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
@@ -6881,7 +6857,7 @@ _n.create = (t) => new _n({
6881
6857
  typeName: N.ZodNaN,
6882
6858
  ...S(t)
6883
6859
  });
6884
- const qi = Symbol("zod_brand");
6860
+ const Bi = Symbol("zod_brand");
6885
6861
  class Bn extends I {
6886
6862
  _parse(e) {
6887
6863
  const { ctx: n } = this._processInputParams(e), r = n.data;
@@ -6937,7 +6913,7 @@ class Yt extends I {
6937
6913
  }
6938
6914
  class qt extends I {
6939
6915
  _parse(e) {
6940
- const n = this._def.innerType._parse(e), r = (a) => (Pt(a) && (a.value = Object.freeze(a.value)), a);
6916
+ const n = this._def.innerType._parse(e), r = (a) => (At(a) && (a.value = Object.freeze(a.value)), a);
6941
6917
  return Dt(n) ? n.then((a) => r(a)) : r(n);
6942
6918
  }
6943
6919
  unwrap() {
@@ -6958,16 +6934,16 @@ function kr(t, e = {}, n) {
6958
6934
  }
6959
6935
  }) : ct.create();
6960
6936
  }
6961
- const Qi = {
6937
+ const Ki = {
6962
6938
  object: D.lazycreate
6963
6939
  };
6964
6940
  var N;
6965
6941
  (function(t) {
6966
6942
  t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
6967
6943
  })(N || (N = {}));
6968
- const Gi = (t, e = {
6944
+ const Ji = (t, e = {
6969
6945
  message: `Input not instance of ${t.name}`
6970
- }) => kr((n) => n instanceof t, e), Tr = Q.create, Cr = Se.create, Hi = _n.create, Yi = je.create, Or = Rt.create, Xi = Fe.create, eo = pn.create, to = Mt.create, no = Lt.create, ro = ct.create, ao = Le.create, so = fe.create, io = mn.create, oo = H.create, co = D.create, lo = D.strictCreate, uo = zt.create, ho = vn.create, po = Ut.create, mo = ce.create, fo = Ft.create, _o = fn.create, go = Ve.create, yo = rt.create, vo = Vt.create, bo = Bt.create, wo = Ie.create, xo = Kt.create, No = lt.create, Hn = X.create, ko = se.create, To = Ze.create, Co = X.createWithPreprocess, Oo = Yt.create, So = () => Tr().optional(), jo = () => Cr().optional(), Io = () => Or().optional(), Zo = {
6946
+ }) => kr((n) => n instanceof t, e), Cr = Q.create, Tr = Se.create, Wi = _n.create, qi = je.create, Or = Rt.create, Qi = Fe.create, Gi = pn.create, Hi = Mt.create, Yi = Lt.create, Xi = ct.create, eo = Le.create, to = fe.create, no = mn.create, ro = H.create, ao = D.create, so = D.strictCreate, io = zt.create, oo = vn.create, co = Ut.create, lo = ce.create, uo = Ft.create, ho = fn.create, po = Ve.create, mo = rt.create, fo = Vt.create, _o = Bt.create, go = Ie.create, yo = Kt.create, vo = lt.create, Hn = X.create, bo = se.create, wo = Ze.create, xo = X.createWithPreprocess, No = Yt.create, ko = () => Cr().optional(), Co = () => Tr().optional(), To = () => Or().optional(), Oo = {
6971
6947
  string: (t) => Q.create({ ...t, coerce: !0 }),
6972
6948
  number: (t) => Se.create({ ...t, coerce: !0 }),
6973
6949
  boolean: (t) => Rt.create({
@@ -6976,14 +6952,14 @@ const Gi = (t, e = {
6976
6952
  }),
6977
6953
  bigint: (t) => je.create({ ...t, coerce: !0 }),
6978
6954
  date: (t) => Fe.create({ ...t, coerce: !0 })
6979
- }, Eo = k;
6980
- var $o = /* @__PURE__ */ Object.freeze({
6955
+ }, So = k;
6956
+ var jo = /* @__PURE__ */ Object.freeze({
6981
6957
  __proto__: null,
6982
6958
  defaultErrorMap: dt,
6983
- setErrorMap: Zi,
6959
+ setErrorMap: Oi,
6984
6960
  getErrorMap: ln,
6985
6961
  makeIssue: un,
6986
- EMPTY_PATH: Ei,
6962
+ EMPTY_PATH: Si,
6987
6963
  addIssueToContext: _,
6988
6964
  ParseStatus: F,
6989
6965
  INVALID: k,
@@ -6991,7 +6967,7 @@ var $o = /* @__PURE__ */ Object.freeze({
6991
6967
  OK: B,
6992
6968
  isAborted: En,
6993
6969
  isDirty: $n,
6994
- isValid: Pt,
6970
+ isValid: At,
6995
6971
  isAsync: Dt,
6996
6972
  get util() {
6997
6973
  return $;
@@ -7034,66 +7010,66 @@ var $o = /* @__PURE__ */ Object.freeze({
7034
7010
  ZodTransformer: X,
7035
7011
  ZodOptional: se,
7036
7012
  ZodNullable: Ze,
7037
- ZodDefault: Wt,
7038
- ZodCatch: Jt,
7013
+ ZodDefault: Jt,
7014
+ ZodCatch: Wt,
7039
7015
  ZodNaN: _n,
7040
- BRAND: qi,
7016
+ BRAND: Bi,
7041
7017
  ZodBranded: Bn,
7042
7018
  ZodPipeline: Yt,
7043
7019
  ZodReadonly: qt,
7044
7020
  custom: kr,
7045
7021
  Schema: I,
7046
7022
  ZodSchema: I,
7047
- late: Qi,
7023
+ late: Ki,
7048
7024
  get ZodFirstPartyTypeKind() {
7049
7025
  return N;
7050
7026
  },
7051
- coerce: Zo,
7052
- any: ro,
7053
- array: oo,
7054
- bigint: Yi,
7027
+ coerce: Oo,
7028
+ any: Xi,
7029
+ array: ro,
7030
+ bigint: qi,
7055
7031
  boolean: Or,
7056
- date: Xi,
7057
- discriminatedUnion: ho,
7032
+ date: Qi,
7033
+ discriminatedUnion: oo,
7058
7034
  effect: Hn,
7059
- enum: wo,
7060
- function: yo,
7061
- instanceof: Gi,
7062
- intersection: po,
7063
- lazy: vo,
7064
- literal: bo,
7065
- map: _o,
7066
- nan: Hi,
7067
- nativeEnum: xo,
7068
- never: so,
7069
- null: no,
7070
- nullable: To,
7071
- number: Cr,
7072
- object: co,
7073
- oboolean: Io,
7074
- onumber: jo,
7075
- optional: ko,
7076
- ostring: So,
7077
- pipeline: Oo,
7078
- preprocess: Co,
7079
- promise: No,
7080
- record: fo,
7081
- set: go,
7082
- strictObject: lo,
7083
- string: Tr,
7084
- symbol: eo,
7035
+ enum: go,
7036
+ function: mo,
7037
+ instanceof: Ji,
7038
+ intersection: co,
7039
+ lazy: fo,
7040
+ literal: _o,
7041
+ map: ho,
7042
+ nan: Wi,
7043
+ nativeEnum: yo,
7044
+ never: to,
7045
+ null: Yi,
7046
+ nullable: wo,
7047
+ number: Tr,
7048
+ object: ao,
7049
+ oboolean: To,
7050
+ onumber: Co,
7051
+ optional: bo,
7052
+ ostring: ko,
7053
+ pipeline: No,
7054
+ preprocess: xo,
7055
+ promise: vo,
7056
+ record: uo,
7057
+ set: po,
7058
+ strictObject: so,
7059
+ string: Cr,
7060
+ symbol: Gi,
7085
7061
  transformer: Hn,
7086
- tuple: mo,
7087
- undefined: to,
7088
- union: uo,
7089
- unknown: ao,
7090
- void: io,
7091
- NEVER: Eo,
7062
+ tuple: lo,
7063
+ undefined: Hi,
7064
+ union: io,
7065
+ unknown: eo,
7066
+ void: no,
7067
+ NEVER: So,
7092
7068
  ZodIssueCode: p,
7093
- quotelessJson: Ii,
7094
- ZodError: W
7069
+ quotelessJson: Ti,
7070
+ ZodError: J
7095
7071
  });
7096
- ji($o);
7072
+ Ci(jo);
7097
7073
  function Xt(t, e = "", n = {}) {
7098
7074
  for (let r in t)
7099
7075
  if (Object.prototype.hasOwnProperty.call(t, r)) {
@@ -7120,7 +7096,7 @@ function Sr(t, e) {
7120
7096
  }
7121
7097
  return n;
7122
7098
  }
7123
- function Ao(t) {
7099
+ function Io(t) {
7124
7100
  return async (e, n) => {
7125
7101
  let r = t.selectFrom("connections").where("connections.tenant_id", "=", e);
7126
7102
  n.q && (r = Be(t, r, n.q, ["user_id", "ip"]));
@@ -7135,10 +7111,10 @@ function Ao(t) {
7135
7111
  };
7136
7112
  };
7137
7113
  }
7138
- function Po(t) {
7114
+ function Zo(t) {
7139
7115
  return async (e, n) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7140
7116
  }
7141
- function Do(t) {
7117
+ function Eo(t) {
7142
7118
  return async (e, n) => {
7143
7119
  const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
7144
7120
  return r ? M({
@@ -7147,7 +7123,7 @@ function Do(t) {
7147
7123
  }) : null;
7148
7124
  };
7149
7125
  }
7150
- function Ro(t) {
7126
+ function $o(t) {
7151
7127
  return async (e, n, r) => {
7152
7128
  const a = {
7153
7129
  ...r,
@@ -7159,16 +7135,16 @@ function Ro(t) {
7159
7135
  }).where("connections.id", "=", n).where("connections.tenant_id", "=", e).execute(), !0;
7160
7136
  };
7161
7137
  }
7162
- function Mo(t) {
7138
+ function Po(t) {
7163
7139
  return {
7164
- create: Ci(t),
7165
- get: Do(t),
7166
- list: Ao(t),
7167
- remove: Po(t),
7168
- update: Ro(t)
7140
+ create: xi(t),
7141
+ get: Eo(t),
7142
+ list: Io(t),
7143
+ remove: Zo(t),
7144
+ update: $o(t)
7169
7145
  };
7170
7146
  }
7171
- function Lo(t) {
7147
+ function Ao(t) {
7172
7148
  return {
7173
7149
  get: async (e) => {
7174
7150
  const n = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
@@ -7176,7 +7152,7 @@ function Lo(t) {
7176
7152
  return null;
7177
7153
  const r = await t.selectFrom("tenants").selectAll().where("id", "=", n.tenant_id).executeTakeFirst();
7178
7154
  if (!r)
7179
- throw new Cn(404, { message: "Tenant not found" });
7155
+ throw new Tn(404, { message: "Tenant not found" });
7180
7156
  const a = await t.selectFrom("connections").where("tenant_id", "=", n.tenant_id).selectAll().execute(), s = await t.selectFrom("domains").where("tenant_id", "=", n.tenant_id).selectAll().execute();
7181
7157
  return {
7182
7158
  ...n,
@@ -7202,7 +7178,7 @@ function Lo(t) {
7202
7178
  }
7203
7179
  };
7204
7180
  }
7205
- function zo(t) {
7181
+ function Do(t) {
7206
7182
  return async () => await t.selectFrom("keys").where(
7207
7183
  (n) => n.or([
7208
7184
  n("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
@@ -7210,22 +7186,22 @@ function zo(t) {
7210
7186
  ])
7211
7187
  ).selectAll().execute();
7212
7188
  }
7213
- function Uo(t) {
7189
+ function Ro(t) {
7214
7190
  return async (e) => {
7215
7191
  await t.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
7216
7192
  };
7217
7193
  }
7218
- function Fo(t) {
7194
+ function Mo(t) {
7219
7195
  return async (e, n) => !!(await t.updateTable("keys").set(n).where("kid", "=", e).execute()).length;
7220
7196
  }
7221
- function Vo(t) {
7197
+ function Lo(t) {
7222
7198
  return {
7223
- create: Uo(t),
7224
- list: zo(t),
7225
- update: Fo(t)
7199
+ create: Ro(t),
7200
+ list: Do(t),
7201
+ update: Mo(t)
7226
7202
  };
7227
7203
  }
7228
- function Bo(t) {
7204
+ function zo(t) {
7229
7205
  return async (e, n) => {
7230
7206
  const r = {
7231
7207
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -7237,7 +7213,7 @@ function Bo(t) {
7237
7213
  return await t.insertInto("domains").values(r).execute(), r;
7238
7214
  };
7239
7215
  }
7240
- function Ko(t) {
7216
+ function Uo(t) {
7241
7217
  return async (e, n) => {
7242
7218
  let r = t.selectFrom("domains").where("domains.tenant_id", "=", e);
7243
7219
  n.q && (r = Be(t, r, n.q, ["user_id", "ip"]));
@@ -7250,13 +7226,13 @@ function Ko(t) {
7250
7226
  };
7251
7227
  };
7252
7228
  }
7253
- function Wo(t) {
7229
+ function Fo(t) {
7254
7230
  return {
7255
- create: Bo(t),
7256
- list: Ko(t)
7231
+ create: zo(t),
7232
+ list: Uo(t)
7257
7233
  };
7258
7234
  }
7259
- function Jo(t) {
7235
+ function Vo(t) {
7260
7236
  return async (e) => {
7261
7237
  const [n] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
7262
7238
  if (!n)
@@ -7286,9 +7262,9 @@ function Jo(t) {
7286
7262
  });
7287
7263
  };
7288
7264
  }
7289
- function qo(t) {
7265
+ function Bo(t) {
7290
7266
  return async (e, n) => {
7291
- var o, d, c, l, u, Z, R, J, _e, We, ge, ye, ve, Je, qe, ee, te, ne;
7267
+ var o, d, c, l, u, Z, R, W, _e, Je, ge, ye, ve, We, qe, ee, te, ne;
7292
7268
  const { colors: r, font: a, ...s } = n;
7293
7269
  try {
7294
7270
  await t.insertInto("branding").values({
@@ -7297,7 +7273,7 @@ function qo(t) {
7297
7273
  colors_page_background_type: (d = (o = n.colors) == null ? void 0 : o.page_background) == null ? void 0 : d.type,
7298
7274
  colors_page_background_start: (l = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : l.start,
7299
7275
  colors_page_background_end: (Z = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : Z.end,
7300
- colors_page_background_angle_dev: (J = (R = n.colors) == null ? void 0 : R.page_background) == null ? void 0 : J.angle_deg,
7276
+ colors_page_background_angle_dev: (W = (R = n.colors) == null ? void 0 : R.page_background) == null ? void 0 : W.angle_deg,
7301
7277
  font_url: (_e = n.font) == null ? void 0 : _e.url,
7302
7278
  tenant_id: e
7303
7279
  }).execute();
@@ -7305,22 +7281,22 @@ function qo(t) {
7305
7281
  await t.updateTable("branding").set({
7306
7282
  ...s,
7307
7283
  colors_primary: r == null ? void 0 : r.primary,
7308
- colors_page_background_type: (ge = (We = n.colors) == null ? void 0 : We.page_background) == null ? void 0 : ge.type,
7284
+ colors_page_background_type: (ge = (Je = n.colors) == null ? void 0 : Je.page_background) == null ? void 0 : ge.type,
7309
7285
  colors_page_background_start: (ve = (ye = n.colors) == null ? void 0 : ye.page_background) == null ? void 0 : ve.start,
7310
- colors_page_background_end: (qe = (Je = n.colors) == null ? void 0 : Je.page_background) == null ? void 0 : qe.end,
7286
+ colors_page_background_end: (qe = (We = n.colors) == null ? void 0 : We.page_background) == null ? void 0 : qe.end,
7311
7287
  colors_page_background_angle_dev: (te = (ee = n.colors) == null ? void 0 : ee.page_background) == null ? void 0 : te.angle_deg,
7312
7288
  font_url: (ne = n.font) == null ? void 0 : ne.url
7313
7289
  }).where("tenant_id", "=", e).execute();
7314
7290
  }
7315
7291
  };
7316
7292
  }
7317
- function Qo(t) {
7293
+ function Ko(t) {
7318
7294
  return {
7319
- get: Jo(t),
7320
- set: qo(t)
7295
+ get: Vo(t),
7296
+ set: Bo(t)
7321
7297
  };
7322
7298
  }
7323
- function Go(t) {
7299
+ function Jo(t) {
7324
7300
  return async (e, n) => {
7325
7301
  let r = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
7326
7302
  n.q && (r = Be(t, r, n.q, ["url"]));
@@ -7340,7 +7316,7 @@ function Go(t) {
7340
7316
  };
7341
7317
  };
7342
7318
  }
7343
- function Ho(t) {
7319
+ function Wo(t) {
7344
7320
  return async (e, n) => {
7345
7321
  const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
7346
7322
  return r ? M({
@@ -7350,10 +7326,10 @@ function Ho(t) {
7350
7326
  }) : null;
7351
7327
  };
7352
7328
  }
7353
- function Yo(t) {
7329
+ function qo(t) {
7354
7330
  return async (e, n) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7355
7331
  }
7356
- function Xo(t) {
7332
+ function Qo(t) {
7357
7333
  return async (e, n) => {
7358
7334
  const r = {
7359
7335
  hook_id: Ke(),
@@ -7369,7 +7345,7 @@ function Xo(t) {
7369
7345
  }).execute(), r;
7370
7346
  };
7371
7347
  }
7372
- function ed(t) {
7348
+ function Go(t) {
7373
7349
  return async (e, n, r) => {
7374
7350
  const a = {
7375
7351
  ...r,
@@ -7380,16 +7356,16 @@ function ed(t) {
7380
7356
  return await t.updateTable("hooks").set(a).where("hooks.hook_id", "=", n).where("hooks.tenant_id", "=", e).execute(), !0;
7381
7357
  };
7382
7358
  }
7383
- function td(t) {
7359
+ function Ho(t) {
7384
7360
  return {
7385
- create: Xo(t),
7386
- get: Ho(t),
7387
- list: Go(t),
7388
- update: ed(t),
7389
- remove: Yo(t)
7361
+ create: Qo(t),
7362
+ get: Wo(t),
7363
+ list: Jo(t),
7364
+ update: Go(t),
7365
+ remove: qo(t)
7390
7366
  };
7391
7367
  }
7392
- function nd(t) {
7368
+ function Yo(t) {
7393
7369
  return async (e, n) => {
7394
7370
  const r = {
7395
7371
  themeId: Ke(),
@@ -7400,16 +7376,16 @@ function nd(t) {
7400
7376
  return await t.insertInto("themes").values({ ...Xt(r), tenant_id: e }).execute(), r;
7401
7377
  };
7402
7378
  }
7403
- function rd(t) {
7379
+ function Xo(t) {
7404
7380
  return async (e, n) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7405
7381
  }
7406
- function ad(t) {
7382
+ function ed(t) {
7407
7383
  return async (e, n) => {
7408
7384
  const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", n).selectAll().executeTakeFirst();
7409
7385
  return r ? M(r) : null;
7410
7386
  };
7411
7387
  }
7412
- function sd(t) {
7388
+ function td(t) {
7413
7389
  return async (e, n, r) => {
7414
7390
  const a = Xt({
7415
7391
  ...r,
@@ -7418,15 +7394,15 @@ function sd(t) {
7418
7394
  return await t.updateTable("themes").set(a).where("themes.id", "=", n).where("themes.tenant_id", "=", e).execute(), !0;
7419
7395
  };
7420
7396
  }
7421
- function id(t) {
7397
+ function nd(t) {
7422
7398
  return {
7423
- create: nd(t),
7424
- get: ad(t),
7425
- remove: rd(t),
7426
- update: sd(t)
7399
+ create: Yo(t),
7400
+ get: ed(t),
7401
+ remove: Xo(t),
7402
+ update: td(t)
7427
7403
  };
7428
7404
  }
7429
- function od(t) {
7405
+ function rd(t) {
7430
7406
  return async (e, n) => {
7431
7407
  const r = (/* @__PURE__ */ new Date()).toISOString(), a = await t.selectFrom("logins").where("logins.expires_at", ">", r).where("logins.login_id", "=", n).selectAll().executeTakeFirst();
7432
7408
  return a ? ks.parse(
@@ -7434,7 +7410,7 @@ function od(t) {
7434
7410
  ) : null;
7435
7411
  };
7436
7412
  }
7437
- function dd(t) {
7413
+ function ad(t) {
7438
7414
  return async (e, n) => {
7439
7415
  const r = {
7440
7416
  login_id: Ke(),
@@ -7445,21 +7421,21 @@ function dd(t) {
7445
7421
  return await t.insertInto("logins").values({ ...Xt(r), tenant_id: e }).execute(), r;
7446
7422
  };
7447
7423
  }
7448
- function cd(t) {
7424
+ function sd(t) {
7449
7425
  return async (e, n, r) => (await t.updateTable("logins").set(Xt(r)).where("logins.login_id", "=", n).where("logins.tenant_id", "=", e).execute()).length === 1;
7450
7426
  }
7451
- function ld(t) {
7427
+ function id(t) {
7452
7428
  return async (e, n) => (await t.deleteFrom("logins").where("logins.tenant_id", "=", e).where("logins.login_id", "=", n).execute()).length > 0;
7453
7429
  }
7454
- function ud(t) {
7430
+ function od(t) {
7455
7431
  return {
7456
- create: dd(t),
7457
- get: od(t),
7458
- update: cd(t),
7459
- remove: ld(t)
7432
+ create: ad(t),
7433
+ get: rd(t),
7434
+ update: sd(t),
7435
+ remove: id(t)
7460
7436
  };
7461
7437
  }
7462
- function hd(t) {
7438
+ function dd(t) {
7463
7439
  return async (e) => {
7464
7440
  const [n] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
7465
7441
  return M({
@@ -7479,10 +7455,10 @@ function Yn(t) {
7479
7455
  universal_login_experience: t.universal_login_experience
7480
7456
  });
7481
7457
  }
7482
- function pd(t) {
7458
+ function cd(t) {
7483
7459
  return async (e, n) => {
7484
7460
  try {
7485
- const r = Ps.parse(n);
7461
+ const r = As.parse(n);
7486
7462
  await t.insertInto("prompt_settings").values({
7487
7463
  ...Yn(r),
7488
7464
  tenant_id: e
@@ -7492,10 +7468,62 @@ function pd(t) {
7492
7468
  }
7493
7469
  };
7494
7470
  }
7471
+ function ld(t) {
7472
+ return {
7473
+ get: dd(t),
7474
+ set: cd(t)
7475
+ };
7476
+ }
7477
+ function ud(t) {
7478
+ return async (e) => {
7479
+ const [n] = await t.selectFrom("email_providers").where("email_providers.tenant_id", "=", e).selectAll().execute();
7480
+ if (!n)
7481
+ return null;
7482
+ const {
7483
+ tenant_id: r,
7484
+ credentials: a,
7485
+ settings: s,
7486
+ enabled: o,
7487
+ ...d
7488
+ } = n;
7489
+ return M({
7490
+ ...d,
7491
+ credentials: JSON.parse(a),
7492
+ settings: JSON.parse(s),
7493
+ enabled: !!o
7494
+ });
7495
+ };
7496
+ }
7497
+ function hd(t) {
7498
+ return async (e, n) => {
7499
+ const { credentials: r, settings: a, enabled: s, ...o } = n;
7500
+ await t.updateTable("email_providers").set({
7501
+ ...o,
7502
+ credentials: r ? JSON.stringify(r) : void 0,
7503
+ settings: a ? JSON.stringify(a) : void 0,
7504
+ enabled: s !== void 0 ? s ? 1 : 0 : void 0
7505
+ }).where("tenant_id", "=", e).execute();
7506
+ };
7507
+ }
7508
+ function pd(t) {
7509
+ return async (e, n) => {
7510
+ const { credentials: r, settings: a, enabled: s, ...o } = n;
7511
+ await t.insertInto("email_providers").values({
7512
+ ...o,
7513
+ enabled: s ? 1 : 0,
7514
+ credentials: JSON.stringify(r),
7515
+ settings: JSON.stringify(a),
7516
+ tenant_id: e,
7517
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
7518
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
7519
+ }).execute();
7520
+ };
7521
+ }
7495
7522
  function md(t) {
7496
7523
  return {
7497
- get: hd(t),
7498
- set: pd(t)
7524
+ get: ud(t),
7525
+ create: pd(t),
7526
+ update: hd(t)
7499
7527
  };
7500
7528
  }
7501
7529
  function fd(t) {
@@ -7514,7 +7542,7 @@ const en = z({
7514
7542
  name: t
7515
7543
  });
7516
7544
  }
7517
- }), Pn = z({
7545
+ }), An = z({
7518
7546
  is(t) {
7519
7547
  return t.kind === "SchemableIdentifierNode";
7520
7548
  },
@@ -7549,13 +7577,13 @@ const en = z({
7549
7577
  create(t) {
7550
7578
  return z({
7551
7579
  kind: "TableNode",
7552
- table: Pn.create(t)
7580
+ table: An.create(t)
7553
7581
  });
7554
7582
  },
7555
7583
  createWithSchema(t, e) {
7556
7584
  return z({
7557
7585
  kind: "TableNode",
7558
- table: Pn.createWithSchema(t, e)
7586
+ table: An.createWithSchema(t, e)
7559
7587
  });
7560
7588
  }
7561
7589
  });
@@ -8424,12 +8452,12 @@ class vd extends gd {
8424
8452
  ht(this, at, n);
8425
8453
  }
8426
8454
  transformNodeImpl(n) {
8427
- if (!C(this, L, jr).call(this, n))
8455
+ if (!T(this, L, jr).call(this, n))
8428
8456
  return super.transformNodeImpl(n);
8429
- const r = C(this, L, Zr).call(this, n);
8457
+ const r = T(this, L, Zr).call(this, n);
8430
8458
  for (const o of r)
8431
8459
  v(this, Re).add(o);
8432
- const a = C(this, L, Ir).call(this, n);
8460
+ const a = T(this, L, Ir).call(this, n);
8433
8461
  for (const o of a)
8434
8462
  v(this, De).add(o);
8435
8463
  const s = super.transformNodeImpl(n);
@@ -8458,19 +8486,19 @@ at = new WeakMap(), De = new WeakMap(), Re = new WeakMap(), L = new WeakSet(), j
8458
8486
  return n.kind in yd;
8459
8487
  }, Ir = function(n) {
8460
8488
  const r = /* @__PURE__ */ new Set();
8461
- if ("name" in n && n.name && Pn.is(n.name) && C(this, L, Dn).call(this, n.name, r), "from" in n && n.from)
8489
+ if ("name" in n && n.name && An.is(n.name) && T(this, L, Dn).call(this, n.name, r), "from" in n && n.from)
8462
8490
  for (const a of n.from.froms)
8463
- C(this, L, Ye).call(this, a, r);
8464
- if ("into" in n && n.into && C(this, L, Ye).call(this, n.into, r), "table" in n && n.table && C(this, L, Ye).call(this, n.table, r), "joins" in n && n.joins)
8491
+ T(this, L, Ye).call(this, a, r);
8492
+ if ("into" in n && n.into && T(this, L, Ye).call(this, n.into, r), "table" in n && n.table && T(this, L, Ye).call(this, n.table, r), "joins" in n && n.joins)
8465
8493
  for (const a of n.joins)
8466
- C(this, L, Ye).call(this, a.table, r);
8467
- return "using" in n && n.using && C(this, L, Ye).call(this, n.using, r), r;
8494
+ T(this, L, Ye).call(this, a.table, r);
8495
+ return "using" in n && n.using && T(this, L, Ye).call(this, n.using, r), r;
8468
8496
  }, Zr = function(n) {
8469
8497
  const r = /* @__PURE__ */ new Set();
8470
- return "with" in n && n.with && C(this, L, Er).call(this, n.with, r), r;
8498
+ return "with" in n && n.with && T(this, L, Er).call(this, n.with, r), r;
8471
8499
  }, Ye = function(n, r) {
8472
8500
  const a = Nn.is(n) ? n : _d.is(n) && Nn.is(n.node) ? n.node : null;
8473
- a && C(this, L, Dn).call(this, a.table, r);
8501
+ a && T(this, L, Dn).call(this, a.table, r);
8474
8502
  }, Dn = function(n, r) {
8475
8503
  const a = n.identifier.name;
8476
8504
  !v(this, De).has(a) && !v(this, Re).has(a) && r.add(a);
@@ -8503,12 +8531,12 @@ class wd {
8503
8531
  }
8504
8532
  }
8505
8533
  const xd = "kysely_migration", Xn = "kysely_migration_lock", Nd = !1, kn = "migration_lock", kd = z({ __noMigrations__: !0 });
8506
- var A, m, vt, ue, he, Xe, Ar, pe, Pr, Dr, Rr, Mr, Lr, Rn, et, Mn, zr, Ur, Fr, Ln, Vr, Br, Kr, Wr, Jr, bt;
8534
+ var P, m, vt, ue, he, Xe, Pr, pe, Ar, Dr, Rr, Mr, Lr, Rn, et, Mn, zr, Ur, Fr, Ln, Vr, Br, Kr, Jr, Wr, bt;
8507
8535
  class $r {
8508
8536
  constructor(e) {
8509
8537
  re(this, m);
8510
- re(this, A);
8511
- ht(this, A, z(e));
8538
+ re(this, P);
8539
+ ht(this, P, z(e));
8512
8540
  }
8513
8541
  /**
8514
8542
  * Returns a {@link MigrationInfo} object for each migration.
@@ -8516,8 +8544,8 @@ class $r {
8516
8544
  * The returned array is sorted by migration name.
8517
8545
  */
8518
8546
  async getMigrations() {
8519
- const e = await C(this, m, et).call(this, v(this, m, he)) ? await v(this, A).db.withPlugin(v(this, m, pe)).selectFrom(v(this, m, he)).select(["name", "timestamp"]).execute() : [];
8520
- return (await C(this, m, Ln).call(this)).map(({ name: r, ...a }) => {
8547
+ const e = await T(this, m, et).call(this, v(this, m, he)) ? await v(this, P).db.withPlugin(v(this, m, pe)).selectFrom(v(this, m, he)).select(["name", "timestamp"]).execute() : [];
8548
+ return (await T(this, m, Ln).call(this)).map(({ name: r, ...a }) => {
8521
8549
  const s = e.find((o) => o.name === r);
8522
8550
  return {
8523
8551
  name: r,
@@ -8574,7 +8602,7 @@ class $r {
8574
8602
  * ```
8575
8603
  */
8576
8604
  async migrateToLatest() {
8577
- return C(this, m, vt).call(this, () => ({ direction: "Up", step: 1 / 0 }));
8605
+ return T(this, m, vt).call(this, () => ({ direction: "Up", step: 1 / 0 }));
8578
8606
  }
8579
8607
  /**
8580
8608
  * Migrate up/down to a specific migration.
@@ -8600,7 +8628,7 @@ class $r {
8600
8628
  * ```
8601
8629
  */
8602
8630
  async migrateTo(e) {
8603
- return C(this, m, vt).call(this, ({ migrations: n, executedMigrations: r, pendingMigrations: a }) => {
8631
+ return T(this, m, vt).call(this, ({ migrations: n, executedMigrations: r, pendingMigrations: a }) => {
8604
8632
  if (e === kd)
8605
8633
  return { direction: "Down", step: 1 / 0 };
8606
8634
  if (!n.find((d) => d.name === e))
@@ -8631,7 +8659,7 @@ class $r {
8631
8659
  * ```
8632
8660
  */
8633
8661
  async migrateUp() {
8634
- return C(this, m, vt).call(this, () => ({ direction: "Up", step: 1 }));
8662
+ return T(this, m, vt).call(this, () => ({ direction: "Up", step: 1 }));
8635
8663
  }
8636
8664
  /**
8637
8665
  * Migrate one step down.
@@ -8648,90 +8676,90 @@ class $r {
8648
8676
  * ```
8649
8677
  */
8650
8678
  async migrateDown() {
8651
- return C(this, m, vt).call(this, () => ({ direction: "Down", step: 1 }));
8679
+ return T(this, m, vt).call(this, () => ({ direction: "Down", step: 1 }));
8652
8680
  }
8653
8681
  }
8654
- A = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8682
+ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8655
8683
  try {
8656
- return await C(this, m, Pr).call(this), await C(this, m, zr).call(this, e);
8684
+ return await T(this, m, Ar).call(this), await T(this, m, zr).call(this, e);
8657
8685
  } catch (n) {
8658
- return n instanceof Tn ? n.resultSet : { error: n };
8686
+ return n instanceof Cn ? n.resultSet : { error: n };
8659
8687
  }
8660
8688
  }, ue = function() {
8661
- return v(this, A).migrationTableSchema;
8689
+ return v(this, P).migrationTableSchema;
8662
8690
  }, he = function() {
8663
- return v(this, A).migrationTableName ?? xd;
8691
+ return v(this, P).migrationTableName ?? xd;
8664
8692
  }, Xe = function() {
8665
- return v(this, A).migrationLockTableName ?? Xn;
8666
- }, Ar = function() {
8667
- return v(this, A).allowUnorderedMigrations ?? Nd;
8693
+ return v(this, P).migrationLockTableName ?? Xn;
8694
+ }, Pr = function() {
8695
+ return v(this, P).allowUnorderedMigrations ?? Nd;
8668
8696
  }, pe = function() {
8669
8697
  return v(this, m, ue) ? new bd(v(this, m, ue)) : new wd();
8670
- }, Pr = async function() {
8671
- await C(this, m, Dr).call(this), await C(this, m, Rr).call(this), await C(this, m, Mr).call(this), await C(this, m, Lr).call(this);
8698
+ }, Ar = async function() {
8699
+ await T(this, m, Dr).call(this), await T(this, m, Rr).call(this), await T(this, m, Mr).call(this), await T(this, m, Lr).call(this);
8672
8700
  }, Dr = async function() {
8673
- if (v(this, m, ue) && !await C(this, m, Rn).call(this))
8701
+ if (v(this, m, ue) && !await T(this, m, Rn).call(this))
8674
8702
  try {
8675
- await C(this, m, bt).call(this, v(this, A).db.schema.createSchema(v(this, m, ue)));
8703
+ await T(this, m, bt).call(this, v(this, P).db.schema.createSchema(v(this, m, ue)));
8676
8704
  } catch (e) {
8677
- if (!await C(this, m, Rn).call(this))
8705
+ if (!await T(this, m, Rn).call(this))
8678
8706
  throw e;
8679
8707
  }
8680
8708
  }, Rr = async function() {
8681
- if (!await C(this, m, et).call(this, v(this, m, he)))
8709
+ if (!await T(this, m, et).call(this, v(this, m, he)))
8682
8710
  try {
8683
- v(this, m, ue) && await C(this, m, bt).call(this, v(this, A).db.schema.createSchema(v(this, m, ue))), await C(this, m, bt).call(this, v(this, A).db.schema.withPlugin(v(this, m, pe)).createTable(v(this, m, he)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
8711
+ v(this, m, ue) && await T(this, m, bt).call(this, v(this, P).db.schema.createSchema(v(this, m, ue))), await T(this, m, bt).call(this, v(this, P).db.schema.withPlugin(v(this, m, pe)).createTable(v(this, m, he)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
8684
8712
  } catch (e) {
8685
- if (!await C(this, m, et).call(this, v(this, m, he)))
8713
+ if (!await T(this, m, et).call(this, v(this, m, he)))
8686
8714
  throw e;
8687
8715
  }
8688
8716
  }, Mr = async function() {
8689
- if (!await C(this, m, et).call(this, v(this, m, Xe)))
8717
+ if (!await T(this, m, et).call(this, v(this, m, Xe)))
8690
8718
  try {
8691
- await C(this, m, bt).call(this, v(this, A).db.schema.withPlugin(v(this, m, pe)).createTable(v(this, m, Xe)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
8719
+ await T(this, m, bt).call(this, v(this, P).db.schema.withPlugin(v(this, m, pe)).createTable(v(this, m, Xe)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
8692
8720
  } catch (e) {
8693
- if (!await C(this, m, et).call(this, v(this, m, Xe)))
8721
+ if (!await T(this, m, et).call(this, v(this, m, Xe)))
8694
8722
  throw e;
8695
8723
  }
8696
8724
  }, Lr = async function() {
8697
- if (!await C(this, m, Mn).call(this))
8725
+ if (!await T(this, m, Mn).call(this))
8698
8726
  try {
8699
- await v(this, A).db.withPlugin(v(this, m, pe)).insertInto(v(this, m, Xe)).values({ id: kn, is_locked: 0 }).execute();
8727
+ await v(this, P).db.withPlugin(v(this, m, pe)).insertInto(v(this, m, Xe)).values({ id: kn, is_locked: 0 }).execute();
8700
8728
  } catch (e) {
8701
- if (!await C(this, m, Mn).call(this))
8729
+ if (!await T(this, m, Mn).call(this))
8702
8730
  throw e;
8703
8731
  }
8704
8732
  }, Rn = async function() {
8705
- return (await v(this, A).db.introspection.getSchemas()).some((n) => n.name === v(this, m, ue));
8733
+ return (await v(this, P).db.introspection.getSchemas()).some((n) => n.name === v(this, m, ue));
8706
8734
  }, et = async function(e) {
8707
8735
  const n = v(this, m, ue);
8708
- return (await v(this, A).db.introspection.getTables({
8736
+ return (await v(this, P).db.introspection.getTables({
8709
8737
  withInternalKyselyTables: !0
8710
8738
  })).some((a) => a.name === e && (!n || a.schema === n));
8711
8739
  }, Mn = async function() {
8712
- return !!await v(this, A).db.withPlugin(v(this, m, pe)).selectFrom(v(this, m, Xe)).where("id", "=", kn).select("id").executeTakeFirst();
8740
+ return !!await v(this, P).db.withPlugin(v(this, m, pe)).selectFrom(v(this, m, Xe)).where("id", "=", kn).select("id").executeTakeFirst();
8713
8741
  }, zr = async function(e) {
8714
- const n = v(this, A).db.getExecutor().adapter, r = z({
8715
- lockTable: v(this, A).migrationLockTableName ?? Xn,
8742
+ const n = v(this, P).db.getExecutor().adapter, r = z({
8743
+ lockTable: v(this, P).migrationLockTableName ?? Xn,
8716
8744
  lockRowId: kn,
8717
- lockTableSchema: v(this, A).migrationTableSchema
8745
+ lockTableSchema: v(this, P).migrationTableSchema
8718
8746
  }), a = async (s) => {
8719
8747
  try {
8720
8748
  await n.acquireMigrationLock(s, r);
8721
- const o = await C(this, m, Ur).call(this, s);
8749
+ const o = await T(this, m, Ur).call(this, s);
8722
8750
  if (o.migrations.length === 0)
8723
8751
  return { results: [] };
8724
8752
  const { direction: d, step: c } = e(o);
8725
- return c <= 0 ? { results: [] } : d === "Down" ? await C(this, m, Wr).call(this, s, o, c) : d === "Up" ? await C(this, m, Jr).call(this, s, o, c) : { results: [] };
8753
+ return c <= 0 ? { results: [] } : d === "Down" ? await T(this, m, Jr).call(this, s, o, c) : d === "Up" ? await T(this, m, Wr).call(this, s, o, c) : { results: [] };
8726
8754
  } finally {
8727
8755
  await n.releaseMigrationLock(s, r);
8728
8756
  }
8729
8757
  };
8730
- return n.supportsTransactionalDdl ? v(this, A).db.transaction().execute(a) : v(this, A).db.connection().execute(a);
8758
+ return n.supportsTransactionalDdl ? v(this, P).db.transaction().execute(a) : v(this, P).db.connection().execute(a);
8731
8759
  }, Ur = async function(e) {
8732
- const n = await C(this, m, Ln).call(this), r = await C(this, m, Vr).call(this, e);
8733
- C(this, m, Br).call(this, n, r), v(this, m, Ar) || C(this, m, Kr).call(this, n, r);
8734
- const a = C(this, m, Fr).call(this, n, r);
8760
+ const n = await T(this, m, Ln).call(this), r = await T(this, m, Vr).call(this, e);
8761
+ T(this, m, Br).call(this, n, r), v(this, m, Pr) || T(this, m, Kr).call(this, n, r);
8762
+ const a = T(this, m, Fr).call(this, n, r);
8735
8763
  return z({
8736
8764
  migrations: n,
8737
8765
  executedMigrations: r,
@@ -8741,7 +8769,7 @@ A = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8741
8769
  }, Fr = function(e, n) {
8742
8770
  return e.filter((r) => !n.includes(r.name));
8743
8771
  }, Ln = async function() {
8744
- const e = await v(this, A).provider.getMigrations();
8772
+ const e = await v(this, P).provider.getMigrations();
8745
8773
  return Object.keys(e).sort().map((n) => ({
8746
8774
  ...e[n],
8747
8775
  name: n
@@ -8756,7 +8784,7 @@ A = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8756
8784
  for (let r = 0; r < n.length; ++r)
8757
8785
  if (e[r].name !== n[r])
8758
8786
  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.`);
8759
- }, Wr = async function(e, n, r) {
8787
+ }, Jr = async function(e, n, r) {
8760
8788
  const a = n.executedMigrations.slice().reverse().slice(0, r).map((o) => n.migrations.find((d) => d.name === o)), s = a.map((o) => ({
8761
8789
  migrationName: o.name,
8762
8790
  direction: "Down",
@@ -8775,14 +8803,14 @@ A = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8775
8803
  migrationName: d.name,
8776
8804
  direction: "Down",
8777
8805
  status: "Error"
8778
- }, new Tn({
8806
+ }, new Cn({
8779
8807
  error: c,
8780
8808
  results: s
8781
8809
  });
8782
8810
  }
8783
8811
  }
8784
8812
  return { results: s };
8785
- }, Jr = async function(e, n, r) {
8813
+ }, Wr = async function(e, n, r) {
8786
8814
  const s = n.pendingMigrations.slice(0, r).map((o) => ({
8787
8815
  migrationName: o.name,
8788
8816
  direction: "Up",
@@ -8804,7 +8832,7 @@ A = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8804
8832
  migrationName: d.name,
8805
8833
  direction: "Up",
8806
8834
  status: "Error"
8807
- }, new Tn({
8835
+ }, new Cn({
8808
8836
  error: c,
8809
8837
  results: s
8810
8838
  });
@@ -8812,10 +8840,10 @@ A = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8812
8840
  }
8813
8841
  return { results: s };
8814
8842
  }, bt = async function(e) {
8815
- v(this, A).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
8843
+ v(this, P).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
8816
8844
  };
8817
8845
  var Gt;
8818
- class Tn extends Error {
8846
+ class Cn extends Error {
8819
8847
  constructor(n) {
8820
8848
  super();
8821
8849
  re(this, Gt);
@@ -8835,7 +8863,7 @@ class qr {
8835
8863
  return this.migrations;
8836
8864
  }
8837
8865
  }
8838
- async function Td(t) {
8866
+ async function Cd(t) {
8839
8867
  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(
8840
8868
  "tenant_id",
8841
8869
  "varchar(255)",
@@ -8903,13 +8931,13 @@ async function Td(t) {
8903
8931
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
8904
8932
  ).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();
8905
8933
  }
8906
- async function Cd(t) {
8934
+ async function Td(t) {
8907
8935
  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();
8908
8936
  }
8909
8937
  const Od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8910
8938
  __proto__: null,
8911
- down: Cd,
8912
- up: Td
8939
+ down: Td,
8940
+ up: Cd
8913
8941
  }, Symbol.toStringTag, { value: "Module" }));
8914
8942
  async function Sd(t) {
8915
8943
  await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
@@ -8931,7 +8959,7 @@ const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8931
8959
  down: Ed,
8932
8960
  up: Zd
8933
8961
  }, Symbol.toStringTag, { value: "Module" }));
8934
- async function Ad(t) {
8962
+ async function Pd(t) {
8935
8963
  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(
8936
8964
  "tenant_id_constraint",
8937
8965
  ["tenant_id"],
@@ -8940,13 +8968,13 @@ async function Ad(t) {
8940
8968
  (e) => e.onDelete("cascade")
8941
8969
  ).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();
8942
8970
  }
8943
- async function Pd(t) {
8971
+ async function Ad(t) {
8944
8972
  await t.schema.dropTable("logs").execute();
8945
8973
  }
8946
8974
  const Dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8947
8975
  __proto__: null,
8948
- down: Pd,
8949
- up: Ad
8976
+ down: Ad,
8977
+ up: Pd
8950
8978
  }, Symbol.toStringTag, { value: "Module" }));
8951
8979
  async function Rd(t) {
8952
8980
  }
@@ -9017,14 +9045,14 @@ const Kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9017
9045
  down: Bd,
9018
9046
  up: Vd
9019
9047
  }, Symbol.toStringTag, { value: "Module" }));
9020
- async function Wd(t) {
9021
- }
9022
9048
  async function Jd(t) {
9023
9049
  }
9050
+ async function Wd(t) {
9051
+ }
9024
9052
  const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9025
9053
  __proto__: null,
9026
- down: Jd,
9027
- up: Wd
9054
+ down: Wd,
9055
+ up: Jd
9028
9056
  }, Symbol.toStringTag, { value: "Module" }));
9029
9057
  async function Qd(t) {
9030
9058
  await t.schema.alterTable("passwords").addColumn(
@@ -9137,14 +9165,14 @@ const kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9137
9165
  down: Nc,
9138
9166
  up: xc
9139
9167
  }, Symbol.toStringTag, { value: "Module" }));
9140
- async function Tc(t) {
9141
- }
9142
9168
  async function Cc(t) {
9143
9169
  }
9170
+ async function Tc(t) {
9171
+ }
9144
9172
  const Oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9145
9173
  __proto__: null,
9146
- down: Cc,
9147
- up: Tc
9174
+ down: Tc,
9175
+ up: Cc
9148
9176
  }, Symbol.toStringTag, { value: "Module" }));
9149
9177
  async function Sc(t) {
9150
9178
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
@@ -9166,16 +9194,16 @@ const $c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9166
9194
  down: Ec,
9167
9195
  up: Zc
9168
9196
  }, Symbol.toStringTag, { value: "Module" }));
9169
- async function Ac(t) {
9197
+ async function Pc(t) {
9170
9198
  await t.schema.alterTable("logs").dropColumn("category").execute();
9171
9199
  }
9172
- async function Pc(t) {
9200
+ async function Ac(t) {
9173
9201
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
9174
9202
  }
9175
9203
  const Dc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9176
9204
  __proto__: null,
9177
- down: Pc,
9178
- up: Ac
9205
+ down: Ac,
9206
+ up: Pc
9179
9207
  }, Symbol.toStringTag, { value: "Module" }));
9180
9208
  async function Rc(t) {
9181
9209
  await t.schema.alterTable("users").dropColumn("tags").execute();
@@ -9210,16 +9238,16 @@ const Kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9210
9238
  down: Bc,
9211
9239
  up: Vc
9212
9240
  }, Symbol.toStringTag, { value: "Module" }));
9213
- async function Wc(t) {
9241
+ async function Jc(t) {
9214
9242
  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();
9215
9243
  }
9216
- async function Jc(t) {
9244
+ async function Wc(t) {
9217
9245
  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();
9218
9246
  }
9219
9247
  const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9220
9248
  __proto__: null,
9221
- down: Jc,
9222
- up: Wc
9249
+ down: Wc,
9250
+ up: Jc
9223
9251
  }, Symbol.toStringTag, { value: "Module" }));
9224
9252
  async function Qc(t) {
9225
9253
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
@@ -9334,14 +9362,14 @@ const kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9334
9362
  down: Nl,
9335
9363
  up: xl
9336
9364
  }, Symbol.toStringTag, { value: "Module" }));
9337
- async function Tl(t) {
9338
- }
9339
9365
  async function Cl(t) {
9340
9366
  }
9367
+ async function Tl(t) {
9368
+ }
9341
9369
  const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9342
9370
  __proto__: null,
9343
- down: Cl,
9344
- up: Tl
9371
+ down: Tl,
9372
+ up: Cl
9345
9373
  }, Symbol.toStringTag, { value: "Module" }));
9346
9374
  async function Sl(t) {
9347
9375
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
@@ -9365,14 +9393,14 @@ const $l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9365
9393
  down: El,
9366
9394
  up: Zl
9367
9395
  }, Symbol.toStringTag, { value: "Module" }));
9368
- async function Al(t) {
9369
- }
9370
9396
  async function Pl(t) {
9371
9397
  }
9398
+ async function Al(t) {
9399
+ }
9372
9400
  const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9373
9401
  __proto__: null,
9374
- down: Pl,
9375
- up: Al
9402
+ down: Al,
9403
+ up: Pl
9376
9404
  }, Symbol.toStringTag, { value: "Module" }));
9377
9405
  async function Rl(t) {
9378
9406
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
@@ -9411,7 +9439,7 @@ const Kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9411
9439
  down: Bl,
9412
9440
  up: Vl
9413
9441
  }, Symbol.toStringTag, { value: "Module" }));
9414
- async function Wl(t) {
9442
+ async function Jl(t) {
9415
9443
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
9416
9444
  "tenant_id",
9417
9445
  "varchar(255)",
@@ -9428,7 +9456,7 @@ async function Wl(t) {
9428
9456
  (e) => e.onDelete("cascade")
9429
9457
  ).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();
9430
9458
  }
9431
- async function Jl(t) {
9459
+ async function Wl(t) {
9432
9460
  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(
9433
9461
  "codes_user_id_tenant_id_constraint",
9434
9462
  ["user_id", "tenant_id"],
@@ -9439,8 +9467,8 @@ async function Jl(t) {
9439
9467
  }
9440
9468
  const ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9441
9469
  __proto__: null,
9442
- down: Jl,
9443
- up: Wl
9470
+ down: Wl,
9471
+ up: Jl
9444
9472
  }, Symbol.toStringTag, { value: "Module" }));
9445
9473
  async function Ql(t) {
9446
9474
  }
@@ -9581,16 +9609,16 @@ const ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9581
9609
  down: Nu,
9582
9610
  up: xu
9583
9611
  }, Symbol.toStringTag, { value: "Module" }));
9584
- async function Tu(t) {
9612
+ async function Cu(t) {
9585
9613
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
9586
9614
  }
9587
- async function Cu(t) {
9615
+ async function Tu(t) {
9588
9616
  await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
9589
9617
  }
9590
9618
  const Ou = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9591
9619
  __proto__: null,
9592
- down: Cu,
9593
- up: Tu
9620
+ down: Tu,
9621
+ up: Cu
9594
9622
  }, Symbol.toStringTag, { value: "Module" }));
9595
9623
  async function Su(t) {
9596
9624
  }
@@ -9628,14 +9656,14 @@ const $u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9628
9656
  down: Eu,
9629
9657
  up: Zu
9630
9658
  }, Symbol.toStringTag, { value: "Module" }));
9631
- async function Au(t) {
9632
- }
9633
9659
  async function Pu(t) {
9634
9660
  }
9661
+ async function Au(t) {
9662
+ }
9635
9663
  const Du = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9636
9664
  __proto__: null,
9637
- down: Pu,
9638
- up: Au
9665
+ down: Au,
9666
+ up: Pu
9639
9667
  }, Symbol.toStringTag, { value: "Module" }));
9640
9668
  async function Ru(t) {
9641
9669
  }
@@ -9666,16 +9694,16 @@ const Ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9666
9694
  down: Bu,
9667
9695
  up: Vu
9668
9696
  }, Symbol.toStringTag, { value: "Module" }));
9669
- async function Wu(t) {
9697
+ async function Ju(t) {
9670
9698
  await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
9671
9699
  }
9672
- async function Ju(t) {
9700
+ async function Wu(t) {
9673
9701
  await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
9674
9702
  }
9675
9703
  const qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9676
9704
  __proto__: null,
9677
- down: Ju,
9678
- up: Wu
9705
+ down: Wu,
9706
+ up: Ju
9679
9707
  }, Symbol.toStringTag, { value: "Module" }));
9680
9708
  async function Qu(t) {
9681
9709
  }
@@ -9696,6 +9724,36 @@ const eh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9696
9724
  __proto__: null,
9697
9725
  down: Xu,
9698
9726
  up: Yu
9727
+ }, Symbol.toStringTag, { value: "Module" }));
9728
+ async function th(t) {
9729
+ await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
9730
+ }
9731
+ async function nh(t) {
9732
+ await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
9733
+ }
9734
+ const rh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9735
+ __proto__: null,
9736
+ down: nh,
9737
+ up: th
9738
+ }, Symbol.toStringTag, { value: "Module" }));
9739
+ async function ah(t) {
9740
+ 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(
9741
+ "credentials",
9742
+ "varchar(2048)",
9743
+ (e) => e.notNull().defaultTo("{}")
9744
+ ).addColumn(
9745
+ "settings",
9746
+ "varchar(2048)",
9747
+ (e) => e.notNull().defaultTo("{}")
9748
+ ).addColumn("created_at", "varchar(29)", (e) => e.notNull()).addColumn("updated_at", "varchar(29)", (e) => e.notNull()).execute();
9749
+ }
9750
+ async function sh(t) {
9751
+ await t.schema.dropTable("email_providers").execute();
9752
+ }
9753
+ const ih = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9754
+ __proto__: null,
9755
+ down: sh,
9756
+ up: ah
9699
9757
  }, Symbol.toStringTag, { value: "Module" })), Qr = {
9700
9758
  m1_init: Od,
9701
9759
  m2_magicLink: Id,
@@ -9760,9 +9818,11 @@ const eh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9760
9818
  n61_userLocales: Ku,
9761
9819
  n62_prompt: qu,
9762
9820
  n63_connection_cleanup: Hu,
9763
- n64_act_as: eh
9821
+ n64_act_as: eh,
9822
+ n65_code_verifier: rh,
9823
+ n66_email_providers: ih
9764
9824
  };
9765
- async function nh(t, e = !1) {
9825
+ async function dh(t, e = !1) {
9766
9826
  e && console.log("migrating...");
9767
9827
  const n = new qr(Qr), r = new $r({
9768
9828
  db: t,
@@ -9775,7 +9835,7 @@ async function nh(t, e = !1) {
9775
9835
  }), a)
9776
9836
  throw console.error("failed to migrate"), console.error(a), a;
9777
9837
  }
9778
- async function rh(t) {
9838
+ async function ch(t) {
9779
9839
  console.log("migrating...");
9780
9840
  const e = new qr(Qr), n = new $r({
9781
9841
  db: t,
@@ -9786,29 +9846,29 @@ async function rh(t) {
9786
9846
  }), r)
9787
9847
  throw console.error("failed to migrate"), console.error(r), r;
9788
9848
  }
9789
- function ah(t) {
9849
+ function lh(t) {
9790
9850
  return {
9791
- applications: Ti(t),
9792
- branding: Qo(t),
9793
- clients: Lo(t),
9794
- codes: vi(t),
9795
- connections: Mo(t),
9796
- domains: Wo(t),
9797
- hooks: td(t),
9798
- keys: Vo(t),
9799
- logins: ud(t),
9851
+ applications: wi(t),
9852
+ branding: Ko(t),
9853
+ clients: Ao(t),
9854
+ codes: fi(t),
9855
+ connections: Po(t),
9856
+ emailProviders: md(t),
9857
+ domains: Fo(t),
9858
+ hooks: Ho(t),
9859
+ keys: Lo(t),
9860
+ logins: od(t),
9800
9861
  logs: ei(t),
9801
- passwords: mi(t),
9802
- promptSettings: md(t),
9862
+ passwords: li(t),
9863
+ promptSettings: ld(t),
9803
9864
  users: Fs(t),
9804
9865
  sessions: ii(t),
9805
9866
  tenants: Qs(t),
9806
- themes: id(t),
9807
- tickets: li(t)
9867
+ themes: nd(t)
9808
9868
  };
9809
9869
  }
9810
9870
  export {
9811
- ah as default,
9812
- rh as migrateDown,
9813
- nh as migrateToLatest
9871
+ lh as default,
9872
+ ch as migrateDown,
9873
+ dh as migrateToLatest
9814
9874
  };