@authhero/kysely-adapter 11.21.1 → 12.0.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.
@@ -634,7 +634,7 @@ var Ge = [
634
634
  "login_count",
635
635
  "created_at",
636
636
  "updated_at"
637
- ], Ke = /* @__PURE__ */ new Set([
637
+ ], Ke = new Set([
638
638
  "last_login",
639
639
  "last_ip",
640
640
  "login_count"
@@ -1826,7 +1826,7 @@ function on(e) {
1826
1826
  }
1827
1827
  function sn(e) {
1828
1828
  return async (t, n) => {
1829
- let r = e.selectFrom("clients").where("clients.tenant_id", "=", t), i = /* @__PURE__ */ new Set(["owner_user_id", "registration_type"]);
1829
+ let r = e.selectFrom("clients").where("clients.tenant_id", "=", t), i = new Set(["owner_user_id", "registration_type"]);
1830
1830
  if (n?.q) {
1831
1831
  let e = n.q.trim().match(/^([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/);
1832
1832
  if (e && i.has(e[1]) && e[2]) {
@@ -1997,7 +1997,7 @@ function hn(e) {
1997
1997
  let i = await e.selectFrom("clients").where("clients.tenant_id", "=", t).where("clients.client_id", "=", r).select("connections").executeTakeFirst();
1998
1998
  if (!i) return !1;
1999
1999
  let a = JSON.parse(i.connections || "[]"), o = a.filter((e) => e !== n);
2000
- return o.length === a.length || (await e.updateTable("clients").set({
2000
+ return o.length === a.length ? !0 : (await e.updateTable("clients").set({
2001
2001
  connections: JSON.stringify(o),
2002
2002
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
2003
2003
  }).where("clients.tenant_id", "=", t).where("clients.client_id", "=", r).executeTakeFirst()).numUpdatedRows > 0;
@@ -2053,8 +2053,8 @@ function vn(e) {
2053
2053
  audience: r.audience,
2054
2054
  scope: r.scope ? JSON.parse(r.scope) : [],
2055
2055
  organization_usage: r.organization_usage,
2056
- allow_any_organization: r.allow_any_organization !== void 0 && !!r.allow_any_organization,
2057
- is_system: r.is_system !== void 0 && !!r.is_system,
2056
+ allow_any_organization: r.allow_any_organization === void 0 ? !1 : !!r.allow_any_organization,
2057
+ is_system: r.is_system === void 0 ? !1 : !!r.is_system,
2058
2058
  subject_type: r.subject_type,
2059
2059
  authorization_details_types: r.authorization_details_types ? JSON.parse(r.authorization_details_types) : [],
2060
2060
  created_at: r.created_at,
@@ -3682,7 +3682,7 @@ function xi(e) {
3682
3682
  return async (n, r) => {
3683
3683
  let i = (/* @__PURE__ */ new Date()).toISOString(), a = r.scope ?? [], o = r.audience ?? "", s = await e.selectFrom("grants").where("tenant_id", "=", n).where("user_id", "=", r.user_id).where("client_id", "=", r.clientID).where("audience", "=", o).selectAll().executeTakeFirst();
3684
3684
  if (s) {
3685
- let t = s.scope ? JSON.parse(s.scope) : [], r = Array.from(/* @__PURE__ */ new Set([...t, ...a]));
3685
+ let t = s.scope ? JSON.parse(s.scope) : [], r = Array.from(new Set([...t, ...a]));
3686
3686
  return await e.updateTable("grants").set({
3687
3687
  scope: JSON.stringify(r),
3688
3688
  updated_at: i
@@ -4407,7 +4407,7 @@ function ta(e) {
4407
4407
  function na(e) {
4408
4408
  return async (t, n, r) => {
4409
4409
  let i = {};
4410
- return r.inviter !== void 0 && (i.inviter = JSON.stringify(r.inviter)), r.invitee !== void 0 && (i.invitee = JSON.stringify(r.invitee)), r.client_id !== void 0 && (i.client_id = r.client_id), r.connection_id !== void 0 && (i.connection_id = r.connection_id), r.app_metadata !== void 0 && (i.app_metadata = JSON.stringify(r.app_metadata)), r.user_metadata !== void 0 && (i.user_metadata = JSON.stringify(r.user_metadata)), r.roles !== void 0 && (i.roles = JSON.stringify(r.roles)), r.ttl_sec !== void 0 && (i.ttl_sec = r.ttl_sec, i.expires_at = new Date(Date.now() + r.ttl_sec * 1e3).toISOString()), r.send_invitation_email !== void 0 && (i.send_invitation_email = +!!r.send_invitation_email), Object.keys(i).length === 0 || (await e.updateTable("invites").set(i).where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst()).numUpdatedRows > 0n;
4410
+ return r.inviter !== void 0 && (i.inviter = JSON.stringify(r.inviter)), r.invitee !== void 0 && (i.invitee = JSON.stringify(r.invitee)), r.client_id !== void 0 && (i.client_id = r.client_id), r.connection_id !== void 0 && (i.connection_id = r.connection_id), r.app_metadata !== void 0 && (i.app_metadata = JSON.stringify(r.app_metadata)), r.user_metadata !== void 0 && (i.user_metadata = JSON.stringify(r.user_metadata)), r.roles !== void 0 && (i.roles = JSON.stringify(r.roles)), r.ttl_sec !== void 0 && (i.ttl_sec = r.ttl_sec, i.expires_at = new Date(Date.now() + r.ttl_sec * 1e3).toISOString()), r.send_invitation_email !== void 0 && (i.send_invitation_email = +!!r.send_invitation_email), Object.keys(i).length === 0 ? !0 : (await e.updateTable("invites").set(i).where("tenant_id", "=", t).where("id", "=", n).executeTakeFirst()).numUpdatedRows > 0n;
4411
4411
  };
4412
4412
  }
4413
4413
  //#endregion