authhero 4.97.0 → 4.99.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.
@@ -103,6 +103,84 @@ export declare const actionInsertSchema: z.ZodObject<{
103
103
  }[] | undefined;
104
104
  }>;
105
105
  export type ActionInsert = z.infer<typeof actionInsertSchema>;
106
+ export declare const actionUpdateSchema: z.ZodObject<{
107
+ name: z.ZodOptional<z.ZodString>;
108
+ code: z.ZodOptional<z.ZodString>;
109
+ supported_triggers: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
110
+ id: z.ZodString;
111
+ version: z.ZodOptional<z.ZodString>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ id: string;
114
+ version?: string | undefined;
115
+ }, {
116
+ id: string;
117
+ version?: string | undefined;
118
+ }>, "many">>>;
119
+ runtime: z.ZodOptional<z.ZodOptional<z.ZodString>>;
120
+ dependencies: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
121
+ name: z.ZodString;
122
+ version: z.ZodString;
123
+ }, "strip", z.ZodTypeAny, {
124
+ version: string;
125
+ name: string;
126
+ }, {
127
+ version: string;
128
+ name: string;
129
+ }>, "many">>>;
130
+ secrets: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
131
+ name: z.ZodString;
132
+ value: z.ZodString;
133
+ }, "strip", z.ZodTypeAny, {
134
+ value: string;
135
+ name: string;
136
+ }, {
137
+ value: string;
138
+ name: string;
139
+ }>, "many">>>;
140
+ } & {
141
+ status: z.ZodOptional<z.ZodEnum<[
142
+ "draft",
143
+ "built"
144
+ ]>>;
145
+ deployed_at: z.ZodOptional<z.ZodString>;
146
+ }, "strip", z.ZodTypeAny, {
147
+ code?: string | undefined;
148
+ status?: "draft" | "built" | undefined;
149
+ name?: string | undefined;
150
+ supported_triggers?: {
151
+ id: string;
152
+ version?: string | undefined;
153
+ }[] | undefined;
154
+ runtime?: string | undefined;
155
+ dependencies?: {
156
+ version: string;
157
+ name: string;
158
+ }[] | undefined;
159
+ secrets?: {
160
+ value: string;
161
+ name: string;
162
+ }[] | undefined;
163
+ deployed_at?: string | undefined;
164
+ }, {
165
+ code?: string | undefined;
166
+ status?: "draft" | "built" | undefined;
167
+ name?: string | undefined;
168
+ supported_triggers?: {
169
+ id: string;
170
+ version?: string | undefined;
171
+ }[] | undefined;
172
+ runtime?: string | undefined;
173
+ dependencies?: {
174
+ version: string;
175
+ name: string;
176
+ }[] | undefined;
177
+ secrets?: {
178
+ value: string;
179
+ name: string;
180
+ }[] | undefined;
181
+ deployed_at?: string | undefined;
182
+ }>;
183
+ export type ActionUpdate = z.infer<typeof actionUpdateSchema>;
106
184
  export declare const actionSchema: z.ZodObject<{
107
185
  name: z.ZodString;
108
186
  code: z.ZodString;
@@ -2477,7 +2555,7 @@ export declare const userSchema: z.ZodObject<{
2477
2555
  }[] | undefined;
2478
2556
  }>;
2479
2557
  export type User = z.infer<typeof userSchema>;
2480
- export declare const auth0UserResponseSchema: z.ZodObject<{
2558
+ export declare const auth0UserResponseSchema: z.ZodObject<Omit<{
2481
2559
  user_id: z.ZodString;
2482
2560
  provider: z.ZodString;
2483
2561
  is_social: z.ZodBoolean;
@@ -2621,7 +2699,7 @@ export declare const auth0UserResponseSchema: z.ZodObject<{
2621
2699
  last_ip: z.ZodOptional<z.ZodString>;
2622
2700
  last_login: z.ZodOptional<z.ZodString>;
2623
2701
  registration_completed_at: z.ZodOptional<z.ZodString>;
2624
- }, "strip", z.ZodTypeAny, {
2702
+ }, "registration_completed_at">, "strip", z.ZodTypeAny, {
2625
2703
  created_at: string;
2626
2704
  updated_at: string;
2627
2705
  connection: string;
@@ -2662,7 +2740,6 @@ export declare const auth0UserResponseSchema: z.ZodObject<{
2662
2740
  verify_email?: boolean | undefined;
2663
2741
  last_ip?: string | undefined;
2664
2742
  last_login?: string | undefined;
2665
- registration_completed_at?: string | undefined;
2666
2743
  identities?: {
2667
2744
  connection: string;
2668
2745
  user_id: string;
@@ -2727,7 +2804,6 @@ export declare const auth0UserResponseSchema: z.ZodObject<{
2727
2804
  verify_email?: boolean | undefined;
2728
2805
  last_ip?: string | undefined;
2729
2806
  last_login?: string | undefined;
2730
- registration_completed_at?: string | undefined;
2731
2807
  login_count?: number | undefined;
2732
2808
  identities?: {
2733
2809
  connection: string;
@@ -48610,7 +48686,7 @@ export interface ListActionsResponse extends Totals {
48610
48686
  export interface ActionsAdapter {
48611
48687
  create: (tenant_id: string, action: ActionInsert) => Promise<Action>;
48612
48688
  get: (tenant_id: string, action_id: string) => Promise<Action | null>;
48613
- update: (tenant_id: string, action_id: string, action: Partial<ActionInsert>) => Promise<boolean>;
48689
+ update: (tenant_id: string, action_id: string, action: ActionUpdate) => Promise<boolean>;
48614
48690
  remove: (tenant_id: string, action_id: string) => Promise<boolean>;
48615
48691
  list: (tenant_id: string, params?: ListParams) => Promise<ListActionsResponse>;
48616
48692
  }
@@ -52370,31 +52446,58 @@ export declare function createInMemoryCache(config?: InMemoryCacheConfig): Cache
52370
52446
  * that occasionally lose tail work if the process exits.
52371
52447
  */
52372
52448
  export declare function waitUntil(ctx: Context, promise: Promise<unknown>): void;
52373
- /**
52374
- * Parameters for cleaning up expired sessions for a specific user
52375
- */
52376
52449
  export interface UserSessionCleanupParams {
52377
- tenantId: string;
52450
+ tenantId?: string;
52378
52451
  userId?: string;
52379
52452
  }
52380
52453
  /**
52381
- * Cleanup expired login_sessions, sessions, and refresh_tokens.
52382
- * Can be scoped to a specific user.
52383
- * This is designed to be called with waitUntil after creating a new login session.
52384
- *
52385
- * Usage:
52386
- * ```typescript
52387
- * import { waitUntil } from "./wait-until";
52388
- * import { cleanupUserSessions } from "./user-session-cleanup";
52389
- *
52390
- * // After creating a login session
52391
- * waitUntil(ctx, cleanupUserSessions(ctx, { tenantId, userId }));
52392
- * ```
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.
52393
52462
  */
52394
52463
  export declare function cleanupUserSessions(ctx: Context<{
52395
52464
  Bindings: Bindings;
52396
52465
  Variables: Variables;
52397
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>;
52398
52501
  /**
52399
52502
  * Options for the entity hooks wrapper
52400
52503
  */
@@ -52660,6 +52763,53 @@ export declare class LocalCodeExecutor implements CodeExecutor {
52660
52763
  timeoutMs?: number;
52661
52764
  }): Promise<CodeExecutionResult>;
52662
52765
  }
52766
+ /**
52767
+ * Worker Loader binding type (Cloudflare Dynamic Workers).
52768
+ * Configure in wrangler.toml:
52769
+ * [[worker_loaders]]
52770
+ * binding = "LOADER"
52771
+ */
52772
+ export interface WorkerLoader {
52773
+ load(code: WorkerCode): WorkerStub;
52774
+ get(id: string, callback: () => Promise<WorkerCode>): WorkerStub;
52775
+ }
52776
+ export interface WorkerCode {
52777
+ compatibilityDate: string;
52778
+ mainModule: string;
52779
+ modules: Record<string, string>;
52780
+ globalOutbound?: null;
52781
+ }
52782
+ export interface WorkerStub {
52783
+ getEntrypoint(): {
52784
+ fetch(request: Request): Promise<Response>;
52785
+ };
52786
+ }
52787
+ export interface CloudflareCodeExecutorOptions {
52788
+ loader: WorkerLoader;
52789
+ compatibilityDate?: string;
52790
+ }
52791
+ /**
52792
+ * Cloudflare Dynamic Workers code executor.
52793
+ * Spins up isolated Workers on demand via the Worker Loader binding
52794
+ * to execute user-authored hook code in a sandboxed environment.
52795
+ *
52796
+ * Uses `env.LOADER.get(id, callback)` to cache workers by hookCodeId + code hash,
52797
+ * so the same code stays warm across requests while code updates get a fresh worker.
52798
+ * Network access is blocked via `globalOutbound: null`.
52799
+ */
52800
+ export declare class CloudflareCodeExecutor implements CodeExecutor {
52801
+ private loader;
52802
+ private compatibilityDate;
52803
+ constructor(options: CloudflareCodeExecutorOptions);
52804
+ execute(params: {
52805
+ code: string;
52806
+ hookCodeId?: string;
52807
+ triggerId: string;
52808
+ event: Record<string, unknown>;
52809
+ timeoutMs?: number;
52810
+ cpuLimitMs?: number;
52811
+ }): Promise<CodeExecutionResult>;
52812
+ }
52663
52813
  export declare function init(config: AuthHeroConfig): {
52664
52814
  app: OpenAPIHono<{
52665
52815
  Bindings: Bindings;
@@ -62001,7 +62151,6 @@ export declare function init(config: AuthHeroConfig): {
62001
62151
  verify_email?: boolean | undefined | undefined;
62002
62152
  last_ip?: string | undefined | undefined;
62003
62153
  last_login?: string | undefined | undefined;
62004
- registration_completed_at?: string | undefined | undefined;
62005
62154
  identities?: {
62006
62155
  connection: string;
62007
62156
  user_id: string;
@@ -62072,7 +62221,6 @@ export declare function init(config: AuthHeroConfig): {
62072
62221
  verify_email?: boolean | undefined | undefined;
62073
62222
  last_ip?: string | undefined | undefined;
62074
62223
  last_login?: string | undefined | undefined;
62075
- registration_completed_at?: string | undefined | undefined;
62076
62224
  identities?: {
62077
62225
  connection: string;
62078
62226
  user_id: string;
@@ -62158,7 +62306,6 @@ export declare function init(config: AuthHeroConfig): {
62158
62306
  verify_email?: boolean | undefined | undefined;
62159
62307
  last_ip?: string | undefined | undefined;
62160
62308
  last_login?: string | undefined | undefined;
62161
- registration_completed_at?: string | undefined | undefined;
62162
62309
  identities?: {
62163
62310
  connection: string;
62164
62311
  user_id: string;
@@ -62297,7 +62444,6 @@ export declare function init(config: AuthHeroConfig): {
62297
62444
  verify_email?: boolean | undefined | undefined;
62298
62445
  last_ip?: string | undefined | undefined;
62299
62446
  last_login?: string | undefined | undefined;
62300
- registration_completed_at?: string | undefined | undefined;
62301
62447
  identities?: {
62302
62448
  connection: string;
62303
62449
  user_id: string;
@@ -62491,7 +62637,6 @@ export declare function init(config: AuthHeroConfig): {
62491
62637
  verify_email?: boolean | undefined | undefined;
62492
62638
  last_ip?: string | undefined | undefined;
62493
62639
  last_login?: string | undefined | undefined;
62494
- registration_completed_at?: string | undefined | undefined;
62495
62640
  identities?: {
62496
62641
  connection: string;
62497
62642
  user_id: string;
@@ -65089,10 +65234,10 @@ export declare function init(config: AuthHeroConfig): {
65089
65234
  locale?: string | undefined;
65090
65235
  profile?: string | undefined;
65091
65236
  address?: {
65237
+ region?: string | undefined;
65092
65238
  formatted?: string | undefined;
65093
65239
  street_address?: string | undefined;
65094
65240
  locality?: string | undefined;
65095
- region?: string | undefined;
65096
65241
  postal_code?: string | undefined;
65097
65242
  country?: string | undefined;
65098
65243
  } | undefined;
@@ -65130,10 +65275,10 @@ export declare function init(config: AuthHeroConfig): {
65130
65275
  locale?: string | undefined;
65131
65276
  profile?: string | undefined;
65132
65277
  address?: {
65278
+ region?: string | undefined;
65133
65279
  formatted?: string | undefined;
65134
65280
  street_address?: string | undefined;
65135
65281
  locality?: string | undefined;
65136
- region?: string | undefined;
65137
65282
  postal_code?: string | undefined;
65138
65283
  country?: string | undefined;
65139
65284
  } | undefined;