@authhero/adapter-interfaces 4.9.0 → 4.11.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.
@@ -28,6 +28,23 @@ export interface UpdateRefreshTokenOptions {
28
28
  expires_at: string;
29
29
  };
30
30
  }
31
+ /**
32
+ * Update payload for a refresh token.
33
+ *
34
+ * The two expiry columns are three-valued on the way in: `undefined` leaves
35
+ * the stored value alone, a string overwrites it, and `null` clears it — the
36
+ * token stops expiring on that axis.
37
+ *
38
+ * Clearing exists for the in-place refresh exchange. A rotating client
39
+ * reconciles a changed refresh-token config for free, because the child row is
40
+ * minted from the current lifetimes; a non-rotating one keeps handing back the
41
+ * row it was given, so switching a client to non-expiring has to be able to
42
+ * drop the expiries that row was stamped with.
43
+ */
44
+ export type RefreshTokenUpdate = Partial<Omit<RefreshToken, "expires_at" | "idle_expires_at">> & {
45
+ expires_at?: string | null;
46
+ idle_expires_at?: string | null;
47
+ };
31
48
  export interface RefreshTokensAdapter {
32
49
  create: (tenant_id: string, refresh_token: RefreshTokenInsert) => Promise<RefreshToken>;
33
50
  get: (tenant_id: string, id: string) => Promise<RefreshToken | null>;
@@ -38,7 +55,7 @@ export interface RefreshTokensAdapter {
38
55
  */
39
56
  getByLookup: (tenant_id: string, token_lookup: string) => Promise<RefreshToken | null>;
40
57
  list(tenant_id: string, params?: RefreshTokenListParams): Promise<ListRefreshTokenResponse>;
41
- update: (tenant_id: string, id: string, refresh_token: Partial<RefreshToken>, options?: UpdateRefreshTokenOptions) => Promise<boolean>;
58
+ update: (tenant_id: string, id: string, refresh_token: RefreshTokenUpdate, options?: UpdateRefreshTokenOptions) => Promise<boolean>;
42
59
  remove: (tenant_id: string, id: string) => Promise<boolean>;
43
60
  /**
44
61
  * Soft-revoke every refresh token belonging to a user that isn't already
@@ -53,6 +70,23 @@ export interface RefreshTokensAdapter {
53
70
  */
54
71
  revokeByUser: (tenant_id: string, user_id: string, revoked_at: string) => Promise<number>;
55
72
  revokeByLoginSession: (tenant_id: string, login_session_id: string, revoked_at: string) => Promise<number>;
73
+ /**
74
+ * Soft-revoke every refresh token owned by a session that isn't already
75
+ * revoked. This is the cascade behind "revoking a session revokes its
76
+ * refresh tokens" — deliberate revocation only.
77
+ *
78
+ * It must never be called for a session that merely *expired* or that
79
+ * cleanup removed: a refresh token is designed to outlive its session, and
80
+ * killing tokens on an SSO timeout would log out every long-lived native
81
+ * client. Lifetime does not couple; revocation does.
82
+ *
83
+ * Rows minted before `session_id` existed carry no value here and are not
84
+ * matched — callers sweep `revokeByLoginSession` alongside this until those
85
+ * rows have aged out (#1259).
86
+ *
87
+ * Returns the number of tokens revoked.
88
+ */
89
+ revokeBySession: (tenant_id: string, session_id: string, revoked_at: string) => Promise<number>;
56
90
  /**
57
91
  * Soft-revoke every refresh token that shares `family_id` and isn't already
58
92
  * revoked. Used for reuse detection (entire rotation chain torched) and for
@@ -1,7 +1,13 @@
1
1
  /**
2
2
  * Shared pieces of the Lucene-style `q` filter handling. The SQL generation
3
3
  * itself is ORM-specific and lives in each adapter; what is shared here is
4
- * the query-string sanitization that enforces the tenant boundary.
4
+ * the tokenizer (including the OR split) and the query-string sanitization
5
+ * that enforces the tenant boundary.
5
6
  */
7
+ export declare function tokenizeLuceneQuery(query: string): string[];
8
+ export declare function unescapeLuceneValue(value: string): string;
9
+ export declare function escapeLuceneValue(value: string): string;
10
+ export declare function unquoteLuceneValue(value: string): string;
11
+ export declare function splitLuceneOrGroups(query: string): string[][];
6
12
  export declare function sanitizeLuceneQuery(query: string, allowedFields: string[]): string;
7
13
  export declare function isEmailSearchTerm(value: string): boolean;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "4.9.0",
14
+ "version": "4.11.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],