@authhero/kysely-adapter 10.37.0 → 10.38.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,287 @@ 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
+ export interface CacheAdapter {
6106
+ /**
6107
+ * Get a value from the cache
6108
+ * @param key The cache key
6109
+ * @returns The cached value or null if not found or expired
6110
+ */
6111
+ get<T = any>(key: string): Promise<T | null>;
6112
+ /**
6113
+ * Set a value in the cache
6114
+ * @param key The cache key
6115
+ * @param value The value to cache
6116
+ * @param ttlSeconds Time to live in seconds (optional)
6117
+ */
6118
+ set<T = any>(key: string, value: T, ttlSeconds?: number): Promise<void>;
6119
+ /**
6120
+ * Delete a value from the cache
6121
+ * @param key The cache key
6122
+ * @returns True if the key existed and was deleted, false otherwise
6123
+ */
6124
+ delete(key: string): Promise<boolean>;
6125
+ /**
6126
+ * Clear all items from the cache
6127
+ */
6128
+ clear(): Promise<void>;
6129
+ }
5849
6130
  export interface ListCodesResponse extends Totals {
5850
6131
  codes: Code[];
5851
6132
  }
@@ -6036,9 +6317,20 @@ export interface UserRolesAdapter {
6036
6317
  assign(tenantId: string, userId: string, roles: string[]): Promise<boolean>;
6037
6318
  remove(tenantId: string, userId: string, roles: string[]): Promise<boolean>;
6038
6319
  }
6320
+ export interface ListOrganizationsResponse extends Totals {
6321
+ organizations: Organization[];
6322
+ }
6323
+ export interface OrganizationsAdapter {
6324
+ create(tenant_id: string, params: OrganizationInsert): Promise<Organization>;
6325
+ get(tenant_id: string, id: string): Promise<Organization | null>;
6326
+ remove(tenant_id: string, id: string): Promise<boolean>;
6327
+ list(tenant_id: string, params?: ListParams): Promise<ListOrganizationsResponse>;
6328
+ update(tenant_id: string, id: string, params: Partial<OrganizationInsert>): Promise<boolean>;
6329
+ }
6039
6330
  export interface DataAdapters {
6040
6331
  applications: ApplicationsAdapter;
6041
6332
  branding: BrandingAdapter;
6333
+ cache?: CacheAdapter;
6042
6334
  clients: ClientsAdapter;
6043
6335
  codes: CodesAdapter;
6044
6336
  connections: ConnectionsAdapter;
@@ -6061,6 +6353,7 @@ export interface DataAdapters {
6061
6353
  themes: ThemesAdapter;
6062
6354
  users: UserDataAdapter;
6063
6355
  userRoles: UserRolesAdapter;
6356
+ organizations: OrganizationsAdapter;
6064
6357
  }
6065
6358
  export interface SqlLog {
6066
6359
  id: string;
@@ -6852,6 +7145,40 @@ declare const sqlUserRoleSchema: z.ZodObject<{
6852
7145
  user_id: string;
6853
7146
  role_id: string;
6854
7147
  }>;
7148
+ declare const sqlOrganizationSchema: z.ZodObject<{
7149
+ tenant_id: z.ZodString;
7150
+ branding: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7151
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7152
+ enabled_connections: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7153
+ token_quota: z.ZodDefault<z.ZodOptional<z.ZodString>>;
7154
+ created_at: z.ZodString;
7155
+ updated_at: z.ZodString;
7156
+ id: z.ZodString;
7157
+ name: z.ZodString;
7158
+ display_name: z.ZodOptional<z.ZodString>;
7159
+ }, "strip", z.ZodTypeAny, {
7160
+ tenant_id: string;
7161
+ id: string;
7162
+ name: string;
7163
+ created_at: string;
7164
+ updated_at: string;
7165
+ branding: string;
7166
+ metadata: string;
7167
+ enabled_connections: string;
7168
+ token_quota: string;
7169
+ display_name?: string | undefined;
7170
+ }, {
7171
+ tenant_id: string;
7172
+ id: string;
7173
+ name: string;
7174
+ created_at: string;
7175
+ updated_at: string;
7176
+ branding?: string | undefined;
7177
+ metadata?: string | undefined;
7178
+ enabled_connections?: string | undefined;
7179
+ token_quota?: string | undefined;
7180
+ display_name?: string | undefined;
7181
+ }>;
6855
7182
  export interface Database {
6856
7183
  applications: z.infer<typeof sqlApplicationSchema>;
6857
7184
  branding: z.infer<typeof sqlBrandingSchema>;
@@ -6882,6 +7209,7 @@ export interface Database {
6882
7209
  user_permissions: z.infer<typeof sqlUserPermissionSchema>;
6883
7210
  user_roles: z.infer<typeof sqlUserRoleSchema>;
6884
7211
  roles: z.infer<typeof sqlRoleSchema>;
7212
+ organizations: z.infer<typeof sqlOrganizationSchema>;
6885
7213
  }
6886
7214
  export declare function migrateToLatest(db: Kysely<Database>, debug?: boolean): Promise<void>;
6887
7215
  export declare function migrateDown(db: Kysely<Database>): Promise<void>;