@trigger.dev/core 0.0.0-v3-prerelease-20240717092755 → 0.0.0-v3-prerelease-20240730135037

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.
Files changed (47) hide show
  1. package/dist/{catalog-U7_q4XsM.d.mts → catalog-H7yFiZ60.d.mts} +1 -1
  2. package/dist/{catalog-bSnBE19I.d.ts → catalog-h79CG5Wy.d.ts} +1 -1
  3. package/dist/index.d.mts +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/{messages-CHPNqMXf.d.mts → messages-mhHZiNGN.d.mts} +202 -9
  6. package/dist/{messages-CHPNqMXf.d.ts → messages-mhHZiNGN.d.ts} +202 -9
  7. package/dist/retry.d.mts +1 -1
  8. package/dist/retry.d.ts +1 -1
  9. package/dist/schemas/index.d.mts +6 -6
  10. package/dist/schemas/index.d.ts +6 -6
  11. package/dist/{schemas-WHkFakb3.d.mts → schemas-C9ssfehv.d.mts} +47 -1
  12. package/dist/{schemas-WHkFakb3.d.ts → schemas-C9ssfehv.d.ts} +47 -1
  13. package/dist/v3/index.d.mts +49 -29
  14. package/dist/v3/index.d.ts +49 -29
  15. package/dist/v3/index.js +65 -9
  16. package/dist/v3/index.js.map +1 -1
  17. package/dist/v3/index.mjs +62 -10
  18. package/dist/v3/index.mjs.map +1 -1
  19. package/dist/v3/otel/index.js +1 -1
  20. package/dist/v3/otel/index.js.map +1 -1
  21. package/dist/v3/otel/index.mjs +1 -1
  22. package/dist/v3/otel/index.mjs.map +1 -1
  23. package/dist/v3/prod/index.d.mts +1 -1
  24. package/dist/v3/prod/index.d.ts +1 -1
  25. package/dist/v3/schemas/index.d.mts +166 -4
  26. package/dist/v3/schemas/index.d.ts +166 -4
  27. package/dist/v3/schemas/index.js +52 -8
  28. package/dist/v3/schemas/index.js.map +1 -1
  29. package/dist/v3/schemas/index.mjs +49 -9
  30. package/dist/v3/schemas/index.mjs.map +1 -1
  31. package/dist/v3/utils/ioSerialization.js +48 -4
  32. package/dist/v3/utils/ioSerialization.js.map +1 -1
  33. package/dist/v3/utils/ioSerialization.mjs +48 -4
  34. package/dist/v3/utils/ioSerialization.mjs.map +1 -1
  35. package/dist/v3/utils/retries.d.mts +1 -1
  36. package/dist/v3/utils/retries.d.ts +1 -1
  37. package/dist/v3/workers/index.d.mts +4 -4
  38. package/dist/v3/workers/index.d.ts +4 -4
  39. package/dist/v3/workers/index.js +48 -4
  40. package/dist/v3/workers/index.js.map +1 -1
  41. package/dist/v3/workers/index.mjs +48 -4
  42. package/dist/v3/workers/index.mjs.map +1 -1
  43. package/dist/v3/zodfetch.d.mts +1 -1
  44. package/dist/v3/zodfetch.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/dist/{api-a39zAY3E.d.mts → api-Pl9fxB8v.d.mts} +153 -153
  47. package/dist/{api--StDLb4h.d.ts → api-sNoooMbT.d.ts} +153 -153
@@ -1,4 +1,4 @@
1
- import { R as RetryOptions } from '../../schemas-WHkFakb3.mjs';
1
+ import { R as RetryOptions } from '../../schemas-C9ssfehv.mjs';
2
2
  import 'zod';
3
3
 
4
4
  declare const defaultRetryOptions: {
@@ -1,4 +1,4 @@
1
- import { R as RetryOptions } from '../../schemas-WHkFakb3.js';
1
+ import { R as RetryOptions } from '../../schemas-C9ssfehv.js';
2
2
  import 'zod';
3
3
 
4
4
  declare const defaultRetryOptions: {
@@ -2,10 +2,10 @@ import * as logsAPI from '@opentelemetry/api-logs';
2
2
  import { TracingSDK } from '../otel/index.mjs';
3
3
  export { TracingDiagnosticLogLevel, recordSpanException } from '../otel/index.mjs';
4
4
  import { c as TaskRunExecution, T as TaskRunExecutionResult } from '../../common-CLW82lkt.mjs';
5
- import { B as BackgroundWorkerProperties } from '../../messages-CHPNqMXf.mjs';
6
- import { C as Config, a as TaskFileMetadata, b as TaskMetadataWithFilePath } from '../../schemas-WHkFakb3.mjs';
7
- import { P as ProjectConfig, H as HandleErrorFunction, T as TaskMetadataWithFunctions, U as UsageMeasurement, C as Clock, a as ClockTime, b as TaskCatalog, c as UsageManager, d as UsageSample } from '../../catalog-U7_q4XsM.mjs';
8
- export { u as usage } from '../../catalog-U7_q4XsM.mjs';
5
+ import { B as BackgroundWorkerProperties } from '../../messages-mhHZiNGN.mjs';
6
+ import { C as Config, a as TaskFileMetadata, b as TaskMetadataWithFilePath } from '../../schemas-C9ssfehv.mjs';
7
+ import { P as ProjectConfig, H as HandleErrorFunction, T as TaskMetadataWithFunctions, U as UsageMeasurement, C as Clock, a as ClockTime, b as TaskCatalog, c as UsageManager, d as UsageSample } from '../../catalog-H7yFiZ60.mjs';
8
+ export { u as usage } from '../../catalog-H7yFiZ60.mjs';
9
9
  import { T as TriggerTracer } from '../../tracer-N0p2Fuuv.mjs';
10
10
  export { R as RuntimeManager } from '../../manager-KvCabW1a.mjs';
11
11
  import { PreciseDate } from '@google-cloud/precise-date';
@@ -2,10 +2,10 @@ import * as logsAPI from '@opentelemetry/api-logs';
2
2
  import { TracingSDK } from '../otel/index.js';
3
3
  export { TracingDiagnosticLogLevel, recordSpanException } from '../otel/index.js';
4
4
  import { c as TaskRunExecution, T as TaskRunExecutionResult } from '../../common-CLW82lkt.js';
5
- import { B as BackgroundWorkerProperties } from '../../messages-CHPNqMXf.js';
6
- import { C as Config, a as TaskFileMetadata, b as TaskMetadataWithFilePath } from '../../schemas-WHkFakb3.js';
7
- import { P as ProjectConfig, H as HandleErrorFunction, T as TaskMetadataWithFunctions, U as UsageMeasurement, C as Clock, a as ClockTime, b as TaskCatalog, c as UsageManager, d as UsageSample } from '../../catalog-bSnBE19I.js';
8
- export { u as usage } from '../../catalog-bSnBE19I.js';
5
+ import { B as BackgroundWorkerProperties } from '../../messages-mhHZiNGN.js';
6
+ import { C as Config, a as TaskFileMetadata, b as TaskMetadataWithFilePath } from '../../schemas-C9ssfehv.js';
7
+ import { P as ProjectConfig, H as HandleErrorFunction, T as TaskMetadataWithFunctions, U as UsageMeasurement, C as Clock, a as ClockTime, b as TaskCatalog, c as UsageManager, d as UsageSample } from '../../catalog-h79CG5Wy.js';
8
+ export { u as usage } from '../../catalog-h79CG5Wy.js';
9
9
  import { T as TriggerTracer } from '../../tracer-N0p2Fuuv.js';
10
10
  export { R as RuntimeManager } from '../../manager-OBA35PzR.js';
11
11
  import { PreciseDate } from '@google-cloud/precise-date';
@@ -406,7 +406,7 @@ function getEnvVar(name) {
406
406
  __name(getEnvVar, "getEnvVar");
407
407
 
408
408
  // package.json
409
- var version = "0.0.0-v3-prerelease-20240717092755";
409
+ var version = "0.0.0-v3-prerelease-20240730135037";
410
410
 
411
411
  // src/v3/otel/tracingSDK.ts
412
412
  var _a;
@@ -892,13 +892,18 @@ var QueueOptions = zod.z.object({
892
892
  /** @deprecated This feature is coming soon */
893
893
  rateLimit: RateLimitOptions.optional()
894
894
  });
895
+ var ScheduleMetadata = zod.z.object({
896
+ cron: zod.z.string(),
897
+ timezone: zod.z.string()
898
+ });
895
899
  zod.z.object({
896
900
  id: zod.z.string(),
897
901
  packageVersion: zod.z.string(),
898
902
  queue: QueueOptions.optional(),
899
903
  retry: RetryOptions.optional(),
900
904
  machine: MachineConfig.optional(),
901
- triggerSource: zod.z.string().optional()
905
+ triggerSource: zod.z.string().optional(),
906
+ schedule: ScheduleMetadata.optional()
902
907
  });
903
908
  zod.z.object({
904
909
  filePath: zod.z.string(),
@@ -911,6 +916,7 @@ zod.z.object({
911
916
  retry: RetryOptions.optional(),
912
917
  machine: MachineConfig.optional(),
913
918
  triggerSource: zod.z.string().optional(),
919
+ schedule: ScheduleMetadata.optional(),
914
920
  filePath: zod.z.string(),
915
921
  exportName: zod.z.string()
916
922
  });
@@ -972,7 +978,8 @@ var TaskResource = zod.z.object({
972
978
  queue: QueueOptions.optional(),
973
979
  retry: RetryOptions.optional(),
974
980
  machine: MachineConfig.optional(),
975
- triggerSource: zod.z.string().optional()
981
+ triggerSource: zod.z.string().optional(),
982
+ schedule: ScheduleMetadata.optional()
976
983
  });
977
984
  var BackgroundWorkerMetadata = zod.z.object({
978
985
  packageVersion: zod.z.string(),
@@ -1020,6 +1027,11 @@ zod.z.object({
1020
1027
  version: zod.z.string(),
1021
1028
  contentHash: zod.z.string()
1022
1029
  });
1030
+ var RunTag = zod.z.string().max(64, "Tags must be less than 64 characters");
1031
+ var RunTags = zod.z.union([
1032
+ RunTag,
1033
+ RunTag.array().max(3, "You can only set a maximum of 3 tags on a run.")
1034
+ ]);
1023
1035
  var TriggerTaskRequestBody = zod.z.object({
1024
1036
  payload: zod.z.any(),
1025
1037
  context: zod.z.any(),
@@ -1034,6 +1046,7 @@ var TriggerTaskRequestBody = zod.z.object({
1034
1046
  payloadType: zod.z.string().optional(),
1035
1047
  delay: zod.z.string().or(zod.z.coerce.date()).optional(),
1036
1048
  ttl: zod.z.string().or(zod.z.number().nonnegative().int()).optional(),
1049
+ tags: RunTags.optional(),
1037
1050
  maxAttempts: zod.z.number().int().optional()
1038
1051
  }).optional()
1039
1052
  });
@@ -1061,6 +1074,9 @@ zod.z.object({
1061
1074
  ])
1062
1075
  }))
1063
1076
  });
1077
+ zod.z.object({
1078
+ tags: RunTags
1079
+ });
1064
1080
  zod.z.object({
1065
1081
  delay: zod.z.string().or(zod.z.coerce.date())
1066
1082
  });
@@ -1135,10 +1151,21 @@ var ReplayRunResponse = zod.z.object({
1135
1151
  var CanceledRunResponse = zod.z.object({
1136
1152
  id: zod.z.string()
1137
1153
  });
1154
+ var ScheduleType = zod.z.union([
1155
+ zod.z.literal("DECLARATIVE"),
1156
+ zod.z.literal("IMPERATIVE")
1157
+ ]);
1138
1158
  zod.z.object({
1139
1159
  /** The schedule id associated with this run (you can have many schedules for the same task).
1140
1160
  You can use this to remove the schedule, update it, etc */
1141
1161
  scheduleId: zod.z.string(),
1162
+ /** The type of schedule – `"DECLARATIVE"` or `"IMPERATIVE"`.
1163
+ *
1164
+ * **DECLARATIVE** – defined inline on your `schedules.task` using the `cron` property. They can only be created, updated or deleted by modifying the `cron` property on your task.
1165
+ *
1166
+ * **IMPERATIVE** – created using the `schedules.create` functions or in the dashboard.
1167
+ */
1168
+ type: ScheduleType,
1142
1169
  /** When the task was scheduled to run.
1143
1170
  * Note this will be slightly different from `new Date()` because it takes a few ms to run the task.
1144
1171
  *
@@ -1214,6 +1241,7 @@ var ScheduleGenerator = zod.z.object({
1214
1241
  });
1215
1242
  var ScheduleObject = zod.z.object({
1216
1243
  id: zod.z.string(),
1244
+ type: ScheduleType,
1217
1245
  task: zod.z.string(),
1218
1246
  active: zod.z.boolean(),
1219
1247
  deduplicationKey: zod.z.string().nullish(),
@@ -1311,7 +1339,11 @@ var CommonRunFields = {
1311
1339
  finishedAt: zod.z.coerce.date().optional(),
1312
1340
  delayedUntil: zod.z.coerce.date().optional(),
1313
1341
  ttl: zod.z.string().optional(),
1314
- expiredAt: zod.z.coerce.date().optional()
1342
+ expiredAt: zod.z.coerce.date().optional(),
1343
+ tags: zod.z.string().array(),
1344
+ costInCents: zod.z.number(),
1345
+ baseCostInCents: zod.z.number(),
1346
+ durationMs: zod.z.number()
1315
1347
  };
1316
1348
  var RetrieveRunResponse = zod.z.object({
1317
1349
  ...CommonRunFields,
@@ -2138,6 +2170,15 @@ var _ApiClient = class _ApiClient {
2138
2170
  body: JSON.stringify(body)
2139
2171
  }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2140
2172
  }
2173
+ addTags(runId, body, requestOptions) {
2174
+ return zodfetch(zod.z.object({
2175
+ message: zod.z.string()
2176
+ }), `${this.baseUrl}/api/v1/runs/${runId}/tags`, {
2177
+ method: "POST",
2178
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2179
+ body: JSON.stringify(body)
2180
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2181
+ }
2141
2182
  createSchedule(options, requestOptions) {
2142
2183
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules`, {
2143
2184
  method: "POST",
@@ -2265,6 +2306,9 @@ function createSearchQueryForListRuns(query) {
2265
2306
  if (query.bulkAction) {
2266
2307
  searchParams.append("filter[bulkAction]", query.bulkAction);
2267
2308
  }
2309
+ if (query.tag) {
2310
+ searchParams.append("filter[tag]", Array.isArray(query.tag) ? query.tag.join(",") : query.tag);
2311
+ }
2268
2312
  if (query.schedule) {
2269
2313
  searchParams.append("filter[schedule]", query.schedule);
2270
2314
  }