@trigger.dev/core 0.0.0-isomorphic-sdk-20230918150523 → 0.0.0-statuses-20230920011059
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 +297 -61
- package/dist/index.js +452 -415
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -73,6 +73,7 @@ __export(src_exports, {
|
|
|
73
73
|
FetchRetryStrategySchema: () => FetchRetryStrategySchema,
|
|
74
74
|
GetEventSchema: () => GetEventSchema,
|
|
75
75
|
GetRunSchema: () => GetRunSchema,
|
|
76
|
+
GetRunStatusesSchema: () => GetRunStatusesSchema,
|
|
76
77
|
GetRunsSchema: () => GetRunsSchema,
|
|
77
78
|
HandleTriggerSourceSchema: () => HandleTriggerSourceSchema,
|
|
78
79
|
HttpSourceRequestHeadersSchema: () => HttpSourceRequestHeadersSchema,
|
|
@@ -86,6 +87,7 @@ __export(src_exports, {
|
|
|
86
87
|
IntervalMetadataSchema: () => IntervalMetadataSchema,
|
|
87
88
|
IntervalOptionsSchema: () => IntervalOptionsSchema,
|
|
88
89
|
JobMetadataSchema: () => JobMetadataSchema,
|
|
90
|
+
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
89
91
|
LogMessageSchema: () => LogMessageSchema,
|
|
90
92
|
Logger: () => Logger,
|
|
91
93
|
MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
|
|
@@ -147,6 +149,9 @@ __export(src_exports, {
|
|
|
147
149
|
ServerTaskSchema: () => ServerTaskSchema,
|
|
148
150
|
SourceMetadataV2Schema: () => SourceMetadataV2Schema,
|
|
149
151
|
StaticTriggerMetadataSchema: () => StaticTriggerMetadataSchema,
|
|
152
|
+
StatusHistorySchema: () => StatusHistorySchema,
|
|
153
|
+
StatusUpdateSchema: () => StatusUpdateSchema,
|
|
154
|
+
StatusUpdateStateSchema: () => StatusUpdateStateSchema,
|
|
150
155
|
StyleSchema: () => StyleSchema,
|
|
151
156
|
TaskSchema: () => TaskSchema,
|
|
152
157
|
TaskStatusSchema: () => TaskStatusSchema,
|
|
@@ -318,8 +323,8 @@ function prettyPrintBytes(value) {
|
|
|
318
323
|
__name(prettyPrintBytes, "prettyPrintBytes");
|
|
319
324
|
|
|
320
325
|
// src/schemas/api.ts
|
|
321
|
-
var
|
|
322
|
-
var
|
|
326
|
+
var import_ulid = require("ulid");
|
|
327
|
+
var import_zod11 = require("zod");
|
|
323
328
|
|
|
324
329
|
// src/schemas/addMissingVersionField.ts
|
|
325
330
|
function addMissingVersionField(val) {
|
|
@@ -616,456 +621,562 @@ var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
|
|
|
616
621
|
ScheduledTriggerMetadataSchema
|
|
617
622
|
]);
|
|
618
623
|
|
|
624
|
+
// src/schemas/runs.ts
|
|
625
|
+
var import_zod10 = require("zod");
|
|
626
|
+
|
|
627
|
+
// src/schemas/statuses.ts
|
|
628
|
+
var import_zod9 = require("zod");
|
|
629
|
+
var StatusUpdateStateSchema = import_zod9.z.union([
|
|
630
|
+
import_zod9.z.literal("loading"),
|
|
631
|
+
import_zod9.z.literal("success"),
|
|
632
|
+
import_zod9.z.literal("failure")
|
|
633
|
+
]);
|
|
634
|
+
var StatusUpdateDataSchema = import_zod9.z.record(SerializableJsonSchema);
|
|
635
|
+
var StatusUpdateSchema = import_zod9.z.object({
|
|
636
|
+
label: import_zod9.z.string().optional(),
|
|
637
|
+
state: StatusUpdateStateSchema.optional(),
|
|
638
|
+
data: StatusUpdateDataSchema.optional()
|
|
639
|
+
});
|
|
640
|
+
var InitalStatusUpdateSchema = StatusUpdateSchema.required({
|
|
641
|
+
label: true
|
|
642
|
+
});
|
|
643
|
+
var StatusHistorySchema = import_zod9.z.array(StatusUpdateSchema);
|
|
644
|
+
var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({
|
|
645
|
+
key: import_zod9.z.string(),
|
|
646
|
+
history: StatusHistorySchema
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
// src/schemas/runs.ts
|
|
650
|
+
var RunStatusSchema = import_zod10.z.union([
|
|
651
|
+
import_zod10.z.literal("PENDING"),
|
|
652
|
+
import_zod10.z.literal("QUEUED"),
|
|
653
|
+
import_zod10.z.literal("WAITING_ON_CONNECTIONS"),
|
|
654
|
+
import_zod10.z.literal("PREPROCESSING"),
|
|
655
|
+
import_zod10.z.literal("STARTED"),
|
|
656
|
+
import_zod10.z.literal("SUCCESS"),
|
|
657
|
+
import_zod10.z.literal("FAILURE"),
|
|
658
|
+
import_zod10.z.literal("TIMED_OUT"),
|
|
659
|
+
import_zod10.z.literal("ABORTED"),
|
|
660
|
+
import_zod10.z.literal("CANCELED")
|
|
661
|
+
]);
|
|
662
|
+
var RunTaskSchema = import_zod10.z.object({
|
|
663
|
+
/** The Task id */
|
|
664
|
+
id: import_zod10.z.string(),
|
|
665
|
+
/** The key that you defined when creating the Task, the first param in any task. */
|
|
666
|
+
displayKey: import_zod10.z.string().nullable(),
|
|
667
|
+
/** The Task status */
|
|
668
|
+
status: TaskStatusSchema,
|
|
669
|
+
/** The name of the Task */
|
|
670
|
+
name: import_zod10.z.string(),
|
|
671
|
+
/** The icon of the Task, a string.
|
|
672
|
+
* For integrations, this will be a lowercase name of the company.
|
|
673
|
+
* Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
|
|
674
|
+
icon: import_zod10.z.string().nullable(),
|
|
675
|
+
/** When the task started */
|
|
676
|
+
startedAt: import_zod10.z.coerce.date().nullable(),
|
|
677
|
+
/** When the task completed */
|
|
678
|
+
completedAt: import_zod10.z.coerce.date().nullable()
|
|
679
|
+
});
|
|
680
|
+
var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
|
|
681
|
+
subtasks: import_zod10.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
|
|
682
|
+
});
|
|
683
|
+
var GetRunOptionsSchema = import_zod10.z.object({
|
|
684
|
+
/** Return subtasks, which appear in a `subtasks` array on a task. @default false */
|
|
685
|
+
subtasks: import_zod10.z.boolean().optional(),
|
|
686
|
+
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
687
|
+
cursor: import_zod10.z.string().optional(),
|
|
688
|
+
/** How many tasks you want to return in one go, max 50. @default 20 */
|
|
689
|
+
take: import_zod10.z.number().optional()
|
|
690
|
+
});
|
|
691
|
+
var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({
|
|
692
|
+
/** If `true`, it returns the `params` and `output` of all tasks. @default false */
|
|
693
|
+
taskdetails: import_zod10.z.boolean().optional()
|
|
694
|
+
});
|
|
695
|
+
var RunSchema = import_zod10.z.object({
|
|
696
|
+
/** The Run id */
|
|
697
|
+
id: import_zod10.z.string(),
|
|
698
|
+
/** The Run status */
|
|
699
|
+
status: RunStatusSchema,
|
|
700
|
+
/** When the run started */
|
|
701
|
+
startedAt: import_zod10.z.coerce.date().nullable(),
|
|
702
|
+
/** When the run was last updated */
|
|
703
|
+
updatedAt: import_zod10.z.coerce.date().nullable(),
|
|
704
|
+
/** When the run was completed */
|
|
705
|
+
completedAt: import_zod10.z.coerce.date().nullable()
|
|
706
|
+
});
|
|
707
|
+
var GetRunSchema = RunSchema.extend({
|
|
708
|
+
/** The output of the run */
|
|
709
|
+
output: import_zod10.z.any().optional(),
|
|
710
|
+
/** The tasks from the run */
|
|
711
|
+
tasks: import_zod10.z.array(RunTaskWithSubtasksSchema),
|
|
712
|
+
/** Any status updates that were published from the run */
|
|
713
|
+
statuses: import_zod10.z.array(JobRunStatusRecordSchema),
|
|
714
|
+
/** If there are more tasks, you can use this to get them */
|
|
715
|
+
nextCursor: import_zod10.z.string().optional()
|
|
716
|
+
});
|
|
717
|
+
var GetRunsOptionsSchema = import_zod10.z.object({
|
|
718
|
+
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
|
|
719
|
+
cursor: import_zod10.z.string().optional(),
|
|
720
|
+
/** How many runs you want to return in one go, max 50. @default 20 */
|
|
721
|
+
take: import_zod10.z.number().optional()
|
|
722
|
+
});
|
|
723
|
+
var GetRunsSchema = import_zod10.z.object({
|
|
724
|
+
/** The runs from the query */
|
|
725
|
+
runs: RunSchema.array(),
|
|
726
|
+
/** If there are more runs, you can use this to get them */
|
|
727
|
+
nextCursor: import_zod10.z.string().optional()
|
|
728
|
+
});
|
|
729
|
+
|
|
619
730
|
// src/schemas/api.ts
|
|
620
|
-
var UpdateTriggerSourceBodyV1Schema =
|
|
621
|
-
registeredEvents:
|
|
622
|
-
secret:
|
|
731
|
+
var UpdateTriggerSourceBodyV1Schema = import_zod11.z.object({
|
|
732
|
+
registeredEvents: import_zod11.z.array(import_zod11.z.string()),
|
|
733
|
+
secret: import_zod11.z.string().optional(),
|
|
623
734
|
data: SerializableJsonSchema.optional()
|
|
624
735
|
});
|
|
625
|
-
var UpdateTriggerSourceBodyV2Schema =
|
|
626
|
-
secret:
|
|
736
|
+
var UpdateTriggerSourceBodyV2Schema = import_zod11.z.object({
|
|
737
|
+
secret: import_zod11.z.string().optional(),
|
|
627
738
|
data: SerializableJsonSchema.optional(),
|
|
628
|
-
options:
|
|
629
|
-
event:
|
|
630
|
-
}).and(
|
|
739
|
+
options: import_zod11.z.object({
|
|
740
|
+
event: import_zod11.z.array(import_zod11.z.string())
|
|
741
|
+
}).and(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.array(import_zod11.z.string())).optional())
|
|
631
742
|
});
|
|
632
|
-
var RegisterHTTPTriggerSourceBodySchema =
|
|
633
|
-
type:
|
|
634
|
-
url:
|
|
743
|
+
var RegisterHTTPTriggerSourceBodySchema = import_zod11.z.object({
|
|
744
|
+
type: import_zod11.z.literal("HTTP"),
|
|
745
|
+
url: import_zod11.z.string().url()
|
|
635
746
|
});
|
|
636
|
-
var RegisterSMTPTriggerSourceBodySchema =
|
|
637
|
-
type:
|
|
747
|
+
var RegisterSMTPTriggerSourceBodySchema = import_zod11.z.object({
|
|
748
|
+
type: import_zod11.z.literal("SMTP")
|
|
638
749
|
});
|
|
639
|
-
var RegisterSQSTriggerSourceBodySchema =
|
|
640
|
-
type:
|
|
750
|
+
var RegisterSQSTriggerSourceBodySchema = import_zod11.z.object({
|
|
751
|
+
type: import_zod11.z.literal("SQS")
|
|
641
752
|
});
|
|
642
|
-
var RegisterSourceChannelBodySchema =
|
|
753
|
+
var RegisterSourceChannelBodySchema = import_zod11.z.discriminatedUnion("type", [
|
|
643
754
|
RegisterHTTPTriggerSourceBodySchema,
|
|
644
755
|
RegisterSMTPTriggerSourceBodySchema,
|
|
645
756
|
RegisterSQSTriggerSourceBodySchema
|
|
646
757
|
]);
|
|
647
758
|
var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
|
|
648
759
|
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
|
|
649
|
-
var RegisterTriggerSourceSchema =
|
|
650
|
-
key:
|
|
651
|
-
params:
|
|
652
|
-
active:
|
|
653
|
-
secret:
|
|
760
|
+
var RegisterTriggerSourceSchema = import_zod11.z.object({
|
|
761
|
+
key: import_zod11.z.string(),
|
|
762
|
+
params: import_zod11.z.any(),
|
|
763
|
+
active: import_zod11.z.boolean(),
|
|
764
|
+
secret: import_zod11.z.string(),
|
|
654
765
|
data: DeserializedJsonSchema.optional(),
|
|
655
766
|
channel: RegisterSourceChannelBodySchema,
|
|
656
|
-
clientId:
|
|
767
|
+
clientId: import_zod11.z.string().optional()
|
|
657
768
|
});
|
|
658
|
-
var SourceEventOptionSchema =
|
|
659
|
-
name:
|
|
660
|
-
value:
|
|
769
|
+
var SourceEventOptionSchema = import_zod11.z.object({
|
|
770
|
+
name: import_zod11.z.string(),
|
|
771
|
+
value: import_zod11.z.string()
|
|
661
772
|
});
|
|
662
|
-
var RegisterSourceEventSchemaV1 =
|
|
773
|
+
var RegisterSourceEventSchemaV1 = import_zod11.z.object({
|
|
663
774
|
/** The id of the source */
|
|
664
|
-
id:
|
|
775
|
+
id: import_zod11.z.string(),
|
|
665
776
|
source: RegisterTriggerSourceSchema,
|
|
666
|
-
events:
|
|
667
|
-
missingEvents:
|
|
668
|
-
orphanedEvents:
|
|
669
|
-
dynamicTriggerId:
|
|
777
|
+
events: import_zod11.z.array(import_zod11.z.string()),
|
|
778
|
+
missingEvents: import_zod11.z.array(import_zod11.z.string()),
|
|
779
|
+
orphanedEvents: import_zod11.z.array(import_zod11.z.string()),
|
|
780
|
+
dynamicTriggerId: import_zod11.z.string().optional()
|
|
670
781
|
});
|
|
671
|
-
var RegisteredOptionsDiffSchema =
|
|
672
|
-
desired:
|
|
673
|
-
missing:
|
|
674
|
-
orphaned:
|
|
782
|
+
var RegisteredOptionsDiffSchema = import_zod11.z.object({
|
|
783
|
+
desired: import_zod11.z.array(import_zod11.z.string()),
|
|
784
|
+
missing: import_zod11.z.array(import_zod11.z.string()),
|
|
785
|
+
orphaned: import_zod11.z.array(import_zod11.z.string())
|
|
675
786
|
});
|
|
676
|
-
var RegisterSourceEventOptionsSchema =
|
|
787
|
+
var RegisterSourceEventOptionsSchema = import_zod11.z.object({
|
|
677
788
|
event: RegisteredOptionsDiffSchema
|
|
678
|
-
}).and(
|
|
679
|
-
var RegisterSourceEventSchemaV2 =
|
|
789
|
+
}).and(import_zod11.z.record(import_zod11.z.string(), RegisteredOptionsDiffSchema));
|
|
790
|
+
var RegisterSourceEventSchemaV2 = import_zod11.z.object({
|
|
680
791
|
/** The id of the source */
|
|
681
|
-
id:
|
|
792
|
+
id: import_zod11.z.string(),
|
|
682
793
|
source: RegisterTriggerSourceSchema,
|
|
683
794
|
options: RegisterSourceEventOptionsSchema,
|
|
684
|
-
dynamicTriggerId:
|
|
795
|
+
dynamicTriggerId: import_zod11.z.string().optional()
|
|
685
796
|
});
|
|
686
|
-
var TriggerSourceSchema =
|
|
687
|
-
id:
|
|
688
|
-
key:
|
|
797
|
+
var TriggerSourceSchema = import_zod11.z.object({
|
|
798
|
+
id: import_zod11.z.string(),
|
|
799
|
+
key: import_zod11.z.string()
|
|
689
800
|
});
|
|
690
801
|
var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
|
|
691
|
-
var HandleTriggerSourceSchema =
|
|
692
|
-
key:
|
|
693
|
-
secret:
|
|
694
|
-
data:
|
|
695
|
-
params:
|
|
802
|
+
var HandleTriggerSourceSchema = import_zod11.z.object({
|
|
803
|
+
key: import_zod11.z.string(),
|
|
804
|
+
secret: import_zod11.z.string(),
|
|
805
|
+
data: import_zod11.z.any(),
|
|
806
|
+
params: import_zod11.z.any(),
|
|
696
807
|
auth: ConnectionAuthSchema.optional(),
|
|
697
808
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
698
809
|
});
|
|
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":
|
|
810
|
+
var HttpSourceRequestSchema = import_zod11.z.object({
|
|
811
|
+
url: import_zod11.z.string().url(),
|
|
812
|
+
method: import_zod11.z.string(),
|
|
813
|
+
headers: import_zod11.z.record(import_zod11.z.string()),
|
|
814
|
+
rawBody: import_zod11.z.instanceof(Buffer).optional().nullable()
|
|
815
|
+
});
|
|
816
|
+
var HttpSourceRequestHeadersSchema = import_zod11.z.object({
|
|
817
|
+
"x-ts-key": import_zod11.z.string(),
|
|
818
|
+
"x-ts-dynamic-id": import_zod11.z.string().optional(),
|
|
819
|
+
"x-ts-secret": import_zod11.z.string(),
|
|
820
|
+
"x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
821
|
+
"x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)),
|
|
822
|
+
"x-ts-http-url": import_zod11.z.string(),
|
|
823
|
+
"x-ts-http-method": import_zod11.z.string(),
|
|
824
|
+
"x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))),
|
|
825
|
+
"x-ts-auth": import_zod11.z.string().optional().transform((s) => {
|
|
715
826
|
if (s === void 0)
|
|
716
827
|
return;
|
|
717
828
|
const json = JSON.parse(s);
|
|
718
829
|
return ConnectionAuthSchema.parse(json);
|
|
719
830
|
}),
|
|
720
|
-
"x-ts-metadata":
|
|
831
|
+
"x-ts-metadata": import_zod11.z.string().optional().transform((s) => {
|
|
721
832
|
if (s === void 0)
|
|
722
833
|
return;
|
|
723
834
|
const json = JSON.parse(s);
|
|
724
835
|
return DeserializedJsonSchema.parse(json);
|
|
725
836
|
})
|
|
726
837
|
});
|
|
727
|
-
var PongSuccessResponseSchema =
|
|
728
|
-
ok:
|
|
838
|
+
var PongSuccessResponseSchema = import_zod11.z.object({
|
|
839
|
+
ok: import_zod11.z.literal(true)
|
|
729
840
|
});
|
|
730
|
-
var PongErrorResponseSchema =
|
|
731
|
-
ok:
|
|
732
|
-
error:
|
|
841
|
+
var PongErrorResponseSchema = import_zod11.z.object({
|
|
842
|
+
ok: import_zod11.z.literal(false),
|
|
843
|
+
error: import_zod11.z.string()
|
|
733
844
|
});
|
|
734
|
-
var PongResponseSchema =
|
|
845
|
+
var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
735
846
|
PongSuccessResponseSchema,
|
|
736
847
|
PongErrorResponseSchema
|
|
737
848
|
]);
|
|
738
|
-
var ValidateSuccessResponseSchema =
|
|
739
|
-
ok:
|
|
740
|
-
endpointId:
|
|
849
|
+
var ValidateSuccessResponseSchema = import_zod11.z.object({
|
|
850
|
+
ok: import_zod11.z.literal(true),
|
|
851
|
+
endpointId: import_zod11.z.string()
|
|
741
852
|
});
|
|
742
|
-
var ValidateErrorResponseSchema =
|
|
743
|
-
ok:
|
|
744
|
-
error:
|
|
853
|
+
var ValidateErrorResponseSchema = import_zod11.z.object({
|
|
854
|
+
ok: import_zod11.z.literal(false),
|
|
855
|
+
error: import_zod11.z.string()
|
|
745
856
|
});
|
|
746
|
-
var ValidateResponseSchema =
|
|
857
|
+
var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
747
858
|
ValidateSuccessResponseSchema,
|
|
748
859
|
ValidateErrorResponseSchema
|
|
749
860
|
]);
|
|
750
|
-
var QueueOptionsSchema =
|
|
751
|
-
name:
|
|
752
|
-
maxConcurrent:
|
|
753
|
-
});
|
|
754
|
-
var JobMetadataSchema =
|
|
755
|
-
id:
|
|
756
|
-
name:
|
|
757
|
-
version:
|
|
861
|
+
var QueueOptionsSchema = import_zod11.z.object({
|
|
862
|
+
name: import_zod11.z.string(),
|
|
863
|
+
maxConcurrent: import_zod11.z.number().optional()
|
|
864
|
+
});
|
|
865
|
+
var JobMetadataSchema = import_zod11.z.object({
|
|
866
|
+
id: import_zod11.z.string(),
|
|
867
|
+
name: import_zod11.z.string(),
|
|
868
|
+
version: import_zod11.z.string(),
|
|
758
869
|
event: EventSpecificationSchema,
|
|
759
870
|
trigger: TriggerMetadataSchema,
|
|
760
|
-
integrations:
|
|
761
|
-
internal:
|
|
762
|
-
enabled:
|
|
763
|
-
startPosition:
|
|
871
|
+
integrations: import_zod11.z.record(IntegrationConfigSchema),
|
|
872
|
+
internal: import_zod11.z.boolean().default(false),
|
|
873
|
+
enabled: import_zod11.z.boolean(),
|
|
874
|
+
startPosition: import_zod11.z.enum([
|
|
764
875
|
"initial",
|
|
765
876
|
"latest"
|
|
766
877
|
]),
|
|
767
|
-
preprocessRuns:
|
|
878
|
+
preprocessRuns: import_zod11.z.boolean()
|
|
768
879
|
});
|
|
769
|
-
var SourceMetadataV1Schema =
|
|
770
|
-
version:
|
|
771
|
-
channel:
|
|
880
|
+
var SourceMetadataV1Schema = import_zod11.z.object({
|
|
881
|
+
version: import_zod11.z.literal("1"),
|
|
882
|
+
channel: import_zod11.z.enum([
|
|
772
883
|
"HTTP",
|
|
773
884
|
"SQS",
|
|
774
885
|
"SMTP"
|
|
775
886
|
]),
|
|
776
887
|
integration: IntegrationConfigSchema,
|
|
777
|
-
key:
|
|
778
|
-
params:
|
|
779
|
-
events:
|
|
780
|
-
registerSourceJob:
|
|
781
|
-
id:
|
|
782
|
-
version:
|
|
888
|
+
key: import_zod11.z.string(),
|
|
889
|
+
params: import_zod11.z.any(),
|
|
890
|
+
events: import_zod11.z.array(import_zod11.z.string()),
|
|
891
|
+
registerSourceJob: import_zod11.z.object({
|
|
892
|
+
id: import_zod11.z.string(),
|
|
893
|
+
version: import_zod11.z.string()
|
|
783
894
|
}).optional()
|
|
784
895
|
});
|
|
785
|
-
var SourceMetadataV2Schema =
|
|
786
|
-
version:
|
|
787
|
-
channel:
|
|
896
|
+
var SourceMetadataV2Schema = import_zod11.z.object({
|
|
897
|
+
version: import_zod11.z.literal("2"),
|
|
898
|
+
channel: import_zod11.z.enum([
|
|
788
899
|
"HTTP",
|
|
789
900
|
"SQS",
|
|
790
901
|
"SMTP"
|
|
791
902
|
]),
|
|
792
903
|
integration: IntegrationConfigSchema,
|
|
793
|
-
key:
|
|
794
|
-
params:
|
|
795
|
-
options:
|
|
796
|
-
registerSourceJob:
|
|
797
|
-
id:
|
|
798
|
-
version:
|
|
904
|
+
key: import_zod11.z.string(),
|
|
905
|
+
params: import_zod11.z.any(),
|
|
906
|
+
options: import_zod11.z.record(import_zod11.z.array(import_zod11.z.string())),
|
|
907
|
+
registerSourceJob: import_zod11.z.object({
|
|
908
|
+
id: import_zod11.z.string(),
|
|
909
|
+
version: import_zod11.z.string()
|
|
799
910
|
}).optional()
|
|
800
911
|
});
|
|
801
|
-
var SourceMetadataSchema =
|
|
912
|
+
var SourceMetadataSchema = import_zod11.z.preprocess(addMissingVersionField, import_zod11.z.discriminatedUnion("version", [
|
|
802
913
|
SourceMetadataV1Schema,
|
|
803
914
|
SourceMetadataV2Schema
|
|
804
915
|
]));
|
|
805
|
-
var DynamicTriggerEndpointMetadataSchema =
|
|
806
|
-
id:
|
|
807
|
-
jobs:
|
|
916
|
+
var DynamicTriggerEndpointMetadataSchema = import_zod11.z.object({
|
|
917
|
+
id: import_zod11.z.string(),
|
|
918
|
+
jobs: import_zod11.z.array(JobMetadataSchema.pick({
|
|
808
919
|
id: true,
|
|
809
920
|
version: true
|
|
810
921
|
})),
|
|
811
|
-
registerSourceJob:
|
|
812
|
-
id:
|
|
813
|
-
version:
|
|
922
|
+
registerSourceJob: import_zod11.z.object({
|
|
923
|
+
id: import_zod11.z.string(),
|
|
924
|
+
version: import_zod11.z.string()
|
|
814
925
|
}).optional()
|
|
815
926
|
});
|
|
816
|
-
var IndexEndpointResponseSchema =
|
|
817
|
-
jobs:
|
|
818
|
-
sources:
|
|
819
|
-
dynamicTriggers:
|
|
820
|
-
dynamicSchedules:
|
|
927
|
+
var IndexEndpointResponseSchema = import_zod11.z.object({
|
|
928
|
+
jobs: import_zod11.z.array(JobMetadataSchema),
|
|
929
|
+
sources: import_zod11.z.array(SourceMetadataSchema),
|
|
930
|
+
dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
931
|
+
dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
|
|
821
932
|
});
|
|
822
|
-
var RawEventSchema =
|
|
933
|
+
var RawEventSchema = import_zod11.z.object({
|
|
823
934
|
/** The `name` property must exactly match any subscriptions you want to
|
|
824
935
|
trigger. */
|
|
825
|
-
name:
|
|
936
|
+
name: import_zod11.z.string(),
|
|
826
937
|
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
827
938
|
as the `payload` param of the `run()` function. You can leave this
|
|
828
939
|
parameter out if you just want to trigger a Job without any input data. */
|
|
829
|
-
payload:
|
|
940
|
+
payload: import_zod11.z.any(),
|
|
830
941
|
/** The optional `context` property will be sent to any matching Jobs and will
|
|
831
942
|
be passed through as the `context.event.context` param of the `run()`
|
|
832
943
|
function. This is optional but can be useful if you want to pass through
|
|
833
944
|
some additional context to the Job. */
|
|
834
|
-
context:
|
|
945
|
+
context: import_zod11.z.any().optional(),
|
|
835
946
|
/** The `id` property uniquely identify this particular event. If unset it
|
|
836
947
|
will be set automatically using `ulid`. */
|
|
837
|
-
id:
|
|
948
|
+
id: import_zod11.z.string().default(() => (0, import_ulid.ulid)()),
|
|
838
949
|
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
839
950
|
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
840
951
|
you receive a timestamp from a service and you want the same timestamp to
|
|
841
952
|
be used in your Job. */
|
|
842
|
-
timestamp:
|
|
953
|
+
timestamp: import_zod11.z.coerce.date().optional(),
|
|
843
954
|
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
844
955
|
this as you can filter events using this in the `eventTrigger()`. */
|
|
845
|
-
source:
|
|
956
|
+
source: import_zod11.z.string().optional()
|
|
846
957
|
});
|
|
847
|
-
var ApiEventLogSchema =
|
|
958
|
+
var ApiEventLogSchema = import_zod11.z.object({
|
|
848
959
|
/** The `id` of the event that was sent.
|
|
849
960
|
*/
|
|
850
|
-
id:
|
|
961
|
+
id: import_zod11.z.string(),
|
|
851
962
|
/** The `name` of the event that was sent. */
|
|
852
|
-
name:
|
|
963
|
+
name: import_zod11.z.string(),
|
|
853
964
|
/** The `payload` of the event that was sent */
|
|
854
965
|
payload: DeserializedJsonSchema,
|
|
855
966
|
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
856
967
|
set when sending the event. */
|
|
857
968
|
context: DeserializedJsonSchema.optional().nullable(),
|
|
858
969
|
/** The `timestamp` of the event that was sent */
|
|
859
|
-
timestamp:
|
|
970
|
+
timestamp: import_zod11.z.coerce.date(),
|
|
860
971
|
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
861
972
|
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
862
973
|
event. */
|
|
863
|
-
deliverAt:
|
|
974
|
+
deliverAt: import_zod11.z.coerce.date().optional().nullable(),
|
|
864
975
|
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
865
976
|
or `deliverAfter` were set when sending the event. */
|
|
866
|
-
deliveredAt:
|
|
977
|
+
deliveredAt: import_zod11.z.coerce.date().optional().nullable(),
|
|
867
978
|
/** The timestamp when the event was cancelled. Is `undefined` if the event
|
|
868
979
|
* wasn't cancelled. */
|
|
869
|
-
cancelledAt:
|
|
980
|
+
cancelledAt: import_zod11.z.coerce.date().optional().nullable()
|
|
870
981
|
});
|
|
871
|
-
var SendEventOptionsSchema =
|
|
982
|
+
var SendEventOptionsSchema = import_zod11.z.object({
|
|
872
983
|
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
873
984
|
be sent to the platform immediately but won't be acted upon until the
|
|
874
985
|
specified time. */
|
|
875
|
-
deliverAt:
|
|
986
|
+
deliverAt: import_zod11.z.coerce.date().optional(),
|
|
876
987
|
/** An optional number of seconds you want to wait for the event to trigger
|
|
877
988
|
any relevant Jobs. The event will be sent to the platform immediately but
|
|
878
989
|
won't be delivered until after the elapsed number of seconds. */
|
|
879
|
-
deliverAfter:
|
|
990
|
+
deliverAfter: import_zod11.z.number().int().optional(),
|
|
880
991
|
/** This optional param will be used by Trigger.dev Connect, which
|
|
881
992
|
is coming soon. */
|
|
882
|
-
accountId:
|
|
993
|
+
accountId: import_zod11.z.string().optional()
|
|
883
994
|
});
|
|
884
|
-
var SendEventBodySchema =
|
|
995
|
+
var SendEventBodySchema = import_zod11.z.object({
|
|
885
996
|
event: RawEventSchema,
|
|
886
997
|
options: SendEventOptionsSchema.optional()
|
|
887
998
|
});
|
|
888
|
-
var DeliverEventResponseSchema =
|
|
889
|
-
deliveredAt:
|
|
999
|
+
var DeliverEventResponseSchema = import_zod11.z.object({
|
|
1000
|
+
deliveredAt: import_zod11.z.string().datetime()
|
|
890
1001
|
});
|
|
891
|
-
var RuntimeEnvironmentTypeSchema =
|
|
1002
|
+
var RuntimeEnvironmentTypeSchema = import_zod11.z.enum([
|
|
892
1003
|
"PRODUCTION",
|
|
893
1004
|
"STAGING",
|
|
894
1005
|
"DEVELOPMENT",
|
|
895
1006
|
"PREVIEW"
|
|
896
1007
|
]);
|
|
897
|
-
var RunSourceContextSchema =
|
|
898
|
-
id:
|
|
899
|
-
metadata:
|
|
1008
|
+
var RunSourceContextSchema = import_zod11.z.object({
|
|
1009
|
+
id: import_zod11.z.string(),
|
|
1010
|
+
metadata: import_zod11.z.any()
|
|
900
1011
|
});
|
|
901
|
-
var RunJobBodySchema =
|
|
1012
|
+
var RunJobBodySchema = import_zod11.z.object({
|
|
902
1013
|
event: ApiEventLogSchema,
|
|
903
|
-
job:
|
|
904
|
-
id:
|
|
905
|
-
version:
|
|
1014
|
+
job: import_zod11.z.object({
|
|
1015
|
+
id: import_zod11.z.string(),
|
|
1016
|
+
version: import_zod11.z.string()
|
|
906
1017
|
}),
|
|
907
|
-
run:
|
|
908
|
-
id:
|
|
909
|
-
isTest:
|
|
910
|
-
isRetry:
|
|
911
|
-
startedAt:
|
|
1018
|
+
run: import_zod11.z.object({
|
|
1019
|
+
id: import_zod11.z.string(),
|
|
1020
|
+
isTest: import_zod11.z.boolean(),
|
|
1021
|
+
isRetry: import_zod11.z.boolean().default(false),
|
|
1022
|
+
startedAt: import_zod11.z.coerce.date()
|
|
912
1023
|
}),
|
|
913
|
-
environment:
|
|
914
|
-
id:
|
|
915
|
-
slug:
|
|
1024
|
+
environment: import_zod11.z.object({
|
|
1025
|
+
id: import_zod11.z.string(),
|
|
1026
|
+
slug: import_zod11.z.string(),
|
|
916
1027
|
type: RuntimeEnvironmentTypeSchema
|
|
917
1028
|
}),
|
|
918
|
-
organization:
|
|
919
|
-
id:
|
|
920
|
-
title:
|
|
921
|
-
slug:
|
|
1029
|
+
organization: import_zod11.z.object({
|
|
1030
|
+
id: import_zod11.z.string(),
|
|
1031
|
+
title: import_zod11.z.string(),
|
|
1032
|
+
slug: import_zod11.z.string()
|
|
922
1033
|
}),
|
|
923
|
-
account:
|
|
924
|
-
id:
|
|
925
|
-
metadata:
|
|
1034
|
+
account: import_zod11.z.object({
|
|
1035
|
+
id: import_zod11.z.string(),
|
|
1036
|
+
metadata: import_zod11.z.any()
|
|
926
1037
|
}).optional(),
|
|
927
1038
|
source: RunSourceContextSchema.optional(),
|
|
928
|
-
tasks:
|
|
929
|
-
connections:
|
|
1039
|
+
tasks: import_zod11.z.array(CachedTaskSchema).optional(),
|
|
1040
|
+
connections: import_zod11.z.record(ConnectionAuthSchema).optional()
|
|
930
1041
|
});
|
|
931
|
-
var RunJobErrorSchema =
|
|
932
|
-
status:
|
|
1042
|
+
var RunJobErrorSchema = import_zod11.z.object({
|
|
1043
|
+
status: import_zod11.z.literal("ERROR"),
|
|
933
1044
|
error: ErrorWithStackSchema,
|
|
934
1045
|
task: TaskSchema.optional()
|
|
935
1046
|
});
|
|
936
|
-
var RunJobResumeWithTaskSchema =
|
|
937
|
-
status:
|
|
1047
|
+
var RunJobResumeWithTaskSchema = import_zod11.z.object({
|
|
1048
|
+
status: import_zod11.z.literal("RESUME_WITH_TASK"),
|
|
938
1049
|
task: TaskSchema
|
|
939
1050
|
});
|
|
940
|
-
var RunJobRetryWithTaskSchema =
|
|
941
|
-
status:
|
|
1051
|
+
var RunJobRetryWithTaskSchema = import_zod11.z.object({
|
|
1052
|
+
status: import_zod11.z.literal("RETRY_WITH_TASK"),
|
|
942
1053
|
task: TaskSchema,
|
|
943
1054
|
error: ErrorWithStackSchema,
|
|
944
|
-
retryAt:
|
|
1055
|
+
retryAt: import_zod11.z.coerce.date()
|
|
945
1056
|
});
|
|
946
|
-
var RunJobCanceledWithTaskSchema =
|
|
947
|
-
status:
|
|
1057
|
+
var RunJobCanceledWithTaskSchema = import_zod11.z.object({
|
|
1058
|
+
status: import_zod11.z.literal("CANCELED"),
|
|
948
1059
|
task: TaskSchema
|
|
949
1060
|
});
|
|
950
|
-
var RunJobSuccessSchema =
|
|
951
|
-
status:
|
|
1061
|
+
var RunJobSuccessSchema = import_zod11.z.object({
|
|
1062
|
+
status: import_zod11.z.literal("SUCCESS"),
|
|
952
1063
|
output: DeserializedJsonSchema.optional()
|
|
953
1064
|
});
|
|
954
|
-
var RunJobResponseSchema =
|
|
1065
|
+
var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
955
1066
|
RunJobErrorSchema,
|
|
956
1067
|
RunJobResumeWithTaskSchema,
|
|
957
1068
|
RunJobRetryWithTaskSchema,
|
|
958
1069
|
RunJobCanceledWithTaskSchema,
|
|
959
1070
|
RunJobSuccessSchema
|
|
960
1071
|
]);
|
|
961
|
-
var PreprocessRunBodySchema =
|
|
1072
|
+
var PreprocessRunBodySchema = import_zod11.z.object({
|
|
962
1073
|
event: ApiEventLogSchema,
|
|
963
|
-
job:
|
|
964
|
-
id:
|
|
965
|
-
version:
|
|
1074
|
+
job: import_zod11.z.object({
|
|
1075
|
+
id: import_zod11.z.string(),
|
|
1076
|
+
version: import_zod11.z.string()
|
|
966
1077
|
}),
|
|
967
|
-
run:
|
|
968
|
-
id:
|
|
969
|
-
isTest:
|
|
1078
|
+
run: import_zod11.z.object({
|
|
1079
|
+
id: import_zod11.z.string(),
|
|
1080
|
+
isTest: import_zod11.z.boolean()
|
|
970
1081
|
}),
|
|
971
|
-
environment:
|
|
972
|
-
id:
|
|
973
|
-
slug:
|
|
1082
|
+
environment: import_zod11.z.object({
|
|
1083
|
+
id: import_zod11.z.string(),
|
|
1084
|
+
slug: import_zod11.z.string(),
|
|
974
1085
|
type: RuntimeEnvironmentTypeSchema
|
|
975
1086
|
}),
|
|
976
|
-
organization:
|
|
977
|
-
id:
|
|
978
|
-
title:
|
|
979
|
-
slug:
|
|
1087
|
+
organization: import_zod11.z.object({
|
|
1088
|
+
id: import_zod11.z.string(),
|
|
1089
|
+
title: import_zod11.z.string(),
|
|
1090
|
+
slug: import_zod11.z.string()
|
|
980
1091
|
}),
|
|
981
|
-
account:
|
|
982
|
-
id:
|
|
983
|
-
metadata:
|
|
1092
|
+
account: import_zod11.z.object({
|
|
1093
|
+
id: import_zod11.z.string(),
|
|
1094
|
+
metadata: import_zod11.z.any()
|
|
984
1095
|
}).optional()
|
|
985
1096
|
});
|
|
986
|
-
var PreprocessRunResponseSchema =
|
|
987
|
-
abort:
|
|
988
|
-
properties:
|
|
1097
|
+
var PreprocessRunResponseSchema = import_zod11.z.object({
|
|
1098
|
+
abort: import_zod11.z.boolean(),
|
|
1099
|
+
properties: import_zod11.z.array(DisplayPropertySchema).optional()
|
|
989
1100
|
});
|
|
990
|
-
var CreateRunResponseOkSchema =
|
|
991
|
-
ok:
|
|
992
|
-
data:
|
|
993
|
-
id:
|
|
1101
|
+
var CreateRunResponseOkSchema = import_zod11.z.object({
|
|
1102
|
+
ok: import_zod11.z.literal(true),
|
|
1103
|
+
data: import_zod11.z.object({
|
|
1104
|
+
id: import_zod11.z.string()
|
|
994
1105
|
})
|
|
995
1106
|
});
|
|
996
|
-
var CreateRunResponseErrorSchema =
|
|
997
|
-
ok:
|
|
998
|
-
error:
|
|
1107
|
+
var CreateRunResponseErrorSchema = import_zod11.z.object({
|
|
1108
|
+
ok: import_zod11.z.literal(false),
|
|
1109
|
+
error: import_zod11.z.string()
|
|
999
1110
|
});
|
|
1000
|
-
var CreateRunResponseBodySchema =
|
|
1111
|
+
var CreateRunResponseBodySchema = import_zod11.z.discriminatedUnion("ok", [
|
|
1001
1112
|
CreateRunResponseOkSchema,
|
|
1002
1113
|
CreateRunResponseErrorSchema
|
|
1003
1114
|
]);
|
|
1004
|
-
var RedactStringSchema =
|
|
1005
|
-
__redactedString:
|
|
1006
|
-
strings:
|
|
1007
|
-
interpolations:
|
|
1115
|
+
var RedactStringSchema = import_zod11.z.object({
|
|
1116
|
+
__redactedString: import_zod11.z.literal(true),
|
|
1117
|
+
strings: import_zod11.z.array(import_zod11.z.string()),
|
|
1118
|
+
interpolations: import_zod11.z.array(import_zod11.z.string())
|
|
1008
1119
|
});
|
|
1009
|
-
var LogMessageSchema =
|
|
1010
|
-
level:
|
|
1120
|
+
var LogMessageSchema = import_zod11.z.object({
|
|
1121
|
+
level: import_zod11.z.enum([
|
|
1011
1122
|
"DEBUG",
|
|
1012
1123
|
"INFO",
|
|
1013
1124
|
"WARN",
|
|
1014
1125
|
"ERROR"
|
|
1015
1126
|
]),
|
|
1016
|
-
message:
|
|
1127
|
+
message: import_zod11.z.string(),
|
|
1017
1128
|
data: SerializableJsonSchema.optional()
|
|
1018
1129
|
});
|
|
1019
|
-
var RedactSchema =
|
|
1020
|
-
paths:
|
|
1130
|
+
var RedactSchema = import_zod11.z.object({
|
|
1131
|
+
paths: import_zod11.z.array(import_zod11.z.string())
|
|
1021
1132
|
});
|
|
1022
|
-
var RetryOptionsSchema =
|
|
1133
|
+
var RetryOptionsSchema = import_zod11.z.object({
|
|
1023
1134
|
/** The maximum number of times to retry the request. */
|
|
1024
|
-
limit:
|
|
1135
|
+
limit: import_zod11.z.number().optional(),
|
|
1025
1136
|
/** The exponential factor to use when calculating the next retry time. */
|
|
1026
|
-
factor:
|
|
1137
|
+
factor: import_zod11.z.number().optional(),
|
|
1027
1138
|
/** The minimum amount of time to wait before retrying the request. */
|
|
1028
|
-
minTimeoutInMs:
|
|
1139
|
+
minTimeoutInMs: import_zod11.z.number().optional(),
|
|
1029
1140
|
/** The maximum amount of time to wait before retrying the request. */
|
|
1030
|
-
maxTimeoutInMs:
|
|
1141
|
+
maxTimeoutInMs: import_zod11.z.number().optional(),
|
|
1031
1142
|
/** Whether to randomize the retry time. */
|
|
1032
|
-
randomize:
|
|
1143
|
+
randomize: import_zod11.z.boolean().optional()
|
|
1033
1144
|
});
|
|
1034
|
-
var RunTaskOptionsSchema =
|
|
1145
|
+
var RunTaskOptionsSchema = import_zod11.z.object({
|
|
1035
1146
|
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1036
|
-
name:
|
|
1147
|
+
name: import_zod11.z.string().optional(),
|
|
1037
1148
|
/** The Task will wait and only start at the specified Date */
|
|
1038
|
-
delayUntil:
|
|
1149
|
+
delayUntil: import_zod11.z.coerce.date().optional(),
|
|
1039
1150
|
/** Retry options */
|
|
1040
1151
|
retry: RetryOptionsSchema.optional(),
|
|
1041
1152
|
/** The icon for the Task, it will appear in the logs.
|
|
1042
1153
|
* You can use the name of a company in lowercase, e.g. "github".
|
|
1043
1154
|
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
1044
|
-
icon:
|
|
1155
|
+
icon: import_zod11.z.string().optional(),
|
|
1045
1156
|
/** The key for the Task that you want to appear in the logs */
|
|
1046
|
-
displayKey:
|
|
1157
|
+
displayKey: import_zod11.z.string().optional(),
|
|
1047
1158
|
/** A description of the Task */
|
|
1048
|
-
description:
|
|
1159
|
+
description: import_zod11.z.string().optional(),
|
|
1049
1160
|
/** Properties that are displayed in the logs */
|
|
1050
|
-
properties:
|
|
1161
|
+
properties: import_zod11.z.array(DisplayPropertySchema).optional(),
|
|
1051
1162
|
/** The input params to the Task, will be displayed in the logs */
|
|
1052
|
-
params:
|
|
1163
|
+
params: import_zod11.z.any(),
|
|
1053
1164
|
/** The style of the log entry. */
|
|
1054
1165
|
style: StyleSchema.optional(),
|
|
1055
1166
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1056
|
-
connectionKey:
|
|
1167
|
+
connectionKey: import_zod11.z.string().optional(),
|
|
1057
1168
|
/** 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:
|
|
1169
|
+
operation: import_zod11.z.enum([
|
|
1059
1170
|
"fetch"
|
|
1060
1171
|
]).optional(),
|
|
1061
1172
|
/** 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:
|
|
1173
|
+
noop: import_zod11.z.boolean().default(false),
|
|
1063
1174
|
redact: RedactSchema.optional(),
|
|
1064
1175
|
trigger: TriggerMetadataSchema.optional()
|
|
1065
1176
|
});
|
|
1066
1177
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
1067
|
-
idempotencyKey:
|
|
1068
|
-
parentId:
|
|
1178
|
+
idempotencyKey: import_zod11.z.string(),
|
|
1179
|
+
parentId: import_zod11.z.string().optional()
|
|
1069
1180
|
});
|
|
1070
1181
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1071
1182
|
params: DeserializedJsonSchema.optional().nullable()
|
|
@@ -1077,270 +1188,196 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
|
1077
1188
|
}).extend({
|
|
1078
1189
|
output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
|
|
1079
1190
|
});
|
|
1080
|
-
var FailTaskBodyInputSchema =
|
|
1191
|
+
var FailTaskBodyInputSchema = import_zod11.z.object({
|
|
1081
1192
|
error: ErrorWithStackSchema
|
|
1082
1193
|
});
|
|
1083
|
-
var NormalizedRequestSchema =
|
|
1084
|
-
headers:
|
|
1085
|
-
method:
|
|
1086
|
-
query:
|
|
1087
|
-
url:
|
|
1088
|
-
body:
|
|
1194
|
+
var NormalizedRequestSchema = import_zod11.z.object({
|
|
1195
|
+
headers: import_zod11.z.record(import_zod11.z.string()),
|
|
1196
|
+
method: import_zod11.z.string(),
|
|
1197
|
+
query: import_zod11.z.record(import_zod11.z.string()),
|
|
1198
|
+
url: import_zod11.z.string(),
|
|
1199
|
+
body: import_zod11.z.any()
|
|
1089
1200
|
});
|
|
1090
|
-
var NormalizedResponseSchema =
|
|
1091
|
-
status:
|
|
1092
|
-
body:
|
|
1093
|
-
headers:
|
|
1201
|
+
var NormalizedResponseSchema = import_zod11.z.object({
|
|
1202
|
+
status: import_zod11.z.number(),
|
|
1203
|
+
body: import_zod11.z.any(),
|
|
1204
|
+
headers: import_zod11.z.record(import_zod11.z.string()).optional()
|
|
1094
1205
|
});
|
|
1095
|
-
var HttpSourceResponseSchema =
|
|
1206
|
+
var HttpSourceResponseSchema = import_zod11.z.object({
|
|
1096
1207
|
response: NormalizedResponseSchema,
|
|
1097
|
-
events:
|
|
1208
|
+
events: import_zod11.z.array(RawEventSchema),
|
|
1098
1209
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
1099
1210
|
});
|
|
1100
|
-
var RegisterTriggerBodySchemaV1 =
|
|
1211
|
+
var RegisterTriggerBodySchemaV1 = import_zod11.z.object({
|
|
1101
1212
|
rule: EventRuleSchema,
|
|
1102
1213
|
source: SourceMetadataV1Schema
|
|
1103
1214
|
});
|
|
1104
|
-
var RegisterTriggerBodySchemaV2 =
|
|
1215
|
+
var RegisterTriggerBodySchemaV2 = import_zod11.z.object({
|
|
1105
1216
|
rule: EventRuleSchema,
|
|
1106
1217
|
source: SourceMetadataV2Schema
|
|
1107
1218
|
});
|
|
1108
|
-
var InitializeTriggerBodySchema =
|
|
1109
|
-
id:
|
|
1110
|
-
params:
|
|
1111
|
-
accountId:
|
|
1112
|
-
metadata:
|
|
1219
|
+
var InitializeTriggerBodySchema = import_zod11.z.object({
|
|
1220
|
+
id: import_zod11.z.string(),
|
|
1221
|
+
params: import_zod11.z.any(),
|
|
1222
|
+
accountId: import_zod11.z.string().optional(),
|
|
1223
|
+
metadata: import_zod11.z.any().optional()
|
|
1113
1224
|
});
|
|
1114
|
-
var RegisterCommonScheduleBodySchema =
|
|
1225
|
+
var RegisterCommonScheduleBodySchema = import_zod11.z.object({
|
|
1115
1226
|
/** A unique id for the schedule. This is used to identify and unregister the schedule later. */
|
|
1116
|
-
id:
|
|
1227
|
+
id: import_zod11.z.string(),
|
|
1117
1228
|
/** Any additional metadata about the schedule. */
|
|
1118
|
-
metadata:
|
|
1229
|
+
metadata: import_zod11.z.any(),
|
|
1119
1230
|
/** This will be used by the Trigger.dev Connect feature, which is coming soon. */
|
|
1120
|
-
accountId:
|
|
1231
|
+
accountId: import_zod11.z.string().optional()
|
|
1121
1232
|
});
|
|
1122
1233
|
var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
|
|
1123
1234
|
var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
|
|
1124
|
-
var RegisterScheduleBodySchema =
|
|
1235
|
+
var RegisterScheduleBodySchema = import_zod11.z.discriminatedUnion("type", [
|
|
1125
1236
|
RegisterIntervalScheduleBodySchema,
|
|
1126
1237
|
InitializeCronScheduleBodySchema
|
|
1127
1238
|
]);
|
|
1128
|
-
var RegisterScheduleResponseBodySchema =
|
|
1129
|
-
id:
|
|
1239
|
+
var RegisterScheduleResponseBodySchema = import_zod11.z.object({
|
|
1240
|
+
id: import_zod11.z.string(),
|
|
1130
1241
|
schedule: ScheduleMetadataSchema,
|
|
1131
|
-
metadata:
|
|
1132
|
-
active:
|
|
1242
|
+
metadata: import_zod11.z.any(),
|
|
1243
|
+
active: import_zod11.z.boolean()
|
|
1133
1244
|
});
|
|
1134
|
-
var CreateExternalConnectionBodySchema =
|
|
1135
|
-
accessToken:
|
|
1136
|
-
type:
|
|
1245
|
+
var CreateExternalConnectionBodySchema = import_zod11.z.object({
|
|
1246
|
+
accessToken: import_zod11.z.string(),
|
|
1247
|
+
type: import_zod11.z.enum([
|
|
1137
1248
|
"oauth2"
|
|
1138
1249
|
]),
|
|
1139
|
-
scopes:
|
|
1140
|
-
metadata:
|
|
1250
|
+
scopes: import_zod11.z.array(import_zod11.z.string()).optional(),
|
|
1251
|
+
metadata: import_zod11.z.any()
|
|
1252
|
+
});
|
|
1253
|
+
var GetRunStatusesSchema = import_zod11.z.object({
|
|
1254
|
+
run: import_zod11.z.object({
|
|
1255
|
+
id: import_zod11.z.string(),
|
|
1256
|
+
status: RunStatusSchema,
|
|
1257
|
+
output: import_zod11.z.any().optional()
|
|
1258
|
+
}),
|
|
1259
|
+
statuses: import_zod11.z.array(JobRunStatusRecordSchema)
|
|
1141
1260
|
});
|
|
1142
1261
|
|
|
1143
1262
|
// src/schemas/notifications.ts
|
|
1144
|
-
var
|
|
1263
|
+
var import_zod12 = require("zod");
|
|
1145
1264
|
var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
|
|
1146
1265
|
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:
|
|
1266
|
+
var CommonMissingConnectionNotificationPayloadSchema = import_zod12.z.object({
|
|
1267
|
+
id: import_zod12.z.string(),
|
|
1268
|
+
client: import_zod12.z.object({
|
|
1269
|
+
id: import_zod12.z.string(),
|
|
1270
|
+
title: import_zod12.z.string(),
|
|
1271
|
+
scopes: import_zod12.z.array(import_zod12.z.string()),
|
|
1272
|
+
createdAt: import_zod12.z.coerce.date(),
|
|
1273
|
+
updatedAt: import_zod12.z.coerce.date()
|
|
1155
1274
|
}),
|
|
1156
|
-
authorizationUrl:
|
|
1275
|
+
authorizationUrl: import_zod12.z.string()
|
|
1157
1276
|
});
|
|
1158
1277
|
var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1159
|
-
type:
|
|
1278
|
+
type: import_zod12.z.literal("DEVELOPER")
|
|
1160
1279
|
});
|
|
1161
1280
|
var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
|
|
1162
|
-
type:
|
|
1163
|
-
account:
|
|
1164
|
-
id:
|
|
1165
|
-
metadata:
|
|
1281
|
+
type: import_zod12.z.literal("EXTERNAL"),
|
|
1282
|
+
account: import_zod12.z.object({
|
|
1283
|
+
id: import_zod12.z.string(),
|
|
1284
|
+
metadata: import_zod12.z.any()
|
|
1166
1285
|
})
|
|
1167
1286
|
});
|
|
1168
|
-
var MissingConnectionNotificationPayloadSchema =
|
|
1287
|
+
var MissingConnectionNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
|
|
1169
1288
|
MissingDeveloperConnectionNotificationPayloadSchema,
|
|
1170
1289
|
MissingExternalConnectionNotificationPayloadSchema
|
|
1171
1290
|
]);
|
|
1172
|
-
var CommonMissingConnectionNotificationResolvedPayloadSchema =
|
|
1173
|
-
id:
|
|
1174
|
-
client:
|
|
1175
|
-
id:
|
|
1176
|
-
title:
|
|
1177
|
-
scopes:
|
|
1178
|
-
createdAt:
|
|
1179
|
-
updatedAt:
|
|
1180
|
-
integrationIdentifier:
|
|
1181
|
-
integrationAuthMethod:
|
|
1291
|
+
var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod12.z.object({
|
|
1292
|
+
id: import_zod12.z.string(),
|
|
1293
|
+
client: import_zod12.z.object({
|
|
1294
|
+
id: import_zod12.z.string(),
|
|
1295
|
+
title: import_zod12.z.string(),
|
|
1296
|
+
scopes: import_zod12.z.array(import_zod12.z.string()),
|
|
1297
|
+
createdAt: import_zod12.z.coerce.date(),
|
|
1298
|
+
updatedAt: import_zod12.z.coerce.date(),
|
|
1299
|
+
integrationIdentifier: import_zod12.z.string(),
|
|
1300
|
+
integrationAuthMethod: import_zod12.z.string()
|
|
1182
1301
|
}),
|
|
1183
|
-
expiresAt:
|
|
1302
|
+
expiresAt: import_zod12.z.coerce.date()
|
|
1184
1303
|
});
|
|
1185
1304
|
var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1186
|
-
type:
|
|
1305
|
+
type: import_zod12.z.literal("DEVELOPER")
|
|
1187
1306
|
});
|
|
1188
1307
|
var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
|
|
1189
|
-
type:
|
|
1190
|
-
account:
|
|
1191
|
-
id:
|
|
1192
|
-
metadata:
|
|
1308
|
+
type: import_zod12.z.literal("EXTERNAL"),
|
|
1309
|
+
account: import_zod12.z.object({
|
|
1310
|
+
id: import_zod12.z.string(),
|
|
1311
|
+
metadata: import_zod12.z.any()
|
|
1193
1312
|
})
|
|
1194
1313
|
});
|
|
1195
|
-
var MissingConnectionResolvedNotificationPayloadSchema =
|
|
1314
|
+
var MissingConnectionResolvedNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [
|
|
1196
1315
|
MissingDeveloperConnectionResolvedNotificationPayloadSchema,
|
|
1197
1316
|
MissingExternalConnectionResolvedNotificationPayloadSchema
|
|
1198
1317
|
]);
|
|
1199
1318
|
|
|
1200
1319
|
// src/schemas/fetch.ts
|
|
1201
|
-
var
|
|
1202
|
-
var FetchRetryHeadersStrategySchema =
|
|
1320
|
+
var import_zod13 = require("zod");
|
|
1321
|
+
var FetchRetryHeadersStrategySchema = import_zod13.z.object({
|
|
1203
1322
|
/** The `headers` strategy retries the request using info from the response headers. */
|
|
1204
|
-
strategy:
|
|
1323
|
+
strategy: import_zod13.z.literal("headers"),
|
|
1205
1324
|
/** The header to use to determine the maximum number of times to retry the request. */
|
|
1206
|
-
limitHeader:
|
|
1325
|
+
limitHeader: import_zod13.z.string(),
|
|
1207
1326
|
/** The header to use to determine the number of remaining retries. */
|
|
1208
|
-
remainingHeader:
|
|
1327
|
+
remainingHeader: import_zod13.z.string(),
|
|
1209
1328
|
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
1210
|
-
resetHeader:
|
|
1329
|
+
resetHeader: import_zod13.z.string()
|
|
1211
1330
|
});
|
|
1212
1331
|
var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
|
|
1213
1332
|
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
1214
|
-
strategy:
|
|
1333
|
+
strategy: import_zod13.z.literal("backoff")
|
|
1215
1334
|
});
|
|
1216
|
-
var FetchRetryStrategySchema =
|
|
1335
|
+
var FetchRetryStrategySchema = import_zod13.z.discriminatedUnion("strategy", [
|
|
1217
1336
|
FetchRetryHeadersStrategySchema,
|
|
1218
1337
|
FetchRetryBackoffStrategySchema
|
|
1219
1338
|
]);
|
|
1220
|
-
var FetchRequestInitSchema =
|
|
1339
|
+
var FetchRequestInitSchema = import_zod13.z.object({
|
|
1221
1340
|
/** The HTTP method to use for the request. */
|
|
1222
|
-
method:
|
|
1341
|
+
method: import_zod13.z.string().optional(),
|
|
1223
1342
|
/** 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
|
-
|
|
1343
|
+
headers: import_zod13.z.record(import_zod13.z.union([
|
|
1344
|
+
import_zod13.z.string(),
|
|
1226
1345
|
RedactStringSchema
|
|
1227
1346
|
])).optional(),
|
|
1228
1347
|
/** The body of the request. */
|
|
1229
|
-
body:
|
|
1230
|
-
|
|
1231
|
-
|
|
1348
|
+
body: import_zod13.z.union([
|
|
1349
|
+
import_zod13.z.string(),
|
|
1350
|
+
import_zod13.z.instanceof(ArrayBuffer)
|
|
1232
1351
|
]).optional()
|
|
1233
1352
|
});
|
|
1234
|
-
var FetchRetryOptionsSchema =
|
|
1235
|
-
var FetchOperationSchema =
|
|
1236
|
-
url:
|
|
1353
|
+
var FetchRetryOptionsSchema = import_zod13.z.record(FetchRetryStrategySchema);
|
|
1354
|
+
var FetchOperationSchema = import_zod13.z.object({
|
|
1355
|
+
url: import_zod13.z.string(),
|
|
1237
1356
|
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()
|
|
1357
|
+
retry: import_zod13.z.record(FetchRetryStrategySchema).optional()
|
|
1322
1358
|
});
|
|
1323
1359
|
|
|
1324
1360
|
// src/schemas/events.ts
|
|
1325
|
-
var
|
|
1361
|
+
var import_zod14 = require("zod");
|
|
1362
|
+
var GetEventSchema = import_zod14.z.object({
|
|
1326
1363
|
/** The event id */
|
|
1327
|
-
id:
|
|
1364
|
+
id: import_zod14.z.string(),
|
|
1328
1365
|
/** The event name */
|
|
1329
|
-
name:
|
|
1366
|
+
name: import_zod14.z.string(),
|
|
1330
1367
|
/** When the event was created */
|
|
1331
|
-
createdAt:
|
|
1368
|
+
createdAt: import_zod14.z.coerce.date(),
|
|
1332
1369
|
/** When the event was last updated */
|
|
1333
|
-
updatedAt:
|
|
1370
|
+
updatedAt: import_zod14.z.coerce.date(),
|
|
1334
1371
|
/** The runs that were triggered by the event */
|
|
1335
|
-
runs:
|
|
1372
|
+
runs: import_zod14.z.array(import_zod14.z.object({
|
|
1336
1373
|
/** The Run id */
|
|
1337
|
-
id:
|
|
1374
|
+
id: import_zod14.z.string(),
|
|
1338
1375
|
/** The Run status */
|
|
1339
1376
|
status: RunStatusSchema,
|
|
1340
1377
|
/** When the run started */
|
|
1341
|
-
startedAt:
|
|
1378
|
+
startedAt: import_zod14.z.coerce.date().optional().nullable(),
|
|
1342
1379
|
/** When the run completed */
|
|
1343
|
-
completedAt:
|
|
1380
|
+
completedAt: import_zod14.z.coerce.date().optional().nullable()
|
|
1344
1381
|
}))
|
|
1345
1382
|
});
|
|
1346
1383
|
|