@workflow/world-testing 5.0.1 → 5.0.2
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.
|
@@ -335,6 +335,13 @@ var require_ms2 = __commonJS({
|
|
|
335
335
|
|
|
336
336
|
// ../utils/dist/time.js
|
|
337
337
|
function parseDurationToDate2(param) {
|
|
338
|
+
const date9 = durationToDate2(param);
|
|
339
|
+
if (Number.isNaN(date9.getTime())) {
|
|
340
|
+
throw new Error(typeof param === "object" ? "Invalid date: the Date object does not hold a valid time." : `Invalid duration: ${JSON.stringify(param)} ends past the latest time a Date can represent.`);
|
|
341
|
+
}
|
|
342
|
+
return date9;
|
|
343
|
+
}
|
|
344
|
+
function durationToDate2(param) {
|
|
338
345
|
if (typeof param === "string") {
|
|
339
346
|
const durationMs = (0, import_ms2.default)(param);
|
|
340
347
|
if (typeof durationMs !== "number" || durationMs < 0) {
|
|
@@ -358,6 +365,7 @@ var init_time2 = __esm({
|
|
|
358
365
|
"use strict";
|
|
359
366
|
import_ms2 = __toESM(require_ms2(), 1);
|
|
360
367
|
__name(parseDurationToDate2, "parseDurationToDate");
|
|
368
|
+
__name(durationToDate2, "durationToDate");
|
|
361
369
|
}
|
|
362
370
|
});
|
|
363
371
|
|
|
@@ -22124,6 +22132,11 @@ var init_hooks2 = __esm({
|
|
|
22124
22132
|
// Named `runSpecVersion` to distinguish it from the hook's own `specVersion`.
|
|
22125
22133
|
runSpecVersion: external_exports2.number().optional(),
|
|
22126
22134
|
workflowCoreVersion: external_exports2.string().optional(),
|
|
22135
|
+
// Node.js version of the run's creating deployment, mirrored from
|
|
22136
|
+
// `executionContext.nodeVersion`. Decides whether a resume may write zstd
|
|
22137
|
+
// (which needs Node.js >= 22.15) or must use gzip. Absent on runs created
|
|
22138
|
+
// before the field existed and on non-Node runtimes, where writers use gzip.
|
|
22139
|
+
nodeVersion: external_exports2.string().optional(),
|
|
22127
22140
|
traceCarrier: TraceCarrierSchema2.optional(),
|
|
22128
22141
|
// The run's published X25519 public key (base64), mirrored from the run
|
|
22129
22142
|
// entity. Lets a resume seal (`encp`) its payload to the run without reading
|
|
@@ -58743,6 +58756,12 @@ function createEventsStorage(basedir, tag) {
|
|
|
58743
58756
|
return { event: occupant };
|
|
58744
58757
|
}
|
|
58745
58758
|
}
|
|
58759
|
+
if (data3.eventType === "hook_created" && data3.correlationId) {
|
|
58760
|
+
const occupant = await readJSONWithFallback(basedir, "events", `${effectiveRunId}-${eventId}`, ReadEventSchema, tag);
|
|
58761
|
+
if (occupant?.eventType === "hook_created" && occupant.correlationId === data3.correlationId) {
|
|
58762
|
+
break;
|
|
58763
|
+
}
|
|
58764
|
+
}
|
|
58746
58765
|
if (!await bumpEventSlot(attempt)) {
|
|
58747
58766
|
break;
|
|
58748
58767
|
}
|
|
@@ -62952,7 +62971,7 @@ var version5;
|
|
|
62952
62971
|
var init_version3 = __esm({
|
|
62953
62972
|
"../world-vercel/dist/version.js"() {
|
|
62954
62973
|
"use strict";
|
|
62955
|
-
version5 = "5.0
|
|
62974
|
+
version5 = "5.1.0";
|
|
62956
62975
|
}
|
|
62957
62976
|
});
|
|
62958
62977
|
|
|
@@ -72453,7 +72472,7 @@ var require_picocolors = __commonJS({
|
|
|
72453
72472
|
}
|
|
72454
72473
|
});
|
|
72455
72474
|
|
|
72456
|
-
// ../../node_modules/.pnpm/@vercel+queue@0.
|
|
72475
|
+
// ../../node_modules/.pnpm/@vercel+queue@0.8.0_@opentelemetry+api@1.9.1/node_modules/@vercel/queue/dist/index.mjs
|
|
72457
72476
|
import assert4 from "assert/strict";
|
|
72458
72477
|
import * as fs9 from "fs";
|
|
72459
72478
|
import * as net from "net";
|
|
@@ -72851,6 +72870,7 @@ function registerHandlerForFile(filePath, handler, client, options) {
|
|
|
72851
72870
|
return true;
|
|
72852
72871
|
}
|
|
72853
72872
|
function registerDevHandler(handler, client, options, _testCallerPath) {
|
|
72873
|
+
if (getApiClient(client).usesLocalBroker?.()) return;
|
|
72854
72874
|
const callerPath = _testCallerPath ?? extractCallerFilePath();
|
|
72855
72875
|
if (!callerPath) {
|
|
72856
72876
|
console.warn(
|
|
@@ -73591,30 +73611,68 @@ function parseRetryAfterSeconds(value) {
|
|
|
73591
73611
|
}
|
|
73592
73612
|
return void 0;
|
|
73593
73613
|
}
|
|
73594
|
-
function
|
|
73614
|
+
async function readHttpErrorResponse(response) {
|
|
73615
|
+
const text = await response.text();
|
|
73616
|
+
if (!response.headers.get("Content-Type")?.toLowerCase().includes("json")) {
|
|
73617
|
+
return {
|
|
73618
|
+
response,
|
|
73619
|
+
message: text
|
|
73620
|
+
};
|
|
73621
|
+
}
|
|
73622
|
+
try {
|
|
73623
|
+
const body = JSON.parse(text);
|
|
73624
|
+
if (typeof body !== "object" || body === null) {
|
|
73625
|
+
return { response, message: text };
|
|
73626
|
+
}
|
|
73627
|
+
const error121 = "error" in body ? body.error : void 0;
|
|
73628
|
+
let message = text;
|
|
73629
|
+
if (typeof error121 === "string") {
|
|
73630
|
+
message = error121;
|
|
73631
|
+
} else if (typeof error121 === "object" && error121 !== null && "message" in error121 && typeof error121.message === "string") {
|
|
73632
|
+
message = error121.message;
|
|
73633
|
+
}
|
|
73634
|
+
return {
|
|
73635
|
+
response,
|
|
73636
|
+
message,
|
|
73637
|
+
originalMessageId: "originalMessageId" in body && typeof body.originalMessageId === "string" ? body.originalMessageId : void 0
|
|
73638
|
+
};
|
|
73639
|
+
} catch {
|
|
73640
|
+
return { response, message: text };
|
|
73641
|
+
}
|
|
73642
|
+
}
|
|
73643
|
+
function throwCommonHttpError(error121, operation, badRequestDefault = "Invalid parameters") {
|
|
73644
|
+
const { status, statusText } = error121.response;
|
|
73645
|
+
const message = error121.message;
|
|
73646
|
+
const statusDescription = statusText ? `${status} ${statusText}` : `${status}`;
|
|
73647
|
+
if (status === 503 && error121.response.headers.get("Vqs-Error-Code") === "consumer_registry_not_configured") {
|
|
73648
|
+
throw new ConsumerRegistryNotConfiguredError(
|
|
73649
|
+
message || "Consumer registry not configured"
|
|
73650
|
+
);
|
|
73651
|
+
}
|
|
73652
|
+
if (status === 413) {
|
|
73653
|
+
throw new PayloadTooLargeError(message || "Request payload is too large");
|
|
73654
|
+
}
|
|
73595
73655
|
if (status === 400) {
|
|
73596
|
-
throw new BadRequestError(
|
|
73656
|
+
throw new BadRequestError(message || badRequestDefault);
|
|
73597
73657
|
}
|
|
73598
73658
|
if (status === 429) {
|
|
73599
73659
|
throw new TooManyRequestsError(
|
|
73600
|
-
|
|
73601
|
-
parseRetryAfterSeconds(
|
|
73660
|
+
message || `Too many requests: ${operation}`,
|
|
73661
|
+
parseRetryAfterSeconds(error121.response.headers.get("Retry-After"))
|
|
73602
73662
|
);
|
|
73603
73663
|
}
|
|
73604
73664
|
if (status === 401) {
|
|
73605
|
-
throw new UnauthorizedError(
|
|
73665
|
+
throw new UnauthorizedError(message || void 0);
|
|
73606
73666
|
}
|
|
73607
73667
|
if (status === 403) {
|
|
73608
|
-
throw new ForbiddenError(
|
|
73668
|
+
throw new ForbiddenError(message || void 0);
|
|
73609
73669
|
}
|
|
73610
73670
|
if (status >= 500) {
|
|
73611
73671
|
throw new InternalServerError(
|
|
73612
|
-
|
|
73672
|
+
message || `Server error: ${statusDescription}`
|
|
73613
73673
|
);
|
|
73614
73674
|
}
|
|
73615
|
-
throw new Error(
|
|
73616
|
-
errorText || `Failed to ${operation}: ${status} ${statusText}`
|
|
73617
|
-
);
|
|
73675
|
+
throw new Error(message || `Failed to ${operation}: ${statusDescription}`);
|
|
73618
73676
|
}
|
|
73619
73677
|
function parseQueueHeaders(headers) {
|
|
73620
73678
|
const messageId = headers.get("Vqs-Message-Id");
|
|
@@ -73646,8 +73704,25 @@ function validateRegion(region) {
|
|
|
73646
73704
|
);
|
|
73647
73705
|
}
|
|
73648
73706
|
}
|
|
73649
|
-
function
|
|
73650
|
-
|
|
73707
|
+
function stripTrailingSlashes(path22) {
|
|
73708
|
+
let end = path22.length;
|
|
73709
|
+
while (end > 0 && path22[end - 1] === "/") {
|
|
73710
|
+
end--;
|
|
73711
|
+
}
|
|
73712
|
+
return path22.slice(0, end);
|
|
73713
|
+
}
|
|
73714
|
+
function supportsLocalQueueBroker(version8) {
|
|
73715
|
+
if (!version8 || version8.length > 256) return false;
|
|
73716
|
+
const match2 = version8.match(
|
|
73717
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*))?(?:\+[\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*)?$/
|
|
73718
|
+
);
|
|
73719
|
+
if (!match2 || match2[0] !== version8) return false;
|
|
73720
|
+
const [major2, minor, patch] = match2.slice(1, 4).map(Number);
|
|
73721
|
+
const prerelease = match2[4];
|
|
73722
|
+
if (![major2, minor, patch].every(Number.isSafeInteger) || prerelease?.split(".").some((part) => /^0\d+$/.test(part))) {
|
|
73723
|
+
return false;
|
|
73724
|
+
}
|
|
73725
|
+
return major2 > 59 || major2 === 59 && (minor > 26 || minor === 26 && (patch > 0 || !prerelease));
|
|
73651
73726
|
}
|
|
73652
73727
|
function setApi(client, api) {
|
|
73653
73728
|
apiClients.set(client, api);
|
|
@@ -73679,6 +73754,25 @@ function resolveCallbackRequest(input3) {
|
|
|
73679
73754
|
}
|
|
73680
73755
|
return input3;
|
|
73681
73756
|
}
|
|
73757
|
+
function skippedDeliveryReason(error121) {
|
|
73758
|
+
if (error121 instanceof MessageAlreadyProcessedError || error121 instanceof Error && error121.name === "MessageAlreadyProcessedError") {
|
|
73759
|
+
return "already_processed";
|
|
73760
|
+
}
|
|
73761
|
+
if (error121 instanceof MessageNotAvailableError || error121 instanceof Error && error121.name === "MessageNotAvailableError") {
|
|
73762
|
+
return "not_available";
|
|
73763
|
+
}
|
|
73764
|
+
return null;
|
|
73765
|
+
}
|
|
73766
|
+
function reportSkippedDelivery(reason, messageId) {
|
|
73767
|
+
console.debug(
|
|
73768
|
+
`Queue callback skipped (${reason}) for message ${messageId ?? "<unknown>"}: the message was already handled or is no longer available to this consumer.`
|
|
73769
|
+
);
|
|
73770
|
+
return {
|
|
73771
|
+
status: "skipped",
|
|
73772
|
+
reason,
|
|
73773
|
+
...messageId !== void 0 ? { messageId } : {}
|
|
73774
|
+
};
|
|
73775
|
+
}
|
|
73682
73776
|
function getApiClient(client) {
|
|
73683
73777
|
return getApi(client);
|
|
73684
73778
|
}
|
|
@@ -73693,9 +73787,9 @@ function resolveRegion2(region) {
|
|
|
73693
73787
|
}
|
|
73694
73788
|
return DEFAULT_REGION;
|
|
73695
73789
|
}
|
|
73696
|
-
var import_picocolors, import_oidc3, JsonTransport, MessageNotFoundError, MessageNotAvailableError, MessageCorruptedError, TooManyRequestsError, UnauthorizedError, ForbiddenError, BadRequestError, InternalServerError, InvalidLimitError, MessageAlreadyProcessedError, ConsumerDiscoveryError, ConsumerRegistryNotConfiguredError, DEFAULT_VISIBILITY_TIMEOUT_SECONDS, MIN_VISIBILITY_TIMEOUT_SECONDS, MAX_RENEWAL_INTERVAL_SECONDS, MIN_RENEWAL_INTERVAL_SECONDS, RETRY_INTERVAL_MS, DIRECTIVE_CALL_ATTEMPTS, DIRECTIVE_CALL_RETRY_DELAY_MS, ConsumerGroup, Topic, CLOUD_EVENT_TYPE_V1BETA, CLOUD_EVENT_TYPE_V2BETA, PREFIX, OK, FAIL, RETRY, ROUTE_MAPPINGS_KEY, _sdkPackageDir, HANDLER_REGISTRY_KEY, DEV_RETRY_INITIAL_DELAY_MS, DEV_RETRY_MAX_WAIT_MS, DEV_RETRY_BACKOFF, PORT_CHECK_TIMEOUT_MS, PRIME_PORT_ENV_KEYS, PRIME_URL_ENV_KEYS, DEV_REDELIVERY_MAX_DELAY_S, DEV_REDELIVERY_DEFAULT_DELAY_S, DEV_REDELIVERY_MAX_ATTEMPTS, DEFAULT_RETENTION_S, encoder2, otelApiPromise, INJECTED_CONTEXT_HEADERS, CONSUMER_TRACEPARENT_HEADER, CONSUMER_TRACESTATE_HEADER, CONSUMER_BAGGAGE_HEADER, REGION_PATTERN, DEFAULT_BASE_URL_RESOLVER, BASE_PATH, ApiClient, apiClients, API_CLIENT_KEY, DEFAULT_REGION, QueueClient;
|
|
73790
|
+
var import_picocolors, import_oidc3, JsonTransport, MessageNotFoundError, MessageNotAvailableError, MessageCorruptedError, MessageLockedError, TooManyRequestsError, UnauthorizedError, ForbiddenError, BadRequestError, PayloadTooLargeError, InternalServerError, InvalidLimitError, MessageAlreadyProcessedError, ConsumerDiscoveryError, ConsumerRegistryNotConfiguredError, DEFAULT_VISIBILITY_TIMEOUT_SECONDS, MIN_VISIBILITY_TIMEOUT_SECONDS, MAX_RENEWAL_INTERVAL_SECONDS, MIN_RENEWAL_INTERVAL_SECONDS, RETRY_INTERVAL_MS, DIRECTIVE_CALL_ATTEMPTS, DIRECTIVE_CALL_RETRY_DELAY_MS, ConsumerGroup, Topic, CLOUD_EVENT_TYPE_V1BETA, CLOUD_EVENT_TYPE_V2BETA, PREFIX, OK, FAIL, RETRY, ROUTE_MAPPINGS_KEY, _sdkPackageDir, HANDLER_REGISTRY_KEY, DEV_RETRY_INITIAL_DELAY_MS, DEV_RETRY_MAX_WAIT_MS, DEV_RETRY_BACKOFF, PORT_CHECK_TIMEOUT_MS, PRIME_PORT_ENV_KEYS, PRIME_URL_ENV_KEYS, DEV_REDELIVERY_MAX_DELAY_S, DEV_REDELIVERY_DEFAULT_DELAY_S, DEV_REDELIVERY_MAX_ATTEMPTS, DEFAULT_RETENTION_S, encoder2, otelApiPromise, INJECTED_CONTEXT_HEADERS, CONSUMER_TRACEPARENT_HEADER, CONSUMER_TRACESTATE_HEADER, CONSUMER_BAGGAGE_HEADER, REGION_PATTERN, DEFAULT_BASE_URL_RESOLVER, BASE_PATH, ApiClient, apiClients, API_CLIENT_KEY, DEFAULT_REGION, QueueClient;
|
|
73697
73791
|
var init_dist10 = __esm({
|
|
73698
|
-
"../../node_modules/.pnpm/@vercel+queue@0.
|
|
73792
|
+
"../../node_modules/.pnpm/@vercel+queue@0.8.0_@opentelemetry+api@1.9.1/node_modules/@vercel/queue/dist/index.mjs"() {
|
|
73699
73793
|
init_dist9();
|
|
73700
73794
|
init_esm4();
|
|
73701
73795
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -73755,6 +73849,21 @@ var init_dist10 = __esm({
|
|
|
73755
73849
|
this.name = "MessageCorruptedError";
|
|
73756
73850
|
}
|
|
73757
73851
|
};
|
|
73852
|
+
MessageLockedError = class extends MessageNotAvailableError {
|
|
73853
|
+
static {
|
|
73854
|
+
__name(this, "MessageLockedError");
|
|
73855
|
+
}
|
|
73856
|
+
/** Suggested retry delay in seconds, if provided by the server. */
|
|
73857
|
+
retryAfter;
|
|
73858
|
+
constructor(messageId, retryAfter) {
|
|
73859
|
+
super(
|
|
73860
|
+
messageId,
|
|
73861
|
+
retryAfter !== void 0 ? `temporarily locked. Retry after ${retryAfter} seconds.` : "temporarily locked. Try again later."
|
|
73862
|
+
);
|
|
73863
|
+
this.name = "MessageLockedError";
|
|
73864
|
+
this.retryAfter = retryAfter;
|
|
73865
|
+
}
|
|
73866
|
+
};
|
|
73758
73867
|
TooManyRequestsError = class extends Error {
|
|
73759
73868
|
static {
|
|
73760
73869
|
__name(this, "TooManyRequestsError");
|
|
@@ -73794,6 +73903,15 @@ var init_dist10 = __esm({
|
|
|
73794
73903
|
this.name = "BadRequestError";
|
|
73795
73904
|
}
|
|
73796
73905
|
};
|
|
73906
|
+
PayloadTooLargeError = class extends Error {
|
|
73907
|
+
static {
|
|
73908
|
+
__name(this, "PayloadTooLargeError");
|
|
73909
|
+
}
|
|
73910
|
+
constructor(message) {
|
|
73911
|
+
super(message);
|
|
73912
|
+
this.name = "PayloadTooLargeError";
|
|
73913
|
+
}
|
|
73914
|
+
};
|
|
73797
73915
|
InternalServerError = class extends Error {
|
|
73798
73916
|
static {
|
|
73799
73917
|
__name(this, "InternalServerError");
|
|
@@ -73952,12 +74070,13 @@ var init_dist10 = __esm({
|
|
|
73952
74070
|
* - On transient failures (5xx, network errors): retry every 3 seconds
|
|
73953
74071
|
* - On 4xx client errors: stop retrying (the lease is lost or invalid)
|
|
73954
74072
|
*
|
|
73955
|
-
* @param
|
|
74073
|
+
* @param message - The message ID and receipt handle for the active lease
|
|
73956
74074
|
* @param options - Optional configuration
|
|
73957
74075
|
* @param options.visibilityDeadline - Absolute deadline (from server's `ce-vqsvisibilitydeadline`)
|
|
73958
74076
|
* when the current visibility timeout expires. Used to calculate the first extension delay.
|
|
73959
74077
|
*/
|
|
73960
|
-
startVisibilityExtension(
|
|
74078
|
+
startVisibilityExtension(message, options) {
|
|
74079
|
+
const { messageId, receiptHandle } = message;
|
|
73961
74080
|
let isRunning = true;
|
|
73962
74081
|
let isResolved = false;
|
|
73963
74082
|
let resolveLifecycle;
|
|
@@ -73989,6 +74108,7 @@ var init_dist10 = __esm({
|
|
|
73989
74108
|
}
|
|
73990
74109
|
try {
|
|
73991
74110
|
await this.client.changeVisibility({
|
|
74111
|
+
messageId,
|
|
73992
74112
|
queueName: this.topicName,
|
|
73993
74113
|
consumerGroup: this.consumerGroupName,
|
|
73994
74114
|
receiptHandle,
|
|
@@ -74047,10 +74167,7 @@ var init_dist10 = __esm({
|
|
|
74047
74167
|
}
|
|
74048
74168
|
}
|
|
74049
74169
|
async processMessage(message, handler, options) {
|
|
74050
|
-
const stopExtension = this.startVisibilityExtension(
|
|
74051
|
-
message.receiptHandle,
|
|
74052
|
-
options
|
|
74053
|
-
);
|
|
74170
|
+
const stopExtension = this.startVisibilityExtension(message, options);
|
|
74054
74171
|
const DEFAULT_RETENTION_MS = 864e5;
|
|
74055
74172
|
const metadata = {
|
|
74056
74173
|
messageId: message.messageId,
|
|
@@ -74065,6 +74182,7 @@ var init_dist10 = __esm({
|
|
|
74065
74182
|
await handler(message.payload, metadata);
|
|
74066
74183
|
await stopExtension();
|
|
74067
74184
|
await this.client.acknowledgeMessage({
|
|
74185
|
+
messageId: message.messageId,
|
|
74068
74186
|
queueName: this.topicName,
|
|
74069
74187
|
consumerGroup: this.consumerGroupName,
|
|
74070
74188
|
receiptHandle: message.receiptHandle
|
|
@@ -74083,6 +74201,7 @@ var init_dist10 = __esm({
|
|
|
74083
74201
|
try {
|
|
74084
74202
|
await this.directiveCallWithRetries(
|
|
74085
74203
|
() => this.client.acknowledgeMessage({
|
|
74204
|
+
messageId: message.messageId,
|
|
74086
74205
|
queueName: this.topicName,
|
|
74087
74206
|
consumerGroup: this.consumerGroupName,
|
|
74088
74207
|
receiptHandle: message.receiptHandle
|
|
@@ -74098,6 +74217,7 @@ var init_dist10 = __esm({
|
|
|
74098
74217
|
try {
|
|
74099
74218
|
await this.directiveCallWithRetries(
|
|
74100
74219
|
() => this.client.changeVisibility({
|
|
74220
|
+
messageId: message.messageId,
|
|
74101
74221
|
queueName: this.topicName,
|
|
74102
74222
|
consumerGroup: this.consumerGroupName,
|
|
74103
74223
|
receiptHandle: message.receiptHandle,
|
|
@@ -74157,7 +74277,8 @@ var init_dist10 = __esm({
|
|
|
74157
74277
|
queueName: this.topicName,
|
|
74158
74278
|
consumerGroup: this.consumerGroupName,
|
|
74159
74279
|
visibilityTimeoutSeconds: this.visibilityTimeout,
|
|
74160
|
-
limit
|
|
74280
|
+
limit,
|
|
74281
|
+
cursorFallback: options && "cursorFallback" in options ? options.cursorFallback : void 0
|
|
74161
74282
|
})) {
|
|
74162
74283
|
messagesProcessed++;
|
|
74163
74284
|
await this.processMessage(message, handler, { retry });
|
|
@@ -74212,7 +74333,7 @@ var init_dist10 = __esm({
|
|
|
74212
74333
|
headers: options?.headers,
|
|
74213
74334
|
telemetry: options?.telemetry
|
|
74214
74335
|
});
|
|
74215
|
-
if (result2.messageId && isDevMode()) {
|
|
74336
|
+
if (result2.messageId && isDevMode() && !this.client.usesLocalBroker()) {
|
|
74216
74337
|
invokeDevHandlers(
|
|
74217
74338
|
this.topicName,
|
|
74218
74339
|
result2.messageId,
|
|
@@ -74344,12 +74465,14 @@ var init_dist10 = __esm({
|
|
|
74344
74465
|
__name(isDebugEnabled2, "isDebugEnabled");
|
|
74345
74466
|
__name(consumeStream, "consumeStream");
|
|
74346
74467
|
__name(parseRetryAfterSeconds, "parseRetryAfterSeconds");
|
|
74468
|
+
__name(readHttpErrorResponse, "readHttpErrorResponse");
|
|
74347
74469
|
__name(throwCommonHttpError, "throwCommonHttpError");
|
|
74348
74470
|
__name(parseQueueHeaders, "parseQueueHeaders");
|
|
74349
74471
|
REGION_PATTERN = /^[a-z]{2,5}[0-9]{1,2}$/;
|
|
74350
74472
|
__name(validateRegion, "validateRegion");
|
|
74351
74473
|
DEFAULT_BASE_URL_RESOLVER = /* @__PURE__ */ __name((region) => new URL(`https://${region}.vercel-queue.com`), "DEFAULT_BASE_URL_RESOLVER");
|
|
74352
|
-
__name(
|
|
74474
|
+
__name(stripTrailingSlashes, "stripTrailingSlashes");
|
|
74475
|
+
__name(supportsLocalQueueBroker, "supportsLocalQueueBroker");
|
|
74353
74476
|
BASE_PATH = "/api/v3/topic";
|
|
74354
74477
|
ApiClient = class _ApiClient {
|
|
74355
74478
|
static {
|
|
@@ -74364,13 +74487,36 @@ var init_dist10 = __esm({
|
|
|
74364
74487
|
transport;
|
|
74365
74488
|
region;
|
|
74366
74489
|
baseUrlResolver;
|
|
74490
|
+
// Keep injected credentials separate from explicit tokens: a regional resolver
|
|
74491
|
+
// can select a different endpoint, where the broker token must not be used.
|
|
74492
|
+
localResource;
|
|
74367
74493
|
dispatcher;
|
|
74368
74494
|
telemetry;
|
|
74369
|
-
constructor(options) {
|
|
74495
|
+
constructor(options, localResource) {
|
|
74370
74496
|
validateRegion(options.region);
|
|
74371
74497
|
this.region = options.region;
|
|
74372
|
-
this.
|
|
74373
|
-
|
|
74498
|
+
this.localResource = localResource ?? null;
|
|
74499
|
+
if (localResource === void 0 && isDevMode() && supportsLocalQueueBroker(process.env.VERCEL_CLI_VERSION)) {
|
|
74500
|
+
const injectedUrl = process.env.VERCEL_QUEUE_BASE_URL;
|
|
74501
|
+
if (injectedUrl) {
|
|
74502
|
+
try {
|
|
74503
|
+
this.localResource = {
|
|
74504
|
+
baseUrl: new URL(injectedUrl),
|
|
74505
|
+
token: process.env.VERCEL_QUEUE_TOKEN
|
|
74506
|
+
};
|
|
74507
|
+
} catch (cause) {
|
|
74508
|
+
if (!options.resolveBaseUrl) {
|
|
74509
|
+
throw new Error(
|
|
74510
|
+
"Invalid VERCEL_QUEUE_BASE_URL: expected an absolute URL",
|
|
74511
|
+
{ cause }
|
|
74512
|
+
);
|
|
74513
|
+
}
|
|
74514
|
+
}
|
|
74515
|
+
}
|
|
74516
|
+
}
|
|
74517
|
+
const localBaseUrl = this.localResource?.baseUrl;
|
|
74518
|
+
this.baseUrlResolver = options.resolveBaseUrl ?? (localBaseUrl ? () => new URL(localBaseUrl) : DEFAULT_BASE_URL_RESOLVER);
|
|
74519
|
+
this.baseUrl = this.baseUrlResolver(this.region);
|
|
74374
74520
|
this.customHeaders = options.headers || {};
|
|
74375
74521
|
this.providedToken = options.token;
|
|
74376
74522
|
this.transport = options.transport || new JsonTransport();
|
|
@@ -74392,16 +74538,23 @@ var init_dist10 = __esm({
|
|
|
74392
74538
|
* region indicated by the incoming `ce-vqsregion` header.
|
|
74393
74539
|
*/
|
|
74394
74540
|
withRegion(region) {
|
|
74395
|
-
return new _ApiClient(
|
|
74396
|
-
|
|
74397
|
-
|
|
74398
|
-
|
|
74399
|
-
|
|
74400
|
-
|
|
74401
|
-
|
|
74402
|
-
|
|
74403
|
-
|
|
74404
|
-
|
|
74541
|
+
return new _ApiClient(
|
|
74542
|
+
{
|
|
74543
|
+
region,
|
|
74544
|
+
resolveBaseUrl: this.baseUrlResolver,
|
|
74545
|
+
token: this.providedToken,
|
|
74546
|
+
headers: { ...this.customHeaders },
|
|
74547
|
+
deploymentId: this.explicitlyUnpinned ? null : this.resolvedDeploymentId,
|
|
74548
|
+
transport: this.transport,
|
|
74549
|
+
dispatcher: this.dispatcher,
|
|
74550
|
+
telemetry: this.telemetry
|
|
74551
|
+
},
|
|
74552
|
+
this.localResource
|
|
74553
|
+
);
|
|
74554
|
+
}
|
|
74555
|
+
usesLocalBroker() {
|
|
74556
|
+
const local = this.localResource?.baseUrl;
|
|
74557
|
+
return local !== void 0 && this.baseUrl.origin === local.origin && stripTrailingSlashes(this.baseUrl.pathname) === stripTrailingSlashes(local.pathname);
|
|
74405
74558
|
}
|
|
74406
74559
|
getRegion() {
|
|
74407
74560
|
return this.region;
|
|
@@ -74421,14 +74574,14 @@ var init_dist10 = __esm({
|
|
|
74421
74574
|
);
|
|
74422
74575
|
}
|
|
74423
74576
|
getSendDeploymentId() {
|
|
74424
|
-
if (isDevMode()) {
|
|
74577
|
+
if (this.usesLocalBroker() || isDevMode()) {
|
|
74425
74578
|
return void 0;
|
|
74426
74579
|
}
|
|
74427
74580
|
this.requireDeploymentId();
|
|
74428
74581
|
return this.pinSends ? this.resolvedDeploymentId : void 0;
|
|
74429
74582
|
}
|
|
74430
74583
|
getConsumeDeploymentId() {
|
|
74431
|
-
if (isDevMode()) {
|
|
74584
|
+
if (this.usesLocalBroker() || isDevMode()) {
|
|
74432
74585
|
return void 0;
|
|
74433
74586
|
}
|
|
74434
74587
|
this.requireDeploymentId();
|
|
@@ -74438,6 +74591,14 @@ var init_dist10 = __esm({
|
|
|
74438
74591
|
if (this.providedToken) {
|
|
74439
74592
|
return this.providedToken;
|
|
74440
74593
|
}
|
|
74594
|
+
if (this.usesLocalBroker()) {
|
|
74595
|
+
if (this.localResource?.token) {
|
|
74596
|
+
return this.localResource.token;
|
|
74597
|
+
}
|
|
74598
|
+
throw new Error(
|
|
74599
|
+
"Missing local queue token. VERCEL_QUEUE_BASE_URL selects a local broker, but VERCEL_QUEUE_TOKEN is not set. Start your app with a Vercel CLI version that supports local Queues, or provide an explicit token."
|
|
74600
|
+
);
|
|
74601
|
+
}
|
|
74441
74602
|
try {
|
|
74442
74603
|
return await (0, import_oidc3.getVercelOidcToken)();
|
|
74443
74604
|
} catch (err) {
|
|
@@ -74462,7 +74623,7 @@ Cause: ${cause}`
|
|
|
74462
74623
|
const encodedQueue = encodeURIComponent(queueName);
|
|
74463
74624
|
const segments = pathSegments.map((s) => encodeURIComponent(s));
|
|
74464
74625
|
const path22 = segments.length > 0 ? "/" + segments.join("/") : "";
|
|
74465
|
-
const basePath = this.baseUrl.pathname
|
|
74626
|
+
const basePath = stripTrailingSlashes(this.baseUrl.pathname);
|
|
74466
74627
|
return `${this.baseUrl.origin}${basePath}${BASE_PATH}/${encodedQueue}${path22}`;
|
|
74467
74628
|
}
|
|
74468
74629
|
async fetch(url3, init) {
|
|
@@ -74487,7 +74648,7 @@ Cause: ${cause}`
|
|
|
74487
74648
|
}
|
|
74488
74649
|
console.debug("[VQS Debug] Request:", JSON.stringify(logData, null, 2));
|
|
74489
74650
|
}
|
|
74490
|
-
init.headers.set("User-Agent", `@vercel/queue/${"0.
|
|
74651
|
+
init.headers.set("User-Agent", `@vercel/queue/${"0.8.0"}`);
|
|
74491
74652
|
init.headers.set("Vqs-Client-Ts", (/* @__PURE__ */ new Date()).toISOString());
|
|
74492
74653
|
const fetchInit = this.dispatcher ? { ...init, dispatcher: this.dispatcher } : init;
|
|
74493
74654
|
const response = await fetch(url3, fetchInit);
|
|
@@ -74526,24 +74687,14 @@ Cause: ${cause}`
|
|
|
74526
74687
|
...body instanceof ReadableStream && { duplex: "half" }
|
|
74527
74688
|
});
|
|
74528
74689
|
if (!response.ok) {
|
|
74529
|
-
const
|
|
74690
|
+
const error121 = await readHttpErrorResponse(response);
|
|
74530
74691
|
if (response.status === 502 && response.headers.get("Vqs-Error-Code") === "consumer_discovery_failed") {
|
|
74531
74692
|
throw new ConsumerDiscoveryError(
|
|
74532
|
-
|
|
74693
|
+
error121.message || "Consumer discovery failed",
|
|
74533
74694
|
deploymentId
|
|
74534
74695
|
);
|
|
74535
74696
|
}
|
|
74536
|
-
|
|
74537
|
-
throw new ConsumerRegistryNotConfiguredError(
|
|
74538
|
-
errorText || "Consumer registry not configured"
|
|
74539
|
-
);
|
|
74540
|
-
}
|
|
74541
|
-
throwCommonHttpError(
|
|
74542
|
-
response.status,
|
|
74543
|
-
response.statusText,
|
|
74544
|
-
errorText,
|
|
74545
|
-
"send message"
|
|
74546
|
-
);
|
|
74697
|
+
throwCommonHttpError(error121, "send message");
|
|
74547
74698
|
}
|
|
74548
74699
|
if (response.status === 202) {
|
|
74549
74700
|
await response.text();
|
|
@@ -74590,18 +74741,8 @@ Cause: ${cause}`
|
|
|
74590
74741
|
duplex: "half"
|
|
74591
74742
|
});
|
|
74592
74743
|
if (!response.ok) {
|
|
74593
|
-
const
|
|
74594
|
-
|
|
74595
|
-
throw new ConsumerRegistryNotConfiguredError(
|
|
74596
|
-
errorText || "Consumer registry not configured"
|
|
74597
|
-
);
|
|
74598
|
-
}
|
|
74599
|
-
throwCommonHttpError(
|
|
74600
|
-
response.status,
|
|
74601
|
-
response.statusText,
|
|
74602
|
-
errorText,
|
|
74603
|
-
"send message batch"
|
|
74604
|
-
);
|
|
74744
|
+
const error121 = await readHttpErrorResponse(response);
|
|
74745
|
+
throwCommonHttpError(error121, "send message batch");
|
|
74605
74746
|
}
|
|
74606
74747
|
const { results } = await response.json();
|
|
74607
74748
|
if (results.length !== messages.length) {
|
|
@@ -74641,7 +74782,13 @@ Cause: ${cause}`
|
|
|
74641
74782
|
}
|
|
74642
74783
|
async *receiveMessages(options) {
|
|
74643
74784
|
const transport = this.transport;
|
|
74644
|
-
const {
|
|
74785
|
+
const {
|
|
74786
|
+
queueName,
|
|
74787
|
+
consumerGroup,
|
|
74788
|
+
visibilityTimeoutSeconds,
|
|
74789
|
+
limit,
|
|
74790
|
+
cursorFallback
|
|
74791
|
+
} = options;
|
|
74645
74792
|
if (limit !== void 0 && (limit < 1 || limit > 10)) {
|
|
74646
74793
|
throw new InvalidLimitError(limit);
|
|
74647
74794
|
}
|
|
@@ -74659,6 +74806,9 @@ Cause: ${cause}`
|
|
|
74659
74806
|
if (limit !== void 0) {
|
|
74660
74807
|
headers.set("Vqs-Max-Messages", limit.toString());
|
|
74661
74808
|
}
|
|
74809
|
+
if (cursorFallback !== void 0) {
|
|
74810
|
+
headers.set("Vqs-Cursor-Fallback", cursorFallback);
|
|
74811
|
+
}
|
|
74662
74812
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
74663
74813
|
if (effectiveDeploymentId) {
|
|
74664
74814
|
headers.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -74675,11 +74825,8 @@ Cause: ${cause}`
|
|
|
74675
74825
|
return;
|
|
74676
74826
|
}
|
|
74677
74827
|
if (!response.ok) {
|
|
74678
|
-
const errorText = await response.text();
|
|
74679
74828
|
throwCommonHttpError(
|
|
74680
|
-
response
|
|
74681
|
-
response.statusText,
|
|
74682
|
-
errorText,
|
|
74829
|
+
await readHttpErrorResponse(response),
|
|
74683
74830
|
"receive messages"
|
|
74684
74831
|
);
|
|
74685
74832
|
}
|
|
@@ -74731,33 +74878,26 @@ Cause: ${cause}`
|
|
|
74731
74878
|
}
|
|
74732
74879
|
);
|
|
74733
74880
|
if (!response.ok) {
|
|
74734
|
-
const
|
|
74881
|
+
const error121 = await readHttpErrorResponse(response);
|
|
74735
74882
|
if (response.status === 404) {
|
|
74736
74883
|
throw new MessageNotFoundError(messageId);
|
|
74737
74884
|
}
|
|
74738
74885
|
if (response.status === 409) {
|
|
74739
|
-
|
|
74740
|
-
try {
|
|
74741
|
-
errorData = JSON.parse(errorText);
|
|
74742
|
-
} catch {
|
|
74743
|
-
}
|
|
74744
|
-
if (errorData.originalMessageId) {
|
|
74886
|
+
if (error121.originalMessageId) {
|
|
74745
74887
|
throw new MessageNotAvailableError(
|
|
74746
74888
|
messageId,
|
|
74747
|
-
`This message was a duplicate - use originalMessageId: ${
|
|
74889
|
+
`This message was a duplicate - use originalMessageId: ${error121.originalMessageId}`
|
|
74748
74890
|
);
|
|
74749
74891
|
}
|
|
74750
|
-
throw new
|
|
74892
|
+
throw new MessageLockedError(
|
|
74893
|
+
messageId,
|
|
74894
|
+
parseRetryAfterSeconds(response.headers.get("Retry-After"))
|
|
74895
|
+
);
|
|
74751
74896
|
}
|
|
74752
74897
|
if (response.status === 410) {
|
|
74753
74898
|
throw new MessageAlreadyProcessedError(messageId);
|
|
74754
74899
|
}
|
|
74755
|
-
throwCommonHttpError(
|
|
74756
|
-
response.status,
|
|
74757
|
-
response.statusText,
|
|
74758
|
-
errorText,
|
|
74759
|
-
"receive message by ID"
|
|
74760
|
-
);
|
|
74900
|
+
throwCommonHttpError(error121, "receive message by ID");
|
|
74761
74901
|
}
|
|
74762
74902
|
for await (const multipartMessage of parseMultipartStream(response)) {
|
|
74763
74903
|
const parsedHeaders = parseQueueHeaders(multipartMessage.headers);
|
|
@@ -74780,7 +74920,7 @@ Cause: ${cause}`
|
|
|
74780
74920
|
throw new MessageNotFoundError(messageId);
|
|
74781
74921
|
}
|
|
74782
74922
|
async acknowledgeMessage(options) {
|
|
74783
|
-
const { queueName, consumerGroup, receiptHandle } = options;
|
|
74923
|
+
const { messageId, queueName, consumerGroup, receiptHandle } = options;
|
|
74784
74924
|
const headers = new Headers({
|
|
74785
74925
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
74786
74926
|
...this.customHeaders
|
|
@@ -74803,23 +74943,20 @@ Cause: ${cause}`
|
|
|
74803
74943
|
}
|
|
74804
74944
|
);
|
|
74805
74945
|
if (!response.ok) {
|
|
74806
|
-
const
|
|
74946
|
+
const error121 = await readHttpErrorResponse(response);
|
|
74807
74947
|
if (response.status === 404) {
|
|
74808
|
-
throw new MessageNotFoundError(
|
|
74948
|
+
throw new MessageNotFoundError(messageId);
|
|
74809
74949
|
}
|
|
74810
74950
|
if (response.status === 409) {
|
|
74811
74951
|
throw new MessageNotAvailableError(
|
|
74812
|
-
|
|
74813
|
-
|
|
74952
|
+
messageId,
|
|
74953
|
+
error121.message || "Invalid receipt handle, message not in correct state, or already processed"
|
|
74814
74954
|
);
|
|
74815
74955
|
}
|
|
74816
74956
|
throwCommonHttpError(
|
|
74817
|
-
|
|
74818
|
-
response.statusText,
|
|
74819
|
-
errorText,
|
|
74957
|
+
error121,
|
|
74820
74958
|
"acknowledge message",
|
|
74821
|
-
"Missing or invalid receipt handle"
|
|
74822
|
-
response.headers?.get("Retry-After") ?? null
|
|
74959
|
+
"Missing or invalid receipt handle"
|
|
74823
74960
|
);
|
|
74824
74961
|
}
|
|
74825
74962
|
await response.text();
|
|
@@ -74827,6 +74964,7 @@ Cause: ${cause}`
|
|
|
74827
74964
|
}
|
|
74828
74965
|
async changeVisibility(options) {
|
|
74829
74966
|
const {
|
|
74967
|
+
messageId,
|
|
74830
74968
|
queueName,
|
|
74831
74969
|
consumerGroup,
|
|
74832
74970
|
receiptHandle,
|
|
@@ -74856,23 +74994,20 @@ Cause: ${cause}`
|
|
|
74856
74994
|
}
|
|
74857
74995
|
);
|
|
74858
74996
|
if (!response.ok) {
|
|
74859
|
-
const
|
|
74997
|
+
const error121 = await readHttpErrorResponse(response);
|
|
74860
74998
|
if (response.status === 404) {
|
|
74861
|
-
throw new MessageNotFoundError(
|
|
74999
|
+
throw new MessageNotFoundError(messageId);
|
|
74862
75000
|
}
|
|
74863
75001
|
if (response.status === 409) {
|
|
74864
75002
|
throw new MessageNotAvailableError(
|
|
74865
|
-
|
|
74866
|
-
|
|
75003
|
+
messageId,
|
|
75004
|
+
error121.message || "Invalid receipt handle, message not in correct state, or already processed"
|
|
74867
75005
|
);
|
|
74868
75006
|
}
|
|
74869
75007
|
throwCommonHttpError(
|
|
74870
|
-
|
|
74871
|
-
response.statusText,
|
|
74872
|
-
errorText,
|
|
75008
|
+
error121,
|
|
74873
75009
|
"change visibility",
|
|
74874
|
-
"Missing receipt handle or invalid visibility timeout"
|
|
74875
|
-
response.headers?.get("Retry-After") ?? null
|
|
75010
|
+
"Missing receipt handle or invalid visibility timeout"
|
|
74876
75011
|
);
|
|
74877
75012
|
}
|
|
74878
75013
|
await response.text();
|
|
@@ -74884,6 +75019,8 @@ Cause: ${cause}`
|
|
|
74884
75019
|
__name(setApi, "setApi");
|
|
74885
75020
|
__name(getApi, "getApi");
|
|
74886
75021
|
__name(resolveCallbackRequest, "resolveCallbackRequest");
|
|
75022
|
+
__name(skippedDeliveryReason, "skippedDeliveryReason");
|
|
75023
|
+
__name(reportSkippedDelivery, "reportSkippedDelivery");
|
|
74887
75024
|
__name(getApiClient, "getApiClient");
|
|
74888
75025
|
DEFAULT_REGION = "iad1";
|
|
74889
75026
|
__name(resolveRegion2, "resolveRegion");
|
|
@@ -74921,7 +75058,7 @@ Cause: ${cause}`
|
|
|
74921
75058
|
headers: options?.headers,
|
|
74922
75059
|
telemetry: options?.telemetry
|
|
74923
75060
|
});
|
|
74924
|
-
if (result2.messageId && isDevMode()) {
|
|
75061
|
+
if (result2.messageId && isDevMode() && !api.usesLocalBroker()) {
|
|
74925
75062
|
invokeDevHandlers(
|
|
74926
75063
|
topicName,
|
|
74927
75064
|
result2.messageId,
|
|
@@ -74945,7 +75082,7 @@ Cause: ${cause}`
|
|
|
74945
75082
|
messages,
|
|
74946
75083
|
telemetry: options?.telemetry
|
|
74947
75084
|
});
|
|
74948
|
-
if (!isDevMode()) {
|
|
75085
|
+
if (!isDevMode() || api.usesLocalBroker()) {
|
|
74949
75086
|
return results;
|
|
74950
75087
|
}
|
|
74951
75088
|
const region = api.getRegion();
|
|
@@ -74983,13 +75120,13 @@ Cause: ${cause}`
|
|
|
74983
75120
|
* @returns A route handler that accepts either `Request` or `{ request: Request }`
|
|
74984
75121
|
*/
|
|
74985
75122
|
handleCallback = /* @__PURE__ */ __name((handler, options) => {
|
|
74986
|
-
if (isDevMode()) {
|
|
75123
|
+
if (isDevMode() && !getApi(this).usesLocalBroker()) {
|
|
74987
75124
|
registerDevHandler(handler, this, options);
|
|
74988
75125
|
}
|
|
74989
75126
|
const telemetry = resolveTelemetryConfig(getApi(this).getTelemetry?.());
|
|
74990
75127
|
return async (requestOrEvent) => {
|
|
74991
75128
|
const request = resolveCallbackRequest(requestOrEvent);
|
|
74992
|
-
if (isDevMode() && request.headers.get("x-vercel-queue-prime") === "1") {
|
|
75129
|
+
if (isDevMode() && !getApi(this).usesLocalBroker() && request.headers.get("x-vercel-queue-prime") === "1") {
|
|
74993
75130
|
const primeFile = request.headers.get("x-vercel-queue-prime-file");
|
|
74994
75131
|
if (primeFile) {
|
|
74995
75132
|
registerDevHandler(
|
|
@@ -75001,11 +75138,13 @@ Cause: ${cause}`
|
|
|
75001
75138
|
}
|
|
75002
75139
|
return Response.json({ status: "primed" });
|
|
75003
75140
|
}
|
|
75141
|
+
let parsed;
|
|
75004
75142
|
try {
|
|
75005
|
-
|
|
75143
|
+
parsed = await parseCallback(request);
|
|
75144
|
+
const callback = parsed;
|
|
75006
75145
|
await withConsumerSpan(
|
|
75007
75146
|
request.headers,
|
|
75008
|
-
() => handleCallback(handler,
|
|
75147
|
+
() => handleCallback(handler, callback, {
|
|
75009
75148
|
client: this,
|
|
75010
75149
|
visibilityTimeoutSeconds: options?.visibilityTimeoutSeconds,
|
|
75011
75150
|
retry: options?.retry
|
|
@@ -75014,6 +75153,12 @@ Cause: ${cause}`
|
|
|
75014
75153
|
);
|
|
75015
75154
|
return Response.json({ status: "success" });
|
|
75016
75155
|
} catch (error121) {
|
|
75156
|
+
const skipped = skippedDeliveryReason(error121);
|
|
75157
|
+
if (skipped) {
|
|
75158
|
+
return Response.json(
|
|
75159
|
+
reportSkippedDelivery(skipped, parsed?.messageId)
|
|
75160
|
+
);
|
|
75161
|
+
}
|
|
75017
75162
|
console.error("Queue callback error:", error121);
|
|
75018
75163
|
if (error121 instanceof Error && (error121.message.includes("Invalid content type") || error121.message.includes("Invalid CloudEvent") || error121.message.includes("Missing required CloudEvent") || error121.message.includes("Failed to parse CloudEvent") || error121.message.includes("Binary mode callback"))) {
|
|
75019
75164
|
return Response.json({ error: error121.message }, { status: 400 });
|
|
@@ -75046,7 +75191,7 @@ Cause: ${cause}`
|
|
|
75046
75191
|
* @returns A `(req, res) => Promise<void>` route handler
|
|
75047
75192
|
*/
|
|
75048
75193
|
handleNodeCallback = /* @__PURE__ */ __name((handler, options) => {
|
|
75049
|
-
if (isDevMode()) {
|
|
75194
|
+
if (isDevMode() && !getApi(this).usesLocalBroker()) {
|
|
75050
75195
|
registerDevHandler(handler, this, options);
|
|
75051
75196
|
}
|
|
75052
75197
|
const telemetry = resolveTelemetryConfig(getApi(this).getTelemetry?.());
|
|
@@ -75056,7 +75201,7 @@ Cause: ${cause}`
|
|
|
75056
75201
|
return;
|
|
75057
75202
|
}
|
|
75058
75203
|
const primeHeader = req.headers["x-vercel-queue-prime"];
|
|
75059
|
-
if (isDevMode() && primeHeader === "1") {
|
|
75204
|
+
if (isDevMode() && !getApi(this).usesLocalBroker() && primeHeader === "1") {
|
|
75060
75205
|
const primeFileHeader = req.headers["x-vercel-queue-prime-file"];
|
|
75061
75206
|
const primeFile = Array.isArray(primeFileHeader) ? primeFileHeader[0] : primeFileHeader;
|
|
75062
75207
|
if (primeFile) {
|
|
@@ -75070,11 +75215,13 @@ Cause: ${cause}`
|
|
|
75070
75215
|
res.status(200).json({ status: "primed" });
|
|
75071
75216
|
return;
|
|
75072
75217
|
}
|
|
75218
|
+
let parsed;
|
|
75073
75219
|
try {
|
|
75074
|
-
|
|
75220
|
+
parsed = parseRawCallback(req.body, req.headers);
|
|
75221
|
+
const callback = parsed;
|
|
75075
75222
|
await withConsumerSpan(
|
|
75076
75223
|
req.headers,
|
|
75077
|
-
() => handleCallback(handler,
|
|
75224
|
+
() => handleCallback(handler, callback, {
|
|
75078
75225
|
client: this,
|
|
75079
75226
|
visibilityTimeoutSeconds: options?.visibilityTimeoutSeconds,
|
|
75080
75227
|
retry: options?.retry
|
|
@@ -75083,6 +75230,11 @@ Cause: ${cause}`
|
|
|
75083
75230
|
);
|
|
75084
75231
|
res.status(200).json({ status: "success" });
|
|
75085
75232
|
} catch (error121) {
|
|
75233
|
+
const skipped = skippedDeliveryReason(error121);
|
|
75234
|
+
if (skipped) {
|
|
75235
|
+
res.status(200).json(reportSkippedDelivery(skipped, parsed?.messageId));
|
|
75236
|
+
return;
|
|
75237
|
+
}
|
|
75086
75238
|
console.error("Queue callback error:", error121);
|
|
75087
75239
|
if (error121 instanceof Error && (error121.message.includes("Invalid content type") || error121.message.includes("Invalid CloudEvent") || error121.message.includes("Missing required CloudEvent") || error121.message.includes("Failed to parse CloudEvent") || error121.message.includes("Binary mode callback"))) {
|
|
75088
75240
|
res.status(400).json({ error: error121.message });
|
|
@@ -75109,7 +75261,7 @@ var init_deployment_id = __esm({
|
|
|
75109
75261
|
|
|
75110
75262
|
// ../world-vercel/dist/ws-transport-enabled.js
|
|
75111
75263
|
function isWsEventsTransportEnabled() {
|
|
75112
|
-
return process.env.WORKFLOW_EVENTS_TRANSPORT?.trim().toLowerCase()
|
|
75264
|
+
return process.env.WORKFLOW_EVENTS_TRANSPORT?.trim().toLowerCase() !== "http";
|
|
75113
75265
|
}
|
|
75114
75266
|
function wsEventsTransportOverrideWorkflows() {
|
|
75115
75267
|
const raw = process.env.WORKFLOW_EVENTS_TRANSPORT_WS_OVERRIDE_WORKFLOWS;
|
|
@@ -75731,8 +75883,7 @@ var init_ws_transport = __esm({
|
|
|
75731
75883
|
* That de-opt covers the handshake only. A channel that connects and then
|
|
75732
75884
|
* fails every write stays registered and keeps taking the WS path, so the
|
|
75733
75885
|
* fallback is per-invocation rather than a circuit breaker. Tolerable while
|
|
75734
|
-
* the transport is opt-in; defaulting it on
|
|
75735
|
-
* de-opt too.
|
|
75886
|
+
* the transport is opt-in; defaulting it on needs a write-failure de-opt too.
|
|
75736
75887
|
*/
|
|
75737
75888
|
open() {
|
|
75738
75889
|
if (this.closed)
|
|
@@ -76621,6 +76772,9 @@ var init_resolve_latest_deployment = __esm({
|
|
|
76621
76772
|
});
|
|
76622
76773
|
|
|
76623
76774
|
// ../world-vercel/dist/event-retry.js
|
|
76775
|
+
function recordsStepOutcome(eventType) {
|
|
76776
|
+
return STEP_OUTCOME_EVENT_TYPES.has(eventType);
|
|
76777
|
+
}
|
|
76624
76778
|
function collectErrorMarkers(err, depth = 0) {
|
|
76625
76779
|
if (depth > 5 || err === null || typeof err !== "object")
|
|
76626
76780
|
return [];
|
|
@@ -76673,23 +76827,48 @@ function errorMarker(err) {
|
|
|
76673
76827
|
}
|
|
76674
76828
|
return collectErrorMarkers(err)[0] ?? (err instanceof Error ? err.name : "unknown");
|
|
76675
76829
|
}
|
|
76676
|
-
function
|
|
76830
|
+
async function resolveDeadlineMs() {
|
|
76831
|
+
try {
|
|
76832
|
+
const deadline = await getDeadline2();
|
|
76833
|
+
const ms3 = deadline?.getTime();
|
|
76834
|
+
return ms3 !== void 0 && Number.isFinite(ms3) ? ms3 : void 0;
|
|
76835
|
+
} catch {
|
|
76836
|
+
return void 0;
|
|
76837
|
+
}
|
|
76838
|
+
}
|
|
76839
|
+
function createThrottleWaiter(target2, budget) {
|
|
76677
76840
|
let waitedMs = 0;
|
|
76841
|
+
let limit;
|
|
76678
76842
|
return async (err, signal) => {
|
|
76679
76843
|
const waitMs = Math.max(1, typeof err.retryAfter === "number" ? err.retryAfter : DEFAULT_THROTTLE_RETRY_AFTER_SECONDS) * 1e3;
|
|
76680
|
-
if (
|
|
76681
|
-
|
|
76844
|
+
if (limit === void 0) {
|
|
76845
|
+
const deadlineMs = await resolveDeadlineMs();
|
|
76846
|
+
limit = {
|
|
76847
|
+
budgetMs: budget === "invocation" && deadlineMs !== void 0 ? THROTTLE_RETRY_MAX_BUDGET_MS : THROTTLE_RETRY_BUDGET_MS,
|
|
76848
|
+
deadlineMs
|
|
76849
|
+
};
|
|
76850
|
+
}
|
|
76851
|
+
const outlastsInvocation = limit.deadlineMs !== void 0 && Date.now() + waitMs > limit.deadlineMs - THROTTLE_DEADLINE_RESERVE_MS;
|
|
76852
|
+
if (waitedMs + waitMs > limit.budgetMs || outlastsInvocation) {
|
|
76853
|
+
logRetry("throttle retry budget exhausted; surfacing to the queue", {
|
|
76682
76854
|
target: target2,
|
|
76855
|
+
budget,
|
|
76683
76856
|
waitedMs,
|
|
76684
|
-
retryAfter: err.retryAfter
|
|
76857
|
+
retryAfter: err.retryAfter,
|
|
76858
|
+
outlastsInvocation
|
|
76685
76859
|
});
|
|
76686
76860
|
throw err;
|
|
76687
76861
|
}
|
|
76688
76862
|
waitedMs += waitMs;
|
|
76689
|
-
console.warn(`[workflow] Throttled (429)
|
|
76863
|
+
console.warn(`[workflow] Throttled (429) ${target2}; retrying in-process in ${waitMs / 1e3}s`);
|
|
76690
76864
|
await sleep(waitMs, signal);
|
|
76691
76865
|
};
|
|
76692
76866
|
}
|
|
76867
|
+
function throttleBudgetFor(eventType, options) {
|
|
76868
|
+
if (options?.batchIdempotent !== void 0)
|
|
76869
|
+
return "bounded";
|
|
76870
|
+
return options?.afterStepBody === true || recordsStepOutcome(eventType) ? "invocation" : "bounded";
|
|
76871
|
+
}
|
|
76693
76872
|
function isEligibleForTransientRetry(eventType, options) {
|
|
76694
76873
|
if (options?.batchIdempotent !== void 0) {
|
|
76695
76874
|
return options.batchIdempotent;
|
|
@@ -76698,11 +76877,13 @@ function isEligibleForTransientRetry(eventType, options) {
|
|
|
76698
76877
|
}
|
|
76699
76878
|
async function withEventPostRetry(fn, eventType, options) {
|
|
76700
76879
|
const retryable = isEligibleForTransientRetry(eventType, options);
|
|
76701
|
-
const waitOutThrottle = createThrottleWaiter(
|
|
76880
|
+
const waitOutThrottle = createThrottleWaiter(`writing ${eventType} event`, throttleBudgetFor(eventType, options));
|
|
76702
76881
|
for (let attempt = 0; ; ) {
|
|
76703
76882
|
try {
|
|
76704
76883
|
return await fn();
|
|
76705
76884
|
} catch (err) {
|
|
76885
|
+
if (err instanceof AfterCommitError)
|
|
76886
|
+
throw err;
|
|
76706
76887
|
if (ThrottleError2.is(err)) {
|
|
76707
76888
|
await waitOutThrottle(err);
|
|
76708
76889
|
continue;
|
|
@@ -76730,11 +76911,12 @@ async function withEventPostRetry(fn, eventType, options) {
|
|
|
76730
76911
|
}
|
|
76731
76912
|
}
|
|
76732
76913
|
}
|
|
76733
|
-
var ReplayEventObserverError, EVENT_RETRY_ELIGIBILITY, MAX_EVENT_POST_RETRIES, THROTTLE_RETRY_BUDGET_MS, DEFAULT_THROTTLE_RETRY_AFTER_SECONDS, EVENT_POST_RETRY_BASE_MS, EVENT_POST_RETRY_JITTER_MS, TRANSIENT_CODES, sleep, RETRY_DEBUG_ENABLED;
|
|
76914
|
+
var ReplayEventObserverError, AfterCommitError, STEP_OUTCOME_EVENT_TYPES, EVENT_RETRY_ELIGIBILITY, MAX_EVENT_POST_RETRIES, THROTTLE_RETRY_BUDGET_MS, THROTTLE_DEADLINE_RESERVE_MS, THROTTLE_RETRY_MAX_BUDGET_MS, DEFAULT_THROTTLE_RETRY_AFTER_SECONDS, EVENT_POST_RETRY_BASE_MS, EVENT_POST_RETRY_JITTER_MS, TRANSIENT_CODES, sleep, RETRY_DEBUG_ENABLED;
|
|
76734
76915
|
var init_event_retry = __esm({
|
|
76735
76916
|
"../world-vercel/dist/event-retry.js"() {
|
|
76736
76917
|
"use strict";
|
|
76737
76918
|
init_dist7();
|
|
76919
|
+
init_get_deadline();
|
|
76738
76920
|
ReplayEventObserverError = class extends Error {
|
|
76739
76921
|
static {
|
|
76740
76922
|
__name(this, "ReplayEventObserverError");
|
|
@@ -76746,6 +76928,22 @@ var init_event_retry = __esm({
|
|
|
76746
76928
|
this.name = "ReplayEventObserverError";
|
|
76747
76929
|
}
|
|
76748
76930
|
};
|
|
76931
|
+
AfterCommitError = class extends Error {
|
|
76932
|
+
static {
|
|
76933
|
+
__name(this, "AfterCommitError");
|
|
76934
|
+
}
|
|
76935
|
+
error;
|
|
76936
|
+
constructor(error121) {
|
|
76937
|
+
super("Event log read after a committed write failed", { cause: error121 });
|
|
76938
|
+
this.error = error121;
|
|
76939
|
+
this.name = "AfterCommitError";
|
|
76940
|
+
}
|
|
76941
|
+
};
|
|
76942
|
+
STEP_OUTCOME_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
76943
|
+
"step_completed",
|
|
76944
|
+
"step_retrying"
|
|
76945
|
+
]);
|
|
76946
|
+
__name(recordsStepOutcome, "recordsStepOutcome");
|
|
76749
76947
|
EVENT_RETRY_ELIGIBILITY = {
|
|
76750
76948
|
// Creates: conditional create → 409 EntityConflictError if it already exists.
|
|
76751
76949
|
run_created: {
|
|
@@ -76831,6 +77029,8 @@ var init_event_retry = __esm({
|
|
|
76831
77029
|
};
|
|
76832
77030
|
MAX_EVENT_POST_RETRIES = 2;
|
|
76833
77031
|
THROTTLE_RETRY_BUDGET_MS = 3e4;
|
|
77032
|
+
THROTTLE_DEADLINE_RESERVE_MS = 15e3;
|
|
77033
|
+
THROTTLE_RETRY_MAX_BUDGET_MS = 15 * 6e4;
|
|
76834
77034
|
DEFAULT_THROTTLE_RETRY_AFTER_SECONDS = 1;
|
|
76835
77035
|
EVENT_POST_RETRY_BASE_MS = 100;
|
|
76836
77036
|
EVENT_POST_RETRY_JITTER_MS = 50;
|
|
@@ -76879,7 +77079,9 @@ var init_event_retry = __esm({
|
|
|
76879
77079
|
RETRY_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
76880
77080
|
__name(logRetry, "logRetry");
|
|
76881
77081
|
__name(errorMarker, "errorMarker");
|
|
77082
|
+
__name(resolveDeadlineMs, "resolveDeadlineMs");
|
|
76882
77083
|
__name(createThrottleWaiter, "createThrottleWaiter");
|
|
77084
|
+
__name(throttleBudgetFor, "throttleBudgetFor");
|
|
76883
77085
|
__name(isEligibleForTransientRetry, "isEligibleForTransientRetry");
|
|
76884
77086
|
__name(withEventPostRetry, "withEventPostRetry");
|
|
76885
77087
|
}
|
|
@@ -77733,11 +77935,18 @@ async function consumeReplayLogResponse(response, { runId, eventsRemoteRefBehavi
|
|
|
77733
77935
|
if (!page.cursor) {
|
|
77734
77936
|
throw new WorkflowWorldError2("v4 createEvent: partial event stream missing cursor", { code: "SCHEMA_VALIDATION" });
|
|
77735
77937
|
}
|
|
77736
|
-
|
|
77737
|
-
|
|
77738
|
-
|
|
77739
|
-
|
|
77740
|
-
|
|
77938
|
+
let suffix;
|
|
77939
|
+
try {
|
|
77940
|
+
suffix = await getWorkflowRunEventsV4(runId, {
|
|
77941
|
+
cursor: page.cursor,
|
|
77942
|
+
// The suffix of a replay log is the same replay log.
|
|
77943
|
+
remoteRefBehavior: eventsRemoteRefBehavior === "skip-step-inputs" ? "skip-step-inputs" : "resolve"
|
|
77944
|
+
}, config4, replayEventObserver);
|
|
77945
|
+
} catch (err) {
|
|
77946
|
+
if (ThrottleError2.is(err))
|
|
77947
|
+
throw new AfterCommitError(err);
|
|
77948
|
+
throw err;
|
|
77949
|
+
}
|
|
77741
77950
|
return {
|
|
77742
77951
|
events: [...page.events, ...suffix.events],
|
|
77743
77952
|
cursor: suffix.cursor ?? page.cursor,
|
|
@@ -77798,9 +78007,22 @@ async function getWorkflowRunEventsV4(runId, params = {}, config4, replayEventOb
|
|
|
77798
78007
|
let cursor = params.cursor ?? null;
|
|
77799
78008
|
let partialStreamRetries = 0;
|
|
77800
78009
|
let consumed;
|
|
77801
|
-
|
|
78010
|
+
const fullLog = params.limit === void 0;
|
|
78011
|
+
const waitOutThrottle = createThrottleWaiter("reading events", "bounded");
|
|
78012
|
+
for (; ; ) {
|
|
77802
78013
|
const pageCursor = cursor ?? void 0;
|
|
77803
|
-
|
|
78014
|
+
try {
|
|
78015
|
+
consumed = await consumeListWithSkipFallback(baseUrl, params.remoteRefBehavior, (remoteRefBehavior) => `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events` + paginationToQuery({
|
|
78016
|
+
...params,
|
|
78017
|
+
remoteRefBehavior,
|
|
78018
|
+
cursor: pageCursor
|
|
78019
|
+
}), headers, config4, "listEvents", replayEventObserver);
|
|
78020
|
+
} catch (err) {
|
|
78021
|
+
if (!fullLog || !ThrottleError2.is(err))
|
|
78022
|
+
throw err;
|
|
78023
|
+
await waitOutThrottle(err);
|
|
78024
|
+
continue;
|
|
78025
|
+
}
|
|
77804
78026
|
const cursorAdvanced = !!consumed.cursor && consumed.cursor !== cursor;
|
|
77805
78027
|
if (consumed.kind === "partial") {
|
|
77806
78028
|
if (params.limit !== void 0 || !cursorAdvanced || partialStreamRetries === MAX_PARTIAL_STREAM_RETRIES) {
|
|
@@ -77814,7 +78036,9 @@ async function getWorkflowRunEventsV4(runId, params = {}, config4, replayEventOb
|
|
|
77814
78036
|
for (const event of consumed.events) {
|
|
77815
78037
|
events.push(event);
|
|
77816
78038
|
}
|
|
77817
|
-
|
|
78039
|
+
if (consumed.kind !== "partial")
|
|
78040
|
+
break;
|
|
78041
|
+
}
|
|
77818
78042
|
return {
|
|
77819
78043
|
events,
|
|
77820
78044
|
cursor: consumed.cursor || (partialStreamRetries > 0 ? cursor : null),
|
|
@@ -78462,7 +78686,8 @@ async function createWorkflowRunEvent(id, data3, params, config4) {
|
|
|
78462
78686
|
// The atomic lazy-resume shape is deduplicated server-side by the
|
|
78463
78687
|
// (runId, resumeId) claim, so its POST is idempotent-on-retry even
|
|
78464
78688
|
// though plain hook_received is not; see EVENT_RETRY_ELIGIBILITY.
|
|
78465
|
-
idempotentHookResume: data3.eventType === "hook_received" && params?.resumeId !== void 0 && params?.resumePayloadDigest !== void 0
|
|
78689
|
+
idempotentHookResume: data3.eventType === "hook_received" && params?.resumeId !== void 0 && params?.resumePayloadDigest !== void 0,
|
|
78690
|
+
afterStepBody: params?.afterStepBody === true
|
|
78466
78691
|
});
|
|
78467
78692
|
if (data3.eventType === "run_created" && !result2.run) {
|
|
78468
78693
|
throw new WorkflowWorldError2(`${data3.eventType} response is missing the run entity`, { code: "SCHEMA_VALIDATION" });
|
|
@@ -78477,6 +78702,8 @@ async function createWorkflowRunEvent(id, data3, params, config4) {
|
|
|
78477
78702
|
} catch (err) {
|
|
78478
78703
|
if (err instanceof ReplayEventObserverError)
|
|
78479
78704
|
throw err.error;
|
|
78705
|
+
if (err instanceof AfterCommitError)
|
|
78706
|
+
throw err.error;
|
|
78480
78707
|
if (HookForceClaimedError2.is(err) && data3.eventType === "hook_received") {
|
|
78481
78708
|
const token = data3.eventData?.token;
|
|
78482
78709
|
throw new HookForceClaimedError2(typeof token === "string" ? token : err.token, err.claimedByRunId, err.claimedByHookId);
|
|
@@ -79405,6 +79632,13 @@ var init_ws_stream_session = __esm({
|
|
|
79405
79632
|
if (this.mode === "deferred")
|
|
79406
79633
|
this.mode = "waiting_to_connect";
|
|
79407
79634
|
}
|
|
79635
|
+
release() {
|
|
79636
|
+
return this.enqueue(async () => {
|
|
79637
|
+
if (this.mode === "closed" || this.mode === "poisoned")
|
|
79638
|
+
return;
|
|
79639
|
+
this.fallbackToHttpBeforeSend("stream writer released");
|
|
79640
|
+
});
|
|
79641
|
+
}
|
|
79408
79642
|
dispose() {
|
|
79409
79643
|
if (this.mode === "closed")
|
|
79410
79644
|
return;
|
|
@@ -79591,6 +79825,8 @@ var init_ws_stream_session = __esm({
|
|
|
79591
79825
|
return;
|
|
79592
79826
|
}
|
|
79593
79827
|
void this.inbound.then(() => {
|
|
79828
|
+
if (ws !== this.socket)
|
|
79829
|
+
return;
|
|
79594
79830
|
if (this.isIdleThrottledSocket(ws)) {
|
|
79595
79831
|
this.leaveThrottledSocketForHttp();
|
|
79596
79832
|
return;
|
|
@@ -79802,9 +80038,12 @@ var init_ws_stream_session = __esm({
|
|
|
79802
80038
|
fallbackToHttpBeforeSend(reason = "HTTP fallback before send") {
|
|
79803
80039
|
this.mode = "http";
|
|
79804
80040
|
this.drainReason = void 0;
|
|
79805
|
-
this.socket
|
|
80041
|
+
const socket = this.socket;
|
|
79806
80042
|
this.socket = void 0;
|
|
80043
|
+
this.transportDecision = Promise.resolve();
|
|
79807
80044
|
this.finishDrainWait();
|
|
80045
|
+
if (socket)
|
|
80046
|
+
beginNormalWsClose(socket, reason);
|
|
79808
80047
|
}
|
|
79809
80048
|
/**
|
|
79810
80049
|
* Classifies a correlated error and applies its session effect
|
|
@@ -79831,7 +80070,7 @@ var init_ws_stream_session = __esm({
|
|
|
79831
80070
|
* StreamWsRequestNotSentError, which callers turn into an HTTP fallback.
|
|
79832
80071
|
*/
|
|
79833
80072
|
async requestRetryingThrottle(operation, buildFrame, writeTiming, writeMetadata, maxMessageBytes) {
|
|
79834
|
-
const waitOutThrottle = createThrottleWaiter(operation === "write" ? "stream chunks" : "stream close");
|
|
80073
|
+
const waitOutThrottle = createThrottleWaiter(operation === "write" ? "writing stream chunks" : "writing stream close", "bounded");
|
|
79835
80074
|
for (let attempt = 0; ; attempt++) {
|
|
79836
80075
|
try {
|
|
79837
80076
|
return await this.request(operation, buildFrame, attempt === 0 ? writeTiming : void 0, writeMetadata, maxMessageBytes);
|
|
@@ -82932,7 +83171,7 @@ var init_encryption4 = __esm({
|
|
|
82932
83171
|
});
|
|
82933
83172
|
|
|
82934
83173
|
// ../core/dist/symbols.js
|
|
82935
|
-
var WORKFLOW_USE_STEP, WORKFLOW_SET_ATTRIBUTES, WORKFLOW_CREATE_HOOK, WORKFLOW_SLEEP, WORKFLOW_GET_STREAM_ID, STABLE_ULID2, STREAM_NAME_SYMBOL2, STREAM_TYPE_SYMBOL2, STREAM_FRAMING_SYMBOL2, STREAM_SERVER_RUN_ID_SYMBOL2, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL2, STREAM_SERVER_PUBLIC_KEY_SYMBOL2, STREAM_DRAIN_SYMBOL2, BODY_INIT_SYMBOL2, WEBHOOK_RESPONSE_WRITABLE2, WORKFLOW_CLASS_REGISTRY2, ABORT_STREAM_NAME2, ABORT_HOOK_TOKEN2, ABORT_LISTENER_ATTACHED2, ABORT_READER_CANCEL2;
|
|
83174
|
+
var WORKFLOW_USE_STEP, WORKFLOW_SET_ATTRIBUTES, WORKFLOW_CREATE_HOOK, WORKFLOW_SLEEP, WORKFLOW_GET_STREAM_ID, STABLE_ULID2, STREAM_NAME_SYMBOL2, STREAM_TYPE_SYMBOL2, STREAM_FRAMING_SYMBOL2, STREAM_SERVER_RUN_ID_SYMBOL2, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL2, STREAM_SERVER_PUBLIC_KEY_SYMBOL2, STREAM_DRAIN_SYMBOL2, STREAM_RELEASE_SYMBOL2, BODY_INIT_SYMBOL2, WEBHOOK_RESPONSE_WRITABLE2, WORKFLOW_CLASS_REGISTRY2, ABORT_STREAM_NAME2, ABORT_HOOK_TOKEN2, ABORT_LISTENER_ATTACHED2, ABORT_READER_CANCEL2;
|
|
82936
83175
|
var init_symbols2 = __esm({
|
|
82937
83176
|
"../core/dist/symbols.js"() {
|
|
82938
83177
|
"use strict";
|
|
@@ -82949,6 +83188,7 @@ var init_symbols2 = __esm({
|
|
|
82949
83188
|
STREAM_SERVER_DEPLOYMENT_ID_SYMBOL2 = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID");
|
|
82950
83189
|
STREAM_SERVER_PUBLIC_KEY_SYMBOL2 = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_SERVER_PUBLIC_KEY");
|
|
82951
83190
|
STREAM_DRAIN_SYMBOL2 = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_DRAIN");
|
|
83191
|
+
STREAM_RELEASE_SYMBOL2 = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_RELEASE");
|
|
82952
83192
|
BODY_INIT_SYMBOL2 = /* @__PURE__ */ Symbol.for("BODY_INIT");
|
|
82953
83193
|
WEBHOOK_RESPONSE_WRITABLE2 = /* @__PURE__ */ Symbol.for("WEBHOOK_RESPONSE_WRITABLE");
|
|
82954
83194
|
WORKFLOW_CLASS_REGISTRY2 = /* @__PURE__ */ Symbol.for("workflow-class-registry");
|
|
@@ -83007,12 +83247,11 @@ function isReadableUnlockedNotClosed2(readable) {
|
|
|
83007
83247
|
return true;
|
|
83008
83248
|
}
|
|
83009
83249
|
function resolveAfterDrain2(state) {
|
|
83010
|
-
const
|
|
83011
|
-
|
|
83012
|
-
state.
|
|
83013
|
-
|
|
83014
|
-
|
|
83015
|
-
barrier().then(() => state.resolve(), (err) => state.reject(err));
|
|
83250
|
+
const release = /* @__PURE__ */ __name(async () => {
|
|
83251
|
+
await state.drainBarrier?.();
|
|
83252
|
+
await state.releaseTransport?.();
|
|
83253
|
+
}, "release");
|
|
83254
|
+
release().then(() => state.resolve(), (err) => state.reject(err));
|
|
83016
83255
|
}
|
|
83017
83256
|
function markFlushableFrameProduced2(state) {
|
|
83018
83257
|
state.producedFrames++;
|
|
@@ -83104,6 +83343,7 @@ function trackFlushableWritable2(writable, state, WritableStreamConstructor = Wr
|
|
|
83104
83343
|
}
|
|
83105
83344
|
}
|
|
83106
83345
|
await drainFlushableSnapshot2(state);
|
|
83346
|
+
await state.releaseTransport?.();
|
|
83107
83347
|
if (!state.doneResolved) {
|
|
83108
83348
|
state.doneResolved = true;
|
|
83109
83349
|
state.resolve();
|
|
@@ -83175,6 +83415,10 @@ function flushablePipe2(source, sink, state) {
|
|
|
83175
83415
|
if (typeof drain === "function") {
|
|
83176
83416
|
state.drainBarrier = drain;
|
|
83177
83417
|
}
|
|
83418
|
+
const release = sink[STREAM_RELEASE_SYMBOL2];
|
|
83419
|
+
if (typeof release === "function") {
|
|
83420
|
+
state.releaseTransport = release;
|
|
83421
|
+
}
|
|
83178
83422
|
return flushablePipePerChunk2(source, sink, state);
|
|
83179
83423
|
}
|
|
83180
83424
|
async function flushablePipePerChunk2(source, sink, state) {
|
|
@@ -83228,6 +83472,8 @@ async function flushablePipePerChunk2(source, sink, state) {
|
|
|
83228
83472
|
await state.drainBarrier().catch(() => {
|
|
83229
83473
|
});
|
|
83230
83474
|
}
|
|
83475
|
+
await writer.abort(err).catch(() => {
|
|
83476
|
+
});
|
|
83231
83477
|
if (!state.doneResolved) {
|
|
83232
83478
|
state.doneResolved = true;
|
|
83233
83479
|
state.reject(err);
|
|
@@ -83852,7 +84098,7 @@ function readToStringTag2(value) {
|
|
|
83852
84098
|
const tag = readProperty2(value, Symbol.toStringTag);
|
|
83853
84099
|
return typeof tag === "string" ? tag : void 0;
|
|
83854
84100
|
}
|
|
83855
|
-
var GUEST_CODE_EXECUTION_SAMPLE_LIMIT2, activeStats2, reportedProxies2, useStepClosures2, uncurryThis2, dateGetDate2, dateGetTime2, dateToISOString2, regExpSource2, regExpFlags2, arrayBufferByteLength2, mapEntries2, setValues2, numberValueOf2, stringValueOf2, booleanValueOf2, bigIntValueOf2, TypedArrayPrototype2, typedArrayTag2, typedArrayBuffer2, typedArrayByteOffset2, typedArrayByteLength2, typedArrayLength2, dataViewBuffer2, dataViewByteOffset2, dataViewByteLength2, sharedArrayBufferByteLength2, headersIterator2, urlHrefGetter2, urlSearchParamsToStringMethod2, isProxy2, functionToString2, KNOWN_VIEW_TAGS2, BRAND_DECIDED_TAGS2, hardenedStringifyOperations2;
|
|
84101
|
+
var GUEST_CODE_EXECUTION_SAMPLE_LIMIT2, activeStats2, reportedProxies2, useStepClosures2, uncurryThis2, dateGetDate2, dateGetTime2, dateToISOString2, regExpSource2, regExpFlags2, arrayBufferByteLength2, mapEntries2, setValues2, numberValueOf2, stringValueOf2, booleanValueOf2, bigIntValueOf2, TypedArrayPrototype2, typedArrayTag2, typedArrayBuffer2, typedArrayByteOffset2, typedArrayByteLength2, typedArrayLength2, typedArraySet2, HostArrayBuffer2, HostUint8Array2, dataViewBuffer2, dataViewByteOffset2, dataViewByteLength2, sharedArrayBufferByteLength2, headersIterator2, urlHrefGetter2, urlSearchParamsToStringMethod2, isProxy2, functionToString2, KNOWN_VIEW_TAGS2, BRAND_DECIDED_TAGS2, hardenedStringifyOperations2;
|
|
83856
84102
|
var init_hardened2 = __esm({
|
|
83857
84103
|
"../core/dist/serialization/hardened.js"() {
|
|
83858
84104
|
"use strict";
|
|
@@ -83887,6 +84133,9 @@ var init_hardened2 = __esm({
|
|
|
83887
84133
|
typedArrayByteOffset2 = protoGetter2(TypedArrayPrototype2, "byteOffset");
|
|
83888
84134
|
typedArrayByteLength2 = protoGetter2(TypedArrayPrototype2, "byteLength");
|
|
83889
84135
|
typedArrayLength2 = protoGetter2(TypedArrayPrototype2, "length");
|
|
84136
|
+
typedArraySet2 = uncurryThis2(TypedArrayPrototype2.set);
|
|
84137
|
+
HostArrayBuffer2 = ArrayBuffer;
|
|
84138
|
+
HostUint8Array2 = Uint8Array;
|
|
83890
84139
|
dataViewBuffer2 = protoGetter2(DataView.prototype, "buffer");
|
|
83891
84140
|
dataViewByteOffset2 = protoGetter2(DataView.prototype, "byteOffset");
|
|
83892
84141
|
dataViewByteLength2 = protoGetter2(DataView.prototype, "byteLength");
|
|
@@ -83986,12 +84235,19 @@ var init_hardened2 = __esm({
|
|
|
83986
84235
|
entriesOf: /* @__PURE__ */ __name((map3) => mapToEntries2(map3), "entriesOf"),
|
|
83987
84236
|
viewInfo: /* @__PURE__ */ __name((view) => {
|
|
83988
84237
|
const info = viewInfo2(view);
|
|
84238
|
+
const length = types5.isDataView(view) ? 0 : typedArrayLength2(view);
|
|
84239
|
+
const bufferByteLength = types5.isSharedArrayBuffer(info.buffer) ? sharedArrayBufferByteLength2(info.buffer) : arrayBufferByteLength2(info.buffer);
|
|
84240
|
+
if (info.byteLength === bufferByteLength) {
|
|
84241
|
+
return { ...info, length, bufferByteLength };
|
|
84242
|
+
}
|
|
84243
|
+
const copy = new HostArrayBuffer2(info.byteLength);
|
|
84244
|
+
typedArraySet2(new HostUint8Array2(copy), new HostUint8Array2(info.buffer, info.byteOffset, info.byteLength));
|
|
83989
84245
|
return {
|
|
83990
|
-
|
|
83991
|
-
|
|
83992
|
-
|
|
83993
|
-
length
|
|
83994
|
-
bufferByteLength:
|
|
84246
|
+
buffer: copy,
|
|
84247
|
+
byteOffset: 0,
|
|
84248
|
+
byteLength: info.byteLength,
|
|
84249
|
+
length,
|
|
84250
|
+
bufferByteLength: info.byteLength
|
|
83995
84251
|
};
|
|
83996
84252
|
}, "viewInfo"),
|
|
83997
84253
|
shapeOf: /* @__PURE__ */ __name((value) => {
|
|
@@ -84925,24 +85181,25 @@ function recordStats2(stats, codec3, uncompressedBytes, storedBytes) {
|
|
|
84925
85181
|
stats.uncompressedBytes = uncompressedBytes;
|
|
84926
85182
|
stats.storedBytes = storedBytes;
|
|
84927
85183
|
}
|
|
84928
|
-
function selectWriteCodec2() {
|
|
85184
|
+
function selectWriteCodec2(mode) {
|
|
84929
85185
|
const override = codecOverrideFromEnv2();
|
|
84930
|
-
if (override === "gzip")
|
|
85186
|
+
if (mode === "gzip" || override === "gzip") {
|
|
84931
85187
|
return isGzipAvailable2() ? "gzip" : "none";
|
|
85188
|
+
}
|
|
84932
85189
|
if (isZstdAvailable2())
|
|
84933
85190
|
return "zstd";
|
|
84934
85191
|
if (isGzipAvailable2())
|
|
84935
85192
|
return "gzip";
|
|
84936
85193
|
return "none";
|
|
84937
85194
|
}
|
|
84938
|
-
async function compress2(data3,
|
|
85195
|
+
async function compress2(data3, mode, stats, opts) {
|
|
84939
85196
|
if (!(data3 instanceof Uint8Array))
|
|
84940
85197
|
return data3;
|
|
84941
|
-
if (!
|
|
85198
|
+
if (!mode || data3.length < COMPRESSION_MIN_BYTES2 || isCompressionDisabledByEnv2()) {
|
|
84942
85199
|
recordStats2(stats, "none", data3.length, data3.length);
|
|
84943
85200
|
return data3;
|
|
84944
85201
|
}
|
|
84945
|
-
const codec3 = selectWriteCodec2();
|
|
85202
|
+
const codec3 = selectWriteCodec2(mode);
|
|
84946
85203
|
if (codec3 === "none") {
|
|
84947
85204
|
recordStats2(stats, "none", data3.length, data3.length);
|
|
84948
85205
|
return data3;
|
|
@@ -85200,7 +85457,7 @@ async function serialize3(value, encryptionKey, options) {
|
|
|
85200
85457
|
try {
|
|
85201
85458
|
const payload = devalueCodec2.serialize(value, "step", options);
|
|
85202
85459
|
const prefixed = encodeWithFormatPrefix2(SerializationFormat2.DEVALUE_V1, payload);
|
|
85203
|
-
const compressed = await compress2(prefixed, options?.compression
|
|
85460
|
+
const compressed = await compress2(prefixed, options?.compression ?? false, options?.compressionStats);
|
|
85204
85461
|
return encrypt4(compressed, encryptionKey);
|
|
85205
85462
|
} catch (error121) {
|
|
85206
85463
|
rethrowIfRuntimeError2(error121);
|
|
@@ -88074,7 +88331,23 @@ var require_semver5 = __commonJS({
|
|
|
88074
88331
|
});
|
|
88075
88332
|
|
|
88076
88333
|
// ../core/dist/capabilities.js
|
|
88077
|
-
function
|
|
88334
|
+
function nodeVersionSupportsZstd2(nodeVersion) {
|
|
88335
|
+
if (typeof nodeVersion !== "string" || !import_semver3.default.valid(nodeVersion)) {
|
|
88336
|
+
return false;
|
|
88337
|
+
}
|
|
88338
|
+
return import_semver3.default.satisfies(nodeVersion, ZSTD_NODE_RANGE2);
|
|
88339
|
+
}
|
|
88340
|
+
function getCurrentNodeVersion2() {
|
|
88341
|
+
try {
|
|
88342
|
+
const versions = globalThis.process?.versions;
|
|
88343
|
+
if (!versions || versions.bun || versions.deno)
|
|
88344
|
+
return void 0;
|
|
88345
|
+
return typeof versions.node === "string" ? versions.node : void 0;
|
|
88346
|
+
} catch {
|
|
88347
|
+
return void 0;
|
|
88348
|
+
}
|
|
88349
|
+
}
|
|
88350
|
+
function getRunCapabilities2(workflowCoreVersion, nodeVersion) {
|
|
88078
88351
|
if (!workflowCoreVersion || !import_semver3.default.valid(workflowCoreVersion)) {
|
|
88079
88352
|
return {
|
|
88080
88353
|
supportedFormats: BASELINE_FORMATS2,
|
|
@@ -88087,6 +88360,9 @@ function getRunCapabilities2(workflowCoreVersion) {
|
|
|
88087
88360
|
formats.add(format);
|
|
88088
88361
|
}
|
|
88089
88362
|
}
|
|
88363
|
+
if (!nodeVersionSupportsZstd2(nodeVersion)) {
|
|
88364
|
+
formats.delete(SerializationFormat2.ZSTD);
|
|
88365
|
+
}
|
|
88090
88366
|
const result2 = {
|
|
88091
88367
|
supportedFormats: formats,
|
|
88092
88368
|
framedByteStreams: false
|
|
@@ -88098,7 +88374,13 @@ function getRunCapabilities2(workflowCoreVersion) {
|
|
|
88098
88374
|
}
|
|
88099
88375
|
return result2;
|
|
88100
88376
|
}
|
|
88101
|
-
|
|
88377
|
+
function getCompressionMode2(capabilities) {
|
|
88378
|
+
if (!capabilities.supportedFormats.has(SerializationFormat2.GZIP)) {
|
|
88379
|
+
return false;
|
|
88380
|
+
}
|
|
88381
|
+
return capabilities.supportedFormats.has(SerializationFormat2.ZSTD) ? true : "gzip";
|
|
88382
|
+
}
|
|
88383
|
+
var import_semver3, FORMAT_VERSION_TABLE2, CAPABILITY_VERSION_TABLE2, BASELINE_FORMATS2, ZSTD_NODE_RANGE2;
|
|
88102
88384
|
var init_capabilities2 = __esm({
|
|
88103
88385
|
"../core/dist/capabilities.js"() {
|
|
88104
88386
|
"use strict";
|
|
@@ -88111,7 +88393,8 @@ var init_capabilities2 = __esm({
|
|
|
88111
88393
|
// bump to the next beta. A too-low cutoff makes new producers write
|
|
88112
88394
|
// compressed payloads to consumers that cannot decompress them; too-high
|
|
88113
88395
|
// merely delays the optimization (safe). gzip and zstd ship together, so
|
|
88114
|
-
// they share a min version
|
|
88396
|
+
// they share a min version. zstd additionally requires the run's runtime to
|
|
88397
|
+
// decode it; see `getRunCapabilities`.
|
|
88115
88398
|
{ format: SerializationFormat2.GZIP, minVersion: "5.0.0-beta.18" },
|
|
88116
88399
|
{ format: SerializationFormat2.ZSTD, minVersion: "5.0.0-beta.18" },
|
|
88117
88400
|
// TODO(release): verify this matches the actual version that ships sealed-box
|
|
@@ -88142,7 +88425,11 @@ var init_capabilities2 = __esm({
|
|
|
88142
88425
|
BASELINE_FORMATS2 = /* @__PURE__ */ new Set([
|
|
88143
88426
|
SerializationFormat2.DEVALUE_V1
|
|
88144
88427
|
]);
|
|
88428
|
+
ZSTD_NODE_RANGE2 = "^22.15.0 || >=23.8.0";
|
|
88429
|
+
__name(nodeVersionSupportsZstd2, "nodeVersionSupportsZstd");
|
|
88430
|
+
__name(getCurrentNodeVersion2, "getCurrentNodeVersion");
|
|
88145
88431
|
__name(getRunCapabilities2, "getRunCapabilities");
|
|
88432
|
+
__name(getCompressionMode2, "getCompressionMode");
|
|
88146
88433
|
}
|
|
88147
88434
|
});
|
|
88148
88435
|
|
|
@@ -88151,7 +88438,7 @@ var version6;
|
|
|
88151
88438
|
var init_version4 = __esm({
|
|
88152
88439
|
"../core/dist/version.js"() {
|
|
88153
88440
|
"use strict";
|
|
88154
|
-
version6 = "5.0
|
|
88441
|
+
version6 = "5.1.0";
|
|
88155
88442
|
}
|
|
88156
88443
|
});
|
|
88157
88444
|
|
|
@@ -88413,6 +88700,7 @@ async function handleHealthCheckMessage(healthCheck3, worldSpecVersion) {
|
|
|
88413
88700
|
correlationId: healthCheck3.correlationId,
|
|
88414
88701
|
specVersion: worldSpecVersion ?? SPEC_VERSION_CURRENT2,
|
|
88415
88702
|
workflowCoreVersion: version6,
|
|
88703
|
+
nodeVersion: getCurrentNodeVersion2(),
|
|
88416
88704
|
// We are executing inside the target deployment, so this constant reflects
|
|
88417
88705
|
// the *consumer's* hook-resume protocol version, exactly what a
|
|
88418
88706
|
// cross-deployment caller needs to gate its parallel resume path on.
|
|
@@ -88675,7 +88963,8 @@ function withHealthCheck(handler, worldSpecVersion) {
|
|
|
88675
88963
|
healthy: true,
|
|
88676
88964
|
endpoint: url3.pathname,
|
|
88677
88965
|
specVersion: worldSpecVersion ?? SPEC_VERSION_CURRENT2,
|
|
88678
|
-
workflowCoreVersion: version6
|
|
88966
|
+
workflowCoreVersion: version6,
|
|
88967
|
+
nodeVersion: getCurrentNodeVersion2()
|
|
88679
88968
|
}), {
|
|
88680
88969
|
status: 200,
|
|
88681
88970
|
headers: {
|
|
@@ -88794,6 +89083,7 @@ var init_helpers3 = __esm({
|
|
|
88794
89083
|
init_dist7();
|
|
88795
89084
|
init_dist6();
|
|
88796
89085
|
init_node2();
|
|
89086
|
+
init_capabilities2();
|
|
88797
89087
|
init_logger2();
|
|
88798
89088
|
init_sealed_box2();
|
|
88799
89089
|
init_encryption5();
|
|
@@ -89197,11 +89487,13 @@ function resumeContextFromRun2(run3) {
|
|
|
89197
89487
|
const coreVersion = run3.executionContext?.workflowCoreVersion;
|
|
89198
89488
|
const traceCarrier = run3.executionContext?.traceCarrier;
|
|
89199
89489
|
const hookResumeInputVersion = run3.executionContext?.hookResumeInputVersion;
|
|
89490
|
+
const nodeVersion = run3.executionContext?.nodeVersion;
|
|
89200
89491
|
return {
|
|
89201
89492
|
deploymentId: run3.deploymentId,
|
|
89202
89493
|
workflowName: run3.workflowName,
|
|
89203
89494
|
runSpecVersion: run3.specVersion,
|
|
89204
89495
|
workflowCoreVersion: typeof coreVersion === "string" ? coreVersion : void 0,
|
|
89496
|
+
nodeVersion: typeof nodeVersion === "string" ? nodeVersion : void 0,
|
|
89205
89497
|
traceCarrier: traceCarrier && typeof traceCarrier === "object" ? traceCarrier : void 0,
|
|
89206
89498
|
encryptionPublicKey: run3.encryptionPublicKey,
|
|
89207
89499
|
hookResumeInputVersion: typeof hookResumeInputVersion === "number" ? hookResumeInputVersion : void 0
|
|
@@ -89388,7 +89680,7 @@ async function resumeHookAttempt2(world, span, tokenOrHook, payload, encryptionK
|
|
|
89388
89680
|
if (info.run && isTerminalWorkflowRunStatus2(info.run.status)) {
|
|
89389
89681
|
throw new HookNotFoundError2(hook.token);
|
|
89390
89682
|
}
|
|
89391
|
-
const capabilities = getRunCapabilities2(resumeContext.workflowCoreVersion);
|
|
89683
|
+
const capabilities = getRunCapabilities2(resumeContext.workflowCoreVersion, resumeContext.nodeVersion);
|
|
89392
89684
|
let payloadKey;
|
|
89393
89685
|
const runPublicKey = encryptionKeyOverride ? (
|
|
89394
89686
|
// The caller already holds a key (resumeWebhook resolved one to
|
|
@@ -89405,7 +89697,7 @@ async function resumeHookAttempt2(world, span, tokenOrHook, payload, encryptionK
|
|
|
89405
89697
|
}
|
|
89406
89698
|
payloadKey = encryptionKey;
|
|
89407
89699
|
}
|
|
89408
|
-
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2
|
|
89700
|
+
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION2 ? getCompressionMode2(capabilities) : false;
|
|
89409
89701
|
const ops = [];
|
|
89410
89702
|
const readbackOps = [];
|
|
89411
89703
|
const v1Compat = isLegacySpecVersion2(hook.specVersion);
|
|
@@ -90929,7 +91221,7 @@ function getWorkflowRevivers(global2 = globalThis) {
|
|
|
90929
91221
|
}, "AbortSignal")
|
|
90930
91222
|
};
|
|
90931
91223
|
}
|
|
90932
|
-
function getStepRevivers2(global2 = globalThis, ops, runId, cryptoKey, deploymentId, streamStates) {
|
|
91224
|
+
function getStepRevivers2(global2 = globalThis, ops, runId, cryptoKey, deploymentId, streamStates, runReadyBarrier) {
|
|
90933
91225
|
return {
|
|
90934
91226
|
...getCommonRevivers4(global2),
|
|
90935
91227
|
// StepFunction reviver for step context - returns raw step function
|
|
@@ -91045,7 +91337,7 @@ function getStepRevivers2(global2 = globalThis, ops, runId, cryptoKey, deploymen
|
|
|
91045
91337
|
pollReadableLock2(userReadable, state);
|
|
91046
91338
|
return userReadable;
|
|
91047
91339
|
} else {
|
|
91048
|
-
const transform3 = getDeserializeStream2(getStepRevivers2(global2, ops, runId, cryptoKey, deploymentId), cryptoKey);
|
|
91340
|
+
const transform3 = getDeserializeStream2(getStepRevivers2(global2, ops, runId, cryptoKey, deploymentId, streamStates, runReadyBarrier), cryptoKey);
|
|
91049
91341
|
const state = createFlushableState2();
|
|
91050
91342
|
ops.push(state.promise);
|
|
91051
91343
|
flushablePipe2(readable, transform3.writable, state).catch(() => {
|
|
@@ -91058,8 +91350,9 @@ function getStepRevivers2(global2 = globalThis, ops, runId, cryptoKey, deploymen
|
|
|
91058
91350
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
91059
91351
|
const targetDeploymentId = typeof value.deploymentId === "string" ? value.deploymentId : targetRunId === runId ? deploymentId : void 0;
|
|
91060
91352
|
const targetKey = targetRunId === runId ? cryptoKey : lazyForwardedWritableEncryptionKey2(targetRunId, targetDeploymentId, value.encryptionPublicKey);
|
|
91061
|
-
const
|
|
91062
|
-
const
|
|
91353
|
+
const targetRunReady = targetRunId === runId ? runReadyBarrier : void 0;
|
|
91354
|
+
const serialize5 = getSerializeStream2(getStepReducers2(global2, ops, targetRunId, targetKey, false, targetRunReady), targetKey);
|
|
91355
|
+
const serverWritable = new WorkflowServerWritableStream2(targetRunId, value.name, targetRunReady);
|
|
91063
91356
|
const state = createFlushableState2();
|
|
91064
91357
|
state.deferReleaseSettlement = streamStates !== void 0;
|
|
91065
91358
|
streamStates?.push(state);
|
|
@@ -91198,12 +91491,12 @@ async function dehydrateStepArguments2(value, _runId, key, global2 = globalThis,
|
|
|
91198
91491
|
throw new SerializationError2(message, { hint: hint3, cause });
|
|
91199
91492
|
}
|
|
91200
91493
|
}
|
|
91201
|
-
async function hydrateStepArguments2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId, streamStates) {
|
|
91494
|
+
async function hydrateStepArguments2(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId, streamStates, runReadyBarrier) {
|
|
91202
91495
|
const compressionStats = {};
|
|
91203
91496
|
const result2 = await deserialize4(value, key, {
|
|
91204
91497
|
global: global2,
|
|
91205
91498
|
extraRevivers: {
|
|
91206
|
-
...getStreamAndRequestRevivers2(getStepRevivers2(global2, ops, runId, key, deploymentId, streamStates)),
|
|
91499
|
+
...getStreamAndRequestRevivers2(getStepRevivers2(global2, ops, runId, key, deploymentId, streamStates, runReadyBarrier)),
|
|
91207
91500
|
...extraRevivers
|
|
91208
91501
|
},
|
|
91209
91502
|
compressionStats
|
|
@@ -91694,6 +91987,14 @@ var init_serialization4 = __esm({
|
|
|
91694
91987
|
enumerable: false,
|
|
91695
91988
|
writable: false
|
|
91696
91989
|
});
|
|
91990
|
+
Object.defineProperty(this, STREAM_RELEASE_SYMBOL2, {
|
|
91991
|
+
value: /* @__PURE__ */ __name(async () => {
|
|
91992
|
+
const session = await writeSessionPromise.catch(() => void 0);
|
|
91993
|
+
await session?.release?.();
|
|
91994
|
+
}, "value"),
|
|
91995
|
+
enumerable: false,
|
|
91996
|
+
writable: false
|
|
91997
|
+
});
|
|
91697
91998
|
}
|
|
91698
91999
|
};
|
|
91699
92000
|
__name(getAllBaseReducers2, "getAllBaseReducers");
|
|
@@ -99174,7 +99475,19 @@ async function executeStep(params) {
|
|
|
99174
99475
|
const encryptionKey = params.encryptionKey ?? await getEncryptionKey();
|
|
99175
99476
|
const hydratedInput = await trace5("step.hydrate", {}, async (hydrateSpan) => {
|
|
99176
99477
|
const startTime = Date.now();
|
|
99177
|
-
const hydrated = await hydrateStepArguments2(
|
|
99478
|
+
const hydrated = await hydrateStepArguments2(
|
|
99479
|
+
step.input,
|
|
99480
|
+
workflowRunId,
|
|
99481
|
+
encryptionKey,
|
|
99482
|
+
ops,
|
|
99483
|
+
globalThis,
|
|
99484
|
+
{},
|
|
99485
|
+
params.workflowDeploymentId,
|
|
99486
|
+
streamStates,
|
|
99487
|
+
// A workflow-created writable passed into an optimistic step can
|
|
99488
|
+
// emit chunks before run_started lands, just like getWritable().
|
|
99489
|
+
optimisticStart ? params.runReadyBarrier : void 0
|
|
99490
|
+
);
|
|
99178
99491
|
const durationMs = Date.now() - startTime;
|
|
99179
99492
|
hydrateSpan?.setAttributes({
|
|
99180
99493
|
...StepArgumentsCount2(hydrated.args.length),
|
|
@@ -99272,6 +99585,13 @@ async function executeStep(params) {
|
|
|
99272
99585
|
const executionTimeMs = Date.now() - executionStartTime;
|
|
99273
99586
|
cancelAbortReaders(...args, thisVal, hydratedInput.closureVars);
|
|
99274
99587
|
if (userCodeFailed) {
|
|
99588
|
+
await settleReleasedStepStreams(streamStates).catch((error121) => {
|
|
99589
|
+
runtimeLogger2.warn("Failed to drain released streams after step error", {
|
|
99590
|
+
workflowRunId,
|
|
99591
|
+
stepId,
|
|
99592
|
+
error: error121 instanceof Error ? error121.message : String(error121)
|
|
99593
|
+
});
|
|
99594
|
+
});
|
|
99275
99595
|
throw userCodeError;
|
|
99276
99596
|
}
|
|
99277
99597
|
span?.setAttributes({
|
|
@@ -99376,16 +99696,20 @@ async function executeStep(params) {
|
|
|
99376
99696
|
setErrorStack(effectiveErr, normalizedStack);
|
|
99377
99697
|
}
|
|
99378
99698
|
try {
|
|
99379
|
-
await createEvent(
|
|
99380
|
-
|
|
99381
|
-
|
|
99382
|
-
|
|
99383
|
-
|
|
99384
|
-
|
|
99385
|
-
|
|
99386
|
-
|
|
99387
|
-
|
|
99388
|
-
|
|
99699
|
+
await createEvent(
|
|
99700
|
+
{
|
|
99701
|
+
eventType: "step_failed",
|
|
99702
|
+
specVersion: SPEC_VERSION_CURRENT2,
|
|
99703
|
+
correlationId: stepId,
|
|
99704
|
+
eventData: {
|
|
99705
|
+
stepName,
|
|
99706
|
+
error: await dehydrateStepError(effectiveErr, workflowRunId, await getEncryptionKey(), [], globalThis, compression),
|
|
99707
|
+
...latencyEventData
|
|
99708
|
+
}
|
|
99709
|
+
},
|
|
99710
|
+
// The body ran: losing this write to redelivery would run it again.
|
|
99711
|
+
{ afterStepBody: true }
|
|
99712
|
+
);
|
|
99389
99713
|
} catch (stepFailErr) {
|
|
99390
99714
|
if (EntityConflictError2.is(stepFailErr)) {
|
|
99391
99715
|
runtimeLogger2.info("Tried failing step, but step has already finished.", {
|
|
@@ -99424,16 +99748,20 @@ async function executeStep(params) {
|
|
|
99424
99748
|
if (normalizedStack)
|
|
99425
99749
|
wrappedError.stack = normalizedStack;
|
|
99426
99750
|
try {
|
|
99427
|
-
await createEvent(
|
|
99428
|
-
|
|
99429
|
-
|
|
99430
|
-
|
|
99431
|
-
|
|
99432
|
-
|
|
99433
|
-
|
|
99434
|
-
|
|
99435
|
-
|
|
99436
|
-
|
|
99751
|
+
await createEvent(
|
|
99752
|
+
{
|
|
99753
|
+
eventType: "step_failed",
|
|
99754
|
+
specVersion: SPEC_VERSION_CURRENT2,
|
|
99755
|
+
correlationId: stepId,
|
|
99756
|
+
eventData: {
|
|
99757
|
+
stepName,
|
|
99758
|
+
error: await dehydrateStepError(wrappedError, workflowRunId, await getEncryptionKey(), [], globalThis, compression),
|
|
99759
|
+
...latencyEventData
|
|
99760
|
+
}
|
|
99761
|
+
},
|
|
99762
|
+
// The body ran: losing this write to redelivery would run it again.
|
|
99763
|
+
{ afterStepBody: true }
|
|
99764
|
+
);
|
|
99437
99765
|
} catch (stepFailErr) {
|
|
99438
99766
|
if (EntityConflictError2.is(stepFailErr)) {
|
|
99439
99767
|
runtimeLogger2.info("Tried failing step, but step has already finished.", {
|
|
@@ -104293,6 +104621,11 @@ function createQuickJSSerde(vm, capturedRoot) {
|
|
|
104293
104621
|
]) {
|
|
104294
104622
|
typedArrayConstructors.set(name, at3(name));
|
|
104295
104623
|
}
|
|
104624
|
+
{
|
|
104625
|
+
const float16Array = optional3("Float16Array");
|
|
104626
|
+
if (float16Array)
|
|
104627
|
+
typedArrayConstructors.set("Float16Array", float16Array);
|
|
104628
|
+
}
|
|
104296
104629
|
const symbols = /* @__PURE__ */ new Map();
|
|
104297
104630
|
{
|
|
104298
104631
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
@@ -104545,7 +104878,16 @@ function createQuickJSSerde(vm, capturedRoot) {
|
|
|
104545
104878
|
if (!isDataView) {
|
|
104546
104879
|
info.length = call(i3.viewLength, value).consume((h) => h.toNumber());
|
|
104547
104880
|
}
|
|
104548
|
-
|
|
104881
|
+
if (info.byteLength === info.bufferByteLength)
|
|
104882
|
+
return info;
|
|
104883
|
+
const viewed = viewBytes(value).slice();
|
|
104884
|
+
return {
|
|
104885
|
+
buffer: vm.newArrayBuffer(viewed.buffer),
|
|
104886
|
+
byteOffset: 0,
|
|
104887
|
+
byteLength: info.byteLength,
|
|
104888
|
+
bufferByteLength: info.byteLength,
|
|
104889
|
+
length: info.length
|
|
104890
|
+
};
|
|
104549
104891
|
}, "viewInfo"),
|
|
104550
104892
|
toArrayBuffer: /* @__PURE__ */ __name((value) => isHandle(value) ? value.toArrayBuffer() : d.toArrayBuffer(value), "toArrayBuffer"),
|
|
104551
104893
|
lengthOf: /* @__PURE__ */ __name((value) => {
|
|
@@ -105960,6 +106302,9 @@ var init_quickjs_serde = __esm({
|
|
|
105960
106302
|
Float64Array: new Float64Array(0),
|
|
105961
106303
|
BigInt64Array: new BigInt64Array(0),
|
|
105962
106304
|
BigUint64Array: new BigUint64Array(0),
|
|
106305
|
+
...(typeof Float16Array === 'function'
|
|
106306
|
+
? { Float16Array: new Float16Array(0) }
|
|
106307
|
+
: {}),
|
|
105963
106308
|
})`;
|
|
105964
106309
|
CAPTURE_INTRINSICS = `(() => {
|
|
105965
106310
|
const descriptor = (object, key) =>
|
|
@@ -106017,6 +106362,7 @@ var init_quickjs_serde = __esm({
|
|
|
106017
106362
|
Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,
|
|
106018
106363
|
Int32Array, Uint32Array, Float32Array, Float64Array,
|
|
106019
106364
|
BigInt64Array, BigUint64Array,
|
|
106365
|
+
Float16Array: g.Float16Array,
|
|
106020
106366
|
Error,
|
|
106021
106367
|
AggregateError: g.AggregateError,
|
|
106022
106368
|
EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError,
|
|
@@ -110104,6 +110450,14 @@ var require_ms = __commonJS2({
|
|
|
110104
110450
|
}
|
|
110105
110451
|
});
|
|
110106
110452
|
function parseDurationToDate(param) {
|
|
110453
|
+
const date52 = durationToDate(param);
|
|
110454
|
+
if (Number.isNaN(date52.getTime())) {
|
|
110455
|
+
throw new Error(typeof param === "object" ? "Invalid date: the Date object does not hold a valid time." : `Invalid duration: ${JSON.stringify(param)} ends past the latest time a Date can represent.`);
|
|
110456
|
+
}
|
|
110457
|
+
return date52;
|
|
110458
|
+
}
|
|
110459
|
+
__name(parseDurationToDate, "parseDurationToDate");
|
|
110460
|
+
function durationToDate(param) {
|
|
110107
110461
|
if (typeof param === "string") {
|
|
110108
110462
|
const durationMs = (0, import_ms.default)(param);
|
|
110109
110463
|
if (typeof durationMs !== "number" || durationMs < 0) {
|
|
@@ -110121,13 +110475,14 @@ function parseDurationToDate(param) {
|
|
|
110121
110475
|
throw new Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`);
|
|
110122
110476
|
}
|
|
110123
110477
|
}
|
|
110124
|
-
__name(
|
|
110478
|
+
__name(durationToDate, "durationToDate");
|
|
110125
110479
|
var import_ms;
|
|
110126
110480
|
var init_time = __esm2({
|
|
110127
110481
|
"../utils/dist/time.js"() {
|
|
110128
110482
|
"use strict";
|
|
110129
110483
|
import_ms = __toESM2(require_ms(), 1);
|
|
110130
110484
|
__name2(parseDurationToDate, "parseDurationToDate");
|
|
110485
|
+
__name2(durationToDate, "durationToDate");
|
|
110131
110486
|
}
|
|
110132
110487
|
});
|
|
110133
110488
|
var init_dist = __esm2({
|
|
@@ -112481,6 +112836,7 @@ var STREAM_SERVER_RUN_ID_SYMBOL;
|
|
|
112481
112836
|
var STREAM_SERVER_DEPLOYMENT_ID_SYMBOL;
|
|
112482
112837
|
var STREAM_SERVER_PUBLIC_KEY_SYMBOL;
|
|
112483
112838
|
var STREAM_DRAIN_SYMBOL;
|
|
112839
|
+
var STREAM_RELEASE_SYMBOL;
|
|
112484
112840
|
var BODY_INIT_SYMBOL;
|
|
112485
112841
|
var WEBHOOK_RESPONSE_WRITABLE;
|
|
112486
112842
|
var WORKFLOW_CLASS_REGISTRY;
|
|
@@ -112499,6 +112855,7 @@ var init_symbols = __esm2({
|
|
|
112499
112855
|
STREAM_SERVER_DEPLOYMENT_ID_SYMBOL = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID");
|
|
112500
112856
|
STREAM_SERVER_PUBLIC_KEY_SYMBOL = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_SERVER_PUBLIC_KEY");
|
|
112501
112857
|
STREAM_DRAIN_SYMBOL = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_DRAIN");
|
|
112858
|
+
STREAM_RELEASE_SYMBOL = /* @__PURE__ */ Symbol.for("WORKFLOW_STREAM_RELEASE");
|
|
112502
112859
|
BODY_INIT_SYMBOL = /* @__PURE__ */ Symbol.for("BODY_INIT");
|
|
112503
112860
|
WEBHOOK_RESPONSE_WRITABLE = /* @__PURE__ */ Symbol.for("WEBHOOK_RESPONSE_WRITABLE");
|
|
112504
112861
|
WORKFLOW_CLASS_REGISTRY = /* @__PURE__ */ Symbol.for("workflow-class-registry");
|
|
@@ -112556,12 +112913,11 @@ function isReadableUnlockedNotClosed(readable) {
|
|
|
112556
112913
|
}
|
|
112557
112914
|
__name(isReadableUnlockedNotClosed, "isReadableUnlockedNotClosed");
|
|
112558
112915
|
function resolveAfterDrain(state) {
|
|
112559
|
-
const
|
|
112560
|
-
|
|
112561
|
-
state.
|
|
112562
|
-
|
|
112563
|
-
|
|
112564
|
-
barrier().then(() => state.resolve(), (err) => state.reject(err));
|
|
112916
|
+
const release = /* @__PURE__ */ __name2(async () => {
|
|
112917
|
+
await state.drainBarrier?.();
|
|
112918
|
+
await state.releaseTransport?.();
|
|
112919
|
+
}, "release");
|
|
112920
|
+
release().then(() => state.resolve(), (err) => state.reject(err));
|
|
112565
112921
|
}
|
|
112566
112922
|
__name(resolveAfterDrain, "resolveAfterDrain");
|
|
112567
112923
|
function markFlushableFrameProduced(state) {
|
|
@@ -112657,6 +113013,7 @@ function trackFlushableWritable(writable, state, WritableStreamConstructor = Wri
|
|
|
112657
113013
|
}
|
|
112658
113014
|
}
|
|
112659
113015
|
await drainFlushableSnapshot(state);
|
|
113016
|
+
await state.releaseTransport?.();
|
|
112660
113017
|
if (!state.doneResolved) {
|
|
112661
113018
|
state.doneResolved = true;
|
|
112662
113019
|
state.resolve();
|
|
@@ -112731,6 +113088,10 @@ function flushablePipe(source, sink, state) {
|
|
|
112731
113088
|
if (typeof drain === "function") {
|
|
112732
113089
|
state.drainBarrier = drain;
|
|
112733
113090
|
}
|
|
113091
|
+
const release = sink[STREAM_RELEASE_SYMBOL];
|
|
113092
|
+
if (typeof release === "function") {
|
|
113093
|
+
state.releaseTransport = release;
|
|
113094
|
+
}
|
|
112734
113095
|
return flushablePipePerChunk(source, sink, state);
|
|
112735
113096
|
}
|
|
112736
113097
|
__name(flushablePipe, "flushablePipe");
|
|
@@ -112783,6 +113144,8 @@ async function flushablePipePerChunk(source, sink, state) {
|
|
|
112783
113144
|
await state.drainBarrier().catch(() => {
|
|
112784
113145
|
});
|
|
112785
113146
|
}
|
|
113147
|
+
await writer.abort(err).catch(() => {
|
|
113148
|
+
});
|
|
112786
113149
|
if (!state.doneResolved) {
|
|
112787
113150
|
state.doneResolved = true;
|
|
112788
113151
|
state.reject(err);
|
|
@@ -136799,6 +137162,11 @@ var init_hooks = __esm2({
|
|
|
136799
137162
|
// Named `runSpecVersion` to distinguish it from the hook's own `specVersion`.
|
|
136800
137163
|
runSpecVersion: external_exports.number().optional(),
|
|
136801
137164
|
workflowCoreVersion: external_exports.string().optional(),
|
|
137165
|
+
// Node.js version of the run's creating deployment, mirrored from
|
|
137166
|
+
// `executionContext.nodeVersion`. Decides whether a resume may write zstd
|
|
137167
|
+
// (which needs Node.js >= 22.15) or must use gzip. Absent on runs created
|
|
137168
|
+
// before the field existed and on non-Node runtimes, where writers use gzip.
|
|
137169
|
+
nodeVersion: external_exports.string().optional(),
|
|
136802
137170
|
traceCarrier: TraceCarrierSchema.optional(),
|
|
136803
137171
|
// The run's published X25519 public key (base64), mirrored from the run
|
|
136804
137172
|
// entity. Lets a resume seal (`encp`) its payload to the run without reading
|
|
@@ -137345,6 +137713,9 @@ var typedArrayBuffer;
|
|
|
137345
137713
|
var typedArrayByteOffset;
|
|
137346
137714
|
var typedArrayByteLength;
|
|
137347
137715
|
var typedArrayLength;
|
|
137716
|
+
var typedArraySet;
|
|
137717
|
+
var HostArrayBuffer;
|
|
137718
|
+
var HostUint8Array;
|
|
137348
137719
|
var dataViewBuffer;
|
|
137349
137720
|
var dataViewByteOffset;
|
|
137350
137721
|
var dataViewByteLength;
|
|
@@ -137392,6 +137763,9 @@ var init_hardened = __esm2({
|
|
|
137392
137763
|
typedArrayByteOffset = protoGetter(TypedArrayPrototype, "byteOffset");
|
|
137393
137764
|
typedArrayByteLength = protoGetter(TypedArrayPrototype, "byteLength");
|
|
137394
137765
|
typedArrayLength = protoGetter(TypedArrayPrototype, "length");
|
|
137766
|
+
typedArraySet = uncurryThis(TypedArrayPrototype.set);
|
|
137767
|
+
HostArrayBuffer = ArrayBuffer;
|
|
137768
|
+
HostUint8Array = Uint8Array;
|
|
137395
137769
|
dataViewBuffer = protoGetter(DataView.prototype, "buffer");
|
|
137396
137770
|
dataViewByteOffset = protoGetter(DataView.prototype, "byteOffset");
|
|
137397
137771
|
dataViewByteLength = protoGetter(DataView.prototype, "byteLength");
|
|
@@ -137485,12 +137859,23 @@ var init_hardened = __esm2({
|
|
|
137485
137859
|
entriesOf: /* @__PURE__ */ __name2((map22) => mapToEntries(map22), "entriesOf"),
|
|
137486
137860
|
viewInfo: /* @__PURE__ */ __name2((view) => {
|
|
137487
137861
|
const info = viewInfo(view);
|
|
137862
|
+
const length = types.isDataView(view) ? 0 : typedArrayLength(view);
|
|
137863
|
+
const bufferByteLength = types.isSharedArrayBuffer(info.buffer) ? sharedArrayBufferByteLength(info.buffer) : arrayBufferByteLength(info.buffer);
|
|
137864
|
+
if (info.byteLength === bufferByteLength) {
|
|
137865
|
+
return {
|
|
137866
|
+
...info,
|
|
137867
|
+
length,
|
|
137868
|
+
bufferByteLength
|
|
137869
|
+
};
|
|
137870
|
+
}
|
|
137871
|
+
const copy = new HostArrayBuffer(info.byteLength);
|
|
137872
|
+
typedArraySet(new HostUint8Array(copy), new HostUint8Array(info.buffer, info.byteOffset, info.byteLength));
|
|
137488
137873
|
return {
|
|
137489
|
-
|
|
137490
|
-
|
|
137491
|
-
|
|
137492
|
-
length
|
|
137493
|
-
bufferByteLength:
|
|
137874
|
+
buffer: copy,
|
|
137875
|
+
byteOffset: 0,
|
|
137876
|
+
byteLength: info.byteLength,
|
|
137877
|
+
length,
|
|
137878
|
+
bufferByteLength: info.byteLength
|
|
137494
137879
|
};
|
|
137495
137880
|
}, "viewInfo"),
|
|
137496
137881
|
shapeOf: /* @__PURE__ */ __name2((value) => {
|
|
@@ -138334,21 +138719,23 @@ function recordStats(stats, codec22, uncompressedBytes, storedBytes) {
|
|
|
138334
138719
|
stats.storedBytes = storedBytes;
|
|
138335
138720
|
}
|
|
138336
138721
|
__name(recordStats, "recordStats");
|
|
138337
|
-
function selectWriteCodec() {
|
|
138722
|
+
function selectWriteCodec(mode) {
|
|
138338
138723
|
const override = codecOverrideFromEnv();
|
|
138339
|
-
if (
|
|
138724
|
+
if (mode === "gzip" || override === "gzip") {
|
|
138725
|
+
return isGzipAvailable() ? "gzip" : "none";
|
|
138726
|
+
}
|
|
138340
138727
|
if (isZstdAvailable()) return "zstd";
|
|
138341
138728
|
if (isGzipAvailable()) return "gzip";
|
|
138342
138729
|
return "none";
|
|
138343
138730
|
}
|
|
138344
138731
|
__name(selectWriteCodec, "selectWriteCodec");
|
|
138345
|
-
async function compress(data22,
|
|
138732
|
+
async function compress(data22, mode, stats, opts) {
|
|
138346
138733
|
if (!(data22 instanceof Uint8Array)) return data22;
|
|
138347
|
-
if (!
|
|
138734
|
+
if (!mode || data22.length < COMPRESSION_MIN_BYTES || isCompressionDisabledByEnv()) {
|
|
138348
138735
|
recordStats(stats, "none", data22.length, data22.length);
|
|
138349
138736
|
return data22;
|
|
138350
138737
|
}
|
|
138351
|
-
const codec22 = selectWriteCodec();
|
|
138738
|
+
const codec22 = selectWriteCodec(mode);
|
|
138352
138739
|
if (codec22 === "none") {
|
|
138353
138740
|
recordStats(stats, "none", data22.length, data22.length);
|
|
138354
138741
|
return data22;
|
|
@@ -141413,7 +141800,7 @@ async function serialize(value, encryptionKey, options) {
|
|
|
141413
141800
|
try {
|
|
141414
141801
|
const payload = devalueCodec.serialize(value, "client", options);
|
|
141415
141802
|
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
141416
|
-
const compressed = await compress(prefixed, options?.compression
|
|
141803
|
+
const compressed = await compress(prefixed, options?.compression ?? false, options?.compressionStats);
|
|
141417
141804
|
return encrypt2(compressed, encryptionKey);
|
|
141418
141805
|
} catch (error612) {
|
|
141419
141806
|
rethrowIfRuntimeError(error612);
|
|
@@ -141458,7 +141845,7 @@ async function serialize2(value, encryptionKey, options) {
|
|
|
141458
141845
|
try {
|
|
141459
141846
|
const payload = devalueCodec.serialize(value, "step", options);
|
|
141460
141847
|
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
141461
|
-
const compressed = await compress(prefixed, options?.compression
|
|
141848
|
+
const compressed = await compress(prefixed, options?.compression ?? false, options?.compressionStats);
|
|
141462
141849
|
return encrypt2(compressed, encryptionKey);
|
|
141463
141850
|
} catch (error612) {
|
|
141464
141851
|
rethrowIfRuntimeError(error612);
|
|
@@ -143518,7 +143905,24 @@ var require_semver3 = __commonJS2({
|
|
|
143518
143905
|
};
|
|
143519
143906
|
}
|
|
143520
143907
|
});
|
|
143521
|
-
function
|
|
143908
|
+
function nodeVersionSupportsZstd(nodeVersion) {
|
|
143909
|
+
if (typeof nodeVersion !== "string" || !import_semver.default.valid(nodeVersion)) {
|
|
143910
|
+
return false;
|
|
143911
|
+
}
|
|
143912
|
+
return import_semver.default.satisfies(nodeVersion, ZSTD_NODE_RANGE);
|
|
143913
|
+
}
|
|
143914
|
+
__name(nodeVersionSupportsZstd, "nodeVersionSupportsZstd");
|
|
143915
|
+
function getCurrentNodeVersion() {
|
|
143916
|
+
try {
|
|
143917
|
+
const versions = globalThis.process?.versions;
|
|
143918
|
+
if (!versions || versions.bun || versions.deno) return void 0;
|
|
143919
|
+
return typeof versions.node === "string" ? versions.node : void 0;
|
|
143920
|
+
} catch {
|
|
143921
|
+
return void 0;
|
|
143922
|
+
}
|
|
143923
|
+
}
|
|
143924
|
+
__name(getCurrentNodeVersion, "getCurrentNodeVersion");
|
|
143925
|
+
function getRunCapabilities(workflowCoreVersion, nodeVersion) {
|
|
143522
143926
|
if (!workflowCoreVersion || !import_semver.default.valid(workflowCoreVersion)) {
|
|
143523
143927
|
return {
|
|
143524
143928
|
supportedFormats: BASELINE_FORMATS,
|
|
@@ -143531,6 +143935,9 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
143531
143935
|
formats.add(format);
|
|
143532
143936
|
}
|
|
143533
143937
|
}
|
|
143938
|
+
if (!nodeVersionSupportsZstd(nodeVersion)) {
|
|
143939
|
+
formats.delete(SerializationFormat.ZSTD);
|
|
143940
|
+
}
|
|
143534
143941
|
const result2 = {
|
|
143535
143942
|
supportedFormats: formats,
|
|
143536
143943
|
framedByteStreams: false
|
|
@@ -143543,10 +143950,18 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
143543
143950
|
return result2;
|
|
143544
143951
|
}
|
|
143545
143952
|
__name(getRunCapabilities, "getRunCapabilities");
|
|
143953
|
+
function getCompressionMode(capabilities) {
|
|
143954
|
+
if (!capabilities.supportedFormats.has(SerializationFormat.GZIP)) {
|
|
143955
|
+
return false;
|
|
143956
|
+
}
|
|
143957
|
+
return capabilities.supportedFormats.has(SerializationFormat.ZSTD) ? true : "gzip";
|
|
143958
|
+
}
|
|
143959
|
+
__name(getCompressionMode, "getCompressionMode");
|
|
143546
143960
|
var import_semver;
|
|
143547
143961
|
var FORMAT_VERSION_TABLE;
|
|
143548
143962
|
var CAPABILITY_VERSION_TABLE;
|
|
143549
143963
|
var BASELINE_FORMATS;
|
|
143964
|
+
var ZSTD_NODE_RANGE;
|
|
143550
143965
|
var init_capabilities = __esm2({
|
|
143551
143966
|
"../core/dist/capabilities.js"() {
|
|
143552
143967
|
"use strict";
|
|
@@ -143562,7 +143977,8 @@ var init_capabilities = __esm2({
|
|
|
143562
143977
|
// bump to the next beta. A too-low cutoff makes new producers write
|
|
143563
143978
|
// compressed payloads to consumers that cannot decompress them; too-high
|
|
143564
143979
|
// merely delays the optimization (safe). gzip and zstd ship together, so
|
|
143565
|
-
// they share a min version
|
|
143980
|
+
// they share a min version. zstd additionally requires the run's runtime to
|
|
143981
|
+
// decode it; see `getRunCapabilities`.
|
|
143566
143982
|
{
|
|
143567
143983
|
format: SerializationFormat.GZIP,
|
|
143568
143984
|
minVersion: "5.0.0-beta.18"
|
|
@@ -143595,14 +144011,18 @@ var init_capabilities = __esm2({
|
|
|
143595
144011
|
BASELINE_FORMATS = /* @__PURE__ */ new Set([
|
|
143596
144012
|
SerializationFormat.DEVALUE_V1
|
|
143597
144013
|
]);
|
|
144014
|
+
ZSTD_NODE_RANGE = "^22.15.0 || >=23.8.0";
|
|
144015
|
+
__name2(nodeVersionSupportsZstd, "nodeVersionSupportsZstd");
|
|
144016
|
+
__name2(getCurrentNodeVersion, "getCurrentNodeVersion");
|
|
143598
144017
|
__name2(getRunCapabilities, "getRunCapabilities");
|
|
144018
|
+
__name2(getCompressionMode, "getCompressionMode");
|
|
143599
144019
|
}
|
|
143600
144020
|
});
|
|
143601
144021
|
var version2;
|
|
143602
144022
|
var init_version = __esm2({
|
|
143603
144023
|
"../core/dist/version.js"() {
|
|
143604
144024
|
"use strict";
|
|
143605
|
-
version2 = "5.0
|
|
144025
|
+
version2 = "5.1.0";
|
|
143606
144026
|
}
|
|
143607
144027
|
});
|
|
143608
144028
|
function isDynamicWorkflowsEnabled() {
|
|
@@ -143718,6 +144138,9 @@ function parseHealthCheckResponse(chunks) {
|
|
|
143718
144138
|
if (typeof r.workflowCoreVersion === "string") {
|
|
143719
144139
|
parsed.workflowCoreVersion = r.workflowCoreVersion;
|
|
143720
144140
|
}
|
|
144141
|
+
if (typeof r.nodeVersion === "string") {
|
|
144142
|
+
parsed.nodeVersion = r.nodeVersion;
|
|
144143
|
+
}
|
|
143721
144144
|
if (typeof r.encryptionPublicKey === "string") {
|
|
143722
144145
|
parsed.encryptionPublicKey = r.encryptionPublicKey;
|
|
143723
144146
|
}
|
|
@@ -143798,6 +144221,7 @@ var init_helpers = __esm2({
|
|
|
143798
144221
|
init_dist2();
|
|
143799
144222
|
init_dist4();
|
|
143800
144223
|
init_node();
|
|
144224
|
+
init_capabilities();
|
|
143801
144225
|
init_logger();
|
|
143802
144226
|
init_sealed_box();
|
|
143803
144227
|
init_encryption2();
|
|
@@ -148936,11 +149360,13 @@ function resumeContextFromRun(run22) {
|
|
|
148936
149360
|
const coreVersion = run22.executionContext?.workflowCoreVersion;
|
|
148937
149361
|
const traceCarrier = run22.executionContext?.traceCarrier;
|
|
148938
149362
|
const hookResumeInputVersion = run22.executionContext?.hookResumeInputVersion;
|
|
149363
|
+
const nodeVersion = run22.executionContext?.nodeVersion;
|
|
148939
149364
|
return {
|
|
148940
149365
|
deploymentId: run22.deploymentId,
|
|
148941
149366
|
workflowName: run22.workflowName,
|
|
148942
149367
|
runSpecVersion: run22.specVersion,
|
|
148943
149368
|
workflowCoreVersion: typeof coreVersion === "string" ? coreVersion : void 0,
|
|
149369
|
+
nodeVersion: typeof nodeVersion === "string" ? nodeVersion : void 0,
|
|
148944
149370
|
traceCarrier: traceCarrier && typeof traceCarrier === "object" ? traceCarrier : void 0,
|
|
148945
149371
|
encryptionPublicKey: run22.encryptionPublicKey,
|
|
148946
149372
|
hookResumeInputVersion: typeof hookResumeInputVersion === "number" ? hookResumeInputVersion : void 0
|
|
@@ -149146,7 +149572,7 @@ async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKe
|
|
|
149146
149572
|
if (info.run && isTerminalWorkflowRunStatus(info.run.status)) {
|
|
149147
149573
|
throw new HookNotFoundError(hook.token);
|
|
149148
149574
|
}
|
|
149149
|
-
const capabilities = getRunCapabilities(resumeContext.workflowCoreVersion);
|
|
149575
|
+
const capabilities = getRunCapabilities(resumeContext.workflowCoreVersion, resumeContext.nodeVersion);
|
|
149150
149576
|
let payloadKey;
|
|
149151
149577
|
const runPublicKey = encryptionKeyOverride ? (
|
|
149152
149578
|
// hydrate hook metadata), so sealing would add an ECDH for no
|
|
@@ -149162,7 +149588,7 @@ async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKe
|
|
|
149162
149588
|
}
|
|
149163
149589
|
payloadKey = encryptionKey;
|
|
149164
149590
|
}
|
|
149165
|
-
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION
|
|
149591
|
+
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION ? getCompressionMode(capabilities) : false;
|
|
149166
149592
|
const ops = [];
|
|
149167
149593
|
const readbackOps = [];
|
|
149168
149594
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
@@ -150571,7 +150997,7 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey, option
|
|
|
150571
150997
|
};
|
|
150572
150998
|
}
|
|
150573
150999
|
__name(getExternalRevivers, "getExternalRevivers");
|
|
150574
|
-
function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deploymentId, streamStates) {
|
|
151000
|
+
function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deploymentId, streamStates, runReadyBarrier) {
|
|
150575
151001
|
return {
|
|
150576
151002
|
...getCommonRevivers2(global2),
|
|
150577
151003
|
// StepFunction reviver for step context - returns raw step function
|
|
@@ -150690,7 +151116,7 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
150690
151116
|
pollReadableLock(userReadable, state);
|
|
150691
151117
|
return userReadable;
|
|
150692
151118
|
} else {
|
|
150693
|
-
const transform22 = getDeserializeStream(getStepRevivers(global2, ops, runId, cryptoKey, deploymentId), cryptoKey);
|
|
151119
|
+
const transform22 = getDeserializeStream(getStepRevivers(global2, ops, runId, cryptoKey, deploymentId, streamStates, runReadyBarrier), cryptoKey);
|
|
150694
151120
|
const state = createFlushableState();
|
|
150695
151121
|
ops.push(state.promise);
|
|
150696
151122
|
flushablePipe(readable, transform22.writable, state).catch(() => {
|
|
@@ -150703,8 +151129,9 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
150703
151129
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
150704
151130
|
const targetDeploymentId = typeof value.deploymentId === "string" ? value.deploymentId : targetRunId === runId ? deploymentId : void 0;
|
|
150705
151131
|
const targetKey = targetRunId === runId ? cryptoKey : lazyForwardedWritableEncryptionKey(targetRunId, targetDeploymentId, value.encryptionPublicKey);
|
|
150706
|
-
const
|
|
150707
|
-
const
|
|
151132
|
+
const targetRunReady = targetRunId === runId ? runReadyBarrier : void 0;
|
|
151133
|
+
const serialize32 = getSerializeStream(getStepReducers(global2, ops, targetRunId, targetKey, false, targetRunReady), targetKey);
|
|
151134
|
+
const serverWritable = new WorkflowServerWritableStream(targetRunId, value.name, targetRunReady);
|
|
150708
151135
|
const state = createFlushableState();
|
|
150709
151136
|
state.deferReleaseSettlement = streamStates !== void 0;
|
|
150710
151137
|
streamStates?.push(state);
|
|
@@ -150819,12 +151246,12 @@ async function dehydrateStepArguments(value, _runId, key, global2 = globalThis,
|
|
|
150819
151246
|
}
|
|
150820
151247
|
}
|
|
150821
151248
|
__name(dehydrateStepArguments, "dehydrateStepArguments");
|
|
150822
|
-
async function hydrateStepArguments(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId, streamStates) {
|
|
151249
|
+
async function hydrateStepArguments(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId, streamStates, runReadyBarrier) {
|
|
150823
151250
|
const compressionStats = {};
|
|
150824
151251
|
const result2 = await deserialize2(value, key, {
|
|
150825
151252
|
global: global2,
|
|
150826
151253
|
extraRevivers: {
|
|
150827
|
-
...getStreamAndRequestRevivers(getStepRevivers(global2, ops, runId, key, deploymentId, streamStates)),
|
|
151254
|
+
...getStreamAndRequestRevivers(getStepRevivers(global2, ops, runId, key, deploymentId, streamStates, runReadyBarrier)),
|
|
150828
151255
|
...extraRevivers
|
|
150829
151256
|
},
|
|
150830
151257
|
compressionStats
|
|
@@ -151296,6 +151723,14 @@ var init_serialization2 = __esm2({
|
|
|
151296
151723
|
enumerable: false,
|
|
151297
151724
|
writable: false
|
|
151298
151725
|
});
|
|
151726
|
+
Object.defineProperty(this, STREAM_RELEASE_SYMBOL, {
|
|
151727
|
+
value: /* @__PURE__ */ __name2(async () => {
|
|
151728
|
+
const session = await writeSessionPromise.catch(() => void 0);
|
|
151729
|
+
await session?.release?.();
|
|
151730
|
+
}, "value"),
|
|
151731
|
+
enumerable: false,
|
|
151732
|
+
writable: false
|
|
151733
|
+
});
|
|
151299
151734
|
}
|
|
151300
151735
|
};
|
|
151301
151736
|
__name2(getAllBaseReducers, "getAllBaseReducers");
|
|
@@ -158681,20 +159116,23 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
158681
159116
|
throw dynamicStartRefusal("Dynamic workflows require a World that declares `capabilities.dynamicWorkflowCode`. This World does not, so no run was created.");
|
|
158682
159117
|
}
|
|
158683
159118
|
let framedByteStreams;
|
|
158684
|
-
let
|
|
159119
|
+
let targetCompression;
|
|
159120
|
+
let targetNodeVersion;
|
|
158685
159121
|
let targetHookResumeInputVersion;
|
|
158686
159122
|
let probedRunPublicKey;
|
|
158687
159123
|
let targetSpecVersion;
|
|
158688
159124
|
let specVersionSource;
|
|
158689
159125
|
if (!crossDeployment) {
|
|
158690
159126
|
framedByteStreams = true;
|
|
158691
|
-
|
|
159127
|
+
targetCompression = true;
|
|
159128
|
+
targetNodeVersion = getCurrentNodeVersion();
|
|
158692
159129
|
targetHookResumeInputVersion = HOOK_RESUME_INPUT_VERSION;
|
|
158693
159130
|
targetSpecVersion = world.specVersion;
|
|
158694
159131
|
specVersionSource = "same-deployment";
|
|
158695
159132
|
} else if (typeof world.streams?.get !== "function") {
|
|
158696
159133
|
framedByteStreams = false;
|
|
158697
|
-
|
|
159134
|
+
targetCompression = false;
|
|
159135
|
+
targetNodeVersion = void 0;
|
|
158698
159136
|
targetHookResumeInputVersion = void 0;
|
|
158699
159137
|
({ specVersion: targetSpecVersion, source: specVersionSource } = resolveCrossDeploymentSpecVersion(void 0, world.specVersion));
|
|
158700
159138
|
} else {
|
|
@@ -158704,9 +159142,10 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
158704
159142
|
namespace: opts.namespace
|
|
158705
159143
|
});
|
|
158706
159144
|
probedRunPublicKey = probe?.encryptionPublicKey;
|
|
158707
|
-
const capabilities = getRunCapabilities(probe?.workflowCoreVersion);
|
|
159145
|
+
const capabilities = getRunCapabilities(probe?.workflowCoreVersion, probe?.nodeVersion);
|
|
158708
159146
|
framedByteStreams = capabilities.framedByteStreams;
|
|
158709
|
-
|
|
159147
|
+
targetCompression = getCompressionMode(capabilities);
|
|
159148
|
+
targetNodeVersion = probe?.nodeVersion;
|
|
158710
159149
|
targetHookResumeInputVersion = probe?.hookResumeInputVersion;
|
|
158711
159150
|
({ specVersion: targetSpecVersion, source: specVersionSource } = resolveCrossDeploymentSpecVersion(probe, world.specVersion));
|
|
158712
159151
|
span?.setAttributes({
|
|
@@ -158798,6 +159237,9 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
158798
159237
|
const executionContext = {
|
|
158799
159238
|
traceCarrier,
|
|
158800
159239
|
workflowCoreVersion: version2,
|
|
159240
|
+
...targetNodeVersion ? {
|
|
159241
|
+
nodeVersion: targetNodeVersion
|
|
159242
|
+
} : {},
|
|
158801
159243
|
features: {
|
|
158802
159244
|
encryption: !!encryptionKey
|
|
158803
159245
|
},
|
|
@@ -158824,7 +159266,7 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
158824
159266
|
throw dynamicStartRefusalFrom(err);
|
|
158825
159267
|
}
|
|
158826
159268
|
}
|
|
158827
|
-
const compression =
|
|
159269
|
+
const compression = specVersion >= SPEC_VERSION_SUPPORTS_COMPRESSION ? targetCompression : false;
|
|
158828
159270
|
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat, framedByteStreams, compression);
|
|
158829
159271
|
let dynamicWorkflowCode;
|
|
158830
159272
|
let dynamicWorkflowCodeRef;
|
|
@@ -158960,7 +159402,7 @@ __name2(start, "start");
|
|
|
158960
159402
|
value: "start",
|
|
158961
159403
|
configurable: true
|
|
158962
159404
|
});
|
|
158963
|
-
})(start, "step//@workflow/core/runtime/start@5.0
|
|
159405
|
+
})(start, "step//@workflow/core/runtime/start@5.1.0//start");
|
|
158964
159406
|
async function wakeUpRun(world, runId, options) {
|
|
158965
159407
|
try {
|
|
158966
159408
|
const run22 = await world.runs.get(runId, {
|
|
@@ -159438,7 +159880,7 @@ var Run = class _Run {
|
|
|
159438
159880
|
value: "wakeUp",
|
|
159439
159881
|
configurable: true
|
|
159440
159882
|
});
|
|
159441
|
-
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0
|
|
159883
|
+
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.1.0//Run#wakeUp");
|
|
159442
159884
|
(function(__wf_fn, __wf_id) {
|
|
159443
159885
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159444
159886
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159447,7 +159889,7 @@ var Run = class _Run {
|
|
|
159447
159889
|
value: "cancel",
|
|
159448
159890
|
configurable: true
|
|
159449
159891
|
});
|
|
159450
|
-
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0
|
|
159892
|
+
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.1.0//Run#cancel");
|
|
159451
159893
|
(function(__wf_fn, __wf_id) {
|
|
159452
159894
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159453
159895
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159456,7 +159898,7 @@ var Run = class _Run {
|
|
|
159456
159898
|
value: "getReadable",
|
|
159457
159899
|
configurable: true
|
|
159458
159900
|
});
|
|
159459
|
-
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0
|
|
159901
|
+
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.1.0//Run#getReadable");
|
|
159460
159902
|
(function(__wf_fn, __wf_id) {
|
|
159461
159903
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159462
159904
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159465,7 +159907,7 @@ var Run = class _Run {
|
|
|
159465
159907
|
value: "getWritable",
|
|
159466
159908
|
configurable: true
|
|
159467
159909
|
});
|
|
159468
|
-
})(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.0
|
|
159910
|
+
})(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.1.0//Run#getWritable");
|
|
159469
159911
|
(function(__wf_fn, __wf_id) {
|
|
159470
159912
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159471
159913
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159474,7 +159916,7 @@ var Run = class _Run {
|
|
|
159474
159916
|
value: "exists",
|
|
159475
159917
|
configurable: true
|
|
159476
159918
|
});
|
|
159477
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0
|
|
159919
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.1.0//Run#exists");
|
|
159478
159920
|
(function(__wf_fn, __wf_id) {
|
|
159479
159921
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159480
159922
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159483,7 +159925,7 @@ var Run = class _Run {
|
|
|
159483
159925
|
value: "status",
|
|
159484
159926
|
configurable: true
|
|
159485
159927
|
});
|
|
159486
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0
|
|
159928
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.1.0//Run#status");
|
|
159487
159929
|
(function(__wf_fn, __wf_id) {
|
|
159488
159930
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159489
159931
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159492,7 +159934,7 @@ var Run = class _Run {
|
|
|
159492
159934
|
value: "returnValue",
|
|
159493
159935
|
configurable: true
|
|
159494
159936
|
});
|
|
159495
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0
|
|
159937
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.1.0//Run#returnValue");
|
|
159496
159938
|
(function(__wf_fn, __wf_id) {
|
|
159497
159939
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159498
159940
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159501,7 +159943,7 @@ var Run = class _Run {
|
|
|
159501
159943
|
value: "workflowName",
|
|
159502
159944
|
configurable: true
|
|
159503
159945
|
});
|
|
159504
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0
|
|
159946
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.1.0//Run#workflowName");
|
|
159505
159947
|
(function(__wf_fn, __wf_id) {
|
|
159506
159948
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159507
159949
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159510,7 +159952,7 @@ var Run = class _Run {
|
|
|
159510
159952
|
value: "createdAt",
|
|
159511
159953
|
configurable: true
|
|
159512
159954
|
});
|
|
159513
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0
|
|
159955
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.1.0//Run#createdAt");
|
|
159514
159956
|
(function(__wf_fn, __wf_id) {
|
|
159515
159957
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159516
159958
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159519,7 +159961,7 @@ var Run = class _Run {
|
|
|
159519
159961
|
value: "startedAt",
|
|
159520
159962
|
configurable: true
|
|
159521
159963
|
});
|
|
159522
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0
|
|
159964
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.1.0//Run#startedAt");
|
|
159523
159965
|
(function(__wf_fn, __wf_id) {
|
|
159524
159966
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159525
159967
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -159528,7 +159970,7 @@ var Run = class _Run {
|
|
|
159528
159970
|
value: "completedAt",
|
|
159529
159971
|
configurable: true
|
|
159530
159972
|
});
|
|
159531
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0
|
|
159973
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.1.0//Run#completedAt");
|
|
159532
159974
|
(function(__wf_cls, __wf_id) {
|
|
159533
159975
|
var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
159534
159976
|
__wf_reg.set(__wf_id, __wf_cls);
|
|
@@ -159538,7 +159980,7 @@ var Run = class _Run {
|
|
|
159538
159980
|
enumerable: false,
|
|
159539
159981
|
configurable: false
|
|
159540
159982
|
});
|
|
159541
|
-
})(Run, "class//@workflow/core/runtime/run@5.0
|
|
159983
|
+
})(Run, "class//@workflow/core/runtime/run@5.1.0//Run");
|
|
159542
159984
|
async function fetch2(...args) {
|
|
159543
159985
|
return globalThis.fetch(...args);
|
|
159544
159986
|
}
|
|
@@ -166168,6 +166610,14 @@ __name(globalSingleton, "globalSingleton");
|
|
|
166168
166610
|
// ../utils/dist/time.js
|
|
166169
166611
|
var import_ms = __toESM(require_ms(), 1);
|
|
166170
166612
|
function parseDurationToDate(param) {
|
|
166613
|
+
const date5 = durationToDate(param);
|
|
166614
|
+
if (Number.isNaN(date5.getTime())) {
|
|
166615
|
+
throw new Error(typeof param === "object" ? "Invalid date: the Date object does not hold a valid time." : \`Invalid duration: \${JSON.stringify(param)} ends past the latest time a Date can represent.\`);
|
|
166616
|
+
}
|
|
166617
|
+
return date5;
|
|
166618
|
+
}
|
|
166619
|
+
__name(parseDurationToDate, "parseDurationToDate");
|
|
166620
|
+
function durationToDate(param) {
|
|
166171
166621
|
if (typeof param === "string") {
|
|
166172
166622
|
const durationMs = (0, import_ms.default)(param);
|
|
166173
166623
|
if (typeof durationMs !== "number" || durationMs < 0) {
|
|
@@ -166185,7 +166635,7 @@ function parseDurationToDate(param) {
|
|
|
166185
166635
|
throw new Error(\`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.\`);
|
|
166186
166636
|
}
|
|
166187
166637
|
}
|
|
166188
|
-
__name(
|
|
166638
|
+
__name(durationToDate, "durationToDate");
|
|
166189
166639
|
|
|
166190
166640
|
// ../errors/dist/error-codes.js
|
|
166191
166641
|
var RUN_ERROR_CODES = {
|
|
@@ -166590,11 +167040,11 @@ var Run = class _Run {
|
|
|
166590
167040
|
return this.getWritable();
|
|
166591
167041
|
}
|
|
166592
167042
|
};
|
|
166593
|
-
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
166594
|
-
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
166595
|
-
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
166596
|
-
Run.prototype["getWritable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
166597
|
-
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
167043
|
+
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#wakeUp");
|
|
167044
|
+
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#cancel");
|
|
167045
|
+
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#getReadable");
|
|
167046
|
+
Run.prototype["getWritable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#getWritable");
|
|
167047
|
+
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#exists");
|
|
166598
167048
|
Object.defineProperty(Run.prototype, "exists", {
|
|
166599
167049
|
get() {
|
|
166600
167050
|
return __step_Run$exists.call(this);
|
|
@@ -166602,7 +167052,7 @@ Object.defineProperty(Run.prototype, "exists", {
|
|
|
166602
167052
|
configurable: true,
|
|
166603
167053
|
enumerable: false
|
|
166604
167054
|
});
|
|
166605
|
-
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
167055
|
+
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#status");
|
|
166606
167056
|
Object.defineProperty(Run.prototype, "status", {
|
|
166607
167057
|
get() {
|
|
166608
167058
|
return __step_Run$status.call(this);
|
|
@@ -166610,7 +167060,7 @@ Object.defineProperty(Run.prototype, "status", {
|
|
|
166610
167060
|
configurable: true,
|
|
166611
167061
|
enumerable: false
|
|
166612
167062
|
});
|
|
166613
|
-
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
167063
|
+
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#returnValue");
|
|
166614
167064
|
Object.defineProperty(Run.prototype, "returnValue", {
|
|
166615
167065
|
get() {
|
|
166616
167066
|
return __step_Run$returnValue.call(this);
|
|
@@ -166618,7 +167068,7 @@ Object.defineProperty(Run.prototype, "returnValue", {
|
|
|
166618
167068
|
configurable: true,
|
|
166619
167069
|
enumerable: false
|
|
166620
167070
|
});
|
|
166621
|
-
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
167071
|
+
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#workflowName");
|
|
166622
167072
|
Object.defineProperty(Run.prototype, "workflowName", {
|
|
166623
167073
|
get() {
|
|
166624
167074
|
return __step_Run$workflowName.call(this);
|
|
@@ -166626,7 +167076,7 @@ Object.defineProperty(Run.prototype, "workflowName", {
|
|
|
166626
167076
|
configurable: true,
|
|
166627
167077
|
enumerable: false
|
|
166628
167078
|
});
|
|
166629
|
-
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
167079
|
+
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#createdAt");
|
|
166630
167080
|
Object.defineProperty(Run.prototype, "createdAt", {
|
|
166631
167081
|
get() {
|
|
166632
167082
|
return __step_Run$createdAt.call(this);
|
|
@@ -166634,7 +167084,7 @@ Object.defineProperty(Run.prototype, "createdAt", {
|
|
|
166634
167084
|
configurable: true,
|
|
166635
167085
|
enumerable: false
|
|
166636
167086
|
});
|
|
166637
|
-
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
167087
|
+
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#startedAt");
|
|
166638
167088
|
Object.defineProperty(Run.prototype, "startedAt", {
|
|
166639
167089
|
get() {
|
|
166640
167090
|
return __step_Run$startedAt.call(this);
|
|
@@ -166642,7 +167092,7 @@ Object.defineProperty(Run.prototype, "startedAt", {
|
|
|
166642
167092
|
configurable: true,
|
|
166643
167093
|
enumerable: false
|
|
166644
167094
|
});
|
|
166645
|
-
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0
|
|
167095
|
+
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.1.0//Run#completedAt");
|
|
166646
167096
|
Object.defineProperty(Run.prototype, "completedAt", {
|
|
166647
167097
|
get() {
|
|
166648
167098
|
return __step_Run$completedAt.call(this);
|
|
@@ -166659,7 +167109,7 @@ Object.defineProperty(Run.prototype, "completedAt", {
|
|
|
166659
167109
|
enumerable: false,
|
|
166660
167110
|
configurable: false
|
|
166661
167111
|
});
|
|
166662
|
-
})(Run, "class//@workflow/core/runtime/run@5.0
|
|
167112
|
+
})(Run, "class//@workflow/core/runtime/run@5.1.0//Run");
|
|
166663
167113
|
|
|
166664
167114
|
// ../core/dist/workflow/create-hook.js
|
|
166665
167115
|
aliasSerializationClass(RUN_CLASS_ID, Run);
|
|
@@ -188766,6 +189216,11 @@ var HookResumeContextSchema = external_exports.compile(external_exports.object({
|
|
|
188766
189216
|
// Named \`runSpecVersion\` to distinguish it from the hook's own \`specVersion\`.
|
|
188767
189217
|
runSpecVersion: external_exports.number().optional(),
|
|
188768
189218
|
workflowCoreVersion: external_exports.string().optional(),
|
|
189219
|
+
// Node.js version of the run's creating deployment, mirrored from
|
|
189220
|
+
// \`executionContext.nodeVersion\`. Decides whether a resume may write zstd
|
|
189221
|
+
// (which needs Node.js >= 22.15) or must use gzip. Absent on runs created
|
|
189222
|
+
// before the field existed and on non-Node runtimes, where writers use gzip.
|
|
189223
|
+
nodeVersion: external_exports.string().optional(),
|
|
188769
189224
|
traceCarrier: TraceCarrierSchema.optional(),
|
|
188770
189225
|
// The run's published X25519 public key (base64), mirrored from the run
|
|
188771
189226
|
// entity. Lets a resume seal (\`encp\`) its payload to the run without reading
|
|
@@ -188952,7 +189407,7 @@ var latestNoOpWarning = globalSingleton("@workflow/core//latestNoOpWarning", 1,
|
|
|
188952
189407
|
var probeMissWarning = globalSingleton("@workflow/core//crossDeploymentProbeMissWarning", 1, () => ({
|
|
188953
189408
|
warned: false
|
|
188954
189409
|
}));
|
|
188955
|
-
var start = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/start@5.0
|
|
189410
|
+
var start = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/start@5.1.0//start");
|
|
188956
189411
|
|
|
188957
189412
|
// workflows/lineage.ts
|
|
188958
189413
|
var noop = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//./workflows/lineage//noop");
|