@authhero/adapter-interfaces 2.6.1 → 2.8.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 +103 -2
- package/dist/adapter-interfaces.mjs +2618 -3401
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/adapters/EmailService.d.ts +9 -0
- package/dist/types/adapters/ProxyRoutes.d.ts +19 -0
- package/dist/types/adapters/SmsService.d.ts +2 -0
- package/dist/types/adapters/index.d.ts +9 -0
- package/dist/types/types/ProxyRoute.d.ts +65 -0
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +4 -6
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { EmailProvider } from "../types";
|
|
2
|
+
export interface CreateServiceTokenParams {
|
|
3
|
+
clientId: string;
|
|
4
|
+
scope: string;
|
|
5
|
+
audience?: string;
|
|
6
|
+
expiresInSeconds?: number;
|
|
7
|
+
customClaims?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export type CreateServiceTokenFn = (params: CreateServiceTokenParams) => Promise<string>;
|
|
2
10
|
export interface EmailServiceSendParams {
|
|
3
11
|
emailProvider: EmailProvider;
|
|
4
12
|
to: string;
|
|
@@ -8,6 +16,7 @@ export interface EmailServiceSendParams {
|
|
|
8
16
|
text?: string;
|
|
9
17
|
template: string;
|
|
10
18
|
data: Record<string, string>;
|
|
19
|
+
createServiceToken?: CreateServiceTokenFn;
|
|
11
20
|
}
|
|
12
21
|
export interface EmailServiceAdapter {
|
|
13
22
|
send(params: EmailServiceSendParams): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ProxyRoute, ProxyRouteInsert, ProxyRouteUpdate } from "../types/ProxyRoute";
|
|
2
|
+
export interface ListProxyRoutesParams {
|
|
3
|
+
page?: number;
|
|
4
|
+
per_page?: number;
|
|
5
|
+
custom_domain_id?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ListProxyRoutesResult {
|
|
8
|
+
proxy_routes: ProxyRoute[];
|
|
9
|
+
start: number;
|
|
10
|
+
limit: number;
|
|
11
|
+
length: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ProxyRoutesAdapter {
|
|
14
|
+
create(tenant_id: string, route: ProxyRouteInsert): Promise<ProxyRoute>;
|
|
15
|
+
get(tenant_id: string, id: string): Promise<ProxyRoute | null>;
|
|
16
|
+
list(tenant_id: string, params?: ListProxyRoutesParams): Promise<ListProxyRoutesResult>;
|
|
17
|
+
update(tenant_id: string, id: string, route: ProxyRouteUpdate): Promise<boolean>;
|
|
18
|
+
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
19
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CreateServiceTokenFn } from "./EmailService";
|
|
1
2
|
export interface SmsServiceSendParams {
|
|
2
3
|
to: string;
|
|
3
4
|
from?: string;
|
|
@@ -5,6 +6,7 @@ export interface SmsServiceSendParams {
|
|
|
5
6
|
template: string;
|
|
6
7
|
options: Record<string, unknown>;
|
|
7
8
|
data: Record<string, string>;
|
|
9
|
+
createServiceToken?: CreateServiceTokenFn;
|
|
8
10
|
}
|
|
9
11
|
export interface SmsServiceAdapter {
|
|
10
12
|
send(params: SmsServiceSendParams): Promise<void>;
|
|
@@ -24,6 +24,7 @@ import { HookCodeAdapter } from "./HookCode";
|
|
|
24
24
|
import { ThemesAdapter } from "./Themes";
|
|
25
25
|
import { LoginSessionsAdapter } from "./LoginSessions";
|
|
26
26
|
import { PromptSettingsAdapter } from "./PromptSettings";
|
|
27
|
+
import { ProxyRoutesAdapter } from "./ProxyRoutes";
|
|
27
28
|
import { EmailProvidersAdapter } from "./EmailProviders";
|
|
28
29
|
import { EmailTemplatesAdapter } from "./EmailTemplates";
|
|
29
30
|
import { RefreshTokensAdapter } from "./RefreshTokens";
|
|
@@ -89,6 +90,13 @@ export interface DataAdapters {
|
|
|
89
90
|
migrationSources?: MigrationSourcesAdapter;
|
|
90
91
|
passwords: PasswordsAdapter;
|
|
91
92
|
promptSettings: PromptSettingsAdapter;
|
|
93
|
+
/**
|
|
94
|
+
* Optional adapter for managing reverse-proxy route configuration per tenant.
|
|
95
|
+
* When set, AuthHero mounts the `/api/v2/proxy-routes` management API. A
|
|
96
|
+
* separate proxy worker (see `@authhero/proxy`) reads the same data either
|
|
97
|
+
* directly from the database or by calling this management API.
|
|
98
|
+
*/
|
|
99
|
+
proxyRoutes?: ProxyRoutesAdapter;
|
|
92
100
|
refreshTokens: RefreshTokensAdapter;
|
|
93
101
|
resourceServers: ResourceServersAdapter;
|
|
94
102
|
rolePermissions: RolePermissionsAdapter;
|
|
@@ -208,6 +216,7 @@ export * from "./LoginSessions";
|
|
|
208
216
|
export * from "./Logs";
|
|
209
217
|
export * from "./Passwords";
|
|
210
218
|
export * from "./PromptSettings";
|
|
219
|
+
export * from "./ProxyRoutes";
|
|
211
220
|
export * from "./ResourceServers";
|
|
212
221
|
export * from "./Roles";
|
|
213
222
|
export * from "./Sessions";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const matchSchema: z.ZodObject<{
|
|
3
|
+
hosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4
|
+
methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5
|
+
path: z.ZodDefault<z.ZodString>;
|
|
6
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
7
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type RouteMatch = z.infer<typeof matchSchema>;
|
|
10
|
+
export declare const handlerConfigSchema: z.ZodObject<{
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
options: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type HandlerConfig = z.infer<typeof handlerConfigSchema>;
|
|
15
|
+
export declare const proxyRouteInsertSchema: z.ZodObject<{
|
|
16
|
+
custom_domain_id: z.ZodString;
|
|
17
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
match: z.ZodObject<{
|
|
19
|
+
hosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
+
methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
path: z.ZodDefault<z.ZodString>;
|
|
22
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
23
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
26
|
+
type: z.ZodString;
|
|
27
|
+
options: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type ProxyRouteInsert = z.infer<typeof proxyRouteInsertSchema>;
|
|
31
|
+
export declare const proxyRouteSchema: z.ZodObject<{
|
|
32
|
+
custom_domain_id: z.ZodString;
|
|
33
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
34
|
+
match: z.ZodObject<{
|
|
35
|
+
hosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
path: z.ZodDefault<z.ZodString>;
|
|
38
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
39
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
42
|
+
type: z.ZodString;
|
|
43
|
+
options: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
tenant_id: z.ZodString;
|
|
47
|
+
created_at: z.ZodString;
|
|
48
|
+
updated_at: z.ZodString;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type ProxyRoute = z.infer<typeof proxyRouteSchema>;
|
|
51
|
+
export declare const proxyRouteUpdateSchema: z.ZodObject<{
|
|
52
|
+
priority: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
53
|
+
match: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
hosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
55
|
+
methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
+
path: z.ZodDefault<z.ZodString>;
|
|
57
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
58
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
|
+
type: z.ZodString;
|
|
62
|
+
options: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export type ProxyRouteUpdate = z.infer<typeof proxyRouteUpdateSchema>;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/markusahlstrand/authhero"
|
|
13
13
|
},
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.8.0",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
@@ -27,18 +27,16 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@hono/zod-openapi": "^1.4.0",
|
|
30
|
-
"@
|
|
31
|
-
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
32
|
-
"@types/node": "^22.9.1",
|
|
30
|
+
"@types/node": "^22.19.19",
|
|
33
31
|
"rollup-plugin-dts": "^6.4.1",
|
|
34
32
|
"typescript": "^5.6.3",
|
|
35
|
-
"vite": "^
|
|
33
|
+
"vite": "^8.0.14"
|
|
36
34
|
},
|
|
37
35
|
"peerDependencies": {
|
|
38
36
|
"@hono/zod-openapi": "^1.4.0"
|
|
39
37
|
},
|
|
40
38
|
"dependencies": {
|
|
41
|
-
"nanoid": "^5.
|
|
39
|
+
"nanoid": "^5.1.11"
|
|
42
40
|
},
|
|
43
41
|
"scripts": {
|
|
44
42
|
"build": "vite build && tsc -p tsconfig.types.json && rollup -c rollup.dts.config.mjs"
|