@authhero/adapter-interfaces 2.5.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.cjs +1 -1
- package/dist/adapter-interfaces.d.ts +10911 -52339
- package/dist/adapter-interfaces.mjs +189 -211
- 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 +5 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CustomText, PromptScreen } from "../types";
|
|
2
|
+
export interface CustomTextAdapter {
|
|
3
|
+
/**
|
|
4
|
+
* Get custom text for a specific prompt screen and language
|
|
5
|
+
*/
|
|
6
|
+
get: (tenant_id: string, prompt: PromptScreen, language: string) => Promise<CustomText | null>;
|
|
7
|
+
/**
|
|
8
|
+
* Set custom text for a specific prompt screen and language
|
|
9
|
+
*/
|
|
10
|
+
set: (tenant_id: string, prompt: PromptScreen, language: string, customText: CustomText) => Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Delete custom text for a specific prompt screen and language
|
|
13
|
+
*/
|
|
14
|
+
delete: (tenant_id: string, prompt: PromptScreen, language: string) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* List all custom text entries for a tenant
|
|
17
|
+
*/
|
|
18
|
+
list: (tenant_id: string) => Promise<Array<{
|
|
19
|
+
prompt: PromptScreen;
|
|
20
|
+
language: string;
|
|
21
|
+
}>>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EmailProvider } from "../types";
|
|
2
|
+
export interface EmailProvidersAdapter {
|
|
3
|
+
update: (tenant_id: string, emailProvider: Partial<EmailProvider>) => Promise<void>;
|
|
4
|
+
create: (tenant_id: string, emailProvider: EmailProvider) => Promise<void>;
|
|
5
|
+
get: (tenant_id: string) => Promise<EmailProvider | null>;
|
|
6
|
+
remove: (tenant_id: string) => Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EmailProvider } from "../types";
|
|
2
|
+
export interface EmailServiceSendParams {
|
|
3
|
+
emailProvider: EmailProvider;
|
|
4
|
+
to: string;
|
|
5
|
+
from: string;
|
|
6
|
+
subject: string;
|
|
7
|
+
html?: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
template: string;
|
|
10
|
+
data: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export interface EmailServiceAdapter {
|
|
13
|
+
send(params: EmailServiceSendParams): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EmailTemplate, EmailTemplateName } from "../types";
|
|
2
|
+
export interface EmailTemplatesAdapter {
|
|
3
|
+
get: (tenant_id: string, templateName: EmailTemplateName) => Promise<EmailTemplate | null>;
|
|
4
|
+
list: (tenant_id: string) => Promise<EmailTemplate[]>;
|
|
5
|
+
create: (tenant_id: string, template: EmailTemplate) => Promise<EmailTemplate>;
|
|
6
|
+
update: (tenant_id: string, templateName: EmailTemplateName, template: Partial<EmailTemplate>) => Promise<boolean>;
|
|
7
|
+
remove: (tenant_id: string, templateName: EmailTemplateName) => Promise<boolean>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Flow, FlowInsert, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListFlowsResponse extends Totals {
|
|
4
|
+
flows: Flow[];
|
|
5
|
+
}
|
|
6
|
+
export interface FlowsAdapter {
|
|
7
|
+
create(tenant_id: string, params: FlowInsert): Promise<Flow>;
|
|
8
|
+
get(tenant_id: string, flow_id: string): Promise<Flow | null>;
|
|
9
|
+
remove(tenant_id: string, flow_id: string): Promise<boolean>;
|
|
10
|
+
update(tenant_id: string, flow_id: string, flow: Partial<FlowInsert>): Promise<Flow | null>;
|
|
11
|
+
list(tenant_id: string, params?: ListParams): Promise<ListFlowsResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Form, FormInsert, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListFormsResponse extends Totals {
|
|
4
|
+
forms: Form[];
|
|
5
|
+
}
|
|
6
|
+
export interface FormsAdapter {
|
|
7
|
+
create(tenant_id: string, params: FormInsert): Promise<Form>;
|
|
8
|
+
get(tenant_id: string, form_id: string): Promise<Form | null>;
|
|
9
|
+
remove(tenant_id: string, form_id: string): Promise<boolean>;
|
|
10
|
+
update(tenant_id: string, form_id: string, form: Partial<FormInsert>): Promise<boolean>;
|
|
11
|
+
list(tenant_id: string, params?: ListParams): Promise<ListFormsResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GeoInfo {
|
|
2
|
+
country_code: string;
|
|
3
|
+
city_name: string;
|
|
4
|
+
latitude: string;
|
|
5
|
+
longitude: string;
|
|
6
|
+
time_zone: string;
|
|
7
|
+
continent_code: string;
|
|
8
|
+
}
|
|
9
|
+
export interface GeoAdapter {
|
|
10
|
+
/**
|
|
11
|
+
* Get geo information from request headers
|
|
12
|
+
* @param headers - Record of HTTP headers (lowercase keys)
|
|
13
|
+
* @returns Geo information or null if not available
|
|
14
|
+
*/
|
|
15
|
+
getGeoInfo(headers: Record<string, string>): Promise<GeoInfo | null>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HookCode, HookCodeInsert } from "../types";
|
|
2
|
+
export interface HookCodeAdapter {
|
|
3
|
+
create: (tenant_id: string, hookCode: HookCodeInsert) => Promise<HookCode>;
|
|
4
|
+
get: (tenant_id: string, id: string) => Promise<HookCode | null>;
|
|
5
|
+
update: (tenant_id: string, id: string, hookCode: Partial<HookCodeInsert>) => Promise<boolean>;
|
|
6
|
+
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Hook, HookInsert, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListHooksResponse extends Totals {
|
|
4
|
+
hooks: Hook[];
|
|
5
|
+
}
|
|
6
|
+
export interface HooksAdapter {
|
|
7
|
+
create: (tenant_id: string, hook: HookInsert) => Promise<Hook>;
|
|
8
|
+
remove: (tenant_id: string, hook_id: string) => Promise<boolean>;
|
|
9
|
+
get: (tenant_id: string, hook_id: string) => Promise<Hook | null>;
|
|
10
|
+
update: (tenant_id: string, hook_id: string, hook: Partial<HookInsert>) => Promise<boolean>;
|
|
11
|
+
list: (tenant_id: string, params?: ListParams) => Promise<ListHooksResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Invite, InviteInsert, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListInvitesResponse extends Totals {
|
|
4
|
+
invites: Invite[];
|
|
5
|
+
}
|
|
6
|
+
export interface InvitesAdapter {
|
|
7
|
+
create(tenant_id: string, params: InviteInsert): Promise<Invite>;
|
|
8
|
+
get(tenant_id: string, id: string): Promise<Invite | null>;
|
|
9
|
+
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
10
|
+
list(tenant_id: string, params?: ListParams): Promise<ListInvitesResponse>;
|
|
11
|
+
update(tenant_id: string, id: string, params: Partial<InviteInsert>): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SigningKey, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListKeysResponse extends Totals {
|
|
4
|
+
signingKeys: SigningKey[];
|
|
5
|
+
}
|
|
6
|
+
export interface KeysAdapter {
|
|
7
|
+
create: (key: SigningKey) => Promise<void>;
|
|
8
|
+
list: (params?: ListParams) => Promise<ListKeysResponse>;
|
|
9
|
+
update: (kid: string, key: Partial<Omit<SigningKey, "kid">>) => Promise<boolean>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LogStream, LogStreamInsert } from "../types/LogStream";
|
|
2
|
+
export interface LogStreamsAdapter {
|
|
3
|
+
create(tenant_id: string, params: LogStreamInsert): Promise<LogStream>;
|
|
4
|
+
get(tenant_id: string, id: string): Promise<LogStream | null>;
|
|
5
|
+
list(tenant_id: string): Promise<LogStream[]>;
|
|
6
|
+
update(tenant_id: string, id: string, params: Partial<LogStream>): Promise<boolean>;
|
|
7
|
+
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LoginSession, LoginSessionInsert } from "../types";
|
|
2
|
+
export interface LoginSessionsAdapter {
|
|
3
|
+
create: (tenant_id: string, session: LoginSessionInsert) => Promise<LoginSession>;
|
|
4
|
+
update: (tenant_id: string, id: string, session: Partial<LoginSession>) => Promise<boolean>;
|
|
5
|
+
get: (tenant_id: string, id: string) => Promise<LoginSession | null>;
|
|
6
|
+
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Log, LogInsert, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
interface ListLogsResponse extends Totals {
|
|
4
|
+
logs: Log[];
|
|
5
|
+
}
|
|
6
|
+
export interface LogsDataAdapter {
|
|
7
|
+
create(tenantId: string, params: LogInsert): Promise<Log>;
|
|
8
|
+
list(tenantId: string, params?: ListParams): Promise<ListLogsResponse>;
|
|
9
|
+
get(tenantId: string, logId: string): Promise<Log | null>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MigrationSource, MigrationSourceInsert } from "../types/MigrationSource";
|
|
2
|
+
export interface MigrationSourcesAdapter {
|
|
3
|
+
create: (tenant_id: string, migration_source: MigrationSourceInsert) => Promise<MigrationSource>;
|
|
4
|
+
get: (tenant_id: string, id: string) => Promise<MigrationSource | null>;
|
|
5
|
+
list: (tenant_id: string) => Promise<MigrationSource[]>;
|
|
6
|
+
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
7
|
+
update: (tenant_id: string, id: string, migration_source: Partial<MigrationSourceInsert>) => Promise<boolean>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OrganizationConnection, OrganizationConnectionInsert } from "../types";
|
|
2
|
+
export interface OrganizationConnectionsAdapter {
|
|
3
|
+
create(tenant_id: string, organization_id: string, params: OrganizationConnectionInsert): Promise<OrganizationConnection>;
|
|
4
|
+
list(tenant_id: string, organization_id: string): Promise<OrganizationConnection[]>;
|
|
5
|
+
get(tenant_id: string, organization_id: string, connection_id: string): Promise<OrganizationConnection | null>;
|
|
6
|
+
update(tenant_id: string, organization_id: string, connection_id: string, params: Partial<Omit<OrganizationConnectionInsert, "connection_id">>): Promise<OrganizationConnection | null>;
|
|
7
|
+
remove(tenant_id: string, organization_id: string, connection_id: string): Promise<boolean>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Organization, OrganizationInsert, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListOrganizationsResponse extends Totals {
|
|
4
|
+
organizations: Organization[];
|
|
5
|
+
}
|
|
6
|
+
export interface OrganizationsAdapter {
|
|
7
|
+
create(tenant_id: string, params: OrganizationInsert): Promise<Organization>;
|
|
8
|
+
get(tenant_id: string, id: string): Promise<Organization | null>;
|
|
9
|
+
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
10
|
+
list(tenant_id: string, params?: ListParams): Promise<ListOrganizationsResponse>;
|
|
11
|
+
update(tenant_id: string, id: string, params: Partial<OrganizationInsert>): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AuditEvent, AuditEventInsert } from "../types/AuditEvent";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface OutboxEvent extends AuditEvent {
|
|
4
|
+
/** When the event was persisted to the outbox */
|
|
5
|
+
created_at: string;
|
|
6
|
+
/** When the event was successfully processed (null if pending) */
|
|
7
|
+
processed_at: string | null;
|
|
8
|
+
/** Number of delivery attempts */
|
|
9
|
+
retry_count: number;
|
|
10
|
+
/** When to attempt the next retry (null if not in retry state) */
|
|
11
|
+
next_retry_at: string | null;
|
|
12
|
+
/** Last error message from a failed delivery attempt */
|
|
13
|
+
error: string | null;
|
|
14
|
+
/** When the event was moved to dead-letter state (null if still active) */
|
|
15
|
+
dead_lettered_at?: string | null;
|
|
16
|
+
/** Final error captured when the event was dead-lettered */
|
|
17
|
+
final_error?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface ListFailedEventsResponse {
|
|
20
|
+
events: OutboxEvent[];
|
|
21
|
+
start: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
length: number;
|
|
24
|
+
}
|
|
25
|
+
export interface OutboxAdapter {
|
|
26
|
+
/** Write an audit event to the outbox. Returns the event ID. */
|
|
27
|
+
create(tenantId: string, event: AuditEventInsert): Promise<string>;
|
|
28
|
+
/** Fetch events by their IDs */
|
|
29
|
+
getByIds(ids: string[]): Promise<OutboxEvent[]>;
|
|
30
|
+
/** Fetch unprocessed events ready for delivery */
|
|
31
|
+
getUnprocessed(limit: number): Promise<OutboxEvent[]>;
|
|
32
|
+
/** Atomically claim events for exclusive processing. Returns IDs that were successfully claimed. */
|
|
33
|
+
claimEvents(ids: string[], workerId: string, leaseMs: number): Promise<string[]>;
|
|
34
|
+
/** Mark events as successfully processed */
|
|
35
|
+
markProcessed(ids: string[]): Promise<void>;
|
|
36
|
+
/** Mark an event for retry with a backoff delay */
|
|
37
|
+
markRetry(id: string, error: string, nextRetryAt: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Move an event to dead-letter state. The event is marked processed so the
|
|
40
|
+
* relay stops retrying it, and the final error is preserved for admin review
|
|
41
|
+
* via `listFailed`.
|
|
42
|
+
*/
|
|
43
|
+
deadLetter(id: string, finalError: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* List dead-lettered events for a tenant, newest first. Used by the
|
|
46
|
+
* management API's failed-events endpoints.
|
|
47
|
+
*/
|
|
48
|
+
listFailed(tenantId: string, params?: ListParams): Promise<ListFailedEventsResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Reset a dead-lettered event so the relay retries it. Clears
|
|
51
|
+
* `dead_lettered_at`, `final_error`, `processed_at`, `retry_count`, and
|
|
52
|
+
* `next_retry_at`. Scoped to `tenantId` so operators cannot replay events
|
|
53
|
+
* from other tenants — returns false when no row matches both the id and
|
|
54
|
+
* the tenant.
|
|
55
|
+
*/
|
|
56
|
+
replay(id: string, tenantId: string): Promise<boolean>;
|
|
57
|
+
/** Delete processed events older than the given ISO date. Returns count deleted. */
|
|
58
|
+
cleanup(olderThan: string): Promise<number>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Password, PasswordInsert } from "../types";
|
|
2
|
+
export interface PasswordsAdapter {
|
|
3
|
+
create: (tenant_id: string, params: PasswordInsert) => Promise<Password>;
|
|
4
|
+
update: (tenant_id: string, params: PasswordInsert) => Promise<boolean>;
|
|
5
|
+
get: (tenant_id: string, user_id: string) => Promise<Password | null>;
|
|
6
|
+
list: (tenant_id: string, user_id: string, limit?: number) => Promise<Password[]>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logical buckets that consumers can rate-limit against. Backends decide
|
|
3
|
+
* how each scope is enforced (e.g. mapping to a separate Cloudflare Workers
|
|
4
|
+
* Rate Limiter binding with its own deploy-time limit/period).
|
|
5
|
+
*/
|
|
6
|
+
export type RateLimitScope = "pre-login" | "pre-user-registration" | "brute-force";
|
|
7
|
+
export interface RateLimitDecision {
|
|
8
|
+
/** True if the request is allowed; false if the limit was exceeded. */
|
|
9
|
+
allowed: boolean;
|
|
10
|
+
/** Optional retry-after hint in seconds (omitted if the backend can't tell). */
|
|
11
|
+
retryAfterSeconds?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface RateLimitAdapter {
|
|
14
|
+
/**
|
|
15
|
+
* Consume one unit of quota for the given scope and key.
|
|
16
|
+
*
|
|
17
|
+
* The numeric threshold and window are backend-specific; the
|
|
18
|
+
* Cloudflare Workers Rate Limiter binding bakes them in at deploy
|
|
19
|
+
* time and cannot honor a per-tenant override. Callers that need
|
|
20
|
+
* per-tenant `max_attempts` should layer their own counter on top.
|
|
21
|
+
*
|
|
22
|
+
* Returns `{ allowed: true }` if the scope is not configured, so
|
|
23
|
+
* callers can opt in by configuring backends without changing call
|
|
24
|
+
* sites.
|
|
25
|
+
*/
|
|
26
|
+
consume(scope: RateLimitScope, key: string): Promise<RateLimitDecision>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RefreshToken, RefreshTokenInsert, Totals, ListParams } from "../types";
|
|
2
|
+
export interface ListRefreshTokenResponse extends Totals {
|
|
3
|
+
refresh_tokens: RefreshToken[];
|
|
4
|
+
}
|
|
5
|
+
export interface UpdateRefreshTokenOptions {
|
|
6
|
+
/**
|
|
7
|
+
* When provided, the adapter also extends the parent login_session's
|
|
8
|
+
* `expires_at` to `expires_at` (only if the current value is smaller).
|
|
9
|
+
* The caller is expected to compute the new expiry so the adapter can
|
|
10
|
+
* avoid a read-before-write and parallelise the two UPDATEs.
|
|
11
|
+
*/
|
|
12
|
+
loginSessionBump?: {
|
|
13
|
+
login_id: string;
|
|
14
|
+
expires_at: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface RefreshTokensAdapter {
|
|
18
|
+
create: (tenant_id: string, refresh_token: RefreshTokenInsert) => Promise<RefreshToken>;
|
|
19
|
+
get: (tenant_id: string, id: string) => Promise<RefreshToken | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Look up a refresh token by its plaintext `token_lookup` slice (extracted
|
|
22
|
+
* from the wire format `rt_<lookup>.<secret>`). Returns null if no row
|
|
23
|
+
* matches. Callers must verify the secret hash before trusting the row.
|
|
24
|
+
*/
|
|
25
|
+
getByLookup: (tenant_id: string, token_lookup: string) => Promise<RefreshToken | null>;
|
|
26
|
+
list(tenant_id: string, params?: ListParams): Promise<ListRefreshTokenResponse>;
|
|
27
|
+
update: (tenant_id: string, id: string, refresh_token: Partial<RefreshToken>, options?: UpdateRefreshTokenOptions) => Promise<boolean>;
|
|
28
|
+
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
29
|
+
revokeByLoginSession: (tenant_id: string, login_session_id: string, revoked_at: string) => Promise<number>;
|
|
30
|
+
/**
|
|
31
|
+
* Soft-revoke every refresh token that shares `family_id` and isn't already
|
|
32
|
+
* revoked. Used for reuse detection (entire rotation chain torched) and for
|
|
33
|
+
* admin revocations that should propagate to descendants.
|
|
34
|
+
*/
|
|
35
|
+
revokeFamily: (tenant_id: string, family_id: string, revoked_at: string) => Promise<number>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ListParams } from "../types/ListParams";
|
|
2
|
+
import { ResourceServer, ResourceServerInsert, Totals } from "../types";
|
|
3
|
+
export interface ListResourceServersResponse extends Totals {
|
|
4
|
+
resource_servers: ResourceServer[];
|
|
5
|
+
}
|
|
6
|
+
export interface ResourceServersAdapter {
|
|
7
|
+
create(tenant_id: string, params: ResourceServerInsert): Promise<ResourceServer>;
|
|
8
|
+
get(tenant_id: string, id: string): Promise<ResourceServer | null>;
|
|
9
|
+
list(tenant_id: string, params?: ListParams): Promise<ListResourceServersResponse>;
|
|
10
|
+
update(tenant_id: string, id: string, resourceServer: Partial<ResourceServerInsert>): Promise<boolean>;
|
|
11
|
+
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ListParams } from "../types/ListParams";
|
|
2
|
+
import { RolePermissionInsert, RolePermissionList } from "../types/RolePermission";
|
|
3
|
+
export interface RolePermissionsAdapter {
|
|
4
|
+
assign(tenant_id: string, role_id: string, permissions: RolePermissionInsert[]): Promise<boolean>;
|
|
5
|
+
remove(tenant_id: string, role_id: string, permissions: Pick<RolePermissionInsert, "resource_server_identifier" | "permission_name">[]): Promise<boolean>;
|
|
6
|
+
list(tenant_id: string, role_id: string, params?: ListParams): Promise<RolePermissionList>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Role, RoleInsert } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { Totals } from "../types";
|
|
4
|
+
export interface ListRolesResponse extends Totals {
|
|
5
|
+
roles: Role[];
|
|
6
|
+
}
|
|
7
|
+
export interface RolesAdapter {
|
|
8
|
+
create(tenantId: string, role: RoleInsert): Promise<Role>;
|
|
9
|
+
get(tenantId: string, roleId: string): Promise<Role | null>;
|
|
10
|
+
list(tenantId: string, params?: ListParams): Promise<ListRolesResponse>;
|
|
11
|
+
update(tenantId: string, roleId: string, updates: Partial<Role>): Promise<boolean>;
|
|
12
|
+
remove(tenantId: string, roleId: string): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Session, SessionInsert, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListSesssionsResponse extends Totals {
|
|
4
|
+
sessions: Session[];
|
|
5
|
+
}
|
|
6
|
+
export interface SessionsAdapter {
|
|
7
|
+
create: (tenant_id: string, session: SessionInsert) => Promise<Session>;
|
|
8
|
+
get: (tenant_id: string, id: string) => Promise<Session | null>;
|
|
9
|
+
list(tenantId: string, params?: ListParams): Promise<ListSesssionsResponse>;
|
|
10
|
+
update: (tenant_id: string, id: string, session: Partial<Session>) => Promise<boolean>;
|
|
11
|
+
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SmsServiceSendParams {
|
|
2
|
+
to: string;
|
|
3
|
+
from?: string;
|
|
4
|
+
text: string;
|
|
5
|
+
template: string;
|
|
6
|
+
options: Record<string, unknown>;
|
|
7
|
+
data: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface SmsServiceAdapter {
|
|
10
|
+
send(params: SmsServiceSendParams): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DailyStats } from "../types";
|
|
2
|
+
export interface StatsListParams {
|
|
3
|
+
from?: string;
|
|
4
|
+
to?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StatsAdapter {
|
|
7
|
+
/**
|
|
8
|
+
* Get daily statistics (logins, signups, etc.) for a date range
|
|
9
|
+
*/
|
|
10
|
+
getDaily(tenantId: string, params?: StatsListParams): Promise<DailyStats[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Get the number of active users in the last 30 days
|
|
13
|
+
*/
|
|
14
|
+
getActiveUsers(tenantId: string): Promise<number>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Tenant, Totals } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface CreateTenantParams {
|
|
4
|
+
friendly_name: string;
|
|
5
|
+
audience: string;
|
|
6
|
+
sender_name: string;
|
|
7
|
+
sender_email: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
session_lifetime?: number;
|
|
10
|
+
idle_session_lifetime?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TenantsDataAdapter {
|
|
13
|
+
create(params: CreateTenantParams): Promise<Tenant>;
|
|
14
|
+
get(id: string): Promise<Tenant | null>;
|
|
15
|
+
list(params?: ListParams): Promise<{
|
|
16
|
+
tenants: Tenant[];
|
|
17
|
+
totals?: Totals;
|
|
18
|
+
}>;
|
|
19
|
+
update(id: string, tenant: Partial<Tenant>): Promise<void>;
|
|
20
|
+
remove(tenantId: string): Promise<boolean>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThemeInsert, Theme } from "../types/Theme";
|
|
2
|
+
export interface ThemesAdapter {
|
|
3
|
+
create: (tenant_id: string, theme: ThemeInsert, themeId?: string) => Promise<Theme>;
|
|
4
|
+
remove: (tenant_id: string, themeId: string) => Promise<boolean>;
|
|
5
|
+
get: (tenant_id: string, themeId: string) => Promise<Theme | null>;
|
|
6
|
+
update: (tenant_id: string, themeId: any, theme: Partial<ThemeInsert>) => Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface UniversalLoginTemplate {
|
|
2
|
+
body: string;
|
|
3
|
+
}
|
|
4
|
+
export interface UniversalLoginTemplatesAdapter {
|
|
5
|
+
get: (tenant_id: string) => Promise<UniversalLoginTemplate | null>;
|
|
6
|
+
set: (tenant_id: string, template: UniversalLoginTemplate) => Promise<void>;
|
|
7
|
+
delete: (tenant_id: string) => Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Totals } from "../types";
|
|
2
|
+
import { UserOrganization, UserOrganizationInsert } from "../types/UserOrganization";
|
|
3
|
+
import { Organization } from "../types/Organization";
|
|
4
|
+
import { ListParams } from "../types/ListParams";
|
|
5
|
+
export interface UserOrganizationsAdapter {
|
|
6
|
+
create(tenantId: string, params: UserOrganizationInsert): Promise<UserOrganization>;
|
|
7
|
+
get(tenantId: string, id: string): Promise<UserOrganization | null>;
|
|
8
|
+
remove(tenantId: string, id: string): Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* List user-organization relationships
|
|
11
|
+
* @param tenantId - The tenant ID
|
|
12
|
+
* @param params - List parameters including query options:
|
|
13
|
+
* - q: "user_id:{userId}" to get organizations for a specific user
|
|
14
|
+
* - q: "organization_id:{organizationId}" to get members of a specific organization
|
|
15
|
+
*/
|
|
16
|
+
list(tenantId: string, params?: ListParams): Promise<{
|
|
17
|
+
userOrganizations: UserOrganization[];
|
|
18
|
+
} & Totals>;
|
|
19
|
+
/**
|
|
20
|
+
* List organizations for a specific user (Auth0 compatible API)
|
|
21
|
+
* Returns full organization objects instead of user-organization relationships
|
|
22
|
+
*/
|
|
23
|
+
listUserOrganizations(tenantId: string, userId: string, params?: ListParams): Promise<{
|
|
24
|
+
organizations: Organization[];
|
|
25
|
+
} & Totals>;
|
|
26
|
+
update(tenantId: string, id: string, params: Partial<UserOrganizationInsert>): Promise<boolean>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ListParams } from "../types/ListParams";
|
|
2
|
+
import { UserPermissionInsert, UserPermissionWithDetailsList } from "../types";
|
|
3
|
+
export interface UserPermissionsAdapter {
|
|
4
|
+
create(tenant_id: string, user_id: string, permission: UserPermissionInsert, organization_id?: string): Promise<boolean>;
|
|
5
|
+
remove(tenant_id: string, user_id: string, permission: Pick<UserPermissionInsert, "resource_server_identifier" | "permission_name">, organization_id?: string): Promise<boolean>;
|
|
6
|
+
list(tenant_id: string, user_id: string, params?: ListParams, organization_id?: string): Promise<UserPermissionWithDetailsList>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Role } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListUserRolesResponse {
|
|
4
|
+
roles: Role[];
|
|
5
|
+
start: number;
|
|
6
|
+
limit: number;
|
|
7
|
+
length: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UserRolesAdapter {
|
|
10
|
+
list(tenantId: string, userId: string, params?: ListParams, organizationId?: string): Promise<Role[]>;
|
|
11
|
+
create(tenantId: string, userId: string, roleId: string, organizationId?: string): Promise<boolean>;
|
|
12
|
+
remove(tenantId: string, userId: string, roleId: string, organizationId?: string): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { User, Totals, UserInsert } from "../types";
|
|
2
|
+
import { ListParams } from "../types/ListParams";
|
|
3
|
+
export interface ListUsersResponse extends Totals {
|
|
4
|
+
users: User[];
|
|
5
|
+
}
|
|
6
|
+
export interface UserDataAdapter {
|
|
7
|
+
get(tenant_id: string, id: string): Promise<User | null>;
|
|
8
|
+
create(tenantId: string, user: UserInsert): Promise<User>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a user without invoking any decorator-level hooks (pre/post
|
|
11
|
+
* registration hooks, linking, webhooks, etc.). Intended to be called from
|
|
12
|
+
* inside a registration pipeline that owns hook orchestration and transaction
|
|
13
|
+
* boundaries itself. The DB-level behavior is identical to `create`.
|
|
14
|
+
*/
|
|
15
|
+
rawCreate(tenantId: string, user: UserInsert): Promise<User>;
|
|
16
|
+
remove(tenantId: string, id: string): Promise<boolean>;
|
|
17
|
+
list(tenantId: string, params?: ListParams): Promise<ListUsersResponse>;
|
|
18
|
+
update(tenantId: string, id: string, user: Partial<User>): Promise<boolean>;
|
|
19
|
+
unlink(tenantId: string, id: string, provider: string, linked_user_id: string): Promise<boolean>;
|
|
20
|
+
}
|