@authhero/kysely-adapter 10.38.0 → 10.40.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/kysely-adapter.cjs +1 -1
- package/dist/kysely-adapter.d.ts +96 -6
- package/dist/kysely-adapter.mjs +1130 -908
- package/package.json +3 -3
package/dist/kysely-adapter.d.ts
CHANGED
|
@@ -5782,14 +5782,17 @@ declare const userPermissionInsertSchema: z.ZodObject<{
|
|
|
5782
5782
|
user_id: z.ZodString;
|
|
5783
5783
|
resource_server_identifier: z.ZodString;
|
|
5784
5784
|
permission_name: z.ZodString;
|
|
5785
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
5785
5786
|
}, "strip", z.ZodTypeAny, {
|
|
5786
5787
|
user_id: string;
|
|
5787
5788
|
resource_server_identifier: string;
|
|
5788
5789
|
permission_name: string;
|
|
5790
|
+
organization_id?: string | undefined;
|
|
5789
5791
|
}, {
|
|
5790
5792
|
user_id: string;
|
|
5791
5793
|
resource_server_identifier: string;
|
|
5792
5794
|
permission_name: string;
|
|
5795
|
+
organization_id?: string | undefined;
|
|
5793
5796
|
}>;
|
|
5794
5797
|
export type UserPermissionInsert = z.infer<typeof userPermissionInsertSchema>;
|
|
5795
5798
|
declare const userPermissionWithDetailsListSchema: z.ZodArray<z.ZodObject<{
|
|
@@ -5799,6 +5802,7 @@ declare const userPermissionWithDetailsListSchema: z.ZodArray<z.ZodObject<{
|
|
|
5799
5802
|
permission_name: z.ZodString;
|
|
5800
5803
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5801
5804
|
created_at: z.ZodOptional<z.ZodString>;
|
|
5805
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
5802
5806
|
}, "strip", z.ZodTypeAny, {
|
|
5803
5807
|
user_id: string;
|
|
5804
5808
|
resource_server_identifier: string;
|
|
@@ -5806,6 +5810,7 @@ declare const userPermissionWithDetailsListSchema: z.ZodArray<z.ZodObject<{
|
|
|
5806
5810
|
resource_server_name: string;
|
|
5807
5811
|
description?: string | null | undefined;
|
|
5808
5812
|
created_at?: string | undefined;
|
|
5813
|
+
organization_id?: string | undefined;
|
|
5809
5814
|
}, {
|
|
5810
5815
|
user_id: string;
|
|
5811
5816
|
resource_server_identifier: string;
|
|
@@ -5813,6 +5818,7 @@ declare const userPermissionWithDetailsListSchema: z.ZodArray<z.ZodObject<{
|
|
|
5813
5818
|
resource_server_name: string;
|
|
5814
5819
|
description?: string | null | undefined;
|
|
5815
5820
|
created_at?: string | undefined;
|
|
5821
|
+
organization_id?: string | undefined;
|
|
5816
5822
|
}>, "many">;
|
|
5817
5823
|
export type UserPermissionWithDetailsList = z.infer<typeof userPermissionWithDetailsListSchema>;
|
|
5818
5824
|
declare const roleInsertSchema: z.ZodObject<{
|
|
@@ -6102,6 +6108,37 @@ declare const organizationSchema: z.ZodObject<{
|
|
|
6102
6108
|
} | undefined;
|
|
6103
6109
|
}>;
|
|
6104
6110
|
export type Organization = z.infer<typeof organizationSchema>;
|
|
6111
|
+
declare const userOrganizationInsertSchema: z.ZodObject<{
|
|
6112
|
+
user_id: z.ZodString;
|
|
6113
|
+
organization_id: z.ZodString;
|
|
6114
|
+
}, "strip", z.ZodTypeAny, {
|
|
6115
|
+
user_id: string;
|
|
6116
|
+
organization_id: string;
|
|
6117
|
+
}, {
|
|
6118
|
+
user_id: string;
|
|
6119
|
+
organization_id: string;
|
|
6120
|
+
}>;
|
|
6121
|
+
export type UserOrganizationInsert = z.infer<typeof userOrganizationInsertSchema>;
|
|
6122
|
+
declare const userOrganizationSchema: z.ZodObject<{
|
|
6123
|
+
id: z.ZodString;
|
|
6124
|
+
created_at: z.ZodString;
|
|
6125
|
+
updated_at: z.ZodString;
|
|
6126
|
+
user_id: z.ZodString;
|
|
6127
|
+
organization_id: z.ZodString;
|
|
6128
|
+
}, "strip", z.ZodTypeAny, {
|
|
6129
|
+
created_at: string;
|
|
6130
|
+
updated_at: string;
|
|
6131
|
+
user_id: string;
|
|
6132
|
+
id: string;
|
|
6133
|
+
organization_id: string;
|
|
6134
|
+
}, {
|
|
6135
|
+
created_at: string;
|
|
6136
|
+
updated_at: string;
|
|
6137
|
+
user_id: string;
|
|
6138
|
+
id: string;
|
|
6139
|
+
organization_id: string;
|
|
6140
|
+
}>;
|
|
6141
|
+
export type UserOrganization = z.infer<typeof userOrganizationSchema>;
|
|
6105
6142
|
export interface CacheAdapter {
|
|
6106
6143
|
/**
|
|
6107
6144
|
* Get a value from the cache
|
|
@@ -6298,9 +6335,9 @@ export interface RolePermissionsAdapter {
|
|
|
6298
6335
|
list(tenant_id: string, role_id: string, params?: ListParams): Promise<RolePermissionWithDetailsList>;
|
|
6299
6336
|
}
|
|
6300
6337
|
export interface UserPermissionsAdapter {
|
|
6301
|
-
|
|
6302
|
-
remove(tenant_id: string, user_id: string,
|
|
6303
|
-
list(tenant_id: string, user_id: string, params?: ListParams): Promise<UserPermissionWithDetailsList>;
|
|
6338
|
+
create(tenant_id: string, user_id: string, permission: UserPermissionInsert, organization_id?: string): Promise<boolean>;
|
|
6339
|
+
remove(tenant_id: string, user_id: string, permission: Pick<UserPermissionInsert, "resource_server_identifier" | "permission_name">, organization_id?: string): Promise<boolean>;
|
|
6340
|
+
list(tenant_id: string, user_id: string, params?: ListParams, organization_id?: string): Promise<UserPermissionWithDetailsList>;
|
|
6304
6341
|
}
|
|
6305
6342
|
export interface ListRolesResponse extends Totals {
|
|
6306
6343
|
roles: Role[];
|
|
@@ -6313,9 +6350,9 @@ export interface RolesAdapter {
|
|
|
6313
6350
|
remove(tenantId: string, roleId: string): Promise<boolean>;
|
|
6314
6351
|
}
|
|
6315
6352
|
export interface UserRolesAdapter {
|
|
6316
|
-
list(tenantId: string, userId: string, params?: ListParams): Promise<Role[]>;
|
|
6317
|
-
|
|
6318
|
-
remove(tenantId: string, userId: string,
|
|
6353
|
+
list(tenantId: string, userId: string, params?: ListParams, organizationId?: string): Promise<Role[]>;
|
|
6354
|
+
create(tenantId: string, userId: string, roleId: string, organizationId?: string): Promise<boolean>;
|
|
6355
|
+
remove(tenantId: string, userId: string, roleId: string, organizationId?: string): Promise<boolean>;
|
|
6319
6356
|
}
|
|
6320
6357
|
export interface ListOrganizationsResponse extends Totals {
|
|
6321
6358
|
organizations: Organization[];
|
|
@@ -6327,6 +6364,29 @@ export interface OrganizationsAdapter {
|
|
|
6327
6364
|
list(tenant_id: string, params?: ListParams): Promise<ListOrganizationsResponse>;
|
|
6328
6365
|
update(tenant_id: string, id: string, params: Partial<OrganizationInsert>): Promise<boolean>;
|
|
6329
6366
|
}
|
|
6367
|
+
export interface UserOrganizationsAdapter {
|
|
6368
|
+
create(tenantId: string, params: UserOrganizationInsert): Promise<UserOrganization>;
|
|
6369
|
+
get(tenantId: string, id: string): Promise<UserOrganization | null>;
|
|
6370
|
+
remove(tenantId: string, id: string): Promise<boolean>;
|
|
6371
|
+
/**
|
|
6372
|
+
* List user-organization relationships
|
|
6373
|
+
* @param tenantId - The tenant ID
|
|
6374
|
+
* @param params - List parameters including query options:
|
|
6375
|
+
* - q: "user_id:{userId}" to get organizations for a specific user
|
|
6376
|
+
* - q: "organization_id:{organizationId}" to get members of a specific organization
|
|
6377
|
+
*/
|
|
6378
|
+
list(tenantId: string, params?: ListParams): Promise<{
|
|
6379
|
+
userOrganizations: UserOrganization[];
|
|
6380
|
+
} & Totals>;
|
|
6381
|
+
/**
|
|
6382
|
+
* List organizations for a specific user (Auth0 compatible API)
|
|
6383
|
+
* Returns full organization objects instead of user-organization relationships
|
|
6384
|
+
*/
|
|
6385
|
+
listUserOrganizations(tenantId: string, userId: string, params?: ListParams): Promise<{
|
|
6386
|
+
organizations: Organization[];
|
|
6387
|
+
} & Totals>;
|
|
6388
|
+
update(tenantId: string, id: string, params: Partial<UserOrganizationInsert>): Promise<boolean>;
|
|
6389
|
+
}
|
|
6330
6390
|
export interface DataAdapters {
|
|
6331
6391
|
applications: ApplicationsAdapter;
|
|
6332
6392
|
branding: BrandingAdapter;
|
|
@@ -6354,6 +6414,7 @@ export interface DataAdapters {
|
|
|
6354
6414
|
users: UserDataAdapter;
|
|
6355
6415
|
userRoles: UserRolesAdapter;
|
|
6356
6416
|
organizations: OrganizationsAdapter;
|
|
6417
|
+
userOrganizations: UserOrganizationsAdapter;
|
|
6357
6418
|
}
|
|
6358
6419
|
export interface SqlLog {
|
|
6359
6420
|
id: string;
|
|
@@ -7115,6 +7176,7 @@ declare const sqlUserPermissionSchema: z.ZodObject<{
|
|
|
7115
7176
|
user_id: z.ZodString;
|
|
7116
7177
|
resource_server_identifier: z.ZodString;
|
|
7117
7178
|
permission_name: z.ZodString;
|
|
7179
|
+
organization_id: z.ZodString;
|
|
7118
7180
|
created_at: z.ZodString;
|
|
7119
7181
|
}, "strip", z.ZodTypeAny, {
|
|
7120
7182
|
tenant_id: string;
|
|
@@ -7122,28 +7184,33 @@ declare const sqlUserPermissionSchema: z.ZodObject<{
|
|
|
7122
7184
|
user_id: string;
|
|
7123
7185
|
resource_server_identifier: string;
|
|
7124
7186
|
permission_name: string;
|
|
7187
|
+
organization_id: string;
|
|
7125
7188
|
}, {
|
|
7126
7189
|
tenant_id: string;
|
|
7127
7190
|
created_at: string;
|
|
7128
7191
|
user_id: string;
|
|
7129
7192
|
resource_server_identifier: string;
|
|
7130
7193
|
permission_name: string;
|
|
7194
|
+
organization_id: string;
|
|
7131
7195
|
}>;
|
|
7132
7196
|
declare const sqlUserRoleSchema: z.ZodObject<{
|
|
7133
7197
|
tenant_id: z.ZodString;
|
|
7134
7198
|
user_id: z.ZodString;
|
|
7135
7199
|
role_id: z.ZodString;
|
|
7200
|
+
organization_id: z.ZodString;
|
|
7136
7201
|
created_at: z.ZodString;
|
|
7137
7202
|
}, "strip", z.ZodTypeAny, {
|
|
7138
7203
|
tenant_id: string;
|
|
7139
7204
|
created_at: string;
|
|
7140
7205
|
user_id: string;
|
|
7141
7206
|
role_id: string;
|
|
7207
|
+
organization_id: string;
|
|
7142
7208
|
}, {
|
|
7143
7209
|
tenant_id: string;
|
|
7144
7210
|
created_at: string;
|
|
7145
7211
|
user_id: string;
|
|
7146
7212
|
role_id: string;
|
|
7213
|
+
organization_id: string;
|
|
7147
7214
|
}>;
|
|
7148
7215
|
declare const sqlOrganizationSchema: z.ZodObject<{
|
|
7149
7216
|
tenant_id: z.ZodString;
|
|
@@ -7179,6 +7246,28 @@ declare const sqlOrganizationSchema: z.ZodObject<{
|
|
|
7179
7246
|
token_quota?: string | undefined;
|
|
7180
7247
|
display_name?: string | undefined;
|
|
7181
7248
|
}>;
|
|
7249
|
+
declare const sqlUserOrganizationSchema: z.ZodObject<{
|
|
7250
|
+
id: z.ZodString;
|
|
7251
|
+
tenant_id: z.ZodString;
|
|
7252
|
+
user_id: z.ZodString;
|
|
7253
|
+
organization_id: z.ZodString;
|
|
7254
|
+
created_at: z.ZodString;
|
|
7255
|
+
updated_at: z.ZodString;
|
|
7256
|
+
}, "strip", z.ZodTypeAny, {
|
|
7257
|
+
tenant_id: string;
|
|
7258
|
+
id: string;
|
|
7259
|
+
created_at: string;
|
|
7260
|
+
updated_at: string;
|
|
7261
|
+
user_id: string;
|
|
7262
|
+
organization_id: string;
|
|
7263
|
+
}, {
|
|
7264
|
+
tenant_id: string;
|
|
7265
|
+
id: string;
|
|
7266
|
+
created_at: string;
|
|
7267
|
+
updated_at: string;
|
|
7268
|
+
user_id: string;
|
|
7269
|
+
organization_id: string;
|
|
7270
|
+
}>;
|
|
7182
7271
|
export interface Database {
|
|
7183
7272
|
applications: z.infer<typeof sqlApplicationSchema>;
|
|
7184
7273
|
branding: z.infer<typeof sqlBrandingSchema>;
|
|
@@ -7210,6 +7299,7 @@ export interface Database {
|
|
|
7210
7299
|
user_roles: z.infer<typeof sqlUserRoleSchema>;
|
|
7211
7300
|
roles: z.infer<typeof sqlRoleSchema>;
|
|
7212
7301
|
organizations: z.infer<typeof sqlOrganizationSchema>;
|
|
7302
|
+
user_organizations: z.infer<typeof sqlUserOrganizationSchema>;
|
|
7213
7303
|
}
|
|
7214
7304
|
export declare function migrateToLatest(db: Kysely<Database>, debug?: boolean): Promise<void>;
|
|
7215
7305
|
export declare function migrateDown(db: Kysely<Database>): Promise<void>;
|