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