@trigger.dev/core 3.0.0-beta.42 → 3.0.0-beta.43

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.
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ var humanizeDuration = require('humanize-duration');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var humanizeDuration__default = /*#__PURE__*/_interopDefault(humanizeDuration);
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
+ function dateDifference(date1, date2) {
12
+ return Math.abs(date1.getTime() - date2.getTime());
13
+ }
14
+ __name(dateDifference, "dateDifference");
15
+ function formatDuration(start, end, options) {
16
+ if (!start || !end) {
17
+ return "\u2013";
18
+ }
19
+ return formatDurationMilliseconds(dateDifference(start, end), options);
20
+ }
21
+ __name(formatDuration, "formatDuration");
22
+ function nanosecondsToMilliseconds(nanoseconds) {
23
+ return nanoseconds / 1e6;
24
+ }
25
+ __name(nanosecondsToMilliseconds, "nanosecondsToMilliseconds");
26
+ function millisecondsToNanoseconds(milliseconds) {
27
+ return milliseconds * 1e6;
28
+ }
29
+ __name(millisecondsToNanoseconds, "millisecondsToNanoseconds");
30
+ function formatDurationNanoseconds(nanoseconds, options) {
31
+ return formatDurationMilliseconds(nanosecondsToMilliseconds(nanoseconds), options);
32
+ }
33
+ __name(formatDurationNanoseconds, "formatDurationNanoseconds");
34
+ var aboveOneSecondUnits = [
35
+ "d",
36
+ "h",
37
+ "m",
38
+ "s"
39
+ ];
40
+ var belowOneSecondUnits = [
41
+ "ms"
42
+ ];
43
+ function formatDurationMilliseconds(milliseconds, options) {
44
+ let duration = humanizeDuration__default.default(milliseconds, {
45
+ units: options?.units ? options.units : milliseconds < 1e3 ? belowOneSecondUnits : aboveOneSecondUnits,
46
+ maxDecimalPoints: options?.maxDecimalPoints ?? 1,
47
+ largest: 2
48
+ });
49
+ if (!options) {
50
+ return duration;
51
+ }
52
+ switch (options.style) {
53
+ case "short":
54
+ duration = duration.replace(" milliseconds", "ms");
55
+ duration = duration.replace(" millisecond", "ms");
56
+ duration = duration.replace(" seconds", "s");
57
+ duration = duration.replace(" second", "s");
58
+ duration = duration.replace(" minutes", "m");
59
+ duration = duration.replace(" minute", "m");
60
+ duration = duration.replace(" hours", "h");
61
+ duration = duration.replace(" hour", "h");
62
+ duration = duration.replace(" days", "d");
63
+ duration = duration.replace(" day", "d");
64
+ duration = duration.replace(" weeks", "w");
65
+ duration = duration.replace(" week", "w");
66
+ duration = duration.replace(" months", "mo");
67
+ duration = duration.replace(" month", "mo");
68
+ duration = duration.replace(" years", "y");
69
+ duration = duration.replace(" year", "y");
70
+ }
71
+ return duration;
72
+ }
73
+ __name(formatDurationMilliseconds, "formatDurationMilliseconds");
74
+ function formatDurationInDays(milliseconds) {
75
+ let duration = humanizeDuration__default.default(milliseconds, {
76
+ maxDecimalPoints: 0,
77
+ largest: 2,
78
+ units: [
79
+ "d"
80
+ ]
81
+ });
82
+ return duration;
83
+ }
84
+ __name(formatDurationInDays, "formatDurationInDays");
85
+
86
+ exports.formatDuration = formatDuration;
87
+ exports.formatDurationInDays = formatDurationInDays;
88
+ exports.formatDurationMilliseconds = formatDurationMilliseconds;
89
+ exports.formatDurationNanoseconds = formatDurationNanoseconds;
90
+ exports.millisecondsToNanoseconds = millisecondsToNanoseconds;
91
+ exports.nanosecondsToMilliseconds = nanosecondsToMilliseconds;
92
+ //# sourceMappingURL=out.js.map
93
+ //# sourceMappingURL=durations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/v3/utils/durations.ts"],"names":["humanizeDuration","dateDifference","date1","date2","Math","abs","getTime","formatDuration","start","end","options","formatDurationMilliseconds","nanosecondsToMilliseconds","nanoseconds","millisecondsToNanoseconds","milliseconds","formatDurationNanoseconds","aboveOneSecondUnits","belowOneSecondUnits","duration","units","maxDecimalPoints","largest","style","replace","formatDurationInDays"],"mappings":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K,QAAQ,SAAS,GAAA;AACrCL,iBAAWA,SAASK,QAAQ,QAAQ,GAAA;AACpCL,iBAAWA,SAASK,QAAQ,UAAU,GAAA;AACtCL,iBAAWA,SAASK,QAAQ,SAAS,GAAA;AACrCL,iBAAWA,SAASK,QAAQ,WAAW,IAAA;AACvCL,iBAAWA,SAASK,QAAQ,UAAU,IAAA;AACtCL,iBAAWA,SAASK,QAAQ,UAAU,GAAA;AACtCL,iBAAWA,SAASK,QAAQ,SAAS,GAAA;EACzC;AAEA,SAAOL;AACT;AAvCgBR;AAyCT,SAASc,qBAAqBV,cAA8B;AACjE,MAAII,WAAWnB,iBAAiBe,cAAc;IAC5CM,kBAAkB;IAClBC,SAAS;IACTF,OAAO;MAAC;;EACV,CAAA;AAEA,SAAOD;AACT;AARgBM","sourcesContent":["import humanizeDuration, { Unit } from \"humanize-duration\";\n\nfunction dateDifference(date1: Date, date2: Date) {\n return Math.abs(date1.getTime() - date2.getTime());\n}\n\ntype DurationOptions = {\n style?: \"long\" | \"short\";\n maxDecimalPoints?: number;\n units?: Unit[];\n};\n\nexport function formatDuration(\n start?: Date | null,\n end?: Date | null,\n options?: DurationOptions\n): string {\n if (!start || !end) {\n return \"–\";\n }\n\n return formatDurationMilliseconds(dateDifference(start, end), options);\n}\n\nexport function nanosecondsToMilliseconds(nanoseconds: number): number {\n return nanoseconds / 1_000_000;\n}\n\nexport function millisecondsToNanoseconds(milliseconds: number): number {\n return milliseconds * 1_000_000;\n}\n\nexport function formatDurationNanoseconds(nanoseconds: number, options?: DurationOptions): string {\n return formatDurationMilliseconds(nanosecondsToMilliseconds(nanoseconds), options);\n}\n\nconst aboveOneSecondUnits = [\"d\", \"h\", \"m\", \"s\"] as Unit[];\nconst belowOneSecondUnits = [\"ms\"] as Unit[];\n\nexport function formatDurationMilliseconds(\n milliseconds: number,\n options?: DurationOptions\n): string {\n let duration = humanizeDuration(milliseconds, {\n units: options?.units\n ? options.units\n : milliseconds < 1000\n ? belowOneSecondUnits\n : aboveOneSecondUnits,\n maxDecimalPoints: options?.maxDecimalPoints ?? 1,\n largest: 2,\n });\n\n if (!options) {\n return duration;\n }\n\n switch (options.style) {\n case \"short\":\n duration = duration.replace(\" milliseconds\", \"ms\");\n duration = duration.replace(\" millisecond\", \"ms\");\n duration = duration.replace(\" seconds\", \"s\");\n duration = duration.replace(\" second\", \"s\");\n duration = duration.replace(\" minutes\", \"m\");\n duration = duration.replace(\" minute\", \"m\");\n duration = duration.replace(\" hours\", \"h\");\n duration = duration.replace(\" hour\", \"h\");\n duration = duration.replace(\" days\", \"d\");\n duration = duration.replace(\" day\", \"d\");\n duration = duration.replace(\" weeks\", \"w\");\n duration = duration.replace(\" week\", \"w\");\n duration = duration.replace(\" months\", \"mo\");\n duration = duration.replace(\" month\", \"mo\");\n duration = duration.replace(\" years\", \"y\");\n duration = duration.replace(\" year\", \"y\");\n }\n\n return duration;\n}\n\nexport function formatDurationInDays(milliseconds: number): string {\n let duration = humanizeDuration(milliseconds, {\n maxDecimalPoints: 0,\n largest: 2,\n units: [\"d\"],\n });\n\n return duration;\n}\n"]}
@@ -0,0 +1,82 @@
1
+ import humanizeDuration from 'humanize-duration';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ function dateDifference(date1, date2) {
6
+ return Math.abs(date1.getTime() - date2.getTime());
7
+ }
8
+ __name(dateDifference, "dateDifference");
9
+ function formatDuration(start, end, options) {
10
+ if (!start || !end) {
11
+ return "\u2013";
12
+ }
13
+ return formatDurationMilliseconds(dateDifference(start, end), options);
14
+ }
15
+ __name(formatDuration, "formatDuration");
16
+ function nanosecondsToMilliseconds(nanoseconds) {
17
+ return nanoseconds / 1e6;
18
+ }
19
+ __name(nanosecondsToMilliseconds, "nanosecondsToMilliseconds");
20
+ function millisecondsToNanoseconds(milliseconds) {
21
+ return milliseconds * 1e6;
22
+ }
23
+ __name(millisecondsToNanoseconds, "millisecondsToNanoseconds");
24
+ function formatDurationNanoseconds(nanoseconds, options) {
25
+ return formatDurationMilliseconds(nanosecondsToMilliseconds(nanoseconds), options);
26
+ }
27
+ __name(formatDurationNanoseconds, "formatDurationNanoseconds");
28
+ var aboveOneSecondUnits = [
29
+ "d",
30
+ "h",
31
+ "m",
32
+ "s"
33
+ ];
34
+ var belowOneSecondUnits = [
35
+ "ms"
36
+ ];
37
+ function formatDurationMilliseconds(milliseconds, options) {
38
+ let duration = humanizeDuration(milliseconds, {
39
+ units: options?.units ? options.units : milliseconds < 1e3 ? belowOneSecondUnits : aboveOneSecondUnits,
40
+ maxDecimalPoints: options?.maxDecimalPoints ?? 1,
41
+ largest: 2
42
+ });
43
+ if (!options) {
44
+ return duration;
45
+ }
46
+ switch (options.style) {
47
+ case "short":
48
+ duration = duration.replace(" milliseconds", "ms");
49
+ duration = duration.replace(" millisecond", "ms");
50
+ duration = duration.replace(" seconds", "s");
51
+ duration = duration.replace(" second", "s");
52
+ duration = duration.replace(" minutes", "m");
53
+ duration = duration.replace(" minute", "m");
54
+ duration = duration.replace(" hours", "h");
55
+ duration = duration.replace(" hour", "h");
56
+ duration = duration.replace(" days", "d");
57
+ duration = duration.replace(" day", "d");
58
+ duration = duration.replace(" weeks", "w");
59
+ duration = duration.replace(" week", "w");
60
+ duration = duration.replace(" months", "mo");
61
+ duration = duration.replace(" month", "mo");
62
+ duration = duration.replace(" years", "y");
63
+ duration = duration.replace(" year", "y");
64
+ }
65
+ return duration;
66
+ }
67
+ __name(formatDurationMilliseconds, "formatDurationMilliseconds");
68
+ function formatDurationInDays(milliseconds) {
69
+ let duration = humanizeDuration(milliseconds, {
70
+ maxDecimalPoints: 0,
71
+ largest: 2,
72
+ units: [
73
+ "d"
74
+ ]
75
+ });
76
+ return duration;
77
+ }
78
+ __name(formatDurationInDays, "formatDurationInDays");
79
+
80
+ export { formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, millisecondsToNanoseconds, nanosecondsToMilliseconds };
81
+ //# sourceMappingURL=out.js.map
82
+ //# sourceMappingURL=durations.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/v3/utils/durations.ts"],"names":["humanizeDuration","dateDifference","date1","date2","Math","abs","getTime","formatDuration","start","end","options","formatDurationMilliseconds","nanosecondsToMilliseconds","nanoseconds","millisecondsToNanoseconds","milliseconds","formatDurationNanoseconds","aboveOneSecondUnits","belowOneSecondUnits","duration","units","maxDecimalPoints","largest","style","replace","formatDurationInDays"],"mappings":";;;;AAAA,OAAOA,sBAAgC;AAEvC,SAASC,eAAeC,OAAaC,OAAa;AAChD,SAAOC,KAAKC,IAAIH,MAAMI,QAAO,IAAKH,MAAMG,QAAO,CAAA;AACjD;AAFSL;AAUF,SAASM,eACdC,OACAC,KACAC,SACQ;AACR,MAAI,CAACF,SAAS,CAACC,KAAK;AAClB,WAAO;EACT;AAEA,SAAOE,2BAA2BV,eAAeO,OAAOC,GAAAA,GAAMC,OAAAA;AAChE;AAVgBH;AAYT,SAASK,0BAA0BC,aAA6B;AACrE,SAAOA,cAAc;AACvB;AAFgBD;AAIT,SAASE,0BAA0BC,cAA8B;AACtE,SAAOA,eAAe;AACxB;AAFgBD;AAIT,SAASE,0BAA0BH,aAAqBH,SAAmC;AAChG,SAAOC,2BAA2BC,0BAA0BC,WAAAA,GAAcH,OAAAA;AAC5E;AAFgBM;AAIhB,IAAMC,sBAAsB;EAAC;EAAK;EAAK;EAAK;;AAC5C,IAAMC,sBAAsB;EAAC;;AAEtB,SAASP,2BACdI,cACAL,SACQ;AACR,MAAIS,WAAWnB,iBAAiBe,cAAc;IAC5CK,OAAOV,SAASU,QACZV,QAAQU,QACRL,eAAe,MACfG,sBACAD;IACJI,kBAAkBX,SAASW,oBAAoB;IAC/CC,SAAS;EACX,CAAA;AAEA,MAAI,CAACZ,SAAS;AACZ,WAAOS;EACT;AAEA,UAAQT,QAAQa,OAAK;IACnB,KAAK;AACHJ,iBAAWA,SAASK,QAAQ,iBAAiB,IAAA;AAC7CL,iBAAWA,SAASK,QAAQ,gBAAgB,IAAA;AAC5CL,iBAAWA,SAASK,QAAQ,YAAY,GAAA;AACxCL,iBAAWA,SAASK,QAAQ,WAAW,GAAA;AACvCL,iBAAWA,SAASK,QAAQ,YAAY,GAAA;AACxCL,iBAAWA,SAASK,QAAQ,WAAW,GAAA;AACvCL,iBAAWA,SAASK,QAAQ,UAAU,GAAA;AACtCL,iBAAWA,SAASK,QAAQ,SAAS,GAAA;AACrCL,iBAAWA,SAASK,QAAQ,SAAS,GAAA;AACrCL,iBAAWA,SAASK,QAAQ,QAAQ,GAAA;AACpCL,iBAAWA,SAASK,QAAQ,UAAU,GAAA;AACtCL,iBAAWA,SAASK,QAAQ,SAAS,GAAA;AACrCL,iBAAWA,SAASK,QAAQ,WAAW,IAAA;AACvCL,iBAAWA,SAASK,QAAQ,UAAU,IAAA;AACtCL,iBAAWA,SAASK,QAAQ,UAAU,GAAA;AACtCL,iBAAWA,SAASK,QAAQ,SAAS,GAAA;EACzC;AAEA,SAAOL;AACT;AAvCgBR;AAyCT,SAASc,qBAAqBV,cAA8B;AACjE,MAAII,WAAWnB,iBAAiBe,cAAc;IAC5CM,kBAAkB;IAClBC,SAAS;IACTF,OAAO;MAAC;;EACV,CAAA;AAEA,SAAOD;AACT;AARgBM","sourcesContent":["import humanizeDuration, { Unit } from \"humanize-duration\";\n\nfunction dateDifference(date1: Date, date2: Date) {\n return Math.abs(date1.getTime() - date2.getTime());\n}\n\ntype DurationOptions = {\n style?: \"long\" | \"short\";\n maxDecimalPoints?: number;\n units?: Unit[];\n};\n\nexport function formatDuration(\n start?: Date | null,\n end?: Date | null,\n options?: DurationOptions\n): string {\n if (!start || !end) {\n return \"–\";\n }\n\n return formatDurationMilliseconds(dateDifference(start, end), options);\n}\n\nexport function nanosecondsToMilliseconds(nanoseconds: number): number {\n return nanoseconds / 1_000_000;\n}\n\nexport function millisecondsToNanoseconds(milliseconds: number): number {\n return milliseconds * 1_000_000;\n}\n\nexport function formatDurationNanoseconds(nanoseconds: number, options?: DurationOptions): string {\n return formatDurationMilliseconds(nanosecondsToMilliseconds(nanoseconds), options);\n}\n\nconst aboveOneSecondUnits = [\"d\", \"h\", \"m\", \"s\"] as Unit[];\nconst belowOneSecondUnits = [\"ms\"] as Unit[];\n\nexport function formatDurationMilliseconds(\n milliseconds: number,\n options?: DurationOptions\n): string {\n let duration = humanizeDuration(milliseconds, {\n units: options?.units\n ? options.units\n : milliseconds < 1000\n ? belowOneSecondUnits\n : aboveOneSecondUnits,\n maxDecimalPoints: options?.maxDecimalPoints ?? 1,\n largest: 2,\n });\n\n if (!options) {\n return duration;\n }\n\n switch (options.style) {\n case \"short\":\n duration = duration.replace(\" milliseconds\", \"ms\");\n duration = duration.replace(\" millisecond\", \"ms\");\n duration = duration.replace(\" seconds\", \"s\");\n duration = duration.replace(\" second\", \"s\");\n duration = duration.replace(\" minutes\", \"m\");\n duration = duration.replace(\" minute\", \"m\");\n duration = duration.replace(\" hours\", \"h\");\n duration = duration.replace(\" hour\", \"h\");\n duration = duration.replace(\" days\", \"d\");\n duration = duration.replace(\" day\", \"d\");\n duration = duration.replace(\" weeks\", \"w\");\n duration = duration.replace(\" week\", \"w\");\n duration = duration.replace(\" months\", \"mo\");\n duration = duration.replace(\" month\", \"mo\");\n duration = duration.replace(\" years\", \"y\");\n duration = duration.replace(\" year\", \"y\");\n }\n\n return duration;\n}\n\nexport function formatDurationInDays(milliseconds: number): string {\n let duration = humanizeDuration(milliseconds, {\n maxDecimalPoints: 0,\n largest: 2,\n units: [\"d\"],\n });\n\n return duration;\n}\n"]}
@@ -370,7 +370,7 @@ function getEnvVar(name) {
370
370
  __name(getEnvVar, "getEnvVar");
371
371
 
372
372
  // package.json
373
- var version = "3.0.0-beta.42";
373
+ var version = "3.0.0-beta.43";
374
374
 
375
375
  // src/v3/otel/tracingSDK.ts
376
376
  var _a;
@@ -1256,7 +1256,9 @@ var CommonRunFields = {
1256
1256
  var RetrieveRunResponse = zod.z.object({
1257
1257
  ...CommonRunFields,
1258
1258
  payload: zod.z.any().optional(),
1259
+ payloadPresignedUrl: zod.z.string().optional(),
1259
1260
  output: zod.z.any().optional(),
1261
+ outputPresignedUrl: zod.z.string().optional(),
1260
1262
  schedule: RunScheduleDetails.optional(),
1261
1263
  attempts: zod.z.array(zod.z.object({
1262
1264
  id: zod.z.string(),
@@ -2240,7 +2242,7 @@ async function conditionallyExportPacket(packet, pathPrefix, tracer) {
2240
2242
  return packet;
2241
2243
  }
2242
2244
  __name(conditionallyExportPacket, "conditionallyExportPacket");
2243
- function packetRequiresOffloading(packet) {
2245
+ function packetRequiresOffloading(packet, lengthLimit) {
2244
2246
  if (!packet.data) {
2245
2247
  return {
2246
2248
  needsOffloading: false,
@@ -2249,7 +2251,7 @@ function packetRequiresOffloading(packet) {
2249
2251
  }
2250
2252
  const byteSize = Buffer.byteLength(packet.data, "utf8");
2251
2253
  return {
2252
- needsOffloading: byteSize >= OFFLOAD_IO_PACKET_LENGTH_LIMIT,
2254
+ needsOffloading: byteSize >= (lengthLimit ?? OFFLOAD_IO_PACKET_LENGTH_LIMIT),
2253
2255
  size: byteSize
2254
2256
  };
2255
2257
  }