@authhero/kysely-adapter 10.37.1 → 10.39.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.
@@ -5846,6 +5846,293 @@ declare const roleSchema: z.ZodObject<{
5846
5846
  }>;
5847
5847
  export type Role = z.infer<typeof roleSchema>;
5848
5848
  export type RoleInsert = z.infer<typeof roleInsertSchema>;
5849
+ declare const organizationInsertSchema: z.ZodObject<{
5850
+ id: z.ZodOptional<z.ZodString>;
5851
+ name: z.ZodString;
5852
+ display_name: z.ZodOptional<z.ZodString>;
5853
+ branding: z.ZodOptional<z.ZodObject<{
5854
+ logo_url: z.ZodOptional<z.ZodString>;
5855
+ colors: z.ZodOptional<z.ZodObject<{
5856
+ primary: z.ZodOptional<z.ZodString>;
5857
+ page_background: z.ZodOptional<z.ZodString>;
5858
+ }, "strip", z.ZodTypeAny, {
5859
+ primary?: string | undefined;
5860
+ page_background?: string | undefined;
5861
+ }, {
5862
+ primary?: string | undefined;
5863
+ page_background?: string | undefined;
5864
+ }>>;
5865
+ }, "strip", z.ZodTypeAny, {
5866
+ colors?: {
5867
+ primary?: string | undefined;
5868
+ page_background?: string | undefined;
5869
+ } | undefined;
5870
+ logo_url?: string | undefined;
5871
+ }, {
5872
+ colors?: {
5873
+ primary?: string | undefined;
5874
+ page_background?: string | undefined;
5875
+ } | undefined;
5876
+ logo_url?: string | undefined;
5877
+ }>>;
5878
+ metadata: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>>;
5879
+ enabled_connections: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
5880
+ connection_id: z.ZodString;
5881
+ assign_membership_on_login: z.ZodDefault<z.ZodBoolean>;
5882
+ show_as_button: z.ZodDefault<z.ZodBoolean>;
5883
+ is_signup_enabled: z.ZodDefault<z.ZodBoolean>;
5884
+ }, "strip", z.ZodTypeAny, {
5885
+ connection_id: string;
5886
+ assign_membership_on_login: boolean;
5887
+ show_as_button: boolean;
5888
+ is_signup_enabled: boolean;
5889
+ }, {
5890
+ connection_id: string;
5891
+ assign_membership_on_login?: boolean | undefined;
5892
+ show_as_button?: boolean | undefined;
5893
+ is_signup_enabled?: boolean | undefined;
5894
+ }>, "many">>>;
5895
+ token_quota: z.ZodOptional<z.ZodObject<{
5896
+ client_credentials: z.ZodOptional<z.ZodObject<{
5897
+ enforce: z.ZodDefault<z.ZodBoolean>;
5898
+ per_day: z.ZodDefault<z.ZodNumber>;
5899
+ per_hour: z.ZodDefault<z.ZodNumber>;
5900
+ }, "strip", z.ZodTypeAny, {
5901
+ enforce: boolean;
5902
+ per_day: number;
5903
+ per_hour: number;
5904
+ }, {
5905
+ enforce?: boolean | undefined;
5906
+ per_day?: number | undefined;
5907
+ per_hour?: number | undefined;
5908
+ }>>;
5909
+ }, "strip", z.ZodTypeAny, {
5910
+ client_credentials?: {
5911
+ enforce: boolean;
5912
+ per_day: number;
5913
+ per_hour: number;
5914
+ } | undefined;
5915
+ }, {
5916
+ client_credentials?: {
5917
+ enforce?: boolean | undefined;
5918
+ per_day?: number | undefined;
5919
+ per_hour?: number | undefined;
5920
+ } | undefined;
5921
+ }>>;
5922
+ }, "strip", z.ZodTypeAny, {
5923
+ name: string;
5924
+ id?: string | undefined;
5925
+ display_name?: string | undefined;
5926
+ branding?: {
5927
+ colors?: {
5928
+ primary?: string | undefined;
5929
+ page_background?: string | undefined;
5930
+ } | undefined;
5931
+ logo_url?: string | undefined;
5932
+ } | undefined;
5933
+ metadata?: Record<string, any> | undefined;
5934
+ enabled_connections?: {
5935
+ connection_id: string;
5936
+ assign_membership_on_login: boolean;
5937
+ show_as_button: boolean;
5938
+ is_signup_enabled: boolean;
5939
+ }[] | undefined;
5940
+ token_quota?: {
5941
+ client_credentials?: {
5942
+ enforce: boolean;
5943
+ per_day: number;
5944
+ per_hour: number;
5945
+ } | undefined;
5946
+ } | undefined;
5947
+ }, {
5948
+ name: string;
5949
+ id?: string | undefined;
5950
+ display_name?: string | undefined;
5951
+ branding?: {
5952
+ colors?: {
5953
+ primary?: string | undefined;
5954
+ page_background?: string | undefined;
5955
+ } | undefined;
5956
+ logo_url?: string | undefined;
5957
+ } | undefined;
5958
+ metadata?: Record<string, any> | undefined;
5959
+ enabled_connections?: {
5960
+ connection_id: string;
5961
+ assign_membership_on_login?: boolean | undefined;
5962
+ show_as_button?: boolean | undefined;
5963
+ is_signup_enabled?: boolean | undefined;
5964
+ }[] | undefined;
5965
+ token_quota?: {
5966
+ client_credentials?: {
5967
+ enforce?: boolean | undefined;
5968
+ per_day?: number | undefined;
5969
+ per_hour?: number | undefined;
5970
+ } | undefined;
5971
+ } | undefined;
5972
+ }>;
5973
+ export type OrganizationInsert = z.infer<typeof organizationInsertSchema>;
5974
+ declare const organizationSchema: z.ZodObject<{
5975
+ id: z.ZodString;
5976
+ created_at: z.ZodString;
5977
+ updated_at: z.ZodString;
5978
+ name: z.ZodString;
5979
+ display_name: z.ZodOptional<z.ZodString>;
5980
+ branding: z.ZodOptional<z.ZodObject<{
5981
+ logo_url: z.ZodOptional<z.ZodString>;
5982
+ colors: z.ZodOptional<z.ZodObject<{
5983
+ primary: z.ZodOptional<z.ZodString>;
5984
+ page_background: z.ZodOptional<z.ZodString>;
5985
+ }, "strip", z.ZodTypeAny, {
5986
+ primary?: string | undefined;
5987
+ page_background?: string | undefined;
5988
+ }, {
5989
+ primary?: string | undefined;
5990
+ page_background?: string | undefined;
5991
+ }>>;
5992
+ }, "strip", z.ZodTypeAny, {
5993
+ colors?: {
5994
+ primary?: string | undefined;
5995
+ page_background?: string | undefined;
5996
+ } | undefined;
5997
+ logo_url?: string | undefined;
5998
+ }, {
5999
+ colors?: {
6000
+ primary?: string | undefined;
6001
+ page_background?: string | undefined;
6002
+ } | undefined;
6003
+ logo_url?: string | undefined;
6004
+ }>>;
6005
+ metadata: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>>;
6006
+ enabled_connections: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
6007
+ connection_id: z.ZodString;
6008
+ assign_membership_on_login: z.ZodDefault<z.ZodBoolean>;
6009
+ show_as_button: z.ZodDefault<z.ZodBoolean>;
6010
+ is_signup_enabled: z.ZodDefault<z.ZodBoolean>;
6011
+ }, "strip", z.ZodTypeAny, {
6012
+ connection_id: string;
6013
+ assign_membership_on_login: boolean;
6014
+ show_as_button: boolean;
6015
+ is_signup_enabled: boolean;
6016
+ }, {
6017
+ connection_id: string;
6018
+ assign_membership_on_login?: boolean | undefined;
6019
+ show_as_button?: boolean | undefined;
6020
+ is_signup_enabled?: boolean | undefined;
6021
+ }>, "many">>>;
6022
+ token_quota: z.ZodOptional<z.ZodObject<{
6023
+ client_credentials: z.ZodOptional<z.ZodObject<{
6024
+ enforce: z.ZodDefault<z.ZodBoolean>;
6025
+ per_day: z.ZodDefault<z.ZodNumber>;
6026
+ per_hour: z.ZodDefault<z.ZodNumber>;
6027
+ }, "strip", z.ZodTypeAny, {
6028
+ enforce: boolean;
6029
+ per_day: number;
6030
+ per_hour: number;
6031
+ }, {
6032
+ enforce?: boolean | undefined;
6033
+ per_day?: number | undefined;
6034
+ per_hour?: number | undefined;
6035
+ }>>;
6036
+ }, "strip", z.ZodTypeAny, {
6037
+ client_credentials?: {
6038
+ enforce: boolean;
6039
+ per_day: number;
6040
+ per_hour: number;
6041
+ } | undefined;
6042
+ }, {
6043
+ client_credentials?: {
6044
+ enforce?: boolean | undefined;
6045
+ per_day?: number | undefined;
6046
+ per_hour?: number | undefined;
6047
+ } | undefined;
6048
+ }>>;
6049
+ }, "strip", z.ZodTypeAny, {
6050
+ created_at: string;
6051
+ updated_at: string;
6052
+ name: string;
6053
+ id: string;
6054
+ display_name?: string | undefined;
6055
+ branding?: {
6056
+ colors?: {
6057
+ primary?: string | undefined;
6058
+ page_background?: string | undefined;
6059
+ } | undefined;
6060
+ logo_url?: string | undefined;
6061
+ } | undefined;
6062
+ metadata?: Record<string, any> | undefined;
6063
+ enabled_connections?: {
6064
+ connection_id: string;
6065
+ assign_membership_on_login: boolean;
6066
+ show_as_button: boolean;
6067
+ is_signup_enabled: boolean;
6068
+ }[] | undefined;
6069
+ token_quota?: {
6070
+ client_credentials?: {
6071
+ enforce: boolean;
6072
+ per_day: number;
6073
+ per_hour: number;
6074
+ } | undefined;
6075
+ } | undefined;
6076
+ }, {
6077
+ created_at: string;
6078
+ updated_at: string;
6079
+ name: string;
6080
+ id: string;
6081
+ display_name?: string | undefined;
6082
+ branding?: {
6083
+ colors?: {
6084
+ primary?: string | undefined;
6085
+ page_background?: string | undefined;
6086
+ } | undefined;
6087
+ logo_url?: string | undefined;
6088
+ } | undefined;
6089
+ metadata?: Record<string, any> | undefined;
6090
+ enabled_connections?: {
6091
+ connection_id: string;
6092
+ assign_membership_on_login?: boolean | undefined;
6093
+ show_as_button?: boolean | undefined;
6094
+ is_signup_enabled?: boolean | undefined;
6095
+ }[] | undefined;
6096
+ token_quota?: {
6097
+ client_credentials?: {
6098
+ enforce?: boolean | undefined;
6099
+ per_day?: number | undefined;
6100
+ per_hour?: number | undefined;
6101
+ } | undefined;
6102
+ } | undefined;
6103
+ }>;
6104
+ export type Organization = z.infer<typeof organizationSchema>;
6105
+ declare const userOrganizationInsertSchema: z.ZodObject<{
6106
+ user_id: z.ZodString;
6107
+ organization_id: z.ZodString;
6108
+ }, "strip", z.ZodTypeAny, {
6109
+ user_id: string;
6110
+ organization_id: string;
6111
+ }, {
6112
+ user_id: string;
6113
+ organization_id: string;
6114
+ }>;
6115
+ export type UserOrganizationInsert = z.infer<typeof userOrganizationInsertSchema>;
6116
+ declare const userOrganizationSchema: z.ZodObject<{
6117
+ id: z.ZodString;
6118
+ created_at: z.ZodString;
6119
+ updated_at: z.ZodString;
6120
+ user_id: z.ZodString;
6121
+ organization_id: z.ZodString;
6122
+ }, "strip", z.ZodTypeAny, {
6123
+ created_at: string;
6124
+ updated_at: string;
6125
+ user_id: string;
6126
+ id: string;
6127
+ organization_id: string;
6128
+ }, {
6129
+ created_at: string;
6130
+ updated_at: string;
6131
+ user_id: string;
6132
+ id: string;
6133
+ organization_id: string;
6134
+ }>;
6135
+ export type UserOrganization = z.infer<typeof userOrganizationSchema>;
5849
6136
  export interface CacheAdapter {
5850
6137
  /**
5851
6138
  * Get a value from the cache
@@ -6061,6 +6348,32 @@ export interface UserRolesAdapter {
6061
6348
  assign(tenantId: string, userId: string, roles: string[]): Promise<boolean>;
6062
6349
  remove(tenantId: string, userId: string, roles: string[]): Promise<boolean>;
6063
6350
  }
6351
+ export interface ListOrganizationsResponse extends Totals {
6352
+ organizations: Organization[];
6353
+ }
6354
+ export interface OrganizationsAdapter {
6355
+ create(tenant_id: string, params: OrganizationInsert): Promise<Organization>;
6356
+ get(tenant_id: string, id: string): Promise<Organization | null>;
6357
+ remove(tenant_id: string, id: string): Promise<boolean>;
6358
+ list(tenant_id: string, params?: ListParams): Promise<ListOrganizationsResponse>;
6359
+ update(tenant_id: string, id: string, params: Partial<OrganizationInsert>): Promise<boolean>;
6360
+ }
6361
+ export interface UserOrganizationsAdapter {
6362
+ create(tenantId: string, params: UserOrganizationInsert): Promise<UserOrganization>;
6363
+ get(tenantId: string, id: string): Promise<UserOrganization | null>;
6364
+ remove(tenantId: string, id: string): Promise<boolean>;
6365
+ /**
6366
+ * List user-organization relationships
6367
+ * @param tenantId - The tenant ID
6368
+ * @param params - List parameters including query options:
6369
+ * - q: "user_id:{userId}" to get organizations for a specific user
6370
+ * - q: "organization_id:{organizationId}" to get members of a specific organization
6371
+ */
6372
+ list(tenantId: string, params?: ListParams): Promise<{
6373
+ userOrganizations: UserOrganization[];
6374
+ } & Totals>;
6375
+ update(tenantId: string, id: string, params: Partial<UserOrganizationInsert>): Promise<boolean>;
6376
+ }
6064
6377
  export interface DataAdapters {
6065
6378
  applications: ApplicationsAdapter;
6066
6379
  branding: BrandingAdapter;
@@ -6087,6 +6400,8 @@ export interface DataAdapters {
6087
6400
  themes: ThemesAdapter;
6088
6401
  users: UserDataAdapter;
6089
6402
  userRoles: UserRolesAdapter;
6403
+ organizations: OrganizationsAdapter;
6404
+ userOrganizations: UserOrganizationsAdapter;
6090
6405
  }
6091
6406
  export interface SqlLog {
6092
6407
  id: string;
@@ -6878,6 +7193,62 @@ declare const sqlUserRoleSchema: z.ZodObject<{
6878
7193
  user_id: string;
6879
7194
  role_id: string;
6880
7195
  }>;
7196
+ declare const sqlOrganizationSchema: z.ZodObject<{
7197
+ tenant_id: z.ZodString;
7198
+ branding: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7199
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7200
+ enabled_connections: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7201
+ token_quota: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7202
+ created_at: z.ZodString;
7203
+ updated_at: z.ZodString;
7204
+ id: z.ZodString;
7205
+ name: z.ZodString;
7206
+ display_name: z.ZodOptional<z.ZodString>;
7207
+ }, "strip", z.ZodTypeAny, {
7208
+ tenant_id: string;
7209
+ id: string;
7210
+ name: string;
7211
+ created_at: string;
7212
+ updated_at: string;
7213
+ branding: string;
7214
+ metadata: string;
7215
+ enabled_connections: string;
7216
+ token_quota: string;
7217
+ display_name?: string | undefined;
7218
+ }, {
7219
+ tenant_id: string;
7220
+ id: string;
7221
+ name: string;
7222
+ created_at: string;
7223
+ updated_at: string;
7224
+ branding?: string | undefined;
7225
+ metadata?: string | undefined;
7226
+ enabled_connections?: string | undefined;
7227
+ token_quota?: string | undefined;
7228
+ display_name?: string | undefined;
7229
+ }>;
7230
+ declare const sqlUserOrganizationSchema: z.ZodObject<{
7231
+ id: z.ZodString;
7232
+ tenant_id: z.ZodString;
7233
+ user_id: z.ZodString;
7234
+ organization_id: z.ZodString;
7235
+ created_at: z.ZodString;
7236
+ updated_at: z.ZodString;
7237
+ }, "strip", z.ZodTypeAny, {
7238
+ tenant_id: string;
7239
+ id: string;
7240
+ created_at: string;
7241
+ updated_at: string;
7242
+ user_id: string;
7243
+ organization_id: string;
7244
+ }, {
7245
+ tenant_id: string;
7246
+ id: string;
7247
+ created_at: string;
7248
+ updated_at: string;
7249
+ user_id: string;
7250
+ organization_id: string;
7251
+ }>;
6881
7252
  export interface Database {
6882
7253
  applications: z.infer<typeof sqlApplicationSchema>;
6883
7254
  branding: z.infer<typeof sqlBrandingSchema>;
@@ -6908,6 +7279,8 @@ export interface Database {
6908
7279
  user_permissions: z.infer<typeof sqlUserPermissionSchema>;
6909
7280
  user_roles: z.infer<typeof sqlUserRoleSchema>;
6910
7281
  roles: z.infer<typeof sqlRoleSchema>;
7282
+ organizations: z.infer<typeof sqlOrganizationSchema>;
7283
+ user_organizations: z.infer<typeof sqlUserOrganizationSchema>;
6911
7284
  }
6912
7285
  export declare function migrateToLatest(db: Kysely<Database>, debug?: boolean): Promise<void>;
6913
7286
  export declare function migrateDown(db: Kysely<Database>): Promise<void>;