@trigger.dev/core 3.0.0-beta.1 → 3.0.0-beta.11
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/v3/index.d.mts +1327 -1179
- package/dist/v3/index.d.ts +1327 -1179
- package/dist/v3/index.js +223 -44
- package/dist/v3/index.js.map +1 -1
- package/dist/v3/index.mjs +216 -44
- package/dist/v3/index.mjs.map +1 -1
- package/dist/v3/otel/index.js +2 -2
- package/dist/v3/otel/index.js.map +1 -1
- package/dist/v3/otel/index.mjs +2 -2
- package/dist/v3/otel/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/v3/index.mjs
CHANGED
|
@@ -434,7 +434,7 @@ var QueueOptions = z.object({
|
|
|
434
434
|
/** An optional property that specifies the maximum number of concurrent run executions.
|
|
435
435
|
*
|
|
436
436
|
* If this property is omitted, the task can potentially use up the full concurrency of an environment. */
|
|
437
|
-
concurrencyLimit: z.number().int().min(
|
|
437
|
+
concurrencyLimit: z.number().int().min(0).max(1e3).optional(),
|
|
438
438
|
/** @deprecated This feature is coming soon */
|
|
439
439
|
rateLimit: RateLimitOptions.optional()
|
|
440
440
|
});
|
|
@@ -461,6 +461,13 @@ var UncaughtExceptionMessage = z.object({
|
|
|
461
461
|
"unhandledRejection"
|
|
462
462
|
])
|
|
463
463
|
});
|
|
464
|
+
var TaskMetadataFailedToParseData = z.object({
|
|
465
|
+
version: z.literal("v1").default("v1"),
|
|
466
|
+
tasks: z.unknown(),
|
|
467
|
+
zodIssues: z.custom((v) => {
|
|
468
|
+
return Array.isArray(v) && v.every((issue) => typeof issue === "object" && "message" in issue);
|
|
469
|
+
})
|
|
470
|
+
});
|
|
464
471
|
var childToWorkerMessages = {
|
|
465
472
|
TASK_RUN_COMPLETED: z.object({
|
|
466
473
|
version: z.literal("v1").default("v1"),
|
|
@@ -471,6 +478,7 @@ var childToWorkerMessages = {
|
|
|
471
478
|
version: z.literal("v1").default("v1"),
|
|
472
479
|
tasks: TaskMetadataWithFilePath.array()
|
|
473
480
|
}),
|
|
481
|
+
TASKS_FAILED_TO_PARSE: TaskMetadataFailedToParseData,
|
|
474
482
|
TASK_HEARTBEAT: z.object({
|
|
475
483
|
version: z.literal("v1").default("v1"),
|
|
476
484
|
id: z.string()
|
|
@@ -505,6 +513,9 @@ var ProdChildToWorkerMessages = {
|
|
|
505
513
|
tasks: TaskMetadataWithFilePath.array()
|
|
506
514
|
})
|
|
507
515
|
},
|
|
516
|
+
TASKS_FAILED_TO_PARSE: {
|
|
517
|
+
message: TaskMetadataFailedToParseData
|
|
518
|
+
},
|
|
508
519
|
TASK_HEARTBEAT: {
|
|
509
520
|
message: z.object({
|
|
510
521
|
version: z.literal("v1").default("v1"),
|
|
@@ -700,6 +711,11 @@ var InitializeDeploymentRequestBody = z.object({
|
|
|
700
711
|
contentHash: z.string(),
|
|
701
712
|
userId: z.string().optional()
|
|
702
713
|
});
|
|
714
|
+
var DeploymentErrorData = z.object({
|
|
715
|
+
name: z.string(),
|
|
716
|
+
message: z.string(),
|
|
717
|
+
stack: z.string().optional()
|
|
718
|
+
});
|
|
703
719
|
var GetDeploymentResponseBody = z.object({
|
|
704
720
|
id: z.string(),
|
|
705
721
|
status: z.enum([
|
|
@@ -715,11 +731,7 @@ var GetDeploymentResponseBody = z.object({
|
|
|
715
731
|
shortCode: z.string(),
|
|
716
732
|
version: z.string(),
|
|
717
733
|
imageReference: z.string().optional(),
|
|
718
|
-
errorData:
|
|
719
|
-
name: z.string(),
|
|
720
|
-
message: z.string(),
|
|
721
|
-
stack: z.string().optional()
|
|
722
|
-
}).optional().nullable(),
|
|
734
|
+
errorData: DeploymentErrorData.optional().nullable(),
|
|
723
735
|
worker: z.object({
|
|
724
736
|
id: z.string(),
|
|
725
737
|
version: z.string(),
|
|
@@ -734,6 +746,12 @@ var GetDeploymentResponseBody = z.object({
|
|
|
734
746
|
var CreateUploadPayloadUrlResponseBody = z.object({
|
|
735
747
|
presignedUrl: z.string()
|
|
736
748
|
});
|
|
749
|
+
var ReplayRunResponse = z.object({
|
|
750
|
+
id: z.string()
|
|
751
|
+
});
|
|
752
|
+
var CanceledRunResponse = z.object({
|
|
753
|
+
message: z.string()
|
|
754
|
+
});
|
|
737
755
|
var PostStartCauses = z.enum([
|
|
738
756
|
"index",
|
|
739
757
|
"create",
|
|
@@ -764,7 +782,8 @@ var Config = z.object({
|
|
|
764
782
|
dependenciesToBundle: z.array(z.union([
|
|
765
783
|
z.string(),
|
|
766
784
|
RegexSchema
|
|
767
|
-
])).optional()
|
|
785
|
+
])).optional(),
|
|
786
|
+
logLevel: z.string().optional()
|
|
768
787
|
});
|
|
769
788
|
var WaitReason = z.enum([
|
|
770
789
|
"WAIT_FOR_DURATION",
|
|
@@ -786,6 +805,27 @@ var ProviderToPlatformMessages = {
|
|
|
786
805
|
callback: z.object({
|
|
787
806
|
status: z.literal("ok")
|
|
788
807
|
})
|
|
808
|
+
},
|
|
809
|
+
WORKER_CRASHED: {
|
|
810
|
+
message: z.object({
|
|
811
|
+
version: z.literal("v1").default("v1"),
|
|
812
|
+
runId: z.string(),
|
|
813
|
+
reason: z.string().optional(),
|
|
814
|
+
exitCode: z.number().optional(),
|
|
815
|
+
message: z.string().optional(),
|
|
816
|
+
logs: z.string().optional()
|
|
817
|
+
})
|
|
818
|
+
},
|
|
819
|
+
INDEXING_FAILED: {
|
|
820
|
+
message: z.object({
|
|
821
|
+
version: z.literal("v1").default("v1"),
|
|
822
|
+
deploymentId: z.string(),
|
|
823
|
+
error: z.object({
|
|
824
|
+
name: z.string(),
|
|
825
|
+
message: z.string(),
|
|
826
|
+
stack: z.string().optional()
|
|
827
|
+
})
|
|
828
|
+
})
|
|
789
829
|
}
|
|
790
830
|
};
|
|
791
831
|
var PlatformToProviderMessages = {
|
|
@@ -808,7 +848,8 @@ var PlatformToProviderMessages = {
|
|
|
808
848
|
envId: z.string(),
|
|
809
849
|
envType: EnvironmentType,
|
|
810
850
|
orgId: z.string(),
|
|
811
|
-
projectId: z.string()
|
|
851
|
+
projectId: z.string(),
|
|
852
|
+
deploymentId: z.string()
|
|
812
853
|
}),
|
|
813
854
|
callback: z.discriminatedUnion("success", [
|
|
814
855
|
z.object({
|
|
@@ -1399,7 +1440,11 @@ var SpanMessagingEvent = z.object({
|
|
|
1399
1440
|
});
|
|
1400
1441
|
|
|
1401
1442
|
// src/zodfetch.ts
|
|
1402
|
-
async function zodfetch(schema, url, requestInit) {
|
|
1443
|
+
async function zodfetch(schema, url, requestInit, options) {
|
|
1444
|
+
return await _doZodFetch(schema, url, requestInit, options);
|
|
1445
|
+
}
|
|
1446
|
+
__name(zodfetch, "zodfetch");
|
|
1447
|
+
async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
|
|
1403
1448
|
try {
|
|
1404
1449
|
const response = await fetch(url, requestInit);
|
|
1405
1450
|
if ((!requestInit || requestInit.method === "GET") && response.status === 404) {
|
|
@@ -1408,7 +1453,7 @@ async function zodfetch(schema, url, requestInit) {
|
|
|
1408
1453
|
error: `404: ${response.statusText}`
|
|
1409
1454
|
};
|
|
1410
1455
|
}
|
|
1411
|
-
if (response.status >= 400 && response.status < 500) {
|
|
1456
|
+
if (response.status >= 400 && response.status < 500 && response.status !== 429) {
|
|
1412
1457
|
const body = await response.json();
|
|
1413
1458
|
if (!body.error) {
|
|
1414
1459
|
return {
|
|
@@ -1421,6 +1466,27 @@ async function zodfetch(schema, url, requestInit) {
|
|
|
1421
1466
|
error: body.error
|
|
1422
1467
|
};
|
|
1423
1468
|
}
|
|
1469
|
+
if (response.status === 429 || response.status >= 500) {
|
|
1470
|
+
if (!options?.retry) {
|
|
1471
|
+
return {
|
|
1472
|
+
ok: false,
|
|
1473
|
+
error: `Failed to fetch ${url}, got status code ${response.status}`
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1476
|
+
const retry = {
|
|
1477
|
+
...defaultRetryOptions,
|
|
1478
|
+
...options.retry
|
|
1479
|
+
};
|
|
1480
|
+
if (attempt > retry.maxAttempts) {
|
|
1481
|
+
return {
|
|
1482
|
+
ok: false,
|
|
1483
|
+
error: `Failed to fetch ${url}, got status code ${response.status}`
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
const delay = calculateNextRetryDelay(retry, attempt);
|
|
1487
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1488
|
+
return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
|
|
1489
|
+
}
|
|
1424
1490
|
if (response.status !== 200) {
|
|
1425
1491
|
return {
|
|
1426
1492
|
ok: false,
|
|
@@ -1446,13 +1512,28 @@ async function zodfetch(schema, url, requestInit) {
|
|
|
1446
1512
|
error: parsedResult.error.message
|
|
1447
1513
|
};
|
|
1448
1514
|
} catch (error) {
|
|
1515
|
+
if (options?.retry) {
|
|
1516
|
+
const retry = {
|
|
1517
|
+
...defaultRetryOptions,
|
|
1518
|
+
...options.retry
|
|
1519
|
+
};
|
|
1520
|
+
if (attempt > retry.maxAttempts) {
|
|
1521
|
+
return {
|
|
1522
|
+
ok: false,
|
|
1523
|
+
error: error instanceof Error ? error.message : JSON.stringify(error)
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
const delay = calculateNextRetryDelay(retry, attempt);
|
|
1527
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1528
|
+
return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
|
|
1529
|
+
}
|
|
1449
1530
|
return {
|
|
1450
1531
|
ok: false,
|
|
1451
1532
|
error: error instanceof Error ? error.message : JSON.stringify(error)
|
|
1452
1533
|
};
|
|
1453
1534
|
}
|
|
1454
1535
|
}
|
|
1455
|
-
__name(
|
|
1536
|
+
__name(_doZodFetch, "_doZodFetch");
|
|
1456
1537
|
|
|
1457
1538
|
// src/v3/utils/flattenAttributes.ts
|
|
1458
1539
|
function flattenAttributes(obj, prefix) {
|
|
@@ -1738,6 +1819,15 @@ function getEnvVar(name) {
|
|
|
1738
1819
|
__name(getEnvVar, "getEnvVar");
|
|
1739
1820
|
|
|
1740
1821
|
// src/v3/apiClient/index.ts
|
|
1822
|
+
var zodFetchOptions = {
|
|
1823
|
+
retry: {
|
|
1824
|
+
maxAttempts: 5,
|
|
1825
|
+
minTimeoutInMs: 1e3,
|
|
1826
|
+
maxTimeoutInMs: 3e4,
|
|
1827
|
+
factor: 2,
|
|
1828
|
+
randomize: false
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1741
1831
|
var _getHeaders, getHeaders_fn;
|
|
1742
1832
|
var _ApiClient = class _ApiClient {
|
|
1743
1833
|
constructor(baseUrl, accessToken) {
|
|
@@ -1750,26 +1840,38 @@ var _ApiClient = class _ApiClient {
|
|
|
1750
1840
|
method: "POST",
|
|
1751
1841
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
|
|
1752
1842
|
body: JSON.stringify(body)
|
|
1753
|
-
});
|
|
1843
|
+
}, zodFetchOptions);
|
|
1754
1844
|
}
|
|
1755
1845
|
batchTriggerTask(taskId, body, options) {
|
|
1756
1846
|
return zodfetch(BatchTriggerTaskResponse, `${this.baseUrl}/api/v1/tasks/${taskId}/batch`, {
|
|
1757
1847
|
method: "POST",
|
|
1758
1848
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
|
|
1759
1849
|
body: JSON.stringify(body)
|
|
1760
|
-
});
|
|
1850
|
+
}, zodFetchOptions);
|
|
1761
1851
|
}
|
|
1762
1852
|
createUploadPayloadUrl(filename) {
|
|
1763
1853
|
return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
|
|
1764
1854
|
method: "PUT",
|
|
1765
1855
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1766
|
-
});
|
|
1856
|
+
}, zodFetchOptions);
|
|
1767
1857
|
}
|
|
1768
1858
|
getPayloadUrl(filename) {
|
|
1769
1859
|
return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
|
|
1770
1860
|
method: "GET",
|
|
1771
1861
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1772
|
-
});
|
|
1862
|
+
}, zodFetchOptions);
|
|
1863
|
+
}
|
|
1864
|
+
replayRun(runId) {
|
|
1865
|
+
return zodfetch(ReplayRunResponse, `${this.baseUrl}/api/v1/runs/${runId}/replay`, {
|
|
1866
|
+
method: "POST",
|
|
1867
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1868
|
+
}, zodFetchOptions);
|
|
1869
|
+
}
|
|
1870
|
+
cancelRun(runId) {
|
|
1871
|
+
return zodfetch(CanceledRunResponse, `${this.baseUrl}/api/v2/runs/${runId}/cancel`, {
|
|
1872
|
+
method: "POST",
|
|
1873
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1874
|
+
}, zodFetchOptions);
|
|
1773
1875
|
}
|
|
1774
1876
|
};
|
|
1775
1877
|
_getHeaders = new WeakSet();
|
|
@@ -1819,6 +1921,15 @@ getStore_fn2 = /* @__PURE__ */ __name(function() {
|
|
|
1819
1921
|
__name(_ApiClientManager, "ApiClientManager");
|
|
1820
1922
|
var ApiClientManager = _ApiClientManager;
|
|
1821
1923
|
var apiClientManager = new ApiClientManager();
|
|
1924
|
+
var _ZodSchemaParsedError = class _ZodSchemaParsedError extends Error {
|
|
1925
|
+
constructor(error, payload) {
|
|
1926
|
+
super(error.message);
|
|
1927
|
+
this.error = error;
|
|
1928
|
+
this.payload = payload;
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
__name(_ZodSchemaParsedError, "ZodSchemaParsedError");
|
|
1932
|
+
var ZodSchemaParsedError = _ZodSchemaParsedError;
|
|
1822
1933
|
var ZodMessageSchema = z.object({
|
|
1823
1934
|
version: z.literal("v1").default("v1"),
|
|
1824
1935
|
type: z.string(),
|
|
@@ -1915,7 +2026,7 @@ var _ZodMessageSender = class _ZodMessageSender {
|
|
|
1915
2026
|
}
|
|
1916
2027
|
const parsedPayload = schema.safeParse(payload);
|
|
1917
2028
|
if (!parsedPayload.success) {
|
|
1918
|
-
throw new
|
|
2029
|
+
throw new ZodSchemaParsedError(parsedPayload.error, payload);
|
|
1919
2030
|
}
|
|
1920
2031
|
await __privateGet(this, _sender).call(this, {
|
|
1921
2032
|
type,
|
|
@@ -2419,7 +2530,7 @@ var _ZodIpcConnection = class _ZodIpcConnection {
|
|
|
2419
2530
|
}
|
|
2420
2531
|
const parsedPayload = schema.safeParse(payload);
|
|
2421
2532
|
if (!parsedPayload.success) {
|
|
2422
|
-
throw new
|
|
2533
|
+
throw new ZodSchemaParsedError(parsedPayload.error, payload);
|
|
2423
2534
|
}
|
|
2424
2535
|
await __privateMethod(this, _sendPacket, sendPacket_fn).call(this, {
|
|
2425
2536
|
type: "EVENT",
|
|
@@ -2608,6 +2719,41 @@ function correctStackTraceLine(line, projectDir) {
|
|
|
2608
2719
|
return line;
|
|
2609
2720
|
}
|
|
2610
2721
|
__name(correctStackTraceLine, "correctStackTraceLine");
|
|
2722
|
+
function groupTaskMetadataIssuesByTask(tasks, issues) {
|
|
2723
|
+
return issues.reduce((acc, issue) => {
|
|
2724
|
+
if (issue.path.length === 0) {
|
|
2725
|
+
return acc;
|
|
2726
|
+
}
|
|
2727
|
+
const taskIndex = issue.path[1];
|
|
2728
|
+
if (typeof taskIndex !== "number") {
|
|
2729
|
+
return acc;
|
|
2730
|
+
}
|
|
2731
|
+
const task = tasks[taskIndex];
|
|
2732
|
+
if (!task) {
|
|
2733
|
+
return acc;
|
|
2734
|
+
}
|
|
2735
|
+
const restOfPath = issue.path.slice(2);
|
|
2736
|
+
const taskId = task.id;
|
|
2737
|
+
const taskName = task.exportName;
|
|
2738
|
+
const filePath = task.filePath;
|
|
2739
|
+
const key = taskIndex;
|
|
2740
|
+
const existing = acc[key] ?? {
|
|
2741
|
+
id: taskId,
|
|
2742
|
+
exportName: taskName,
|
|
2743
|
+
filePath,
|
|
2744
|
+
issues: []
|
|
2745
|
+
};
|
|
2746
|
+
existing.issues.push({
|
|
2747
|
+
message: issue.message,
|
|
2748
|
+
path: restOfPath.length === 0 ? void 0 : restOfPath.join(".")
|
|
2749
|
+
});
|
|
2750
|
+
return {
|
|
2751
|
+
...acc,
|
|
2752
|
+
[key]: existing
|
|
2753
|
+
};
|
|
2754
|
+
}, {});
|
|
2755
|
+
}
|
|
2756
|
+
__name(groupTaskMetadataIssuesByTask, "groupTaskMetadataIssuesByTask");
|
|
2611
2757
|
|
|
2612
2758
|
// src/v3/utils/platform.ts
|
|
2613
2759
|
var _globalThis = typeof globalThis === "object" ? globalThis : global;
|
|
@@ -2808,6 +2954,7 @@ var clock = ClockAPI.getInstance();
|
|
|
2808
2954
|
|
|
2809
2955
|
// src/v3/logger/taskLogger.ts
|
|
2810
2956
|
var logLevels = [
|
|
2957
|
+
"none",
|
|
2811
2958
|
"error",
|
|
2812
2959
|
"warn",
|
|
2813
2960
|
"log",
|
|
@@ -2823,27 +2970,27 @@ var _OtelTaskLogger = class _OtelTaskLogger {
|
|
|
2823
2970
|
this._level = logLevels.indexOf(_config.level);
|
|
2824
2971
|
}
|
|
2825
2972
|
debug(message, properties) {
|
|
2826
|
-
if (this._level <
|
|
2973
|
+
if (this._level < 5)
|
|
2827
2974
|
return;
|
|
2828
2975
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "debug", SeverityNumber.DEBUG, properties);
|
|
2829
2976
|
}
|
|
2830
2977
|
log(message, properties) {
|
|
2831
|
-
if (this._level <
|
|
2978
|
+
if (this._level < 3)
|
|
2832
2979
|
return;
|
|
2833
2980
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "log", SeverityNumber.INFO, properties);
|
|
2834
2981
|
}
|
|
2835
2982
|
info(message, properties) {
|
|
2836
|
-
if (this._level <
|
|
2983
|
+
if (this._level < 4)
|
|
2837
2984
|
return;
|
|
2838
2985
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "info", SeverityNumber.INFO, properties);
|
|
2839
2986
|
}
|
|
2840
2987
|
warn(message, properties) {
|
|
2841
|
-
if (this._level <
|
|
2988
|
+
if (this._level < 2)
|
|
2842
2989
|
return;
|
|
2843
2990
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "warn", SeverityNumber.WARN, properties);
|
|
2844
2991
|
}
|
|
2845
2992
|
error(message, properties) {
|
|
2846
|
-
if (this._level <
|
|
2993
|
+
if (this._level < 1)
|
|
2847
2994
|
return;
|
|
2848
2995
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "error", SeverityNumber.ERROR, properties);
|
|
2849
2996
|
}
|
|
@@ -3859,11 +4006,11 @@ var _TracingSDK = class _TracingSDK {
|
|
|
3859
4006
|
this.getTracer = traceProvider.getTracer.bind(traceProvider);
|
|
3860
4007
|
}
|
|
3861
4008
|
async flush() {
|
|
3862
|
-
await this.
|
|
4009
|
+
await this._traceProvider.forceFlush();
|
|
3863
4010
|
await this._logProvider.forceFlush();
|
|
3864
4011
|
}
|
|
3865
4012
|
async shutdown() {
|
|
3866
|
-
await this.
|
|
4013
|
+
await this._traceProvider.shutdown();
|
|
3867
4014
|
await this._logProvider.shutdown();
|
|
3868
4015
|
}
|
|
3869
4016
|
};
|
|
@@ -3947,11 +4094,18 @@ async function stringifyIO(value) {
|
|
|
3947
4094
|
dataType: "text/plain"
|
|
3948
4095
|
};
|
|
3949
4096
|
}
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
data
|
|
3953
|
-
|
|
3954
|
-
|
|
4097
|
+
try {
|
|
4098
|
+
const { stringify } = await loadSuperJSON();
|
|
4099
|
+
const data = stringify(value);
|
|
4100
|
+
return {
|
|
4101
|
+
data,
|
|
4102
|
+
dataType: "application/super+json"
|
|
4103
|
+
};
|
|
4104
|
+
} catch {
|
|
4105
|
+
return {
|
|
4106
|
+
dataType: "application/json"
|
|
4107
|
+
};
|
|
4108
|
+
}
|
|
3955
4109
|
}
|
|
3956
4110
|
__name(stringifyIO, "stringifyIO");
|
|
3957
4111
|
async function conditionallyExportPacket(packet, pathPrefix, tracer) {
|
|
@@ -4055,7 +4209,7 @@ async function importPacket(packet, span) {
|
|
|
4055
4209
|
__name(importPacket, "importPacket");
|
|
4056
4210
|
async function createPacketAttributes(packet, dataKey, dataTypeKey) {
|
|
4057
4211
|
if (!packet.data) {
|
|
4058
|
-
return
|
|
4212
|
+
return;
|
|
4059
4213
|
}
|
|
4060
4214
|
switch (packet.dataType) {
|
|
4061
4215
|
case "application/json":
|
|
@@ -4065,12 +4219,19 @@ async function createPacketAttributes(packet, dataKey, dataTypeKey) {
|
|
|
4065
4219
|
};
|
|
4066
4220
|
case "application/super+json":
|
|
4067
4221
|
const { parse } = await loadSuperJSON();
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4222
|
+
if (typeof packet.data === "undefined" || packet.data === null) {
|
|
4223
|
+
return;
|
|
4224
|
+
}
|
|
4225
|
+
try {
|
|
4226
|
+
const parsed = parse(packet.data);
|
|
4227
|
+
const jsonified = JSON.parse(JSON.stringify(parsed, safeReplacer));
|
|
4228
|
+
return {
|
|
4229
|
+
...flattenAttributes(jsonified, dataKey),
|
|
4230
|
+
[dataTypeKey]: "application/json"
|
|
4231
|
+
};
|
|
4232
|
+
} catch {
|
|
4233
|
+
return;
|
|
4234
|
+
}
|
|
4074
4235
|
case "application/store":
|
|
4075
4236
|
return {
|
|
4076
4237
|
[dataKey]: packet.data,
|
|
@@ -4078,15 +4239,15 @@ async function createPacketAttributes(packet, dataKey, dataTypeKey) {
|
|
|
4078
4239
|
};
|
|
4079
4240
|
case "text/plain":
|
|
4080
4241
|
return {
|
|
4081
|
-
[
|
|
4082
|
-
[
|
|
4242
|
+
[dataKey]: packet.data,
|
|
4243
|
+
[dataTypeKey]: packet.dataType
|
|
4083
4244
|
};
|
|
4084
4245
|
default:
|
|
4085
|
-
return
|
|
4246
|
+
return;
|
|
4086
4247
|
}
|
|
4087
4248
|
}
|
|
4088
4249
|
__name(createPacketAttributes, "createPacketAttributes");
|
|
4089
|
-
async function
|
|
4250
|
+
async function createPacketAttributesAsJson(data, dataType) {
|
|
4090
4251
|
if (typeof data === "string" || typeof data === "number" || typeof data === "boolean" || data === null || data === void 0) {
|
|
4091
4252
|
return data;
|
|
4092
4253
|
}
|
|
@@ -4096,7 +4257,7 @@ async function createPackageAttributesAsJson(data, dataType) {
|
|
|
4096
4257
|
case "application/super+json":
|
|
4097
4258
|
const { deserialize } = await loadSuperJSON();
|
|
4098
4259
|
const deserialized = deserialize(data);
|
|
4099
|
-
const jsonify =
|
|
4260
|
+
const jsonify = safeJsonParse(JSON.stringify(deserialized, safeReplacer));
|
|
4100
4261
|
return imposeAttributeLimits(flattenAttributes(jsonify, void 0));
|
|
4101
4262
|
case "application/store":
|
|
4102
4263
|
return data;
|
|
@@ -4104,7 +4265,7 @@ async function createPackageAttributesAsJson(data, dataType) {
|
|
|
4104
4265
|
return {};
|
|
4105
4266
|
}
|
|
4106
4267
|
}
|
|
4107
|
-
__name(
|
|
4268
|
+
__name(createPacketAttributesAsJson, "createPacketAttributesAsJson");
|
|
4108
4269
|
async function prettyPrintPacket(rawData, dataType) {
|
|
4109
4270
|
if (rawData === void 0) {
|
|
4110
4271
|
return "";
|
|
@@ -4159,6 +4320,14 @@ async function loadSuperJSON() {
|
|
|
4159
4320
|
return await import('superjson');
|
|
4160
4321
|
}
|
|
4161
4322
|
__name(loadSuperJSON, "loadSuperJSON");
|
|
4323
|
+
function safeJsonParse(value) {
|
|
4324
|
+
try {
|
|
4325
|
+
return JSON.parse(value);
|
|
4326
|
+
} catch {
|
|
4327
|
+
return;
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
__name(safeJsonParse, "safeJsonParse");
|
|
4162
4331
|
|
|
4163
4332
|
// src/v3/workers/taskExecutor.ts
|
|
4164
4333
|
var _callRun, callRun_fn, _callTaskInit, callTaskInit_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
|
|
@@ -4204,7 +4373,10 @@ var _TaskExecutor = class _TaskExecutor {
|
|
|
4204
4373
|
try {
|
|
4205
4374
|
const stringifiedOutput = await stringifyIO(output);
|
|
4206
4375
|
const finalOutput = await conditionallyExportPacket(stringifiedOutput, `${execution.attempt.id}/output`, this._tracer);
|
|
4207
|
-
|
|
4376
|
+
const attributes = await createPacketAttributes(finalOutput, SemanticInternalAttributes.OUTPUT, SemanticInternalAttributes.OUTPUT_TYPE);
|
|
4377
|
+
if (attributes) {
|
|
4378
|
+
span.setAttributes(attributes);
|
|
4379
|
+
}
|
|
4208
4380
|
return {
|
|
4209
4381
|
ok: true,
|
|
4210
4382
|
id: execution.attempt.id,
|
|
@@ -4446,6 +4618,6 @@ function parseBatchTriggerTaskRequestBody(body) {
|
|
|
4446
4618
|
}
|
|
4447
4619
|
__name(parseBatchTriggerTaskRequestBody, "parseBatchTriggerTaskRequestBody");
|
|
4448
4620
|
|
|
4449
|
-
export { ApiClient, ApiClientManager, BackgroundWorkerClientMessages, BackgroundWorkerMetadata, BackgroundWorkerProperties, BackgroundWorkerServerMessages, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CancellationSpanEvent, ClientToSharedQueueMessages, Config, ConsoleInterceptor, CoordinatorToPlatformMessages, CoordinatorToProdWorkerMessages, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateUploadPayloadUrlResponseBody, DevRuntimeManager, PreciseWallClock as DurableClock, EnvironmentType, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, FixedWindowRateLimit, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, GetPersonalAccessTokenRequestSchema, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, ImageDetailsMetadata, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, LogLevel, Machine, MachineCpu, MachineMemory, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtelTaskLogger, OtherSpanEvent, PRIMARY_VARIANT, PlatformToCoordinatorMessages, PlatformToProviderMessages, PostStartCauses, PreStopCauses, ProdChildToWorkerMessages, ProdRuntimeManager, ProdTaskRunExecution, ProdTaskRunExecutionPayload, ProdWorkerSocketData, ProdWorkerToChildMessages, ProdWorkerToCoordinatorMessages, ProviderToPlatformMessages, QueueOptions, RateLimitOptions, RetryOptions, SemanticInternalAttributes, SharedQueueToClientMessages, SimpleStructuredLogger, SlidingWindowRateLimit, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskContextSpanProcessor, TaskEventStyle, TaskExecutor, TaskMetadata, TaskMetadataWithFilePath, TaskResource, TaskRun, TaskRunBuiltInError, TaskRunContext, TaskRunCustomErrorObject, TaskRunError, TaskRunErrorCodes, TaskRunExecution, TaskRunExecutionAttempt, TaskRunExecutionBatch, TaskRunExecutionEnvironment, TaskRunExecutionOrganization, TaskRunExecutionPayload, TaskRunExecutionProject, TaskRunExecutionQueue, TaskRunExecutionResult, TaskRunExecutionRetry, TaskRunExecutionTask, TaskRunFailedExecutionResult, TaskRunInternalError, TaskRunStringError, TaskRunSuccessfulExecutionResult, TracingSDK, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UncaughtExceptionMessage, WaitReason, WhoAmIResponseSchema, ZodIpcConnection, ZodMessageHandler, ZodMessageSchema, ZodMessageSender, ZodNamespace, ZodSocketConnection, ZodSocketMessageHandler, ZodSocketMessageSender, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt2 as calculateResetAt, childToWorkerMessages, clientWebsocketMessages, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError,
|
|
4621
|
+
export { ApiClient, ApiClientManager, BackgroundWorkerClientMessages, BackgroundWorkerMetadata, BackgroundWorkerProperties, BackgroundWorkerServerMessages, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CanceledRunResponse, CancellationSpanEvent, ClientToSharedQueueMessages, Config, ConsoleInterceptor, CoordinatorToPlatformMessages, CoordinatorToProdWorkerMessages, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateUploadPayloadUrlResponseBody, DeploymentErrorData, DevRuntimeManager, PreciseWallClock as DurableClock, EnvironmentType, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, FixedWindowRateLimit, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, GetPersonalAccessTokenRequestSchema, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, ImageDetailsMetadata, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, LogLevel, Machine, MachineCpu, MachineMemory, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtelTaskLogger, OtherSpanEvent, PRIMARY_VARIANT, PlatformToCoordinatorMessages, PlatformToProviderMessages, PostStartCauses, PreStopCauses, ProdChildToWorkerMessages, ProdRuntimeManager, ProdTaskRunExecution, ProdTaskRunExecutionPayload, ProdWorkerSocketData, ProdWorkerToChildMessages, ProdWorkerToCoordinatorMessages, ProviderToPlatformMessages, QueueOptions, RateLimitOptions, ReplayRunResponse, RetryOptions, SemanticInternalAttributes, SharedQueueToClientMessages, SimpleStructuredLogger, SlidingWindowRateLimit, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskContextSpanProcessor, TaskEventStyle, TaskExecutor, TaskMetadata, TaskMetadataFailedToParseData, TaskMetadataWithFilePath, TaskResource, TaskRun, TaskRunBuiltInError, TaskRunContext, TaskRunCustomErrorObject, TaskRunError, TaskRunErrorCodes, TaskRunExecution, TaskRunExecutionAttempt, TaskRunExecutionBatch, TaskRunExecutionEnvironment, TaskRunExecutionOrganization, TaskRunExecutionPayload, TaskRunExecutionProject, TaskRunExecutionQueue, TaskRunExecutionResult, TaskRunExecutionRetry, TaskRunExecutionTask, TaskRunFailedExecutionResult, TaskRunInternalError, TaskRunStringError, TaskRunSuccessfulExecutionResult, TracingSDK, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UncaughtExceptionMessage, WaitReason, WhoAmIResponseSchema, ZodIpcConnection, ZodMessageHandler, ZodMessageSchema, ZodMessageSender, ZodNamespace, ZodSchemaParsedError, ZodSocketConnection, ZodSocketMessageHandler, ZodSocketMessageSender, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt2 as calculateResetAt, childToWorkerMessages, clientWebsocketMessages, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError, createPacketAttributes, createPacketAttributesAsJson, defaultFetchRetryOptions, defaultRetryOptions, detectDependencyVersion, eventFilterMatches, flattenAttributes, formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, getEnvVar, groupTaskMetadataIssuesByTask, iconStringForSeverity, imposeAttributeLimits, isCancellationSpanEvent, isExceptionSpanEvent, logLevels, logger, millisecondsToNanoseconds, nanosecondsToMilliseconds, omit, packetRequiresOffloading, parseBatchTriggerTaskRequestBody, parseError, parsePacket, parseTriggerTaskRequestBody, prettyPrintPacket, primitiveValueOrflattenedAttributes, recordSpanException, runtime, serverWebsocketMessages, stringPatternMatchers, stringifyIO, taskContextManager, unflattenAttributes, workerToChildMessages };
|
|
4450
4622
|
//# sourceMappingURL=out.js.map
|
|
4451
4623
|
//# sourceMappingURL=index.mjs.map
|