@trigger.dev/core 3.0.0-beta.1 → 3.0.0-beta.12
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.js
CHANGED
|
@@ -442,7 +442,7 @@ var QueueOptions = zod.z.object({
|
|
|
442
442
|
/** An optional property that specifies the maximum number of concurrent run executions.
|
|
443
443
|
*
|
|
444
444
|
* If this property is omitted, the task can potentially use up the full concurrency of an environment. */
|
|
445
|
-
concurrencyLimit: zod.z.number().int().min(
|
|
445
|
+
concurrencyLimit: zod.z.number().int().min(0).max(1e3).optional(),
|
|
446
446
|
/** @deprecated This feature is coming soon */
|
|
447
447
|
rateLimit: RateLimitOptions.optional()
|
|
448
448
|
});
|
|
@@ -469,6 +469,13 @@ var UncaughtExceptionMessage = zod.z.object({
|
|
|
469
469
|
"unhandledRejection"
|
|
470
470
|
])
|
|
471
471
|
});
|
|
472
|
+
var TaskMetadataFailedToParseData = zod.z.object({
|
|
473
|
+
version: zod.z.literal("v1").default("v1"),
|
|
474
|
+
tasks: zod.z.unknown(),
|
|
475
|
+
zodIssues: zod.z.custom((v) => {
|
|
476
|
+
return Array.isArray(v) && v.every((issue) => typeof issue === "object" && "message" in issue);
|
|
477
|
+
})
|
|
478
|
+
});
|
|
472
479
|
var childToWorkerMessages = {
|
|
473
480
|
TASK_RUN_COMPLETED: zod.z.object({
|
|
474
481
|
version: zod.z.literal("v1").default("v1"),
|
|
@@ -479,6 +486,7 @@ var childToWorkerMessages = {
|
|
|
479
486
|
version: zod.z.literal("v1").default("v1"),
|
|
480
487
|
tasks: TaskMetadataWithFilePath.array()
|
|
481
488
|
}),
|
|
489
|
+
TASKS_FAILED_TO_PARSE: TaskMetadataFailedToParseData,
|
|
482
490
|
TASK_HEARTBEAT: zod.z.object({
|
|
483
491
|
version: zod.z.literal("v1").default("v1"),
|
|
484
492
|
id: zod.z.string()
|
|
@@ -513,6 +521,9 @@ var ProdChildToWorkerMessages = {
|
|
|
513
521
|
tasks: TaskMetadataWithFilePath.array()
|
|
514
522
|
})
|
|
515
523
|
},
|
|
524
|
+
TASKS_FAILED_TO_PARSE: {
|
|
525
|
+
message: TaskMetadataFailedToParseData
|
|
526
|
+
},
|
|
516
527
|
TASK_HEARTBEAT: {
|
|
517
528
|
message: zod.z.object({
|
|
518
529
|
version: zod.z.literal("v1").default("v1"),
|
|
@@ -708,6 +719,11 @@ var InitializeDeploymentRequestBody = zod.z.object({
|
|
|
708
719
|
contentHash: zod.z.string(),
|
|
709
720
|
userId: zod.z.string().optional()
|
|
710
721
|
});
|
|
722
|
+
var DeploymentErrorData = zod.z.object({
|
|
723
|
+
name: zod.z.string(),
|
|
724
|
+
message: zod.z.string(),
|
|
725
|
+
stack: zod.z.string().optional()
|
|
726
|
+
});
|
|
711
727
|
var GetDeploymentResponseBody = zod.z.object({
|
|
712
728
|
id: zod.z.string(),
|
|
713
729
|
status: zod.z.enum([
|
|
@@ -723,11 +739,7 @@ var GetDeploymentResponseBody = zod.z.object({
|
|
|
723
739
|
shortCode: zod.z.string(),
|
|
724
740
|
version: zod.z.string(),
|
|
725
741
|
imageReference: zod.z.string().optional(),
|
|
726
|
-
errorData:
|
|
727
|
-
name: zod.z.string(),
|
|
728
|
-
message: zod.z.string(),
|
|
729
|
-
stack: zod.z.string().optional()
|
|
730
|
-
}).optional().nullable(),
|
|
742
|
+
errorData: DeploymentErrorData.optional().nullable(),
|
|
731
743
|
worker: zod.z.object({
|
|
732
744
|
id: zod.z.string(),
|
|
733
745
|
version: zod.z.string(),
|
|
@@ -742,6 +754,12 @@ var GetDeploymentResponseBody = zod.z.object({
|
|
|
742
754
|
var CreateUploadPayloadUrlResponseBody = zod.z.object({
|
|
743
755
|
presignedUrl: zod.z.string()
|
|
744
756
|
});
|
|
757
|
+
var ReplayRunResponse = zod.z.object({
|
|
758
|
+
id: zod.z.string()
|
|
759
|
+
});
|
|
760
|
+
var CanceledRunResponse = zod.z.object({
|
|
761
|
+
message: zod.z.string()
|
|
762
|
+
});
|
|
745
763
|
var PostStartCauses = zod.z.enum([
|
|
746
764
|
"index",
|
|
747
765
|
"create",
|
|
@@ -772,7 +790,8 @@ var Config = zod.z.object({
|
|
|
772
790
|
dependenciesToBundle: zod.z.array(zod.z.union([
|
|
773
791
|
zod.z.string(),
|
|
774
792
|
RegexSchema
|
|
775
|
-
])).optional()
|
|
793
|
+
])).optional(),
|
|
794
|
+
logLevel: zod.z.string().optional()
|
|
776
795
|
});
|
|
777
796
|
var WaitReason = zod.z.enum([
|
|
778
797
|
"WAIT_FOR_DURATION",
|
|
@@ -794,6 +813,27 @@ var ProviderToPlatformMessages = {
|
|
|
794
813
|
callback: zod.z.object({
|
|
795
814
|
status: zod.z.literal("ok")
|
|
796
815
|
})
|
|
816
|
+
},
|
|
817
|
+
WORKER_CRASHED: {
|
|
818
|
+
message: zod.z.object({
|
|
819
|
+
version: zod.z.literal("v1").default("v1"),
|
|
820
|
+
runId: zod.z.string(),
|
|
821
|
+
reason: zod.z.string().optional(),
|
|
822
|
+
exitCode: zod.z.number().optional(),
|
|
823
|
+
message: zod.z.string().optional(),
|
|
824
|
+
logs: zod.z.string().optional()
|
|
825
|
+
})
|
|
826
|
+
},
|
|
827
|
+
INDEXING_FAILED: {
|
|
828
|
+
message: zod.z.object({
|
|
829
|
+
version: zod.z.literal("v1").default("v1"),
|
|
830
|
+
deploymentId: zod.z.string(),
|
|
831
|
+
error: zod.z.object({
|
|
832
|
+
name: zod.z.string(),
|
|
833
|
+
message: zod.z.string(),
|
|
834
|
+
stack: zod.z.string().optional()
|
|
835
|
+
})
|
|
836
|
+
})
|
|
797
837
|
}
|
|
798
838
|
};
|
|
799
839
|
var PlatformToProviderMessages = {
|
|
@@ -816,7 +856,8 @@ var PlatformToProviderMessages = {
|
|
|
816
856
|
envId: zod.z.string(),
|
|
817
857
|
envType: EnvironmentType,
|
|
818
858
|
orgId: zod.z.string(),
|
|
819
|
-
projectId: zod.z.string()
|
|
859
|
+
projectId: zod.z.string(),
|
|
860
|
+
deploymentId: zod.z.string()
|
|
820
861
|
}),
|
|
821
862
|
callback: zod.z.discriminatedUnion("success", [
|
|
822
863
|
zod.z.object({
|
|
@@ -1407,7 +1448,11 @@ var SpanMessagingEvent = zod.z.object({
|
|
|
1407
1448
|
});
|
|
1408
1449
|
|
|
1409
1450
|
// src/zodfetch.ts
|
|
1410
|
-
async function zodfetch(schema, url, requestInit) {
|
|
1451
|
+
async function zodfetch(schema, url, requestInit, options) {
|
|
1452
|
+
return await _doZodFetch(schema, url, requestInit, options);
|
|
1453
|
+
}
|
|
1454
|
+
__name(zodfetch, "zodfetch");
|
|
1455
|
+
async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
|
|
1411
1456
|
try {
|
|
1412
1457
|
const response = await fetch(url, requestInit);
|
|
1413
1458
|
if ((!requestInit || requestInit.method === "GET") && response.status === 404) {
|
|
@@ -1416,7 +1461,7 @@ async function zodfetch(schema, url, requestInit) {
|
|
|
1416
1461
|
error: `404: ${response.statusText}`
|
|
1417
1462
|
};
|
|
1418
1463
|
}
|
|
1419
|
-
if (response.status >= 400 && response.status < 500) {
|
|
1464
|
+
if (response.status >= 400 && response.status < 500 && response.status !== 429) {
|
|
1420
1465
|
const body = await response.json();
|
|
1421
1466
|
if (!body.error) {
|
|
1422
1467
|
return {
|
|
@@ -1429,6 +1474,27 @@ async function zodfetch(schema, url, requestInit) {
|
|
|
1429
1474
|
error: body.error
|
|
1430
1475
|
};
|
|
1431
1476
|
}
|
|
1477
|
+
if (response.status === 429 || response.status >= 500) {
|
|
1478
|
+
if (!options?.retry) {
|
|
1479
|
+
return {
|
|
1480
|
+
ok: false,
|
|
1481
|
+
error: `Failed to fetch ${url}, got status code ${response.status}`
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
const retry = {
|
|
1485
|
+
...defaultRetryOptions,
|
|
1486
|
+
...options.retry
|
|
1487
|
+
};
|
|
1488
|
+
if (attempt > retry.maxAttempts) {
|
|
1489
|
+
return {
|
|
1490
|
+
ok: false,
|
|
1491
|
+
error: `Failed to fetch ${url}, got status code ${response.status}`
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
1494
|
+
const delay = calculateNextRetryDelay(retry, attempt);
|
|
1495
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1496
|
+
return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
|
|
1497
|
+
}
|
|
1432
1498
|
if (response.status !== 200) {
|
|
1433
1499
|
return {
|
|
1434
1500
|
ok: false,
|
|
@@ -1454,13 +1520,28 @@ async function zodfetch(schema, url, requestInit) {
|
|
|
1454
1520
|
error: parsedResult.error.message
|
|
1455
1521
|
};
|
|
1456
1522
|
} catch (error) {
|
|
1523
|
+
if (options?.retry) {
|
|
1524
|
+
const retry = {
|
|
1525
|
+
...defaultRetryOptions,
|
|
1526
|
+
...options.retry
|
|
1527
|
+
};
|
|
1528
|
+
if (attempt > retry.maxAttempts) {
|
|
1529
|
+
return {
|
|
1530
|
+
ok: false,
|
|
1531
|
+
error: error instanceof Error ? error.message : JSON.stringify(error)
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
const delay = calculateNextRetryDelay(retry, attempt);
|
|
1535
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1536
|
+
return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
|
|
1537
|
+
}
|
|
1457
1538
|
return {
|
|
1458
1539
|
ok: false,
|
|
1459
1540
|
error: error instanceof Error ? error.message : JSON.stringify(error)
|
|
1460
1541
|
};
|
|
1461
1542
|
}
|
|
1462
1543
|
}
|
|
1463
|
-
__name(
|
|
1544
|
+
__name(_doZodFetch, "_doZodFetch");
|
|
1464
1545
|
|
|
1465
1546
|
// src/v3/utils/flattenAttributes.ts
|
|
1466
1547
|
function flattenAttributes(obj, prefix) {
|
|
@@ -1746,6 +1827,15 @@ function getEnvVar(name) {
|
|
|
1746
1827
|
__name(getEnvVar, "getEnvVar");
|
|
1747
1828
|
|
|
1748
1829
|
// src/v3/apiClient/index.ts
|
|
1830
|
+
var zodFetchOptions = {
|
|
1831
|
+
retry: {
|
|
1832
|
+
maxAttempts: 5,
|
|
1833
|
+
minTimeoutInMs: 1e3,
|
|
1834
|
+
maxTimeoutInMs: 3e4,
|
|
1835
|
+
factor: 2,
|
|
1836
|
+
randomize: false
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1749
1839
|
var _getHeaders, getHeaders_fn;
|
|
1750
1840
|
var _ApiClient = class _ApiClient {
|
|
1751
1841
|
constructor(baseUrl, accessToken) {
|
|
@@ -1758,26 +1848,38 @@ var _ApiClient = class _ApiClient {
|
|
|
1758
1848
|
method: "POST",
|
|
1759
1849
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
|
|
1760
1850
|
body: JSON.stringify(body)
|
|
1761
|
-
});
|
|
1851
|
+
}, zodFetchOptions);
|
|
1762
1852
|
}
|
|
1763
1853
|
batchTriggerTask(taskId, body, options) {
|
|
1764
1854
|
return zodfetch(BatchTriggerTaskResponse, `${this.baseUrl}/api/v1/tasks/${taskId}/batch`, {
|
|
1765
1855
|
method: "POST",
|
|
1766
1856
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
|
|
1767
1857
|
body: JSON.stringify(body)
|
|
1768
|
-
});
|
|
1858
|
+
}, zodFetchOptions);
|
|
1769
1859
|
}
|
|
1770
1860
|
createUploadPayloadUrl(filename) {
|
|
1771
1861
|
return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
|
|
1772
1862
|
method: "PUT",
|
|
1773
1863
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1774
|
-
});
|
|
1864
|
+
}, zodFetchOptions);
|
|
1775
1865
|
}
|
|
1776
1866
|
getPayloadUrl(filename) {
|
|
1777
1867
|
return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
|
|
1778
1868
|
method: "GET",
|
|
1779
1869
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1780
|
-
});
|
|
1870
|
+
}, zodFetchOptions);
|
|
1871
|
+
}
|
|
1872
|
+
replayRun(runId) {
|
|
1873
|
+
return zodfetch(ReplayRunResponse, `${this.baseUrl}/api/v1/runs/${runId}/replay`, {
|
|
1874
|
+
method: "POST",
|
|
1875
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1876
|
+
}, zodFetchOptions);
|
|
1877
|
+
}
|
|
1878
|
+
cancelRun(runId) {
|
|
1879
|
+
return zodfetch(CanceledRunResponse, `${this.baseUrl}/api/v2/runs/${runId}/cancel`, {
|
|
1880
|
+
method: "POST",
|
|
1881
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1882
|
+
}, zodFetchOptions);
|
|
1781
1883
|
}
|
|
1782
1884
|
};
|
|
1783
1885
|
_getHeaders = new WeakSet();
|
|
@@ -1827,6 +1929,15 @@ getStore_fn2 = /* @__PURE__ */ __name(function() {
|
|
|
1827
1929
|
__name(_ApiClientManager, "ApiClientManager");
|
|
1828
1930
|
var ApiClientManager = _ApiClientManager;
|
|
1829
1931
|
var apiClientManager = new ApiClientManager();
|
|
1932
|
+
var _ZodSchemaParsedError = class _ZodSchemaParsedError extends Error {
|
|
1933
|
+
constructor(error, payload) {
|
|
1934
|
+
super(error.message);
|
|
1935
|
+
this.error = error;
|
|
1936
|
+
this.payload = payload;
|
|
1937
|
+
}
|
|
1938
|
+
};
|
|
1939
|
+
__name(_ZodSchemaParsedError, "ZodSchemaParsedError");
|
|
1940
|
+
var ZodSchemaParsedError = _ZodSchemaParsedError;
|
|
1830
1941
|
var ZodMessageSchema = zod.z.object({
|
|
1831
1942
|
version: zod.z.literal("v1").default("v1"),
|
|
1832
1943
|
type: zod.z.string(),
|
|
@@ -1923,7 +2034,7 @@ var _ZodMessageSender = class _ZodMessageSender {
|
|
|
1923
2034
|
}
|
|
1924
2035
|
const parsedPayload = schema.safeParse(payload);
|
|
1925
2036
|
if (!parsedPayload.success) {
|
|
1926
|
-
throw new
|
|
2037
|
+
throw new ZodSchemaParsedError(parsedPayload.error, payload);
|
|
1927
2038
|
}
|
|
1928
2039
|
await __privateGet(this, _sender).call(this, {
|
|
1929
2040
|
type,
|
|
@@ -2427,7 +2538,7 @@ var _ZodIpcConnection = class _ZodIpcConnection {
|
|
|
2427
2538
|
}
|
|
2428
2539
|
const parsedPayload = schema.safeParse(payload);
|
|
2429
2540
|
if (!parsedPayload.success) {
|
|
2430
|
-
throw new
|
|
2541
|
+
throw new ZodSchemaParsedError(parsedPayload.error, payload);
|
|
2431
2542
|
}
|
|
2432
2543
|
await __privateMethod(this, _sendPacket, sendPacket_fn).call(this, {
|
|
2433
2544
|
type: "EVENT",
|
|
@@ -2616,6 +2727,41 @@ function correctStackTraceLine(line, projectDir) {
|
|
|
2616
2727
|
return line;
|
|
2617
2728
|
}
|
|
2618
2729
|
__name(correctStackTraceLine, "correctStackTraceLine");
|
|
2730
|
+
function groupTaskMetadataIssuesByTask(tasks, issues) {
|
|
2731
|
+
return issues.reduce((acc, issue) => {
|
|
2732
|
+
if (issue.path.length === 0) {
|
|
2733
|
+
return acc;
|
|
2734
|
+
}
|
|
2735
|
+
const taskIndex = issue.path[1];
|
|
2736
|
+
if (typeof taskIndex !== "number") {
|
|
2737
|
+
return acc;
|
|
2738
|
+
}
|
|
2739
|
+
const task = tasks[taskIndex];
|
|
2740
|
+
if (!task) {
|
|
2741
|
+
return acc;
|
|
2742
|
+
}
|
|
2743
|
+
const restOfPath = issue.path.slice(2);
|
|
2744
|
+
const taskId = task.id;
|
|
2745
|
+
const taskName = task.exportName;
|
|
2746
|
+
const filePath = task.filePath;
|
|
2747
|
+
const key = taskIndex;
|
|
2748
|
+
const existing = acc[key] ?? {
|
|
2749
|
+
id: taskId,
|
|
2750
|
+
exportName: taskName,
|
|
2751
|
+
filePath,
|
|
2752
|
+
issues: []
|
|
2753
|
+
};
|
|
2754
|
+
existing.issues.push({
|
|
2755
|
+
message: issue.message,
|
|
2756
|
+
path: restOfPath.length === 0 ? void 0 : restOfPath.join(".")
|
|
2757
|
+
});
|
|
2758
|
+
return {
|
|
2759
|
+
...acc,
|
|
2760
|
+
[key]: existing
|
|
2761
|
+
};
|
|
2762
|
+
}, {});
|
|
2763
|
+
}
|
|
2764
|
+
__name(groupTaskMetadataIssuesByTask, "groupTaskMetadataIssuesByTask");
|
|
2619
2765
|
|
|
2620
2766
|
// src/v3/utils/platform.ts
|
|
2621
2767
|
var _globalThis = typeof globalThis === "object" ? globalThis : global;
|
|
@@ -2816,6 +2962,7 @@ var clock = ClockAPI.getInstance();
|
|
|
2816
2962
|
|
|
2817
2963
|
// src/v3/logger/taskLogger.ts
|
|
2818
2964
|
var logLevels = [
|
|
2965
|
+
"none",
|
|
2819
2966
|
"error",
|
|
2820
2967
|
"warn",
|
|
2821
2968
|
"log",
|
|
@@ -2831,27 +2978,27 @@ var _OtelTaskLogger = class _OtelTaskLogger {
|
|
|
2831
2978
|
this._level = logLevels.indexOf(_config.level);
|
|
2832
2979
|
}
|
|
2833
2980
|
debug(message, properties) {
|
|
2834
|
-
if (this._level <
|
|
2981
|
+
if (this._level < 5)
|
|
2835
2982
|
return;
|
|
2836
2983
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "debug", apiLogs.SeverityNumber.DEBUG, properties);
|
|
2837
2984
|
}
|
|
2838
2985
|
log(message, properties) {
|
|
2839
|
-
if (this._level <
|
|
2986
|
+
if (this._level < 3)
|
|
2840
2987
|
return;
|
|
2841
2988
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "log", apiLogs.SeverityNumber.INFO, properties);
|
|
2842
2989
|
}
|
|
2843
2990
|
info(message, properties) {
|
|
2844
|
-
if (this._level <
|
|
2991
|
+
if (this._level < 4)
|
|
2845
2992
|
return;
|
|
2846
2993
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "info", apiLogs.SeverityNumber.INFO, properties);
|
|
2847
2994
|
}
|
|
2848
2995
|
warn(message, properties) {
|
|
2849
|
-
if (this._level <
|
|
2996
|
+
if (this._level < 2)
|
|
2850
2997
|
return;
|
|
2851
2998
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "warn", apiLogs.SeverityNumber.WARN, properties);
|
|
2852
2999
|
}
|
|
2853
3000
|
error(message, properties) {
|
|
2854
|
-
if (this._level <
|
|
3001
|
+
if (this._level < 1)
|
|
2855
3002
|
return;
|
|
2856
3003
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "error", apiLogs.SeverityNumber.ERROR, properties);
|
|
2857
3004
|
}
|
|
@@ -3867,11 +4014,11 @@ var _TracingSDK = class _TracingSDK {
|
|
|
3867
4014
|
this.getTracer = traceProvider.getTracer.bind(traceProvider);
|
|
3868
4015
|
}
|
|
3869
4016
|
async flush() {
|
|
3870
|
-
await this.
|
|
4017
|
+
await this._traceProvider.forceFlush();
|
|
3871
4018
|
await this._logProvider.forceFlush();
|
|
3872
4019
|
}
|
|
3873
4020
|
async shutdown() {
|
|
3874
|
-
await this.
|
|
4021
|
+
await this._traceProvider.shutdown();
|
|
3875
4022
|
await this._logProvider.shutdown();
|
|
3876
4023
|
}
|
|
3877
4024
|
};
|
|
@@ -3955,11 +4102,18 @@ async function stringifyIO(value) {
|
|
|
3955
4102
|
dataType: "text/plain"
|
|
3956
4103
|
};
|
|
3957
4104
|
}
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
data
|
|
3961
|
-
|
|
3962
|
-
|
|
4105
|
+
try {
|
|
4106
|
+
const { stringify } = await loadSuperJSON();
|
|
4107
|
+
const data = stringify(value);
|
|
4108
|
+
return {
|
|
4109
|
+
data,
|
|
4110
|
+
dataType: "application/super+json"
|
|
4111
|
+
};
|
|
4112
|
+
} catch {
|
|
4113
|
+
return {
|
|
4114
|
+
dataType: "application/json"
|
|
4115
|
+
};
|
|
4116
|
+
}
|
|
3963
4117
|
}
|
|
3964
4118
|
__name(stringifyIO, "stringifyIO");
|
|
3965
4119
|
async function conditionallyExportPacket(packet, pathPrefix, tracer) {
|
|
@@ -4063,7 +4217,7 @@ async function importPacket(packet, span) {
|
|
|
4063
4217
|
__name(importPacket, "importPacket");
|
|
4064
4218
|
async function createPacketAttributes(packet, dataKey, dataTypeKey) {
|
|
4065
4219
|
if (!packet.data) {
|
|
4066
|
-
return
|
|
4220
|
+
return;
|
|
4067
4221
|
}
|
|
4068
4222
|
switch (packet.dataType) {
|
|
4069
4223
|
case "application/json":
|
|
@@ -4073,12 +4227,19 @@ async function createPacketAttributes(packet, dataKey, dataTypeKey) {
|
|
|
4073
4227
|
};
|
|
4074
4228
|
case "application/super+json":
|
|
4075
4229
|
const { parse } = await loadSuperJSON();
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4230
|
+
if (typeof packet.data === "undefined" || packet.data === null) {
|
|
4231
|
+
return;
|
|
4232
|
+
}
|
|
4233
|
+
try {
|
|
4234
|
+
const parsed = parse(packet.data);
|
|
4235
|
+
const jsonified = JSON.parse(JSON.stringify(parsed, safeReplacer));
|
|
4236
|
+
return {
|
|
4237
|
+
...flattenAttributes(jsonified, dataKey),
|
|
4238
|
+
[dataTypeKey]: "application/json"
|
|
4239
|
+
};
|
|
4240
|
+
} catch {
|
|
4241
|
+
return;
|
|
4242
|
+
}
|
|
4082
4243
|
case "application/store":
|
|
4083
4244
|
return {
|
|
4084
4245
|
[dataKey]: packet.data,
|
|
@@ -4086,15 +4247,15 @@ async function createPacketAttributes(packet, dataKey, dataTypeKey) {
|
|
|
4086
4247
|
};
|
|
4087
4248
|
case "text/plain":
|
|
4088
4249
|
return {
|
|
4089
|
-
[
|
|
4090
|
-
[
|
|
4250
|
+
[dataKey]: packet.data,
|
|
4251
|
+
[dataTypeKey]: packet.dataType
|
|
4091
4252
|
};
|
|
4092
4253
|
default:
|
|
4093
|
-
return
|
|
4254
|
+
return;
|
|
4094
4255
|
}
|
|
4095
4256
|
}
|
|
4096
4257
|
__name(createPacketAttributes, "createPacketAttributes");
|
|
4097
|
-
async function
|
|
4258
|
+
async function createPacketAttributesAsJson(data, dataType) {
|
|
4098
4259
|
if (typeof data === "string" || typeof data === "number" || typeof data === "boolean" || data === null || data === void 0) {
|
|
4099
4260
|
return data;
|
|
4100
4261
|
}
|
|
@@ -4104,7 +4265,7 @@ async function createPackageAttributesAsJson(data, dataType) {
|
|
|
4104
4265
|
case "application/super+json":
|
|
4105
4266
|
const { deserialize } = await loadSuperJSON();
|
|
4106
4267
|
const deserialized = deserialize(data);
|
|
4107
|
-
const jsonify =
|
|
4268
|
+
const jsonify = safeJsonParse(JSON.stringify(deserialized, safeReplacer));
|
|
4108
4269
|
return imposeAttributeLimits(flattenAttributes(jsonify, void 0));
|
|
4109
4270
|
case "application/store":
|
|
4110
4271
|
return data;
|
|
@@ -4112,7 +4273,7 @@ async function createPackageAttributesAsJson(data, dataType) {
|
|
|
4112
4273
|
return {};
|
|
4113
4274
|
}
|
|
4114
4275
|
}
|
|
4115
|
-
__name(
|
|
4276
|
+
__name(createPacketAttributesAsJson, "createPacketAttributesAsJson");
|
|
4116
4277
|
async function prettyPrintPacket(rawData, dataType) {
|
|
4117
4278
|
if (rawData === void 0) {
|
|
4118
4279
|
return "";
|
|
@@ -4167,6 +4328,14 @@ async function loadSuperJSON() {
|
|
|
4167
4328
|
return await import('superjson');
|
|
4168
4329
|
}
|
|
4169
4330
|
__name(loadSuperJSON, "loadSuperJSON");
|
|
4331
|
+
function safeJsonParse(value) {
|
|
4332
|
+
try {
|
|
4333
|
+
return JSON.parse(value);
|
|
4334
|
+
} catch {
|
|
4335
|
+
return;
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4338
|
+
__name(safeJsonParse, "safeJsonParse");
|
|
4170
4339
|
|
|
4171
4340
|
// src/v3/workers/taskExecutor.ts
|
|
4172
4341
|
var _callRun, callRun_fn, _callTaskInit, callTaskInit_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
|
|
@@ -4212,7 +4381,10 @@ var _TaskExecutor = class _TaskExecutor {
|
|
|
4212
4381
|
try {
|
|
4213
4382
|
const stringifiedOutput = await stringifyIO(output);
|
|
4214
4383
|
const finalOutput = await conditionallyExportPacket(stringifiedOutput, `${execution.attempt.id}/output`, this._tracer);
|
|
4215
|
-
|
|
4384
|
+
const attributes = await createPacketAttributes(finalOutput, SemanticInternalAttributes.OUTPUT, SemanticInternalAttributes.OUTPUT_TYPE);
|
|
4385
|
+
if (attributes) {
|
|
4386
|
+
span.setAttributes(attributes);
|
|
4387
|
+
}
|
|
4216
4388
|
return {
|
|
4217
4389
|
ok: true,
|
|
4218
4390
|
id: execution.attempt.id,
|
|
@@ -4463,6 +4635,7 @@ exports.BackgroundWorkerServerMessages = BackgroundWorkerServerMessages;
|
|
|
4463
4635
|
exports.BatchTaskRunExecutionResult = BatchTaskRunExecutionResult;
|
|
4464
4636
|
exports.BatchTriggerTaskRequestBody = BatchTriggerTaskRequestBody;
|
|
4465
4637
|
exports.BatchTriggerTaskResponse = BatchTriggerTaskResponse;
|
|
4638
|
+
exports.CanceledRunResponse = CanceledRunResponse;
|
|
4466
4639
|
exports.CancellationSpanEvent = CancellationSpanEvent;
|
|
4467
4640
|
exports.ClientToSharedQueueMessages = ClientToSharedQueueMessages;
|
|
4468
4641
|
exports.Config = Config;
|
|
@@ -4473,6 +4646,7 @@ exports.CreateAuthorizationCodeResponseSchema = CreateAuthorizationCodeResponseS
|
|
|
4473
4646
|
exports.CreateBackgroundWorkerRequestBody = CreateBackgroundWorkerRequestBody;
|
|
4474
4647
|
exports.CreateBackgroundWorkerResponse = CreateBackgroundWorkerResponse;
|
|
4475
4648
|
exports.CreateUploadPayloadUrlResponseBody = CreateUploadPayloadUrlResponseBody;
|
|
4649
|
+
exports.DeploymentErrorData = DeploymentErrorData;
|
|
4476
4650
|
exports.DevRuntimeManager = DevRuntimeManager;
|
|
4477
4651
|
exports.DurableClock = PreciseWallClock;
|
|
4478
4652
|
exports.EnvironmentType = EnvironmentType;
|
|
@@ -4527,6 +4701,7 @@ exports.ProdWorkerToCoordinatorMessages = ProdWorkerToCoordinatorMessages;
|
|
|
4527
4701
|
exports.ProviderToPlatformMessages = ProviderToPlatformMessages;
|
|
4528
4702
|
exports.QueueOptions = QueueOptions;
|
|
4529
4703
|
exports.RateLimitOptions = RateLimitOptions;
|
|
4704
|
+
exports.ReplayRunResponse = ReplayRunResponse;
|
|
4530
4705
|
exports.RetryOptions = RetryOptions;
|
|
4531
4706
|
exports.SemanticInternalAttributes = SemanticInternalAttributes;
|
|
4532
4707
|
exports.SharedQueueToClientMessages = SharedQueueToClientMessages;
|
|
@@ -4541,6 +4716,7 @@ exports.TaskContextSpanProcessor = TaskContextSpanProcessor;
|
|
|
4541
4716
|
exports.TaskEventStyle = TaskEventStyle;
|
|
4542
4717
|
exports.TaskExecutor = TaskExecutor;
|
|
4543
4718
|
exports.TaskMetadata = TaskMetadata;
|
|
4719
|
+
exports.TaskMetadataFailedToParseData = TaskMetadataFailedToParseData;
|
|
4544
4720
|
exports.TaskMetadataWithFilePath = TaskMetadataWithFilePath;
|
|
4545
4721
|
exports.TaskResource = TaskResource;
|
|
4546
4722
|
exports.TaskRun = TaskRun;
|
|
@@ -4576,6 +4752,7 @@ exports.ZodMessageHandler = ZodMessageHandler;
|
|
|
4576
4752
|
exports.ZodMessageSchema = ZodMessageSchema;
|
|
4577
4753
|
exports.ZodMessageSender = ZodMessageSender;
|
|
4578
4754
|
exports.ZodNamespace = ZodNamespace;
|
|
4755
|
+
exports.ZodSchemaParsedError = ZodSchemaParsedError;
|
|
4579
4756
|
exports.ZodSocketConnection = ZodSocketConnection;
|
|
4580
4757
|
exports.ZodSocketMessageHandler = ZodSocketMessageHandler;
|
|
4581
4758
|
exports.ZodSocketMessageSender = ZodSocketMessageSender;
|
|
@@ -4590,8 +4767,8 @@ exports.conditionallyExportPacket = conditionallyExportPacket;
|
|
|
4590
4767
|
exports.conditionallyImportPacket = conditionallyImportPacket;
|
|
4591
4768
|
exports.correctErrorStackTrace = correctErrorStackTrace;
|
|
4592
4769
|
exports.createErrorTaskError = createErrorTaskError;
|
|
4593
|
-
exports.createPackageAttributesAsJson = createPackageAttributesAsJson;
|
|
4594
4770
|
exports.createPacketAttributes = createPacketAttributes;
|
|
4771
|
+
exports.createPacketAttributesAsJson = createPacketAttributesAsJson;
|
|
4595
4772
|
exports.defaultFetchRetryOptions = defaultFetchRetryOptions;
|
|
4596
4773
|
exports.defaultRetryOptions = defaultRetryOptions;
|
|
4597
4774
|
exports.detectDependencyVersion = detectDependencyVersion;
|
|
@@ -4602,10 +4779,12 @@ exports.formatDurationInDays = formatDurationInDays;
|
|
|
4602
4779
|
exports.formatDurationMilliseconds = formatDurationMilliseconds;
|
|
4603
4780
|
exports.formatDurationNanoseconds = formatDurationNanoseconds;
|
|
4604
4781
|
exports.getEnvVar = getEnvVar;
|
|
4782
|
+
exports.groupTaskMetadataIssuesByTask = groupTaskMetadataIssuesByTask;
|
|
4605
4783
|
exports.iconStringForSeverity = iconStringForSeverity;
|
|
4606
4784
|
exports.imposeAttributeLimits = imposeAttributeLimits;
|
|
4607
4785
|
exports.isCancellationSpanEvent = isCancellationSpanEvent;
|
|
4608
4786
|
exports.isExceptionSpanEvent = isExceptionSpanEvent;
|
|
4787
|
+
exports.logLevels = logLevels;
|
|
4609
4788
|
exports.logger = logger;
|
|
4610
4789
|
exports.millisecondsToNanoseconds = millisecondsToNanoseconds;
|
|
4611
4790
|
exports.nanosecondsToMilliseconds = nanosecondsToMilliseconds;
|