@trigger.dev/core
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -76,2 +76,3 @@ "use strict"; | ||
GetRunSchema: () => GetRunSchema, | ||
GetRunStatusesSchema: () => GetRunStatusesSchema, | ||
GetRunsSchema: () => GetRunsSchema, | ||
@@ -90,2 +91,3 @@ HandleTriggerSourceSchema: () => HandleTriggerSourceSchema, | ||
JobMetadataSchema: () => JobMetadataSchema, | ||
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema, | ||
LogMessageSchema: () => LogMessageSchema, | ||
@@ -131,2 +133,3 @@ Logger: () => Logger, | ||
RunJobErrorSchema: () => RunJobErrorSchema, | ||
RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema, | ||
RunJobResponseSchema: () => RunJobResponseSchema, | ||
@@ -136,2 +139,3 @@ RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema, | ||
RunJobSuccessSchema: () => RunJobSuccessSchema, | ||
RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema, | ||
RunSourceContextSchema: () => RunSourceContextSchema, | ||
@@ -148,2 +152,3 @@ RunStatusSchema: () => RunStatusSchema, | ||
ScheduledTriggerMetadataSchema: () => ScheduledTriggerMetadataSchema, | ||
SchemaErrorSchema: () => SchemaErrorSchema, | ||
SendEventBodySchema: () => SendEventBodySchema, | ||
@@ -155,2 +160,5 @@ SendEventOptionsSchema: () => SendEventOptionsSchema, | ||
StaticTriggerMetadataSchema: () => StaticTriggerMetadataSchema, | ||
StatusHistorySchema: () => StatusHistorySchema, | ||
StatusUpdateSchema: () => StatusUpdateSchema, | ||
StatusUpdateStateSchema: () => StatusUpdateStateSchema, | ||
StyleSchema: () => StyleSchema, | ||
@@ -328,3 +336,3 @@ TaskSchema: () => TaskSchema, | ||
var import_ulid = require("ulid"); | ||
var import_zod9 = require("zod"); | ||
var import_zod11 = require("zod"); | ||
@@ -350,2 +358,6 @@ // src/schemas/addMissingVersionField.ts | ||
}); | ||
var SchemaErrorSchema = import_zod.z.object({ | ||
path: import_zod.z.array(import_zod.z.string()), | ||
message: import_zod.z.string() | ||
}); | ||
@@ -433,3 +445,4 @@ // src/schemas/eventFilter.ts | ||
type: import_zod3.z.enum([ | ||
"oauth2" | ||
"oauth2", | ||
"apiKey" | ||
]), | ||
@@ -450,3 +463,4 @@ accessToken: import_zod3.z.string(), | ||
"HOSTED", | ||
"LOCAL" | ||
"LOCAL", | ||
"RESOLVER" | ||
]) | ||
@@ -524,2 +538,4 @@ }); | ||
options: CronOptionsSchema, | ||
/** An optional Account ID to associate with runs triggered by this interval */ | ||
accountId: import_zod6.z.string().optional(), | ||
metadata: import_zod6.z.any() | ||
@@ -532,2 +548,4 @@ }); | ||
options: IntervalOptionsSchema, | ||
/** An optional Account ID to associate with runs triggered by this interval */ | ||
accountId: import_zod6.z.string().optional(), | ||
/** Any additional metadata about the schedule. */ | ||
@@ -631,26 +649,134 @@ metadata: import_zod6.z.any() | ||
// src/schemas/runs.ts | ||
var import_zod10 = require("zod"); | ||
// src/schemas/statuses.ts | ||
var import_zod9 = require("zod"); | ||
var StatusUpdateStateSchema = import_zod9.z.union([ | ||
import_zod9.z.literal("loading"), | ||
import_zod9.z.literal("success"), | ||
import_zod9.z.literal("failure") | ||
]); | ||
var StatusUpdateDataSchema = import_zod9.z.record(SerializableJsonSchema); | ||
var StatusUpdateSchema = import_zod9.z.object({ | ||
label: import_zod9.z.string().optional(), | ||
state: StatusUpdateStateSchema.optional(), | ||
data: StatusUpdateDataSchema.optional() | ||
}); | ||
var InitalStatusUpdateSchema = StatusUpdateSchema.required({ | ||
label: true | ||
}); | ||
var StatusHistorySchema = import_zod9.z.array(StatusUpdateSchema); | ||
var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({ | ||
key: import_zod9.z.string(), | ||
history: StatusHistorySchema | ||
}); | ||
// src/schemas/runs.ts | ||
var RunStatusSchema = import_zod10.z.union([ | ||
import_zod10.z.literal("PENDING"), | ||
import_zod10.z.literal("QUEUED"), | ||
import_zod10.z.literal("WAITING_ON_CONNECTIONS"), | ||
import_zod10.z.literal("PREPROCESSING"), | ||
import_zod10.z.literal("STARTED"), | ||
import_zod10.z.literal("SUCCESS"), | ||
import_zod10.z.literal("FAILURE"), | ||
import_zod10.z.literal("TIMED_OUT"), | ||
import_zod10.z.literal("ABORTED"), | ||
import_zod10.z.literal("CANCELED"), | ||
import_zod10.z.literal("UNRESOLVED_AUTH"), | ||
import_zod10.z.literal("INVALID_PAYLOAD") | ||
]); | ||
var RunTaskSchema = import_zod10.z.object({ | ||
/** The Task id */ | ||
id: import_zod10.z.string(), | ||
/** The key that you defined when creating the Task, the first param in any task. */ | ||
displayKey: import_zod10.z.string().nullable(), | ||
/** The Task status */ | ||
status: TaskStatusSchema, | ||
/** The name of the Task */ | ||
name: import_zod10.z.string(), | ||
/** The icon of the Task, a string. | ||
* For integrations, this will be a lowercase name of the company. | ||
* Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */ | ||
icon: import_zod10.z.string().nullable(), | ||
/** When the task started */ | ||
startedAt: import_zod10.z.coerce.date().nullable(), | ||
/** When the task completed */ | ||
completedAt: import_zod10.z.coerce.date().nullable() | ||
}); | ||
var RunTaskWithSubtasksSchema = RunTaskSchema.extend({ | ||
subtasks: import_zod10.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional() | ||
}); | ||
var GetRunOptionsSchema = import_zod10.z.object({ | ||
/** Return subtasks, which appear in a `subtasks` array on a task. @default false */ | ||
subtasks: import_zod10.z.boolean().optional(), | ||
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */ | ||
cursor: import_zod10.z.string().optional(), | ||
/** How many tasks you want to return in one go, max 50. @default 20 */ | ||
take: import_zod10.z.number().optional() | ||
}); | ||
var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({ | ||
/** If `true`, it returns the `params` and `output` of all tasks. @default false */ | ||
taskdetails: import_zod10.z.boolean().optional() | ||
}); | ||
var RunSchema = import_zod10.z.object({ | ||
/** The Run id */ | ||
id: import_zod10.z.string(), | ||
/** The Run status */ | ||
status: RunStatusSchema, | ||
/** When the run started */ | ||
startedAt: import_zod10.z.coerce.date().nullable(), | ||
/** When the run was last updated */ | ||
updatedAt: import_zod10.z.coerce.date().nullable(), | ||
/** When the run was completed */ | ||
completedAt: import_zod10.z.coerce.date().nullable() | ||
}); | ||
var GetRunSchema = RunSchema.extend({ | ||
/** The output of the run */ | ||
output: import_zod10.z.any().optional(), | ||
/** The tasks from the run */ | ||
tasks: import_zod10.z.array(RunTaskWithSubtasksSchema), | ||
/** Any status updates that were published from the run */ | ||
statuses: import_zod10.z.array(JobRunStatusRecordSchema).default([]), | ||
/** If there are more tasks, you can use this to get them */ | ||
nextCursor: import_zod10.z.string().optional() | ||
}); | ||
var GetRunsOptionsSchema = import_zod10.z.object({ | ||
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */ | ||
cursor: import_zod10.z.string().optional(), | ||
/** How many runs you want to return in one go, max 50. @default 20 */ | ||
take: import_zod10.z.number().optional() | ||
}); | ||
var GetRunsSchema = import_zod10.z.object({ | ||
/** The runs from the query */ | ||
runs: RunSchema.array(), | ||
/** If there are more runs, you can use this to get them */ | ||
nextCursor: import_zod10.z.string().optional() | ||
}); | ||
// src/schemas/api.ts | ||
var UpdateTriggerSourceBodyV1Schema = import_zod9.z.object({ | ||
registeredEvents: import_zod9.z.array(import_zod9.z.string()), | ||
secret: import_zod9.z.string().optional(), | ||
var UpdateTriggerSourceBodyV1Schema = import_zod11.z.object({ | ||
registeredEvents: import_zod11.z.array(import_zod11.z.string()), | ||
secret: import_zod11.z.string().optional(), | ||
data: SerializableJsonSchema.optional() | ||
}); | ||
var UpdateTriggerSourceBodyV2Schema = import_zod9.z.object({ | ||
secret: import_zod9.z.string().optional(), | ||
var UpdateTriggerSourceBodyV2Schema = import_zod11.z.object({ | ||
secret: import_zod11.z.string().optional(), | ||
data: SerializableJsonSchema.optional(), | ||
options: import_zod9.z.object({ | ||
event: import_zod9.z.array(import_zod9.z.string()) | ||
}).and(import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(import_zod9.z.string())).optional()) | ||
options: import_zod11.z.object({ | ||
event: import_zod11.z.array(import_zod11.z.string()) | ||
}).and(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.array(import_zod11.z.string())).optional()) | ||
}); | ||
var RegisterHTTPTriggerSourceBodySchema = import_zod9.z.object({ | ||
type: import_zod9.z.literal("HTTP"), | ||
url: import_zod9.z.string().url() | ||
var RegisterHTTPTriggerSourceBodySchema = import_zod11.z.object({ | ||
type: import_zod11.z.literal("HTTP"), | ||
url: import_zod11.z.string().url() | ||
}); | ||
var RegisterSMTPTriggerSourceBodySchema = import_zod9.z.object({ | ||
type: import_zod9.z.literal("SMTP") | ||
var RegisterSMTPTriggerSourceBodySchema = import_zod11.z.object({ | ||
type: import_zod11.z.literal("SMTP") | ||
}); | ||
var RegisterSQSTriggerSourceBodySchema = import_zod9.z.object({ | ||
type: import_zod9.z.literal("SQS") | ||
var RegisterSQSTriggerSourceBodySchema = import_zod11.z.object({ | ||
type: import_zod11.z.literal("SQS") | ||
}); | ||
var RegisterSourceChannelBodySchema = import_zod9.z.discriminatedUnion("type", [ | ||
var RegisterSourceChannelBodySchema = import_zod11.z.discriminatedUnion("type", [ | ||
RegisterHTTPTriggerSourceBodySchema, | ||
@@ -662,68 +788,68 @@ RegisterSMTPTriggerSourceBodySchema, | ||
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2"; | ||
var RegisterTriggerSourceSchema = import_zod9.z.object({ | ||
key: import_zod9.z.string(), | ||
params: import_zod9.z.any(), | ||
active: import_zod9.z.boolean(), | ||
secret: import_zod9.z.string(), | ||
var RegisterTriggerSourceSchema = import_zod11.z.object({ | ||
key: import_zod11.z.string(), | ||
params: import_zod11.z.any(), | ||
active: import_zod11.z.boolean(), | ||
secret: import_zod11.z.string(), | ||
data: DeserializedJsonSchema.optional(), | ||
channel: RegisterSourceChannelBodySchema, | ||
clientId: import_zod9.z.string().optional() | ||
clientId: import_zod11.z.string().optional() | ||
}); | ||
var SourceEventOptionSchema = import_zod9.z.object({ | ||
name: import_zod9.z.string(), | ||
value: import_zod9.z.string() | ||
var SourceEventOptionSchema = import_zod11.z.object({ | ||
name: import_zod11.z.string(), | ||
value: import_zod11.z.string() | ||
}); | ||
var RegisterSourceEventSchemaV1 = import_zod9.z.object({ | ||
var RegisterSourceEventSchemaV1 = import_zod11.z.object({ | ||
/** The id of the source */ | ||
id: import_zod9.z.string(), | ||
id: import_zod11.z.string(), | ||
source: RegisterTriggerSourceSchema, | ||
events: import_zod9.z.array(import_zod9.z.string()), | ||
missingEvents: import_zod9.z.array(import_zod9.z.string()), | ||
orphanedEvents: import_zod9.z.array(import_zod9.z.string()), | ||
dynamicTriggerId: import_zod9.z.string().optional() | ||
events: import_zod11.z.array(import_zod11.z.string()), | ||
missingEvents: import_zod11.z.array(import_zod11.z.string()), | ||
orphanedEvents: import_zod11.z.array(import_zod11.z.string()), | ||
dynamicTriggerId: import_zod11.z.string().optional() | ||
}); | ||
var RegisteredOptionsDiffSchema = import_zod9.z.object({ | ||
desired: import_zod9.z.array(import_zod9.z.string()), | ||
missing: import_zod9.z.array(import_zod9.z.string()), | ||
orphaned: import_zod9.z.array(import_zod9.z.string()) | ||
var RegisteredOptionsDiffSchema = import_zod11.z.object({ | ||
desired: import_zod11.z.array(import_zod11.z.string()), | ||
missing: import_zod11.z.array(import_zod11.z.string()), | ||
orphaned: import_zod11.z.array(import_zod11.z.string()) | ||
}); | ||
var RegisterSourceEventOptionsSchema = import_zod9.z.object({ | ||
var RegisterSourceEventOptionsSchema = import_zod11.z.object({ | ||
event: RegisteredOptionsDiffSchema | ||
}).and(import_zod9.z.record(import_zod9.z.string(), RegisteredOptionsDiffSchema)); | ||
var RegisterSourceEventSchemaV2 = import_zod9.z.object({ | ||
}).and(import_zod11.z.record(import_zod11.z.string(), RegisteredOptionsDiffSchema)); | ||
var RegisterSourceEventSchemaV2 = import_zod11.z.object({ | ||
/** The id of the source */ | ||
id: import_zod9.z.string(), | ||
id: import_zod11.z.string(), | ||
source: RegisterTriggerSourceSchema, | ||
options: RegisterSourceEventOptionsSchema, | ||
dynamicTriggerId: import_zod9.z.string().optional() | ||
dynamicTriggerId: import_zod11.z.string().optional() | ||
}); | ||
var TriggerSourceSchema = import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
key: import_zod9.z.string() | ||
var TriggerSourceSchema = import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
key: import_zod11.z.string() | ||
}); | ||
var HttpSourceResponseMetadataSchema = DeserializedJsonSchema; | ||
var HandleTriggerSourceSchema = import_zod9.z.object({ | ||
key: import_zod9.z.string(), | ||
secret: import_zod9.z.string(), | ||
data: import_zod9.z.any(), | ||
params: import_zod9.z.any(), | ||
var HandleTriggerSourceSchema = import_zod11.z.object({ | ||
key: import_zod11.z.string(), | ||
secret: import_zod11.z.string(), | ||
data: import_zod11.z.any(), | ||
params: import_zod11.z.any(), | ||
auth: ConnectionAuthSchema.optional(), | ||
metadata: HttpSourceResponseMetadataSchema.optional() | ||
}); | ||
var HttpSourceRequestSchema = import_zod9.z.object({ | ||
url: import_zod9.z.string().url(), | ||
method: import_zod9.z.string(), | ||
headers: import_zod9.z.record(import_zod9.z.string()), | ||
rawBody: import_zod9.z.instanceof(Buffer).optional().nullable() | ||
var HttpSourceRequestSchema = import_zod11.z.object({ | ||
url: import_zod11.z.string().url(), | ||
method: import_zod11.z.string(), | ||
headers: import_zod11.z.record(import_zod11.z.string()), | ||
rawBody: import_zod11.z.instanceof(Buffer).optional().nullable() | ||
}); | ||
var HttpSourceRequestHeadersSchema = import_zod9.z.object({ | ||
"x-ts-key": import_zod9.z.string(), | ||
"x-ts-dynamic-id": import_zod9.z.string().optional(), | ||
"x-ts-secret": import_zod9.z.string(), | ||
"x-ts-data": import_zod9.z.string().transform((s) => JSON.parse(s)), | ||
"x-ts-params": import_zod9.z.string().transform((s) => JSON.parse(s)), | ||
"x-ts-http-url": import_zod9.z.string(), | ||
"x-ts-http-method": import_zod9.z.string(), | ||
"x-ts-http-headers": import_zod9.z.string().transform((s) => import_zod9.z.record(import_zod9.z.string()).parse(JSON.parse(s))), | ||
"x-ts-auth": import_zod9.z.string().optional().transform((s) => { | ||
var HttpSourceRequestHeadersSchema = import_zod11.z.object({ | ||
"x-ts-key": import_zod11.z.string(), | ||
"x-ts-dynamic-id": import_zod11.z.string().optional(), | ||
"x-ts-secret": import_zod11.z.string(), | ||
"x-ts-data": import_zod11.z.string().transform((s) => JSON.parse(s)), | ||
"x-ts-params": import_zod11.z.string().transform((s) => JSON.parse(s)), | ||
"x-ts-http-url": import_zod11.z.string(), | ||
"x-ts-http-method": import_zod11.z.string(), | ||
"x-ts-http-headers": import_zod11.z.string().transform((s) => import_zod11.z.record(import_zod11.z.string()).parse(JSON.parse(s))), | ||
"x-ts-auth": import_zod11.z.string().optional().transform((s) => { | ||
if (s === void 0) | ||
@@ -734,3 +860,3 @@ return; | ||
}), | ||
"x-ts-metadata": import_zod9.z.string().optional().transform((s) => { | ||
"x-ts-metadata": import_zod11.z.string().optional().transform((s) => { | ||
if (s === void 0) | ||
@@ -742,47 +868,47 @@ return; | ||
}); | ||
var PongSuccessResponseSchema = import_zod9.z.object({ | ||
ok: import_zod9.z.literal(true) | ||
var PongSuccessResponseSchema = import_zod11.z.object({ | ||
ok: import_zod11.z.literal(true) | ||
}); | ||
var PongErrorResponseSchema = import_zod9.z.object({ | ||
ok: import_zod9.z.literal(false), | ||
error: import_zod9.z.string() | ||
var PongErrorResponseSchema = import_zod11.z.object({ | ||
ok: import_zod11.z.literal(false), | ||
error: import_zod11.z.string() | ||
}); | ||
var PongResponseSchema = import_zod9.z.discriminatedUnion("ok", [ | ||
var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [ | ||
PongSuccessResponseSchema, | ||
PongErrorResponseSchema | ||
]); | ||
var ValidateSuccessResponseSchema = import_zod9.z.object({ | ||
ok: import_zod9.z.literal(true), | ||
endpointId: import_zod9.z.string() | ||
var ValidateSuccessResponseSchema = import_zod11.z.object({ | ||
ok: import_zod11.z.literal(true), | ||
endpointId: import_zod11.z.string() | ||
}); | ||
var ValidateErrorResponseSchema = import_zod9.z.object({ | ||
ok: import_zod9.z.literal(false), | ||
error: import_zod9.z.string() | ||
var ValidateErrorResponseSchema = import_zod11.z.object({ | ||
ok: import_zod11.z.literal(false), | ||
error: import_zod11.z.string() | ||
}); | ||
var ValidateResponseSchema = import_zod9.z.discriminatedUnion("ok", [ | ||
var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [ | ||
ValidateSuccessResponseSchema, | ||
ValidateErrorResponseSchema | ||
]); | ||
var QueueOptionsSchema = import_zod9.z.object({ | ||
name: import_zod9.z.string(), | ||
maxConcurrent: import_zod9.z.number().optional() | ||
var QueueOptionsSchema = import_zod11.z.object({ | ||
name: import_zod11.z.string(), | ||
maxConcurrent: import_zod11.z.number().optional() | ||
}); | ||
var JobMetadataSchema = import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
name: import_zod9.z.string(), | ||
version: import_zod9.z.string(), | ||
var JobMetadataSchema = import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
name: import_zod11.z.string(), | ||
version: import_zod11.z.string(), | ||
event: EventSpecificationSchema, | ||
trigger: TriggerMetadataSchema, | ||
integrations: import_zod9.z.record(IntegrationConfigSchema), | ||
internal: import_zod9.z.boolean().default(false), | ||
enabled: import_zod9.z.boolean(), | ||
startPosition: import_zod9.z.enum([ | ||
integrations: import_zod11.z.record(IntegrationConfigSchema), | ||
internal: import_zod11.z.boolean().default(false), | ||
enabled: import_zod11.z.boolean(), | ||
startPosition: import_zod11.z.enum([ | ||
"initial", | ||
"latest" | ||
]), | ||
preprocessRuns: import_zod9.z.boolean() | ||
preprocessRuns: import_zod11.z.boolean() | ||
}); | ||
var SourceMetadataV1Schema = import_zod9.z.object({ | ||
version: import_zod9.z.literal("1"), | ||
channel: import_zod9.z.enum([ | ||
var SourceMetadataV1Schema = import_zod11.z.object({ | ||
version: import_zod11.z.literal("1"), | ||
channel: import_zod11.z.enum([ | ||
"HTTP", | ||
@@ -793,13 +919,13 @@ "SQS", | ||
integration: IntegrationConfigSchema, | ||
key: import_zod9.z.string(), | ||
params: import_zod9.z.any(), | ||
events: import_zod9.z.array(import_zod9.z.string()), | ||
registerSourceJob: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
version: import_zod9.z.string() | ||
key: import_zod11.z.string(), | ||
params: import_zod11.z.any(), | ||
events: import_zod11.z.array(import_zod11.z.string()), | ||
registerSourceJob: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
version: import_zod11.z.string() | ||
}).optional() | ||
}); | ||
var SourceMetadataV2Schema = import_zod9.z.object({ | ||
version: import_zod9.z.literal("2"), | ||
channel: import_zod9.z.enum([ | ||
var SourceMetadataV2Schema = import_zod11.z.object({ | ||
version: import_zod11.z.literal("2"), | ||
channel: import_zod11.z.enum([ | ||
"HTTP", | ||
@@ -810,39 +936,39 @@ "SQS", | ||
integration: IntegrationConfigSchema, | ||
key: import_zod9.z.string(), | ||
params: import_zod9.z.any(), | ||
options: import_zod9.z.record(import_zod9.z.array(import_zod9.z.string())), | ||
registerSourceJob: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
version: import_zod9.z.string() | ||
key: import_zod11.z.string(), | ||
params: import_zod11.z.any(), | ||
options: import_zod11.z.record(import_zod11.z.array(import_zod11.z.string())), | ||
registerSourceJob: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
version: import_zod11.z.string() | ||
}).optional() | ||
}); | ||
var SourceMetadataSchema = import_zod9.z.preprocess(addMissingVersionField, import_zod9.z.discriminatedUnion("version", [ | ||
var SourceMetadataSchema = import_zod11.z.preprocess(addMissingVersionField, import_zod11.z.discriminatedUnion("version", [ | ||
SourceMetadataV1Schema, | ||
SourceMetadataV2Schema | ||
])); | ||
var DynamicTriggerEndpointMetadataSchema = import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
jobs: import_zod9.z.array(JobMetadataSchema.pick({ | ||
var DynamicTriggerEndpointMetadataSchema = import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
jobs: import_zod11.z.array(JobMetadataSchema.pick({ | ||
id: true, | ||
version: true | ||
})), | ||
registerSourceJob: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
version: import_zod9.z.string() | ||
registerSourceJob: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
version: import_zod11.z.string() | ||
}).optional() | ||
}); | ||
var IndexEndpointResponseSchema = import_zod9.z.object({ | ||
jobs: import_zod9.z.array(JobMetadataSchema), | ||
sources: import_zod9.z.array(SourceMetadataSchema), | ||
dynamicTriggers: import_zod9.z.array(DynamicTriggerEndpointMetadataSchema), | ||
dynamicSchedules: import_zod9.z.array(RegisterDynamicSchedulePayloadSchema) | ||
var IndexEndpointResponseSchema = import_zod11.z.object({ | ||
jobs: import_zod11.z.array(JobMetadataSchema), | ||
sources: import_zod11.z.array(SourceMetadataSchema), | ||
dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema), | ||
dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema) | ||
}); | ||
var RawEventSchema = import_zod9.z.object({ | ||
var RawEventSchema = import_zod11.z.object({ | ||
/** The `name` property must exactly match any subscriptions you want to | ||
trigger. */ | ||
name: import_zod9.z.string(), | ||
name: import_zod11.z.string(), | ||
/** The `payload` property will be sent to any matching Jobs and will appear | ||
as the `payload` param of the `run()` function. You can leave this | ||
parameter out if you just want to trigger a Job without any input data. */ | ||
payload: import_zod9.z.any(), | ||
payload: import_zod11.z.any(), | ||
/** The optional `context` property will be sent to any matching Jobs and will | ||
@@ -852,6 +978,6 @@ be passed through as the `context.event.context` param of the `run()` | ||
some additional context to the Job. */ | ||
context: import_zod9.z.any().optional(), | ||
context: import_zod11.z.any().optional(), | ||
/** The `id` property uniquely identify this particular event. If unset it | ||
will be set automatically using `ulid`. */ | ||
id: import_zod9.z.string().default(() => (0, import_ulid.ulid)()), | ||
id: import_zod11.z.string().default(() => (0, import_ulid.ulid)()), | ||
/** This is optional, it defaults to the current timestamp. Usually you would | ||
@@ -861,13 +987,13 @@ only set this if you have a timestamp that you wish to pass through, e.g. | ||
be used in your Job. */ | ||
timestamp: import_zod9.z.coerce.date().optional(), | ||
timestamp: import_zod11.z.coerce.date().optional(), | ||
/** This is optional, it defaults to "trigger.dev". It can be useful to set | ||
this as you can filter events using this in the `eventTrigger()`. */ | ||
source: import_zod9.z.string().optional() | ||
source: import_zod11.z.string().optional() | ||
}); | ||
var ApiEventLogSchema = import_zod9.z.object({ | ||
var ApiEventLogSchema = import_zod11.z.object({ | ||
/** The `id` of the event that was sent. | ||
*/ | ||
id: import_zod9.z.string(), | ||
id: import_zod11.z.string(), | ||
/** The `name` of the event that was sent. */ | ||
name: import_zod9.z.string(), | ||
name: import_zod11.z.string(), | ||
/** The `payload` of the event that was sent */ | ||
@@ -879,35 +1005,35 @@ payload: DeserializedJsonSchema, | ||
/** The `timestamp` of the event that was sent */ | ||
timestamp: import_zod9.z.coerce.date(), | ||
timestamp: import_zod11.z.coerce.date(), | ||
/** The timestamp when the event will be delivered to any matching Jobs. Is | ||
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the | ||
event. */ | ||
deliverAt: import_zod9.z.coerce.date().optional().nullable(), | ||
deliverAt: import_zod11.z.coerce.date().optional().nullable(), | ||
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt` | ||
or `deliverAfter` were set when sending the event. */ | ||
deliveredAt: import_zod9.z.coerce.date().optional().nullable(), | ||
deliveredAt: import_zod11.z.coerce.date().optional().nullable(), | ||
/** The timestamp when the event was cancelled. Is `undefined` if the event | ||
* wasn't cancelled. */ | ||
cancelledAt: import_zod9.z.coerce.date().optional().nullable() | ||
cancelledAt: import_zod11.z.coerce.date().optional().nullable() | ||
}); | ||
var SendEventOptionsSchema = import_zod9.z.object({ | ||
var SendEventOptionsSchema = import_zod11.z.object({ | ||
/** An optional Date when you want the event to trigger Jobs. The event will | ||
be sent to the platform immediately but won't be acted upon until the | ||
specified time. */ | ||
deliverAt: import_zod9.z.coerce.date().optional(), | ||
deliverAt: import_zod11.z.coerce.date().optional(), | ||
/** An optional number of seconds you want to wait for the event to trigger | ||
any relevant Jobs. The event will be sent to the platform immediately but | ||
won't be delivered until after the elapsed number of seconds. */ | ||
deliverAfter: import_zod9.z.number().int().optional(), | ||
deliverAfter: import_zod11.z.number().int().optional(), | ||
/** This optional param will be used by Trigger.dev Connect, which | ||
is coming soon. */ | ||
accountId: import_zod9.z.string().optional() | ||
accountId: import_zod11.z.string().optional() | ||
}); | ||
var SendEventBodySchema = import_zod9.z.object({ | ||
var SendEventBodySchema = import_zod11.z.object({ | ||
event: RawEventSchema, | ||
options: SendEventOptionsSchema.optional() | ||
}); | ||
var DeliverEventResponseSchema = import_zod9.z.object({ | ||
deliveredAt: import_zod9.z.string().datetime() | ||
var DeliverEventResponseSchema = import_zod11.z.object({ | ||
deliveredAt: import_zod11.z.string().datetime() | ||
}); | ||
var RuntimeEnvironmentTypeSchema = import_zod9.z.enum([ | ||
var RuntimeEnvironmentTypeSchema = import_zod11.z.enum([ | ||
"PRODUCTION", | ||
@@ -918,61 +1044,74 @@ "STAGING", | ||
]); | ||
var RunSourceContextSchema = import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
metadata: import_zod9.z.any() | ||
var RunSourceContextSchema = import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
metadata: import_zod11.z.any() | ||
}); | ||
var RunJobBodySchema = import_zod9.z.object({ | ||
var RunJobBodySchema = import_zod11.z.object({ | ||
event: ApiEventLogSchema, | ||
job: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
version: import_zod9.z.string() | ||
job: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
version: import_zod11.z.string() | ||
}), | ||
run: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
isTest: import_zod9.z.boolean(), | ||
isRetry: import_zod9.z.boolean().default(false), | ||
startedAt: import_zod9.z.coerce.date() | ||
run: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
isTest: import_zod11.z.boolean(), | ||
isRetry: import_zod11.z.boolean().default(false), | ||
startedAt: import_zod11.z.coerce.date() | ||
}), | ||
environment: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
slug: import_zod9.z.string(), | ||
environment: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
slug: import_zod11.z.string(), | ||
type: RuntimeEnvironmentTypeSchema | ||
}), | ||
organization: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
title: import_zod9.z.string(), | ||
slug: import_zod9.z.string() | ||
organization: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
title: import_zod11.z.string(), | ||
slug: import_zod11.z.string() | ||
}), | ||
account: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
metadata: import_zod9.z.any() | ||
account: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
metadata: import_zod11.z.any() | ||
}).optional(), | ||
source: RunSourceContextSchema.optional(), | ||
tasks: import_zod9.z.array(CachedTaskSchema).optional(), | ||
connections: import_zod9.z.record(ConnectionAuthSchema).optional() | ||
tasks: import_zod11.z.array(CachedTaskSchema).optional(), | ||
connections: import_zod11.z.record(ConnectionAuthSchema).optional() | ||
}); | ||
var RunJobErrorSchema = import_zod9.z.object({ | ||
status: import_zod9.z.literal("ERROR"), | ||
var RunJobErrorSchema = import_zod11.z.object({ | ||
status: import_zod11.z.literal("ERROR"), | ||
error: ErrorWithStackSchema, | ||
task: TaskSchema.optional() | ||
}); | ||
var RunJobResumeWithTaskSchema = import_zod9.z.object({ | ||
status: import_zod9.z.literal("RESUME_WITH_TASK"), | ||
var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({ | ||
status: import_zod11.z.literal("INVALID_PAYLOAD"), | ||
errors: import_zod11.z.array(SchemaErrorSchema) | ||
}); | ||
var RunJobUnresolvedAuthErrorSchema = import_zod11.z.object({ | ||
status: import_zod11.z.literal("UNRESOLVED_AUTH_ERROR"), | ||
issues: import_zod11.z.record(import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
error: import_zod11.z.string() | ||
})) | ||
}); | ||
var RunJobResumeWithTaskSchema = import_zod11.z.object({ | ||
status: import_zod11.z.literal("RESUME_WITH_TASK"), | ||
task: TaskSchema | ||
}); | ||
var RunJobRetryWithTaskSchema = import_zod9.z.object({ | ||
status: import_zod9.z.literal("RETRY_WITH_TASK"), | ||
var RunJobRetryWithTaskSchema = import_zod11.z.object({ | ||
status: import_zod11.z.literal("RETRY_WITH_TASK"), | ||
task: TaskSchema, | ||
error: ErrorWithStackSchema, | ||
retryAt: import_zod9.z.coerce.date() | ||
retryAt: import_zod11.z.coerce.date() | ||
}); | ||
var RunJobCanceledWithTaskSchema = import_zod9.z.object({ | ||
status: import_zod9.z.literal("CANCELED"), | ||
var RunJobCanceledWithTaskSchema = import_zod11.z.object({ | ||
status: import_zod11.z.literal("CANCELED"), | ||
task: TaskSchema | ||
}); | ||
var RunJobSuccessSchema = import_zod9.z.object({ | ||
status: import_zod9.z.literal("SUCCESS"), | ||
var RunJobSuccessSchema = import_zod11.z.object({ | ||
status: import_zod11.z.literal("SUCCESS"), | ||
output: DeserializedJsonSchema.optional() | ||
}); | ||
var RunJobResponseSchema = import_zod9.z.discriminatedUnion("status", [ | ||
var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [ | ||
RunJobErrorSchema, | ||
RunJobUnresolvedAuthErrorSchema, | ||
RunJobInvalidPayloadErrorSchema, | ||
RunJobResumeWithTaskSchema, | ||
@@ -983,52 +1122,52 @@ RunJobRetryWithTaskSchema, | ||
]); | ||
var PreprocessRunBodySchema = import_zod9.z.object({ | ||
var PreprocessRunBodySchema = import_zod11.z.object({ | ||
event: ApiEventLogSchema, | ||
job: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
version: import_zod9.z.string() | ||
job: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
version: import_zod11.z.string() | ||
}), | ||
run: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
isTest: import_zod9.z.boolean() | ||
run: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
isTest: import_zod11.z.boolean() | ||
}), | ||
environment: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
slug: import_zod9.z.string(), | ||
environment: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
slug: import_zod11.z.string(), | ||
type: RuntimeEnvironmentTypeSchema | ||
}), | ||
organization: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
title: import_zod9.z.string(), | ||
slug: import_zod9.z.string() | ||
organization: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
title: import_zod11.z.string(), | ||
slug: import_zod11.z.string() | ||
}), | ||
account: import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
metadata: import_zod9.z.any() | ||
account: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
metadata: import_zod11.z.any() | ||
}).optional() | ||
}); | ||
var PreprocessRunResponseSchema = import_zod9.z.object({ | ||
abort: import_zod9.z.boolean(), | ||
properties: import_zod9.z.array(DisplayPropertySchema).optional() | ||
var PreprocessRunResponseSchema = import_zod11.z.object({ | ||
abort: import_zod11.z.boolean(), | ||
properties: import_zod11.z.array(DisplayPropertySchema).optional() | ||
}); | ||
var CreateRunResponseOkSchema = import_zod9.z.object({ | ||
ok: import_zod9.z.literal(true), | ||
data: import_zod9.z.object({ | ||
id: import_zod9.z.string() | ||
var CreateRunResponseOkSchema = import_zod11.z.object({ | ||
ok: import_zod11.z.literal(true), | ||
data: import_zod11.z.object({ | ||
id: import_zod11.z.string() | ||
}) | ||
}); | ||
var CreateRunResponseErrorSchema = import_zod9.z.object({ | ||
ok: import_zod9.z.literal(false), | ||
error: import_zod9.z.string() | ||
var CreateRunResponseErrorSchema = import_zod11.z.object({ | ||
ok: import_zod11.z.literal(false), | ||
error: import_zod11.z.string() | ||
}); | ||
var CreateRunResponseBodySchema = import_zod9.z.discriminatedUnion("ok", [ | ||
var CreateRunResponseBodySchema = import_zod11.z.discriminatedUnion("ok", [ | ||
CreateRunResponseOkSchema, | ||
CreateRunResponseErrorSchema | ||
]); | ||
var RedactStringSchema = import_zod9.z.object({ | ||
__redactedString: import_zod9.z.literal(true), | ||
strings: import_zod9.z.array(import_zod9.z.string()), | ||
interpolations: import_zod9.z.array(import_zod9.z.string()) | ||
var RedactStringSchema = import_zod11.z.object({ | ||
__redactedString: import_zod11.z.literal(true), | ||
strings: import_zod11.z.array(import_zod11.z.string()), | ||
interpolations: import_zod11.z.array(import_zod11.z.string()) | ||
}); | ||
var LogMessageSchema = import_zod9.z.object({ | ||
level: import_zod9.z.enum([ | ||
var LogMessageSchema = import_zod11.z.object({ | ||
level: import_zod11.z.enum([ | ||
"DEBUG", | ||
@@ -1039,25 +1178,25 @@ "INFO", | ||
]), | ||
message: import_zod9.z.string(), | ||
message: import_zod11.z.string(), | ||
data: SerializableJsonSchema.optional() | ||
}); | ||
var RedactSchema = import_zod9.z.object({ | ||
paths: import_zod9.z.array(import_zod9.z.string()) | ||
var RedactSchema = import_zod11.z.object({ | ||
paths: import_zod11.z.array(import_zod11.z.string()) | ||
}); | ||
var RetryOptionsSchema = import_zod9.z.object({ | ||
var RetryOptionsSchema = import_zod11.z.object({ | ||
/** The maximum number of times to retry the request. */ | ||
limit: import_zod9.z.number().optional(), | ||
limit: import_zod11.z.number().optional(), | ||
/** The exponential factor to use when calculating the next retry time. */ | ||
factor: import_zod9.z.number().optional(), | ||
factor: import_zod11.z.number().optional(), | ||
/** The minimum amount of time to wait before retrying the request. */ | ||
minTimeoutInMs: import_zod9.z.number().optional(), | ||
minTimeoutInMs: import_zod11.z.number().optional(), | ||
/** The maximum amount of time to wait before retrying the request. */ | ||
maxTimeoutInMs: import_zod9.z.number().optional(), | ||
maxTimeoutInMs: import_zod11.z.number().optional(), | ||
/** Whether to randomize the retry time. */ | ||
randomize: import_zod9.z.boolean().optional() | ||
randomize: import_zod11.z.boolean().optional() | ||
}); | ||
var RunTaskOptionsSchema = import_zod9.z.object({ | ||
var RunTaskOptionsSchema = import_zod11.z.object({ | ||
/** The name of the Task is required. This is displayed on the Task in the logs. */ | ||
name: import_zod9.z.string().optional(), | ||
name: import_zod11.z.string().optional(), | ||
/** The Task will wait and only start at the specified Date */ | ||
delayUntil: import_zod9.z.coerce.date().optional(), | ||
delayUntil: import_zod11.z.coerce.date().optional(), | ||
/** Retry options */ | ||
@@ -1068,21 +1207,21 @@ retry: RetryOptionsSchema.optional(), | ||
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */ | ||
icon: import_zod9.z.string().optional(), | ||
icon: import_zod11.z.string().optional(), | ||
/** The key for the Task that you want to appear in the logs */ | ||
displayKey: import_zod9.z.string().optional(), | ||
displayKey: import_zod11.z.string().optional(), | ||
/** A description of the Task */ | ||
description: import_zod9.z.string().optional(), | ||
description: import_zod11.z.string().optional(), | ||
/** Properties that are displayed in the logs */ | ||
properties: import_zod9.z.array(DisplayPropertySchema).optional(), | ||
properties: import_zod11.z.array(DisplayPropertySchema).optional(), | ||
/** The input params to the Task, will be displayed in the logs */ | ||
params: import_zod9.z.any(), | ||
params: import_zod11.z.any(), | ||
/** The style of the log entry. */ | ||
style: StyleSchema.optional(), | ||
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */ | ||
connectionKey: import_zod9.z.string().optional(), | ||
connectionKey: import_zod11.z.string().optional(), | ||
/** 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. */ | ||
operation: import_zod9.z.enum([ | ||
operation: import_zod11.z.enum([ | ||
"fetch" | ||
]).optional(), | ||
/** 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). */ | ||
noop: import_zod9.z.boolean().default(false), | ||
noop: import_zod11.z.boolean().default(false), | ||
redact: RedactSchema.optional(), | ||
@@ -1092,4 +1231,4 @@ trigger: TriggerMetadataSchema.optional() | ||
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({ | ||
idempotencyKey: import_zod9.z.string(), | ||
parentId: import_zod9.z.string().optional() | ||
idempotencyKey: import_zod11.z.string(), | ||
parentId: import_zod11.z.string().optional() | ||
}); | ||
@@ -1106,118 +1245,127 @@ var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({ | ||
}); | ||
var FailTaskBodyInputSchema = import_zod9.z.object({ | ||
var FailTaskBodyInputSchema = import_zod11.z.object({ | ||
error: ErrorWithStackSchema | ||
}); | ||
var NormalizedRequestSchema = import_zod9.z.object({ | ||
headers: import_zod9.z.record(import_zod9.z.string()), | ||
method: import_zod9.z.string(), | ||
query: import_zod9.z.record(import_zod9.z.string()), | ||
url: import_zod9.z.string(), | ||
body: import_zod9.z.any() | ||
var NormalizedRequestSchema = import_zod11.z.object({ | ||
headers: import_zod11.z.record(import_zod11.z.string()), | ||
method: import_zod11.z.string(), | ||
query: import_zod11.z.record(import_zod11.z.string()), | ||
url: import_zod11.z.string(), | ||
body: import_zod11.z.any() | ||
}); | ||
var NormalizedResponseSchema = import_zod9.z.object({ | ||
status: import_zod9.z.number(), | ||
body: import_zod9.z.any(), | ||
headers: import_zod9.z.record(import_zod9.z.string()).optional() | ||
var NormalizedResponseSchema = import_zod11.z.object({ | ||
status: import_zod11.z.number(), | ||
body: import_zod11.z.any(), | ||
headers: import_zod11.z.record(import_zod11.z.string()).optional() | ||
}); | ||
var HttpSourceResponseSchema = import_zod9.z.object({ | ||
var HttpSourceResponseSchema = import_zod11.z.object({ | ||
response: NormalizedResponseSchema, | ||
events: import_zod9.z.array(RawEventSchema), | ||
events: import_zod11.z.array(RawEventSchema), | ||
metadata: HttpSourceResponseMetadataSchema.optional() | ||
}); | ||
var RegisterTriggerBodySchemaV1 = import_zod9.z.object({ | ||
var RegisterTriggerBodySchemaV1 = import_zod11.z.object({ | ||
rule: EventRuleSchema, | ||
source: SourceMetadataV1Schema | ||
}); | ||
var RegisterTriggerBodySchemaV2 = import_zod9.z.object({ | ||
var RegisterTriggerBodySchemaV2 = import_zod11.z.object({ | ||
rule: EventRuleSchema, | ||
source: SourceMetadataV2Schema | ||
source: SourceMetadataV2Schema, | ||
accountId: import_zod11.z.string().optional() | ||
}); | ||
var InitializeTriggerBodySchema = import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
params: import_zod9.z.any(), | ||
accountId: import_zod9.z.string().optional(), | ||
metadata: import_zod9.z.any().optional() | ||
var InitializeTriggerBodySchema = import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
params: import_zod11.z.any(), | ||
accountId: import_zod11.z.string().optional(), | ||
metadata: import_zod11.z.any().optional() | ||
}); | ||
var RegisterCommonScheduleBodySchema = import_zod9.z.object({ | ||
var RegisterCommonScheduleBodySchema = import_zod11.z.object({ | ||
/** A unique id for the schedule. This is used to identify and unregister the schedule later. */ | ||
id: import_zod9.z.string(), | ||
id: import_zod11.z.string(), | ||
/** Any additional metadata about the schedule. */ | ||
metadata: import_zod9.z.any(), | ||
/** This will be used by the Trigger.dev Connect feature, which is coming soon. */ | ||
accountId: import_zod9.z.string().optional() | ||
metadata: import_zod11.z.any(), | ||
/** An optional Account ID to associate with runs triggered by this schedule */ | ||
accountId: import_zod11.z.string().optional() | ||
}); | ||
var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema); | ||
var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema); | ||
var RegisterScheduleBodySchema = import_zod9.z.discriminatedUnion("type", [ | ||
var RegisterScheduleBodySchema = import_zod11.z.discriminatedUnion("type", [ | ||
RegisterIntervalScheduleBodySchema, | ||
InitializeCronScheduleBodySchema | ||
]); | ||
var RegisterScheduleResponseBodySchema = import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
var RegisterScheduleResponseBodySchema = import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
schedule: ScheduleMetadataSchema, | ||
metadata: import_zod9.z.any(), | ||
active: import_zod9.z.boolean() | ||
metadata: import_zod11.z.any(), | ||
active: import_zod11.z.boolean() | ||
}); | ||
var CreateExternalConnectionBodySchema = import_zod9.z.object({ | ||
accessToken: import_zod9.z.string(), | ||
type: import_zod9.z.enum([ | ||
var CreateExternalConnectionBodySchema = import_zod11.z.object({ | ||
accessToken: import_zod11.z.string(), | ||
type: import_zod11.z.enum([ | ||
"oauth2" | ||
]), | ||
scopes: import_zod9.z.array(import_zod9.z.string()).optional(), | ||
metadata: import_zod9.z.any() | ||
scopes: import_zod11.z.array(import_zod11.z.string()).optional(), | ||
metadata: import_zod11.z.any() | ||
}); | ||
var GetRunStatusesSchema = import_zod11.z.object({ | ||
run: import_zod11.z.object({ | ||
id: import_zod11.z.string(), | ||
status: RunStatusSchema, | ||
output: import_zod11.z.any().optional() | ||
}), | ||
statuses: import_zod11.z.array(JobRunStatusRecordSchema) | ||
}); | ||
// src/schemas/notifications.ts | ||
var import_zod10 = require("zod"); | ||
var import_zod12 = require("zod"); | ||
var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection"; | ||
var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved"; | ||
var CommonMissingConnectionNotificationPayloadSchema = import_zod10.z.object({ | ||
id: import_zod10.z.string(), | ||
client: import_zod10.z.object({ | ||
id: import_zod10.z.string(), | ||
title: import_zod10.z.string(), | ||
scopes: import_zod10.z.array(import_zod10.z.string()), | ||
createdAt: import_zod10.z.coerce.date(), | ||
updatedAt: import_zod10.z.coerce.date() | ||
var CommonMissingConnectionNotificationPayloadSchema = import_zod12.z.object({ | ||
id: import_zod12.z.string(), | ||
client: import_zod12.z.object({ | ||
id: import_zod12.z.string(), | ||
title: import_zod12.z.string(), | ||
scopes: import_zod12.z.array(import_zod12.z.string()), | ||
createdAt: import_zod12.z.coerce.date(), | ||
updatedAt: import_zod12.z.coerce.date() | ||
}), | ||
authorizationUrl: import_zod10.z.string() | ||
authorizationUrl: import_zod12.z.string() | ||
}); | ||
var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({ | ||
type: import_zod10.z.literal("DEVELOPER") | ||
type: import_zod12.z.literal("DEVELOPER") | ||
}); | ||
var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({ | ||
type: import_zod10.z.literal("EXTERNAL"), | ||
account: import_zod10.z.object({ | ||
id: import_zod10.z.string(), | ||
metadata: import_zod10.z.any() | ||
type: import_zod12.z.literal("EXTERNAL"), | ||
account: import_zod12.z.object({ | ||
id: import_zod12.z.string(), | ||
metadata: import_zod12.z.any() | ||
}) | ||
}); | ||
var MissingConnectionNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [ | ||
var MissingConnectionNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [ | ||
MissingDeveloperConnectionNotificationPayloadSchema, | ||
MissingExternalConnectionNotificationPayloadSchema | ||
]); | ||
var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod10.z.object({ | ||
id: import_zod10.z.string(), | ||
client: import_zod10.z.object({ | ||
id: import_zod10.z.string(), | ||
title: import_zod10.z.string(), | ||
scopes: import_zod10.z.array(import_zod10.z.string()), | ||
createdAt: import_zod10.z.coerce.date(), | ||
updatedAt: import_zod10.z.coerce.date(), | ||
integrationIdentifier: import_zod10.z.string(), | ||
integrationAuthMethod: import_zod10.z.string() | ||
var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod12.z.object({ | ||
id: import_zod12.z.string(), | ||
client: import_zod12.z.object({ | ||
id: import_zod12.z.string(), | ||
title: import_zod12.z.string(), | ||
scopes: import_zod12.z.array(import_zod12.z.string()), | ||
createdAt: import_zod12.z.coerce.date(), | ||
updatedAt: import_zod12.z.coerce.date(), | ||
integrationIdentifier: import_zod12.z.string(), | ||
integrationAuthMethod: import_zod12.z.string() | ||
}), | ||
expiresAt: import_zod10.z.coerce.date() | ||
expiresAt: import_zod12.z.coerce.date() | ||
}); | ||
var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({ | ||
type: import_zod10.z.literal("DEVELOPER") | ||
type: import_zod12.z.literal("DEVELOPER") | ||
}); | ||
var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({ | ||
type: import_zod10.z.literal("EXTERNAL"), | ||
account: import_zod10.z.object({ | ||
id: import_zod10.z.string(), | ||
metadata: import_zod10.z.any() | ||
type: import_zod12.z.literal("EXTERNAL"), | ||
account: import_zod12.z.object({ | ||
id: import_zod12.z.string(), | ||
metadata: import_zod12.z.any() | ||
}) | ||
}); | ||
var MissingConnectionResolvedNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [ | ||
var MissingConnectionResolvedNotificationPayloadSchema = import_zod12.z.discriminatedUnion("type", [ | ||
MissingDeveloperConnectionResolvedNotificationPayloadSchema, | ||
@@ -1228,145 +1376,63 @@ MissingExternalConnectionResolvedNotificationPayloadSchema | ||
// src/schemas/fetch.ts | ||
var import_zod11 = require("zod"); | ||
var FetchRetryHeadersStrategySchema = import_zod11.z.object({ | ||
var import_zod13 = require("zod"); | ||
var FetchRetryHeadersStrategySchema = import_zod13.z.object({ | ||
/** The `headers` strategy retries the request using info from the response headers. */ | ||
strategy: import_zod11.z.literal("headers"), | ||
strategy: import_zod13.z.literal("headers"), | ||
/** The header to use to determine the maximum number of times to retry the request. */ | ||
limitHeader: import_zod11.z.string(), | ||
limitHeader: import_zod13.z.string(), | ||
/** The header to use to determine the number of remaining retries. */ | ||
remainingHeader: import_zod11.z.string(), | ||
remainingHeader: import_zod13.z.string(), | ||
/** The header to use to determine the time when the number of remaining retries will be reset. */ | ||
resetHeader: import_zod11.z.string() | ||
resetHeader: import_zod13.z.string() | ||
}); | ||
var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({ | ||
/** The `backoff` strategy retries the request with an exponential backoff. */ | ||
strategy: import_zod11.z.literal("backoff") | ||
strategy: import_zod13.z.literal("backoff") | ||
}); | ||
var FetchRetryStrategySchema = import_zod11.z.discriminatedUnion("strategy", [ | ||
var FetchRetryStrategySchema = import_zod13.z.discriminatedUnion("strategy", [ | ||
FetchRetryHeadersStrategySchema, | ||
FetchRetryBackoffStrategySchema | ||
]); | ||
var FetchRequestInitSchema = import_zod11.z.object({ | ||
var FetchRequestInitSchema = import_zod13.z.object({ | ||
/** The HTTP method to use for the request. */ | ||
method: import_zod11.z.string().optional(), | ||
method: import_zod13.z.string().optional(), | ||
/** 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. */ | ||
headers: import_zod11.z.record(import_zod11.z.union([ | ||
import_zod11.z.string(), | ||
headers: import_zod13.z.record(import_zod13.z.union([ | ||
import_zod13.z.string(), | ||
RedactStringSchema | ||
])).optional(), | ||
/** The body of the request. */ | ||
body: import_zod11.z.union([ | ||
import_zod11.z.string(), | ||
import_zod11.z.instanceof(ArrayBuffer) | ||
body: import_zod13.z.union([ | ||
import_zod13.z.string(), | ||
import_zod13.z.instanceof(ArrayBuffer) | ||
]).optional() | ||
}); | ||
var FetchRetryOptionsSchema = import_zod11.z.record(FetchRetryStrategySchema); | ||
var FetchOperationSchema = import_zod11.z.object({ | ||
url: import_zod11.z.string(), | ||
var FetchRetryOptionsSchema = import_zod13.z.record(FetchRetryStrategySchema); | ||
var FetchOperationSchema = import_zod13.z.object({ | ||
url: import_zod13.z.string(), | ||
requestInit: FetchRequestInitSchema.optional(), | ||
retry: import_zod11.z.record(FetchRetryStrategySchema).optional() | ||
retry: import_zod13.z.record(FetchRetryStrategySchema).optional() | ||
}); | ||
// src/schemas/events.ts | ||
var import_zod13 = require("zod"); | ||
// src/schemas/runs.ts | ||
var import_zod12 = require("zod"); | ||
var RunStatusSchema = import_zod12.z.union([ | ||
import_zod12.z.literal("PENDING"), | ||
import_zod12.z.literal("QUEUED"), | ||
import_zod12.z.literal("WAITING_ON_CONNECTIONS"), | ||
import_zod12.z.literal("PREPROCESSING"), | ||
import_zod12.z.literal("STARTED"), | ||
import_zod12.z.literal("SUCCESS"), | ||
import_zod12.z.literal("FAILURE"), | ||
import_zod12.z.literal("TIMED_OUT"), | ||
import_zod12.z.literal("ABORTED"), | ||
import_zod12.z.literal("CANCELED") | ||
]); | ||
var RunTaskSchema = import_zod12.z.object({ | ||
/** The Task id */ | ||
id: import_zod12.z.string(), | ||
/** The key that you defined when creating the Task, the first param in any task. */ | ||
displayKey: import_zod12.z.string().nullable(), | ||
/** The Task status */ | ||
status: TaskStatusSchema, | ||
/** The name of the Task */ | ||
name: import_zod12.z.string(), | ||
/** The icon of the Task, a string. | ||
* For integrations, this will be a lowercase name of the company. | ||
* Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */ | ||
icon: import_zod12.z.string().nullable(), | ||
/** When the task started */ | ||
startedAt: import_zod12.z.coerce.date().nullable(), | ||
/** When the task completed */ | ||
completedAt: import_zod12.z.coerce.date().nullable() | ||
}); | ||
var RunTaskWithSubtasksSchema = RunTaskSchema.extend({ | ||
subtasks: import_zod12.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional() | ||
}); | ||
var GetRunOptionsSchema = import_zod12.z.object({ | ||
/** Return subtasks, which appear in a `subtasks` array on a task. @default false */ | ||
subtasks: import_zod12.z.boolean().optional(), | ||
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */ | ||
cursor: import_zod12.z.string().optional(), | ||
/** How many tasks you want to return in one go, max 50. @default 20 */ | ||
take: import_zod12.z.number().optional() | ||
}); | ||
var GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({ | ||
/** If `true`, it returns the `params` and `output` of all tasks. @default false */ | ||
taskdetails: import_zod12.z.boolean().optional() | ||
}); | ||
var RunSchema = import_zod12.z.object({ | ||
/** The Run id */ | ||
id: import_zod12.z.string(), | ||
/** The Run status */ | ||
status: RunStatusSchema, | ||
/** When the run started */ | ||
startedAt: import_zod12.z.coerce.date().nullable(), | ||
/** When the run was last updated */ | ||
updatedAt: import_zod12.z.coerce.date().nullable(), | ||
/** When the run was completed */ | ||
completedAt: import_zod12.z.coerce.date().nullable() | ||
}); | ||
var GetRunSchema = RunSchema.extend({ | ||
/** The output of the run */ | ||
output: import_zod12.z.any().optional(), | ||
/** The tasks from the run */ | ||
tasks: import_zod12.z.array(RunTaskWithSubtasksSchema), | ||
/** If there are more tasks, you can use this to get them */ | ||
nextCursor: import_zod12.z.string().optional() | ||
}); | ||
var GetRunsOptionsSchema = import_zod12.z.object({ | ||
/** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */ | ||
cursor: import_zod12.z.string().optional(), | ||
/** How many runs you want to return in one go, max 50. @default 20 */ | ||
take: import_zod12.z.number().optional() | ||
}); | ||
var GetRunsSchema = import_zod12.z.object({ | ||
/** The runs from the query */ | ||
runs: RunSchema.array(), | ||
/** If there are more runs, you can use this to get them */ | ||
nextCursor: import_zod12.z.string().optional() | ||
}); | ||
// src/schemas/events.ts | ||
var GetEventSchema = import_zod13.z.object({ | ||
var import_zod14 = require("zod"); | ||
var GetEventSchema = import_zod14.z.object({ | ||
/** The event id */ | ||
id: import_zod13.z.string(), | ||
id: import_zod14.z.string(), | ||
/** The event name */ | ||
name: import_zod13.z.string(), | ||
name: import_zod14.z.string(), | ||
/** When the event was created */ | ||
createdAt: import_zod13.z.coerce.date(), | ||
createdAt: import_zod14.z.coerce.date(), | ||
/** When the event was last updated */ | ||
updatedAt: import_zod13.z.coerce.date(), | ||
updatedAt: import_zod14.z.coerce.date(), | ||
/** The runs that were triggered by the event */ | ||
runs: import_zod13.z.array(import_zod13.z.object({ | ||
runs: import_zod14.z.array(import_zod14.z.object({ | ||
/** The Run id */ | ||
id: import_zod13.z.string(), | ||
id: import_zod14.z.string(), | ||
/** The Run status */ | ||
status: RunStatusSchema, | ||
/** When the run started */ | ||
startedAt: import_zod13.z.coerce.date().optional().nullable(), | ||
startedAt: import_zod14.z.coerce.date().optional().nullable(), | ||
/** When the run completed */ | ||
completedAt: import_zod13.z.coerce.date().optional().nullable() | ||
completedAt: import_zod14.z.coerce.date().optional().nullable() | ||
})) | ||
@@ -1373,0 +1439,0 @@ }); |
{ | ||
"name": "@trigger.dev/core", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Core code used across the Trigger.dev SDK and platform", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
489437
11194