@authhero/kysely-adapter 12.4.2 → 12.5.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.
@@ -0,0 +1,4 @@
1
+ import { Kysely } from "kysely";
2
+ import { Database } from "../../src/db";
3
+ export declare function up(db: Kysely<Database>): Promise<void>;
4
+ export declare function down(db: Kysely<Database>): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { Kysely } from "kysely";
2
+ import { Database } from "../../src/db";
3
+ export declare function up(db: Kysely<Database>): Promise<void>;
4
+ export declare function down(): Promise<void>;
@@ -5,6 +5,8 @@ import * as userBlocked from "./2026-08-05T12:00:00_user_blocked";
5
5
  import * as promptSettingsLastUsed from "./2026-08-09T12:00:00_prompt_settings_last_used";
6
6
  import * as actionExecutionsCreatedAtIndex from "./2026-08-10T12:00:00_action_executions_created_at_index";
7
7
  import * as pageHooks from "./2026-08-11T12:00:00_page_hooks";
8
+ import * as refreshTokenSessionId from "./2026-08-20T12:00:00_refresh_token_session_id";
9
+ import * as refreshTokenSessionIdBackfill from "./2026-08-21T12:00:00_refresh_token_session_id_backfill";
8
10
  /**
9
11
  * Kysely runs these in key order and refuses to start if an already-executed
10
12
  * migration sorts after a pending one, so the keys must sort in execution
@@ -28,5 +30,7 @@ declare const _default: {
28
30
  "2026-08-09T12:00:00_prompt_settings_last_used": typeof promptSettingsLastUsed;
29
31
  "2026-08-10T12:00:00_action_executions_created_at_index": typeof actionExecutionsCreatedAtIndex;
30
32
  "2026-08-11T12:00:00_page_hooks": typeof pageHooks;
33
+ "2026-08-20T12:00:00_refresh_token_session_id": typeof refreshTokenSessionId;
34
+ "2026-08-21T12:00:00_refresh_token_session_id_backfill": typeof refreshTokenSessionIdBackfill;
31
35
  };
32
36
  export default _default;
@@ -238,7 +238,10 @@ declare const sqlSessionSchema: z.ZodObject<{
238
238
  }, z.core.$strip>;
239
239
  declare const sqlRefreshTokensSchema: z.ZodObject<{
240
240
  client_id: z.ZodString;
241
+ organization: z.ZodOptional<z.ZodString>;
242
+ session_id: z.ZodOptional<z.ZodString>;
241
243
  user_id: z.ZodString;
244
+ auth_connection: z.ZodOptional<z.ZodString>;
242
245
  id: z.ZodString;
243
246
  login_id: z.ZodString;
244
247
  token_lookup: z.ZodOptional<z.ZodString>;
@@ -249,6 +252,8 @@ declare const sqlRefreshTokensSchema: z.ZodObject<{
249
252
  device: z.ZodString;
250
253
  resource_servers: z.ZodString;
251
254
  rotating: z.ZodNumber;
255
+ auth_strategy_strategy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
256
+ auth_strategy_strategy_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
257
  created_at_ts: z.ZodNumber;
253
258
  expires_at_ts: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
254
259
  idle_expires_at_ts: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -1,4 +1,4 @@
1
- import { ListParams, ListRefreshTokenResponse } from "@authhero/adapter-interfaces";
1
+ import { ListRefreshTokenResponse, RefreshTokenListParams } from "@authhero/adapter-interfaces";
2
2
  import { Kysely } from "kysely";
3
3
  import { Database } from "../db";
4
- export declare function list(db: Kysely<Database>): (tenant_id: string, params?: ListParams) => Promise<ListRefreshTokenResponse>;
4
+ export declare function list(db: Kysely<Database>): (tenant_id: string, params?: RefreshTokenListParams) => Promise<ListRefreshTokenResponse>;
@@ -0,0 +1,13 @@
1
+ import { Kysely } from "kysely";
2
+ import { Database } from "../db";
3
+ /**
4
+ * Soft-revoke every unrevoked refresh token belonging to a user.
5
+ *
6
+ * Exact tenant + user predicates rather than a `q` filter: the Lucene grammar
7
+ * splits on ` OR ` before tokenizing, so a crafted user id can widen the match
8
+ * to another user's rows.
9
+ *
10
+ * `revoked_at_ts IS NULL` keeps this idempotent and concurrency-safe — a second
11
+ * revocation cannot overwrite the audit timestamp written by the first.
12
+ */
13
+ export declare function revokeByUser(db: Kysely<Database>): (tenant_id: string, user_id: string, revoked_at: string) => Promise<number>;
@@ -0,0 +1,11 @@
1
+ import { RefreshToken } from "@authhero/adapter-interfaces";
2
+ import { Selectable } from "kysely";
3
+ import { Database } from "../db";
4
+ /**
5
+ * Map a `refresh_tokens` row onto the adapter shape.
6
+ *
7
+ * Shared by get / getByLookup / list so the three readers cannot drift — in
8
+ * particular the `auth_strategy` re-nesting, which is stored as two flat
9
+ * columns but exposed as one nested object.
10
+ */
11
+ export declare function toRefreshToken(row: Selectable<Database["refresh_tokens"]>): RefreshToken;