@workflow/world-testing 5.0.0-beta.17 → 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.
|
@@ -16321,7 +16321,7 @@ function requiresNewerWorld(v) {
|
|
|
16321
16321
|
return false;
|
|
16322
16322
|
return v > SPEC_VERSION_CURRENT2;
|
|
16323
16323
|
}
|
|
16324
|
-
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;
|
|
16325
16325
|
var init_spec_version2 = __esm({
|
|
16326
16326
|
"../world/dist/spec-version.js"() {
|
|
16327
16327
|
"use strict";
|
|
@@ -16329,7 +16329,8 @@ var init_spec_version2 = __esm({
|
|
|
16329
16329
|
SPEC_VERSION_SUPPORTS_EVENT_SOURCING2 = 2;
|
|
16330
16330
|
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT2 = 3;
|
|
16331
16331
|
SPEC_VERSION_SUPPORTS_ATTRIBUTES2 = 4;
|
|
16332
|
-
|
|
16332
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION2 = 5;
|
|
16333
|
+
SPEC_VERSION_CURRENT2 = SPEC_VERSION_SUPPORTS_COMPRESSION2;
|
|
16333
16334
|
__name(isLegacySpecVersion2, "isLegacySpecVersion");
|
|
16334
16335
|
__name(requiresNewerWorld, "requiresNewerWorld");
|
|
16335
16336
|
}
|
|
@@ -16660,6 +16661,7 @@ __export(dist_exports, {
|
|
|
16660
16661
|
SPEC_VERSION_LEGACY: () => SPEC_VERSION_LEGACY2,
|
|
16661
16662
|
SPEC_VERSION_SUPPORTS_ATTRIBUTES: () => SPEC_VERSION_SUPPORTS_ATTRIBUTES2,
|
|
16662
16663
|
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT: () => SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT2,
|
|
16664
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION: () => SPEC_VERSION_SUPPORTS_COMPRESSION2,
|
|
16663
16665
|
SPEC_VERSION_SUPPORTS_EVENT_SOURCING: () => SPEC_VERSION_SUPPORTS_EVENT_SOURCING2,
|
|
16664
16666
|
SerializedDataSchema: () => SerializedDataSchema2,
|
|
16665
16667
|
StepInvokePayloadSchema: () => StepInvokePayloadSchema2,
|
|
@@ -17077,7 +17079,7 @@ var init_log_format2 = __esm({
|
|
|
17077
17079
|
function SemanticConvention2(...names) {
|
|
17078
17080
|
return (value) => Object.fromEntries(names.map((name) => [name, value]));
|
|
17079
17081
|
}
|
|
17080
|
-
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, 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;
|
|
17081
17083
|
var init_semantic_conventions2 = __esm({
|
|
17082
17084
|
"../core/dist/telemetry/semantic-conventions.js"() {
|
|
17083
17085
|
"use strict";
|
|
@@ -17139,6 +17141,12 @@ var init_semantic_conventions2 = __esm({
|
|
|
17139
17141
|
QueueDeserializeTimeMs2 = SemanticConvention2("workflow.queue.deserialize_time_ms");
|
|
17140
17142
|
QueueExecutionTimeMs2 = SemanticConvention2("workflow.queue.execution_time_ms");
|
|
17141
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");
|
|
17142
17150
|
PeerService2 = SemanticConvention2("peer.service");
|
|
17143
17151
|
RpcSystem2 = SemanticConvention2("rpc.system");
|
|
17144
17152
|
RpcService2 = SemanticConvention2("rpc.service");
|
|
@@ -19177,7 +19185,7 @@ var version4;
|
|
|
19177
19185
|
var init_version3 = __esm({
|
|
19178
19186
|
"../core/dist/version.js"() {
|
|
19179
19187
|
"use strict";
|
|
19180
|
-
version4 = "5.0.0-beta.
|
|
19188
|
+
version4 = "5.0.0-beta.18";
|
|
19181
19189
|
}
|
|
19182
19190
|
});
|
|
19183
19191
|
|
|
@@ -20911,7 +20919,11 @@ var init_types3 = __esm({
|
|
|
20911
20919
|
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
20912
20920
|
DEVALUE_V1: "devl",
|
|
20913
20921
|
/** Encrypted payload (inner payload has its own format prefix) */
|
|
20914
|
-
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"
|
|
20915
20927
|
};
|
|
20916
20928
|
}
|
|
20917
20929
|
});
|
|
@@ -21060,6 +21072,168 @@ var init_format2 = __esm({
|
|
|
21060
21072
|
}
|
|
21061
21073
|
});
|
|
21062
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
|
+
|
|
21063
21237
|
// ../core/dist/serialization/encryption.js
|
|
21064
21238
|
async function resolveEncryptionKey2(key) {
|
|
21065
21239
|
return typeof key === "function" ? key() : key;
|
|
@@ -21142,7 +21316,7 @@ var init_errors6 = __esm({
|
|
|
21142
21316
|
|
|
21143
21317
|
// ../core/dist/serialization/client.js
|
|
21144
21318
|
async function deserialize3(data, encryptionKey, options) {
|
|
21145
|
-
const decrypted = await decrypt4(data, encryptionKey);
|
|
21319
|
+
const decrypted = await decompress2(await decrypt4(data, encryptionKey), options?.compressionStats);
|
|
21146
21320
|
if (!(decrypted instanceof Uint8Array)) {
|
|
21147
21321
|
if (devalueCodec2.deserializeLegacy) {
|
|
21148
21322
|
return devalueCodec2.deserializeLegacy(decrypted, "client", options);
|
|
@@ -21160,6 +21334,7 @@ var init_client2 = __esm({
|
|
|
21160
21334
|
"use strict";
|
|
21161
21335
|
init_dist6();
|
|
21162
21336
|
init_codec_devalue2();
|
|
21337
|
+
init_compression2();
|
|
21163
21338
|
init_encryption4();
|
|
21164
21339
|
init_errors6();
|
|
21165
21340
|
init_format2();
|
|
@@ -21173,7 +21348,8 @@ async function serialize3(value, encryptionKey, options) {
|
|
|
21173
21348
|
try {
|
|
21174
21349
|
const payload = devalueCodec2.serialize(value, "step", options);
|
|
21175
21350
|
const prefixed = encodeWithFormatPrefix2(SerializationFormat2.DEVALUE_V1, payload);
|
|
21176
|
-
|
|
21351
|
+
const compressed = await compress2(prefixed, options?.compression === true, options?.compressionStats);
|
|
21352
|
+
return encrypt4(compressed, encryptionKey);
|
|
21177
21353
|
} catch (error95) {
|
|
21178
21354
|
rethrowIfRuntimeError2(error95);
|
|
21179
21355
|
const { message, hint: hint3 } = formatSerializationError2("step value", error95);
|
|
@@ -21181,7 +21357,7 @@ async function serialize3(value, encryptionKey, options) {
|
|
|
21181
21357
|
}
|
|
21182
21358
|
}
|
|
21183
21359
|
async function deserialize4(data, encryptionKey, options) {
|
|
21184
|
-
const decrypted = await decrypt4(data, encryptionKey);
|
|
21360
|
+
const decrypted = await decompress2(await decrypt4(data, encryptionKey), options?.compressionStats);
|
|
21185
21361
|
if (!(decrypted instanceof Uint8Array)) {
|
|
21186
21362
|
if (devalueCodec2.deserializeLegacy) {
|
|
21187
21363
|
return devalueCodec2.deserializeLegacy(decrypted, "step", options);
|
|
@@ -21199,6 +21375,7 @@ var init_step2 = __esm({
|
|
|
21199
21375
|
"use strict";
|
|
21200
21376
|
init_dist6();
|
|
21201
21377
|
init_codec_devalue2();
|
|
21378
|
+
init_compression2();
|
|
21202
21379
|
init_encryption4();
|
|
21203
21380
|
init_errors6();
|
|
21204
21381
|
init_format2();
|
|
@@ -23591,7 +23768,15 @@ var init_capabilities2 = __esm({
|
|
|
23591
23768
|
import_semver3 = __toESM(require_semver5(), 1);
|
|
23592
23769
|
init_serialization4();
|
|
23593
23770
|
FORMAT_VERSION_TABLE2 = [
|
|
23594
|
-
{ 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" }
|
|
23595
23780
|
// Future entries:
|
|
23596
23781
|
// { format: SerializationFormat.CBOR, minVersion: '5.x.y' },
|
|
23597
23782
|
// { format: SerializationFormat.ENCRYPTED_V2, minVersion: '5.x.y' },
|
|
@@ -24797,9 +24982,10 @@ async function resumeHook2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
24797
24982
|
if (!capabilities.supportedFormats.has(SerializationFormat2.ENCRYPTED)) {
|
|
24798
24983
|
encryptionKey = void 0;
|
|
24799
24984
|
}
|
|
24985
|
+
const compression = (workflowRun.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2 && capabilities.supportedFormats.has(SerializationFormat2.GZIP);
|
|
24800
24986
|
const ops = [];
|
|
24801
24987
|
const v1Compat = isLegacySpecVersion2(hook.specVersion);
|
|
24802
|
-
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);
|
|
24803
24989
|
safeWaitUntil2(Promise.all(ops), (err) => {
|
|
24804
24990
|
if (err === void 0)
|
|
24805
24991
|
return;
|
|
@@ -24921,6 +25107,26 @@ function unwrapSerializationCause2(error95) {
|
|
|
24921
25107
|
}
|
|
24922
25108
|
return error95;
|
|
24923
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
|
+
}
|
|
24924
25130
|
function getSerializeStream2(reducers, cryptoKey) {
|
|
24925
25131
|
const encoder3 = new TextEncoder();
|
|
24926
25132
|
const keyState = { resolved: false, key: void 0 };
|
|
@@ -25970,7 +26176,10 @@ async function maybeDecrypt2(data, key) {
|
|
|
25970
26176
|
return decrypt4(data, key);
|
|
25971
26177
|
}
|
|
25972
26178
|
async function hydrateWorkflowArguments(value, _runId, key, global2 = globalThis, extraRevivers = {}) {
|
|
25973
|
-
|
|
26179
|
+
const compressionStats = {};
|
|
26180
|
+
const inflated = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26181
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26182
|
+
return deserialize5(inflated, {
|
|
25974
26183
|
global: global2,
|
|
25975
26184
|
extraRevivers: {
|
|
25976
26185
|
...getStreamAndRequestRevivers2(getWorkflowRevivers(global2)),
|
|
@@ -25978,16 +26187,21 @@ async function hydrateWorkflowArguments(value, _runId, key, global2 = globalThis
|
|
|
25978
26187
|
}
|
|
25979
26188
|
});
|
|
25980
26189
|
}
|
|
25981
|
-
async function dehydrateWorkflowReturnValue(value, _runId, key, global2 = globalThis, v1Compat = false) {
|
|
26190
|
+
async function dehydrateWorkflowReturnValue(value, _runId, key, global2 = globalThis, v1Compat = false, compression = false) {
|
|
25982
26191
|
if (v1Compat) {
|
|
25983
26192
|
const str = stringify2(value, getWorkflowReducers2(global2));
|
|
25984
26193
|
return revive2(str);
|
|
25985
26194
|
}
|
|
25986
26195
|
try {
|
|
25987
|
-
|
|
26196
|
+
const compressionStats = {};
|
|
26197
|
+
const result = await serialize3(value, key, {
|
|
25988
26198
|
global: global2,
|
|
25989
|
-
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2))
|
|
26199
|
+
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2)),
|
|
26200
|
+
compression,
|
|
26201
|
+
compressionStats
|
|
25990
26202
|
});
|
|
26203
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26204
|
+
return result;
|
|
25991
26205
|
} catch (error95) {
|
|
25992
26206
|
const cause = unwrapSerializationCause2(error95);
|
|
25993
26207
|
const { message, hint: hint3 } = formatSerializationError2("workflow return value", cause);
|
|
@@ -25995,24 +26209,33 @@ async function dehydrateWorkflowReturnValue(value, _runId, key, global2 = global
|
|
|
25995
26209
|
}
|
|
25996
26210
|
}
|
|
25997
26211
|
async function hydrateWorkflowReturnValue2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
25998
|
-
|
|
26212
|
+
const compressionStats = {};
|
|
26213
|
+
const result = await deserialize3(value, key, {
|
|
25999
26214
|
global: global2,
|
|
26000
26215
|
extraRevivers: {
|
|
26001
26216
|
...getStreamAndRequestRevivers2(getExternalRevivers2(global2, ops, runId, key)),
|
|
26002
26217
|
...extraRevivers
|
|
26003
|
-
}
|
|
26218
|
+
},
|
|
26219
|
+
compressionStats
|
|
26004
26220
|
});
|
|
26221
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26222
|
+
return result;
|
|
26005
26223
|
}
|
|
26006
|
-
async function dehydrateStepArguments2(value, _runId, key, global2 = globalThis, v1Compat = false) {
|
|
26224
|
+
async function dehydrateStepArguments2(value, _runId, key, global2 = globalThis, v1Compat = false, compression = false) {
|
|
26007
26225
|
if (v1Compat) {
|
|
26008
26226
|
const str = stringify2(value, getWorkflowReducers2(global2));
|
|
26009
26227
|
return revive2(str);
|
|
26010
26228
|
}
|
|
26011
26229
|
try {
|
|
26012
|
-
|
|
26230
|
+
const compressionStats = {};
|
|
26231
|
+
const result = await serialize3(value, key, {
|
|
26013
26232
|
global: global2,
|
|
26014
|
-
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2))
|
|
26233
|
+
extraReducers: getStreamAndRequestReducers2(getWorkflowReducers2(global2)),
|
|
26234
|
+
compression,
|
|
26235
|
+
compressionStats
|
|
26015
26236
|
});
|
|
26237
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26238
|
+
return result;
|
|
26016
26239
|
} catch (error95) {
|
|
26017
26240
|
const cause = unwrapSerializationCause2(error95);
|
|
26018
26241
|
const { message, hint: hint3 } = formatSerializationError2("step arguments", cause);
|
|
@@ -26020,36 +26243,49 @@ async function dehydrateStepArguments2(value, _runId, key, global2 = globalThis,
|
|
|
26020
26243
|
}
|
|
26021
26244
|
}
|
|
26022
26245
|
async function hydrateStepArguments2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId) {
|
|
26023
|
-
|
|
26246
|
+
const compressionStats = {};
|
|
26247
|
+
const result = await deserialize4(value, key, {
|
|
26024
26248
|
global: global2,
|
|
26025
26249
|
extraRevivers: {
|
|
26026
26250
|
...getStreamAndRequestRevivers2(getStepRevivers2(global2, ops, runId, key, deploymentId)),
|
|
26027
26251
|
...extraRevivers
|
|
26028
|
-
}
|
|
26252
|
+
},
|
|
26253
|
+
compressionStats
|
|
26029
26254
|
});
|
|
26255
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26256
|
+
return result;
|
|
26030
26257
|
}
|
|
26031
|
-
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) {
|
|
26032
26259
|
if (v1Compat) {
|
|
26033
26260
|
const str = stringify2(value, getStepReducers2(global2, ops, runId, key, framedByteStreams));
|
|
26034
26261
|
return revive2(str);
|
|
26035
26262
|
}
|
|
26036
26263
|
try {
|
|
26037
|
-
|
|
26264
|
+
const compressionStats = {};
|
|
26265
|
+
const result = await serialize3(value, key, {
|
|
26038
26266
|
global: global2,
|
|
26039
|
-
extraReducers: getStreamAndRequestReducers2(getStepReducers2(global2, ops, runId, key, framedByteStreams))
|
|
26267
|
+
extraReducers: getStreamAndRequestReducers2(getStepReducers2(global2, ops, runId, key, framedByteStreams)),
|
|
26268
|
+
compression,
|
|
26269
|
+
compressionStats
|
|
26040
26270
|
});
|
|
26271
|
+
await recordCompression2(compressionStats, "serialize");
|
|
26272
|
+
return result;
|
|
26041
26273
|
} catch (error95) {
|
|
26042
26274
|
const cause = unwrapSerializationCause2(error95);
|
|
26043
26275
|
const { message, hint: hint3 } = formatSerializationError2("step return value", cause);
|
|
26044
26276
|
throw new SerializationError2(message, { hint: hint3, cause });
|
|
26045
26277
|
}
|
|
26046
26278
|
}
|
|
26047
|
-
async function dehydrateStepError(value, runId, key, ops = [], global2 = globalThis) {
|
|
26279
|
+
async function dehydrateStepError(value, runId, key, ops = [], global2 = globalThis, compression = false) {
|
|
26048
26280
|
try {
|
|
26049
26281
|
const str = stringify2(value, getStepReducers2(global2, ops, runId, key));
|
|
26050
26282
|
const payload = new TextEncoder().encode(str);
|
|
26051
26283
|
const serialized = encodeWithFormatPrefix2(SerializationFormat2.DEVALUE_V1, payload);
|
|
26052
|
-
|
|
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;
|
|
26053
26289
|
} catch (error95) {
|
|
26054
26290
|
const cause = unwrapSerializationCause2(error95);
|
|
26055
26291
|
const { message, hint: hint3 } = formatSerializationError2("step error", cause);
|
|
@@ -26057,7 +26293,9 @@ async function dehydrateStepError(value, runId, key, ops = [], global2 = globalT
|
|
|
26057
26293
|
}
|
|
26058
26294
|
}
|
|
26059
26295
|
async function hydrateStepError(value, _runId, key, global2 = globalThis, extraRevivers = {}) {
|
|
26060
|
-
const
|
|
26296
|
+
const compressionStats = {};
|
|
26297
|
+
const decrypted = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26298
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26061
26299
|
if (!(decrypted instanceof Uint8Array)) {
|
|
26062
26300
|
return unflatten2(decrypted, {
|
|
26063
26301
|
...getWorkflowRevivers(global2),
|
|
@@ -26074,12 +26312,16 @@ async function hydrateStepError(value, _runId, key, global2 = globalThis, extraR
|
|
|
26074
26312
|
}
|
|
26075
26313
|
throw new Error(`Unsupported serialization format: ${format}`);
|
|
26076
26314
|
}
|
|
26077
|
-
async function dehydrateRunError(value, _runId, key, global2 = globalThis) {
|
|
26315
|
+
async function dehydrateRunError(value, _runId, key, global2 = globalThis, compression = false) {
|
|
26078
26316
|
try {
|
|
26079
26317
|
const str = stringify2(value, getWorkflowReducers2(global2));
|
|
26080
26318
|
const payload = new TextEncoder().encode(str);
|
|
26081
26319
|
const serialized = encodeWithFormatPrefix2(SerializationFormat2.DEVALUE_V1, payload);
|
|
26082
|
-
|
|
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;
|
|
26083
26325
|
} catch (error95) {
|
|
26084
26326
|
const cause = unwrapSerializationCause2(error95);
|
|
26085
26327
|
const { message, hint: hint3 } = formatSerializationError2("run error", cause);
|
|
@@ -26087,7 +26329,9 @@ async function dehydrateRunError(value, _runId, key, global2 = globalThis) {
|
|
|
26087
26329
|
}
|
|
26088
26330
|
}
|
|
26089
26331
|
async function hydrateRunError2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
26090
|
-
const
|
|
26332
|
+
const compressionStats = {};
|
|
26333
|
+
const decrypted = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26334
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26091
26335
|
if (!(decrypted instanceof Uint8Array)) {
|
|
26092
26336
|
return unflatten2(decrypted, {
|
|
26093
26337
|
...getExternalRevivers2(global2, ops, runId, key),
|
|
@@ -26105,7 +26349,10 @@ async function hydrateRunError2(value, runId, key, ops = [], global2 = globalThi
|
|
|
26105
26349
|
throw new Error(`Unsupported serialization format: ${format}`);
|
|
26106
26350
|
}
|
|
26107
26351
|
async function hydrateStepReturnValue(value, _runId, key, global2 = globalThis, extraRevivers = {}) {
|
|
26108
|
-
|
|
26352
|
+
const compressionStats = {};
|
|
26353
|
+
const inflated = await decompress2(await maybeDecrypt2(value, key), compressionStats);
|
|
26354
|
+
await recordCompression2(compressionStats, "deserialize");
|
|
26355
|
+
return deserialize5(inflated, {
|
|
26109
26356
|
global: global2,
|
|
26110
26357
|
extraRevivers: {
|
|
26111
26358
|
...getStreamAndRequestRevivers2(getWorkflowRevivers(global2)),
|
|
@@ -26143,6 +26390,7 @@ var init_serialization4 = __esm({
|
|
|
26143
26390
|
init_private2();
|
|
26144
26391
|
init_get_world_lazy2();
|
|
26145
26392
|
init_client2();
|
|
26393
|
+
init_compression2();
|
|
26146
26394
|
init_encryption4();
|
|
26147
26395
|
init_errors6();
|
|
26148
26396
|
init_format2();
|
|
@@ -26154,12 +26402,15 @@ var init_serialization4 = __esm({
|
|
|
26154
26402
|
init_workflow2();
|
|
26155
26403
|
init_context_storage2();
|
|
26156
26404
|
init_symbols2();
|
|
26405
|
+
init_semantic_conventions2();
|
|
26406
|
+
init_telemetry2();
|
|
26157
26407
|
init_util4();
|
|
26158
26408
|
init_abort_controller2();
|
|
26159
26409
|
defaultUlid2 = monotonicFactory2();
|
|
26160
26410
|
__name(getStreamType2, "getStreamType");
|
|
26161
26411
|
FRAME_HEADER_SIZE2 = 4;
|
|
26162
26412
|
__name(unwrapSerializationCause2, "unwrapSerializationCause");
|
|
26413
|
+
__name(recordCompression2, "recordCompression");
|
|
26163
26414
|
__name(getSerializeStream2, "getSerializeStream");
|
|
26164
26415
|
__name(getDeserializeStream2, "getDeserializeStream");
|
|
26165
26416
|
MAX_FRAME_SIZE2 = 1e8;
|
|
@@ -71951,6 +72202,7 @@ var SPEC_VERSION_LEGACY;
|
|
|
71951
72202
|
var SPEC_VERSION_SUPPORTS_EVENT_SOURCING;
|
|
71952
72203
|
var SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT;
|
|
71953
72204
|
var SPEC_VERSION_SUPPORTS_ATTRIBUTES;
|
|
72205
|
+
var SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
71954
72206
|
var SPEC_VERSION_CURRENT;
|
|
71955
72207
|
var init_spec_version = __esm2({
|
|
71956
72208
|
"../world/dist/spec-version.js"() {
|
|
@@ -71959,7 +72211,8 @@ var init_spec_version = __esm2({
|
|
|
71959
72211
|
SPEC_VERSION_SUPPORTS_EVENT_SOURCING = 2;
|
|
71960
72212
|
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
|
|
71961
72213
|
SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
|
|
71962
|
-
|
|
72214
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION = 5;
|
|
72215
|
+
SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
71963
72216
|
__name2(isLegacySpecVersion, "isLegacySpecVersion");
|
|
71964
72217
|
}
|
|
71965
72218
|
});
|
|
@@ -73766,7 +74019,11 @@ var init_types = __esm2({
|
|
|
73766
74019
|
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
73767
74020
|
DEVALUE_V1: "devl",
|
|
73768
74021
|
/** Encrypted payload (inner payload has its own format prefix) */
|
|
73769
|
-
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"
|
|
73770
74027
|
};
|
|
73771
74028
|
}
|
|
73772
74029
|
});
|
|
@@ -73928,6 +74185,179 @@ var init_format = __esm2({
|
|
|
73928
74185
|
__name2(decodeFormatPrefix, "decodeFormatPrefix");
|
|
73929
74186
|
}
|
|
73930
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
|
+
});
|
|
73931
74361
|
async function resolveEncryptionKey(key) {
|
|
73932
74362
|
return typeof key === "function" ? key() : key;
|
|
73933
74363
|
}
|
|
@@ -74401,6 +74831,12 @@ var WorkflowEventsPagesLoaded;
|
|
|
74401
74831
|
var QueueDeserializeTimeMs;
|
|
74402
74832
|
var QueueExecutionTimeMs;
|
|
74403
74833
|
var QueueSerializeTimeMs;
|
|
74834
|
+
var SerializationOperation;
|
|
74835
|
+
var SerializationCompressed;
|
|
74836
|
+
var SerializationCodec;
|
|
74837
|
+
var SerializationUncompressedBytes;
|
|
74838
|
+
var SerializationStoredBytes;
|
|
74839
|
+
var SerializationCompressionRatio;
|
|
74404
74840
|
var PeerService;
|
|
74405
74841
|
var RpcSystem;
|
|
74406
74842
|
var RpcService;
|
|
@@ -74468,6 +74904,12 @@ var init_semantic_conventions = __esm2({
|
|
|
74468
74904
|
QueueDeserializeTimeMs = SemanticConvention("workflow.queue.deserialize_time_ms");
|
|
74469
74905
|
QueueExecutionTimeMs = SemanticConvention("workflow.queue.execution_time_ms");
|
|
74470
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");
|
|
74471
74913
|
PeerService = SemanticConvention("peer.service");
|
|
74472
74914
|
RpcSystem = SemanticConvention("rpc.system");
|
|
74473
74915
|
RpcService = SemanticConvention("rpc.service");
|
|
@@ -76731,7 +77173,8 @@ async function serialize(value, encryptionKey, options) {
|
|
|
76731
77173
|
try {
|
|
76732
77174
|
const payload = devalueCodec.serialize(value, "client", options);
|
|
76733
77175
|
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
76734
|
-
|
|
77176
|
+
const compressed = await compress(prefixed, options?.compression === true, options?.compressionStats);
|
|
77177
|
+
return encrypt2(compressed, encryptionKey);
|
|
76735
77178
|
} catch (error482) {
|
|
76736
77179
|
rethrowIfRuntimeError(error482);
|
|
76737
77180
|
const { message, hint: hint22 } = formatSerializationError("client value", error482);
|
|
@@ -76743,7 +77186,7 @@ async function serialize(value, encryptionKey, options) {
|
|
|
76743
77186
|
}
|
|
76744
77187
|
__name(serialize, "serialize");
|
|
76745
77188
|
async function deserialize(data, encryptionKey, options) {
|
|
76746
|
-
const decrypted = await decrypt2(data, encryptionKey);
|
|
77189
|
+
const decrypted = await decompress(await decrypt2(data, encryptionKey), options?.compressionStats);
|
|
76747
77190
|
if (!(decrypted instanceof Uint8Array)) {
|
|
76748
77191
|
if (devalueCodec.deserializeLegacy) {
|
|
76749
77192
|
return devalueCodec.deserializeLegacy(decrypted, "client", options);
|
|
@@ -76762,6 +77205,7 @@ var init_client = __esm2({
|
|
|
76762
77205
|
"use strict";
|
|
76763
77206
|
init_dist2();
|
|
76764
77207
|
init_codec_devalue();
|
|
77208
|
+
init_compression();
|
|
76765
77209
|
init_encryption2();
|
|
76766
77210
|
init_errors3();
|
|
76767
77211
|
init_format();
|
|
@@ -76774,7 +77218,8 @@ async function serialize2(value, encryptionKey, options) {
|
|
|
76774
77218
|
try {
|
|
76775
77219
|
const payload = devalueCodec.serialize(value, "step", options);
|
|
76776
77220
|
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
76777
|
-
|
|
77221
|
+
const compressed = await compress(prefixed, options?.compression === true, options?.compressionStats);
|
|
77222
|
+
return encrypt2(compressed, encryptionKey);
|
|
76778
77223
|
} catch (error482) {
|
|
76779
77224
|
rethrowIfRuntimeError(error482);
|
|
76780
77225
|
const { message, hint: hint22 } = formatSerializationError("step value", error482);
|
|
@@ -76786,7 +77231,7 @@ async function serialize2(value, encryptionKey, options) {
|
|
|
76786
77231
|
}
|
|
76787
77232
|
__name(serialize2, "serialize2");
|
|
76788
77233
|
async function deserialize2(data, encryptionKey, options) {
|
|
76789
|
-
const decrypted = await decrypt2(data, encryptionKey);
|
|
77234
|
+
const decrypted = await decompress(await decrypt2(data, encryptionKey), options?.compressionStats);
|
|
76790
77235
|
if (!(decrypted instanceof Uint8Array)) {
|
|
76791
77236
|
if (devalueCodec.deserializeLegacy) {
|
|
76792
77237
|
return devalueCodec.deserializeLegacy(decrypted, "step", options);
|
|
@@ -76805,6 +77250,7 @@ var init_step = __esm2({
|
|
|
76805
77250
|
"use strict";
|
|
76806
77251
|
init_dist2();
|
|
76807
77252
|
init_codec_devalue();
|
|
77253
|
+
init_compression();
|
|
76808
77254
|
init_encryption2();
|
|
76809
77255
|
init_errors3();
|
|
76810
77256
|
init_format();
|
|
@@ -78864,6 +79310,20 @@ var init_capabilities = __esm2({
|
|
|
78864
79310
|
{
|
|
78865
79311
|
format: SerializationFormat.ENCRYPTED,
|
|
78866
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"
|
|
78867
79327
|
}
|
|
78868
79328
|
];
|
|
78869
79329
|
CAPABILITY_VERSION_TABLE = [
|
|
@@ -78882,7 +79342,7 @@ var version2;
|
|
|
78882
79342
|
var init_version = __esm2({
|
|
78883
79343
|
"../core/dist/version.js"() {
|
|
78884
79344
|
"use strict";
|
|
78885
|
-
version2 = "5.0.0-beta.
|
|
79345
|
+
version2 = "5.0.0-beta.18";
|
|
78886
79346
|
}
|
|
78887
79347
|
});
|
|
78888
79348
|
function getWorkflowQueueName(workflowName, namespace) {
|
|
@@ -80271,9 +80731,10 @@ async function resumeHook(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
80271
80731
|
if (!capabilities.supportedFormats.has(SerializationFormat.ENCRYPTED)) {
|
|
80272
80732
|
encryptionKey = void 0;
|
|
80273
80733
|
}
|
|
80734
|
+
const compression = (workflowRun.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat.GZIP);
|
|
80274
80735
|
const ops = [];
|
|
80275
80736
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
80276
|
-
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);
|
|
80277
80738
|
safeWaitUntil(Promise.all(ops), (err) => {
|
|
80278
80739
|
if (err === void 0) return;
|
|
80279
80740
|
runtimeLogger.warn("Background flush of hook payload ops failed", {
|
|
@@ -80406,6 +80867,25 @@ function unwrapSerializationCause(error482) {
|
|
|
80406
80867
|
return error482;
|
|
80407
80868
|
}
|
|
80408
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");
|
|
80409
80889
|
function getSerializeStream(reducers, cryptoKey) {
|
|
80410
80890
|
const encoder22 = new TextEncoder();
|
|
80411
80891
|
const keyState = {
|
|
@@ -81391,16 +81871,21 @@ async function maybeDecrypt(data, key) {
|
|
|
81391
81871
|
return decrypt2(data, key);
|
|
81392
81872
|
}
|
|
81393
81873
|
__name(maybeDecrypt, "maybeDecrypt");
|
|
81394
|
-
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) {
|
|
81395
81875
|
if (v1Compat) {
|
|
81396
81876
|
const str = stringify(value, getExternalReducers(global2, ops, runId, key, framedByteStreams));
|
|
81397
81877
|
return revive(str);
|
|
81398
81878
|
}
|
|
81399
81879
|
try {
|
|
81400
|
-
|
|
81880
|
+
const compressionStats = {};
|
|
81881
|
+
const result = await serialize(value, key, {
|
|
81401
81882
|
global: global2,
|
|
81402
|
-
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams))
|
|
81883
|
+
extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams)),
|
|
81884
|
+
compression,
|
|
81885
|
+
compressionStats
|
|
81403
81886
|
});
|
|
81887
|
+
await recordCompression(compressionStats, "serialize");
|
|
81888
|
+
return result;
|
|
81404
81889
|
} catch (error482) {
|
|
81405
81890
|
const cause = unwrapSerializationCause(error482);
|
|
81406
81891
|
const { message, hint: hint22 } = formatSerializationError("workflow arguments", cause);
|
|
@@ -81412,25 +81897,34 @@ async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 =
|
|
|
81412
81897
|
}
|
|
81413
81898
|
__name(dehydrateWorkflowArguments, "dehydrateWorkflowArguments");
|
|
81414
81899
|
async function hydrateWorkflowReturnValue(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
81415
|
-
|
|
81900
|
+
const compressionStats = {};
|
|
81901
|
+
const result = await deserialize(value, key, {
|
|
81416
81902
|
global: global2,
|
|
81417
81903
|
extraRevivers: {
|
|
81418
81904
|
...getStreamAndRequestRevivers(getExternalRevivers(global2, ops, runId, key)),
|
|
81419
81905
|
...extraRevivers
|
|
81420
|
-
}
|
|
81906
|
+
},
|
|
81907
|
+
compressionStats
|
|
81421
81908
|
});
|
|
81909
|
+
await recordCompression(compressionStats, "deserialize");
|
|
81910
|
+
return result;
|
|
81422
81911
|
}
|
|
81423
81912
|
__name(hydrateWorkflowReturnValue, "hydrateWorkflowReturnValue");
|
|
81424
|
-
async function dehydrateStepArguments(value, _runId, key, global2 = globalThis, v1Compat = false) {
|
|
81913
|
+
async function dehydrateStepArguments(value, _runId, key, global2 = globalThis, v1Compat = false, compression = false) {
|
|
81425
81914
|
if (v1Compat) {
|
|
81426
81915
|
const str = stringify(value, getWorkflowReducers(global2));
|
|
81427
81916
|
return revive(str);
|
|
81428
81917
|
}
|
|
81429
81918
|
try {
|
|
81430
|
-
|
|
81919
|
+
const compressionStats = {};
|
|
81920
|
+
const result = await serialize2(value, key, {
|
|
81431
81921
|
global: global2,
|
|
81432
|
-
extraReducers: getStreamAndRequestReducers(getWorkflowReducers(global2))
|
|
81922
|
+
extraReducers: getStreamAndRequestReducers(getWorkflowReducers(global2)),
|
|
81923
|
+
compression,
|
|
81924
|
+
compressionStats
|
|
81433
81925
|
});
|
|
81926
|
+
await recordCompression(compressionStats, "serialize");
|
|
81927
|
+
return result;
|
|
81434
81928
|
} catch (error482) {
|
|
81435
81929
|
const cause = unwrapSerializationCause(error482);
|
|
81436
81930
|
const { message, hint: hint22 } = formatSerializationError("step arguments", cause);
|
|
@@ -81442,25 +81936,34 @@ async function dehydrateStepArguments(value, _runId, key, global2 = globalThis,
|
|
|
81442
81936
|
}
|
|
81443
81937
|
__name(dehydrateStepArguments, "dehydrateStepArguments");
|
|
81444
81938
|
async function hydrateStepArguments(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId) {
|
|
81445
|
-
|
|
81939
|
+
const compressionStats = {};
|
|
81940
|
+
const result = await deserialize2(value, key, {
|
|
81446
81941
|
global: global2,
|
|
81447
81942
|
extraRevivers: {
|
|
81448
81943
|
...getStreamAndRequestRevivers(getStepRevivers(global2, ops, runId, key, deploymentId)),
|
|
81449
81944
|
...extraRevivers
|
|
81450
|
-
}
|
|
81945
|
+
},
|
|
81946
|
+
compressionStats
|
|
81451
81947
|
});
|
|
81948
|
+
await recordCompression(compressionStats, "deserialize");
|
|
81949
|
+
return result;
|
|
81452
81950
|
}
|
|
81453
81951
|
__name(hydrateStepArguments, "hydrateStepArguments");
|
|
81454
|
-
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) {
|
|
81455
81953
|
if (v1Compat) {
|
|
81456
81954
|
const str = stringify(value, getStepReducers(global2, ops, runId, key, framedByteStreams));
|
|
81457
81955
|
return revive(str);
|
|
81458
81956
|
}
|
|
81459
81957
|
try {
|
|
81460
|
-
|
|
81958
|
+
const compressionStats = {};
|
|
81959
|
+
const result = await serialize2(value, key, {
|
|
81461
81960
|
global: global2,
|
|
81462
|
-
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams))
|
|
81961
|
+
extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams)),
|
|
81962
|
+
compression,
|
|
81963
|
+
compressionStats
|
|
81463
81964
|
});
|
|
81965
|
+
await recordCompression(compressionStats, "serialize");
|
|
81966
|
+
return result;
|
|
81464
81967
|
} catch (error482) {
|
|
81465
81968
|
const cause = unwrapSerializationCause(error482);
|
|
81466
81969
|
const { message, hint: hint22 } = formatSerializationError("step return value", cause);
|
|
@@ -81472,7 +81975,9 @@ async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = g
|
|
|
81472
81975
|
}
|
|
81473
81976
|
__name(dehydrateStepReturnValue, "dehydrateStepReturnValue");
|
|
81474
81977
|
async function hydrateRunError(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
81475
|
-
const
|
|
81978
|
+
const compressionStats = {};
|
|
81979
|
+
const decrypted = await decompress(await maybeDecrypt(value, key), compressionStats);
|
|
81980
|
+
await recordCompression(compressionStats, "deserialize");
|
|
81476
81981
|
if (!(decrypted instanceof Uint8Array)) {
|
|
81477
81982
|
return unflatten(decrypted, {
|
|
81478
81983
|
...getExternalRevivers(global2, ops, runId, key),
|
|
@@ -81530,6 +82035,7 @@ var init_serialization2 = __esm2({
|
|
|
81530
82035
|
init_private();
|
|
81531
82036
|
init_get_world_lazy();
|
|
81532
82037
|
init_client();
|
|
82038
|
+
init_compression();
|
|
81533
82039
|
init_encryption2();
|
|
81534
82040
|
init_errors3();
|
|
81535
82041
|
init_format();
|
|
@@ -81541,12 +82047,15 @@ var init_serialization2 = __esm2({
|
|
|
81541
82047
|
init_workflow();
|
|
81542
82048
|
init_context_storage();
|
|
81543
82049
|
init_symbols();
|
|
82050
|
+
init_semantic_conventions();
|
|
82051
|
+
init_telemetry();
|
|
81544
82052
|
init_util2();
|
|
81545
82053
|
init_abort_controller();
|
|
81546
82054
|
defaultUlid = monotonicFactory();
|
|
81547
82055
|
__name2(getStreamType, "getStreamType");
|
|
81548
82056
|
FRAME_HEADER_SIZE = 4;
|
|
81549
82057
|
__name2(unwrapSerializationCause, "unwrapSerializationCause");
|
|
82058
|
+
__name2(recordCompression, "recordCompression");
|
|
81550
82059
|
__name2(getSerializeStream, "getSerializeStream");
|
|
81551
82060
|
__name2(getDeserializeStream, "getDeserializeStream");
|
|
81552
82061
|
MAX_FRAME_SIZE = 1e8;
|
|
@@ -81877,6 +82386,7 @@ init_helpers();
|
|
|
81877
82386
|
init_wait_until();
|
|
81878
82387
|
var CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS = 2e3;
|
|
81879
82388
|
var ulid3 = monotonicFactory();
|
|
82389
|
+
var hasWarnedLatestNoOp = false;
|
|
81880
82390
|
async function start(workflow, argsOrOptions, options) {
|
|
81881
82391
|
return await waitedUntil(() => {
|
|
81882
82392
|
const workflowName = workflow?.workflowId;
|
|
@@ -81905,22 +82415,34 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
81905
82415
|
const currentDeploymentId = await world.getDeploymentId();
|
|
81906
82416
|
let deploymentId = opts.deploymentId ?? currentDeploymentId;
|
|
81907
82417
|
if (deploymentId === "latest") {
|
|
81908
|
-
if (
|
|
81909
|
-
|
|
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;
|
|
81910
82428
|
}
|
|
81911
|
-
deploymentId = await world.resolveLatestDeploymentId();
|
|
81912
82429
|
}
|
|
81913
82430
|
let framedByteStreams;
|
|
82431
|
+
let targetSupportsCompression;
|
|
81914
82432
|
if (deploymentId === currentDeploymentId) {
|
|
81915
82433
|
framedByteStreams = true;
|
|
82434
|
+
targetSupportsCompression = true;
|
|
81916
82435
|
} else if (typeof world.streams?.get !== "function") {
|
|
81917
82436
|
framedByteStreams = false;
|
|
82437
|
+
targetSupportsCompression = false;
|
|
81918
82438
|
} else {
|
|
81919
82439
|
const probe = await healthCheck(world, "workflow", {
|
|
81920
82440
|
deploymentId,
|
|
81921
82441
|
timeout: CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS
|
|
81922
82442
|
}).catch(() => void 0);
|
|
81923
|
-
|
|
82443
|
+
const capabilities = getRunCapabilities(probe?.workflowCoreVersion);
|
|
82444
|
+
framedByteStreams = capabilities.framedByteStreams;
|
|
82445
|
+
targetSupportsCompression = capabilities.supportedFormats.has(SerializationFormat.GZIP);
|
|
81924
82446
|
}
|
|
81925
82447
|
const ops = [];
|
|
81926
82448
|
const runId = `wrun_${ulid3()}`;
|
|
@@ -81957,7 +82479,8 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
81957
82479
|
deploymentId
|
|
81958
82480
|
});
|
|
81959
82481
|
const encryptionKey = rawKey ? await importKey(rawKey) : void 0;
|
|
81960
|
-
const
|
|
82482
|
+
const compression = targetSupportsCompression && specVersion >= SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
82483
|
+
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat, framedByteStreams, compression);
|
|
81961
82484
|
const executionContext = {
|
|
81962
82485
|
traceCarrier,
|
|
81963
82486
|
workflowCoreVersion: version2,
|
|
@@ -82049,7 +82572,7 @@ __name2(start, "start");
|
|
|
82049
82572
|
value: "start",
|
|
82050
82573
|
configurable: true
|
|
82051
82574
|
});
|
|
82052
|
-
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.
|
|
82575
|
+
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.18//start");
|
|
82053
82576
|
function isRetryableStartError(err) {
|
|
82054
82577
|
if (ThrottleError.is(err)) return true;
|
|
82055
82578
|
if (WorkflowWorldError.is(err) && err.status && err.status >= 500) return true;
|
|
@@ -82383,7 +82906,7 @@ var Run = class _Run {
|
|
|
82383
82906
|
value: "wakeUp",
|
|
82384
82907
|
configurable: true
|
|
82385
82908
|
});
|
|
82386
|
-
})(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");
|
|
82387
82910
|
(function(__wf_fn, __wf_id) {
|
|
82388
82911
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82389
82912
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82392,7 +82915,7 @@ var Run = class _Run {
|
|
|
82392
82915
|
value: "cancel",
|
|
82393
82916
|
configurable: true
|
|
82394
82917
|
});
|
|
82395
|
-
})(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");
|
|
82396
82919
|
(function(__wf_fn, __wf_id) {
|
|
82397
82920
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82398
82921
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82401,7 +82924,7 @@ var Run = class _Run {
|
|
|
82401
82924
|
value: "getReadable",
|
|
82402
82925
|
configurable: true
|
|
82403
82926
|
});
|
|
82404
|
-
})(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");
|
|
82405
82928
|
(function(__wf_fn, __wf_id) {
|
|
82406
82929
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82407
82930
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82410,7 +82933,7 @@ var Run = class _Run {
|
|
|
82410
82933
|
value: "exists",
|
|
82411
82934
|
configurable: true
|
|
82412
82935
|
});
|
|
82413
|
-
})(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");
|
|
82414
82937
|
(function(__wf_fn, __wf_id) {
|
|
82415
82938
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82416
82939
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82419,7 +82942,7 @@ var Run = class _Run {
|
|
|
82419
82942
|
value: "status",
|
|
82420
82943
|
configurable: true
|
|
82421
82944
|
});
|
|
82422
|
-
})(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");
|
|
82423
82946
|
(function(__wf_fn, __wf_id) {
|
|
82424
82947
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82425
82948
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82428,7 +82951,7 @@ var Run = class _Run {
|
|
|
82428
82951
|
value: "returnValue",
|
|
82429
82952
|
configurable: true
|
|
82430
82953
|
});
|
|
82431
|
-
})(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");
|
|
82432
82955
|
(function(__wf_fn, __wf_id) {
|
|
82433
82956
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82434
82957
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82437,7 +82960,7 @@ var Run = class _Run {
|
|
|
82437
82960
|
value: "workflowName",
|
|
82438
82961
|
configurable: true
|
|
82439
82962
|
});
|
|
82440
|
-
})(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");
|
|
82441
82964
|
(function(__wf_fn, __wf_id) {
|
|
82442
82965
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82443
82966
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82446,7 +82969,7 @@ var Run = class _Run {
|
|
|
82446
82969
|
value: "createdAt",
|
|
82447
82970
|
configurable: true
|
|
82448
82971
|
});
|
|
82449
|
-
})(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");
|
|
82450
82973
|
(function(__wf_fn, __wf_id) {
|
|
82451
82974
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82452
82975
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82455,7 +82978,7 @@ var Run = class _Run {
|
|
|
82455
82978
|
value: "startedAt",
|
|
82456
82979
|
configurable: true
|
|
82457
82980
|
});
|
|
82458
|
-
})(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");
|
|
82459
82982
|
(function(__wf_fn, __wf_id) {
|
|
82460
82983
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82461
82984
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -82464,7 +82987,7 @@ var Run = class _Run {
|
|
|
82464
82987
|
value: "completedAt",
|
|
82465
82988
|
configurable: true
|
|
82466
82989
|
});
|
|
82467
|
-
})(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");
|
|
82468
82991
|
(function(__wf_cls, __wf_id) {
|
|
82469
82992
|
var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
82470
82993
|
__wf_reg.set(__wf_id, __wf_cls);
|
|
@@ -82474,7 +82997,7 @@ var Run = class _Run {
|
|
|
82474
82997
|
enumerable: false,
|
|
82475
82998
|
configurable: false
|
|
82476
82999
|
});
|
|
82477
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
83000
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.18//Run");
|
|
82478
83001
|
async function fetch2(...args) {
|
|
82479
83002
|
return globalThis.fetch(...args);
|
|
82480
83003
|
}
|
|
@@ -93300,7 +93823,7 @@ import os from "node:os";
|
|
|
93300
93823
|
import { inspect } from "node:util";
|
|
93301
93824
|
|
|
93302
93825
|
// ../world-vercel/dist/version.js
|
|
93303
|
-
var version5 = "5.0.0-beta.
|
|
93826
|
+
var version5 = "5.0.0-beta.17";
|
|
93304
93827
|
|
|
93305
93828
|
// ../world-vercel/dist/utils.js
|
|
93306
93829
|
var HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
@@ -94105,14 +94628,21 @@ async function consumeListFrameStream(url3, headers, config4, opName) {
|
|
|
94105
94628
|
return { events, ...next2 ? { next: next2 } : {} };
|
|
94106
94629
|
}
|
|
94107
94630
|
__name(consumeListFrameStream, "consumeListFrameStream");
|
|
94108
|
-
function
|
|
94109
|
-
const sp = new URLSearchParams();
|
|
94631
|
+
function appendListParams(sp, params) {
|
|
94110
94632
|
if (params.cursor)
|
|
94111
94633
|
sp.set("cursor", params.cursor);
|
|
94112
94634
|
if (params.limit !== void 0)
|
|
94113
94635
|
sp.set("limit", String(params.limit));
|
|
94114
94636
|
if (params.sortOrder)
|
|
94115
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);
|
|
94116
94646
|
const qs = sp.toString();
|
|
94117
94647
|
return qs ? `?${qs}` : "";
|
|
94118
94648
|
}
|
|
@@ -94127,12 +94657,7 @@ async function getEventsByCorrelationIdV4(correlationId, params = {}, config4) {
|
|
|
94127
94657
|
const { baseUrl, headers } = await getHttpConfig(config4);
|
|
94128
94658
|
const sp = new URLSearchParams();
|
|
94129
94659
|
sp.set("correlationId", correlationId);
|
|
94130
|
-
|
|
94131
|
-
sp.set("cursor", params.cursor);
|
|
94132
|
-
if (params.limit !== void 0)
|
|
94133
|
-
sp.set("limit", String(params.limit));
|
|
94134
|
-
if (params.sortOrder)
|
|
94135
|
-
sp.set("sortOrder", params.sortOrder);
|
|
94660
|
+
appendListParams(sp, params);
|
|
94136
94661
|
const url3 = `${baseUrl}/v4/events?${sp.toString()}`;
|
|
94137
94662
|
return consumeListFrameStream(url3, headers, config4, "listEventsByCorrelationId");
|
|
94138
94663
|
}
|
|
@@ -94518,7 +95043,8 @@ async function getWorkflowRunEvents(params, config4) {
|
|
|
94518
95043
|
const wirePagination = {
|
|
94519
95044
|
cursor: pagination?.cursor ?? void 0,
|
|
94520
95045
|
limit: pagination?.limit,
|
|
94521
|
-
sortOrder: pagination?.sortOrder
|
|
95046
|
+
sortOrder: pagination?.sortOrder,
|
|
95047
|
+
remoteRefBehavior: resolveData === "none" ? "lazy" : "resolve"
|
|
94522
95048
|
};
|
|
94523
95049
|
const result = await ("correlationId" in params ? getEventsByCorrelationIdV4(params.correlationId, wirePagination, config4) : getWorkflowRunEventsV4(params.runId, wirePagination, config4));
|
|
94524
95050
|
const events = result.events.map((listed) => buildEventFromV4(listed.event, listed.body, resolveData));
|
|
@@ -94872,11 +95398,14 @@ __name(createStreamer2, "createStreamer");
|
|
|
94872
95398
|
function createVercelWorld(config4) {
|
|
94873
95399
|
const projectId = config4?.projectConfig?.projectId || process.env.VERCEL_PROJECT_ID;
|
|
94874
95400
|
return {
|
|
94875
|
-
// Spec
|
|
94876
|
-
//
|
|
94877
|
-
//
|
|
94878
|
-
//
|
|
94879
|
-
|
|
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,
|
|
94880
95409
|
// On Vercel the platform fails the function invocation when the
|
|
94881
95410
|
// process exits non-zero, and VQS redelivers the queue message via a
|
|
94882
95411
|
// fresh invocation. The core runtime uses this to decide whether
|
|
@@ -95243,6 +95772,7 @@ var DEFAULT_STEP_MAX_RETRIES = 3;
|
|
|
95243
95772
|
async function executeStep(params) {
|
|
95244
95773
|
const { world, workflowRunId, workflowName, workflowStartedAt, stepId, stepName } = params;
|
|
95245
95774
|
const isVercel = process.env.VERCEL_URL !== void 0;
|
|
95775
|
+
const compression = (params.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2;
|
|
95246
95776
|
const spanName = `step.execute ${stepDisplayName(stepName)}`;
|
|
95247
95777
|
return trace3(spanName, {}, async (span) => {
|
|
95248
95778
|
span?.setAttributes({
|
|
@@ -95267,7 +95797,7 @@ async function executeStep(params) {
|
|
|
95267
95797
|
correlationId: stepId,
|
|
95268
95798
|
eventData: {
|
|
95269
95799
|
stepName,
|
|
95270
|
-
error: await dehydrateStepError(new FatalError2(errorMessage), workflowRunId, await getEncryptionKey())
|
|
95800
|
+
error: await dehydrateStepError(new FatalError2(errorMessage), workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95271
95801
|
}
|
|
95272
95802
|
});
|
|
95273
95803
|
} catch (stepFailErr) {
|
|
@@ -95366,7 +95896,7 @@ async function executeStep(params) {
|
|
|
95366
95896
|
correlationId: stepId,
|
|
95367
95897
|
eventData: {
|
|
95368
95898
|
stepName,
|
|
95369
|
-
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey())
|
|
95899
|
+
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95370
95900
|
}
|
|
95371
95901
|
});
|
|
95372
95902
|
} catch (err) {
|
|
@@ -95436,7 +95966,7 @@ async function executeStep(params) {
|
|
|
95436
95966
|
});
|
|
95437
95967
|
result = await trace3("step.dehydrate", {}, async (dehydrateSpan) => {
|
|
95438
95968
|
const startTime = Date.now();
|
|
95439
|
-
const dehydrated = await dehydrateStepReturnValue2(result, workflowRunId, encryptionKey, ops);
|
|
95969
|
+
const dehydrated = await dehydrateStepReturnValue2(result, workflowRunId, encryptionKey, ops, globalThis, false, false, compression);
|
|
95440
95970
|
const durationMs = Date.now() - startTime;
|
|
95441
95971
|
dehydrateSpan?.setAttributes({
|
|
95442
95972
|
...QueueSerializeTimeMs2(durationMs),
|
|
@@ -95536,7 +96066,7 @@ async function executeStep(params) {
|
|
|
95536
96066
|
correlationId: stepId,
|
|
95537
96067
|
eventData: {
|
|
95538
96068
|
stepName,
|
|
95539
|
-
error: await dehydrateStepError(effectiveErr, workflowRunId, await getEncryptionKey())
|
|
96069
|
+
error: await dehydrateStepError(effectiveErr, workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95540
96070
|
}
|
|
95541
96071
|
});
|
|
95542
96072
|
} catch (stepFailErr) {
|
|
@@ -95583,7 +96113,7 @@ async function executeStep(params) {
|
|
|
95583
96113
|
correlationId: stepId,
|
|
95584
96114
|
eventData: {
|
|
95585
96115
|
stepName,
|
|
95586
|
-
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey())
|
|
96116
|
+
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey(), [], globalThis, compression)
|
|
95587
96117
|
}
|
|
95588
96118
|
});
|
|
95589
96119
|
} catch (stepFailErr) {
|
|
@@ -95629,7 +96159,7 @@ async function executeStep(params) {
|
|
|
95629
96159
|
correlationId: stepId,
|
|
95630
96160
|
eventData: {
|
|
95631
96161
|
stepName,
|
|
95632
|
-
error: await dehydrateStepError(err, workflowRunId, await getEncryptionKey()),
|
|
96162
|
+
error: await dehydrateStepError(err, workflowRunId, await getEncryptionKey(), [], globalThis, compression),
|
|
95633
96163
|
...RetryableError2.is(err) && { retryAfter: err.retryAfter }
|
|
95634
96164
|
}
|
|
95635
96165
|
});
|
|
@@ -95714,8 +96244,9 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId
|
|
|
95714
96244
|
const hooksNeedingDisposal = allHookItems.filter((item) => item.disposed);
|
|
95715
96245
|
const rawKey = await world.getEncryptionKeyForRun?.(run3);
|
|
95716
96246
|
const encryptionKey = rawKey ? await importKey2(rawKey) : void 0;
|
|
96247
|
+
const compression = (run3.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2;
|
|
95717
96248
|
const hookEvents = await Promise.all(hooksNeedingCreation.map(async (queueItem) => {
|
|
95718
|
-
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);
|
|
95719
96250
|
return {
|
|
95720
96251
|
queueItem,
|
|
95721
96252
|
hookEvent: {
|
|
@@ -95785,7 +96316,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId
|
|
|
95785
96316
|
if (hooksNeedingAbort.length > 0) {
|
|
95786
96317
|
await Promise.all(hooksNeedingAbort.map(async (queueItem) => {
|
|
95787
96318
|
try {
|
|
95788
|
-
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);
|
|
95789
96320
|
await world.events.create(runId, {
|
|
95790
96321
|
eventType: "hook_received",
|
|
95791
96322
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
@@ -95828,7 +96359,7 @@ async function handleSuspension({ suspension, world, run: run3, span, requestId
|
|
|
95828
96359
|
args: queueItem.args,
|
|
95829
96360
|
closureVars: queueItem.closureVars,
|
|
95830
96361
|
thisVal: queueItem.thisVal
|
|
95831
|
-
}, runId, encryptionKey, suspension.globalThis);
|
|
96362
|
+
}, runId, encryptionKey, suspension.globalThis, false, compression);
|
|
95832
96363
|
const stepEvent = {
|
|
95833
96364
|
eventType: "step_created",
|
|
95834
96365
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
@@ -96557,6 +97088,7 @@ init_util4();
|
|
|
96557
97088
|
init_dist6();
|
|
96558
97089
|
init_dist5();
|
|
96559
97090
|
init_parse_name2();
|
|
97091
|
+
init_dist7();
|
|
96560
97092
|
import { runInContext as runInContext2 } from "node:vm";
|
|
96561
97093
|
|
|
96562
97094
|
// ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
|
|
@@ -98141,7 +98673,17 @@ Learn more: https://workflow-sdk.dev/err/${ERROR_SLUGS2.FETCH_IN_WORKFLOW_FUNCTI
|
|
|
98141
98673
|
workflowFn(...args),
|
|
98142
98674
|
workflowDiscontinuation.promise
|
|
98143
98675
|
]);
|
|
98144
|
-
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
|
+
);
|
|
98145
98687
|
span?.setAttributes({
|
|
98146
98688
|
...WorkflowResultType2(typeof result)
|
|
98147
98689
|
});
|
|
@@ -98531,7 +99073,7 @@ async function recordFatalRunError({ world, workflowRun, runId, requestId, err,
|
|
|
98531
99073
|
eventType: "run_failed",
|
|
98532
99074
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
98533
99075
|
eventData: {
|
|
98534
|
-
error: await dehydrateRunError(err, runId, await getEncryptionKey()),
|
|
99076
|
+
error: await dehydrateRunError(err, runId, await getEncryptionKey(), globalThis, (workflowRun?.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2),
|
|
98535
99077
|
errorCode
|
|
98536
99078
|
}
|
|
98537
99079
|
}, { requestId });
|
|
@@ -98659,7 +99201,8 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98659
99201
|
workflowName,
|
|
98660
99202
|
workflowStartedAt: bgStartedAt,
|
|
98661
99203
|
stepId: incomingStepId,
|
|
98662
|
-
stepName: incomingStepName
|
|
99204
|
+
stepName: incomingStepName,
|
|
99205
|
+
runSpecVersion: bgRun.specVersion
|
|
98663
99206
|
});
|
|
98664
99207
|
} finally {
|
|
98665
99208
|
replayBudget.resume();
|
|
@@ -98985,7 +99528,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
98985
99528
|
eventType: "run_failed",
|
|
98986
99529
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
98987
99530
|
eventData: {
|
|
98988
|
-
error: await dehydrateRunError(suspensionError, runId, encryptionKey),
|
|
99531
|
+
error: await dehydrateRunError(suspensionError, runId, encryptionKey, globalThis, (workflowRun?.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2),
|
|
98989
99532
|
errorCode
|
|
98990
99533
|
}
|
|
98991
99534
|
}, { requestId });
|
|
@@ -99066,7 +99609,8 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
99066
99609
|
workflowName,
|
|
99067
99610
|
workflowStartedAt,
|
|
99068
99611
|
stepId: inlineStep.correlationId,
|
|
99069
|
-
stepName: inlineStep.stepName
|
|
99612
|
+
stepName: inlineStep.stepName,
|
|
99613
|
+
runSpecVersion: workflowRun.specVersion
|
|
99070
99614
|
});
|
|
99071
99615
|
} finally {
|
|
99072
99616
|
replayBudget.resume();
|
|
@@ -99156,7 +99700,7 @@ function workflowEntrypoint(workflowCode2, options) {
|
|
|
99156
99700
|
eventType: "run_failed",
|
|
99157
99701
|
specVersion: SPEC_VERSION_CURRENT2,
|
|
99158
99702
|
eventData: {
|
|
99159
|
-
error: await dehydrateRunError(terminalError, runId, encryptionKey),
|
|
99703
|
+
error: await dehydrateRunError(terminalError, runId, encryptionKey, globalThis, (workflowRun?.specVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2),
|
|
99160
99704
|
errorCode
|
|
99161
99705
|
}
|
|
99162
99706
|
}, { requestId });
|
|
@@ -115470,10 +116014,10 @@ var Run = class _Run {
|
|
|
115470
116014
|
return this.getReadable();
|
|
115471
116015
|
}
|
|
115472
116016
|
};
|
|
115473
|
-
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
115474
|
-
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
115475
|
-
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
115476
|
-
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");
|
|
115477
116021
|
Object.defineProperty(Run.prototype, "exists", {
|
|
115478
116022
|
get() {
|
|
115479
116023
|
return __step_Run$exists.call(this);
|
|
@@ -115481,7 +116025,7 @@ Object.defineProperty(Run.prototype, "exists", {
|
|
|
115481
116025
|
configurable: true,
|
|
115482
116026
|
enumerable: false
|
|
115483
116027
|
});
|
|
115484
|
-
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");
|
|
115485
116029
|
Object.defineProperty(Run.prototype, "status", {
|
|
115486
116030
|
get() {
|
|
115487
116031
|
return __step_Run$status.call(this);
|
|
@@ -115489,7 +116033,7 @@ Object.defineProperty(Run.prototype, "status", {
|
|
|
115489
116033
|
configurable: true,
|
|
115490
116034
|
enumerable: false
|
|
115491
116035
|
});
|
|
115492
|
-
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");
|
|
115493
116037
|
Object.defineProperty(Run.prototype, "returnValue", {
|
|
115494
116038
|
get() {
|
|
115495
116039
|
return __step_Run$returnValue.call(this);
|
|
@@ -115497,7 +116041,7 @@ Object.defineProperty(Run.prototype, "returnValue", {
|
|
|
115497
116041
|
configurable: true,
|
|
115498
116042
|
enumerable: false
|
|
115499
116043
|
});
|
|
115500
|
-
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");
|
|
115501
116045
|
Object.defineProperty(Run.prototype, "workflowName", {
|
|
115502
116046
|
get() {
|
|
115503
116047
|
return __step_Run$workflowName.call(this);
|
|
@@ -115505,7 +116049,7 @@ Object.defineProperty(Run.prototype, "workflowName", {
|
|
|
115505
116049
|
configurable: true,
|
|
115506
116050
|
enumerable: false
|
|
115507
116051
|
});
|
|
115508
|
-
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");
|
|
115509
116053
|
Object.defineProperty(Run.prototype, "createdAt", {
|
|
115510
116054
|
get() {
|
|
115511
116055
|
return __step_Run$createdAt.call(this);
|
|
@@ -115513,7 +116057,7 @@ Object.defineProperty(Run.prototype, "createdAt", {
|
|
|
115513
116057
|
configurable: true,
|
|
115514
116058
|
enumerable: false
|
|
115515
116059
|
});
|
|
115516
|
-
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");
|
|
115517
116061
|
Object.defineProperty(Run.prototype, "startedAt", {
|
|
115518
116062
|
get() {
|
|
115519
116063
|
return __step_Run$startedAt.call(this);
|
|
@@ -115521,7 +116065,7 @@ Object.defineProperty(Run.prototype, "startedAt", {
|
|
|
115521
116065
|
configurable: true,
|
|
115522
116066
|
enumerable: false
|
|
115523
116067
|
});
|
|
115524
|
-
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");
|
|
115525
116069
|
Object.defineProperty(Run.prototype, "completedAt", {
|
|
115526
116070
|
get() {
|
|
115527
116071
|
return __step_Run$completedAt.call(this);
|
|
@@ -115538,7 +116082,7 @@ Object.defineProperty(Run.prototype, "completedAt", {
|
|
|
115538
116082
|
enumerable: false,
|
|
115539
116083
|
configurable: false
|
|
115540
116084
|
});
|
|
115541
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
116085
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.18//Run");
|
|
115542
116086
|
|
|
115543
116087
|
// ../core/dist/workflow/create-hook.js
|
|
115544
116088
|
aliasSerializationClass(RUN_CLASS_ID, Run);
|