@trigger.dev/sdk 0.2.4 → 0.2.5

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.js CHANGED
@@ -6,9 +6,6 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __commonJS = (cb, mod) => function __require() {
10
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
- };
12
9
  var __export = (target, all) => {
13
10
  for (var name2 in all)
14
11
  __defProp(target, name2, { get: all[name2], enumerable: true });
@@ -49,195 +46,6 @@ var __privateMethod = (obj, member, method) => {
49
46
  return method;
50
47
  };
51
48
 
52
- // ../common-schemas/dist/index.js
53
- var require_dist = __commonJS({
54
- "../common-schemas/dist/index.js"(exports, module2) {
55
- "use strict";
56
- var __defProp2 = Object.defineProperty;
57
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
58
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
59
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
60
- var __export2 = /* @__PURE__ */ __name((target, all) => {
61
- for (var name2 in all)
62
- __defProp2(target, name2, {
63
- get: all[name2],
64
- enumerable: true
65
- });
66
- }, "__export");
67
- var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
68
- if (from && typeof from === "object" || typeof from === "function") {
69
- for (let key of __getOwnPropNames2(from))
70
- if (!__hasOwnProp2.call(to, key) && key !== except)
71
- __defProp2(to, key, {
72
- get: () => from[key],
73
- enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
74
- });
75
- }
76
- return to;
77
- }, "__copyProps");
78
- var __toCommonJS2 = /* @__PURE__ */ __name((mod) => __copyProps2(__defProp2({}, "__esModule", {
79
- value: true
80
- }), mod), "__toCommonJS");
81
- var src_exports2 = {};
82
- __export2(src_exports2, {
83
- CustomEventSchema: () => CustomEventSchema2,
84
- CustomEventTriggerSchema: () => CustomEventTriggerSchema,
85
- DelaySchema: () => DelaySchema,
86
- ErrorSchema: () => ErrorSchema,
87
- EventFilterSchema: () => EventFilterSchema,
88
- HttpEventTriggerSchema: () => HttpEventTriggerSchema,
89
- JsonSchema: () => JsonSchema2,
90
- LogMessageSchema: () => LogMessageSchema,
91
- ScheduleSourceCronSchema: () => ScheduleSourceCronSchema,
92
- ScheduleSourceRateSchema: () => ScheduleSourceRateSchema,
93
- ScheduleSourceSchema: () => ScheduleSourceSchema,
94
- ScheduledEventPayloadSchema: () => ScheduledEventPayloadSchema2,
95
- ScheduledEventTriggerSchema: () => ScheduledEventTriggerSchema,
96
- ScheduledForSchema: () => ScheduledForSchema,
97
- SerializableCustomEventSchema: () => SerializableCustomEventSchema,
98
- SerializableJsonSchema: () => SerializableJsonSchema,
99
- TriggerMetadataSchema: () => TriggerMetadataSchema2,
100
- WaitSchema: () => WaitSchema2,
101
- WebhookEventTriggerSchema: () => WebhookEventTriggerSchema
102
- });
103
- module2.exports = __toCommonJS2(src_exports2);
104
- var import_zod5 = require("zod");
105
- var LiteralSchema = import_zod5.z.union([
106
- import_zod5.z.string(),
107
- import_zod5.z.number(),
108
- import_zod5.z.boolean(),
109
- import_zod5.z.null()
110
- ]);
111
- var JsonSchema2 = import_zod5.z.lazy(() => import_zod5.z.union([
112
- LiteralSchema,
113
- import_zod5.z.array(JsonSchema2),
114
- import_zod5.z.record(JsonSchema2)
115
- ]));
116
- var SerializableSchema = import_zod5.z.union([
117
- import_zod5.z.string(),
118
- import_zod5.z.number(),
119
- import_zod5.z.boolean(),
120
- import_zod5.z.null(),
121
- import_zod5.z.date()
122
- ]);
123
- var SerializableJsonSchema = import_zod5.z.lazy(() => import_zod5.z.union([
124
- SerializableSchema,
125
- import_zod5.z.array(SerializableJsonSchema),
126
- import_zod5.z.record(SerializableJsonSchema)
127
- ]));
128
- var import_zod22 = require("zod");
129
- var ErrorSchema = import_zod22.z.object({
130
- name: import_zod22.z.string(),
131
- message: import_zod22.z.string(),
132
- stackTrace: import_zod22.z.string().optional()
133
- });
134
- var import_zod32 = require("zod");
135
- var LogMessageSchema = import_zod32.z.object({
136
- level: import_zod32.z.enum([
137
- "DEBUG",
138
- "INFO",
139
- "WARN",
140
- "ERROR"
141
- ]),
142
- message: import_zod32.z.string(),
143
- properties: JsonSchema2.default({})
144
- });
145
- var import_zod42 = require("zod");
146
- var DelaySchema = import_zod42.z.object({
147
- type: import_zod42.z.literal("DELAY"),
148
- seconds: import_zod42.z.number().optional(),
149
- minutes: import_zod42.z.number().optional(),
150
- hours: import_zod42.z.number().optional(),
151
- days: import_zod42.z.number().optional()
152
- });
153
- var ScheduledForSchema = import_zod42.z.object({
154
- type: import_zod42.z.literal("SCHEDULE_FOR"),
155
- scheduledFor: import_zod42.z.string().datetime()
156
- });
157
- var WaitSchema2 = import_zod42.z.discriminatedUnion("type", [
158
- DelaySchema,
159
- ScheduledForSchema
160
- ]);
161
- var import_zod52 = require("zod");
162
- var CustomEventSchema2 = import_zod52.z.object({
163
- name: import_zod52.z.string(),
164
- payload: JsonSchema2,
165
- context: JsonSchema2.optional(),
166
- timestamp: import_zod52.z.string().datetime().optional()
167
- });
168
- var SerializableCustomEventSchema = import_zod52.z.object({
169
- name: import_zod52.z.string(),
170
- payload: SerializableJsonSchema,
171
- context: SerializableJsonSchema.optional(),
172
- timestamp: import_zod52.z.string().datetime().optional()
173
- });
174
- var EventMatcherSchema = import_zod52.z.union([
175
- import_zod52.z.array(import_zod52.z.string()),
176
- import_zod52.z.array(import_zod52.z.number()),
177
- import_zod52.z.array(import_zod52.z.boolean())
178
- ]);
179
- var EventFilterSchema = import_zod52.z.lazy(() => import_zod52.z.record(import_zod52.z.union([
180
- EventMatcherSchema,
181
- EventFilterSchema
182
- ])));
183
- var ScheduledEventPayloadSchema2 = import_zod52.z.object({
184
- scheduledTime: import_zod52.z.coerce.date()
185
- });
186
- var ScheduleSourceRateSchema = import_zod52.z.object({
187
- rateOf: import_zod52.z.union([
188
- import_zod52.z.object({
189
- minutes: import_zod52.z.number().min(1).max(1440).int()
190
- }),
191
- import_zod52.z.object({
192
- hours: import_zod52.z.number().min(1).max(720).int()
193
- }),
194
- import_zod52.z.object({
195
- days: import_zod52.z.number().min(1).max(365).int()
196
- })
197
- ])
198
- });
199
- var ScheduleSourceCronSchema = import_zod52.z.object({
200
- cron: import_zod52.z.string()
201
- });
202
- var ScheduleSourceSchema = import_zod52.z.union([
203
- ScheduleSourceRateSchema,
204
- ScheduleSourceCronSchema
205
- ]);
206
- var import_zod6 = require("zod");
207
- var CustomEventTriggerSchema = import_zod6.z.object({
208
- type: import_zod6.z.literal("CUSTOM_EVENT"),
209
- service: import_zod6.z.literal("trigger"),
210
- name: import_zod6.z.string(),
211
- filter: EventFilterSchema
212
- });
213
- var WebhookEventTriggerSchema = import_zod6.z.object({
214
- type: import_zod6.z.literal("WEBHOOK"),
215
- service: import_zod6.z.string(),
216
- name: import_zod6.z.string(),
217
- filter: EventFilterSchema,
218
- source: JsonSchema2
219
- });
220
- var HttpEventTriggerSchema = import_zod6.z.object({
221
- type: import_zod6.z.literal("HTTP_ENDPOINT"),
222
- service: import_zod6.z.literal("trigger"),
223
- name: import_zod6.z.string(),
224
- filter: EventFilterSchema
225
- });
226
- var ScheduledEventTriggerSchema = import_zod6.z.object({
227
- type: import_zod6.z.literal("SCHEDULE"),
228
- service: import_zod6.z.literal("scheduler"),
229
- name: import_zod6.z.string(),
230
- source: ScheduleSourceSchema
231
- });
232
- var TriggerMetadataSchema2 = import_zod6.z.discriminatedUnion("type", [
233
- CustomEventTriggerSchema,
234
- WebhookEventTriggerSchema,
235
- HttpEventTriggerSchema,
236
- ScheduledEventTriggerSchema
237
- ]);
238
- }
239
- });
240
-
241
49
  // src/index.ts
242
50
  var src_exports = {};
243
51
  __export(src_exports, {
@@ -249,8 +57,153 @@ __export(src_exports, {
249
57
  });
250
58
  module.exports = __toCommonJS(src_exports);
251
59
 
60
+ // ../common-schemas/src/json.ts
61
+ var import_zod = require("zod");
62
+ var LiteralSchema = import_zod.z.union([
63
+ import_zod.z.string(),
64
+ import_zod.z.number(),
65
+ import_zod.z.boolean(),
66
+ import_zod.z.null()
67
+ ]);
68
+ var JsonSchema = import_zod.z.lazy(() => import_zod.z.union([
69
+ LiteralSchema,
70
+ import_zod.z.array(JsonSchema),
71
+ import_zod.z.record(JsonSchema)
72
+ ]));
73
+ var SerializableSchema = import_zod.z.union([
74
+ import_zod.z.string(),
75
+ import_zod.z.number(),
76
+ import_zod.z.boolean(),
77
+ import_zod.z.null(),
78
+ import_zod.z.date()
79
+ ]);
80
+ var SerializableJsonSchema = import_zod.z.lazy(() => import_zod.z.union([
81
+ SerializableSchema,
82
+ import_zod.z.array(SerializableJsonSchema),
83
+ import_zod.z.record(SerializableJsonSchema)
84
+ ]));
85
+
86
+ // ../common-schemas/src/error.ts
87
+ var import_zod2 = require("zod");
88
+ var ErrorSchema = import_zod2.z.object({
89
+ name: import_zod2.z.string(),
90
+ message: import_zod2.z.string(),
91
+ stackTrace: import_zod2.z.string().optional()
92
+ });
93
+
94
+ // ../common-schemas/src/logs.ts
95
+ var import_zod3 = require("zod");
96
+ var LogMessageSchema = import_zod3.z.object({
97
+ level: import_zod3.z.enum([
98
+ "DEBUG",
99
+ "INFO",
100
+ "WARN",
101
+ "ERROR"
102
+ ]),
103
+ message: import_zod3.z.string(),
104
+ properties: JsonSchema.default({})
105
+ });
106
+
107
+ // ../common-schemas/src/waits.ts
108
+ var import_zod4 = require("zod");
109
+ var DelaySchema = import_zod4.z.object({
110
+ type: import_zod4.z.literal("DELAY"),
111
+ seconds: import_zod4.z.number().optional(),
112
+ minutes: import_zod4.z.number().optional(),
113
+ hours: import_zod4.z.number().optional(),
114
+ days: import_zod4.z.number().optional()
115
+ });
116
+ var ScheduledForSchema = import_zod4.z.object({
117
+ type: import_zod4.z.literal("SCHEDULE_FOR"),
118
+ scheduledFor: import_zod4.z.string().datetime()
119
+ });
120
+ var WaitSchema = import_zod4.z.discriminatedUnion("type", [
121
+ DelaySchema,
122
+ ScheduledForSchema
123
+ ]);
124
+
125
+ // ../common-schemas/src/events.ts
126
+ var import_zod5 = require("zod");
127
+ var CustomEventSchema = import_zod5.z.object({
128
+ name: import_zod5.z.string(),
129
+ payload: JsonSchema,
130
+ context: JsonSchema.optional(),
131
+ timestamp: import_zod5.z.string().datetime().optional()
132
+ });
133
+ var SerializableCustomEventSchema = import_zod5.z.object({
134
+ name: import_zod5.z.string(),
135
+ payload: SerializableJsonSchema,
136
+ context: SerializableJsonSchema.optional(),
137
+ timestamp: import_zod5.z.string().datetime().optional()
138
+ });
139
+ var EventMatcherSchema = import_zod5.z.union([
140
+ import_zod5.z.array(import_zod5.z.string()),
141
+ import_zod5.z.array(import_zod5.z.number()),
142
+ import_zod5.z.array(import_zod5.z.boolean())
143
+ ]);
144
+ var EventFilterSchema = import_zod5.z.lazy(() => import_zod5.z.record(import_zod5.z.union([
145
+ EventMatcherSchema,
146
+ EventFilterSchema
147
+ ])));
148
+ var ScheduledEventPayloadSchema = import_zod5.z.object({
149
+ scheduledTime: import_zod5.z.coerce.date()
150
+ });
151
+ var ScheduleSourceRateSchema = import_zod5.z.object({
152
+ rateOf: import_zod5.z.union([
153
+ import_zod5.z.object({
154
+ minutes: import_zod5.z.number().min(1).max(1440).int()
155
+ }),
156
+ import_zod5.z.object({
157
+ hours: import_zod5.z.number().min(1).max(720).int()
158
+ }),
159
+ import_zod5.z.object({
160
+ days: import_zod5.z.number().min(1).max(365).int()
161
+ })
162
+ ])
163
+ });
164
+ var ScheduleSourceCronSchema = import_zod5.z.object({
165
+ cron: import_zod5.z.string()
166
+ });
167
+ var ScheduleSourceSchema = import_zod5.z.union([
168
+ ScheduleSourceRateSchema,
169
+ ScheduleSourceCronSchema
170
+ ]);
171
+
172
+ // ../common-schemas/src/triggers.ts
173
+ var import_zod6 = require("zod");
174
+ var CustomEventTriggerSchema = import_zod6.z.object({
175
+ type: import_zod6.z.literal("CUSTOM_EVENT"),
176
+ service: import_zod6.z.literal("trigger"),
177
+ name: import_zod6.z.string(),
178
+ filter: EventFilterSchema
179
+ });
180
+ var WebhookEventTriggerSchema = import_zod6.z.object({
181
+ type: import_zod6.z.literal("WEBHOOK"),
182
+ service: import_zod6.z.string(),
183
+ name: import_zod6.z.string(),
184
+ filter: EventFilterSchema,
185
+ source: JsonSchema
186
+ });
187
+ var HttpEventTriggerSchema = import_zod6.z.object({
188
+ type: import_zod6.z.literal("HTTP_ENDPOINT"),
189
+ service: import_zod6.z.literal("trigger"),
190
+ name: import_zod6.z.string(),
191
+ filter: EventFilterSchema
192
+ });
193
+ var ScheduledEventTriggerSchema = import_zod6.z.object({
194
+ type: import_zod6.z.literal("SCHEDULE"),
195
+ service: import_zod6.z.literal("scheduler"),
196
+ name: import_zod6.z.string(),
197
+ source: ScheduleSourceSchema
198
+ });
199
+ var TriggerMetadataSchema = import_zod6.z.discriminatedUnion("type", [
200
+ CustomEventTriggerSchema,
201
+ WebhookEventTriggerSchema,
202
+ HttpEventTriggerSchema,
203
+ ScheduledEventTriggerSchema
204
+ ]);
205
+
252
206
  // src/events.ts
253
- var import_common_schemas = __toESM(require_dist());
254
207
  function customEvent(options) {
255
208
  return {
256
209
  metadata: {
@@ -275,196 +228,194 @@ function scheduleEvent(options) {
275
228
  name: "scheduled-event",
276
229
  source: options
277
230
  },
278
- schema: import_common_schemas.ScheduledEventPayloadSchema
231
+ schema: ScheduledEventPayloadSchema
279
232
  };
280
233
  }
281
234
  __name(scheduleEvent, "scheduleEvent");
282
235
 
283
236
  // ../internal-bridge/src/schemas/host.ts
284
- var import_zod = require("zod");
285
- var import_common_schemas2 = __toESM(require_dist());
237
+ var import_zod7 = require("zod");
286
238
  var HostRPCSchema = {
287
239
  TRIGGER_WORKFLOW: {
288
- request: import_zod.z.object({
289
- id: import_zod.z.string(),
290
- trigger: import_zod.z.object({
291
- input: import_common_schemas2.JsonSchema.default({}),
292
- context: import_common_schemas2.JsonSchema.default({})
240
+ request: import_zod7.z.object({
241
+ id: import_zod7.z.string(),
242
+ trigger: import_zod7.z.object({
243
+ input: JsonSchema.default({}),
244
+ context: JsonSchema.default({})
293
245
  }),
294
- meta: import_zod.z.object({
295
- environment: import_zod.z.string(),
296
- workflowId: import_zod.z.string(),
297
- organizationId: import_zod.z.string(),
298
- apiKey: import_zod.z.string()
246
+ meta: import_zod7.z.object({
247
+ environment: import_zod7.z.string(),
248
+ workflowId: import_zod7.z.string(),
249
+ organizationId: import_zod7.z.string(),
250
+ apiKey: import_zod7.z.string()
299
251
  })
300
252
  }),
301
- response: import_zod.z.boolean()
253
+ response: import_zod7.z.boolean()
302
254
  },
303
255
  RESOLVE_REQUEST: {
304
- request: import_zod.z.object({
305
- id: import_zod.z.string(),
306
- key: import_zod.z.string(),
307
- output: import_common_schemas2.JsonSchema.default({}),
308
- meta: import_zod.z.object({
309
- environment: import_zod.z.string(),
310
- workflowId: import_zod.z.string(),
311
- organizationId: import_zod.z.string(),
312
- apiKey: import_zod.z.string(),
313
- runId: import_zod.z.string()
256
+ request: import_zod7.z.object({
257
+ id: import_zod7.z.string(),
258
+ key: import_zod7.z.string(),
259
+ output: JsonSchema.default({}),
260
+ meta: import_zod7.z.object({
261
+ environment: import_zod7.z.string(),
262
+ workflowId: import_zod7.z.string(),
263
+ organizationId: import_zod7.z.string(),
264
+ apiKey: import_zod7.z.string(),
265
+ runId: import_zod7.z.string()
314
266
  })
315
267
  }),
316
- response: import_zod.z.boolean()
268
+ response: import_zod7.z.boolean()
317
269
  },
318
270
  RESOLVE_DELAY: {
319
- request: import_zod.z.object({
320
- id: import_zod.z.string(),
321
- key: import_zod.z.string(),
322
- meta: import_zod.z.object({
323
- environment: import_zod.z.string(),
324
- workflowId: import_zod.z.string(),
325
- organizationId: import_zod.z.string(),
326
- apiKey: import_zod.z.string(),
327
- runId: import_zod.z.string()
271
+ request: import_zod7.z.object({
272
+ id: import_zod7.z.string(),
273
+ key: import_zod7.z.string(),
274
+ meta: import_zod7.z.object({
275
+ environment: import_zod7.z.string(),
276
+ workflowId: import_zod7.z.string(),
277
+ organizationId: import_zod7.z.string(),
278
+ apiKey: import_zod7.z.string(),
279
+ runId: import_zod7.z.string()
328
280
  })
329
281
  }),
330
- response: import_zod.z.boolean()
282
+ response: import_zod7.z.boolean()
331
283
  },
332
284
  REJECT_REQUEST: {
333
- request: import_zod.z.object({
334
- id: import_zod.z.string(),
335
- key: import_zod.z.string(),
336
- error: import_common_schemas2.JsonSchema.default({}),
337
- meta: import_zod.z.object({
338
- environment: import_zod.z.string(),
339
- workflowId: import_zod.z.string(),
340
- organizationId: import_zod.z.string(),
341
- apiKey: import_zod.z.string(),
342
- runId: import_zod.z.string()
285
+ request: import_zod7.z.object({
286
+ id: import_zod7.z.string(),
287
+ key: import_zod7.z.string(),
288
+ error: JsonSchema.default({}),
289
+ meta: import_zod7.z.object({
290
+ environment: import_zod7.z.string(),
291
+ workflowId: import_zod7.z.string(),
292
+ organizationId: import_zod7.z.string(),
293
+ apiKey: import_zod7.z.string(),
294
+ runId: import_zod7.z.string()
343
295
  })
344
296
  }),
345
- response: import_zod.z.boolean()
297
+ response: import_zod7.z.boolean()
346
298
  }
347
299
  };
348
300
 
349
301
  // ../internal-bridge/src/schemas/server.ts
350
- var import_common_schemas3 = __toESM(require_dist());
351
- var import_zod2 = require("zod");
302
+ var import_zod8 = require("zod");
352
303
  var ServerRPCSchema = {
353
304
  INITIALIZE_DELAY: {
354
- request: import_zod2.z.object({
355
- runId: import_zod2.z.string(),
356
- key: import_zod2.z.string(),
357
- wait: import_common_schemas3.WaitSchema,
358
- timestamp: import_zod2.z.string()
305
+ request: import_zod8.z.object({
306
+ runId: import_zod8.z.string(),
307
+ key: import_zod8.z.string(),
308
+ wait: WaitSchema,
309
+ timestamp: import_zod8.z.string()
359
310
  }),
360
- response: import_zod2.z.boolean()
311
+ response: import_zod8.z.boolean()
361
312
  },
362
313
  SEND_REQUEST: {
363
- request: import_zod2.z.object({
364
- runId: import_zod2.z.string(),
365
- key: import_zod2.z.string(),
366
- request: import_zod2.z.object({
367
- service: import_zod2.z.string(),
368
- endpoint: import_zod2.z.string(),
369
- params: import_zod2.z.any()
314
+ request: import_zod8.z.object({
315
+ runId: import_zod8.z.string(),
316
+ key: import_zod8.z.string(),
317
+ request: import_zod8.z.object({
318
+ service: import_zod8.z.string(),
319
+ endpoint: import_zod8.z.string(),
320
+ params: import_zod8.z.any()
370
321
  }),
371
- timestamp: import_zod2.z.string()
322
+ timestamp: import_zod8.z.string()
372
323
  }),
373
- response: import_zod2.z.boolean()
324
+ response: import_zod8.z.boolean()
374
325
  },
375
326
  SEND_LOG: {
376
- request: import_zod2.z.object({
377
- runId: import_zod2.z.string(),
378
- key: import_zod2.z.string(),
379
- log: import_zod2.z.object({
380
- message: import_zod2.z.string(),
381
- level: import_zod2.z.enum([
327
+ request: import_zod8.z.object({
328
+ runId: import_zod8.z.string(),
329
+ key: import_zod8.z.string(),
330
+ log: import_zod8.z.object({
331
+ message: import_zod8.z.string(),
332
+ level: import_zod8.z.enum([
382
333
  "DEBUG",
383
334
  "INFO",
384
335
  "WARN",
385
336
  "ERROR"
386
337
  ]),
387
- properties: import_zod2.z.string().optional()
338
+ properties: import_zod8.z.string().optional()
388
339
  }),
389
- timestamp: import_zod2.z.string()
340
+ timestamp: import_zod8.z.string()
390
341
  }),
391
- response: import_zod2.z.boolean()
342
+ response: import_zod8.z.boolean()
392
343
  },
393
344
  SEND_EVENT: {
394
- request: import_zod2.z.object({
395
- runId: import_zod2.z.string(),
396
- key: import_zod2.z.string(),
397
- event: import_common_schemas3.CustomEventSchema,
398
- timestamp: import_zod2.z.string()
345
+ request: import_zod8.z.object({
346
+ runId: import_zod8.z.string(),
347
+ key: import_zod8.z.string(),
348
+ event: CustomEventSchema,
349
+ timestamp: import_zod8.z.string()
399
350
  }),
400
- response: import_zod2.z.boolean()
351
+ response: import_zod8.z.boolean()
401
352
  },
402
353
  INITIALIZE_HOST: {
403
- request: import_zod2.z.object({
404
- apiKey: import_zod2.z.string(),
405
- workflowId: import_zod2.z.string(),
406
- workflowName: import_zod2.z.string(),
407
- trigger: import_common_schemas3.TriggerMetadataSchema,
408
- packageVersion: import_zod2.z.string(),
409
- packageName: import_zod2.z.string(),
410
- triggerTTL: import_zod2.z.number().optional()
354
+ request: import_zod8.z.object({
355
+ apiKey: import_zod8.z.string(),
356
+ workflowId: import_zod8.z.string(),
357
+ workflowName: import_zod8.z.string(),
358
+ trigger: TriggerMetadataSchema,
359
+ packageVersion: import_zod8.z.string(),
360
+ packageName: import_zod8.z.string(),
361
+ triggerTTL: import_zod8.z.number().optional()
411
362
  }),
412
- response: import_zod2.z.discriminatedUnion("type", [
413
- import_zod2.z.object({
414
- type: import_zod2.z.literal("success")
363
+ response: import_zod8.z.discriminatedUnion("type", [
364
+ import_zod8.z.object({
365
+ type: import_zod8.z.literal("success")
415
366
  }),
416
- import_zod2.z.object({
417
- type: import_zod2.z.literal("error"),
418
- message: import_zod2.z.string()
367
+ import_zod8.z.object({
368
+ type: import_zod8.z.literal("error"),
369
+ message: import_zod8.z.string()
419
370
  })
420
371
  ]).nullable()
421
372
  },
422
373
  START_WORKFLOW_RUN: {
423
- request: import_zod2.z.object({
424
- runId: import_zod2.z.string(),
425
- timestamp: import_zod2.z.string()
374
+ request: import_zod8.z.object({
375
+ runId: import_zod8.z.string(),
376
+ timestamp: import_zod8.z.string()
426
377
  }),
427
- response: import_zod2.z.boolean()
378
+ response: import_zod8.z.boolean()
428
379
  },
429
380
  COMPLETE_WORKFLOW_RUN: {
430
- request: import_zod2.z.object({
431
- runId: import_zod2.z.string(),
432
- output: import_zod2.z.string().optional(),
433
- timestamp: import_zod2.z.string()
381
+ request: import_zod8.z.object({
382
+ runId: import_zod8.z.string(),
383
+ output: import_zod8.z.string().optional(),
384
+ timestamp: import_zod8.z.string()
434
385
  }),
435
- response: import_zod2.z.boolean()
386
+ response: import_zod8.z.boolean()
436
387
  },
437
388
  SEND_WORKFLOW_ERROR: {
438
- request: import_zod2.z.object({
439
- runId: import_zod2.z.string(),
440
- error: import_zod2.z.object({
441
- name: import_zod2.z.string(),
442
- message: import_zod2.z.string(),
443
- stackTrace: import_zod2.z.string().optional()
389
+ request: import_zod8.z.object({
390
+ runId: import_zod8.z.string(),
391
+ error: import_zod8.z.object({
392
+ name: import_zod8.z.string(),
393
+ message: import_zod8.z.string(),
394
+ stackTrace: import_zod8.z.string().optional()
444
395
  }),
445
- timestamp: import_zod2.z.string()
396
+ timestamp: import_zod8.z.string()
446
397
  }),
447
- response: import_zod2.z.boolean()
398
+ response: import_zod8.z.boolean()
448
399
  }
449
400
  };
450
401
 
451
402
  // ../internal-bridge/src/schemas/common.ts
452
- var import_zod3 = require("zod");
453
- var MESSAGE_META = import_zod3.z.object({
454
- data: import_zod3.z.any(),
455
- id: import_zod3.z.string(),
456
- type: import_zod3.z.union([
457
- import_zod3.z.literal("ACK"),
458
- import_zod3.z.literal("MESSAGE")
403
+ var import_zod9 = require("zod");
404
+ var MESSAGE_META = import_zod9.z.object({
405
+ data: import_zod9.z.any(),
406
+ id: import_zod9.z.string(),
407
+ type: import_zod9.z.union([
408
+ import_zod9.z.literal("ACK"),
409
+ import_zod9.z.literal("MESSAGE")
459
410
  ])
460
411
  });
461
- var TriggerEnvironmentSchema = import_zod3.z.enum([
412
+ var TriggerEnvironmentSchema = import_zod9.z.enum([
462
413
  "live",
463
414
  "development"
464
415
  ]);
465
416
 
466
417
  // ../internal-bridge/src/zodRPC.ts
467
- var import_zod4 = require("zod");
418
+ var import_zod10 = require("zod");
468
419
  var import_node_crypto = require("crypto");
469
420
 
470
421
  // ../internal-bridge/src/logger.ts
@@ -528,11 +479,11 @@ function formattedDateTime() {
528
479
  __name(formattedDateTime, "formattedDateTime");
529
480
 
530
481
  // ../internal-bridge/src/zodRPC.ts
531
- var RPCMessageSchema = import_zod4.z.object({
532
- id: import_zod4.z.string(),
533
- methodName: import_zod4.z.string(),
534
- data: import_zod4.z.any(),
535
- kind: import_zod4.z.enum([
482
+ var RPCMessageSchema = import_zod10.z.object({
483
+ id: import_zod10.z.string(),
484
+ methodName: import_zod10.z.string(),
485
+ data: import_zod10.z.any(),
486
+ kind: import_zod10.z.enum([
536
487
  "CALL",
537
488
  "RESPONSE"
538
489
  ])
@@ -608,7 +559,7 @@ onCall_fn = /* @__PURE__ */ __name(async function(message) {
608
559
  try {
609
560
  await __privateMethod(this, _handleCall, handleCall_fn).call(this, message);
610
561
  } catch (callError) {
611
- if (callError instanceof import_zod4.ZodError) {
562
+ if (callError instanceof import_zod10.ZodError) {
612
563
  __privateGet(this, _logger).error(`[ZodRPC] Received invalid call:
613
564
  ${JSON.stringify(message)}: `, callError.errors);
614
565
  } else {
@@ -622,7 +573,7 @@ onResponse_fn = /* @__PURE__ */ __name(async function(message1) {
622
573
  try {
623
574
  await __privateMethod(this, _handleResponse, handleResponse_fn).call(this, message1);
624
575
  } catch (callError) {
625
- if (callError instanceof import_zod4.ZodError) {
576
+ if (callError instanceof import_zod10.ZodError) {
626
577
  __privateGet(this, _logger).error(`[ZodRPC] Received invalid response
627
578
 
628
579
  ${JSON.stringify(message1)}: `, callError.flatten());
@@ -701,7 +652,7 @@ var import_ws = require("ws");
701
652
 
702
653
  // package.json
703
654
  var name = "@trigger.dev/sdk";
704
- var version = "0.2.4";
655
+ var version = "0.2.5";
705
656
 
706
657
  // src/connection.ts
707
658
  var import_uuid = require("uuid");