@authhero/adapter-interfaces 4.10.0 → 4.12.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.
- package/dist/adapter-interfaces.cjs +1 -1
- package/dist/adapter-interfaces.d.ts +112 -6
- package/dist/adapter-interfaces.mjs +451 -419
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/adapters/RefreshTokens.d.ts +18 -1
- package/dist/types/types/Action.d.ts +40 -0
- package/dist/types/types/Code.d.ts +5 -2
- package/dist/types/utils/feature-not-supported.d.ts +26 -0
- package/dist/types/utils/http.d.ts +12 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/lucene.d.ts +7 -1
- package/package.json +1 -1
|
@@ -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:
|
|
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
|
|
@@ -85,3 +85,43 @@ export declare const actionSchema: z.ZodObject<{
|
|
|
85
85
|
updated_at: z.ZodString;
|
|
86
86
|
}, z.core.$strip>;
|
|
87
87
|
export type Action = z.infer<typeof actionSchema>;
|
|
88
|
+
/** A secret as it appears in an API response — name only, never the value. */
|
|
89
|
+
export declare const actionSecretNameSchema: z.ZodObject<{
|
|
90
|
+
name: z.ZodString;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
/**
|
|
93
|
+
* The action shape safe to return over HTTP.
|
|
94
|
+
*
|
|
95
|
+
* Identical to {@link actionSchema} except that secrets are narrowed to their
|
|
96
|
+
* names, so a secret value cannot leak through a management-API response —
|
|
97
|
+
* the route handlers already redact at runtime, and this makes the type
|
|
98
|
+
* system enforce it rather than relying on every handler remembering.
|
|
99
|
+
*/
|
|
100
|
+
export declare const actionResponseSchema: z.ZodObject<{
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
code: z.ZodString;
|
|
103
|
+
supported_triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
version: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strip>>>;
|
|
107
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
108
|
+
dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
version: z.ZodString;
|
|
111
|
+
}, z.core.$strip>>>;
|
|
112
|
+
is_system: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
inherit: z.ZodOptional<z.ZodBoolean>;
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
tenant_id: z.ZodString;
|
|
116
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
117
|
+
draft: "draft";
|
|
118
|
+
built: "built";
|
|
119
|
+
}>>;
|
|
120
|
+
deployed_at: z.ZodOptional<z.ZodString>;
|
|
121
|
+
created_at: z.ZodString;
|
|
122
|
+
updated_at: z.ZodString;
|
|
123
|
+
secrets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
}, z.core.$strip>>>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type ActionResponse = z.infer<typeof actionResponseSchema>;
|
|
@@ -7,11 +7,12 @@ export declare const codeTypeSchema: z.ZodEnum<{
|
|
|
7
7
|
authorization_code: "authorization_code";
|
|
8
8
|
oauth2_state: "oauth2_state";
|
|
9
9
|
ticket: "ticket";
|
|
10
|
+
client_assertion_jti: "client_assertion_jti";
|
|
10
11
|
}>;
|
|
11
12
|
export type CodeType = z.infer<typeof codeTypeSchema>;
|
|
12
13
|
export declare const codeInsertSchema: z.ZodObject<{
|
|
13
14
|
code_id: z.ZodString;
|
|
14
|
-
login_id: z.ZodString
|
|
15
|
+
login_id: z.ZodOptional<z.ZodString>;
|
|
15
16
|
connection_id: z.ZodOptional<z.ZodString>;
|
|
16
17
|
code_type: z.ZodEnum<{
|
|
17
18
|
password_reset: "password_reset";
|
|
@@ -21,6 +22,7 @@ export declare const codeInsertSchema: z.ZodObject<{
|
|
|
21
22
|
authorization_code: "authorization_code";
|
|
22
23
|
oauth2_state: "oauth2_state";
|
|
23
24
|
ticket: "ticket";
|
|
25
|
+
client_assertion_jti: "client_assertion_jti";
|
|
24
26
|
}>;
|
|
25
27
|
code_verifier: z.ZodOptional<z.ZodString>;
|
|
26
28
|
code_challenge: z.ZodOptional<z.ZodString>;
|
|
@@ -39,7 +41,7 @@ export declare const codeInsertSchema: z.ZodObject<{
|
|
|
39
41
|
export type CodeInsert = z.infer<typeof codeInsertSchema>;
|
|
40
42
|
export declare const codeSchema: z.ZodObject<{
|
|
41
43
|
code_id: z.ZodString;
|
|
42
|
-
login_id: z.ZodString
|
|
44
|
+
login_id: z.ZodOptional<z.ZodString>;
|
|
43
45
|
connection_id: z.ZodOptional<z.ZodString>;
|
|
44
46
|
code_type: z.ZodEnum<{
|
|
45
47
|
password_reset: "password_reset";
|
|
@@ -49,6 +51,7 @@ export declare const codeSchema: z.ZodObject<{
|
|
|
49
51
|
authorization_code: "authorization_code";
|
|
50
52
|
oauth2_state: "oauth2_state";
|
|
51
53
|
ticket: "ticket";
|
|
54
|
+
client_assertion_jti: "client_assertion_jti";
|
|
52
55
|
}>;
|
|
53
56
|
code_verifier: z.ZodOptional<z.ZodString>;
|
|
54
57
|
code_challenge: z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by an adapter when a backend cannot implement a feature at all —
|
|
3
|
+
* as opposed to a transient failure or a bad request.
|
|
4
|
+
*
|
|
5
|
+
* Adapters are free to leave parts of the surface unimplemented (the AWS
|
|
6
|
+
* DynamoDB adapter has no Actions support, for example). Throwing this
|
|
7
|
+
* instead of a plain `Error` lets HTTP callers recognise the gap and map it
|
|
8
|
+
* to `501 Not Implemented` rather than a generic `500`.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FeatureNotSupportedError extends Error {
|
|
11
|
+
/** The feature that is missing, e.g. `"actions"`. */
|
|
12
|
+
readonly feature: string;
|
|
13
|
+
/** The adapter that does not support it, e.g. `"aws-dynamodb"`. */
|
|
14
|
+
readonly adapter: string;
|
|
15
|
+
constructor(feature: string, adapter: string,
|
|
16
|
+
/** Optional extra context appended to the message. */
|
|
17
|
+
details?: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Narrows an unknown thrown value to a {@link FeatureNotSupportedError}.
|
|
21
|
+
*
|
|
22
|
+
* Uses the `name` rather than `instanceof` so it keeps working across module
|
|
23
|
+
* instances (a bundled adapter and the host can carry separate copies of the
|
|
24
|
+
* class).
|
|
25
|
+
*/
|
|
26
|
+
export declare function isFeatureNotSupportedError(error: unknown): error is FeatureNotSupportedError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response header stamped by the authhero control plane on its deliberate
|
|
3
|
+
* cross-host 302s — the `/authorize/resume` hop that sends the browser back
|
|
4
|
+
* to the host that served the original `/authorize` request so the session
|
|
5
|
+
* cookie lands on the right domain.
|
|
6
|
+
*
|
|
7
|
+
* Location-rewriting proxies (e.g. `@authhero/proxy`'s `rewrite_location`
|
|
8
|
+
* handler) must leave a marked Location untouched — rewriting it back onto
|
|
9
|
+
* the request host turns the hop into an infinite redirect loop — and strip
|
|
10
|
+
* the marker before the response reaches the browser.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PRESERVE_LOCATION_HEADER = "x-authhero-preserve-location";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./user-id";
|
|
2
|
+
export * from "./http";
|
|
2
3
|
export * from "./passthrough";
|
|
3
4
|
export * from "./connection-attributes";
|
|
4
5
|
export * from "./guards";
|
|
@@ -10,3 +11,4 @@ export * from "./cursor";
|
|
|
10
11
|
export * from "./lucene";
|
|
11
12
|
export * from "./session-retention";
|
|
12
13
|
export * from "./username-validation";
|
|
14
|
+
export * from "./feature-not-supported";
|
|
@@ -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
|
|
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;
|