authhero 4.98.0 → 4.99.1

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.
@@ -2555,7 +2555,7 @@ export declare const userSchema: z.ZodObject<{
2555
2555
  }[] | undefined;
2556
2556
  }>;
2557
2557
  export type User = z.infer<typeof userSchema>;
2558
- export declare const auth0UserResponseSchema: z.ZodObject<{
2558
+ export declare const auth0UserResponseSchema: z.ZodObject<Omit<{
2559
2559
  user_id: z.ZodString;
2560
2560
  provider: z.ZodString;
2561
2561
  is_social: z.ZodBoolean;
@@ -2699,7 +2699,7 @@ export declare const auth0UserResponseSchema: z.ZodObject<{
2699
2699
  last_ip: z.ZodOptional<z.ZodString>;
2700
2700
  last_login: z.ZodOptional<z.ZodString>;
2701
2701
  registration_completed_at: z.ZodOptional<z.ZodString>;
2702
- }, "strip", z.ZodTypeAny, {
2702
+ }, "registration_completed_at">, "strip", z.ZodTypeAny, {
2703
2703
  created_at: string;
2704
2704
  updated_at: string;
2705
2705
  connection: string;
@@ -2740,7 +2740,6 @@ export declare const auth0UserResponseSchema: z.ZodObject<{
2740
2740
  verify_email?: boolean | undefined;
2741
2741
  last_ip?: string | undefined;
2742
2742
  last_login?: string | undefined;
2743
- registration_completed_at?: string | undefined;
2744
2743
  identities?: {
2745
2744
  connection: string;
2746
2745
  user_id: string;
@@ -2805,7 +2804,6 @@ export declare const auth0UserResponseSchema: z.ZodObject<{
2805
2804
  verify_email?: boolean | undefined;
2806
2805
  last_ip?: string | undefined;
2807
2806
  last_login?: string | undefined;
2808
- registration_completed_at?: string | undefined;
2809
2807
  login_count?: number | undefined;
2810
2808
  identities?: {
2811
2809
  connection: string;
@@ -52448,31 +52446,58 @@ export declare function createInMemoryCache(config?: InMemoryCacheConfig): Cache
52448
52446
  * that occasionally lose tail work if the process exits.
52449
52447
  */
52450
52448
  export declare function waitUntil(ctx: Context, promise: Promise<unknown>): void;
52451
- /**
52452
- * Parameters for cleaning up expired sessions for a specific user
52453
- */
52454
52449
  export interface UserSessionCleanupParams {
52455
- tenantId: string;
52450
+ tenantId?: string;
52456
52451
  userId?: string;
52457
52452
  }
52458
52453
  /**
52459
- * Cleanup expired login_sessions, sessions, and refresh_tokens.
52460
- * Can be scoped to a specific user.
52461
- * This is designed to be called with waitUntil after creating a new login session.
52462
- *
52463
- * Usage:
52464
- * ```typescript
52465
- * import { waitUntil } from "./wait-until";
52466
- * import { cleanupUserSessions } from "./user-session-cleanup";
52467
- *
52468
- * // After creating a login session
52469
- * waitUntil(ctx, cleanupUserSessions(ctx, { tenantId, userId }));
52470
- * ```
52454
+ * Context-free session cleanup for use in scheduled handlers / cron jobs.
52455
+ * Deletes expired login_sessions, sessions, and refresh_tokens, optionally
52456
+ * scoped to a tenant and/or user.
52457
+ */
52458
+ export declare function cleanupSessions(data: DataAdapters, params?: UserSessionCleanupParams): Promise<void>;
52459
+ /**
52460
+ * Per-request wrapper around cleanupSessions. Designed to be called with
52461
+ * waitUntil after creating a new login session.
52471
52462
  */
52472
52463
  export declare function cleanupUserSessions(ctx: Context<{
52473
52464
  Bindings: Bindings;
52474
52465
  Variables: Variables;
52475
52466
  }>, params: UserSessionCleanupParams): Promise<void>;
52467
+ /**
52468
+ * Interface for outbox event destinations.
52469
+ * Each destination transforms audit events into its own format and delivers them.
52470
+ *
52471
+ * Destinations may implement `accepts(event)` to filter which events they
52472
+ * handle (e.g. the logs destination only accepts log-shaped events, while a
52473
+ * webhook destination only accepts `hook.*` events). If `accepts` is absent,
52474
+ * the destination receives every event.
52475
+ */
52476
+ export interface EventDestination {
52477
+ name: string;
52478
+ accepts?(event: AuditEvent): boolean;
52479
+ transform(event: AuditEvent): unknown;
52480
+ deliver(events: unknown[]): Promise<void>;
52481
+ }
52482
+ /**
52483
+ * Drain unprocessed events from the outbox and deliver to all destinations.
52484
+ * Intended for cron/scheduled use to sweep up events that failed per-request processing.
52485
+ * Uses claim mechanism for safe multi-worker execution.
52486
+ */
52487
+ export declare function drainOutbox(outbox: OutboxAdapter, destinations: EventDestination[], options?: {
52488
+ batchSize?: number;
52489
+ maxRetries?: number;
52490
+ retentionDays?: number;
52491
+ }): Promise<void>;
52492
+ export interface OutboxCleanupParams {
52493
+ /** Days to keep processed (and dead-lettered) events. Defaults to 7. */
52494
+ retentionDays?: number;
52495
+ }
52496
+ /**
52497
+ * Delete processed outbox events older than the retention window.
52498
+ * Intended for use in a scheduled handler / cron job.
52499
+ */
52500
+ export declare function cleanupOutbox(outbox: OutboxAdapter, params?: OutboxCleanupParams): Promise<number>;
52476
52501
  /**
52477
52502
  * Options for the entity hooks wrapper
52478
52503
  */
@@ -52746,7 +52771,7 @@ export declare class LocalCodeExecutor implements CodeExecutor {
52746
52771
  */
52747
52772
  export interface WorkerLoader {
52748
52773
  load(code: WorkerCode): WorkerStub;
52749
- get(id: string, callback: () => WorkerCode): WorkerStub;
52774
+ get(id: string, callback: () => Promise<WorkerCode>): WorkerStub;
52750
52775
  }
52751
52776
  export interface WorkerCode {
52752
52777
  compatibilityDate: string;
@@ -62126,7 +62151,6 @@ export declare function init(config: AuthHeroConfig): {
62126
62151
  verify_email?: boolean | undefined | undefined;
62127
62152
  last_ip?: string | undefined | undefined;
62128
62153
  last_login?: string | undefined | undefined;
62129
- registration_completed_at?: string | undefined | undefined;
62130
62154
  identities?: {
62131
62155
  connection: string;
62132
62156
  user_id: string;
@@ -62197,7 +62221,6 @@ export declare function init(config: AuthHeroConfig): {
62197
62221
  verify_email?: boolean | undefined | undefined;
62198
62222
  last_ip?: string | undefined | undefined;
62199
62223
  last_login?: string | undefined | undefined;
62200
- registration_completed_at?: string | undefined | undefined;
62201
62224
  identities?: {
62202
62225
  connection: string;
62203
62226
  user_id: string;
@@ -62283,7 +62306,6 @@ export declare function init(config: AuthHeroConfig): {
62283
62306
  verify_email?: boolean | undefined | undefined;
62284
62307
  last_ip?: string | undefined | undefined;
62285
62308
  last_login?: string | undefined | undefined;
62286
- registration_completed_at?: string | undefined | undefined;
62287
62309
  identities?: {
62288
62310
  connection: string;
62289
62311
  user_id: string;
@@ -62422,7 +62444,6 @@ export declare function init(config: AuthHeroConfig): {
62422
62444
  verify_email?: boolean | undefined | undefined;
62423
62445
  last_ip?: string | undefined | undefined;
62424
62446
  last_login?: string | undefined | undefined;
62425
- registration_completed_at?: string | undefined | undefined;
62426
62447
  identities?: {
62427
62448
  connection: string;
62428
62449
  user_id: string;
@@ -62616,7 +62637,6 @@ export declare function init(config: AuthHeroConfig): {
62616
62637
  verify_email?: boolean | undefined | undefined;
62617
62638
  last_ip?: string | undefined | undefined;
62618
62639
  last_login?: string | undefined | undefined;
62619
- registration_completed_at?: string | undefined | undefined;
62620
62640
  identities?: {
62621
62641
  connection: string;
62622
62642
  user_id: string;
@@ -65214,10 +65234,10 @@ export declare function init(config: AuthHeroConfig): {
65214
65234
  locale?: string | undefined;
65215
65235
  profile?: string | undefined;
65216
65236
  address?: {
65237
+ region?: string | undefined;
65217
65238
  formatted?: string | undefined;
65218
65239
  street_address?: string | undefined;
65219
65240
  locality?: string | undefined;
65220
- region?: string | undefined;
65221
65241
  postal_code?: string | undefined;
65222
65242
  country?: string | undefined;
65223
65243
  } | undefined;
@@ -65255,10 +65275,10 @@ export declare function init(config: AuthHeroConfig): {
65255
65275
  locale?: string | undefined;
65256
65276
  profile?: string | undefined;
65257
65277
  address?: {
65278
+ region?: string | undefined;
65258
65279
  formatted?: string | undefined;
65259
65280
  street_address?: string | undefined;
65260
65281
  locality?: string | undefined;
65261
- region?: string | undefined;
65262
65282
  postal_code?: string | undefined;
65263
65283
  country?: string | undefined;
65264
65284
  } | undefined;