@trigger.dev/redis-worker 4.5.0-rc.3 → 4.5.0-rc.4

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/index.d.cts CHANGED
@@ -2147,6 +2147,10 @@ declare const BufferEntrySchema: z.ZodObject<{
2147
2147
  status: z.ZodEnum<["QUEUED", "DRAINING", "FAILED"]>;
2148
2148
  attempts: z.ZodEffects<z.ZodString, number, string>;
2149
2149
  createdAt: z.ZodEffects<z.ZodString, Date, string>;
2150
+ createdAtMicros: z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>;
2151
+ materialised: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<"true">, z.ZodLiteral<"false">]>, boolean, "true" | "false">>;
2152
+ idempotencyLookupKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2153
+ metadataVersion: z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>;
2150
2154
  lastError: z.ZodOptional<z.ZodEffects<z.ZodString, {
2151
2155
  message: string;
2152
2156
  code: string;
@@ -2159,6 +2163,10 @@ declare const BufferEntrySchema: z.ZodObject<{
2159
2163
  envId: string;
2160
2164
  orgId: string;
2161
2165
  attempts: number;
2166
+ createdAtMicros: number;
2167
+ materialised: boolean;
2168
+ idempotencyLookupKey: string;
2169
+ metadataVersion: number;
2162
2170
  lastError?: {
2163
2171
  message: string;
2164
2172
  code: string;
@@ -2171,6 +2179,10 @@ declare const BufferEntrySchema: z.ZodObject<{
2171
2179
  envId: string;
2172
2180
  orgId: string;
2173
2181
  attempts: string;
2182
+ createdAtMicros?: string | undefined;
2183
+ materialised?: "true" | "false" | undefined;
2184
+ idempotencyLookupKey?: string | undefined;
2185
+ metadataVersion?: string | undefined;
2174
2186
  lastError?: string | undefined;
2175
2187
  }>;
2176
2188
  type BufferEntry = z.infer<typeof BufferEntrySchema>;
@@ -2179,13 +2191,62 @@ declare function deserialiseSnapshot<T = unknown>(serialised: string): T;
2179
2191
 
2180
2192
  type MollifierBufferOptions = {
2181
2193
  redisOptions: RedisOptions;
2182
- entryTtlSeconds: number;
2183
2194
  logger?: Logger;
2184
2195
  };
2196
+ type SnapshotPatch = {
2197
+ type: "append_tags";
2198
+ tags: string[];
2199
+ maxTags?: number;
2200
+ } | {
2201
+ type: "set_metadata";
2202
+ metadata: string;
2203
+ metadataType: string;
2204
+ } | {
2205
+ type: "set_delay";
2206
+ delayUntil: string;
2207
+ } | {
2208
+ type: "mark_cancelled";
2209
+ cancelledAt: string;
2210
+ cancelReason?: string;
2211
+ };
2212
+ type MutateSnapshotResult = "applied_to_snapshot" | "not_found" | "busy" | "limit_exceeded";
2213
+ type CasSetMetadataResult = {
2214
+ kind: "applied";
2215
+ newVersion: number;
2216
+ } | {
2217
+ kind: "version_conflict";
2218
+ currentVersion: number;
2219
+ } | {
2220
+ kind: "not_found";
2221
+ } | {
2222
+ kind: "busy";
2223
+ };
2224
+ type AcceptResult = {
2225
+ kind: "accepted";
2226
+ } | {
2227
+ kind: "duplicate_run_id";
2228
+ } | {
2229
+ kind: "duplicate_idempotency";
2230
+ existingRunId: string;
2231
+ };
2232
+ type IdempotencyLookupInput = {
2233
+ envId: string;
2234
+ taskIdentifier: string;
2235
+ idempotencyKey: string;
2236
+ };
2237
+ declare function idempotencyLookupKeyFor(input: IdempotencyLookupInput): string;
2238
+ declare function makeIdempotencyClaimKey(input: IdempotencyLookupInput): string;
2239
+ type IdempotencyClaimResult = {
2240
+ kind: "claimed";
2241
+ } | {
2242
+ kind: "pending";
2243
+ } | {
2244
+ kind: "resolved";
2245
+ runId: string;
2246
+ };
2185
2247
  declare class MollifierBuffer {
2186
2248
  #private;
2187
2249
  private readonly redis;
2188
- private readonly entryTtlSeconds;
2189
2250
  private readonly logger;
2190
2251
  constructor(options: MollifierBufferOptions);
2191
2252
  accept(input: {
@@ -2193,11 +2254,38 @@ declare class MollifierBuffer {
2193
2254
  envId: string;
2194
2255
  orgId: string;
2195
2256
  payload: string;
2196
- }): Promise<boolean>;
2257
+ idempotencyKey?: string;
2258
+ taskIdentifier?: string;
2259
+ }): Promise<AcceptResult>;
2197
2260
  pop(envId: string): Promise<BufferEntry | null>;
2198
2261
  getEntry(runId: string): Promise<BufferEntry | null>;
2199
2262
  listOrgs(): Promise<string[]>;
2200
2263
  listEnvsForOrg(orgId: string): Promise<string[]>;
2264
+ listEntriesForEnv(envId: string, maxCount: number): Promise<BufferEntry[]>;
2265
+ mutateSnapshot(runId: string, patch: SnapshotPatch): Promise<MutateSnapshotResult>;
2266
+ casSetMetadata(input: {
2267
+ runId: string;
2268
+ expectedVersion: number;
2269
+ newMetadata: string;
2270
+ newMetadataType: string;
2271
+ }): Promise<CasSetMetadataResult>;
2272
+ claimIdempotency(input: IdempotencyLookupInput & {
2273
+ token: string;
2274
+ ttlSeconds: number;
2275
+ }): Promise<IdempotencyClaimResult>;
2276
+ publishClaim(input: IdempotencyLookupInput & {
2277
+ token: string;
2278
+ runId: string;
2279
+ ttlSeconds: number;
2280
+ }): Promise<boolean>;
2281
+ releaseClaim(input: IdempotencyLookupInput & {
2282
+ token: string;
2283
+ }): Promise<void>;
2284
+ readClaim(input: IdempotencyLookupInput): Promise<IdempotencyClaimResult | null>;
2285
+ lookupIdempotency(input: IdempotencyLookupInput): Promise<string | null>;
2286
+ resetIdempotency(input: IdempotencyLookupInput): Promise<{
2287
+ clearedRunId: string | null;
2288
+ }>;
2201
2289
  ack(runId: string): Promise<void>;
2202
2290
  requeue(runId: string): Promise<void>;
2203
2291
  fail(runId: string, error: {
@@ -2217,10 +2305,18 @@ declare class MollifierBuffer {
2217
2305
  }
2218
2306
  declare module "@internal/redis" {
2219
2307
  interface RedisCommander<Context> {
2220
- acceptMollifierEntry(entryKey: string, queueKey: string, orgsKey: string, runId: string, envId: string, orgId: string, payload: string, createdAt: string, ttlSeconds: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2308
+ acceptMollifierEntry(entryKey: string, queueKey: string, orgsKey: string, runId: string, envId: string, orgId: string, payload: string, createdAt: string, createdAtMicros: string, orgEnvsPrefix: string, idempotencyLookupKey: string, entryPrefix: string, callback?: Callback<number | string>): Result<number | string, Context>;
2221
2309
  popAndMarkDraining(queueKey: string, orgsKey: string, entryPrefix: string, envId: string, orgEnvsPrefix: string, callback?: Callback<string | null>): Result<string | null, Context>;
2222
2310
  requeueMollifierEntry(entryKey: string, orgsKey: string, queuePrefix: string, runId: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2311
+ mutateMollifierSnapshot(entryKey: string, patchJson: string, callback?: Callback<string>): Result<string, Context>;
2312
+ casSetMollifierMetadata(entryKey: string, expectedVersion: string, newMetadata: string, newMetadataType: string, callback?: Callback<string>): Result<string, Context>;
2313
+ resetMollifierIdempotency(lookupKey: string, entryPrefix: string, claimKey: string, callback?: Callback<string>): Result<string, Context>;
2314
+ claimMollifierIdempotency(claimKey: string, pendingMarker: string, pendingPrefix: string, ttlSeconds: string, callback?: Callback<string>): Result<string, Context>;
2315
+ publishMollifierClaim(claimKey: string, ownerMarker: string, runId: string, ttlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2316
+ releaseMollifierClaim(claimKey: string, ownerMarker: string, callback?: Callback<number>): Result<number, Context>;
2317
+ ackMollifierEntry(entryKey: string, graceTtlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2223
2318
  failMollifierEntry(entryKey: string, errorPayload: string, callback?: Callback<number>): Result<number, Context>;
2319
+ delMollifierKeyIfEquals(key: string, expected: string, callback?: Callback<number>): Result<number, Context>;
2224
2320
  mollifierEvaluateTrip(rateKey: string, trippedKey: string, windowMs: string, threshold: string, holdMs: string, callback?: Callback<[number, number]>): Result<[number, number], Context>;
2225
2321
  }
2226
2322
  }
@@ -2233,9 +2329,24 @@ type MollifierDrainerHandler<TPayload> = (input: {
2233
2329
  attempts: number;
2234
2330
  createdAt: Date;
2235
2331
  }) => Promise<void>;
2332
+ type MollifierDrainerTerminalFailureCause = "non-retryable" | "max-attempts-exhausted";
2333
+ type MollifierDrainerTerminalFailureHandler<TPayload> = (input: {
2334
+ runId: string;
2335
+ envId: string;
2336
+ orgId: string;
2337
+ payload: TPayload;
2338
+ attempts: number;
2339
+ createdAt: Date;
2340
+ error: {
2341
+ code: string;
2342
+ message: string;
2343
+ };
2344
+ cause: MollifierDrainerTerminalFailureCause;
2345
+ }) => Promise<void>;
2236
2346
  type MollifierDrainerOptions<TPayload> = {
2237
2347
  buffer: MollifierBuffer;
2238
2348
  handler: MollifierDrainerHandler<TPayload>;
2349
+ onTerminalFailure?: MollifierDrainerTerminalFailureHandler<TPayload>;
2239
2350
  concurrency: number;
2240
2351
  maxAttempts: number;
2241
2352
  isRetryable: (err: unknown) => boolean;
@@ -2250,6 +2361,7 @@ type DrainResult = {
2250
2361
  declare class MollifierDrainer<TPayload = unknown> {
2251
2362
  private readonly buffer;
2252
2363
  private readonly handler;
2364
+ private readonly onTerminalFailure?;
2253
2365
  private readonly maxAttempts;
2254
2366
  private readonly isRetryable;
2255
2367
  private readonly pollIntervalMs;
@@ -2276,4 +2388,4 @@ declare class MollifierDrainer<TPayload = unknown> {
2276
2388
  private processEntry;
2277
2389
  }
2278
2390
 
2279
- export { type AnyMessageCatalog, type AnyQueueItem, BaseScheduler, type BatchConfig, BatchedSpanManager, type BatchedSpanManagerOptions, type BufferEntry, BufferEntryError, BufferEntrySchema, BufferEntryStatus, CallbackFairQueueKeyProducer, type ClaimResult, type ConcurrencyCheckResult, type ConcurrencyGroupConfig, ConcurrencyManager, type ConcurrencyManagerOptions, type ConcurrencyState, type ConsumerLoopState, type CooloffOptions, CronSchema, CustomRetry, DRRScheduler, type DRRSchedulerConfig, type DeadLetterMessage, DefaultFairQueueKeyProducer, type DispatchSchedulerContext, type DrainResult, type EnqueueBatchOptions, type EnqueueOptions, ExponentialBackoffRetry, FairQueue, FairQueueAttributes, type FairQueueKeyProducer, type FairQueueMetrics, type FairQueueOptions, FairQueueTelemetry, type FairScheduler, FixedDelayRetry, type GlobalRateLimiter, ImmediateRetry, type InFlightMessage, type JobHandler, type JobHandlerParams, LinearBackoffRetry, MasterQueue, type MasterQueueOptions, type MessageCatalogKey, type MessageCatalogSchema, type MessageCatalogValue, type MessageHandler, type MessageHandlerContext, MessagingAttributes, MollifierBuffer, type MollifierBufferOptions, MollifierDrainer, type MollifierDrainerHandler, type MollifierDrainerOptions, NoRetry, NoopScheduler, type QueueCooloffState, type QueueDescriptor, type QueueItem, type QueueMessage, type QueueWithScore, type ReclaimedMessageInfo, type RetryOptions, type RetryStrategy, RoundRobinScheduler, type SchedulerContext, SimpleQueue, type StoredMessage, type TelemetryOptions, TenantDispatch, type TenantDispatchOptions, type TenantQueues, type TenantWithScore, VisibilityManager, type VisibilityManagerOptions, WeightedScheduler, type WeightedSchedulerBiases, type WeightedSchedulerConfig, Worker, type WorkerCatalog, type WorkerConcurrencyOptions, WorkerQueueManager, type WorkerQueueManagerOptions, type WorkerQueueOptions, createDefaultRetryStrategy, defaultRetryOptions, deserialiseSnapshot, isAbortError, noopTelemetry, serialiseSnapshot };
2391
+ export { type AcceptResult, type AnyMessageCatalog, type AnyQueueItem, BaseScheduler, type BatchConfig, BatchedSpanManager, type BatchedSpanManagerOptions, type BufferEntry, BufferEntryError, BufferEntrySchema, BufferEntryStatus, CallbackFairQueueKeyProducer, type CasSetMetadataResult, type ClaimResult, type ConcurrencyCheckResult, type ConcurrencyGroupConfig, ConcurrencyManager, type ConcurrencyManagerOptions, type ConcurrencyState, type ConsumerLoopState, type CooloffOptions, CronSchema, CustomRetry, DRRScheduler, type DRRSchedulerConfig, type DeadLetterMessage, DefaultFairQueueKeyProducer, type DispatchSchedulerContext, type DrainResult, type EnqueueBatchOptions, type EnqueueOptions, ExponentialBackoffRetry, FairQueue, FairQueueAttributes, type FairQueueKeyProducer, type FairQueueMetrics, type FairQueueOptions, FairQueueTelemetry, type FairScheduler, FixedDelayRetry, type GlobalRateLimiter, type IdempotencyClaimResult, type IdempotencyLookupInput, ImmediateRetry, type InFlightMessage, type JobHandler, type JobHandlerParams, LinearBackoffRetry, MasterQueue, type MasterQueueOptions, type MessageCatalogKey, type MessageCatalogSchema, type MessageCatalogValue, type MessageHandler, type MessageHandlerContext, MessagingAttributes, MollifierBuffer, type MollifierBufferOptions, MollifierDrainer, type MollifierDrainerHandler, type MollifierDrainerOptions, type MollifierDrainerTerminalFailureCause, type MollifierDrainerTerminalFailureHandler, type MutateSnapshotResult, NoRetry, NoopScheduler, type QueueCooloffState, type QueueDescriptor, type QueueItem, type QueueMessage, type QueueWithScore, type ReclaimedMessageInfo, type RetryOptions, type RetryStrategy, RoundRobinScheduler, type SchedulerContext, SimpleQueue, type SnapshotPatch, type StoredMessage, type TelemetryOptions, TenantDispatch, type TenantDispatchOptions, type TenantQueues, type TenantWithScore, VisibilityManager, type VisibilityManagerOptions, WeightedScheduler, type WeightedSchedulerBiases, type WeightedSchedulerConfig, Worker, type WorkerCatalog, type WorkerConcurrencyOptions, WorkerQueueManager, type WorkerQueueManagerOptions, type WorkerQueueOptions, createDefaultRetryStrategy, defaultRetryOptions, deserialiseSnapshot, idempotencyLookupKeyFor, isAbortError, makeIdempotencyClaimKey, noopTelemetry, serialiseSnapshot };
package/dist/index.d.ts CHANGED
@@ -2147,6 +2147,10 @@ declare const BufferEntrySchema: z.ZodObject<{
2147
2147
  status: z.ZodEnum<["QUEUED", "DRAINING", "FAILED"]>;
2148
2148
  attempts: z.ZodEffects<z.ZodString, number, string>;
2149
2149
  createdAt: z.ZodEffects<z.ZodString, Date, string>;
2150
+ createdAtMicros: z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>;
2151
+ materialised: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<"true">, z.ZodLiteral<"false">]>, boolean, "true" | "false">>;
2152
+ idempotencyLookupKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2153
+ metadataVersion: z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>;
2150
2154
  lastError: z.ZodOptional<z.ZodEffects<z.ZodString, {
2151
2155
  message: string;
2152
2156
  code: string;
@@ -2159,6 +2163,10 @@ declare const BufferEntrySchema: z.ZodObject<{
2159
2163
  envId: string;
2160
2164
  orgId: string;
2161
2165
  attempts: number;
2166
+ createdAtMicros: number;
2167
+ materialised: boolean;
2168
+ idempotencyLookupKey: string;
2169
+ metadataVersion: number;
2162
2170
  lastError?: {
2163
2171
  message: string;
2164
2172
  code: string;
@@ -2171,6 +2179,10 @@ declare const BufferEntrySchema: z.ZodObject<{
2171
2179
  envId: string;
2172
2180
  orgId: string;
2173
2181
  attempts: string;
2182
+ createdAtMicros?: string | undefined;
2183
+ materialised?: "true" | "false" | undefined;
2184
+ idempotencyLookupKey?: string | undefined;
2185
+ metadataVersion?: string | undefined;
2174
2186
  lastError?: string | undefined;
2175
2187
  }>;
2176
2188
  type BufferEntry = z.infer<typeof BufferEntrySchema>;
@@ -2179,13 +2191,62 @@ declare function deserialiseSnapshot<T = unknown>(serialised: string): T;
2179
2191
 
2180
2192
  type MollifierBufferOptions = {
2181
2193
  redisOptions: RedisOptions;
2182
- entryTtlSeconds: number;
2183
2194
  logger?: Logger;
2184
2195
  };
2196
+ type SnapshotPatch = {
2197
+ type: "append_tags";
2198
+ tags: string[];
2199
+ maxTags?: number;
2200
+ } | {
2201
+ type: "set_metadata";
2202
+ metadata: string;
2203
+ metadataType: string;
2204
+ } | {
2205
+ type: "set_delay";
2206
+ delayUntil: string;
2207
+ } | {
2208
+ type: "mark_cancelled";
2209
+ cancelledAt: string;
2210
+ cancelReason?: string;
2211
+ };
2212
+ type MutateSnapshotResult = "applied_to_snapshot" | "not_found" | "busy" | "limit_exceeded";
2213
+ type CasSetMetadataResult = {
2214
+ kind: "applied";
2215
+ newVersion: number;
2216
+ } | {
2217
+ kind: "version_conflict";
2218
+ currentVersion: number;
2219
+ } | {
2220
+ kind: "not_found";
2221
+ } | {
2222
+ kind: "busy";
2223
+ };
2224
+ type AcceptResult = {
2225
+ kind: "accepted";
2226
+ } | {
2227
+ kind: "duplicate_run_id";
2228
+ } | {
2229
+ kind: "duplicate_idempotency";
2230
+ existingRunId: string;
2231
+ };
2232
+ type IdempotencyLookupInput = {
2233
+ envId: string;
2234
+ taskIdentifier: string;
2235
+ idempotencyKey: string;
2236
+ };
2237
+ declare function idempotencyLookupKeyFor(input: IdempotencyLookupInput): string;
2238
+ declare function makeIdempotencyClaimKey(input: IdempotencyLookupInput): string;
2239
+ type IdempotencyClaimResult = {
2240
+ kind: "claimed";
2241
+ } | {
2242
+ kind: "pending";
2243
+ } | {
2244
+ kind: "resolved";
2245
+ runId: string;
2246
+ };
2185
2247
  declare class MollifierBuffer {
2186
2248
  #private;
2187
2249
  private readonly redis;
2188
- private readonly entryTtlSeconds;
2189
2250
  private readonly logger;
2190
2251
  constructor(options: MollifierBufferOptions);
2191
2252
  accept(input: {
@@ -2193,11 +2254,38 @@ declare class MollifierBuffer {
2193
2254
  envId: string;
2194
2255
  orgId: string;
2195
2256
  payload: string;
2196
- }): Promise<boolean>;
2257
+ idempotencyKey?: string;
2258
+ taskIdentifier?: string;
2259
+ }): Promise<AcceptResult>;
2197
2260
  pop(envId: string): Promise<BufferEntry | null>;
2198
2261
  getEntry(runId: string): Promise<BufferEntry | null>;
2199
2262
  listOrgs(): Promise<string[]>;
2200
2263
  listEnvsForOrg(orgId: string): Promise<string[]>;
2264
+ listEntriesForEnv(envId: string, maxCount: number): Promise<BufferEntry[]>;
2265
+ mutateSnapshot(runId: string, patch: SnapshotPatch): Promise<MutateSnapshotResult>;
2266
+ casSetMetadata(input: {
2267
+ runId: string;
2268
+ expectedVersion: number;
2269
+ newMetadata: string;
2270
+ newMetadataType: string;
2271
+ }): Promise<CasSetMetadataResult>;
2272
+ claimIdempotency(input: IdempotencyLookupInput & {
2273
+ token: string;
2274
+ ttlSeconds: number;
2275
+ }): Promise<IdempotencyClaimResult>;
2276
+ publishClaim(input: IdempotencyLookupInput & {
2277
+ token: string;
2278
+ runId: string;
2279
+ ttlSeconds: number;
2280
+ }): Promise<boolean>;
2281
+ releaseClaim(input: IdempotencyLookupInput & {
2282
+ token: string;
2283
+ }): Promise<void>;
2284
+ readClaim(input: IdempotencyLookupInput): Promise<IdempotencyClaimResult | null>;
2285
+ lookupIdempotency(input: IdempotencyLookupInput): Promise<string | null>;
2286
+ resetIdempotency(input: IdempotencyLookupInput): Promise<{
2287
+ clearedRunId: string | null;
2288
+ }>;
2201
2289
  ack(runId: string): Promise<void>;
2202
2290
  requeue(runId: string): Promise<void>;
2203
2291
  fail(runId: string, error: {
@@ -2217,10 +2305,18 @@ declare class MollifierBuffer {
2217
2305
  }
2218
2306
  declare module "@internal/redis" {
2219
2307
  interface RedisCommander<Context> {
2220
- acceptMollifierEntry(entryKey: string, queueKey: string, orgsKey: string, runId: string, envId: string, orgId: string, payload: string, createdAt: string, ttlSeconds: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2308
+ acceptMollifierEntry(entryKey: string, queueKey: string, orgsKey: string, runId: string, envId: string, orgId: string, payload: string, createdAt: string, createdAtMicros: string, orgEnvsPrefix: string, idempotencyLookupKey: string, entryPrefix: string, callback?: Callback<number | string>): Result<number | string, Context>;
2221
2309
  popAndMarkDraining(queueKey: string, orgsKey: string, entryPrefix: string, envId: string, orgEnvsPrefix: string, callback?: Callback<string | null>): Result<string | null, Context>;
2222
2310
  requeueMollifierEntry(entryKey: string, orgsKey: string, queuePrefix: string, runId: string, orgEnvsPrefix: string, callback?: Callback<number>): Result<number, Context>;
2311
+ mutateMollifierSnapshot(entryKey: string, patchJson: string, callback?: Callback<string>): Result<string, Context>;
2312
+ casSetMollifierMetadata(entryKey: string, expectedVersion: string, newMetadata: string, newMetadataType: string, callback?: Callback<string>): Result<string, Context>;
2313
+ resetMollifierIdempotency(lookupKey: string, entryPrefix: string, claimKey: string, callback?: Callback<string>): Result<string, Context>;
2314
+ claimMollifierIdempotency(claimKey: string, pendingMarker: string, pendingPrefix: string, ttlSeconds: string, callback?: Callback<string>): Result<string, Context>;
2315
+ publishMollifierClaim(claimKey: string, ownerMarker: string, runId: string, ttlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2316
+ releaseMollifierClaim(claimKey: string, ownerMarker: string, callback?: Callback<number>): Result<number, Context>;
2317
+ ackMollifierEntry(entryKey: string, graceTtlSeconds: string, callback?: Callback<number>): Result<number, Context>;
2223
2318
  failMollifierEntry(entryKey: string, errorPayload: string, callback?: Callback<number>): Result<number, Context>;
2319
+ delMollifierKeyIfEquals(key: string, expected: string, callback?: Callback<number>): Result<number, Context>;
2224
2320
  mollifierEvaluateTrip(rateKey: string, trippedKey: string, windowMs: string, threshold: string, holdMs: string, callback?: Callback<[number, number]>): Result<[number, number], Context>;
2225
2321
  }
2226
2322
  }
@@ -2233,9 +2329,24 @@ type MollifierDrainerHandler<TPayload> = (input: {
2233
2329
  attempts: number;
2234
2330
  createdAt: Date;
2235
2331
  }) => Promise<void>;
2332
+ type MollifierDrainerTerminalFailureCause = "non-retryable" | "max-attempts-exhausted";
2333
+ type MollifierDrainerTerminalFailureHandler<TPayload> = (input: {
2334
+ runId: string;
2335
+ envId: string;
2336
+ orgId: string;
2337
+ payload: TPayload;
2338
+ attempts: number;
2339
+ createdAt: Date;
2340
+ error: {
2341
+ code: string;
2342
+ message: string;
2343
+ };
2344
+ cause: MollifierDrainerTerminalFailureCause;
2345
+ }) => Promise<void>;
2236
2346
  type MollifierDrainerOptions<TPayload> = {
2237
2347
  buffer: MollifierBuffer;
2238
2348
  handler: MollifierDrainerHandler<TPayload>;
2349
+ onTerminalFailure?: MollifierDrainerTerminalFailureHandler<TPayload>;
2239
2350
  concurrency: number;
2240
2351
  maxAttempts: number;
2241
2352
  isRetryable: (err: unknown) => boolean;
@@ -2250,6 +2361,7 @@ type DrainResult = {
2250
2361
  declare class MollifierDrainer<TPayload = unknown> {
2251
2362
  private readonly buffer;
2252
2363
  private readonly handler;
2364
+ private readonly onTerminalFailure?;
2253
2365
  private readonly maxAttempts;
2254
2366
  private readonly isRetryable;
2255
2367
  private readonly pollIntervalMs;
@@ -2276,4 +2388,4 @@ declare class MollifierDrainer<TPayload = unknown> {
2276
2388
  private processEntry;
2277
2389
  }
2278
2390
 
2279
- export { type AnyMessageCatalog, type AnyQueueItem, BaseScheduler, type BatchConfig, BatchedSpanManager, type BatchedSpanManagerOptions, type BufferEntry, BufferEntryError, BufferEntrySchema, BufferEntryStatus, CallbackFairQueueKeyProducer, type ClaimResult, type ConcurrencyCheckResult, type ConcurrencyGroupConfig, ConcurrencyManager, type ConcurrencyManagerOptions, type ConcurrencyState, type ConsumerLoopState, type CooloffOptions, CronSchema, CustomRetry, DRRScheduler, type DRRSchedulerConfig, type DeadLetterMessage, DefaultFairQueueKeyProducer, type DispatchSchedulerContext, type DrainResult, type EnqueueBatchOptions, type EnqueueOptions, ExponentialBackoffRetry, FairQueue, FairQueueAttributes, type FairQueueKeyProducer, type FairQueueMetrics, type FairQueueOptions, FairQueueTelemetry, type FairScheduler, FixedDelayRetry, type GlobalRateLimiter, ImmediateRetry, type InFlightMessage, type JobHandler, type JobHandlerParams, LinearBackoffRetry, MasterQueue, type MasterQueueOptions, type MessageCatalogKey, type MessageCatalogSchema, type MessageCatalogValue, type MessageHandler, type MessageHandlerContext, MessagingAttributes, MollifierBuffer, type MollifierBufferOptions, MollifierDrainer, type MollifierDrainerHandler, type MollifierDrainerOptions, NoRetry, NoopScheduler, type QueueCooloffState, type QueueDescriptor, type QueueItem, type QueueMessage, type QueueWithScore, type ReclaimedMessageInfo, type RetryOptions, type RetryStrategy, RoundRobinScheduler, type SchedulerContext, SimpleQueue, type StoredMessage, type TelemetryOptions, TenantDispatch, type TenantDispatchOptions, type TenantQueues, type TenantWithScore, VisibilityManager, type VisibilityManagerOptions, WeightedScheduler, type WeightedSchedulerBiases, type WeightedSchedulerConfig, Worker, type WorkerCatalog, type WorkerConcurrencyOptions, WorkerQueueManager, type WorkerQueueManagerOptions, type WorkerQueueOptions, createDefaultRetryStrategy, defaultRetryOptions, deserialiseSnapshot, isAbortError, noopTelemetry, serialiseSnapshot };
2391
+ export { type AcceptResult, type AnyMessageCatalog, type AnyQueueItem, BaseScheduler, type BatchConfig, BatchedSpanManager, type BatchedSpanManagerOptions, type BufferEntry, BufferEntryError, BufferEntrySchema, BufferEntryStatus, CallbackFairQueueKeyProducer, type CasSetMetadataResult, type ClaimResult, type ConcurrencyCheckResult, type ConcurrencyGroupConfig, ConcurrencyManager, type ConcurrencyManagerOptions, type ConcurrencyState, type ConsumerLoopState, type CooloffOptions, CronSchema, CustomRetry, DRRScheduler, type DRRSchedulerConfig, type DeadLetterMessage, DefaultFairQueueKeyProducer, type DispatchSchedulerContext, type DrainResult, type EnqueueBatchOptions, type EnqueueOptions, ExponentialBackoffRetry, FairQueue, FairQueueAttributes, type FairQueueKeyProducer, type FairQueueMetrics, type FairQueueOptions, FairQueueTelemetry, type FairScheduler, FixedDelayRetry, type GlobalRateLimiter, type IdempotencyClaimResult, type IdempotencyLookupInput, ImmediateRetry, type InFlightMessage, type JobHandler, type JobHandlerParams, LinearBackoffRetry, MasterQueue, type MasterQueueOptions, type MessageCatalogKey, type MessageCatalogSchema, type MessageCatalogValue, type MessageHandler, type MessageHandlerContext, MessagingAttributes, MollifierBuffer, type MollifierBufferOptions, MollifierDrainer, type MollifierDrainerHandler, type MollifierDrainerOptions, type MollifierDrainerTerminalFailureCause, type MollifierDrainerTerminalFailureHandler, type MutateSnapshotResult, NoRetry, NoopScheduler, type QueueCooloffState, type QueueDescriptor, type QueueItem, type QueueMessage, type QueueWithScore, type ReclaimedMessageInfo, type RetryOptions, type RetryStrategy, RoundRobinScheduler, type SchedulerContext, SimpleQueue, type SnapshotPatch, type StoredMessage, type TelemetryOptions, TenantDispatch, type TenantDispatchOptions, type TenantQueues, type TenantWithScore, VisibilityManager, type VisibilityManagerOptions, WeightedScheduler, type WeightedSchedulerBiases, type WeightedSchedulerConfig, Worker, type WorkerCatalog, type WorkerConcurrencyOptions, WorkerQueueManager, type WorkerQueueManagerOptions, type WorkerQueueOptions, createDefaultRetryStrategy, defaultRetryOptions, deserialiseSnapshot, idempotencyLookupKeyFor, isAbortError, makeIdempotencyClaimKey, noopTelemetry, serialiseSnapshot };