@authhero/adapter-interfaces 2.6.0 → 2.6.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/dist/adapter-interfaces.d.ts +10840 -11234
- package/dist/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/adapters/ActionExecutions.d.ts +5 -0
- package/dist/types/adapters/ActionVersions.d.ts +20 -0
- package/dist/types/adapters/Actions.d.ts +12 -0
- package/dist/types/adapters/Analytics.d.ts +9 -0
- package/dist/types/adapters/AuthenticationMethods.d.ts +9 -0
- package/dist/types/adapters/Branding.d.ts +5 -0
- package/dist/types/adapters/Cache.d.ts +35 -0
- package/dist/types/adapters/ClientConnections.d.ts +26 -0
- package/dist/types/adapters/ClientGrants.d.ts +12 -0
- package/dist/types/adapters/ClientRegistrationTokens.d.ts +11 -0
- package/dist/types/adapters/Clients.d.ts +25 -0
- package/dist/types/adapters/CodeExecutor.d.ts +47 -0
- package/dist/types/adapters/Codes.d.ts +17 -0
- package/dist/types/adapters/Connections.d.ts +12 -0
- package/dist/types/adapters/CustomDomains.d.ts +9 -0
- package/dist/types/adapters/CustomText.d.ts +22 -0
- package/dist/types/adapters/EmailProviders.d.ts +7 -0
- package/dist/types/adapters/EmailService.d.ts +14 -0
- package/dist/types/adapters/EmailTemplates.d.ts +8 -0
- package/dist/types/adapters/Flows.d.ts +12 -0
- package/dist/types/adapters/Forms.d.ts +12 -0
- package/dist/types/adapters/Geo.d.ts +16 -0
- package/dist/types/adapters/HookCode.d.ts +7 -0
- package/dist/types/adapters/Hooks.d.ts +12 -0
- package/dist/types/adapters/Invites.d.ts +12 -0
- package/dist/types/adapters/Keys.d.ts +10 -0
- package/dist/types/adapters/LogStreams.d.ts +8 -0
- package/dist/types/adapters/LoginSessions.d.ts +7 -0
- package/dist/types/adapters/Logs.d.ts +11 -0
- package/dist/types/adapters/MigrationSources.d.ts +8 -0
- package/dist/types/adapters/OrganizationConnections.d.ts +8 -0
- package/dist/types/adapters/Organizations.d.ts +12 -0
- package/dist/types/adapters/Outbox.d.ts +59 -0
- package/dist/types/adapters/Passwords.d.ts +7 -0
- package/dist/types/adapters/PromptSettings.d.ts +5 -0
- package/dist/types/adapters/RateLimit.d.ts +27 -0
- package/dist/types/adapters/RefreshTokens.d.ts +36 -0
- package/dist/types/adapters/ResourceServers.d.ts +12 -0
- package/dist/types/adapters/RolePermissions.d.ts +7 -0
- package/dist/types/adapters/Roles.d.ts +13 -0
- package/dist/types/adapters/Sessions.d.ts +12 -0
- package/dist/types/adapters/SmsService.d.ts +11 -0
- package/dist/types/adapters/Stats.d.ts +15 -0
- package/dist/types/adapters/TenantSettings.d.ts +5 -0
- package/dist/types/adapters/Tenants.d.ts +21 -0
- package/dist/types/adapters/Themes.d.ts +7 -0
- package/dist/types/adapters/UniversalLoginTemplates.d.ts +8 -0
- package/dist/types/adapters/UserOrganizations.d.ts +27 -0
- package/dist/types/adapters/UserPermissions.d.ts +7 -0
- package/dist/types/adapters/UserRoles.d.ts +13 -0
- package/dist/types/adapters/Users.d.ts +20 -0
- package/dist/types/adapters/index.d.ts +217 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/types/Action.d.ts +87 -0
- package/dist/types/types/ActionExecution.d.ts +128 -0
- package/dist/types/types/ActionVersion.d.ts +44 -0
- package/dist/types/types/Analytics.d.ts +91 -0
- package/dist/types/types/AttackProtection.d.ts +79 -0
- package/dist/types/types/AuditEvent.d.ts +208 -0
- package/dist/types/types/AuthParams.d.ts +67 -0
- package/dist/types/types/AuthenticationMethod.d.ts +59 -0
- package/dist/types/types/BaseEntity.d.ts +5 -0
- package/dist/types/types/Branding.d.ts +24 -0
- package/dist/types/types/Client.d.ts +249 -0
- package/dist/types/types/ClientGrant.d.ts +61 -0
- package/dist/types/types/ClientRegistrationToken.d.ts +37 -0
- package/dist/types/types/Code.d.ts +68 -0
- package/dist/types/types/Connection.d.ts +470 -0
- package/dist/types/types/CustomDomain.d.ts +116 -0
- package/dist/types/types/CustomText.d.ts +81 -0
- package/dist/types/types/Device.d.ts +9 -0
- package/dist/types/types/EmailProvider.d.ts +9 -0
- package/dist/types/types/EmailTemplate.d.ts +41 -0
- package/dist/types/types/Flow.d.ts +267 -0
- package/dist/types/types/Flows.d.ts +572 -0
- package/dist/types/types/Forms.d.ts +4943 -0
- package/dist/types/types/Hook.d.ts +152 -0
- package/dist/types/types/HookCode.d.ts +15 -0
- package/dist/types/types/Identity.d.ts +36 -0
- package/dist/types/types/Invite.d.ts +50 -0
- package/dist/types/types/JWKS.d.ts +89 -0
- package/dist/types/types/ListParams.d.ts +14 -0
- package/dist/types/types/LogStream.d.ts +67 -0
- package/dist/types/types/LoginSession.d.ts +143 -0
- package/dist/types/types/Logs.d.ts +255 -0
- package/dist/types/types/MigrationSource.d.ts +58 -0
- package/dist/types/types/Organization.d.ts +77 -0
- package/dist/types/types/OrganizationConnection.d.ts +34 -0
- package/dist/types/types/Password.d.ts +25 -0
- package/dist/types/types/PromptSetting.d.ts +11 -0
- package/dist/types/types/RefreshTokens.d.ts +59 -0
- package/dist/types/types/ResourceServer.d.ts +124 -0
- package/dist/types/types/Role.d.ts +29 -0
- package/dist/types/types/RolePermission.d.ts +21 -0
- package/dist/types/types/Session.d.ts +43 -0
- package/dist/types/types/SigningKey.d.ts +22 -0
- package/dist/types/types/SmsProvider.d.ts +11 -0
- package/dist/types/types/Stats.d.ts +12 -0
- package/dist/types/types/Strategy.d.ts +21 -0
- package/dist/types/types/Tenant.d.ts +367 -0
- package/dist/types/types/TenantSettings.d.ts +96 -0
- package/dist/types/types/Theme.d.ts +341 -0
- package/dist/types/types/Token.d.ts +25 -0
- package/dist/types/types/User.d.ts +222 -0
- package/dist/types/types/UserOrganization.d.ts +14 -0
- package/dist/types/types/UserPermission.d.ts +46 -0
- package/dist/types/types/UserRole.d.ts +23 -0
- package/dist/types/types/auth0/Query.d.ts +8 -0
- package/dist/types/types/auth0/Totals.d.ts +13 -0
- package/dist/types/types/auth0/UserResponse.d.ts +46 -0
- package/dist/types/types/auth0/index.d.ts +3 -0
- package/dist/types/types/index.d.ts +53 -0
- package/dist/types/utils/connection-attributes.d.ts +25 -0
- package/dist/types/utils/guards.d.ts +1 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/passthrough.d.ts +111 -0
- package/dist/types/utils/user-id.d.ts +4 -0
- package/package.json +3 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const userOrganizationInsertSchema: z.ZodObject<{
|
|
3
|
+
user_id: z.ZodString;
|
|
4
|
+
organization_id: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type UserOrganizationInsert = z.infer<typeof userOrganizationInsertSchema>;
|
|
7
|
+
export declare const userOrganizationSchema: z.ZodObject<{
|
|
8
|
+
user_id: z.ZodString;
|
|
9
|
+
organization_id: z.ZodString;
|
|
10
|
+
created_at: z.ZodString;
|
|
11
|
+
updated_at: z.ZodString;
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type UserOrganization = z.infer<typeof userOrganizationSchema>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const userPermissionInsertSchema: z.ZodObject<{
|
|
3
|
+
user_id: z.ZodString;
|
|
4
|
+
resource_server_identifier: z.ZodString;
|
|
5
|
+
permission_name: z.ZodString;
|
|
6
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type UserPermissionInsert = z.infer<typeof userPermissionInsertSchema>;
|
|
9
|
+
export declare const userPermissionSchema: z.ZodObject<{
|
|
10
|
+
user_id: z.ZodString;
|
|
11
|
+
resource_server_identifier: z.ZodString;
|
|
12
|
+
permission_name: z.ZodString;
|
|
13
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
14
|
+
tenant_id: z.ZodString;
|
|
15
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type UserPermission = z.infer<typeof userPermissionSchema>;
|
|
18
|
+
export declare const userPermissionListSchema: z.ZodArray<z.ZodObject<{
|
|
19
|
+
user_id: z.ZodString;
|
|
20
|
+
resource_server_identifier: z.ZodString;
|
|
21
|
+
permission_name: z.ZodString;
|
|
22
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
23
|
+
tenant_id: z.ZodString;
|
|
24
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
export type UserPermissionList = z.infer<typeof userPermissionListSchema>;
|
|
27
|
+
export declare const userPermissionWithDetailsSchema: z.ZodObject<{
|
|
28
|
+
user_id: z.ZodString;
|
|
29
|
+
resource_server_identifier: z.ZodString;
|
|
30
|
+
resource_server_name: z.ZodString;
|
|
31
|
+
permission_name: z.ZodString;
|
|
32
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
34
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type UserPermissionWithDetails = z.infer<typeof userPermissionWithDetailsSchema>;
|
|
37
|
+
export declare const userPermissionWithDetailsListSchema: z.ZodArray<z.ZodObject<{
|
|
38
|
+
user_id: z.ZodString;
|
|
39
|
+
resource_server_identifier: z.ZodString;
|
|
40
|
+
resource_server_name: z.ZodString;
|
|
41
|
+
permission_name: z.ZodString;
|
|
42
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
44
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
export type UserPermissionWithDetailsList = z.infer<typeof userPermissionWithDetailsListSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const userRoleInsertSchema: z.ZodObject<{
|
|
3
|
+
user_id: z.ZodString;
|
|
4
|
+
role_id: z.ZodString;
|
|
5
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type UserRoleInsert = z.infer<typeof userRoleInsertSchema>;
|
|
8
|
+
export declare const userRoleSchema: z.ZodObject<{
|
|
9
|
+
user_id: z.ZodString;
|
|
10
|
+
role_id: z.ZodString;
|
|
11
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
12
|
+
tenant_id: z.ZodString;
|
|
13
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type UserRole = z.infer<typeof userRoleSchema>;
|
|
16
|
+
export declare const userRoleListSchema: z.ZodArray<z.ZodObject<{
|
|
17
|
+
user_id: z.ZodString;
|
|
18
|
+
role_id: z.ZodString;
|
|
19
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
20
|
+
tenant_id: z.ZodString;
|
|
21
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
export type UserRoleList = z.infer<typeof userRoleListSchema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const auth0QuerySchema: z.ZodObject<{
|
|
3
|
+
page: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<number, string>>;
|
|
4
|
+
per_page: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<number, string>>;
|
|
5
|
+
include_totals: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<boolean, string>>;
|
|
6
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
7
|
+
q: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const totalsSchema: z.ZodObject<{
|
|
3
|
+
start: z.ZodNumber;
|
|
4
|
+
limit: z.ZodNumber;
|
|
5
|
+
length: z.ZodNumber;
|
|
6
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export interface Totals {
|
|
9
|
+
start: number;
|
|
10
|
+
limit: number;
|
|
11
|
+
length: number;
|
|
12
|
+
total?: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { BaseUser } from "../User";
|
|
3
|
+
export interface PostUsersBody extends BaseUser {
|
|
4
|
+
password?: string;
|
|
5
|
+
verify_email?: boolean;
|
|
6
|
+
username?: string;
|
|
7
|
+
connection?: string;
|
|
8
|
+
email_verified?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const userResponseSchema: z.ZodObject<{
|
|
11
|
+
email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
12
|
+
username: z.ZodOptional<z.ZodString>;
|
|
13
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
14
|
+
phone_verified: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
given_name: z.ZodOptional<z.ZodString>;
|
|
16
|
+
family_name: z.ZodOptional<z.ZodString>;
|
|
17
|
+
nickname: z.ZodOptional<z.ZodString>;
|
|
18
|
+
name: z.ZodOptional<z.ZodString>;
|
|
19
|
+
picture: z.ZodOptional<z.ZodString>;
|
|
20
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
21
|
+
linked_to: z.ZodOptional<z.ZodString>;
|
|
22
|
+
profileData: z.ZodOptional<z.ZodString>;
|
|
23
|
+
app_metadata: z.ZodOptional<z.ZodDefault<z.ZodAny>>;
|
|
24
|
+
user_metadata: z.ZodOptional<z.ZodDefault<z.ZodAny>>;
|
|
25
|
+
middle_name: z.ZodOptional<z.ZodString>;
|
|
26
|
+
preferred_username: z.ZodOptional<z.ZodString>;
|
|
27
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
28
|
+
website: z.ZodOptional<z.ZodString>;
|
|
29
|
+
gender: z.ZodOptional<z.ZodString>;
|
|
30
|
+
birthdate: z.ZodOptional<z.ZodString>;
|
|
31
|
+
zoneinfo: z.ZodOptional<z.ZodString>;
|
|
32
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
formatted: z.ZodOptional<z.ZodString>;
|
|
34
|
+
street_address: z.ZodOptional<z.ZodString>;
|
|
35
|
+
locality: z.ZodOptional<z.ZodString>;
|
|
36
|
+
region: z.ZodOptional<z.ZodString>;
|
|
37
|
+
postal_code: z.ZodOptional<z.ZodString>;
|
|
38
|
+
country: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
login_count: z.ZodNumber;
|
|
41
|
+
multifactor: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
last_ip: z.ZodOptional<z.ZodString>;
|
|
43
|
+
last_login: z.ZodOptional<z.ZodString>;
|
|
44
|
+
user_id: z.ZodString;
|
|
45
|
+
}, z.core.$catchall<z.ZodAny>>;
|
|
46
|
+
export type UserResponse = z.infer<typeof userResponseSchema>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export * from "./Action";
|
|
2
|
+
export * from "./ActionExecution";
|
|
3
|
+
export * from "./ActionVersion";
|
|
4
|
+
export * from "./AuditEvent";
|
|
5
|
+
export * from "./Flow";
|
|
6
|
+
export * from "./auth0";
|
|
7
|
+
export * from "./Client";
|
|
8
|
+
export * from "./ClientGrant";
|
|
9
|
+
export * from "./ClientRegistrationToken";
|
|
10
|
+
export { ComponentCategory, ComponentType, NodeType, coordinatesSchema, richTextComponentSchema, buttonComponentSchema, legalComponentSchema, genericComponentSchema, componentSchema, type Coordinates, type RichTextComponent, type ButtonComponent, type LegalComponent, type GenericComponent, type Component, stepNodeSchema as flowsStepNodeSchema, flowNodeSchema as flowsFlowNodeSchema, actionNodeSchema, genericNodeSchema, nodeSchema, type StepNode as FlowsStepNode, type FlowNode as FlowsFlowNode, type ActionNode, type GenericNode, type Node, startSchema, endingSchema, auth0FlowInsertSchema, auth0FlowSchema, type Auth0FlowInsert, type Auth0Flow, type Start, type Ending, fieldComponentSchema as flowsFieldComponentSchema, type FieldComponent as FlowsFieldComponent, } from "./Flows";
|
|
11
|
+
export * from "./AuthParams";
|
|
12
|
+
export * from "./Branding";
|
|
13
|
+
export * from "./Code";
|
|
14
|
+
export * from "./Connection";
|
|
15
|
+
export * from "./CustomDomain";
|
|
16
|
+
export * from "./Forms";
|
|
17
|
+
export * from "./Hook";
|
|
18
|
+
export * from "./HookCode";
|
|
19
|
+
export * from "./Identity";
|
|
20
|
+
export * from "./Invite";
|
|
21
|
+
export * from "./JWKS";
|
|
22
|
+
export * from "./ListParams";
|
|
23
|
+
export * from "./LoginSession";
|
|
24
|
+
export * from "./Logs";
|
|
25
|
+
export * from "./LogStream";
|
|
26
|
+
export * from "./MigrationSource";
|
|
27
|
+
export * from "./AttackProtection";
|
|
28
|
+
export * from "./Password";
|
|
29
|
+
export * from "./Session";
|
|
30
|
+
export * from "./SigningKey";
|
|
31
|
+
export * from "./Tenant";
|
|
32
|
+
export * from "./Token";
|
|
33
|
+
export * from "./User";
|
|
34
|
+
export * from "./Theme";
|
|
35
|
+
export * from "./PromptSetting";
|
|
36
|
+
export * from "./EmailProvider";
|
|
37
|
+
export * from "./EmailTemplate";
|
|
38
|
+
export * from "./RefreshTokens";
|
|
39
|
+
export * from "./SmsProvider";
|
|
40
|
+
export * from "./ResourceServer";
|
|
41
|
+
export * from "./RolePermission";
|
|
42
|
+
export * from "./UserPermission";
|
|
43
|
+
export * from "./UserRole";
|
|
44
|
+
export * from "./Role";
|
|
45
|
+
export * from "./Organization";
|
|
46
|
+
export * from "./OrganizationConnection";
|
|
47
|
+
export * from "./UserOrganization";
|
|
48
|
+
export * from "./TenantSettings";
|
|
49
|
+
export * from "./Stats";
|
|
50
|
+
export * from "./Analytics";
|
|
51
|
+
export * from "./CustomText";
|
|
52
|
+
export * from "./Strategy";
|
|
53
|
+
export * from "./AuthenticationMethod";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Connection, ConnectionInsert } from "../types/Connection";
|
|
2
|
+
type ConnectionLike = Connection | ConnectionInsert;
|
|
3
|
+
interface IdentifierConfig {
|
|
4
|
+
/** Whether username is accepted as a login identifier */
|
|
5
|
+
usernameIdentifierActive: boolean;
|
|
6
|
+
/** Whether email is accepted as a login identifier */
|
|
7
|
+
emailIdentifierActive: boolean;
|
|
8
|
+
/** Minimum username length (defaults to 1) */
|
|
9
|
+
usernameMinLength: number;
|
|
10
|
+
/** Maximum username length (defaults to 15) */
|
|
11
|
+
usernameMaxLength: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reads the modern `attributes` schema from a connection's options,
|
|
15
|
+
* with fallback to the legacy `requires_username` / `validation` fields.
|
|
16
|
+
*
|
|
17
|
+
* Auth0 migrated from:
|
|
18
|
+
* options.requires_username (boolean) + options.validation.username.{min,max}
|
|
19
|
+
* to:
|
|
20
|
+
* options.attributes.email.identifier.active
|
|
21
|
+
* options.attributes.username.identifier.active
|
|
22
|
+
* options.attributes.username.validation.{min_length,max_length}
|
|
23
|
+
*/
|
|
24
|
+
export declare function getConnectionIdentifierConfig(connection: ConnectionLike | null | undefined): IdentifierConfig;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a secondary adapter in passthrough mode.
|
|
3
|
+
*/
|
|
4
|
+
export interface SecondaryAdapterConfig<T> {
|
|
5
|
+
/**
|
|
6
|
+
* The secondary adapter to sync writes to.
|
|
7
|
+
* Can be a partial implementation - only implemented methods will be called.
|
|
8
|
+
*/
|
|
9
|
+
adapter: Partial<T>;
|
|
10
|
+
/**
|
|
11
|
+
* If true, wait for the secondary write to complete before returning.
|
|
12
|
+
* Default: false (fire-and-forget)
|
|
13
|
+
*/
|
|
14
|
+
blocking?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Called when a secondary write fails.
|
|
17
|
+
* @param error - The error that occurred
|
|
18
|
+
* @param method - The method name that failed
|
|
19
|
+
* @param args - The arguments passed to the method
|
|
20
|
+
*/
|
|
21
|
+
onError?: (error: Error, method: string, args: unknown[]) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for creating a passthrough adapter that syncs writes to multiple destinations.
|
|
25
|
+
*
|
|
26
|
+
* @template T - The adapter interface type (e.g., LogsDataAdapter, UsersDataAdapter)
|
|
27
|
+
*/
|
|
28
|
+
export interface PassthroughConfig<T> {
|
|
29
|
+
/**
|
|
30
|
+
* Primary adapter - all reads come from here, writes go here first.
|
|
31
|
+
*/
|
|
32
|
+
primary: T;
|
|
33
|
+
/**
|
|
34
|
+
* Secondary adapters to sync writes to.
|
|
35
|
+
*/
|
|
36
|
+
secondaries: SecondaryAdapterConfig<T>[];
|
|
37
|
+
/**
|
|
38
|
+
* Methods that should be synced to secondaries.
|
|
39
|
+
* Default: ["create", "rawCreate", "update", "remove", "delete", "set"]
|
|
40
|
+
*/
|
|
41
|
+
syncMethods?: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a passthrough adapter that syncs write operations to multiple destinations.
|
|
45
|
+
*
|
|
46
|
+
* Reads always come from the primary adapter.
|
|
47
|
+
* Writes go to the primary first, then are synced to all secondaries.
|
|
48
|
+
*
|
|
49
|
+
* @example Logs adapter with database primary and Analytics Engine secondary
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { createPassthroughAdapter } from "@authhero/adapter-interfaces";
|
|
52
|
+
*
|
|
53
|
+
* const logsAdapter = createPassthroughAdapter({
|
|
54
|
+
* primary: databaseLogsAdapter,
|
|
55
|
+
* secondaries: [
|
|
56
|
+
* {
|
|
57
|
+
* adapter: analyticsEngineAdapter,
|
|
58
|
+
* onError: (err) => console.error("Analytics sync failed:", err),
|
|
59
|
+
* },
|
|
60
|
+
* ],
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Cache adapter with multiple backends
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const cacheAdapter = createPassthroughAdapter({
|
|
67
|
+
* primary: redisCacheAdapter,
|
|
68
|
+
* secondaries: [
|
|
69
|
+
* { adapter: memcachedAdapter, blocking: true },
|
|
70
|
+
* { adapter: localCacheAdapter },
|
|
71
|
+
* ],
|
|
72
|
+
* syncMethods: ["set", "delete"],
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Users adapter with search index sync
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const usersAdapter = createPassthroughAdapter({
|
|
79
|
+
* primary: databaseUsersAdapter,
|
|
80
|
+
* secondaries: [
|
|
81
|
+
* {
|
|
82
|
+
* adapter: elasticsearchAdapter,
|
|
83
|
+
* blocking: true, // Wait for search index to update
|
|
84
|
+
* },
|
|
85
|
+
* ],
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function createPassthroughAdapter<T extends object>(config: PassthroughConfig<T>): T;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a write-only adapter that only implements specific methods.
|
|
92
|
+
* Useful for creating secondary adapters that only need to handle synced writes.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* const webhookNotifier = createWriteOnlyAdapter<LogsDataAdapter>({
|
|
97
|
+
* create: async (tenantId, log) => {
|
|
98
|
+
* await fetch("https://webhook.example.com/logs", {
|
|
99
|
+
* method: "POST",
|
|
100
|
+
* body: JSON.stringify({ tenantId, log }),
|
|
101
|
+
* });
|
|
102
|
+
* },
|
|
103
|
+
* });
|
|
104
|
+
*
|
|
105
|
+
* const logsAdapter = createPassthroughAdapter({
|
|
106
|
+
* primary: databaseLogsAdapter,
|
|
107
|
+
* secondaries: [{ adapter: webhookNotifier }],
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function createWriteOnlyAdapter<T>(implementation: Partial<T>): Partial<T>;
|
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.6.
|
|
14
|
+
"version": "2.6.1",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
31
31
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
32
32
|
"@types/node": "^22.9.1",
|
|
33
|
-
"
|
|
33
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
34
34
|
"typescript": "^5.6.3",
|
|
35
35
|
"vite": "^5.4.11"
|
|
36
36
|
},
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"nanoid": "^5.0.8"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "
|
|
44
|
+
"build": "vite build && tsc -p tsconfig.types.json && rollup -c rollup.dts.config.mjs"
|
|
45
45
|
}
|
|
46
46
|
}
|