@trigger.dev/core 2.2.6 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { z } from 'zod';
11
11
  type LogLevel = "log" | "error" | "warn" | "info" | "debug";
12
12
  declare class Logger {
13
13
  #private;
14
- constructor(name: string, level?: LogLevel, filteredKeys?: string[], jsonReplacer?: (key: string, value: unknown) => unknown);
14
+ constructor(name: string, level?: LogLevel, filteredKeys?: string[], jsonReplacer?: (key: string, value: unknown) => unknown, additionalFields?: () => Record<string, unknown>);
15
15
  filter(...keys: string[]): Logger;
16
16
  static satisfiesLogLevel(logLevel: LogLevel, setLevel: LogLevel): boolean;
17
17
  log(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
@@ -4373,6 +4373,44 @@ declare const EndpointHeadersSchema: z.ZodObject<{
4373
4373
  "trigger-version"?: string | undefined;
4374
4374
  "trigger-sdk-version"?: string | undefined;
4375
4375
  }>;
4376
+ declare const ExecuteJobRunMetadataSchema: z.ZodObject<{
4377
+ successSubscription: z.ZodOptional<z.ZodBoolean>;
4378
+ failedSubscription: z.ZodOptional<z.ZodBoolean>;
4379
+ }, "strip", z.ZodTypeAny, {
4380
+ successSubscription?: boolean | undefined;
4381
+ failedSubscription?: boolean | undefined;
4382
+ }, {
4383
+ successSubscription?: boolean | undefined;
4384
+ failedSubscription?: boolean | undefined;
4385
+ }>;
4386
+ declare const ExecuteJobHeadersSchema: z.ZodObject<{
4387
+ "trigger-version": z.ZodOptional<z.ZodString>;
4388
+ "trigger-sdk-version": z.ZodOptional<z.ZodString>;
4389
+ "x-trigger-run-metadata": z.ZodOptional<z.ZodEffects<z.ZodObject<{
4390
+ successSubscription: z.ZodOptional<z.ZodBoolean>;
4391
+ failedSubscription: z.ZodOptional<z.ZodBoolean>;
4392
+ }, "strip", z.ZodTypeAny, {
4393
+ successSubscription?: boolean | undefined;
4394
+ failedSubscription?: boolean | undefined;
4395
+ }, {
4396
+ successSubscription?: boolean | undefined;
4397
+ failedSubscription?: boolean | undefined;
4398
+ }>, {
4399
+ successSubscription?: boolean | undefined;
4400
+ failedSubscription?: boolean | undefined;
4401
+ }, unknown>>;
4402
+ }, "strip", z.ZodTypeAny, {
4403
+ "trigger-version"?: string | undefined;
4404
+ "trigger-sdk-version"?: string | undefined;
4405
+ "x-trigger-run-metadata"?: {
4406
+ successSubscription?: boolean | undefined;
4407
+ failedSubscription?: boolean | undefined;
4408
+ } | undefined;
4409
+ }, {
4410
+ "trigger-version"?: string | undefined;
4411
+ "trigger-sdk-version"?: string | undefined;
4412
+ "x-trigger-run-metadata"?: unknown;
4413
+ }>;
4376
4414
  declare const RawEventSchema: z.ZodObject<{
4377
4415
  /** The `name` property must exactly match any subscriptions you want to
4378
4416
  trigger. */
@@ -16987,7 +17025,36 @@ declare const GetRunsSchema: z.ZodObject<{
16987
17025
  }[];
16988
17026
  nextCursor?: string | undefined;
16989
17027
  }>;
16990
- type RunNotificationCommon = {
17028
+ type RunNotificationJobMetadata = {
17029
+ id: string;
17030
+ version: string;
17031
+ };
17032
+ type RunNotificationEnvMetadata = {
17033
+ slug: string;
17034
+ id: string;
17035
+ type: RuntimeEnvironmentType;
17036
+ };
17037
+ type RunNotificationOrgMetadata = {
17038
+ slug: string;
17039
+ id: string;
17040
+ title: string;
17041
+ };
17042
+ type RunNotificationProjectMetadata = {
17043
+ slug: string;
17044
+ id: string;
17045
+ name: string;
17046
+ };
17047
+ type RunNotificationAccountMetadata = {
17048
+ id: string;
17049
+ metadata?: any;
17050
+ };
17051
+ type RunNotificationInvocationMetadata<T = any> = {
17052
+ id: string;
17053
+ context: any;
17054
+ timestamp: Date;
17055
+ payload: T;
17056
+ };
17057
+ type RunNotificationRunMetadata = {
16991
17058
  /** The Run id */
16992
17059
  id: string;
16993
17060
  /** The Run status */
@@ -16998,58 +17065,65 @@ type RunNotificationCommon = {
16998
17065
  updatedAt: Date;
16999
17066
  /** When the run was completed */
17000
17067
  completedAt: Date;
17068
+ /** If the run was a test or not */
17069
+ isTest: boolean;
17070
+ executionDurationInMs: number;
17071
+ executionCount: number;
17072
+ };
17073
+ type RunNotificationCommon<TPayload = any> = {
17074
+ /** The Run id */
17075
+ id: string;
17076
+ /** The Run status */
17077
+ statuses: JobRunStatusRecord[];
17078
+ /** When the run started */
17079
+ startedAt: Date;
17080
+ /** When the run was last updated */
17081
+ updatedAt: Date;
17082
+ /** When the run was completed */
17083
+ completedAt: Date;
17084
+ /** If the run was a test or not */
17085
+ isTest: boolean;
17001
17086
  executionDurationInMs: number;
17002
17087
  executionCount: number;
17003
17088
  /** Job metadata */
17004
- job: {
17005
- id: string;
17006
- version: string;
17007
- };
17089
+ job: RunNotificationJobMetadata;
17008
17090
  /** Environment metadata */
17009
- environment: {
17010
- slug: string;
17011
- id: string;
17012
- type: RuntimeEnvironmentType;
17013
- };
17091
+ environment: RunNotificationEnvMetadata;
17014
17092
  /** Organization metadata */
17015
- organization: {
17016
- slug: string;
17017
- id: string;
17018
- title: string;
17019
- };
17093
+ organization: RunNotificationOrgMetadata;
17020
17094
  /** Project metadata */
17021
- project: {
17022
- slug: string;
17023
- id: string;
17024
- name: string;
17025
- };
17095
+ project: RunNotificationProjectMetadata;
17026
17096
  /** Account metadata */
17027
- account?: {
17028
- id: string;
17029
- metadata?: any;
17030
- };
17097
+ account?: RunNotificationAccountMetadata;
17031
17098
  /** Invocation metadata */
17032
- invocation: {
17033
- id: string;
17034
- context: any;
17035
- timestamp: Date;
17036
- };
17099
+ invocation: RunNotificationInvocationMetadata<TPayload>;
17037
17100
  };
17038
- type SuccessfulRunNotification<TOutput> = RunNotificationCommon & {
17101
+ type SuccessfulRunNotification<TOutput, TPayload = any> = RunNotificationCommon<TPayload> & {
17039
17102
  ok: true;
17040
17103
  /** The Run status */
17041
17104
  status: "SUCCESS";
17042
17105
  /** The output of the run */
17043
17106
  output: TOutput;
17044
17107
  };
17045
- type FailedRunNotification = RunNotificationCommon & {
17108
+ type FailedRunNotification<TPayload = any> = RunNotificationCommon<TPayload> & {
17046
17109
  ok: false;
17047
17110
  /** The Run status */
17048
17111
  status: "FAILURE" | "TIMED_OUT" | "ABORTED" | "CANCELED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
17049
17112
  /** The error of the run */
17050
17113
  error: any;
17114
+ /** The task that failed */
17115
+ task?: {
17116
+ id: string;
17117
+ cacheKey: string | null;
17118
+ status: string;
17119
+ name: string;
17120
+ icon: string | null;
17121
+ startedAt: string;
17122
+ error: ErrorWithStack;
17123
+ params: any | null;
17124
+ };
17051
17125
  };
17052
- type RunNotification<TOutput> = SuccessfulRunNotification<TOutput> | FailedRunNotification;
17126
+ type RunNotification<TOutput, TPayload = any> = SuccessfulRunNotification<TOutput, TPayload> | FailedRunNotification<TPayload>;
17053
17127
 
17054
17128
  declare function addMissingVersionField(val: unknown): unknown;
17055
17129
 
@@ -17114,4 +17188,4 @@ declare const PLATFORM_FEATURES: {
17114
17188
  };
17115
17189
  declare function supportsFeature<TFeatureName extends keyof typeof PLATFORM_FEATURES>(featureName: TFeatureName, version: string): boolean;
17116
17190
 
17117
- export { API_VERSIONS, ApiEventLog, ApiEventLogSchema, AutoYieldConfig, AutoYieldConfigSchema, AutoYieldMetadata, AutoYieldMetadataSchema, CachedTask, CachedTaskSchema, CancelRunsForEvent, CancelRunsForEventSchema, ClientTask, CommonMissingConnectionNotificationPayloadSchema, CommonMissingConnectionNotificationResolvedPayloadSchema, CompleteTaskBodyInput, CompleteTaskBodyInputSchema, CompleteTaskBodyOutput, CompleteTaskBodyV2Input, CompleteTaskBodyV2InputSchema, ConnectionAuth, ConnectionAuthSchema, CreateExternalConnectionBody, CreateExternalConnectionBodySchema, CreateRunResponseBody, CreateRunResponseBodySchema, CronMetadata, CronMetadataSchema, CronOptions, CronOptionsSchema, DeliverEventResponse, DeliverEventResponseSchema, DeserializedJson, DeserializedJsonSchema, DisplayPropertiesSchema, DisplayProperty, DisplayPropertySchema, DynamicTriggerEndpointMetadata, DynamicTriggerEndpointMetadataSchema, DynamicTriggerMetadataSchema, EndpointHeadersSchema, EndpointIndexError, EndpointIndexErrorSchema, EphemeralEventDispatcherRequestBody, EphemeralEventDispatcherRequestBodySchema, EphemeralEventDispatcherResponseBody, EphemeralEventDispatcherResponseBodySchema, ErrorWithStack, ErrorWithStackSchema, EventExample, EventExampleSchema, EventFilter, EventFilterSchema, EventRule, EventRuleSchema, EventSpecificationSchema, ExampleReplacement, FailTaskBodyInput, FailTaskBodyInputSchema, FailedRunNotification, FetchOperation, FetchOperationSchema, FetchPollOperation, FetchPollOperationSchema, FetchRequestInit, FetchRequestInitSchema, FetchRetryBackoffStrategy, FetchRetryBackoffStrategySchema, FetchRetryHeadersStrategy, FetchRetryHeadersStrategySchema, FetchRetryOptions, FetchRetryOptionsSchema, FetchRetryStrategy, FetchRetryStrategySchema, FetchTimeoutOptions, FetchTimeoutOptionsSchema, GetEndpointIndexResponse, GetEndpointIndexResponseSchema, GetEvent, GetEventSchema, GetRun, GetRunOptions, GetRunOptionsWithTaskDetails, GetRunSchema, GetRunStatuses, GetRunStatusesSchema, GetRunsOptions, GetRunsSchema, HTTPMethodUnionSchema, HandleTriggerSource, HandleTriggerSourceSchema, HttpEndpointMetadata, HttpEndpointRequestHeadersSchema, HttpMethod, HttpSourceRequestHeaders, HttpSourceRequestHeadersSchema, HttpSourceResponseMetadata, HttpSourceResponseSchema, IndexEndpointResponse, IndexEndpointResponseSchema, IndexEndpointStats, InitialStatusUpdate, InitializeCronScheduleBodySchema, InitializeTriggerBody, InitializeTriggerBodySchema, IntegrationConfig, IntegrationConfigSchema, IntegrationMetadata, IntegrationMetadataSchema, IntervalMetadata, IntervalMetadataSchema, IntervalOptions, IntervalOptionsSchema, InvokeJobRequestBody, InvokeJobRequestBodySchema, InvokeJobResponseSchema, InvokeOptions, InvokeOptionsSchema, InvokeTriggerMetadataSchema, JobMetadata, JobMetadataSchema, JobRunStatusRecord, JobRunStatusRecordSchema, LogLevel, LogMessage, LogMessageSchema, Logger, MISSING_CONNECTION_NOTIFICATION, MISSING_CONNECTION_RESOLVED_NOTIFICATION, MissingConnectionNotificationPayload, MissingConnectionNotificationPayloadSchema, MissingConnectionResolvedNotificationPayload, MissingConnectionResolvedNotificationPayloadSchema, MissingDeveloperConnectionNotificationPayloadSchema, MissingDeveloperConnectionResolvedNotificationPayloadSchema, MissingExternalConnectionNotificationPayloadSchema, MissingExternalConnectionResolvedNotificationPayloadSchema, NormalizedRequest, NormalizedRequestSchema, NormalizedResponse, NormalizedResponseSchema, OverridableRunTaskOptions, PLATFORM_FEATURES, PongErrorResponseSchema, PongResponse, PongResponseSchema, PongSuccessResponseSchema, PreprocessRunBody, PreprocessRunBodySchema, PreprocessRunResponse, PreprocessRunResponseSchema, Prettify, QueueOptions, QueueOptionsSchema, REGISTER_SOURCE_EVENT_V1, REGISTER_SOURCE_EVENT_V2, RawEvent, RawEventSchema, RedactSchema, RedactString, RedactStringSchema, RegisterCronScheduleBody, RegisterDynamicSchedulePayload, RegisterDynamicSchedulePayloadSchema, RegisterHTTPTriggerSourceBodySchema, RegisterIntervalScheduleBody, RegisterIntervalScheduleBodySchema, RegisterSMTPTriggerSourceBodySchema, RegisterSQSTriggerSourceBodySchema, RegisterScheduleBody, RegisterScheduleBodySchema, RegisterScheduleResponseBody, RegisterScheduleResponseBodySchema, RegisterSourceChannelBodySchema, RegisterSourceEventOptions, RegisterSourceEventSchemaV1, RegisterSourceEventSchemaV2, RegisterSourceEventV1, RegisterSourceEventV2, RegisterTriggerBodySchemaV1, RegisterTriggerBodySchemaV2, RegisterTriggerBodyV1, RegisterTriggerBodyV2, RegisterTriggerSource, RegisterTriggerSourceSchema, RegisteredOptionsDiff, RequestFilter, RequestFilterSchema, RequestWithRawBodySchema, ResponseFilter, ResponseFilterMatchResult, ResponseFilterSchema, RetryOptions, RetryOptionsSchema, RunJobAutoYieldExecutionError, RunJobAutoYieldExecutionErrorSchema, RunJobAutoYieldWithCompletedTaskExecutionError, RunJobAutoYieldWithCompletedTaskExecutionErrorSchema, RunJobBody, RunJobBodySchema, RunJobCanceledWithTask, RunJobCanceledWithTaskSchema, RunJobError, RunJobErrorResponse, RunJobErrorResponseSchema, RunJobErrorSchema, RunJobInvalidPayloadError, RunJobInvalidPayloadErrorSchema, RunJobResponse, RunJobResponseSchema, RunJobResumeWithParallelTask, RunJobResumeWithParallelTaskSchema, RunJobResumeWithTask, RunJobResumeWithTaskSchema, RunJobRetryWithTask, RunJobRetryWithTaskSchema, RunJobSuccess, RunJobSuccessSchema, RunJobUnresolvedAuthError, RunJobUnresolvedAuthErrorSchema, RunJobYieldExecutionError, RunJobYieldExecutionErrorSchema, RunNotification, RunSourceContext, RunSourceContextSchema, RunStatusSchema, RunTaskBodyInput, RunTaskBodyInputSchema, RunTaskBodyOutput, RunTaskBodyOutputSchema, RunTaskOptions, RunTaskOptionsSchema, RunTaskResponseWithCachedTasksBody, RunTaskResponseWithCachedTasksBodySchema, RunTaskSchema, RunTaskWithSubtasks, RuntimeEnvironmentType, RuntimeEnvironmentTypeSchema, SCHEDULED_EVENT, ScheduleMetadata, ScheduleMetadataSchema, ScheduledPayload, ScheduledPayloadSchema, ScheduledTriggerMetadataSchema, SchemaError, SchemaErrorSchema, SendBulkEventsBodySchema, SendEvent, SendEventBody, SendEventBodySchema, SendEventOptions, SendEventOptionsSchema, SerializableJson, SerializableJsonSchema, ServerTask, ServerTaskSchema, SourceEventOption, SourceMetadataV1, SourceMetadataV2, SourceMetadataV2Schema, StaticTriggerMetadataSchema, StatusHistory, StatusHistorySchema, StatusUpdate, StatusUpdateData, StatusUpdateSchema, StatusUpdateState, StatusUpdateStateSchema, StringMatch, Style, StyleName, StyleSchema, SuccessfulRunNotification, TaskSchema, TaskStatus, TaskStatusSchema, TriggerHelpSchema, TriggerMetadata, TriggerMetadataSchema, TriggerSource, TriggerSourceSchema, UpdateTriggerSourceBodyV1, UpdateTriggerSourceBodyV1Schema, UpdateTriggerSourceBodyV2, UpdateTriggerSourceBodyV2Schema, ValidateErrorResponseSchema, ValidateResponse, ValidateResponseSchema, ValidateSuccessResponseSchema, addMissingVersionField, calculateResetAt, calculateRetryAt, currentDate, currentTimestampMilliseconds, currentTimestampSeconds, deepMergeFilters, eventFilterMatches, parseEndpointIndexStats, replacements, requestFilterMatches, responseFilterMatches, stringPatternMatchers, supportsFeature, urlWithSearchParams };
17191
+ export { API_VERSIONS, ApiEventLog, ApiEventLogSchema, AutoYieldConfig, AutoYieldConfigSchema, AutoYieldMetadata, AutoYieldMetadataSchema, CachedTask, CachedTaskSchema, CancelRunsForEvent, CancelRunsForEventSchema, ClientTask, CommonMissingConnectionNotificationPayloadSchema, CommonMissingConnectionNotificationResolvedPayloadSchema, CompleteTaskBodyInput, CompleteTaskBodyInputSchema, CompleteTaskBodyOutput, CompleteTaskBodyV2Input, CompleteTaskBodyV2InputSchema, ConnectionAuth, ConnectionAuthSchema, CreateExternalConnectionBody, CreateExternalConnectionBodySchema, CreateRunResponseBody, CreateRunResponseBodySchema, CronMetadata, CronMetadataSchema, CronOptions, CronOptionsSchema, DeliverEventResponse, DeliverEventResponseSchema, DeserializedJson, DeserializedJsonSchema, DisplayPropertiesSchema, DisplayProperty, DisplayPropertySchema, DynamicTriggerEndpointMetadata, DynamicTriggerEndpointMetadataSchema, DynamicTriggerMetadataSchema, EndpointHeadersSchema, EndpointIndexError, EndpointIndexErrorSchema, EphemeralEventDispatcherRequestBody, EphemeralEventDispatcherRequestBodySchema, EphemeralEventDispatcherResponseBody, EphemeralEventDispatcherResponseBodySchema, ErrorWithStack, ErrorWithStackSchema, EventExample, EventExampleSchema, EventFilter, EventFilterSchema, EventRule, EventRuleSchema, EventSpecificationSchema, ExampleReplacement, ExecuteJobHeadersSchema, ExecuteJobRunMetadataSchema, FailTaskBodyInput, FailTaskBodyInputSchema, FailedRunNotification, FetchOperation, FetchOperationSchema, FetchPollOperation, FetchPollOperationSchema, FetchRequestInit, FetchRequestInitSchema, FetchRetryBackoffStrategy, FetchRetryBackoffStrategySchema, FetchRetryHeadersStrategy, FetchRetryHeadersStrategySchema, FetchRetryOptions, FetchRetryOptionsSchema, FetchRetryStrategy, FetchRetryStrategySchema, FetchTimeoutOptions, FetchTimeoutOptionsSchema, GetEndpointIndexResponse, GetEndpointIndexResponseSchema, GetEvent, GetEventSchema, GetRun, GetRunOptions, GetRunOptionsWithTaskDetails, GetRunSchema, GetRunStatuses, GetRunStatusesSchema, GetRunsOptions, GetRunsSchema, HTTPMethodUnionSchema, HandleTriggerSource, HandleTriggerSourceSchema, HttpEndpointMetadata, HttpEndpointRequestHeadersSchema, HttpMethod, HttpSourceRequestHeaders, HttpSourceRequestHeadersSchema, HttpSourceResponseMetadata, HttpSourceResponseSchema, IndexEndpointResponse, IndexEndpointResponseSchema, IndexEndpointStats, InitialStatusUpdate, InitializeCronScheduleBodySchema, InitializeTriggerBody, InitializeTriggerBodySchema, IntegrationConfig, IntegrationConfigSchema, IntegrationMetadata, IntegrationMetadataSchema, IntervalMetadata, IntervalMetadataSchema, IntervalOptions, IntervalOptionsSchema, InvokeJobRequestBody, InvokeJobRequestBodySchema, InvokeJobResponseSchema, InvokeOptions, InvokeOptionsSchema, InvokeTriggerMetadataSchema, JobMetadata, JobMetadataSchema, JobRunStatusRecord, JobRunStatusRecordSchema, LogLevel, LogMessage, LogMessageSchema, Logger, MISSING_CONNECTION_NOTIFICATION, MISSING_CONNECTION_RESOLVED_NOTIFICATION, MissingConnectionNotificationPayload, MissingConnectionNotificationPayloadSchema, MissingConnectionResolvedNotificationPayload, MissingConnectionResolvedNotificationPayloadSchema, MissingDeveloperConnectionNotificationPayloadSchema, MissingDeveloperConnectionResolvedNotificationPayloadSchema, MissingExternalConnectionNotificationPayloadSchema, MissingExternalConnectionResolvedNotificationPayloadSchema, NormalizedRequest, NormalizedRequestSchema, NormalizedResponse, NormalizedResponseSchema, OverridableRunTaskOptions, PLATFORM_FEATURES, PongErrorResponseSchema, PongResponse, PongResponseSchema, PongSuccessResponseSchema, PreprocessRunBody, PreprocessRunBodySchema, PreprocessRunResponse, PreprocessRunResponseSchema, Prettify, QueueOptions, QueueOptionsSchema, REGISTER_SOURCE_EVENT_V1, REGISTER_SOURCE_EVENT_V2, RawEvent, RawEventSchema, RedactSchema, RedactString, RedactStringSchema, RegisterCronScheduleBody, RegisterDynamicSchedulePayload, RegisterDynamicSchedulePayloadSchema, RegisterHTTPTriggerSourceBodySchema, RegisterIntervalScheduleBody, RegisterIntervalScheduleBodySchema, RegisterSMTPTriggerSourceBodySchema, RegisterSQSTriggerSourceBodySchema, RegisterScheduleBody, RegisterScheduleBodySchema, RegisterScheduleResponseBody, RegisterScheduleResponseBodySchema, RegisterSourceChannelBodySchema, RegisterSourceEventOptions, RegisterSourceEventSchemaV1, RegisterSourceEventSchemaV2, RegisterSourceEventV1, RegisterSourceEventV2, RegisterTriggerBodySchemaV1, RegisterTriggerBodySchemaV2, RegisterTriggerBodyV1, RegisterTriggerBodyV2, RegisterTriggerSource, RegisterTriggerSourceSchema, RegisteredOptionsDiff, RequestFilter, RequestFilterSchema, RequestWithRawBodySchema, ResponseFilter, ResponseFilterMatchResult, ResponseFilterSchema, RetryOptions, RetryOptionsSchema, RunJobAutoYieldExecutionError, RunJobAutoYieldExecutionErrorSchema, RunJobAutoYieldWithCompletedTaskExecutionError, RunJobAutoYieldWithCompletedTaskExecutionErrorSchema, RunJobBody, RunJobBodySchema, RunJobCanceledWithTask, RunJobCanceledWithTaskSchema, RunJobError, RunJobErrorResponse, RunJobErrorResponseSchema, RunJobErrorSchema, RunJobInvalidPayloadError, RunJobInvalidPayloadErrorSchema, RunJobResponse, RunJobResponseSchema, RunJobResumeWithParallelTask, RunJobResumeWithParallelTaskSchema, RunJobResumeWithTask, RunJobResumeWithTaskSchema, RunJobRetryWithTask, RunJobRetryWithTaskSchema, RunJobSuccess, RunJobSuccessSchema, RunJobUnresolvedAuthError, RunJobUnresolvedAuthErrorSchema, RunJobYieldExecutionError, RunJobYieldExecutionErrorSchema, RunNotification, RunNotificationAccountMetadata, RunNotificationEnvMetadata, RunNotificationInvocationMetadata, RunNotificationJobMetadata, RunNotificationOrgMetadata, RunNotificationProjectMetadata, RunNotificationRunMetadata, RunSourceContext, RunSourceContextSchema, RunStatusSchema, RunTaskBodyInput, RunTaskBodyInputSchema, RunTaskBodyOutput, RunTaskBodyOutputSchema, RunTaskOptions, RunTaskOptionsSchema, RunTaskResponseWithCachedTasksBody, RunTaskResponseWithCachedTasksBodySchema, RunTaskSchema, RunTaskWithSubtasks, RuntimeEnvironmentType, RuntimeEnvironmentTypeSchema, SCHEDULED_EVENT, ScheduleMetadata, ScheduleMetadataSchema, ScheduledPayload, ScheduledPayloadSchema, ScheduledTriggerMetadataSchema, SchemaError, SchemaErrorSchema, SendBulkEventsBodySchema, SendEvent, SendEventBody, SendEventBodySchema, SendEventOptions, SendEventOptionsSchema, SerializableJson, SerializableJsonSchema, ServerTask, ServerTaskSchema, SourceEventOption, SourceMetadataV1, SourceMetadataV2, SourceMetadataV2Schema, StaticTriggerMetadataSchema, StatusHistory, StatusHistorySchema, StatusUpdate, StatusUpdateData, StatusUpdateSchema, StatusUpdateState, StatusUpdateStateSchema, StringMatch, Style, StyleName, StyleSchema, SuccessfulRunNotification, TaskSchema, TaskStatus, TaskStatusSchema, TriggerHelpSchema, TriggerMetadata, TriggerMetadataSchema, TriggerSource, TriggerSourceSchema, UpdateTriggerSourceBodyV1, UpdateTriggerSourceBodyV1Schema, UpdateTriggerSourceBodyV2, UpdateTriggerSourceBodyV2Schema, ValidateErrorResponseSchema, ValidateResponse, ValidateResponseSchema, ValidateSuccessResponseSchema, addMissingVersionField, calculateResetAt, calculateRetryAt, currentDate, currentTimestampMilliseconds, currentTimestampSeconds, deepMergeFilters, eventFilterMatches, parseEndpointIndexStats, replacements, requestFilterMatches, responseFilterMatches, stringPatternMatchers, supportsFeature, urlWithSearchParams };
package/dist/index.js CHANGED
@@ -73,6 +73,8 @@ __export(src_exports, {
73
73
  EventFilterSchema: () => EventFilterSchema,
74
74
  EventRuleSchema: () => EventRuleSchema,
75
75
  EventSpecificationSchema: () => EventSpecificationSchema,
76
+ ExecuteJobHeadersSchema: () => ExecuteJobHeadersSchema,
77
+ ExecuteJobRunMetadataSchema: () => ExecuteJobRunMetadataSchema,
76
78
  FailTaskBodyInputSchema: () => FailTaskBodyInputSchema,
77
79
  FetchOperationSchema: () => FetchOperationSchema,
78
80
  FetchPollOperationSchema: () => FetchPollOperationSchema,
@@ -220,18 +222,20 @@ var logLevels = [
220
222
  "info",
221
223
  "debug"
222
224
  ];
223
- var _name, _level, _filteredKeys, _jsonReplacer, _structuredLog, structuredLog_fn;
225
+ var _name, _level, _filteredKeys, _jsonReplacer, _additionalFields, _structuredLog, structuredLog_fn;
224
226
  var _Logger = class _Logger {
225
- constructor(name, level = "info", filteredKeys = [], jsonReplacer) {
227
+ constructor(name, level = "info", filteredKeys = [], jsonReplacer, additionalFields) {
226
228
  __privateAdd(this, _structuredLog);
227
229
  __privateAdd(this, _name, void 0);
228
230
  __privateAdd(this, _level, void 0);
229
231
  __privateAdd(this, _filteredKeys, []);
230
232
  __privateAdd(this, _jsonReplacer, void 0);
233
+ __privateAdd(this, _additionalFields, void 0);
231
234
  __privateSet(this, _name, name);
232
235
  __privateSet(this, _level, logLevels.indexOf(process.env.TRIGGER_LOG_LEVEL ?? level));
233
236
  __privateSet(this, _filteredKeys, filteredKeys);
234
237
  __privateSet(this, _jsonReplacer, createReplacer(jsonReplacer));
238
+ __privateSet(this, _additionalFields, additionalFields ?? (() => ({})));
235
239
  }
236
240
  // Return a new Logger instance with the same name and a new log level
237
241
  // but filter out the keys from the log messages (at any level)
@@ -271,10 +275,12 @@ _name = new WeakMap();
271
275
  _level = new WeakMap();
272
276
  _filteredKeys = new WeakMap();
273
277
  _jsonReplacer = new WeakMap();
278
+ _additionalFields = new WeakMap();
274
279
  _structuredLog = new WeakSet();
275
280
  structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, level, ...args) {
276
281
  const structuredLog = {
277
282
  ...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
283
+ ...__privateGet(this, _additionalFields).call(this),
278
284
  timestamp: /* @__PURE__ */ new Date(),
279
285
  name: __privateGet(this, _name),
280
286
  message,
@@ -374,7 +380,7 @@ function getSizeInBytes(value) {
374
380
  __name(getSizeInBytes, "getSizeInBytes");
375
381
 
376
382
  // src/schemas/api.ts
377
- var import_ulid = require("ulid");
383
+ var import_ulidx = require("ulidx");
378
384
  var import_zod12 = require("zod");
379
385
 
380
386
  // src/schemas/addMissingVersionField.ts
@@ -1135,6 +1141,13 @@ var EndpointHeadersSchema = import_zod12.z.object({
1135
1141
  "trigger-version": import_zod12.z.string().optional(),
1136
1142
  "trigger-sdk-version": import_zod12.z.string().optional()
1137
1143
  });
1144
+ var ExecuteJobRunMetadataSchema = import_zod12.z.object({
1145
+ successSubscription: import_zod12.z.boolean().optional(),
1146
+ failedSubscription: import_zod12.z.boolean().optional()
1147
+ });
1148
+ var ExecuteJobHeadersSchema = EndpointHeadersSchema.extend({
1149
+ "x-trigger-run-metadata": import_zod12.z.preprocess((val) => typeof val === "string" && JSON.parse(val), ExecuteJobRunMetadataSchema).optional()
1150
+ });
1138
1151
  var RawEventSchema = import_zod12.z.object({
1139
1152
  /** The `name` property must exactly match any subscriptions you want to
1140
1153
  trigger. */
@@ -1150,7 +1163,7 @@ var RawEventSchema = import_zod12.z.object({
1150
1163
  context: import_zod12.z.any().optional(),
1151
1164
  /** The `id` property uniquely identify this particular event. If unset it
1152
1165
  will be set automatically using `ulid`. */
1153
- id: import_zod12.z.string().default(() => (0, import_ulid.ulid)()),
1166
+ id: import_zod12.z.string().default(() => (0, import_ulidx.ulid)()),
1154
1167
  /** This is optional, it defaults to the current timestamp. Usually you would
1155
1168
  only set this if you have a timestamp that you wish to pass through, e.g.
1156
1169
  you receive a timestamp from a service and you want the same timestamp to
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/runs.ts","../src/schemas/statuses.ts","../src/schemas/requestFilter.ts","../src/schemas/notifications.ts","../src/schemas/fetch.ts","../src/schemas/events.ts","../src/schemas/request.ts","../src/utils.ts","../src/retry.ts","../src/replacements.ts","../src/searchParams.ts","../src/eventFilterMatches.ts","../src/requestFilterMatches.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\";\nexport * from \"./requestFilterMatches\";\n\nexport const API_VERSIONS = {\n LAZY_LOADED_CACHED_TASKS: \"2023-09-29\",\n SERIALIZED_TASK_OUTPUT: \"2023-11-01\",\n} as const;\n\nexport const PLATFORM_FEATURES = {\n yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,\n lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,\n};\n\nexport function supportsFeature<TFeatureName extends keyof typeof PLATFORM_FEATURES>(\n featureName: TFeatureName,\n version: string\n): boolean {\n if (version === \"unversioned\" || version === \"unknown\") {\n return false;\n }\n\n const supportedVersion = PLATFORM_FEATURES[featureName];\n\n if (!supportedVersion) {\n return false;\n }\n\n return version >= supportedVersion;\n}\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 = createReplacer(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, \"log\", ...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, \"error\", ...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, \"warn\", ...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, \"info\", ...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, \"debug\", ...args);\n }\n\n #structuredLog(\n loggerFunction: (message: string, ...args: any[]) => void,\n message: string,\n level: 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 level,\n };\n\n loggerFunction(JSON.stringify(structuredLog, 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;\n }\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) {\n return;\n }\n\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 = getSizeInBytes(value);\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\nfunction getSizeInBytes(value: unknown) {\n const jsonString = JSON.stringify(value);\n\n if (typeof window === \"undefined\") {\n // Node.js environment\n return Buffer.byteLength(jsonString, \"utf8\");\n } else {\n // Browser environment\n return new TextEncoder().encode(jsonString).length;\n }\n}\n","import { ulid } from \"ulid\";\nimport { z } from \"zod\";\nimport { Prettify } from \"../types\";\nimport { addMissingVersionField } from \"./addMissingVersionField\";\nimport { ErrorWithStackSchema, SchemaErrorSchema } from \"./errors\";\nimport { EventFilterSchema, 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, ServerTaskSchema, TaskSchema } from \"./tasks\";\nimport { EventSpecificationSchema, TriggerMetadataSchema } from \"./triggers\";\nimport { RunStatusSchema } from \"./runs\";\nimport { JobRunStatusRecordSchema } from \"./statuses\";\nimport { RequestFilterSchema } from \"./requestFilter\";\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 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 HttpEndpointRequestHeadersSchema = z.object({\n \"x-ts-key\": z.string(),\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});\n\nexport const PongSuccessResponseSchema = z.object({\n ok: z.literal(true),\n triggerVersion: z.string().optional(),\n triggerSdkVersion: z.string().optional(),\n});\n\nexport const PongErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n triggerVersion: z.string().optional(),\n triggerSdkVersion: z.string().optional(),\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 triggerVersion: z.string().optional(),\n});\n\nexport const ValidateErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n triggerVersion: z.string().optional(),\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\nconst HttpEndpointMetadataSchema = z.object({\n id: z.string(),\n version: z.string(),\n enabled: z.boolean(),\n title: z.string().optional(),\n icon: z.string().optional(),\n properties: z.array(DisplayPropertySchema).optional(),\n event: EventSpecificationSchema,\n immediateResponseFilter: RequestFilterSchema.optional(),\n skipTriggeringRuns: z.boolean().optional(),\n source: z.string(),\n});\n\nexport type HttpEndpointMetadata = z.infer<typeof HttpEndpointMetadataSchema>;\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 httpEndpoints: z.array(HttpEndpointMetadataSchema).optional(),\n});\n\nexport type IndexEndpointResponse = z.infer<typeof IndexEndpointResponseSchema>;\n\nexport const EndpointIndexErrorSchema = z.object({\n message: z.string(),\n raw: z.any().optional(),\n});\n\nexport type EndpointIndexError = z.infer<typeof EndpointIndexErrorSchema>;\n\nconst IndexEndpointStatsSchema = z.object({\n jobs: z.number(),\n sources: z.number(),\n dynamicTriggers: z.number(),\n dynamicSchedules: z.number(),\n disabledJobs: z.number().default(0),\n httpEndpoints: z.number().default(0),\n});\n\nexport type IndexEndpointStats = z.infer<typeof IndexEndpointStatsSchema>;\n\nexport function parseEndpointIndexStats(stats: unknown): IndexEndpointStats | undefined {\n if (stats === null || stats === undefined) {\n return;\n }\n return IndexEndpointStatsSchema.parse(stats);\n}\n\nexport const GetEndpointIndexResponseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"PENDING\"),\n updatedAt: z.coerce.date(),\n }),\n z.object({\n status: z.literal(\"STARTED\"),\n updatedAt: z.coerce.date(),\n }),\n z.object({\n status: z.literal(\"SUCCESS\"),\n stats: IndexEndpointStatsSchema,\n updatedAt: z.coerce.date(),\n }),\n z.object({\n status: z.literal(\"FAILURE\"),\n error: EndpointIndexErrorSchema,\n updatedAt: z.coerce.date(),\n }),\n]);\n\nexport type GetEndpointIndexResponse = z.infer<typeof GetEndpointIndexResponseSchema>;\n\nexport const EndpointHeadersSchema = z.object({\n \"trigger-version\": z.string().optional(),\n \"trigger-sdk-version\": z.string().optional(),\n});\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 /** This is optional, it defaults to \"JSON\". If your event is actually a request,\n with a url, headers, method and rawBody you can use \"REQUEST\" */\n payloadType: z.union([z.literal(\"JSON\"), z.literal(\"REQUEST\")]).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 const SendBulkEventsBodySchema = z.object({\n events: RawEventSchema.array(),\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 type RunSourceContext = z.infer<typeof RunSourceContextSchema>;\n\nexport const AutoYieldConfigSchema = z.object({\n startTaskThreshold: z.number(),\n beforeExecuteTaskThreshold: z.number(),\n beforeCompleteTaskThreshold: z.number(),\n afterCompleteTaskThreshold: z.number(),\n});\n\nexport type AutoYieldConfig = z.infer<typeof AutoYieldConfigSchema>;\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 project: z\n .object({\n id: z.string(),\n name: z.string(),\n slug: z.string(),\n })\n .optional(),\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 cachedTaskCursor: z.string().optional(),\n noopTasksSet: z.string().optional(),\n connections: z.record(ConnectionAuthSchema).optional(),\n yieldedExecutions: z.string().array().optional(),\n runChunkExecutionLimit: z.number().optional(),\n autoYieldConfig: AutoYieldConfigSchema.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 RunJobYieldExecutionErrorSchema = z.object({\n status: z.literal(\"YIELD_EXECUTION\"),\n key: z.string(),\n});\n\nexport type RunJobYieldExecutionError = z.infer<typeof RunJobYieldExecutionErrorSchema>;\n\nexport const AutoYieldMetadataSchema = z.object({\n location: z.string(),\n timeRemaining: z.number(),\n timeElapsed: z.number(),\n limit: z.number().optional(),\n});\n\nexport type AutoYieldMetadata = z.infer<typeof AutoYieldMetadataSchema>;\n\nexport const RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({\n status: z.literal(\"AUTO_YIELD_EXECUTION\"),\n});\n\nexport type RunJobAutoYieldExecutionError = Prettify<\n z.infer<typeof RunJobAutoYieldExecutionErrorSchema>\n>;\n\nexport const RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = z.object({\n status: z.literal(\"AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK\"),\n id: z.string(),\n properties: z.array(DisplayPropertySchema).optional(),\n output: z.string().optional(),\n data: AutoYieldMetadataSchema,\n});\n\nexport type RunJobAutoYieldWithCompletedTaskExecutionError = z.infer<\n typeof RunJobAutoYieldWithCompletedTaskExecutionErrorSchema\n>;\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 RunJobErrorResponseSchema = z.union([\n RunJobAutoYieldExecutionErrorSchema,\n RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,\n RunJobYieldExecutionErrorSchema,\n RunJobErrorSchema,\n RunJobUnresolvedAuthErrorSchema,\n RunJobInvalidPayloadErrorSchema,\n RunJobResumeWithTaskSchema,\n RunJobRetryWithTaskSchema,\n RunJobCanceledWithTaskSchema,\n]);\n\nexport type RunJobErrorResponse = z.infer<typeof RunJobErrorResponseSchema>;\n\nexport const RunJobResumeWithParallelTaskSchema = z.object({\n status: z.literal(\"RESUME_WITH_PARALLEL_TASK\"),\n task: TaskSchema,\n childErrors: z.array(RunJobErrorResponseSchema),\n});\n\nexport type RunJobResumeWithParallelTask = z.infer<typeof RunJobResumeWithParallelTaskSchema>;\n\nexport const RunJobResponseSchema = z.discriminatedUnion(\"status\", [\n RunJobAutoYieldExecutionErrorSchema,\n RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,\n RunJobYieldExecutionErrorSchema,\n RunJobErrorSchema,\n RunJobUnresolvedAuthErrorSchema,\n RunJobInvalidPayloadErrorSchema,\n RunJobResumeWithTaskSchema,\n RunJobResumeWithParallelTaskSchema,\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 [Tabler Icons](https://tabler-icons.io/) 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 expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */\n callback: z\n .object({\n /** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */\n enabled: z.boolean(),\n /** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */\n timeoutInSeconds: z.number(),\n })\n .partial()\n .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\", \"fetch-response\", and \"fetch-poll\" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */\n operation: z.enum([\"fetch\", \"fetch-response\", \"fetch-poll\"]).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 parallel: z.boolean().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 properties: z.array(DisplayPropertySchema.partial()).optional(),\n params: DeserializedJsonSchema.optional().nullable(),\n callback: z\n .object({\n enabled: z.boolean(),\n timeoutInSeconds: z.number().default(3600),\n })\n .optional(),\n});\n\nexport type RunTaskBodyOutput = z.infer<typeof RunTaskBodyOutputSchema>;\n\nexport const RunTaskResponseWithCachedTasksBodySchema = z.object({\n task: ServerTaskSchema,\n cachedTasks: z\n .object({\n tasks: z.array(CachedTaskSchema),\n cursor: z.string().optional(),\n })\n .optional(),\n});\n\nexport type RunTaskResponseWithCachedTasksBody = z.infer<\n typeof RunTaskResponseWithCachedTasksBodySchema\n>;\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 CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({\n properties: true,\n description: true,\n params: true,\n}).extend({\n output: z.string().optional(),\n});\n\nexport type CompleteTaskBodyV2Input = Prettify<z.input<typeof CompleteTaskBodyV2InputSchema>>;\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\nexport const InvokeJobResponseSchema = z.object({\n id: z.string(),\n});\n\nexport const InvokeJobRequestBodySchema = z.object({\n payload: z.any(),\n context: z.any().optional(),\n options: z\n .object({\n accountId: z.string().optional(),\n callbackUrl: z.string().optional(),\n })\n .optional(),\n});\n\nexport type InvokeJobRequestBody = z.infer<typeof InvokeJobRequestBodySchema>;\n\nexport const InvokeOptionsSchema = z.object({\n accountId: z.string().optional(),\n idempotencyKey: z.string().optional(),\n context: z.any().optional(),\n callbackUrl: z.string().optional(),\n});\n\nexport type InvokeOptions = z.infer<typeof InvokeOptionsSchema>;\n\nexport const EphemeralEventDispatcherRequestBodySchema = z.object({\n url: z.string(),\n name: z.string().or(z.array(z.string())),\n source: z.string().optional(),\n filter: EventFilterSchema.optional(),\n contextFilter: EventFilterSchema.optional(),\n accountId: z.string().optional(),\n timeoutInSeconds: z\n .number()\n .int()\n .positive()\n .min(10)\n .max(60 * 60 * 24 * 365)\n .default(3600),\n});\n\nexport type EphemeralEventDispatcherRequestBody = z.infer<\n typeof EphemeralEventDispatcherRequestBodySchema\n>;\n\nexport const EphemeralEventDispatcherResponseBodySchema = z.object({\n id: z.string(),\n});\n\nexport type EphemeralEventDispatcherResponseBody = z.infer<\n typeof EphemeralEventDispatcherResponseBodySchema\n>;\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\nexport const stringPatternMatchers = [\n z.object({\n $endsWith: z.string(),\n }),\n z.object({\n $startsWith: z.string(),\n }),\n z.object({\n $ignoreCaseEquals: z.string(),\n }),\n] as const;\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 ...stringPatternMatchers,\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 ])\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 /** The URL to a list of images to display next to the property */\n imageUrl: z.array(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 = 2_592_000 (30 days) */\n seconds: z.number().int().positive().min(60).max(2_592_000),\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 context: 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 callbackUrl: z.string().optional().nullable(),\n childExecutionMode: z.enum([\"SEQUENTIAL\", \"PARALLEL\"]).optional().nullable(),\n});\n\nexport const ServerTaskSchema = TaskSchema.extend({\n idempotencyKey: z.string(),\n attempts: z.number(),\n forceYield: z.boolean().optional().nullable(),\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 TriggerHelpSchema = z.object({\n noRuns: z\n .object({\n text: z.string(),\n link: z.string().optional(),\n })\n .optional(),\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 link: z.string().optional(),\n help: TriggerHelpSchema.optional(),\n});\n\nexport const InvokeTriggerMetadataSchema = z.object({\n type: z.literal(\"invoke\"),\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 InvokeTriggerMetadataSchema,\n]);\n\nexport type TriggerMetadata = z.infer<typeof TriggerMetadataSchema>;\n","import { z } from \"zod\";\nimport { TaskStatusSchema } from \"./tasks\";\nimport { JobRunStatusRecord, JobRunStatusRecordSchema } from \"./statuses\";\nimport { Prettify } from \"../types\";\nimport { RuntimeEnvironmentType } from \"./api\";\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 = Prettify<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\ntype RunNotificationCommon = {\n /** The Run id */\n id: string;\n /** The Run status */\n statuses: JobRunStatusRecord[];\n /** When the run started */\n startedAt: Date;\n /** When the run was last updated */\n updatedAt: Date;\n /** When the run was completed */\n completedAt: Date;\n\n executionDurationInMs: number;\n executionCount: number;\n\n /** Job metadata */\n job: { id: string; version: string };\n /** Environment metadata */\n environment: { slug: string; id: string; type: RuntimeEnvironmentType };\n /** Organization metadata */\n organization: { slug: string; id: string; title: string };\n /** Project metadata */\n project: { slug: string; id: string; name: string };\n /** Account metadata */\n account?: { id: string; metadata?: any };\n /** Invocation metadata */\n invocation: { id: string; context: any; timestamp: Date };\n};\n\nexport type SuccessfulRunNotification<TOutput> = RunNotificationCommon & {\n ok: true;\n /** The Run status */\n status: \"SUCCESS\";\n /** The output of the run */\n output: TOutput;\n};\n\nexport type FailedRunNotification = RunNotificationCommon & {\n ok: false;\n /** The Run status */\n status: \"FAILURE\" | \"TIMED_OUT\" | \"ABORTED\" | \"CANCELED\" | \"UNRESOLVED_AUTH\" | \"INVALID_PAYLOAD\";\n /** The error of the run */\n error: any;\n};\n\nexport type RunNotification<TOutput> = SuccessfulRunNotification<TOutput> | FailedRunNotification;\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\nexport type JobRunStatusRecord = z.infer<typeof JobRunStatusRecordSchema>;\n","import { z } from \"zod\";\nimport { EventFilterSchema, stringPatternMatchers } from \"./eventFilter\";\nimport { Prettify } from \"../types\";\n\nconst StringMatchSchema = z.union([\n /** Match against a string */\n z.array(z.string()),\n z.array(z.union(stringPatternMatchers)),\n]);\n\nexport type StringMatch = z.infer<typeof StringMatchSchema>;\n\nexport const HTTPMethodUnionSchema = z.union([\n z.literal(\"GET\"),\n z.literal(\"POST\"),\n z.literal(\"PUT\"),\n z.literal(\"PATCH\"),\n z.literal(\"DELETE\"),\n z.literal(\"HEAD\"),\n z.literal(\"OPTIONS\"),\n]);\n\nexport type HttpMethod = z.infer<typeof HTTPMethodUnionSchema>;\n\n/** Only Requests that match this filter will cause the `handler` function to run.\n * For example, you can use this to only respond to `GET` Requests. */\nexport const RequestFilterSchema = z.object({\n /** An array of HTTP methods to match.\n * For example, `[\"GET\", \"POST\"]` will match both `GET` and `POST` Requests. */\n method: z.array(HTTPMethodUnionSchema).optional(),\n /** An object of header key/values to match. \n * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).\n\n @example\n ```ts\n filter: {\n header: {\n \"content-type\": [\"application/json\"],\n },\n },\n ``` */\n headers: z.record(StringMatchSchema).optional(),\n /** An object of query parameters to match. \n * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).\n\n @example\n ```ts\n filter: {\n query: {\n \"hub.mode\": [{ $startsWith: \"sub\" }],\n },\n },\n ``` */\n query: z.record(StringMatchSchema).optional(),\n /** An object of key/values to match.\n * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).\n */\n body: EventFilterSchema.optional(),\n});\n\nexport type RequestFilter = z.infer<typeof RequestFilterSchema>;\n\n/** Only Requests that match this filter will cause the `handler` function to run.\n * For example, you can use this to only respond to `GET` Requests. */\nexport const ResponseFilterSchema = RequestFilterSchema.omit({ method: true, query: true }).extend({\n status: z.array(z.number()).optional(),\n});\n\nexport type ResponseFilter = Prettify<z.infer<typeof ResponseFilterSchema>>;\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\";\nimport { EventFilterSchema } from \"./eventFilter\";\nimport { ResponseFilterSchema } from \"./requestFilter\";\nimport { Prettify } from \"../types\";\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 /** The event filter to use to determine if the request should be retried. */\n bodyFilter: EventFilterSchema.optional(),\n\n /** The format of the `resetHeader` value. */\n resetFormat: z\n .enum([\n \"unix_timestamp\",\n \"unix_timestamp_in_ms\",\n \"iso_8601\",\n \"iso_8601_duration_openai_variant\",\n ])\n .default(\"unix_timestamp\"),\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 /** The event filter to use to determine if the request should be retried. */\n bodyFilter: EventFilterSchema.optional(),\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 FetchTimeoutOptionsSchema = z.object({\n durationInMs: z.number(),\n retry: RetryOptionsSchema.optional(),\n});\n\nexport type FetchTimeoutOptions = z.infer<typeof FetchTimeoutOptionsSchema>;\n\nexport const FetchOperationSchema = z.object({\n url: z.string(),\n requestInit: FetchRequestInitSchema.optional(),\n retry: z.record(FetchRetryStrategySchema).optional(),\n timeout: FetchTimeoutOptionsSchema.optional(),\n});\n\nexport type FetchOperation = z.infer<typeof FetchOperationSchema>;\n\nexport const FetchPollOperationSchema = z.object({\n url: z.string(),\n interval: z.number().int().positive().min(10).max(600).default(10), // defaults to 10 seconds\n timeout: z.number().int().positive().min(30).max(3600).default(600), // defaults to 10 minutes\n responseFilter: ResponseFilterSchema,\n requestInit: FetchRequestInitSchema.optional(),\n requestTimeout: FetchTimeoutOptionsSchema.optional(),\n});\n\nexport type FetchPollOperation = Prettify<z.infer<typeof FetchPollOperationSchema>>;\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\nexport const CancelRunsForEventSchema = z.object({\n cancelledRunIds: z.array(z.string()),\n failedToCancelRunIds: z.array(z.string()),\n});\n\nexport type CancelRunsForEvent = z.infer<typeof CancelRunsForEventSchema>;\n","import { z } from \"zod\";\n\nexport const RequestWithRawBodySchema = z.object({\n url: z.string(),\n method: z.string(),\n headers: z.record(z.string()),\n rawBody: z.string(),\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\nexport function calculateResetAt(\n resets: string | undefined | null,\n format:\n | \"unix_timestamp\"\n | \"iso_8601\"\n | \"iso_8601_duration_openai_variant\"\n | \"unix_timestamp_in_ms\",\n now: Date = new Date()\n): Date | undefined {\n if (!resets) return;\n\n switch (format) {\n case \"iso_8601_duration_openai_variant\": {\n return calculateISO8601DurationOpenAIVariantResetAt(resets, now);\n }\n case \"iso_8601\": {\n return calculateISO8601ResetAt(resets, now);\n }\n case \"unix_timestamp\": {\n return calculateUnixTimestampResetAt(resets, now);\n }\n case \"unix_timestamp_in_ms\": {\n return calculateUnixTimestampInMsResetAt(resets, now);\n }\n }\n}\n\nfunction calculateUnixTimestampResetAt(resets: string, now: Date = new Date()): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Convert the string to a number\n const resetAt = parseInt(resets, 10);\n\n // If the string doesn't match the expected format, return undefined\n if (isNaN(resetAt)) return undefined;\n\n // Return the date\n return new Date(resetAt * 1000);\n}\n\nfunction calculateUnixTimestampInMsResetAt(\n resets: string,\n now: Date = new Date()\n): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Convert the string to a number\n const resetAt = parseInt(resets, 10);\n\n // If the string doesn't match the expected format, return undefined\n if (isNaN(resetAt)) return undefined;\n\n // Return the date\n return new Date(resetAt);\n}\n\nfunction calculateISO8601ResetAt(resets: string, now: Date = new Date()): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Parse the date\n const resetAt = new Date(resets);\n\n // If the string doesn't match the expected format, return undefined\n if (isNaN(resetAt.getTime())) return undefined;\n\n return resetAt;\n}\n\nfunction calculateISO8601DurationOpenAIVariantResetAt(\n resets: string,\n now: Date = new Date()\n): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Regular expression to match the duration string pattern\n const pattern = /^(?:(\\d+)d)?(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+(?:\\.\\d+)?)s)?(?:(\\d+)ms)?$/;\n const match = resets.match(pattern);\n\n // If the string doesn't match the expected format, return undefined\n if (!match) return undefined;\n\n // Extract days, hours, minutes, seconds, and milliseconds from the string\n const days = parseInt(match[1], 10) || 0;\n const hours = parseInt(match[2], 10) || 0;\n const minutes = parseInt(match[3], 10) || 0;\n const seconds = parseFloat(match[4]) || 0;\n const milliseconds = parseInt(match[5], 10) || 0;\n\n // Calculate the future date based on the current date plus the extracted time\n const resetAt = new Date(now);\n resetAt.setDate(resetAt.getDate() + days);\n resetAt.setHours(resetAt.getHours() + hours);\n resetAt.setMinutes(resetAt.getMinutes() + minutes);\n resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));\n resetAt.setMilliseconds(\n resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1000 + milliseconds\n );\n\n return resetAt;\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 if (payload === undefined || payload === null) {\n if (Object.entries(filter).length === 0) {\n return true;\n } else {\n return false;\n }\n }\n\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","import { eventFilterMatches } from \"./eventFilterMatches\";\nimport { HttpMethod, RequestFilter, ResponseFilter, StringMatch } from \"./schemas/requestFilter\";\n\nexport async function requestFilterMatches(\n request: Request,\n filter: RequestFilter\n): Promise<boolean> {\n const clonedRequest = request.clone();\n if (!requestMethodMatches(clonedRequest.method as HttpMethod, filter.method)) {\n return false;\n }\n\n if (filter.headers && !eventFilterMatches(clonedRequest.headers, filter.headers)) {\n return false;\n }\n\n const searchParams = new URL(clonedRequest.url).searchParams;\n const searchParamsObject: Record<string, string> = {};\n for (const [key, value] of searchParams.entries()) {\n searchParamsObject[key] = value;\n }\n\n if (filter.query && !eventFilterMatches(searchParamsObject, filter.query)) {\n return false;\n }\n\n try {\n const json = await clonedRequest.json();\n if (filter.body && !eventFilterMatches(json, filter.body)) {\n return false;\n }\n } catch (e) {\n if (filter.body) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type ResponseFilterMatchResult = {\n match: boolean;\n body?: unknown;\n};\n\nexport async function responseFilterMatches(\n response: Response,\n filter: ResponseFilter\n): Promise<ResponseFilterMatchResult> {\n if (filter.headers && !eventFilterMatches(response.headers, filter.headers)) {\n return { match: false };\n }\n\n try {\n const json = await response.json();\n if (filter.body && !eventFilterMatches(json, filter.body)) {\n return { match: false, body: json };\n } else {\n return { match: true, body: json };\n }\n } catch (e) {\n if (filter.body) {\n return { match: false, body: undefined };\n }\n }\n\n return { match: true, body: undefined };\n}\n\nfunction requestMethodMatches(method: HttpMethod, filter: RequestFilter[\"method\"]): boolean {\n if (!filter) {\n return true;\n }\n\n return filter.includes(method);\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,eAAgBM,eAAeL,YAAAA;EACtC;;;EAIAM,UAAUC,MAAgB;AACxB,WAAO,IAAIZ,QAAO,mBAAK,QAAOD,UAAU,mBAAK,OAAM,GAAGa,MAAM,mBAAK,cAAa;EAChF;EAEA,OAAOC,kBAAkBC,UAAoBC,UAAoB;AAC/D,WAAOhB,UAAUO,QAAQQ,QAAAA,KAAaf,UAAUO,QAAQS,QAAAA;EAC1D;EAEAC,IAAIC,YAAoBC,MAAkD;AACxE,QAAI,mBAAK,UAAS;AAAG;AAErB,0BAAK,kCA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C,GAAG;AACV,QAAIjB,OAAOgB,MAAM;AACf,aAAO;IACT;EACF;AAEA,SAAO;AACT;AAnCsBlB;AA0CtB,eAAsBoB,sBACpBC,UACAnB,QACoC;AACpC,MAAIA,OAAOK,WAAW,CAACC,mBAAmBa,SAASd,SAASL,OAAOK,OAAO,GAAG;AAC3E,WAAO;MAAEe,OAAO;IAAM;EACxB;AAEA,MAAI;AACF,UAAML,OAAO,MAAMI,SAASJ,KAAI;AAChC,QAAIf,OAAOgB,QAAQ,CAACV,mBAAmBS,MAAMf,OAAOgB,IAAI,GAAG;AACzD,aAAO;QAAEI,OAAO;QAAOJ,MAAMD;MAAK;IACpC,OAAO;AACL,aAAO;QAAEK,OAAO;QAAMJ,MAAMD;MAAK;IACnC;EACF,SAASE,GAAG;AACV,QAAIjB,OAAOgB,MAAM;AACf,aAAO;QAAEI,OAAO;QAAOJ,MAAMK;MAAU;IACzC;EACF;AAEA,SAAO;IAAED,OAAO;IAAMJ,MAAMK;EAAU;AACxC;AAtBsBH;AAwBtB,SAASf,qBAAqBC,QAAoBJ,QAA0C;AAC1F,MAAI,CAACA,QAAQ;AACX,WAAO;EACT;AAEA,SAAOA,OAAOsB,SAASlB,MAAAA;AACzB;AANSD;;;AxB3DF,IAAMoB,eAAe;EAC1BC,0BAA0B;EAC1BC,wBAAwB;AAC1B;AAEO,IAAMC,oBAAoB;EAC/BC,gBAAgBJ,aAAaC;EAC7BI,uBAAuBL,aAAaC;AACtC;AAEO,SAASK,gBACdC,aACAC,SACS;AACT,MAAIA,YAAY,iBAAiBA,YAAY,WAAW;AACtD,WAAO;EACT;AAEA,QAAMC,mBAAmBN,kBAAkBI,WAAAA;AAE3C,MAAI,CAACE,kBAAkB;AACrB,WAAO;EACT;AAEA,SAAOD,WAAWC;AACpB;AAfgBH;","names":["logLevels","Logger","constructor","name","level","filteredKeys","jsonReplacer","indexOf","process","env","TRIGGER_LOG_LEVEL","createReplacer","filter","keys","satisfiesLogLevel","logLevel","setLevel","log","message","args","console","error","warn","info","debug","loggerFunction","structuredLog","structureArgs","safeJsonClone","timestamp","Date","JSON","stringify","replacer","key","value","toString","bigIntReplacer","_key","obj","parse","e","length","filterKeys","Array","isArray","map","item","filteredObj","Object","entries","includes","prettyPrintBytes","NODE_ENV","sizeInBytes","getSizeInBytes","toFixed","jsonString","window","Buffer","byteLength","TextEncoder","encode","import_zod","addMissingVersionField","val","version","ErrorWithStackSchema","z","object","message","string","name","optional","stack","SchemaErrorSchema","path","array","import_zod","stringPatternMatchers","z","object","$endsWith","string","$startsWith","$ignoreCaseEquals","EventMatcherSchema","union","array","number","boolean","$exists","$isNull","$anythingBut","$gt","$lt","$gte","$lte","$between","tuple","$includes","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","imageUrl","array","DisplayPropertiesSchema","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","context","error","parentId","style","StyleSchema","operation","callbackUrl","childExecutionMode","ServerTaskSchema","extend","idempotencyKey","attempts","number","forceYield","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","TriggerHelpSchema","noRuns","text","link","StaticTriggerMetadataSchema","union","rule","EventRuleSchema","help","InvokeTriggerMetadataSchema","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","import_zod","StringMatchSchema","z","union","array","string","stringPatternMatchers","HTTPMethodUnionSchema","literal","RequestFilterSchema","object","method","optional","headers","record","query","body","EventFilterSchema","ResponseFilterSchema","omit","extend","status","number","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","HttpSourceRequestHeadersSchema","transform","s","JSON","parse","undefined","json","HttpEndpointRequestHeadersSchema","PongSuccessResponseSchema","ok","triggerVersion","triggerSdkVersion","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","HttpEndpointMetadataSchema","title","icon","properties","DisplayPropertySchema","immediateResponseFilter","RequestFilterSchema","skipTriggeringRuns","IndexEndpointResponseSchema","sources","dynamicTriggers","dynamicSchedules","RegisterDynamicSchedulePayloadSchema","httpEndpoints","EndpointIndexErrorSchema","message","raw","IndexEndpointStatsSchema","disabledJobs","parseEndpointIndexStats","stats","GetEndpointIndexResponseSchema","status","updatedAt","coerce","date","EndpointHeadersSchema","RawEventSchema","payload","context","ulid","timestamp","payloadType","union","ApiEventLogSchema","nullable","deliverAt","deliveredAt","cancelledAt","SendEventOptionsSchema","deliverAfter","int","accountId","SendEventBodySchema","SendBulkEventsBodySchema","DeliverEventResponseSchema","datetime","RuntimeEnvironmentTypeSchema","RunSourceContextSchema","AutoYieldConfigSchema","startTaskThreshold","beforeExecuteTaskThreshold","beforeCompleteTaskThreshold","afterCompleteTaskThreshold","RunJobBodySchema","job","run","isTest","isRetry","startedAt","environment","slug","organization","project","account","tasks","CachedTaskSchema","cachedTaskCursor","noopTasksSet","connections","yieldedExecutions","runChunkExecutionLimit","autoYieldConfig","RunJobErrorSchema","ErrorWithStackSchema","task","TaskSchema","RunJobYieldExecutionErrorSchema","AutoYieldMetadataSchema","location","timeRemaining","timeElapsed","limit","RunJobAutoYieldExecutionErrorSchema","extend","RunJobAutoYieldWithCompletedTaskExecutionErrorSchema","output","RunJobInvalidPayloadErrorSchema","errors","SchemaErrorSchema","RunJobUnresolvedAuthErrorSchema","issues","RunJobResumeWithTaskSchema","RunJobRetryWithTaskSchema","retryAt","RunJobCanceledWithTaskSchema","RunJobSuccessSchema","RunJobErrorResponseSchema","RunJobResumeWithParallelTaskSchema","childErrors","RunJobResponseSchema","PreprocessRunBodySchema","PreprocessRunResponseSchema","abort","CreateRunResponseOkSchema","CreateRunResponseErrorSchema","CreateRunResponseBodySchema","RedactStringSchema","__redactedString","strings","interpolations","LogMessageSchema","level","RedactSchema","paths","RetryOptionsSchema","factor","minTimeoutInMs","maxTimeoutInMs","randomize","RunTaskOptionsSchema","delayUntil","retry","displayKey","description","style","StyleSchema","callback","timeoutInSeconds","partial","connectionKey","operation","noop","redact","parallel","RunTaskBodyInputSchema","idempotencyKey","parentId","RunTaskBodyOutputSchema","RunTaskResponseWithCachedTasksBodySchema","ServerTaskSchema","cachedTasks","cursor","CompleteTaskBodyInputSchema","v","stringify","CompleteTaskBodyV2InputSchema","FailTaskBodyInputSchema","NormalizedRequestSchema","headers","method","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","InvokeJobResponseSchema","InvokeJobRequestBodySchema","callbackUrl","InvokeOptionsSchema","EphemeralEventDispatcherRequestBodySchema","or","filter","EventFilterSchema","contextFilter","positive","min","max","EphemeralEventDispatcherResponseBodySchema","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","bodyFilter","EventFilterSchema","optional","resetFormat","enum","default","FetchRetryBackoffStrategySchema","RetryOptionsSchema","extend","FetchRetryStrategySchema","discriminatedUnion","FetchRequestInitSchema","method","headers","record","union","RedactStringSchema","body","instanceof","ArrayBuffer","FetchRetryOptionsSchema","FetchTimeoutOptionsSchema","durationInMs","number","retry","FetchOperationSchema","url","requestInit","timeout","FetchPollOperationSchema","interval","int","positive","min","max","responseFilter","ResponseFilterSchema","requestTimeout","import_zod","GetEventSchema","z","object","id","string","name","createdAt","coerce","date","updatedAt","runs","array","status","RunStatusSchema","startedAt","optional","nullable","completedAt","CancelRunsForEventSchema","cancelledRunIds","failedToCancelRunIds","import_zod","RequestWithRawBodySchema","z","object","url","string","method","headers","record","rawBody","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","calculateResetAt","resets","format","calculateISO8601DurationOpenAIVariantResetAt","calculateISO8601ResetAt","calculateUnixTimestampResetAt","calculateUnixTimestampInMsResetAt","undefined","resetAt","parseInt","isNaN","getTime","pattern","match","days","hours","minutes","seconds","parseFloat","milliseconds","setDate","getDate","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","floor","setMilliseconds","getMilliseconds","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","undefined","Object","entries","length","patternKey","patternValue","payloadValue","Array","isArray","every","item","includes","objectArray","contentFiltersMatches","some","actualValue","contentFilters","contentFilter","key","value","contentFilterMatches","endsWith","$endsWith","startsWith","$startsWith","$anythingBut","$exists","$gt","$lt","$gte","$lte","$between","$includes","localeCompare","$ignoreCaseEquals","sensitivity","$isNull","requestFilterMatches","request","filter","clonedRequest","clone","requestMethodMatches","method","headers","eventFilterMatches","searchParams","URL","url","searchParamsObject","key","value","entries","query","json","body","e","responseFilterMatches","response","match","undefined","includes","API_VERSIONS","LAZY_LOADED_CACHED_TASKS","SERIALIZED_TASK_OUTPUT","PLATFORM_FEATURES","yieldExecution","lazyLoadedCachedTasks","supportsFeature","featureName","version","supportedVersion"]}
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/requestFilter.ts","../src/schemas/notifications.ts","../src/schemas/fetch.ts","../src/schemas/events.ts","../src/schemas/request.ts","../src/utils.ts","../src/retry.ts","../src/replacements.ts","../src/searchParams.ts","../src/eventFilterMatches.ts","../src/requestFilterMatches.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\";\nexport * from \"./requestFilterMatches\";\n\nexport const API_VERSIONS = {\n LAZY_LOADED_CACHED_TASKS: \"2023-09-29\",\n SERIALIZED_TASK_OUTPUT: \"2023-11-01\",\n} as const;\n\nexport const PLATFORM_FEATURES = {\n yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,\n lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,\n};\n\nexport function supportsFeature<TFeatureName extends keyof typeof PLATFORM_FEATURES>(\n featureName: TFeatureName,\n version: string\n): boolean {\n if (version === \"unversioned\" || version === \"unknown\") {\n return false;\n }\n\n const supportedVersion = PLATFORM_FEATURES[featureName];\n\n if (!supportedVersion) {\n return false;\n }\n\n return version >= supportedVersion;\n}\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 #additionalFields: () => Record<string, unknown>;\n\n constructor(\n name: string,\n level: LogLevel = \"info\",\n filteredKeys: string[] = [],\n jsonReplacer?: (key: string, value: unknown) => unknown,\n additionalFields?: () => Record<string, 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 = createReplacer(jsonReplacer);\n this.#additionalFields = additionalFields ?? (() => ({}));\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, \"log\", ...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, \"error\", ...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, \"warn\", ...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, \"info\", ...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, \"debug\", ...args);\n }\n\n #structuredLog(\n loggerFunction: (message: string, ...args: any[]) => void,\n message: string,\n level: string,\n ...args: Array<Record<string, unknown> | undefined>\n ) {\n const structuredLog = {\n ...structureArgs(safeJsonClone(args) as Record<string, unknown>[], this.#filteredKeys),\n ...this.#additionalFields(),\n timestamp: new Date(),\n name: this.#name,\n message,\n level,\n };\n\n loggerFunction(JSON.stringify(structuredLog, 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;\n }\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) {\n return;\n }\n\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 = getSizeInBytes(value);\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\nfunction getSizeInBytes(value: unknown) {\n const jsonString = JSON.stringify(value);\n\n if (typeof window === \"undefined\") {\n // Node.js environment\n return Buffer.byteLength(jsonString, \"utf8\");\n } else {\n // Browser environment\n return new TextEncoder().encode(jsonString).length;\n }\n}\n","import { ulid } from \"ulidx\";\nimport { z } from \"zod\";\nimport { Prettify } from \"../types\";\nimport { addMissingVersionField } from \"./addMissingVersionField\";\nimport { ErrorWithStackSchema, SchemaErrorSchema } from \"./errors\";\nimport { EventFilterSchema, 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, ServerTaskSchema, TaskSchema } from \"./tasks\";\nimport { EventSpecificationSchema, TriggerMetadataSchema } from \"./triggers\";\nimport { RunStatusSchema } from \"./runs\";\nimport { JobRunStatusRecordSchema } from \"./statuses\";\nimport { RequestFilterSchema } from \"./requestFilter\";\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 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 HttpEndpointRequestHeadersSchema = z.object({\n \"x-ts-key\": z.string(),\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});\n\nexport const PongSuccessResponseSchema = z.object({\n ok: z.literal(true),\n triggerVersion: z.string().optional(),\n triggerSdkVersion: z.string().optional(),\n});\n\nexport const PongErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n triggerVersion: z.string().optional(),\n triggerSdkVersion: z.string().optional(),\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 triggerVersion: z.string().optional(),\n});\n\nexport const ValidateErrorResponseSchema = z.object({\n ok: z.literal(false),\n error: z.string(),\n triggerVersion: z.string().optional(),\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\nconst HttpEndpointMetadataSchema = z.object({\n id: z.string(),\n version: z.string(),\n enabled: z.boolean(),\n title: z.string().optional(),\n icon: z.string().optional(),\n properties: z.array(DisplayPropertySchema).optional(),\n event: EventSpecificationSchema,\n immediateResponseFilter: RequestFilterSchema.optional(),\n skipTriggeringRuns: z.boolean().optional(),\n source: z.string(),\n});\n\nexport type HttpEndpointMetadata = z.infer<typeof HttpEndpointMetadataSchema>;\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 httpEndpoints: z.array(HttpEndpointMetadataSchema).optional(),\n});\n\nexport type IndexEndpointResponse = z.infer<typeof IndexEndpointResponseSchema>;\n\nexport const EndpointIndexErrorSchema = z.object({\n message: z.string(),\n raw: z.any().optional(),\n});\n\nexport type EndpointIndexError = z.infer<typeof EndpointIndexErrorSchema>;\n\nconst IndexEndpointStatsSchema = z.object({\n jobs: z.number(),\n sources: z.number(),\n dynamicTriggers: z.number(),\n dynamicSchedules: z.number(),\n disabledJobs: z.number().default(0),\n httpEndpoints: z.number().default(0),\n});\n\nexport type IndexEndpointStats = z.infer<typeof IndexEndpointStatsSchema>;\n\nexport function parseEndpointIndexStats(stats: unknown): IndexEndpointStats | undefined {\n if (stats === null || stats === undefined) {\n return;\n }\n return IndexEndpointStatsSchema.parse(stats);\n}\n\nexport const GetEndpointIndexResponseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"PENDING\"),\n updatedAt: z.coerce.date(),\n }),\n z.object({\n status: z.literal(\"STARTED\"),\n updatedAt: z.coerce.date(),\n }),\n z.object({\n status: z.literal(\"SUCCESS\"),\n stats: IndexEndpointStatsSchema,\n updatedAt: z.coerce.date(),\n }),\n z.object({\n status: z.literal(\"FAILURE\"),\n error: EndpointIndexErrorSchema,\n updatedAt: z.coerce.date(),\n }),\n]);\n\nexport type GetEndpointIndexResponse = z.infer<typeof GetEndpointIndexResponseSchema>;\n\nexport const EndpointHeadersSchema = z.object({\n \"trigger-version\": z.string().optional(),\n \"trigger-sdk-version\": z.string().optional(),\n});\n\nexport const ExecuteJobRunMetadataSchema = z.object({\n successSubscription: z.boolean().optional(),\n failedSubscription: z.boolean().optional(),\n});\n\nexport const ExecuteJobHeadersSchema = EndpointHeadersSchema.extend({\n \"x-trigger-run-metadata\": z\n .preprocess((val) => typeof val === \"string\" && JSON.parse(val), ExecuteJobRunMetadataSchema)\n .optional(),\n});\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 /** This is optional, it defaults to \"JSON\". If your event is actually a request,\n with a url, headers, method and rawBody you can use \"REQUEST\" */\n payloadType: z.union([z.literal(\"JSON\"), z.literal(\"REQUEST\")]).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 const SendBulkEventsBodySchema = z.object({\n events: RawEventSchema.array(),\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 type RunSourceContext = z.infer<typeof RunSourceContextSchema>;\n\nexport const AutoYieldConfigSchema = z.object({\n startTaskThreshold: z.number(),\n beforeExecuteTaskThreshold: z.number(),\n beforeCompleteTaskThreshold: z.number(),\n afterCompleteTaskThreshold: z.number(),\n});\n\nexport type AutoYieldConfig = z.infer<typeof AutoYieldConfigSchema>;\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 project: z\n .object({\n id: z.string(),\n name: z.string(),\n slug: z.string(),\n })\n .optional(),\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 cachedTaskCursor: z.string().optional(),\n noopTasksSet: z.string().optional(),\n connections: z.record(ConnectionAuthSchema).optional(),\n yieldedExecutions: z.string().array().optional(),\n runChunkExecutionLimit: z.number().optional(),\n autoYieldConfig: AutoYieldConfigSchema.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 RunJobYieldExecutionErrorSchema = z.object({\n status: z.literal(\"YIELD_EXECUTION\"),\n key: z.string(),\n});\n\nexport type RunJobYieldExecutionError = z.infer<typeof RunJobYieldExecutionErrorSchema>;\n\nexport const AutoYieldMetadataSchema = z.object({\n location: z.string(),\n timeRemaining: z.number(),\n timeElapsed: z.number(),\n limit: z.number().optional(),\n});\n\nexport type AutoYieldMetadata = z.infer<typeof AutoYieldMetadataSchema>;\n\nexport const RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({\n status: z.literal(\"AUTO_YIELD_EXECUTION\"),\n});\n\nexport type RunJobAutoYieldExecutionError = Prettify<\n z.infer<typeof RunJobAutoYieldExecutionErrorSchema>\n>;\n\nexport const RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = z.object({\n status: z.literal(\"AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK\"),\n id: z.string(),\n properties: z.array(DisplayPropertySchema).optional(),\n output: z.string().optional(),\n data: AutoYieldMetadataSchema,\n});\n\nexport type RunJobAutoYieldWithCompletedTaskExecutionError = z.infer<\n typeof RunJobAutoYieldWithCompletedTaskExecutionErrorSchema\n>;\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 RunJobErrorResponseSchema = z.union([\n RunJobAutoYieldExecutionErrorSchema,\n RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,\n RunJobYieldExecutionErrorSchema,\n RunJobErrorSchema,\n RunJobUnresolvedAuthErrorSchema,\n RunJobInvalidPayloadErrorSchema,\n RunJobResumeWithTaskSchema,\n RunJobRetryWithTaskSchema,\n RunJobCanceledWithTaskSchema,\n]);\n\nexport type RunJobErrorResponse = z.infer<typeof RunJobErrorResponseSchema>;\n\nexport const RunJobResumeWithParallelTaskSchema = z.object({\n status: z.literal(\"RESUME_WITH_PARALLEL_TASK\"),\n task: TaskSchema,\n childErrors: z.array(RunJobErrorResponseSchema),\n});\n\nexport type RunJobResumeWithParallelTask = z.infer<typeof RunJobResumeWithParallelTaskSchema>;\n\nexport const RunJobResponseSchema = z.discriminatedUnion(\"status\", [\n RunJobAutoYieldExecutionErrorSchema,\n RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,\n RunJobYieldExecutionErrorSchema,\n RunJobErrorSchema,\n RunJobUnresolvedAuthErrorSchema,\n RunJobInvalidPayloadErrorSchema,\n RunJobResumeWithTaskSchema,\n RunJobResumeWithParallelTaskSchema,\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 [Tabler Icons](https://tabler-icons.io/) 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 expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */\n callback: z\n .object({\n /** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */\n enabled: z.boolean(),\n /** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */\n timeoutInSeconds: z.number(),\n })\n .partial()\n .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\", \"fetch-response\", and \"fetch-poll\" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */\n operation: z.enum([\"fetch\", \"fetch-response\", \"fetch-poll\"]).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 parallel: z.boolean().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 properties: z.array(DisplayPropertySchema.partial()).optional(),\n params: DeserializedJsonSchema.optional().nullable(),\n callback: z\n .object({\n enabled: z.boolean(),\n timeoutInSeconds: z.number().default(3600),\n })\n .optional(),\n});\n\nexport type RunTaskBodyOutput = z.infer<typeof RunTaskBodyOutputSchema>;\n\nexport const RunTaskResponseWithCachedTasksBodySchema = z.object({\n task: ServerTaskSchema,\n cachedTasks: z\n .object({\n tasks: z.array(CachedTaskSchema),\n cursor: z.string().optional(),\n })\n .optional(),\n});\n\nexport type RunTaskResponseWithCachedTasksBody = z.infer<\n typeof RunTaskResponseWithCachedTasksBodySchema\n>;\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 CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({\n properties: true,\n description: true,\n params: true,\n}).extend({\n output: z.string().optional(),\n});\n\nexport type CompleteTaskBodyV2Input = Prettify<z.input<typeof CompleteTaskBodyV2InputSchema>>;\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\nexport const InvokeJobResponseSchema = z.object({\n id: z.string(),\n});\n\nexport const InvokeJobRequestBodySchema = z.object({\n payload: z.any(),\n context: z.any().optional(),\n options: z\n .object({\n accountId: z.string().optional(),\n callbackUrl: z.string().optional(),\n })\n .optional(),\n});\n\nexport type InvokeJobRequestBody = z.infer<typeof InvokeJobRequestBodySchema>;\n\nexport const InvokeOptionsSchema = z.object({\n accountId: z.string().optional(),\n idempotencyKey: z.string().optional(),\n context: z.any().optional(),\n callbackUrl: z.string().optional(),\n});\n\nexport type InvokeOptions = z.infer<typeof InvokeOptionsSchema>;\n\nexport const EphemeralEventDispatcherRequestBodySchema = z.object({\n url: z.string(),\n name: z.string().or(z.array(z.string())),\n source: z.string().optional(),\n filter: EventFilterSchema.optional(),\n contextFilter: EventFilterSchema.optional(),\n accountId: z.string().optional(),\n timeoutInSeconds: z\n .number()\n .int()\n .positive()\n .min(10)\n .max(60 * 60 * 24 * 365)\n .default(3600),\n});\n\nexport type EphemeralEventDispatcherRequestBody = z.infer<\n typeof EphemeralEventDispatcherRequestBodySchema\n>;\n\nexport const EphemeralEventDispatcherResponseBodySchema = z.object({\n id: z.string(),\n});\n\nexport type EphemeralEventDispatcherResponseBody = z.infer<\n typeof EphemeralEventDispatcherResponseBodySchema\n>;\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\nexport const stringPatternMatchers = [\n z.object({\n $endsWith: z.string(),\n }),\n z.object({\n $startsWith: z.string(),\n }),\n z.object({\n $ignoreCaseEquals: z.string(),\n }),\n] as const;\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 ...stringPatternMatchers,\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 ])\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 /** The URL to a list of images to display next to the property */\n imageUrl: z.array(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 = 2_592_000 (30 days) */\n seconds: z.number().int().positive().min(60).max(2_592_000),\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 context: 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 callbackUrl: z.string().optional().nullable(),\n childExecutionMode: z.enum([\"SEQUENTIAL\", \"PARALLEL\"]).optional().nullable(),\n});\n\nexport const ServerTaskSchema = TaskSchema.extend({\n idempotencyKey: z.string(),\n attempts: z.number(),\n forceYield: z.boolean().optional().nullable(),\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 TriggerHelpSchema = z.object({\n noRuns: z\n .object({\n text: z.string(),\n link: z.string().optional(),\n })\n .optional(),\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 link: z.string().optional(),\n help: TriggerHelpSchema.optional(),\n});\n\nexport const InvokeTriggerMetadataSchema = z.object({\n type: z.literal(\"invoke\"),\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 InvokeTriggerMetadataSchema,\n]);\n\nexport type TriggerMetadata = z.infer<typeof TriggerMetadataSchema>;\n","import { z } from \"zod\";\nimport { Prettify } from \"../types\";\nimport { RuntimeEnvironmentType } from \"./api\";\nimport { ErrorWithStack } from \"./errors\";\nimport { JobRunStatusRecord, JobRunStatusRecordSchema } from \"./statuses\";\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 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 = Prettify<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\nexport type RunNotificationJobMetadata = { id: string; version: string };\nexport type RunNotificationEnvMetadata = {\n slug: string;\n id: string;\n type: RuntimeEnvironmentType;\n};\nexport type RunNotificationOrgMetadata = { slug: string; id: string; title: string };\nexport type RunNotificationProjectMetadata = { slug: string; id: string; name: string };\nexport type RunNotificationAccountMetadata = { id: string; metadata?: any };\nexport type RunNotificationInvocationMetadata<T = any> = {\n id: string;\n context: any;\n timestamp: Date;\n payload: T;\n};\nexport type RunNotificationRunMetadata = {\n /** The Run id */\n id: string;\n /** The Run status */\n statuses: JobRunStatusRecord[];\n /** When the run started */\n startedAt: Date;\n /** When the run was last updated */\n updatedAt: Date;\n /** When the run was completed */\n completedAt: Date;\n /** If the run was a test or not */\n isTest: boolean;\n\n executionDurationInMs: number;\n executionCount: number;\n};\n\ntype RunNotificationCommon<TPayload = any> = {\n /** The Run id */\n id: string;\n /** The Run status */\n statuses: JobRunStatusRecord[];\n /** When the run started */\n startedAt: Date;\n /** When the run was last updated */\n updatedAt: Date;\n /** When the run was completed */\n completedAt: Date;\n /** If the run was a test or not */\n isTest: boolean;\n\n executionDurationInMs: number;\n executionCount: number;\n\n /** Job metadata */\n job: RunNotificationJobMetadata;\n /** Environment metadata */\n environment: RunNotificationEnvMetadata;\n /** Organization metadata */\n organization: RunNotificationOrgMetadata;\n /** Project metadata */\n project: RunNotificationProjectMetadata;\n /** Account metadata */\n account?: RunNotificationAccountMetadata;\n /** Invocation metadata */\n invocation: RunNotificationInvocationMetadata<TPayload>;\n};\n\nexport type SuccessfulRunNotification<TOutput, TPayload = any> = RunNotificationCommon<TPayload> & {\n ok: true;\n /** The Run status */\n status: \"SUCCESS\";\n /** The output of the run */\n output: TOutput;\n};\n\nexport type FailedRunNotification<TPayload = any> = RunNotificationCommon<TPayload> & {\n ok: false;\n /** The Run status */\n status: \"FAILURE\" | \"TIMED_OUT\" | \"ABORTED\" | \"CANCELED\" | \"UNRESOLVED_AUTH\" | \"INVALID_PAYLOAD\";\n /** The error of the run */\n error: any;\n /** The task that failed */\n task?: {\n id: string;\n cacheKey: string | null;\n status: string;\n name: string;\n icon: string | null;\n startedAt: string;\n error: ErrorWithStack;\n params: any | null;\n };\n};\n\nexport type RunNotification<TOutput, TPayload = any> =\n | SuccessfulRunNotification<TOutput, TPayload>\n | FailedRunNotification<TPayload>;\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\nexport type JobRunStatusRecord = z.infer<typeof JobRunStatusRecordSchema>;\n","import { z } from \"zod\";\nimport { EventFilterSchema, stringPatternMatchers } from \"./eventFilter\";\nimport { Prettify } from \"../types\";\n\nconst StringMatchSchema = z.union([\n /** Match against a string */\n z.array(z.string()),\n z.array(z.union(stringPatternMatchers)),\n]);\n\nexport type StringMatch = z.infer<typeof StringMatchSchema>;\n\nexport const HTTPMethodUnionSchema = z.union([\n z.literal(\"GET\"),\n z.literal(\"POST\"),\n z.literal(\"PUT\"),\n z.literal(\"PATCH\"),\n z.literal(\"DELETE\"),\n z.literal(\"HEAD\"),\n z.literal(\"OPTIONS\"),\n]);\n\nexport type HttpMethod = z.infer<typeof HTTPMethodUnionSchema>;\n\n/** Only Requests that match this filter will cause the `handler` function to run.\n * For example, you can use this to only respond to `GET` Requests. */\nexport const RequestFilterSchema = z.object({\n /** An array of HTTP methods to match.\n * For example, `[\"GET\", \"POST\"]` will match both `GET` and `POST` Requests. */\n method: z.array(HTTPMethodUnionSchema).optional(),\n /** An object of header key/values to match. \n * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).\n\n @example\n ```ts\n filter: {\n header: {\n \"content-type\": [\"application/json\"],\n },\n },\n ``` */\n headers: z.record(StringMatchSchema).optional(),\n /** An object of query parameters to match. \n * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).\n\n @example\n ```ts\n filter: {\n query: {\n \"hub.mode\": [{ $startsWith: \"sub\" }],\n },\n },\n ``` */\n query: z.record(StringMatchSchema).optional(),\n /** An object of key/values to match.\n * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).\n */\n body: EventFilterSchema.optional(),\n});\n\nexport type RequestFilter = z.infer<typeof RequestFilterSchema>;\n\n/** Only Requests that match this filter will cause the `handler` function to run.\n * For example, you can use this to only respond to `GET` Requests. */\nexport const ResponseFilterSchema = RequestFilterSchema.omit({ method: true, query: true }).extend({\n status: z.array(z.number()).optional(),\n});\n\nexport type ResponseFilter = Prettify<z.infer<typeof ResponseFilterSchema>>;\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\";\nimport { EventFilterSchema } from \"./eventFilter\";\nimport { ResponseFilterSchema } from \"./requestFilter\";\nimport { Prettify } from \"../types\";\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 /** The event filter to use to determine if the request should be retried. */\n bodyFilter: EventFilterSchema.optional(),\n\n /** The format of the `resetHeader` value. */\n resetFormat: z\n .enum([\n \"unix_timestamp\",\n \"unix_timestamp_in_ms\",\n \"iso_8601\",\n \"iso_8601_duration_openai_variant\",\n ])\n .default(\"unix_timestamp\"),\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 /** The event filter to use to determine if the request should be retried. */\n bodyFilter: EventFilterSchema.optional(),\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 FetchTimeoutOptionsSchema = z.object({\n durationInMs: z.number(),\n retry: RetryOptionsSchema.optional(),\n});\n\nexport type FetchTimeoutOptions = z.infer<typeof FetchTimeoutOptionsSchema>;\n\nexport const FetchOperationSchema = z.object({\n url: z.string(),\n requestInit: FetchRequestInitSchema.optional(),\n retry: z.record(FetchRetryStrategySchema).optional(),\n timeout: FetchTimeoutOptionsSchema.optional(),\n});\n\nexport type FetchOperation = z.infer<typeof FetchOperationSchema>;\n\nexport const FetchPollOperationSchema = z.object({\n url: z.string(),\n interval: z.number().int().positive().min(10).max(600).default(10), // defaults to 10 seconds\n timeout: z.number().int().positive().min(30).max(3600).default(600), // defaults to 10 minutes\n responseFilter: ResponseFilterSchema,\n requestInit: FetchRequestInitSchema.optional(),\n requestTimeout: FetchTimeoutOptionsSchema.optional(),\n});\n\nexport type FetchPollOperation = Prettify<z.infer<typeof FetchPollOperationSchema>>;\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\nexport const CancelRunsForEventSchema = z.object({\n cancelledRunIds: z.array(z.string()),\n failedToCancelRunIds: z.array(z.string()),\n});\n\nexport type CancelRunsForEvent = z.infer<typeof CancelRunsForEventSchema>;\n","import { z } from \"zod\";\n\nexport const RequestWithRawBodySchema = z.object({\n url: z.string(),\n method: z.string(),\n headers: z.record(z.string()),\n rawBody: z.string(),\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\nexport function calculateResetAt(\n resets: string | undefined | null,\n format:\n | \"unix_timestamp\"\n | \"iso_8601\"\n | \"iso_8601_duration_openai_variant\"\n | \"unix_timestamp_in_ms\",\n now: Date = new Date()\n): Date | undefined {\n if (!resets) return;\n\n switch (format) {\n case \"iso_8601_duration_openai_variant\": {\n return calculateISO8601DurationOpenAIVariantResetAt(resets, now);\n }\n case \"iso_8601\": {\n return calculateISO8601ResetAt(resets, now);\n }\n case \"unix_timestamp\": {\n return calculateUnixTimestampResetAt(resets, now);\n }\n case \"unix_timestamp_in_ms\": {\n return calculateUnixTimestampInMsResetAt(resets, now);\n }\n }\n}\n\nfunction calculateUnixTimestampResetAt(resets: string, now: Date = new Date()): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Convert the string to a number\n const resetAt = parseInt(resets, 10);\n\n // If the string doesn't match the expected format, return undefined\n if (isNaN(resetAt)) return undefined;\n\n // Return the date\n return new Date(resetAt * 1000);\n}\n\nfunction calculateUnixTimestampInMsResetAt(\n resets: string,\n now: Date = new Date()\n): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Convert the string to a number\n const resetAt = parseInt(resets, 10);\n\n // If the string doesn't match the expected format, return undefined\n if (isNaN(resetAt)) return undefined;\n\n // Return the date\n return new Date(resetAt);\n}\n\nfunction calculateISO8601ResetAt(resets: string, now: Date = new Date()): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Parse the date\n const resetAt = new Date(resets);\n\n // If the string doesn't match the expected format, return undefined\n if (isNaN(resetAt.getTime())) return undefined;\n\n return resetAt;\n}\n\nfunction calculateISO8601DurationOpenAIVariantResetAt(\n resets: string,\n now: Date = new Date()\n): Date | undefined {\n // Check if the input is null or undefined\n if (!resets) return undefined;\n\n // Regular expression to match the duration string pattern\n const pattern = /^(?:(\\d+)d)?(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+(?:\\.\\d+)?)s)?(?:(\\d+)ms)?$/;\n const match = resets.match(pattern);\n\n // If the string doesn't match the expected format, return undefined\n if (!match) return undefined;\n\n // Extract days, hours, minutes, seconds, and milliseconds from the string\n const days = parseInt(match[1], 10) || 0;\n const hours = parseInt(match[2], 10) || 0;\n const minutes = parseInt(match[3], 10) || 0;\n const seconds = parseFloat(match[4]) || 0;\n const milliseconds = parseInt(match[5], 10) || 0;\n\n // Calculate the future date based on the current date plus the extracted time\n const resetAt = new Date(now);\n resetAt.setDate(resetAt.getDate() + days);\n resetAt.setHours(resetAt.getHours() + hours);\n resetAt.setMinutes(resetAt.getMinutes() + minutes);\n resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));\n resetAt.setMilliseconds(\n resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1000 + milliseconds\n );\n\n return resetAt;\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 if (payload === undefined || payload === null) {\n if (Object.entries(filter).length === 0) {\n return true;\n } else {\n return false;\n }\n }\n\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","import { eventFilterMatches } from \"./eventFilterMatches\";\nimport { HttpMethod, RequestFilter, ResponseFilter, StringMatch } from \"./schemas/requestFilter\";\n\nexport async function requestFilterMatches(\n request: Request,\n filter: RequestFilter\n): Promise<boolean> {\n const clonedRequest = request.clone();\n if (!requestMethodMatches(clonedRequest.method as HttpMethod, filter.method)) {\n return false;\n }\n\n if (filter.headers && !eventFilterMatches(clonedRequest.headers, filter.headers)) {\n return false;\n }\n\n const searchParams = new URL(clonedRequest.url).searchParams;\n const searchParamsObject: Record<string, string> = {};\n for (const [key, value] of searchParams.entries()) {\n searchParamsObject[key] = value;\n }\n\n if (filter.query && !eventFilterMatches(searchParamsObject, filter.query)) {\n return false;\n }\n\n try {\n const json = await clonedRequest.json();\n if (filter.body && !eventFilterMatches(json, filter.body)) {\n return false;\n }\n } catch (e) {\n if (filter.body) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type ResponseFilterMatchResult = {\n match: boolean;\n body?: unknown;\n};\n\nexport async function responseFilterMatches(\n response: Response,\n filter: ResponseFilter\n): Promise<ResponseFilterMatchResult> {\n if (filter.headers && !eventFilterMatches(response.headers, filter.headers)) {\n return { match: false };\n }\n\n try {\n const json = await response.json();\n if (filter.body && !eventFilterMatches(json, filter.body)) {\n return { match: false, body: json };\n } else {\n return { match: true, body: json };\n }\n } catch (e) {\n if (filter.body) {\n return { match: false, body: undefined };\n }\n }\n\n return { match: true, body: undefined };\n}\n\nfunction requestMethodMatches(method: HttpMethod, filter: RequestFilter[\"method\"]): boolean {\n if (!filter) {\n return true;\n }\n\n return filter.includes(method);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACYA,IAAMA,YAA6B;EAAC;EAAO;EAAS;EAAQ;EAAQ;;AAZpE;AAcO,IAAMC,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AO;MAAEe,OAAO;IAAM;EACxB;AAEA,MAAI;AACF,UAAML,OAAO,MAAMI,SAASJ,KAAI;AAChC,QAAIf,OAAOgB,QAAQ,CAACV,mBAAmBS,MAAMf,OAAOgB,IAAI,GAAG;AACzD,aAAO;QAAEI,OAAO;QAAOJ,MAAMD;MAAK;IACpC,OAAO;AACL,aAAO;QAAEK,OAAO;QAAMJ,MAAMD;MAAK;IACnC;EACF,SAASE,GAAG;AACV,QAAIjB,OAAOgB,MAAM;AACf,aAAO;QAAEI,OAAO;QAAOJ,MAAMK;MAAU;IACzC;EACF;AAEA,SAAO;IAAED,OAAO;IAAMJ,MAAMK;EAAU;AACxC;AAtBsBH;AAwBtB,SAASf,qBAAqBC,QAAoBJ,QAA0C;AAC1F,MAAI,CAACA,QAAQ;AACX,WAAO;EACT;AAEA,SAAOA,OAAOsB,SAASlB,MAAAA;AACzB;AANSD;;;AxB3DF,IAAMoB,eAAe;EAC1BC,0BAA0B;EAC1BC,wBAAwB;AAC1B;AAEO,IAAMC,oBAAoB;EAC/BC,gBAAgBJ,aAAaC;EAC7BI,uBAAuBL,aAAaC;AACtC;AAEO,SAASK,gBACdC,aACAC,SACS;AACT,MAAIA,YAAY,iBAAiBA,YAAY,WAAW;AACtD,WAAO;EACT;AAEA,QAAMC,mBAAmBN,kBAAkBI,WAAAA;AAE3C,MAAI,CAACE,kBAAkB;AACrB,WAAO;EACT;AAEA,SAAOD,WAAWC;AACpB;AAfgBH;","names":["logLevels","Logger","constructor","name","level","filteredKeys","jsonReplacer","additionalFields","indexOf","process","env","TRIGGER_LOG_LEVEL","createReplacer","filter","keys","satisfiesLogLevel","logLevel","setLevel","log","message","args","console","error","warn","info","debug","loggerFunction","structuredLog","structureArgs","safeJsonClone","timestamp","Date","JSON","stringify","replacer","key","value","toString","bigIntReplacer","_key","obj","parse","e","length","filterKeys","Array","isArray","map","item","filteredObj","Object","entries","includes","prettyPrintBytes","NODE_ENV","sizeInBytes","getSizeInBytes","toFixed","jsonString","window","Buffer","byteLength","TextEncoder","encode","import_zod","addMissingVersionField","val","version","ErrorWithStackSchema","z","object","message","string","name","optional","stack","SchemaErrorSchema","path","array","import_zod","stringPatternMatchers","z","object","$endsWith","string","$startsWith","$ignoreCaseEquals","EventMatcherSchema","union","array","number","boolean","$exists","$isNull","$anythingBut","$gt","$lt","$gte","$lte","$between","tuple","$includes","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","imageUrl","array","DisplayPropertiesSchema","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","context","error","parentId","style","StyleSchema","operation","callbackUrl","childExecutionMode","ServerTaskSchema","extend","idempotencyKey","attempts","number","forceYield","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","TriggerHelpSchema","noRuns","text","link","StaticTriggerMetadataSchema","union","rule","EventRuleSchema","help","InvokeTriggerMetadataSchema","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","import_zod","StringMatchSchema","z","union","array","string","stringPatternMatchers","HTTPMethodUnionSchema","literal","RequestFilterSchema","object","method","optional","headers","record","query","body","EventFilterSchema","ResponseFilterSchema","omit","extend","status","number","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","HttpSourceRequestHeadersSchema","transform","s","JSON","parse","undefined","json","HttpEndpointRequestHeadersSchema","PongSuccessResponseSchema","ok","triggerVersion","triggerSdkVersion","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","HttpEndpointMetadataSchema","title","icon","properties","DisplayPropertySchema","immediateResponseFilter","RequestFilterSchema","skipTriggeringRuns","IndexEndpointResponseSchema","sources","dynamicTriggers","dynamicSchedules","RegisterDynamicSchedulePayloadSchema","httpEndpoints","EndpointIndexErrorSchema","message","raw","IndexEndpointStatsSchema","disabledJobs","parseEndpointIndexStats","stats","GetEndpointIndexResponseSchema","status","updatedAt","coerce","date","EndpointHeadersSchema","ExecuteJobRunMetadataSchema","successSubscription","failedSubscription","ExecuteJobHeadersSchema","extend","val","RawEventSchema","payload","context","ulid","timestamp","payloadType","union","ApiEventLogSchema","nullable","deliverAt","deliveredAt","cancelledAt","SendEventOptionsSchema","deliverAfter","int","accountId","SendEventBodySchema","SendBulkEventsBodySchema","DeliverEventResponseSchema","datetime","RuntimeEnvironmentTypeSchema","RunSourceContextSchema","AutoYieldConfigSchema","startTaskThreshold","beforeExecuteTaskThreshold","beforeCompleteTaskThreshold","afterCompleteTaskThreshold","RunJobBodySchema","job","run","isTest","isRetry","startedAt","environment","slug","organization","project","account","tasks","CachedTaskSchema","cachedTaskCursor","noopTasksSet","connections","yieldedExecutions","runChunkExecutionLimit","autoYieldConfig","RunJobErrorSchema","ErrorWithStackSchema","task","TaskSchema","RunJobYieldExecutionErrorSchema","AutoYieldMetadataSchema","location","timeRemaining","timeElapsed","limit","RunJobAutoYieldExecutionErrorSchema","RunJobAutoYieldWithCompletedTaskExecutionErrorSchema","output","RunJobInvalidPayloadErrorSchema","errors","SchemaErrorSchema","RunJobUnresolvedAuthErrorSchema","issues","RunJobResumeWithTaskSchema","RunJobRetryWithTaskSchema","retryAt","RunJobCanceledWithTaskSchema","RunJobSuccessSchema","RunJobErrorResponseSchema","RunJobResumeWithParallelTaskSchema","childErrors","RunJobResponseSchema","PreprocessRunBodySchema","PreprocessRunResponseSchema","abort","CreateRunResponseOkSchema","CreateRunResponseErrorSchema","CreateRunResponseBodySchema","RedactStringSchema","__redactedString","strings","interpolations","LogMessageSchema","level","RedactSchema","paths","RetryOptionsSchema","factor","minTimeoutInMs","maxTimeoutInMs","randomize","RunTaskOptionsSchema","delayUntil","retry","displayKey","description","style","StyleSchema","callback","timeoutInSeconds","partial","connectionKey","operation","noop","redact","parallel","RunTaskBodyInputSchema","idempotencyKey","parentId","RunTaskBodyOutputSchema","RunTaskResponseWithCachedTasksBodySchema","ServerTaskSchema","cachedTasks","cursor","CompleteTaskBodyInputSchema","v","stringify","CompleteTaskBodyV2InputSchema","FailTaskBodyInputSchema","NormalizedRequestSchema","headers","method","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","InvokeJobResponseSchema","InvokeJobRequestBodySchema","callbackUrl","InvokeOptionsSchema","EphemeralEventDispatcherRequestBodySchema","or","filter","EventFilterSchema","contextFilter","positive","min","max","EphemeralEventDispatcherResponseBodySchema","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","bodyFilter","EventFilterSchema","optional","resetFormat","enum","default","FetchRetryBackoffStrategySchema","RetryOptionsSchema","extend","FetchRetryStrategySchema","discriminatedUnion","FetchRequestInitSchema","method","headers","record","union","RedactStringSchema","body","instanceof","ArrayBuffer","FetchRetryOptionsSchema","FetchTimeoutOptionsSchema","durationInMs","number","retry","FetchOperationSchema","url","requestInit","timeout","FetchPollOperationSchema","interval","int","positive","min","max","responseFilter","ResponseFilterSchema","requestTimeout","import_zod","GetEventSchema","z","object","id","string","name","createdAt","coerce","date","updatedAt","runs","array","status","RunStatusSchema","startedAt","optional","nullable","completedAt","CancelRunsForEventSchema","cancelledRunIds","failedToCancelRunIds","import_zod","RequestWithRawBodySchema","z","object","url","string","method","headers","record","rawBody","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","calculateResetAt","resets","format","calculateISO8601DurationOpenAIVariantResetAt","calculateISO8601ResetAt","calculateUnixTimestampResetAt","calculateUnixTimestampInMsResetAt","undefined","resetAt","parseInt","isNaN","getTime","pattern","match","days","hours","minutes","seconds","parseFloat","milliseconds","setDate","getDate","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","floor","setMilliseconds","getMilliseconds","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","undefined","Object","entries","length","patternKey","patternValue","payloadValue","Array","isArray","every","item","includes","objectArray","contentFiltersMatches","some","actualValue","contentFilters","contentFilter","key","value","contentFilterMatches","endsWith","$endsWith","startsWith","$startsWith","$anythingBut","$exists","$gt","$lt","$gte","$lte","$between","$includes","localeCompare","$ignoreCaseEquals","sensitivity","$isNull","requestFilterMatches","request","filter","clonedRequest","clone","requestMethodMatches","method","headers","eventFilterMatches","searchParams","URL","url","searchParamsObject","key","value","entries","query","json","body","e","responseFilterMatches","response","match","undefined","includes","API_VERSIONS","LAZY_LOADED_CACHED_TASKS","SERIALIZED_TASK_OUTPUT","PLATFORM_FEATURES","yieldExecution","lazyLoadedCachedTasks","supportsFeature","featureName","version","supportedVersion"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trigger.dev/core",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Core code used across the Trigger.dev SDK and platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "sideEffects": false,
22
22
  "dependencies": {
23
- "ulid": "^2.3.0",
23
+ "ulidx": "^2.2.1",
24
24
  "zod": "3.22.3",
25
25
  "zod-error": "1.5.0"
26
26
  },