@authhero/kysely-adapter 0.9.4 → 0.9.5

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.
@@ -3558,7 +3558,7 @@ const Zr = i.object({
3558
3558
  Er.extend({
3559
3559
  themeId: i.string()
3560
3560
  });
3561
- i.object({
3561
+ const Ar = i.object({
3562
3562
  universal_login_experience: i.enum(["new", "classic"]).default("new"),
3563
3563
  identifier_first: i.boolean().default(!0),
3564
3564
  password_first: i.boolean().default(!1),
@@ -3589,7 +3589,7 @@ function Pn(n) {
3589
3589
  }
3590
3590
  };
3591
3591
  }
3592
- function Ar(n) {
3592
+ function Rr(n) {
3593
3593
  return async (e, t) => {
3594
3594
  const [s, r] = await Promise.all([
3595
3595
  n.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", t).selectAll().executeTakeFirst(),
@@ -3655,7 +3655,7 @@ function Ee(n, e, t, s) {
3655
3655
  function ke(n) {
3656
3656
  return typeof n == "string" ? parseInt(n, 10) : typeof n == "bigint" ? Number(n) : n;
3657
3657
  }
3658
- function Rr(n) {
3658
+ function $r(n) {
3659
3659
  return async (e, t) => {
3660
3660
  let s = n.selectFrom("users").where("users.tenant_id", "=", e);
3661
3661
  if (t.q && (s = Ee(n, s, t.q, ["email", "name"])), t.sort && t.sort.sort_by) {
@@ -3689,48 +3689,48 @@ function Rr(n) {
3689
3689
  };
3690
3690
  };
3691
3691
  }
3692
- function $r(n) {
3692
+ function Pr(n) {
3693
3693
  return async (e, t) => (await n.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", t).execute(), (await n.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", t).execute()).length === 1);
3694
3694
  }
3695
- function Pr(n) {
3695
+ function Dr(n) {
3696
3696
  if (n.email_verified !== void 0)
3697
3697
  return n.email_verified ? 1 : 0;
3698
3698
  }
3699
- function Dr(n) {
3699
+ function Mr(n) {
3700
3700
  return async (e, t, s) => {
3701
3701
  const r = {
3702
3702
  ...s,
3703
- email_verified: Pr(s),
3703
+ email_verified: Dr(s),
3704
3704
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
3705
3705
  };
3706
3706
  return (await n.updateTable("users").set(r).where("users.tenant_id", "=", e).where("users.user_id", "=", t).execute()).length === 1;
3707
3707
  };
3708
3708
  }
3709
- function Mr(n) {
3709
+ function Lr(n) {
3710
3710
  return async (e, t, s, r) => {
3711
3711
  const a = { linked_to: null };
3712
3712
  return (await n.updateTable("users").set(a).where("users.tenant_id", "=", e).where("users.user_id", "=", `${s}|${r}`).where("users.linked_to", "=", `${t}`).execute()).length === 1;
3713
3713
  };
3714
3714
  }
3715
- function Lr(n) {
3715
+ function Vr(n) {
3716
3716
  return {
3717
3717
  create: Qn(n),
3718
- remove: $r(n),
3719
- get: Ar(n),
3720
- list: Rr(n),
3721
- update: Dr(n),
3718
+ remove: Pr(n),
3719
+ get: Rr(n),
3720
+ list: $r(n),
3721
+ update: Mr(n),
3722
3722
  // TODO - think about this more when other issues fixed
3723
- unlink: Mr(n)
3723
+ unlink: Lr(n)
3724
3724
  };
3725
3725
  }
3726
- const Vr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3726
+ const Ur = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3727
3727
  let Ae = (n = 21) => {
3728
3728
  let e = "", t = crypto.getRandomValues(new Uint8Array(n));
3729
3729
  for (; n--; )
3730
- e += Vr[t[n] & 63];
3730
+ e += Ur[t[n] & 63];
3731
3731
  return e;
3732
3732
  };
3733
- function Ur(n) {
3733
+ function Fr(n) {
3734
3734
  return async (e) => {
3735
3735
  const t = {
3736
3736
  id: e.id || Ae(),
@@ -3741,13 +3741,13 @@ function Ur(n) {
3741
3741
  return await n.insertInto("tenants").values(t).execute(), t;
3742
3742
  };
3743
3743
  }
3744
- function Fr(n) {
3744
+ function zr(n) {
3745
3745
  return async (e) => {
3746
3746
  const t = await n.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
3747
3747
  return t ? R(t) : null;
3748
3748
  };
3749
3749
  }
3750
- function zr(n) {
3750
+ function Br(n) {
3751
3751
  return async (e) => {
3752
3752
  let t = n.selectFrom("tenants");
3753
3753
  if (e.sort && e.sort.sort_by) {
@@ -3769,7 +3769,7 @@ function zr(n) {
3769
3769
  };
3770
3770
  };
3771
3771
  }
3772
- function Br(n) {
3772
+ function Wr(n) {
3773
3773
  return async (e, t) => {
3774
3774
  const s = {
3775
3775
  ...t,
@@ -3779,29 +3779,29 @@ function Br(n) {
3779
3779
  await n.updateTable("tenants").set(s).where("id", "=", e).execute();
3780
3780
  };
3781
3781
  }
3782
- function Wr(n) {
3782
+ function qr(n) {
3783
3783
  return async (e) => (await n.deleteFrom("tenants").where("tenants.id", "=", e).execute()).length === 1;
3784
3784
  }
3785
- function qr(n) {
3785
+ function Jr(n) {
3786
3786
  return {
3787
- create: Ur(n),
3788
- get: Fr(n),
3789
- list: zr(n),
3790
- update: Br(n),
3791
- remove: Wr(n)
3787
+ create: Fr(n),
3788
+ get: zr(n),
3789
+ list: Br(n),
3790
+ update: Wr(n),
3791
+ remove: qr(n)
3792
3792
  };
3793
3793
  }
3794
3794
  function _n(n) {
3795
3795
  return n ? JSON.stringify(n) : void 0;
3796
3796
  }
3797
- const Jr = 1024;
3798
- function Kr(n) {
3797
+ const Kr = 1024;
3798
+ function Hr(n) {
3799
3799
  return async (e, t) => {
3800
3800
  var r, a, o;
3801
3801
  const s = {
3802
3802
  id: Ae(),
3803
3803
  ...t,
3804
- user_agent: t.user_agent.slice(0, Jr)
3804
+ user_agent: t.user_agent.slice(0, Kr)
3805
3805
  };
3806
3806
  return await n.insertInto("logs").values({
3807
3807
  ...s,
@@ -3837,7 +3837,7 @@ function Dn(n) {
3837
3837
  _id: n.id
3838
3838
  };
3839
3839
  }
3840
- function Hr(n) {
3840
+ function Qr(n) {
3841
3841
  return async (e, t) => {
3842
3842
  let s = n.selectFrom("logs").where("logs.tenant_id", "=", e);
3843
3843
  t.q && (s = Ee(n, s, t.q, ["user_id", "ip"]));
@@ -3859,23 +3859,23 @@ function Hr(n) {
3859
3859
  };
3860
3860
  };
3861
3861
  }
3862
- function Qr(n) {
3862
+ function Yr(n) {
3863
3863
  return async (e, t) => {
3864
3864
  const s = await n.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", t).selectAll().executeTakeFirst();
3865
3865
  return s ? Dn(s) : null;
3866
3866
  };
3867
3867
  }
3868
- function Yr(n) {
3868
+ function Gr(n) {
3869
3869
  return {
3870
- create: Kr(n),
3871
- list: Hr(n),
3872
- get: Qr(n)
3870
+ create: Hr(n),
3871
+ list: Qr(n),
3872
+ get: Yr(n)
3873
3873
  };
3874
3874
  }
3875
- function Gr(n) {
3875
+ function Xr(n) {
3876
3876
  return async (e, t) => await n.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.session_id", "=", t).where("sessions.deleted_at", "is", null).selectAll().executeTakeFirst() ?? null;
3877
3877
  }
3878
- function Xr(n) {
3878
+ function ea(n) {
3879
3879
  return async (e, t) => {
3880
3880
  const s = {
3881
3881
  ...t,
@@ -3885,13 +3885,13 @@ function Xr(n) {
3885
3885
  return await n.insertInto("sessions").values({ ...s, tenant_id: e }).execute(), { ...t, ...s };
3886
3886
  };
3887
3887
  }
3888
- function ea(n) {
3888
+ function ta(n) {
3889
3889
  return async (e, t) => !!(await n.updateTable("sessions").set({ deleted_at: (/* @__PURE__ */ new Date()).toISOString() }).where("tenant_id", "=", e).where("sessions.session_id", "=", t).where("sessions.deleted_at", "is", null).execute()).length;
3890
3890
  }
3891
- function ta(n) {
3891
+ function na(n) {
3892
3892
  return async (e, t, s) => !!(await n.updateTable("sessions").set(s).where("tenant_id", "=", e).where("sessions.session_id", "=", t).where("sessions.deleted_at", "is", null).execute()).length;
3893
3893
  }
3894
- function na(n) {
3894
+ function sa(n) {
3895
3895
  return async (e, t) => {
3896
3896
  let s = n.selectFrom("sessions").where("sessions.tenant_id", "=", e);
3897
3897
  t.q && (s = Ee(n, s, t.q, ["user_id", "session_id"]));
@@ -3913,16 +3913,16 @@ function na(n) {
3913
3913
  };
3914
3914
  };
3915
3915
  }
3916
- function sa(n) {
3916
+ function ra(n) {
3917
3917
  return {
3918
- create: Xr(n),
3919
- get: Gr(n),
3920
- list: na(n),
3921
- remove: ea(n),
3922
- update: ta(n)
3918
+ create: ea(n),
3919
+ get: Xr(n),
3920
+ list: sa(n),
3921
+ remove: ta(n),
3922
+ update: na(n)
3923
3923
  };
3924
3924
  }
3925
- function ra(n) {
3925
+ function aa(n) {
3926
3926
  return async (e, t) => {
3927
3927
  const s = await n.selectFrom("tickets").where("tickets.tenant_id", "=", e).where("tickets.id", "=", t).where("tickets.used_at", "is", null).selectAll().executeTakeFirst();
3928
3928
  if (!s)
@@ -3952,7 +3952,7 @@ function ra(n) {
3952
3952
  };
3953
3953
  };
3954
3954
  }
3955
- function aa(n) {
3955
+ function ia(n) {
3956
3956
  return async (e) => {
3957
3957
  const { authParams: t, ...s } = e, r = {
3958
3958
  ...s,
@@ -3964,27 +3964,27 @@ function aa(n) {
3964
3964
  await n.insertInto("tickets").values(r).execute();
3965
3965
  };
3966
3966
  }
3967
- function ia(n) {
3967
+ function oa(n) {
3968
3968
  return async (e, t) => {
3969
3969
  await n.updateTable("tickets").set({
3970
3970
  used_at: (/* @__PURE__ */ new Date()).toISOString()
3971
3971
  }).where("tickets.tenant_id", "=", e).where("tickets.id", "=", t).execute();
3972
3972
  };
3973
3973
  }
3974
- function oa(n) {
3974
+ function ca(n) {
3975
3975
  return {
3976
- create: aa(n),
3977
- get: ra(n),
3978
- remove: ia(n)
3976
+ create: ia(n),
3977
+ get: aa(n),
3978
+ remove: oa(n)
3979
3979
  };
3980
3980
  }
3981
- function ca(n) {
3981
+ function da(n) {
3982
3982
  return async (e, t) => {
3983
3983
  const s = await n.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", t).selectAll().executeTakeFirstOrThrow(), { tenant_id: r, ...a } = s;
3984
3984
  return a;
3985
3985
  };
3986
3986
  }
3987
- function da(n) {
3987
+ function ua(n) {
3988
3988
  return async (e, t) => {
3989
3989
  const s = {
3990
3990
  ...t,
@@ -3997,20 +3997,20 @@ function da(n) {
3997
3997
  }).execute(), s;
3998
3998
  };
3999
3999
  }
4000
- function ua(n) {
4000
+ function la(n) {
4001
4001
  return async (e, t) => (await n.updateTable("passwords").set({
4002
4002
  password: t.password,
4003
4003
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
4004
4004
  }).where("tenant_id", "=", e).where("user_id", "=", t.user_id).execute()).length === 1;
4005
4005
  }
4006
- function la(n) {
4006
+ function pa(n) {
4007
4007
  return {
4008
- create: da(n),
4009
- update: ua(n),
4010
- get: ca(n)
4008
+ create: ua(n),
4009
+ update: la(n),
4010
+ get: da(n)
4011
4011
  };
4012
4012
  }
4013
- function pa(n) {
4013
+ function ha(n) {
4014
4014
  return async (e, t) => {
4015
4015
  let s = n.selectFrom("codes").where("codes.tenant_id", "=", e);
4016
4016
  t.q && (s = Ee(n, s, t.q, ["code", "login_id"]));
@@ -4026,7 +4026,7 @@ function pa(n) {
4026
4026
  };
4027
4027
  };
4028
4028
  }
4029
- function ha(n) {
4029
+ function fa(n) {
4030
4030
  return async (e, t) => {
4031
4031
  const s = {
4032
4032
  ...t,
@@ -4038,10 +4038,10 @@ function ha(n) {
4038
4038
  }).execute(), s;
4039
4039
  };
4040
4040
  }
4041
- function fa(n) {
4041
+ function ma(n) {
4042
4042
  return async (e, t) => (await n.deleteFrom("codes").where("codes.tenant_id", "=", e).where("codes.code_id", "=", t).executeTakeFirst()).numDeletedRows > 0;
4043
4043
  }
4044
- function ma(n) {
4044
+ function _a(n) {
4045
4045
  return async (e, t, s) => {
4046
4046
  let r = n.selectFrom("codes").where("codes.code_id", "=", t).where("codes.code_type", "=", s).where("codes.expires_at", ">", (/* @__PURE__ */ new Date()).toISOString());
4047
4047
  e.length && (r = r.where("codes.tenant_id", "=", e));
@@ -4049,15 +4049,15 @@ function ma(n) {
4049
4049
  return a ? R(a) : null;
4050
4050
  };
4051
4051
  }
4052
- function _a(n) {
4052
+ function ga(n) {
4053
4053
  return {
4054
- create: ha(n),
4055
- list: pa(n),
4056
- remove: fa(n),
4057
- get: ma(n)
4054
+ create: fa(n),
4055
+ list: ha(n),
4056
+ remove: ma(n),
4057
+ get: _a(n)
4058
4058
  };
4059
4059
  }
4060
- function ga(n) {
4060
+ function ya(n) {
4061
4061
  return async (e, t) => {
4062
4062
  const s = {
4063
4063
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4076,7 +4076,7 @@ function ga(n) {
4076
4076
  }).execute(), s;
4077
4077
  };
4078
4078
  }
4079
- function ya(n) {
4079
+ function va(n) {
4080
4080
  return async (e) => ({
4081
4081
  applications: (await n.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((a) => ({
4082
4082
  ...a,
@@ -4089,7 +4089,7 @@ function ya(n) {
4089
4089
  }))
4090
4090
  });
4091
4091
  }
4092
- function va(n) {
4092
+ function wa(n) {
4093
4093
  return async (e, t) => {
4094
4094
  const s = await n.selectFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", t).selectAll().executeTakeFirst();
4095
4095
  return s ? R({
@@ -4103,10 +4103,10 @@ function va(n) {
4103
4103
  }) : null;
4104
4104
  };
4105
4105
  }
4106
- function wa(n) {
4106
+ function ba(n) {
4107
4107
  return async (e, t) => (await n.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", t).executeTakeFirst()).numDeletedRows > 0;
4108
4108
  }
4109
- function ba(n) {
4109
+ function ka(n) {
4110
4110
  return async (e, t, s) => {
4111
4111
  const r = {
4112
4112
  ...s,
@@ -4121,16 +4121,16 @@ function ba(n) {
4121
4121
  return await n.updateTable("applications").set(r).where("applications.id", "=", t).where("applications.tenant_id", "=", e).execute(), !0;
4122
4122
  };
4123
4123
  }
4124
- function ka(n) {
4124
+ function xa(n) {
4125
4125
  return {
4126
- create: ga(n),
4127
- list: ya(n),
4128
- get: va(n),
4129
- remove: wa(n),
4130
- update: ba(n)
4126
+ create: ya(n),
4127
+ list: va(n),
4128
+ get: wa(n),
4129
+ remove: ba(n),
4130
+ update: ka(n)
4131
4131
  };
4132
4132
  }
4133
- function xa(n, e) {
4133
+ function Ta(n, e) {
4134
4134
  var t = {};
4135
4135
  for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && e.indexOf(s) < 0 && (t[s] = n[s]);
4136
4136
  if (n != null && typeof Object.getOwnPropertySymbols == "function")
@@ -4138,7 +4138,7 @@ function xa(n, e) {
4138
4138
  e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, s[r]) && (t[s[r]] = n[s[r]]);
4139
4139
  return t;
4140
4140
  }
4141
- function Ta(n, e) {
4141
+ function Oa(n, e) {
4142
4142
  var t;
4143
4143
  return ((t = n == null ? void 0 : n._def) === null || t === void 0 ? void 0 : t.typeName) === e;
4144
4144
  }
@@ -4149,15 +4149,15 @@ function Ye(n, e) {
4149
4149
  return r._def.openapi = this._def.openapi, r;
4150
4150
  };
4151
4151
  }
4152
- function Oa(n) {
4152
+ function Sa(n) {
4153
4153
  if (typeof n.ZodType.prototype.openapi < "u")
4154
4154
  return;
4155
4155
  n.ZodType.prototype.openapi = function(r, a) {
4156
4156
  var o, c, d, u, l, j;
4157
- const A = typeof r == "string" ? a : r, U = A ?? {}, { param: ie } = U, $e = xa(U, ["param"]), oe = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof r == "string" ? { refId: r } : void 0), ce = Object.assign(Object.assign(Object.assign({}, (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata), $e), !((u = (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata) === null || u === void 0) && u.param || ie ? {
4157
+ const A = typeof r == "string" ? a : r, U = A ?? {}, { param: ie } = U, $e = Ta(U, ["param"]), oe = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof r == "string" ? { refId: r } : void 0), ce = Object.assign(Object.assign(Object.assign({}, (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata), $e), !((u = (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata) === null || u === void 0) && u.param || ie ? {
4158
4158
  param: Object.assign(Object.assign({}, (j = (l = this._def.openapi) === null || l === void 0 ? void 0 : l.metadata) === null || j === void 0 ? void 0 : j.param), ie)
4159
4159
  } : void 0), de = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(oe).length > 0 ? { _internal: oe } : void 0), Object.keys(ce).length > 0 ? { metadata: ce } : void 0) }));
4160
- if (Ta(this, "ZodObject")) {
4160
+ if (Oa(this, "ZodObject")) {
4161
4161
  const Pe = this.extend;
4162
4162
  de.extend = function(...De) {
4163
4163
  var K, H, Q, ue, xe, Te;
@@ -4295,7 +4295,7 @@ const g = C.arrayToEnum([
4295
4295
  "invalid_intersection_types",
4296
4296
  "not_multiple_of",
4297
4297
  "not_finite"
4298
- ]), Sa = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
4298
+ ]), Za = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
4299
4299
  class V extends Error {
4300
4300
  constructor(e) {
4301
4301
  super(), this.issues = [], this.addIssue = (s) => {
@@ -4413,7 +4413,7 @@ const Je = (n, e) => {
4413
4413
  return { message: t };
4414
4414
  };
4415
4415
  let Mn = Je;
4416
- function Za(n) {
4416
+ function ja(n) {
4417
4417
  Mn = n;
4418
4418
  }
4419
4419
  function Vt() {
@@ -4439,7 +4439,7 @@ const Ut = (n) => {
4439
4439
  path: a,
4440
4440
  message: c
4441
4441
  };
4442
- }, ja = [];
4442
+ }, Na = [];
4443
4443
  function m(n, e) {
4444
4444
  const t = Vt(), s = Ut({
4445
4445
  issueData: e,
@@ -4730,14 +4730,14 @@ class Z {
4730
4730
  return this.safeParse(null).success;
4731
4731
  }
4732
4732
  }
4733
- const Na = /^c[^\s-]{8,}$/i, Ca = /^[0-9a-z]+$/, Ia = /^[0-9A-HJKMNP-TV-Z]{26}$/, Ea = /^[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, Aa = /^[a-z0-9_-]{21}$/i, Ra = /^[-+]?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)?)??$/, $a = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Pa = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
4733
+ const Ca = /^c[^\s-]{8,}$/i, Ia = /^[0-9a-z]+$/, Ea = /^[0-9A-HJKMNP-TV-Z]{26}$/, Aa = /^[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, Ra = /^[a-z0-9_-]{21}$/i, $a = /^[-+]?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)?)??$/, Pa = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Da = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
4734
4734
  let Yt;
4735
- const Da = /^(?:(?: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])$/, Ma = /^(([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})))$/, La = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Vn = "((\\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])))", Va = new RegExp(`^${Vn}$`);
4735
+ const Ma = /^(?:(?: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])$/, La = /^(([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})))$/, Va = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Vn = "((\\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])))", Ua = new RegExp(`^${Vn}$`);
4736
4736
  function Un(n) {
4737
4737
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
4738
4738
  return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
4739
4739
  }
4740
- function Ua(n) {
4740
+ function Fa(n) {
4741
4741
  return new RegExp(`^${Un(n)}$`);
4742
4742
  }
4743
4743
  function Fn(n) {
@@ -4745,8 +4745,8 @@ function Fn(n) {
4745
4745
  const t = [];
4746
4746
  return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
4747
4747
  }
4748
- function Fa(n, e) {
4749
- return !!((e === "v4" || !e) && Da.test(n) || (e === "v6" || !e) && Ma.test(n));
4748
+ function za(n, e) {
4749
+ return !!((e === "v4" || !e) && Ma.test(n) || (e === "v6" || !e) && La.test(n));
4750
4750
  }
4751
4751
  class z extends Z {
4752
4752
  _parse(e) {
@@ -4797,43 +4797,43 @@ class z extends Z {
4797
4797
  message: a.message
4798
4798
  }), s.dirty());
4799
4799
  } else if (a.kind === "email")
4800
- $a.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4800
+ Pa.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4801
4801
  validation: "email",
4802
4802
  code: h.invalid_string,
4803
4803
  message: a.message
4804
4804
  }), s.dirty());
4805
4805
  else if (a.kind === "emoji")
4806
- Yt || (Yt = new RegExp(Pa, "u")), Yt.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4806
+ Yt || (Yt = new RegExp(Da, "u")), Yt.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4807
4807
  validation: "emoji",
4808
4808
  code: h.invalid_string,
4809
4809
  message: a.message
4810
4810
  }), s.dirty());
4811
4811
  else if (a.kind === "uuid")
4812
- Ea.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4812
+ Aa.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4813
4813
  validation: "uuid",
4814
4814
  code: h.invalid_string,
4815
4815
  message: a.message
4816
4816
  }), s.dirty());
4817
4817
  else if (a.kind === "nanoid")
4818
- Aa.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4818
+ Ra.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4819
4819
  validation: "nanoid",
4820
4820
  code: h.invalid_string,
4821
4821
  message: a.message
4822
4822
  }), s.dirty());
4823
4823
  else if (a.kind === "cuid")
4824
- Na.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4824
+ Ca.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4825
4825
  validation: "cuid",
4826
4826
  code: h.invalid_string,
4827
4827
  message: a.message
4828
4828
  }), s.dirty());
4829
4829
  else if (a.kind === "cuid2")
4830
- Ca.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4830
+ Ia.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4831
4831
  validation: "cuid2",
4832
4832
  code: h.invalid_string,
4833
4833
  message: a.message
4834
4834
  }), s.dirty());
4835
4835
  else if (a.kind === "ulid")
4836
- Ia.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4836
+ Ea.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4837
4837
  validation: "ulid",
4838
4838
  code: h.invalid_string,
4839
4839
  message: a.message
@@ -4868,23 +4868,23 @@ class z extends Z {
4868
4868
  code: h.invalid_string,
4869
4869
  validation: "datetime",
4870
4870
  message: a.message
4871
- }), s.dirty()) : a.kind === "date" ? Va.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4871
+ }), s.dirty()) : a.kind === "date" ? Ua.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4872
4872
  code: h.invalid_string,
4873
4873
  validation: "date",
4874
4874
  message: a.message
4875
- }), s.dirty()) : a.kind === "time" ? Ua(a).test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4875
+ }), s.dirty()) : a.kind === "time" ? Fa(a).test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4876
4876
  code: h.invalid_string,
4877
4877
  validation: "time",
4878
4878
  message: a.message
4879
- }), s.dirty()) : a.kind === "duration" ? Ra.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4879
+ }), s.dirty()) : a.kind === "duration" ? $a.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4880
4880
  validation: "duration",
4881
4881
  code: h.invalid_string,
4882
4882
  message: a.message
4883
- }), s.dirty()) : a.kind === "ip" ? Fa(e.data, a.version) || (r = this._getOrReturnCtx(e, r), m(r, {
4883
+ }), s.dirty()) : a.kind === "ip" ? za(e.data, a.version) || (r = this._getOrReturnCtx(e, r), m(r, {
4884
4884
  validation: "ip",
4885
4885
  code: h.invalid_string,
4886
4886
  message: a.message
4887
- }), s.dirty()) : a.kind === "base64" ? La.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4887
+ }), s.dirty()) : a.kind === "base64" ? Va.test(e.data) || (r = this._getOrReturnCtx(e, r), m(r, {
4888
4888
  validation: "base64",
4889
4889
  code: h.invalid_string,
4890
4890
  message: a.message
@@ -5106,7 +5106,7 @@ z.create = (n) => {
5106
5106
  ...O(n)
5107
5107
  });
5108
5108
  };
5109
- function za(n, e) {
5109
+ function Ba(n, e) {
5110
5110
  const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = parseInt(n.toFixed(r).replace(".", "")), o = parseInt(e.toFixed(r).replace(".", ""));
5111
5111
  return a % o / Math.pow(10, r);
5112
5112
  }
@@ -5145,7 +5145,7 @@ class ye extends Z {
5145
5145
  inclusive: a.inclusive,
5146
5146
  exact: !1,
5147
5147
  message: a.message
5148
- }), r.dirty()) : a.kind === "multipleOf" ? za(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), m(s, {
5148
+ }), r.dirty()) : a.kind === "multipleOf" ? Ba(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), m(s, {
5149
5149
  code: h.not_multiple_of,
5150
5150
  multipleOf: a.value,
5151
5151
  message: a.message
@@ -6846,7 +6846,7 @@ qt.create = (n) => new qt({
6846
6846
  typeName: b.ZodNaN,
6847
6847
  ...O(n)
6848
6848
  });
6849
- const Ba = Symbol("zod_brand");
6849
+ const Wa = Symbol("zod_brand");
6850
6850
  class pn extends Z {
6851
6851
  _parse(e) {
6852
6852
  const { ctx: t } = this._processInputParams(e), s = t.data;
@@ -6923,16 +6923,16 @@ function Bn(n, e = {}, t) {
6923
6923
  }
6924
6924
  }) : Ke.create();
6925
6925
  }
6926
- const Wa = {
6926
+ const qa = {
6927
6927
  object: E.lazycreate
6928
6928
  };
6929
6929
  var b;
6930
6930
  (function(n) {
6931
6931
  n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
6932
6932
  })(b || (b = {}));
6933
- const qa = (n, e = {
6933
+ const Ja = (n, e = {
6934
6934
  message: `Input not instance of ${n.name}`
6935
- }) => Bn((t) => t instanceof n, e), Wn = z.create, qn = ye.create, Ja = qt.create, Ka = ve.create, Jn = yt.create, Ha = Ce.create, Qa = zt.create, Ya = vt.create, Ga = wt.create, Xa = Ke.create, ei = Ze.create, ti = ae.create, ni = Bt.create, si = W.create, ri = E.create, ai = E.strictCreate, ii = bt.create, oi = Kt.create, ci = kt.create, di = ne.create, ui = xt.create, li = Wt.create, pi = Ie.create, hi = ze.create, fi = Tt.create, mi = Ot.create, _i = we.create, gi = St.create, yi = He.create, vn = J.create, vi = G.create, wi = be.create, bi = J.createWithPreprocess, ki = It.create, xi = () => Wn().optional(), Ti = () => qn().optional(), Oi = () => Jn().optional(), Si = {
6935
+ }) => Bn((t) => t instanceof n, e), Wn = z.create, qn = ye.create, Ka = qt.create, Ha = ve.create, Jn = yt.create, Qa = Ce.create, Ya = zt.create, Ga = vt.create, Xa = wt.create, ei = Ke.create, ti = Ze.create, ni = ae.create, si = Bt.create, ri = W.create, ai = E.create, ii = E.strictCreate, oi = bt.create, ci = Kt.create, di = kt.create, ui = ne.create, li = xt.create, pi = Wt.create, hi = Ie.create, fi = ze.create, mi = Tt.create, _i = Ot.create, gi = we.create, yi = St.create, vi = He.create, vn = J.create, wi = G.create, bi = be.create, ki = J.createWithPreprocess, xi = It.create, Ti = () => Wn().optional(), Oi = () => qn().optional(), Si = () => Jn().optional(), Zi = {
6936
6936
  string: (n) => z.create({ ...n, coerce: !0 }),
6937
6937
  number: (n) => ye.create({ ...n, coerce: !0 }),
6938
6938
  boolean: (n) => yt.create({
@@ -6941,14 +6941,14 @@ const qa = (n, e = {
6941
6941
  }),
6942
6942
  bigint: (n) => ve.create({ ...n, coerce: !0 }),
6943
6943
  date: (n) => Ce.create({ ...n, coerce: !0 })
6944
- }, Zi = k;
6945
- var ji = /* @__PURE__ */ Object.freeze({
6944
+ }, ji = k;
6945
+ var Ni = /* @__PURE__ */ Object.freeze({
6946
6946
  __proto__: null,
6947
6947
  defaultErrorMap: Je,
6948
- setErrorMap: Za,
6948
+ setErrorMap: ja,
6949
6949
  getErrorMap: Vt,
6950
6950
  makeIssue: Ut,
6951
- EMPTY_PATH: ja,
6951
+ EMPTY_PATH: Na,
6952
6952
  addIssueToContext: m,
6953
6953
  ParseStatus: P,
6954
6954
  INVALID: k,
@@ -7002,63 +7002,63 @@ var ji = /* @__PURE__ */ Object.freeze({
7002
7002
  ZodDefault: Zt,
7003
7003
  ZodCatch: jt,
7004
7004
  ZodNaN: qt,
7005
- BRAND: Ba,
7005
+ BRAND: Wa,
7006
7006
  ZodBranded: pn,
7007
7007
  ZodPipeline: It,
7008
7008
  ZodReadonly: Nt,
7009
7009
  custom: Bn,
7010
7010
  Schema: Z,
7011
7011
  ZodSchema: Z,
7012
- late: Wa,
7012
+ late: qa,
7013
7013
  get ZodFirstPartyTypeKind() {
7014
7014
  return b;
7015
7015
  },
7016
- coerce: Si,
7017
- any: Xa,
7018
- array: si,
7019
- bigint: Ka,
7016
+ coerce: Zi,
7017
+ any: ei,
7018
+ array: ri,
7019
+ bigint: Ha,
7020
7020
  boolean: Jn,
7021
- date: Ha,
7022
- discriminatedUnion: oi,
7021
+ date: Qa,
7022
+ discriminatedUnion: ci,
7023
7023
  effect: vn,
7024
- enum: _i,
7025
- function: hi,
7026
- instanceof: qa,
7027
- intersection: ci,
7028
- lazy: fi,
7029
- literal: mi,
7030
- map: li,
7031
- nan: Ja,
7032
- nativeEnum: gi,
7033
- never: ti,
7034
- null: Ga,
7035
- nullable: wi,
7024
+ enum: gi,
7025
+ function: fi,
7026
+ instanceof: Ja,
7027
+ intersection: di,
7028
+ lazy: mi,
7029
+ literal: _i,
7030
+ map: pi,
7031
+ nan: Ka,
7032
+ nativeEnum: yi,
7033
+ never: ni,
7034
+ null: Xa,
7035
+ nullable: bi,
7036
7036
  number: qn,
7037
- object: ri,
7038
- oboolean: Oi,
7039
- onumber: Ti,
7040
- optional: vi,
7041
- ostring: xi,
7042
- pipeline: ki,
7043
- preprocess: bi,
7044
- promise: yi,
7045
- record: ui,
7046
- set: pi,
7047
- strictObject: ai,
7037
+ object: ai,
7038
+ oboolean: Si,
7039
+ onumber: Oi,
7040
+ optional: wi,
7041
+ ostring: Ti,
7042
+ pipeline: xi,
7043
+ preprocess: ki,
7044
+ promise: vi,
7045
+ record: li,
7046
+ set: hi,
7047
+ strictObject: ii,
7048
7048
  string: Wn,
7049
- symbol: Qa,
7049
+ symbol: Ya,
7050
7050
  transformer: vn,
7051
- tuple: di,
7052
- undefined: Ya,
7053
- union: ii,
7054
- unknown: ei,
7055
- void: ni,
7056
- NEVER: Zi,
7051
+ tuple: ui,
7052
+ undefined: Ga,
7053
+ union: oi,
7054
+ unknown: ti,
7055
+ void: si,
7056
+ NEVER: ji,
7057
7057
  ZodIssueCode: h,
7058
- quotelessJson: Sa,
7058
+ quotelessJson: Za,
7059
7059
  ZodError: V
7060
7060
  });
7061
- Oa(ji);
7061
+ Sa(Ni);
7062
7062
  function Re(n, e = "", t = {}) {
7063
7063
  for (let s in n)
7064
7064
  if (Object.prototype.hasOwnProperty.call(n, s)) {
@@ -7085,7 +7085,7 @@ function hn(n, e) {
7085
7085
  }
7086
7086
  return t;
7087
7087
  }
7088
- function Ni(n) {
7088
+ function Ci(n) {
7089
7089
  return async (e, t) => {
7090
7090
  const s = {
7091
7091
  id: Ae(),
@@ -7096,7 +7096,7 @@ function Ni(n) {
7096
7096
  return await n.insertInto("connections").values({ ...Re(s), tenant_id: e }).execute(), s;
7097
7097
  };
7098
7098
  }
7099
- function Ci(n) {
7099
+ function Ii(n) {
7100
7100
  return async (e, t) => {
7101
7101
  let s = n.selectFrom("connections").where("connections.tenant_id", "=", e);
7102
7102
  t.q && (s = Ee(n, s, t.q, ["user_id", "ip"]));
@@ -7111,16 +7111,16 @@ function Ci(n) {
7111
7111
  };
7112
7112
  };
7113
7113
  }
7114
- function Ii(n) {
7114
+ function Ei(n) {
7115
7115
  return async (e, t) => (await n.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", t).executeTakeFirst()).numDeletedRows > 0;
7116
7116
  }
7117
- function Ei(n) {
7117
+ function Ai(n) {
7118
7118
  return async (e, t) => {
7119
7119
  const s = await n.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", t).selectAll().executeTakeFirst();
7120
7120
  return s ? R(hn(s, ["options"])) : null;
7121
7121
  };
7122
7122
  }
7123
- function Ai(n) {
7123
+ function Ri(n) {
7124
7124
  return async (e, t, s) => {
7125
7125
  const r = {
7126
7126
  ...s,
@@ -7129,16 +7129,16 @@ function Ai(n) {
7129
7129
  return await n.updateTable("connections").set(Re(r)).where("connections.id", "=", t).where("connections.tenant_id", "=", e).execute(), !0;
7130
7130
  };
7131
7131
  }
7132
- function Ri(n) {
7132
+ function $i(n) {
7133
7133
  return {
7134
- create: Ni(n),
7135
- get: Ei(n),
7136
- list: Ci(n),
7137
- remove: Ii(n),
7138
- update: Ai(n)
7134
+ create: Ci(n),
7135
+ get: Ai(n),
7136
+ list: Ii(n),
7137
+ remove: Ei(n),
7138
+ update: Ri(n)
7139
7139
  };
7140
7140
  }
7141
- function $i(n) {
7141
+ function Pi(n) {
7142
7142
  return {
7143
7143
  get: async (e) => {
7144
7144
  const t = await n.selectFrom("applications").selectAll().where("id", "=", e).executeTakeFirst();
@@ -7166,25 +7166,25 @@ function $i(n) {
7166
7166
  }
7167
7167
  };
7168
7168
  }
7169
- function Pi(n) {
7169
+ function Di(n) {
7170
7170
  return async () => await n.selectFrom("keys").where("revoked_at", "is", null).selectAll().execute();
7171
7171
  }
7172
- function Di(n) {
7172
+ function Mi(n) {
7173
7173
  return async (e) => {
7174
7174
  await n.insertInto("keys").values({ ...e, created_at: (/* @__PURE__ */ new Date()).toDateString() }).execute();
7175
7175
  };
7176
7176
  }
7177
- function Mi(n) {
7177
+ function Li(n) {
7178
7178
  return async (e, t) => !!(await n.updateTable("keys").set(t).where("kid", "=", e).execute()).length;
7179
7179
  }
7180
- function Li(n) {
7180
+ function Vi(n) {
7181
7181
  return {
7182
- create: Di(n),
7183
- list: Pi(n),
7184
- update: Mi(n)
7182
+ create: Mi(n),
7183
+ list: Di(n),
7184
+ update: Li(n)
7185
7185
  };
7186
7186
  }
7187
- function Vi(n) {
7187
+ function Ui(n) {
7188
7188
  return async (e, t) => {
7189
7189
  const s = {
7190
7190
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -7196,7 +7196,7 @@ function Vi(n) {
7196
7196
  return await n.insertInto("domains").values(s).execute(), s;
7197
7197
  };
7198
7198
  }
7199
- function Ui(n) {
7199
+ function Fi(n) {
7200
7200
  return async (e, t) => {
7201
7201
  let s = n.selectFrom("domains").where("domains.tenant_id", "=", e);
7202
7202
  t.q && (s = Ee(n, s, t.q, ["user_id", "ip"]));
@@ -7209,13 +7209,13 @@ function Ui(n) {
7209
7209
  };
7210
7210
  };
7211
7211
  }
7212
- function Fi(n) {
7212
+ function zi(n) {
7213
7213
  return {
7214
- create: Vi(n),
7215
- list: Ui(n)
7214
+ create: Ui(n),
7215
+ list: Fi(n)
7216
7216
  };
7217
7217
  }
7218
- function zi(n) {
7218
+ function Bi(n) {
7219
7219
  return async (e) => {
7220
7220
  const [t] = await n.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
7221
7221
  if (!t)
@@ -7245,7 +7245,7 @@ function zi(n) {
7245
7245
  });
7246
7246
  };
7247
7247
  }
7248
- function Bi(n) {
7248
+ function Wi(n) {
7249
7249
  return async (e, t) => {
7250
7250
  var o, c, d, u, l, j, A, U, ie, $e, oe, ce, de, Pe, De, K, H, Q;
7251
7251
  const { colors: s, font: r, ...a } = t;
@@ -7273,13 +7273,13 @@ function Bi(n) {
7273
7273
  }
7274
7274
  };
7275
7275
  }
7276
- function Wi(n) {
7276
+ function qi(n) {
7277
7277
  return {
7278
- get: zi(n),
7279
- set: Bi(n)
7278
+ get: Bi(n),
7279
+ set: Wi(n)
7280
7280
  };
7281
7281
  }
7282
- function qi(n) {
7282
+ function Ji(n) {
7283
7283
  return async (e, t) => {
7284
7284
  let s = n.selectFrom("hooks").where("hooks.tenant_id", "=", e);
7285
7285
  t.q && (s = Ee(n, s, t.q, ["url"]));
@@ -7299,16 +7299,16 @@ function qi(n) {
7299
7299
  };
7300
7300
  };
7301
7301
  }
7302
- function Ji(n) {
7302
+ function Ki(n) {
7303
7303
  return async (e, t) => {
7304
7304
  const s = await n.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", t).selectAll().executeTakeFirst();
7305
7305
  return s ? (s.enabled = !!s.enabled, s.synchronous = !!s.synchronous, R(s)) : null;
7306
7306
  };
7307
7307
  }
7308
- function Ki(n) {
7308
+ function Hi(n) {
7309
7309
  return async (e, t) => (await n.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", t).executeTakeFirst()).numDeletedRows > 0;
7310
7310
  }
7311
- function Hi(n) {
7311
+ function Qi(n) {
7312
7312
  return async (e, t) => {
7313
7313
  const s = {
7314
7314
  hook_id: Ae(),
@@ -7322,7 +7322,7 @@ function Hi(n) {
7322
7322
  }).execute(), s;
7323
7323
  };
7324
7324
  }
7325
- function Qi(n) {
7325
+ function Yi(n) {
7326
7326
  return async (e, t, s) => {
7327
7327
  const r = {
7328
7328
  ...s,
@@ -7331,16 +7331,16 @@ function Qi(n) {
7331
7331
  return await n.updateTable("hooks").set(r).where("hooks.hook_id", "=", t).where("hooks.tenant_id", "=", e).execute(), !0;
7332
7332
  };
7333
7333
  }
7334
- function Yi(n) {
7334
+ function Gi(n) {
7335
7335
  return {
7336
- create: Hi(n),
7337
- get: Ji(n),
7338
- list: qi(n),
7339
- update: Qi(n),
7340
- remove: Ki(n)
7336
+ create: Qi(n),
7337
+ get: Ki(n),
7338
+ list: Ji(n),
7339
+ update: Yi(n),
7340
+ remove: Hi(n)
7341
7341
  };
7342
7342
  }
7343
- function Gi(n) {
7343
+ function Xi(n) {
7344
7344
  return async (e, t) => {
7345
7345
  const s = {
7346
7346
  themeId: Ae(),
@@ -7351,16 +7351,16 @@ function Gi(n) {
7351
7351
  return await n.insertInto("themes").values({ ...Re(s), tenant_id: e }).execute(), s;
7352
7352
  };
7353
7353
  }
7354
- function Xi(n) {
7354
+ function eo(n) {
7355
7355
  return async (e, t) => (await n.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", t).executeTakeFirst()).numDeletedRows > 0;
7356
7356
  }
7357
- function eo(n) {
7357
+ function to(n) {
7358
7358
  return async (e, t) => {
7359
7359
  const s = await n.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", t).selectAll().executeTakeFirst();
7360
7360
  return s ? R(s) : null;
7361
7361
  };
7362
7362
  }
7363
- function to(n) {
7363
+ function no(n) {
7364
7364
  return async (e, t, s) => {
7365
7365
  const r = Re({
7366
7366
  ...s,
@@ -7369,15 +7369,15 @@ function to(n) {
7369
7369
  return await n.updateTable("themes").set(r).where("themes.id", "=", t).where("themes.tenant_id", "=", e).execute(), !0;
7370
7370
  };
7371
7371
  }
7372
- function no(n) {
7372
+ function so(n) {
7373
7373
  return {
7374
- create: Gi(n),
7375
- get: eo(n),
7376
- remove: Xi(n),
7377
- update: to(n)
7374
+ create: Xi(n),
7375
+ get: to(n),
7376
+ remove: eo(n),
7377
+ update: no(n)
7378
7378
  };
7379
7379
  }
7380
- function so(n) {
7380
+ function ro(n) {
7381
7381
  return async (e, t) => {
7382
7382
  const s = (/* @__PURE__ */ new Date()).toISOString(), r = await n.selectFrom("logins").where("logins.expires_at", ">", s).where("logins.login_id", "=", t).selectAll().executeTakeFirst();
7383
7383
  return r ? kr.parse(
@@ -7385,7 +7385,7 @@ function so(n) {
7385
7385
  ) : null;
7386
7386
  };
7387
7387
  }
7388
- function ro(n) {
7388
+ function ao(n) {
7389
7389
  return async (e, t) => {
7390
7390
  const s = {
7391
7391
  login_id: Ae(),
@@ -7396,23 +7396,23 @@ function ro(n) {
7396
7396
  return await n.insertInto("logins").values({ ...Re(s), tenant_id: e }).execute(), s;
7397
7397
  };
7398
7398
  }
7399
- function ao(n) {
7399
+ function io(n) {
7400
7400
  return async (e, t, s) => (await n.updateTable("logins").set(Re(s)).where("logins.login_id", "=", t).where("logins.tenant_id", "=", e).execute()).length === 1;
7401
7401
  }
7402
- function io(n) {
7402
+ function oo(n) {
7403
7403
  return async (e, t) => (await n.deleteFrom("logins").where("logins.tenant_id", "=", e).where("logins.login_id", "=", t).execute()).length > 0;
7404
7404
  }
7405
- function oo(n) {
7405
+ function co(n) {
7406
7406
  return {
7407
- create: ro(n),
7408
- get: so(n),
7409
- update: ao(n),
7410
- remove: io(n)
7407
+ create: ao(n),
7408
+ get: ro(n),
7409
+ update: io(n),
7410
+ remove: oo(n)
7411
7411
  };
7412
7412
  }
7413
- function co(n) {
7413
+ function uo(n) {
7414
7414
  return async (e) => {
7415
- const [t] = await n.selectFrom("promptSettings").where("promptSettings.tenant_id", "=", e).selectAll().execute();
7415
+ const [t] = await n.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
7416
7416
  return R({
7417
7417
  identifier_first: !!(t != null && t.identifier_first),
7418
7418
  password_first: !!(t != null && t.password_first),
@@ -7421,45 +7421,46 @@ function co(n) {
7421
7421
  });
7422
7422
  };
7423
7423
  }
7424
- function uo(n) {
7424
+ function lo(n) {
7425
7425
  return async (e, t) => {
7426
7426
  try {
7427
- await n.insertInto("promptSettings").values({
7428
- ...t,
7427
+ const s = Ar.parse(t);
7428
+ await n.insertInto("prompt_settings").values({
7429
+ ...s,
7429
7430
  tenant_id: e
7430
7431
  }).execute();
7431
7432
  } catch {
7432
- await n.updateTable("promptSettings").set(t).where("tenant_id", "=", e).execute();
7433
+ await n.updateTable("prompt_settings").set(t).where("tenant_id", "=", e).execute();
7433
7434
  }
7434
7435
  };
7435
7436
  }
7436
- function lo(n) {
7437
+ function po(n) {
7437
7438
  return {
7438
- get: co(n),
7439
- set: uo(n)
7439
+ get: uo(n),
7440
+ set: lo(n)
7440
7441
  };
7441
7442
  }
7442
- function ho(n) {
7443
+ function fo(n) {
7443
7444
  return {
7444
- applications: ka(n),
7445
- branding: Wi(n),
7446
- clients: $i(n),
7447
- codes: _a(n),
7448
- connections: Ri(n),
7449
- domains: Fi(n),
7450
- hooks: Yi(n),
7451
- keys: Li(n),
7452
- logins: oo(n),
7453
- logs: Yr(n),
7454
- passwords: la(n),
7455
- promptSettings: lo(n),
7456
- users: Lr(n),
7457
- sessions: sa(n),
7458
- tenants: qr(n),
7459
- themes: no(n),
7460
- tickets: oa(n)
7445
+ applications: xa(n),
7446
+ branding: qi(n),
7447
+ clients: Pi(n),
7448
+ codes: ga(n),
7449
+ connections: $i(n),
7450
+ domains: zi(n),
7451
+ hooks: Gi(n),
7452
+ keys: Vi(n),
7453
+ logins: co(n),
7454
+ logs: Gr(n),
7455
+ passwords: pa(n),
7456
+ promptSettings: po(n),
7457
+ users: Vr(n),
7458
+ sessions: ra(n),
7459
+ tenants: Jr(n),
7460
+ themes: so(n),
7461
+ tickets: ca(n)
7461
7462
  };
7462
7463
  }
7463
7464
  export {
7464
- ho as default
7465
+ fo as default
7465
7466
  };