@authhero/kysely-adapter 0.26.1 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- var qa = Object.defineProperty;
1
+ var Wa = Object.defineProperty;
2
2
  var Bn = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var Qa = (t, e, n) => e in t ? qa(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var ut = (t, e, n) => Qa(t, typeof e != "symbol" ? e + "" : e, n), bn = (t, e, n) => e.has(t) || Bn("Cannot " + n);
5
+ var qa = (t, e, n) => e in t ? Wa(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
+ var ut = (t, e, n) => qa(t, typeof e != "symbol" ? e + "" : e, n), bn = (t, e, n) => e.has(t) || Bn("Cannot " + n);
7
7
  var v = (t, e, n) => (bn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), ae = (t, e, n) => e.has(t) ? Bn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), ht = (t, e, n, a) => (bn(t, e, "write to private field"), a ? a.call(t, n) : e.set(t, n), n), T = (t, e, n) => (bn(t, e, "access private method"), n);
8
8
  var Tn = class extends Error {
9
9
  constructor(e = 500, n) {
@@ -21,7 +21,7 @@ var Tn = class extends Error {
21
21
  });
22
22
  }
23
23
  };
24
- function Ga(t) {
24
+ function Qa(t) {
25
25
  return async (e, n) => {
26
26
  const { identities: a, ...r } = n, s = {
27
27
  ...r,
@@ -54,7 +54,7 @@ function R(t) {
54
54
  e[n] === null ? delete e[n] : typeof e[n] == "object" && (Array.isArray(e[n]) ? e[n] = e[n].map(R) : e[n] = R(e[n]));
55
55
  return e;
56
56
  }
57
- function Ha(t, e) {
57
+ function Ga(t, e) {
58
58
  var n = {};
59
59
  for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && e.indexOf(a) < 0 && (n[a] = t[a]);
60
60
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -62,7 +62,7 @@ function Ha(t, e) {
62
62
  e.indexOf(a[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, a[r]) && (n[a[r]] = t[a[r]]);
63
63
  return n;
64
64
  }
65
- function Ya(t, e) {
65
+ function Ha(t, e) {
66
66
  var n;
67
67
  return ((n = t == null ? void 0 : t._def) === null || n === void 0 ? void 0 : n.typeName) === e;
68
68
  }
@@ -73,15 +73,15 @@ function pt(t, e) {
73
73
  return r._def.openapi = this._def.openapi, r;
74
74
  };
75
75
  }
76
- function Xa(t) {
76
+ function Ya(t) {
77
77
  if (typeof t.ZodType.prototype.openapi < "u")
78
78
  return;
79
79
  t.ZodType.prototype.openapi = function(r, s) {
80
80
  var o, d, c, l, u, Z;
81
- const M = typeof r == "string" ? s : r, W = M ?? {}, { param: _e } = W, Je = Ha(W, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof r == "string" ? { refId: r } : 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
+ const M = typeof r == "string" ? s : r, W = M ?? {}, { param: _e } = W, Je = Ga(W, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof r == "string" ? { refId: r } : 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 ? {
82
82
  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)
83
83
  } : 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) }));
84
- if (Ya(this, "ZodObject")) {
84
+ if (Ha(this, "ZodObject")) {
85
85
  const We = this.extend;
86
86
  ve.extend = function(...qe) {
87
87
  var ee, te, ne, be, $e, Pe;
@@ -219,7 +219,7 @@ const g = E.arrayToEnum([
219
219
  "invalid_intersection_types",
220
220
  "not_multiple_of",
221
221
  "not_finite"
222
- ]), er = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
222
+ ]), Xa = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
223
223
  class K extends Error {
224
224
  constructor(e) {
225
225
  super(), this.issues = [], this.addIssue = (a) => {
@@ -337,7 +337,7 @@ const st = (t, e) => {
337
337
  return { message: n };
338
338
  };
339
339
  let Xn = st;
340
- function tr(t) {
340
+ function er(t) {
341
341
  Xn = t;
342
342
  }
343
343
  function tn() {
@@ -363,7 +363,7 @@ const nn = (t) => {
363
363
  path: s,
364
364
  message: d
365
365
  };
366
- }, nr = [];
366
+ }, tr = [];
367
367
  function f(t, e) {
368
368
  const n = tn(), a = nn({
369
369
  issueData: e,
@@ -654,14 +654,14 @@ class j {
654
654
  return this.safeParse(null).success;
655
655
  }
656
656
  }
657
- const ar = /^c[^\s-]{8,}$/i, rr = /^[0-9a-z]+$/, sr = /^[0-9A-HJKMNP-TV-Z]{26}$/, ir = /^[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, or = /^[a-z0-9_-]{21}$/i, dr = /^[-+]?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)?)??$/, cr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, lr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
657
+ const nr = /^c[^\s-]{8,}$/i, ar = /^[0-9a-z]+$/, rr = /^[0-9A-HJKMNP-TV-Z]{26}$/, sr = /^[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, ir = /^[a-z0-9_-]{21}$/i, or = /^[-+]?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)?)??$/, dr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, cr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
658
658
  let wn;
659
- const ur = /^(?:(?: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])$/, hr = /^(([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})))$/, pr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ta = "((\\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])))", mr = new RegExp(`^${ta}$`);
659
+ const lr = /^(?:(?: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])$/, ur = /^(([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})))$/, hr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ta = "((\\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])))", pr = new RegExp(`^${ta}$`);
660
660
  function na(t) {
661
661
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
662
662
  return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
663
663
  }
664
- function fr(t) {
664
+ function mr(t) {
665
665
  return new RegExp(`^${na(t)}$`);
666
666
  }
667
667
  function aa(t) {
@@ -669,8 +669,8 @@ function aa(t) {
669
669
  const n = [];
670
670
  return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
671
671
  }
672
- function _r(t, e) {
673
- return !!((e === "v4" || !e) && ur.test(t) || (e === "v6" || !e) && hr.test(t));
672
+ function fr(t, e) {
673
+ return !!((e === "v4" || !e) && lr.test(t) || (e === "v6" || !e) && ur.test(t));
674
674
  }
675
675
  class q extends j {
676
676
  _parse(e) {
@@ -721,43 +721,43 @@ class q extends j {
721
721
  message: r.message
722
722
  }), n.dirty());
723
723
  } else if (r.kind === "email")
724
- cr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
724
+ dr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
725
725
  validation: "email",
726
726
  code: h.invalid_string,
727
727
  message: r.message
728
728
  }), n.dirty());
729
729
  else if (r.kind === "emoji")
730
- wn || (wn = new RegExp(lr, "u")), wn.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
730
+ wn || (wn = new RegExp(cr, "u")), wn.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
731
731
  validation: "emoji",
732
732
  code: h.invalid_string,
733
733
  message: r.message
734
734
  }), n.dirty());
735
735
  else if (r.kind === "uuid")
736
- ir.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
736
+ sr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
737
737
  validation: "uuid",
738
738
  code: h.invalid_string,
739
739
  message: r.message
740
740
  }), n.dirty());
741
741
  else if (r.kind === "nanoid")
742
- or.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
742
+ ir.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
743
743
  validation: "nanoid",
744
744
  code: h.invalid_string,
745
745
  message: r.message
746
746
  }), n.dirty());
747
747
  else if (r.kind === "cuid")
748
- ar.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
748
+ nr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
749
749
  validation: "cuid",
750
750
  code: h.invalid_string,
751
751
  message: r.message
752
752
  }), n.dirty());
753
753
  else if (r.kind === "cuid2")
754
- rr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
754
+ ar.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
755
755
  validation: "cuid2",
756
756
  code: h.invalid_string,
757
757
  message: r.message
758
758
  }), n.dirty());
759
759
  else if (r.kind === "ulid")
760
- sr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
760
+ rr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
761
761
  validation: "ulid",
762
762
  code: h.invalid_string,
763
763
  message: r.message
@@ -792,23 +792,23 @@ class q extends j {
792
792
  code: h.invalid_string,
793
793
  validation: "datetime",
794
794
  message: r.message
795
- }), n.dirty()) : r.kind === "date" ? mr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
795
+ }), n.dirty()) : r.kind === "date" ? pr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
796
796
  code: h.invalid_string,
797
797
  validation: "date",
798
798
  message: r.message
799
- }), n.dirty()) : r.kind === "time" ? fr(r).test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
799
+ }), n.dirty()) : r.kind === "time" ? mr(r).test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
800
800
  code: h.invalid_string,
801
801
  validation: "time",
802
802
  message: r.message
803
- }), n.dirty()) : r.kind === "duration" ? dr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
803
+ }), n.dirty()) : r.kind === "duration" ? or.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
804
804
  validation: "duration",
805
805
  code: h.invalid_string,
806
806
  message: r.message
807
- }), n.dirty()) : r.kind === "ip" ? _r(e.data, r.version) || (a = this._getOrReturnCtx(e, a), f(a, {
807
+ }), n.dirty()) : r.kind === "ip" ? fr(e.data, r.version) || (a = this._getOrReturnCtx(e, a), f(a, {
808
808
  validation: "ip",
809
809
  code: h.invalid_string,
810
810
  message: r.message
811
- }), n.dirty()) : r.kind === "base64" ? pr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
811
+ }), n.dirty()) : r.kind === "base64" ? hr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
812
812
  validation: "base64",
813
813
  code: h.invalid_string,
814
814
  message: r.message
@@ -1030,7 +1030,7 @@ q.create = (t) => {
1030
1030
  ...O(t)
1031
1031
  });
1032
1032
  };
1033
- function gr(t, e) {
1033
+ function _r(t, e) {
1034
1034
  const n = (t.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, r = n > a ? n : a, s = parseInt(t.toFixed(r).replace(".", "")), o = parseInt(e.toFixed(r).replace(".", ""));
1035
1035
  return s % o / Math.pow(10, r);
1036
1036
  }
@@ -1069,7 +1069,7 @@ class ke extends j {
1069
1069
  inclusive: r.inclusive,
1070
1070
  exact: !1,
1071
1071
  message: r.message
1072
- }), a.dirty()) : r.kind === "multipleOf" ? gr(e.data, r.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
1072
+ }), a.dirty()) : r.kind === "multipleOf" ? _r(e.data, r.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
1073
1073
  code: h.not_multiple_of,
1074
1074
  multipleOf: r.value,
1075
1075
  message: r.message
@@ -2770,7 +2770,7 @@ cn.create = (t) => new cn({
2770
2770
  typeName: x.ZodNaN,
2771
2771
  ...O(t)
2772
2772
  });
2773
- const yr = Symbol("zod_brand");
2773
+ const gr = Symbol("zod_brand");
2774
2774
  class zn extends j {
2775
2775
  _parse(e) {
2776
2776
  const { ctx: n } = this._processInputParams(e), a = n.data;
@@ -2847,16 +2847,16 @@ function sa(t, e = {}, n) {
2847
2847
  }
2848
2848
  }) : it.create();
2849
2849
  }
2850
- const vr = {
2850
+ const yr = {
2851
2851
  object: A.lazycreate
2852
2852
  };
2853
2853
  var x;
2854
2854
  (function(t) {
2855
2855
  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";
2856
2856
  })(x || (x = {}));
2857
- const br = (t, e = {
2857
+ const vr = (t, e = {
2858
2858
  message: `Input not instance of ${t.name}`
2859
- }) => sa((n) => n instanceof t, e), ia = q.create, oa = ke.create, wr = cn.create, xr = Ce.create, da = Nt.create, Nr = ze.create, kr = sn.create, Cr = kt.create, Tr = Ct.create, Or = it.create, Sr = Re.create, jr = me.create, Ir = on.create, Zr = G.create, Er = A.create, $r = A.strictCreate, Pr = Tt.create, Ar = yn.create, Dr = Ot.create, Mr = oe.create, Rr = St.create, Lr = dn.create, zr = Ue.create, Ur = nt.create, Fr = jt.create, Vr = It.create, Br = Te.create, Kr = Zt.create, Jr = ot.create, Jn = Y.create, Wr = re.create, qr = Oe.create, Qr = Y.createWithPreprocess, Gr = Ht.create, Hr = () => ia().optional(), Yr = () => oa().optional(), Xr = () => da().optional(), es = {
2859
+ }) => sa((n) => n instanceof t, e), ia = q.create, oa = ke.create, br = cn.create, wr = Ce.create, da = Nt.create, xr = ze.create, Nr = sn.create, kr = kt.create, Cr = Ct.create, Tr = it.create, Or = Re.create, Sr = me.create, jr = on.create, Ir = G.create, Zr = A.create, Er = A.strictCreate, $r = Tt.create, Pr = yn.create, Ar = Ot.create, Dr = oe.create, Mr = St.create, Rr = dn.create, Lr = Ue.create, zr = nt.create, Ur = jt.create, Fr = It.create, Vr = Te.create, Br = Zt.create, Kr = ot.create, Jn = Y.create, Jr = re.create, Wr = Oe.create, qr = Y.createWithPreprocess, Qr = Ht.create, Gr = () => ia().optional(), Hr = () => oa().optional(), Yr = () => da().optional(), Xr = {
2860
2860
  string: (t) => q.create({ ...t, coerce: !0 }),
2861
2861
  number: (t) => ke.create({ ...t, coerce: !0 }),
2862
2862
  boolean: (t) => Nt.create({
@@ -2865,14 +2865,14 @@ const br = (t, e = {
2865
2865
  }),
2866
2866
  bigint: (t) => Ce.create({ ...t, coerce: !0 }),
2867
2867
  date: (t) => ze.create({ ...t, coerce: !0 })
2868
- }, ts = C;
2868
+ }, es = C;
2869
2869
  var i = /* @__PURE__ */ Object.freeze({
2870
2870
  __proto__: null,
2871
2871
  defaultErrorMap: st,
2872
- setErrorMap: tr,
2872
+ setErrorMap: er,
2873
2873
  getErrorMap: tn,
2874
2874
  makeIssue: nn,
2875
- EMPTY_PATH: nr,
2875
+ EMPTY_PATH: tr,
2876
2876
  addIssueToContext: f,
2877
2877
  ParseStatus: U,
2878
2878
  INVALID: C,
@@ -2926,63 +2926,63 @@ var i = /* @__PURE__ */ Object.freeze({
2926
2926
  ZodDefault: Et,
2927
2927
  ZodCatch: $t,
2928
2928
  ZodNaN: cn,
2929
- BRAND: yr,
2929
+ BRAND: gr,
2930
2930
  ZodBranded: zn,
2931
2931
  ZodPipeline: Ht,
2932
2932
  ZodReadonly: Pt,
2933
2933
  custom: sa,
2934
2934
  Schema: j,
2935
2935
  ZodSchema: j,
2936
- late: vr,
2936
+ late: yr,
2937
2937
  get ZodFirstPartyTypeKind() {
2938
2938
  return x;
2939
2939
  },
2940
- coerce: es,
2941
- any: Or,
2942
- array: Zr,
2943
- bigint: xr,
2940
+ coerce: Xr,
2941
+ any: Tr,
2942
+ array: Ir,
2943
+ bigint: wr,
2944
2944
  boolean: da,
2945
- date: Nr,
2946
- discriminatedUnion: Ar,
2945
+ date: xr,
2946
+ discriminatedUnion: Pr,
2947
2947
  effect: Jn,
2948
- enum: Br,
2949
- function: Ur,
2950
- instanceof: br,
2951
- intersection: Dr,
2952
- lazy: Fr,
2953
- literal: Vr,
2954
- map: Lr,
2955
- nan: wr,
2956
- nativeEnum: Kr,
2957
- never: jr,
2958
- null: Tr,
2959
- nullable: qr,
2948
+ enum: Vr,
2949
+ function: zr,
2950
+ instanceof: vr,
2951
+ intersection: Ar,
2952
+ lazy: Ur,
2953
+ literal: Fr,
2954
+ map: Rr,
2955
+ nan: br,
2956
+ nativeEnum: Br,
2957
+ never: Sr,
2958
+ null: Cr,
2959
+ nullable: Wr,
2960
2960
  number: oa,
2961
- object: Er,
2962
- oboolean: Xr,
2963
- onumber: Yr,
2964
- optional: Wr,
2965
- ostring: Hr,
2966
- pipeline: Gr,
2967
- preprocess: Qr,
2968
- promise: Jr,
2969
- record: Rr,
2970
- set: zr,
2971
- strictObject: $r,
2961
+ object: Zr,
2962
+ oboolean: Yr,
2963
+ onumber: Hr,
2964
+ optional: Jr,
2965
+ ostring: Gr,
2966
+ pipeline: Qr,
2967
+ preprocess: qr,
2968
+ promise: Kr,
2969
+ record: Mr,
2970
+ set: Lr,
2971
+ strictObject: Er,
2972
2972
  string: ia,
2973
- symbol: kr,
2973
+ symbol: Nr,
2974
2974
  transformer: Jn,
2975
- tuple: Mr,
2976
- undefined: Cr,
2977
- union: Pr,
2978
- unknown: Sr,
2979
- void: Ir,
2980
- NEVER: ts,
2975
+ tuple: Dr,
2976
+ undefined: kr,
2977
+ union: $r,
2978
+ unknown: Or,
2979
+ void: jr,
2980
+ NEVER: es,
2981
2981
  ZodIssueCode: h,
2982
- quotelessJson: er,
2982
+ quotelessJson: Xa,
2983
2983
  ZodError: K
2984
2984
  });
2985
- Xa(i);
2985
+ Ya(i);
2986
2986
  i.object({
2987
2987
  start: i.number(),
2988
2988
  limit: i.number(),
@@ -2991,7 +2991,7 @@ i.object({
2991
2991
  const Un = i.object({
2992
2992
  created_at: i.string(),
2993
2993
  updated_at: i.string()
2994
- }), ns = i.object({
2994
+ }), ts = i.object({
2995
2995
  email: i.string().optional(),
2996
2996
  email_verified: i.boolean().optional(),
2997
2997
  name: i.string().optional(),
@@ -3000,7 +3000,7 @@ const Un = i.object({
3000
3000
  phone_number: i.string().optional(),
3001
3001
  phone_verified: i.boolean().optional(),
3002
3002
  family_name: i.string().optional()
3003
- }).catchall(i.any()), as = i.object({
3003
+ }).catchall(i.any()), ns = i.object({
3004
3004
  connection: i.string(),
3005
3005
  user_id: i.string(),
3006
3006
  provider: i.string(),
@@ -3008,7 +3008,7 @@ const Un = i.object({
3008
3008
  access_token: i.string().optional(),
3009
3009
  access_token_secret: i.string().optional(),
3010
3010
  refresh_token: i.string().optional(),
3011
- profileData: ns.optional()
3011
+ profileData: ts.optional()
3012
3012
  }), ca = i.object({
3013
3013
  email: i.string().optional(),
3014
3014
  username: i.string().optional(),
@@ -3023,7 +3023,7 @@ const Un = i.object({
3023
3023
  user_id: i.string().optional(),
3024
3024
  app_metadata: i.any().default({}).optional(),
3025
3025
  user_metadata: i.any().default({}).optional()
3026
- }), rs = ca.extend({
3026
+ }), as = ca.extend({
3027
3027
  email_verified: i.boolean().default(!1),
3028
3028
  verify_email: i.boolean().optional(),
3029
3029
  last_ip: i.string().optional(),
@@ -3034,14 +3034,14 @@ const Un = i.object({
3034
3034
  is_social: i.boolean().optional()
3035
3035
  });
3036
3036
  i.object({
3037
- ...rs.shape,
3037
+ ...as.shape,
3038
3038
  ...Un.shape,
3039
3039
  user_id: i.string(),
3040
3040
  is_social: i.boolean(),
3041
3041
  // TODO: this not might be correct if you use the username
3042
3042
  email: i.string(),
3043
3043
  login_count: i.number(),
3044
- identities: i.array(as).optional()
3044
+ identities: i.array(ns).optional()
3045
3045
  });
3046
3046
  ca.extend({
3047
3047
  email: i.string(),
@@ -3051,14 +3051,14 @@ ca.extend({
3051
3051
  last_login: i.string().optional(),
3052
3052
  user_id: i.string()
3053
3053
  }).catchall(i.any());
3054
- const ss = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3055
- let is = (t = 21) => {
3054
+ const rs = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3055
+ let ss = (t = 21) => {
3056
3056
  let e = "", n = crypto.getRandomValues(new Uint8Array(t));
3057
3057
  for (; t--; )
3058
- e += ss[n[t] & 63];
3058
+ e += rs[n[t] & 63];
3059
3059
  return e;
3060
3060
  };
3061
- const os = i.object({
3061
+ const is = i.object({
3062
3062
  audience: i.string().optional(),
3063
3063
  recipient: i.string().optional(),
3064
3064
  createUpnClaim: i.boolean().optional(),
@@ -3075,7 +3075,7 @@ const os = i.object({
3075
3075
  nameIdentifierProbes: i.array(i.string()).optional(),
3076
3076
  authnContextClassRef: i.string().optional(),
3077
3077
  mappings: i.record(i.string()).optional()
3078
- }), ds = i.object({
3078
+ }), os = i.object({
3079
3079
  id: i.string(),
3080
3080
  name: i.string(),
3081
3081
  callbacks: i.array(i.string()).default([]).optional().openapi({
@@ -3094,24 +3094,24 @@ const os = i.object({
3094
3094
  description: "Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"
3095
3095
  }),
3096
3096
  addons: i.object({
3097
- samlp: os.optional()
3097
+ samlp: is.optional()
3098
3098
  }).default({}).optional().openapi({
3099
3099
  description: "Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."
3100
3100
  }),
3101
3101
  email_validation: i.enum(["enabled", "disabled", "enforced"]).default("enforced").optional().openapi({
3102
3102
  description: "Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"
3103
3103
  }),
3104
- client_secret: i.string().default(() => is()).optional(),
3104
+ client_secret: i.string().default(() => ss()).optional(),
3105
3105
  disable_sign_ups: i.boolean().optional().default(!1).openapi({
3106
3106
  description: "Prevents users from signing up using the hosted login page. This is not available in auth0"
3107
3107
  })
3108
- }), cs = i.object({
3108
+ }), ds = i.object({
3109
3109
  created_at: i.string().transform((t) => t === null ? "" : t),
3110
3110
  updated_at: i.string().transform((t) => t === null ? "" : t),
3111
- ...ds.shape
3111
+ ...os.shape
3112
3112
  });
3113
3113
  var la = /* @__PURE__ */ ((t) => (t.TOKEN = "token", t.TOKEN_ID_TOKEN = "token id_token", t.CODE = "code", t))(la || {}), ua = /* @__PURE__ */ ((t) => (t.QUERY = "query", t.FRAGMENT = "fragment", t.FORM_POST = "form_post", t.WEB_MESSAGE = "web_message", t.SAML_POST = "saml_post", t))(ua || {}), ha = /* @__PURE__ */ ((t) => (t.S256 = "S256", t.Plain = "plain", t))(ha || {});
3114
- const ls = i.object({
3114
+ const cs = i.object({
3115
3115
  client_id: i.string(),
3116
3116
  vendor_id: i.string().optional(),
3117
3117
  act_as: i.string().optional(),
@@ -3144,7 +3144,7 @@ i.object({
3144
3144
  url: i.string()
3145
3145
  }).optional()
3146
3146
  });
3147
- const us = i.object({
3147
+ const ls = i.object({
3148
3148
  id: i.string().optional(),
3149
3149
  name: i.string(),
3150
3150
  strategy: i.string(),
@@ -3170,7 +3170,7 @@ const us = i.object({
3170
3170
  id: i.string(),
3171
3171
  created_at: i.string().transform((t) => t === null ? "" : t),
3172
3172
  updated_at: i.string().transform((t) => t === null ? "" : t)
3173
- }).extend(us.shape), hs = i.object({
3173
+ }).extend(ls.shape), us = i.object({
3174
3174
  name: i.string(),
3175
3175
  audience: i.string(),
3176
3176
  sender_email: i.string().email(),
@@ -3180,11 +3180,11 @@ const us = i.object({
3180
3180
  primary_color: i.string().optional(),
3181
3181
  secondary_color: i.string().optional(),
3182
3182
  language: i.string().optional()
3183
- }), ps = i.object({
3183
+ }), hs = i.object({
3184
3184
  created_at: i.string().transform((t) => t === null ? "" : t),
3185
3185
  updated_at: i.string().transform((t) => t === null ? "" : t),
3186
3186
  id: i.string(),
3187
- ...hs.shape
3187
+ ...us.shape
3188
3188
  });
3189
3189
  i.object({
3190
3190
  logoUrl: i.string(),
@@ -3204,7 +3204,7 @@ i.object({
3204
3204
  siteUrl: i.string().nullable(),
3205
3205
  manageSubscriptionsUrl: i.string().optional()
3206
3206
  });
3207
- const ms = i.object({
3207
+ const ps = i.object({
3208
3208
  domain: i.string(),
3209
3209
  dkim_private_key: i.string().optional(),
3210
3210
  dkim_public_key: i.string().optional(),
@@ -3212,19 +3212,19 @@ const ms = i.object({
3212
3212
  email_service: i.string().optional()
3213
3213
  });
3214
3214
  i.object({
3215
- ...cs.shape,
3216
- domains: i.array(ms),
3217
- tenant: ps,
3215
+ ...ds.shape,
3216
+ domains: i.array(ps),
3217
+ tenant: hs,
3218
3218
  connections: i.array(pa)
3219
3219
  });
3220
- const fs = i.enum([
3220
+ const ms = i.enum([
3221
3221
  "password_reset",
3222
3222
  "email_verification",
3223
3223
  "otp",
3224
3224
  "authorization_code",
3225
3225
  "oauth2_state",
3226
3226
  "ticket"
3227
- ]), _s = i.object({
3227
+ ]), fs = i.object({
3228
3228
  code_id: i.string().openapi({
3229
3229
  description: "The code that will be used in for instance an email verification flow"
3230
3230
  }),
@@ -3234,17 +3234,17 @@ const fs = i.enum([
3234
3234
  connection_id: i.string().optional().openapi({
3235
3235
  description: "The connection that the code is connected to"
3236
3236
  }),
3237
- code_type: fs,
3237
+ code_type: ms,
3238
3238
  code_verifier: i.string().optional().openapi({
3239
3239
  description: "The code verifier used in PKCE in outbound flows"
3240
3240
  }),
3241
3241
  expires_at: i.string(),
3242
3242
  used_at: i.string().optional(),
3243
3243
  user_id: i.string().optional()
3244
- }), gs = i.object({
3245
- ..._s.shape,
3244
+ }), _s = i.object({
3245
+ ...fs.shape,
3246
3246
  created_at: i.string()
3247
- }), ys = i.object({
3247
+ }), gs = i.object({
3248
3248
  domain: i.string(),
3249
3249
  dkim_private_key: i.string().optional(),
3250
3250
  dkim_public_key: i.string().optional(),
@@ -3252,10 +3252,10 @@ const fs = i.enum([
3252
3252
  email_service: i.string().optional()
3253
3253
  });
3254
3254
  Un.extend({
3255
- ...ys.shape,
3255
+ ...gs.shape,
3256
3256
  id: i.string()
3257
3257
  });
3258
- const vs = i.object({
3258
+ const ys = i.object({
3259
3259
  trigger_id: i.enum([
3260
3260
  "pre-user-signup",
3261
3261
  "post-user-registration",
@@ -3267,11 +3267,11 @@ const vs = i.object({
3267
3267
  synchronous: i.boolean().default(!1),
3268
3268
  priority: i.number().optional()
3269
3269
  });
3270
- vs.extend({
3270
+ ys.extend({
3271
3271
  ...Un.shape,
3272
3272
  hook_id: i.string()
3273
3273
  });
3274
- const bs = i.object({
3274
+ const vs = i.object({
3275
3275
  alg: i.enum([
3276
3276
  "RS256",
3277
3277
  "RS384",
@@ -3292,7 +3292,7 @@ const bs = i.object({
3292
3292
  use: i.enum(["sig", "enc"]).optional()
3293
3293
  });
3294
3294
  i.object({
3295
- keys: i.array(bs)
3295
+ keys: i.array(vs)
3296
3296
  });
3297
3297
  i.object({
3298
3298
  issuer: i.string(),
@@ -3316,23 +3316,23 @@ i.object({
3316
3316
  request_parameter_supported: i.boolean(),
3317
3317
  token_endpoint_auth_signing_alg_values_supported: i.array(i.string())
3318
3318
  });
3319
- const ws = i.object({
3319
+ const bs = i.object({
3320
3320
  auth0Client: i.string().optional(),
3321
- authParams: ls,
3321
+ authParams: cs,
3322
3322
  expires_at: i.string(),
3323
3323
  deleted_at: i.string().optional(),
3324
3324
  ip: i.string().optional(),
3325
3325
  useragent: i.string().optional()
3326
3326
  }).openapi({
3327
3327
  description: "This represents a login sesion"
3328
- }), xs = i.object({
3329
- ...ws.shape,
3328
+ }), ws = i.object({
3329
+ ...bs.shape,
3330
3330
  login_id: i.string().openapi({
3331
3331
  description: "This is is used as the state in the universal login"
3332
3332
  }),
3333
3333
  created_at: i.string(),
3334
3334
  updated_at: i.string()
3335
- }), Ns = i.enum([
3335
+ }), xs = i.enum([
3336
3336
  "cls",
3337
3337
  // CODE_LINK_SENT
3338
3338
  "fsa",
@@ -3379,15 +3379,9 @@ const ws = i.object({
3379
3379
  // SUCCESS_SILENT_AUTH,
3380
3380
  "sv",
3381
3381
  // SUCCESS_VERIFICATION_EMAIL
3382
- "svr",
3382
+ "svr"
3383
3383
  // SUCCESS_VERIFICATION_EMAIL_REQUEST
3384
- "limit_wc",
3385
- // BLOCKED_ACCOUNT_EMAIL
3386
- "limit_sul",
3387
- // BLOCKED_ACCOUNT_IP
3388
- "limit_mu"
3389
- // BLOCKED_IP_ADDRESS
3390
- ]), ks = i.object({
3384
+ ]), Ns = i.object({
3391
3385
  name: i.string(),
3392
3386
  version: i.string(),
3393
3387
  env: i.object({
@@ -3395,7 +3389,7 @@ const ws = i.object({
3395
3389
  }).optional()
3396
3390
  });
3397
3391
  i.object({
3398
- type: Ns,
3392
+ type: xs,
3399
3393
  date: i.string(),
3400
3394
  description: i.string().optional(),
3401
3395
  log_id: i.string().optional(),
@@ -3416,19 +3410,19 @@ i.object({
3416
3410
  strategy: i.string().optional(),
3417
3411
  strategy_type: i.string().optional(),
3418
3412
  hostname: i.string().optional(),
3419
- auth0_client: ks.optional()
3413
+ auth0_client: Ns.optional()
3420
3414
  });
3421
- const Cs = i.object({
3415
+ const ks = i.object({
3422
3416
  user_id: i.string(),
3423
3417
  password: i.string(),
3424
3418
  algorithm: i.enum(["bcrypt", "argon2id"]).default("argon2id")
3425
3419
  });
3426
3420
  i.object({
3427
- ...Cs.shape,
3421
+ ...ks.shape,
3428
3422
  created_at: i.string(),
3429
3423
  updated_at: i.string()
3430
3424
  });
3431
- const Ts = i.object({
3425
+ const Cs = i.object({
3432
3426
  session_id: i.string(),
3433
3427
  client_id: i.string(),
3434
3428
  expires_at: i.string(),
@@ -3438,7 +3432,7 @@ const Ts = i.object({
3438
3432
  });
3439
3433
  i.object({
3440
3434
  created_at: i.string(),
3441
- ...Ts.shape
3435
+ ...Cs.shape
3442
3436
  });
3443
3437
  i.object({
3444
3438
  kid: i.string().openapi({ description: "The key id of the signing key" }),
@@ -3473,7 +3467,7 @@ i.object({
3473
3467
  code: i.string(),
3474
3468
  state: i.string().optional()
3475
3469
  });
3476
- const Os = i.object({
3470
+ const Ts = i.object({
3477
3471
  button_border_radius: i.number(),
3478
3472
  button_border_weight: i.number(),
3479
3473
  buttons_style: i.enum(["pill"]),
@@ -3483,7 +3477,7 @@ const Os = i.object({
3483
3477
  show_widget_shadow: i.boolean(),
3484
3478
  widget_border_weight: i.number(),
3485
3479
  widget_corner_radius: i.number()
3486
- }), Ss = i.object({
3480
+ }), Os = i.object({
3487
3481
  base_focus_color: i.string(),
3488
3482
  base_hover_color: i.string(),
3489
3483
  body_text: i.string(),
@@ -3506,7 +3500,7 @@ const Os = i.object({
3506
3500
  }), Qe = i.object({
3507
3501
  bold: i.boolean(),
3508
3502
  size: i.number()
3509
- }), js = i.object({
3503
+ }), Ss = i.object({
3510
3504
  body_text: Qe,
3511
3505
  buttons_text: Qe,
3512
3506
  font_url: i.string(),
@@ -3516,28 +3510,28 @@ const Os = i.object({
3516
3510
  reference_text_size: i.number(),
3517
3511
  subtitle: Qe,
3518
3512
  title: Qe
3519
- }), Is = i.object({
3513
+ }), js = i.object({
3520
3514
  background_color: i.string(),
3521
3515
  background_image_url: i.string(),
3522
3516
  page_layout: i.enum(["center"])
3523
- }), Zs = i.object({
3517
+ }), Is = i.object({
3524
3518
  header_text_alignment: i.enum(["center"]),
3525
3519
  logo_height: i.number(),
3526
3520
  logo_position: i.enum(["center"]),
3527
3521
  logo_url: i.string(),
3528
3522
  social_buttons_layout: i.enum(["bottom"])
3529
- }), Es = i.object({
3530
- borders: Os,
3531
- colors: Ss,
3523
+ }), Zs = i.object({
3524
+ borders: Ts,
3525
+ colors: Os,
3532
3526
  displayName: i.string(),
3533
- fonts: js,
3534
- page_background: Is,
3535
- widget: Zs
3527
+ fonts: Ss,
3528
+ page_background: js,
3529
+ widget: Is
3536
3530
  });
3537
- Es.extend({
3531
+ Zs.extend({
3538
3532
  themeId: i.string()
3539
3533
  });
3540
- const $s = i.object({
3534
+ const Es = i.object({
3541
3535
  universal_login_experience: i.enum(["new", "classic"]).default("new"),
3542
3536
  identifier_first: i.boolean().default(!0),
3543
3537
  password_first: i.boolean().default(!1),
@@ -3599,7 +3593,7 @@ function ma(t) {
3599
3593
  }
3600
3594
  };
3601
3595
  }
3602
- function Ps(t) {
3596
+ function $s(t) {
3603
3597
  return async (e, n) => {
3604
3598
  const [a, r] = await Promise.all([
3605
3599
  t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", n).selectAll().executeTakeFirst(),
@@ -3667,7 +3661,7 @@ function Be(t, e, n, a) {
3667
3661
  function Ee(t) {
3668
3662
  return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
3669
3663
  }
3670
- function As(t) {
3664
+ function Ps(t) {
3671
3665
  return async (e, n) => {
3672
3666
  let a = t.selectFrom("users").where("users.tenant_id", "=", e);
3673
3667
  if (n.q && (a = Be(t, a, n.q, ["email", "name"])), n.sort && n.sort.sort_by) {
@@ -3703,48 +3697,48 @@ function As(t) {
3703
3697
  };
3704
3698
  };
3705
3699
  }
3706
- function Ds(t) {
3700
+ function As(t) {
3707
3701
  return async (e, n) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", n).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", n).execute()).length === 1);
3708
3702
  }
3709
- function Ms(t) {
3703
+ function Ds(t) {
3710
3704
  if (t.email_verified !== void 0)
3711
3705
  return t.email_verified ? 1 : 0;
3712
3706
  }
3713
- function Rs(t) {
3707
+ function Ms(t) {
3714
3708
  return async (e, n, a) => {
3715
3709
  const r = {
3716
3710
  ...a,
3717
- email_verified: Ms(a),
3711
+ email_verified: Ds(a),
3718
3712
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
3719
3713
  };
3720
3714
  return a.app_metadata && (r.app_metadata = JSON.stringify(a.app_metadata)), a.user_metadata && (r.user_metadata = JSON.stringify(a.user_metadata)), (await t.updateTable("users").set(r).where("users.tenant_id", "=", e).where("users.user_id", "=", n).execute()).length === 1;
3721
3715
  };
3722
3716
  }
3723
- function Ls(t) {
3717
+ function Rs(t) {
3724
3718
  return async (e, n, a, r) => {
3725
3719
  const s = { linked_to: null };
3726
3720
  return (await t.updateTable("users").set(s).where("users.tenant_id", "=", e).where("users.user_id", "=", `${a}|${r}`).where("users.linked_to", "=", `${n}`).execute()).length === 1;
3727
3721
  };
3728
3722
  }
3729
- function zs(t) {
3723
+ function Ls(t) {
3730
3724
  return {
3731
- create: Ga(t),
3732
- remove: Ds(t),
3733
- get: Ps(t),
3734
- list: As(t),
3735
- update: Rs(t),
3725
+ create: Qa(t),
3726
+ remove: As(t),
3727
+ get: $s(t),
3728
+ list: Ps(t),
3729
+ update: Ms(t),
3736
3730
  // TODO - think about this more when other issues fixed
3737
- unlink: Ls(t)
3731
+ unlink: Rs(t)
3738
3732
  };
3739
3733
  }
3740
- const Us = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3734
+ const zs = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3741
3735
  let Ke = (t = 21) => {
3742
3736
  let e = "", n = crypto.getRandomValues(new Uint8Array(t));
3743
3737
  for (; t--; )
3744
- e += Us[n[t] & 63];
3738
+ e += zs[n[t] & 63];
3745
3739
  return e;
3746
3740
  };
3747
- function Fs(t) {
3741
+ function Us(t) {
3748
3742
  return async (e) => {
3749
3743
  const n = {
3750
3744
  id: e.id || Ke(),
@@ -3755,13 +3749,13 @@ function Fs(t) {
3755
3749
  return await t.insertInto("tenants").values(n).execute(), n;
3756
3750
  };
3757
3751
  }
3758
- function Vs(t) {
3752
+ function Fs(t) {
3759
3753
  return async (e) => {
3760
3754
  const n = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
3761
3755
  return n ? R(n) : null;
3762
3756
  };
3763
3757
  }
3764
- function Bs(t) {
3758
+ function Vs(t) {
3765
3759
  return async (e) => {
3766
3760
  let n = t.selectFrom("tenants");
3767
3761
  if (e.sort && e.sort.sort_by) {
@@ -3783,7 +3777,7 @@ function Bs(t) {
3783
3777
  };
3784
3778
  };
3785
3779
  }
3786
- function Ks(t) {
3780
+ function Bs(t) {
3787
3781
  return async (e, n) => {
3788
3782
  const a = {
3789
3783
  ...n,
@@ -3793,29 +3787,29 @@ function Ks(t) {
3793
3787
  await t.updateTable("tenants").set(a).where("id", "=", e).execute();
3794
3788
  };
3795
3789
  }
3796
- function Js(t) {
3790
+ function Ks(t) {
3797
3791
  return async (e) => (await t.deleteFrom("tenants").where("tenants.id", "=", e).execute()).length === 1;
3798
3792
  }
3799
- function Ws(t) {
3793
+ function Js(t) {
3800
3794
  return {
3801
- create: Fs(t),
3802
- get: Vs(t),
3803
- list: Bs(t),
3804
- update: Ks(t),
3805
- remove: Js(t)
3795
+ create: Us(t),
3796
+ get: Fs(t),
3797
+ list: Vs(t),
3798
+ update: Bs(t),
3799
+ remove: Ks(t)
3806
3800
  };
3807
3801
  }
3808
3802
  function Wn(t) {
3809
3803
  return t ? JSON.stringify(t) : void 0;
3810
3804
  }
3811
- const qs = 1024;
3812
- function Qs(t) {
3805
+ const Ws = 1024;
3806
+ function qs(t) {
3813
3807
  return async (e, n) => {
3814
3808
  var r, s, o;
3815
3809
  const a = {
3816
3810
  id: Ke(),
3817
3811
  ...n,
3818
- user_agent: n.user_agent.slice(0, qs)
3812
+ user_agent: n.user_agent.slice(0, Ws)
3819
3813
  };
3820
3814
  return await t.insertInto("logs").values({
3821
3815
  ...a,
@@ -3851,7 +3845,7 @@ function fa(t) {
3851
3845
  _id: t.id
3852
3846
  };
3853
3847
  }
3854
- function Gs(t) {
3848
+ function Qs(t) {
3855
3849
  return async (e, n) => {
3856
3850
  let a = t.selectFrom("logs").where("logs.tenant_id", "=", e);
3857
3851
  n.q && (a = Be(t, a, n.q, ["user_id", "ip"]));
@@ -3873,23 +3867,23 @@ function Gs(t) {
3873
3867
  };
3874
3868
  };
3875
3869
  }
3876
- function Hs(t) {
3870
+ function Gs(t) {
3877
3871
  return async (e, n) => {
3878
3872
  const a = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", n).selectAll().executeTakeFirst();
3879
3873
  return a ? fa(a) : null;
3880
3874
  };
3881
3875
  }
3882
- function Ys(t) {
3876
+ function Hs(t) {
3883
3877
  return {
3884
- create: Qs(t),
3885
- list: Gs(t),
3886
- get: Hs(t)
3878
+ create: qs(t),
3879
+ list: Qs(t),
3880
+ get: Gs(t)
3887
3881
  };
3888
3882
  }
3889
- function Xs(t) {
3883
+ function Ys(t) {
3890
3884
  return async (e, n) => await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.session_id", "=", n).where("sessions.deleted_at", "is", null).selectAll().executeTakeFirst() ?? null;
3891
3885
  }
3892
- function ei(t) {
3886
+ function Xs(t) {
3893
3887
  return async (e, n) => {
3894
3888
  const a = {
3895
3889
  ...n,
@@ -3899,13 +3893,13 @@ function ei(t) {
3899
3893
  return await t.insertInto("sessions").values({ ...a, tenant_id: e }).execute(), { ...n, ...a };
3900
3894
  };
3901
3895
  }
3902
- function ti(t) {
3896
+ function ei(t) {
3903
3897
  return async (e, n) => !!(await t.updateTable("sessions").set({ deleted_at: (/* @__PURE__ */ new Date()).toISOString() }).where("tenant_id", "=", e).where("sessions.session_id", "=", n).where("sessions.deleted_at", "is", null).execute()).length;
3904
3898
  }
3905
- function ni(t) {
3899
+ function ti(t) {
3906
3900
  return async (e, n, a) => !!(await t.updateTable("sessions").set(a).where("tenant_id", "=", e).where("sessions.session_id", "=", n).where("sessions.deleted_at", "is", null).execute()).length;
3907
3901
  }
3908
- function ai(t) {
3902
+ function ni(t) {
3909
3903
  return async (e, n) => {
3910
3904
  let a = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
3911
3905
  n.q && (a = Be(t, a, n.q, ["user_id", "session_id"]));
@@ -3927,22 +3921,22 @@ function ai(t) {
3927
3921
  };
3928
3922
  };
3929
3923
  }
3930
- function ri(t) {
3924
+ function ai(t) {
3931
3925
  return {
3932
- create: ei(t),
3933
- get: Xs(t),
3934
- list: ai(t),
3935
- remove: ti(t),
3936
- update: ni(t)
3926
+ create: Xs(t),
3927
+ get: Ys(t),
3928
+ list: ni(t),
3929
+ remove: ei(t),
3930
+ update: ti(t)
3937
3931
  };
3938
3932
  }
3939
- function si(t) {
3933
+ function ri(t) {
3940
3934
  return async (e, n) => {
3941
3935
  const a = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", n).selectAll().executeTakeFirstOrThrow(), { tenant_id: r, ...s } = a;
3942
3936
  return s;
3943
3937
  };
3944
3938
  }
3945
- function ii(t) {
3939
+ function si(t) {
3946
3940
  return async (e, n) => {
3947
3941
  const a = {
3948
3942
  ...n,
@@ -3955,20 +3949,20 @@ function ii(t) {
3955
3949
  }).execute(), a;
3956
3950
  };
3957
3951
  }
3958
- function oi(t) {
3952
+ function ii(t) {
3959
3953
  return async (e, n) => (await t.updateTable("passwords").set({
3960
3954
  password: n.password,
3961
3955
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
3962
3956
  }).where("tenant_id", "=", e).where("user_id", "=", n.user_id).execute()).length === 1;
3963
3957
  }
3964
- function di(t) {
3958
+ function oi(t) {
3965
3959
  return {
3966
- create: ii(t),
3967
- update: oi(t),
3968
- get: si(t)
3960
+ create: si(t),
3961
+ update: ii(t),
3962
+ get: ri(t)
3969
3963
  };
3970
3964
  }
3971
- function ci(t) {
3965
+ function di(t) {
3972
3966
  return async (e, n) => {
3973
3967
  let a = t.selectFrom("codes").where("codes.tenant_id", "=", e);
3974
3968
  n.q && (a = Be(t, a, n.q, ["code", "login_id"]));
@@ -3976,7 +3970,7 @@ function ci(t) {
3976
3970
  return {
3977
3971
  codes: s.map((c) => {
3978
3972
  const { tenant_id: l, ...u } = c;
3979
- return gs.parse(R(u));
3973
+ return _s.parse(R(u));
3980
3974
  }),
3981
3975
  start: n.page * n.per_page,
3982
3976
  limit: n.per_page,
@@ -3984,7 +3978,7 @@ function ci(t) {
3984
3978
  };
3985
3979
  };
3986
3980
  }
3987
- function li(t) {
3981
+ function ci(t) {
3988
3982
  return async (e, n) => {
3989
3983
  const a = {
3990
3984
  ...n,
@@ -3996,10 +3990,10 @@ function li(t) {
3996
3990
  }).execute(), a;
3997
3991
  };
3998
3992
  }
3999
- function ui(t) {
3993
+ function li(t) {
4000
3994
  return async (e, n) => (await t.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4001
3995
  }
4002
- function hi(t) {
3996
+ function ui(t) {
4003
3997
  return async (e, n, a) => {
4004
3998
  let r = t.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", a);
4005
3999
  e.length && (r = r.where("codes.tenant_id", "=", e));
@@ -4007,19 +4001,19 @@ function hi(t) {
4007
4001
  return s ? R(s) : null;
4008
4002
  };
4009
4003
  }
4010
- function pi(t) {
4004
+ function hi(t) {
4011
4005
  return async (e, n) => (await t.updateTable("codes").set({ used_at: (/* @__PURE__ */ new Date()).toISOString() }).where("codes.tenant_id", "=", e).where("codes.code_id", "=", n).executeTakeFirst()).numUpdatedRows > 0;
4012
4006
  }
4013
- function mi(t) {
4007
+ function pi(t) {
4014
4008
  return {
4015
- create: li(t),
4016
- list: ci(t),
4017
- remove: ui(t),
4018
- used: pi(t),
4019
- get: hi(t)
4009
+ create: ci(t),
4010
+ list: di(t),
4011
+ remove: li(t),
4012
+ used: hi(t),
4013
+ get: ui(t)
4020
4014
  };
4021
4015
  }
4022
- function fi(t) {
4016
+ function mi(t) {
4023
4017
  return async (e, n) => {
4024
4018
  const a = {
4025
4019
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4039,7 +4033,7 @@ function fi(t) {
4039
4033
  }).execute(), a;
4040
4034
  };
4041
4035
  }
4042
- function _i(t) {
4036
+ function fi(t) {
4043
4037
  return async (e) => ({
4044
4038
  applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((s) => ({
4045
4039
  ...s,
@@ -4053,7 +4047,7 @@ function _i(t) {
4053
4047
  }))
4054
4048
  });
4055
4049
  }
4056
- function gi(t) {
4050
+ function _i(t) {
4057
4051
  return async (e, n) => {
4058
4052
  const a = await t.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", n).selectAll().executeTakeFirst();
4059
4053
  return a ? R({
@@ -4067,10 +4061,10 @@ function gi(t) {
4067
4061
  }) : null;
4068
4062
  };
4069
4063
  }
4070
- function yi(t) {
4064
+ function gi(t) {
4071
4065
  return async (e, n) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4072
4066
  }
4073
- function vi(t) {
4067
+ function yi(t) {
4074
4068
  return async (e, n, a) => {
4075
4069
  const r = {
4076
4070
  ...a,
@@ -4086,32 +4080,304 @@ function vi(t) {
4086
4080
  return await t.updateTable("applications").set(r).where("applications.id", "=", n).where("applications.tenant_id", "=", e).execute(), !0;
4087
4081
  };
4088
4082
  }
4089
- function bi(t) {
4083
+ function vi(t) {
4090
4084
  return {
4091
- create: fi(t),
4092
- list: _i(t),
4093
- get: gi(t),
4094
- remove: yi(t),
4095
- update: vi(t)
4085
+ create: mi(t),
4086
+ list: fi(t),
4087
+ get: _i(t),
4088
+ remove: gi(t),
4089
+ update: yi(t)
4090
+ };
4091
+ }
4092
+ function bi(t) {
4093
+ return async (e, n) => {
4094
+ const a = {
4095
+ id: Ke(),
4096
+ ...n,
4097
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
4098
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
4099
+ };
4100
+ return await t.insertInto("connections").values({
4101
+ ...a,
4102
+ // The connection options will have many different properties depending on the strategy
4103
+ options: JSON.stringify(a.options || {}),
4104
+ tenant_id: e
4105
+ }).execute(), a;
4096
4106
  };
4097
4107
  }
4098
4108
  function wi(t) {
4109
+ return async (e, n) => {
4110
+ let a = t.selectFrom("connections").where("connections.tenant_id", "=", e);
4111
+ n.q && (a = Be(t, a, n.q, ["user_id", "ip"]));
4112
+ const o = (await a.offset(n.page * n.per_page).limit(n.per_page).selectAll().execute()).map(
4113
+ (c) => R({
4114
+ ...c,
4115
+ options: JSON.parse(c.options)
4116
+ })
4117
+ ), { count: d } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
4118
+ return {
4119
+ connections: o,
4120
+ start: n.page * n.per_page,
4121
+ limit: n.per_page,
4122
+ length: Ee(d)
4123
+ };
4124
+ };
4125
+ }
4126
+ function xi(t) {
4127
+ return async (e, n) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4128
+ }
4129
+ function Ni(t) {
4130
+ return async (e, n) => {
4131
+ const a = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
4132
+ return a ? R({
4133
+ ...a,
4134
+ options: JSON.parse(a.options)
4135
+ }) : null;
4136
+ };
4137
+ }
4138
+ function ki(t) {
4139
+ return async (e, n, a) => {
4140
+ const r = {
4141
+ ...a,
4142
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
4143
+ };
4144
+ return await t.updateTable("connections").set({
4145
+ ...r,
4146
+ options: r.options ? JSON.stringify(r.options) : void 0
4147
+ }).where("connections.id", "=", n).where("connections.tenant_id", "=", e).execute(), !0;
4148
+ };
4149
+ }
4150
+ function Ci(t) {
4151
+ return {
4152
+ create: bi(t),
4153
+ get: Ni(t),
4154
+ list: wi(t),
4155
+ remove: xi(t),
4156
+ update: ki(t)
4157
+ };
4158
+ }
4159
+ function Ti(t) {
4160
+ return {
4161
+ get: async (e) => {
4162
+ const n = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
4163
+ if (!n)
4164
+ return null;
4165
+ const a = await t.selectFrom("tenants").selectAll().where("id", "=", n.tenant_id).executeTakeFirst();
4166
+ if (!a)
4167
+ throw new Tn(404, { message: "Tenant not found" });
4168
+ const r = 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();
4169
+ return {
4170
+ ...n,
4171
+ connections: r.map(
4172
+ (d) => pa.parse(
4173
+ R({
4174
+ ...d,
4175
+ options: d.options ? JSON.parse(d.options) : {}
4176
+ })
4177
+ )
4178
+ ),
4179
+ domains: s,
4180
+ addons: n.addons ? JSON.parse(n.addons) : {},
4181
+ callbacks: n.callbacks ? JSON.parse(n.callbacks) : [],
4182
+ allowed_origins: n.allowed_origins ? JSON.parse(n.allowed_origins) : [],
4183
+ web_origins: n.web_origins ? JSON.parse(n.web_origins) : [],
4184
+ allowed_logout_urls: n.allowed_logout_urls ? JSON.parse(n.allowed_logout_urls) : [],
4185
+ allowed_clients: n.allowed_clients ? JSON.parse(n.allowed_clients) : [],
4186
+ tenant: R(a),
4187
+ // this is really an integer in the database
4188
+ disable_sign_ups: !!n.disable_sign_ups
4189
+ };
4190
+ }
4191
+ };
4192
+ }
4193
+ function Oi(t) {
4194
+ return async () => await t.selectFrom("keys").where(
4195
+ (n) => n.or([
4196
+ n("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
4197
+ n("revoked_at", "is", null)
4198
+ ])
4199
+ ).selectAll().execute();
4200
+ }
4201
+ function Si(t) {
4202
+ return async (e) => {
4203
+ await t.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
4204
+ };
4205
+ }
4206
+ function ji(t) {
4207
+ return async (e, n) => !!(await t.updateTable("keys").set(n).where("kid", "=", e).execute()).length;
4208
+ }
4209
+ function Ii(t) {
4210
+ return {
4211
+ create: Si(t),
4212
+ list: Oi(t),
4213
+ update: ji(t)
4214
+ };
4215
+ }
4216
+ function Zi(t) {
4099
4217
  return async (e, n) => {
4100
4218
  const a = {
4219
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
4220
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
4221
+ tenant_id: e,
4101
4222
  id: Ke(),
4223
+ ...n
4224
+ };
4225
+ return await t.insertInto("domains").values(a).execute(), a;
4226
+ };
4227
+ }
4228
+ function Ei(t) {
4229
+ return async (e, n) => {
4230
+ let a = t.selectFrom("domains").where("domains.tenant_id", "=", e);
4231
+ n.q && (a = Be(t, a, n.q, ["user_id", "ip"]));
4232
+ const s = await a.offset(n.page * n.per_page).limit(n.per_page).selectAll().execute(), { count: o } = await a.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
4233
+ return {
4234
+ domains: s,
4235
+ start: n.page * n.per_page,
4236
+ limit: n.per_page,
4237
+ length: Ee(o)
4238
+ };
4239
+ };
4240
+ }
4241
+ function $i(t) {
4242
+ return {
4243
+ create: Zi(t),
4244
+ list: Ei(t)
4245
+ };
4246
+ }
4247
+ function Pi(t) {
4248
+ return async (e) => {
4249
+ const [n] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
4250
+ if (!n)
4251
+ return null;
4252
+ const {
4253
+ tenant_id: a,
4254
+ colors_primary: r,
4255
+ colors_page_background_type: s,
4256
+ colors_page_background_start: o,
4257
+ colors_page_background_end: d,
4258
+ colors_page_background_angle_dev: c,
4259
+ font_url: l,
4260
+ ...u
4261
+ } = n;
4262
+ return R({
4263
+ ...u,
4264
+ colors: {
4265
+ primary: r,
4266
+ page_background: {
4267
+ type: s,
4268
+ start: o,
4269
+ end: d,
4270
+ angle_deg: c
4271
+ }
4272
+ },
4273
+ font: l ? { url: l } : void 0
4274
+ });
4275
+ };
4276
+ }
4277
+ function Ai(t) {
4278
+ return async (e, n) => {
4279
+ var o, d, c, l, u, Z, M, W, _e, Je, ge, ye, ve, We, qe, ee, te, ne;
4280
+ const { colors: a, font: r, ...s } = n;
4281
+ try {
4282
+ await t.insertInto("branding").values({
4283
+ ...s,
4284
+ colors_primary: a == null ? void 0 : a.primary,
4285
+ colors_page_background_type: (d = (o = n.colors) == null ? void 0 : o.page_background) == null ? void 0 : d.type,
4286
+ colors_page_background_start: (l = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : l.start,
4287
+ colors_page_background_end: (Z = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : Z.end,
4288
+ colors_page_background_angle_dev: (W = (M = n.colors) == null ? void 0 : M.page_background) == null ? void 0 : W.angle_deg,
4289
+ font_url: (_e = n.font) == null ? void 0 : _e.url,
4290
+ tenant_id: e
4291
+ }).execute();
4292
+ } catch {
4293
+ await t.updateTable("branding").set({
4294
+ ...s,
4295
+ colors_primary: a == null ? void 0 : a.primary,
4296
+ colors_page_background_type: (ge = (Je = n.colors) == null ? void 0 : Je.page_background) == null ? void 0 : ge.type,
4297
+ colors_page_background_start: (ve = (ye = n.colors) == null ? void 0 : ye.page_background) == null ? void 0 : ve.start,
4298
+ colors_page_background_end: (qe = (We = n.colors) == null ? void 0 : We.page_background) == null ? void 0 : qe.end,
4299
+ colors_page_background_angle_dev: (te = (ee = n.colors) == null ? void 0 : ee.page_background) == null ? void 0 : te.angle_deg,
4300
+ font_url: (ne = n.font) == null ? void 0 : ne.url
4301
+ }).where("tenant_id", "=", e).execute();
4302
+ }
4303
+ };
4304
+ }
4305
+ function Di(t) {
4306
+ return {
4307
+ get: Pi(t),
4308
+ set: Ai(t)
4309
+ };
4310
+ }
4311
+ function Mi(t) {
4312
+ return async (e, n) => {
4313
+ let a = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
4314
+ n.q && (a = Be(t, a, n.q, ["url"]));
4315
+ const s = await a.offset(n.page * n.per_page).limit(n.per_page).selectAll().execute(), { count: o } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
4316
+ return {
4317
+ hooks: s.map((c) => {
4318
+ const { tenant_id: l, enabled: u, synchronous: Z, ...M } = c;
4319
+ return R({
4320
+ ...M,
4321
+ enabled: !!u,
4322
+ synchronous: !!Z
4323
+ });
4324
+ }),
4325
+ start: n.page * n.per_page,
4326
+ limit: n.per_page,
4327
+ length: Ee(o)
4328
+ };
4329
+ };
4330
+ }
4331
+ function Ri(t) {
4332
+ return async (e, n) => {
4333
+ const a = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
4334
+ return a ? R({
4335
+ ...a,
4336
+ enabled: !!a.enabled,
4337
+ synchronous: !!a.synchronous
4338
+ }) : null;
4339
+ };
4340
+ }
4341
+ function Li(t) {
4342
+ return async (e, n) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
4343
+ }
4344
+ function zi(t) {
4345
+ return async (e, n) => {
4346
+ const a = {
4347
+ hook_id: Ke(),
4102
4348
  ...n,
4103
4349
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
4104
4350
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
4105
4351
  };
4106
- return await t.insertInto("connections").values({
4107
- ...a,
4108
- // The connection options will have many different properties depending on the strategy
4109
- options: JSON.stringify(a.options || {}),
4110
- tenant_id: e
4111
- }).execute(), a;
4352
+ return await t.insertInto("hooks").values({
4353
+ ...a,
4354
+ tenant_id: e,
4355
+ enabled: n.enabled ? 1 : 0,
4356
+ synchronous: n.synchronous ? 1 : 0
4357
+ }).execute(), a;
4358
+ };
4359
+ }
4360
+ function Ui(t) {
4361
+ return async (e, n, a) => {
4362
+ const r = {
4363
+ ...a,
4364
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
4365
+ enabled: a.enabled !== void 0 ? a.enabled ? 1 : 0 : void 0,
4366
+ synchronous: a.enabled !== void 0 ? a.synchronous ? 1 : 0 : void 0
4367
+ };
4368
+ return await t.updateTable("hooks").set(r).where("hooks.hook_id", "=", n).where("hooks.tenant_id", "=", e).execute(), !0;
4369
+ };
4370
+ }
4371
+ function Fi(t) {
4372
+ return {
4373
+ create: zi(t),
4374
+ get: Ri(t),
4375
+ list: Mi(t),
4376
+ update: Ui(t),
4377
+ remove: Li(t)
4112
4378
  };
4113
4379
  }
4114
- function xi(t, e) {
4380
+ function Vi(t, e) {
4115
4381
  var n = {};
4116
4382
  for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && e.indexOf(a) < 0 && (n[a] = t[a]);
4117
4383
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -4119,7 +4385,7 @@ function xi(t, e) {
4119
4385
  e.indexOf(a[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, a[r]) && (n[a[r]] = t[a[r]]);
4120
4386
  return n;
4121
4387
  }
4122
- function Ni(t, e) {
4388
+ function Bi(t, e) {
4123
4389
  var n;
4124
4390
  return ((n = t == null ? void 0 : t._def) === null || n === void 0 ? void 0 : n.typeName) === e;
4125
4391
  }
@@ -4130,15 +4396,15 @@ function mt(t, e) {
4130
4396
  return r._def.openapi = this._def.openapi, r;
4131
4397
  };
4132
4398
  }
4133
- function ki(t) {
4399
+ function Ki(t) {
4134
4400
  if (typeof t.ZodType.prototype.openapi < "u")
4135
4401
  return;
4136
4402
  t.ZodType.prototype.openapi = function(r, s) {
4137
4403
  var o, d, c, l, u, Z;
4138
- const M = typeof r == "string" ? s : r, W = M ?? {}, { param: _e } = W, Je = xi(W, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof r == "string" ? { refId: r } : 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 ? {
4404
+ const M = typeof r == "string" ? s : r, W = M ?? {}, { param: _e } = W, Je = Vi(W, ["param"]), ge = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof r == "string" ? { refId: r } : 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 ? {
4139
4405
  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)
4140
4406
  } : 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) }));
4141
- if (Ni(this, "ZodObject")) {
4407
+ if (Bi(this, "ZodObject")) {
4142
4408
  const We = this.extend;
4143
4409
  ve.extend = function(...qe) {
4144
4410
  var ee, te, ne, be, $e, Pe;
@@ -4276,7 +4542,7 @@ const y = $.arrayToEnum([
4276
4542
  "invalid_intersection_types",
4277
4543
  "not_multiple_of",
4278
4544
  "not_finite"
4279
- ]), Ci = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
4545
+ ]), Ji = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
4280
4546
  class J extends Error {
4281
4547
  constructor(e) {
4282
4548
  super(), this.issues = [], this.addIssue = (a) => {
@@ -4394,7 +4660,7 @@ const dt = (t, e) => {
4394
4660
  return { message: n };
4395
4661
  };
4396
4662
  let _a = dt;
4397
- function Ti(t) {
4663
+ function Wi(t) {
4398
4664
  _a = t;
4399
4665
  }
4400
4666
  function ln() {
@@ -4420,7 +4686,7 @@ const un = (t) => {
4420
4686
  path: s,
4421
4687
  message: d
4422
4688
  };
4423
- }, Oi = [];
4689
+ }, qi = [];
4424
4690
  function _(t, e) {
4425
4691
  const n = ln(), a = un({
4426
4692
  issueData: e,
@@ -4711,14 +4977,14 @@ class I {
4711
4977
  return this.safeParse(null).success;
4712
4978
  }
4713
4979
  }
4714
- const Si = /^c[^\s-]{8,}$/i, ji = /^[0-9a-z]+$/, Ii = /^[0-9A-HJKMNP-TV-Z]{26}$/, Zi = /^[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, Ei = /^[a-z0-9_-]{21}$/i, $i = /^[-+]?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)?)??$/, Pi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ai = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
4980
+ const Qi = /^c[^\s-]{8,}$/i, Gi = /^[0-9a-z]+$/, Hi = /^[0-9A-HJKMNP-TV-Z]{26}$/, Yi = /^[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, Xi = /^[a-z0-9_-]{21}$/i, eo = /^[-+]?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)?)??$/, to = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, no = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
4715
4981
  let xn;
4716
- const Di = /^(?:(?: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})))$/, Ri = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ya = "((\\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])))", Li = new RegExp(`^${ya}$`);
4982
+ const ao = /^(?:(?: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])$/, ro = /^(([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})))$/, so = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ya = "((\\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])))", io = new RegExp(`^${ya}$`);
4717
4983
  function va(t) {
4718
4984
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
4719
4985
  return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
4720
4986
  }
4721
- function zi(t) {
4987
+ function oo(t) {
4722
4988
  return new RegExp(`^${va(t)}$`);
4723
4989
  }
4724
4990
  function ba(t) {
@@ -4726,8 +4992,8 @@ function ba(t) {
4726
4992
  const n = [];
4727
4993
  return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
4728
4994
  }
4729
- function Ui(t, e) {
4730
- return !!((e === "v4" || !e) && Di.test(t) || (e === "v6" || !e) && Mi.test(t));
4995
+ function co(t, e) {
4996
+ return !!((e === "v4" || !e) && ao.test(t) || (e === "v6" || !e) && ro.test(t));
4731
4997
  }
4732
4998
  class Q extends I {
4733
4999
  _parse(e) {
@@ -4778,43 +5044,43 @@ class Q extends I {
4778
5044
  message: s.message
4779
5045
  }), a.dirty());
4780
5046
  } else if (s.kind === "email")
4781
- Pi.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5047
+ to.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4782
5048
  validation: "email",
4783
5049
  code: p.invalid_string,
4784
5050
  message: s.message
4785
5051
  }), a.dirty());
4786
5052
  else if (s.kind === "emoji")
4787
- xn || (xn = new RegExp(Ai, "u")), xn.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5053
+ xn || (xn = new RegExp(no, "u")), xn.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4788
5054
  validation: "emoji",
4789
5055
  code: p.invalid_string,
4790
5056
  message: s.message
4791
5057
  }), a.dirty());
4792
5058
  else if (s.kind === "uuid")
4793
- Zi.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5059
+ Yi.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4794
5060
  validation: "uuid",
4795
5061
  code: p.invalid_string,
4796
5062
  message: s.message
4797
5063
  }), a.dirty());
4798
5064
  else if (s.kind === "nanoid")
4799
- Ei.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5065
+ Xi.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4800
5066
  validation: "nanoid",
4801
5067
  code: p.invalid_string,
4802
5068
  message: s.message
4803
5069
  }), a.dirty());
4804
5070
  else if (s.kind === "cuid")
4805
- Si.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5071
+ Qi.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4806
5072
  validation: "cuid",
4807
5073
  code: p.invalid_string,
4808
5074
  message: s.message
4809
5075
  }), a.dirty());
4810
5076
  else if (s.kind === "cuid2")
4811
- ji.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5077
+ Gi.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4812
5078
  validation: "cuid2",
4813
5079
  code: p.invalid_string,
4814
5080
  message: s.message
4815
5081
  }), a.dirty());
4816
5082
  else if (s.kind === "ulid")
4817
- Ii.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5083
+ Hi.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4818
5084
  validation: "ulid",
4819
5085
  code: p.invalid_string,
4820
5086
  message: s.message
@@ -4849,23 +5115,23 @@ class Q extends I {
4849
5115
  code: p.invalid_string,
4850
5116
  validation: "datetime",
4851
5117
  message: s.message
4852
- }), a.dirty()) : s.kind === "date" ? Li.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5118
+ }), a.dirty()) : s.kind === "date" ? io.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4853
5119
  code: p.invalid_string,
4854
5120
  validation: "date",
4855
5121
  message: s.message
4856
- }), a.dirty()) : s.kind === "time" ? zi(s).test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5122
+ }), a.dirty()) : s.kind === "time" ? oo(s).test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4857
5123
  code: p.invalid_string,
4858
5124
  validation: "time",
4859
5125
  message: s.message
4860
- }), a.dirty()) : s.kind === "duration" ? $i.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5126
+ }), a.dirty()) : s.kind === "duration" ? eo.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4861
5127
  validation: "duration",
4862
5128
  code: p.invalid_string,
4863
5129
  message: s.message
4864
- }), a.dirty()) : s.kind === "ip" ? Ui(e.data, s.version) || (r = this._getOrReturnCtx(e, r), _(r, {
5130
+ }), a.dirty()) : s.kind === "ip" ? co(e.data, s.version) || (r = this._getOrReturnCtx(e, r), _(r, {
4865
5131
  validation: "ip",
4866
5132
  code: p.invalid_string,
4867
5133
  message: s.message
4868
- }), a.dirty()) : s.kind === "base64" ? Ri.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
5134
+ }), a.dirty()) : s.kind === "base64" ? so.test(e.data) || (r = this._getOrReturnCtx(e, r), _(r, {
4869
5135
  validation: "base64",
4870
5136
  code: p.invalid_string,
4871
5137
  message: s.message
@@ -5087,7 +5353,7 @@ Q.create = (t) => {
5087
5353
  ...S(t)
5088
5354
  });
5089
5355
  };
5090
- function Fi(t, e) {
5356
+ function lo(t, e) {
5091
5357
  const n = (t.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, r = n > a ? n : a, s = parseInt(t.toFixed(r).replace(".", "")), o = parseInt(e.toFixed(r).replace(".", ""));
5092
5358
  return s % o / Math.pow(10, r);
5093
5359
  }
@@ -5126,7 +5392,7 @@ class Se extends I {
5126
5392
  inclusive: s.inclusive,
5127
5393
  exact: !1,
5128
5394
  message: s.message
5129
- }), r.dirty()) : s.kind === "multipleOf" ? Fi(e.data, s.value) !== 0 && (a = this._getOrReturnCtx(e, a), _(a, {
5395
+ }), r.dirty()) : s.kind === "multipleOf" ? lo(e.data, s.value) !== 0 && (a = this._getOrReturnCtx(e, a), _(a, {
5130
5396
  code: p.not_multiple_of,
5131
5397
  multipleOf: s.value,
5132
5398
  message: s.message
@@ -6827,7 +7093,7 @@ _n.create = (t) => new _n({
6827
7093
  typeName: N.ZodNaN,
6828
7094
  ...S(t)
6829
7095
  });
6830
- const Vi = Symbol("zod_brand");
7096
+ const uo = Symbol("zod_brand");
6831
7097
  class Vn extends I {
6832
7098
  _parse(e) {
6833
7099
  const { ctx: n } = this._processInputParams(e), a = n.data;
@@ -6904,16 +7170,16 @@ function xa(t, e = {}, n) {
6904
7170
  }
6905
7171
  }) : ct.create();
6906
7172
  }
6907
- const Bi = {
7173
+ const ho = {
6908
7174
  object: D.lazycreate
6909
7175
  };
6910
7176
  var N;
6911
7177
  (function(t) {
6912
7178
  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";
6913
7179
  })(N || (N = {}));
6914
- const Ki = (t, e = {
7180
+ const po = (t, e = {
6915
7181
  message: `Input not instance of ${t.name}`
6916
- }) => xa((n) => n instanceof t, e), Na = Q.create, ka = Se.create, Ji = _n.create, Wi = je.create, Ca = Mt.create, qi = Fe.create, Qi = pn.create, Gi = Rt.create, Hi = Lt.create, Yi = ct.create, Xi = Le.create, eo = fe.create, to = mn.create, no = H.create, ao = D.create, ro = D.strictCreate, so = zt.create, io = vn.create, oo = Ut.create, co = ce.create, lo = Ft.create, uo = fn.create, ho = Ve.create, po = at.create, mo = Vt.create, fo = Bt.create, _o = Ie.create, go = Kt.create, yo = lt.create, Gn = X.create, vo = se.create, bo = Ze.create, wo = X.createWithPreprocess, xo = Yt.create, No = () => Na().optional(), ko = () => ka().optional(), Co = () => Ca().optional(), To = {
7182
+ }) => xa((n) => n instanceof t, e), Na = Q.create, ka = Se.create, mo = _n.create, fo = je.create, Ca = Mt.create, _o = Fe.create, go = pn.create, yo = Rt.create, vo = Lt.create, bo = ct.create, wo = Le.create, xo = fe.create, No = mn.create, ko = H.create, Co = D.create, To = D.strictCreate, Oo = zt.create, So = vn.create, jo = Ut.create, Io = ce.create, Zo = Ft.create, Eo = fn.create, $o = Ve.create, Po = at.create, Ao = Vt.create, Do = Bt.create, Mo = Ie.create, Ro = Kt.create, Lo = lt.create, Gn = X.create, zo = se.create, Uo = Ze.create, Fo = X.createWithPreprocess, Vo = Yt.create, Bo = () => Na().optional(), Ko = () => ka().optional(), Jo = () => Ca().optional(), Wo = {
6917
7183
  string: (t) => Q.create({ ...t, coerce: !0 }),
6918
7184
  number: (t) => Se.create({ ...t, coerce: !0 }),
6919
7185
  boolean: (t) => Mt.create({
@@ -6922,14 +7188,14 @@ const Ki = (t, e = {
6922
7188
  }),
6923
7189
  bigint: (t) => je.create({ ...t, coerce: !0 }),
6924
7190
  date: (t) => Fe.create({ ...t, coerce: !0 })
6925
- }, Oo = k;
6926
- var So = /* @__PURE__ */ Object.freeze({
7191
+ }, qo = k;
7192
+ var Qo = /* @__PURE__ */ Object.freeze({
6927
7193
  __proto__: null,
6928
7194
  defaultErrorMap: dt,
6929
- setErrorMap: Ti,
7195
+ setErrorMap: Wi,
6930
7196
  getErrorMap: ln,
6931
7197
  makeIssue: un,
6932
- EMPTY_PATH: Oi,
7198
+ EMPTY_PATH: qi,
6933
7199
  addIssueToContext: _,
6934
7200
  ParseStatus: F,
6935
7201
  INVALID: k,
@@ -6983,63 +7249,63 @@ var So = /* @__PURE__ */ Object.freeze({
6983
7249
  ZodDefault: Jt,
6984
7250
  ZodCatch: Wt,
6985
7251
  ZodNaN: _n,
6986
- BRAND: Vi,
7252
+ BRAND: uo,
6987
7253
  ZodBranded: Vn,
6988
7254
  ZodPipeline: Yt,
6989
7255
  ZodReadonly: qt,
6990
7256
  custom: xa,
6991
7257
  Schema: I,
6992
7258
  ZodSchema: I,
6993
- late: Bi,
7259
+ late: ho,
6994
7260
  get ZodFirstPartyTypeKind() {
6995
7261
  return N;
6996
7262
  },
6997
- coerce: To,
6998
- any: Yi,
6999
- array: no,
7000
- bigint: Wi,
7263
+ coerce: Wo,
7264
+ any: bo,
7265
+ array: ko,
7266
+ bigint: fo,
7001
7267
  boolean: Ca,
7002
- date: qi,
7003
- discriminatedUnion: io,
7268
+ date: _o,
7269
+ discriminatedUnion: So,
7004
7270
  effect: Gn,
7005
- enum: _o,
7006
- function: po,
7007
- instanceof: Ki,
7008
- intersection: oo,
7009
- lazy: mo,
7010
- literal: fo,
7011
- map: uo,
7012
- nan: Ji,
7013
- nativeEnum: go,
7014
- never: eo,
7015
- null: Hi,
7016
- nullable: bo,
7271
+ enum: Mo,
7272
+ function: Po,
7273
+ instanceof: po,
7274
+ intersection: jo,
7275
+ lazy: Ao,
7276
+ literal: Do,
7277
+ map: Eo,
7278
+ nan: mo,
7279
+ nativeEnum: Ro,
7280
+ never: xo,
7281
+ null: vo,
7282
+ nullable: Uo,
7017
7283
  number: ka,
7018
- object: ao,
7019
- oboolean: Co,
7020
- onumber: ko,
7021
- optional: vo,
7022
- ostring: No,
7023
- pipeline: xo,
7024
- preprocess: wo,
7025
- promise: yo,
7026
- record: lo,
7027
- set: ho,
7028
- strictObject: ro,
7284
+ object: Co,
7285
+ oboolean: Jo,
7286
+ onumber: Ko,
7287
+ optional: zo,
7288
+ ostring: Bo,
7289
+ pipeline: Vo,
7290
+ preprocess: Fo,
7291
+ promise: Lo,
7292
+ record: Zo,
7293
+ set: $o,
7294
+ strictObject: To,
7029
7295
  string: Na,
7030
- symbol: Qi,
7296
+ symbol: go,
7031
7297
  transformer: Gn,
7032
- tuple: co,
7033
- undefined: Gi,
7034
- union: so,
7035
- unknown: Xi,
7036
- void: to,
7037
- NEVER: Oo,
7298
+ tuple: Io,
7299
+ undefined: yo,
7300
+ union: Oo,
7301
+ unknown: wo,
7302
+ void: No,
7303
+ NEVER: qo,
7038
7304
  ZodIssueCode: p,
7039
- quotelessJson: Ci,
7305
+ quotelessJson: Ji,
7040
7306
  ZodError: J
7041
7307
  });
7042
- ki(So);
7308
+ Ki(Qo);
7043
7309
  function Xt(t, e = "", n = {}) {
7044
7310
  for (let a in t)
7045
7311
  if (Object.prototype.hasOwnProperty.call(t, a)) {
@@ -7048,7 +7314,7 @@ function Xt(t, e = "", n = {}) {
7048
7314
  }
7049
7315
  return n;
7050
7316
  }
7051
- function Ta(t, e) {
7317
+ function Go(t, e) {
7052
7318
  const n = {};
7053
7319
  for (const [a, r] of Object.entries(t)) {
7054
7320
  const s = e.find(
@@ -7066,275 +7332,6 @@ function Ta(t, e) {
7066
7332
  }
7067
7333
  return n;
7068
7334
  }
7069
- function jo(t) {
7070
- return async (e, n) => {
7071
- let a = t.selectFrom("connections").where("connections.tenant_id", "=", e);
7072
- n.q && (a = Be(t, a, n.q, ["user_id", "ip"]));
7073
- const o = (await a.offset(n.page * n.per_page).limit(n.per_page).selectAll().execute()).map(
7074
- (c) => R(Ta(c, ["options"]))
7075
- ), { count: d } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
7076
- return {
7077
- connections: o,
7078
- start: n.page * n.per_page,
7079
- limit: n.per_page,
7080
- length: Ee(d)
7081
- };
7082
- };
7083
- }
7084
- function Io(t) {
7085
- return async (e, n) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7086
- }
7087
- function Zo(t) {
7088
- return async (e, n) => {
7089
- const a = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
7090
- return a ? R({
7091
- ...a,
7092
- options: JSON.parse(a.options)
7093
- }) : null;
7094
- };
7095
- }
7096
- function Eo(t) {
7097
- return async (e, n, a) => {
7098
- const r = {
7099
- ...a,
7100
- updated_at: (/* @__PURE__ */ new Date()).toISOString()
7101
- };
7102
- return await t.updateTable("connections").set({
7103
- ...r,
7104
- options: r.options ? JSON.stringify(r.options) : void 0
7105
- }).where("connections.id", "=", n).where("connections.tenant_id", "=", e).execute(), !0;
7106
- };
7107
- }
7108
- function $o(t) {
7109
- return {
7110
- create: wi(t),
7111
- get: Zo(t),
7112
- list: jo(t),
7113
- remove: Io(t),
7114
- update: Eo(t)
7115
- };
7116
- }
7117
- function Po(t) {
7118
- return {
7119
- get: async (e) => {
7120
- const n = await t.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
7121
- if (!n)
7122
- return null;
7123
- const a = await t.selectFrom("tenants").selectAll().where("id", "=", n.tenant_id).executeTakeFirst();
7124
- if (!a)
7125
- throw new Tn(404, { message: "Tenant not found" });
7126
- const r = 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();
7127
- return {
7128
- ...n,
7129
- connections: r.map(
7130
- (d) => pa.parse(
7131
- R({
7132
- ...d,
7133
- options: d.options ? JSON.parse(d.options) : {}
7134
- })
7135
- )
7136
- ),
7137
- domains: s,
7138
- addons: n.addons ? JSON.parse(n.addons) : {},
7139
- callbacks: n.callbacks ? JSON.parse(n.callbacks) : [],
7140
- allowed_origins: n.allowed_origins ? JSON.parse(n.allowed_origins) : [],
7141
- web_origins: n.web_origins ? JSON.parse(n.web_origins) : [],
7142
- allowed_logout_urls: n.allowed_logout_urls ? JSON.parse(n.allowed_logout_urls) : [],
7143
- allowed_clients: n.allowed_clients ? JSON.parse(n.allowed_clients) : [],
7144
- tenant: R(a),
7145
- // this is really an integer in the database
7146
- disable_sign_ups: !!n.disable_sign_ups
7147
- };
7148
- }
7149
- };
7150
- }
7151
- function Ao(t) {
7152
- return async () => await t.selectFrom("keys").where(
7153
- (n) => n.or([
7154
- n("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
7155
- n("revoked_at", "is", null)
7156
- ])
7157
- ).selectAll().execute();
7158
- }
7159
- function Do(t) {
7160
- return async (e) => {
7161
- await t.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
7162
- };
7163
- }
7164
- function Mo(t) {
7165
- return async (e, n) => !!(await t.updateTable("keys").set(n).where("kid", "=", e).execute()).length;
7166
- }
7167
- function Ro(t) {
7168
- return {
7169
- create: Do(t),
7170
- list: Ao(t),
7171
- update: Mo(t)
7172
- };
7173
- }
7174
- function Lo(t) {
7175
- return async (e, n) => {
7176
- const a = {
7177
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
7178
- updated_at: (/* @__PURE__ */ new Date()).toISOString(),
7179
- tenant_id: e,
7180
- id: Ke(),
7181
- ...n
7182
- };
7183
- return await t.insertInto("domains").values(a).execute(), a;
7184
- };
7185
- }
7186
- function zo(t) {
7187
- return async (e, n) => {
7188
- let a = t.selectFrom("domains").where("domains.tenant_id", "=", e);
7189
- n.q && (a = Be(t, a, n.q, ["user_id", "ip"]));
7190
- const s = await a.offset(n.page * n.per_page).limit(n.per_page).selectAll().execute(), { count: o } = await a.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
7191
- return {
7192
- domains: s,
7193
- start: n.page * n.per_page,
7194
- limit: n.per_page,
7195
- length: Ee(o)
7196
- };
7197
- };
7198
- }
7199
- function Uo(t) {
7200
- return {
7201
- create: Lo(t),
7202
- list: zo(t)
7203
- };
7204
- }
7205
- function Fo(t) {
7206
- return async (e) => {
7207
- const [n] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
7208
- if (!n)
7209
- return null;
7210
- const {
7211
- tenant_id: a,
7212
- colors_primary: r,
7213
- colors_page_background_type: s,
7214
- colors_page_background_start: o,
7215
- colors_page_background_end: d,
7216
- colors_page_background_angle_dev: c,
7217
- font_url: l,
7218
- ...u
7219
- } = n;
7220
- return R({
7221
- ...u,
7222
- colors: {
7223
- primary: r,
7224
- page_background: {
7225
- type: s,
7226
- start: o,
7227
- end: d,
7228
- angle_deg: c
7229
- }
7230
- },
7231
- font: l ? { url: l } : void 0
7232
- });
7233
- };
7234
- }
7235
- function Vo(t) {
7236
- return async (e, n) => {
7237
- var o, d, c, l, u, Z, M, W, _e, Je, ge, ye, ve, We, qe, ee, te, ne;
7238
- const { colors: a, font: r, ...s } = n;
7239
- try {
7240
- await t.insertInto("branding").values({
7241
- ...s,
7242
- colors_primary: a == null ? void 0 : a.primary,
7243
- colors_page_background_type: (d = (o = n.colors) == null ? void 0 : o.page_background) == null ? void 0 : d.type,
7244
- colors_page_background_start: (l = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : l.start,
7245
- colors_page_background_end: (Z = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : Z.end,
7246
- colors_page_background_angle_dev: (W = (M = n.colors) == null ? void 0 : M.page_background) == null ? void 0 : W.angle_deg,
7247
- font_url: (_e = n.font) == null ? void 0 : _e.url,
7248
- tenant_id: e
7249
- }).execute();
7250
- } catch {
7251
- await t.updateTable("branding").set({
7252
- ...s,
7253
- colors_primary: a == null ? void 0 : a.primary,
7254
- colors_page_background_type: (ge = (Je = n.colors) == null ? void 0 : Je.page_background) == null ? void 0 : ge.type,
7255
- colors_page_background_start: (ve = (ye = n.colors) == null ? void 0 : ye.page_background) == null ? void 0 : ve.start,
7256
- colors_page_background_end: (qe = (We = n.colors) == null ? void 0 : We.page_background) == null ? void 0 : qe.end,
7257
- colors_page_background_angle_dev: (te = (ee = n.colors) == null ? void 0 : ee.page_background) == null ? void 0 : te.angle_deg,
7258
- font_url: (ne = n.font) == null ? void 0 : ne.url
7259
- }).where("tenant_id", "=", e).execute();
7260
- }
7261
- };
7262
- }
7263
- function Bo(t) {
7264
- return {
7265
- get: Fo(t),
7266
- set: Vo(t)
7267
- };
7268
- }
7269
- function Ko(t) {
7270
- return async (e, n) => {
7271
- let a = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
7272
- n.q && (a = Be(t, a, n.q, ["url"]));
7273
- const s = await a.offset(n.page * n.per_page).limit(n.per_page).selectAll().execute(), { count: o } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
7274
- return {
7275
- hooks: s.map((c) => {
7276
- const { tenant_id: l, enabled: u, synchronous: Z, ...M } = c;
7277
- return R({
7278
- ...M,
7279
- enabled: !!u,
7280
- synchronous: !!Z
7281
- });
7282
- }),
7283
- start: n.page * n.per_page,
7284
- limit: n.per_page,
7285
- length: Ee(o)
7286
- };
7287
- };
7288
- }
7289
- function Jo(t) {
7290
- return async (e, n) => {
7291
- const a = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
7292
- return a ? R({
7293
- ...a,
7294
- enabled: !!a.enabled,
7295
- synchronous: !!a.synchronous
7296
- }) : null;
7297
- };
7298
- }
7299
- function Wo(t) {
7300
- return async (e, n) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).executeTakeFirst()).numDeletedRows > 0;
7301
- }
7302
- function qo(t) {
7303
- return async (e, n) => {
7304
- const a = {
7305
- hook_id: Ke(),
7306
- ...n,
7307
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
7308
- updated_at: (/* @__PURE__ */ new Date()).toISOString()
7309
- };
7310
- return await t.insertInto("hooks").values({
7311
- ...a,
7312
- tenant_id: e,
7313
- enabled: n.enabled ? 1 : 0,
7314
- synchronous: n.synchronous ? 1 : 0
7315
- }).execute(), a;
7316
- };
7317
- }
7318
- function Qo(t) {
7319
- return async (e, n, a) => {
7320
- const r = {
7321
- ...a,
7322
- updated_at: (/* @__PURE__ */ new Date()).toISOString(),
7323
- enabled: a.enabled !== void 0 ? a.enabled ? 1 : 0 : void 0,
7324
- synchronous: a.enabled !== void 0 ? a.synchronous ? 1 : 0 : void 0
7325
- };
7326
- return await t.updateTable("hooks").set(r).where("hooks.hook_id", "=", n).where("hooks.tenant_id", "=", e).execute(), !0;
7327
- };
7328
- }
7329
- function Go(t) {
7330
- return {
7331
- create: qo(t),
7332
- get: Jo(t),
7333
- list: Ko(t),
7334
- update: Qo(t),
7335
- remove: Wo(t)
7336
- };
7337
- }
7338
7335
  function Ho(t) {
7339
7336
  return async (e, n) => {
7340
7337
  const a = {
@@ -7375,8 +7372,8 @@ function td(t) {
7375
7372
  function nd(t) {
7376
7373
  return async (e, n) => {
7377
7374
  const a = (/* @__PURE__ */ new Date()).toISOString(), r = await t.selectFrom("logins").where("logins.expires_at", ">", a).where("logins.login_id", "=", n).selectAll().executeTakeFirst();
7378
- return r ? xs.parse(
7379
- Ta(R(r), ["authParams"])
7375
+ return r ? ws.parse(
7376
+ Go(R(r), ["authParams"])
7380
7377
  ) : null;
7381
7378
  };
7382
7379
  }
@@ -7428,7 +7425,7 @@ function Hn(t) {
7428
7425
  function dd(t) {
7429
7426
  return async (e, n) => {
7430
7427
  try {
7431
- const a = $s.parse(n);
7428
+ const a = Es.parse(n);
7432
7429
  await t.insertInto("prompt_settings").values({
7433
7430
  ...Hn(a),
7434
7431
  tenant_id: e
@@ -8411,7 +8408,7 @@ const gd = z({
8411
8408
  UpdateQueryNode: !0,
8412
8409
  MergeQueryNode: !0
8413
8410
  });
8414
- var rt, De, Me, L, Oa, Sa, ja, Ye, Dn, Ia;
8411
+ var rt, De, Me, L, Ta, Oa, Sa, Ye, Dn, ja;
8415
8412
  class yd extends _d {
8416
8413
  constructor(n) {
8417
8414
  super();
@@ -8422,12 +8419,12 @@ class yd extends _d {
8422
8419
  ht(this, rt, n);
8423
8420
  }
8424
8421
  transformNodeImpl(n) {
8425
- if (!T(this, L, Oa).call(this, n))
8422
+ if (!T(this, L, Ta).call(this, n))
8426
8423
  return super.transformNodeImpl(n);
8427
- const a = T(this, L, ja).call(this, n);
8424
+ const a = T(this, L, Sa).call(this, n);
8428
8425
  for (const o of a)
8429
8426
  v(this, Me).add(o);
8430
- const r = T(this, L, Sa).call(this, n);
8427
+ const r = T(this, L, Oa).call(this, n);
8431
8428
  for (const o of r)
8432
8429
  v(this, De).add(o);
8433
8430
  const s = super.transformNodeImpl(n);
@@ -8452,9 +8449,9 @@ class yd extends _d {
8452
8449
  };
8453
8450
  }
8454
8451
  }
8455
- rt = new WeakMap(), De = new WeakMap(), Me = new WeakMap(), L = new WeakSet(), Oa = function(n) {
8452
+ rt = new WeakMap(), De = new WeakMap(), Me = new WeakMap(), L = new WeakSet(), Ta = function(n) {
8456
8453
  return n.kind in gd;
8457
- }, Sa = function(n) {
8454
+ }, Oa = function(n) {
8458
8455
  const a = /* @__PURE__ */ new Set();
8459
8456
  if ("name" in n && n.name && An.is(n.name) && T(this, L, Dn).call(this, n.name, a), "from" in n && n.from)
8460
8457
  for (const r of n.from.froms)
@@ -8463,16 +8460,16 @@ rt = new WeakMap(), De = new WeakMap(), Me = new WeakMap(), L = new WeakSet(), O
8463
8460
  for (const r of n.joins)
8464
8461
  T(this, L, Ye).call(this, r.table, a);
8465
8462
  return "using" in n && n.using && T(this, L, Ye).call(this, n.using, a), a;
8466
- }, ja = function(n) {
8463
+ }, Sa = function(n) {
8467
8464
  const a = /* @__PURE__ */ new Set();
8468
- return "with" in n && n.with && T(this, L, Ia).call(this, n.with, a), a;
8465
+ return "with" in n && n.with && T(this, L, ja).call(this, n.with, a), a;
8469
8466
  }, Ye = function(n, a) {
8470
8467
  const r = Nn.is(n) ? n : fd.is(n) && Nn.is(n.node) ? n.node : null;
8471
8468
  r && T(this, L, Dn).call(this, r.table, a);
8472
8469
  }, Dn = function(n, a) {
8473
8470
  const r = n.identifier.name;
8474
8471
  !v(this, De).has(r) && !v(this, Me).has(r) && a.add(r);
8475
- }, Ia = function(n, a) {
8472
+ }, ja = function(n, a) {
8476
8473
  for (const r of n.expressions) {
8477
8474
  const s = r.name.table.table.identifier.name;
8478
8475
  v(this, Me).has(s) || a.add(s);
@@ -8501,8 +8498,8 @@ class bd {
8501
8498
  }
8502
8499
  }
8503
8500
  const wd = "kysely_migration", Yn = "kysely_migration_lock", xd = !1, kn = "migration_lock", Nd = z({ __noMigrations__: !0 });
8504
- var P, m, vt, ue, he, Xe, Ea, pe, $a, Pa, Aa, Da, Ma, Mn, et, Rn, Ra, La, za, Ln, Ua, Fa, Va, Ba, Ka, bt;
8505
- class Za {
8501
+ var P, m, vt, ue, he, Xe, Za, pe, Ea, $a, Pa, Aa, Da, Mn, et, Rn, Ma, Ra, La, Ln, za, Ua, Fa, Va, Ba, bt;
8502
+ class Ia {
8506
8503
  constructor(e) {
8507
8504
  ae(this, m);
8508
8505
  ae(this, P);
@@ -8651,7 +8648,7 @@ class Za {
8651
8648
  }
8652
8649
  P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8653
8650
  try {
8654
- return await T(this, m, $a).call(this), await T(this, m, Ra).call(this, e);
8651
+ return await T(this, m, Ea).call(this), await T(this, m, Ma).call(this, e);
8655
8652
  } catch (n) {
8656
8653
  return n instanceof Cn ? n.resultSet : { error: n };
8657
8654
  }
@@ -8661,13 +8658,13 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8661
8658
  return v(this, P).migrationTableName ?? wd;
8662
8659
  }, Xe = function() {
8663
8660
  return v(this, P).migrationLockTableName ?? Yn;
8664
- }, Ea = function() {
8661
+ }, Za = function() {
8665
8662
  return v(this, P).allowUnorderedMigrations ?? xd;
8666
8663
  }, pe = function() {
8667
8664
  return v(this, m, ue) ? new vd(v(this, m, ue)) : new bd();
8665
+ }, Ea = async function() {
8666
+ await T(this, m, $a).call(this), await T(this, m, Pa).call(this), await T(this, m, Aa).call(this), await T(this, m, Da).call(this);
8668
8667
  }, $a = async function() {
8669
- await T(this, m, Pa).call(this), await T(this, m, Aa).call(this), await T(this, m, Da).call(this), await T(this, m, Ma).call(this);
8670
- }, Pa = async function() {
8671
8668
  if (v(this, m, ue) && !await T(this, m, Mn).call(this))
8672
8669
  try {
8673
8670
  await T(this, m, bt).call(this, v(this, P).db.schema.createSchema(v(this, m, ue)));
@@ -8675,7 +8672,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8675
8672
  if (!await T(this, m, Mn).call(this))
8676
8673
  throw e;
8677
8674
  }
8678
- }, Aa = async function() {
8675
+ }, Pa = async function() {
8679
8676
  if (!await T(this, m, et).call(this, v(this, m, he)))
8680
8677
  try {
8681
8678
  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()));
@@ -8683,7 +8680,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8683
8680
  if (!await T(this, m, et).call(this, v(this, m, he)))
8684
8681
  throw e;
8685
8682
  }
8686
- }, Da = async function() {
8683
+ }, Aa = async function() {
8687
8684
  if (!await T(this, m, et).call(this, v(this, m, Xe)))
8688
8685
  try {
8689
8686
  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)));
@@ -8691,7 +8688,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8691
8688
  if (!await T(this, m, et).call(this, v(this, m, Xe)))
8692
8689
  throw e;
8693
8690
  }
8694
- }, Ma = async function() {
8691
+ }, Da = async function() {
8695
8692
  if (!await T(this, m, Rn).call(this))
8696
8693
  try {
8697
8694
  await v(this, P).db.withPlugin(v(this, m, pe)).insertInto(v(this, m, Xe)).values({ id: kn, is_locked: 0 }).execute();
@@ -8708,7 +8705,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8708
8705
  })).some((r) => r.name === e && (!n || r.schema === n));
8709
8706
  }, Rn = async function() {
8710
8707
  return !!await v(this, P).db.withPlugin(v(this, m, pe)).selectFrom(v(this, m, Xe)).where("id", "=", kn).select("id").executeTakeFirst();
8711
- }, Ra = async function(e) {
8708
+ }, Ma = async function(e) {
8712
8709
  const n = v(this, P).db.getExecutor().adapter, a = z({
8713
8710
  lockTable: v(this, P).migrationLockTableName ?? Yn,
8714
8711
  lockRowId: kn,
@@ -8716,27 +8713,27 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8716
8713
  }), r = async (s) => {
8717
8714
  try {
8718
8715
  await n.acquireMigrationLock(s, a);
8719
- const o = await T(this, m, La).call(this, s);
8716
+ const o = await T(this, m, Ra).call(this, s);
8720
8717
  if (o.migrations.length === 0)
8721
8718
  return { results: [] };
8722
8719
  const { direction: d, step: c } = e(o);
8723
- return c <= 0 ? { results: [] } : d === "Down" ? await T(this, m, Ba).call(this, s, o, c) : d === "Up" ? await T(this, m, Ka).call(this, s, o, c) : { results: [] };
8720
+ return c <= 0 ? { results: [] } : d === "Down" ? await T(this, m, Va).call(this, s, o, c) : d === "Up" ? await T(this, m, Ba).call(this, s, o, c) : { results: [] };
8724
8721
  } finally {
8725
8722
  await n.releaseMigrationLock(s, a);
8726
8723
  }
8727
8724
  };
8728
8725
  return n.supportsTransactionalDdl ? v(this, P).db.transaction().execute(r) : v(this, P).db.connection().execute(r);
8729
- }, La = async function(e) {
8730
- const n = await T(this, m, Ln).call(this), a = await T(this, m, Ua).call(this, e);
8731
- T(this, m, Fa).call(this, n, a), v(this, m, Ea) || T(this, m, Va).call(this, n, a);
8732
- const r = T(this, m, za).call(this, n, a);
8726
+ }, Ra = async function(e) {
8727
+ const n = await T(this, m, Ln).call(this), a = await T(this, m, za).call(this, e);
8728
+ T(this, m, Ua).call(this, n, a), v(this, m, Za) || T(this, m, Fa).call(this, n, a);
8729
+ const r = T(this, m, La).call(this, n, a);
8733
8730
  return z({
8734
8731
  migrations: n,
8735
8732
  executedMigrations: a,
8736
8733
  lastMigration: md(a),
8737
8734
  pendingMigrations: r
8738
8735
  });
8739
- }, za = function(e, n) {
8736
+ }, La = function(e, n) {
8740
8737
  return e.filter((a) => !n.includes(a.name));
8741
8738
  }, Ln = async function() {
8742
8739
  const e = await v(this, P).provider.getMigrations();
@@ -8744,17 +8741,17 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8744
8741
  ...e[n],
8745
8742
  name: n
8746
8743
  }));
8747
- }, Ua = async function(e) {
8744
+ }, za = async function(e) {
8748
8745
  return (await e.withPlugin(v(this, m, pe)).selectFrom(v(this, m, he)).select("name").orderBy(["timestamp", "name"]).execute()).map((a) => a.name);
8749
- }, Fa = function(e, n) {
8746
+ }, Ua = function(e, n) {
8750
8747
  for (const a of n)
8751
8748
  if (!e.some((r) => r.name === a))
8752
8749
  throw new Error(`corrupted migrations: previously executed migration ${a} is missing`);
8753
- }, Va = function(e, n) {
8750
+ }, Fa = function(e, n) {
8754
8751
  for (let a = 0; a < n.length; ++a)
8755
8752
  if (e[a].name !== n[a])
8756
8753
  throw new Error(`corrupted migrations: expected previously executed migration ${n[a]} to be at index ${a} but ${e[a].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
8757
- }, Ba = async function(e, n, a) {
8754
+ }, Va = async function(e, n, a) {
8758
8755
  const r = n.executedMigrations.slice().reverse().slice(0, a).map((o) => n.migrations.find((d) => d.name === o)), s = r.map((o) => ({
8759
8756
  migrationName: o.name,
8760
8757
  direction: "Down",
@@ -8780,7 +8777,7 @@ P = new WeakMap(), m = new WeakSet(), vt = async function(e) {
8780
8777
  }
8781
8778
  }
8782
8779
  return { results: s };
8783
- }, Ka = async function(e, n, a) {
8780
+ }, Ba = async function(e, n, a) {
8784
8781
  const s = n.pendingMigrations.slice(0, a).map((o) => ({
8785
8782
  migrationName: o.name,
8786
8783
  direction: "Up",
@@ -8824,7 +8821,7 @@ class Cn extends Error {
8824
8821
  }
8825
8822
  }
8826
8823
  Gt = new WeakMap();
8827
- class Ja {
8824
+ class Ka {
8828
8825
  constructor(e) {
8829
8826
  ut(this, "migrations");
8830
8827
  this.migrations = e;
@@ -9753,7 +9750,7 @@ const uh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9753
9750
  __proto__: null,
9754
9751
  down: lh,
9755
9752
  up: ch
9756
- }, Symbol.toStringTag, { value: "Module" })), Wa = {
9753
+ }, Symbol.toStringTag, { value: "Module" })), Ja = {
9757
9754
  m1_init: Td,
9758
9755
  m2_magicLink: jd,
9759
9756
  m3_updateAt: Ed,
@@ -9825,7 +9822,7 @@ const uh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9825
9822
  };
9826
9823
  async function ph(t, e = !1) {
9827
9824
  e && console.log("migrating...");
9828
- const n = new Ja(Wa), a = new Za({
9825
+ const n = new Ka(Ja), a = new Ia({
9829
9826
  db: t,
9830
9827
  provider: n
9831
9828
  }), { error: r, results: s } = await a.migrateToLatest();
@@ -9838,7 +9835,7 @@ async function ph(t, e = !1) {
9838
9835
  }
9839
9836
  async function mh(t) {
9840
9837
  console.log("migrating...");
9841
- const e = new Ja(Wa), n = new Za({
9838
+ const e = new Ka(Ja), n = new Ia({
9842
9839
  db: t,
9843
9840
  provider: e
9844
9841
  }), { error: a, results: r } = await n.migrateDown();
@@ -9849,22 +9846,22 @@ async function mh(t) {
9849
9846
  }
9850
9847
  function fh(t) {
9851
9848
  return {
9852
- applications: bi(t),
9853
- branding: Bo(t),
9854
- clients: Po(t),
9855
- codes: mi(t),
9856
- connections: $o(t),
9849
+ applications: vi(t),
9850
+ branding: Di(t),
9851
+ clients: Ti(t),
9852
+ codes: pi(t),
9853
+ connections: Ci(t),
9857
9854
  emailProviders: pd(t),
9858
- domains: Uo(t),
9859
- hooks: Go(t),
9860
- keys: Ro(t),
9855
+ domains: $i(t),
9856
+ hooks: Fi(t),
9857
+ keys: Ii(t),
9861
9858
  logins: id(t),
9862
- logs: Ys(t),
9863
- passwords: di(t),
9859
+ logs: Hs(t),
9860
+ passwords: oi(t),
9864
9861
  promptSettings: cd(t),
9865
- users: zs(t),
9866
- sessions: ri(t),
9867
- tenants: Ws(t),
9862
+ users: Ls(t),
9863
+ sessions: ai(t),
9864
+ tenants: Js(t),
9868
9865
  themes: td(t)
9869
9866
  };
9870
9867
  }