@trigger.dev/sdk 2.0.0-next.13 → 2.0.0-next.14

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
@@ -64,6 +64,19 @@ declare const ServerTaskSchema: z.ZodObject<{
64
64
  text: string;
65
65
  url?: string | undefined;
66
66
  }>, "many">>>;
67
+ outputProperties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
68
+ label: z.ZodString;
69
+ text: z.ZodString;
70
+ url: z.ZodOptional<z.ZodString>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ label: string;
73
+ text: string;
74
+ url?: string | undefined;
75
+ }, {
76
+ label: string;
77
+ text: string;
78
+ url?: string | undefined;
79
+ }>, "many">>>;
67
80
  output: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
68
81
  error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
69
82
  parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -98,6 +111,11 @@ declare const ServerTaskSchema: z.ZodObject<{
98
111
  text: string;
99
112
  url?: string | undefined;
100
113
  }[] | null | undefined;
114
+ outputProperties?: {
115
+ label: string;
116
+ text: string;
117
+ url?: string | undefined;
118
+ }[] | null | undefined;
101
119
  output?: DeserializedJson | undefined;
102
120
  error?: string | null | undefined;
103
121
  parentId?: string | null | undefined;
@@ -124,6 +142,11 @@ declare const ServerTaskSchema: z.ZodObject<{
124
142
  text: string;
125
143
  url?: string | undefined;
126
144
  }[] | null | undefined;
145
+ outputProperties?: {
146
+ label: string;
147
+ text: string;
148
+ url?: string | undefined;
149
+ }[] | null | undefined;
127
150
  output?: DeserializedJson | undefined;
128
151
  error?: string | null | undefined;
129
152
  parentId?: string | null | undefined;
@@ -157,6 +180,10 @@ declare const CachedTaskSchema: z.ZodObject<{
157
180
  parentId?: string | null | undefined;
158
181
  }>;
159
182
 
183
+ type Prettify<T> = {
184
+ [K in keyof T]: T[K];
185
+ } & {};
186
+
160
187
  declare const UpdateTriggerSourceBodySchema: z.ZodObject<{
161
188
  registeredEvents: z.ZodArray<z.ZodString, "many">;
162
189
  secret: z.ZodOptional<z.ZodString>;
@@ -2227,7 +2254,7 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<{
2227
2254
  }[] | undefined;
2228
2255
  output?: SerializableJson;
2229
2256
  }>;
2230
- type CompleteTaskBodyInput = z.input<typeof CompleteTaskBodyInputSchema>;
2257
+ type CompleteTaskBodyInput = Prettify<z.input<typeof CompleteTaskBodyInputSchema>>;
2231
2258
  declare const FailTaskBodyInputSchema: z.ZodObject<{
2232
2259
  error: z.ZodObject<{
2233
2260
  message: z.ZodString;
@@ -3111,10 +3138,6 @@ declare const FetchRetryOptionsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminat
3111
3138
  */
3112
3139
  type FetchRetryOptions = z.infer<typeof FetchRetryOptionsSchema>;
3113
3140
 
3114
- type Prettify<T> = {
3115
- [K in keyof T]: T[K];
3116
- } & {};
3117
-
3118
3141
  type ApiClientOptions = {
3119
3142
  apiKey?: string;
3120
3143
  apiUrl?: string;
@@ -3159,6 +3182,11 @@ declare class ApiClient {
3159
3182
  text: string;
3160
3183
  url?: string | undefined;
3161
3184
  }[] | null | undefined;
3185
+ outputProperties?: {
3186
+ label: string;
3187
+ text: string;
3188
+ url?: string | undefined;
3189
+ }[] | null | undefined;
3162
3190
  output?: DeserializedJson | undefined;
3163
3191
  error?: string | null | undefined;
3164
3192
  parentId?: string | null | undefined;
@@ -3186,6 +3214,11 @@ declare class ApiClient {
3186
3214
  text: string;
3187
3215
  url?: string | undefined;
3188
3216
  }[] | null | undefined;
3217
+ outputProperties?: {
3218
+ label: string;
3219
+ text: string;
3220
+ url?: string | undefined;
3221
+ }[] | null | undefined;
3189
3222
  output?: DeserializedJson | undefined;
3190
3223
  error?: string | null | undefined;
3191
3224
  parentId?: string | null | undefined;
@@ -3213,6 +3246,11 @@ declare class ApiClient {
3213
3246
  text: string;
3214
3247
  url?: string | undefined;
3215
3248
  }[] | null | undefined;
3249
+ outputProperties?: {
3250
+ label: string;
3251
+ text: string;
3252
+ url?: string | undefined;
3253
+ }[] | null | undefined;
3216
3254
  output?: DeserializedJson | undefined;
3217
3255
  error?: string | null | undefined;
3218
3256
  parentId?: string | null | undefined;
@@ -3936,7 +3974,7 @@ declare class IO {
3936
3974
  retryAt: Date;
3937
3975
  error?: Error;
3938
3976
  jitter?: number;
3939
- } | undefined | void): Promise<TResult>;
3977
+ } | Error | undefined | void): Promise<TResult>;
3940
3978
  /** `io.try()` allows you to run Tasks and catch any errors that are thrown, it's similar to a normal `try/catch` block but works with [io.runTask()](/sdk/io/runtask).
3941
3979
  * A regular `try/catch` block on its own won't work as expected with Tasks. Internally `runTask()` throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks.
3942
3980
  * @param tryCallback The code you wish to run
@@ -3983,7 +4021,7 @@ type AuthenticatedTask<TClient, TParams, TResult, TAuth = ConnectionAuth> = {
3983
4021
  onError?: (error: unknown, task: ServerTask) => {
3984
4022
  retryAt: Date;
3985
4023
  error?: Error;
3986
- } | undefined | void;
4024
+ } | Error | undefined | void;
3987
4025
  };
3988
4026
  declare function authenticatedTask<TClient, TParams, TResult>(options: {
3989
4027
  run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
package/dist/index.js CHANGED
@@ -430,6 +430,7 @@ var TaskSchema = import_zod7.z.object({
430
430
  status: TaskStatusSchema,
431
431
  description: import_zod7.z.string().optional().nullable(),
432
432
  properties: import_zod7.z.array(DisplayPropertySchema).optional().nullable(),
433
+ outputProperties: import_zod7.z.array(DisplayPropertySchema).optional().nullable(),
433
434
  params: DeserializedJsonSchema.optional().nullable(),
434
435
  output: DeserializedJsonSchema.optional().nullable(),
435
436
  error: import_zod7.z.string().optional().nullable(),
@@ -1708,7 +1709,8 @@ var IO = class {
1708
1709
  task
1709
1710
  });
1710
1711
  await this._apiClient.completeTask(this._id, task.id, {
1711
- output: result ?? void 0
1712
+ output: result ?? void 0,
1713
+ properties: task.outputProperties ?? void 0
1712
1714
  });
1713
1715
  return result;
1714
1716
  } catch (error) {
@@ -1718,10 +1720,14 @@ var IO = class {
1718
1720
  if (onError) {
1719
1721
  const onErrorResult = onError(error, task, this);
1720
1722
  if (onErrorResult) {
1721
- const parsedError2 = ErrorWithStackSchema.safeParse(onErrorResult.error);
1722
- throw new RetryWithTaskError(parsedError2.success ? parsedError2.data : {
1723
- message: "Unknown error"
1724
- }, task, onErrorResult.retryAt);
1723
+ if (onErrorResult instanceof Error) {
1724
+ error = onErrorResult;
1725
+ } else {
1726
+ const parsedError2 = ErrorWithStackSchema.safeParse(onErrorResult.error);
1727
+ throw new RetryWithTaskError(parsedError2.success ? parsedError2.data : {
1728
+ message: "Unknown error"
1729
+ }, task, onErrorResult.retryAt);
1730
+ }
1725
1731
  }
1726
1732
  }
1727
1733
  const parsedError = ErrorWithStackSchema.safeParse(error);