@trigger.dev/core 0.0.0-isomorphic-sdk-20230918150523 → 0.0.0-node-18-20231010094401
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.ts +1116 -187
- package/dist/index.js +608 -424
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
@@ -17,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
18
|
return to;
|
|
18
19
|
};
|
|
19
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var __publicField = (obj, key, value) => {
|
|
22
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
20
25
|
var __accessCheck = (obj, member, msg) => {
|
|
21
26
|
if (!member.has(obj))
|
|
22
27
|
throw TypeError("Cannot " + msg);
|
|
@@ -43,7 +48,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
43
48
|
// src/index.ts
|
|
44
49
|
var src_exports = {};
|
|
45
50
|
__export(src_exports, {
|
|
51
|
+
API_VERSIONS: () => API_VERSIONS,
|
|
46
52
|
ApiEventLogSchema: () => ApiEventLogSchema,
|
|
53
|
+
BloomFilter: () => BloomFilter,
|
|
47
54
|
CachedTaskSchema: () => CachedTaskSchema,
|
|
48
55
|
CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
|
|
49
56
|
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
@@ -59,6 +66,7 @@ __export(src_exports, {
|
|
|
59
66
|
DisplayPropertySchema: () => DisplayPropertySchema,
|
|
60
67
|
DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
|
|
61
68
|
DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
|
|
69
|
+
EndpointHeadersSchema: () => EndpointHeadersSchema,
|
|
62
70
|
ErrorWithStackSchema: () => ErrorWithStackSchema,
|
|
63
71
|
EventExampleSchema: () => EventExampleSchema,
|
|
64
72
|
EventFilterSchema: () => EventFilterSchema,
|
|
@@ -73,6 +81,7 @@ __export(src_exports, {
|
|
|
73
81
|
FetchRetryStrategySchema: () => FetchRetryStrategySchema,
|
|
74
82
|
GetEventSchema: () => GetEventSchema,
|
|
75
83
|
GetRunSchema: () => GetRunSchema,
|
|
84
|
+
GetRunStatusesSchema: () => GetRunStatusesSchema,
|
|
76
85
|
GetRunsSchema: () => GetRunsSchema,
|
|
77
86
|
HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
|
|
78
87
|
HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
|
|
@@ -86,6 +95,7 @@ __export(src_exports, {
|
|
|
86
95
|
IntervalMetadataSchema: () => IntervalMetadataSchema,
|
|
87
96
|
IntervalOptionsSchema: () => IntervalOptionsSchema,
|
|
88
97
|
JobMetadataSchema: () => JobMetadataSchema,
|
|
98
|
+
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
89
99
|
LogMessageSchema: () => LogMessageSchema,
|
|
90
100
|
Logger: () => Logger,
|
|
91
101
|
MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
|
|
@@ -98,6 +108,7 @@ __export(src_exports, {
|
|
|
98
108
|
MissingExternalConnectionResolvedNotificationPayloadSchema: () => MissingExternalConnectionResolvedNotificationPayloadSchema,
|
|
99
109
|
NormalizedRequestSchema: () => NormalizedRequestSchema,
|
|
100
110
|
NormalizedResponseSchema: () => NormalizedResponseSchema,
|
|
111
|
+
PLATFORM_FEATURES: () => PLATFORM_FEATURES,
|
|
101
112
|
PongErrorResponseSchema: () => PongErrorResponseSchema,
|
|
102
113
|
PongResponseSchema: () => PongResponseSchema,
|
|
103
114
|
PongSuccessResponseSchema: () => PongSuccessResponseSchema,
|
|
@@ -126,27 +137,35 @@ __export(src_exports, {
|
|
|
126
137
|
RunJobBodySchema: () => RunJobBodySchema,
|
|
127
138
|
RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
|
|
128
139
|
RunJobErrorSchema: () => RunJobErrorSchema,
|
|
140
|
+
RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
|
|
129
141
|
RunJobResponseSchema: () => RunJobResponseSchema,
|
|
130
142
|
RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
|
|
131
143
|
RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
|
|
132
144
|
RunJobSuccessSchema: () => RunJobSuccessSchema,
|
|
145
|
+
RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
|
|
146
|
+
RunJobYieldExecutionErrorSchema: () => RunJobYieldExecutionErrorSchema,
|
|
133
147
|
RunSourceContextSchema: () => RunSourceContextSchema,
|
|
134
148
|
RunStatusSchema: () => RunStatusSchema,
|
|
135
149
|
RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
|
|
136
150
|
RunTaskBodyOutputSchema: () => RunTaskBodyOutputSchema,
|
|
137
151
|
RunTaskOptionsSchema: () => RunTaskOptionsSchema,
|
|
152
|
+
RunTaskResponseWithCachedTasksBodySchema: () => RunTaskResponseWithCachedTasksBodySchema,
|
|
138
153
|
RunTaskSchema: () => RunTaskSchema,
|
|
139
154
|
RuntimeEnvironmentTypeSchema: () => RuntimeEnvironmentTypeSchema,
|
|
140
155
|
SCHEDULED_EVENT: () => SCHEDULED_EVENT,
|
|
141
156
|
ScheduleMetadataSchema: () => ScheduleMetadataSchema,
|
|
142
157
|
ScheduledPayloadSchema: () => ScheduledPayloadSchema,
|
|
143
158
|
ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema,
|
|
159
|
+
SchemaErrorSchema: () => SchemaErrorSchema,
|
|
144
160
|
SendEventBodySchema: () => SendEventBodySchema,
|
|
145
161
|
SendEventOptionsSchema: () => SendEventOptionsSchema,
|
|
146
162
|
SerializableJsonSchema: () => SerializableJsonSchema,
|
|
147
163
|
ServerTaskSchema: () => ServerTaskSchema,
|
|
148
164
|
SourceMetadataV2Schema: () => SourceMetadataV2Schema,
|
|
149
165
|
StaticTriggerMetadataSchema: () => StaticTriggerMetadataSchema,
|
|
166
|
+
StatusHistorySchema: () => StatusHistorySchema,
|
|
167
|
+
StatusUpdateSchema: () => StatusUpdateSchema,
|
|
168
|
+
StatusUpdateStateSchema: () => StatusUpdateStateSchema,
|
|
150
169
|
StyleSchema: () => StyleSchema,
|
|
151
170
|
TaskSchema: () => TaskSchema,
|
|
152
171
|
TaskStatusSchema: () => TaskStatusSchema,
|
|
@@ -165,6 +184,7 @@ __export(src_exports, {
|
|
|
165
184
|
deepMergeFilters: () => deepMergeFilters,
|
|
166
185
|
eventFilterMatches: () => eventFilterMatches,
|
|
167
186
|
replacements: () => replacements,
|
|
187
|
+
supportsFeature: () => supportsFeature,
|
|
168
188
|
urlWithSearchParams: () => urlWithSearchParams
|
|
169
189
|
});
|
|
170
190
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -318,8 +338,8 @@ function prettyPrintBytes(value) {
|
|
|
318
338
|
__name(prettyPrintBytes, "prettyPrintBytes");
|
|
319
339
|
|
|
320
340
|
// src/schemas/api.ts
|
|
321
|
-
var
|
|
322
|
-
var
|
|
341
|
+
var import_ulid = require("ulid");
|
|
342
|
+
var import_zod11 = require("zod");
|
|
323
343
|
|
|
324
344
|
// src/schemas/addMissingVersionField.ts
|
|
325
345
|
function addMissingVersionField(val) {
|
|
@@ -340,6 +360,10 @@ var ErrorWithStackSchema = import_zod.z.object({
|
|
|
340
360
|
name: import_zod.z.string().optional(),
|
|
341
361
|
stack: import_zod.z.string().optional()
|
|
342
362
|
});
|
|
363
|
+
var SchemaErrorSchema = import_zod.z.object({
|
|
364
|
+
path: import_zod.z.array(import_zod.z.string()),
|
|
365
|
+
message: import_zod.z.string()
|
|
366
|
+
});
|
|
343
367
|
|
|
344
368
|
// src/schemas/eventFilter.ts
|
|
345
369
|
var import_zod2 = require("zod");
|
|
@@ -422,7 +446,8 @@ var EventRuleSchema = import_zod2.z.object({
|
|
|
422
446
|
var import_zod3 = require("zod");
|
|
423
447
|
var ConnectionAuthSchema = import_zod3.z.object({
|
|
424
448
|
type: import_zod3.z.enum([
|
|
425
|
-
"oauth2"
|
|
449
|
+
"oauth2",
|
|
450
|
+
"apiKey"
|
|
426
451
|
]),
|
|
427
452
|
accessToken: import_zod3.z.string(),
|
|
428
453
|
scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
@@ -438,7 +463,8 @@ var IntegrationConfigSchema = import_zod3.z.object({
|
|
|
438
463
|
metadata: IntegrationMetadataSchema,
|
|
439
464
|
authSource: import_zod3.z.enum([
|
|
440
465
|
"HOSTED",
|
|
441
|
-
"LOCAL"
|
|
466
|
+
"LOCAL",
|
|
467
|
+
"RESOLVER"
|
|
442
468
|
])
|
|
443
469
|
});
|
|
444
470
|
|
|
@@ -499,8 +525,8 @@ var ScheduledPayloadSchema = import_zod6.z.object({
|
|
|
499
525
|
lastTimestamp: import_zod6.z.coerce.date().optional()
|
|
500
526
|
});
|
|
501
527
|
var IntervalOptionsSchema = import_zod6.z.object({
|
|
502
|
-
/** The number of seconds for the interval. Min = 60, Max =
|
|
503
|
-
seconds: import_zod6.z.number().int().positive().min(60).max(
|
|
528
|
+
/** The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days) */
|
|
529
|
+
seconds: import_zod6.z.number().int().positive().min(60).max(2592e3)
|
|
504
530
|
});
|
|
505
531
|
var CronOptionsSchema = import_zod6.z.object({
|
|
506
532
|
/** A CRON expression that defines the schedule. A useful tool when writing CRON
|
|
@@ -511,6 +537,8 @@ var CronOptionsSchema = import_zod6.z.object({
|
|
|
511
537
|
var CronMetadataSchema = import_zod6.z.object({
|
|
512
538
|
type: import_zod6.z.literal("cron"),
|
|
513
539
|
options: CronOptionsSchema,
|
|
540
|
+
/** An optional Account ID to associate with runs triggered by this interval */
|
|
541
|
+
accountId: import_zod6.z.string().optional(),
|
|
514
542
|
metadata: import_zod6.z.any()
|
|
515
543
|
});
|
|
516
544
|
var IntervalMetadataSchema = import_zod6.z.object({
|
|
@@ -518,6 +546,8 @@ var IntervalMetadataSchema = import_zod6.z.object({
|
|
|
518
546
|
type: import_zod6.z.literal("interval"),
|
|
519
547
|
/** An object containing options about the interval. */
|
|
520
548
|
options: IntervalOptionsSchema,
|
|
549
|
+
/** An optional Account ID to associate with runs triggered by this interval */
|
|
550
|
+
accountId: import_zod6.z.string().optional(),
|
|
521
551
|
/** Any additional metadata about the schedule. */
|
|
522
552
|
metadata: import_zod6.z.any()
|
|
523
553
|
});
|
|
@@ -560,7 +590,8 @@ var TaskSchema = import_zod7.z.object({
|
|
|
560
590
|
error: import_zod7.z.string().optional().nullable(),
|
|
561
591
|
parentId: import_zod7.z.string().optional().nullable(),
|
|
562
592
|
style: StyleSchema.optional().nullable(),
|
|
563
|
-
operation: import_zod7.z.string().optional().nullable()
|
|
593
|
+
operation: import_zod7.z.string().optional().nullable(),
|
|
594
|
+
callbackUrl: import_zod7.z.string().optional().nullable()
|
|
564
595
|
});
|
|
565
596
|
var ServerTaskSchema = TaskSchema.extend({
|
|
566
597
|
idempotencyKey: import_zod7.z.string(),
|
|
@@ -616,459 +647,613 @@ var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
|
|
|
616
647
|
ScheduledTriggerMetadataSchema
|
|
617
648
|
]);
|
|
618
649
|
|
|
650
|
+
// src/schemas/runs.ts
|
|
651
|
+
var import_zod10 = require("zod");
|
|
652
|
+
|
|
653
|
+
// src/schemas/statuses.ts
|
|
654
|
+
var import_zod9 = require("zod");
|
|
655
|
+
var StatusUpdateStateSchema = import_zod9.z.union([
|
|
656
|
+
import_zod9.z.literal("loading"),
|
|
657
|
+
import_zod9.z.literal("success"),
|
|
658
|
+
import_zod9.z.literal("failure")
|
|
659
|
+
]);
|
|
660
|
+
var StatusUpdateDataSchema = import_zod9.z.record(SerializableJsonSchema);
|
|
661
|
+
var StatusUpdateSchema = import_zod9.z.object({
|
|
662
|
+
label: import_zod9.z.string().optional(),
|
|
663
|
+
state: StatusUpdateStateSchema.optional(),
|
|
664
|
+
data: StatusUpdateDataSchema.optional()
|
|
665
|
+
});
|
|
666
|
+
var InitalStatusUpdateSchema = StatusUpdateSchema.required({
|
|
667
|
+
label: true
|
|
668
|
+
});
|
|
669
|
+
var StatusHistorySchema = import_zod9.z.array(StatusUpdateSchema);
|
|
670
|
+
var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({
|
|
671
|
+
key: import_zod9.z.string(),
|
|
672
|
+
history: StatusHistorySchema
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
// src/schemas/runs.ts
|
|
676
|
+
var RunStatusSchema = import_zod10.z.union([
|
|
677
|
+
import_zod10.z.literal("PENDING"),
|
|
678
|
+
import_zod10.z.literal("QUEUED"),
|
|
679
|
+
import_zod10.z.literal("WAITING_ON_CONNECTIONS"),
|
|
680
|
+
import_zod10.z.literal("PREPROCESSING"),
|
|
681
|
+
import_zod10.z.literal("STARTED"),
|
|
682
|
+
import_zod10.z.literal("SUCCESS"),
|
|
683
|
+
import_zod10.z.literal("FAILURE"),
|
|
684
|
+
import_zod10.z.literal("TIMED_OUT"),
|
|
685
|
+
import_zod10.z.literal("ABORTED"),
|
|
686
|
+
import_zod10.z.literal("CANCELED"),
|
|
687
|
+
import_zod10.z.literal("UNRESOLVED_AUTH"),
|
|
688
|
+
import_zod10.z.literal("INVALID_PAYLOAD")
|
|
689
|
+
]);
|
|
690
|
+
var RunTaskSchema = import_zod10.z.object({
|
|
691
|
+
/** The Task id */
|
|
692
|
+
id: import_zod10.z.string(),
|
|
693
|
+
/** The key that you defined when creating the Task, the first param in any task. */
|
|
694
|
+
displayKey: import_zod10.z.string().nullable(),
|
|
695
|
+
/** The Task status */
|
|
696
|
+
status: TaskStatusSchema,
|
|
697
|
+
/** The name of the Task */
|
|
698
|
+
name: import_zod10.z.string(),
|
|
699
|
+
/** The icon of the Task, a string.
|
|
700
|
+
* For integrations, this will be a lowercase name of the company.
|
|
701
|
+
* Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
|
|
702
|
+
icon: import_zod10.z.string().nullable(),
|
|
703
|
+
/** When the task started */
|
|
704
|
+
startedAt: import_zod10.z.coerce.date().nullable(),
|
|
705
|
+
/** When the task completed */
|
|
706
|
+
completedAt: import_zod10.z.coerce.date().nullable()
|
|
707
|
+
});
|
|
708
|
+
var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
|
|
709
|
+
subtasks: import_zod10.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
|
|
710
|
+
});
|
|
711
|
+
var GetRunOptionsSchema = import_zod10.z.object({
|
|
712
|
+
/** Return subtasks, which appear in a `subtasks` array on a task. @default false */
|
|
713
|
+
subtasks: import_zod10.z.boolean().optional(),
|
|
714
|
+
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
715
|
+
cursor: import_zod10.z.string().optional(),
|
|
716
|
+
/** How many tasks you want to return in one go, max 50. @default 20 */
|
|
717
|
+
take: import_zod10.z.number().optional()
|
|
718
|
+
});
|
|
719
|
+
var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
|
|
720
|
+
/** If `true`, it returns the `params` and `output` of all tasks. @default false */
|
|
721
|
+
taskdetails: import_zod10.z.boolean().optional()
|
|
722
|
+
});
|
|
723
|
+
var RunSchema = import_zod10.z.object({
|
|
724
|
+
/** The Run id */
|
|
725
|
+
id: import_zod10.z.string(),
|
|
726
|
+
/** The Run status */
|
|
727
|
+
status: RunStatusSchema,
|
|
728
|
+
/** When the run started */
|
|
729
|
+
startedAt: import_zod10.z.coerce.date().nullable(),
|
|
730
|
+
/** When the run was last updated */
|
|
731
|
+
updatedAt: import_zod10.z.coerce.date().nullable(),
|
|
732
|
+
/** When the run was completed */
|
|
733
|
+
completedAt: import_zod10.z.coerce.date().nullable()
|
|
734
|
+
});
|
|
735
|
+
var GetRunSchema = RunSchema.extend({
|
|
736
|
+
/** The output of the run */
|
|
737
|
+
output: import_zod10.z.any().optional(),
|
|
738
|
+
/** The tasks from the run */
|
|
739
|
+
tasks: import_zod10.z.array(RunTaskWithSubtasksSchema),
|
|
740
|
+
/** Any status updates that were published from the run */
|
|
741
|
+
statuses: import_zod10.z.array(JobRunStatusRecordSchema).default([]),
|
|
742
|
+
/** If there are more tasks, you can use this to get them */
|
|
743
|
+
nextCursor: import_zod10.z.string().optional()
|
|
744
|
+
});
|
|
745
|
+
var GetRunsOptionsSchema = import_zod10.z.object({
|
|
746
|
+
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
747
|
+
cursor: import_zod10.z.string().optional(),
|
|
748
|
+
/** How many runs you want to return in one go, max 50. @default 20 */
|
|
749
|
+
take: import_zod10.z.number().optional()
|
|
750
|
+
});
|
|
751
|
+
var GetRunsSchema = import_zod10.z.object({
|
|
752
|
+
/** The runs from the query */
|
|
753
|
+
runs: RunSchema.array(),
|
|
754
|
+
/** If there are more runs, you can use this to get them */
|
|
755
|
+
nextCursor: import_zod10.z.string().optional()
|
|
756
|
+
});
|
|
757
|
+
|
|
619
758
|
// src/schemas/api.ts
|
|
620
|
-
var UpdateTriggerSourceBodyV1Schema =
|
|
621
|
-
registeredEvents:
|
|
622
|
-
secret:
|
|
759
|
+
var UpdateTriggerSourceBodyV1Schema = import_zod11.z.object({
|
|
760
|
+
registeredEvents: import_zod11.z.array(import_zod11.z.string()),
|
|
761
|
+
secret: import_zod11.z.string().optional(),
|
|
623
762
|
data: SerializableJsonSchema.optional()
|
|
624
763
|
});
|
|
625
|
-
var UpdateTriggerSourceBodyV2Schema =
|
|
626
|
-
secret:
|
|
764
|
+
var UpdateTriggerSourceBodyV2Schema = import_zod11.z.object({
|
|
765
|
+
secret: import_zod11.z.string().optional(),
|
|
627
766
|
data: SerializableJsonSchema.optional(),
|
|
628
|
-
options:
|
|
629
|
-
event:
|
|
630
|
-
}).and(
|
|
767
|
+
options: import_zod11.z.object({
|
|
768
|
+
event: import_zod11.z.array(import_zod11.z.string())
|
|
769
|
+
}).and(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.array(import_zod11.z.string())).optional())
|
|
631
770
|
});
|
|
632
|
-
var RegisterHTTPTriggerSourceBodySchema =
|
|
633
|
-
type:
|
|
634
|
-
url:
|
|
771
|
+
var RegisterHTTPTriggerSourceBodySchema = import_zod11.z.object({
|
|
772
|
+
type: import_zod11.z.literal("HTTP"),
|
|
773
|
+
url: import_zod11.z.string().url()
|
|
635
774
|
});
|
|
636
|
-
var RegisterSMTPTriggerSourceBodySchema =
|
|
637
|
-
type:
|
|
775
|
+
var RegisterSMTPTriggerSourceBodySchema = import_zod11.z.object({
|
|
776
|
+
type: import_zod11.z.literal("SMTP")
|
|
638
777
|
});
|
|
639
|
-
var RegisterSQSTriggerSourceBodySchema =
|
|
640
|
-
type:
|
|
778
|
+
var RegisterSQSTriggerSourceBodySchema = import_zod11.z.object({
|
|
779
|
+
type: import_zod11.z.literal("SQS")
|
|
641
780
|
});
|
|
642
|
-
var RegisterSourceChannelBodySchema =
|
|
781
|
+
var RegisterSourceChannelBodySchema = import_zod11.z.discriminatedUnion("type", [
|
|
643
782
|
RegisterHTTPTriggerSourceBodySchema,
|
|
644
783
|
RegisterSMTPTriggerSourceBodySchema,
|
|
645
784
|
RegisterSQSTriggerSourceBodySchema
|
|
646
785
|
]);
|
|
647
786
|
var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
|
|
648
787
|
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
|
|
649
|
-
var RegisterTriggerSourceSchema =
|
|
650
|
-
key:
|
|
651
|
-
params:
|
|
652
|
-
active:
|
|
653
|
-
secret:
|
|
788
|
+
var RegisterTriggerSourceSchema = import_zod11.z.object({
|
|
789
|
+
key: import_zod11.z.string(),
|
|
790
|
+
params: import_zod11.z.any(),
|
|
791
|
+
active: import_zod11.z.boolean(),
|
|
792
|
+
secret: import_zod11.z.string(),
|
|
654
793
|
data: DeserializedJsonSchema.optional(),
|
|
655
794
|
channel: RegisterSourceChannelBodySchema,
|
|
656
|
-
clientId:
|
|
795
|
+
clientId: import_zod11.z.string().optional()
|
|
657
796
|
});
|
|
658
|
-
var SourceEventOptionSchema =
|
|
659
|
-
name:
|
|
660
|
-
value:
|
|
797
|
+
var SourceEventOptionSchema = import_zod11.z.object({
|
|
798
|
+
name: import_zod11.z.string(),
|
|
799
|
+
value: import_zod11.z.string()
|
|
661
800
|
});
|
|
662
|
-
var RegisterSourceEventSchemaV1 =
|
|
801
|
+
var RegisterSourceEventSchemaV1 = import_zod11.z.object({
|
|
663
802
|
/** The id of the source */
|
|
664
|
-
id:
|
|
803
|
+
id: import_zod11.z.string(),
|
|
665
804
|
source: RegisterTriggerSourceSchema,
|
|
666
|
-
events:
|
|
667
|
-
missingEvents:
|
|
668
|
-
orphanedEvents:
|
|
669
|
-
dynamicTriggerId:
|
|
805
|
+
events: import_zod11.z.array(import_zod11.z.string()),
|
|
806
|
+
missingEvents: import_zod11.z.array(import_zod11.z.string()),
|
|
807
|
+
orphanedEvents: import_zod11.z.array(import_zod11.z.string()),
|
|
808
|
+
dynamicTriggerId: import_zod11.z.string().optional()
|
|
670
809
|
});
|
|
671
|
-
var RegisteredOptionsDiffSchema =
|
|
672
|
-
desired:
|
|
673
|
-
missing:
|
|
674
|
-
orphaned:
|
|
810
|
+
var RegisteredOptionsDiffSchema = import_zod11.z.object({
|
|
811
|
+
desired: import_zod11.z.array(import_zod11.z.string()),
|
|
812
|
+
missing: import_zod11.z.array(import_zod11.z.string()),
|
|
813
|
+
orphaned: import_zod11.z.array(import_zod11.z.string())
|
|
675
814
|
});
|
|
676
|
-
var RegisterSourceEventOptionsSchema =
|
|
815
|
+
var RegisterSourceEventOptionsSchema = import_zod11.z.object({
|
|
677
816
|
event: RegisteredOptionsDiffSchema
|
|
678
|
-
}).and(
|
|
679
|
-
var RegisterSourceEventSchemaV2 =
|
|
817
|
+
}).and(import_zod11.z.record(import_zod11.z.string(), RegisteredOptionsDiffSchema));
|
|
818
|
+
var RegisterSourceEventSchemaV2 = import_zod11.z.object({
|
|
680
819
|
/** The id of the source */
|
|
681
|
-
id:
|
|
820
|
+
id: import_zod11.z.string(),
|
|
682
821
|
source: RegisterTriggerSourceSchema,
|
|
683
822
|
options: RegisterSourceEventOptionsSchema,
|
|
684
|
-
dynamicTriggerId:
|
|
823
|
+
dynamicTriggerId: import_zod11.z.string().optional()
|
|
685
824
|
});
|
|
686
|
-
var TriggerSourceSchema =
|
|
687
|
-
id:
|
|
688
|
-
key:
|
|
825
|
+
var TriggerSourceSchema = import_zod11.z.object({
|
|
826
|
+
id: import_zod11.z.string(),
|
|
827
|
+
key: import_zod11.z.string()
|
|
689
828
|
});
|
|
690
829
|
var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
|
|
691
|
-
var HandleTriggerSourceSchema =
|
|
692
|
-
key:
|
|
693
|
-
secret:
|
|
694
|
-
data:
|
|
695
|
-
params:
|
|
830
|
+
var HandleTriggerSourceSchema = import_zod11.z.object({
|
|
831
|
+
key: import_zod11.z.string(),
|
|
832
|
+
secret: import_zod11.z.string(),
|
|
833
|
+
data: import_zod11.z.any(),
|
|
834
|
+
params: import_zod11.z.any(),
|
|
696
835
|
auth: ConnectionAuthSchema.optional(),
|
|
697
836
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
698
837
|
});
|
|
699
|
-
var HttpSourceRequestSchema =
|
|
700
|
-
url:
|
|
701
|
-
method:
|
|
702
|
-
headers:
|
|
703
|
-
rawBody:
|
|
704
|
-
});
|
|
705
|
-
var HttpSourceRequestHeadersSchema =
|
|
706
|
-
"x-ts-key":
|
|
707
|
-
"x-ts-dynamic-id":
|
|
708
|
-
"x-ts-secret":
|
|
709
|
-
"x-ts-data":
|
|
710
|
-
"x-ts-params":
|
|
711
|
-
"x-ts-http-url":
|
|
712
|
-
"x-ts-http-method":
|
|
713
|
-
"x-ts-http-headers":
|
|
714
|
-
"x-ts-auth":
|
|
838
|
+
var HttpSourceRequestSchema = import_zod11.z.object({
|
|
839
|
+
url: import_zod11.z.string().url(),
|
|
840
|
+
method: import_zod11.z.string(),
|
|
841
|
+
headers: import_zod11.z.record(import_zod11.z.string()),
|
|
842
|
+
rawBody: import_zod11.z.instanceof(Buffer).optional().nullable()
|
|
843
|
+
});
|
|
844
|
+
var HttpSourceRequestHeadersSchema = import_zod11.z.object({
|
|
845
|
+
"x-ts-key": import_zod11.z.string(),
|
|
846
|
+
"x-ts-dynamic-id": import_zod11.z.string().optional(),
|
|
847
|
+
"x-ts-secret": import_zod11.z.string(),
|
|
848
|
+
"x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
849
|
+
"x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
850
|
+
"x-ts-http-url": import_zod11.z.string(),
|
|
851
|
+
"x-ts-http-method": import_zod11.z.string(),
|
|
852
|
+
"x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
|
|
853
|
+
"x-ts-auth": import_zod11.z.string().optional().transform((s) => {
|
|
715
854
|
if (s === void 0)
|
|
716
855
|
return;
|
|
717
856
|
const json = JSON.parse(s);
|
|
718
857
|
return ConnectionAuthSchema.parse(json);
|
|
719
858
|
}),
|
|
720
|
-
"x-ts-metadata":
|
|
859
|
+
"x-ts-metadata": import_zod11.z.string().optional().transform((s) => {
|
|
721
860
|
if (s === void 0)
|
|
722
861
|
return;
|
|
723
862
|
const json = JSON.parse(s);
|
|
724
863
|
return DeserializedJsonSchema.parse(json);
|
|
725
864
|
})
|
|
726
865
|
});
|
|
727
|
-
var PongSuccessResponseSchema =
|
|
728
|
-
ok:
|
|
866
|
+
var PongSuccessResponseSchema = import_zod11.z.object({
|
|
867
|
+
ok: import_zod11.z.literal(true),
|
|
868
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
729
869
|
});
|
|
730
|
-
var PongErrorResponseSchema =
|
|
731
|
-
ok:
|
|
732
|
-
error:
|
|
870
|
+
var PongErrorResponseSchema = import_zod11.z.object({
|
|
871
|
+
ok: import_zod11.z.literal(false),
|
|
872
|
+
error: import_zod11.z.string(),
|
|
873
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
733
874
|
});
|
|
734
|
-
var PongResponseSchema =
|
|
875
|
+
var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
735
876
|
PongSuccessResponseSchema,
|
|
736
877
|
PongErrorResponseSchema
|
|
737
878
|
]);
|
|
738
|
-
var ValidateSuccessResponseSchema =
|
|
739
|
-
ok:
|
|
740
|
-
endpointId:
|
|
879
|
+
var ValidateSuccessResponseSchema = import_zod11.z.object({
|
|
880
|
+
ok: import_zod11.z.literal(true),
|
|
881
|
+
endpointId: import_zod11.z.string(),
|
|
882
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
741
883
|
});
|
|
742
|
-
var ValidateErrorResponseSchema =
|
|
743
|
-
ok:
|
|
744
|
-
error:
|
|
884
|
+
var ValidateErrorResponseSchema = import_zod11.z.object({
|
|
885
|
+
ok: import_zod11.z.literal(false),
|
|
886
|
+
error: import_zod11.z.string(),
|
|
887
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
745
888
|
});
|
|
746
|
-
var ValidateResponseSchema =
|
|
889
|
+
var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
747
890
|
ValidateSuccessResponseSchema,
|
|
748
891
|
ValidateErrorResponseSchema
|
|
749
892
|
]);
|
|
750
|
-
var QueueOptionsSchema =
|
|
751
|
-
name:
|
|
752
|
-
maxConcurrent:
|
|
753
|
-
});
|
|
754
|
-
var JobMetadataSchema =
|
|
755
|
-
id:
|
|
756
|
-
name:
|
|
757
|
-
version:
|
|
893
|
+
var QueueOptionsSchema = import_zod11.z.object({
|
|
894
|
+
name: import_zod11.z.string(),
|
|
895
|
+
maxConcurrent: import_zod11.z.number().optional()
|
|
896
|
+
});
|
|
897
|
+
var JobMetadataSchema = import_zod11.z.object({
|
|
898
|
+
id: import_zod11.z.string(),
|
|
899
|
+
name: import_zod11.z.string(),
|
|
900
|
+
version: import_zod11.z.string(),
|
|
758
901
|
event: EventSpecificationSchema,
|
|
759
902
|
trigger: TriggerMetadataSchema,
|
|
760
|
-
integrations:
|
|
761
|
-
internal:
|
|
762
|
-
enabled:
|
|
763
|
-
startPosition:
|
|
903
|
+
integrations: import_zod11.z.record(IntegrationConfigSchema),
|
|
904
|
+
internal: import_zod11.z.boolean().default(false),
|
|
905
|
+
enabled: import_zod11.z.boolean(),
|
|
906
|
+
startPosition: import_zod11.z.enum([
|
|
764
907
|
"initial",
|
|
765
908
|
"latest"
|
|
766
909
|
]),
|
|
767
|
-
preprocessRuns:
|
|
910
|
+
preprocessRuns: import_zod11.z.boolean()
|
|
768
911
|
});
|
|
769
|
-
var SourceMetadataV1Schema =
|
|
770
|
-
version:
|
|
771
|
-
channel:
|
|
912
|
+
var SourceMetadataV1Schema = import_zod11.z.object({
|
|
913
|
+
version: import_zod11.z.literal("1"),
|
|
914
|
+
channel: import_zod11.z.enum([
|
|
772
915
|
"HTTP",
|
|
773
916
|
"SQS",
|
|
774
917
|
"SMTP"
|
|
775
918
|
]),
|
|
776
919
|
integration: IntegrationConfigSchema,
|
|
777
|
-
key:
|
|
778
|
-
params:
|
|
779
|
-
events:
|
|
780
|
-
registerSourceJob:
|
|
781
|
-
id:
|
|
782
|
-
version:
|
|
920
|
+
key: import_zod11.z.string(),
|
|
921
|
+
params: import_zod11.z.any(),
|
|
922
|
+
events: import_zod11.z.array(import_zod11.z.string()),
|
|
923
|
+
registerSourceJob: import_zod11.z.object({
|
|
924
|
+
id: import_zod11.z.string(),
|
|
925
|
+
version: import_zod11.z.string()
|
|
783
926
|
}).optional()
|
|
784
927
|
});
|
|
785
|
-
var SourceMetadataV2Schema =
|
|
786
|
-
version:
|
|
787
|
-
channel:
|
|
928
|
+
var SourceMetadataV2Schema = import_zod11.z.object({
|
|
929
|
+
version: import_zod11.z.literal("2"),
|
|
930
|
+
channel: import_zod11.z.enum([
|
|
788
931
|
"HTTP",
|
|
789
932
|
"SQS",
|
|
790
933
|
"SMTP"
|
|
791
934
|
]),
|
|
792
935
|
integration: IntegrationConfigSchema,
|
|
793
|
-
key:
|
|
794
|
-
params:
|
|
795
|
-
options:
|
|
796
|
-
registerSourceJob:
|
|
797
|
-
id:
|
|
798
|
-
version:
|
|
936
|
+
key: import_zod11.z.string(),
|
|
937
|
+
params: import_zod11.z.any(),
|
|
938
|
+
options: import_zod11.z.record(import_zod11.z.array(import_zod11.z.string())),
|
|
939
|
+
registerSourceJob: import_zod11.z.object({
|
|
940
|
+
id: import_zod11.z.string(),
|
|
941
|
+
version: import_zod11.z.string()
|
|
799
942
|
}).optional()
|
|
800
943
|
});
|
|
801
|
-
var SourceMetadataSchema =
|
|
944
|
+
var SourceMetadataSchema = import_zod11.z.preprocess(addMissingVersionField, import_zod11.z.discriminatedUnion("version", [
|
|
802
945
|
SourceMetadataV1Schema,
|
|
803
946
|
SourceMetadataV2Schema
|
|
804
947
|
]));
|
|
805
|
-
var DynamicTriggerEndpointMetadataSchema =
|
|
806
|
-
id:
|
|
807
|
-
jobs:
|
|
948
|
+
var DynamicTriggerEndpointMetadataSchema = import_zod11.z.object({
|
|
949
|
+
id: import_zod11.z.string(),
|
|
950
|
+
jobs: import_zod11.z.array(JobMetadataSchema.pick({
|
|
808
951
|
id: true,
|
|
809
952
|
version: true
|
|
810
953
|
})),
|
|
811
|
-
registerSourceJob:
|
|
812
|
-
id:
|
|
813
|
-
version:
|
|
954
|
+
registerSourceJob: import_zod11.z.object({
|
|
955
|
+
id: import_zod11.z.string(),
|
|
956
|
+
version: import_zod11.z.string()
|
|
814
957
|
}).optional()
|
|
815
958
|
});
|
|
816
|
-
var IndexEndpointResponseSchema =
|
|
817
|
-
jobs:
|
|
818
|
-
sources:
|
|
819
|
-
dynamicTriggers:
|
|
820
|
-
dynamicSchedules:
|
|
959
|
+
var IndexEndpointResponseSchema = import_zod11.z.object({
|
|
960
|
+
jobs: import_zod11.z.array(JobMetadataSchema),
|
|
961
|
+
sources: import_zod11.z.array(SourceMetadataSchema),
|
|
962
|
+
dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
963
|
+
dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
|
|
964
|
+
});
|
|
965
|
+
var EndpointHeadersSchema = import_zod11.z.object({
|
|
966
|
+
"trigger-version": import_zod11.z.string().optional()
|
|
821
967
|
});
|
|
822
|
-
var RawEventSchema =
|
|
968
|
+
var RawEventSchema = import_zod11.z.object({
|
|
823
969
|
/** The `name` property must exactly match any subscriptions you want to
|
|
824
970
|
trigger. */
|
|
825
|
-
name:
|
|
971
|
+
name: import_zod11.z.string(),
|
|
826
972
|
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
827
973
|
as the `payload` param of the `run()` function. You can leave this
|
|
828
974
|
parameter out if you just want to trigger a Job without any input data. */
|
|
829
|
-
payload:
|
|
975
|
+
payload: import_zod11.z.any(),
|
|
830
976
|
/** The optional `context` property will be sent to any matching Jobs and will
|
|
831
977
|
be passed through as the `context.event.context` param of the `run()`
|
|
832
978
|
function. This is optional but can be useful if you want to pass through
|
|
833
979
|
some additional context to the Job. */
|
|
834
|
-
context:
|
|
980
|
+
context: import_zod11.z.any().optional(),
|
|
835
981
|
/** The `id` property uniquely identify this particular event. If unset it
|
|
836
982
|
will be set automatically using `ulid`. */
|
|
837
|
-
id:
|
|
983
|
+
id: import_zod11.z.string().default(() => (0, import_ulid.ulid)()),
|
|
838
984
|
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
839
985
|
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
840
986
|
you receive a timestamp from a service and you want the same timestamp to
|
|
841
987
|
be used in your Job. */
|
|
842
|
-
timestamp:
|
|
988
|
+
timestamp: import_zod11.z.coerce.date().optional(),
|
|
843
989
|
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
844
990
|
this as you can filter events using this in the `eventTrigger()`. */
|
|
845
|
-
source:
|
|
991
|
+
source: import_zod11.z.string().optional()
|
|
846
992
|
});
|
|
847
|
-
var ApiEventLogSchema =
|
|
993
|
+
var ApiEventLogSchema = import_zod11.z.object({
|
|
848
994
|
/** The `id` of the event that was sent.
|
|
849
995
|
*/
|
|
850
|
-
id:
|
|
996
|
+
id: import_zod11.z.string(),
|
|
851
997
|
/** The `name` of the event that was sent. */
|
|
852
|
-
name:
|
|
998
|
+
name: import_zod11.z.string(),
|
|
853
999
|
/** The `payload` of the event that was sent */
|
|
854
1000
|
payload: DeserializedJsonSchema,
|
|
855
1001
|
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
856
1002
|
set when sending the event. */
|
|
857
1003
|
context: DeserializedJsonSchema.optional().nullable(),
|
|
858
1004
|
/** The `timestamp` of the event that was sent */
|
|
859
|
-
timestamp:
|
|
1005
|
+
timestamp: import_zod11.z.coerce.date(),
|
|
860
1006
|
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
861
1007
|
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
862
1008
|
event. */
|
|
863
|
-
deliverAt:
|
|
1009
|
+
deliverAt: import_zod11.z.coerce.date().optional().nullable(),
|
|
864
1010
|
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
865
1011
|
or `deliverAfter` were set when sending the event. */
|
|
866
|
-
deliveredAt:
|
|
1012
|
+
deliveredAt: import_zod11.z.coerce.date().optional().nullable(),
|
|
867
1013
|
/** The timestamp when the event was cancelled. Is `undefined` if the event
|
|
868
1014
|
* wasn't cancelled. */
|
|
869
|
-
cancelledAt:
|
|
1015
|
+
cancelledAt: import_zod11.z.coerce.date().optional().nullable()
|
|
870
1016
|
});
|
|
871
|
-
var SendEventOptionsSchema =
|
|
1017
|
+
var SendEventOptionsSchema = import_zod11.z.object({
|
|
872
1018
|
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
873
1019
|
be sent to the platform immediately but won't be acted upon until the
|
|
874
1020
|
specified time. */
|
|
875
|
-
deliverAt:
|
|
1021
|
+
deliverAt: import_zod11.z.coerce.date().optional(),
|
|
876
1022
|
/** An optional number of seconds you want to wait for the event to trigger
|
|
877
1023
|
any relevant Jobs. The event will be sent to the platform immediately but
|
|
878
1024
|
won't be delivered until after the elapsed number of seconds. */
|
|
879
|
-
deliverAfter:
|
|
1025
|
+
deliverAfter: import_zod11.z.number().int().optional(),
|
|
880
1026
|
/** This optional param will be used by Trigger.dev Connect, which
|
|
881
1027
|
is coming soon. */
|
|
882
|
-
accountId:
|
|
1028
|
+
accountId: import_zod11.z.string().optional()
|
|
883
1029
|
});
|
|
884
|
-
var SendEventBodySchema =
|
|
1030
|
+
var SendEventBodySchema = import_zod11.z.object({
|
|
885
1031
|
event: RawEventSchema,
|
|
886
1032
|
options: SendEventOptionsSchema.optional()
|
|
887
1033
|
});
|
|
888
|
-
var DeliverEventResponseSchema =
|
|
889
|
-
deliveredAt:
|
|
1034
|
+
var DeliverEventResponseSchema = import_zod11.z.object({
|
|
1035
|
+
deliveredAt: import_zod11.z.string().datetime()
|
|
890
1036
|
});
|
|
891
|
-
var RuntimeEnvironmentTypeSchema =
|
|
1037
|
+
var RuntimeEnvironmentTypeSchema = import_zod11.z.enum([
|
|
892
1038
|
"PRODUCTION",
|
|
893
1039
|
"STAGING",
|
|
894
1040
|
"DEVELOPMENT",
|
|
895
1041
|
"PREVIEW"
|
|
896
1042
|
]);
|
|
897
|
-
var RunSourceContextSchema =
|
|
898
|
-
id:
|
|
899
|
-
metadata:
|
|
1043
|
+
var RunSourceContextSchema = import_zod11.z.object({
|
|
1044
|
+
id: import_zod11.z.string(),
|
|
1045
|
+
metadata: import_zod11.z.any()
|
|
900
1046
|
});
|
|
901
|
-
var RunJobBodySchema =
|
|
1047
|
+
var RunJobBodySchema = import_zod11.z.object({
|
|
902
1048
|
event: ApiEventLogSchema,
|
|
903
|
-
job:
|
|
904
|
-
id:
|
|
905
|
-
version:
|
|
1049
|
+
job: import_zod11.z.object({
|
|
1050
|
+
id: import_zod11.z.string(),
|
|
1051
|
+
version: import_zod11.z.string()
|
|
906
1052
|
}),
|
|
907
|
-
run:
|
|
908
|
-
id:
|
|
909
|
-
isTest:
|
|
910
|
-
isRetry:
|
|
911
|
-
startedAt:
|
|
1053
|
+
run: import_zod11.z.object({
|
|
1054
|
+
id: import_zod11.z.string(),
|
|
1055
|
+
isTest: import_zod11.z.boolean(),
|
|
1056
|
+
isRetry: import_zod11.z.boolean().default(false),
|
|
1057
|
+
startedAt: import_zod11.z.coerce.date()
|
|
912
1058
|
}),
|
|
913
|
-
environment:
|
|
914
|
-
id:
|
|
915
|
-
slug:
|
|
1059
|
+
environment: import_zod11.z.object({
|
|
1060
|
+
id: import_zod11.z.string(),
|
|
1061
|
+
slug: import_zod11.z.string(),
|
|
916
1062
|
type: RuntimeEnvironmentTypeSchema
|
|
917
1063
|
}),
|
|
918
|
-
organization:
|
|
919
|
-
id:
|
|
920
|
-
title:
|
|
921
|
-
slug:
|
|
1064
|
+
organization: import_zod11.z.object({
|
|
1065
|
+
id: import_zod11.z.string(),
|
|
1066
|
+
title: import_zod11.z.string(),
|
|
1067
|
+
slug: import_zod11.z.string()
|
|
922
1068
|
}),
|
|
923
|
-
account:
|
|
924
|
-
id:
|
|
925
|
-
metadata:
|
|
1069
|
+
account: import_zod11.z.object({
|
|
1070
|
+
id: import_zod11.z.string(),
|
|
1071
|
+
metadata: import_zod11.z.any()
|
|
926
1072
|
}).optional(),
|
|
927
1073
|
source: RunSourceContextSchema.optional(),
|
|
928
|
-
tasks:
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1074
|
+
tasks: import_zod11.z.array(CachedTaskSchema).optional(),
|
|
1075
|
+
cachedTaskCursor: import_zod11.z.string().optional(),
|
|
1076
|
+
noopTasksSet: import_zod11.z.string().optional(),
|
|
1077
|
+
connections: import_zod11.z.record(ConnectionAuthSchema).optional(),
|
|
1078
|
+
yieldedExecutions: import_zod11.z.string().array().optional()
|
|
1079
|
+
});
|
|
1080
|
+
var RunJobErrorSchema = import_zod11.z.object({
|
|
1081
|
+
status: import_zod11.z.literal("ERROR"),
|
|
933
1082
|
error: ErrorWithStackSchema,
|
|
934
1083
|
task: TaskSchema.optional()
|
|
935
1084
|
});
|
|
936
|
-
var
|
|
937
|
-
status:
|
|
1085
|
+
var RunJobYieldExecutionErrorSchema = import_zod11.z.object({
|
|
1086
|
+
status: import_zod11.z.literal("YIELD_EXECUTION"),
|
|
1087
|
+
key: import_zod11.z.string()
|
|
1088
|
+
});
|
|
1089
|
+
var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({
|
|
1090
|
+
status: import_zod11.z.literal("INVALID_PAYLOAD"),
|
|
1091
|
+
errors: import_zod11.z.array(SchemaErrorSchema)
|
|
1092
|
+
});
|
|
1093
|
+
var RunJobUnresolvedAuthErrorSchema = import_zod11.z.object({
|
|
1094
|
+
status: import_zod11.z.literal("UNRESOLVED_AUTH_ERROR"),
|
|
1095
|
+
issues: import_zod11.z.record(import_zod11.z.object({
|
|
1096
|
+
id: import_zod11.z.string(),
|
|
1097
|
+
error: import_zod11.z.string()
|
|
1098
|
+
}))
|
|
1099
|
+
});
|
|
1100
|
+
var RunJobResumeWithTaskSchema = import_zod11.z.object({
|
|
1101
|
+
status: import_zod11.z.literal("RESUME_WITH_TASK"),
|
|
938
1102
|
task: TaskSchema
|
|
939
1103
|
});
|
|
940
|
-
var RunJobRetryWithTaskSchema =
|
|
941
|
-
status:
|
|
1104
|
+
var RunJobRetryWithTaskSchema = import_zod11.z.object({
|
|
1105
|
+
status: import_zod11.z.literal("RETRY_WITH_TASK"),
|
|
942
1106
|
task: TaskSchema,
|
|
943
1107
|
error: ErrorWithStackSchema,
|
|
944
|
-
retryAt:
|
|
1108
|
+
retryAt: import_zod11.z.coerce.date()
|
|
945
1109
|
});
|
|
946
|
-
var RunJobCanceledWithTaskSchema =
|
|
947
|
-
status:
|
|
1110
|
+
var RunJobCanceledWithTaskSchema = import_zod11.z.object({
|
|
1111
|
+
status: import_zod11.z.literal("CANCELED"),
|
|
948
1112
|
task: TaskSchema
|
|
949
1113
|
});
|
|
950
|
-
var RunJobSuccessSchema =
|
|
951
|
-
status:
|
|
1114
|
+
var RunJobSuccessSchema = import_zod11.z.object({
|
|
1115
|
+
status: import_zod11.z.literal("SUCCESS"),
|
|
952
1116
|
output: DeserializedJsonSchema.optional()
|
|
953
1117
|
});
|
|
954
|
-
var RunJobResponseSchema =
|
|
1118
|
+
var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
1119
|
+
RunJobYieldExecutionErrorSchema,
|
|
955
1120
|
RunJobErrorSchema,
|
|
1121
|
+
RunJobUnresolvedAuthErrorSchema,
|
|
1122
|
+
RunJobInvalidPayloadErrorSchema,
|
|
956
1123
|
RunJobResumeWithTaskSchema,
|
|
957
1124
|
RunJobRetryWithTaskSchema,
|
|
958
1125
|
RunJobCanceledWithTaskSchema,
|
|
959
1126
|
RunJobSuccessSchema
|
|
960
1127
|
]);
|
|
961
|
-
var PreprocessRunBodySchema =
|
|
1128
|
+
var PreprocessRunBodySchema = import_zod11.z.object({
|
|
962
1129
|
event: ApiEventLogSchema,
|
|
963
|
-
job:
|
|
964
|
-
id:
|
|
965
|
-
version:
|
|
1130
|
+
job: import_zod11.z.object({
|
|
1131
|
+
id: import_zod11.z.string(),
|
|
1132
|
+
version: import_zod11.z.string()
|
|
966
1133
|
}),
|
|
967
|
-
run:
|
|
968
|
-
id:
|
|
969
|
-
isTest:
|
|
1134
|
+
run: import_zod11.z.object({
|
|
1135
|
+
id: import_zod11.z.string(),
|
|
1136
|
+
isTest: import_zod11.z.boolean()
|
|
970
1137
|
}),
|
|
971
|
-
environment:
|
|
972
|
-
id:
|
|
973
|
-
slug:
|
|
1138
|
+
environment: import_zod11.z.object({
|
|
1139
|
+
id: import_zod11.z.string(),
|
|
1140
|
+
slug: import_zod11.z.string(),
|
|
974
1141
|
type: RuntimeEnvironmentTypeSchema
|
|
975
1142
|
}),
|
|
976
|
-
organization:
|
|
977
|
-
id:
|
|
978
|
-
title:
|
|
979
|
-
slug:
|
|
1143
|
+
organization: import_zod11.z.object({
|
|
1144
|
+
id: import_zod11.z.string(),
|
|
1145
|
+
title: import_zod11.z.string(),
|
|
1146
|
+
slug: import_zod11.z.string()
|
|
980
1147
|
}),
|
|
981
|
-
account:
|
|
982
|
-
id:
|
|
983
|
-
metadata:
|
|
1148
|
+
account: import_zod11.z.object({
|
|
1149
|
+
id: import_zod11.z.string(),
|
|
1150
|
+
metadata: import_zod11.z.any()
|
|
984
1151
|
}).optional()
|
|
985
1152
|
});
|
|
986
|
-
var PreprocessRunResponseSchema =
|
|
987
|
-
abort:
|
|
988
|
-
properties:
|
|
1153
|
+
var PreprocessRunResponseSchema = import_zod11.z.object({
|
|
1154
|
+
abort: import_zod11.z.boolean(),
|
|
1155
|
+
properties: import_zod11.z.array(DisplayPropertySchema).optional()
|
|
989
1156
|
});
|
|
990
|
-
var CreateRunResponseOkSchema =
|
|
991
|
-
ok:
|
|
992
|
-
data:
|
|
993
|
-
id:
|
|
1157
|
+
var CreateRunResponseOkSchema = import_zod11.z.object({
|
|
1158
|
+
ok: import_zod11.z.literal(true),
|
|
1159
|
+
data: import_zod11.z.object({
|
|
1160
|
+
id: import_zod11.z.string()
|
|
994
1161
|
})
|
|
995
1162
|
});
|
|
996
|
-
var CreateRunResponseErrorSchema =
|
|
997
|
-
ok:
|
|
998
|
-
error:
|
|
1163
|
+
var CreateRunResponseErrorSchema = import_zod11.z.object({
|
|
1164
|
+
ok: import_zod11.z.literal(false),
|
|
1165
|
+
error: import_zod11.z.string()
|
|
999
1166
|
});
|
|
1000
|
-
var CreateRunResponseBodySchema =
|
|
1167
|
+
var CreateRunResponseBodySchema = import_zod11.z.discriminatedUnion("ok", [
|
|
1001
1168
|
CreateRunResponseOkSchema,
|
|
1002
1169
|
CreateRunResponseErrorSchema
|
|
1003
1170
|
]);
|
|
1004
|
-
var RedactStringSchema =
|
|
1005
|
-
__redactedString:
|
|
1006
|
-
strings:
|
|
1007
|
-
interpolations:
|
|
1171
|
+
var RedactStringSchema = import_zod11.z.object({
|
|
1172
|
+
__redactedString: import_zod11.z.literal(true),
|
|
1173
|
+
strings: import_zod11.z.array(import_zod11.z.string()),
|
|
1174
|
+
interpolations: import_zod11.z.array(import_zod11.z.string())
|
|
1008
1175
|
});
|
|
1009
|
-
var LogMessageSchema =
|
|
1010
|
-
level:
|
|
1176
|
+
var LogMessageSchema = import_zod11.z.object({
|
|
1177
|
+
level: import_zod11.z.enum([
|
|
1011
1178
|
"DEBUG",
|
|
1012
1179
|
"INFO",
|
|
1013
1180
|
"WARN",
|
|
1014
1181
|
"ERROR"
|
|
1015
1182
|
]),
|
|
1016
|
-
message:
|
|
1183
|
+
message: import_zod11.z.string(),
|
|
1017
1184
|
data: SerializableJsonSchema.optional()
|
|
1018
1185
|
});
|
|
1019
|
-
var RedactSchema =
|
|
1020
|
-
paths:
|
|
1186
|
+
var RedactSchema = import_zod11.z.object({
|
|
1187
|
+
paths: import_zod11.z.array(import_zod11.z.string())
|
|
1021
1188
|
});
|
|
1022
|
-
var RetryOptionsSchema =
|
|
1189
|
+
var RetryOptionsSchema = import_zod11.z.object({
|
|
1023
1190
|
/** The maximum number of times to retry the request. */
|
|
1024
|
-
limit:
|
|
1191
|
+
limit: import_zod11.z.number().optional(),
|
|
1025
1192
|
/** The exponential factor to use when calculating the next retry time. */
|
|
1026
|
-
factor:
|
|
1193
|
+
factor: import_zod11.z.number().optional(),
|
|
1027
1194
|
/** The minimum amount of time to wait before retrying the request. */
|
|
1028
|
-
minTimeoutInMs:
|
|
1195
|
+
minTimeoutInMs: import_zod11.z.number().optional(),
|
|
1029
1196
|
/** The maximum amount of time to wait before retrying the request. */
|
|
1030
|
-
maxTimeoutInMs:
|
|
1197
|
+
maxTimeoutInMs: import_zod11.z.number().optional(),
|
|
1031
1198
|
/** Whether to randomize the retry time. */
|
|
1032
|
-
randomize:
|
|
1199
|
+
randomize: import_zod11.z.boolean().optional()
|
|
1033
1200
|
});
|
|
1034
|
-
var RunTaskOptionsSchema =
|
|
1201
|
+
var RunTaskOptionsSchema = import_zod11.z.object({
|
|
1035
1202
|
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1036
|
-
name:
|
|
1203
|
+
name: import_zod11.z.string().optional(),
|
|
1037
1204
|
/** The Task will wait and only start at the specified Date */
|
|
1038
|
-
delayUntil:
|
|
1205
|
+
delayUntil: import_zod11.z.coerce.date().optional(),
|
|
1039
1206
|
/** Retry options */
|
|
1040
1207
|
retry: RetryOptionsSchema.optional(),
|
|
1041
1208
|
/** The icon for the Task, it will appear in the logs.
|
|
1042
1209
|
* You can use the name of a company in lowercase, e.g. "github".
|
|
1043
1210
|
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
1044
|
-
icon:
|
|
1211
|
+
icon: import_zod11.z.string().optional(),
|
|
1045
1212
|
/** The key for the Task that you want to appear in the logs */
|
|
1046
|
-
displayKey:
|
|
1213
|
+
displayKey: import_zod11.z.string().optional(),
|
|
1047
1214
|
/** A description of the Task */
|
|
1048
|
-
description:
|
|
1215
|
+
description: import_zod11.z.string().optional(),
|
|
1049
1216
|
/** Properties that are displayed in the logs */
|
|
1050
|
-
properties:
|
|
1217
|
+
properties: import_zod11.z.array(DisplayPropertySchema).optional(),
|
|
1051
1218
|
/** The input params to the Task, will be displayed in the logs */
|
|
1052
|
-
params:
|
|
1219
|
+
params: import_zod11.z.any(),
|
|
1053
1220
|
/** The style of the log entry. */
|
|
1054
1221
|
style: StyleSchema.optional(),
|
|
1222
|
+
/** Allows you to expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */
|
|
1223
|
+
callback: import_zod11.z.object({
|
|
1224
|
+
/** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
|
|
1225
|
+
enabled: import_zod11.z.boolean(),
|
|
1226
|
+
/** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
|
|
1227
|
+
timeoutInSeconds: import_zod11.z.number()
|
|
1228
|
+
}).partial().optional(),
|
|
1055
1229
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1056
|
-
connectionKey:
|
|
1230
|
+
connectionKey: import_zod11.z.string().optional(),
|
|
1057
1231
|
/** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
1058
|
-
operation:
|
|
1232
|
+
operation: import_zod11.z.enum([
|
|
1059
1233
|
"fetch"
|
|
1060
1234
|
]).optional(),
|
|
1061
1235
|
/** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
|
|
1062
|
-
noop:
|
|
1236
|
+
noop: import_zod11.z.boolean().default(false),
|
|
1063
1237
|
redact: RedactSchema.optional(),
|
|
1064
1238
|
trigger: TriggerMetadataSchema.optional()
|
|
1065
1239
|
});
|
|
1066
1240
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
1067
|
-
idempotencyKey:
|
|
1068
|
-
parentId:
|
|
1241
|
+
idempotencyKey: import_zod11.z.string(),
|
|
1242
|
+
parentId: import_zod11.z.string().optional()
|
|
1069
1243
|
});
|
|
1070
1244
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1071
|
-
params: DeserializedJsonSchema.optional().nullable()
|
|
1245
|
+
params: DeserializedJsonSchema.optional().nullable(),
|
|
1246
|
+
callback: import_zod11.z.object({
|
|
1247
|
+
enabled: import_zod11.z.boolean(),
|
|
1248
|
+
timeoutInSeconds: import_zod11.z.number().default(3600)
|
|
1249
|
+
}).optional()
|
|
1250
|
+
});
|
|
1251
|
+
var RunTaskResponseWithCachedTasksBodySchema = import_zod11.z.object({
|
|
1252
|
+
task: ServerTaskSchema,
|
|
1253
|
+
cachedTasks: import_zod11.z.object({
|
|
1254
|
+
tasks: import_zod11.z.array(CachedTaskSchema),
|
|
1255
|
+
cursor: import_zod11.z.string().optional()
|
|
1256
|
+
}).optional()
|
|
1072
1257
|
});
|
|
1073
1258
|
var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
1074
1259
|
properties: true,
|
|
@@ -1077,270 +1262,197 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
|
1077
1262
|
}).extend({
|
|
1078
1263
|
output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
|
|
1079
1264
|
});
|
|
1080
|
-
var FailTaskBodyInputSchema =
|
|
1265
|
+
var FailTaskBodyInputSchema = import_zod11.z.object({
|
|
1081
1266
|
error: ErrorWithStackSchema
|
|
1082
1267
|
});
|
|
1083
|
-
var NormalizedRequestSchema =
|
|
1084
|
-
headers:
|
|
1085
|
-
method:
|
|
1086
|
-
query:
|
|
1087
|
-
url:
|
|
1088
|
-
body:
|
|
1268
|
+
var NormalizedRequestSchema = import_zod11.z.object({
|
|
1269
|
+
headers: import_zod11.z.record(import_zod11.z.string()),
|
|
1270
|
+
method: import_zod11.z.string(),
|
|
1271
|
+
query: import_zod11.z.record(import_zod11.z.string()),
|
|
1272
|
+
url: import_zod11.z.string(),
|
|
1273
|
+
body: import_zod11.z.any()
|
|
1089
1274
|
});
|
|
1090
|
-
var NormalizedResponseSchema =
|
|
1091
|
-
status:
|
|
1092
|
-
body:
|
|
1093
|
-
headers:
|
|
1275
|
+
var NormalizedResponseSchema = import_zod11.z.object({
|
|
1276
|
+
status: import_zod11.z.number(),
|
|
1277
|
+
body: import_zod11.z.any(),
|
|
1278
|
+
headers: import_zod11.z.record(import_zod11.z.string()).optional()
|
|
1094
1279
|
});
|
|
1095
|
-
var HttpSourceResponseSchema =
|
|
1280
|
+
var HttpSourceResponseSchema = import_zod11.z.object({
|
|
1096
1281
|
response: NormalizedResponseSchema,
|
|
1097
|
-
events:
|
|
1282
|
+
events: import_zod11.z.array(RawEventSchema),
|
|
1098
1283
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
1099
1284
|
});
|
|
1100
|
-
var RegisterTriggerBodySchemaV1 =
|
|
1285
|
+
var RegisterTriggerBodySchemaV1 = import_zod11.z.object({
|
|
1101
1286
|
rule: EventRuleSchema,
|
|
1102
1287
|
source: SourceMetadataV1Schema
|
|
1103
1288
|
});
|
|
1104
|
-
var RegisterTriggerBodySchemaV2 =
|
|
1289
|
+
var RegisterTriggerBodySchemaV2 = import_zod11.z.object({
|
|
1105
1290
|
rule: EventRuleSchema,
|
|
1106
|
-
source: SourceMetadataV2Schema
|
|
1291
|
+
source: SourceMetadataV2Schema,
|
|
1292
|
+
accountId: import_zod11.z.string().optional()
|
|
1107
1293
|
});
|
|
1108
|
-
var InitializeTriggerBodySchema =
|
|
1109
|
-
id:
|
|
1110
|
-
params:
|
|
1111
|
-
accountId:
|
|
1112
|
-
metadata:
|
|
1294
|
+
var InitializeTriggerBodySchema = import_zod11.z.object({
|
|
1295
|
+
id: import_zod11.z.string(),
|
|
1296
|
+
params: import_zod11.z.any(),
|
|
1297
|
+
accountId: import_zod11.z.string().optional(),
|
|
1298
|
+
metadata: import_zod11.z.any().optional()
|
|
1113
1299
|
});
|
|
1114
|
-
var RegisterCommonScheduleBodySchema =
|
|
1300
|
+
var RegisterCommonScheduleBodySchema = import_zod11.z.object({
|
|
1115
1301
|
/** A unique id for the schedule. This is used to identify and unregister the schedule later. */
|
|
1116
|
-
id:
|
|
1302
|
+
id: import_zod11.z.string(),
|
|
1117
1303
|
/** Any additional metadata about the schedule. */
|
|
1118
|
-
metadata:
|
|
1119
|
-
/**
|
|
1120
|
-
accountId:
|
|
1304
|
+
metadata: import_zod11.z.any(),
|
|
1305
|
+
/** An optional Account ID to associate with runs triggered by this schedule */
|
|
1306
|
+
accountId: import_zod11.z.string().optional()
|
|
1121
1307
|
});
|
|
1122
1308
|
var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
|
|
1123
1309
|
var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
|
|
1124
|
-
var RegisterScheduleBodySchema =
|
|
1310
|
+
var RegisterScheduleBodySchema = import_zod11.z.discriminatedUnion("type", [
|
|
1125
1311
|
RegisterIntervalScheduleBodySchema,
|
|
1126
1312
|
InitializeCronScheduleBodySchema
|
|
1127
1313
|
]);
|
|
1128
|
-
var RegisterScheduleResponseBodySchema =
|
|
1129
|
-
id:
|
|
1314
|
+
var RegisterScheduleResponseBodySchema = import_zod11.z.object({
|
|
1315
|
+
id: import_zod11.z.string(),
|
|
1130
1316
|
schedule: ScheduleMetadataSchema,
|
|
1131
|
-
metadata:
|
|
1132
|
-
active:
|
|
1317
|
+
metadata: import_zod11.z.any(),
|
|
1318
|
+
active: import_zod11.z.boolean()
|
|
1133
1319
|
});
|
|
1134
|
-
var CreateExternalConnectionBodySchema =
|
|
1135
|
-
accessToken:
|
|
1136
|
-
type:
|
|
1320
|
+
var CreateExternalConnectionBodySchema = import_zod11.z.object({
|
|
1321
|
+
accessToken: import_zod11.z.string(),
|
|
1322
|
+
type: import_zod11.z.enum([
|
|
1137
1323
|
"oauth2"
|
|
1138
1324
|
]),
|
|
1139
|
-
scopes:
|
|
1140
|
-
metadata:
|
|
1325
|
+
scopes: import_zod11.z.array(import_zod11.z.string()).optional(),
|
|
1326
|
+
metadata: import_zod11.z.any()
|
|
1327
|
+
});
|
|
1328
|
+
var GetRunStatusesSchema = import_zod11.z.object({
|
|
1329
|
+
run: import_zod11.z.object({
|
|
1330
|
+
id: import_zod11.z.string(),
|
|
1331
|
+
status: RunStatusSchema,
|
|
1332
|
+
output: import_zod11.z.any().optional()
|
|
1333
|
+
}),
|
|
1334
|
+
statuses: import_zod11.z.array(JobRunStatusRecordSchema)
|
|
1141
1335
|
});
|
|
1142
1336
|
|
|
1143
1337
|
// src/schemas/notifications.ts
|
|
1144
|
-
var
|
|
1338
|
+
var import_zod12 = require("zod");
|
|
1145
1339
|
var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
|
|
1146
1340
|
var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
|
|
1147
|
-
var CommonMissingConnectionNotificationPayloadSchema =
|
|
1148
|
-
id:
|
|
1149
|
-
client:
|
|
1150
|
-
id:
|
|
1151
|
-
title:
|
|
1152
|
-
scopes:
|
|
1153
|
-
createdAt:
|
|
1154
|
-
updatedAt:
|
|
1341
|
+
var CommonMissingConnectionNotificationPayloadSchema = import_zod12.z.object({
|
|
1342
|
+
id: import_zod12.z.string(),
|
|
1343
|
+
client: import_zod12.z.object({
|
|
1344
|
+
id: import_zod12.z.string(),
|
|
1345
|
+
title: import_zod12.z.string(),
|
|
1346
|
+
scopes: import_zod12.z.array(import_zod12.z.string()),
|
|
1347
|
+
createdAt: import_zod12.z.coerce.date(),
|
|
1348
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1155
1349
|
}),
|
|
1156
|
-
authorizationUrl:
|
|
1350
|
+
authorizationUrl: import_zod12.z.string()
|
|
1157
1351
|
});
|
|
1158
1352
|
var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1159
|
-
type:
|
|
1353
|
+
type: import_zod12.z.literal("DEVELOPER")
|
|
1160
1354
|
});
|
|
1161
1355
|
var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1162
|
-
type:
|
|
1163
|
-
account:
|
|
1164
|
-
id:
|
|
1165
|
-
metadata:
|
|
1356
|
+
type: import_zod12.z.literal("EXTERNAL"),
|
|
1357
|
+
account: import_zod12.z.object({
|
|
1358
|
+
id: import_zod12.z.string(),
|
|
1359
|
+
metadata: import_zod12.z.any()
|
|
1166
1360
|
})
|
|
1167
1361
|
});
|
|
1168
|
-
var MissingConnectionNotificationPayloadSchema =
|
|
1362
|
+
var MissingConnectionNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
|
|
1169
1363
|
MissingDeveloperConnectionNotificationPayloadSchema,
|
|
1170
1364
|
MissingExternalConnectionNotificationPayloadSchema
|
|
1171
1365
|
]);
|
|
1172
|
-
var CommonMissingConnectionNotificationResolvedPayloadSchema =
|
|
1173
|
-
id:
|
|
1174
|
-
client:
|
|
1175
|
-
id:
|
|
1176
|
-
title:
|
|
1177
|
-
scopes:
|
|
1178
|
-
createdAt:
|
|
1179
|
-
updatedAt:
|
|
1180
|
-
integrationIdentifier:
|
|
1181
|
-
integrationAuthMethod:
|
|
1366
|
+
var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod12.z.object({
|
|
1367
|
+
id: import_zod12.z.string(),
|
|
1368
|
+
client: import_zod12.z.object({
|
|
1369
|
+
id: import_zod12.z.string(),
|
|
1370
|
+
title: import_zod12.z.string(),
|
|
1371
|
+
scopes: import_zod12.z.array(import_zod12.z.string()),
|
|
1372
|
+
createdAt: import_zod12.z.coerce.date(),
|
|
1373
|
+
updatedAt: import_zod12.z.coerce.date(),
|
|
1374
|
+
integrationIdentifier: import_zod12.z.string(),
|
|
1375
|
+
integrationAuthMethod: import_zod12.z.string()
|
|
1182
1376
|
}),
|
|
1183
|
-
expiresAt:
|
|
1377
|
+
expiresAt: import_zod12.z.coerce.date()
|
|
1184
1378
|
});
|
|
1185
1379
|
var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1186
|
-
type:
|
|
1380
|
+
type: import_zod12.z.literal("DEVELOPER")
|
|
1187
1381
|
});
|
|
1188
1382
|
var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1189
|
-
type:
|
|
1190
|
-
account:
|
|
1191
|
-
id:
|
|
1192
|
-
metadata:
|
|
1383
|
+
type: import_zod12.z.literal("EXTERNAL"),
|
|
1384
|
+
account: import_zod12.z.object({
|
|
1385
|
+
id: import_zod12.z.string(),
|
|
1386
|
+
metadata: import_zod12.z.any()
|
|
1193
1387
|
})
|
|
1194
1388
|
});
|
|
1195
|
-
var MissingConnectionResolvedNotificationPayloadSchema =
|
|
1389
|
+
var MissingConnectionResolvedNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
|
|
1196
1390
|
MissingDeveloperConnectionResolvedNotificationPayloadSchema,
|
|
1197
1391
|
MissingExternalConnectionResolvedNotificationPayloadSchema
|
|
1198
1392
|
]);
|
|
1199
1393
|
|
|
1200
1394
|
// src/schemas/fetch.ts
|
|
1201
|
-
var
|
|
1202
|
-
var FetchRetryHeadersStrategySchema =
|
|
1395
|
+
var import_zod13 = require("zod");
|
|
1396
|
+
var FetchRetryHeadersStrategySchema = import_zod13.z.object({
|
|
1203
1397
|
/** The `headers` strategy retries the request using info from the response headers. */
|
|
1204
|
-
strategy:
|
|
1398
|
+
strategy: import_zod13.z.literal("headers"),
|
|
1205
1399
|
/** The header to use to determine the maximum number of times to retry the request. */
|
|
1206
|
-
limitHeader:
|
|
1400
|
+
limitHeader: import_zod13.z.string(),
|
|
1207
1401
|
/** The header to use to determine the number of remaining retries. */
|
|
1208
|
-
remainingHeader:
|
|
1402
|
+
remainingHeader: import_zod13.z.string(),
|
|
1209
1403
|
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
1210
|
-
resetHeader:
|
|
1404
|
+
resetHeader: import_zod13.z.string()
|
|
1211
1405
|
});
|
|
1212
1406
|
var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
|
|
1213
1407
|
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
1214
|
-
strategy:
|
|
1408
|
+
strategy: import_zod13.z.literal("backoff")
|
|
1215
1409
|
});
|
|
1216
|
-
var FetchRetryStrategySchema =
|
|
1410
|
+
var FetchRetryStrategySchema = import_zod13.z.discriminatedUnion("strategy", [
|
|
1217
1411
|
FetchRetryHeadersStrategySchema,
|
|
1218
1412
|
FetchRetryBackoffStrategySchema
|
|
1219
1413
|
]);
|
|
1220
|
-
var FetchRequestInitSchema =
|
|
1414
|
+
var FetchRequestInitSchema = import_zod13.z.object({
|
|
1221
1415
|
/** The HTTP method to use for the request. */
|
|
1222
|
-
method:
|
|
1416
|
+
method: import_zod13.z.string().optional(),
|
|
1223
1417
|
/** Any headers to send with the request. Note that you can use [redactString](https://trigger.dev/docs/sdk/redactString) to prevent sensitive information from being stored (e.g. in the logs), like API keys and tokens. */
|
|
1224
|
-
headers:
|
|
1225
|
-
|
|
1418
|
+
headers: import_zod13.z.record(import_zod13.z.union([
|
|
1419
|
+
import_zod13.z.string(),
|
|
1226
1420
|
RedactStringSchema
|
|
1227
1421
|
])).optional(),
|
|
1228
1422
|
/** The body of the request. */
|
|
1229
|
-
body:
|
|
1230
|
-
|
|
1231
|
-
|
|
1423
|
+
body: import_zod13.z.union([
|
|
1424
|
+
import_zod13.z.string(),
|
|
1425
|
+
import_zod13.z.instanceof(ArrayBuffer)
|
|
1232
1426
|
]).optional()
|
|
1233
1427
|
});
|
|
1234
|
-
var FetchRetryOptionsSchema =
|
|
1235
|
-
var FetchOperationSchema =
|
|
1236
|
-
url:
|
|
1428
|
+
var FetchRetryOptionsSchema = import_zod13.z.record(FetchRetryStrategySchema);
|
|
1429
|
+
var FetchOperationSchema = import_zod13.z.object({
|
|
1430
|
+
url: import_zod13.z.string(),
|
|
1237
1431
|
requestInit: FetchRequestInitSchema.optional(),
|
|
1238
|
-
retry:
|
|
1239
|
-
});
|
|
1240
|
-
|
|
1241
|
-
// src/schemas/events.ts
|
|
1242
|
-
var import_zod13 = require("zod");
|
|
1243
|
-
|
|
1244
|
-
// src/schemas/runs.ts
|
|
1245
|
-
var import_zod12 = require("zod");
|
|
1246
|
-
var RunStatusSchema = import_zod12.z.union([
|
|
1247
|
-
import_zod12.z.literal("PENDING"),
|
|
1248
|
-
import_zod12.z.literal("QUEUED"),
|
|
1249
|
-
import_zod12.z.literal("WAITING_ON_CONNECTIONS"),
|
|
1250
|
-
import_zod12.z.literal("PREPROCESSING"),
|
|
1251
|
-
import_zod12.z.literal("STARTED"),
|
|
1252
|
-
import_zod12.z.literal("SUCCESS"),
|
|
1253
|
-
import_zod12.z.literal("FAILURE"),
|
|
1254
|
-
import_zod12.z.literal("TIMED_OUT"),
|
|
1255
|
-
import_zod12.z.literal("ABORTED"),
|
|
1256
|
-
import_zod12.z.literal("CANCELED")
|
|
1257
|
-
]);
|
|
1258
|
-
var RunTaskSchema = import_zod12.z.object({
|
|
1259
|
-
/** The Task id */
|
|
1260
|
-
id: import_zod12.z.string(),
|
|
1261
|
-
/** The key that you defined when creating the Task, the first param in any task. */
|
|
1262
|
-
displayKey: import_zod12.z.string().nullable(),
|
|
1263
|
-
/** The Task status */
|
|
1264
|
-
status: TaskStatusSchema,
|
|
1265
|
-
/** The name of the Task */
|
|
1266
|
-
name: import_zod12.z.string(),
|
|
1267
|
-
/** The icon of the Task, a string.
|
|
1268
|
-
* For integrations, this will be a lowercase name of the company.
|
|
1269
|
-
* Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
|
|
1270
|
-
icon: import_zod12.z.string().nullable(),
|
|
1271
|
-
/** When the task started */
|
|
1272
|
-
startedAt: import_zod12.z.coerce.date().nullable(),
|
|
1273
|
-
/** When the task completed */
|
|
1274
|
-
completedAt: import_zod12.z.coerce.date().nullable()
|
|
1275
|
-
});
|
|
1276
|
-
var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
|
|
1277
|
-
subtasks: import_zod12.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
|
|
1278
|
-
});
|
|
1279
|
-
var GetRunOptionsSchema = import_zod12.z.object({
|
|
1280
|
-
/** Return subtasks, which appear in a `subtasks` array on a task. @default false */
|
|
1281
|
-
subtasks: import_zod12.z.boolean().optional(),
|
|
1282
|
-
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
1283
|
-
cursor: import_zod12.z.string().optional(),
|
|
1284
|
-
/** How many tasks you want to return in one go, max 50. @default 20 */
|
|
1285
|
-
take: import_zod12.z.number().optional()
|
|
1286
|
-
});
|
|
1287
|
-
var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
|
|
1288
|
-
/** If `true`, it returns the `params` and `output` of all tasks. @default false */
|
|
1289
|
-
taskdetails: import_zod12.z.boolean().optional()
|
|
1290
|
-
});
|
|
1291
|
-
var RunSchema = import_zod12.z.object({
|
|
1292
|
-
/** The Run id */
|
|
1293
|
-
id: import_zod12.z.string(),
|
|
1294
|
-
/** The Run status */
|
|
1295
|
-
status: RunStatusSchema,
|
|
1296
|
-
/** When the run started */
|
|
1297
|
-
startedAt: import_zod12.z.coerce.date().nullable(),
|
|
1298
|
-
/** When the run was last updated */
|
|
1299
|
-
updatedAt: import_zod12.z.coerce.date().nullable(),
|
|
1300
|
-
/** When the run was completed */
|
|
1301
|
-
completedAt: import_zod12.z.coerce.date().nullable()
|
|
1302
|
-
});
|
|
1303
|
-
var GetRunSchema = RunSchema.extend({
|
|
1304
|
-
/** The output of the run */
|
|
1305
|
-
output: import_zod12.z.any().optional(),
|
|
1306
|
-
/** The tasks from the run */
|
|
1307
|
-
tasks: import_zod12.z.array(RunTaskWithSubtasksSchema),
|
|
1308
|
-
/** If there are more tasks, you can use this to get them */
|
|
1309
|
-
nextCursor: import_zod12.z.string().optional()
|
|
1310
|
-
});
|
|
1311
|
-
var GetRunsOptionsSchema = import_zod12.z.object({
|
|
1312
|
-
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
1313
|
-
cursor: import_zod12.z.string().optional(),
|
|
1314
|
-
/** How many runs you want to return in one go, max 50. @default 20 */
|
|
1315
|
-
take: import_zod12.z.number().optional()
|
|
1316
|
-
});
|
|
1317
|
-
var GetRunsSchema = import_zod12.z.object({
|
|
1318
|
-
/** The runs from the query */
|
|
1319
|
-
runs: RunSchema.array(),
|
|
1320
|
-
/** If there are more runs, you can use this to get them */
|
|
1321
|
-
nextCursor: import_zod12.z.string().optional()
|
|
1432
|
+
retry: import_zod13.z.record(FetchRetryStrategySchema).optional()
|
|
1322
1433
|
});
|
|
1323
1434
|
|
|
1324
1435
|
// src/schemas/events.ts
|
|
1325
|
-
var
|
|
1436
|
+
var import_zod14 = require("zod");
|
|
1437
|
+
var GetEventSchema = import_zod14.z.object({
|
|
1326
1438
|
/** The event id */
|
|
1327
|
-
id:
|
|
1439
|
+
id: import_zod14.z.string(),
|
|
1328
1440
|
/** The event name */
|
|
1329
|
-
name:
|
|
1441
|
+
name: import_zod14.z.string(),
|
|
1330
1442
|
/** When the event was created */
|
|
1331
|
-
createdAt:
|
|
1443
|
+
createdAt: import_zod14.z.coerce.date(),
|
|
1332
1444
|
/** When the event was last updated */
|
|
1333
|
-
updatedAt:
|
|
1445
|
+
updatedAt: import_zod14.z.coerce.date(),
|
|
1334
1446
|
/** The runs that were triggered by the event */
|
|
1335
|
-
runs:
|
|
1447
|
+
runs: import_zod14.z.array(import_zod14.z.object({
|
|
1336
1448
|
/** The Run id */
|
|
1337
|
-
id:
|
|
1449
|
+
id: import_zod14.z.string(),
|
|
1338
1450
|
/** The Run status */
|
|
1339
1451
|
status: RunStatusSchema,
|
|
1340
1452
|
/** When the run started */
|
|
1341
|
-
startedAt:
|
|
1453
|
+
startedAt: import_zod14.z.coerce.date().optional().nullable(),
|
|
1342
1454
|
/** When the run completed */
|
|
1343
|
-
completedAt:
|
|
1455
|
+
completedAt: import_zod14.z.coerce.date().optional().nullable()
|
|
1344
1456
|
}))
|
|
1345
1457
|
});
|
|
1346
1458
|
|
|
@@ -1567,4 +1679,76 @@ function contentFilterMatches(actualValue, contentFilter) {
|
|
|
1567
1679
|
return true;
|
|
1568
1680
|
}
|
|
1569
1681
|
__name(contentFilterMatches, "contentFilterMatches");
|
|
1682
|
+
|
|
1683
|
+
// src/bloom.ts
|
|
1684
|
+
var import_node_buffer = require("buffer");
|
|
1685
|
+
var _BloomFilter = class _BloomFilter {
|
|
1686
|
+
constructor(size) {
|
|
1687
|
+
this.size = size;
|
|
1688
|
+
this.bitArray = new Uint8Array(Math.ceil(size / 8));
|
|
1689
|
+
}
|
|
1690
|
+
add(item) {
|
|
1691
|
+
const index = murmurHash3(item) % this.size;
|
|
1692
|
+
this.bitArray[Math.floor(index / 8)] |= 1 << index % 8;
|
|
1693
|
+
}
|
|
1694
|
+
test(item) {
|
|
1695
|
+
const index = murmurHash3(item) % this.size;
|
|
1696
|
+
return (this.bitArray[Math.floor(index / 8)] & 1 << index % 8) !== 0;
|
|
1697
|
+
}
|
|
1698
|
+
// Serialize to a Base64 string
|
|
1699
|
+
serialize() {
|
|
1700
|
+
return import_node_buffer.Buffer.from(this.bitArray).toString("base64");
|
|
1701
|
+
}
|
|
1702
|
+
// Deserialize from a Base64 string
|
|
1703
|
+
static deserialize(str, size) {
|
|
1704
|
+
const filter = new _BloomFilter(size);
|
|
1705
|
+
filter.bitArray = Uint8Array.from(import_node_buffer.Buffer.from(str, "base64"));
|
|
1706
|
+
return filter;
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
__name(_BloomFilter, "BloomFilter");
|
|
1710
|
+
__publicField(_BloomFilter, "NOOP_TASK_SET_SIZE", 32768);
|
|
1711
|
+
var BloomFilter = _BloomFilter;
|
|
1712
|
+
function murmurHash3(str, seed = 0) {
|
|
1713
|
+
let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
|
|
1714
|
+
for (let i = 0, ch; i < str.length; i++) {
|
|
1715
|
+
ch = str.charCodeAt(i);
|
|
1716
|
+
h1 = Math.imul(h1 ^ ch, 3432918353);
|
|
1717
|
+
h1 = h1 << 15 | h1 >>> 17;
|
|
1718
|
+
h1 = Math.imul(h1, 461845907);
|
|
1719
|
+
h2 = Math.imul(h2 ^ ch, 2246822507);
|
|
1720
|
+
h2 = h2 << 13 | h2 >>> 19;
|
|
1721
|
+
h2 = Math.imul(h2, 3266489909);
|
|
1722
|
+
}
|
|
1723
|
+
h1 ^= str.length;
|
|
1724
|
+
h2 ^= str.length;
|
|
1725
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
1726
|
+
h1 = Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
1727
|
+
h1 ^= h1 >>> 16;
|
|
1728
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
1729
|
+
h2 = Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
1730
|
+
h2 ^= h2 >>> 16;
|
|
1731
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
1732
|
+
}
|
|
1733
|
+
__name(murmurHash3, "murmurHash3");
|
|
1734
|
+
|
|
1735
|
+
// src/index.ts
|
|
1736
|
+
var API_VERSIONS = {
|
|
1737
|
+
LAZY_LOADED_CACHED_TASKS: "2023-09-29"
|
|
1738
|
+
};
|
|
1739
|
+
var PLATFORM_FEATURES = {
|
|
1740
|
+
yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
|
1741
|
+
lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS
|
|
1742
|
+
};
|
|
1743
|
+
function supportsFeature(featureName, version) {
|
|
1744
|
+
if (version === "unversioned" || version === "unknown") {
|
|
1745
|
+
return false;
|
|
1746
|
+
}
|
|
1747
|
+
const supportedVersion = PLATFORM_FEATURES[featureName];
|
|
1748
|
+
if (!supportedVersion) {
|
|
1749
|
+
return false;
|
|
1750
|
+
}
|
|
1751
|
+
return version >= supportedVersion;
|
|
1752
|
+
}
|
|
1753
|
+
__name(supportsFeature, "supportsFeature");
|
|
1570
1754
|
//# sourceMappingURL=index.js.map
|