@absolutejs/auth 0.47.0 → 0.48.1

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.
package/dist/index.js CHANGED
@@ -581,6 +581,27 @@ var providers = defineProviders({
581
581
  url: "https://api.close.com/oauth2/token/"
582
582
  }
583
583
  },
584
+ calendly: {
585
+ authorizationUrl: "https://auth.calendly.com/oauth/authorize",
586
+ email: ["resource", "email"],
587
+ fullName: ["resource", "name"],
588
+ isOIDC: false,
589
+ isRefreshable: true,
590
+ profileRequest: {
591
+ authIn: "header",
592
+ encoding: "application/json",
593
+ method: "GET",
594
+ url: "https://api.calendly.com/users/me"
595
+ },
596
+ scopeRequired: false,
597
+ subject: ["resource", "uri"],
598
+ subjectType: "string",
599
+ tokenRequest: {
600
+ authIn: "body",
601
+ encoding: "application/x-www-form-urlencoded",
602
+ url: "https://auth.calendly.com/oauth/token"
603
+ }
604
+ },
584
605
  coinbase: {
585
606
  authorizationUrl: "https://www.coinbase.com/oauth/authorize",
586
607
  isOIDC: false,
@@ -9605,6 +9626,22 @@ var performStoreCleanup = async ({
9605
9626
  onSessionCleanup
9606
9627
  }) => {
9607
9628
  const now = Date.now();
9629
+ if (authSessionStore.deleteExpired) {
9630
+ const removedSessionCount = await authSessionStore.deleteExpired();
9631
+ const removedUnregisteredCount = await authSessionStore.deleteExpiredUnregistered?.() ?? 0;
9632
+ if (removedSessionCount > 0 || removedUnregisteredCount > 0) {
9633
+ console.info(`[sessionCleanup] deleted expired sessions=${removedSessionCount} unregistered=${removedUnregisteredCount}`);
9634
+ }
9635
+ try {
9636
+ await onSessionCleanup?.({
9637
+ removedSessions: new Map,
9638
+ removedUnregisteredSessions: new Map
9639
+ });
9640
+ } catch (err) {
9641
+ console.error("[sessionCleanup] onSessionCleanup handler failed:", err);
9642
+ }
9643
+ return;
9644
+ }
9608
9645
  const sessionEntries = await loadStoreSessions(authSessionStore);
9609
9646
  const unregisteredEntries = await loadStoreUnregisteredSessions(authSessionStore);
9610
9647
  if (!sessionEntries || !unregisteredEntries) {
@@ -11652,6 +11689,19 @@ var ExtraConfigColumn = class extends PgColumn {
11652
11689
  return this;
11653
11690
  }
11654
11691
  };
11692
+ var IndexedColumn = class {
11693
+ static [entityKind] = "IndexedColumn";
11694
+ constructor(name2, keyAsName, type, indexConfig) {
11695
+ this.name = name2;
11696
+ this.keyAsName = keyAsName;
11697
+ this.type = type;
11698
+ this.indexConfig = indexConfig;
11699
+ }
11700
+ name;
11701
+ keyAsName;
11702
+ type;
11703
+ indexConfig;
11704
+ };
11655
11705
 
11656
11706
  // node_modules/drizzle-orm/pg-core/columns/int.common.js
11657
11707
  var PgIntColumnBuilder = class extends PgColumnBuilder {
@@ -13632,30 +13682,53 @@ var PrimaryKey = class {
13632
13682
  return this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk`;
13633
13683
  }
13634
13684
  };
13635
- // node_modules/drizzle-orm/pg-core/checks.js
13636
- var CheckBuilder = class {
13637
- static [entityKind] = "PgCheckBuilder";
13638
- brand;
13639
- constructor(name2, value) {
13685
+ // node_modules/drizzle-orm/pg-core/indexes.js
13686
+ var IndexBuilderOn = class {
13687
+ static [entityKind] = "PgIndexBuilderOn";
13688
+ constructor(unique, name2) {
13689
+ this.unique = unique;
13640
13690
  this.name = name2;
13641
- this.value = value;
13642
13691
  }
13643
- build(table) {
13644
- return new Check(table, this);
13645
- }
13646
- };
13647
- var Check = class {
13648
- static [entityKind] = "PgCheck";
13649
- name;
13650
- value;
13651
- constructor(table, builder) {
13652
- this.table = table;
13653
- this.name = builder.name;
13654
- this.value = builder.value;
13692
+ on(...columns) {
13693
+ return new IndexBuilder(columns.map((it) => {
13694
+ if (is(it, SQL))
13695
+ return it;
13696
+ if (is(it, ExtraConfigColumn)) {
13697
+ const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
13698
+ it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
13699
+ return clonedIndexedColumn;
13700
+ }
13701
+ it = it;
13702
+ return new IndexedColumn(it.name, !!it.keyAsName, it.columnType, {});
13703
+ }), this.unique, false, this.name);
13704
+ }
13705
+ onOnly(...columns) {
13706
+ return new IndexBuilder(columns.map((it) => {
13707
+ if (is(it, SQL))
13708
+ return it;
13709
+ if (is(it, ExtraConfigColumn)) {
13710
+ const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
13711
+ it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
13712
+ return clonedIndexedColumn;
13713
+ }
13714
+ it = it;
13715
+ return new IndexedColumn(it.name, !!it.keyAsName, it.columnType, {});
13716
+ }), this.unique, true, this.name);
13717
+ }
13718
+ using(method, ...columns) {
13719
+ return new IndexBuilder(columns.map((it) => {
13720
+ if (is(it, SQL))
13721
+ return it;
13722
+ if (is(it, ExtraConfigColumn)) {
13723
+ const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
13724
+ it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
13725
+ return clonedIndexedColumn;
13726
+ }
13727
+ it = it;
13728
+ return new IndexedColumn(it.name, !!it.keyAsName, it.columnType, {});
13729
+ }), this.unique, true, this.name, method);
13655
13730
  }
13656
13731
  };
13657
-
13658
- // node_modules/drizzle-orm/pg-core/indexes.js
13659
13732
  var IndexBuilder = class {
13660
13733
  static [entityKind] = "PgIndexBuilder";
13661
13734
  config;
@@ -13696,6 +13769,31 @@ var Index = class {
13696
13769
  this.isNameExplicit = !!config.name;
13697
13770
  }
13698
13771
  };
13772
+ function index(name2) {
13773
+ return new IndexBuilderOn(false, name2);
13774
+ }
13775
+ // node_modules/drizzle-orm/pg-core/checks.js
13776
+ var CheckBuilder = class {
13777
+ static [entityKind] = "PgCheckBuilder";
13778
+ brand;
13779
+ constructor(name2, value) {
13780
+ this.name = name2;
13781
+ this.value = value;
13782
+ }
13783
+ build(table) {
13784
+ return new Check(table, this);
13785
+ }
13786
+ };
13787
+ var Check = class {
13788
+ static [entityKind] = "PgCheck";
13789
+ name;
13790
+ value;
13791
+ constructor(table, builder) {
13792
+ this.table = table;
13793
+ this.name = builder.name;
13794
+ this.value = builder.value;
13795
+ }
13796
+ };
13699
13797
 
13700
13798
  // node_modules/drizzle-orm/pg-core/policies.js
13701
13799
  var PgPolicy = class {
@@ -21565,7 +21663,7 @@ var authSessionsTable = pgTable("auth_sessions", {
21565
21663
  refresh_token: text("refresh_token"),
21566
21664
  updated_at: timestamp("updated_at").notNull().defaultNow(),
21567
21665
  user_json: jsonb("user_json").$type().notNull()
21568
- });
21666
+ }, (table) => [index("auth_sessions_expires_at_idx").on(table.expires_at_ms)]);
21569
21667
  var authUnregisteredSessionsTable = pgTable("auth_unregistered_sessions", {
21570
21668
  access_token: text("access_token"),
21571
21669
  created_at: timestamp("created_at").notNull().defaultNow(),
@@ -21575,7 +21673,9 @@ var authUnregisteredSessionsTable = pgTable("auth_unregistered_sessions", {
21575
21673
  session_information_json: jsonb("session_information_json").$type(),
21576
21674
  updated_at: timestamp("updated_at").notNull().defaultNow(),
21577
21675
  user_identity_json: jsonb("user_identity_json").$type()
21578
- });
21676
+ }, (table) => [
21677
+ index("auth_unregistered_sessions_expires_at_idx").on(table.expires_at_ms)
21678
+ ]);
21579
21679
  var cloneUser = (value) => {
21580
21680
  if (value === null || value === undefined)
21581
21681
  return value;
@@ -21616,6 +21716,14 @@ var createNeonAuthSessionStore = (databaseUrl) => {
21616
21716
  const rows = await db.select({ id: authUnregisteredSessionsTable.id }).from(authUnregisteredSessionsTable);
21617
21717
  return rows.map((row) => row.id).filter(isUserSessionId);
21618
21718
  },
21719
+ deleteExpired: async () => {
21720
+ const rows = await db.delete(authSessionsTable).where(lt(authSessionsTable.expires_at_ms, Date.now())).returning({ id: authSessionsTable.id });
21721
+ return rows.length;
21722
+ },
21723
+ deleteExpiredUnregistered: async () => {
21724
+ const rows = await db.delete(authUnregisteredSessionsTable).where(lt(authUnregisteredSessionsTable.expires_at_ms, Date.now())).returning({ id: authUnregisteredSessionsTable.id });
21725
+ return rows.length;
21726
+ },
21619
21727
  removeSession: async (id) => {
21620
21728
  await db.delete(authSessionsTable).where(eq(authSessionsTable.id, id));
21621
21729
  },
@@ -27445,5 +27553,5 @@ export {
27445
27553
  AuthIdentityConflictError
27446
27554
  };
27447
27555
 
27448
- //# debugId=AEEC1560A2CA950D64756E2164756E21
27556
+ //# debugId=07E6619F2A4E193764756E2164756E21
27449
27557
  //# sourceMappingURL=index.js.map