@authhero/adapter-interfaces 4.2.1 → 4.3.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/LICENSE +1 -1
- package/dist/adapter-interfaces.cjs +1 -1
- package/dist/adapter-interfaces.d.ts +56 -2
- package/dist/adapter-interfaces.mjs +267 -247
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/adapters/UserRoles.d.ts +13 -0
- package/dist/types/types/AuditEvent.d.ts +3 -0
- package/dist/types/types/codeHookApiShapes.d.ts +37 -0
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +2 -1
|
@@ -21,6 +21,19 @@ export interface ListRoleUsersResponse {
|
|
|
21
21
|
next?: string;
|
|
22
22
|
}
|
|
23
23
|
export interface UserRolesAdapter {
|
|
24
|
+
/**
|
|
25
|
+
* List the roles assigned to a user, returned as a flat array.
|
|
26
|
+
*
|
|
27
|
+
* `organizationId` selects the scope and adapters MUST honor it exactly:
|
|
28
|
+
* - `undefined` — roles across every organization scope (no filter)
|
|
29
|
+
* - `""` — global / tenant-level roles only
|
|
30
|
+
* - `"<id>"` — that organization's roles only
|
|
31
|
+
*
|
|
32
|
+
* The empty-string case is load-bearing: callers pass `""` to read a user's
|
|
33
|
+
* global roles (e.g. the org-membership `admin:organizations` bypass), so an
|
|
34
|
+
* adapter that treats `""` as "all scopes" leaks org-scoped roles into global
|
|
35
|
+
* lookups (see #1198).
|
|
36
|
+
*/
|
|
24
37
|
list(tenantId: string, userId: string, params?: ListParams, organizationId?: string): Promise<Role[]>;
|
|
25
38
|
/**
|
|
26
39
|
* List the distinct users assigned to a role, across all organization
|
|
@@ -41,6 +41,7 @@ export declare const requestContextSchema: z.ZodObject<{
|
|
|
41
41
|
ip: z.ZodString;
|
|
42
42
|
user_agent: z.ZodOptional<z.ZodString>;
|
|
43
43
|
correlation_id: z.ZodOptional<z.ZodString>;
|
|
44
|
+
redirect_uri: z.ZodOptional<z.ZodString>;
|
|
44
45
|
}, z.core.$strip>;
|
|
45
46
|
export type RequestContext = z.infer<typeof requestContextSchema>;
|
|
46
47
|
export declare const responseContextSchema: z.ZodObject<{
|
|
@@ -105,6 +106,7 @@ export declare const auditEventInsertSchema: z.ZodObject<{
|
|
|
105
106
|
ip: z.ZodString;
|
|
106
107
|
user_agent: z.ZodOptional<z.ZodString>;
|
|
107
108
|
correlation_id: z.ZodOptional<z.ZodString>;
|
|
109
|
+
redirect_uri: z.ZodOptional<z.ZodString>;
|
|
108
110
|
}, z.core.$strip>;
|
|
109
111
|
response: z.ZodOptional<z.ZodObject<{
|
|
110
112
|
status_code: z.ZodNumber;
|
|
@@ -179,6 +181,7 @@ export declare const auditEventSchema: z.ZodObject<{
|
|
|
179
181
|
ip: z.ZodString;
|
|
180
182
|
user_agent: z.ZodOptional<z.ZodString>;
|
|
181
183
|
correlation_id: z.ZodOptional<z.ZodString>;
|
|
184
|
+
redirect_uri: z.ZodOptional<z.ZodString>;
|
|
182
185
|
}, z.core.$strip>;
|
|
183
186
|
response: z.ZodOptional<z.ZodObject<{
|
|
184
187
|
status_code: z.ZodNumber;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-trigger allowlist of namespaced API methods exposed to user-authored
|
|
3
|
+
* code hooks. Each entry maps a trigger id to `{ namespace: [method, ...] }`.
|
|
4
|
+
*
|
|
5
|
+
* Code hooks run in an isolate with a **recording** `api` proxy: user code calls
|
|
6
|
+
* `api.<namespace>.<method>(...)`, the call is captured as
|
|
7
|
+
* `{ method: "<namespace>.<method>", args }`, and the host replays it against
|
|
8
|
+
* the real API objects after the isolate returns. This shape is what the proxy
|
|
9
|
+
* is built from, so it is the single source of truth for *which* verbs a trigger
|
|
10
|
+
* exposes.
|
|
11
|
+
*
|
|
12
|
+
* It lives here (not in an executor) because both executors need an identical
|
|
13
|
+
* copy: the local `LocalCodeExecutor` builds the proxy in-process, and the
|
|
14
|
+
* Cloudflare `WorkerLoaderCodeExecutor` serializes this object into the
|
|
15
|
+
* generated worker script. Duplicating it risked the two drifting; importing
|
|
16
|
+
* this const keeps them byte-identical by construction.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TRIGGER_API_SHAPES: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
|
|
19
|
+
/**
|
|
20
|
+
* A single candidate primary the built-in email-based linking policy would
|
|
21
|
+
* consider, pre-resolved into a `post-user-login` code-hook event as
|
|
22
|
+
* `event.link_candidates`. Code hooks have no return channel and no data
|
|
23
|
+
* adapter, so link targets must be pushed *into* the event rather than looked
|
|
24
|
+
* up from user code. The shape is intentionally minimal and JSON-serializable.
|
|
25
|
+
*/
|
|
26
|
+
export interface LinkCandidate {
|
|
27
|
+
user_id: string;
|
|
28
|
+
email: string;
|
|
29
|
+
email_verified: boolean;
|
|
30
|
+
provider: string;
|
|
31
|
+
connection: string;
|
|
32
|
+
created_at: string;
|
|
33
|
+
/** No `linked_to` set — this user is itself a primary. */
|
|
34
|
+
is_primary: boolean;
|
|
35
|
+
/** The candidate the built-in "oldest account wins" policy would pick. */
|
|
36
|
+
is_oldest: boolean;
|
|
37
|
+
}
|
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.
|
|
14
|
+
"version": "4.3.0",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"nanoid": "^5.1.11"
|
|
46
46
|
},
|
|
47
|
+
"license": "MIT",
|
|
47
48
|
"scripts": {
|
|
48
49
|
"build": "vite build && tsc -p tsconfig.types.json && rollup -c rollup.dts.config.mjs"
|
|
49
50
|
}
|