@workflow/world-testing 5.0.0-beta.16 → 5.0.0-beta.18
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.
|
@@ -102,6 +102,26 @@ function formatStepName2(name) {
|
|
|
102
102
|
function formatWorkflowName2(name) {
|
|
103
103
|
return formatParsedName2(parseWorkflowName2(name), name);
|
|
104
104
|
}
|
|
105
|
+
function workflowDisplayName2(name) {
|
|
106
|
+
return parseWorkflowName2(name)?.shortName ?? shortNameFromSanitized2("workflow", name) ?? name;
|
|
107
|
+
}
|
|
108
|
+
function stepDisplayName(name) {
|
|
109
|
+
return parseStepName2(name)?.shortName ?? shortNameFromSanitized2("step", name) ?? name;
|
|
110
|
+
}
|
|
111
|
+
function shortNameFromSanitized2(tag, name) {
|
|
112
|
+
if (!name.startsWith(`${tag}--`))
|
|
113
|
+
return null;
|
|
114
|
+
const segments = name.split("--").filter(Boolean);
|
|
115
|
+
const functionPart = segments.at(-1);
|
|
116
|
+
let shortName = functionPart?.split("-").filter(Boolean).at(-1) ?? "";
|
|
117
|
+
if (["default", "__default"].includes(shortName)) {
|
|
118
|
+
const moduleShortName = segments.at(-2)?.split("-").filter(Boolean).at(-1);
|
|
119
|
+
if (moduleShortName && moduleShortName !== tag) {
|
|
120
|
+
shortName = moduleShortName;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return shortName || null;
|
|
124
|
+
}
|
|
105
125
|
function formatParsedName2(parsed, fallback) {
|
|
106
126
|
if (!parsed)
|
|
107
127
|
return fallback;
|
|
@@ -115,6 +135,9 @@ var init_parse_name2 = __esm({
|
|
|
115
135
|
__name(parseStepName2, "parseStepName");
|
|
116
136
|
__name(formatStepName2, "formatStepName");
|
|
117
137
|
__name(formatWorkflowName2, "formatWorkflowName");
|
|
138
|
+
__name(workflowDisplayName2, "workflowDisplayName");
|
|
139
|
+
__name(stepDisplayName, "stepDisplayName");
|
|
140
|
+
__name(shortNameFromSanitized2, "shortNameFromSanitized");
|
|
118
141
|
__name(formatParsedName2, "formatParsedName");
|
|
119
142
|
}
|
|
120
143
|
});
|
|
@@ -16298,7 +16321,7 @@ function requiresNewerWorld(v) {
|
|
|
16298
16321
|
return false;
|
|
16299
16322
|
return v > SPEC_VERSION_CURRENT2;
|
|
16300
16323
|
}
|
|
16301
|
-
var SPEC_VERSION_LEGACY2, SPEC_VERSION_SUPPORTS_EVENT_SOURCING2, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT2, SPEC_VERSION_SUPPORTS_ATTRIBUTES2, SPEC_VERSION_CURRENT2;
|
|
16324
|
+
var SPEC_VERSION_LEGACY2, SPEC_VERSION_SUPPORTS_EVENT_SOURCING2, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT2, SPEC_VERSION_SUPPORTS_ATTRIBUTES2, SPEC_VERSION_SUPPORTS_COMPRESSION2, SPEC_VERSION_CURRENT2;
|
|
16302
16325
|
var init_spec_version2 = __esm({
|
|
16303
16326
|
"../world/dist/spec-version.js"() {
|
|
16304
16327
|
"use strict";
|
|
@@ -16306,7 +16329,8 @@ var init_spec_version2 = __esm({
|
|
|
16306
16329
|
SPEC_VERSION_SUPPORTS_EVENT_SOURCING2 = 2;
|
|
16307
16330
|
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT2 = 3;
|
|
16308
16331
|
SPEC_VERSION_SUPPORTS_ATTRIBUTES2 = 4;
|
|
16309
|
-
|
|
16332
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION2 = 5;
|
|
16333
|
+
SPEC_VERSION_CURRENT2 = SPEC_VERSION_SUPPORTS_COMPRESSION2;
|
|
16310
16334
|
__name(isLegacySpecVersion2, "isLegacySpecVersion");
|
|
16311
16335
|
__name(requiresNewerWorld, "requiresNewerWorld");
|
|
16312
16336
|
}
|
|
@@ -16637,6 +16661,7 @@ __export(dist_exports, {
|
|
|
16637
16661
|
SPEC_VERSION_LEGACY: () => SPEC_VERSION_LEGACY2,
|
|
16638
16662
|
SPEC_VERSION_SUPPORTS_ATTRIBUTES: () => SPEC_VERSION_SUPPORTS_ATTRIBUTES2,
|
|
16639
16663
|
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT: () => SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT2,
|
|
16664
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION: () => SPEC_VERSION_SUPPORTS_COMPRESSION2,
|
|
16640
16665
|
SPEC_VERSION_SUPPORTS_EVENT_SOURCING: () => SPEC_VERSION_SUPPORTS_EVENT_SOURCING2,
|
|
16641
16666
|
SerializedDataSchema: () => SerializedDataSchema2,
|
|
16642
16667
|
StepInvokePayloadSchema: () => StepInvokePayloadSchema2,
|
|
@@ -17054,7 +17079,7 @@ var init_log_format2 = __esm({
|
|
|
17054
17079
|
function SemanticConvention2(...names) {
|
|
17055
17080
|
return (value) => Object.fromEntries(names.map((name) => [name, value]));
|
|
17056
17081
|
}
|
|
17057
|
-
var WorkflowName2, WorkflowOperation2, WorkflowRunId2, WorkflowRunStatus2, WorkflowStartedAt2, WorkflowEventsCount2, WorkflowArgumentsCount2, WorkflowResultType2, WorkflowTracePropagated2, WorkflowErrorName2, WorkflowErrorMessage2, WorkflowErrorCode2, WorkflowStepsCreated2, WorkflowHooksCreated2, WorkflowWaitsCreated2, StepName2, StepId2, StepAttempt2, StepStatus2, StepMaxRetries2, StepTracePropagated2, StepSkipped2, StepSkipReason2, StepArgumentsCount2, StepResultType2, StepErrorName2, StepErrorMessage2, StepFatalError2, StepRetryExhausted2, StepRetryTimeoutSeconds2, StepRetryWillRetry2, MessagingSystem2, MessagingDestinationName2, MessagingMessageId2, MessagingOperationType2, QueueOverheadMs2, DeploymentId2, HookToken2, HookId2, HookFound2, WebhookHandlersTriggered2, WorkflowSuspensionState2, WorkflowSuspensionHookCount2, WorkflowSuspensionStepCount2, WorkflowSuspensionWaitCount2, HttpRequestMethod2, UrlFull2, ServerAddress2, ServerPort2, HttpResponseStatusCode2, ErrorType2, WorldParseFormat2, WorkflowEventsPagesLoaded2, QueueDeserializeTimeMs2, QueueExecutionTimeMs2, QueueSerializeTimeMs2, PeerService2, RpcSystem2, RpcService2, RpcMethod2, ErrorRetryable2, ErrorCategory2;
|
|
17082
|
+
var WorkflowName2, WorkflowOperation2, WorkflowRunId2, WorkflowRunStatus2, WorkflowStartedAt2, WorkflowEventsCount2, WorkflowArgumentsCount2, WorkflowResultType2, WorkflowTracePropagated2, WorkflowTraceMode2, WorkflowErrorName2, WorkflowErrorMessage2, WorkflowErrorCode2, WorkflowStepsCreated2, WorkflowHooksCreated2, WorkflowWaitsCreated2, StepName2, StepId2, StepAttempt2, StepStatus2, StepMaxRetries2, StepTracePropagated2, StepSkipped2, StepSkipReason2, StepArgumentsCount2, StepResultType2, StepErrorName2, StepErrorMessage2, StepFatalError2, StepRetryExhausted2, StepRetryTimeoutSeconds2, StepRetryWillRetry2, MessagingSystem2, MessagingDestinationName2, MessagingMessageId2, MessagingOperationType2, QueueOverheadMs2, DeploymentId2, HookToken2, HookId2, HookFound2, WebhookHandlersTriggered2, WorkflowSuspensionState2, WorkflowSuspensionHookCount2, WorkflowSuspensionStepCount2, WorkflowSuspensionWaitCount2, HttpRequestMethod2, UrlFull2, ServerAddress2, ServerPort2, HttpResponseStatusCode2, ErrorType2, WorldParseFormat2, WorkflowEventsPagesLoaded2, QueueDeserializeTimeMs2, QueueExecutionTimeMs2, QueueSerializeTimeMs2, SerializationOperation2, SerializationCompressed2, SerializationCodec2, SerializationUncompressedBytes2, SerializationStoredBytes2, SerializationCompressionRatio2, PeerService2, RpcSystem2, RpcService2, RpcMethod2, ErrorRetryable2, ErrorCategory2;
|
|
17058
17083
|
var init_semantic_conventions2 = __esm({
|
|
17059
17084
|
"../core/dist/telemetry/semantic-conventions.js"() {
|
|
17060
17085
|
"use strict";
|
|
@@ -17068,6 +17093,7 @@ var init_semantic_conventions2 = __esm({
|
|
|
17068
17093
|
WorkflowArgumentsCount2 = SemanticConvention2("workflow.arguments.count");
|
|
17069
17094
|
WorkflowResultType2 = SemanticConvention2("workflow.result.type");
|
|
17070
17095
|
WorkflowTracePropagated2 = SemanticConvention2("workflow.trace.propagated");
|
|
17096
|
+
WorkflowTraceMode2 = SemanticConvention2("workflow.trace.mode");
|
|
17071
17097
|
WorkflowErrorName2 = SemanticConvention2("workflow.error.name");
|
|
17072
17098
|
WorkflowErrorMessage2 = SemanticConvention2("workflow.error.message");
|
|
17073
17099
|
WorkflowErrorCode2 = SemanticConvention2("workflow.error.code");
|
|
@@ -17115,6 +17141,12 @@ var init_semantic_conventions2 = __esm({
|
|
|
17115
17141
|
QueueDeserializeTimeMs2 = SemanticConvention2("workflow.queue.deserialize_time_ms");
|
|
17116
17142
|
QueueExecutionTimeMs2 = SemanticConvention2("workflow.queue.execution_time_ms");
|
|
17117
17143
|
QueueSerializeTimeMs2 = SemanticConvention2("workflow.queue.serialize_time_ms");
|
|
17144
|
+
SerializationOperation2 = SemanticConvention2("workflow.serialization.operation");
|
|
17145
|
+
SerializationCompressed2 = SemanticConvention2("workflow.serialization.compressed");
|
|
17146
|
+
SerializationCodec2 = SemanticConvention2("workflow.serialization.codec");
|
|
17147
|
+
SerializationUncompressedBytes2 = SemanticConvention2("workflow.serialization.uncompressed_bytes");
|
|
17148
|
+
SerializationStoredBytes2 = SemanticConvention2("workflow.serialization.stored_bytes");
|
|
17149
|
+
SerializationCompressionRatio2 = SemanticConvention2("workflow.serialization.compression_ratio");
|
|
17118
17150
|
PeerService2 = SemanticConvention2("peer.service");
|
|
17119
17151
|
RpcSystem2 = SemanticConvention2("rpc.system");
|
|
17120
17152
|
RpcService2 = SemanticConvention2("rpc.service");
|
|
@@ -18813,6 +18845,32 @@ var init_esm = __esm({
|
|
|
18813
18845
|
});
|
|
18814
18846
|
|
|
18815
18847
|
// ../core/dist/telemetry.js
|
|
18848
|
+
function getWorkflowTraceMode() {
|
|
18849
|
+
const value = process.env.WORKFLOW_TRACE_MODE;
|
|
18850
|
+
if (value === "continuous")
|
|
18851
|
+
return "continuous";
|
|
18852
|
+
if (value && value !== "linked" && !warnedUnrecognizedTraceModes.has(value)) {
|
|
18853
|
+
warnedUnrecognizedTraceModes.add(value);
|
|
18854
|
+
runtimeLogger2.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${value}"; expected "linked" or "continuous". Falling back to "linked".`);
|
|
18855
|
+
}
|
|
18856
|
+
return "linked";
|
|
18857
|
+
}
|
|
18858
|
+
function isUsableTraceCarrier(carrier) {
|
|
18859
|
+
return carrier !== void 0 && Object.keys(carrier).length > 0;
|
|
18860
|
+
}
|
|
18861
|
+
function getNextTraceCarrier(traceMode, incomingCarrier) {
|
|
18862
|
+
return traceMode === "linked" && isUsableTraceCarrier(incomingCarrier) ? Promise.resolve(incomingCarrier) : serializeTraceCarrier2();
|
|
18863
|
+
}
|
|
18864
|
+
async function buildInvocationSpanLinks(traceMode, incomingCarrier) {
|
|
18865
|
+
const deliveryLinks = await linkToCurrentContext();
|
|
18866
|
+
if (traceMode !== "linked")
|
|
18867
|
+
return deliveryLinks;
|
|
18868
|
+
const originLink = await linkToTraceCarrier2(isUsableTraceCarrier(incomingCarrier) ? incomingCarrier : void 0);
|
|
18869
|
+
if (!originLink || deliveryLinks?.some((link) => link.context.traceId === originLink.context.traceId && link.context.spanId === originLink.context.spanId)) {
|
|
18870
|
+
return deliveryLinks;
|
|
18871
|
+
}
|
|
18872
|
+
return [...deliveryLinks ?? [], originLink];
|
|
18873
|
+
}
|
|
18816
18874
|
async function serializeTraceCarrier2() {
|
|
18817
18875
|
const otel = await OtelApi2.value;
|
|
18818
18876
|
if (!otel)
|
|
@@ -18906,6 +18964,19 @@ function linkToCurrentContext() {
|
|
|
18906
18964
|
return [{ context: context2 }];
|
|
18907
18965
|
});
|
|
18908
18966
|
}
|
|
18967
|
+
async function linkToTraceCarrier2(carrier) {
|
|
18968
|
+
if (!carrier)
|
|
18969
|
+
return;
|
|
18970
|
+
const [context2, otel] = await Promise.all([
|
|
18971
|
+
getSpanContextForTraceCarrier2(carrier),
|
|
18972
|
+
OtelApi2.value
|
|
18973
|
+
]);
|
|
18974
|
+
if (!context2 || !otel)
|
|
18975
|
+
return;
|
|
18976
|
+
if (!otel.trace.isSpanContextValid(context2))
|
|
18977
|
+
return;
|
|
18978
|
+
return { context: context2 };
|
|
18979
|
+
}
|
|
18909
18980
|
async function withWorkflowBaggage(context2, fn) {
|
|
18910
18981
|
const otel = await OtelApi2.value;
|
|
18911
18982
|
if (!otel)
|
|
@@ -18917,7 +18988,7 @@ async function withWorkflowBaggage(context2, fn) {
|
|
|
18917
18988
|
const contextWithBaggage = otel.propagation.setBaggage(otel.context.active(), baggage);
|
|
18918
18989
|
return otel.context.with(contextWithBaggage, () => fn());
|
|
18919
18990
|
}
|
|
18920
|
-
var OtelApi2, Tracer2;
|
|
18991
|
+
var warnedUnrecognizedTraceModes, OtelApi2, Tracer2;
|
|
18921
18992
|
var init_telemetry2 = __esm({
|
|
18922
18993
|
"../core/dist/telemetry.js"() {
|
|
18923
18994
|
"use strict";
|
|
@@ -18925,6 +18996,11 @@ var init_telemetry2 = __esm({
|
|
|
18925
18996
|
init_global2();
|
|
18926
18997
|
init_logger2();
|
|
18927
18998
|
init_semantic_conventions2();
|
|
18999
|
+
warnedUnrecognizedTraceModes = /* @__PURE__ */ new Set();
|
|
19000
|
+
__name(getWorkflowTraceMode, "getWorkflowTraceMode");
|
|
19001
|
+
__name(isUsableTraceCarrier, "isUsableTraceCarrier");
|
|
19002
|
+
__name(getNextTraceCarrier, "getNextTraceCarrier");
|
|
19003
|
+
__name(buildInvocationSpanLinks, "buildInvocationSpanLinks");
|
|
18928
19004
|
__name(serializeTraceCarrier2, "serializeTraceCarrier");
|
|
18929
19005
|
__name(deserializeTraceCarrier2, "deserializeTraceCarrier");
|
|
18930
19006
|
__name(withTraceContext, "withTraceContext");
|
|
@@ -18949,6 +19025,7 @@ var init_telemetry2 = __esm({
|
|
|
18949
19025
|
__name(getSpanKind, "getSpanKind");
|
|
18950
19026
|
__name(withOtel2, "withOtel");
|
|
18951
19027
|
__name(linkToCurrentContext, "linkToCurrentContext");
|
|
19028
|
+
__name(linkToTraceCarrier2, "linkToTraceCarrier");
|
|
18952
19029
|
__name(withWorkflowBaggage, "withWorkflowBaggage");
|
|
18953
19030
|
}
|
|
18954
19031
|
});
|
|
@@ -19108,7 +19185,7 @@ var version4;
|
|
|
19108
19185
|
var init_version3 = __esm({
|
|
19109
19186
|
"../core/dist/version.js"() {
|
|
19110
19187
|
"use strict";
|
|
19111
|
-
version4 = "5.0.0-beta.
|
|
19188
|
+
version4 = "5.0.0-beta.18";
|
|
19112
19189
|
}
|
|
19113
19190
|
});
|
|
19114
19191
|
|
|
@@ -20842,7 +20919,11 @@ var init_types3 = __esm({
|
|
|
20842
20919
|
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
20843
20920
|
DEVALUE_V1: "devl",
|
|
20844
20921
|
/** Encrypted payload (inner payload has its own format prefix) */
|
|
20845
|
-
ENCRYPTED: "encr"
|
|
20922
|
+
ENCRYPTED: "encr",
|
|
20923
|
+
/** Gzip-compressed payload (inner payload has its own format prefix) */
|
|
20924
|
+
GZIP: "gzip",
|
|
20925
|
+
/** Zstandard-compressed payload (inner payload has its own format prefix) */
|
|
20926
|
+
ZSTD: "zstd"
|
|
20846
20927
|
};
|
|
20847
20928
|
}
|
|
20848
20929
|
});
|
|
@@ -20991,6 +21072,168 @@ var init_format2 = __esm({
|
|
|
20991
21072
|
}
|
|
20992
21073
|
});
|
|
20993
21074
|
|
|
21075
|
+
// ../core/dist/serialization/compression.js
|
|
21076
|
+
function isCompressionDisabledByEnv2() {
|
|
21077
|
+
try {
|
|
21078
|
+
return typeof process !== "undefined" && process.env?.WORKFLOW_DISABLE_COMPRESSION === "1";
|
|
21079
|
+
} catch {
|
|
21080
|
+
return false;
|
|
21081
|
+
}
|
|
21082
|
+
}
|
|
21083
|
+
function codecOverrideFromEnv2() {
|
|
21084
|
+
try {
|
|
21085
|
+
const v = process.env?.WORKFLOW_COMPRESSION_CODEC;
|
|
21086
|
+
return v === "gzip" || v === "zstd" ? v : void 0;
|
|
21087
|
+
} catch {
|
|
21088
|
+
return void 0;
|
|
21089
|
+
}
|
|
21090
|
+
}
|
|
21091
|
+
function getNodeZlib2() {
|
|
21092
|
+
try {
|
|
21093
|
+
return globalThis.process?.getBuiltinModule?.("node:zlib");
|
|
21094
|
+
} catch {
|
|
21095
|
+
return void 0;
|
|
21096
|
+
}
|
|
21097
|
+
}
|
|
21098
|
+
function isZstdAvailable2() {
|
|
21099
|
+
const z3 = getNodeZlib2();
|
|
21100
|
+
return typeof z3?.zstdCompressSync === "function" && typeof z3?.zstdDecompressSync === "function";
|
|
21101
|
+
}
|
|
21102
|
+
function isGzipAvailable2() {
|
|
21103
|
+
return typeof CompressionStream === "function" && typeof DecompressionStream === "function";
|
|
21104
|
+
}
|
|
21105
|
+
async function pipeThroughTransform2(data, transform3) {
|
|
21106
|
+
const writer = transform3.writable.getWriter();
|
|
21107
|
+
const writePromise = writer.write(data).then(() => writer.close());
|
|
21108
|
+
writePromise.catch(() => {
|
|
21109
|
+
});
|
|
21110
|
+
const chunks = [];
|
|
21111
|
+
let total = 0;
|
|
21112
|
+
const reader = transform3.readable.getReader();
|
|
21113
|
+
for (; ; ) {
|
|
21114
|
+
const { done, value } = await reader.read();
|
|
21115
|
+
if (done)
|
|
21116
|
+
break;
|
|
21117
|
+
chunks.push(value);
|
|
21118
|
+
total += value.length;
|
|
21119
|
+
}
|
|
21120
|
+
await writePromise;
|
|
21121
|
+
const out = new Uint8Array(total);
|
|
21122
|
+
let offset = 0;
|
|
21123
|
+
for (const chunk of chunks) {
|
|
21124
|
+
out.set(chunk, offset);
|
|
21125
|
+
offset += chunk.length;
|
|
21126
|
+
}
|
|
21127
|
+
return out;
|
|
21128
|
+
}
|
|
21129
|
+
async function gzipBytes2(data) {
|
|
21130
|
+
return pipeThroughTransform2(data, new CompressionStream("gzip"));
|
|
21131
|
+
}
|
|
21132
|
+
async function gunzipBytes2(data) {
|
|
21133
|
+
return pipeThroughTransform2(data, new DecompressionStream("gzip"));
|
|
21134
|
+
}
|
|
21135
|
+
function zstdBytes2(data) {
|
|
21136
|
+
const z3 = getNodeZlib2();
|
|
21137
|
+
const level = z3?.constants?.ZSTD_c_compressionLevel;
|
|
21138
|
+
const opts = level !== void 0 ? { params: { [level]: ZSTD_LEVEL2 } } : void 0;
|
|
21139
|
+
return new Uint8Array(z3.zstdCompressSync(data, opts));
|
|
21140
|
+
}
|
|
21141
|
+
function unzstdBytes2(data) {
|
|
21142
|
+
const z3 = getNodeZlib2();
|
|
21143
|
+
if (!z3?.zstdDecompressSync) {
|
|
21144
|
+
throw new Error("Compressed (zstd) workflow data encountered but node:zlib zstd support is not available in this runtime (requires Node.js 22.15+). In the browser, register a zstd decoder via registerZstdDecoder (serialization-format.ts).");
|
|
21145
|
+
}
|
|
21146
|
+
return new Uint8Array(z3.zstdDecompressSync(data));
|
|
21147
|
+
}
|
|
21148
|
+
function recordStats2(stats, codec3, uncompressedBytes, storedBytes) {
|
|
21149
|
+
if (!stats)
|
|
21150
|
+
return;
|
|
21151
|
+
stats.recorded = true;
|
|
21152
|
+
stats.compressed = codec3 !== "none";
|
|
21153
|
+
stats.codec = codec3;
|
|
21154
|
+
stats.uncompressedBytes = uncompressedBytes;
|
|
21155
|
+
stats.storedBytes = storedBytes;
|
|
21156
|
+
}
|
|
21157
|
+
function selectWriteCodec2() {
|
|
21158
|
+
const override = codecOverrideFromEnv2();
|
|
21159
|
+
if (override === "gzip")
|
|
21160
|
+
return isGzipAvailable2() ? "gzip" : "none";
|
|
21161
|
+
if (isZstdAvailable2())
|
|
21162
|
+
return "zstd";
|
|
21163
|
+
if (isGzipAvailable2())
|
|
21164
|
+
return "gzip";
|
|
21165
|
+
return "none";
|
|
21166
|
+
}
|
|
21167
|
+
async function compress2(data, enabled, stats) {
|
|
21168
|
+
if (!(data instanceof Uint8Array))
|
|
21169
|
+
return data;
|
|
21170
|
+
if (!enabled || data.length < COMPRESSION_MIN_BYTES2 || isCompressionDisabledByEnv2()) {
|
|
21171
|
+
recordStats2(stats, "none", data.length, data.length);
|
|
21172
|
+
return data;
|
|
21173
|
+
}
|
|
21174
|
+
const codec3 = selectWriteCodec2();
|
|
21175
|
+
if (codec3 === "none") {
|
|
21176
|
+
recordStats2(stats, "none", data.length, data.length);
|
|
21177
|
+
return data;
|
|
21178
|
+
}
|
|
21179
|
+
const compressed = codec3 === "zstd" ? zstdBytes2(data) : await gzipBytes2(data);
|
|
21180
|
+
const format = codec3 === "zstd" ? SerializationFormat2.ZSTD : SerializationFormat2.GZIP;
|
|
21181
|
+
const wrappedLength = 4 + compressed.length;
|
|
21182
|
+
if (wrappedLength >= data.length * (1 - COMPRESSION_MIN_SAVINGS_RATIO2)) {
|
|
21183
|
+
recordStats2(stats, "none", data.length, data.length);
|
|
21184
|
+
return data;
|
|
21185
|
+
}
|
|
21186
|
+
recordStats2(stats, codec3, data.length, wrappedLength);
|
|
21187
|
+
return encodeWithFormatPrefix2(format, compressed);
|
|
21188
|
+
}
|
|
21189
|
+
async function decompress2(data, stats) {
|
|
21190
|
+
if (!(data instanceof Uint8Array))
|
|
21191
|
+
return data;
|
|
21192
|
+
const prefix = peekFormatPrefix2(data);
|
|
21193
|
+
if (prefix === SerializationFormat2.ZSTD) {
|
|
21194
|
+
const { payload } = decodeFormatPrefix2(data);
|
|
21195
|
+
const inflated = unzstdBytes2(payload);
|
|
21196
|
+
recordStats2(stats, "zstd", inflated.length, data.length);
|
|
21197
|
+
return inflated;
|
|
21198
|
+
}
|
|
21199
|
+
if (prefix === SerializationFormat2.GZIP) {
|
|
21200
|
+
if (!isGzipAvailable2()) {
|
|
21201
|
+
throw new Error("Compressed (gzip) workflow data encountered but DecompressionStream is not available in this runtime. Node.js 18+, browsers, and edge runtimes all support it.");
|
|
21202
|
+
}
|
|
21203
|
+
const { payload } = decodeFormatPrefix2(data);
|
|
21204
|
+
const inflated = await gunzipBytes2(payload);
|
|
21205
|
+
recordStats2(stats, "gzip", inflated.length, data.length);
|
|
21206
|
+
return inflated;
|
|
21207
|
+
}
|
|
21208
|
+
recordStats2(stats, "none", data.length, data.length);
|
|
21209
|
+
return data;
|
|
21210
|
+
}
|
|
21211
|
+
var COMPRESSION_MIN_BYTES2, COMPRESSION_MIN_SAVINGS_RATIO2, ZSTD_LEVEL2;
|
|
21212
|
+
var init_compression2 = __esm({
|
|
21213
|
+
"../core/dist/serialization/compression.js"() {
|
|
21214
|
+
"use strict";
|
|
21215
|
+
init_format2();
|
|
21216
|
+
init_types3();
|
|
21217
|
+
COMPRESSION_MIN_BYTES2 = 1024;
|
|
21218
|
+
COMPRESSION_MIN_SAVINGS_RATIO2 = 0.05;
|
|
21219
|
+
ZSTD_LEVEL2 = 3;
|
|
21220
|
+
__name(isCompressionDisabledByEnv2, "isCompressionDisabledByEnv");
|
|
21221
|
+
__name(codecOverrideFromEnv2, "codecOverrideFromEnv");
|
|
21222
|
+
__name(getNodeZlib2, "getNodeZlib");
|
|
21223
|
+
__name(isZstdAvailable2, "isZstdAvailable");
|
|
21224
|
+
__name(isGzipAvailable2, "isGzipAvailable");
|
|
21225
|
+
__name(pipeThroughTransform2, "pipeThroughTransform");
|
|
21226
|
+
__name(gzipBytes2, "gzipBytes");
|
|
21227
|
+
__name(gunzipBytes2, "gunzipBytes");
|
|
21228
|
+
__name(zstdBytes2, "zstdBytes");
|
|
21229
|
+
__name(unzstdBytes2, "unzstdBytes");
|
|
21230
|
+
__name(recordStats2, "recordStats");
|
|
21231
|
+
__name(selectWriteCodec2, "selectWriteCodec");
|
|
21232
|
+
__name(compress2, "compress");
|
|
21233
|
+
__name(decompress2, "decompress");
|
|
21234
|
+
}
|
|
21235
|
+
});
|
|
21236
|
+
|
|
20994
21237
|
// ../core/dist/serialization/encryption.js
|
|
20995
21238
|
async function resolveEncryptionKey2(key) {
|
|
20996
21239
|
return typeof key === "function" ? key() : key;
|
|
@@ -21073,7 +21316,7 @@ var init_errors6 = __esm({
|
|
|
21073
21316
|
|
|
21074
21317
|
// ../core/dist/serialization/client.js
|
|
21075
21318
|
async function deserialize3(data, encryptionKey, options) {
|
|
21076
|
-
const decrypted = await decrypt4(data, encryptionKey);
|
|
21319
|
+
const decrypted = await decompress2(await decrypt4(data, encryptionKey), options?.compressionStats);
|
|
21077
21320
|
if (!(decrypted instanceof Uint8Array)) {
|
|
21078
21321
|
if (devalueCodec2.deserializeLegacy) {
|
|
21079
21322
|
return devalueCodec2.deserializeLegacy(decrypted, "client", options);
|
|
@@ -21091,6 +21334,7 @@ var init_client2 = __esm({
|
|
|
21091
21334
|
"use strict";
|
|
21092
21335
|
init_dist6();
|
|
21093
21336
|
init_codec_devalue2();
|
|
21337
|
+
init_compression2();
|
|
21094
21338
|
init_encryption4();
|
|
21095
21339
|
init_errors6();
|
|
21096
21340
|
init_format2();
|
|
@@ -21104,7 +21348,8 @@ async function serialize3(value, encryptionKey, options) {
|
|
|
21104
21348
|
try {
|
|
21105
21349
|
const payload = devalueCodec2.serialize(value, "step", options);
|
|
21106
21350
|
const prefixed = encodeWithFormatPrefix2(SerializationFormat2.DEVALUE_V1, payload);
|
|
21107
|
-
|
|
21351
|
+
const compressed = await compress2(prefixed, options?.compression === true, options?.compressionStats);
|
|
21352
|
+
return encrypt4(compressed, encryptionKey);
|
|
21108
21353
|
} catch (error95) {
|
|
21109
21354
|
rethrowIfRuntimeError2(error95);
|
|
21110
21355
|
const { message, hint: hint3 } = formatSerializationError2("step value", error95);
|
|
@@ -21112,7 +21357,7 @@ async function serialize3(value, encryptionKey, options) {
|
|
|
21112
21357
|
}
|
|
21113
21358
|
}
|
|
21114
21359
|
async function deserialize4(data, encryptionKey, options) {
|
|
21115
|
-
const decrypted = await decrypt4(data, encryptionKey);
|
|
21360
|
+
const decrypted = await decompress2(await decrypt4(data, encryptionKey), options?.compressionStats);
|
|
21116
21361
|
if (!(decrypted instanceof Uint8Array)) {
|
|
21117
21362
|
if (devalueCodec2.deserializeLegacy) {
|
|
21118
21363
|
return devalueCodec2.deserializeLegacy(decrypted, "step", options);
|
|
@@ -21130,6 +21375,7 @@ var init_step2 = __esm({
|
|
|
21130
21375
|
"use strict";
|
|
21131
21376
|
init_dist6();
|
|
21132
21377
|
init_codec_devalue2();
|
|
21378
|
+
init_compression2();
|
|
21133
21379
|
init_encryption4();
|
|
21134
21380
|
init_errors6();
|
|
21135
21381
|
init_format2();
|
|
@@ -23522,7 +23768,15 @@ var init_capabilities2 = __esm({
|
|
|
23522
23768
|
import_semver3 = __toESM(require_semver5(), 1);
|
|
23523
23769
|
init_serialization4();
|
|
23524
23770
|
FORMAT_VERSION_TABLE2 = [
|
|
23525
|
-
{ format: SerializationFormat2.ENCRYPTED, minVersion: "4.2.0-beta.64" }
|
|
23771
|
+
{ format: SerializationFormat2.ENCRYPTED, minVersion: "4.2.0-beta.64" },
|
|
23772
|
+
// TODO(release): verify this matches the actual version that ships payload
|
|
23773
|
+
// compression. If a "Version Packages (beta)" PR merges before this change,
|
|
23774
|
+
// bump to the next beta. A too-low cutoff makes new producers write
|
|
23775
|
+
// compressed payloads to consumers that cannot decompress them; too-high
|
|
23776
|
+
// merely delays the optimization (safe). gzip and zstd ship together, so
|
|
23777
|
+
// they share a min version — a run that can read one can read both.
|
|
23778
|
+
{ format: SerializationFormat2.GZIP, minVersion: "5.0.0-beta.18" },
|
|
23779
|
+
{ format: SerializationFormat2.ZSTD, minVersion: "5.0.0-beta.18" }
|
|
23526
23780
|
// Future entries:
|
|
23527
23781
|
// { format: SerializationFormat.CBOR, minVersion: '5.x.y' },
|
|
23528
23782
|
// { format: SerializationFormat.ENCRYPTED_V2, minVersion: '5.x.y' },
|
|
@@ -24728,9 +24982,10 @@ async function resumeHook2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
24728
24982
|
if (!capabilities.supportedFormats.has(SerializationFormat2.ENCRYPTED)) {
|
|
24729
24983
|
encryptionKey = void 0;
|
|
24730
24984
|
}
|
|
24985
|
+
const compression = (workflowRun.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2 && capabilities.supportedFormats.has(SerializationFormat2.GZIP);
|
|
24731
24986
|
const ops = [];
|
|
24732
24987
|
const v1Compat = isLegacySpecVersion2(hook.specVersion);
|
|
24733
|
-
const dehydratedPayload = await dehydrateStepReturnValue2(payload, hook.runId, encryptionKey, ops, globalThis, v1Compat, capabilities.framedByteStreams);
|
|
24988
|
+
const dehydratedPayload = await dehydrateStepReturnValue2(payload, hook.runId, encryptionKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression);
|
|
24734
24989
|
safeWaitUntil2(Promise.all(ops), (err) => {
|
|
24735
24990
|
if (err === void 0)
|
|
24736
24991
|
return;
|
|
@@ -24752,12 +25007,9 @@ async function resumeHook2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
24752
25007
|
span?.setAttributes({
|
|
24753
25008
|
...WorkflowName2(workflowRun.workflowName)
|
|
24754
25009
|
});
|
|
24755
|
-
const
|
|
24756
|
-
if (
|
|
24757
|
-
|
|
24758
|
-
if (context2) {
|
|
24759
|
-
span?.addLink?.({ context: context2 });
|
|
24760
|
-
}
|
|
25010
|
+
const originLink = await linkToTraceCarrier2(workflowRun.executionContext?.traceCarrier);
|
|
25011
|
+
if (originLink) {
|
|
25012
|
+
span?.addLink?.(originLink);
|
|
24761
25013
|
}
|
|
24762
25014
|
await world.queue(getWorkflowQueueName2(workflowRun.workflowName), {
|
|
24763
25015
|
runId: hook.runId,
|
|
@@ -24855,6 +25107,26 @@ function unwrapSerializationCause2(error95) {
|
|
|
24855
25107
|
}
|
|
24856
25108
|
return error95;
|
|
24857
25109
|
}
|
|
25110
|
+
async function recordCompression2(stats, operation) {
|
|
25111
|
+
if (!stats.recorded)
|
|
25112
|
+
return;
|
|
25113
|
+
try {
|
|
25114
|
+
const span = await getActiveSpan3();
|
|
25115
|
+
if (!span)
|
|
25116
|
+
return;
|
|
25117
|
+
const uncompressedBytes = stats.uncompressedBytes ?? 0;
|
|
25118
|
+
const storedBytes = stats.storedBytes ?? 0;
|
|
25119
|
+
span.setAttributes({
|
|
25120
|
+
...SerializationOperation2(operation),
|
|
25121
|
+
...SerializationCompressed2(stats.compressed ?? false),
|
|
25122
|
+
...SerializationCodec2(stats.codec ?? "none"),
|
|
25123
|
+
...SerializationUncompressedBytes2(uncompressedBytes),
|
|
25124
|
+
...SerializationStoredBytes2(storedBytes),
|
|
25125
|
+
...stats.compressed && uncompressedBytes > 0 ? SerializationCompressionRatio2(1 - storedBytes / uncompressedBytes) : {}
|
|
25126
|
+
});
|
|
25127
|
+
} catch {
|
|
25128
|
+
}
|
|
25129
|
+
}
|
|
24858
25130
|
function getSerializeStream2(reducers, cryptoKey) {
|
|
24859
25131
|
const encoder3 = new TextEncoder();
|
|
24860
25132
|
const keyState = { resolved: false, key: void 0 };
|
|
@@ -25904,7 +26176,10 @@ async function maybeDecrypt2(data, key) {
|
|
|
25904
26176
|
return decrypt4(data, key);
|
|
25905
26177
|
}
|
|
25906
26178
|
async function hydrateWorkflowArguments(value, _runId, key, global2 = globalThis, extraRevivers = {}) {
|
|
25907
|
-
|
|
26179
|
+
const compressionStats = {};
|
|
26180
|
+
const inflated = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26181
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26182
|
+
return deserialize5(inflated, {
|
|
25908
26183
|
global: global2,
|
|
25909
26184
|
extraRevivers: {
|
|
25910
26185
|
...getStreamAndRequestRevivers2(getWorkflowRevivers(global2)),
|
|
@@ -25912,16 +26187,21 @@ async function hydrateWorkflowArguments(value, _runId, key, global2 = globalThis
|
|
|
25912
26187
|
}
|
|
25913
26188
|
});
|
|
25914
26189
|
}
|
|
25915
|
-
async function dehydrateWorkflowReturnValue(value, _runId, key, global2 = globalThis, v1Compat = false) {
|
|
26190
|
+
async function dehydrateWorkflowReturnValue(value, _runId, key, global2 = globalThis, v1Compat = false, compression = false) {
|
|
25916
26191
|
if (v1Compat) {
|
|
25917
26192
|
const str = stringify2(value, getWorkflowReducers2(global2));
|
|
25918
26193
|
return revive2(str);
|
|
25919
26194
|
}
|
|
25920
26195
|
try {
|
|
25921
|
-
|
|
26196
|
+
const compressionStats = {};
|
|
26197
|
+
const result = await serialize3(value, key, {
|
|
25922
26198
|
global: global2,
|
|
25923
|
-
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2))
|
|
26199
|
+
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2)),
|
|
26200
|
+
compression,
|
|
26201
|
+
compressionStats
|
|
25924
26202
|
});
|
|
26203
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26204
|
+
return result;
|
|
25925
26205
|
} catch (error95) {
|
|
25926
26206
|
const cause = unwrapSerializationCause2(error95);
|
|
25927
26207
|
const { message, hint: hint3 } = formatSerializationError2("workflow return value", cause);
|
|
@@ -25929,24 +26209,33 @@ async function dehydrateWorkflowReturnValue(value, _runId, key, global2 = global
|
|
|
25929
26209
|
}
|
|
25930
26210
|
}
|
|
25931
26211
|
async function hydrateWorkflowReturnValue2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
25932
|
-
|
|
26212
|
+
const compressionStats = {};
|
|
26213
|
+
const result = await deserialize3(value, key, {
|
|
25933
26214
|
global: global2,
|
|
25934
26215
|
extraRevivers: {
|
|
25935
26216
|
...getStreamAndRequestRevivers2(getExternalRevivers2(global2, ops, runId, key)),
|
|
25936
26217
|
...extraRevivers
|
|
25937
|
-
}
|
|
26218
|
+
},
|
|
26219
|
+
compressionStats
|
|
25938
26220
|
});
|
|
26221
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26222
|
+
return result;
|
|
25939
26223
|
}
|
|
25940
|
-
async function dehydrateStepArguments2(value, _runId, key, global2 = globalThis, v1Compat = false) {
|
|
26224
|
+
async function dehydrateStepArguments2(value, _runId, key, global2 = globalThis, v1Compat = false, compression = false) {
|
|
25941
26225
|
if (v1Compat) {
|
|
25942
26226
|
const str = stringify2(value, getWorkflowReducers2(global2));
|
|
25943
26227
|
return revive2(str);
|
|
25944
26228
|
}
|
|
25945
26229
|
try {
|
|
25946
|
-
|
|
26230
|
+
const compressionStats = {};
|
|
26231
|
+
const result = await serialize3(value, key, {
|
|
25947
26232
|
global: global2,
|
|
25948
|
-
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2))
|
|
26233
|
+
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2)),
|
|
26234
|
+
compression,
|
|
26235
|
+
compressionStats
|
|
25949
26236
|
});
|
|
26237
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26238
|
+
return result;
|
|
25950
26239
|
} catch (error95) {
|
|
25951
26240
|
const cause = unwrapSerializationCause2(error95);
|
|
25952
26241
|
const { message, hint: hint3 } = formatSerializationError2("step arguments", cause);
|
|
@@ -25954,36 +26243,49 @@ async function dehydrateStepArguments2(value, _runId, key, global2 = globalThis,
|
|
|
25954
26243
|
}
|
|
25955
26244
|
}
|
|
25956
26245
|
async function hydrateStepArguments2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId) {
|
|
25957
|
-
|
|
26246
|
+
const compressionStats = {};
|
|
26247
|
+
const result = await deserialize4(value, key, {
|
|
25958
26248
|
global: global2,
|
|
25959
26249
|
extraRevivers: {
|
|
25960
26250
|
...getStreamAndRequestRevivers2(getStepRevivers2(global2, ops, runId, key, deploymentId)),
|
|
25961
26251
|
...extraRevivers
|
|
25962
|
-
}
|
|
26252
|
+
},
|
|
26253
|
+
compressionStats
|
|
25963
26254
|
});
|
|
26255
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26256
|
+
return result;
|
|
25964
26257
|
}
|
|
25965
|
-
async function dehydrateStepReturnValue2(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false) {
|
|
26258
|
+
async function dehydrateStepReturnValue2(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
|
|
25966
26259
|
if (v1Compat) {
|
|
25967
26260
|
const str = stringify2(value, getStepReducers2(global2, ops, runId, key, framedByteStreams));
|
|
25968
26261
|
return revive2(str);
|
|
25969
26262
|
}
|
|
25970
26263
|
try {
|
|
25971
|
-
|
|
26264
|
+
const compressionStats = {};
|
|
26265
|
+
const result = await serialize3(value, key, {
|
|
25972
26266
|
global: global2,
|
|
25973
|
-
extraReducers: getStreamAndRequestReducers2(getStepReducers2(global2, ops, runId, key, framedByteStreams))
|
|
26267
|
+
extraReducers: getStreamAndRequestReducers2(getStepReducers2(global2, ops, runId, key, framedByteStreams)),
|
|
26268
|
+
compression,
|
|
26269
|
+
compressionStats
|
|
25974
26270
|
});
|
|
26271
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26272
|
+
return result;
|
|
25975
26273
|
} catch (error95) {
|
|
25976
26274
|
const cause = unwrapSerializationCause2(error95);
|
|
25977
26275
|
const { message, hint: hint3 } = formatSerializationError2("step return value", cause);
|
|
25978
26276
|
throw new SerializationError2(message, { hint: hint3, cause });
|
|
25979
26277
|
}
|
|
25980
26278
|
}
|
|
25981
|
-
async function dehydrateStepError(value, runId, key, ops = [], global2 = globalThis) {
|
|
26279
|
+
async function dehydrateStepError(value, runId, key, ops = [], global2 = globalThis, compression = false) {
|
|
25982
26280
|
try {
|
|
25983
26281
|
const str = stringify2(value, getStepReducers2(global2, ops, runId, key));
|
|
25984
26282
|
const payload = new TextEncoder().encode(str);
|
|
25985
26283
|
const serialized = encodeWithFormatPrefix2(SerializationFormat2.DEVALUE_V1, payload);
|
|
25986
|
-
|
|
26284
|
+
const compressionStats = {};
|
|
26285
|
+
const compressed = await compress2(serialized, compression, compressionStats);
|
|
26286
|
+
const encrypted = await maybeEncrypt(compressed, key);
|
|
26287
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26288
|
+
return encrypted;
|
|
25987
26289
|
} catch (error95) {
|
|
25988
26290
|
const cause = unwrapSerializationCause2(error95);
|
|
25989
26291
|
const { message, hint: hint3 } = formatSerializationError2("step error", cause);
|
|
@@ -25991,7 +26293,9 @@ async function dehydrateStepError(value, runId, key, ops = [], global2 = globalT
|
|
|
25991
26293
|
}
|
|
25992
26294
|
}
|
|
25993
26295
|
async function hydrateStepError(value, _runId, key, global2 = globalThis, extraRevivers = {}) {
|
|
25994
|
-
const
|
|
26296
|
+
const compressionStats = {};
|
|
26297
|
+
const decrypted = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26298
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
25995
26299
|
if (!(decrypted instanceof Uint8Array)) {
|
|
25996
26300
|
return unflatten2(decrypted, {
|
|
25997
26301
|
...getWorkflowRevivers(global2),
|
|
@@ -26008,12 +26312,16 @@ async function hydrateStepError(value, _runId, key, global2 = globalThis, extraR
|
|
|
26008
26312
|
}
|
|
26009
26313
|
throw new Error(`Unsupported serialization format: ${format}`);
|
|
26010
26314
|
}
|
|
26011
|
-
async function dehydrateRunError(value, _runId, key, global2 = globalThis) {
|
|
26315
|
+
async function dehydrateRunError(value, _runId, key, global2 = globalThis, compression = false) {
|
|
26012
26316
|
try {
|
|
26013
26317
|
const str = stringify2(value, getWorkflowReducers2(global2));
|
|
26014
26318
|
const payload = new TextEncoder().encode(str);
|
|
26015
26319
|
const serialized = encodeWithFormatPrefix2(SerializationFormat2.DEVALUE_V1, payload);
|
|
26016
|
-
|
|
26320
|
+
const compressionStats = {};
|
|
26321
|
+
const compressed = await compress2(serialized, compression, compressionStats);
|
|
26322
|
+
const encrypted = await maybeEncrypt(compressed, key);
|
|
26323
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26324
|
+
return encrypted;
|
|
26017
26325
|
} catch (error95) {
|
|
26018
26326
|
const cause = unwrapSerializationCause2(error95);
|
|
26019
26327
|
const { message, hint: hint3 } = formatSerializationError2("run error", cause);
|
|
@@ -26021,7 +26329,9 @@ async function dehydrateRunError(value, _runId, key, global2 = globalThis) {
|
|
|
26021
26329
|
}
|
|
26022
26330
|
}
|
|
26023
26331
|
async function hydrateRunError2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
26024
|
-
const
|
|
26332
|
+
const compressionStats = {};
|
|
26333
|
+
const decrypted = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26334
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26025
26335
|
if (!(decrypted instanceof Uint8Array)) {
|
|
26026
26336
|
return unflatten2(decrypted, {
|
|
26027
26337
|
...getExternalRevivers2(global2, ops, runId, key),
|
|
@@ -26039,7 +26349,10 @@ async function hydrateRunError2(value, runId, key, ops = [], global2 = globalThi
|
|
|
26039
26349
|
throw new Error(`Unsupported serialization format: ${format}`);
|
|
26040
26350
|
}
|
|
26041
26351
|
async function hydrateStepReturnValue(value, _runId, key, global2 = globalThis, extraRevivers = {}) {
|
|
26042
|
-
|
|
26352
|
+
const compressionStats = {};
|
|
26353
|
+
const inflated = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26354
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26355
|
+
return deserialize5(inflated, {
|
|
26043
26356
|
global: global2,
|
|
26044
26357
|
extraRevivers: {
|
|
26045
26358
|
...getStreamAndRequestRevivers2(getWorkflowRevivers(global2)),
|
|
@@ -26077,6 +26390,7 @@ var init_serialization4 = __esm({
|
|
|
26077
26390
|
init_private2();
|
|
26078
26391
|
init_get_world_lazy2();
|
|
26079
26392
|
init_client2();
|
|
26393
|
+
init_compression2();
|
|
26080
26394
|
init_encryption4();
|
|
26081
26395
|
init_errors6();
|
|
26082
26396
|
init_format2();
|
|
@@ -26088,12 +26402,15 @@ var init_serialization4 = __esm({
|
|
|
26088
26402
|
init_workflow2();
|
|
26089
26403
|
init_context_storage2();
|
|
26090
26404
|
init_symbols2();
|
|
26405
|
+
init_semantic_conventions2();
|
|
26406
|
+
init_telemetry2();
|
|
26091
26407
|
init_util4();
|
|
26092
26408
|
init_abort_controller2();
|
|
26093
26409
|
defaultUlid2 = monotonicFactory2();
|
|
26094
26410
|
__name(getStreamType2, "getStreamType");
|
|
26095
26411
|
FRAME_HEADER_SIZE2 = 4;
|
|
26096
26412
|
__name(unwrapSerializationCause2, "unwrapSerializationCause");
|
|
26413
|
+
__name(recordCompression2, "recordCompression");
|
|
26097
26414
|
__name(getSerializeStream2, "getSerializeStream");
|
|
26098
26415
|
__name(getDeserializeStream2, "getDeserializeStream");
|
|
26099
26416
|
MAX_FRAME_SIZE2 = 1e8;
|
|
@@ -54310,6 +54627,27 @@ function formatWorkflowName(name) {
|
|
|
54310
54627
|
return formatParsedName(parseWorkflowName(name), name);
|
|
54311
54628
|
}
|
|
54312
54629
|
__name(formatWorkflowName, "formatWorkflowName");
|
|
54630
|
+
function workflowDisplayName(name) {
|
|
54631
|
+
return parseWorkflowName(name)?.shortName ?? shortNameFromSanitized("workflow", name) ?? name;
|
|
54632
|
+
}
|
|
54633
|
+
__name(workflowDisplayName, "workflowDisplayName");
|
|
54634
|
+
function shortNameFromSanitized(tag, name) {
|
|
54635
|
+
if (!name.startsWith(`${tag}--`)) return null;
|
|
54636
|
+
const segments = name.split("--").filter(Boolean);
|
|
54637
|
+
const functionPart = segments.at(-1);
|
|
54638
|
+
let shortName = functionPart?.split("-").filter(Boolean).at(-1) ?? "";
|
|
54639
|
+
if ([
|
|
54640
|
+
"default",
|
|
54641
|
+
"__default"
|
|
54642
|
+
].includes(shortName)) {
|
|
54643
|
+
const moduleShortName = segments.at(-2)?.split("-").filter(Boolean).at(-1);
|
|
54644
|
+
if (moduleShortName && moduleShortName !== tag) {
|
|
54645
|
+
shortName = moduleShortName;
|
|
54646
|
+
}
|
|
54647
|
+
}
|
|
54648
|
+
return shortName || null;
|
|
54649
|
+
}
|
|
54650
|
+
__name(shortNameFromSanitized, "shortNameFromSanitized");
|
|
54313
54651
|
function formatParsedName(parsed, fallback) {
|
|
54314
54652
|
if (!parsed) return fallback;
|
|
54315
54653
|
return `${parsed.shortName} (${parsed.moduleSpecifier})`;
|
|
@@ -54323,6 +54661,8 @@ var init_parse_name = __esm2({
|
|
|
54323
54661
|
__name2(parseStepName, "parseStepName");
|
|
54324
54662
|
__name2(formatStepName, "formatStepName");
|
|
54325
54663
|
__name2(formatWorkflowName, "formatWorkflowName");
|
|
54664
|
+
__name2(workflowDisplayName, "workflowDisplayName");
|
|
54665
|
+
__name2(shortNameFromSanitized, "shortNameFromSanitized");
|
|
54326
54666
|
__name2(formatParsedName, "formatParsedName");
|
|
54327
54667
|
}
|
|
54328
54668
|
});
|
|
@@ -71862,6 +72202,7 @@ var SPEC_VERSION_LEGACY;
|
|
|
71862
72202
|
var SPEC_VERSION_SUPPORTS_EVENT_SOURCING;
|
|
71863
72203
|
var SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT;
|
|
71864
72204
|
var SPEC_VERSION_SUPPORTS_ATTRIBUTES;
|
|
72205
|
+
var SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
71865
72206
|
var SPEC_VERSION_CURRENT;
|
|
71866
72207
|
var init_spec_version = __esm2({
|
|
71867
72208
|
"../world/dist/spec-version.js"() {
|
|
@@ -71870,7 +72211,8 @@ var init_spec_version = __esm2({
|
|
|
71870
72211
|
SPEC_VERSION_SUPPORTS_EVENT_SOURCING = 2;
|
|
71871
72212
|
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
|
|
71872
72213
|
SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
|
|
71873
|
-
|
|
72214
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION = 5;
|
|
72215
|
+
SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
71874
72216
|
__name2(isLegacySpecVersion, "isLegacySpecVersion");
|
|
71875
72217
|
}
|
|
71876
72218
|
});
|
|
@@ -73677,7 +74019,11 @@ var init_types = __esm2({
|
|
|
73677
74019
|
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
73678
74020
|
DEVALUE_V1: "devl",
|
|
73679
74021
|
/** Encrypted payload (inner payload has its own format prefix) */
|
|
73680
|
-
ENCRYPTED: "encr"
|
|
74022
|
+
ENCRYPTED: "encr",
|
|
74023
|
+
/** Gzip-compressed payload (inner payload has its own format prefix) */
|
|
74024
|
+
GZIP: "gzip",
|
|
74025
|
+
/** Zstandard-compressed payload (inner payload has its own format prefix) */
|
|
74026
|
+
ZSTD: "zstd"
|
|
73681
74027
|
};
|
|
73682
74028
|
}
|
|
73683
74029
|
});
|
|
@@ -73839,6 +74185,179 @@ var init_format = __esm2({
|
|
|
73839
74185
|
__name2(decodeFormatPrefix, "decodeFormatPrefix");
|
|
73840
74186
|
}
|
|
73841
74187
|
});
|
|
74188
|
+
function isCompressionDisabledByEnv() {
|
|
74189
|
+
try {
|
|
74190
|
+
return typeof process !== "undefined" && process.env?.WORKFLOW_DISABLE_COMPRESSION === "1";
|
|
74191
|
+
} catch {
|
|
74192
|
+
return false;
|
|
74193
|
+
}
|
|
74194
|
+
}
|
|
74195
|
+
__name(isCompressionDisabledByEnv, "isCompressionDisabledByEnv");
|
|
74196
|
+
function codecOverrideFromEnv() {
|
|
74197
|
+
try {
|
|
74198
|
+
const v = process.env?.WORKFLOW_COMPRESSION_CODEC;
|
|
74199
|
+
return v === "gzip" || v === "zstd" ? v : void 0;
|
|
74200
|
+
} catch {
|
|
74201
|
+
return void 0;
|
|
74202
|
+
}
|
|
74203
|
+
}
|
|
74204
|
+
__name(codecOverrideFromEnv, "codecOverrideFromEnv");
|
|
74205
|
+
function getNodeZlib() {
|
|
74206
|
+
try {
|
|
74207
|
+
return globalThis.process?.getBuiltinModule?.("node:zlib");
|
|
74208
|
+
} catch {
|
|
74209
|
+
return void 0;
|
|
74210
|
+
}
|
|
74211
|
+
}
|
|
74212
|
+
__name(getNodeZlib, "getNodeZlib");
|
|
74213
|
+
function isZstdAvailable() {
|
|
74214
|
+
const z22 = getNodeZlib();
|
|
74215
|
+
return typeof z22?.zstdCompressSync === "function" && typeof z22?.zstdDecompressSync === "function";
|
|
74216
|
+
}
|
|
74217
|
+
__name(isZstdAvailable, "isZstdAvailable");
|
|
74218
|
+
function isGzipAvailable() {
|
|
74219
|
+
return typeof CompressionStream === "function" && typeof DecompressionStream === "function";
|
|
74220
|
+
}
|
|
74221
|
+
__name(isGzipAvailable, "isGzipAvailable");
|
|
74222
|
+
async function pipeThroughTransform(data, transform22) {
|
|
74223
|
+
const writer = transform22.writable.getWriter();
|
|
74224
|
+
const writePromise = writer.write(data).then(() => writer.close());
|
|
74225
|
+
writePromise.catch(() => {
|
|
74226
|
+
});
|
|
74227
|
+
const chunks = [];
|
|
74228
|
+
let total = 0;
|
|
74229
|
+
const reader = transform22.readable.getReader();
|
|
74230
|
+
for (; ; ) {
|
|
74231
|
+
const { done, value } = await reader.read();
|
|
74232
|
+
if (done) break;
|
|
74233
|
+
chunks.push(value);
|
|
74234
|
+
total += value.length;
|
|
74235
|
+
}
|
|
74236
|
+
await writePromise;
|
|
74237
|
+
const out = new Uint8Array(total);
|
|
74238
|
+
let offset = 0;
|
|
74239
|
+
for (const chunk of chunks) {
|
|
74240
|
+
out.set(chunk, offset);
|
|
74241
|
+
offset += chunk.length;
|
|
74242
|
+
}
|
|
74243
|
+
return out;
|
|
74244
|
+
}
|
|
74245
|
+
__name(pipeThroughTransform, "pipeThroughTransform");
|
|
74246
|
+
async function gzipBytes(data) {
|
|
74247
|
+
return pipeThroughTransform(data, new CompressionStream("gzip"));
|
|
74248
|
+
}
|
|
74249
|
+
__name(gzipBytes, "gzipBytes");
|
|
74250
|
+
async function gunzipBytes(data) {
|
|
74251
|
+
return pipeThroughTransform(data, new DecompressionStream("gzip"));
|
|
74252
|
+
}
|
|
74253
|
+
__name(gunzipBytes, "gunzipBytes");
|
|
74254
|
+
function zstdBytes(data) {
|
|
74255
|
+
const z22 = getNodeZlib();
|
|
74256
|
+
const level = z22?.constants?.ZSTD_c_compressionLevel;
|
|
74257
|
+
const opts = level !== void 0 ? {
|
|
74258
|
+
params: {
|
|
74259
|
+
[level]: ZSTD_LEVEL
|
|
74260
|
+
}
|
|
74261
|
+
} : void 0;
|
|
74262
|
+
return new Uint8Array(z22.zstdCompressSync(data, opts));
|
|
74263
|
+
}
|
|
74264
|
+
__name(zstdBytes, "zstdBytes");
|
|
74265
|
+
function unzstdBytes(data) {
|
|
74266
|
+
const z22 = getNodeZlib();
|
|
74267
|
+
if (!z22?.zstdDecompressSync) {
|
|
74268
|
+
throw new Error("Compressed (zstd) workflow data encountered but node:zlib zstd support is not available in this runtime (requires Node.js 22.15+). In the browser, register a zstd decoder via registerZstdDecoder (serialization-format.ts).");
|
|
74269
|
+
}
|
|
74270
|
+
return new Uint8Array(z22.zstdDecompressSync(data));
|
|
74271
|
+
}
|
|
74272
|
+
__name(unzstdBytes, "unzstdBytes");
|
|
74273
|
+
function recordStats(stats, codec22, uncompressedBytes, storedBytes) {
|
|
74274
|
+
if (!stats) return;
|
|
74275
|
+
stats.recorded = true;
|
|
74276
|
+
stats.compressed = codec22 !== "none";
|
|
74277
|
+
stats.codec = codec22;
|
|
74278
|
+
stats.uncompressedBytes = uncompressedBytes;
|
|
74279
|
+
stats.storedBytes = storedBytes;
|
|
74280
|
+
}
|
|
74281
|
+
__name(recordStats, "recordStats");
|
|
74282
|
+
function selectWriteCodec() {
|
|
74283
|
+
const override = codecOverrideFromEnv();
|
|
74284
|
+
if (override === "gzip") return isGzipAvailable() ? "gzip" : "none";
|
|
74285
|
+
if (isZstdAvailable()) return "zstd";
|
|
74286
|
+
if (isGzipAvailable()) return "gzip";
|
|
74287
|
+
return "none";
|
|
74288
|
+
}
|
|
74289
|
+
__name(selectWriteCodec, "selectWriteCodec");
|
|
74290
|
+
async function compress(data, enabled, stats) {
|
|
74291
|
+
if (!(data instanceof Uint8Array)) return data;
|
|
74292
|
+
if (!enabled || data.length < COMPRESSION_MIN_BYTES || isCompressionDisabledByEnv()) {
|
|
74293
|
+
recordStats(stats, "none", data.length, data.length);
|
|
74294
|
+
return data;
|
|
74295
|
+
}
|
|
74296
|
+
const codec22 = selectWriteCodec();
|
|
74297
|
+
if (codec22 === "none") {
|
|
74298
|
+
recordStats(stats, "none", data.length, data.length);
|
|
74299
|
+
return data;
|
|
74300
|
+
}
|
|
74301
|
+
const compressed = codec22 === "zstd" ? zstdBytes(data) : await gzipBytes(data);
|
|
74302
|
+
const format = codec22 === "zstd" ? SerializationFormat.ZSTD : SerializationFormat.GZIP;
|
|
74303
|
+
const wrappedLength = 4 + compressed.length;
|
|
74304
|
+
if (wrappedLength >= data.length * (1 - COMPRESSION_MIN_SAVINGS_RATIO)) {
|
|
74305
|
+
recordStats(stats, "none", data.length, data.length);
|
|
74306
|
+
return data;
|
|
74307
|
+
}
|
|
74308
|
+
recordStats(stats, codec22, data.length, wrappedLength);
|
|
74309
|
+
return encodeWithFormatPrefix(format, compressed);
|
|
74310
|
+
}
|
|
74311
|
+
__name(compress, "compress");
|
|
74312
|
+
async function decompress(data, stats) {
|
|
74313
|
+
if (!(data instanceof Uint8Array)) return data;
|
|
74314
|
+
const prefix = peekFormatPrefix(data);
|
|
74315
|
+
if (prefix === SerializationFormat.ZSTD) {
|
|
74316
|
+
const { payload } = decodeFormatPrefix(data);
|
|
74317
|
+
const inflated = unzstdBytes(payload);
|
|
74318
|
+
recordStats(stats, "zstd", inflated.length, data.length);
|
|
74319
|
+
return inflated;
|
|
74320
|
+
}
|
|
74321
|
+
if (prefix === SerializationFormat.GZIP) {
|
|
74322
|
+
if (!isGzipAvailable()) {
|
|
74323
|
+
throw new Error("Compressed (gzip) workflow data encountered but DecompressionStream is not available in this runtime. Node.js 18+, browsers, and edge runtimes all support it.");
|
|
74324
|
+
}
|
|
74325
|
+
const { payload } = decodeFormatPrefix(data);
|
|
74326
|
+
const inflated = await gunzipBytes(payload);
|
|
74327
|
+
recordStats(stats, "gzip", inflated.length, data.length);
|
|
74328
|
+
return inflated;
|
|
74329
|
+
}
|
|
74330
|
+
recordStats(stats, "none", data.length, data.length);
|
|
74331
|
+
return data;
|
|
74332
|
+
}
|
|
74333
|
+
__name(decompress, "decompress");
|
|
74334
|
+
var COMPRESSION_MIN_BYTES;
|
|
74335
|
+
var COMPRESSION_MIN_SAVINGS_RATIO;
|
|
74336
|
+
var ZSTD_LEVEL;
|
|
74337
|
+
var init_compression = __esm2({
|
|
74338
|
+
"../core/dist/serialization/compression.js"() {
|
|
74339
|
+
"use strict";
|
|
74340
|
+
init_format();
|
|
74341
|
+
init_types();
|
|
74342
|
+
COMPRESSION_MIN_BYTES = 1024;
|
|
74343
|
+
COMPRESSION_MIN_SAVINGS_RATIO = 0.05;
|
|
74344
|
+
ZSTD_LEVEL = 3;
|
|
74345
|
+
__name2(isCompressionDisabledByEnv, "isCompressionDisabledByEnv");
|
|
74346
|
+
__name2(codecOverrideFromEnv, "codecOverrideFromEnv");
|
|
74347
|
+
__name2(getNodeZlib, "getNodeZlib");
|
|
74348
|
+
__name2(isZstdAvailable, "isZstdAvailable");
|
|
74349
|
+
__name2(isGzipAvailable, "isGzipAvailable");
|
|
74350
|
+
__name2(pipeThroughTransform, "pipeThroughTransform");
|
|
74351
|
+
__name2(gzipBytes, "gzipBytes");
|
|
74352
|
+
__name2(gunzipBytes, "gunzipBytes");
|
|
74353
|
+
__name2(zstdBytes, "zstdBytes");
|
|
74354
|
+
__name2(unzstdBytes, "unzstdBytes");
|
|
74355
|
+
__name2(recordStats, "recordStats");
|
|
74356
|
+
__name2(selectWriteCodec, "selectWriteCodec");
|
|
74357
|
+
__name2(compress, "compress");
|
|
74358
|
+
__name2(decompress, "decompress");
|
|
74359
|
+
}
|
|
74360
|
+
});
|
|
73842
74361
|
async function resolveEncryptionKey(key) {
|
|
73843
74362
|
return typeof key === "function" ? key() : key;
|
|
73844
74363
|
}
|
|
@@ -74264,6 +74783,7 @@ var WorkflowEventsCount;
|
|
|
74264
74783
|
var WorkflowArgumentsCount;
|
|
74265
74784
|
var WorkflowResultType;
|
|
74266
74785
|
var WorkflowTracePropagated;
|
|
74786
|
+
var WorkflowTraceMode;
|
|
74267
74787
|
var WorkflowErrorName;
|
|
74268
74788
|
var WorkflowErrorMessage;
|
|
74269
74789
|
var WorkflowErrorCode;
|
|
@@ -74311,6 +74831,12 @@ var WorkflowEventsPagesLoaded;
|
|
|
74311
74831
|
var QueueDeserializeTimeMs;
|
|
74312
74832
|
var QueueExecutionTimeMs;
|
|
74313
74833
|
var QueueSerializeTimeMs;
|
|
74834
|
+
var SerializationOperation;
|
|
74835
|
+
var SerializationCompressed;
|
|
74836
|
+
var SerializationCodec;
|
|
74837
|
+
var SerializationUncompressedBytes;
|
|
74838
|
+
var SerializationStoredBytes;
|
|
74839
|
+
var SerializationCompressionRatio;
|
|
74314
74840
|
var PeerService;
|
|
74315
74841
|
var RpcSystem;
|
|
74316
74842
|
var RpcService;
|
|
@@ -74330,6 +74856,7 @@ var init_semantic_conventions = __esm2({
|
|
|
74330
74856
|
WorkflowArgumentsCount = SemanticConvention("workflow.arguments.count");
|
|
74331
74857
|
WorkflowResultType = SemanticConvention("workflow.result.type");
|
|
74332
74858
|
WorkflowTracePropagated = SemanticConvention("workflow.trace.propagated");
|
|
74859
|
+
WorkflowTraceMode = SemanticConvention("workflow.trace.mode");
|
|
74333
74860
|
WorkflowErrorName = SemanticConvention("workflow.error.name");
|
|
74334
74861
|
WorkflowErrorMessage = SemanticConvention("workflow.error.message");
|
|
74335
74862
|
WorkflowErrorCode = SemanticConvention("workflow.error.code");
|
|
@@ -74377,6 +74904,12 @@ var init_semantic_conventions = __esm2({
|
|
|
74377
74904
|
QueueDeserializeTimeMs = SemanticConvention("workflow.queue.deserialize_time_ms");
|
|
74378
74905
|
QueueExecutionTimeMs = SemanticConvention("workflow.queue.execution_time_ms");
|
|
74379
74906
|
QueueSerializeTimeMs = SemanticConvention("workflow.queue.serialize_time_ms");
|
|
74907
|
+
SerializationOperation = SemanticConvention("workflow.serialization.operation");
|
|
74908
|
+
SerializationCompressed = SemanticConvention("workflow.serialization.compressed");
|
|
74909
|
+
SerializationCodec = SemanticConvention("workflow.serialization.codec");
|
|
74910
|
+
SerializationUncompressedBytes = SemanticConvention("workflow.serialization.uncompressed_bytes");
|
|
74911
|
+
SerializationStoredBytes = SemanticConvention("workflow.serialization.stored_bytes");
|
|
74912
|
+
SerializationCompressionRatio = SemanticConvention("workflow.serialization.compression_ratio");
|
|
74380
74913
|
PeerService = SemanticConvention("peer.service");
|
|
74381
74914
|
RpcSystem = SemanticConvention("rpc.system");
|
|
74382
74915
|
RpcService = SemanticConvention("rpc.service");
|
|
@@ -76467,6 +77000,19 @@ async function withOtel(fn) {
|
|
|
76467
77000
|
return await fn(otel);
|
|
76468
77001
|
}
|
|
76469
77002
|
__name(withOtel, "withOtel");
|
|
77003
|
+
async function linkToTraceCarrier(carrier) {
|
|
77004
|
+
if (!carrier) return;
|
|
77005
|
+
const [context2, otel] = await Promise.all([
|
|
77006
|
+
getSpanContextForTraceCarrier(carrier),
|
|
77007
|
+
OtelApi.value
|
|
77008
|
+
]);
|
|
77009
|
+
if (!context2 || !otel) return;
|
|
77010
|
+
if (!otel.trace.isSpanContextValid(context2)) return;
|
|
77011
|
+
return {
|
|
77012
|
+
context: context2
|
|
77013
|
+
};
|
|
77014
|
+
}
|
|
77015
|
+
__name(linkToTraceCarrier, "linkToTraceCarrier");
|
|
76470
77016
|
var OtelApi;
|
|
76471
77017
|
var Tracer;
|
|
76472
77018
|
var init_telemetry = __esm2({
|
|
@@ -76496,6 +77042,7 @@ var init_telemetry = __esm2({
|
|
|
76496
77042
|
__name2(getSpanContextForTraceCarrier, "getSpanContextForTraceCarrier");
|
|
76497
77043
|
__name2(getActiveSpan, "getActiveSpan");
|
|
76498
77044
|
__name2(withOtel, "withOtel");
|
|
77045
|
+
__name2(linkToTraceCarrier, "linkToTraceCarrier");
|
|
76499
77046
|
}
|
|
76500
77047
|
});
|
|
76501
77048
|
function matchesDebugNamespace(namespace, patternList) {
|
|
@@ -76626,7 +77173,8 @@ async function serialize(value, encryptionKey, options) {
|
|
|
76626
77173
|
try {
|
|
76627
77174
|
const payload = devalueCodec.serialize(value, "client", options);
|
|
76628
77175
|
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
76629
|
-
|
|
77176
|
+
const compressed = await compress(prefixed, options?.compression === true, options?.compressionStats);
|
|
77177
|
+
return encrypt2(compressed, encryptionKey);
|
|
76630
77178
|
} catch (error482) {
|
|
76631
77179
|
rethrowIfRuntimeError(error482);
|
|
76632
77180
|
const { message, hint: hint22 } = formatSerializationError("client value", error482);
|
|
@@ -76638,7 +77186,7 @@ async function serialize(value, encryptionKey, options) {
|
|
|
76638
77186
|
}
|
|
76639
77187
|
__name(serialize, "serialize");
|
|
76640
77188
|
async function deserialize(data, encryptionKey, options) {
|
|
76641
|
-
const decrypted = await decrypt2(data, encryptionKey);
|
|
77189
|
+
const decrypted = await decompress(await decrypt2(data, encryptionKey), options?.compressionStats);
|
|
76642
77190
|
if (!(decrypted instanceof Uint8Array)) {
|
|
76643
77191
|
if (devalueCodec.deserializeLegacy) {
|
|
76644
77192
|
return devalueCodec.deserializeLegacy(decrypted, "client", options);
|
|
@@ -76657,6 +77205,7 @@ var init_client = __esm2({
|
|
|
76657
77205
|
"use strict";
|
|
76658
77206
|
init_dist2();
|
|
76659
77207
|
init_codec_devalue();
|
|
77208
|
+
init_compression();
|
|
76660
77209
|
init_encryption2();
|
|
76661
77210
|
init_errors3();
|
|
76662
77211
|
init_format();
|
|
@@ -76669,7 +77218,8 @@ async function serialize2(value, encryptionKey, options) {
|
|
|
76669
77218
|
try {
|
|
76670
77219
|
const payload = devalueCodec.serialize(value, "step", options);
|
|
76671
77220
|
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
76672
|
-
|
|
77221
|
+
const compressed = await compress(prefixed, options?.compression === true, options?.compressionStats);
|
|
77222
|
+
return encrypt2(compressed, encryptionKey);
|
|
76673
77223
|
} catch (error482) {
|
|
76674
77224
|
rethrowIfRuntimeError(error482);
|
|
76675
77225
|
const { message, hint: hint22 } = formatSerializationError("step value", error482);
|
|
@@ -76681,7 +77231,7 @@ async function serialize2(value, encryptionKey, options) {
|
|
|
76681
77231
|
}
|
|
76682
77232
|
__name(serialize2, "serialize2");
|
|
76683
77233
|
async function deserialize2(data, encryptionKey, options) {
|
|
76684
|
-
const decrypted = await decrypt2(data, encryptionKey);
|
|
77234
|
+
const decrypted = await decompress(await decrypt2(data, encryptionKey), options?.compressionStats);
|
|
76685
77235
|
if (!(decrypted instanceof Uint8Array)) {
|
|
76686
77236
|
if (devalueCodec.deserializeLegacy) {
|
|
76687
77237
|
return devalueCodec.deserializeLegacy(decrypted, "step", options);
|
|
@@ -76700,6 +77250,7 @@ var init_step = __esm2({
|
|
|
76700
77250
|
"use strict";
|
|
76701
77251
|
init_dist2();
|
|
76702
77252
|
init_codec_devalue();
|
|
77253
|
+
init_compression();
|
|
76703
77254
|
init_encryption2();
|
|
76704
77255
|
init_errors3();
|
|
76705
77256
|
init_format();
|
|
@@ -78759,6 +79310,20 @@ var init_capabilities = __esm2({
|
|
|
78759
79310
|
{
|
|
78760
79311
|
format: SerializationFormat.ENCRYPTED,
|
|
78761
79312
|
minVersion: "4.2.0-beta.64"
|
|
79313
|
+
},
|
|
79314
|
+
// TODO(release): verify this matches the actual version that ships payload
|
|
79315
|
+
// compression. If a "Version Packages (beta)" PR merges before this change,
|
|
79316
|
+
// bump to the next beta. A too-low cutoff makes new producers write
|
|
79317
|
+
// compressed payloads to consumers that cannot decompress them; too-high
|
|
79318
|
+
// merely delays the optimization (safe). gzip and zstd ship together, so
|
|
79319
|
+
// they share a min version — a run that can read one can read both.
|
|
79320
|
+
{
|
|
79321
|
+
format: SerializationFormat.GZIP,
|
|
79322
|
+
minVersion: "5.0.0-beta.18"
|
|
79323
|
+
},
|
|
79324
|
+
{
|
|
79325
|
+
format: SerializationFormat.ZSTD,
|
|
79326
|
+
minVersion: "5.0.0-beta.18"
|
|
78762
79327
|
}
|
|
78763
79328
|
];
|
|
78764
79329
|
CAPABILITY_VERSION_TABLE = [
|
|
@@ -78777,7 +79342,7 @@ var version2;
|
|
|
78777
79342
|
var init_version = __esm2({
|
|
78778
79343
|
"../core/dist/version.js"() {
|
|
78779
79344
|
"use strict";
|
|
78780
|
-
version2 = "5.0.0-beta.
|
|
79345
|
+
version2 = "5.0.0-beta.18";
|
|
78781
79346
|
}
|
|
78782
79347
|
});
|
|
78783
79348
|
function getWorkflowQueueName(workflowName, namespace) {
|
|
@@ -80166,9 +80731,10 @@ async function resumeHook(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
80166
80731
|
if (!capabilities.supportedFormats.has(SerializationFormat.ENCRYPTED)) {
|
|
80167
80732
|
encryptionKey = void 0;
|
|
80168
80733
|
}
|
|
80734
|
+
const compression = (workflowRun.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat.GZIP);
|
|
80169
80735
|
const ops = [];
|
|
80170
80736
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
80171
|
-
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, encryptionKey, ops, globalThis, v1Compat, capabilities.framedByteStreams);
|
|
80737
|
+
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, encryptionKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression);
|
|
80172
80738
|
safeWaitUntil(Promise.all(ops), (err) => {
|
|
80173
80739
|
if (err === void 0) return;
|
|
80174
80740
|
runtimeLogger.warn("Background flush of hook payload ops failed", {
|
|
@@ -80193,14 +80759,9 @@ async function resumeHook(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
80193
80759
|
span?.setAttributes({
|
|
80194
80760
|
...WorkflowName(workflowRun.workflowName)
|
|
80195
80761
|
});
|
|
80196
|
-
const
|
|
80197
|
-
if (
|
|
80198
|
-
|
|
80199
|
-
if (context2) {
|
|
80200
|
-
span?.addLink?.({
|
|
80201
|
-
context: context2
|
|
80202
|
-
});
|
|
80203
|
-
}
|
|
80762
|
+
const originLink = await linkToTraceCarrier(workflowRun.executionContext?.traceCarrier);
|
|
80763
|
+
if (originLink) {
|
|
80764
|
+
span?.addLink?.(originLink);
|
|
80204
80765
|
}
|
|
80205
80766
|
await world.queue(getWorkflowQueueName(workflowRun.workflowName), {
|
|
80206
80767
|
runId: hook.runId,
|
|
@@ -80306,6 +80867,25 @@ function unwrapSerializationCause(error482) {
|
|
|
80306
80867
|
return error482;
|
|
80307
80868
|
}
|
|
80308
80869
|
__name(unwrapSerializationCause, "unwrapSerializationCause");
|
|
80870
|
+
async function recordCompression(stats, operation) {
|
|
80871
|
+
if (!stats.recorded) return;
|
|
80872
|
+
try {
|
|
80873
|
+
const span = await getActiveSpan();
|
|
80874
|
+
if (!span) return;
|
|
80875
|
+
const uncompressedBytes = stats.uncompressedBytes ?? 0;
|
|
80876
|
+
const storedBytes = stats.storedBytes ?? 0;
|
|
80877
|
+
span.setAttributes({
|
|
80878
|
+
...SerializationOperation(operation),
|
|
80879
|
+
...SerializationCompressed(stats.compressed ?? false),
|
|
80880
|
+
...SerializationCodec(stats.codec ?? "none"),
|
|
80881
|
+
...SerializationUncompressedBytes(uncompressedBytes),
|
|
80882
|
+
...SerializationStoredBytes(storedBytes),
|
|
80883
|
+
...stats.compressed && uncompressedBytes > 0 ? SerializationCompressionRatio(1 - storedBytes / uncompressedBytes) : {}
|
|
80884
|
+
});
|
|
80885
|
+
} catch {
|
|
80886
|
+
}
|
|
80887
|
+
}
|
|
80888
|
+
__name(recordCompression, "recordCompression");
|
|
80309
80889
|
function getSerializeStream(reducers, cryptoKey) {
|
|
80310
80890
|
const encoder22 = new TextEncoder();
|
|
80311
80891
|
const keyState = {
|
|
@@ -81291,16 +81871,21 @@ async function maybeDecrypt(data, key) {
|
|
|
81291
81871
|
return decrypt2(data, key);
|
|
81292
81872
|
}
|
|
81293
81873
|
__name(maybeDecrypt, "maybeDecrypt");
|
|
81294
|
-
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false) {
|
|
81874
|
+
async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
|
|
81295
81875
|
if (v1Compat) {
|
|
81296
81876
|
const str = stringify(value, getExternalReducers(global2, ops, runId, key, framedByteStreams));
|
|
81297
81877
|
return revive(str);
|
|
81298
81878
|
}
|
|
81299
81879
|
try {
|
|
81300
|
-
|
|
81880
|
+
const compressionStats = {};
|
|
81881
|
+
const result = await serialize(value, key, {
|
|
81301
81882
|
global: global2,
|
|
81302
|
-
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams))
|
|
81883
|
+
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams)),
|
|
81884
|
+
compression,
|
|
81885
|
+
compressionStats
|
|
81303
81886
|
});
|
|
81887
|
+
await recordCompression(compressionStats, "serialize");
|
|
81888
|
+
return result;
|
|
81304
81889
|
} catch (error482) {
|
|
81305
81890
|
const cause = unwrapSerializationCause(error482);
|
|
81306
81891
|
const { message, hint: hint22 } = formatSerializationError("workflow arguments", cause);
|
|
@@ -81312,25 +81897,34 @@ async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 =
|
|
|
81312
81897
|
}
|
|
81313
81898
|
__name(dehydrateWorkflowArguments, "dehydrateWorkflowArguments");
|
|
81314
81899
|
async function hydrateWorkflowReturnValue(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
81315
|
-
|
|
81900
|
+
const compressionStats = {};
|
|
81901
|
+
const result = await deserialize(value, key, {
|
|
81316
81902
|
global: global2,
|
|
81317
81903
|
extraRevivers: {
|
|
81318
81904
|
...getStreamAndRequestRevivers(getExternalRevivers(global2, ops, runId, key)),
|
|
81319
81905
|
...extraRevivers
|
|
81320
|
-
}
|
|
81906
|
+
},
|
|
81907
|
+
compressionStats
|
|
81321
81908
|
});
|
|
81909
|
+
await recordCompression(compressionStats, "deserialize");
|
|
81910
|
+
return result;
|
|
81322
81911
|
}
|
|
81323
81912
|
__name(hydrateWorkflowReturnValue, "hydrateWorkflowReturnValue");
|
|
81324
|
-
async function dehydrateStepArguments(value, _runId, key, global2 = globalThis, v1Compat = false) {
|
|
81913
|
+
async function dehydrateStepArguments(value, _runId, key, global2 = globalThis, v1Compat = false, compression = false) {
|
|
81325
81914
|
if (v1Compat) {
|
|
81326
81915
|
const str = stringify(value, getWorkflowReducers(global2));
|
|
81327
81916
|
return revive(str);
|
|
81328
81917
|
}
|
|
81329
81918
|
try {
|
|
81330
|
-
|
|
81919
|
+
const compressionStats = {};
|
|
81920
|
+
const result = await serialize2(value, key, {
|
|
81331
81921
|
global: global2,
|
|
81332
|
-
extraReducers: getStreamAndRequestReducers(getWorkflowReducers(global2))
|
|
81922
|
+
extraReducers: getStreamAndRequestReducers(getWorkflowReducers(global2)),
|
|
81923
|
+
compression,
|
|
81924
|
+
compressionStats
|
|
81333
81925
|
});
|
|
81926
|
+
await recordCompression(compressionStats, "serialize");
|
|
81927
|
+
return result;
|
|
81334
81928
|
} catch (error482) {
|
|
81335
81929
|
const cause = unwrapSerializationCause(error482);
|
|
81336
81930
|
const { message, hint: hint22 } = formatSerializationError("step arguments", cause);
|
|
@@ -81342,25 +81936,34 @@ async function dehydrateStepArguments(value, _runId, key, global2 = globalThis,
|
|
|
81342
81936
|
}
|
|
81343
81937
|
__name(dehydrateStepArguments, "dehydrateStepArguments");
|
|
81344
81938
|
async function hydrateStepArguments(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId) {
|
|
81345
|
-
|
|
81939
|
+
const compressionStats = {};
|
|
81940
|
+
const result = await deserialize2(value, key, {
|
|
81346
81941
|
global: global2,
|
|
81347
81942
|
extraRevivers: {
|
|
81348
81943
|
...getStreamAndRequestRevivers(getStepRevivers(global2, ops, runId, key, deploymentId)),
|
|
81349
81944
|
...extraRevivers
|
|
81350
|
-
}
|
|
81945
|
+
},
|
|
81946
|
+
compressionStats
|
|
81351
81947
|
});
|
|
81948
|
+
await recordCompression(compressionStats, "deserialize");
|
|
81949
|
+
return result;
|
|
81352
81950
|
}
|
|
81353
81951
|
__name(hydrateStepArguments, "hydrateStepArguments");
|
|
81354
|
-
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false) {
|
|
81952
|
+
async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
|
|
81355
81953
|
if (v1Compat) {
|
|
81356
81954
|
const str = stringify(value, getStepReducers(global2, ops, runId, key, framedByteStreams));
|
|
81357
81955
|
return revive(str);
|
|
81358
81956
|
}
|
|
81359
81957
|
try {
|
|
81360
|
-
|
|
81958
|
+
const compressionStats = {};
|
|
81959
|
+
const result = await serialize2(value, key, {
|
|
81361
81960
|
global: global2,
|
|
81362
|
-
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams))
|
|
81961
|
+
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams)),
|
|
81962
|
+
compression,
|
|
81963
|
+
compressionStats
|
|
81363
81964
|
});
|
|
81965
|
+
await recordCompression(compressionStats, "serialize");
|
|
81966
|
+
return result;
|
|
81364
81967
|
} catch (error482) {
|
|
81365
81968
|
const cause = unwrapSerializationCause(error482);
|
|
81366
81969
|
const { message, hint: hint22 } = formatSerializationError("step return value", cause);
|
|
@@ -81372,7 +81975,9 @@ async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = g
|
|
|
81372
81975
|
}
|
|
81373
81976
|
__name(dehydrateStepReturnValue, "dehydrateStepReturnValue");
|
|
81374
81977
|
async function hydrateRunError(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
81375
|
-
const
|
|
81978
|
+
const compressionStats = {};
|
|
81979
|
+
const decrypted = await decompress(await maybeDecrypt(value, key), compressionStats);
|
|
81980
|
+
await recordCompression(compressionStats, "deserialize");
|
|
81376
81981
|
if (!(decrypted instanceof Uint8Array)) {
|
|
81377
81982
|
return unflatten(decrypted, {
|
|
81378
81983
|
...getExternalRevivers(global2, ops, runId, key),
|
|
@@ -81430,6 +82035,7 @@ var init_serialization2 = __esm2({
|
|
|
81430
82035
|
init_private();
|
|
81431
82036
|
init_get_world_lazy();
|
|
81432
82037
|
init_client();
|
|
82038
|
+
init_compression();
|
|
81433
82039
|
init_encryption2();
|
|
81434
82040
|
init_errors3();
|
|
81435
82041
|
init_format();
|
|
@@ -81441,12 +82047,15 @@ var init_serialization2 = __esm2({
|
|
|
81441
82047
|
init_workflow();
|
|
81442
82048
|
init_context_storage();
|
|
81443
82049
|
init_symbols();
|
|
82050
|
+
init_semantic_conventions();
|
|
82051
|
+
init_telemetry();
|
|
81444
82052
|
init_util2();
|
|
81445
82053
|
init_abort_controller();
|
|
81446
82054
|
defaultUlid = monotonicFactory();
|
|
81447
82055
|
__name2(getStreamType, "getStreamType");
|
|
81448
82056
|
FRAME_HEADER_SIZE = 4;
|
|
81449
82057
|
__name2(unwrapSerializationCause, "unwrapSerializationCause");
|
|
82058
|
+
__name2(recordCompression, "recordCompression");
|
|
81450
82059
|
__name2(getSerializeStream, "getSerializeStream");
|
|
81451
82060
|
__name2(getDeserializeStream, "getDeserializeStream");
|
|
81452
82061
|
MAX_FRAME_SIZE = 1e8;
|
|
@@ -81736,6 +82345,7 @@ init_encryption();
|
|
|
81736
82345
|
init_serialization2();
|
|
81737
82346
|
init_helpers();
|
|
81738
82347
|
init_dist2();
|
|
82348
|
+
init_parse_name();
|
|
81739
82349
|
init_dist4();
|
|
81740
82350
|
init_node();
|
|
81741
82351
|
init_dist2();
|
|
@@ -81776,6 +82386,7 @@ init_helpers();
|
|
|
81776
82386
|
init_wait_until();
|
|
81777
82387
|
var CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS = 2e3;
|
|
81778
82388
|
var ulid3 = monotonicFactory();
|
|
82389
|
+
var hasWarnedLatestNoOp = false;
|
|
81779
82390
|
async function start(workflow, argsOrOptions, options) {
|
|
81780
82391
|
return await waitedUntil(() => {
|
|
81781
82392
|
const workflowName = workflow?.workflowId;
|
|
@@ -81784,7 +82395,8 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
81784
82395
|
slug: "start-invalid-workflow-function"
|
|
81785
82396
|
});
|
|
81786
82397
|
}
|
|
81787
|
-
|
|
82398
|
+
const spanName = `workflow.start ${workflowDisplayName(workflowName)}`;
|
|
82399
|
+
return trace(spanName, async (span) => {
|
|
81788
82400
|
span?.setAttributes({
|
|
81789
82401
|
...WorkflowName(workflowName),
|
|
81790
82402
|
...WorkflowOperation("start")
|
|
@@ -81803,22 +82415,34 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
81803
82415
|
const currentDeploymentId = await world.getDeploymentId();
|
|
81804
82416
|
let deploymentId = opts.deploymentId ?? currentDeploymentId;
|
|
81805
82417
|
if (deploymentId === "latest") {
|
|
81806
|
-
if (
|
|
81807
|
-
|
|
82418
|
+
if (world.resolveLatestDeploymentId) {
|
|
82419
|
+
deploymentId = await world.resolveLatestDeploymentId();
|
|
82420
|
+
} else {
|
|
82421
|
+
if (!hasWarnedLatestNoOp) {
|
|
82422
|
+
hasWarnedLatestNoOp = true;
|
|
82423
|
+
runtimeLogger.warn("deploymentId: 'latest' has no effect in this world and was ignored. It is only supported by worlds with atomic deployments, such as Vercel. The run will target the current deployment.", {
|
|
82424
|
+
currentDeploymentId
|
|
82425
|
+
});
|
|
82426
|
+
}
|
|
82427
|
+
deploymentId = currentDeploymentId;
|
|
81808
82428
|
}
|
|
81809
|
-
deploymentId = await world.resolveLatestDeploymentId();
|
|
81810
82429
|
}
|
|
81811
82430
|
let framedByteStreams;
|
|
82431
|
+
let targetSupportsCompression;
|
|
81812
82432
|
if (deploymentId === currentDeploymentId) {
|
|
81813
82433
|
framedByteStreams = true;
|
|
82434
|
+
targetSupportsCompression = true;
|
|
81814
82435
|
} else if (typeof world.streams?.get !== "function") {
|
|
81815
82436
|
framedByteStreams = false;
|
|
82437
|
+
targetSupportsCompression = false;
|
|
81816
82438
|
} else {
|
|
81817
82439
|
const probe = await healthCheck(world, "workflow", {
|
|
81818
82440
|
deploymentId,
|
|
81819
82441
|
timeout: CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS
|
|
81820
82442
|
}).catch(() => void 0);
|
|
81821
|
-
|
|
82443
|
+
const capabilities = getRunCapabilities(probe?.workflowCoreVersion);
|
|
82444
|
+
framedByteStreams = capabilities.framedByteStreams;
|
|
82445
|
+
targetSupportsCompression = capabilities.supportedFormats.has(SerializationFormat.GZIP);
|
|
81822
82446
|
}
|
|
81823
82447
|
const ops = [];
|
|
81824
82448
|
const runId = `wrun_${ulid3()}`;
|
|
@@ -81855,7 +82479,8 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
81855
82479
|
deploymentId
|
|
81856
82480
|
});
|
|
81857
82481
|
const encryptionKey = rawKey ? await importKey(rawKey) : void 0;
|
|
81858
|
-
const
|
|
82482
|
+
const compression = targetSupportsCompression && specVersion >= SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
82483
|
+
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat, framedByteStreams, compression);
|
|
81859
82484
|
const executionContext = {
|
|
81860
82485
|
traceCarrier,
|
|
81861
82486
|
workflowCoreVersion: version2,
|
|
@@ -81947,7 +82572,7 @@ __name2(start, "start");
|
|
|
81947
82572
|
value: "start",
|
|
81948
82573
|
configurable: true
|
|
81949
82574
|
});
|
|
81950
|
-
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.
|
|
82575
|
+
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.18//start");
|
|
81951
82576
|
function isRetryableStartError(err) {
|
|
81952
82577
|
if (ThrottleError.is(err)) return true;
|
|
81953
82578
|
if (WorkflowWorldError.is(err) && err.status && err.status >= 500) return true;
|
|
@@ -82281,7 +82906,7 @@ var Run = class _Run {
|
|
|
82281
82906
|
value: "wakeUp",
|
|
82282
82907
|
configurable: true
|
|
82283
82908
|
});
|
|
82284
|
-
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82909
|
+
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#wakeUp");
|
|
82285
82910
|
(function(__wf_fn, __wf_id) {
|
|
82286
82911
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82287
82912
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82290,7 +82915,7 @@ var Run = class _Run {
|
|
|
82290
82915
|
value: "cancel",
|
|
82291
82916
|
configurable: true
|
|
82292
82917
|
});
|
|
82293
|
-
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82918
|
+
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#cancel");
|
|
82294
82919
|
(function(__wf_fn, __wf_id) {
|
|
82295
82920
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82296
82921
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82299,7 +82924,7 @@ var Run = class _Run {
|
|
|
82299
82924
|
value: "getReadable",
|
|
82300
82925
|
configurable: true
|
|
82301
82926
|
});
|
|
82302
|
-
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82927
|
+
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#getReadable");
|
|
82303
82928
|
(function(__wf_fn, __wf_id) {
|
|
82304
82929
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82305
82930
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82308,7 +82933,7 @@ var Run = class _Run {
|
|
|
82308
82933
|
value: "exists",
|
|
82309
82934
|
configurable: true
|
|
82310
82935
|
});
|
|
82311
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82936
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#exists");
|
|
82312
82937
|
(function(__wf_fn, __wf_id) {
|
|
82313
82938
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82314
82939
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82317,7 +82942,7 @@ var Run = class _Run {
|
|
|
82317
82942
|
value: "status",
|
|
82318
82943
|
configurable: true
|
|
82319
82944
|
});
|
|
82320
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82945
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#status");
|
|
82321
82946
|
(function(__wf_fn, __wf_id) {
|
|
82322
82947
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82323
82948
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82326,7 +82951,7 @@ var Run = class _Run {
|
|
|
82326
82951
|
value: "returnValue",
|
|
82327
82952
|
configurable: true
|
|
82328
82953
|
});
|
|
82329
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82954
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#returnValue");
|
|
82330
82955
|
(function(__wf_fn, __wf_id) {
|
|
82331
82956
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82332
82957
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82335,7 +82960,7 @@ var Run = class _Run {
|
|
|
82335
82960
|
value: "workflowName",
|
|
82336
82961
|
configurable: true
|
|
82337
82962
|
});
|
|
82338
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82963
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#workflowName");
|
|
82339
82964
|
(function(__wf_fn, __wf_id) {
|
|
82340
82965
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82341
82966
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82344,7 +82969,7 @@ var Run = class _Run {
|
|
|
82344
82969
|
value: "createdAt",
|
|
82345
82970
|
configurable: true
|
|
82346
82971
|
});
|
|
82347
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82972
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#createdAt");
|
|
82348
82973
|
(function(__wf_fn, __wf_id) {
|
|
82349
82974
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82350
82975
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82353,7 +82978,7 @@ var Run = class _Run {
|
|
|
82353
82978
|
value: "startedAt",
|
|
82354
82979
|
configurable: true
|
|
82355
82980
|
});
|
|
82356
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82981
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#startedAt");
|
|
82357
82982
|
(function(__wf_fn, __wf_id) {
|
|
82358
82983
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82359
82984
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82362,7 +82987,7 @@ var Run = class _Run {
|
|
|
82362
82987
|
value: "completedAt",
|
|
82363
82988
|
configurable: true
|
|
82364
82989
|
});
|
|
82365
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
82990
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.18//Run#completedAt");
|
|
82366
82991
|
(function(__wf_cls, __wf_id) {
|
|
82367
82992
|
var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82368
82993
|
__wf_reg.set(__wf_id, __wf_cls);
|
|
@@ -82372,7 +82997,7 @@ var Run = class _Run {
|
|
|
82372
82997
|
enumerable: false,
|
|
82373
82998
|
configurable: false
|
|
82374
82999
|
});
|
|
82375
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
83000
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.18//Run");
|
|
82376
83001
|
async function fetch2(...args) {
|
|
82377
83002
|
return globalThis.fetch(...args);
|
|
82378
83003
|
}
|
|
@@ -86208,6 +86833,17 @@ async function getSpanKind3(field) {
|
|
|
86208
86833
|
return otel.SpanKind[field];
|
|
86209
86834
|
}
|
|
86210
86835
|
__name(getSpanKind3, "getSpanKind");
|
|
86836
|
+
async function injectTraceContextIntoHeaders(headers) {
|
|
86837
|
+
const otel = await getOtelApi2();
|
|
86838
|
+
if (!otel)
|
|
86839
|
+
return;
|
|
86840
|
+
const carrier = {};
|
|
86841
|
+
otel.propagation.inject(otel.context.active(), carrier);
|
|
86842
|
+
for (const [key, value] of Object.entries(carrier)) {
|
|
86843
|
+
headers.set(key, value);
|
|
86844
|
+
}
|
|
86845
|
+
}
|
|
86846
|
+
__name(injectTraceContextIntoHeaders, "injectTraceContextIntoHeaders");
|
|
86211
86847
|
function SemanticConvention4(...names) {
|
|
86212
86848
|
return (value) => Object.fromEntries(names.map((name) => [name, value]));
|
|
86213
86849
|
}
|
|
@@ -93187,7 +93823,7 @@ import os from "node:os";
|
|
|
93187
93823
|
import { inspect } from "node:util";
|
|
93188
93824
|
|
|
93189
93825
|
// ../world-vercel/dist/version.js
|
|
93190
|
-
var version5 = "5.0.0-beta.
|
|
93826
|
+
var version5 = "5.0.0-beta.17";
|
|
93191
93827
|
|
|
93192
93828
|
// ../world-vercel/dist/utils.js
|
|
93193
93829
|
var HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
@@ -93306,6 +93942,7 @@ async function makeRequest({ endpoint, options = {}, config: config4 = {}, schem
|
|
|
93306
93942
|
...RpcService4("workflow-server")
|
|
93307
93943
|
});
|
|
93308
93944
|
headers.set("Accept", "application/cbor");
|
|
93945
|
+
await injectTraceContextIntoHeaders(headers);
|
|
93309
93946
|
let body;
|
|
93310
93947
|
if (data !== void 0) {
|
|
93311
93948
|
headers.set("Content-Type", "application/cbor");
|
|
@@ -93991,14 +94628,21 @@ async function consumeListFrameStream(url3, headers, config4, opName) {
|
|
|
93991
94628
|
return { events, ...next2 ? { next: next2 } : {} };
|
|
93992
94629
|
}
|
|
93993
94630
|
__name(consumeListFrameStream, "consumeListFrameStream");
|
|
93994
|
-
function
|
|
93995
|
-
const sp = new URLSearchParams();
|
|
94631
|
+
function appendListParams(sp, params) {
|
|
93996
94632
|
if (params.cursor)
|
|
93997
94633
|
sp.set("cursor", params.cursor);
|
|
93998
94634
|
if (params.limit !== void 0)
|
|
93999
94635
|
sp.set("limit", String(params.limit));
|
|
94000
94636
|
if (params.sortOrder)
|
|
94001
94637
|
sp.set("sortOrder", params.sortOrder);
|
|
94638
|
+
if (params.remoteRefBehavior) {
|
|
94639
|
+
sp.set("remoteRefBehavior", params.remoteRefBehavior);
|
|
94640
|
+
}
|
|
94641
|
+
}
|
|
94642
|
+
__name(appendListParams, "appendListParams");
|
|
94643
|
+
function paginationToQuery(params) {
|
|
94644
|
+
const sp = new URLSearchParams();
|
|
94645
|
+
appendListParams(sp, params);
|
|
94002
94646
|
const qs = sp.toString();
|
|
94003
94647
|
return qs ? `?${qs}` : "";
|
|
94004
94648
|
}
|
|
@@ -94013,12 +94657,7 @@ async function getEventsByCorrelationIdV4(correlationId, params = {}, config4) {
|
|
|
94013
94657
|
const { baseUrl, headers } = await getHttpConfig(config4);
|
|
94014
94658
|
const sp = new URLSearchParams();
|
|
94015
94659
|
sp.set("correlationId", correlationId);
|
|
94016
|
-
|
|
94017
|
-
sp.set("cursor", params.cursor);
|
|
94018
|
-
if (params.limit !== void 0)
|
|
94019
|
-
sp.set("limit", String(params.limit));
|
|
94020
|
-
if (params.sortOrder)
|
|
94021
|
-
sp.set("sortOrder", params.sortOrder);
|
|
94660
|
+
appendListParams(sp, params);
|
|
94022
94661
|
const url3 = `${baseUrl}/v4/events?${sp.toString()}`;
|
|
94023
94662
|
return consumeListFrameStream(url3, headers, config4, "listEventsByCorrelationId");
|
|
94024
94663
|
}
|
|
@@ -94404,7 +95043,8 @@ async function getWorkflowRunEvents(params, config4) {
|
|
|
94404
95043
|
const wirePagination = {
|
|
94405
95044
|
cursor: pagination?.cursor ?? void 0,
|
|
94406
95045
|
limit: pagination?.limit,
|
|
94407
|
-
sortOrder: pagination?.sortOrder
|
|
95046
|
+
sortOrder: pagination?.sortOrder,
|
|
95047
|
+
remoteRefBehavior: resolveData === "none" ? "lazy" : "resolve"
|
|
94408
95048
|
};
|
|
94409
95049
|
const result = await ("correlationId" in params ? getEventsByCorrelationIdV4(params.correlationId, wirePagination, config4) : getWorkflowRunEventsV4(params.runId, wirePagination, config4));
|
|
94410
95050
|
const events = result.events.map((listed) => buildEventFromV4(listed.event, listed.body, resolveData));
|
|
@@ -94758,11 +95398,14 @@ __name(createStreamer2, "createStreamer");
|
|
|
94758
95398
|
function createVercelWorld(config4) {
|
|
94759
95399
|
const projectId = config4?.projectConfig?.projectId || process.env.VERCEL_PROJECT_ID;
|
|
94760
95400
|
return {
|
|
94761
|
-
// Spec
|
|
94762
|
-
//
|
|
94763
|
-
//
|
|
94764
|
-
//
|
|
94765
|
-
|
|
95401
|
+
// Spec v5: new runs may carry gzip-compressed payloads (compression is
|
|
95402
|
+
// entirely client-side — the workflow-server stores payloads opaquely
|
|
95403
|
+
// via RemoteRef and never deserializes them). Spec 5 is a superset of
|
|
95404
|
+
// spec 4, so native `attr_set` events and initial run attributes still
|
|
95405
|
+
// work. New runs are stamped with this version; the server must support
|
|
95406
|
+
// at least it — workflow-server declared spec-5 support in
|
|
95407
|
+
// vercel/workflow-server#520.
|
|
95408
|
+
specVersion: SPEC_VERSION_SUPPORTS_COMPRESSION2,
|
|
94766
95409
|
// On Vercel the platform fails the function invocation when the
|
|
94767
95410
|
// process exits non-zero, and VQS redelivers the queue message via a
|
|
94768
95411
|
// fresh invocation. The core runtime uses this to decide whether
|
|
@@ -95129,7 +95772,9 @@ var DEFAULT_STEP_MAX_RETRIES = 3;
|
|
|
95129
95772
|
async function executeStep(params) {
|
|
95130
95773
|
const { world, workflowRunId, workflowName, workflowStartedAt, stepId, stepName } = params;
|
|
95131
95774
|
const isVercel = process.env.VERCEL_URL !== void 0;
|
|
95132
|
-
|
|
95775
|
+
const compression = (params.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2;
|
|
95776
|
+
const spanName = `step.execute ${stepDisplayName(stepName)}`;
|
|
95777
|
+
return trace3(spanName, {}, async (span) => {
|
|
95133
95778
|
span?.setAttributes({
|
|
95134
95779
|
...StepName2(stepName),
|
|
95135
95780
|
...WorkflowName2(workflowName),
|
|
@@ -95152,7 +95797,7 @@ async function executeStep(params) {
|
|
|
95152
95797
|
correlationId: stepId,
|
|
95153
95798
|
eventData: {
|
|
95154
95799
|
stepName,
|
|
95155
|
-
error: await dehydrateStepError(new FatalError2(errorMessage), workflowRunId, await getEncryptionKey())
|
|
95800
|
+
error: await dehydrateStepError(new FatalError2(errorMessage), workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95156
95801
|
}
|
|
95157
95802
|
});
|
|
95158
95803
|
} catch (stepFailErr) {
|
|
@@ -95251,7 +95896,7 @@ async function executeStep(params) {
|
|
|
95251
95896
|
correlationId: stepId,
|
|
95252
95897
|
eventData: {
|
|
95253
95898
|
stepName,
|
|
95254
|
-
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey())
|
|
95899
|
+
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95255
95900
|
}
|
|
95256
95901
|
});
|
|
95257
95902
|
} catch (err) {
|
|
@@ -95321,7 +95966,7 @@ async function executeStep(params) {
|
|
|
95321
95966
|
});
|
|
95322
95967
|
result = await trace3("step.dehydrate", {}, async (dehydrateSpan) => {
|
|
95323
95968
|
const startTime = Date.now();
|
|
95324
|
-
const dehydrated = await dehydrateStepReturnValue2(result, workflowRunId, encryptionKey, ops);
|
|
95969
|
+
const dehydrated = await dehydrateStepReturnValue2(result, workflowRunId, encryptionKey, ops, globalThis, false, false, compression);
|
|
95325
95970
|
const durationMs = Date.now() - startTime;
|
|
95326
95971
|
dehydrateSpan?.setAttributes({
|
|
95327
95972
|
...QueueSerializeTimeMs2(durationMs),
|
|
@@ -95421,7 +96066,7 @@ async function executeStep(params) {
|
|
|
95421
96066
|
correlationId: stepId,
|
|
95422
96067
|
eventData: {
|
|
95423
96068
|
stepName,
|
|
95424
|
-
error: await dehydrateStepError(effectiveErr, workflowRunId, await getEncryptionKey())
|
|
96069
|
+
error: await dehydrateStepError(effectiveErr, workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95425
96070
|
}
|
|
95426
96071
|
});
|
|
95427
96072
|
} catch (stepFailErr) {
|
|
@@ -95468,7 +96113,7 @@ async function executeStep(params) {
|
|
|
95468
96113
|
correlationId: stepId,
|
|
95469
96114
|
eventData: {
|
|
95470
96115
|
stepName,
|
|
95471
|
-
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey())
|
|
96116
|
+
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95472
96117
|
}
|
|
95473
96118
|
});
|
|
95474
96119
|
} catch (stepFailErr) {
|
|
@@ -95514,7 +96159,7 @@ async function executeStep(params) {
|
|
|
95514
96159
|
correlationId: stepId,
|
|
95515
96160
|
eventData: {
|
|
95516
96161
|
stepName,
|
|
95517
|
-
error: await dehydrateStepError(err, workflowRunId, await getEncryptionKey()),
|
|
96162
|
+
error: await dehydrateStepError(err, workflowRunId, await getEncryptionKey(), [], globalThis, compression),
|
|
95518
96163
|
...RetryableError2.is(err) && { retryAfter: err.retryAfter }
|
|
95519
96164
|
}
|
|
95520
96165
|
});
|
|
@@ -95599,8 +96244,9 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId
|
|
|
95599
96244
|
const hooksNeedingDisposal = allHookItems.filter((item) => item.disposed);
|
|
95600
96245
|
const rawKey = await world.getEncryptionKeyForRun?.(run3);
|
|
95601
96246
|
const encryptionKey = rawKey ? await importKey2(rawKey) : void 0;
|
|
96247
|
+
const compression = (run3.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2;
|
|
95602
96248
|
const hookEvents = await Promise.all(hooksNeedingCreation.map(async (queueItem) => {
|
|
95603
|
-
const hookMetadata = typeof queueItem.metadata === "undefined" ? void 0 : await dehydrateStepArguments2(queueItem.metadata, runId, encryptionKey, suspension.globalThis);
|
|
96249
|
+
const hookMetadata = typeof queueItem.metadata === "undefined" ? void 0 : await dehydrateStepArguments2(queueItem.metadata, runId, encryptionKey, suspension.globalThis, false, compression);
|
|
95604
96250
|
return {
|
|
95605
96251
|
queueItem,
|
|
95606
96252
|
hookEvent: {
|
|
@@ -95670,7 +96316,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId
|
|
|
95670
96316
|
if (hooksNeedingAbort.length > 0) {
|
|
95671
96317
|
await Promise.all(hooksNeedingAbort.map(async (queueItem) => {
|
|
95672
96318
|
try {
|
|
95673
|
-
const abortPayload = await dehydrateStepArguments2({ aborted: true, reason: queueItem.abortReason }, runId, encryptionKey, suspension.globalThis);
|
|
96319
|
+
const abortPayload = await dehydrateStepArguments2({ aborted: true, reason: queueItem.abortReason }, runId, encryptionKey, suspension.globalThis, false, compression);
|
|
95674
96320
|
await world.events.create(runId, {
|
|
95675
96321
|
eventType: "hook_received",
|
|
95676
96322
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
@@ -95713,7 +96359,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId
|
|
|
95713
96359
|
args: queueItem.args,
|
|
95714
96360
|
closureVars: queueItem.closureVars,
|
|
95715
96361
|
thisVal: queueItem.thisVal
|
|
95716
|
-
}, runId, encryptionKey, suspension.globalThis);
|
|
96362
|
+
}, runId, encryptionKey, suspension.globalThis, false, compression);
|
|
95717
96363
|
const stepEvent = {
|
|
95718
96364
|
eventType: "step_created",
|
|
95719
96365
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
@@ -96442,6 +97088,7 @@ init_util4();
|
|
|
96442
97088
|
init_dist6();
|
|
96443
97089
|
init_dist5();
|
|
96444
97090
|
init_parse_name2();
|
|
97091
|
+
init_dist7();
|
|
96445
97092
|
import { runInContext as runInContext2 } from "node:vm";
|
|
96446
97093
|
|
|
96447
97094
|
// ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
|
|
@@ -98026,7 +98673,17 @@ Learn more: https://workflow-sdk.dev/err/${ERROR_SLUGS2.FETCH_IN_WORKFLOW_FUNCTI
|
|
|
98026
98673
|
workflowFn(...args),
|
|
98027
98674
|
workflowDiscontinuation.promise
|
|
98028
98675
|
]);
|
|
98029
|
-
const dehydrated = await dehydrateWorkflowReturnValue(
|
|
98676
|
+
const dehydrated = await dehydrateWorkflowReturnValue(
|
|
98677
|
+
result,
|
|
98678
|
+
workflowRun.runId,
|
|
98679
|
+
encryptionKey,
|
|
98680
|
+
vmGlobalThis,
|
|
98681
|
+
false,
|
|
98682
|
+
// Gate payload compression on the run's specVersion: only runs
|
|
98683
|
+
// marked as possibly containing compressed payloads (spec >= 5)
|
|
98684
|
+
// get gzip data.
|
|
98685
|
+
(workflowRun.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2
|
|
98686
|
+
);
|
|
98030
98687
|
span?.setAttributes({
|
|
98031
98688
|
...WorkflowResultType2(typeof result)
|
|
98032
98689
|
});
|
|
@@ -98066,6 +98723,7 @@ init_helpers2();
|
|
|
98066
98723
|
|
|
98067
98724
|
// ../core/dist/runtime/start.js
|
|
98068
98725
|
init_dist6();
|
|
98726
|
+
init_parse_name2();
|
|
98069
98727
|
init_dist7();
|
|
98070
98728
|
init_node2();
|
|
98071
98729
|
|
|
@@ -98415,7 +99073,7 @@ async function recordFatalRunError({ world, workflowRun, runId, requestId, err,
|
|
|
98415
99073
|
eventType: "run_failed",
|
|
98416
99074
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
98417
99075
|
eventData: {
|
|
98418
|
-
error: await dehydrateRunError(err, runId, await getEncryptionKey()),
|
|
99076
|
+
error: await dehydrateRunError(err, runId, await getEncryptionKey(), globalThis, (workflowRun?.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2),
|
|
98419
99077
|
errorCode
|
|
98420
99078
|
}
|
|
98421
99079
|
}, { requestId });
|
|
@@ -98458,7 +99116,8 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98458
99116
|
await handleHealthCheckMessage(healthCheck3, "workflow", worldHandlers.specVersion);
|
|
98459
99117
|
return;
|
|
98460
99118
|
}
|
|
98461
|
-
const { runId, traceCarrier:
|
|
99119
|
+
const { runId, traceCarrier: incomingTraceCarrier, requestedAt, stepId: incomingStepId, stepName: incomingStepName, replayDivergence, runInput } = WorkflowInvokePayloadSchema2.parse(message_);
|
|
99120
|
+
const traceContext = isUsableTraceCarrier(incomingTraceCarrier) ? incomingTraceCarrier : void 0;
|
|
98462
99121
|
const { requestId } = metadata;
|
|
98463
99122
|
const workflowName = metadata.queueName.slice(workflowPrefix.length);
|
|
98464
99123
|
const runLogger = runtimeLogger2.forRun(runId, workflowName);
|
|
@@ -98494,12 +99153,16 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98494
99153
|
}
|
|
98495
99154
|
return;
|
|
98496
99155
|
}
|
|
98497
|
-
const
|
|
99156
|
+
const traceMode = getWorkflowTraceMode();
|
|
99157
|
+
const nextTraceCarrier = /* @__PURE__ */ __name(() => getNextTraceCarrier(traceMode, traceContext), "nextTraceCarrier");
|
|
99158
|
+
const spanLinks = await buildInvocationSpanLinks(traceMode, traceContext);
|
|
98498
99159
|
const replayBudget = new ReplayBudget();
|
|
98499
|
-
|
|
99160
|
+
const parentTraceCarrier = traceMode === "continuous" ? traceContext : void 0;
|
|
99161
|
+
const spanKind = await getSpanKind("CONSUMER");
|
|
99162
|
+
return await withTraceContext(parentTraceCarrier, async () => {
|
|
98500
99163
|
return await withWorkflowBaggage({ workflowRunId: runId, workflowName }, async () => {
|
|
98501
99164
|
const world = await getWorld();
|
|
98502
|
-
return trace3(`
|
|
99165
|
+
return trace3(`workflow.execute ${workflowDisplayName2(workflowName)}`, traceMode === "linked" ? { kind: spanKind, links: spanLinks, root: true } : { kind: spanKind, links: spanLinks }, async (span) => {
|
|
98503
99166
|
span?.setAttributes({
|
|
98504
99167
|
...WorkflowName2(workflowName),
|
|
98505
99168
|
...WorkflowOperation2("execute_v2"),
|
|
@@ -98509,7 +99172,8 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98509
99172
|
...MessagingOperationType2("process"),
|
|
98510
99173
|
...getQueueOverhead({ requestedAt }),
|
|
98511
99174
|
...WorkflowRunId2(runId),
|
|
98512
|
-
...WorkflowTracePropagated2(!!traceContext)
|
|
99175
|
+
...WorkflowTracePropagated2(!!traceContext),
|
|
99176
|
+
...WorkflowTraceMode2(traceMode)
|
|
98513
99177
|
});
|
|
98514
99178
|
const invocationStartTime = Date.now();
|
|
98515
99179
|
let loopIteration = 0;
|
|
@@ -98537,7 +99201,8 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98537
99201
|
workflowName,
|
|
98538
99202
|
workflowStartedAt: bgStartedAt,
|
|
98539
99203
|
stepId: incomingStepId,
|
|
98540
|
-
stepName: incomingStepName
|
|
99204
|
+
stepName: incomingStepName,
|
|
99205
|
+
runSpecVersion: bgRun.specVersion
|
|
98541
99206
|
});
|
|
98542
99207
|
} finally {
|
|
98543
99208
|
replayBudget.resume();
|
|
@@ -98551,7 +99216,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98551
99216
|
if (stepResult.type === "completed" && stepResult.hasPendingOps) {
|
|
98552
99217
|
await queueMessage(world, getWorkflowQueueName2(workflowName, namespace), {
|
|
98553
99218
|
runId,
|
|
98554
|
-
traceCarrier: await
|
|
99219
|
+
traceCarrier: await nextTraceCarrier(),
|
|
98555
99220
|
requestedAt: /* @__PURE__ */ new Date()
|
|
98556
99221
|
});
|
|
98557
99222
|
return;
|
|
@@ -98693,7 +99358,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98693
99358
|
});
|
|
98694
99359
|
await queueMessage(world, getWorkflowQueueName2(workflowName, namespace), {
|
|
98695
99360
|
runId,
|
|
98696
|
-
traceCarrier: await
|
|
99361
|
+
traceCarrier: await nextTraceCarrier(),
|
|
98697
99362
|
requestedAt: /* @__PURE__ */ new Date()
|
|
98698
99363
|
});
|
|
98699
99364
|
return;
|
|
@@ -98863,7 +99528,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98863
99528
|
eventType: "run_failed",
|
|
98864
99529
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
98865
99530
|
eventData: {
|
|
98866
|
-
error: await dehydrateRunError(suspensionError, runId, encryptionKey),
|
|
99531
|
+
error: await dehydrateRunError(suspensionError, runId, encryptionKey, globalThis, (workflowRun?.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2),
|
|
98867
99532
|
errorCode
|
|
98868
99533
|
}
|
|
98869
99534
|
}, { requestId });
|
|
@@ -98904,7 +99569,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98904
99569
|
const pendingSteps = suspensionResult.pendingSteps;
|
|
98905
99570
|
const ownedPendingSteps = pendingSteps.filter((s) => suspensionResult.createdStepCorrelationIds.has(s.correlationId));
|
|
98906
99571
|
const inlineStep = suspensionResult.hasAwaitedHookCreation ? void 0 : ownedPendingSteps[0];
|
|
98907
|
-
const traceCarrier = await
|
|
99572
|
+
const traceCarrier = await nextTraceCarrier();
|
|
98908
99573
|
const dispatches = [];
|
|
98909
99574
|
for (const step of pendingSteps) {
|
|
98910
99575
|
if (inlineStep && step.correlationId === inlineStep.correlationId) {
|
|
@@ -98944,13 +99609,14 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98944
99609
|
workflowName,
|
|
98945
99610
|
workflowStartedAt,
|
|
98946
99611
|
stepId: inlineStep.correlationId,
|
|
98947
|
-
stepName: inlineStep.stepName
|
|
99612
|
+
stepName: inlineStep.stepName,
|
|
99613
|
+
runSpecVersion: workflowRun.specVersion
|
|
98948
99614
|
});
|
|
98949
99615
|
} finally {
|
|
98950
99616
|
replayBudget.resume();
|
|
98951
99617
|
}
|
|
98952
99618
|
if (stepResult.type === "retry") {
|
|
98953
|
-
const retryTraceCarrier = await
|
|
99619
|
+
const retryTraceCarrier = await nextTraceCarrier();
|
|
98954
99620
|
await queueMessage(world, getWorkflowQueueName2(workflowName, namespace), {
|
|
98955
99621
|
runId,
|
|
98956
99622
|
stepId: inlineStep.correlationId,
|
|
@@ -98975,7 +99641,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98975
99641
|
});
|
|
98976
99642
|
await queueMessage(world, getWorkflowQueueName2(workflowName, namespace), {
|
|
98977
99643
|
runId,
|
|
98978
|
-
traceCarrier: await
|
|
99644
|
+
traceCarrier: await nextTraceCarrier(),
|
|
98979
99645
|
requestedAt: /* @__PURE__ */ new Date()
|
|
98980
99646
|
});
|
|
98981
99647
|
return;
|
|
@@ -98996,7 +99662,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98996
99662
|
});
|
|
98997
99663
|
await queueMessage(world, getWorkflowQueueName2(workflowName, namespace), {
|
|
98998
99664
|
runId,
|
|
98999
|
-
traceCarrier: await
|
|
99665
|
+
traceCarrier: await nextTraceCarrier(),
|
|
99000
99666
|
requestedAt: /* @__PURE__ */ new Date(),
|
|
99001
99667
|
replayDivergence: {
|
|
99002
99668
|
eventId: err.eventId,
|
|
@@ -99034,7 +99700,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
99034
99700
|
eventType: "run_failed",
|
|
99035
99701
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
99036
99702
|
eventData: {
|
|
99037
|
-
error: await dehydrateRunError(terminalError, runId, encryptionKey),
|
|
99703
|
+
error: await dehydrateRunError(terminalError, runId, encryptionKey, globalThis, (workflowRun?.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2),
|
|
99038
99704
|
errorCode
|
|
99039
99705
|
}
|
|
99040
99706
|
}, { requestId });
|
|
@@ -115348,10 +116014,10 @@ var Run = class _Run {
|
|
|
115348
116014
|
return this.getReadable();
|
|
115349
116015
|
}
|
|
115350
116016
|
};
|
|
115351
|
-
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
115352
|
-
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
115353
|
-
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
115354
|
-
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
116017
|
+
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#wakeUp");
|
|
116018
|
+
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#cancel");
|
|
116019
|
+
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#getReadable");
|
|
116020
|
+
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#exists");
|
|
115355
116021
|
Object.defineProperty(Run.prototype, "exists", {
|
|
115356
116022
|
get() {
|
|
115357
116023
|
return __step_Run$exists.call(this);
|
|
@@ -115359,7 +116025,7 @@ Object.defineProperty(Run.prototype, "exists", {
|
|
|
115359
116025
|
configurable: true,
|
|
115360
116026
|
enumerable: false
|
|
115361
116027
|
});
|
|
115362
|
-
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
116028
|
+
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#status");
|
|
115363
116029
|
Object.defineProperty(Run.prototype, "status", {
|
|
115364
116030
|
get() {
|
|
115365
116031
|
return __step_Run$status.call(this);
|
|
@@ -115367,7 +116033,7 @@ Object.defineProperty(Run.prototype, "status", {
|
|
|
115367
116033
|
configurable: true,
|
|
115368
116034
|
enumerable: false
|
|
115369
116035
|
});
|
|
115370
|
-
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
116036
|
+
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#returnValue");
|
|
115371
116037
|
Object.defineProperty(Run.prototype, "returnValue", {
|
|
115372
116038
|
get() {
|
|
115373
116039
|
return __step_Run$returnValue.call(this);
|
|
@@ -115375,7 +116041,7 @@ Object.defineProperty(Run.prototype, "returnValue", {
|
|
|
115375
116041
|
configurable: true,
|
|
115376
116042
|
enumerable: false
|
|
115377
116043
|
});
|
|
115378
|
-
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
116044
|
+
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#workflowName");
|
|
115379
116045
|
Object.defineProperty(Run.prototype, "workflowName", {
|
|
115380
116046
|
get() {
|
|
115381
116047
|
return __step_Run$workflowName.call(this);
|
|
@@ -115383,7 +116049,7 @@ Object.defineProperty(Run.prototype, "workflowName", {
|
|
|
115383
116049
|
configurable: true,
|
|
115384
116050
|
enumerable: false
|
|
115385
116051
|
});
|
|
115386
|
-
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
116052
|
+
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#createdAt");
|
|
115387
116053
|
Object.defineProperty(Run.prototype, "createdAt", {
|
|
115388
116054
|
get() {
|
|
115389
116055
|
return __step_Run$createdAt.call(this);
|
|
@@ -115391,7 +116057,7 @@ Object.defineProperty(Run.prototype, "createdAt", {
|
|
|
115391
116057
|
configurable: true,
|
|
115392
116058
|
enumerable: false
|
|
115393
116059
|
});
|
|
115394
|
-
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
116060
|
+
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#startedAt");
|
|
115395
116061
|
Object.defineProperty(Run.prototype, "startedAt", {
|
|
115396
116062
|
get() {
|
|
115397
116063
|
return __step_Run$startedAt.call(this);
|
|
@@ -115399,7 +116065,7 @@ Object.defineProperty(Run.prototype, "startedAt", {
|
|
|
115399
116065
|
configurable: true,
|
|
115400
116066
|
enumerable: false
|
|
115401
116067
|
});
|
|
115402
|
-
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
116068
|
+
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.18//Run#completedAt");
|
|
115403
116069
|
Object.defineProperty(Run.prototype, "completedAt", {
|
|
115404
116070
|
get() {
|
|
115405
116071
|
return __step_Run$completedAt.call(this);
|
|
@@ -115416,7 +116082,7 @@ Object.defineProperty(Run.prototype, "completedAt", {
|
|
|
115416
116082
|
enumerable: false,
|
|
115417
116083
|
configurable: false
|
|
115418
116084
|
});
|
|
115419
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
116085
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.18//Run");
|
|
115420
116086
|
|
|
115421
116087
|
// ../core/dist/workflow/create-hook.js
|
|
115422
116088
|
aliasSerializationClass(RUN_CLASS_ID, Run);
|