@authhero/kysely-adapter 11.8.11 → 11.10.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.
Files changed (39) hide show
  1. package/dist/kysely-adapter.cjs +15 -15
  2. package/dist/kysely-adapter.d.ts +1 -0
  3. package/dist/kysely-adapter.mjs +2312 -2270
  4. package/dist/types/migrate/migrations/2026-06-27T12:00:00_tenant_database_version.d.ts +11 -0
  5. package/dist/types/migrate/migrations/index.d.ts +2 -0
  6. package/dist/types/src/actions/create.d.ts +2 -2
  7. package/dist/types/src/authenticationMethods/create.d.ts +2 -2
  8. package/dist/types/src/clientGrants/create.d.ts +2 -2
  9. package/dist/types/src/clients/create.d.ts +2 -2
  10. package/dist/types/src/connections/create.d.ts +2 -2
  11. package/dist/types/src/customDomains/create.d.ts +2 -2
  12. package/dist/types/src/db.d.ts +1 -0
  13. package/dist/types/src/emailProvideres/create.d.ts +2 -2
  14. package/dist/types/src/emailTemplates/create.d.ts +2 -2
  15. package/dist/types/src/flows/create.d.ts +2 -2
  16. package/dist/types/src/forms/create.d.ts +2 -2
  17. package/dist/types/src/hook-code/create.d.ts +2 -2
  18. package/dist/types/src/hooks/create.d.ts +2 -2
  19. package/dist/types/src/invites/create.d.ts +2 -2
  20. package/dist/types/src/keys/create.d.ts +2 -2
  21. package/dist/types/src/organizations/create.d.ts +2 -2
  22. package/dist/types/src/passwords/create.d.ts +2 -2
  23. package/dist/types/src/resourceServers/create.d.ts +2 -2
  24. package/dist/types/src/role-permissions/assign.d.ts +2 -2
  25. package/dist/types/src/role-permissions/index.d.ts +1 -1
  26. package/dist/types/src/roles/create.d.ts +2 -2
  27. package/dist/types/src/tenants/create.d.ts +2 -2
  28. package/dist/types/src/tenants/list.d.ts +2 -0
  29. package/dist/types/src/themes/create.d.ts +2 -2
  30. package/dist/types/src/themes/list.d.ts +4 -0
  31. package/dist/types/src/universalLoginTemplates/set.d.ts +2 -2
  32. package/dist/types/src/user-organizations/create.d.ts +2 -2
  33. package/dist/types/src/user-permissions/create.d.ts +2 -2
  34. package/dist/types/src/user-permissions/index.d.ts +1 -1
  35. package/dist/types/src/user-roles/create.d.ts +2 -1
  36. package/dist/types/src/user-roles/index.d.ts +1 -1
  37. package/dist/types/src/users/create.d.ts +2 -2
  38. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  39. package/package.json +3 -3
@@ -0,0 +1,11 @@
1
+ import { Kysely } from "kysely";
2
+ import { Database } from "../../src/db";
3
+ /**
4
+ * Adds `database_version` to the tenant row so the control plane can record the
5
+ * schema version (the latest migration applied) the deployed WFP tenant worker
6
+ * targets. Together with `worker_version` and `bundle_configuration` this lets
7
+ * the control plane detect drift and drive upgrades. Nullable — shared tenants
8
+ * and pre-existing WFP tenants land as `null` until their next (re)provision.
9
+ */
10
+ export declare function up(db: Kysely<Database>): Promise<void>;
11
+ export declare function down(db: Kysely<Database>): Promise<void>;
@@ -173,6 +173,7 @@ import * as o074_widen_user_permissions_resource_server_identifier from "./2026-
173
173
  import * as o075_create_grants from "./2026-06-04T11:00:00_create_grants";
174
174
  import * as o076_default_first_party_true from "./2026-06-04T11:01:00_default_first_party_true";
175
175
  import * as o077_tenant_deployment_fields from "./2026-06-06T12:00:00_tenant_deployment_fields";
176
+ import * as o078_tenant_database_version from "./2026-06-27T12:00:00_tenant_database_version";
176
177
  declare const _default: {
177
178
  m1_init: typeof m1_init;
178
179
  m2_magicLink: typeof m2_magicLink;
@@ -349,5 +350,6 @@ declare const _default: {
349
350
  o075_create_grants: typeof o075_create_grants;
350
351
  o076_default_first_party_true: typeof o076_default_first_party_true;
351
352
  o077_tenant_deployment_fields: typeof o077_tenant_deployment_fields;
353
+ o078_tenant_database_version: typeof o078_tenant_database_version;
352
354
  };
353
355
  export default _default;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { Action, ActionInsert } from "@authhero/adapter-interfaces";
2
+ import { Action, ActionInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, action: ActionInsert) => Promise<Action>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, action: ActionInsert, options?: CreateOptions) => Promise<Action>;
@@ -1,4 +1,4 @@
1
- import { AuthenticationMethod, AuthenticationMethodInsert } from "@authhero/adapter-interfaces";
1
+ import { AuthenticationMethod, AuthenticationMethodInsert, CreateOptions } from "@authhero/adapter-interfaces";
2
2
  import { Kysely } from "kysely";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, method: AuthenticationMethodInsert) => Promise<AuthenticationMethod>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, method: AuthenticationMethodInsert, options?: CreateOptions) => Promise<AuthenticationMethod>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { ClientGrant, ClientGrantInsert } from "@authhero/adapter-interfaces";
2
+ import { ClientGrant, ClientGrantInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, params: ClientGrantInsert) => Promise<ClientGrant>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, params: ClientGrantInsert, options?: CreateOptions) => Promise<ClientGrant>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { Client, ClientInsert } from "@authhero/adapter-interfaces";
2
+ import { Client, ClientInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, params: ClientInsert) => Promise<Client>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, params: ClientInsert, options?: CreateOptions) => Promise<Client>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { Connection, ConnectionInsert } from "@authhero/adapter-interfaces";
2
+ import { Connection, ConnectionInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, params: ConnectionInsert) => Promise<Connection>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, params: ConnectionInsert, options?: CreateOptions) => Promise<Connection>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { CustomDomain, CustomDomainInsert } from "@authhero/adapter-interfaces";
2
+ import { CustomDomain, CustomDomainInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, params: CustomDomainInsert) => Promise<CustomDomain>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, params: CustomDomainInsert, options?: CreateOptions) => Promise<CustomDomain>;
@@ -524,6 +524,7 @@ export declare const sqlTenantSchema: z.ZodObject<{
524
524
  provisioning_state_changed_at: z.ZodOptional<z.ZodString>;
525
525
  bundle_configuration: z.ZodOptional<z.ZodString>;
526
526
  worker_version: z.ZodOptional<z.ZodString>;
527
+ database_version: z.ZodOptional<z.ZodString>;
527
528
  worker_script_name: z.ZodOptional<z.ZodString>;
528
529
  storage_kind: z.ZodOptional<z.ZodEnum<{
529
530
  own_d1: "own_d1";
@@ -1,4 +1,4 @@
1
- import { EmailProvider } from "@authhero/adapter-interfaces";
1
+ import { CreateOptions, EmailProvider } from "@authhero/adapter-interfaces";
2
2
  import { Kysely } from "kysely";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, emailProvider: EmailProvider) => Promise<void>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, emailProvider: EmailProvider, options?: CreateOptions) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { EmailTemplate } from "@authhero/adapter-interfaces";
1
+ import { EmailTemplate, CreateOptions } from "@authhero/adapter-interfaces";
2
2
  import { Kysely } from "kysely";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, template: EmailTemplate) => Promise<EmailTemplate>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, template: EmailTemplate, options?: CreateOptions) => Promise<EmailTemplate>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { Flow, FlowInsert } from "@authhero/adapter-interfaces";
2
+ import { CreateOptions, Flow, FlowInsert } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, params: FlowInsert) => Promise<Flow>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, params: FlowInsert, options?: CreateOptions) => Promise<Flow>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { Form, FormInsert } from "@authhero/adapter-interfaces";
2
+ import { CreateOptions, Form, FormInsert } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, params: FormInsert) => Promise<Form>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, params: FormInsert, options?: CreateOptions) => Promise<Form>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { HookCode, HookCodeInsert } from "@authhero/adapter-interfaces";
2
+ import { CreateOptions, HookCode, HookCodeInsert } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, hookCode: HookCodeInsert) => Promise<HookCode>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, hookCode: HookCodeInsert, options?: CreateOptions) => Promise<HookCode>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { Hook, HookInsert } from "@authhero/adapter-interfaces";
2
+ import { CreateOptions, Hook, HookInsert } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, hook: HookInsert) => Promise<Hook>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, hook: HookInsert, options?: CreateOptions) => Promise<Hook>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { Invite, InviteInsert } from "@authhero/adapter-interfaces";
4
- export declare function create(db: Kysely<Database>): (tenantId: string, invite: InviteInsert) => Promise<Invite>;
3
+ import { Invite, InviteInsert, CreateOptions } from "@authhero/adapter-interfaces";
4
+ export declare function create(db: Kysely<Database>): (tenantId: string, invite: InviteInsert, options?: CreateOptions) => Promise<Invite>;
@@ -1,4 +1,4 @@
1
- import { SigningKey } from "@authhero/adapter-interfaces";
1
+ import { SigningKey, CreateOptions } from "@authhero/adapter-interfaces";
2
2
  import { Kysely } from "kysely";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (key: SigningKey) => Promise<void>;
4
+ export declare function create(db: Kysely<Database>): (key: SigningKey, options?: CreateOptions) => Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { Organization, OrganizationInsert } from "@authhero/adapter-interfaces";
4
- export declare function create(db: Kysely<Database>): (tenantId: string, organization: OrganizationInsert) => Promise<Organization>;
3
+ import { Organization, OrganizationInsert, CreateOptions } from "@authhero/adapter-interfaces";
4
+ export declare function create(db: Kysely<Database>): (tenantId: string, organization: OrganizationInsert, options?: CreateOptions) => Promise<Organization>;
@@ -1,7 +1,7 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { PasswordInsert } from "@authhero/adapter-interfaces";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, password: PasswordInsert) => Promise<{
3
+ import { PasswordInsert, CreateOptions } from "@authhero/adapter-interfaces";
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, password: PasswordInsert, options?: CreateOptions) => Promise<{
5
5
  user_id: string;
6
6
  password: string;
7
7
  algorithm: "bcrypt" | "argon2id";
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { ResourceServer, ResourceServerInsert } from "@authhero/adapter-interfaces";
2
+ import { ResourceServer, ResourceServerInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, params: ResourceServerInsert) => Promise<ResourceServer>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, params: ResourceServerInsert, createOptions?: CreateOptions) => Promise<ResourceServer>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { RolePermissionInsert } from "@authhero/adapter-interfaces";
4
- export declare function assign(db: Kysely<Database>): (tenant_id: string, role_id: string, permissions: RolePermissionInsert[]) => Promise<boolean>;
3
+ import { CreateOptions, RolePermissionInsert } from "@authhero/adapter-interfaces";
4
+ export declare function assign(db: Kysely<Database>): (tenant_id: string, role_id: string, permissions: RolePermissionInsert[], options?: CreateOptions) => Promise<boolean>;
@@ -1,7 +1,7 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
3
  export declare function rolePermissions(db: Kysely<Database>): {
4
- assign: (tenant_id: string, role_id: string, permissions: import("@authhero/adapter-interfaces").RolePermissionInsert[]) => Promise<boolean>;
4
+ assign: (tenant_id: string, role_id: string, permissions: import("@authhero/adapter-interfaces").RolePermissionInsert[], options?: import("@authhero/adapter-interfaces").CreateOptions) => Promise<boolean>;
5
5
  remove: (tenant_id: string, role_id: string, permissions: Pick<import("@authhero/adapter-interfaces").RolePermissionInsert, "resource_server_identifier" | "permission_name">[]) => Promise<boolean>;
6
6
  list: (tenant_id: string, role_id: string, params?: import("@authhero/adapter-interfaces").ListParams) => Promise<{
7
7
  role_id: string;
@@ -1,6 +1,6 @@
1
1
  import { Kysely } from "kysely";
2
- import { Role, RoleInsert } from "@authhero/adapter-interfaces";
2
+ import { Role, RoleInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
4
  export declare function create(db: Kysely<Database>): (tenantId: string, params: RoleInsert & {
5
5
  is_system?: boolean;
6
- }) => Promise<Role>;
6
+ }, options?: CreateOptions) => Promise<Role>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { CreateTenantParams, Tenant } from "@authhero/adapter-interfaces";
2
+ import { CreateTenantParams, Tenant, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (params: CreateTenantParams) => Promise<Tenant>;
4
+ export declare function create(db: Kysely<Database>): (params: CreateTenantParams, options?: CreateOptions) => Promise<Tenant>;
@@ -115,6 +115,7 @@ export declare function list(db: Kysely<Database>): (params?: ListParams) => Pro
115
115
  provisioning_state_changed_at?: string | undefined;
116
116
  bundle_configuration?: string | undefined;
117
117
  worker_version?: string | undefined;
118
+ database_version?: string | undefined;
118
119
  worker_script_name?: string | undefined;
119
120
  storage_kind?: "own_d1" | "existing_d1" | "shared_planetscale" | undefined;
120
121
  d1_database_id?: string | undefined;
@@ -300,6 +301,7 @@ export declare function list(db: Kysely<Database>): (params?: ListParams) => Pro
300
301
  provisioning_state_changed_at?: string | undefined;
301
302
  bundle_configuration?: string | undefined;
302
303
  worker_version?: string | undefined;
304
+ database_version?: string | undefined;
303
305
  worker_script_name?: string | undefined;
304
306
  storage_kind?: "own_d1" | "existing_d1" | "shared_planetscale" | undefined;
305
307
  d1_database_id?: string | undefined;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
- import { Theme, ThemeInsert } from "@authhero/adapter-interfaces";
2
+ import { Theme, ThemeInsert, CreateOptions } from "@authhero/adapter-interfaces";
3
3
  import { Database } from "../db";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, theme: ThemeInsert, themeId?: string) => Promise<Theme>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, theme: ThemeInsert, themeId?: string, options?: CreateOptions) => Promise<Theme>;
@@ -0,0 +1,4 @@
1
+ import { Kysely } from "kysely";
2
+ import { Theme } from "@authhero/adapter-interfaces";
3
+ import { Database } from "../db";
4
+ export declare function list(db: Kysely<Database>): (tenant_id: string) => Promise<Theme[]>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { UniversalLoginTemplate } from "@authhero/adapter-interfaces";
4
- export declare function set(db: Kysely<Database>): (tenant_id: string, template: UniversalLoginTemplate) => Promise<void>;
3
+ import { CreateOptions, UniversalLoginTemplate } from "@authhero/adapter-interfaces";
4
+ export declare function set(db: Kysely<Database>): (tenant_id: string, template: UniversalLoginTemplate, options?: CreateOptions) => Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { UserOrganization, UserOrganizationInsert } from "@authhero/adapter-interfaces";
4
- export declare function create(db: Kysely<Database>): (tenantId: string, userOrganization: UserOrganizationInsert) => Promise<UserOrganization>;
3
+ import { UserOrganization, UserOrganizationInsert, CreateOptions } from "@authhero/adapter-interfaces";
4
+ export declare function create(db: Kysely<Database>): (tenantId: string, userOrganization: UserOrganizationInsert, options?: CreateOptions) => Promise<UserOrganization>;
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { UserPermissionInsert } from "@authhero/adapter-interfaces";
4
- export declare function create(db: Kysely<Database>): (tenant_id: string, user_id: string, permission: UserPermissionInsert, organization_id?: string) => Promise<boolean>;
3
+ import { CreateOptions, UserPermissionInsert } from "@authhero/adapter-interfaces";
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, user_id: string, permission: UserPermissionInsert, organization_id?: string, options?: CreateOptions) => Promise<boolean>;
@@ -1,7 +1,7 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
3
  export declare function userPermissions(db: Kysely<Database>): {
4
- create: (tenant_id: string, user_id: string, permission: import("@authhero/adapter-interfaces").UserPermissionInsert, organization_id?: string) => Promise<boolean>;
4
+ create: (tenant_id: string, user_id: string, permission: import("@authhero/adapter-interfaces").UserPermissionInsert, organization_id?: string, options?: import("@authhero/adapter-interfaces").CreateOptions) => Promise<boolean>;
5
5
  remove: (tenant_id: string, user_id: string, permission: {
6
6
  resource_server_identifier: string;
7
7
  permission_name: string;
@@ -1,3 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
+ import { CreateOptions } from "@authhero/adapter-interfaces";
2
3
  import { Database } from "../db";
3
- export declare function create(db: Kysely<Database>): (tenant_id: string, user_id: string, role_id: string, organization_id?: string) => Promise<boolean>;
4
+ export declare function create(db: Kysely<Database>): (tenant_id: string, user_id: string, role_id: string, organization_id?: string, options?: CreateOptions) => Promise<boolean>;
@@ -2,6 +2,6 @@ import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
3
  export declare function userRoles(db: Kysely<Database>): {
4
4
  list: (tenant_id: string, user_id: string, _params?: import("@authhero/adapter-interfaces").ListParams, organization_id?: string) => Promise<import("@authhero/adapter-interfaces").Role[]>;
5
- create: (tenant_id: string, user_id: string, role_id: string, organization_id?: string) => Promise<boolean>;
5
+ create: (tenant_id: string, user_id: string, role_id: string, organization_id?: string, options?: import("@authhero/adapter-interfaces").CreateOptions) => Promise<boolean>;
6
6
  remove: (tenant_id: string, user_id: string, role_id: string, organization_id?: string) => Promise<boolean>;
7
7
  };
@@ -1,4 +1,4 @@
1
1
  import { Kysely } from "kysely";
2
2
  import { Database } from "../db";
3
- import { User, UserInsert } from "@authhero/adapter-interfaces";
4
- export declare function create(db: Kysely<Database>): (tenantId: string, user: UserInsert) => Promise<User>;
3
+ import { User, UserInsert, CreateOptions } from "@authhero/adapter-interfaces";
4
+ export declare function create(db: Kysely<Database>): (tenantId: string, user: UserInsert, options?: CreateOptions) => Promise<User>;