@authhero/kysely-adapter 0.21.0 → 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,14 +77,14 @@ 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
86
  var ee, te, ne, be, $e, Pe;
87
- const Ae = Je.apply(this, qe);
87
+ const Ae = We.apply(this, qe);
88
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
@@ -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);
@@ -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, {
@@ -1641,7 +1641,7 @@ class A 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"))
@@ -1911,7 +1911,7 @@ A.lazycreate = (t, e) => new A({
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 Pt ? 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({
@@ -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, Pa = A.create, Aa = A.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
2907
  ZodObject: A,
2908
- ZodUnion: Ct,
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,
@@ -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,7 +2952,7 @@ 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,
@@ -2969,8 +2969,8 @@ var i = /* @__PURE__ */ Object.freeze({
2969
2969
  set: Fa,
2970
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,
@@ -3341,7 +3341,7 @@ const Ns = i.object({
3341
3341
  }),
3342
3342
  created_at: i.string(),
3343
3343
  updated_at: i.string()
3344
- }), Ts = i.enum([
3344
+ }), Cs = i.enum([
3345
3345
  "cls",
3346
3346
  // CODE_LINK_SENT
3347
3347
  "fsa",
@@ -3390,7 +3390,7 @@ const Ns = i.object({
3390
3390
  // SUCCESS_VERIFICATION_EMAIL
3391
3391
  "svr"
3392
3392
  // SUCCESS_VERIFICATION_EMAIL_REQUEST
3393
- ]), Cs = i.object({
3393
+ ]), Ts = i.object({
3394
3394
  name: i.string(),
3395
3395
  version: i.string(),
3396
3396
  env: i.object({
@@ -3398,7 +3398,7 @@ const Ns = i.object({
3398
3398
  }).optional()
3399
3399
  });
3400
3400
  i.object({
3401
- type: Ts,
3401
+ type: Cs,
3402
3402
  date: i.string(),
3403
3403
  description: i.string().optional(),
3404
3404
  log_id: i.string().optional(),
@@ -3419,7 +3419,7 @@ i.object({
3419
3419
  strategy: i.string().optional(),
3420
3420
  strategy_type: i.string().optional(),
3421
3421
  hostname: i.string().optional(),
3422
- auth0_client: Cs.optional()
3422
+ auth0_client: Ts.optional()
3423
3423
  });
3424
3424
  const Os = i.object({
3425
3425
  user_id: i.string(),
@@ -3577,6 +3577,37 @@ const As = i.object({
3577
3577
  password_first: i.boolean().default(!1),
3578
3578
  webauthn_platform_first_factor: i.boolean()
3579
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
+ });
3580
3611
  function Vn(t) {
3581
3612
  const [e, n] = t.split("|");
3582
3613
  if (!e || !n)
@@ -3764,7 +3795,7 @@ function Ks(t) {
3764
3795
  return n ? M(n) : null;
3765
3796
  };
3766
3797
  }
3767
- function Ws(t) {
3798
+ function Js(t) {
3768
3799
  return async (e) => {
3769
3800
  let n = t.selectFrom("tenants");
3770
3801
  if (e.sort && e.sort.sort_by) {
@@ -3786,7 +3817,7 @@ function Ws(t) {
3786
3817
  };
3787
3818
  };
3788
3819
  }
3789
- function Js(t) {
3820
+ function Ws(t) {
3790
3821
  return async (e, n) => {
3791
3822
  const r = {
3792
3823
  ...n,
@@ -3803,8 +3834,8 @@ function Qs(t) {
3803
3834
  return {
3804
3835
  create: Bs(t),
3805
3836
  get: Ks(t),
3806
- list: Ws(t),
3807
- update: Js(t),
3837
+ list: Js(t),
3838
+ update: Ws(t),
3808
3839
  remove: qs(t)
3809
3840
  };
3810
3841
  }
@@ -3940,68 +3971,12 @@ function ii(t) {
3940
3971
  };
3941
3972
  }
3942
3973
  function oi(t) {
3943
- return async (e, n) => {
3944
- const r = await t.selectFrom("tickets").where("tickets.tenant_id", "=", e).where("tickets.id", "=", n).where("tickets.used_at", "is", null).selectAll().executeTakeFirst();
3945
- if (!r)
3946
- return null;
3947
- const {
3948
- nonce: a,
3949
- state: s,
3950
- scope: o,
3951
- response_type: d,
3952
- response_mode: c,
3953
- redirect_uri: l,
3954
- ...u
3955
- } = r;
3956
- return {
3957
- ...u,
3958
- authParams: {
3959
- nonce: a,
3960
- state: s,
3961
- scope: o,
3962
- response_type: d,
3963
- response_mode: c,
3964
- redirect_uri: l
3965
- },
3966
- created_at: new Date(r.created_at),
3967
- expires_at: new Date(r.expires_at),
3968
- used_at: r.used_at ? new Date(r.used_at) : void 0
3969
- };
3970
- };
3971
- }
3972
- function di(t) {
3973
- return async (e) => {
3974
- const { authParams: n, ...r } = e, a = {
3975
- ...r,
3976
- ...n,
3977
- created_at: e.created_at.toISOString(),
3978
- expires_at: e.expires_at.toISOString(),
3979
- used_at: e.used_at ? e.used_at.toISOString() : void 0
3980
- };
3981
- await t.insertInto("tickets").values(a).execute();
3982
- };
3983
- }
3984
- function ci(t) {
3985
- return async (e, n) => {
3986
- await t.updateTable("tickets").set({
3987
- used_at: (/* @__PURE__ */ new Date()).toISOString()
3988
- }).where("tickets.tenant_id", "=", e).where("tickets.id", "=", n).execute();
3989
- };
3990
- }
3991
- function li(t) {
3992
- return {
3993
- create: di(t),
3994
- get: oi(t),
3995
- remove: ci(t)
3996
- };
3997
- }
3998
- function ui(t) {
3999
3974
  return async (e, n) => {
4000
3975
  const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", n).selectAll().executeTakeFirstOrThrow(), { tenant_id: a, ...s } = r;
4001
3976
  return s;
4002
3977
  };
4003
3978
  }
4004
- function hi(t) {
3979
+ function di(t) {
4005
3980
  return async (e, n) => {
4006
3981
  const r = {
4007
3982
  ...n,
@@ -4014,20 +3989,20 @@ function hi(t) {
4014
3989
  }).execute(), r;
4015
3990
  };
4016
3991
  }
4017
- function pi(t) {
3992
+ function ci(t) {
4018
3993
  return async (e, n) => (await t.updateTable("passwords").set({
4019
3994
  password: n.password,
4020
3995
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
4021
3996
  }).where("tenant_id", "=", e).where("user_id", "=", n.user_id).execute()).length === 1;
4022
3997
  }
4023
- function mi(t) {
3998
+ function li(t) {
4024
3999
  return {
4025
- create: hi(t),
4026
- update: pi(t),
4027
- get: ui(t)
4000
+ create: di(t),
4001
+ update: ci(t),
4002
+ get: oi(t)
4028
4003
  };
4029
4004
  }
4030
- function fi(t) {
4005
+ function ui(t) {
4031
4006
  return async (e, n) => {
4032
4007
  let r = t.selectFrom("codes").where("codes.tenant_id", "=", e);
4033
4008
  n.q && (r = Be(t, r, n.q, ["code", "login_id"]));
@@ -4043,7 +4018,7 @@ function fi(t) {
4043
4018
  };
4044
4019
  };
4045
4020
  }
4046
- function _i(t) {
4021
+ function hi(t) {
4047
4022
  return async (e, n) => {
4048
4023
  const r = {
4049
4024
  ...n,
@@ -4055,10 +4030,10 @@ function _i(t) {
4055
4030
  }).execute(), r;
4056
4031
  };
4057
4032
  }
4058
- function gi(t) {
4033
+ function pi(t) {
4059
4034
  return async (e, n) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4060
4035
  }
4061
- function yi(t) {
4036
+ function mi(t) {
4062
4037
  return async (e, n, r) => {
4063
4038
  let a = t.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", r).where("codes.expires_at", ">", (/* @__PURE__ */ new Date()).toISOString());
4064
4039
  e.length && (a = a.where("codes.tenant_id", "=", e));
@@ -4066,15 +4041,15 @@ function yi(t) {
4066
4041
  return s ? M(s) : null;
4067
4042
  };
4068
4043
  }
4069
- function vi(t) {
4044
+ function fi(t) {
4070
4045
  return {
4071
- create: _i(t),
4072
- list: fi(t),
4073
- remove: gi(t),
4074
- get: yi(t)
4046
+ create: hi(t),
4047
+ list: ui(t),
4048
+ remove: pi(t),
4049
+ get: mi(t)
4075
4050
  };
4076
4051
  }
4077
- function bi(t) {
4052
+ function _i(t) {
4078
4053
  return async (e, n) => {
4079
4054
  const r = {
4080
4055
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4094,7 +4069,7 @@ function bi(t) {
4094
4069
  }).execute(), r;
4095
4070
  };
4096
4071
  }
4097
- function wi(t) {
4072
+ function gi(t) {
4098
4073
  return async (e) => ({
4099
4074
  applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((s) => ({
4100
4075
  ...s,
@@ -4108,7 +4083,7 @@ function wi(t) {
4108
4083
  }))
4109
4084
  });
4110
4085
  }
4111
- function xi(t) {
4086
+ function yi(t) {
4112
4087
  return async (e, n) => {
4113
4088
  const r = await t.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", n).selectAll().executeTakeFirst();
4114
4089
  return r ? M({
@@ -4122,10 +4097,10 @@ function xi(t) {
4122
4097
  }) : null;
4123
4098
  };
4124
4099
  }
4125
- function Ni(t) {
4100
+ function vi(t) {
4126
4101
  return async (e, n) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4127
4102
  }
4128
- function ki(t) {
4103
+ function bi(t) {
4129
4104
  return async (e, n, r) => {
4130
4105
  const a = {
4131
4106
  ...r,
@@ -4141,16 +4116,16 @@ function ki(t) {
4141
4116
  return await t.updateTable("applications").set(a).where("applications.id", "=", n).where("applications.tenant_id", "=", e).execute(), !0;
4142
4117
  };
4143
4118
  }
4144
- function Ti(t) {
4119
+ function wi(t) {
4145
4120
  return {
4146
- create: bi(t),
4147
- list: wi(t),
4148
- get: xi(t),
4149
- remove: Ni(t),
4150
- update: ki(t)
4121
+ create: _i(t),
4122
+ list: gi(t),
4123
+ get: yi(t),
4124
+ remove: vi(t),
4125
+ update: bi(t)
4151
4126
  };
4152
4127
  }
4153
- function Ci(t) {
4128
+ function xi(t) {
4154
4129
  return async (e, n) => {
4155
4130
  const r = {
4156
4131
  id: Ke(),
@@ -4166,7 +4141,7 @@ function Ci(t) {
4166
4141
  }).execute(), r;
4167
4142
  };
4168
4143
  }
4169
- function Oi(t, e) {
4144
+ function Ni(t, e) {
4170
4145
  var n = {};
4171
4146
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
4172
4147
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -4174,7 +4149,7 @@ function Oi(t, e) {
4174
4149
  e.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[a]) && (n[r[a]] = t[r[a]]);
4175
4150
  return n;
4176
4151
  }
4177
- function Si(t, e) {
4152
+ function ki(t, e) {
4178
4153
  var n;
4179
4154
  return ((n = t == null ? void 0 : t._def) === null || n === void 0 ? void 0 : n.typeName) === e;
4180
4155
  }
@@ -4185,19 +4160,19 @@ function mt(t, e) {
4185
4160
  return a._def.openapi = this._def.openapi, a;
4186
4161
  };
4187
4162
  }
4188
- function ji(t) {
4163
+ function Ci(t) {
4189
4164
  if (typeof t.ZodType.prototype.openapi < "u")
4190
4165
  return;
4191
4166
  t.ZodType.prototype.openapi = function(a, s) {
4192
4167
  var o, d, c, l, u, Z;
4193
- 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 ? {
4194
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)
4195
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) }));
4196
- if (Si(this, "ZodObject")) {
4197
- const Je = this.extend;
4171
+ if (ki(this, "ZodObject")) {
4172
+ const We = this.extend;
4198
4173
  ve.extend = function(...qe) {
4199
4174
  var ee, te, ne, be, $e, Pe;
4200
- const Ae = Je.apply(this, qe);
4175
+ const Ae = We.apply(this, qe);
4201
4176
  return Ae._def.openapi = {
4202
4177
  _internal: {
4203
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
@@ -4331,8 +4306,8 @@ const y = $.arrayToEnum([
4331
4306
  "invalid_intersection_types",
4332
4307
  "not_multiple_of",
4333
4308
  "not_finite"
4334
- ]), Ii = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
4335
- class W extends Error {
4309
+ ]), Ti = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
4310
+ class J extends Error {
4336
4311
  constructor(e) {
4337
4312
  super(), this.issues = [], this.addIssue = (r) => {
4338
4313
  this.issues = [...this.issues, r];
@@ -4369,7 +4344,7 @@ class W extends Error {
4369
4344
  return a(this), r;
4370
4345
  }
4371
4346
  static assert(e) {
4372
- if (!(e instanceof W))
4347
+ if (!(e instanceof J))
4373
4348
  throw new Error(`Not a ZodError: ${e}`);
4374
4349
  }
4375
4350
  toString() {
@@ -4391,7 +4366,7 @@ class W extends Error {
4391
4366
  return this.flatten();
4392
4367
  }
4393
4368
  }
4394
- W.create = (t) => new W(t);
4369
+ J.create = (t) => new J(t);
4395
4370
  const dt = (t, e) => {
4396
4371
  let n;
4397
4372
  switch (t.code) {
@@ -4449,7 +4424,7 @@ const dt = (t, e) => {
4449
4424
  return { message: n };
4450
4425
  };
4451
4426
  let yr = dt;
4452
- function Zi(t) {
4427
+ function Oi(t) {
4453
4428
  yr = t;
4454
4429
  }
4455
4430
  function ln() {
@@ -4475,7 +4450,7 @@ const un = (t) => {
4475
4450
  path: s,
4476
4451
  message: d
4477
4452
  };
4478
- }, Ei = [];
4453
+ }, Si = [];
4479
4454
  function _(t, e) {
4480
4455
  const n = ln(), r = un({
4481
4456
  issueData: e,
@@ -4566,7 +4541,7 @@ const Gn = (t, e) => {
4566
4541
  get error() {
4567
4542
  if (this._error)
4568
4543
  return this._error;
4569
- const n = new W(t.common.issues);
4544
+ const n = new J(t.common.issues);
4570
4545
  return this._error = n, this._error;
4571
4546
  }
4572
4547
  };
@@ -4723,7 +4698,7 @@ class I {
4723
4698
  }
4724
4699
  default(e) {
4725
4700
  const n = typeof e == "function" ? e : () => e;
4726
- return new Wt({
4701
+ return new Jt({
4727
4702
  ...S(this._def),
4728
4703
  innerType: this,
4729
4704
  defaultValue: n,
@@ -4739,7 +4714,7 @@ class I {
4739
4714
  }
4740
4715
  catch(e) {
4741
4716
  const n = typeof e == "function" ? e : () => e;
4742
- return new Jt({
4717
+ return new Wt({
4743
4718
  ...S(this._def),
4744
4719
  innerType: this,
4745
4720
  catchValue: n,
@@ -4766,14 +4741,14 @@ class I {
4766
4741
  return this.safeParse(null).success;
4767
4742
  }
4768
4743
  }
4769
- const $i = /^c[^\s-]{8,}$/i, Pi = /^[0-9a-z]+$/, Ai = /^[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})+$";
4770
4745
  let xn;
4771
- 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}$`);
4772
4747
  function wr(t) {
4773
4748
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
4774
4749
  return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
4775
4750
  }
4776
- function Ki(t) {
4751
+ function Ui(t) {
4777
4752
  return new RegExp(`^${wr(t)}$`);
4778
4753
  }
4779
4754
  function xr(t) {
@@ -4781,8 +4756,8 @@ function xr(t) {
4781
4756
  const n = [];
4782
4757
  return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
4783
4758
  }
4784
- function Wi(t, e) {
4785
- 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));
4786
4761
  }
4787
4762
  class Q extends I {
4788
4763
  _parse(e) {
@@ -4833,43 +4808,43 @@ class Q extends I {
4833
4808
  message: s.message
4834
4809
  }), r.dirty());
4835
4810
  } else if (s.kind === "email")
4836
- Li.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4811
+ Ai.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4837
4812
  validation: "email",
4838
4813
  code: p.invalid_string,
4839
4814
  message: s.message
4840
4815
  }), r.dirty());
4841
4816
  else if (s.kind === "emoji")
4842
- 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, {
4843
4818
  validation: "emoji",
4844
4819
  code: p.invalid_string,
4845
4820
  message: s.message
4846
4821
  }), r.dirty());
4847
4822
  else if (s.kind === "uuid")
4848
- Di.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4823
+ Ei.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4849
4824
  validation: "uuid",
4850
4825
  code: p.invalid_string,
4851
4826
  message: s.message
4852
4827
  }), r.dirty());
4853
4828
  else if (s.kind === "nanoid")
4854
- Ri.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4829
+ $i.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4855
4830
  validation: "nanoid",
4856
4831
  code: p.invalid_string,
4857
4832
  message: s.message
4858
4833
  }), r.dirty());
4859
4834
  else if (s.kind === "cuid")
4860
- $i.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4835
+ ji.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4861
4836
  validation: "cuid",
4862
4837
  code: p.invalid_string,
4863
4838
  message: s.message
4864
4839
  }), r.dirty());
4865
4840
  else if (s.kind === "cuid2")
4866
- Pi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4841
+ Ii.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4867
4842
  validation: "cuid2",
4868
4843
  code: p.invalid_string,
4869
4844
  message: s.message
4870
4845
  }), r.dirty());
4871
4846
  else if (s.kind === "ulid")
4872
- Ai.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4847
+ Zi.test(e.data) || (a = this._getOrReturnCtx(e, a), _(a, {
4873
4848
  validation: "ulid",
4874
4849
  code: p.invalid_string,
4875
4850
  message: s.message
@@ -4904,23 +4879,23 @@ class Q extends I {
4904
4879
  code: p.invalid_string,
4905
4880
  validation: "datetime",
4906
4881
  message: s.message
4907
- }), 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, {
4908
4883
  code: p.invalid_string,
4909
4884
  validation: "date",
4910
4885
  message: s.message
4911
- }), 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, {
4912
4887
  code: p.invalid_string,
4913
4888
  validation: "time",
4914
4889
  message: s.message
4915
- }), 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, {
4916
4891
  validation: "duration",
4917
4892
  code: p.invalid_string,
4918
4893
  message: s.message
4919
- }), 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, {
4920
4895
  validation: "ip",
4921
4896
  code: p.invalid_string,
4922
4897
  message: s.message
4923
- }), 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, {
4924
4899
  validation: "base64",
4925
4900
  code: p.invalid_string,
4926
4901
  message: s.message
@@ -5142,7 +5117,7 @@ Q.create = (t) => {
5142
5117
  ...S(t)
5143
5118
  });
5144
5119
  };
5145
- function Ji(t, e) {
5120
+ function Vi(t, e) {
5146
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(".", ""));
5147
5122
  return s % o / Math.pow(10, a);
5148
5123
  }
@@ -5181,7 +5156,7 @@ class Se extends I {
5181
5156
  inclusive: s.inclusive,
5182
5157
  exact: !1,
5183
5158
  message: s.message
5184
- }), 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, {
5185
5160
  code: p.not_multiple_of,
5186
5161
  multipleOf: s.value,
5187
5162
  message: s.message
@@ -6034,7 +6009,7 @@ class zt extends I {
6034
6009
  for (const d of s)
6035
6010
  if (d.result.status === "dirty")
6036
6011
  return n.common.issues.push(...d.ctx.common.issues), d.result;
6037
- const o = s.map((d) => new W(d.ctx.common.issues));
6012
+ const o = s.map((d) => new J(d.ctx.common.issues));
6038
6013
  return _(n, {
6039
6014
  code: p.invalid_union,
6040
6015
  unionErrors: o
@@ -6081,7 +6056,7 @@ class zt extends I {
6081
6056
  }
6082
6057
  if (s)
6083
6058
  return n.common.issues.push(...s.ctx.common.issues), s.result;
6084
- const d = o.map((c) => new W(c));
6059
+ const d = o.map((c) => new J(c));
6085
6060
  return _(n, {
6086
6061
  code: p.invalid_union,
6087
6062
  unionErrors: d
@@ -6097,7 +6072,7 @@ zt.create = (t, e) => new zt({
6097
6072
  typeName: N.ZodUnion,
6098
6073
  ...S(e)
6099
6074
  });
6100
- 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) : [];
6101
6076
  class vn extends I {
6102
6077
  _parse(e) {
6103
6078
  const { ctx: n } = this._processInputParams(e);
@@ -6475,11 +6450,11 @@ class rt extends I {
6475
6450
  if (this._def.returns instanceof lt) {
6476
6451
  const d = this;
6477
6452
  return B(async function(...c) {
6478
- const l = new W([]), u = await d._def.args.parseAsync(c, s).catch((J) => {
6479
- 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;
6480
6455
  }), Z = await Reflect.apply(o, this, u);
6481
- return await d._def.returns._def.type.parseAsync(Z, s).catch((J) => {
6482
- 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;
6483
6458
  });
6484
6459
  });
6485
6460
  } else {
@@ -6487,10 +6462,10 @@ class rt extends I {
6487
6462
  return B(function(...c) {
6488
6463
  const l = d._def.args.safeParse(c, s);
6489
6464
  if (!l.success)
6490
- throw new W([r(c, l.error)]);
6465
+ throw new J([r(c, l.error)]);
6491
6466
  const u = Reflect.apply(o, this, l.data), Z = d._def.returns.safeParse(u, s);
6492
6467
  if (!Z.success)
6493
- throw new W([a(u, Z.error)]);
6468
+ throw new J([a(u, Z.error)]);
6494
6469
  return Z.data;
6495
6470
  });
6496
6471
  }
@@ -6802,7 +6777,7 @@ Ze.create = (t, e) => new Ze({
6802
6777
  typeName: N.ZodNullable,
6803
6778
  ...S(e)
6804
6779
  });
6805
- class Wt extends I {
6780
+ class Jt extends I {
6806
6781
  _parse(e) {
6807
6782
  const { ctx: n } = this._processInputParams(e);
6808
6783
  let r = n.data;
@@ -6816,13 +6791,13 @@ class Wt extends I {
6816
6791
  return this._def.innerType;
6817
6792
  }
6818
6793
  }
6819
- Wt.create = (t, e) => new Wt({
6794
+ Jt.create = (t, e) => new Jt({
6820
6795
  innerType: t,
6821
6796
  typeName: N.ZodDefault,
6822
6797
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
6823
6798
  ...S(e)
6824
6799
  });
6825
- class Jt extends I {
6800
+ class Wt extends I {
6826
6801
  _parse(e) {
6827
6802
  const { ctx: n } = this._processInputParams(e), r = {
6828
6803
  ...n,
@@ -6841,7 +6816,7 @@ class Jt extends I {
6841
6816
  status: "valid",
6842
6817
  value: s.status === "valid" ? s.value : this._def.catchValue({
6843
6818
  get error() {
6844
- return new W(r.common.issues);
6819
+ return new J(r.common.issues);
6845
6820
  },
6846
6821
  input: r.data
6847
6822
  })
@@ -6849,7 +6824,7 @@ class Jt extends I {
6849
6824
  status: "valid",
6850
6825
  value: a.status === "valid" ? a.value : this._def.catchValue({
6851
6826
  get error() {
6852
- return new W(r.common.issues);
6827
+ return new J(r.common.issues);
6853
6828
  },
6854
6829
  input: r.data
6855
6830
  })
@@ -6859,7 +6834,7 @@ class Jt extends I {
6859
6834
  return this._def.innerType;
6860
6835
  }
6861
6836
  }
6862
- Jt.create = (t, e) => new Jt({
6837
+ Wt.create = (t, e) => new Wt({
6863
6838
  innerType: t,
6864
6839
  typeName: N.ZodCatch,
6865
6840
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
@@ -6882,7 +6857,7 @@ _n.create = (t) => new _n({
6882
6857
  typeName: N.ZodNaN,
6883
6858
  ...S(t)
6884
6859
  });
6885
- const qi = Symbol("zod_brand");
6860
+ const Bi = Symbol("zod_brand");
6886
6861
  class Bn extends I {
6887
6862
  _parse(e) {
6888
6863
  const { ctx: n } = this._processInputParams(e), r = n.data;
@@ -6959,16 +6934,16 @@ function kr(t, e = {}, n) {
6959
6934
  }
6960
6935
  }) : ct.create();
6961
6936
  }
6962
- const Qi = {
6937
+ const Ki = {
6963
6938
  object: D.lazycreate
6964
6939
  };
6965
6940
  var N;
6966
6941
  (function(t) {
6967
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";
6968
6943
  })(N || (N = {}));
6969
- const Gi = (t, e = {
6944
+ const Ji = (t, e = {
6970
6945
  message: `Input not instance of ${t.name}`
6971
- }) => 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 = {
6972
6947
  string: (t) => Q.create({ ...t, coerce: !0 }),
6973
6948
  number: (t) => Se.create({ ...t, coerce: !0 }),
6974
6949
  boolean: (t) => Rt.create({
@@ -6977,14 +6952,14 @@ const Gi = (t, e = {
6977
6952
  }),
6978
6953
  bigint: (t) => je.create({ ...t, coerce: !0 }),
6979
6954
  date: (t) => Fe.create({ ...t, coerce: !0 })
6980
- }, Eo = k;
6981
- var $o = /* @__PURE__ */ Object.freeze({
6955
+ }, So = k;
6956
+ var jo = /* @__PURE__ */ Object.freeze({
6982
6957
  __proto__: null,
6983
6958
  defaultErrorMap: dt,
6984
- setErrorMap: Zi,
6959
+ setErrorMap: Oi,
6985
6960
  getErrorMap: ln,
6986
6961
  makeIssue: un,
6987
- EMPTY_PATH: Ei,
6962
+ EMPTY_PATH: Si,
6988
6963
  addIssueToContext: _,
6989
6964
  ParseStatus: F,
6990
6965
  INVALID: k,
@@ -7035,66 +7010,66 @@ var $o = /* @__PURE__ */ Object.freeze({
7035
7010
  ZodTransformer: X,
7036
7011
  ZodOptional: se,
7037
7012
  ZodNullable: Ze,
7038
- ZodDefault: Wt,
7039
- ZodCatch: Jt,
7013
+ ZodDefault: Jt,
7014
+ ZodCatch: Wt,
7040
7015
  ZodNaN: _n,
7041
- BRAND: qi,
7016
+ BRAND: Bi,
7042
7017
  ZodBranded: Bn,
7043
7018
  ZodPipeline: Yt,
7044
7019
  ZodReadonly: qt,
7045
7020
  custom: kr,
7046
7021
  Schema: I,
7047
7022
  ZodSchema: I,
7048
- late: Qi,
7023
+ late: Ki,
7049
7024
  get ZodFirstPartyTypeKind() {
7050
7025
  return N;
7051
7026
  },
7052
- coerce: Zo,
7053
- any: ro,
7054
- array: oo,
7055
- bigint: Yi,
7027
+ coerce: Oo,
7028
+ any: Xi,
7029
+ array: ro,
7030
+ bigint: qi,
7056
7031
  boolean: Or,
7057
- date: Xi,
7058
- discriminatedUnion: ho,
7032
+ date: Qi,
7033
+ discriminatedUnion: oo,
7059
7034
  effect: Hn,
7060
- enum: wo,
7061
- function: yo,
7062
- instanceof: Gi,
7063
- intersection: po,
7064
- lazy: vo,
7065
- literal: bo,
7066
- map: _o,
7067
- nan: Hi,
7068
- nativeEnum: xo,
7069
- never: so,
7070
- null: no,
7071
- nullable: To,
7072
- number: Cr,
7073
- object: co,
7074
- oboolean: Io,
7075
- onumber: jo,
7076
- optional: ko,
7077
- ostring: So,
7078
- pipeline: Oo,
7079
- preprocess: Co,
7080
- promise: No,
7081
- record: fo,
7082
- set: go,
7083
- strictObject: lo,
7084
- string: Tr,
7085
- 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,
7086
7061
  transformer: Hn,
7087
- tuple: mo,
7088
- undefined: to,
7089
- union: uo,
7090
- unknown: ao,
7091
- void: io,
7092
- NEVER: Eo,
7062
+ tuple: lo,
7063
+ undefined: Hi,
7064
+ union: io,
7065
+ unknown: eo,
7066
+ void: no,
7067
+ NEVER: So,
7093
7068
  ZodIssueCode: p,
7094
- quotelessJson: Ii,
7095
- ZodError: W
7069
+ quotelessJson: Ti,
7070
+ ZodError: J
7096
7071
  });
7097
- ji($o);
7072
+ Ci(jo);
7098
7073
  function Xt(t, e = "", n = {}) {
7099
7074
  for (let r in t)
7100
7075
  if (Object.prototype.hasOwnProperty.call(t, r)) {
@@ -7121,7 +7096,7 @@ function Sr(t, e) {
7121
7096
  }
7122
7097
  return n;
7123
7098
  }
7124
- function Po(t) {
7099
+ function Io(t) {
7125
7100
  return async (e, n) => {
7126
7101
  let r = t.selectFrom("connections").where("connections.tenant_id", "=", e);
7127
7102
  n.q && (r = Be(t, r, n.q, ["user_id", "ip"]));
@@ -7136,10 +7111,10 @@ function Po(t) {
7136
7111
  };
7137
7112
  };
7138
7113
  }
7139
- function Ao(t) {
7114
+ function Zo(t) {
7140
7115
  return async (e, n) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7141
7116
  }
7142
- function Do(t) {
7117
+ function Eo(t) {
7143
7118
  return async (e, n) => {
7144
7119
  const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
7145
7120
  return r ? M({
@@ -7148,7 +7123,7 @@ function Do(t) {
7148
7123
  }) : null;
7149
7124
  };
7150
7125
  }
7151
- function Ro(t) {
7126
+ function $o(t) {
7152
7127
  return async (e, n, r) => {
7153
7128
  const a = {
7154
7129
  ...r,
@@ -7160,16 +7135,16 @@ function Ro(t) {
7160
7135
  }).where("connections.id", "=", n).where("connections.tenant_id", "=", e).execute(), !0;
7161
7136
  };
7162
7137
  }
7163
- function Mo(t) {
7138
+ function Po(t) {
7164
7139
  return {
7165
- create: Ci(t),
7166
- get: Do(t),
7167
- list: Po(t),
7168
- remove: Ao(t),
7169
- update: Ro(t)
7140
+ create: xi(t),
7141
+ get: Eo(t),
7142
+ list: Io(t),
7143
+ remove: Zo(t),
7144
+ update: $o(t)
7170
7145
  };
7171
7146
  }
7172
- function Lo(t) {
7147
+ function Ao(t) {
7173
7148
  return {
7174
7149
  get: async (e) => {
7175
7150
  const n = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
@@ -7177,7 +7152,7 @@ function Lo(t) {
7177
7152
  return null;
7178
7153
  const r = await t.selectFrom("tenants").selectAll().where("id", "=", n.tenant_id).executeTakeFirst();
7179
7154
  if (!r)
7180
- throw new Cn(404, { message: "Tenant not found" });
7155
+ throw new Tn(404, { message: "Tenant not found" });
7181
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();
7182
7157
  return {
7183
7158
  ...n,
@@ -7203,7 +7178,7 @@ function Lo(t) {
7203
7178
  }
7204
7179
  };
7205
7180
  }
7206
- function zo(t) {
7181
+ function Do(t) {
7207
7182
  return async () => await t.selectFrom("keys").where(
7208
7183
  (n) => n.or([
7209
7184
  n("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
@@ -7211,22 +7186,22 @@ function zo(t) {
7211
7186
  ])
7212
7187
  ).selectAll().execute();
7213
7188
  }
7214
- function Uo(t) {
7189
+ function Ro(t) {
7215
7190
  return async (e) => {
7216
7191
  await t.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
7217
7192
  };
7218
7193
  }
7219
- function Fo(t) {
7194
+ function Mo(t) {
7220
7195
  return async (e, n) => !!(await t.updateTable("keys").set(n).where("kid", "=", e).execute()).length;
7221
7196
  }
7222
- function Vo(t) {
7197
+ function Lo(t) {
7223
7198
  return {
7224
- create: Uo(t),
7225
- list: zo(t),
7226
- update: Fo(t)
7199
+ create: Ro(t),
7200
+ list: Do(t),
7201
+ update: Mo(t)
7227
7202
  };
7228
7203
  }
7229
- function Bo(t) {
7204
+ function zo(t) {
7230
7205
  return async (e, n) => {
7231
7206
  const r = {
7232
7207
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -7238,7 +7213,7 @@ function Bo(t) {
7238
7213
  return await t.insertInto("domains").values(r).execute(), r;
7239
7214
  };
7240
7215
  }
7241
- function Ko(t) {
7216
+ function Uo(t) {
7242
7217
  return async (e, n) => {
7243
7218
  let r = t.selectFrom("domains").where("domains.tenant_id", "=", e);
7244
7219
  n.q && (r = Be(t, r, n.q, ["user_id", "ip"]));
@@ -7251,13 +7226,13 @@ function Ko(t) {
7251
7226
  };
7252
7227
  };
7253
7228
  }
7254
- function Wo(t) {
7229
+ function Fo(t) {
7255
7230
  return {
7256
- create: Bo(t),
7257
- list: Ko(t)
7231
+ create: zo(t),
7232
+ list: Uo(t)
7258
7233
  };
7259
7234
  }
7260
- function Jo(t) {
7235
+ function Vo(t) {
7261
7236
  return async (e) => {
7262
7237
  const [n] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
7263
7238
  if (!n)
@@ -7287,9 +7262,9 @@ function Jo(t) {
7287
7262
  });
7288
7263
  };
7289
7264
  }
7290
- function qo(t) {
7265
+ function Bo(t) {
7291
7266
  return async (e, n) => {
7292
- 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;
7293
7268
  const { colors: r, font: a, ...s } = n;
7294
7269
  try {
7295
7270
  await t.insertInto("branding").values({
@@ -7298,7 +7273,7 @@ function qo(t) {
7298
7273
  colors_page_background_type: (d = (o = n.colors) == null ? void 0 : o.page_background) == null ? void 0 : d.type,
7299
7274
  colors_page_background_start: (l = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : l.start,
7300
7275
  colors_page_background_end: (Z = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : Z.end,
7301
- 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,
7302
7277
  font_url: (_e = n.font) == null ? void 0 : _e.url,
7303
7278
  tenant_id: e
7304
7279
  }).execute();
@@ -7306,22 +7281,22 @@ function qo(t) {
7306
7281
  await t.updateTable("branding").set({
7307
7282
  ...s,
7308
7283
  colors_primary: r == null ? void 0 : r.primary,
7309
- 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,
7310
7285
  colors_page_background_start: (ve = (ye = n.colors) == null ? void 0 : ye.page_background) == null ? void 0 : ve.start,
7311
- 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,
7312
7287
  colors_page_background_angle_dev: (te = (ee = n.colors) == null ? void 0 : ee.page_background) == null ? void 0 : te.angle_deg,
7313
7288
  font_url: (ne = n.font) == null ? void 0 : ne.url
7314
7289
  }).where("tenant_id", "=", e).execute();
7315
7290
  }
7316
7291
  };
7317
7292
  }
7318
- function Qo(t) {
7293
+ function Ko(t) {
7319
7294
  return {
7320
- get: Jo(t),
7321
- set: qo(t)
7295
+ get: Vo(t),
7296
+ set: Bo(t)
7322
7297
  };
7323
7298
  }
7324
- function Go(t) {
7299
+ function Jo(t) {
7325
7300
  return async (e, n) => {
7326
7301
  let r = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
7327
7302
  n.q && (r = Be(t, r, n.q, ["url"]));
@@ -7341,7 +7316,7 @@ function Go(t) {
7341
7316
  };
7342
7317
  };
7343
7318
  }
7344
- function Ho(t) {
7319
+ function Wo(t) {
7345
7320
  return async (e, n) => {
7346
7321
  const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
7347
7322
  return r ? M({
@@ -7351,10 +7326,10 @@ function Ho(t) {
7351
7326
  }) : null;
7352
7327
  };
7353
7328
  }
7354
- function Yo(t) {
7329
+ function qo(t) {
7355
7330
  return async (e, n) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7356
7331
  }
7357
- function Xo(t) {
7332
+ function Qo(t) {
7358
7333
  return async (e, n) => {
7359
7334
  const r = {
7360
7335
  hook_id: Ke(),
@@ -7370,7 +7345,7 @@ function Xo(t) {
7370
7345
  }).execute(), r;
7371
7346
  };
7372
7347
  }
7373
- function ed(t) {
7348
+ function Go(t) {
7374
7349
  return async (e, n, r) => {
7375
7350
  const a = {
7376
7351
  ...r,
@@ -7381,16 +7356,16 @@ function ed(t) {
7381
7356
  return await t.updateTable("hooks").set(a).where("hooks.hook_id", "=", n).where("hooks.tenant_id", "=", e).execute(), !0;
7382
7357
  };
7383
7358
  }
7384
- function td(t) {
7359
+ function Ho(t) {
7385
7360
  return {
7386
- create: Xo(t),
7387
- get: Ho(t),
7388
- list: Go(t),
7389
- update: ed(t),
7390
- remove: Yo(t)
7361
+ create: Qo(t),
7362
+ get: Wo(t),
7363
+ list: Jo(t),
7364
+ update: Go(t),
7365
+ remove: qo(t)
7391
7366
  };
7392
7367
  }
7393
- function nd(t) {
7368
+ function Yo(t) {
7394
7369
  return async (e, n) => {
7395
7370
  const r = {
7396
7371
  themeId: Ke(),
@@ -7401,16 +7376,16 @@ function nd(t) {
7401
7376
  return await t.insertInto("themes").values({ ...Xt(r), tenant_id: e }).execute(), r;
7402
7377
  };
7403
7378
  }
7404
- function rd(t) {
7379
+ function Xo(t) {
7405
7380
  return async (e, n) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7406
7381
  }
7407
- function ad(t) {
7382
+ function ed(t) {
7408
7383
  return async (e, n) => {
7409
7384
  const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", n).selectAll().executeTakeFirst();
7410
7385
  return r ? M(r) : null;
7411
7386
  };
7412
7387
  }
7413
- function sd(t) {
7388
+ function td(t) {
7414
7389
  return async (e, n, r) => {
7415
7390
  const a = Xt({
7416
7391
  ...r,
@@ -7419,15 +7394,15 @@ function sd(t) {
7419
7394
  return await t.updateTable("themes").set(a).where("themes.id", "=", n).where("themes.tenant_id", "=", e).execute(), !0;
7420
7395
  };
7421
7396
  }
7422
- function id(t) {
7397
+ function nd(t) {
7423
7398
  return {
7424
- create: nd(t),
7425
- get: ad(t),
7426
- remove: rd(t),
7427
- update: sd(t)
7399
+ create: Yo(t),
7400
+ get: ed(t),
7401
+ remove: Xo(t),
7402
+ update: td(t)
7428
7403
  };
7429
7404
  }
7430
- function od(t) {
7405
+ function rd(t) {
7431
7406
  return async (e, n) => {
7432
7407
  const r = (/* @__PURE__ */ new Date()).toISOString(), a = await t.selectFrom("logins").where("logins.expires_at", ">", r).where("logins.login_id", "=", n).selectAll().executeTakeFirst();
7433
7408
  return a ? ks.parse(
@@ -7435,7 +7410,7 @@ function od(t) {
7435
7410
  ) : null;
7436
7411
  };
7437
7412
  }
7438
- function dd(t) {
7413
+ function ad(t) {
7439
7414
  return async (e, n) => {
7440
7415
  const r = {
7441
7416
  login_id: Ke(),
@@ -7446,21 +7421,21 @@ function dd(t) {
7446
7421
  return await t.insertInto("logins").values({ ...Xt(r), tenant_id: e }).execute(), r;
7447
7422
  };
7448
7423
  }
7449
- function cd(t) {
7424
+ function sd(t) {
7450
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;
7451
7426
  }
7452
- function ld(t) {
7427
+ function id(t) {
7453
7428
  return async (e, n) => (await t.deleteFrom("logins").where("logins.tenant_id", "=", e).where("logins.login_id", "=", n).execute()).length > 0;
7454
7429
  }
7455
- function ud(t) {
7430
+ function od(t) {
7456
7431
  return {
7457
- create: dd(t),
7458
- get: od(t),
7459
- update: cd(t),
7460
- remove: ld(t)
7432
+ create: ad(t),
7433
+ get: rd(t),
7434
+ update: sd(t),
7435
+ remove: id(t)
7461
7436
  };
7462
7437
  }
7463
- function hd(t) {
7438
+ function dd(t) {
7464
7439
  return async (e) => {
7465
7440
  const [n] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
7466
7441
  return M({
@@ -7480,7 +7455,7 @@ function Yn(t) {
7480
7455
  universal_login_experience: t.universal_login_experience
7481
7456
  });
7482
7457
  }
7483
- function pd(t) {
7458
+ function cd(t) {
7484
7459
  return async (e, n) => {
7485
7460
  try {
7486
7461
  const r = As.parse(n);
@@ -7493,10 +7468,62 @@ function pd(t) {
7493
7468
  }
7494
7469
  };
7495
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
+ }
7496
7522
  function md(t) {
7497
7523
  return {
7498
- get: hd(t),
7499
- set: pd(t)
7524
+ get: ud(t),
7525
+ create: pd(t),
7526
+ update: hd(t)
7500
7527
  };
7501
7528
  }
7502
7529
  function fd(t) {
@@ -8425,12 +8452,12 @@ class vd extends gd {
8425
8452
  ht(this, at, n);
8426
8453
  }
8427
8454
  transformNodeImpl(n) {
8428
- if (!C(this, L, jr).call(this, n))
8455
+ if (!T(this, L, jr).call(this, n))
8429
8456
  return super.transformNodeImpl(n);
8430
- const r = C(this, L, Zr).call(this, n);
8457
+ const r = T(this, L, Zr).call(this, n);
8431
8458
  for (const o of r)
8432
8459
  v(this, Re).add(o);
8433
- const a = C(this, L, Ir).call(this, n);
8460
+ const a = T(this, L, Ir).call(this, n);
8434
8461
  for (const o of a)
8435
8462
  v(this, De).add(o);
8436
8463
  const s = super.transformNodeImpl(n);
@@ -8459,19 +8486,19 @@ at = new WeakMap(), De = new WeakMap(), Re = new WeakMap(), L = new WeakSet(), j
8459
8486
  return n.kind in yd;
8460
8487
  }, Ir = function(n) {
8461
8488
  const r = /* @__PURE__ */ new Set();
8462
- if ("name" in n && n.name && An.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)
8463
8490
  for (const a of n.from.froms)
8464
- C(this, L, Ye).call(this, a, r);
8465
- 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)
8466
8493
  for (const a of n.joins)
8467
- C(this, L, Ye).call(this, a.table, r);
8468
- 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;
8469
8496
  }, Zr = function(n) {
8470
8497
  const r = /* @__PURE__ */ new Set();
8471
- 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;
8472
8499
  }, Ye = function(n, r) {
8473
8500
  const a = Nn.is(n) ? n : _d.is(n) && Nn.is(n.node) ? n.node : null;
8474
- a && C(this, L, Dn).call(this, a.table, r);
8501
+ a && T(this, L, Dn).call(this, a.table, r);
8475
8502
  }, Dn = function(n, r) {
8476
8503
  const a = n.identifier.name;
8477
8504
  !v(this, De).has(a) && !v(this, Re).has(a) && r.add(a);
@@ -8504,7 +8531,7 @@ class wd {
8504
8531
  }
8505
8532
  }
8506
8533
  const xd = "kysely_migration", Xn = "kysely_migration_lock", Nd = !1, kn = "migration_lock", kd = z({ __noMigrations__: !0 });
8507
- var P, m, vt, ue, he, Xe, Pr, pe, Ar, 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;
8508
8535
  class $r {
8509
8536
  constructor(e) {
8510
8537
  re(this, m);
@@ -8517,8 +8544,8 @@ class $r {
8517
8544
  * The returned array is sorted by migration name.
8518
8545
  */
8519
8546
  async getMigrations() {
8520
- const e = await C(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() : [];
8521
- 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 }) => {
8522
8549
  const s = e.find((o) => o.name === r);
8523
8550
  return {
8524
8551
  name: r,
@@ -8575,7 +8602,7 @@ class $r {
8575
8602
  * ```
8576
8603
  */
8577
8604
  async migrateToLatest() {
8578
- 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 }));
8579
8606
  }
8580
8607
  /**
8581
8608
  * Migrate up/down to a specific migration.
@@ -8601,7 +8628,7 @@ class $r {
8601
8628
  * ```
8602
8629
  */
8603
8630
  async migrateTo(e) {
8604
- 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 }) => {
8605
8632
  if (e === kd)
8606
8633
  return { direction: "Down", step: 1 / 0 };
8607
8634
  if (!n.find((d) => d.name === e))
@@ -8632,7 +8659,7 @@ class $r {
8632
8659
  * ```
8633
8660
  */
8634
8661
  async migrateUp() {
8635
- return C(this, m, vt).call(this, () => ({ direction: "Up", step: 1 }));
8662
+ return T(this, m, vt).call(this, () => ({ direction: "Up", step: 1 }));
8636
8663
  }
8637
8664
  /**
8638
8665
  * Migrate one step down.
@@ -8649,14 +8676,14 @@ class $r {
8649
8676
  * ```
8650
8677
  */
8651
8678
  async migrateDown() {
8652
- return C(this, m, vt).call(this, () => ({ direction: "Down", step: 1 }));
8679
+ return T(this, m, vt).call(this, () => ({ direction: "Down", step: 1 }));
8653
8680
  }
8654
8681
  }
8655
8682
  P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8656
8683
  try {
8657
- return await C(this, m, Ar).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);
8658
8685
  } catch (n) {
8659
- return n instanceof Tn ? n.resultSet : { error: n };
8686
+ return n instanceof Cn ? n.resultSet : { error: n };
8660
8687
  }
8661
8688
  }, ue = function() {
8662
8689
  return v(this, P).migrationTableSchema;
@@ -8669,37 +8696,37 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8669
8696
  }, pe = function() {
8670
8697
  return v(this, m, ue) ? new bd(v(this, m, ue)) : new wd();
8671
8698
  }, Ar = async function() {
8672
- 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);
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);
8673
8700
  }, Dr = async function() {
8674
- 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))
8675
8702
  try {
8676
- await C(this, m, bt).call(this, v(this, P).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)));
8677
8704
  } catch (e) {
8678
- if (!await C(this, m, Rn).call(this))
8705
+ if (!await T(this, m, Rn).call(this))
8679
8706
  throw e;
8680
8707
  }
8681
8708
  }, Rr = async function() {
8682
- 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)))
8683
8710
  try {
8684
- v(this, m, ue) && await C(this, m, bt).call(this, v(this, P).db.schema.createSchema(v(this, m, ue))), await C(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()));
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()));
8685
8712
  } catch (e) {
8686
- 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)))
8687
8714
  throw e;
8688
8715
  }
8689
8716
  }, Mr = async function() {
8690
- 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)))
8691
8718
  try {
8692
- await C(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)));
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)));
8693
8720
  } catch (e) {
8694
- 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)))
8695
8722
  throw e;
8696
8723
  }
8697
8724
  }, Lr = async function() {
8698
- if (!await C(this, m, Mn).call(this))
8725
+ if (!await T(this, m, Mn).call(this))
8699
8726
  try {
8700
8727
  await v(this, P).db.withPlugin(v(this, m, pe)).insertInto(v(this, m, Xe)).values({ id: kn, is_locked: 0 }).execute();
8701
8728
  } catch (e) {
8702
- if (!await C(this, m, Mn).call(this))
8729
+ if (!await T(this, m, Mn).call(this))
8703
8730
  throw e;
8704
8731
  }
8705
8732
  }, Rn = async function() {
@@ -8719,20 +8746,20 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8719
8746
  }), a = async (s) => {
8720
8747
  try {
8721
8748
  await n.acquireMigrationLock(s, r);
8722
- const o = await C(this, m, Ur).call(this, s);
8749
+ const o = await T(this, m, Ur).call(this, s);
8723
8750
  if (o.migrations.length === 0)
8724
8751
  return { results: [] };
8725
8752
  const { direction: d, step: c } = e(o);
8726
- 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: [] };
8727
8754
  } finally {
8728
8755
  await n.releaseMigrationLock(s, r);
8729
8756
  }
8730
8757
  };
8731
8758
  return n.supportsTransactionalDdl ? v(this, P).db.transaction().execute(a) : v(this, P).db.connection().execute(a);
8732
8759
  }, Ur = async function(e) {
8733
- const n = await C(this, m, Ln).call(this), r = await C(this, m, Vr).call(this, e);
8734
- C(this, m, Br).call(this, n, r), v(this, m, Pr) || C(this, m, Kr).call(this, n, r);
8735
- 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);
8736
8763
  return z({
8737
8764
  migrations: n,
8738
8765
  executedMigrations: r,
@@ -8757,7 +8784,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8757
8784
  for (let r = 0; r < n.length; ++r)
8758
8785
  if (e[r].name !== n[r])
8759
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.`);
8760
- }, Wr = async function(e, n, r) {
8787
+ }, Jr = async function(e, n, r) {
8761
8788
  const a = n.executedMigrations.slice().reverse().slice(0, r).map((o) => n.migrations.find((d) => d.name === o)), s = a.map((o) => ({
8762
8789
  migrationName: o.name,
8763
8790
  direction: "Down",
@@ -8776,14 +8803,14 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8776
8803
  migrationName: d.name,
8777
8804
  direction: "Down",
8778
8805
  status: "Error"
8779
- }, new Tn({
8806
+ }, new Cn({
8780
8807
  error: c,
8781
8808
  results: s
8782
8809
  });
8783
8810
  }
8784
8811
  }
8785
8812
  return { results: s };
8786
- }, Jr = async function(e, n, r) {
8813
+ }, Wr = async function(e, n, r) {
8787
8814
  const s = n.pendingMigrations.slice(0, r).map((o) => ({
8788
8815
  migrationName: o.name,
8789
8816
  direction: "Up",
@@ -8805,7 +8832,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8805
8832
  migrationName: d.name,
8806
8833
  direction: "Up",
8807
8834
  status: "Error"
8808
- }, new Tn({
8835
+ }, new Cn({
8809
8836
  error: c,
8810
8837
  results: s
8811
8838
  });
@@ -8816,7 +8843,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8816
8843
  v(this, P).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
8817
8844
  };
8818
8845
  var Gt;
8819
- class Tn extends Error {
8846
+ class Cn extends Error {
8820
8847
  constructor(n) {
8821
8848
  super();
8822
8849
  re(this, Gt);
@@ -8836,7 +8863,7 @@ class qr {
8836
8863
  return this.migrations;
8837
8864
  }
8838
8865
  }
8839
- async function Td(t) {
8866
+ async function Cd(t) {
8840
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(
8841
8868
  "tenant_id",
8842
8869
  "varchar(255)",
@@ -8904,13 +8931,13 @@ async function Td(t) {
8904
8931
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
8905
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();
8906
8933
  }
8907
- async function Cd(t) {
8934
+ async function Td(t) {
8908
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();
8909
8936
  }
8910
8937
  const Od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8911
8938
  __proto__: null,
8912
- down: Cd,
8913
- up: Td
8939
+ down: Td,
8940
+ up: Cd
8914
8941
  }, Symbol.toStringTag, { value: "Module" }));
8915
8942
  async function Sd(t) {
8916
8943
  await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
@@ -9018,14 +9045,14 @@ const Kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9018
9045
  down: Bd,
9019
9046
  up: Vd
9020
9047
  }, Symbol.toStringTag, { value: "Module" }));
9021
- async function Wd(t) {
9022
- }
9023
9048
  async function Jd(t) {
9024
9049
  }
9050
+ async function Wd(t) {
9051
+ }
9025
9052
  const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9026
9053
  __proto__: null,
9027
- down: Jd,
9028
- up: Wd
9054
+ down: Wd,
9055
+ up: Jd
9029
9056
  }, Symbol.toStringTag, { value: "Module" }));
9030
9057
  async function Qd(t) {
9031
9058
  await t.schema.alterTable("passwords").addColumn(
@@ -9138,14 +9165,14 @@ const kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9138
9165
  down: Nc,
9139
9166
  up: xc
9140
9167
  }, Symbol.toStringTag, { value: "Module" }));
9141
- async function Tc(t) {
9142
- }
9143
9168
  async function Cc(t) {
9144
9169
  }
9170
+ async function Tc(t) {
9171
+ }
9145
9172
  const Oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9146
9173
  __proto__: null,
9147
- down: Cc,
9148
- up: Tc
9174
+ down: Tc,
9175
+ up: Cc
9149
9176
  }, Symbol.toStringTag, { value: "Module" }));
9150
9177
  async function Sc(t) {
9151
9178
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
@@ -9211,16 +9238,16 @@ const Kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9211
9238
  down: Bc,
9212
9239
  up: Vc
9213
9240
  }, Symbol.toStringTag, { value: "Module" }));
9214
- async function Wc(t) {
9241
+ async function Jc(t) {
9215
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();
9216
9243
  }
9217
- async function Jc(t) {
9244
+ async function Wc(t) {
9218
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();
9219
9246
  }
9220
9247
  const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9221
9248
  __proto__: null,
9222
- down: Jc,
9223
- up: Wc
9249
+ down: Wc,
9250
+ up: Jc
9224
9251
  }, Symbol.toStringTag, { value: "Module" }));
9225
9252
  async function Qc(t) {
9226
9253
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
@@ -9335,14 +9362,14 @@ const kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9335
9362
  down: Nl,
9336
9363
  up: xl
9337
9364
  }, Symbol.toStringTag, { value: "Module" }));
9338
- async function Tl(t) {
9339
- }
9340
9365
  async function Cl(t) {
9341
9366
  }
9367
+ async function Tl(t) {
9368
+ }
9342
9369
  const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9343
9370
  __proto__: null,
9344
- down: Cl,
9345
- up: Tl
9371
+ down: Tl,
9372
+ up: Cl
9346
9373
  }, Symbol.toStringTag, { value: "Module" }));
9347
9374
  async function Sl(t) {
9348
9375
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
@@ -9412,7 +9439,7 @@ const Kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9412
9439
  down: Bl,
9413
9440
  up: Vl
9414
9441
  }, Symbol.toStringTag, { value: "Module" }));
9415
- async function Wl(t) {
9442
+ async function Jl(t) {
9416
9443
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
9417
9444
  "tenant_id",
9418
9445
  "varchar(255)",
@@ -9429,7 +9456,7 @@ async function Wl(t) {
9429
9456
  (e) => e.onDelete("cascade")
9430
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();
9431
9458
  }
9432
- async function Jl(t) {
9459
+ async function Wl(t) {
9433
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(
9434
9461
  "codes_user_id_tenant_id_constraint",
9435
9462
  ["user_id", "tenant_id"],
@@ -9440,8 +9467,8 @@ async function Jl(t) {
9440
9467
  }
9441
9468
  const ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9442
9469
  __proto__: null,
9443
- down: Jl,
9444
- up: Wl
9470
+ down: Wl,
9471
+ up: Jl
9445
9472
  }, Symbol.toStringTag, { value: "Module" }));
9446
9473
  async function Ql(t) {
9447
9474
  }
@@ -9582,16 +9609,16 @@ const ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9582
9609
  down: Nu,
9583
9610
  up: xu
9584
9611
  }, Symbol.toStringTag, { value: "Module" }));
9585
- async function Tu(t) {
9612
+ async function Cu(t) {
9586
9613
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
9587
9614
  }
9588
- async function Cu(t) {
9615
+ async function Tu(t) {
9589
9616
  await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
9590
9617
  }
9591
9618
  const Ou = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9592
9619
  __proto__: null,
9593
- down: Cu,
9594
- up: Tu
9620
+ down: Tu,
9621
+ up: Cu
9595
9622
  }, Symbol.toStringTag, { value: "Module" }));
9596
9623
  async function Su(t) {
9597
9624
  }
@@ -9667,16 +9694,16 @@ const Ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9667
9694
  down: Bu,
9668
9695
  up: Vu
9669
9696
  }, Symbol.toStringTag, { value: "Module" }));
9670
- async function Wu(t) {
9697
+ async function Ju(t) {
9671
9698
  await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
9672
9699
  }
9673
- async function Ju(t) {
9700
+ async function Wu(t) {
9674
9701
  await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
9675
9702
  }
9676
9703
  const qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9677
9704
  __proto__: null,
9678
- down: Ju,
9679
- up: Wu
9705
+ down: Wu,
9706
+ up: Ju
9680
9707
  }, Symbol.toStringTag, { value: "Module" }));
9681
9708
  async function Qu(t) {
9682
9709
  }
@@ -9699,7 +9726,7 @@ const eh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9699
9726
  up: Yu
9700
9727
  }, Symbol.toStringTag, { value: "Module" }));
9701
9728
  async function th(t) {
9702
- await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(64)").execute();
9729
+ await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
9703
9730
  }
9704
9731
  async function nh(t) {
9705
9732
  await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
@@ -9708,6 +9735,25 @@ const rh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9708
9735
  __proto__: null,
9709
9736
  down: nh,
9710
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
9711
9757
  }, Symbol.toStringTag, { value: "Module" })), Qr = {
9712
9758
  m1_init: Od,
9713
9759
  m2_magicLink: Id,
@@ -9773,9 +9819,10 @@ const rh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9773
9819
  n62_prompt: qu,
9774
9820
  n63_connection_cleanup: Hu,
9775
9821
  n64_act_as: eh,
9776
- n65_code_verifier: rh
9822
+ n65_code_verifier: rh,
9823
+ n66_email_providers: ih
9777
9824
  };
9778
- async function sh(t, e = !1) {
9825
+ async function dh(t, e = !1) {
9779
9826
  e && console.log("migrating...");
9780
9827
  const n = new qr(Qr), r = new $r({
9781
9828
  db: t,
@@ -9788,7 +9835,7 @@ async function sh(t, e = !1) {
9788
9835
  }), a)
9789
9836
  throw console.error("failed to migrate"), console.error(a), a;
9790
9837
  }
9791
- async function ih(t) {
9838
+ async function ch(t) {
9792
9839
  console.log("migrating...");
9793
9840
  const e = new qr(Qr), n = new $r({
9794
9841
  db: t,
@@ -9799,29 +9846,29 @@ async function ih(t) {
9799
9846
  }), r)
9800
9847
  throw console.error("failed to migrate"), console.error(r), r;
9801
9848
  }
9802
- function oh(t) {
9849
+ function lh(t) {
9803
9850
  return {
9804
- applications: Ti(t),
9805
- branding: Qo(t),
9806
- clients: Lo(t),
9807
- codes: vi(t),
9808
- connections: Mo(t),
9809
- domains: Wo(t),
9810
- hooks: td(t),
9811
- keys: Vo(t),
9812
- 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),
9813
9861
  logs: ei(t),
9814
- passwords: mi(t),
9815
- promptSettings: md(t),
9862
+ passwords: li(t),
9863
+ promptSettings: ld(t),
9816
9864
  users: Fs(t),
9817
9865
  sessions: ii(t),
9818
9866
  tenants: Qs(t),
9819
- themes: id(t),
9820
- tickets: li(t)
9867
+ themes: nd(t)
9821
9868
  };
9822
9869
  }
9823
9870
  export {
9824
- oh as default,
9825
- ih as migrateDown,
9826
- sh as migrateToLatest
9871
+ lh as default,
9872
+ ch as migrateDown,
9873
+ dh as migrateToLatest
9827
9874
  };