@authhero/adapter-interfaces 3.2.0 → 3.4.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 +95 -34
- package/dist/adapter-interfaces.mjs +12 -7
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/adapters/ActionVersions.d.ts +2 -1
- package/dist/types/adapters/Actions.d.ts +2 -1
- package/dist/types/adapters/AuthenticationMethods.d.ts +2 -1
- package/dist/types/adapters/ClientGrants.d.ts +2 -1
- package/dist/types/adapters/Clients.d.ts +2 -1
- package/dist/types/adapters/Connections.d.ts +2 -2
- package/dist/types/adapters/CustomDomains.d.ts +2 -1
- package/dist/types/adapters/CustomText.d.ts +2 -1
- package/dist/types/adapters/EmailProviders.d.ts +2 -1
- package/dist/types/adapters/EmailTemplates.d.ts +2 -1
- package/dist/types/adapters/Flows.d.ts +2 -1
- package/dist/types/adapters/Forms.d.ts +2 -1
- package/dist/types/adapters/HookCode.d.ts +2 -1
- package/dist/types/adapters/Hooks.d.ts +2 -1
- package/dist/types/adapters/Invites.d.ts +2 -1
- package/dist/types/adapters/Keys.d.ts +2 -1
- package/dist/types/adapters/LogStreams.d.ts +2 -1
- package/dist/types/adapters/MigrationSources.d.ts +2 -1
- package/dist/types/adapters/OrganizationConnections.d.ts +2 -1
- package/dist/types/adapters/Organizations.d.ts +2 -1
- package/dist/types/adapters/Passwords.d.ts +2 -1
- package/dist/types/adapters/ProxyRoutes.d.ts +2 -1
- package/dist/types/adapters/ResourceServers.d.ts +2 -1
- package/dist/types/adapters/RolePermissions.d.ts +2 -1
- package/dist/types/adapters/Roles.d.ts +2 -1
- package/dist/types/adapters/Sessions.d.ts +17 -0
- package/dist/types/adapters/Tenants.d.ts +10 -1
- package/dist/types/adapters/Themes.d.ts +9 -1
- package/dist/types/adapters/UniversalLoginTemplates.d.ts +2 -1
- package/dist/types/adapters/UserOrganizations.d.ts +2 -1
- package/dist/types/adapters/UserPermissions.d.ts +2 -1
- package/dist/types/adapters/UserRoles.d.ts +2 -1
- package/dist/types/adapters/Users.d.ts +2 -1
- package/dist/types/types/ImportMetadata.d.ts +27 -0
- package/dist/types/types/Tenant.d.ts +2 -0
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ActionVersion, ActionVersionInsert, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListActionVersionsResponse extends Totals {
|
|
4
5
|
versions: ActionVersion[];
|
|
5
6
|
}
|
|
@@ -9,7 +10,7 @@ export interface ActionVersionsAdapter {
|
|
|
9
10
|
* sequential `number` per action_id and clears the `deployed` flag on any
|
|
10
11
|
* prior versions when the new one is created with `deployed: true`.
|
|
11
12
|
*/
|
|
12
|
-
create: (tenant_id: string, version: ActionVersionInsert) => Promise<ActionVersion>;
|
|
13
|
+
create: (tenant_id: string, version: ActionVersionInsert, options?: CreateOptions) => Promise<ActionVersion>;
|
|
13
14
|
get: (tenant_id: string, action_id: string, version_id: string) => Promise<ActionVersion | null>;
|
|
14
15
|
list: (tenant_id: string, action_id: string, params?: ListParams) => Promise<ListActionVersionsResponse>;
|
|
15
16
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Action, ActionInsert, ActionUpdate, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListActionsResponse extends Totals {
|
|
4
5
|
actions: Action[];
|
|
5
6
|
}
|
|
6
7
|
export interface ActionsAdapter {
|
|
7
|
-
create: (tenant_id: string, action: ActionInsert) => Promise<Action>;
|
|
8
|
+
create: (tenant_id: string, action: ActionInsert, options?: CreateOptions) => Promise<Action>;
|
|
8
9
|
get: (tenant_id: string, action_id: string) => Promise<Action | null>;
|
|
9
10
|
update: (tenant_id: string, action_id: string, action: ActionUpdate) => Promise<boolean>;
|
|
10
11
|
remove: (tenant_id: string, action_id: string) => Promise<boolean>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AuthenticationMethod, AuthenticationMethodInsert, AuthenticationMethodUpdate } from "../types/AuthenticationMethod";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface AuthenticationMethodsAdapter {
|
|
3
|
-
create: (tenant_id: string, method: AuthenticationMethodInsert) => Promise<AuthenticationMethod>;
|
|
4
|
+
create: (tenant_id: string, method: AuthenticationMethodInsert, options?: CreateOptions) => Promise<AuthenticationMethod>;
|
|
4
5
|
get: (tenant_id: string, method_id: string) => Promise<AuthenticationMethod | null>;
|
|
5
6
|
getByCredentialId: (tenant_id: string, credential_id: string) => Promise<AuthenticationMethod | null>;
|
|
6
7
|
list: (tenant_id: string, user_id: string) => Promise<AuthenticationMethod[]>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ListParams } from "../types/ListParams";
|
|
2
2
|
import { ClientGrant, ClientGrantInsert, Totals } from "../types";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListClientGrantsResponse extends Totals {
|
|
4
5
|
client_grants: ClientGrant[];
|
|
5
6
|
}
|
|
6
7
|
export interface ClientGrantsAdapter {
|
|
7
|
-
create(tenant_id: string, params: ClientGrantInsert): Promise<ClientGrant>;
|
|
8
|
+
create(tenant_id: string, params: ClientGrantInsert, options?: CreateOptions): Promise<ClientGrant>;
|
|
8
9
|
get(tenant_id: string, id: string): Promise<ClientGrant | null>;
|
|
9
10
|
list(tenant_id: string, params?: ListParams): Promise<ListClientGrantsResponse>;
|
|
10
11
|
update(tenant_id: string, id: string, clientGrant: Partial<ClientGrantInsert>): Promise<boolean>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Client, ClientInsert, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
/**
|
|
4
5
|
* Result from getByClientId including tenant_id since client_id alone
|
|
5
6
|
* is used to look up the client across all tenants
|
|
@@ -8,7 +9,7 @@ export interface ClientWithTenantId extends Client {
|
|
|
8
9
|
tenant_id: string;
|
|
9
10
|
}
|
|
10
11
|
export interface ClientsAdapter {
|
|
11
|
-
create(tenant_id: string, params: ClientInsert): Promise<Client>;
|
|
12
|
+
create(tenant_id: string, params: ClientInsert, options?: CreateOptions): Promise<Client>;
|
|
12
13
|
get(tenant_id: string, client_id: string): Promise<Client | null>;
|
|
13
14
|
/**
|
|
14
15
|
* Get a client by client_id only (without tenant_id).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Connection, ConnectionInsert, Totals } from "../types";
|
|
1
|
+
import { Connection, ConnectionInsert, CreateOptions, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
3
|
export interface ListConnectionsResponse extends Totals {
|
|
4
4
|
connections: Connection[];
|
|
5
5
|
}
|
|
6
6
|
export interface ConnectionsAdapter {
|
|
7
|
-
create(tenant_id: string, params: ConnectionInsert): Promise<Connection>;
|
|
7
|
+
create(tenant_id: string, params: ConnectionInsert, options?: CreateOptions): Promise<Connection>;
|
|
8
8
|
remove(tenant_id: string, connection_id: string): Promise<boolean>;
|
|
9
9
|
get(tenant_id: string, connection_id: string): Promise<Connection | null>;
|
|
10
10
|
update(tenant_id: string, connection_id: string, params: Partial<ConnectionInsert>): Promise<boolean>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CustomDomain, CustomDomainCertificateUpload, CustomDomainInsert, CustomDomainWithTenantId } from "../types/CustomDomain";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface CustomDomainsAdapter {
|
|
3
|
-
create: (tenant_id: string, custom_domain: CustomDomainInsert) => Promise<CustomDomain>;
|
|
4
|
+
create: (tenant_id: string, custom_domain: CustomDomainInsert, options?: CreateOptions) => Promise<CustomDomain>;
|
|
4
5
|
get: (tenant_id: string, id: string) => Promise<CustomDomain | null>;
|
|
5
6
|
getByDomain: (domain: string) => Promise<CustomDomainWithTenantId | null>;
|
|
6
7
|
list: (tenant_id: string) => Promise<CustomDomain[]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CustomText, PromptScreen } from "../types";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface CustomTextAdapter {
|
|
3
4
|
/**
|
|
4
5
|
* Get custom text for a specific prompt screen and language
|
|
@@ -7,7 +8,7 @@ export interface CustomTextAdapter {
|
|
|
7
8
|
/**
|
|
8
9
|
* Set custom text for a specific prompt screen and language
|
|
9
10
|
*/
|
|
10
|
-
set: (tenant_id: string, prompt: PromptScreen, language: string, customText: CustomText) => Promise<void>;
|
|
11
|
+
set: (tenant_id: string, prompt: PromptScreen, language: string, customText: CustomText, options?: CreateOptions) => Promise<void>;
|
|
11
12
|
/**
|
|
12
13
|
* Delete custom text for a specific prompt screen and language
|
|
13
14
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EmailProvider } from "../types";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface EmailProvidersAdapter {
|
|
3
4
|
update: (tenant_id: string, emailProvider: Partial<EmailProvider>) => Promise<void>;
|
|
4
|
-
create: (tenant_id: string, emailProvider: EmailProvider) => Promise<void>;
|
|
5
|
+
create: (tenant_id: string, emailProvider: EmailProvider, options?: CreateOptions) => Promise<void>;
|
|
5
6
|
get: (tenant_id: string) => Promise<EmailProvider | null>;
|
|
6
7
|
remove: (tenant_id: string) => Promise<void>;
|
|
7
8
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EmailTemplate, EmailTemplateName } from "../types";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface EmailTemplatesAdapter {
|
|
3
4
|
get: (tenant_id: string, templateName: EmailTemplateName) => Promise<EmailTemplate | null>;
|
|
4
5
|
list: (tenant_id: string) => Promise<EmailTemplate[]>;
|
|
5
|
-
create: (tenant_id: string, template: EmailTemplate) => Promise<EmailTemplate>;
|
|
6
|
+
create: (tenant_id: string, template: EmailTemplate, options?: CreateOptions) => Promise<EmailTemplate>;
|
|
6
7
|
update: (tenant_id: string, templateName: EmailTemplateName, template: Partial<EmailTemplate>) => Promise<boolean>;
|
|
7
8
|
remove: (tenant_id: string, templateName: EmailTemplateName) => Promise<boolean>;
|
|
8
9
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Flow, FlowInsert, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListFlowsResponse extends Totals {
|
|
4
5
|
flows: Flow[];
|
|
5
6
|
}
|
|
6
7
|
export interface FlowsAdapter {
|
|
7
|
-
create(tenant_id: string, params: FlowInsert): Promise<Flow>;
|
|
8
|
+
create(tenant_id: string, params: FlowInsert, options?: CreateOptions): Promise<Flow>;
|
|
8
9
|
get(tenant_id: string, flow_id: string): Promise<Flow | null>;
|
|
9
10
|
remove(tenant_id: string, flow_id: string): Promise<boolean>;
|
|
10
11
|
update(tenant_id: string, flow_id: string, flow: Partial<FlowInsert>): Promise<Flow | null>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Form, FormInsert, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListFormsResponse extends Totals {
|
|
4
5
|
forms: Form[];
|
|
5
6
|
}
|
|
6
7
|
export interface FormsAdapter {
|
|
7
|
-
create(tenant_id: string, params: FormInsert): Promise<Form>;
|
|
8
|
+
create(tenant_id: string, params: FormInsert, options?: CreateOptions): Promise<Form>;
|
|
8
9
|
get(tenant_id: string, form_id: string): Promise<Form | null>;
|
|
9
10
|
remove(tenant_id: string, form_id: string): Promise<boolean>;
|
|
10
11
|
update(tenant_id: string, form_id: string, form: Partial<FormInsert>): Promise<boolean>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HookCode, HookCodeInsert } from "../types";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface HookCodeAdapter {
|
|
3
|
-
create: (tenant_id: string, hookCode: HookCodeInsert) => Promise<HookCode>;
|
|
4
|
+
create: (tenant_id: string, hookCode: HookCodeInsert, options?: CreateOptions) => Promise<HookCode>;
|
|
4
5
|
get: (tenant_id: string, id: string) => Promise<HookCode | null>;
|
|
5
6
|
update: (tenant_id: string, id: string, hookCode: Partial<HookCodeInsert>) => Promise<boolean>;
|
|
6
7
|
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Hook, HookInsert, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListHooksResponse extends Totals {
|
|
4
5
|
hooks: Hook[];
|
|
5
6
|
}
|
|
6
7
|
export interface HooksAdapter {
|
|
7
|
-
create: (tenant_id: string, hook: HookInsert) => Promise<Hook>;
|
|
8
|
+
create: (tenant_id: string, hook: HookInsert, options?: CreateOptions) => Promise<Hook>;
|
|
8
9
|
remove: (tenant_id: string, hook_id: string) => Promise<boolean>;
|
|
9
10
|
get: (tenant_id: string, hook_id: string) => Promise<Hook | null>;
|
|
10
11
|
update: (tenant_id: string, hook_id: string, hook: Partial<HookInsert>) => Promise<boolean>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Invite, InviteInsert, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListInvitesResponse extends Totals {
|
|
4
5
|
invites: Invite[];
|
|
5
6
|
}
|
|
6
7
|
export interface InvitesAdapter {
|
|
7
|
-
create(tenant_id: string, params: InviteInsert): Promise<Invite>;
|
|
8
|
+
create(tenant_id: string, params: InviteInsert, options?: CreateOptions): Promise<Invite>;
|
|
8
9
|
get(tenant_id: string, id: string): Promise<Invite | null>;
|
|
9
10
|
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
10
11
|
list(tenant_id: string, params?: ListParams): Promise<ListInvitesResponse>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SigningKey, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListKeysResponse extends Totals {
|
|
4
5
|
signingKeys: SigningKey[];
|
|
5
6
|
}
|
|
6
7
|
export interface KeysAdapter {
|
|
7
|
-
create: (key: SigningKey) => Promise<void>;
|
|
8
|
+
create: (key: SigningKey, options?: CreateOptions) => Promise<void>;
|
|
8
9
|
list: (params?: ListParams) => Promise<ListKeysResponse>;
|
|
9
10
|
update: (kid: string, key: Partial<Omit<SigningKey, "kid">>) => Promise<boolean>;
|
|
10
11
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LogStream, LogStreamInsert } from "../types/LogStream";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface LogStreamsAdapter {
|
|
3
|
-
create(tenant_id: string, params: LogStreamInsert): Promise<LogStream>;
|
|
4
|
+
create(tenant_id: string, params: LogStreamInsert, options?: CreateOptions): Promise<LogStream>;
|
|
4
5
|
get(tenant_id: string, id: string): Promise<LogStream | null>;
|
|
5
6
|
list(tenant_id: string): Promise<LogStream[]>;
|
|
6
7
|
update(tenant_id: string, id: string, params: Partial<LogStream>): Promise<boolean>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MigrationSource, MigrationSourceInsert } from "../types/MigrationSource";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface MigrationSourcesAdapter {
|
|
3
|
-
create: (tenant_id: string, migration_source: MigrationSourceInsert) => Promise<MigrationSource>;
|
|
4
|
+
create: (tenant_id: string, migration_source: MigrationSourceInsert, options?: CreateOptions) => Promise<MigrationSource>;
|
|
4
5
|
get: (tenant_id: string, id: string) => Promise<MigrationSource | null>;
|
|
5
6
|
list: (tenant_id: string) => Promise<MigrationSource[]>;
|
|
6
7
|
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OrganizationConnection, OrganizationConnectionInsert } from "../types";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface OrganizationConnectionsAdapter {
|
|
3
|
-
create(tenant_id: string, organization_id: string, params: OrganizationConnectionInsert): Promise<OrganizationConnection>;
|
|
4
|
+
create(tenant_id: string, organization_id: string, params: OrganizationConnectionInsert, options?: CreateOptions): Promise<OrganizationConnection>;
|
|
4
5
|
list(tenant_id: string, organization_id: string): Promise<OrganizationConnection[]>;
|
|
5
6
|
get(tenant_id: string, organization_id: string, connection_id: string): Promise<OrganizationConnection | null>;
|
|
6
7
|
update(tenant_id: string, organization_id: string, connection_id: string, params: Partial<Omit<OrganizationConnectionInsert, "connection_id">>): Promise<OrganizationConnection | null>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Organization, OrganizationInsert, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListOrganizationsResponse extends Totals {
|
|
4
5
|
organizations: Organization[];
|
|
5
6
|
}
|
|
6
7
|
export interface OrganizationsAdapter {
|
|
7
|
-
create(tenant_id: string, params: OrganizationInsert): Promise<Organization>;
|
|
8
|
+
create(tenant_id: string, params: OrganizationInsert, options?: CreateOptions): Promise<Organization>;
|
|
8
9
|
get(tenant_id: string, id: string): Promise<Organization | null>;
|
|
9
10
|
remove(tenant_id: string, id: string): Promise<boolean>;
|
|
10
11
|
list(tenant_id: string, params?: ListParams): Promise<ListOrganizationsResponse>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Password, PasswordInsert } from "../types";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface PasswordsAdapter {
|
|
3
|
-
create: (tenant_id: string, params: PasswordInsert) => Promise<Password>;
|
|
4
|
+
create: (tenant_id: string, params: PasswordInsert, options?: CreateOptions) => Promise<Password>;
|
|
4
5
|
update: (tenant_id: string, params: PasswordInsert) => Promise<boolean>;
|
|
5
6
|
get: (tenant_id: string, user_id: string) => Promise<Password | null>;
|
|
6
7
|
list: (tenant_id: string, user_id: string, limit?: number) => Promise<Password[]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProxyRoute, ProxyRouteInsert, ProxyRouteUpdate } from "../types/ProxyRoute";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface ListProxyRoutesParams {
|
|
3
4
|
page?: number;
|
|
4
5
|
per_page?: number;
|
|
@@ -11,7 +12,7 @@ export interface ListProxyRoutesResult {
|
|
|
11
12
|
length: number;
|
|
12
13
|
}
|
|
13
14
|
export interface ProxyRoutesAdapter {
|
|
14
|
-
create(tenant_id: string, route: ProxyRouteInsert): Promise<ProxyRoute>;
|
|
15
|
+
create(tenant_id: string, route: ProxyRouteInsert, options?: CreateOptions): Promise<ProxyRoute>;
|
|
15
16
|
get(tenant_id: string, id: string): Promise<ProxyRoute | null>;
|
|
16
17
|
list(tenant_id: string, params?: ListProxyRoutesParams): Promise<ListProxyRoutesResult>;
|
|
17
18
|
update(tenant_id: string, id: string, route: ProxyRouteUpdate): Promise<boolean>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ListParams } from "../types/ListParams";
|
|
2
2
|
import { ResourceServer, ResourceServerInsert, Totals } from "../types";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListResourceServersResponse extends Totals {
|
|
4
5
|
resource_servers: ResourceServer[];
|
|
5
6
|
}
|
|
6
7
|
export interface ResourceServersAdapter {
|
|
7
|
-
create(tenant_id: string, params: ResourceServerInsert): Promise<ResourceServer>;
|
|
8
|
+
create(tenant_id: string, params: ResourceServerInsert, options?: CreateOptions): Promise<ResourceServer>;
|
|
8
9
|
get(tenant_id: string, id: string): Promise<ResourceServer | null>;
|
|
9
10
|
list(tenant_id: string, params?: ListParams): Promise<ListResourceServersResponse>;
|
|
10
11
|
update(tenant_id: string, id: string, resourceServer: Partial<ResourceServerInsert>): Promise<boolean>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ListParams } from "../types/ListParams";
|
|
2
2
|
import { RolePermissionInsert, RolePermissionList } from "../types/RolePermission";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface RolePermissionsAdapter {
|
|
4
|
-
assign(tenant_id: string, role_id: string, permissions: RolePermissionInsert[]): Promise<boolean>;
|
|
5
|
+
assign(tenant_id: string, role_id: string, permissions: RolePermissionInsert[], options?: CreateOptions): Promise<boolean>;
|
|
5
6
|
remove(tenant_id: string, role_id: string, permissions: Pick<RolePermissionInsert, "resource_server_identifier" | "permission_name">[]): Promise<boolean>;
|
|
6
7
|
list(tenant_id: string, role_id: string, params?: ListParams): Promise<RolePermissionList>;
|
|
7
8
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Role, RoleInsert } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
3
|
import { Totals } from "../types";
|
|
4
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
4
5
|
export interface ListRolesResponse extends Totals {
|
|
5
6
|
roles: Role[];
|
|
6
7
|
}
|
|
7
8
|
export interface RolesAdapter {
|
|
8
|
-
create(tenantId: string, role: RoleInsert): Promise<Role>;
|
|
9
|
+
create(tenantId: string, role: RoleInsert, options?: CreateOptions): Promise<Role>;
|
|
9
10
|
get(tenantId: string, roleId: string): Promise<Role | null>;
|
|
10
11
|
list(tenantId: string, params?: ListParams): Promise<ListRolesResponse>;
|
|
11
12
|
update(tenantId: string, roleId: string, updates: Partial<Role>): Promise<boolean>;
|
|
@@ -4,9 +4,26 @@ export interface ListSesssionsResponse extends Totals {
|
|
|
4
4
|
sessions: Session[];
|
|
5
5
|
}
|
|
6
6
|
export interface SessionsAdapter {
|
|
7
|
+
/**
|
|
8
|
+
* ADAPTER RESPONSIBILITY (footgun): when a session is created with an
|
|
9
|
+
* `expires_at`/`idle_expires_at`, the adapter MUST extend the parent
|
|
10
|
+
* `login_session` (referenced by `login_session_id`) so it lives at least as
|
|
11
|
+
* long as the session — never shortening it (only bump when the session's
|
|
12
|
+
* expiry is further out than the login_session's current expiry).
|
|
13
|
+
*
|
|
14
|
+
* If an adapter skips this, a long-lived session outlives its login_session
|
|
15
|
+
* and gets orphaned when cleanup reaps the login_session. The bump must be
|
|
16
|
+
* atomic with the insert. See `refreshTokens` for the equivalent contract.
|
|
17
|
+
*/
|
|
7
18
|
create: (tenant_id: string, session: SessionInsert) => Promise<Session>;
|
|
8
19
|
get: (tenant_id: string, id: string) => Promise<Session | null>;
|
|
9
20
|
list(tenantId: string, params?: ListParams): Promise<ListSesssionsResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* ADAPTER RESPONSIBILITY (footgun): when an update moves `expires_at`/
|
|
23
|
+
* `idle_expires_at` forward (session renewal), the adapter MUST extend the
|
|
24
|
+
* parent `login_session` the same way `create` does (never shortening). See
|
|
25
|
+
* the note on `create` above.
|
|
26
|
+
*/
|
|
10
27
|
update: (tenant_id: string, id: string, session: Partial<Session>) => Promise<boolean>;
|
|
11
28
|
remove: (tenant_id: string, id: string) => Promise<boolean>;
|
|
12
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Tenant, Totals } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface CreateTenantParams {
|
|
4
5
|
friendly_name: string;
|
|
5
6
|
audience?: string;
|
|
@@ -14,12 +15,20 @@ export interface CreateTenantParams {
|
|
|
14
15
|
provisioning_state_changed_at?: string;
|
|
15
16
|
bundle_configuration?: string;
|
|
16
17
|
worker_version?: string;
|
|
18
|
+
database_version?: string;
|
|
17
19
|
worker_script_name?: string;
|
|
18
20
|
storage_kind?: "own_d1" | "existing_d1" | "shared_planetscale";
|
|
19
21
|
d1_database_id?: string;
|
|
20
22
|
}
|
|
21
23
|
export interface TenantsDataAdapter {
|
|
22
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Single source of truth for the new tenant id: `options.importMetadata.id`
|
|
26
|
+
* takes precedence, then `params.id`, then a generated id. The tenant
|
|
27
|
+
* importer relies on this by passing the *target* id via `params.id` and
|
|
28
|
+
* leaving `importMetadata.id` unset, so an export always lands under the
|
|
29
|
+
* requested tenant.
|
|
30
|
+
*/
|
|
31
|
+
create(params: CreateTenantParams, options?: CreateOptions): Promise<Tenant>;
|
|
23
32
|
get(id: string): Promise<Tenant | null>;
|
|
24
33
|
list(params?: ListParams): Promise<{
|
|
25
34
|
tenants: Tenant[];
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { ThemeInsert, Theme } from "../types/Theme";
|
|
2
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
2
3
|
export interface ThemesAdapter {
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Single source of truth for the new row's id: `options.importMetadata.id`
|
|
6
|
+
* takes precedence, then the positional `themeId`, then a generated id. Every
|
|
7
|
+
* adapter must honor this same precedence so imports preserve source ids
|
|
8
|
+
* regardless of backend.
|
|
9
|
+
*/
|
|
10
|
+
create: (tenant_id: string, theme: ThemeInsert, themeId?: string, options?: CreateOptions) => Promise<Theme>;
|
|
4
11
|
remove: (tenant_id: string, themeId: string) => Promise<boolean>;
|
|
5
12
|
get: (tenant_id: string, themeId: string) => Promise<Theme | null>;
|
|
13
|
+
list: (tenant_id: string) => Promise<Theme[]>;
|
|
6
14
|
update: (tenant_id: string, themeId: any, theme: Partial<ThemeInsert>) => Promise<boolean>;
|
|
7
15
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
1
2
|
export interface UniversalLoginTemplate {
|
|
2
3
|
body: string;
|
|
3
4
|
}
|
|
4
5
|
export interface UniversalLoginTemplatesAdapter {
|
|
5
6
|
get: (tenant_id: string) => Promise<UniversalLoginTemplate | null>;
|
|
6
|
-
set: (tenant_id: string, template: UniversalLoginTemplate) => Promise<void>;
|
|
7
|
+
set: (tenant_id: string, template: UniversalLoginTemplate, options?: CreateOptions) => Promise<void>;
|
|
7
8
|
delete: (tenant_id: string) => Promise<void>;
|
|
8
9
|
}
|
|
@@ -2,8 +2,9 @@ import { Totals } from "../types";
|
|
|
2
2
|
import { UserOrganization, UserOrganizationInsert } from "../types/UserOrganization";
|
|
3
3
|
import { Organization } from "../types/Organization";
|
|
4
4
|
import { ListParams } from "../types/ListParams";
|
|
5
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
5
6
|
export interface UserOrganizationsAdapter {
|
|
6
|
-
create(tenantId: string, params: UserOrganizationInsert): Promise<UserOrganization>;
|
|
7
|
+
create(tenantId: string, params: UserOrganizationInsert, options?: CreateOptions): Promise<UserOrganization>;
|
|
7
8
|
get(tenantId: string, id: string): Promise<UserOrganization | null>;
|
|
8
9
|
remove(tenantId: string, id: string): Promise<boolean>;
|
|
9
10
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ListParams } from "../types/ListParams";
|
|
2
2
|
import { UserPermissionInsert, UserPermissionWithDetailsList } from "../types";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface UserPermissionsAdapter {
|
|
4
|
-
create(tenant_id: string, user_id: string, permission: UserPermissionInsert, organization_id?: string): Promise<boolean>;
|
|
5
|
+
create(tenant_id: string, user_id: string, permission: UserPermissionInsert, organization_id?: string, options?: CreateOptions): Promise<boolean>;
|
|
5
6
|
remove(tenant_id: string, user_id: string, permission: Pick<UserPermissionInsert, "resource_server_identifier" | "permission_name">, organization_id?: string): Promise<boolean>;
|
|
6
7
|
list(tenant_id: string, user_id: string, params?: ListParams, organization_id?: string): Promise<UserPermissionWithDetailsList>;
|
|
7
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Role } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListUserRolesResponse {
|
|
4
5
|
roles: Role[];
|
|
5
6
|
start: number;
|
|
@@ -8,6 +9,6 @@ export interface ListUserRolesResponse {
|
|
|
8
9
|
}
|
|
9
10
|
export interface UserRolesAdapter {
|
|
10
11
|
list(tenantId: string, userId: string, params?: ListParams, organizationId?: string): Promise<Role[]>;
|
|
11
|
-
create(tenantId: string, userId: string, roleId: string, organizationId?: string): Promise<boolean>;
|
|
12
|
+
create(tenantId: string, userId: string, roleId: string, organizationId?: string, options?: CreateOptions): Promise<boolean>;
|
|
12
13
|
remove(tenantId: string, userId: string, roleId: string, organizationId?: string): Promise<boolean>;
|
|
13
14
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { User, Totals, UserInsert } from "../types";
|
|
2
2
|
import { ListParams } from "../types/ListParams";
|
|
3
|
+
import { CreateOptions } from "../types/ImportMetadata";
|
|
3
4
|
export interface ListUsersResponse extends Totals {
|
|
4
5
|
users: User[];
|
|
5
6
|
}
|
|
6
7
|
export interface UserDataAdapter {
|
|
7
8
|
get(tenant_id: string, id: string): Promise<User | null>;
|
|
8
|
-
create(tenantId: string, user: UserInsert): Promise<User>;
|
|
9
|
+
create(tenantId: string, user: UserInsert, options?: CreateOptions): Promise<User>;
|
|
9
10
|
/**
|
|
10
11
|
* Create a user without invoking any decorator-level hooks (pre/post
|
|
11
12
|
* registration hooks, linking, webhooks, etc.). Intended to be called from
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
/**
|
|
3
|
+
* Import-only metadata for entity `create()` calls.
|
|
4
|
+
*
|
|
5
|
+
* These values are deliberately NOT part of any public `*InsertSchema` and are
|
|
6
|
+
* never accepted on the normal management-API write routes. They reach an
|
|
7
|
+
* adapter only through the dedicated `options.importMetadata` argument, which
|
|
8
|
+
* the HTTP layer never populates — so request bodies can never set a row's
|
|
9
|
+
* timestamps or primary id. The tenant export/import engine is the only caller
|
|
10
|
+
* that passes them, in order to reproduce a source tenant's rows faithfully.
|
|
11
|
+
*
|
|
12
|
+
* When omitted, `create()` keeps its existing behavior: generate the id and
|
|
13
|
+
* stamp `created_at`/`updated_at` with the current time.
|
|
14
|
+
*/
|
|
15
|
+
export declare const importMetadataSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodOptional<z.ZodString>;
|
|
17
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
18
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type ImportMetadata = z.infer<typeof importMetadataSchema>;
|
|
21
|
+
/**
|
|
22
|
+
* Optional third argument accepted by every durable entity's `create()`.
|
|
23
|
+
* Reserved for import-only concerns; see {@link ImportMetadata}.
|
|
24
|
+
*/
|
|
25
|
+
export interface CreateOptions {
|
|
26
|
+
importMetadata?: ImportMetadata;
|
|
27
|
+
}
|
|
@@ -123,6 +123,7 @@ export declare const tenantInsertSchema: z.ZodObject<{
|
|
|
123
123
|
provisioning_state_changed_at: z.ZodOptional<z.ZodString>;
|
|
124
124
|
bundle_configuration: z.ZodOptional<z.ZodString>;
|
|
125
125
|
worker_version: z.ZodOptional<z.ZodString>;
|
|
126
|
+
database_version: z.ZodOptional<z.ZodString>;
|
|
126
127
|
worker_script_name: z.ZodOptional<z.ZodString>;
|
|
127
128
|
storage_kind: z.ZodOptional<z.ZodEnum<{
|
|
128
129
|
own_d1: "own_d1";
|
|
@@ -327,6 +328,7 @@ export declare const tenantSchema: z.ZodObject<{
|
|
|
327
328
|
provisioning_state_changed_at: z.ZodOptional<z.ZodString>;
|
|
328
329
|
bundle_configuration: z.ZodOptional<z.ZodString>;
|
|
329
330
|
worker_version: z.ZodOptional<z.ZodString>;
|
|
331
|
+
database_version: z.ZodOptional<z.ZodString>;
|
|
330
332
|
worker_script_name: z.ZodOptional<z.ZodString>;
|
|
331
333
|
storage_kind: z.ZodOptional<z.ZodEnum<{
|
|
332
334
|
own_d1: "own_d1";
|