@authhero/kysely-adapter 10.38.0 → 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.
@@ -6102,6 +6102,37 @@ declare const organizationSchema: z.ZodObject<{
6102
6102
  } | undefined;
6103
6103
  }>;
6104
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>;
6105
6136
  export interface CacheAdapter {
6106
6137
  /**
6107
6138
  * Get a value from the cache
@@ -6327,6 +6358,22 @@ export interface OrganizationsAdapter {
6327
6358
  list(tenant_id: string, params?: ListParams): Promise<ListOrganizationsResponse>;
6328
6359
  update(tenant_id: string, id: string, params: Partial<OrganizationInsert>): Promise<boolean>;
6329
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
+ }
6330
6377
  export interface DataAdapters {
6331
6378
  applications: ApplicationsAdapter;
6332
6379
  branding: BrandingAdapter;
@@ -6354,6 +6401,7 @@ export interface DataAdapters {
6354
6401
  users: UserDataAdapter;
6355
6402
  userRoles: UserRolesAdapter;
6356
6403
  organizations: OrganizationsAdapter;
6404
+ userOrganizations: UserOrganizationsAdapter;
6357
6405
  }
6358
6406
  export interface SqlLog {
6359
6407
  id: string;
@@ -7179,6 +7227,28 @@ declare const sqlOrganizationSchema: z.ZodObject<{
7179
7227
  token_quota?: string | undefined;
7180
7228
  display_name?: string | undefined;
7181
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
+ }>;
7182
7252
  export interface Database {
7183
7253
  applications: z.infer<typeof sqlApplicationSchema>;
7184
7254
  branding: z.infer<typeof sqlBrandingSchema>;
@@ -7210,6 +7280,7 @@ export interface Database {
7210
7280
  user_roles: z.infer<typeof sqlUserRoleSchema>;
7211
7281
  roles: z.infer<typeof sqlRoleSchema>;
7212
7282
  organizations: z.infer<typeof sqlOrganizationSchema>;
7283
+ user_organizations: z.infer<typeof sqlUserOrganizationSchema>;
7213
7284
  }
7214
7285
  export declare function migrateToLatest(db: Kysely<Database>, debug?: boolean): Promise<void>;
7215
7286
  export declare function migrateDown(db: Kysely<Database>): Promise<void>;