authhero 3.4.0 → 3.6.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/authhero.cjs +47 -47
- package/dist/authhero.d.ts +26 -9
- package/dist/authhero.mjs +6132 -6072
- package/dist/stats.html +1 -1
- package/package.json +5 -5
package/dist/authhero.d.ts
CHANGED
|
@@ -36585,9 +36585,9 @@ export declare const organizationInsertSchema: z.ZodObject<{
|
|
|
36585
36585
|
export type OrganizationInsert = z.infer<typeof organizationInsertSchema>;
|
|
36586
36586
|
export declare const organizationSchema: z.ZodObject<{
|
|
36587
36587
|
id: z.ZodString;
|
|
36588
|
+
name: z.ZodString;
|
|
36588
36589
|
created_at: z.ZodString;
|
|
36589
36590
|
updated_at: z.ZodString;
|
|
36590
|
-
name: z.ZodString;
|
|
36591
36591
|
display_name: z.ZodOptional<z.ZodString>;
|
|
36592
36592
|
branding: z.ZodOptional<z.ZodObject<{
|
|
36593
36593
|
logo_url: z.ZodOptional<z.ZodString>;
|
|
@@ -37802,13 +37802,17 @@ export type OnFetchUserInfo = (event: UserInfoEvent, api: OnFetchUserInfoAPI) =>
|
|
|
37802
37802
|
*
|
|
37803
37803
|
* Use these to implement cross-tenant synchronization, audit logging,
|
|
37804
37804
|
* webhooks, or any other side effects when entities are created/updated/deleted.
|
|
37805
|
+
*
|
|
37806
|
+
* Each hook type is an array of hooks that will be chained together.
|
|
37807
|
+
* Arrays may contain undefined elements which will be filtered out.
|
|
37808
|
+
* When chaining, "before" hooks pass their return values to the next hook in the chain.
|
|
37805
37809
|
*/
|
|
37806
37810
|
export interface EntityHooksConfig {
|
|
37807
|
-
resourceServers?: EntityHooks<ResourceServer, ResourceServerInsert
|
|
37808
|
-
roles?: EntityHooks<Role, RoleInsert
|
|
37809
|
-
rolePermissions?: RolePermissionHooks;
|
|
37810
|
-
connections?: EntityHooks<Connection, ConnectionInsert
|
|
37811
|
-
tenants?: EntityHooks<Tenant, CreateTenantParams
|
|
37811
|
+
resourceServers?: (EntityHooks<ResourceServer, ResourceServerInsert> | undefined)[];
|
|
37812
|
+
roles?: (EntityHooks<Role, RoleInsert> | undefined)[];
|
|
37813
|
+
rolePermissions?: (RolePermissionHooks | undefined)[];
|
|
37814
|
+
connections?: (EntityHooks<Connection, ConnectionInsert> | undefined)[];
|
|
37815
|
+
tenants?: (EntityHooks<Tenant, CreateTenantParams> | undefined)[];
|
|
37812
37816
|
}
|
|
37813
37817
|
/**
|
|
37814
37818
|
* Route extension for the management API.
|
|
@@ -38359,16 +38363,29 @@ export interface EntityHooksWrapperOptions {
|
|
|
38359
38363
|
* Adds entity hooks to data adapters.
|
|
38360
38364
|
* This wraps each entity adapter's CRUD methods to call the configured hooks.
|
|
38361
38365
|
*
|
|
38362
|
-
*
|
|
38366
|
+
* Hooks must be provided as arrays. Multiple hooks are chained together with
|
|
38367
|
+
* proper return value handling for "before" hooks.
|
|
38368
|
+
*
|
|
38369
|
+
* @example Single hook
|
|
38363
38370
|
* ```typescript
|
|
38364
38371
|
* const wrappedData = addEntityHooks(data, {
|
|
38365
38372
|
* tenantId: ctx.var.tenant_id,
|
|
38366
38373
|
* entityHooks: {
|
|
38367
|
-
* roles: {
|
|
38374
|
+
* roles: [{
|
|
38368
38375
|
* afterCreate: async (ctx, role) => {
|
|
38369
38376
|
* await syncToChildTenants(ctx, role);
|
|
38370
38377
|
* },
|
|
38371
|
-
* },
|
|
38378
|
+
* }],
|
|
38379
|
+
* },
|
|
38380
|
+
* });
|
|
38381
|
+
* ```
|
|
38382
|
+
*
|
|
38383
|
+
* @example Chaining multiple hooks
|
|
38384
|
+
* ```typescript
|
|
38385
|
+
* const wrappedData = addEntityHooks(data, {
|
|
38386
|
+
* tenantId: ctx.var.tenant_id,
|
|
38387
|
+
* entityHooks: {
|
|
38388
|
+
* roles: [syncHooks, auditHooks], // Called in order
|
|
38372
38389
|
* },
|
|
38373
38390
|
* });
|
|
38374
38391
|
* ```
|