@trigger.dev/core 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/logger.ts","../src/schemas/api.ts","../src/schemas/addMissingVersionField.ts","../src/schemas/errors.ts","../src/schemas/eventFilter.ts","../src/schemas/integrations.ts","../src/schemas/json.ts","../src/schemas/properties.ts","../src/schemas/schedules.ts","../src/schemas/tasks.ts","../src/schemas/triggers.ts","../src/schemas/notifications.ts","../src/schemas/fetch.ts","../src/schemas/events.ts","../src/schemas/runs.ts","../src/utils.ts","../src/retry.ts","../src/replacements.ts","../src/searchParams.ts","../src/eventFilterMatches.ts"],"sourcesContent":["export * from \"./logger\";\nexport * from \"./schemas\";\nexport * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./retry\";\nexport * from \"./replacements\";\nexport * from \"./searchParams\";\nexport * from \"./eventFilterMatches\";\n","// Create a logger class that uses the debug package internally\n\n/**\n * Represents different log levels.\n * - `\"log\"`: Only essential messages.\n * - `\"error\"`: Errors and essential messages.\n * - `\"warn\"`: Warnings, Errors and essential messages.\n * - `\"info\"`: Info, Warnings, Errors and essential messages.\n * - `\"debug\"`: Everything.\n */\nexport type LogLevel = \"log\" | \"error\" | \"warn\" | \"info\" | \"debug\";\n\nconst logLevels: Array<LogLevel> = [\"log\", \"error\", \"warn\", \"info\", \"debug\"];\n\nexport class Logger {\n #name: string;\n readonly #level: number;\n #filteredKeys: string[] = [];\n #jsonReplacer?: (key: string, value: unknown) => unknown;\n\n constructor(\n name: string,\n level: LogLevel = \"info\",\n filteredKeys: string[] = [],\n jsonReplacer?: (key: string, value: unknown) => unknown\n ) {\n this.#name = name;\n this.#level = logLevels.indexOf((process.env.TRIGGER_LOG_LEVEL ?? level) as LogLevel);\n this.#filteredKeys = filteredKeys;\n this.#jsonReplacer = jsonReplacer;\n }\n\n // Return a new Logger instance with the same name and a new log level\n // but filter out the keys from the log messages (at any level)\n filter(...keys: string[]) {\n return new Logger(this.#name, logLevels[this.#level], keys, this.#jsonReplacer);\n }\n\n static satisfiesLogLevel(logLevel: LogLevel, setLevel: LogLevel) {\n return logLevels.indexOf(logLevel) <= logLevels.indexOf(setLevel);\n }\n\n log(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 0) return;\n\n this.#structuredLog(console.log, message, ...args);\n }\n\n error(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 1) return;\n\n this.#structuredLog(console.error, message, ...args);\n }\n\n warn(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 2) return;\n\n this.#structuredLog(console.warn, message, ...args);\n }\n\n info(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 3) return;\n\n this.#structuredLog(console.info, message, ...args);\n }\n\n debug(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 4) return;\n\n this.#structuredLog(console.debug, message, ...args);\n }\n\n #structuredLog(\n loggerFunction: (message: string, ...args: any[]) => void,\n message: string,\n ...args: Array<Record<string, unknown> | undefined>\n ) {\n const structuredLog = {\n ...structureArgs(safeJsonClone(args) as Record<string, unknown>[], this.#filteredKeys),\n timestamp: new Date(),\n name: this.#name,\n message,\n };\n\n loggerFunction(JSON.stringify(structuredLog, createReplacer(this.#jsonReplacer)));\n }\n}\n\nfunction createReplacer(replacer?: (key: string, value: unknown) => unknown) {\n return (key: string, value: unknown) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n\n if (replacer) {\n return replacer(key, value);\n }\n\n return value;\n };\n}\n\n// Replacer function for JSON.stringify that converts BigInts to strings\nfunction bigIntReplacer(_key: string, value: unknown) {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n\n return value;\n}\n\nfunction safeJsonClone(obj: unknown) {\n try {\n return JSON.parse(JSON.stringify(obj, bigIntReplacer));\n } catch (e) {\n return obj;\n }\n}\n\nfunction formattedDateTime() {\n const date = new Date();\n\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n const milliseconds = date.getMilliseconds();\n\n // Make sure the time is always 2 digits\n const formattedHours = hours < 10 ? `0${hours}` : hours;\n const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes;\n const formattedSeconds = seconds < 10 ? `0${seconds}` : seconds;\n const formattedMilliseconds =\n milliseconds < 10\n ? `00${milliseconds}`\n : milliseconds < 100\n ? `0${milliseconds}`\n : milliseconds;\n\n return `${formattedHours}:${formattedMinutes}:${formattedSeconds}.${formattedMilliseconds}`;\n}\n\n// If args is has a single item that is an object, return that object\nfunction structureArgs(args: Array<Record<string, unknown>>, filteredKeys: string[] = []) {\n if (args.length === 0) {\n return;\n }\n\n if (args.length === 1 && typeof args[0] === \"object\") {\n return filterKeys(JSON.parse(JSON.stringify(args[0], bigIntReplacer)), filteredKeys);\n }\n\n return args;\n}\n\n// Recursively filter out keys from an object, including nested objects, and arrays\nfunction filterKeys(obj: unknown, keys: string[]): any {\n if (typeof obj !== \"object\" || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((item) => filterKeys(item, keys));\n }\n\n const filteredObj: any = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (keys.includes(key)) {\n if (value) {\n filteredObj[key] = `[filtered ${prettyPrintBytes(value)}]`;\n } else {\n filteredObj[key] = value;\n }\n continue;\n }\n\n filteredObj[key] = filterKeys(value, keys);\n }\n\n return filteredObj;\n}\n\nfunction prettyPrintBytes(value: unknown): string {\n if (process.env.NODE_ENV === \"production\") {\n return \"skipped size\";\n }\n\n const sizeInBytes = Buffer.byteLength(JSON.stringify(value), \"utf8\");\n\n if (sizeInBytes < 1024) {\n return `${sizeInBytes} bytes`;\n }\n\n if (sizeInBytes < 1024 * 1024) {\n return `${(sizeInBytes / 1024).toFixed(2)} KB`;\n }\n\n if (sizeInBytes < 1024 * 1024 * 1024) {\n return `${(sizeInBytes / (1024 * 1024)).toFixed(2)} MB`;\n }\n\n return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;\n}\n","import { ulid } from \"ulid\";\nimport { z } from \"zod\";\nimport { Prettify } from \"../types\";\nimport { addMissingVersionField } from \"./addMissingVersionField\";\nimport { ErrorWithStackSchema } from \"./errors\";\nimport { EventRuleSchema } from \"./eventFilter\";\nimport { ConnectionAuthSchema, IntegrationConfigSchema } from \"./integrations\";\nimport { DeserializedJsonSchema, SerializableJsonSchema } from \"./json\";\nimport { DisplayPropertySchema, StyleSchema } from \"./properties\";\nimport {\n CronMetadataSchema,\n IntervalMetadataSchema,\n RegisterDynamicSchedulePayloadSchema,\n ScheduleMetadataSchema,\n} from \"./schedules\";\nimport { CachedTaskSchema, TaskSchema } from \"./tasks\";\nimport { EventSpecificationSchema, TriggerMetadataSchema } from \"./triggers\";\n\nexport const UpdateTriggerSourceBodyV1Schema = z.object({\n registeredEvents: z.array(z.string()),\n secret: z.string().optional(),\n data: SerializableJsonSchema.optional(),\n});\nexport type UpdateTriggerSourceBodyV1 = z.infer<typeof UpdateTriggerSourceBodyV1Schema>;\n\nexport const UpdateTriggerSourceBodyV2Schema = z.object({\n secret: z.string().optional(),\n data: SerializableJsonSchema.optional(),\n options: z\n .object({\n event: z.array(z.string()),\n })\n .and(z.record(z.string(), z.array(z.string())).optional()),\n});\nexport type UpdateTriggerSourceBodyV2 = z.infer<typeof UpdateTriggerSourceBodyV2Schema>;\n\nexport const RegisterHTTPTriggerSourceBodySchema = z.object({\n type: z.literal(\"HTTP\"),\n url: z.string().url(),\n});\n\nexport const RegisterSMTPTriggerSourceBodySchema = z.object({\n type: z.literal(\"SMTP\"),\n});\n\nexport const RegisterSQSTriggerSourceBodySchema = z.object({\n type: z.literal(\"SQS\"),\n});\n\nexport const RegisterSourceChannelBodySchema = z.discriminatedUnion(\"type\", [\n RegisterHTTPTriggerSourceBodySchema,\n RegisterSMTPTriggerSourceBodySchema,\n RegisterSQSTriggerSourceBodySchema,\n]);\n\nexport const REGISTER_SOURCE_EVENT_V1 = \"dev.trigger.source.register\";\nexport const REGISTER_SOURCE_EVENT_V2 = \"dev.trigger.source.register.v2\";\n\nexport const RegisterTriggerSourceSchema = z.object({\n key: z.string(),\n params: z.any(),\n active: z.boolean(),\n secret: z.string(),\n data: DeserializedJsonSchema.optional(),\n channel: RegisterSourceChannelBodySchema,\n clientId: z.string().optional(),\n});\n\nexport type RegisterTriggerSource = z.infer<typeof RegisterTriggerSourceSchema>;\n\nconst SourceEventOptionSchema = z.object({\n name: z.string(),\n value: z.string(),\n});\n\nexport type SourceEventOption = z.infer<typeof SourceEventOptionSchema>;\n\nexport const RegisterSourceEventSchemaV1 = z.object({\n /** The id of the source */\n id: z.string(),\n source: RegisterTriggerSourceSchema,\n events: z.array(z.string()),\n missingEvents: z.array(z.string()),\n orphanedEvents: z.array(z.string()),\n dynamicTriggerId: z.string().optional(),\n});\n\nexport type RegisterSourceEventV1 = z.infer<typeof RegisterSourceEventSchemaV1>;\n\nconst RegisteredOptionsDiffSchema = z.object({\n desired: z.array(z.string()),\n missing: z.array(z.string()),\n orphaned: z.array(z.string()),\n});\n\nexport type RegisteredOptionsDiff = Prettify<z.infer<typeof RegisteredOptionsDiffSchema>>;\n\nconst RegisterSourceEventOptionsSchema = z\n .object({\n event: RegisteredOptionsDiffSchema,\n })\n .and(z.record(z.string(), RegisteredOptionsDiffSchema));\n\nexport type RegisterSourceEventOptions = z.infer<typeof RegisterSourceEventOptionsSchema>;\n\nexport const RegisterSourceEventSchemaV2 = z.object({\n /** The id of the source */\n id: z.string(),\n source: RegisterTriggerSourceSchema,\n options: RegisterSourceEventOptionsSchema,\n dynamicTriggerId: z.string().optional(),\n});\n\nexport type RegisterSourceEventV2 = z.infer<typeof RegisterSourceEventSchemaV2>;\n\nexport const TriggerSourceSchema = z.object({\n id: z.string(),\n key: z.string(),\n});\n\nconst HttpSourceResponseMetadataSchema = DeserializedJsonSchema;\nexport type HttpSourceResponseMetadata = z.infer<typeof HttpSourceResponseMetadataSchema>;\n\nexport const HandleTriggerSourceSchema = z.object({\n key: z.string(),\n secret: z.string(),\n data: z.any(),\n params: z.any(),\n auth: ConnectionAuthSchema.optional(),\n metadata: HttpSourceResponseMetadataSchema.optional(),\n});\n\nexport type HandleTriggerSource = z.infer<typeof HandleTriggerSourceSchema>;\n\nexport type TriggerSource = z.infer<typeof TriggerSourceSchema>;\n\nexport const HttpSourceRequestSchema = z.object({\n url: z.string().url(),\n method: z.string(),\n headers: z.record(z.string()),\n rawBody: z.instanceof(Buffer).optional().nullable(),\n});\n\nexport type HttpSourceRequest = z.infer<typeof HttpSourceRequestSchema>;\n\nexport const HttpSourceRequestHeadersSchema = z.object({\n \"x-ts-key\": z.string(),\n \"x-ts-dynamic-id\": z.string().optional(),\n \"x-ts-secret\": z.string(),\n \"x-ts-data\": z.string().transform((s) => JSON.parse(s)),\n \"x-ts-params\": z.string().transform((s) => JSON.parse(s)),\n \"x-ts-http-url\": z.string(),\n \"x-ts-http-method\": z.string(),\n \"x-ts-http-headers\": z.string().transform((s) => z.record(z.string()).parse(JSON.parse(s))),\n \"x-ts-auth\": z\n .string()\n .optional()\n .transform((s) => {\n if (s === undefined) return;\n const json = JSON.parse(s);\n return ConnectionAuthSchema.parse(json);\n }),\n \"x-ts-metadata\": z\n .string()\n .optional()\n .transform((s) => {\n if (s === undefined) return;\n const json = JSON.parse(s);\n return DeserializedJsonSchema.parse(json);\n }),\n});\n\nexport type HttpSourceRequestHeaders = z.output<typeof HttpSourceRequestHeadersSchema>;\n\nexport const PongSuccessResponseSchema = z.object({\n ok: z.literal(true),\n});\n\nexport const PongErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n});\n\nexport const PongResponseSchema = z.discriminatedUnion(\"ok\", [\n PongSuccessResponseSchema,\n PongErrorResponseSchema,\n]);\n\nexport type PongResponse = z.infer<typeof PongResponseSchema>;\n\nexport const ValidateSuccessResponseSchema = z.object({\n ok: z.literal(true),\n endpointId: z.string(),\n});\n\nexport const ValidateErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n});\n\nexport const ValidateResponseSchema = z.discriminatedUnion(\"ok\", [\n ValidateSuccessResponseSchema,\n ValidateErrorResponseSchema,\n]);\n\nexport type ValidateResponse = z.infer<typeof ValidateResponseSchema>;\n\nexport const QueueOptionsSchema = z.object({\n name: z.string(),\n maxConcurrent: z.number().optional(),\n});\n\nexport type QueueOptions = z.infer<typeof QueueOptionsSchema>;\n\nexport const JobMetadataSchema = z.object({\n id: z.string(),\n name: z.string(),\n version: z.string(),\n event: EventSpecificationSchema,\n trigger: TriggerMetadataSchema,\n integrations: z.record(IntegrationConfigSchema),\n internal: z.boolean().default(false),\n enabled: z.boolean(),\n startPosition: z.enum([\"initial\", \"latest\"]),\n preprocessRuns: z.boolean(),\n});\n\nexport type JobMetadata = z.infer<typeof JobMetadataSchema>;\n\nconst SourceMetadataV1Schema = z.object({\n version: z.literal(\"1\"),\n channel: z.enum([\"HTTP\", \"SQS\", \"SMTP\"]),\n integration: IntegrationConfigSchema,\n key: z.string(),\n params: z.any(),\n events: z.array(z.string()),\n registerSourceJob: z\n .object({\n id: z.string(),\n version: z.string(),\n })\n .optional(),\n});\n\nexport type SourceMetadataV1 = z.infer<typeof SourceMetadataV1Schema>;\n\nexport const SourceMetadataV2Schema = z.object({\n version: z.literal(\"2\"),\n channel: z.enum([\"HTTP\", \"SQS\", \"SMTP\"]),\n integration: IntegrationConfigSchema,\n key: z.string(),\n params: z.any(),\n options: z.record(z.array(z.string())),\n registerSourceJob: z\n .object({\n id: z.string(),\n version: z.string(),\n })\n .optional(),\n});\n\nexport type SourceMetadataV2 = z.infer<typeof SourceMetadataV2Schema>;\n\nconst SourceMetadataSchema = z.preprocess(\n addMissingVersionField,\n z.discriminatedUnion(\"version\", [SourceMetadataV1Schema, SourceMetadataV2Schema])\n);\n\ntype SourceMetadata = Prettify<z.infer<typeof SourceMetadataSchema>>;\n\nexport const DynamicTriggerEndpointMetadataSchema = z.object({\n id: z.string(),\n jobs: z.array(JobMetadataSchema.pick({ id: true, version: true })),\n registerSourceJob: z\n .object({\n id: z.string(),\n version: z.string(),\n })\n .optional(),\n});\n\nexport type DynamicTriggerEndpointMetadata = z.infer<typeof DynamicTriggerEndpointMetadataSchema>;\n\nexport const IndexEndpointResponseSchema = z.object({\n jobs: z.array(JobMetadataSchema),\n sources: z.array(SourceMetadataSchema),\n dynamicTriggers: z.array(DynamicTriggerEndpointMetadataSchema),\n dynamicSchedules: z.array(RegisterDynamicSchedulePayloadSchema),\n});\n\nexport type IndexEndpointResponse = z.infer<typeof IndexEndpointResponseSchema>;\n\nexport const RawEventSchema = z.object({\n /** The `name` property must exactly match any subscriptions you want to\n trigger. */\n name: z.string(),\n /** The `payload` property will be sent to any matching Jobs and will appear\n as the `payload` param of the `run()` function. You can leave this\n parameter out if you just want to trigger a Job without any input data. */\n payload: z.any(),\n /** The optional `context` property will be sent to any matching Jobs and will\n be passed through as the `context.event.context` param of the `run()`\n function. This is optional but can be useful if you want to pass through\n some additional context to the Job. */\n context: z.any().optional(),\n /** The `id` property uniquely identify this particular event. If unset it\n will be set automatically using `ulid`. */\n id: z.string().default(() => ulid()),\n /** This is optional, it defaults to the current timestamp. Usually you would\n only set this if you have a timestamp that you wish to pass through, e.g.\n you receive a timestamp from a service and you want the same timestamp to\n be used in your Job. */\n timestamp: z.coerce.date().optional(),\n /** This is optional, it defaults to \"trigger.dev\". It can be useful to set\n this as you can filter events using this in the `eventTrigger()`. */\n source: z.string().optional(),\n});\n\nexport type RawEvent = z.infer<typeof RawEventSchema>;\n\n/** The event you wish to send to Trigger a Job */\nexport type SendEvent = z.input<typeof RawEventSchema>;\n\n/** The event that was sent */\nexport const ApiEventLogSchema = z.object({\n /** The `id` of the event that was sent.\n */\n id: z.string(),\n /** The `name` of the event that was sent. */\n name: z.string(),\n /** The `payload` of the event that was sent */\n payload: DeserializedJsonSchema,\n /** The `context` of the event that was sent. Is `undefined` if no context was\n set when sending the event. */\n context: DeserializedJsonSchema.optional().nullable(),\n /** The `timestamp` of the event that was sent */\n timestamp: z.coerce.date(),\n /** The timestamp when the event will be delivered to any matching Jobs. Is\n `undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the\n event. */\n deliverAt: z.coerce.date().optional().nullable(),\n /** The timestamp when the event was delivered. Is `undefined` if `deliverAt`\n or `deliverAfter` were set when sending the event. */\n deliveredAt: z.coerce.date().optional().nullable(),\n /** The timestamp when the event was cancelled. Is `undefined` if the event\n * wasn't cancelled. */\n cancelledAt: z.coerce.date().optional().nullable(),\n});\n\nexport type ApiEventLog = z.infer<typeof ApiEventLogSchema>;\n\n/** Options to control the delivery of the event */\nexport const SendEventOptionsSchema = z.object({\n /** An optional Date when you want the event to trigger Jobs. The event will\n be sent to the platform immediately but won't be acted upon until the\n specified time. */\n deliverAt: z.coerce.date().optional(),\n /** An optional number of seconds you want to wait for the event to trigger\n any relevant Jobs. The event will be sent to the platform immediately but\n won't be delivered until after the elapsed number of seconds. */\n deliverAfter: z.number().int().optional(),\n /** This optional param will be used by Trigger.dev Connect, which\n is coming soon. */\n accountId: z.string().optional(),\n});\n\nexport const SendEventBodySchema = z.object({\n event: RawEventSchema,\n options: SendEventOptionsSchema.optional(),\n});\n\nexport type SendEventBody = z.infer<typeof SendEventBodySchema>;\nexport type SendEventOptions = z.infer<typeof SendEventOptionsSchema>;\n\nexport const DeliverEventResponseSchema = z.object({\n deliveredAt: z.string().datetime(),\n});\n\nexport type DeliverEventResponse = z.infer<typeof DeliverEventResponseSchema>;\n\nexport const RuntimeEnvironmentTypeSchema = z.enum([\n \"PRODUCTION\",\n \"STAGING\",\n \"DEVELOPMENT\",\n \"PREVIEW\",\n]);\n\nexport type RuntimeEnvironmentType = z.infer<typeof RuntimeEnvironmentTypeSchema>;\n\nexport const RunSourceContextSchema = z.object({\n id: z.string(),\n metadata: z.any(),\n});\n\nexport const RunJobBodySchema = z.object({\n event: ApiEventLogSchema,\n job: z.object({\n id: z.string(),\n version: z.string(),\n }),\n run: z.object({\n id: z.string(),\n isTest: z.boolean(),\n isRetry: z.boolean().default(false),\n startedAt: z.coerce.date(),\n }),\n environment: z.object({\n id: z.string(),\n slug: z.string(),\n type: RuntimeEnvironmentTypeSchema,\n }),\n organization: z.object({\n id: z.string(),\n title: z.string(),\n slug: z.string(),\n }),\n account: z\n .object({\n id: z.string(),\n metadata: z.any(),\n })\n .optional(),\n source: RunSourceContextSchema.optional(),\n tasks: z.array(CachedTaskSchema).optional(),\n connections: z.record(ConnectionAuthSchema).optional(),\n});\n\nexport type RunJobBody = z.infer<typeof RunJobBodySchema>;\n\nexport const RunJobErrorSchema = z.object({\n status: z.literal(\"ERROR\"),\n error: ErrorWithStackSchema,\n task: TaskSchema.optional(),\n});\n\nexport type RunJobError = z.infer<typeof RunJobErrorSchema>;\n\nexport const RunJobResumeWithTaskSchema = z.object({\n status: z.literal(\"RESUME_WITH_TASK\"),\n task: TaskSchema,\n});\n\nexport type RunJobResumeWithTask = z.infer<typeof RunJobResumeWithTaskSchema>;\n\nexport const RunJobRetryWithTaskSchema = z.object({\n status: z.literal(\"RETRY_WITH_TASK\"),\n task: TaskSchema,\n error: ErrorWithStackSchema,\n retryAt: z.coerce.date(),\n});\n\nexport type RunJobRetryWithTask = z.infer<typeof RunJobRetryWithTaskSchema>;\n\nexport const RunJobCanceledWithTaskSchema = z.object({\n status: z.literal(\"CANCELED\"),\n task: TaskSchema,\n});\n\nexport type RunJobCanceledWithTask = z.infer<typeof RunJobCanceledWithTaskSchema>;\n\nexport const RunJobSuccessSchema = z.object({\n status: z.literal(\"SUCCESS\"),\n output: DeserializedJsonSchema.optional(),\n});\n\nexport type RunJobSuccess = z.infer<typeof RunJobSuccessSchema>;\n\nexport const RunJobResponseSchema = z.discriminatedUnion(\"status\", [\n RunJobErrorSchema,\n RunJobResumeWithTaskSchema,\n RunJobRetryWithTaskSchema,\n RunJobCanceledWithTaskSchema,\n RunJobSuccessSchema,\n]);\n\nexport type RunJobResponse = z.infer<typeof RunJobResponseSchema>;\n\nexport const PreprocessRunBodySchema = z.object({\n event: ApiEventLogSchema,\n job: z.object({\n id: z.string(),\n version: z.string(),\n }),\n run: z.object({\n id: z.string(),\n isTest: z.boolean(),\n }),\n environment: z.object({\n id: z.string(),\n slug: z.string(),\n type: RuntimeEnvironmentTypeSchema,\n }),\n organization: z.object({\n id: z.string(),\n title: z.string(),\n slug: z.string(),\n }),\n account: z\n .object({\n id: z.string(),\n metadata: z.any(),\n })\n .optional(),\n});\n\nexport type PreprocessRunBody = z.infer<typeof PreprocessRunBodySchema>;\n\nexport const PreprocessRunResponseSchema = z.object({\n abort: z.boolean(),\n properties: z.array(DisplayPropertySchema).optional(),\n});\n\nexport type PreprocessRunResponse = z.infer<typeof PreprocessRunResponseSchema>;\n\nconst CreateRunResponseOkSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n id: z.string(),\n }),\n});\n\nconst CreateRunResponseErrorSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n});\n\nexport const CreateRunResponseBodySchema = z.discriminatedUnion(\"ok\", [\n CreateRunResponseOkSchema,\n CreateRunResponseErrorSchema,\n]);\n\nexport type CreateRunResponseBody = z.infer<typeof CreateRunResponseBodySchema>;\n\nexport const RedactStringSchema = z.object({\n __redactedString: z.literal(true),\n strings: z.array(z.string()),\n interpolations: z.array(z.string()),\n});\n\nexport type RedactString = z.infer<typeof RedactStringSchema>;\n\nexport const LogMessageSchema = z.object({\n level: z.enum([\"DEBUG\", \"INFO\", \"WARN\", \"ERROR\"]),\n message: z.string(),\n data: SerializableJsonSchema.optional(),\n});\n\nexport type LogMessage = z.infer<typeof LogMessageSchema>;\n\nexport type ClientTask = z.infer<typeof TaskSchema>;\nexport type CachedTask = z.infer<typeof CachedTaskSchema>;\n\nexport const RedactSchema = z.object({\n paths: z.array(z.string()),\n});\n\nexport const RetryOptionsSchema = z.object({\n /** The maximum number of times to retry the request. */\n limit: z.number().optional(),\n /** The exponential factor to use when calculating the next retry time. */\n factor: z.number().optional(),\n /** The minimum amount of time to wait before retrying the request. */\n minTimeoutInMs: z.number().optional(),\n /** The maximum amount of time to wait before retrying the request. */\n maxTimeoutInMs: z.number().optional(),\n /** Whether to randomize the retry time. */\n randomize: z.boolean().optional(),\n});\n\nexport type RetryOptions = z.infer<typeof RetryOptionsSchema>;\n\nexport const RunTaskOptionsSchema = z.object({\n /** The name of the Task is required. This is displayed on the Task in the logs. */\n name: z.string().optional(),\n /** The Task will wait and only start at the specified Date */\n delayUntil: z.coerce.date().optional(),\n /** Retry options */\n retry: RetryOptionsSchema.optional(),\n /** The icon for the Task, it will appear in the logs.\n * You can use the name of a company in lowercase, e.g. \"github\".\n * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */\n icon: z.string().optional(),\n /** The key for the Task that you want to appear in the logs */\n displayKey: z.string().optional(),\n /** A description of the Task */\n description: z.string().optional(),\n /** Properties that are displayed in the logs */\n properties: z.array(DisplayPropertySchema).optional(),\n /** The input params to the Task, will be displayed in the logs */\n params: z.any(),\n /** The style of the log entry. */\n style: StyleSchema.optional(),\n /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */\n connectionKey: z.string().optional(),\n /** 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. */\n operation: z.enum([\"fetch\"]).optional(),\n /** 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). */\n noop: z.boolean().default(false),\n redact: RedactSchema.optional(),\n trigger: TriggerMetadataSchema.optional(),\n});\n\nexport type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;\n\nexport type OverridableRunTaskOptions = Pick<\n RunTaskOptions,\n \"retry\" | \"delayUntil\" | \"description\"\n>;\n\nexport const RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({\n idempotencyKey: z.string(),\n parentId: z.string().optional(),\n});\n\nexport type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;\n\nexport const RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({\n params: DeserializedJsonSchema.optional().nullable(),\n});\n\nexport type RunTaskBodyOutput = z.infer<typeof RunTaskBodyOutputSchema>;\n\nexport const CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({\n properties: true,\n description: true,\n params: true,\n}).extend({\n output: SerializableJsonSchema.optional().transform((v) =>\n v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {}\n ),\n});\n\nexport type CompleteTaskBodyInput = Prettify<z.input<typeof CompleteTaskBodyInputSchema>>;\nexport type CompleteTaskBodyOutput = z.infer<typeof CompleteTaskBodyInputSchema>;\n\nexport const FailTaskBodyInputSchema = z.object({\n error: ErrorWithStackSchema,\n});\n\nexport type FailTaskBodyInput = z.infer<typeof FailTaskBodyInputSchema>;\n\nexport const NormalizedRequestSchema = z.object({\n headers: z.record(z.string()),\n method: z.string(),\n query: z.record(z.string()),\n url: z.string(),\n body: z.any(),\n});\n\nexport type NormalizedRequest = z.infer<typeof NormalizedRequestSchema>;\n\nexport const NormalizedResponseSchema = z.object({\n status: z.number(),\n body: z.any(),\n headers: z.record(z.string()).optional(),\n});\n\nexport type NormalizedResponse = z.infer<typeof NormalizedResponseSchema>;\n\nexport const HttpSourceResponseSchema = z.object({\n response: NormalizedResponseSchema,\n events: z.array(RawEventSchema),\n metadata: HttpSourceResponseMetadataSchema.optional(),\n});\n\nexport const RegisterTriggerBodySchemaV1 = z.object({\n rule: EventRuleSchema,\n source: SourceMetadataV1Schema,\n});\n\nexport type RegisterTriggerBodyV1 = z.infer<typeof RegisterTriggerBodySchemaV1>;\n\nexport const RegisterTriggerBodySchemaV2 = z.object({\n rule: EventRuleSchema,\n source: SourceMetadataV2Schema,\n});\n\nexport type RegisterTriggerBodyV2 = z.infer<typeof RegisterTriggerBodySchemaV2>;\n\nexport const InitializeTriggerBodySchema = z.object({\n id: z.string(),\n params: z.any(),\n accountId: z.string().optional(),\n metadata: z.any().optional(),\n});\n\nexport type InitializeTriggerBody = z.infer<typeof InitializeTriggerBodySchema>;\n\nconst RegisterCommonScheduleBodySchema = z.object({\n /** A unique id for the schedule. This is used to identify and unregister the schedule later. */\n id: z.string(),\n /** Any additional metadata about the schedule. */\n metadata: z.any(),\n /** This will be used by the Trigger.dev Connect feature, which is coming soon. */\n accountId: z.string().optional(),\n});\n\nexport const RegisterIntervalScheduleBodySchema =\n RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);\n\nexport type RegisterIntervalScheduleBody = z.infer<typeof RegisterIntervalScheduleBodySchema>;\n\nexport const InitializeCronScheduleBodySchema =\n RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);\n\nexport type RegisterCronScheduleBody = z.infer<typeof InitializeCronScheduleBodySchema>;\n\nexport const RegisterScheduleBodySchema = z.discriminatedUnion(\"type\", [\n RegisterIntervalScheduleBodySchema,\n InitializeCronScheduleBodySchema,\n]);\n\nexport type RegisterScheduleBody = z.infer<typeof RegisterScheduleBodySchema>;\n\nexport const RegisterScheduleResponseBodySchema = z.object({\n id: z.string(),\n schedule: ScheduleMetadataSchema,\n metadata: z.any(),\n active: z.boolean(),\n});\n\nexport type RegisterScheduleResponseBody = z.infer<typeof RegisterScheduleResponseBodySchema>;\n\nexport const CreateExternalConnectionBodySchema = z.object({\n accessToken: z.string(),\n type: z.enum([\"oauth2\"]),\n scopes: z.array(z.string()).optional(),\n metadata: z.any(),\n});\n\nexport type CreateExternalConnectionBody = z.infer<typeof CreateExternalConnectionBodySchema>;\n","export function addMissingVersionField(val: unknown) {\n if (val !== null && typeof val === \"object\" && !(\"version\" in val)) {\n return {\n ...val,\n version: \"1\",\n };\n }\n return val;\n}\n","import { z } from \"zod\";\n\nexport const ErrorWithStackSchema = z.object({\n message: z.string(),\n name: z.string().optional(),\n stack: z.string().optional(),\n});\n\nexport type ErrorWithStack = z.infer<typeof ErrorWithStackSchema>;\n","import { z } from \"zod\";\n\nconst EventMatcherSchema = z.union([\n /** Match against a string */\n z.array(z.string()),\n /** Match against a number */\n z.array(z.number()),\n /** Match against a boolean */\n z.array(z.boolean()),\n z.array(\n z.union([\n z.object({\n $endsWith: z.string(),\n }),\n z.object({\n $startsWith: z.string(),\n }),\n z.object({\n $exists: z.boolean(),\n }),\n z.object({\n $isNull: z.boolean(),\n }),\n z.object({\n $anythingBut: z.union([z.string(), z.number(), z.boolean()]),\n }),\n z.object({\n $anythingBut: z.union([z.array(z.string()), z.array(z.number()), z.array(z.boolean())]),\n }),\n z.object({\n $gt: z.number(),\n }),\n z.object({\n $lt: z.number(),\n }),\n z.object({\n $gte: z.number(),\n }),\n z.object({\n $lte: z.number(),\n }),\n z.object({\n $between: z.tuple([z.number(), z.number()]),\n }),\n z.object({\n $includes: z.union([z.string(), z.number(), z.boolean()]),\n }),\n z.object({\n $ignoreCaseEquals: z.string(),\n }),\n ])\n ),\n]);\n\ntype EventMatcher = z.infer<typeof EventMatcherSchema>;\n\n/** A filter for matching against data */\nexport type EventFilter = { [key: string]: EventMatcher | EventFilter };\n\nexport const EventFilterSchema: z.ZodType<EventFilter> = z.lazy(() =>\n z.record(z.union([EventMatcherSchema, EventFilterSchema]))\n);\n\nexport const EventRuleSchema = z.object({\n event: z.string().or(z.array(z.string())),\n source: z.string(),\n payload: EventFilterSchema.optional(),\n context: EventFilterSchema.optional(),\n});\n\nexport type EventRule = z.infer<typeof EventRuleSchema>;\n","import { z } from \"zod\";\n\nexport const ConnectionAuthSchema = z.object({\n type: z.enum([\"oauth2\"]),\n accessToken: z.string(),\n scopes: z.array(z.string()).optional(),\n additionalFields: z.record(z.string()).optional(),\n});\n\nexport type ConnectionAuth = z.infer<typeof ConnectionAuthSchema>;\n\nexport const IntegrationMetadataSchema = z.object({\n id: z.string(),\n name: z.string(),\n instructions: z.string().optional(),\n});\n\nexport type IntegrationMetadata = z.infer<typeof IntegrationMetadataSchema>;\n\nexport const IntegrationConfigSchema = z.object({\n id: z.string(),\n metadata: IntegrationMetadataSchema,\n authSource: z.enum([\"HOSTED\", \"LOCAL\"]),\n});\n\nexport type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;\n","import { z } from \"zod\";\n\nconst LiteralSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);\ntype Literal = z.infer<typeof LiteralSchema>;\n\nexport type DeserializedJson = Literal | { [key: string]: DeserializedJson } | DeserializedJson[];\n\nexport const DeserializedJsonSchema: z.ZodType<DeserializedJson> = z.lazy(() =>\n z.union([LiteralSchema, z.array(DeserializedJsonSchema), z.record(DeserializedJsonSchema)])\n);\n\nconst SerializableSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.date(),\n z.undefined(),\n z.symbol(),\n]);\ntype Serializable = z.infer<typeof SerializableSchema>;\n\nexport type SerializableJson =\n | Serializable\n | { [key: string]: SerializableJson }\n | SerializableJson[];\n\nexport const SerializableJsonSchema: z.ZodType<SerializableJson> = z.lazy(() =>\n z.union([SerializableSchema, z.array(SerializableJsonSchema), z.record(SerializableJsonSchema)])\n);\n","import { z } from \"zod\";\n\n/** A property that is displayed in the logs */\nexport const DisplayPropertySchema = z.object({\n /** The label for the property */\n label: z.string(),\n /** The value of the property */\n text: z.string(),\n /** The URL to link to when the property is clicked */\n url: z.string().optional(),\n});\n\nexport const DisplayPropertiesSchema = z.array(DisplayPropertySchema);\n\nexport type DisplayProperty = z.infer<typeof DisplayPropertySchema>;\n\nexport const StyleSchema = z.object({\n /** The style, `normal` or `minimal` */\n style: z.enum([\"normal\", \"minimal\"]),\n /** A variant of the style. */\n variant: z.string().optional(),\n});\n\nexport type Style = z.infer<typeof StyleSchema>;\nexport type StyleName = Style[\"style\"];\n","import { z } from \"zod\";\n\nexport const SCHEDULED_EVENT = \"dev.trigger.scheduled\";\n\nexport const ScheduledPayloadSchema = z.object({\n ts: z.coerce.date(),\n lastTimestamp: z.coerce.date().optional(),\n});\n\nexport type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;\n\nexport const IntervalOptionsSchema = z.object({\n /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */\n seconds: z.number().int().positive().min(60).max(86400),\n});\n\n/** Interval options */\nexport type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;\n\nexport const CronOptionsSchema = z.object({\n /** A CRON expression that defines the schedule. A useful tool when writing CRON\n expressions is [crontab guru](https://crontab.guru). Note that the timezone\n used is UTC. */\n cron: z.string(),\n});\n\n/** The options for a `cronTrigger()` */\nexport type CronOptions = z.infer<typeof CronOptionsSchema>;\n\nexport const CronMetadataSchema = z.object({\n type: z.literal(\"cron\"),\n options: CronOptionsSchema,\n metadata: z.any(),\n});\n\nexport type CronMetadata = z.infer<typeof CronMetadataSchema>;\n\nexport const IntervalMetadataSchema = z.object({\n /** An interval reoccurs at the specified number of seconds */\n type: z.literal(\"interval\"),\n /** An object containing options about the interval. */\n options: IntervalOptionsSchema,\n /** Any additional metadata about the schedule. */\n metadata: z.any(),\n});\n\nexport type IntervalMetadata = z.infer<typeof IntervalMetadataSchema>;\n\nexport const ScheduleMetadataSchema = z.discriminatedUnion(\"type\", [\n IntervalMetadataSchema,\n CronMetadataSchema,\n]);\n\nexport type ScheduleMetadata = z.infer<typeof ScheduleMetadataSchema>;\n\nexport const RegisterDynamicSchedulePayloadSchema = z.object({\n id: z.string(),\n jobs: z.array(\n z.object({\n id: z.string(),\n version: z.string(),\n })\n ),\n});\n\nexport type RegisterDynamicSchedulePayload = z.infer<typeof RegisterDynamicSchedulePayloadSchema>;\n","import { z } from \"zod\";\nimport { DisplayPropertySchema, StyleSchema } from \"./properties\";\nimport { DeserializedJsonSchema } from \"./json\";\n\nexport const TaskStatusSchema = z.enum([\n \"PENDING\",\n \"WAITING\",\n \"RUNNING\",\n \"COMPLETED\",\n \"ERRORED\",\n \"CANCELED\",\n]);\n\nexport type TaskStatus = z.infer<typeof TaskStatusSchema>;\n\nexport const TaskSchema = z.object({\n id: z.string(),\n name: z.string(),\n icon: z.string().optional().nullable(),\n noop: z.boolean(),\n startedAt: z.coerce.date().optional().nullable(),\n completedAt: z.coerce.date().optional().nullable(),\n delayUntil: z.coerce.date().optional().nullable(),\n status: TaskStatusSchema,\n description: z.string().optional().nullable(),\n properties: z.array(DisplayPropertySchema).optional().nullable(),\n outputProperties: z.array(DisplayPropertySchema).optional().nullable(),\n params: DeserializedJsonSchema.optional().nullable(),\n output: DeserializedJsonSchema.optional().nullable(),\n error: z.string().optional().nullable(),\n parentId: z.string().optional().nullable(),\n style: StyleSchema.optional().nullable(),\n operation: z.string().optional().nullable(),\n});\n\nexport const ServerTaskSchema = TaskSchema.extend({\n idempotencyKey: z.string(),\n attempts: z.number(),\n});\n\nexport type ServerTask = z.infer<typeof ServerTaskSchema>;\n\nexport const CachedTaskSchema = z.object({\n id: z.string(),\n idempotencyKey: z.string(),\n status: TaskStatusSchema,\n noop: z.boolean().default(false),\n output: DeserializedJsonSchema.optional().nullable(),\n parentId: z.string().optional().nullable(),\n});\n","import { z } from \"zod\";\nimport { EventFilterSchema, EventRuleSchema } from \"./eventFilter\";\nimport { DisplayPropertySchema } from \"./properties\";\nimport { ScheduleMetadataSchema } from \"./schedules\";\n\nexport const EventExampleSchema = z.object({\n id: z.string(),\n icon: z.string().optional(),\n name: z.string(),\n payload: z.any(),\n});\n\nexport type EventExample = z.infer<typeof EventExampleSchema>;\n\nexport const EventSpecificationSchema = z.object({\n name: z.string().or(z.array(z.string())),\n title: z.string(),\n source: z.string(),\n icon: z.string(),\n filter: EventFilterSchema.optional(),\n properties: z.array(DisplayPropertySchema).optional(),\n schema: z.any().optional(),\n examples: z.array(EventExampleSchema).optional(),\n});\n\nexport const DynamicTriggerMetadataSchema = z.object({\n type: z.literal(\"dynamic\"),\n id: z.string(),\n});\n\nexport const StaticTriggerMetadataSchema = z.object({\n type: z.literal(\"static\"),\n title: z.union([z.string(), z.array(z.string())]),\n properties: z.array(DisplayPropertySchema).optional(),\n rule: EventRuleSchema,\n});\n\nexport const ScheduledTriggerMetadataSchema = z.object({\n type: z.literal(\"scheduled\"),\n schedule: ScheduleMetadataSchema,\n});\n\nexport const TriggerMetadataSchema = z.discriminatedUnion(\"type\", [\n DynamicTriggerMetadataSchema,\n StaticTriggerMetadataSchema,\n ScheduledTriggerMetadataSchema,\n]);\n\nexport type TriggerMetadata = z.infer<typeof TriggerMetadataSchema>;\n","import { z } from \"zod\";\n\nexport const MISSING_CONNECTION_NOTIFICATION = \"dev.trigger.notifications.missingConnection\";\n\nexport const MISSING_CONNECTION_RESOLVED_NOTIFICATION =\n \"dev.trigger.notifications.missingConnectionResolved\";\n\nexport const CommonMissingConnectionNotificationPayloadSchema = z.object({\n id: z.string(),\n client: z.object({\n id: z.string(),\n title: z.string(),\n scopes: z.array(z.string()),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n }),\n authorizationUrl: z.string(),\n});\n\nexport const MissingDeveloperConnectionNotificationPayloadSchema =\n CommonMissingConnectionNotificationPayloadSchema.extend({\n type: z.literal(\"DEVELOPER\"),\n });\n\nexport const MissingExternalConnectionNotificationPayloadSchema =\n CommonMissingConnectionNotificationPayloadSchema.extend({\n type: z.literal(\"EXTERNAL\"),\n account: z.object({\n id: z.string(),\n metadata: z.any(),\n }),\n });\n\nexport const MissingConnectionNotificationPayloadSchema = z.discriminatedUnion(\"type\", [\n MissingDeveloperConnectionNotificationPayloadSchema,\n MissingExternalConnectionNotificationPayloadSchema,\n]);\n\nexport type MissingConnectionNotificationPayload = z.infer<\n typeof MissingConnectionNotificationPayloadSchema\n>;\n\nexport const CommonMissingConnectionNotificationResolvedPayloadSchema = z.object({\n id: z.string(),\n client: z.object({\n id: z.string(),\n title: z.string(),\n scopes: z.array(z.string()),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n integrationIdentifier: z.string(),\n integrationAuthMethod: z.string(),\n }),\n expiresAt: z.coerce.date(),\n});\n\nexport const MissingDeveloperConnectionResolvedNotificationPayloadSchema =\n CommonMissingConnectionNotificationResolvedPayloadSchema.extend({\n type: z.literal(\"DEVELOPER\"),\n });\n\nexport const MissingExternalConnectionResolvedNotificationPayloadSchema =\n CommonMissingConnectionNotificationResolvedPayloadSchema.extend({\n type: z.literal(\"EXTERNAL\"),\n account: z.object({\n id: z.string(),\n metadata: z.any(),\n }),\n });\n\nexport const MissingConnectionResolvedNotificationPayloadSchema = z.discriminatedUnion(\"type\", [\n MissingDeveloperConnectionResolvedNotificationPayloadSchema,\n MissingExternalConnectionResolvedNotificationPayloadSchema,\n]);\n\nexport type MissingConnectionResolvedNotificationPayload = z.infer<\n typeof MissingConnectionResolvedNotificationPayloadSchema\n>;\n","import { z } from \"zod\";\nimport { RedactStringSchema, RetryOptionsSchema } from \"./api\";\n\nexport const FetchRetryHeadersStrategySchema = z.object({\n /** The `headers` strategy retries the request using info from the response headers. */\n strategy: z.literal(\"headers\"),\n /** The header to use to determine the maximum number of times to retry the request. */\n limitHeader: z.string(),\n /** The header to use to determine the number of remaining retries. */\n remainingHeader: z.string(),\n /** The header to use to determine the time when the number of remaining retries will be reset. */\n resetHeader: z.string(),\n});\n\nexport type FetchRetryHeadersStrategy = z.infer<typeof FetchRetryHeadersStrategySchema>;\n\n/** The `backoff` strategy retries the request with an exponential backoff. */\nexport const FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({\n /** The `backoff` strategy retries the request with an exponential backoff. */\n strategy: z.literal(\"backoff\"),\n});\n\n/** The `backoff` strategy retries the request with an exponential backoff. */\nexport type FetchRetryBackoffStrategy = z.infer<typeof FetchRetryBackoffStrategySchema>;\n\nexport const FetchRetryStrategySchema = z.discriminatedUnion(\"strategy\", [\n FetchRetryHeadersStrategySchema,\n FetchRetryBackoffStrategySchema,\n]);\n\nexport type FetchRetryStrategy = z.infer<typeof FetchRetryStrategySchema>;\n\n/** The options for a fetch request */\nexport const FetchRequestInitSchema = z.object({\n /** The HTTP method to use for the request. */\n method: z.string().optional(),\n /** 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. */\n headers: z.record(z.union([z.string(), RedactStringSchema])).optional(),\n /** The body of the request. */\n body: z.union([z.string(), z.instanceof(ArrayBuffer)]).optional(),\n});\n\n/** The options for a fetch request */\nexport type FetchRequestInit = z.infer<typeof FetchRequestInitSchema>;\n\nexport const FetchRetryOptionsSchema = z.record(FetchRetryStrategySchema);\n\n/** An object where the key is a status code pattern and the value is a retrying strategy. Supported patterns are:\n - Specific status codes: 429\n - Ranges: 500-599\n - Wildcards: 2xx, 3xx, 4xx, 5xx \n */\nexport type FetchRetryOptions = z.infer<typeof FetchRetryOptionsSchema>;\n\nexport const FetchOperationSchema = z.object({\n url: z.string(),\n requestInit: FetchRequestInitSchema.optional(),\n retry: z.record(FetchRetryStrategySchema).optional(),\n});\n\nexport type FetchOperation = z.infer<typeof FetchOperationSchema>;\n","import { z } from \"zod\";\nimport { RunStatusSchema } from \"./runs\";\n\nexport const GetEventSchema = z.object({\n /** The event id */\n id: z.string(),\n /** The event name */\n name: z.string(),\n /** When the event was created */\n createdAt: z.coerce.date(),\n /** When the event was last updated */\n updatedAt: z.coerce.date(),\n /** The runs that were triggered by the event */\n runs: z.array(\n z.object({\n /** The Run id */\n id: z.string(),\n /** The Run status */\n status: RunStatusSchema,\n /** When the run started */\n startedAt: z.coerce.date().optional().nullable(),\n /** When the run completed */\n completedAt: z.coerce.date().optional().nullable(),\n })\n ),\n});\n\nexport type GetEvent = z.infer<typeof GetEventSchema>;\n","import { ZodObject, z } from \"zod\";\nimport { TaskStatusSchema } from \"./tasks\";\n\nexport const RunStatusSchema = z.union([\n z.literal(\"PENDING\"),\n z.literal(\"QUEUED\"),\n z.literal(\"WAITING_ON_CONNECTIONS\"),\n z.literal(\"PREPROCESSING\"),\n z.literal(\"STARTED\"),\n z.literal(\"SUCCESS\"),\n z.literal(\"FAILURE\"),\n z.literal(\"TIMED_OUT\"),\n z.literal(\"ABORTED\"),\n z.literal(\"CANCELED\"),\n]);\n\nexport const RunTaskSchema = z.object({\n /** The Task id */\n id: z.string(),\n /** The key that you defined when creating the Task, the first param in any task. */\n displayKey: z.string().nullable(),\n /** The Task status */\n status: TaskStatusSchema,\n /** The name of the Task */\n name: z.string(),\n /** The icon of the Task, a string.\n * For integrations, this will be a lowercase name of the company.\n * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */\n icon: z.string().nullable(),\n /** When the task started */\n startedAt: z.coerce.date().nullable(),\n /** When the task completed */\n completedAt: z.coerce.date().nullable(),\n});\n\nexport type RunTaskWithSubtasks = z.infer<typeof RunTaskSchema> & {\n /** The subtasks of the task */\n subtasks?: RunTaskWithSubtasks[];\n};\n\nconst RunTaskWithSubtasksSchema: z.ZodType<RunTaskWithSubtasks> = RunTaskSchema.extend({\n subtasks: z.lazy(() => RunTaskWithSubtasksSchema.array()).optional(),\n});\n\nconst GetRunOptionsSchema = z.object({\n /** Return subtasks, which appear in a `subtasks` array on a task. @default false */\n subtasks: z.boolean().optional(),\n /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */\n cursor: z.string().optional(),\n /** How many tasks you want to return in one go, max 50. @default 20 */\n take: z.number().optional(),\n});\n\nexport type GetRunOptions = z.infer<typeof GetRunOptionsSchema>;\n\nconst GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({\n /** If `true`, it returns the `params` and `output` of all tasks. @default false */\n taskdetails: z.boolean().optional(),\n});\n\nexport type GetRunOptionsWithTaskDetails = z.infer<typeof GetRunOptionsWithTaskDetailsSchema>;\n\nconst RunSchema = z.object({\n /** The Run id */\n id: z.string(),\n /** The Run status */\n status: RunStatusSchema,\n /** When the run started */\n startedAt: z.coerce.date().nullable(),\n /** When the run was last updated */\n updatedAt: z.coerce.date().nullable(),\n /** When the run was completed */\n completedAt: z.coerce.date().nullable(),\n});\n\nexport const GetRunSchema = RunSchema.extend({\n /** The output of the run */\n output: z.any().optional(),\n /** The tasks from the run */\n tasks: z.array(RunTaskWithSubtasksSchema),\n /** If there are more tasks, you can use this to get them */\n nextCursor: z.string().optional(),\n});\n\nexport type GetRun = z.infer<typeof GetRunSchema>;\n\nconst GetRunsOptionsSchema = z.object({\n /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */\n cursor: z.string().optional(),\n /** How many runs you want to return in one go, max 50. @default 20 */\n take: z.number().optional(),\n});\n\nexport type GetRunsOptions = z.infer<typeof GetRunsOptionsSchema>;\n\nexport const GetRunsSchema = z.object({\n /** The runs from the query */\n runs: RunSchema.array(),\n /** If there are more runs, you can use this to get them */\n nextCursor: z.string().optional(),\n});\n","// EventFilter is typed as type EventFilter = { [key: string]: EventFilter | string[] | number[] | boolean[] }\n\nimport { EventFilter } from \"./schemas\";\n\n// This function should take any number of EventFilters and return a new EventFilter that is the result of merging of them.\nexport function deepMergeFilters(...filters: EventFilter[]): EventFilter {\n const result: EventFilter = {};\n\n for (const filter of filters) {\n for (const key in filter) {\n if (filter.hasOwnProperty(key)) {\n const filterValue = filter[key];\n const existingValue = result[key];\n\n if (\n existingValue &&\n typeof existingValue === \"object\" &&\n typeof filterValue === \"object\" &&\n !Array.isArray(existingValue) &&\n !Array.isArray(filterValue) &&\n existingValue !== null &&\n filterValue !== null\n ) {\n result[key] = deepMergeFilters(existingValue, filterValue);\n } else {\n result[key] = filterValue;\n }\n }\n }\n }\n\n return result;\n}\n","import { RetryOptions } from \"./schemas\";\n\nconst DEFAULT_RETRY_OPTIONS = {\n limit: 5,\n factor: 1.8,\n minTimeoutInMs: 1000,\n maxTimeoutInMs: 60000,\n randomize: true,\n} satisfies RetryOptions;\n\nexport function calculateRetryAt(retryOptions: RetryOptions, attempts: number): Date | undefined {\n const options = {\n ...DEFAULT_RETRY_OPTIONS,\n ...retryOptions,\n };\n\n const retryCount = attempts + 1;\n\n if (retryCount >= options.limit) {\n return;\n }\n\n const random = options.randomize ? Math.random() + 1 : 1;\n\n let timeoutInMs = Math.round(\n random *\n Math.max(options.minTimeoutInMs, 1) *\n Math.pow(options.factor, Math.max(attempts - 1, 0))\n );\n\n timeoutInMs = Math.min(timeoutInMs, options.maxTimeoutInMs);\n\n return new Date(Date.now() + timeoutInMs);\n}\n","import { DeserializedJson } from \"./schemas\";\n\nexport interface ExampleReplacement {\n marker: string;\n replace(input: ExampleInputData): DeserializedJson;\n}\n\ntype ExampleInputData = {\n match: {\n key: string;\n value: string;\n };\n data: {\n now: Date;\n };\n};\n\nexport const currentDate: ExampleReplacement = {\n marker: \"__CURRENT_DATE__\",\n replace({ data: { now } }: ExampleInputData) {\n return now.toISOString();\n },\n};\n\nexport const currentTimestampMilliseconds: ExampleReplacement = {\n marker: \"__CURRENT_TIMESTAMP_MS__\",\n replace({ data: { now } }: ExampleInputData) {\n return now.getTime();\n },\n};\n\nexport const currentTimestampSeconds: ExampleReplacement = {\n marker: \"__CURRENT_TIMESTAMP_S__\",\n replace({ data: { now } }: ExampleInputData) {\n return now.getTime() / 1000;\n },\n};\n\nexport const replacements: ExampleReplacement[] = [\n currentDate,\n currentTimestampMilliseconds,\n currentTimestampSeconds,\n];\n","export function urlWithSearchParams(\n url: string,\n params: Record<string, string | number | boolean> | undefined\n) {\n if (!params) {\n return url;\n }\n\n const urlObj = new URL(url);\n for (const [key, value] of Object.entries(params)) {\n urlObj.searchParams.append(key, String(value));\n }\n return urlObj.toString();\n}\n","import { EventFilter } from \"./schemas/eventFilter\";\n\n// EventFilter is a recursive type, where the keys are strings and the values are an array of strings, numbers, booleans, or objects.\n// If the values of the array are strings, numbers, or booleans, than we are matching against the value of the payload.\n// If the values of the array are objects, then we are doing content filtering\n// An example would be [{ $endsWith: \".png\" }, { $startsWith: \"images/\" } ]\nexport function eventFilterMatches(payload: any, filter: EventFilter): boolean {\n for (const [patternKey, patternValue] of Object.entries(filter)) {\n const payloadValue = payload[patternKey];\n\n if (Array.isArray(patternValue)) {\n if (patternValue.length === 0) {\n continue;\n }\n\n // Check to see if all the items in the array are a string\n if ((patternValue as unknown[]).every((item) => typeof item === \"string\")) {\n if ((patternValue as string[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a number\n if ((patternValue as unknown[]).every((item) => typeof item === \"number\")) {\n if ((patternValue as number[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a boolean\n if ((patternValue as unknown[]).every((item) => typeof item === \"boolean\")) {\n if ((patternValue as boolean[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Now we know that all the items in the array are objects\n const objectArray = patternValue as Exclude<\n typeof patternValue,\n number[] | string[] | boolean[]\n >;\n\n if (!contentFiltersMatches(payloadValue, objectArray)) {\n return false;\n }\n\n continue;\n } else if (typeof patternValue === \"object\") {\n if (Array.isArray(payloadValue)) {\n if (!payloadValue.some((item) => eventFilterMatches(item, patternValue))) {\n return false;\n }\n } else {\n if (!eventFilterMatches(payloadValue, patternValue)) {\n return false;\n }\n }\n }\n }\n return true;\n}\n\ntype ContentFilters = Exclude<EventFilter[string], EventFilter | string[] | number[] | boolean[]>;\n\nfunction contentFiltersMatches(actualValue: any, contentFilters: ContentFilters): boolean {\n for (const contentFilter of contentFilters) {\n if (typeof contentFilter === \"object\") {\n const [key, value] = Object.entries(contentFilter)[0];\n\n if (!contentFilterMatches(actualValue, contentFilter)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction contentFilterMatches(actualValue: any, contentFilter: ContentFilters[number]): boolean {\n if (\"$endsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.endsWith(contentFilter.$endsWith);\n }\n\n if (\"$startsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.startsWith(contentFilter.$startsWith);\n }\n\n if (\"$anythingBut\" in contentFilter) {\n if (Array.isArray(contentFilter.$anythingBut)) {\n if ((contentFilter.$anythingBut as any[]).includes(actualValue)) {\n return false;\n }\n }\n\n if (contentFilter.$anythingBut === actualValue) {\n return false;\n }\n\n return true;\n }\n\n if (\"$exists\" in contentFilter) {\n if (contentFilter.$exists) {\n return actualValue !== undefined;\n }\n\n return actualValue === undefined;\n }\n\n if (\"$gt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue > contentFilter.$gt;\n }\n\n if (\"$lt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue < contentFilter.$lt;\n }\n\n if (\"$gte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$gte;\n }\n\n if (\"$lte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue <= contentFilter.$lte;\n }\n\n if (\"$between\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$between[0] && actualValue <= contentFilter.$between[1];\n }\n\n if (\"$includes\" in contentFilter) {\n if (Array.isArray(actualValue)) {\n return actualValue.includes(contentFilter.$includes);\n }\n\n return false;\n }\n\n // Use localCompare\n if (\"$ignoreCaseEquals\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return (\n actualValue.localeCompare(contentFilter.$ignoreCaseEquals, undefined, {\n sensitivity: \"accent\",\n }) === 0\n );\n }\n\n if (\"$isNull\" in contentFilter) {\n if (contentFilter.$isNull) {\n return actualValue === null;\n }\n\n return actualValue !== null;\n }\n\n return true;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACYA,IAAMA,YAA6B;EAAC;EAAO;EAAS;EAAQ;EAAQ;;AAZpE;AAcO,IAAMC,UAAN,MAAMA,QAAAA;EAMXC,YACEC,MACAC,QAAkB,QAClBC,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,cAAcoB,SAAS;AACzB,aAAOtB,gBAAgB;IACzB;AAEA,WAAOA,gBAAgB;EACzB;AAEA,SAAO;AACT;AA7GSK;","names":["logLevels","Logger","constructor","name","level","filteredKeys","jsonReplacer","indexOf","process","env","TRIGGER_LOG_LEVEL","filter","keys","satisfiesLogLevel","logLevel","setLevel","log","message","args","console","error","warn","info","debug","loggerFunction","structuredLog","structureArgs","safeJsonClone","timestamp","Date","JSON","stringify","createReplacer","replacer","key","value","toString","bigIntReplacer","_key","obj","parse","e","structureArgs","args","filteredKeys","length","filterKeys","JSON","parse","stringify","bigIntReplacer","obj","keys","Array","isArray","map","item","filteredObj","key","value","Object","entries","includes","prettyPrintBytes","process","env","NODE_ENV","sizeInBytes","Buffer","byteLength","toFixed","import_zod","addMissingVersionField","val","version","ErrorWithStackSchema","z","object","message","string","name","optional","stack","import_zod","EventMatcherSchema","z","union","array","string","number","boolean","object","$endsWith","$startsWith","$exists","$isNull","$anythingBut","$gt","$lt","$gte","$lte","$between","tuple","$includes","$ignoreCaseEquals","EventFilterSchema","lazy","record","EventRuleSchema","event","or","source","payload","optional","context","import_zod","ConnectionAuthSchema","z","object","type","enum","accessToken","string","scopes","array","optional","additionalFields","record","IntegrationMetadataSchema","id","name","instructions","IntegrationConfigSchema","metadata","authSource","import_zod","LiteralSchema","z","union","string","number","boolean","null","DeserializedJsonSchema","lazy","array","record","SerializableSchema","date","undefined","symbol","SerializableJsonSchema","import_zod","DisplayPropertySchema","z","object","label","string","text","url","optional","DisplayPropertiesSchema","array","StyleSchema","style","enum","variant","import_zod","SCHEDULED_EVENT","ScheduledPayloadSchema","z","object","ts","coerce","date","lastTimestamp","optional","IntervalOptionsSchema","seconds","number","int","positive","min","max","CronOptionsSchema","cron","string","CronMetadataSchema","type","literal","options","metadata","any","IntervalMetadataSchema","ScheduleMetadataSchema","discriminatedUnion","RegisterDynamicSchedulePayloadSchema","id","jobs","array","version","import_zod","TaskStatusSchema","z","enum","TaskSchema","object","id","string","name","icon","optional","nullable","noop","boolean","startedAt","coerce","date","completedAt","delayUntil","status","description","properties","array","DisplayPropertySchema","outputProperties","params","DeserializedJsonSchema","output","error","parentId","style","StyleSchema","operation","ServerTaskSchema","extend","idempotencyKey","attempts","number","CachedTaskSchema","default","import_zod","EventExampleSchema","z","object","id","string","icon","optional","name","payload","any","EventSpecificationSchema","or","array","title","source","filter","EventFilterSchema","properties","DisplayPropertySchema","schema","examples","DynamicTriggerMetadataSchema","type","literal","StaticTriggerMetadataSchema","union","rule","EventRuleSchema","ScheduledTriggerMetadataSchema","schedule","ScheduleMetadataSchema","TriggerMetadataSchema","discriminatedUnion","UpdateTriggerSourceBodyV1Schema","z","object","registeredEvents","array","string","secret","optional","data","SerializableJsonSchema","UpdateTriggerSourceBodyV2Schema","options","event","and","record","RegisterHTTPTriggerSourceBodySchema","type","literal","url","RegisterSMTPTriggerSourceBodySchema","RegisterSQSTriggerSourceBodySchema","RegisterSourceChannelBodySchema","discriminatedUnion","REGISTER_SOURCE_EVENT_V1","REGISTER_SOURCE_EVENT_V2","RegisterTriggerSourceSchema","key","params","any","active","boolean","DeserializedJsonSchema","channel","clientId","SourceEventOptionSchema","name","value","RegisterSourceEventSchemaV1","id","source","events","missingEvents","orphanedEvents","dynamicTriggerId","RegisteredOptionsDiffSchema","desired","missing","orphaned","RegisterSourceEventOptionsSchema","RegisterSourceEventSchemaV2","TriggerSourceSchema","HttpSourceResponseMetadataSchema","HandleTriggerSourceSchema","auth","ConnectionAuthSchema","metadata","HttpSourceRequestSchema","method","headers","rawBody","instanceof","Buffer","nullable","HttpSourceRequestHeadersSchema","transform","s","JSON","parse","undefined","json","PongSuccessResponseSchema","ok","PongErrorResponseSchema","error","PongResponseSchema","ValidateSuccessResponseSchema","endpointId","ValidateErrorResponseSchema","ValidateResponseSchema","QueueOptionsSchema","maxConcurrent","number","JobMetadataSchema","version","EventSpecificationSchema","trigger","TriggerMetadataSchema","integrations","IntegrationConfigSchema","internal","default","enabled","startPosition","enum","preprocessRuns","SourceMetadataV1Schema","integration","registerSourceJob","SourceMetadataV2Schema","SourceMetadataSchema","preprocess","addMissingVersionField","DynamicTriggerEndpointMetadataSchema","jobs","pick","IndexEndpointResponseSchema","sources","dynamicTriggers","dynamicSchedules","RegisterDynamicSchedulePayloadSchema","RawEventSchema","payload","context","ulid","timestamp","coerce","date","ApiEventLogSchema","deliverAt","deliveredAt","cancelledAt","SendEventOptionsSchema","deliverAfter","int","accountId","SendEventBodySchema","DeliverEventResponseSchema","datetime","RuntimeEnvironmentTypeSchema","RunSourceContextSchema","RunJobBodySchema","job","run","isTest","isRetry","startedAt","environment","slug","organization","title","account","tasks","CachedTaskSchema","connections","RunJobErrorSchema","status","ErrorWithStackSchema","task","TaskSchema","RunJobResumeWithTaskSchema","RunJobRetryWithTaskSchema","retryAt","RunJobCanceledWithTaskSchema","RunJobSuccessSchema","output","RunJobResponseSchema","PreprocessRunBodySchema","PreprocessRunResponseSchema","abort","properties","DisplayPropertySchema","CreateRunResponseOkSchema","CreateRunResponseErrorSchema","CreateRunResponseBodySchema","RedactStringSchema","__redactedString","strings","interpolations","LogMessageSchema","level","message","RedactSchema","paths","RetryOptionsSchema","limit","factor","minTimeoutInMs","maxTimeoutInMs","randomize","RunTaskOptionsSchema","delayUntil","retry","icon","displayKey","description","style","StyleSchema","connectionKey","operation","noop","redact","RunTaskBodyInputSchema","extend","idempotencyKey","parentId","RunTaskBodyOutputSchema","CompleteTaskBodyInputSchema","v","stringify","FailTaskBodyInputSchema","NormalizedRequestSchema","query","body","NormalizedResponseSchema","HttpSourceResponseSchema","response","RegisterTriggerBodySchemaV1","rule","EventRuleSchema","RegisterTriggerBodySchemaV2","InitializeTriggerBodySchema","RegisterCommonScheduleBodySchema","RegisterIntervalScheduleBodySchema","merge","IntervalMetadataSchema","InitializeCronScheduleBodySchema","CronMetadataSchema","RegisterScheduleBodySchema","RegisterScheduleResponseBodySchema","schedule","ScheduleMetadataSchema","CreateExternalConnectionBodySchema","accessToken","scopes","import_zod","MISSING_CONNECTION_NOTIFICATION","MISSING_CONNECTION_RESOLVED_NOTIFICATION","CommonMissingConnectionNotificationPayloadSchema","z","object","id","string","client","title","scopes","array","createdAt","coerce","date","updatedAt","authorizationUrl","MissingDeveloperConnectionNotificationPayloadSchema","extend","type","literal","MissingExternalConnectionNotificationPayloadSchema","account","metadata","any","MissingConnectionNotificationPayloadSchema","discriminatedUnion","CommonMissingConnectionNotificationResolvedPayloadSchema","integrationIdentifier","integrationAuthMethod","expiresAt","MissingDeveloperConnectionResolvedNotificationPayloadSchema","MissingExternalConnectionResolvedNotificationPayloadSchema","MissingConnectionResolvedNotificationPayloadSchema","import_zod","FetchRetryHeadersStrategySchema","z","object","strategy","literal","limitHeader","string","remainingHeader","resetHeader","FetchRetryBackoffStrategySchema","RetryOptionsSchema","extend","FetchRetryStrategySchema","discriminatedUnion","FetchRequestInitSchema","method","optional","headers","record","union","RedactStringSchema","body","instanceof","ArrayBuffer","FetchRetryOptionsSchema","FetchOperationSchema","url","requestInit","retry","import_zod","import_zod","RunStatusSchema","z","union","literal","RunTaskSchema","object","id","string","displayKey","nullable","status","TaskStatusSchema","name","icon","startedAt","coerce","date","completedAt","RunTaskWithSubtasksSchema","extend","subtasks","lazy","array","optional","GetRunOptionsSchema","boolean","cursor","take","number","GetRunOptionsWithTaskDetailsSchema","taskdetails","RunSchema","updatedAt","GetRunSchema","output","any","tasks","nextCursor","GetRunsOptionsSchema","GetRunsSchema","runs","GetEventSchema","z","object","id","string","name","createdAt","coerce","date","updatedAt","runs","array","status","RunStatusSchema","startedAt","optional","nullable","completedAt","deepMergeFilters","filters","result","filter","key","hasOwnProperty","filterValue","existingValue","Array","isArray","DEFAULT_RETRY_OPTIONS","limit","factor","minTimeoutInMs","maxTimeoutInMs","randomize","calculateRetryAt","retryOptions","attempts","options","retryCount","random","Math","timeoutInMs","round","max","pow","min","Date","now","currentDate","marker","replace","data","now","toISOString","currentTimestampMilliseconds","getTime","currentTimestampSeconds","replacements","urlWithSearchParams","url","params","urlObj","URL","key","value","Object","entries","searchParams","append","String","toString","eventFilterMatches","payload","filter","patternKey","patternValue","Object","entries","payloadValue","Array","isArray","length","every","item","includes","objectArray","contentFiltersMatches","some","actualValue","contentFilters","contentFilter","key","value","contentFilterMatches","endsWith","$endsWith","startsWith","$startsWith","$anythingBut","$exists","undefined","$gt","$lt","$gte","$lte","$between","$includes","localeCompare","$ignoreCaseEquals","sensitivity","$isNull"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/logger.ts","../src/schemas/api.ts","../src/schemas/addMissingVersionField.ts","../src/schemas/errors.ts","../src/schemas/eventFilter.ts","../src/schemas/integrations.ts","../src/schemas/json.ts","../src/schemas/properties.ts","../src/schemas/schedules.ts","../src/schemas/tasks.ts","../src/schemas/triggers.ts","../src/schemas/runs.ts","../src/schemas/statuses.ts","../src/schemas/notifications.ts","../src/schemas/fetch.ts","../src/schemas/events.ts","../src/utils.ts","../src/retry.ts","../src/replacements.ts","../src/searchParams.ts","../src/eventFilterMatches.ts"],"sourcesContent":["export * from \"./logger\";\nexport * from \"./schemas\";\nexport * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./retry\";\nexport * from \"./replacements\";\nexport * from \"./searchParams\";\nexport * from \"./eventFilterMatches\";\n","// Create a logger class that uses the debug package internally\n\n/**\n * Represents different log levels.\n * - `\"log\"`: Only essential messages.\n * - `\"error\"`: Errors and essential messages.\n * - `\"warn\"`: Warnings, Errors and essential messages.\n * - `\"info\"`: Info, Warnings, Errors and essential messages.\n * - `\"debug\"`: Everything.\n */\nexport type LogLevel = \"log\" | \"error\" | \"warn\" | \"info\" | \"debug\";\n\nconst logLevels: Array<LogLevel> = [\"log\", \"error\", \"warn\", \"info\", \"debug\"];\n\nexport class Logger {\n #name: string;\n readonly #level: number;\n #filteredKeys: string[] = [];\n #jsonReplacer?: (key: string, value: unknown) => unknown;\n\n constructor(\n name: string,\n level: LogLevel = \"info\",\n filteredKeys: string[] = [],\n jsonReplacer?: (key: string, value: unknown) => unknown\n ) {\n this.#name = name;\n this.#level = logLevels.indexOf((process.env.TRIGGER_LOG_LEVEL ?? level) as LogLevel);\n this.#filteredKeys = filteredKeys;\n this.#jsonReplacer = jsonReplacer;\n }\n\n // Return a new Logger instance with the same name and a new log level\n // but filter out the keys from the log messages (at any level)\n filter(...keys: string[]) {\n return new Logger(this.#name, logLevels[this.#level], keys, this.#jsonReplacer);\n }\n\n static satisfiesLogLevel(logLevel: LogLevel, setLevel: LogLevel) {\n return logLevels.indexOf(logLevel) <= logLevels.indexOf(setLevel);\n }\n\n log(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 0) return;\n\n this.#structuredLog(console.log, message, ...args);\n }\n\n error(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 1) return;\n\n this.#structuredLog(console.error, message, ...args);\n }\n\n warn(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 2) return;\n\n this.#structuredLog(console.warn, message, ...args);\n }\n\n info(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 3) return;\n\n this.#structuredLog(console.info, message, ...args);\n }\n\n debug(message: string, ...args: Array<Record<string, unknown> | undefined>) {\n if (this.#level < 4) return;\n\n this.#structuredLog(console.debug, message, ...args);\n }\n\n #structuredLog(\n loggerFunction: (message: string, ...args: any[]) => void,\n message: string,\n ...args: Array<Record<string, unknown> | undefined>\n ) {\n const structuredLog = {\n ...structureArgs(safeJsonClone(args) as Record<string, unknown>[], this.#filteredKeys),\n timestamp: new Date(),\n name: this.#name,\n message,\n };\n\n loggerFunction(JSON.stringify(structuredLog, createReplacer(this.#jsonReplacer)));\n }\n}\n\nfunction createReplacer(replacer?: (key: string, value: unknown) => unknown) {\n return (key: string, value: unknown) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n\n if (replacer) {\n return replacer(key, value);\n }\n\n return value;\n };\n}\n\n// Replacer function for JSON.stringify that converts BigInts to strings\nfunction bigIntReplacer(_key: string, value: unknown) {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n\n return value;\n}\n\nfunction safeJsonClone(obj: unknown) {\n try {\n return JSON.parse(JSON.stringify(obj, bigIntReplacer));\n } catch (e) {\n return obj;\n }\n}\n\nfunction formattedDateTime() {\n const date = new Date();\n\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n const milliseconds = date.getMilliseconds();\n\n // Make sure the time is always 2 digits\n const formattedHours = hours < 10 ? `0${hours}` : hours;\n const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes;\n const formattedSeconds = seconds < 10 ? `0${seconds}` : seconds;\n const formattedMilliseconds =\n milliseconds < 10\n ? `00${milliseconds}`\n : milliseconds < 100\n ? `0${milliseconds}`\n : milliseconds;\n\n return `${formattedHours}:${formattedMinutes}:${formattedSeconds}.${formattedMilliseconds}`;\n}\n\n// If args is has a single item that is an object, return that object\nfunction structureArgs(args: Array<Record<string, unknown>>, filteredKeys: string[] = []) {\n if (args.length === 0) {\n return;\n }\n\n if (args.length === 1 && typeof args[0] === \"object\") {\n return filterKeys(JSON.parse(JSON.stringify(args[0], bigIntReplacer)), filteredKeys);\n }\n\n return args;\n}\n\n// Recursively filter out keys from an object, including nested objects, and arrays\nfunction filterKeys(obj: unknown, keys: string[]): any {\n if (typeof obj !== \"object\" || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((item) => filterKeys(item, keys));\n }\n\n const filteredObj: any = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (keys.includes(key)) {\n if (value) {\n filteredObj[key] = `[filtered ${prettyPrintBytes(value)}]`;\n } else {\n filteredObj[key] = value;\n }\n continue;\n }\n\n filteredObj[key] = filterKeys(value, keys);\n }\n\n return filteredObj;\n}\n\nfunction prettyPrintBytes(value: unknown): string {\n if (process.env.NODE_ENV === \"production\") {\n return \"skipped size\";\n }\n\n const sizeInBytes = Buffer.byteLength(JSON.stringify(value), \"utf8\");\n\n if (sizeInBytes < 1024) {\n return `${sizeInBytes} bytes`;\n }\n\n if (sizeInBytes < 1024 * 1024) {\n return `${(sizeInBytes / 1024).toFixed(2)} KB`;\n }\n\n if (sizeInBytes < 1024 * 1024 * 1024) {\n return `${(sizeInBytes / (1024 * 1024)).toFixed(2)} MB`;\n }\n\n return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;\n}\n","import { ulid } from \"ulid\";\nimport { z } from \"zod\";\nimport { Prettify } from \"../types\";\nimport { addMissingVersionField } from \"./addMissingVersionField\";\nimport { ErrorWithStackSchema, SchemaErrorSchema } from \"./errors\";\nimport { EventRuleSchema } from \"./eventFilter\";\nimport { ConnectionAuthSchema, IntegrationConfigSchema } from \"./integrations\";\nimport { DeserializedJsonSchema, SerializableJsonSchema } from \"./json\";\nimport { DisplayPropertySchema, StyleSchema } from \"./properties\";\nimport {\n CronMetadataSchema,\n IntervalMetadataSchema,\n RegisterDynamicSchedulePayloadSchema,\n ScheduleMetadataSchema,\n} from \"./schedules\";\nimport { CachedTaskSchema, TaskSchema } from \"./tasks\";\nimport { EventSpecificationSchema, TriggerMetadataSchema } from \"./triggers\";\nimport { RunStatusSchema } from \"./runs\";\nimport { JobRunStatusRecordSchema } from \"./statuses\";\n\nexport const UpdateTriggerSourceBodyV1Schema = z.object({\n registeredEvents: z.array(z.string()),\n secret: z.string().optional(),\n data: SerializableJsonSchema.optional(),\n});\nexport type UpdateTriggerSourceBodyV1 = z.infer<typeof UpdateTriggerSourceBodyV1Schema>;\n\nexport const UpdateTriggerSourceBodyV2Schema = z.object({\n secret: z.string().optional(),\n data: SerializableJsonSchema.optional(),\n options: z\n .object({\n event: z.array(z.string()),\n })\n .and(z.record(z.string(), z.array(z.string())).optional()),\n});\nexport type UpdateTriggerSourceBodyV2 = z.infer<typeof UpdateTriggerSourceBodyV2Schema>;\n\nexport const RegisterHTTPTriggerSourceBodySchema = z.object({\n type: z.literal(\"HTTP\"),\n url: z.string().url(),\n});\n\nexport const RegisterSMTPTriggerSourceBodySchema = z.object({\n type: z.literal(\"SMTP\"),\n});\n\nexport const RegisterSQSTriggerSourceBodySchema = z.object({\n type: z.literal(\"SQS\"),\n});\n\nexport const RegisterSourceChannelBodySchema = z.discriminatedUnion(\"type\", [\n RegisterHTTPTriggerSourceBodySchema,\n RegisterSMTPTriggerSourceBodySchema,\n RegisterSQSTriggerSourceBodySchema,\n]);\n\nexport const REGISTER_SOURCE_EVENT_V1 = \"dev.trigger.source.register\";\nexport const REGISTER_SOURCE_EVENT_V2 = \"dev.trigger.source.register.v2\";\n\nexport const RegisterTriggerSourceSchema = z.object({\n key: z.string(),\n params: z.any(),\n active: z.boolean(),\n secret: z.string(),\n data: DeserializedJsonSchema.optional(),\n channel: RegisterSourceChannelBodySchema,\n clientId: z.string().optional(),\n});\n\nexport type RegisterTriggerSource = z.infer<typeof RegisterTriggerSourceSchema>;\n\nconst SourceEventOptionSchema = z.object({\n name: z.string(),\n value: z.string(),\n});\n\nexport type SourceEventOption = z.infer<typeof SourceEventOptionSchema>;\n\nexport const RegisterSourceEventSchemaV1 = z.object({\n /** The id of the source */\n id: z.string(),\n source: RegisterTriggerSourceSchema,\n events: z.array(z.string()),\n missingEvents: z.array(z.string()),\n orphanedEvents: z.array(z.string()),\n dynamicTriggerId: z.string().optional(),\n});\n\nexport type RegisterSourceEventV1 = z.infer<typeof RegisterSourceEventSchemaV1>;\n\nconst RegisteredOptionsDiffSchema = z.object({\n desired: z.array(z.string()),\n missing: z.array(z.string()),\n orphaned: z.array(z.string()),\n});\n\nexport type RegisteredOptionsDiff = Prettify<z.infer<typeof RegisteredOptionsDiffSchema>>;\n\nconst RegisterSourceEventOptionsSchema = z\n .object({\n event: RegisteredOptionsDiffSchema,\n })\n .and(z.record(z.string(), RegisteredOptionsDiffSchema));\n\nexport type RegisterSourceEventOptions = z.infer<typeof RegisterSourceEventOptionsSchema>;\n\nexport const RegisterSourceEventSchemaV2 = z.object({\n /** The id of the source */\n id: z.string(),\n source: RegisterTriggerSourceSchema,\n options: RegisterSourceEventOptionsSchema,\n dynamicTriggerId: z.string().optional(),\n});\n\nexport type RegisterSourceEventV2 = z.infer<typeof RegisterSourceEventSchemaV2>;\n\nexport const TriggerSourceSchema = z.object({\n id: z.string(),\n key: z.string(),\n});\n\nconst HttpSourceResponseMetadataSchema = DeserializedJsonSchema;\nexport type HttpSourceResponseMetadata = z.infer<typeof HttpSourceResponseMetadataSchema>;\n\nexport const HandleTriggerSourceSchema = z.object({\n key: z.string(),\n secret: z.string(),\n data: z.any(),\n params: z.any(),\n auth: ConnectionAuthSchema.optional(),\n metadata: HttpSourceResponseMetadataSchema.optional(),\n});\n\nexport type HandleTriggerSource = z.infer<typeof HandleTriggerSourceSchema>;\n\nexport type TriggerSource = z.infer<typeof TriggerSourceSchema>;\n\nexport const HttpSourceRequestSchema = z.object({\n url: z.string().url(),\n method: z.string(),\n headers: z.record(z.string()),\n rawBody: z.instanceof(Buffer).optional().nullable(),\n});\n\nexport type HttpSourceRequest = z.infer<typeof HttpSourceRequestSchema>;\n\nexport const HttpSourceRequestHeadersSchema = z.object({\n \"x-ts-key\": z.string(),\n \"x-ts-dynamic-id\": z.string().optional(),\n \"x-ts-secret\": z.string(),\n \"x-ts-data\": z.string().transform((s) => JSON.parse(s)),\n \"x-ts-params\": z.string().transform((s) => JSON.parse(s)),\n \"x-ts-http-url\": z.string(),\n \"x-ts-http-method\": z.string(),\n \"x-ts-http-headers\": z.string().transform((s) => z.record(z.string()).parse(JSON.parse(s))),\n \"x-ts-auth\": z\n .string()\n .optional()\n .transform((s) => {\n if (s === undefined) return;\n const json = JSON.parse(s);\n return ConnectionAuthSchema.parse(json);\n }),\n \"x-ts-metadata\": z\n .string()\n .optional()\n .transform((s) => {\n if (s === undefined) return;\n const json = JSON.parse(s);\n return DeserializedJsonSchema.parse(json);\n }),\n});\n\nexport type HttpSourceRequestHeaders = z.output<typeof HttpSourceRequestHeadersSchema>;\n\nexport const PongSuccessResponseSchema = z.object({\n ok: z.literal(true),\n});\n\nexport const PongErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n});\n\nexport const PongResponseSchema = z.discriminatedUnion(\"ok\", [\n PongSuccessResponseSchema,\n PongErrorResponseSchema,\n]);\n\nexport type PongResponse = z.infer<typeof PongResponseSchema>;\n\nexport const ValidateSuccessResponseSchema = z.object({\n ok: z.literal(true),\n endpointId: z.string(),\n});\n\nexport const ValidateErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n});\n\nexport const ValidateResponseSchema = z.discriminatedUnion(\"ok\", [\n ValidateSuccessResponseSchema,\n ValidateErrorResponseSchema,\n]);\n\nexport type ValidateResponse = z.infer<typeof ValidateResponseSchema>;\n\nexport const QueueOptionsSchema = z.object({\n name: z.string(),\n maxConcurrent: z.number().optional(),\n});\n\nexport type QueueOptions = z.infer<typeof QueueOptionsSchema>;\n\nexport const JobMetadataSchema = z.object({\n id: z.string(),\n name: z.string(),\n version: z.string(),\n event: EventSpecificationSchema,\n trigger: TriggerMetadataSchema,\n integrations: z.record(IntegrationConfigSchema),\n internal: z.boolean().default(false),\n enabled: z.boolean(),\n startPosition: z.enum([\"initial\", \"latest\"]),\n preprocessRuns: z.boolean(),\n});\n\nexport type JobMetadata = z.infer<typeof JobMetadataSchema>;\n\nconst SourceMetadataV1Schema = z.object({\n version: z.literal(\"1\"),\n channel: z.enum([\"HTTP\", \"SQS\", \"SMTP\"]),\n integration: IntegrationConfigSchema,\n key: z.string(),\n params: z.any(),\n events: z.array(z.string()),\n registerSourceJob: z\n .object({\n id: z.string(),\n version: z.string(),\n })\n .optional(),\n});\n\nexport type SourceMetadataV1 = z.infer<typeof SourceMetadataV1Schema>;\n\nexport const SourceMetadataV2Schema = z.object({\n version: z.literal(\"2\"),\n channel: z.enum([\"HTTP\", \"SQS\", \"SMTP\"]),\n integration: IntegrationConfigSchema,\n key: z.string(),\n params: z.any(),\n options: z.record(z.array(z.string())),\n registerSourceJob: z\n .object({\n id: z.string(),\n version: z.string(),\n })\n .optional(),\n});\n\nexport type SourceMetadataV2 = z.infer<typeof SourceMetadataV2Schema>;\n\nconst SourceMetadataSchema = z.preprocess(\n addMissingVersionField,\n z.discriminatedUnion(\"version\", [SourceMetadataV1Schema, SourceMetadataV2Schema])\n);\n\ntype SourceMetadata = Prettify<z.infer<typeof SourceMetadataSchema>>;\n\nexport const DynamicTriggerEndpointMetadataSchema = z.object({\n id: z.string(),\n jobs: z.array(JobMetadataSchema.pick({ id: true, version: true })),\n registerSourceJob: z\n .object({\n id: z.string(),\n version: z.string(),\n })\n .optional(),\n});\n\nexport type DynamicTriggerEndpointMetadata = z.infer<typeof DynamicTriggerEndpointMetadataSchema>;\n\nexport const IndexEndpointResponseSchema = z.object({\n jobs: z.array(JobMetadataSchema),\n sources: z.array(SourceMetadataSchema),\n dynamicTriggers: z.array(DynamicTriggerEndpointMetadataSchema),\n dynamicSchedules: z.array(RegisterDynamicSchedulePayloadSchema),\n});\n\nexport type IndexEndpointResponse = z.infer<typeof IndexEndpointResponseSchema>;\n\nexport const RawEventSchema = z.object({\n /** The `name` property must exactly match any subscriptions you want to\n trigger. */\n name: z.string(),\n /** The `payload` property will be sent to any matching Jobs and will appear\n as the `payload` param of the `run()` function. You can leave this\n parameter out if you just want to trigger a Job without any input data. */\n payload: z.any(),\n /** The optional `context` property will be sent to any matching Jobs and will\n be passed through as the `context.event.context` param of the `run()`\n function. This is optional but can be useful if you want to pass through\n some additional context to the Job. */\n context: z.any().optional(),\n /** The `id` property uniquely identify this particular event. If unset it\n will be set automatically using `ulid`. */\n id: z.string().default(() => ulid()),\n /** This is optional, it defaults to the current timestamp. Usually you would\n only set this if you have a timestamp that you wish to pass through, e.g.\n you receive a timestamp from a service and you want the same timestamp to\n be used in your Job. */\n timestamp: z.coerce.date().optional(),\n /** This is optional, it defaults to \"trigger.dev\". It can be useful to set\n this as you can filter events using this in the `eventTrigger()`. */\n source: z.string().optional(),\n});\n\nexport type RawEvent = z.infer<typeof RawEventSchema>;\n\n/** The event you wish to send to Trigger a Job */\nexport type SendEvent = z.input<typeof RawEventSchema>;\n\n/** The event that was sent */\nexport const ApiEventLogSchema = z.object({\n /** The `id` of the event that was sent.\n */\n id: z.string(),\n /** The `name` of the event that was sent. */\n name: z.string(),\n /** The `payload` of the event that was sent */\n payload: DeserializedJsonSchema,\n /** The `context` of the event that was sent. Is `undefined` if no context was\n set when sending the event. */\n context: DeserializedJsonSchema.optional().nullable(),\n /** The `timestamp` of the event that was sent */\n timestamp: z.coerce.date(),\n /** The timestamp when the event will be delivered to any matching Jobs. Is\n `undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the\n event. */\n deliverAt: z.coerce.date().optional().nullable(),\n /** The timestamp when the event was delivered. Is `undefined` if `deliverAt`\n or `deliverAfter` were set when sending the event. */\n deliveredAt: z.coerce.date().optional().nullable(),\n /** The timestamp when the event was cancelled. Is `undefined` if the event\n * wasn't cancelled. */\n cancelledAt: z.coerce.date().optional().nullable(),\n});\n\nexport type ApiEventLog = z.infer<typeof ApiEventLogSchema>;\n\n/** Options to control the delivery of the event */\nexport const SendEventOptionsSchema = z.object({\n /** An optional Date when you want the event to trigger Jobs. The event will\n be sent to the platform immediately but won't be acted upon until the\n specified time. */\n deliverAt: z.coerce.date().optional(),\n /** An optional number of seconds you want to wait for the event to trigger\n any relevant Jobs. The event will be sent to the platform immediately but\n won't be delivered until after the elapsed number of seconds. */\n deliverAfter: z.number().int().optional(),\n /** This optional param will be used by Trigger.dev Connect, which\n is coming soon. */\n accountId: z.string().optional(),\n});\n\nexport const SendEventBodySchema = z.object({\n event: RawEventSchema,\n options: SendEventOptionsSchema.optional(),\n});\n\nexport type SendEventBody = z.infer<typeof SendEventBodySchema>;\nexport type SendEventOptions = z.infer<typeof SendEventOptionsSchema>;\n\nexport const DeliverEventResponseSchema = z.object({\n deliveredAt: z.string().datetime(),\n});\n\nexport type DeliverEventResponse = z.infer<typeof DeliverEventResponseSchema>;\n\nexport const RuntimeEnvironmentTypeSchema = z.enum([\n \"PRODUCTION\",\n \"STAGING\",\n \"DEVELOPMENT\",\n \"PREVIEW\",\n]);\n\nexport type RuntimeEnvironmentType = z.infer<typeof RuntimeEnvironmentTypeSchema>;\n\nexport const RunSourceContextSchema = z.object({\n id: z.string(),\n metadata: z.any(),\n});\n\nexport const RunJobBodySchema = z.object({\n event: ApiEventLogSchema,\n job: z.object({\n id: z.string(),\n version: z.string(),\n }),\n run: z.object({\n id: z.string(),\n isTest: z.boolean(),\n isRetry: z.boolean().default(false),\n startedAt: z.coerce.date(),\n }),\n environment: z.object({\n id: z.string(),\n slug: z.string(),\n type: RuntimeEnvironmentTypeSchema,\n }),\n organization: z.object({\n id: z.string(),\n title: z.string(),\n slug: z.string(),\n }),\n account: z\n .object({\n id: z.string(),\n metadata: z.any(),\n })\n .optional(),\n source: RunSourceContextSchema.optional(),\n tasks: z.array(CachedTaskSchema).optional(),\n connections: z.record(ConnectionAuthSchema).optional(),\n});\n\nexport type RunJobBody = z.infer<typeof RunJobBodySchema>;\n\nexport const RunJobErrorSchema = z.object({\n status: z.literal(\"ERROR\"),\n error: ErrorWithStackSchema,\n task: TaskSchema.optional(),\n});\n\nexport type RunJobError = z.infer<typeof RunJobErrorSchema>;\n\nexport const RunJobInvalidPayloadErrorSchema = z.object({\n status: z.literal(\"INVALID_PAYLOAD\"),\n errors: z.array(SchemaErrorSchema),\n});\n\nexport type RunJobInvalidPayloadError = z.infer<typeof RunJobInvalidPayloadErrorSchema>;\n\nexport const RunJobUnresolvedAuthErrorSchema = z.object({\n status: z.literal(\"UNRESOLVED_AUTH_ERROR\"),\n issues: z.record(z.object({ id: z.string(), error: z.string() })),\n});\n\nexport type RunJobUnresolvedAuthError = z.infer<typeof RunJobUnresolvedAuthErrorSchema>;\n\nexport const RunJobResumeWithTaskSchema = z.object({\n status: z.literal(\"RESUME_WITH_TASK\"),\n task: TaskSchema,\n});\n\nexport type RunJobResumeWithTask = z.infer<typeof RunJobResumeWithTaskSchema>;\n\nexport const RunJobRetryWithTaskSchema = z.object({\n status: z.literal(\"RETRY_WITH_TASK\"),\n task: TaskSchema,\n error: ErrorWithStackSchema,\n retryAt: z.coerce.date(),\n});\n\nexport type RunJobRetryWithTask = z.infer<typeof RunJobRetryWithTaskSchema>;\n\nexport const RunJobCanceledWithTaskSchema = z.object({\n status: z.literal(\"CANCELED\"),\n task: TaskSchema,\n});\n\nexport type RunJobCanceledWithTask = z.infer<typeof RunJobCanceledWithTaskSchema>;\n\nexport const RunJobSuccessSchema = z.object({\n status: z.literal(\"SUCCESS\"),\n output: DeserializedJsonSchema.optional(),\n});\n\nexport type RunJobSuccess = z.infer<typeof RunJobSuccessSchema>;\n\nexport const RunJobResponseSchema = z.discriminatedUnion(\"status\", [\n RunJobErrorSchema,\n RunJobUnresolvedAuthErrorSchema,\n RunJobInvalidPayloadErrorSchema,\n RunJobResumeWithTaskSchema,\n RunJobRetryWithTaskSchema,\n RunJobCanceledWithTaskSchema,\n RunJobSuccessSchema,\n]);\n\nexport type RunJobResponse = z.infer<typeof RunJobResponseSchema>;\n\nexport const PreprocessRunBodySchema = z.object({\n event: ApiEventLogSchema,\n job: z.object({\n id: z.string(),\n version: z.string(),\n }),\n run: z.object({\n id: z.string(),\n isTest: z.boolean(),\n }),\n environment: z.object({\n id: z.string(),\n slug: z.string(),\n type: RuntimeEnvironmentTypeSchema,\n }),\n organization: z.object({\n id: z.string(),\n title: z.string(),\n slug: z.string(),\n }),\n account: z\n .object({\n id: z.string(),\n metadata: z.any(),\n })\n .optional(),\n});\n\nexport type PreprocessRunBody = z.infer<typeof PreprocessRunBodySchema>;\n\nexport const PreprocessRunResponseSchema = z.object({\n abort: z.boolean(),\n properties: z.array(DisplayPropertySchema).optional(),\n});\n\nexport type PreprocessRunResponse = z.infer<typeof PreprocessRunResponseSchema>;\n\nconst CreateRunResponseOkSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n id: z.string(),\n }),\n});\n\nconst CreateRunResponseErrorSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n});\n\nexport const CreateRunResponseBodySchema = z.discriminatedUnion(\"ok\", [\n CreateRunResponseOkSchema,\n CreateRunResponseErrorSchema,\n]);\n\nexport type CreateRunResponseBody = z.infer<typeof CreateRunResponseBodySchema>;\n\nexport const RedactStringSchema = z.object({\n __redactedString: z.literal(true),\n strings: z.array(z.string()),\n interpolations: z.array(z.string()),\n});\n\nexport type RedactString = z.infer<typeof RedactStringSchema>;\n\nexport const LogMessageSchema = z.object({\n level: z.enum([\"DEBUG\", \"INFO\", \"WARN\", \"ERROR\"]),\n message: z.string(),\n data: SerializableJsonSchema.optional(),\n});\n\nexport type LogMessage = z.infer<typeof LogMessageSchema>;\n\nexport type ClientTask = z.infer<typeof TaskSchema>;\nexport type CachedTask = z.infer<typeof CachedTaskSchema>;\n\nexport const RedactSchema = z.object({\n paths: z.array(z.string()),\n});\n\nexport const RetryOptionsSchema = z.object({\n /** The maximum number of times to retry the request. */\n limit: z.number().optional(),\n /** The exponential factor to use when calculating the next retry time. */\n factor: z.number().optional(),\n /** The minimum amount of time to wait before retrying the request. */\n minTimeoutInMs: z.number().optional(),\n /** The maximum amount of time to wait before retrying the request. */\n maxTimeoutInMs: z.number().optional(),\n /** Whether to randomize the retry time. */\n randomize: z.boolean().optional(),\n});\n\nexport type RetryOptions = z.infer<typeof RetryOptionsSchema>;\n\nexport const RunTaskOptionsSchema = z.object({\n /** The name of the Task is required. This is displayed on the Task in the logs. */\n name: z.string().optional(),\n /** The Task will wait and only start at the specified Date */\n delayUntil: z.coerce.date().optional(),\n /** Retry options */\n retry: RetryOptionsSchema.optional(),\n /** The icon for the Task, it will appear in the logs.\n * You can use the name of a company in lowercase, e.g. \"github\".\n * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */\n icon: z.string().optional(),\n /** The key for the Task that you want to appear in the logs */\n displayKey: z.string().optional(),\n /** A description of the Task */\n description: z.string().optional(),\n /** Properties that are displayed in the logs */\n properties: z.array(DisplayPropertySchema).optional(),\n /** The input params to the Task, will be displayed in the logs */\n params: z.any(),\n /** The style of the log entry. */\n style: StyleSchema.optional(),\n /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */\n connectionKey: z.string().optional(),\n /** 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. */\n operation: z.enum([\"fetch\"]).optional(),\n /** 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). */\n noop: z.boolean().default(false),\n redact: RedactSchema.optional(),\n trigger: TriggerMetadataSchema.optional(),\n});\n\nexport type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;\n\nexport type OverridableRunTaskOptions = Pick<\n RunTaskOptions,\n \"retry\" | \"delayUntil\" | \"description\"\n>;\n\nexport const RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({\n idempotencyKey: z.string(),\n parentId: z.string().optional(),\n});\n\nexport type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;\n\nexport const RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({\n params: DeserializedJsonSchema.optional().nullable(),\n});\n\nexport type RunTaskBodyOutput = z.infer<typeof RunTaskBodyOutputSchema>;\n\nexport const CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({\n properties: true,\n description: true,\n params: true,\n}).extend({\n output: SerializableJsonSchema.optional().transform((v) =>\n v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {}\n ),\n});\n\nexport type CompleteTaskBodyInput = Prettify<z.input<typeof CompleteTaskBodyInputSchema>>;\nexport type CompleteTaskBodyOutput = z.infer<typeof CompleteTaskBodyInputSchema>;\n\nexport const FailTaskBodyInputSchema = z.object({\n error: ErrorWithStackSchema,\n});\n\nexport type FailTaskBodyInput = z.infer<typeof FailTaskBodyInputSchema>;\n\nexport const NormalizedRequestSchema = z.object({\n headers: z.record(z.string()),\n method: z.string(),\n query: z.record(z.string()),\n url: z.string(),\n body: z.any(),\n});\n\nexport type NormalizedRequest = z.infer<typeof NormalizedRequestSchema>;\n\nexport const NormalizedResponseSchema = z.object({\n status: z.number(),\n body: z.any(),\n headers: z.record(z.string()).optional(),\n});\n\nexport type NormalizedResponse = z.infer<typeof NormalizedResponseSchema>;\n\nexport const HttpSourceResponseSchema = z.object({\n response: NormalizedResponseSchema,\n events: z.array(RawEventSchema),\n metadata: HttpSourceResponseMetadataSchema.optional(),\n});\n\nexport const RegisterTriggerBodySchemaV1 = z.object({\n rule: EventRuleSchema,\n source: SourceMetadataV1Schema,\n});\n\nexport type RegisterTriggerBodyV1 = z.infer<typeof RegisterTriggerBodySchemaV1>;\n\nexport const RegisterTriggerBodySchemaV2 = z.object({\n rule: EventRuleSchema,\n source: SourceMetadataV2Schema,\n accountId: z.string().optional(),\n});\n\nexport type RegisterTriggerBodyV2 = z.infer<typeof RegisterTriggerBodySchemaV2>;\n\nexport const InitializeTriggerBodySchema = z.object({\n id: z.string(),\n params: z.any(),\n accountId: z.string().optional(),\n metadata: z.any().optional(),\n});\n\nexport type InitializeTriggerBody = z.infer<typeof InitializeTriggerBodySchema>;\n\nconst RegisterCommonScheduleBodySchema = z.object({\n /** A unique id for the schedule. This is used to identify and unregister the schedule later. */\n id: z.string(),\n /** Any additional metadata about the schedule. */\n metadata: z.any(),\n /** An optional Account ID to associate with runs triggered by this schedule */\n accountId: z.string().optional(),\n});\n\nexport const RegisterIntervalScheduleBodySchema =\n RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);\n\nexport type RegisterIntervalScheduleBody = z.infer<typeof RegisterIntervalScheduleBodySchema>;\n\nexport const InitializeCronScheduleBodySchema =\n RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);\n\nexport type RegisterCronScheduleBody = z.infer<typeof InitializeCronScheduleBodySchema>;\n\nexport const RegisterScheduleBodySchema = z.discriminatedUnion(\"type\", [\n RegisterIntervalScheduleBodySchema,\n InitializeCronScheduleBodySchema,\n]);\n\nexport type RegisterScheduleBody = z.infer<typeof RegisterScheduleBodySchema>;\n\nexport const RegisterScheduleResponseBodySchema = z.object({\n id: z.string(),\n schedule: ScheduleMetadataSchema,\n metadata: z.any(),\n active: z.boolean(),\n});\n\nexport type RegisterScheduleResponseBody = z.infer<typeof RegisterScheduleResponseBodySchema>;\n\nexport const CreateExternalConnectionBodySchema = z.object({\n accessToken: z.string(),\n type: z.enum([\"oauth2\"]),\n scopes: z.array(z.string()).optional(),\n metadata: z.any(),\n});\n\nexport type CreateExternalConnectionBody = z.infer<typeof CreateExternalConnectionBodySchema>;\n\nexport const GetRunStatusesSchema = z.object({\n run: z.object({ id: z.string(), status: RunStatusSchema, output: z.any().optional() }),\n statuses: z.array(JobRunStatusRecordSchema),\n});\nexport type GetRunStatuses = z.infer<typeof GetRunStatusesSchema>;\n","export function addMissingVersionField(val: unknown) {\n if (val !== null && typeof val === \"object\" && !(\"version\" in val)) {\n return {\n ...val,\n version: \"1\",\n };\n }\n return val;\n}\n","import { z } from \"zod\";\n\nexport const ErrorWithStackSchema = z.object({\n message: z.string(),\n name: z.string().optional(),\n stack: z.string().optional(),\n});\n\nexport type ErrorWithStack = z.infer<typeof ErrorWithStackSchema>;\n\nexport const SchemaErrorSchema = z.object({\n path: z.array(z.string()),\n message: z.string(),\n});\n\nexport type SchemaError = z.infer<typeof SchemaErrorSchema>;\n","import { z } from \"zod\";\n\nconst EventMatcherSchema = z.union([\n /** Match against a string */\n z.array(z.string()),\n /** Match against a number */\n z.array(z.number()),\n /** Match against a boolean */\n z.array(z.boolean()),\n z.array(\n z.union([\n z.object({\n $endsWith: z.string(),\n }),\n z.object({\n $startsWith: z.string(),\n }),\n z.object({\n $exists: z.boolean(),\n }),\n z.object({\n $isNull: z.boolean(),\n }),\n z.object({\n $anythingBut: z.union([z.string(), z.number(), z.boolean()]),\n }),\n z.object({\n $anythingBut: z.union([z.array(z.string()), z.array(z.number()), z.array(z.boolean())]),\n }),\n z.object({\n $gt: z.number(),\n }),\n z.object({\n $lt: z.number(),\n }),\n z.object({\n $gte: z.number(),\n }),\n z.object({\n $lte: z.number(),\n }),\n z.object({\n $between: z.tuple([z.number(), z.number()]),\n }),\n z.object({\n $includes: z.union([z.string(), z.number(), z.boolean()]),\n }),\n z.object({\n $ignoreCaseEquals: z.string(),\n }),\n ])\n ),\n]);\n\ntype EventMatcher = z.infer<typeof EventMatcherSchema>;\n\n/** A filter for matching against data */\nexport type EventFilter = { [key: string]: EventMatcher | EventFilter };\n\nexport const EventFilterSchema: z.ZodType<EventFilter> = z.lazy(() =>\n z.record(z.union([EventMatcherSchema, EventFilterSchema]))\n);\n\nexport const EventRuleSchema = z.object({\n event: z.string().or(z.array(z.string())),\n source: z.string(),\n payload: EventFilterSchema.optional(),\n context: EventFilterSchema.optional(),\n});\n\nexport type EventRule = z.infer<typeof EventRuleSchema>;\n","import { z } from \"zod\";\n\nexport const ConnectionAuthSchema = z.object({\n type: z.enum([\"oauth2\", \"apiKey\"]),\n accessToken: z.string(),\n scopes: z.array(z.string()).optional(),\n additionalFields: z.record(z.string()).optional(),\n});\n\nexport type ConnectionAuth = z.infer<typeof ConnectionAuthSchema>;\n\nexport const IntegrationMetadataSchema = z.object({\n id: z.string(),\n name: z.string(),\n instructions: z.string().optional(),\n});\n\nexport type IntegrationMetadata = z.infer<typeof IntegrationMetadataSchema>;\n\nexport const IntegrationConfigSchema = z.object({\n id: z.string(),\n metadata: IntegrationMetadataSchema,\n authSource: z.enum([\"HOSTED\", \"LOCAL\", \"RESOLVER\"]),\n});\n\nexport type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;\n","import { z } from \"zod\";\n\nconst LiteralSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);\ntype Literal = z.infer<typeof LiteralSchema>;\n\nexport type DeserializedJson = Literal | { [key: string]: DeserializedJson } | DeserializedJson[];\n\nexport const DeserializedJsonSchema: z.ZodType<DeserializedJson> = z.lazy(() =>\n z.union([LiteralSchema, z.array(DeserializedJsonSchema), z.record(DeserializedJsonSchema)])\n);\n\nconst SerializableSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.date(),\n z.undefined(),\n z.symbol(),\n]);\ntype Serializable = z.infer<typeof SerializableSchema>;\n\nexport type SerializableJson =\n | Serializable\n | { [key: string]: SerializableJson }\n | SerializableJson[];\n\nexport const SerializableJsonSchema: z.ZodType<SerializableJson> = z.lazy(() =>\n z.union([SerializableSchema, z.array(SerializableJsonSchema), z.record(SerializableJsonSchema)])\n);\n","import { z } from \"zod\";\n\n/** A property that is displayed in the logs */\nexport const DisplayPropertySchema = z.object({\n /** The label for the property */\n label: z.string(),\n /** The value of the property */\n text: z.string(),\n /** The URL to link to when the property is clicked */\n url: z.string().optional(),\n});\n\nexport const DisplayPropertiesSchema = z.array(DisplayPropertySchema);\n\nexport type DisplayProperty = z.infer<typeof DisplayPropertySchema>;\n\nexport const StyleSchema = z.object({\n /** The style, `normal` or `minimal` */\n style: z.enum([\"normal\", \"minimal\"]),\n /** A variant of the style. */\n variant: z.string().optional(),\n});\n\nexport type Style = z.infer<typeof StyleSchema>;\nexport type StyleName = Style[\"style\"];\n","import { z } from \"zod\";\n\nexport const SCHEDULED_EVENT = \"dev.trigger.scheduled\";\n\nexport const ScheduledPayloadSchema = z.object({\n ts: z.coerce.date(),\n lastTimestamp: z.coerce.date().optional(),\n});\n\nexport type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;\n\nexport const IntervalOptionsSchema = z.object({\n /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */\n seconds: z.number().int().positive().min(60).max(86400),\n});\n\n/** Interval options */\nexport type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;\n\nexport const CronOptionsSchema = z.object({\n /** A CRON expression that defines the schedule. A useful tool when writing CRON\n expressions is [crontab guru](https://crontab.guru). Note that the timezone\n used is UTC. */\n cron: z.string(),\n});\n\n/** The options for a `cronTrigger()` */\nexport type CronOptions = z.infer<typeof CronOptionsSchema>;\n\nexport const CronMetadataSchema = z.object({\n type: z.literal(\"cron\"),\n options: CronOptionsSchema,\n /** An optional Account ID to associate with runs triggered by this interval */\n accountId: z.string().optional(),\n metadata: z.any(),\n});\n\nexport type CronMetadata = z.infer<typeof CronMetadataSchema>;\n\nexport const IntervalMetadataSchema = z.object({\n /** An interval reoccurs at the specified number of seconds */\n type: z.literal(\"interval\"),\n /** An object containing options about the interval. */\n options: IntervalOptionsSchema,\n /** An optional Account ID to associate with runs triggered by this interval */\n accountId: z.string().optional(),\n /** Any additional metadata about the schedule. */\n metadata: z.any(),\n});\n\nexport type IntervalMetadata = z.infer<typeof IntervalMetadataSchema>;\n\nexport const ScheduleMetadataSchema = z.discriminatedUnion(\"type\", [\n IntervalMetadataSchema,\n CronMetadataSchema,\n]);\n\nexport type ScheduleMetadata = z.infer<typeof ScheduleMetadataSchema>;\n\nexport const RegisterDynamicSchedulePayloadSchema = z.object({\n id: z.string(),\n jobs: z.array(\n z.object({\n id: z.string(),\n version: z.string(),\n })\n ),\n});\n\nexport type RegisterDynamicSchedulePayload = z.infer<typeof RegisterDynamicSchedulePayloadSchema>;\n","import { z } from \"zod\";\nimport { DisplayPropertySchema, StyleSchema } from \"./properties\";\nimport { DeserializedJsonSchema } from \"./json\";\n\nexport const TaskStatusSchema = z.enum([\n \"PENDING\",\n \"WAITING\",\n \"RUNNING\",\n \"COMPLETED\",\n \"ERRORED\",\n \"CANCELED\",\n]);\n\nexport type TaskStatus = z.infer<typeof TaskStatusSchema>;\n\nexport const TaskSchema = z.object({\n id: z.string(),\n name: z.string(),\n icon: z.string().optional().nullable(),\n noop: z.boolean(),\n startedAt: z.coerce.date().optional().nullable(),\n completedAt: z.coerce.date().optional().nullable(),\n delayUntil: z.coerce.date().optional().nullable(),\n status: TaskStatusSchema,\n description: z.string().optional().nullable(),\n properties: z.array(DisplayPropertySchema).optional().nullable(),\n outputProperties: z.array(DisplayPropertySchema).optional().nullable(),\n params: DeserializedJsonSchema.optional().nullable(),\n output: DeserializedJsonSchema.optional().nullable(),\n error: z.string().optional().nullable(),\n parentId: z.string().optional().nullable(),\n style: StyleSchema.optional().nullable(),\n operation: z.string().optional().nullable(),\n});\n\nexport const ServerTaskSchema = TaskSchema.extend({\n idempotencyKey: z.string(),\n attempts: z.number(),\n});\n\nexport type ServerTask = z.infer<typeof ServerTaskSchema>;\n\nexport const CachedTaskSchema = z.object({\n id: z.string(),\n idempotencyKey: z.string(),\n status: TaskStatusSchema,\n noop: z.boolean().default(false),\n output: DeserializedJsonSchema.optional().nullable(),\n parentId: z.string().optional().nullable(),\n});\n","import { z } from \"zod\";\nimport { EventFilterSchema, EventRuleSchema } from \"./eventFilter\";\nimport { DisplayPropertySchema } from \"./properties\";\nimport { ScheduleMetadataSchema } from \"./schedules\";\n\nexport const EventExampleSchema = z.object({\n id: z.string(),\n icon: z.string().optional(),\n name: z.string(),\n payload: z.any(),\n});\n\nexport type EventExample = z.infer<typeof EventExampleSchema>;\n\nexport const EventSpecificationSchema = z.object({\n name: z.string().or(z.array(z.string())),\n title: z.string(),\n source: z.string(),\n icon: z.string(),\n filter: EventFilterSchema.optional(),\n properties: z.array(DisplayPropertySchema).optional(),\n schema: z.any().optional(),\n examples: z.array(EventExampleSchema).optional(),\n});\n\nexport const DynamicTriggerMetadataSchema = z.object({\n type: z.literal(\"dynamic\"),\n id: z.string(),\n});\n\nexport const StaticTriggerMetadataSchema = z.object({\n type: z.literal(\"static\"),\n title: z.union([z.string(), z.array(z.string())]),\n properties: z.array(DisplayPropertySchema).optional(),\n rule: EventRuleSchema,\n});\n\nexport const ScheduledTriggerMetadataSchema = z.object({\n type: z.literal(\"scheduled\"),\n schedule: ScheduleMetadataSchema,\n});\n\nexport const TriggerMetadataSchema = z.discriminatedUnion(\"type\", [\n DynamicTriggerMetadataSchema,\n StaticTriggerMetadataSchema,\n ScheduledTriggerMetadataSchema,\n]);\n\nexport type TriggerMetadata = z.infer<typeof TriggerMetadataSchema>;\n","import { z } from \"zod\";\nimport { TaskStatusSchema } from \"./tasks\";\nimport { JobRunStatusRecordSchema } from \"./statuses\";\n\nexport const RunStatusSchema = z.union([\n z.literal(\"PENDING\"),\n z.literal(\"QUEUED\"),\n z.literal(\"WAITING_ON_CONNECTIONS\"),\n z.literal(\"PREPROCESSING\"),\n z.literal(\"STARTED\"),\n z.literal(\"SUCCESS\"),\n z.literal(\"FAILURE\"),\n z.literal(\"TIMED_OUT\"),\n z.literal(\"ABORTED\"),\n z.literal(\"CANCELED\"),\n z.literal(\"UNRESOLVED_AUTH\"),\n z.literal(\"INVALID_PAYLOAD\"),\n]);\n\nexport const RunTaskSchema = z.object({\n /** The Task id */\n id: z.string(),\n /** The key that you defined when creating the Task, the first param in any task. */\n displayKey: z.string().nullable(),\n /** The Task status */\n status: TaskStatusSchema,\n /** The name of the Task */\n name: z.string(),\n /** The icon of the Task, a string.\n * For integrations, this will be a lowercase name of the company.\n * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */\n icon: z.string().nullable(),\n /** When the task started */\n startedAt: z.coerce.date().nullable(),\n /** When the task completed */\n completedAt: z.coerce.date().nullable(),\n});\n\nexport type RunTaskWithSubtasks = z.infer<typeof RunTaskSchema> & {\n /** The subtasks of the task */\n subtasks?: RunTaskWithSubtasks[];\n};\n\nconst RunTaskWithSubtasksSchema: z.ZodType<RunTaskWithSubtasks> = RunTaskSchema.extend({\n subtasks: z.lazy(() => RunTaskWithSubtasksSchema.array()).optional(),\n});\n\nconst GetRunOptionsSchema = z.object({\n /** Return subtasks, which appear in a `subtasks` array on a task. @default false */\n subtasks: z.boolean().optional(),\n /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */\n cursor: z.string().optional(),\n /** How many tasks you want to return in one go, max 50. @default 20 */\n take: z.number().optional(),\n});\n\nexport type GetRunOptions = z.infer<typeof GetRunOptionsSchema>;\n\nconst GetRunOptionsWithTaskDetailsSchema = GetRunOptionsSchema.extend({\n /** If `true`, it returns the `params` and `output` of all tasks. @default false */\n taskdetails: z.boolean().optional(),\n});\n\nexport type GetRunOptionsWithTaskDetails = z.infer<typeof GetRunOptionsWithTaskDetailsSchema>;\n\nconst RunSchema = z.object({\n /** The Run id */\n id: z.string(),\n /** The Run status */\n status: RunStatusSchema,\n /** When the run started */\n startedAt: z.coerce.date().nullable(),\n /** When the run was last updated */\n updatedAt: z.coerce.date().nullable(),\n /** When the run was completed */\n completedAt: z.coerce.date().nullable(),\n});\n\nexport const GetRunSchema = RunSchema.extend({\n /** The output of the run */\n output: z.any().optional(),\n /** The tasks from the run */\n tasks: z.array(RunTaskWithSubtasksSchema),\n /** Any status updates that were published from the run */\n statuses: z.array(JobRunStatusRecordSchema).default([]),\n /** If there are more tasks, you can use this to get them */\n nextCursor: z.string().optional(),\n});\n\nexport type GetRun = z.infer<typeof GetRunSchema>;\n\nconst GetRunsOptionsSchema = z.object({\n /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */\n cursor: z.string().optional(),\n /** How many runs you want to return in one go, max 50. @default 20 */\n take: z.number().optional(),\n});\n\nexport type GetRunsOptions = z.infer<typeof GetRunsOptionsSchema>;\n\nexport const GetRunsSchema = z.object({\n /** The runs from the query */\n runs: RunSchema.array(),\n /** If there are more runs, you can use this to get them */\n nextCursor: z.string().optional(),\n});\n","import { z } from \"zod\";\nimport { SerializableJsonSchema } from \"./json\";\nimport { RunStatusSchema } from \"./runs\";\n\nexport const StatusUpdateStateSchema = z.union([\n z.literal(\"loading\"),\n z.literal(\"success\"),\n z.literal(\"failure\"),\n]);\nexport type StatusUpdateState = z.infer<typeof StatusUpdateStateSchema>;\n\nconst StatusUpdateDataSchema = z.record(SerializableJsonSchema);\nexport type StatusUpdateData = z.infer<typeof StatusUpdateDataSchema>;\n\nexport const StatusUpdateSchema = z.object({\n label: z.string().optional(),\n state: StatusUpdateStateSchema.optional(),\n data: StatusUpdateDataSchema.optional(),\n});\nexport type StatusUpdate = z.infer<typeof StatusUpdateSchema>;\n\nconst InitalStatusUpdateSchema = StatusUpdateSchema.required({ label: true });\nexport type InitialStatusUpdate = z.infer<typeof InitalStatusUpdateSchema>;\n\nexport const StatusHistorySchema = z.array(StatusUpdateSchema);\nexport type StatusHistory = z.infer<typeof StatusHistorySchema>;\n\nexport const JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({\n key: z.string(),\n history: StatusHistorySchema,\n});\n","import { z } from \"zod\";\n\nexport const MISSING_CONNECTION_NOTIFICATION = \"dev.trigger.notifications.missingConnection\";\n\nexport const MISSING_CONNECTION_RESOLVED_NOTIFICATION =\n \"dev.trigger.notifications.missingConnectionResolved\";\n\nexport const CommonMissingConnectionNotificationPayloadSchema = z.object({\n id: z.string(),\n client: z.object({\n id: z.string(),\n title: z.string(),\n scopes: z.array(z.string()),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n }),\n authorizationUrl: z.string(),\n});\n\nexport const MissingDeveloperConnectionNotificationPayloadSchema =\n CommonMissingConnectionNotificationPayloadSchema.extend({\n type: z.literal(\"DEVELOPER\"),\n });\n\nexport const MissingExternalConnectionNotificationPayloadSchema =\n CommonMissingConnectionNotificationPayloadSchema.extend({\n type: z.literal(\"EXTERNAL\"),\n account: z.object({\n id: z.string(),\n metadata: z.any(),\n }),\n });\n\nexport const MissingConnectionNotificationPayloadSchema = z.discriminatedUnion(\"type\", [\n MissingDeveloperConnectionNotificationPayloadSchema,\n MissingExternalConnectionNotificationPayloadSchema,\n]);\n\nexport type MissingConnectionNotificationPayload = z.infer<\n typeof MissingConnectionNotificationPayloadSchema\n>;\n\nexport const CommonMissingConnectionNotificationResolvedPayloadSchema = z.object({\n id: z.string(),\n client: z.object({\n id: z.string(),\n title: z.string(),\n scopes: z.array(z.string()),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n integrationIdentifier: z.string(),\n integrationAuthMethod: z.string(),\n }),\n expiresAt: z.coerce.date(),\n});\n\nexport const MissingDeveloperConnectionResolvedNotificationPayloadSchema =\n CommonMissingConnectionNotificationResolvedPayloadSchema.extend({\n type: z.literal(\"DEVELOPER\"),\n });\n\nexport const MissingExternalConnectionResolvedNotificationPayloadSchema =\n CommonMissingConnectionNotificationResolvedPayloadSchema.extend({\n type: z.literal(\"EXTERNAL\"),\n account: z.object({\n id: z.string(),\n metadata: z.any(),\n }),\n });\n\nexport const MissingConnectionResolvedNotificationPayloadSchema = z.discriminatedUnion(\"type\", [\n MissingDeveloperConnectionResolvedNotificationPayloadSchema,\n MissingExternalConnectionResolvedNotificationPayloadSchema,\n]);\n\nexport type MissingConnectionResolvedNotificationPayload = z.infer<\n typeof MissingConnectionResolvedNotificationPayloadSchema\n>;\n","import { z } from \"zod\";\nimport { RedactStringSchema, RetryOptionsSchema } from \"./api\";\n\nexport const FetchRetryHeadersStrategySchema = z.object({\n /** The `headers` strategy retries the request using info from the response headers. */\n strategy: z.literal(\"headers\"),\n /** The header to use to determine the maximum number of times to retry the request. */\n limitHeader: z.string(),\n /** The header to use to determine the number of remaining retries. */\n remainingHeader: z.string(),\n /** The header to use to determine the time when the number of remaining retries will be reset. */\n resetHeader: z.string(),\n});\n\nexport type FetchRetryHeadersStrategy = z.infer<typeof FetchRetryHeadersStrategySchema>;\n\n/** The `backoff` strategy retries the request with an exponential backoff. */\nexport const FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({\n /** The `backoff` strategy retries the request with an exponential backoff. */\n strategy: z.literal(\"backoff\"),\n});\n\n/** The `backoff` strategy retries the request with an exponential backoff. */\nexport type FetchRetryBackoffStrategy = z.infer<typeof FetchRetryBackoffStrategySchema>;\n\nexport const FetchRetryStrategySchema = z.discriminatedUnion(\"strategy\", [\n FetchRetryHeadersStrategySchema,\n FetchRetryBackoffStrategySchema,\n]);\n\nexport type FetchRetryStrategy = z.infer<typeof FetchRetryStrategySchema>;\n\n/** The options for a fetch request */\nexport const FetchRequestInitSchema = z.object({\n /** The HTTP method to use for the request. */\n method: z.string().optional(),\n /** 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. */\n headers: z.record(z.union([z.string(), RedactStringSchema])).optional(),\n /** The body of the request. */\n body: z.union([z.string(), z.instanceof(ArrayBuffer)]).optional(),\n});\n\n/** The options for a fetch request */\nexport type FetchRequestInit = z.infer<typeof FetchRequestInitSchema>;\n\nexport const FetchRetryOptionsSchema = z.record(FetchRetryStrategySchema);\n\n/** An object where the key is a status code pattern and the value is a retrying strategy. Supported patterns are:\n - Specific status codes: 429\n - Ranges: 500-599\n - Wildcards: 2xx, 3xx, 4xx, 5xx \n */\nexport type FetchRetryOptions = z.infer<typeof FetchRetryOptionsSchema>;\n\nexport const FetchOperationSchema = z.object({\n url: z.string(),\n requestInit: FetchRequestInitSchema.optional(),\n retry: z.record(FetchRetryStrategySchema).optional(),\n});\n\nexport type FetchOperation = z.infer<typeof FetchOperationSchema>;\n","import { z } from \"zod\";\nimport { RunStatusSchema } from \"./runs\";\n\nexport const GetEventSchema = z.object({\n /** The event id */\n id: z.string(),\n /** The event name */\n name: z.string(),\n /** When the event was created */\n createdAt: z.coerce.date(),\n /** When the event was last updated */\n updatedAt: z.coerce.date(),\n /** The runs that were triggered by the event */\n runs: z.array(\n z.object({\n /** The Run id */\n id: z.string(),\n /** The Run status */\n status: RunStatusSchema,\n /** When the run started */\n startedAt: z.coerce.date().optional().nullable(),\n /** When the run completed */\n completedAt: z.coerce.date().optional().nullable(),\n })\n ),\n});\n\nexport type GetEvent = z.infer<typeof GetEventSchema>;\n","// EventFilter is typed as type EventFilter = { [key: string]: EventFilter | string[] | number[] | boolean[] }\n\nimport { EventFilter } from \"./schemas\";\n\n// This function should take any number of EventFilters and return a new EventFilter that is the result of merging of them.\nexport function deepMergeFilters(...filters: EventFilter[]): EventFilter {\n const result: EventFilter = {};\n\n for (const filter of filters) {\n for (const key in filter) {\n if (filter.hasOwnProperty(key)) {\n const filterValue = filter[key];\n const existingValue = result[key];\n\n if (\n existingValue &&\n typeof existingValue === \"object\" &&\n typeof filterValue === \"object\" &&\n !Array.isArray(existingValue) &&\n !Array.isArray(filterValue) &&\n existingValue !== null &&\n filterValue !== null\n ) {\n result[key] = deepMergeFilters(existingValue, filterValue);\n } else {\n result[key] = filterValue;\n }\n }\n }\n }\n\n return result;\n}\n","import { RetryOptions } from \"./schemas\";\n\nconst DEFAULT_RETRY_OPTIONS = {\n limit: 5,\n factor: 1.8,\n minTimeoutInMs: 1000,\n maxTimeoutInMs: 60000,\n randomize: true,\n} satisfies RetryOptions;\n\nexport function calculateRetryAt(retryOptions: RetryOptions, attempts: number): Date | undefined {\n const options = {\n ...DEFAULT_RETRY_OPTIONS,\n ...retryOptions,\n };\n\n const retryCount = attempts + 1;\n\n if (retryCount >= options.limit) {\n return;\n }\n\n const random = options.randomize ? Math.random() + 1 : 1;\n\n let timeoutInMs = Math.round(\n random *\n Math.max(options.minTimeoutInMs, 1) *\n Math.pow(options.factor, Math.max(attempts - 1, 0))\n );\n\n timeoutInMs = Math.min(timeoutInMs, options.maxTimeoutInMs);\n\n return new Date(Date.now() + timeoutInMs);\n}\n","import { DeserializedJson } from \"./schemas\";\n\nexport interface ExampleReplacement {\n marker: string;\n replace(input: ExampleInputData): DeserializedJson;\n}\n\ntype ExampleInputData = {\n match: {\n key: string;\n value: string;\n };\n data: {\n now: Date;\n };\n};\n\nexport const currentDate: ExampleReplacement = {\n marker: \"__CURRENT_DATE__\",\n replace({ data: { now } }: ExampleInputData) {\n return now.toISOString();\n },\n};\n\nexport const currentTimestampMilliseconds: ExampleReplacement = {\n marker: \"__CURRENT_TIMESTAMP_MS__\",\n replace({ data: { now } }: ExampleInputData) {\n return now.getTime();\n },\n};\n\nexport const currentTimestampSeconds: ExampleReplacement = {\n marker: \"__CURRENT_TIMESTAMP_S__\",\n replace({ data: { now } }: ExampleInputData) {\n return now.getTime() / 1000;\n },\n};\n\nexport const replacements: ExampleReplacement[] = [\n currentDate,\n currentTimestampMilliseconds,\n currentTimestampSeconds,\n];\n","export function urlWithSearchParams(\n url: string,\n params: Record<string, string | number | boolean> | undefined\n) {\n if (!params) {\n return url;\n }\n\n const urlObj = new URL(url);\n for (const [key, value] of Object.entries(params)) {\n urlObj.searchParams.append(key, String(value));\n }\n return urlObj.toString();\n}\n","import { EventFilter } from \"./schemas/eventFilter\";\n\n// EventFilter is a recursive type, where the keys are strings and the values are an array of strings, numbers, booleans, or objects.\n// If the values of the array are strings, numbers, or booleans, than we are matching against the value of the payload.\n// If the values of the array are objects, then we are doing content filtering\n// An example would be [{ $endsWith: \".png\" }, { $startsWith: \"images/\" } ]\nexport function eventFilterMatches(payload: any, filter: EventFilter): boolean {\n for (const [patternKey, patternValue] of Object.entries(filter)) {\n const payloadValue = payload[patternKey];\n\n if (Array.isArray(patternValue)) {\n if (patternValue.length === 0) {\n continue;\n }\n\n // Check to see if all the items in the array are a string\n if ((patternValue as unknown[]).every((item) => typeof item === \"string\")) {\n if ((patternValue as string[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a number\n if ((patternValue as unknown[]).every((item) => typeof item === \"number\")) {\n if ((patternValue as number[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a boolean\n if ((patternValue as unknown[]).every((item) => typeof item === \"boolean\")) {\n if ((patternValue as boolean[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Now we know that all the items in the array are objects\n const objectArray = patternValue as Exclude<\n typeof patternValue,\n number[] | string[] | boolean[]\n >;\n\n if (!contentFiltersMatches(payloadValue, objectArray)) {\n return false;\n }\n\n continue;\n } else if (typeof patternValue === \"object\") {\n if (Array.isArray(payloadValue)) {\n if (!payloadValue.some((item) => eventFilterMatches(item, patternValue))) {\n return false;\n }\n } else {\n if (!eventFilterMatches(payloadValue, patternValue)) {\n return false;\n }\n }\n }\n }\n return true;\n}\n\ntype ContentFilters = Exclude<EventFilter[string], EventFilter | string[] | number[] | boolean[]>;\n\nfunction contentFiltersMatches(actualValue: any, contentFilters: ContentFilters): boolean {\n for (const contentFilter of contentFilters) {\n if (typeof contentFilter === \"object\") {\n const [key, value] = Object.entries(contentFilter)[0];\n\n if (!contentFilterMatches(actualValue, contentFilter)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction contentFilterMatches(actualValue: any, contentFilter: ContentFilters[number]): boolean {\n if (\"$endsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.endsWith(contentFilter.$endsWith);\n }\n\n if (\"$startsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.startsWith(contentFilter.$startsWith);\n }\n\n if (\"$anythingBut\" in contentFilter) {\n if (Array.isArray(contentFilter.$anythingBut)) {\n if ((contentFilter.$anythingBut as any[]).includes(actualValue)) {\n return false;\n }\n }\n\n if (contentFilter.$anythingBut === actualValue) {\n return false;\n }\n\n return true;\n }\n\n if (\"$exists\" in contentFilter) {\n if (contentFilter.$exists) {\n return actualValue !== undefined;\n }\n\n return actualValue === undefined;\n }\n\n if (\"$gt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue > contentFilter.$gt;\n }\n\n if (\"$lt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue < contentFilter.$lt;\n }\n\n if (\"$gte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$gte;\n }\n\n if (\"$lte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue <= contentFilter.$lte;\n }\n\n if (\"$between\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$between[0] && actualValue <= contentFilter.$between[1];\n }\n\n if (\"$includes\" in contentFilter) {\n if (Array.isArray(actualValue)) {\n return actualValue.includes(contentFilter.$includes);\n }\n\n return false;\n }\n\n // Use localCompare\n if (\"$ignoreCaseEquals\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return (\n actualValue.localeCompare(contentFilter.$ignoreCaseEquals, undefined, {\n sensitivity: \"accent\",\n }) === 0\n );\n }\n\n if (\"$isNull\" in contentFilter) {\n if (contentFilter.$isNull) {\n return actualValue === null;\n }\n\n return actualValue !== null;\n }\n\n return true;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACYA,IAAMA,YAA6B;EAAC;EAAO;EAAS;EAAQ;EAAQ;;AAZpE;AAcO,IAAMC,UAAN,MAAMA,QAAAA;EAMXC,YACEC,MACAC,QAAkB,QAClBC,eAAyB,CAAA,GACzBC,cACA;AA+CF;AAzDA;AACS;AACT,sCAA0B,CAAA;AAC1B;AAQE,uBAAK,OAAQH;AACb,uBAAK,QAASH,UAAUO,QAASC,QAAQC,IAAIC,qBAAqBN,KAAAA;AAClE,uBAAK,eAAgBC;AACrB,uBAAK,eAAgBC;EACvB;;;EAIAK,UAAUC,MAAgB;AACxB,WAAO,IAAIX,QAAO,mBAAK,QAAOD,UAAU,mBAAK,OAAM,GAAGY,MAAM,mBAAK,cAAa;EAChF;EAEA,OAAOC,kBAAkBC,UAAoBC,UAAoB;AAC/D,WAAOf,UAAUO,QAAQO,QAAAA,KAAad,UAAUO,QAAQQ,QAAAA;EAC1D;EAEAC,IAAIC,YAAoBC,MAAkD;AACxE,QAAI,mBAAK,UAAS;AAAG;AAErB,0BAAK,kCAAL,WAAoBC,QAAQH,KAAKC,SAAAA,GAAYC;EAC/C;EAEAE,MAAMH,YAAoBC,MAAkD;AAC1E,QAAI,mBAAK,UAAS;AAAG;AAErB,0BAAK,kCAAL,WAAoBC,QAAQC,OAAOH,SAAAA,GAAYC;EAC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aAAO;IACT;AAEA,WAAOA,cAAcE,cAAcW;EACrC;AAEA,MAAI,SAASX,eAAe;AAC1B,QAAI,OAAOF,gBAAgB,UAAU;AACnC,aAAO;IACT;AAEA,WAAOA,cAAcE,cAAcY;EACrC;AAEA,MAAI,UAAUZ,eAAe;AAC3B,QAAI,OAAOF,gBAAgB,UAAU;AACnC,aAAO;IACT;AAEA,WAAOA,eAAeE,cAAca;EACtC;AAEA,MAAI,UAAUb,eAAe;AAC3B,QAAI,OAAOF,gBAAgB,UAAU;AACnC,aAAO;IACT;AAEA,WAAOA,eAAeE,cAAcc;EACtC;AAEA,MAAI,cAAcd,eAAe;AAC/B,QAAI,OAAOF,gBAAgB,UAAU;AACnC,aAAO;IACT;AAEA,WAAOA,eAAeE,cAAce,SAAS,CAAA,KAAMjB,eAAeE,cAAce,SAAS,CAAA;EAC3F;AAEA,MAAI,eAAef,eAAe;AAChC,QAAIX,MAAMC,QAAQQ,WAAAA,GAAc;AAC9B,aAAOA,YAAYJ,SAASM,cAAcgB,SAAS;IACrD;AAEA,WAAO;EACT;AAGA,MAAI,uBAAuBhB,eAAe;AACxC,QAAI,OAAOF,gBAAgB,UAAU;AACnC,aAAO;IACT;AAEA,WACEA,YAAYmB,cAAcjB,cAAckB,mBAAmBR,QAAW;MACpES,aAAa;IACf,CAAA,MAAO;EAEX;AAEA,MAAI,aAAanB,eAAe;AAC9B,QAAIA,cAAcoB,SAAS;AACzB,aAAOtB,gBAAgB;IACzB;AAEA,WAAOA,gBAAgB;EACzB;AAEA,SAAO;AACT;AA7GSK;","names":["logLevels","Logger","constructor","name","level","filteredKeys","jsonReplacer","indexOf","process","env","TRIGGER_LOG_LEVEL","filter","keys","satisfiesLogLevel","logLevel","setLevel","log","message","args","console","error","warn","info","debug","loggerFunction","structuredLog","structureArgs","safeJsonClone","timestamp","Date","JSON","stringify","createReplacer","replacer","key","value","toString","bigIntReplacer","_key","obj","parse","e","structureArgs","args","filteredKeys","length","filterKeys","JSON","parse","stringify","bigIntReplacer","obj","keys","Array","isArray","map","item","filteredObj","key","value","Object","entries","includes","prettyPrintBytes","process","env","NODE_ENV","sizeInBytes","Buffer","byteLength","toFixed","import_zod","addMissingVersionField","val","version","ErrorWithStackSchema","z","object","message","string","name","optional","stack","SchemaErrorSchema","path","array","import_zod","EventMatcherSchema","z","union","array","string","number","boolean","object","$endsWith","$startsWith","$exists","$isNull","$anythingBut","$gt","$lt","$gte","$lte","$between","tuple","$includes","$ignoreCaseEquals","EventFilterSchema","lazy","record","EventRuleSchema","event","or","source","payload","optional","context","import_zod","ConnectionAuthSchema","z","object","type","enum","accessToken","string","scopes","array","optional","additionalFields","record","IntegrationMetadataSchema","id","name","instructions","IntegrationConfigSchema","metadata","authSource","import_zod","LiteralSchema","z","union","string","number","boolean","null","DeserializedJsonSchema","lazy","array","record","SerializableSchema","date","undefined","symbol","SerializableJsonSchema","import_zod","DisplayPropertySchema","z","object","label","string","text","url","optional","DisplayPropertiesSchema","array","StyleSchema","style","enum","variant","import_zod","SCHEDULED_EVENT","ScheduledPayloadSchema","z","object","ts","coerce","date","lastTimestamp","optional","IntervalOptionsSchema","seconds","number","int","positive","min","max","CronOptionsSchema","cron","string","CronMetadataSchema","type","literal","options","accountId","metadata","any","IntervalMetadataSchema","ScheduleMetadataSchema","discriminatedUnion","RegisterDynamicSchedulePayloadSchema","id","jobs","array","version","import_zod","TaskStatusSchema","z","enum","TaskSchema","object","id","string","name","icon","optional","nullable","noop","boolean","startedAt","coerce","date","completedAt","delayUntil","status","description","properties","array","DisplayPropertySchema","outputProperties","params","DeserializedJsonSchema","output","error","parentId","style","StyleSchema","operation","ServerTaskSchema","extend","idempotencyKey","attempts","number","CachedTaskSchema","default","import_zod","EventExampleSchema","z","object","id","string","icon","optional","name","payload","any","EventSpecificationSchema","or","array","title","source","filter","EventFilterSchema","properties","DisplayPropertySchema","schema","examples","DynamicTriggerMetadataSchema","type","literal","StaticTriggerMetadataSchema","union","rule","EventRuleSchema","ScheduledTriggerMetadataSchema","schedule","ScheduleMetadataSchema","TriggerMetadataSchema","discriminatedUnion","import_zod","import_zod","StatusUpdateStateSchema","z","union","literal","StatusUpdateDataSchema","record","SerializableJsonSchema","StatusUpdateSchema","object","label","string","optional","state","data","InitalStatusUpdateSchema","required","StatusHistorySchema","array","JobRunStatusRecordSchema","extend","key","history","RunStatusSchema","z","union","literal","RunTaskSchema","object","id","string","displayKey","nullable","status","TaskStatusSchema","name","icon","startedAt","coerce","date","completedAt","RunTaskWithSubtasksSchema","extend","subtasks","lazy","array","optional","GetRunOptionsSchema","boolean","cursor","take","number","GetRunOptionsWithTaskDetailsSchema","taskdetails","RunSchema","updatedAt","GetRunSchema","output","any","tasks","statuses","JobRunStatusRecordSchema","default","nextCursor","GetRunsOptionsSchema","GetRunsSchema","runs","UpdateTriggerSourceBodyV1Schema","z","object","registeredEvents","array","string","secret","optional","data","SerializableJsonSchema","UpdateTriggerSourceBodyV2Schema","options","event","and","record","RegisterHTTPTriggerSourceBodySchema","type","literal","url","RegisterSMTPTriggerSourceBodySchema","RegisterSQSTriggerSourceBodySchema","RegisterSourceChannelBodySchema","discriminatedUnion","REGISTER_SOURCE_EVENT_V1","REGISTER_SOURCE_EVENT_V2","RegisterTriggerSourceSchema","key","params","any","active","boolean","DeserializedJsonSchema","channel","clientId","SourceEventOptionSchema","name","value","RegisterSourceEventSchemaV1","id","source","events","missingEvents","orphanedEvents","dynamicTriggerId","RegisteredOptionsDiffSchema","desired","missing","orphaned","RegisterSourceEventOptionsSchema","RegisterSourceEventSchemaV2","TriggerSourceSchema","HttpSourceResponseMetadataSchema","HandleTriggerSourceSchema","auth","ConnectionAuthSchema","metadata","HttpSourceRequestSchema","method","headers","rawBody","instanceof","Buffer","nullable","HttpSourceRequestHeadersSchema","transform","s","JSON","parse","undefined","json","PongSuccessResponseSchema","ok","PongErrorResponseSchema","error","PongResponseSchema","ValidateSuccessResponseSchema","endpointId","ValidateErrorResponseSchema","ValidateResponseSchema","QueueOptionsSchema","maxConcurrent","number","JobMetadataSchema","version","EventSpecificationSchema","trigger","TriggerMetadataSchema","integrations","IntegrationConfigSchema","internal","default","enabled","startPosition","enum","preprocessRuns","SourceMetadataV1Schema","integration","registerSourceJob","SourceMetadataV2Schema","SourceMetadataSchema","preprocess","addMissingVersionField","DynamicTriggerEndpointMetadataSchema","jobs","pick","IndexEndpointResponseSchema","sources","dynamicTriggers","dynamicSchedules","RegisterDynamicSchedulePayloadSchema","RawEventSchema","payload","context","ulid","timestamp","coerce","date","ApiEventLogSchema","deliverAt","deliveredAt","cancelledAt","SendEventOptionsSchema","deliverAfter","int","accountId","SendEventBodySchema","DeliverEventResponseSchema","datetime","RuntimeEnvironmentTypeSchema","RunSourceContextSchema","RunJobBodySchema","job","run","isTest","isRetry","startedAt","environment","slug","organization","title","account","tasks","CachedTaskSchema","connections","RunJobErrorSchema","status","ErrorWithStackSchema","task","TaskSchema","RunJobInvalidPayloadErrorSchema","errors","SchemaErrorSchema","RunJobUnresolvedAuthErrorSchema","issues","RunJobResumeWithTaskSchema","RunJobRetryWithTaskSchema","retryAt","RunJobCanceledWithTaskSchema","RunJobSuccessSchema","output","RunJobResponseSchema","PreprocessRunBodySchema","PreprocessRunResponseSchema","abort","properties","DisplayPropertySchema","CreateRunResponseOkSchema","CreateRunResponseErrorSchema","CreateRunResponseBodySchema","RedactStringSchema","__redactedString","strings","interpolations","LogMessageSchema","level","message","RedactSchema","paths","RetryOptionsSchema","limit","factor","minTimeoutInMs","maxTimeoutInMs","randomize","RunTaskOptionsSchema","delayUntil","retry","icon","displayKey","description","style","StyleSchema","connectionKey","operation","noop","redact","RunTaskBodyInputSchema","extend","idempotencyKey","parentId","RunTaskBodyOutputSchema","CompleteTaskBodyInputSchema","v","stringify","FailTaskBodyInputSchema","NormalizedRequestSchema","query","body","NormalizedResponseSchema","HttpSourceResponseSchema","response","RegisterTriggerBodySchemaV1","rule","EventRuleSchema","RegisterTriggerBodySchemaV2","InitializeTriggerBodySchema","RegisterCommonScheduleBodySchema","RegisterIntervalScheduleBodySchema","merge","IntervalMetadataSchema","InitializeCronScheduleBodySchema","CronMetadataSchema","RegisterScheduleBodySchema","RegisterScheduleResponseBodySchema","schedule","ScheduleMetadataSchema","CreateExternalConnectionBodySchema","accessToken","scopes","GetRunStatusesSchema","RunStatusSchema","statuses","JobRunStatusRecordSchema","import_zod","MISSING_CONNECTION_NOTIFICATION","MISSING_CONNECTION_RESOLVED_NOTIFICATION","CommonMissingConnectionNotificationPayloadSchema","z","object","id","string","client","title","scopes","array","createdAt","coerce","date","updatedAt","authorizationUrl","MissingDeveloperConnectionNotificationPayloadSchema","extend","type","literal","MissingExternalConnectionNotificationPayloadSchema","account","metadata","any","MissingConnectionNotificationPayloadSchema","discriminatedUnion","CommonMissingConnectionNotificationResolvedPayloadSchema","integrationIdentifier","integrationAuthMethod","expiresAt","MissingDeveloperConnectionResolvedNotificationPayloadSchema","MissingExternalConnectionResolvedNotificationPayloadSchema","MissingConnectionResolvedNotificationPayloadSchema","import_zod","FetchRetryHeadersStrategySchema","z","object","strategy","literal","limitHeader","string","remainingHeader","resetHeader","FetchRetryBackoffStrategySchema","RetryOptionsSchema","extend","FetchRetryStrategySchema","discriminatedUnion","FetchRequestInitSchema","method","optional","headers","record","union","RedactStringSchema","body","instanceof","ArrayBuffer","FetchRetryOptionsSchema","FetchOperationSchema","url","requestInit","retry","import_zod","GetEventSchema","z","object","id","string","name","createdAt","coerce","date","updatedAt","runs","array","status","RunStatusSchema","startedAt","optional","nullable","completedAt","deepMergeFilters","filters","result","filter","key","hasOwnProperty","filterValue","existingValue","Array","isArray","DEFAULT_RETRY_OPTIONS","limit","factor","minTimeoutInMs","maxTimeoutInMs","randomize","calculateRetryAt","retryOptions","attempts","options","retryCount","random","Math","timeoutInMs","round","max","pow","min","Date","now","currentDate","marker","replace","data","now","toISOString","currentTimestampMilliseconds","getTime","currentTimestampSeconds","replacements","urlWithSearchParams","url","params","urlObj","URL","key","value","Object","entries","searchParams","append","String","toString","eventFilterMatches","payload","filter","patternKey","patternValue","Object","entries","payloadValue","Array","isArray","length","every","item","includes","objectArray","contentFiltersMatches","some","actualValue","contentFilters","contentFilter","key","value","contentFilterMatches","endsWith","$endsWith","startsWith","$startsWith","$anythingBut","$exists","undefined","$gt","$lt","$gte","$lte","$between","$includes","localeCompare","$ignoreCaseEquals","sensitivity","$isNull"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trigger.dev/core",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Core code used across the Trigger.dev SDK and platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",