@authhero/adapter-interfaces 0.1.0 → 0.1.1
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 +21 -0
- package/README.md +3 -0
- package/package.json +8 -5
- package/CHANGELOG.md +0 -7
- package/src/adapters/Applications.ts +0 -31
- package/src/adapters/AuthenticationCodes.ts +0 -6
- package/src/adapters/Branding.ts +0 -6
- package/src/adapters/Codes.ts +0 -6
- package/src/adapters/Connections.ts +0 -18
- package/src/adapters/Domains.ts +0 -11
- package/src/adapters/Hooks.ts +0 -18
- package/src/adapters/Keys.ts +0 -7
- package/src/adapters/ListParams.ts +0 -10
- package/src/adapters/Logs.ts +0 -12
- package/src/adapters/OTP.ts +0 -7
- package/src/adapters/Passwords.ts +0 -10
- package/src/adapters/Sessions.ts +0 -12
- package/src/adapters/Tenants.ts +0 -18
- package/src/adapters/Tickets.ts +0 -7
- package/src/adapters/UniversalLoginSession.ts +0 -17
- package/src/adapters/Users.ts +0 -20
- package/src/adapters/index.ts +0 -35
- package/src/index.ts +0 -2
- package/src/types/Application.ts +0 -33
- package/src/types/AuthParams.ts +0 -36
- package/src/types/AuthenticationCode.ts +0 -14
- package/src/types/BaseEntity.ts +0 -6
- package/src/types/Branding.ts +0 -26
- package/src/types/Client.ts +0 -51
- package/src/types/Code.ts +0 -9
- package/src/types/Connection.ts +0 -33
- package/src/types/Domain.ts +0 -17
- package/src/types/Hook.ts +0 -17
- package/src/types/JWKS.ts +0 -37
- package/src/types/LoginState.ts +0 -8
- package/src/types/OTP.ts +0 -26
- package/src/types/Password.ts +0 -9
- package/src/types/Session.ts +0 -10
- package/src/types/SigningKey.ts +0 -55
- package/src/types/Tenant.ts +0 -54
- package/src/types/Ticket.ts +0 -22
- package/src/types/Token.ts +0 -75
- package/src/types/User.ts +0 -45
- package/src/types/auth0/Identity.ts +0 -27
- package/src/types/auth0/LogsResponse.ts +0 -90
- package/src/types/auth0/Query.ts +0 -42
- package/src/types/auth0/Totals.ts +0 -13
- package/src/types/auth0/UserResponse.ts +0 -24
- package/src/types/auth0/index.ts +0 -3
- package/src/types/index.ts +0 -20
- package/tsconfig.json +0 -9
- package/tsconfig.node.json +0 -4
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.ts +0 -43
- /package/{build/dist → dist}/adapter-interfaces.cjs +0 -0
- /package/{build/dist → dist}/adapter-interfaces.iife.js +0 -0
- /package/{build/dist → dist}/adapter-interfaces.mjs +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 authhero
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/markusahlstrand/authhero"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.1",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
9
12
|
"main": "dist/adapter-interfaces.js",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc && vite build"
|
|
12
|
-
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
15
15
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -19,5 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@hono/zod-openapi": "^0.14.5"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc && vite build"
|
|
22
25
|
}
|
|
23
|
-
}
|
|
26
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Application, Totals } from "../types";
|
|
2
|
-
import { ListParams } from "./ListParams";
|
|
3
|
-
|
|
4
|
-
export interface CreateApplicationParams {
|
|
5
|
-
name: string;
|
|
6
|
-
allowed_web_origins: string;
|
|
7
|
-
allowed_callback_urls: string;
|
|
8
|
-
allowed_logout_urls: string;
|
|
9
|
-
email_validation: "enabled" | "disabled" | "enforced";
|
|
10
|
-
client_secret: string;
|
|
11
|
-
id: string;
|
|
12
|
-
disable_sign_ups: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ApplicationsAdapter {
|
|
16
|
-
create(
|
|
17
|
-
tenant_id: string,
|
|
18
|
-
params: CreateApplicationParams,
|
|
19
|
-
): Promise<Application>;
|
|
20
|
-
get(tenant_id: string, id: string): Promise<Application | null>;
|
|
21
|
-
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
22
|
-
list(
|
|
23
|
-
tenant_id: string,
|
|
24
|
-
params: ListParams,
|
|
25
|
-
): Promise<{ applications: Application[]; totals?: Totals }>;
|
|
26
|
-
update(
|
|
27
|
-
tenant_id: string,
|
|
28
|
-
id: string,
|
|
29
|
-
application: Partial<Application>,
|
|
30
|
-
): Promise<boolean>;
|
|
31
|
-
}
|
package/src/adapters/Branding.ts
DELETED
package/src/adapters/Codes.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Connection, ConnectionInsert, Totals } from "../types";
|
|
2
|
-
import { ListParams } from "./ListParams";
|
|
3
|
-
|
|
4
|
-
export interface ListConnectionsResponse extends Totals {
|
|
5
|
-
connections: Connection[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface ConnectionsAdapter {
|
|
9
|
-
create(tenant_id: string, params: ConnectionInsert): Promise<Connection>;
|
|
10
|
-
remove(tenant_id: string, connection_id: string): Promise<boolean>;
|
|
11
|
-
get(tenant_id: string, connection_id: string): Promise<Connection | null>;
|
|
12
|
-
update(
|
|
13
|
-
tenant_id: string,
|
|
14
|
-
connection_id: string,
|
|
15
|
-
params: Partial<ConnectionInsert>,
|
|
16
|
-
): Promise<boolean>;
|
|
17
|
-
list(tenant_id: string, params: ListParams): Promise<ListConnectionsResponse>;
|
|
18
|
-
}
|
package/src/adapters/Domains.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Totals, Domain } from "../types";
|
|
2
|
-
import { ListParams } from "./ListParams";
|
|
3
|
-
|
|
4
|
-
interface ListDomainsResponse extends Totals {
|
|
5
|
-
domains: Domain[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface DomainsAdapter {
|
|
9
|
-
create(tenant_id: string, params: Domain): Promise<Domain>;
|
|
10
|
-
list(tenant_id: string, params: ListParams): Promise<ListDomainsResponse>;
|
|
11
|
-
}
|
package/src/adapters/Hooks.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Hook, HookInsert, Totals } from "../types";
|
|
2
|
-
import { ListParams } from "./ListParams";
|
|
3
|
-
|
|
4
|
-
export interface ListHooksResponse extends Totals {
|
|
5
|
-
hooks: Hook[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface HooksAdapter {
|
|
9
|
-
create: (tenant_id: string, hook: HookInsert) => Promise<Hook>;
|
|
10
|
-
remove: (tenant_id: string, hook_id: string) => Promise<boolean>;
|
|
11
|
-
get: (tenant_id: string, hook_id: string) => Promise<Hook | null>;
|
|
12
|
-
update: (
|
|
13
|
-
tenant_id: string,
|
|
14
|
-
hook_id: string,
|
|
15
|
-
hook: Partial<HookInsert>,
|
|
16
|
-
) => Promise<boolean>;
|
|
17
|
-
list: (tenant_id: string, params: ListParams) => Promise<ListHooksResponse>;
|
|
18
|
-
}
|
package/src/adapters/Keys.ts
DELETED
package/src/adapters/Logs.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogsResponse, Log, Totals } from "../types";
|
|
2
|
-
import { ListParams } from "./ListParams";
|
|
3
|
-
|
|
4
|
-
interface ListLogsResponse extends Totals {
|
|
5
|
-
logs: LogsResponse[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface LogsDataAdapter {
|
|
9
|
-
create(tenantId: string, params: Log): Promise<Log>;
|
|
10
|
-
list(tenantId: string, params: ListParams): Promise<ListLogsResponse>;
|
|
11
|
-
get(tenantId: string, logId: string): Promise<LogsResponse | null>;
|
|
12
|
-
}
|
package/src/adapters/OTP.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PasswordParams, PasswordResponse } from "../types";
|
|
2
|
-
|
|
3
|
-
export interface PasswordsAdapter {
|
|
4
|
-
create: (tenant_id: string, params: PasswordParams) => Promise<void>;
|
|
5
|
-
update: (tenant_id: string, params: PasswordParams) => Promise<boolean>;
|
|
6
|
-
validate: (
|
|
7
|
-
tenant_id: string,
|
|
8
|
-
params: PasswordParams,
|
|
9
|
-
) => Promise<PasswordResponse>;
|
|
10
|
-
}
|
package/src/adapters/Sessions.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Session } from "../types";
|
|
2
|
-
|
|
3
|
-
export interface SessionsAdapter {
|
|
4
|
-
create: (session: Session) => Promise<void>;
|
|
5
|
-
get: (tenant_id: string, id: string) => Promise<Session | null>;
|
|
6
|
-
update: (
|
|
7
|
-
tenant_id: string,
|
|
8
|
-
id: string,
|
|
9
|
-
session: { used_at: string },
|
|
10
|
-
) => Promise<boolean>;
|
|
11
|
-
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
12
|
-
}
|
package/src/adapters/Tenants.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Tenant, Totals } from "../types";
|
|
2
|
-
import { ListParams } from "./ListParams";
|
|
3
|
-
|
|
4
|
-
export interface CreateTenantParams {
|
|
5
|
-
name: string;
|
|
6
|
-
audience: string;
|
|
7
|
-
sender_name: string;
|
|
8
|
-
sender_email: string;
|
|
9
|
-
id?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface TenantsDataAdapter {
|
|
13
|
-
create(params: CreateTenantParams): Promise<Tenant>;
|
|
14
|
-
get(id: string): Promise<Tenant | null>;
|
|
15
|
-
list(params: ListParams): Promise<{ tenants: Tenant[]; totals?: Totals }>;
|
|
16
|
-
update(id: string, tenant: Partial<Tenant>): Promise<void>;
|
|
17
|
-
remove(tenantId: string): Promise<boolean>;
|
|
18
|
-
}
|
package/src/adapters/Tickets.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AuthParams } from "../types";
|
|
2
|
-
|
|
3
|
-
export interface UniversalLoginSession {
|
|
4
|
-
id: string;
|
|
5
|
-
tenant_id: string;
|
|
6
|
-
created_at: string;
|
|
7
|
-
updated_at: string;
|
|
8
|
-
expires_at: string;
|
|
9
|
-
authParams: AuthParams;
|
|
10
|
-
auth0Client?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface UniversalLoginSessionsAdapter {
|
|
14
|
-
create: (session: UniversalLoginSession) => Promise<void>;
|
|
15
|
-
update: (id: string, session: UniversalLoginSession) => Promise<boolean>;
|
|
16
|
-
get: (id: string) => Promise<UniversalLoginSession | null>;
|
|
17
|
-
}
|
package/src/adapters/Users.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { User, Totals } from "../types";
|
|
2
|
-
import { ListParams } from "./ListParams";
|
|
3
|
-
|
|
4
|
-
export interface ListUsersResponse extends Totals {
|
|
5
|
-
users: User[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface UserDataAdapter {
|
|
9
|
-
get(tenant_id: string, id: string): Promise<User | null>;
|
|
10
|
-
create(tenantId: string, user: User): Promise<User>;
|
|
11
|
-
remove(tenantId: string, id: string): Promise<boolean>;
|
|
12
|
-
list(tenantId: string, params: ListParams): Promise<ListUsersResponse>;
|
|
13
|
-
update(tenantId: string, id: string, user: Partial<User>): Promise<boolean>;
|
|
14
|
-
unlink(
|
|
15
|
-
tenantId: string,
|
|
16
|
-
id: string,
|
|
17
|
-
provider: string,
|
|
18
|
-
linked_user_id: string,
|
|
19
|
-
): Promise<boolean>;
|
|
20
|
-
}
|
package/src/adapters/index.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { CodesAdapter } from "./Codes";
|
|
2
|
-
import { OTPAdapter } from "./OTP";
|
|
3
|
-
import { PasswordsAdapter } from "./Passwords";
|
|
4
|
-
import { SessionsAdapter } from "./Sessions";
|
|
5
|
-
import { TenantsDataAdapter } from "./Tenants";
|
|
6
|
-
import { TicketsAdapter } from "./Tickets";
|
|
7
|
-
import { UserDataAdapter } from "./Users";
|
|
8
|
-
import { LogsDataAdapter } from "./Logs";
|
|
9
|
-
import { ApplicationsAdapter } from "./Applications";
|
|
10
|
-
import { UniversalLoginSessionsAdapter } from "./UniversalLoginSession";
|
|
11
|
-
import { ConnectionsAdapter } from "./Connections";
|
|
12
|
-
import { DomainsAdapter } from "./Domains";
|
|
13
|
-
import { KeysAdapter } from "./Keys";
|
|
14
|
-
import { BrandingAdapter } from "./Branding";
|
|
15
|
-
import { AuthenticationCodesAdapter } from "./AuthenticationCodes";
|
|
16
|
-
import { HooksAdapter } from "./Hooks";
|
|
17
|
-
|
|
18
|
-
export interface DataAdapters {
|
|
19
|
-
applications: ApplicationsAdapter;
|
|
20
|
-
branding: BrandingAdapter;
|
|
21
|
-
codes: CodesAdapter;
|
|
22
|
-
OTP: OTPAdapter;
|
|
23
|
-
passwords: PasswordsAdapter;
|
|
24
|
-
sessions: SessionsAdapter;
|
|
25
|
-
tenants: TenantsDataAdapter;
|
|
26
|
-
tickets: TicketsAdapter;
|
|
27
|
-
universalLoginSessions: UniversalLoginSessionsAdapter;
|
|
28
|
-
users: UserDataAdapter;
|
|
29
|
-
logs: LogsDataAdapter;
|
|
30
|
-
connections: ConnectionsAdapter;
|
|
31
|
-
domains: DomainsAdapter;
|
|
32
|
-
keys: KeysAdapter;
|
|
33
|
-
hooks: HooksAdapter;
|
|
34
|
-
authenticationCodes: AuthenticationCodesAdapter;
|
|
35
|
-
}
|
package/src/index.ts
DELETED
package/src/types/Application.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
|
|
3
|
-
export const applicationInsertSchema = z.object({
|
|
4
|
-
id: z.string(),
|
|
5
|
-
name: z.string(),
|
|
6
|
-
allowed_web_origins: z
|
|
7
|
-
.string()
|
|
8
|
-
.transform((val) => (val === null ? "" : val))
|
|
9
|
-
.default(""),
|
|
10
|
-
allowed_callback_urls: z
|
|
11
|
-
.string()
|
|
12
|
-
.transform((val) => (val === null ? "" : val))
|
|
13
|
-
.default(""),
|
|
14
|
-
allowed_logout_urls: z
|
|
15
|
-
.string()
|
|
16
|
-
.transform((val) => (val === null ? "" : val))
|
|
17
|
-
.default(""),
|
|
18
|
-
email_validation: z
|
|
19
|
-
.enum(["enabled", "disabled", "enforced"])
|
|
20
|
-
.default("enforced"),
|
|
21
|
-
client_secret: z.string().default(""),
|
|
22
|
-
disable_sign_ups: z.boolean().default(false),
|
|
23
|
-
});
|
|
24
|
-
export type ApplicationInsert = z.infer<typeof applicationInsertSchema>;
|
|
25
|
-
|
|
26
|
-
export const applicationSchema = z
|
|
27
|
-
.object({
|
|
28
|
-
created_at: z.string().transform((val) => (val === null ? "" : val)),
|
|
29
|
-
updated_at: z.string().transform((val) => (val === null ? "" : val)),
|
|
30
|
-
})
|
|
31
|
-
.extend(applicationInsertSchema.shape);
|
|
32
|
-
|
|
33
|
-
export type Application = z.infer<typeof applicationSchema>;
|
package/src/types/AuthParams.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
|
|
3
|
-
export enum AuthorizationResponseType {
|
|
4
|
-
TOKEN = "token",
|
|
5
|
-
TOKEN_ID_TOKEN = "token id_token",
|
|
6
|
-
CODE = "code",
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum AuthorizationResponseMode {
|
|
10
|
-
QUERY = "query",
|
|
11
|
-
FRAGMENT = "fragment",
|
|
12
|
-
FORM_POST = "form_post",
|
|
13
|
-
WEB_MESSAGE = "web_message",
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export enum CodeChallengeMethod {
|
|
17
|
-
S265 = "S256",
|
|
18
|
-
plain = "plain",
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const authParamsSchema = z.object({
|
|
22
|
-
client_id: z.string(),
|
|
23
|
-
vendor_id: z.string().optional(),
|
|
24
|
-
response_type: z.nativeEnum(AuthorizationResponseType).optional(),
|
|
25
|
-
response_mode: z.nativeEnum(AuthorizationResponseMode).optional(),
|
|
26
|
-
redirect_uri: z.string().optional(),
|
|
27
|
-
audience: z.string().optional(),
|
|
28
|
-
state: z.string().optional(),
|
|
29
|
-
nonce: z.string().optional(),
|
|
30
|
-
scope: z.string().optional(),
|
|
31
|
-
code_challenge_method: z.nativeEnum(CodeChallengeMethod).optional(),
|
|
32
|
-
code_challenge: z.string().optional(),
|
|
33
|
-
username: z.string().optional(),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
export type AuthParams = z.infer<typeof authParamsSchema>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { authParamsSchema } from "./AuthParams";
|
|
3
|
-
|
|
4
|
-
export const authenticationCodeSchema = z.object({
|
|
5
|
-
authParams: authParamsSchema,
|
|
6
|
-
nonce: z.string().optional(),
|
|
7
|
-
code: z.string(),
|
|
8
|
-
user_id: z.string(),
|
|
9
|
-
created_at: z.string(),
|
|
10
|
-
expires_at: z.string(),
|
|
11
|
-
used_at: z.string().optional(),
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export type AuthenticationCode = z.infer<typeof authenticationCodeSchema>;
|
package/src/types/BaseEntity.ts
DELETED
package/src/types/Branding.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
|
|
3
|
-
export const brandingSchema = z.object({
|
|
4
|
-
colors: z
|
|
5
|
-
.object({
|
|
6
|
-
primary: z.string(),
|
|
7
|
-
page_background: z
|
|
8
|
-
.object({
|
|
9
|
-
type: z.string().optional(),
|
|
10
|
-
start: z.string().optional(),
|
|
11
|
-
end: z.string().optional(),
|
|
12
|
-
angle_deg: z.number().optional(),
|
|
13
|
-
})
|
|
14
|
-
.optional(),
|
|
15
|
-
})
|
|
16
|
-
.optional(),
|
|
17
|
-
logo_url: z.string().optional(),
|
|
18
|
-
favicon_url: z.string().optional(),
|
|
19
|
-
font: z
|
|
20
|
-
.object({
|
|
21
|
-
url: z.string(),
|
|
22
|
-
})
|
|
23
|
-
.optional(),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export type Branding = z.infer<typeof brandingSchema>;
|
package/src/types/Client.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { connectionSchema } from "./Connection";
|
|
3
|
-
|
|
4
|
-
const ClientDomainSchema = z.object({
|
|
5
|
-
domain: z.string(),
|
|
6
|
-
dkim_private_key: z.string().optional(),
|
|
7
|
-
dkim_public_key: z.string().optional(),
|
|
8
|
-
email_api_key: z.string().optional(),
|
|
9
|
-
email_service: z
|
|
10
|
-
.union([z.literal("mailgun"), z.literal("mailchannels")])
|
|
11
|
-
.optional(),
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const BaseClientSchema = z.object({
|
|
15
|
-
id: z.string(),
|
|
16
|
-
name: z.string(),
|
|
17
|
-
domains: z.array(ClientDomainSchema),
|
|
18
|
-
allowed_callback_urls: z.array(z.string()),
|
|
19
|
-
allowed_logout_urls: z.array(z.string()),
|
|
20
|
-
allowed_web_origins: z.array(z.string()),
|
|
21
|
-
email_validation: z.union([
|
|
22
|
-
z.literal("enabled"),
|
|
23
|
-
z.literal("disabled"),
|
|
24
|
-
z.literal("enforced"),
|
|
25
|
-
]),
|
|
26
|
-
tenant_id: z.string(),
|
|
27
|
-
client_secret: z.string(),
|
|
28
|
-
disable_sign_ups: z.boolean(),
|
|
29
|
-
tenant: z.object({
|
|
30
|
-
name: z.string(),
|
|
31
|
-
audience: z.string().optional(),
|
|
32
|
-
logo: z.string().optional(),
|
|
33
|
-
primary_color: z.string().optional(),
|
|
34
|
-
secondary_color: z.string().optional(),
|
|
35
|
-
sender_email: z.string(),
|
|
36
|
-
sender_name: z.string(),
|
|
37
|
-
support_url: z.string().optional(),
|
|
38
|
-
language: z.string().length(2).optional(),
|
|
39
|
-
}),
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const ClientSchema = BaseClientSchema.extend({
|
|
43
|
-
connections: z.array(connectionSchema),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export const PartialClientSchema = BaseClientSchema.extend({
|
|
47
|
-
connections: z.array(connectionSchema.partial()),
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export type Client = z.infer<typeof ClientSchema>;
|
|
51
|
-
export type PartialClient = z.infer<typeof PartialClientSchema>;
|
package/src/types/Code.ts
DELETED
package/src/types/Connection.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import {
|
|
3
|
-
AuthorizationResponseMode,
|
|
4
|
-
AuthorizationResponseType,
|
|
5
|
-
} from "./AuthParams";
|
|
6
|
-
|
|
7
|
-
export const connectionInsertSchema = z.object({
|
|
8
|
-
id: z.string().optional(),
|
|
9
|
-
name: z.string(),
|
|
10
|
-
client_id: z.string().optional(),
|
|
11
|
-
client_secret: z.string().optional(),
|
|
12
|
-
authorization_endpoint: z.string().optional(),
|
|
13
|
-
response_type: z.custom<AuthorizationResponseType>().optional(),
|
|
14
|
-
response_mode: z.custom<AuthorizationResponseMode>().optional(),
|
|
15
|
-
private_key: z.string().optional(),
|
|
16
|
-
kid: z.string().optional(),
|
|
17
|
-
team_id: z.string().optional(),
|
|
18
|
-
token_endpoint: z.string().optional(),
|
|
19
|
-
token_exchange_basic_auth: z.boolean().optional(),
|
|
20
|
-
userinfo_endpoint: z.string().optional(),
|
|
21
|
-
scope: z.string().optional(),
|
|
22
|
-
});
|
|
23
|
-
export type ConnectionInsert = z.infer<typeof connectionInsertSchema>;
|
|
24
|
-
|
|
25
|
-
export const connectionSchema = z
|
|
26
|
-
.object({
|
|
27
|
-
id: z.string(),
|
|
28
|
-
created_at: z.string().transform((val) => (val === null ? "" : val)),
|
|
29
|
-
updated_at: z.string().transform((val) => (val === null ? "" : val)),
|
|
30
|
-
})
|
|
31
|
-
.extend(connectionInsertSchema.shape);
|
|
32
|
-
|
|
33
|
-
export type Connection = z.infer<typeof connectionSchema>;
|
package/src/types/Domain.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { baseEntitySchema } from "./BaseEntity";
|
|
3
|
-
|
|
4
|
-
export const domainInsertSchema = z.object({
|
|
5
|
-
domain: z.string(),
|
|
6
|
-
dkim_private_key: z.string().optional(),
|
|
7
|
-
dkim_public_key: z.string().optional(),
|
|
8
|
-
email_api_key: z.string().optional(),
|
|
9
|
-
email_service: z.enum(["mailgun", "mailchannels"]),
|
|
10
|
-
});
|
|
11
|
-
export type DomainInsert = z.infer<typeof domainInsertSchema>;
|
|
12
|
-
|
|
13
|
-
export const domainSchema = baseEntitySchema.extend({
|
|
14
|
-
...domainInsertSchema.shape,
|
|
15
|
-
id: z.string(),
|
|
16
|
-
});
|
|
17
|
-
export type Domain = z.infer<typeof domainSchema>;
|
package/src/types/Hook.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { baseEntitySchema } from "./BaseEntity";
|
|
3
|
-
|
|
4
|
-
export const hookInsertSchema = z.object({
|
|
5
|
-
trigger_id: z.enum(["post-user-registration", "post-user-login"]),
|
|
6
|
-
enabled: z.boolean().default(false),
|
|
7
|
-
url: z.string(),
|
|
8
|
-
hook_id: z.string().optional(),
|
|
9
|
-
});
|
|
10
|
-
export type HookInsert = z.infer<typeof hookInsertSchema>;
|
|
11
|
-
|
|
12
|
-
export const hookSchema = hookInsertSchema.extend({
|
|
13
|
-
...baseEntitySchema.shape,
|
|
14
|
-
hook_id: z.string(),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export type Hook = z.infer<typeof hookSchema>;
|
package/src/types/JWKS.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
|
|
3
|
-
export const jwksSchema = z.object({
|
|
4
|
-
alg: z.string(),
|
|
5
|
-
e: z.string(),
|
|
6
|
-
kid: z.string(),
|
|
7
|
-
kty: z.string(),
|
|
8
|
-
n: z.string(),
|
|
9
|
-
use: z.string().optional(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const jwksKeySchema = z.object({
|
|
13
|
-
keys: z.array(jwksSchema),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const openIDConfigurationSchema = z.object({
|
|
17
|
-
issuer: z.string(),
|
|
18
|
-
authorization_endpoint: z.string(),
|
|
19
|
-
token_endpoint: z.string(),
|
|
20
|
-
device_authorization_endpoint: z.string(),
|
|
21
|
-
userinfo_endpoint: z.string(),
|
|
22
|
-
mfa_challenge_endpoint: z.string(),
|
|
23
|
-
jwks_uri: z.string(),
|
|
24
|
-
registration_endpoint: z.string(),
|
|
25
|
-
revocation_endpoint: z.string(),
|
|
26
|
-
scopes_supported: z.array(z.string()),
|
|
27
|
-
response_types_supported: z.array(z.string()),
|
|
28
|
-
code_challenge_methods_supported: z.array(z.string()),
|
|
29
|
-
response_modes_supported: z.array(z.string()),
|
|
30
|
-
subject_types_supported: z.array(z.string()),
|
|
31
|
-
id_token_signing_alg_values_supported: z.array(z.string()),
|
|
32
|
-
token_endpoint_auth_methods_supported: z.array(z.string()),
|
|
33
|
-
claims_supported: z.array(z.string()),
|
|
34
|
-
request_uri_parameter_supported: z.boolean(),
|
|
35
|
-
request_parameter_supported: z.boolean(),
|
|
36
|
-
token_endpoint_auth_signing_alg_values_supported: z.array(z.string()),
|
|
37
|
-
});
|