@trigger.dev/redis-worker 4.5.15 → 4.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/index.cjs +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -69
- package/dist/index.d.ts +35 -69
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Callback, Redis, RedisOptions, Result } from "@internal/redis";
|
|
2
2
|
import { Logger } from "@trigger.dev/core/logger";
|
|
3
|
-
import {
|
|
3
|
+
import { AnyZodSchema, inferZodSchemaOutput } from "@trigger.dev/core/v3";
|
|
4
4
|
import { Attributes, Context, Counter, Histogram, Meter, ObservableGauge, Span, SpanKind, Tracer } from "@internal/tracing";
|
|
5
5
|
import { RetryOptions as RetryOptions$1 } from "@trigger.dev/core/v3/schemas";
|
|
6
|
+
import { z } from "zod/v4";
|
|
6
7
|
//#region src/queue.d.ts
|
|
7
8
|
interface MessageCatalogSchema {
|
|
8
|
-
[key: string]:
|
|
9
|
+
[key: string]: AnyZodSchema;
|
|
9
10
|
}
|
|
10
11
|
type MessageCatalogKey<TMessageCatalog extends MessageCatalogSchema> = keyof TMessageCatalog;
|
|
11
|
-
type MessageCatalogValue<TMessageCatalog extends MessageCatalogSchema, TKey extends MessageCatalogKey<TMessageCatalog>> =
|
|
12
|
+
type MessageCatalogValue<TMessageCatalog extends MessageCatalogSchema, TKey extends MessageCatalogKey<TMessageCatalog>> = inferZodSchemaOutput<TMessageCatalog[TKey]>;
|
|
12
13
|
type AnyMessageCatalog = MessageCatalogSchema;
|
|
13
14
|
type QueueItem<TMessageCatalog extends MessageCatalogSchema> = {
|
|
14
15
|
id: string;
|
|
@@ -105,15 +106,7 @@ declare const CronSchema: z.ZodObject<{
|
|
|
105
106
|
cron: z.ZodString;
|
|
106
107
|
lastTimestamp: z.ZodOptional<z.ZodNumber>;
|
|
107
108
|
timestamp: z.ZodNumber;
|
|
108
|
-
},
|
|
109
|
-
cron: string;
|
|
110
|
-
lastTimestamp?: number | undefined;
|
|
111
|
-
timestamp: number;
|
|
112
|
-
}, {
|
|
113
|
-
cron: string;
|
|
114
|
-
lastTimestamp?: number | undefined;
|
|
115
|
-
timestamp: number;
|
|
116
|
-
}>;
|
|
109
|
+
}, z.core.$strip>;
|
|
117
110
|
type CronSchema = z.infer<typeof CronSchema>;
|
|
118
111
|
type BatchConfig = {
|
|
119
112
|
maxSize: number;
|
|
@@ -121,7 +114,7 @@ type BatchConfig = {
|
|
|
121
114
|
};
|
|
122
115
|
type WorkerCatalog = {
|
|
123
116
|
[key: string]: {
|
|
124
|
-
schema:
|
|
117
|
+
schema: AnyZodSchema;
|
|
125
118
|
visibilityTimeoutMs: number;
|
|
126
119
|
retry?: RetryOptions$1;
|
|
127
120
|
cron?: string;
|
|
@@ -135,7 +128,7 @@ type WorkerCatalog = {
|
|
|
135
128
|
type QueueCatalogFromWorkerCatalog<Catalog extends WorkerCatalog> = { [K in keyof Catalog]: Catalog[K]["schema"]; };
|
|
136
129
|
type JobHandlerParams<Catalog extends WorkerCatalog, K extends keyof Catalog> = {
|
|
137
130
|
id: string;
|
|
138
|
-
payload:
|
|
131
|
+
payload: inferZodSchemaOutput<Catalog[K]["schema"]>;
|
|
139
132
|
visibilityTimeoutMs: number;
|
|
140
133
|
attempt: number;
|
|
141
134
|
deduplicationKey?: string;
|
|
@@ -193,7 +186,7 @@ declare class Worker<TCatalog extends WorkerCatalog> {
|
|
|
193
186
|
enqueue<K extends keyof TCatalog>({ id, job, payload, visibilityTimeoutMs, availableAt, cancellationKey }: {
|
|
194
187
|
id?: string;
|
|
195
188
|
job: K;
|
|
196
|
-
payload:
|
|
189
|
+
payload: inferZodSchemaOutput<TCatalog[K]["schema"]>;
|
|
197
190
|
visibilityTimeoutMs?: number;
|
|
198
191
|
availableAt?: Date;
|
|
199
192
|
cancellationKey?: string;
|
|
@@ -211,7 +204,7 @@ declare class Worker<TCatalog extends WorkerCatalog> {
|
|
|
211
204
|
enqueueOnce<K extends keyof TCatalog>({ id, job, payload, visibilityTimeoutMs, availableAt }: {
|
|
212
205
|
id: string;
|
|
213
206
|
job: K;
|
|
214
|
-
payload:
|
|
207
|
+
payload: inferZodSchemaOutput<TCatalog[K]["schema"]>;
|
|
215
208
|
visibilityTimeoutMs?: number;
|
|
216
209
|
availableAt?: Date;
|
|
217
210
|
}): Promise<boolean>;
|
|
@@ -689,7 +682,7 @@ interface CooloffOptions {
|
|
|
689
682
|
*
|
|
690
683
|
* @typeParam TPayloadSchema - Zod schema for message payload validation
|
|
691
684
|
*/
|
|
692
|
-
interface FairQueueOptions<TPayloadSchema extends
|
|
685
|
+
interface FairQueueOptions<TPayloadSchema extends AnyZodSchema = z.ZodUnknown> {
|
|
693
686
|
/** Redis connection options */
|
|
694
687
|
redis: RedisOptions;
|
|
695
688
|
/** Key producer for Redis keys */
|
|
@@ -708,7 +701,7 @@ interface FairQueueOptions<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
|
|
|
708
701
|
* Worker queue configuration.
|
|
709
702
|
* FairQueue routes messages to worker queues; external consumers handle consumption.
|
|
710
703
|
*/
|
|
711
|
-
workerQueue: WorkerQueueOptions<
|
|
704
|
+
workerQueue: WorkerQueueOptions<inferZodSchemaOutput<TPayloadSchema>>;
|
|
712
705
|
/** Retry and dead letter queue configuration */
|
|
713
706
|
retry?: RetryOptions;
|
|
714
707
|
/** Visibility timeout in milliseconds (default: 30000) */
|
|
@@ -2001,7 +1994,7 @@ declare module "@internal/redis" {
|
|
|
2001
1994
|
*
|
|
2002
1995
|
* @typeParam TPayloadSchema - Zod schema for message payload validation
|
|
2003
1996
|
*/
|
|
2004
|
-
declare class FairQueue<TPayloadSchema extends
|
|
1997
|
+
declare class FairQueue<TPayloadSchema extends AnyZodSchema = z.ZodUnknown> {
|
|
2005
1998
|
#private;
|
|
2006
1999
|
private options;
|
|
2007
2000
|
private redis;
|
|
@@ -2056,15 +2049,15 @@ declare class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
|
|
|
2056
2049
|
/**
|
|
2057
2050
|
* Enqueue a single message to a queue.
|
|
2058
2051
|
*/
|
|
2059
|
-
enqueue(options: EnqueueOptions<
|
|
2052
|
+
enqueue(options: EnqueueOptions<inferZodSchemaOutput<TPayloadSchema>>): Promise<string>;
|
|
2060
2053
|
/**
|
|
2061
2054
|
* Enqueue multiple messages to a queue.
|
|
2062
2055
|
*/
|
|
2063
|
-
enqueueBatch(options: EnqueueBatchOptions<
|
|
2056
|
+
enqueueBatch(options: EnqueueBatchOptions<inferZodSchemaOutput<TPayloadSchema>>): Promise<string[]>;
|
|
2064
2057
|
/**
|
|
2065
2058
|
* Get messages from the dead letter queue for a tenant.
|
|
2066
2059
|
*/
|
|
2067
|
-
getDeadLetterMessages(tenantId: string, limit?: number): Promise<DeadLetterMessage<
|
|
2060
|
+
getDeadLetterMessages(tenantId: string, limit?: number): Promise<DeadLetterMessage<inferZodSchemaOutput<TPayloadSchema>>[]>;
|
|
2068
2061
|
/**
|
|
2069
2062
|
* Redrive a message from DLQ back to its original queue.
|
|
2070
2063
|
*/
|
|
@@ -2139,7 +2132,7 @@ declare class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
|
|
|
2139
2132
|
* @param queueId - The queue ID the message belongs to
|
|
2140
2133
|
* @returns The stored message or null if not found
|
|
2141
2134
|
*/
|
|
2142
|
-
getMessageData(messageId: string, queueId: string): Promise<StoredMessage<
|
|
2135
|
+
getMessageData(messageId: string, queueId: string): Promise<StoredMessage<inferZodSchemaOutput<TPayloadSchema>> | null>;
|
|
2143
2136
|
/**
|
|
2144
2137
|
* Extend the visibility timeout for a message.
|
|
2145
2138
|
* External consumers should call this periodically during long-running processing.
|
|
@@ -2187,65 +2180,38 @@ declare module "@internal/redis" {
|
|
|
2187
2180
|
}
|
|
2188
2181
|
//#endregion
|
|
2189
2182
|
//#region src/mollifier/schemas.d.ts
|
|
2190
|
-
declare const BufferEntryStatus: z.ZodEnum<
|
|
2183
|
+
declare const BufferEntryStatus: z.ZodEnum<{
|
|
2184
|
+
DRAINING: "DRAINING";
|
|
2185
|
+
FAILED: "FAILED";
|
|
2186
|
+
QUEUED: "QUEUED";
|
|
2187
|
+
}>;
|
|
2191
2188
|
type BufferEntryStatus = z.infer<typeof BufferEntryStatus>;
|
|
2192
2189
|
declare const BufferEntryError: z.ZodObject<{
|
|
2193
2190
|
code: z.ZodString;
|
|
2194
2191
|
message: z.ZodString;
|
|
2195
|
-
},
|
|
2196
|
-
code: string;
|
|
2197
|
-
message: string;
|
|
2198
|
-
}, {
|
|
2199
|
-
code: string;
|
|
2200
|
-
message: string;
|
|
2201
|
-
}>;
|
|
2192
|
+
}, z.core.$strip>;
|
|
2202
2193
|
type BufferEntryError = z.infer<typeof BufferEntryError>;
|
|
2203
2194
|
declare const BufferEntrySchema: z.ZodObject<{
|
|
2204
2195
|
runId: z.ZodString;
|
|
2205
2196
|
envId: z.ZodString;
|
|
2206
2197
|
orgId: z.ZodString;
|
|
2207
2198
|
payload: z.ZodString;
|
|
2208
|
-
status: z.ZodEnum<
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2199
|
+
status: z.ZodEnum<{
|
|
2200
|
+
DRAINING: "DRAINING";
|
|
2201
|
+
FAILED: "FAILED";
|
|
2202
|
+
QUEUED: "QUEUED";
|
|
2203
|
+
}>;
|
|
2204
|
+
attempts: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
|
|
2205
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>;
|
|
2206
|
+
createdAtMicros: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>>;
|
|
2207
|
+
materialised: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"true">, z.ZodLiteral<"false">]>, z.ZodTransform<boolean, "false" | "true">>>;
|
|
2213
2208
|
idempotencyLookupKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
2214
|
-
metadataVersion: z.ZodDefault<z.
|
|
2215
|
-
lastError: z.ZodOptional<z.
|
|
2209
|
+
metadataVersion: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>>;
|
|
2210
|
+
lastError: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
2216
2211
|
code: string;
|
|
2217
2212
|
message: string;
|
|
2218
|
-
}, string
|
|
2219
|
-
},
|
|
2220
|
-
runId: string;
|
|
2221
|
-
envId: string;
|
|
2222
|
-
orgId: string;
|
|
2223
|
-
payload: string;
|
|
2224
|
-
status: "DRAINING" | "FAILED" | "QUEUED";
|
|
2225
|
-
attempts: number;
|
|
2226
|
-
createdAt: Date;
|
|
2227
|
-
createdAtMicros: number;
|
|
2228
|
-
materialised: boolean;
|
|
2229
|
-
idempotencyLookupKey: string;
|
|
2230
|
-
metadataVersion: number;
|
|
2231
|
-
lastError?: {
|
|
2232
|
-
code: string;
|
|
2233
|
-
message: string;
|
|
2234
|
-
} | undefined;
|
|
2235
|
-
}, {
|
|
2236
|
-
runId: string;
|
|
2237
|
-
envId: string;
|
|
2238
|
-
orgId: string;
|
|
2239
|
-
payload: string;
|
|
2240
|
-
status: "DRAINING" | "FAILED" | "QUEUED";
|
|
2241
|
-
attempts: string;
|
|
2242
|
-
createdAt: string;
|
|
2243
|
-
createdAtMicros?: string | undefined;
|
|
2244
|
-
materialised?: "false" | "true" | undefined;
|
|
2245
|
-
idempotencyLookupKey?: string | undefined;
|
|
2246
|
-
metadataVersion?: string | undefined;
|
|
2247
|
-
lastError?: string | undefined;
|
|
2248
|
-
}>;
|
|
2213
|
+
}, string>>>;
|
|
2214
|
+
}, z.core.$strip>;
|
|
2249
2215
|
type BufferEntry = z.infer<typeof BufferEntrySchema>;
|
|
2250
2216
|
declare function serialiseSnapshot(snapshot: unknown): string;
|
|
2251
2217
|
declare function deserialiseSnapshot<T = unknown>(serialised: string): T;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Logger } from "@trigger.dev/core/logger";
|
|
2
|
-
import {
|
|
2
|
+
import { AnyZodSchema, inferZodSchemaOutput } from "@trigger.dev/core/v3";
|
|
3
|
+
import { z } from "zod/v4";
|
|
3
4
|
import { Callback, Redis, RedisOptions, Result } from "@internal/redis";
|
|
4
5
|
import { Attributes, Context, Counter, Histogram, Meter, ObservableGauge, Span, SpanKind, Tracer } from "@internal/tracing";
|
|
5
6
|
import { RetryOptions as RetryOptions$1 } from "@trigger.dev/core/v3/schemas";
|
|
6
7
|
//#region src/queue.d.ts
|
|
7
8
|
interface MessageCatalogSchema {
|
|
8
|
-
[key: string]:
|
|
9
|
+
[key: string]: AnyZodSchema;
|
|
9
10
|
}
|
|
10
11
|
type MessageCatalogKey<TMessageCatalog extends MessageCatalogSchema> = keyof TMessageCatalog;
|
|
11
|
-
type MessageCatalogValue<TMessageCatalog extends MessageCatalogSchema, TKey extends MessageCatalogKey<TMessageCatalog>> =
|
|
12
|
+
type MessageCatalogValue<TMessageCatalog extends MessageCatalogSchema, TKey extends MessageCatalogKey<TMessageCatalog>> = inferZodSchemaOutput<TMessageCatalog[TKey]>;
|
|
12
13
|
type AnyMessageCatalog = MessageCatalogSchema;
|
|
13
14
|
type QueueItem<TMessageCatalog extends MessageCatalogSchema> = {
|
|
14
15
|
id: string;
|
|
@@ -105,15 +106,7 @@ declare const CronSchema: z.ZodObject<{
|
|
|
105
106
|
cron: z.ZodString;
|
|
106
107
|
lastTimestamp: z.ZodOptional<z.ZodNumber>;
|
|
107
108
|
timestamp: z.ZodNumber;
|
|
108
|
-
},
|
|
109
|
-
cron: string;
|
|
110
|
-
lastTimestamp?: number | undefined;
|
|
111
|
-
timestamp: number;
|
|
112
|
-
}, {
|
|
113
|
-
cron: string;
|
|
114
|
-
lastTimestamp?: number | undefined;
|
|
115
|
-
timestamp: number;
|
|
116
|
-
}>;
|
|
109
|
+
}, z.core.$strip>;
|
|
117
110
|
type CronSchema = z.infer<typeof CronSchema>;
|
|
118
111
|
type BatchConfig = {
|
|
119
112
|
maxSize: number;
|
|
@@ -121,7 +114,7 @@ type BatchConfig = {
|
|
|
121
114
|
};
|
|
122
115
|
type WorkerCatalog = {
|
|
123
116
|
[key: string]: {
|
|
124
|
-
schema:
|
|
117
|
+
schema: AnyZodSchema;
|
|
125
118
|
visibilityTimeoutMs: number;
|
|
126
119
|
retry?: RetryOptions$1;
|
|
127
120
|
cron?: string;
|
|
@@ -135,7 +128,7 @@ type WorkerCatalog = {
|
|
|
135
128
|
type QueueCatalogFromWorkerCatalog<Catalog extends WorkerCatalog> = { [K in keyof Catalog]: Catalog[K]["schema"]; };
|
|
136
129
|
type JobHandlerParams<Catalog extends WorkerCatalog, K extends keyof Catalog> = {
|
|
137
130
|
id: string;
|
|
138
|
-
payload:
|
|
131
|
+
payload: inferZodSchemaOutput<Catalog[K]["schema"]>;
|
|
139
132
|
visibilityTimeoutMs: number;
|
|
140
133
|
attempt: number;
|
|
141
134
|
deduplicationKey?: string;
|
|
@@ -193,7 +186,7 @@ declare class Worker<TCatalog extends WorkerCatalog> {
|
|
|
193
186
|
enqueue<K extends keyof TCatalog>({ id, job, payload, visibilityTimeoutMs, availableAt, cancellationKey }: {
|
|
194
187
|
id?: string;
|
|
195
188
|
job: K;
|
|
196
|
-
payload:
|
|
189
|
+
payload: inferZodSchemaOutput<TCatalog[K]["schema"]>;
|
|
197
190
|
visibilityTimeoutMs?: number;
|
|
198
191
|
availableAt?: Date;
|
|
199
192
|
cancellationKey?: string;
|
|
@@ -211,7 +204,7 @@ declare class Worker<TCatalog extends WorkerCatalog> {
|
|
|
211
204
|
enqueueOnce<K extends keyof TCatalog>({ id, job, payload, visibilityTimeoutMs, availableAt }: {
|
|
212
205
|
id: string;
|
|
213
206
|
job: K;
|
|
214
|
-
payload:
|
|
207
|
+
payload: inferZodSchemaOutput<TCatalog[K]["schema"]>;
|
|
215
208
|
visibilityTimeoutMs?: number;
|
|
216
209
|
availableAt?: Date;
|
|
217
210
|
}): Promise<boolean>;
|
|
@@ -689,7 +682,7 @@ interface CooloffOptions {
|
|
|
689
682
|
*
|
|
690
683
|
* @typeParam TPayloadSchema - Zod schema for message payload validation
|
|
691
684
|
*/
|
|
692
|
-
interface FairQueueOptions<TPayloadSchema extends
|
|
685
|
+
interface FairQueueOptions<TPayloadSchema extends AnyZodSchema = z.ZodUnknown> {
|
|
693
686
|
/** Redis connection options */
|
|
694
687
|
redis: RedisOptions;
|
|
695
688
|
/** Key producer for Redis keys */
|
|
@@ -708,7 +701,7 @@ interface FairQueueOptions<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
|
|
|
708
701
|
* Worker queue configuration.
|
|
709
702
|
* FairQueue routes messages to worker queues; external consumers handle consumption.
|
|
710
703
|
*/
|
|
711
|
-
workerQueue: WorkerQueueOptions<
|
|
704
|
+
workerQueue: WorkerQueueOptions<inferZodSchemaOutput<TPayloadSchema>>;
|
|
712
705
|
/** Retry and dead letter queue configuration */
|
|
713
706
|
retry?: RetryOptions;
|
|
714
707
|
/** Visibility timeout in milliseconds (default: 30000) */
|
|
@@ -2001,7 +1994,7 @@ declare module "@internal/redis" {
|
|
|
2001
1994
|
*
|
|
2002
1995
|
* @typeParam TPayloadSchema - Zod schema for message payload validation
|
|
2003
1996
|
*/
|
|
2004
|
-
declare class FairQueue<TPayloadSchema extends
|
|
1997
|
+
declare class FairQueue<TPayloadSchema extends AnyZodSchema = z.ZodUnknown> {
|
|
2005
1998
|
#private;
|
|
2006
1999
|
private options;
|
|
2007
2000
|
private redis;
|
|
@@ -2056,15 +2049,15 @@ declare class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
|
|
|
2056
2049
|
/**
|
|
2057
2050
|
* Enqueue a single message to a queue.
|
|
2058
2051
|
*/
|
|
2059
|
-
enqueue(options: EnqueueOptions<
|
|
2052
|
+
enqueue(options: EnqueueOptions<inferZodSchemaOutput<TPayloadSchema>>): Promise<string>;
|
|
2060
2053
|
/**
|
|
2061
2054
|
* Enqueue multiple messages to a queue.
|
|
2062
2055
|
*/
|
|
2063
|
-
enqueueBatch(options: EnqueueBatchOptions<
|
|
2056
|
+
enqueueBatch(options: EnqueueBatchOptions<inferZodSchemaOutput<TPayloadSchema>>): Promise<string[]>;
|
|
2064
2057
|
/**
|
|
2065
2058
|
* Get messages from the dead letter queue for a tenant.
|
|
2066
2059
|
*/
|
|
2067
|
-
getDeadLetterMessages(tenantId: string, limit?: number): Promise<DeadLetterMessage<
|
|
2060
|
+
getDeadLetterMessages(tenantId: string, limit?: number): Promise<DeadLetterMessage<inferZodSchemaOutput<TPayloadSchema>>[]>;
|
|
2068
2061
|
/**
|
|
2069
2062
|
* Redrive a message from DLQ back to its original queue.
|
|
2070
2063
|
*/
|
|
@@ -2139,7 +2132,7 @@ declare class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
|
|
|
2139
2132
|
* @param queueId - The queue ID the message belongs to
|
|
2140
2133
|
* @returns The stored message or null if not found
|
|
2141
2134
|
*/
|
|
2142
|
-
getMessageData(messageId: string, queueId: string): Promise<StoredMessage<
|
|
2135
|
+
getMessageData(messageId: string, queueId: string): Promise<StoredMessage<inferZodSchemaOutput<TPayloadSchema>> | null>;
|
|
2143
2136
|
/**
|
|
2144
2137
|
* Extend the visibility timeout for a message.
|
|
2145
2138
|
* External consumers should call this periodically during long-running processing.
|
|
@@ -2187,65 +2180,38 @@ declare module "@internal/redis" {
|
|
|
2187
2180
|
}
|
|
2188
2181
|
//#endregion
|
|
2189
2182
|
//#region src/mollifier/schemas.d.ts
|
|
2190
|
-
declare const BufferEntryStatus: z.ZodEnum<
|
|
2183
|
+
declare const BufferEntryStatus: z.ZodEnum<{
|
|
2184
|
+
DRAINING: "DRAINING";
|
|
2185
|
+
FAILED: "FAILED";
|
|
2186
|
+
QUEUED: "QUEUED";
|
|
2187
|
+
}>;
|
|
2191
2188
|
type BufferEntryStatus = z.infer<typeof BufferEntryStatus>;
|
|
2192
2189
|
declare const BufferEntryError: z.ZodObject<{
|
|
2193
2190
|
code: z.ZodString;
|
|
2194
2191
|
message: z.ZodString;
|
|
2195
|
-
},
|
|
2196
|
-
code: string;
|
|
2197
|
-
message: string;
|
|
2198
|
-
}, {
|
|
2199
|
-
code: string;
|
|
2200
|
-
message: string;
|
|
2201
|
-
}>;
|
|
2192
|
+
}, z.core.$strip>;
|
|
2202
2193
|
type BufferEntryError = z.infer<typeof BufferEntryError>;
|
|
2203
2194
|
declare const BufferEntrySchema: z.ZodObject<{
|
|
2204
2195
|
runId: z.ZodString;
|
|
2205
2196
|
envId: z.ZodString;
|
|
2206
2197
|
orgId: z.ZodString;
|
|
2207
2198
|
payload: z.ZodString;
|
|
2208
|
-
status: z.ZodEnum<
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2199
|
+
status: z.ZodEnum<{
|
|
2200
|
+
DRAINING: "DRAINING";
|
|
2201
|
+
FAILED: "FAILED";
|
|
2202
|
+
QUEUED: "QUEUED";
|
|
2203
|
+
}>;
|
|
2204
|
+
attempts: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
|
|
2205
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>;
|
|
2206
|
+
createdAtMicros: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>>;
|
|
2207
|
+
materialised: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"true">, z.ZodLiteral<"false">]>, z.ZodTransform<boolean, "false" | "true">>>;
|
|
2213
2208
|
idempotencyLookupKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
2214
|
-
metadataVersion: z.ZodDefault<z.
|
|
2215
|
-
lastError: z.ZodOptional<z.
|
|
2209
|
+
metadataVersion: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>>;
|
|
2210
|
+
lastError: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
2216
2211
|
code: string;
|
|
2217
2212
|
message: string;
|
|
2218
|
-
}, string
|
|
2219
|
-
},
|
|
2220
|
-
runId: string;
|
|
2221
|
-
envId: string;
|
|
2222
|
-
orgId: string;
|
|
2223
|
-
payload: string;
|
|
2224
|
-
status: "DRAINING" | "FAILED" | "QUEUED";
|
|
2225
|
-
attempts: number;
|
|
2226
|
-
createdAt: Date;
|
|
2227
|
-
createdAtMicros: number;
|
|
2228
|
-
materialised: boolean;
|
|
2229
|
-
idempotencyLookupKey: string;
|
|
2230
|
-
metadataVersion: number;
|
|
2231
|
-
lastError?: {
|
|
2232
|
-
code: string;
|
|
2233
|
-
message: string;
|
|
2234
|
-
} | undefined;
|
|
2235
|
-
}, {
|
|
2236
|
-
runId: string;
|
|
2237
|
-
envId: string;
|
|
2238
|
-
orgId: string;
|
|
2239
|
-
payload: string;
|
|
2240
|
-
status: "DRAINING" | "FAILED" | "QUEUED";
|
|
2241
|
-
attempts: string;
|
|
2242
|
-
createdAt: string;
|
|
2243
|
-
createdAtMicros?: string | undefined;
|
|
2244
|
-
materialised?: "false" | "true" | undefined;
|
|
2245
|
-
idempotencyLookupKey?: string | undefined;
|
|
2246
|
-
metadataVersion?: string | undefined;
|
|
2247
|
-
lastError?: string | undefined;
|
|
2248
|
-
}>;
|
|
2213
|
+
}, string>>>;
|
|
2214
|
+
}, z.core.$strip>;
|
|
2249
2215
|
type BufferEntry = z.infer<typeof BufferEntrySchema>;
|
|
2250
2216
|
declare function serialiseSnapshot(snapshot: unknown): string;
|
|
2251
2217
|
declare function deserialiseSnapshot<T = unknown>(serialised: string): T;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { webcrypto } from "node:crypto";
|
|
|
7
7
|
import "@trigger.dev/core/v3/utils/flattenAttributes";
|
|
8
8
|
import { calculateNextRetryDelay } from "@trigger.dev/core/v3";
|
|
9
9
|
import { jumpHash, shutdownManager } from "@trigger.dev/core/v3/serverOnly";
|
|
10
|
-
import { z } from "zod";
|
|
10
|
+
import { z } from "zod/v4";
|
|
11
11
|
import cronParser from "cron-parser";
|
|
12
12
|
import { setInterval as setInterval$1, setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
13
13
|
import seedrandom from "seedrandom";
|
|
@@ -16326,10 +16326,10 @@ const BufferEntrySchema = z.object({
|
|
|
16326
16326
|
status: BufferEntryStatus,
|
|
16327
16327
|
attempts: stringToInt,
|
|
16328
16328
|
createdAt: stringToDate,
|
|
16329
|
-
createdAtMicros: stringToInt.default(
|
|
16330
|
-
materialised: stringToBool.default(
|
|
16329
|
+
createdAtMicros: stringToInt.default(0),
|
|
16330
|
+
materialised: stringToBool.default(false),
|
|
16331
16331
|
idempotencyLookupKey: z.string().optional().default(""),
|
|
16332
|
-
metadataVersion: stringToInt.default(
|
|
16332
|
+
metadataVersion: stringToInt.default(0),
|
|
16333
16333
|
lastError: stringToError.optional()
|
|
16334
16334
|
});
|
|
16335
16335
|
function serialiseSnapshot(snapshot) {
|