@workflow/world-testing 5.0.0-beta.48 → 5.0.0-beta.49
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.
|
@@ -709,10 +709,10 @@ function mergeDefs2(...defs) {
|
|
|
709
709
|
function cloneDef2(schema) {
|
|
710
710
|
return mergeDefs2(schema._zod.def);
|
|
711
711
|
}
|
|
712
|
-
function getElementAtPath2(obj,
|
|
713
|
-
if (!
|
|
712
|
+
function getElementAtPath2(obj, path15) {
|
|
713
|
+
if (!path15)
|
|
714
714
|
return obj;
|
|
715
|
-
return
|
|
715
|
+
return path15.reduce((acc, key) => acc?.[key], obj);
|
|
716
716
|
}
|
|
717
717
|
function promiseAllObject2(promisesObj) {
|
|
718
718
|
const keys = Object.keys(promisesObj);
|
|
@@ -1024,11 +1024,11 @@ function aborted2(x, startIndex = 0) {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
return false;
|
|
1026
1026
|
}
|
|
1027
|
-
function prefixIssues2(
|
|
1027
|
+
function prefixIssues2(path15, issues) {
|
|
1028
1028
|
return issues.map((iss) => {
|
|
1029
1029
|
var _a4;
|
|
1030
1030
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
1031
|
-
iss.path.unshift(
|
|
1031
|
+
iss.path.unshift(path15);
|
|
1032
1032
|
return iss;
|
|
1033
1033
|
});
|
|
1034
1034
|
}
|
|
@@ -1327,7 +1327,7 @@ function formatError2(error95, mapper = (issue3) => issue3.message) {
|
|
|
1327
1327
|
}
|
|
1328
1328
|
function treeifyError2(error95, mapper = (issue3) => issue3.message) {
|
|
1329
1329
|
const result2 = { errors: [] };
|
|
1330
|
-
const processError = /* @__PURE__ */ __name((error96,
|
|
1330
|
+
const processError = /* @__PURE__ */ __name((error96, path15 = []) => {
|
|
1331
1331
|
var _a4, _b;
|
|
1332
1332
|
for (const issue3 of error96.issues) {
|
|
1333
1333
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -1337,7 +1337,7 @@ function treeifyError2(error95, mapper = (issue3) => issue3.message) {
|
|
|
1337
1337
|
} else if (issue3.code === "invalid_element") {
|
|
1338
1338
|
processError({ issues: issue3.issues }, issue3.path);
|
|
1339
1339
|
} else {
|
|
1340
|
-
const fullpath = [...
|
|
1340
|
+
const fullpath = [...path15, ...issue3.path];
|
|
1341
1341
|
if (fullpath.length === 0) {
|
|
1342
1342
|
result2.errors.push(mapper(issue3));
|
|
1343
1343
|
continue;
|
|
@@ -1369,8 +1369,8 @@ function treeifyError2(error95, mapper = (issue3) => issue3.message) {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
function toDotPath2(_path) {
|
|
1371
1371
|
const segs = [];
|
|
1372
|
-
const
|
|
1373
|
-
for (const seg of
|
|
1372
|
+
const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1373
|
+
for (const seg of path15) {
|
|
1374
1374
|
if (typeof seg === "number")
|
|
1375
1375
|
segs.push(`[${seg}]`);
|
|
1376
1376
|
else if (typeof seg === "symbol")
|
|
@@ -14425,13 +14425,13 @@ function resolveRef2(ref, ctx) {
|
|
|
14425
14425
|
if (!ref.startsWith("#")) {
|
|
14426
14426
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14427
14427
|
}
|
|
14428
|
-
const
|
|
14429
|
-
if (
|
|
14428
|
+
const path15 = ref.slice(1).split("/").filter(Boolean);
|
|
14429
|
+
if (path15.length === 0) {
|
|
14430
14430
|
return ctx.rootSchema;
|
|
14431
14431
|
}
|
|
14432
14432
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14433
|
-
if (
|
|
14434
|
-
const key =
|
|
14433
|
+
if (path15[0] === defsKey) {
|
|
14434
|
+
const key = path15[1];
|
|
14435
14435
|
if (!key || !ctx.defs[key]) {
|
|
14436
14436
|
throw new Error(`Reference not found: ${ref}`);
|
|
14437
14437
|
}
|
|
@@ -15203,6 +15203,24 @@ var init_zod2 = __esm({
|
|
|
15203
15203
|
});
|
|
15204
15204
|
|
|
15205
15205
|
// ../world/dist/attributes-validation.js
|
|
15206
|
+
function readRunRetention(attributes) {
|
|
15207
|
+
const raw = attributes?.[RETENTION_ATTRIBUTE2];
|
|
15208
|
+
if (raw === void 0) {
|
|
15209
|
+
return { mode: "default", wellFormed: false, unsupported: false };
|
|
15210
|
+
}
|
|
15211
|
+
if (RETENTION_INTEGER_PATTERN.test(raw)) {
|
|
15212
|
+
return raw === RETENTION_ZERO ? { mode: "none", raw, wellFormed: true, unsupported: false } : { mode: "default", raw, wellFormed: true, unsupported: true };
|
|
15213
|
+
}
|
|
15214
|
+
return {
|
|
15215
|
+
mode: "default",
|
|
15216
|
+
raw,
|
|
15217
|
+
wellFormed: false,
|
|
15218
|
+
unsupported: raw !== RETENTION_DEFAULT
|
|
15219
|
+
};
|
|
15220
|
+
}
|
|
15221
|
+
function purgesUserDataOnFinish(attributes) {
|
|
15222
|
+
return readRunRetention(attributes).mode === "none";
|
|
15223
|
+
}
|
|
15206
15224
|
function assertValidAttributeKey2(key, allowReservedAttributes) {
|
|
15207
15225
|
if (typeof key !== "string") {
|
|
15208
15226
|
throw new AttributeValidationError2(`Attribute key must be a string, got ${typeof key}`);
|
|
@@ -15266,13 +15284,19 @@ function applyAttributeChanges(existing, changes) {
|
|
|
15266
15284
|
}
|
|
15267
15285
|
return next2;
|
|
15268
15286
|
}
|
|
15269
|
-
var RESERVED_ATTRIBUTE_KEY_PREFIX2, ROOT_RUN_ID_ATTRIBUTE2, PARENT_RUN_ID_ATTRIBUTE2, ATTRIBUTE_KEY_MAX_LENGTH2, ATTRIBUTE_VALUE_MAX_BYTES2, ATTRIBUTE_MAX_PER_RUN2, textEncoder3, AttributeValidationError2;
|
|
15287
|
+
var RESERVED_ATTRIBUTE_KEY_PREFIX2, ROOT_RUN_ID_ATTRIBUTE2, PARENT_RUN_ID_ATTRIBUTE2, RETENTION_ATTRIBUTE2, RETENTION_ZERO, RETENTION_DEFAULT, RETENTION_INTEGER_PATTERN, ATTRIBUTE_KEY_MAX_LENGTH2, ATTRIBUTE_VALUE_MAX_BYTES2, ATTRIBUTE_MAX_PER_RUN2, textEncoder3, AttributeValidationError2;
|
|
15270
15288
|
var init_attributes_validation2 = __esm({
|
|
15271
15289
|
"../world/dist/attributes-validation.js"() {
|
|
15272
15290
|
"use strict";
|
|
15273
15291
|
RESERVED_ATTRIBUTE_KEY_PREFIX2 = "$";
|
|
15274
15292
|
ROOT_RUN_ID_ATTRIBUTE2 = `${RESERVED_ATTRIBUTE_KEY_PREFIX2}rootRunId`;
|
|
15275
15293
|
PARENT_RUN_ID_ATTRIBUTE2 = `${RESERVED_ATTRIBUTE_KEY_PREFIX2}parentRunId`;
|
|
15294
|
+
RETENTION_ATTRIBUTE2 = `${RESERVED_ATTRIBUTE_KEY_PREFIX2}retention`;
|
|
15295
|
+
RETENTION_ZERO = "0";
|
|
15296
|
+
RETENTION_DEFAULT = "default";
|
|
15297
|
+
RETENTION_INTEGER_PATTERN = /^(?:0|[1-9]\d*)$/;
|
|
15298
|
+
__name(readRunRetention, "readRunRetention");
|
|
15299
|
+
__name(purgesUserDataOnFinish, "purgesUserDataOnFinish");
|
|
15276
15300
|
ATTRIBUTE_KEY_MAX_LENGTH2 = 256;
|
|
15277
15301
|
ATTRIBUTE_VALUE_MAX_BYTES2 = 256;
|
|
15278
15302
|
ATTRIBUTE_MAX_PER_RUN2 = 64;
|
|
@@ -17133,6 +17157,9 @@ __export(dist_exports, {
|
|
|
17133
17157
|
QueuePayloadSchema: () => QueuePayloadSchema2,
|
|
17134
17158
|
QueuePrefix: () => QueuePrefix2,
|
|
17135
17159
|
RESERVED_ATTRIBUTE_KEY_PREFIX: () => RESERVED_ATTRIBUTE_KEY_PREFIX2,
|
|
17160
|
+
RETENTION_ATTRIBUTE: () => RETENTION_ATTRIBUTE2,
|
|
17161
|
+
RETENTION_DEFAULT: () => RETENTION_DEFAULT,
|
|
17162
|
+
RETENTION_ZERO: () => RETENTION_ZERO,
|
|
17136
17163
|
ROOT_RUN_ID_ATTRIBUTE: () => ROOT_RUN_ID_ATTRIBUTE2,
|
|
17137
17164
|
RUN_ENTITY_KEY: () => RUN_ENTITY_KEY,
|
|
17138
17165
|
RUN_EVENT_TYPES: () => RUN_EVENT_TYPES2,
|
|
@@ -17197,6 +17224,8 @@ __export(dist_exports, {
|
|
|
17197
17224
|
isWaitEventType: () => isWaitEventType,
|
|
17198
17225
|
mintedSpecVersion: () => mintedSpecVersion,
|
|
17199
17226
|
parseQueueName: () => parseQueueName,
|
|
17227
|
+
purgesUserDataOnFinish: () => purgesUserDataOnFinish,
|
|
17228
|
+
readRunRetention: () => readRunRetention,
|
|
17200
17229
|
reenqueueActiveRuns: () => reenqueueActiveRuns,
|
|
17201
17230
|
requireEventSlot: () => requireEventSlot,
|
|
17202
17231
|
requiresNewerWorld: () => requiresNewerWorld,
|
|
@@ -17630,8 +17659,14 @@ Caused by: ${options.cause.stack}`;
|
|
|
17630
17659
|
static {
|
|
17631
17660
|
__name(this, "RunExpiredError");
|
|
17632
17661
|
}
|
|
17633
|
-
|
|
17634
|
-
|
|
17662
|
+
runId;
|
|
17663
|
+
runStatus;
|
|
17664
|
+
expiredAt;
|
|
17665
|
+
constructor(message, runId, runStatus, expiredAt) {
|
|
17666
|
+
super(message, { status: 410, code: "run-expired" });
|
|
17667
|
+
this.runId = runId;
|
|
17668
|
+
this.runStatus = runStatus;
|
|
17669
|
+
this.expiredAt = expiredAt;
|
|
17635
17670
|
this.name = "RunExpiredError";
|
|
17636
17671
|
}
|
|
17637
17672
|
static is(value) {
|
|
@@ -18374,7 +18409,7 @@ async function write(filePath, data, opts) {
|
|
|
18374
18409
|
}
|
|
18375
18410
|
async function readJSON(filePath, decoder6) {
|
|
18376
18411
|
try {
|
|
18377
|
-
const content = await fs.readFile(filePath, "utf-8");
|
|
18412
|
+
const content = await withWindowsRetry(() => fs.readFile(filePath, "utf-8"));
|
|
18378
18413
|
return decoder6.parse(JSON.parse(content, jsonReviver));
|
|
18379
18414
|
} catch (error95) {
|
|
18380
18415
|
if (error95.code === "ENOENT")
|
|
@@ -22367,14 +22402,14 @@ var require_util = __commonJS({
|
|
|
22367
22402
|
}
|
|
22368
22403
|
const port = url3.port != null ? url3.port : url3.protocol === "https:" ? 443 : 80;
|
|
22369
22404
|
let origin = url3.origin != null ? url3.origin : `${url3.protocol || ""}//${url3.hostname || ""}:${port}`;
|
|
22370
|
-
let
|
|
22405
|
+
let path15 = url3.path != null ? url3.path : `${url3.pathname || ""}${url3.search || ""}`;
|
|
22371
22406
|
if (origin[origin.length - 1] === "/") {
|
|
22372
22407
|
origin = origin.slice(0, origin.length - 1);
|
|
22373
22408
|
}
|
|
22374
|
-
if (
|
|
22375
|
-
|
|
22409
|
+
if (path15 && path15[0] !== "/") {
|
|
22410
|
+
path15 = `/${path15}`;
|
|
22376
22411
|
}
|
|
22377
|
-
return new URL(`${origin}${
|
|
22412
|
+
return new URL(`${origin}${path15}`);
|
|
22378
22413
|
}
|
|
22379
22414
|
if (!isHttpOrHttpsPrefixed(url3.origin || url3.protocol)) {
|
|
22380
22415
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -23234,9 +23269,9 @@ var require_diagnostics = __commonJS({
|
|
|
23234
23269
|
"undici:client:sendHeaders",
|
|
23235
23270
|
(evt) => {
|
|
23236
23271
|
const {
|
|
23237
|
-
request: { method, path:
|
|
23272
|
+
request: { method, path: path15, origin }
|
|
23238
23273
|
} = evt;
|
|
23239
|
-
debugLog2("sending request to %s %s%s", method, origin,
|
|
23274
|
+
debugLog2("sending request to %s %s%s", method, origin, path15);
|
|
23240
23275
|
}
|
|
23241
23276
|
);
|
|
23242
23277
|
}
|
|
@@ -23255,14 +23290,14 @@ var require_diagnostics = __commonJS({
|
|
|
23255
23290
|
"undici:request:headers",
|
|
23256
23291
|
(evt) => {
|
|
23257
23292
|
const {
|
|
23258
|
-
request: { method, path:
|
|
23293
|
+
request: { method, path: path15, origin },
|
|
23259
23294
|
response: { statusCode }
|
|
23260
23295
|
} = evt;
|
|
23261
23296
|
debugLog2(
|
|
23262
23297
|
"received response to %s %s%s - HTTP %d",
|
|
23263
23298
|
method,
|
|
23264
23299
|
origin,
|
|
23265
|
-
|
|
23300
|
+
path15,
|
|
23266
23301
|
statusCode
|
|
23267
23302
|
);
|
|
23268
23303
|
}
|
|
@@ -23271,23 +23306,23 @@ var require_diagnostics = __commonJS({
|
|
|
23271
23306
|
"undici:request:trailers",
|
|
23272
23307
|
(evt) => {
|
|
23273
23308
|
const {
|
|
23274
|
-
request: { method, path:
|
|
23309
|
+
request: { method, path: path15, origin }
|
|
23275
23310
|
} = evt;
|
|
23276
|
-
debugLog2("trailers received from %s %s%s", method, origin,
|
|
23311
|
+
debugLog2("trailers received from %s %s%s", method, origin, path15);
|
|
23277
23312
|
}
|
|
23278
23313
|
);
|
|
23279
23314
|
diagnosticsChannel.subscribe(
|
|
23280
23315
|
"undici:request:error",
|
|
23281
23316
|
(evt) => {
|
|
23282
23317
|
const {
|
|
23283
|
-
request: { method, path:
|
|
23318
|
+
request: { method, path: path15, origin },
|
|
23284
23319
|
error: error95
|
|
23285
23320
|
} = evt;
|
|
23286
23321
|
debugLog2(
|
|
23287
23322
|
"request to %s %s%s errored - %s",
|
|
23288
23323
|
method,
|
|
23289
23324
|
origin,
|
|
23290
|
-
|
|
23325
|
+
path15,
|
|
23291
23326
|
error95.message
|
|
23292
23327
|
);
|
|
23293
23328
|
}
|
|
@@ -23408,7 +23443,7 @@ var require_request = __commonJS({
|
|
|
23408
23443
|
__name(this, "Request");
|
|
23409
23444
|
}
|
|
23410
23445
|
constructor(origin, {
|
|
23411
|
-
path:
|
|
23446
|
+
path: path15,
|
|
23412
23447
|
method,
|
|
23413
23448
|
body,
|
|
23414
23449
|
headers,
|
|
@@ -23425,11 +23460,11 @@ var require_request = __commonJS({
|
|
|
23425
23460
|
maxRedirections,
|
|
23426
23461
|
typeOfService
|
|
23427
23462
|
}, handler) {
|
|
23428
|
-
if (typeof
|
|
23463
|
+
if (typeof path15 !== "string") {
|
|
23429
23464
|
throw new InvalidArgumentError("path must be a string");
|
|
23430
|
-
} else if (
|
|
23465
|
+
} else if (path15[0] !== "/" && !(path15.startsWith("http://") || path15.startsWith("https://")) && method !== "CONNECT") {
|
|
23431
23466
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
23432
|
-
} else if (invalidPathRegex.test(
|
|
23467
|
+
} else if (invalidPathRegex.test(path15)) {
|
|
23433
23468
|
throw new InvalidArgumentError("invalid request path");
|
|
23434
23469
|
}
|
|
23435
23470
|
if (typeof method !== "string") {
|
|
@@ -23504,7 +23539,7 @@ var require_request = __commonJS({
|
|
|
23504
23539
|
this.completed = false;
|
|
23505
23540
|
this.aborted = false;
|
|
23506
23541
|
this.upgrade = upgrade || null;
|
|
23507
|
-
this.path = query ? serializePathWithQuery(
|
|
23542
|
+
this.path = query ? serializePathWithQuery(path15, query) : path15;
|
|
23508
23543
|
this.origin = origin;
|
|
23509
23544
|
this.protocol = getProtocolFromUrlString(origin);
|
|
23510
23545
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -28842,7 +28877,7 @@ var require_client_h1 = __commonJS({
|
|
|
28842
28877
|
}
|
|
28843
28878
|
__name(shouldSendContentLength, "shouldSendContentLength");
|
|
28844
28879
|
function writeH1(client, request) {
|
|
28845
|
-
const { method, path:
|
|
28880
|
+
const { method, path: path15, host, upgrade, blocking, reset } = request;
|
|
28846
28881
|
let { body, headers, contentLength: contentLength2 } = request;
|
|
28847
28882
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
28848
28883
|
if (util.isFormDataLike(body)) {
|
|
@@ -28920,7 +28955,7 @@ var require_client_h1 = __commonJS({
|
|
|
28920
28955
|
if (socket.setTypeOfService) {
|
|
28921
28956
|
socket.setTypeOfService(request.typeOfService);
|
|
28922
28957
|
}
|
|
28923
|
-
let header = `${method} ${
|
|
28958
|
+
let header = `${method} ${path15} HTTP/1.1\r
|
|
28924
28959
|
`;
|
|
28925
28960
|
if (typeof host === "string") {
|
|
28926
28961
|
header += `host: ${host}\r
|
|
@@ -29599,7 +29634,7 @@ var require_client_h2 = __commonJS({
|
|
|
29599
29634
|
function writeH2(client, request) {
|
|
29600
29635
|
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
29601
29636
|
const session = client[kHTTP2Session];
|
|
29602
|
-
const { method, path:
|
|
29637
|
+
const { method, path: path15, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
29603
29638
|
let { body } = request;
|
|
29604
29639
|
if (upgrade != null && upgrade !== "websocket") {
|
|
29605
29640
|
util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -29667,7 +29702,7 @@ var require_client_h2 = __commonJS({
|
|
|
29667
29702
|
}
|
|
29668
29703
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
29669
29704
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
29670
|
-
headers[HTTP2_HEADER_PATH] =
|
|
29705
|
+
headers[HTTP2_HEADER_PATH] = path15;
|
|
29671
29706
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
29672
29707
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
29673
29708
|
} else {
|
|
@@ -29708,7 +29743,7 @@ var require_client_h2 = __commonJS({
|
|
|
29708
29743
|
stream.setTimeout(requestTimeout);
|
|
29709
29744
|
return true;
|
|
29710
29745
|
}
|
|
29711
|
-
headers[HTTP2_HEADER_PATH] =
|
|
29746
|
+
headers[HTTP2_HEADER_PATH] = path15;
|
|
29712
29747
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
29713
29748
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
29714
29749
|
if (body && typeof body.read === "function") {
|
|
@@ -32112,10 +32147,10 @@ var require_proxy_agent = __commonJS({
|
|
|
32112
32147
|
};
|
|
32113
32148
|
const {
|
|
32114
32149
|
origin,
|
|
32115
|
-
path:
|
|
32150
|
+
path: path15 = "/",
|
|
32116
32151
|
headers = {}
|
|
32117
32152
|
} = opts;
|
|
32118
|
-
opts.path = origin +
|
|
32153
|
+
opts.path = origin + path15;
|
|
32119
32154
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
32120
32155
|
const { host } = new URL(origin);
|
|
32121
32156
|
headers.host = host;
|
|
@@ -34272,21 +34307,21 @@ var require_mock_utils = __commonJS({
|
|
|
34272
34307
|
return normalizedQp;
|
|
34273
34308
|
}
|
|
34274
34309
|
__name(normalizeSearchParams, "normalizeSearchParams");
|
|
34275
|
-
function safeUrl(
|
|
34276
|
-
if (typeof
|
|
34277
|
-
return
|
|
34310
|
+
function safeUrl(path15) {
|
|
34311
|
+
if (typeof path15 !== "string") {
|
|
34312
|
+
return path15;
|
|
34278
34313
|
}
|
|
34279
|
-
const pathSegments =
|
|
34314
|
+
const pathSegments = path15.split("?", 3);
|
|
34280
34315
|
if (pathSegments.length !== 2) {
|
|
34281
|
-
return
|
|
34316
|
+
return path15;
|
|
34282
34317
|
}
|
|
34283
34318
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
34284
34319
|
qp.sort();
|
|
34285
34320
|
return [...pathSegments, qp.toString()].join("?");
|
|
34286
34321
|
}
|
|
34287
34322
|
__name(safeUrl, "safeUrl");
|
|
34288
|
-
function matchKey(mockDispatch2, { path:
|
|
34289
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
34323
|
+
function matchKey(mockDispatch2, { path: path15, method, body, headers }) {
|
|
34324
|
+
const pathMatch = matchValue(mockDispatch2.path, path15);
|
|
34290
34325
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
34291
34326
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
34292
34327
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -34313,8 +34348,8 @@ var require_mock_utils = __commonJS({
|
|
|
34313
34348
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
34314
34349
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
34315
34350
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
34316
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
34317
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
34351
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path15, ignoreTrailingSlash }) => {
|
|
34352
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path15)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path15), resolvedPath);
|
|
34318
34353
|
});
|
|
34319
34354
|
if (matchedMockDispatches.length === 0) {
|
|
34320
34355
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -34356,20 +34391,20 @@ var require_mock_utils = __commonJS({
|
|
|
34356
34391
|
}
|
|
34357
34392
|
}
|
|
34358
34393
|
__name(deleteMockDispatch, "deleteMockDispatch");
|
|
34359
|
-
function removeTrailingSlash(
|
|
34360
|
-
while (
|
|
34361
|
-
|
|
34394
|
+
function removeTrailingSlash(path15) {
|
|
34395
|
+
while (path15.endsWith("/")) {
|
|
34396
|
+
path15 = path15.slice(0, -1);
|
|
34362
34397
|
}
|
|
34363
|
-
if (
|
|
34364
|
-
|
|
34398
|
+
if (path15.length === 0) {
|
|
34399
|
+
path15 = "/";
|
|
34365
34400
|
}
|
|
34366
|
-
return
|
|
34401
|
+
return path15;
|
|
34367
34402
|
}
|
|
34368
34403
|
__name(removeTrailingSlash, "removeTrailingSlash");
|
|
34369
34404
|
function buildKey(opts) {
|
|
34370
|
-
const { path:
|
|
34405
|
+
const { path: path15, method, body, headers, query } = opts;
|
|
34371
34406
|
return {
|
|
34372
|
-
path:
|
|
34407
|
+
path: path15,
|
|
34373
34408
|
method,
|
|
34374
34409
|
body,
|
|
34375
34410
|
headers,
|
|
@@ -35096,10 +35131,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
35096
35131
|
}
|
|
35097
35132
|
format(pendingInterceptors) {
|
|
35098
35133
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
35099
|
-
({ method, path:
|
|
35134
|
+
({ method, path: path15, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
35100
35135
|
Method: method,
|
|
35101
35136
|
Origin: origin,
|
|
35102
|
-
Path:
|
|
35137
|
+
Path: path15,
|
|
35103
35138
|
"Status code": statusCode,
|
|
35104
35139
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
35105
35140
|
Invocations: timesInvoked,
|
|
@@ -35184,9 +35219,9 @@ var require_mock_agent = __commonJS({
|
|
|
35184
35219
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
35185
35220
|
const dispatchOpts = { ...opts };
|
|
35186
35221
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
35187
|
-
const [
|
|
35222
|
+
const [path15, searchParams] = dispatchOpts.path.split("?");
|
|
35188
35223
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
35189
|
-
dispatchOpts.path = `${
|
|
35224
|
+
dispatchOpts.path = `${path15}?${normalizedSearchParams}`;
|
|
35190
35225
|
}
|
|
35191
35226
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
35192
35227
|
}
|
|
@@ -35599,12 +35634,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
35599
35634
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
35600
35635
|
*/
|
|
35601
35636
|
async loadSnapshots(filePath) {
|
|
35602
|
-
const
|
|
35603
|
-
if (!
|
|
35637
|
+
const path15 = filePath || this.#snapshotPath;
|
|
35638
|
+
if (!path15) {
|
|
35604
35639
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
35605
35640
|
}
|
|
35606
35641
|
try {
|
|
35607
|
-
const data = await readFile3(resolve3(
|
|
35642
|
+
const data = await readFile3(resolve3(path15), "utf8");
|
|
35608
35643
|
const parsed = JSON.parse(data);
|
|
35609
35644
|
if (Array.isArray(parsed)) {
|
|
35610
35645
|
this.#snapshots.clear();
|
|
@@ -35618,7 +35653,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
35618
35653
|
if (error95.code === "ENOENT") {
|
|
35619
35654
|
this.#snapshots.clear();
|
|
35620
35655
|
} else {
|
|
35621
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
35656
|
+
throw new UndiciError(`Failed to load snapshots from ${path15}`, { cause: error95 });
|
|
35622
35657
|
}
|
|
35623
35658
|
}
|
|
35624
35659
|
}
|
|
@@ -35629,11 +35664,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
35629
35664
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
35630
35665
|
*/
|
|
35631
35666
|
async saveSnapshots(filePath) {
|
|
35632
|
-
const
|
|
35633
|
-
if (!
|
|
35667
|
+
const path15 = filePath || this.#snapshotPath;
|
|
35668
|
+
if (!path15) {
|
|
35634
35669
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
35635
35670
|
}
|
|
35636
|
-
const resolvedPath = resolve3(
|
|
35671
|
+
const resolvedPath = resolve3(path15);
|
|
35637
35672
|
await mkdir2(dirname2(resolvedPath), { recursive: true });
|
|
35638
35673
|
const data = Array.from(this.#snapshots.entries()).map(([hash3, snapshot]) => ({
|
|
35639
35674
|
hash: hash3,
|
|
@@ -36279,15 +36314,15 @@ var require_redirect_handler = __commonJS({
|
|
|
36279
36314
|
return;
|
|
36280
36315
|
}
|
|
36281
36316
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
36282
|
-
const
|
|
36283
|
-
const redirectUrlString = `${origin}${
|
|
36317
|
+
const path15 = search ? `${pathname}${search}` : pathname;
|
|
36318
|
+
const redirectUrlString = `${origin}${path15}`;
|
|
36284
36319
|
for (const historyUrl of this.history) {
|
|
36285
36320
|
if (historyUrl.toString() === redirectUrlString) {
|
|
36286
36321
|
throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
36287
36322
|
}
|
|
36288
36323
|
}
|
|
36289
36324
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
36290
|
-
this.opts.path =
|
|
36325
|
+
this.opts.path = path15;
|
|
36291
36326
|
this.opts.origin = origin;
|
|
36292
36327
|
this.opts.query = null;
|
|
36293
36328
|
}
|
|
@@ -36374,9 +36409,9 @@ var require_redirect = __commonJS({
|
|
|
36374
36409
|
var require_response_error = __commonJS({
|
|
36375
36410
|
"../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/interceptor/response-error.js"(exports, module) {
|
|
36376
36411
|
"use strict";
|
|
36377
|
-
var
|
|
36412
|
+
var DecoratorHandler2 = require_decorator_handler();
|
|
36378
36413
|
var { ResponseError } = require_errors();
|
|
36379
|
-
var ResponseErrorHandler = class extends
|
|
36414
|
+
var ResponseErrorHandler = class extends DecoratorHandler2 {
|
|
36380
36415
|
static {
|
|
36381
36416
|
__name(this, "ResponseErrorHandler");
|
|
36382
36417
|
}
|
|
@@ -36484,8 +36519,8 @@ var require_dump = __commonJS({
|
|
|
36484
36519
|
"../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/interceptor/dump.js"(exports, module) {
|
|
36485
36520
|
"use strict";
|
|
36486
36521
|
var { InvalidArgumentError, RequestAbortedError } = require_errors();
|
|
36487
|
-
var
|
|
36488
|
-
var DumpHandler = class extends
|
|
36522
|
+
var DecoratorHandler2 = require_decorator_handler();
|
|
36523
|
+
var DumpHandler = class extends DecoratorHandler2 {
|
|
36489
36524
|
static {
|
|
36490
36525
|
__name(this, "DumpHandler");
|
|
36491
36526
|
}
|
|
@@ -36575,7 +36610,7 @@ var require_dns = __commonJS({
|
|
|
36575
36610
|
"use strict";
|
|
36576
36611
|
var { isIP } = __require("node:net");
|
|
36577
36612
|
var { lookup } = __require("node:dns");
|
|
36578
|
-
var
|
|
36613
|
+
var DecoratorHandler2 = require_decorator_handler();
|
|
36579
36614
|
var { InvalidArgumentError, InformationalError } = require_errors();
|
|
36580
36615
|
var maxInt = Math.pow(2, 31) - 1;
|
|
36581
36616
|
function hasSafeIterator(headers) {
|
|
@@ -36884,7 +36919,7 @@ var require_dns = __commonJS({
|
|
|
36884
36919
|
return new DNSDispatchHandler(this, meta5, opts);
|
|
36885
36920
|
}
|
|
36886
36921
|
};
|
|
36887
|
-
var DNSDispatchHandler = class extends
|
|
36922
|
+
var DNSDispatchHandler = class extends DecoratorHandler2 {
|
|
36888
36923
|
static {
|
|
36889
36924
|
__name(this, "DNSDispatchHandler");
|
|
36890
36925
|
}
|
|
@@ -38113,10 +38148,10 @@ var require_cache_handler = __commonJS({
|
|
|
38113
38148
|
return locationUrl.pathname + locationUrl.search;
|
|
38114
38149
|
}
|
|
38115
38150
|
__name(getSameOriginPath, "getSameOriginPath");
|
|
38116
|
-
function deleteCachedUri(store, cacheKey,
|
|
38151
|
+
function deleteCachedUri(store, cacheKey, path15) {
|
|
38117
38152
|
deleteCachedValue(store, {
|
|
38118
38153
|
...cacheKey,
|
|
38119
|
-
path:
|
|
38154
|
+
path: path15
|
|
38120
38155
|
});
|
|
38121
38156
|
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
38122
38157
|
const method = util.safeHTTPMethods[i];
|
|
@@ -38124,7 +38159,7 @@ var require_cache_handler = __commonJS({
|
|
|
38124
38159
|
deleteCachedValue(store, {
|
|
38125
38160
|
...cacheKey,
|
|
38126
38161
|
method,
|
|
38127
|
-
path:
|
|
38162
|
+
path: path15
|
|
38128
38163
|
});
|
|
38129
38164
|
}
|
|
38130
38165
|
}
|
|
@@ -38136,9 +38171,9 @@ var require_cache_handler = __commonJS({
|
|
|
38136
38171
|
}
|
|
38137
38172
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
38138
38173
|
for (let i = 0; i < values.length; i++) {
|
|
38139
|
-
const
|
|
38140
|
-
if (
|
|
38141
|
-
deleteCachedUri(store, cacheKey,
|
|
38174
|
+
const path15 = getSameOriginPath(cacheKey, values[i]);
|
|
38175
|
+
if (path15 !== void 0) {
|
|
38176
|
+
deleteCachedUri(store, cacheKey, path15);
|
|
38142
38177
|
}
|
|
38143
38178
|
}
|
|
38144
38179
|
}
|
|
@@ -39305,7 +39340,7 @@ var require_decompress = __commonJS({
|
|
|
39305
39340
|
"use strict";
|
|
39306
39341
|
var { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = __require("node:zlib");
|
|
39307
39342
|
var { pipeline } = __require("node:stream");
|
|
39308
|
-
var
|
|
39343
|
+
var DecoratorHandler2 = require_decorator_handler();
|
|
39309
39344
|
var { runtimeFeatures } = require_runtime_features();
|
|
39310
39345
|
var supportedEncodings = {
|
|
39311
39346
|
gzip: createGunzip,
|
|
@@ -39324,7 +39359,7 @@ var require_decompress = __commonJS({
|
|
|
39324
39359
|
/** @type {boolean} */
|
|
39325
39360
|
false
|
|
39326
39361
|
);
|
|
39327
|
-
var DecompressHandler = class extends
|
|
39362
|
+
var DecompressHandler = class extends DecoratorHandler2 {
|
|
39328
39363
|
static {
|
|
39329
39364
|
__name(this, "DecompressHandler");
|
|
39330
39365
|
}
|
|
@@ -43117,11 +43152,11 @@ var require_fetch = __commonJS({
|
|
|
43117
43152
|
function dispatch({ body }) {
|
|
43118
43153
|
const url3 = requestCurrentURL(request);
|
|
43119
43154
|
const agent = fetchParams.controller.dispatcher;
|
|
43120
|
-
const
|
|
43155
|
+
const path15 = url3.pathname + url3.search;
|
|
43121
43156
|
const hasTrailingQuestionMark = url3.search.length === 0 && url3.href[url3.href.length - url3.hash.length - 1] === "?";
|
|
43122
43157
|
return new Promise((resolve3, reject) => agent.dispatch(
|
|
43123
43158
|
{
|
|
43124
|
-
path: hasTrailingQuestionMark ? `${
|
|
43159
|
+
path: hasTrailingQuestionMark ? `${path15}?` : path15,
|
|
43125
43160
|
origin: url3.origin,
|
|
43126
43161
|
method: request.method,
|
|
43127
43162
|
body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
|
|
@@ -44081,9 +44116,9 @@ var require_util4 = __commonJS({
|
|
|
44081
44116
|
}
|
|
44082
44117
|
}
|
|
44083
44118
|
__name(validateCookieValue, "validateCookieValue");
|
|
44084
|
-
function validateCookiePath(
|
|
44085
|
-
for (let i = 0; i <
|
|
44086
|
-
const code3 =
|
|
44119
|
+
function validateCookiePath(path15) {
|
|
44120
|
+
for (let i = 0; i < path15.length; ++i) {
|
|
44121
|
+
const code3 = path15.charCodeAt(i);
|
|
44087
44122
|
if (code3 < 32 || // exclude CTLs (0-31)
|
|
44088
44123
|
code3 > 126 || // exclude DEL and non-ascii
|
|
44089
44124
|
code3 === 59) {
|
|
@@ -47345,7 +47380,7 @@ var require_undici = __commonJS({
|
|
|
47345
47380
|
var mockErrors = require_mock_errors();
|
|
47346
47381
|
var RetryHandler = require_retry_handler();
|
|
47347
47382
|
var { getGlobalDispatcher, setGlobalDispatcher } = require_global2();
|
|
47348
|
-
var
|
|
47383
|
+
var DecoratorHandler2 = require_decorator_handler();
|
|
47349
47384
|
var RedirectHandler = require_redirect_handler();
|
|
47350
47385
|
Object.assign(Dispatcher.prototype, api);
|
|
47351
47386
|
module.exports.Dispatcher = Dispatcher;
|
|
@@ -47360,7 +47395,7 @@ var require_undici = __commonJS({
|
|
|
47360
47395
|
module.exports.RetryAgent = RetryAgent2;
|
|
47361
47396
|
module.exports.H2CClient = H2CClient;
|
|
47362
47397
|
module.exports.RetryHandler = RetryHandler;
|
|
47363
|
-
module.exports.DecoratorHandler =
|
|
47398
|
+
module.exports.DecoratorHandler = DecoratorHandler2;
|
|
47364
47399
|
module.exports.RedirectHandler = RedirectHandler;
|
|
47365
47400
|
module.exports.interceptors = {
|
|
47366
47401
|
redirect: require_redirect(),
|
|
@@ -47399,11 +47434,11 @@ var require_undici = __commonJS({
|
|
|
47399
47434
|
if (typeof opts.path !== "string") {
|
|
47400
47435
|
throw new InvalidArgumentError("invalid opts.path");
|
|
47401
47436
|
}
|
|
47402
|
-
let
|
|
47437
|
+
let path15 = opts.path;
|
|
47403
47438
|
if (!opts.path.startsWith("/")) {
|
|
47404
|
-
|
|
47439
|
+
path15 = `/${path15}`;
|
|
47405
47440
|
}
|
|
47406
|
-
url3 = new URL(util.parseOrigin(url3).origin +
|
|
47441
|
+
url3 = new URL(util.parseOrigin(url3).origin + path15);
|
|
47407
47442
|
} else {
|
|
47408
47443
|
if (!opts) {
|
|
47409
47444
|
opts = typeof url3 === "object" ? url3 : {};
|
|
@@ -47866,14 +47901,14 @@ var require_polyfills = __commonJS({
|
|
|
47866
47901
|
fs9.fstatSync = statFixSync(fs9.fstatSync);
|
|
47867
47902
|
fs9.lstatSync = statFixSync(fs9.lstatSync);
|
|
47868
47903
|
if (fs9.chmod && !fs9.lchmod) {
|
|
47869
|
-
fs9.lchmod = function(
|
|
47904
|
+
fs9.lchmod = function(path15, mode, cb) {
|
|
47870
47905
|
if (cb) process.nextTick(cb);
|
|
47871
47906
|
};
|
|
47872
47907
|
fs9.lchmodSync = function() {
|
|
47873
47908
|
};
|
|
47874
47909
|
}
|
|
47875
47910
|
if (fs9.chown && !fs9.lchown) {
|
|
47876
|
-
fs9.lchown = function(
|
|
47911
|
+
fs9.lchown = function(path15, uid, gid, cb) {
|
|
47877
47912
|
if (cb) process.nextTick(cb);
|
|
47878
47913
|
};
|
|
47879
47914
|
fs9.lchownSync = function() {
|
|
@@ -47942,9 +47977,9 @@ var require_polyfills = __commonJS({
|
|
|
47942
47977
|
};
|
|
47943
47978
|
})(fs9.readSync);
|
|
47944
47979
|
function patchLchmod(fs10) {
|
|
47945
|
-
fs10.lchmod = function(
|
|
47980
|
+
fs10.lchmod = function(path15, mode, callback) {
|
|
47946
47981
|
fs10.open(
|
|
47947
|
-
|
|
47982
|
+
path15,
|
|
47948
47983
|
constants2.O_WRONLY | constants2.O_SYMLINK,
|
|
47949
47984
|
mode,
|
|
47950
47985
|
function(err, fd) {
|
|
@@ -47960,8 +47995,8 @@ var require_polyfills = __commonJS({
|
|
|
47960
47995
|
}
|
|
47961
47996
|
);
|
|
47962
47997
|
};
|
|
47963
|
-
fs10.lchmodSync = function(
|
|
47964
|
-
var fd = fs10.openSync(
|
|
47998
|
+
fs10.lchmodSync = function(path15, mode) {
|
|
47999
|
+
var fd = fs10.openSync(path15, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
47965
48000
|
var threw = true;
|
|
47966
48001
|
var ret;
|
|
47967
48002
|
try {
|
|
@@ -47983,8 +48018,8 @@ var require_polyfills = __commonJS({
|
|
|
47983
48018
|
__name(patchLchmod, "patchLchmod");
|
|
47984
48019
|
function patchLutimes(fs10) {
|
|
47985
48020
|
if (constants2.hasOwnProperty("O_SYMLINK") && fs10.futimes) {
|
|
47986
|
-
fs10.lutimes = function(
|
|
47987
|
-
fs10.open(
|
|
48021
|
+
fs10.lutimes = function(path15, at, mt, cb) {
|
|
48022
|
+
fs10.open(path15, constants2.O_SYMLINK, function(er, fd) {
|
|
47988
48023
|
if (er) {
|
|
47989
48024
|
if (cb) cb(er);
|
|
47990
48025
|
return;
|
|
@@ -47996,8 +48031,8 @@ var require_polyfills = __commonJS({
|
|
|
47996
48031
|
});
|
|
47997
48032
|
});
|
|
47998
48033
|
};
|
|
47999
|
-
fs10.lutimesSync = function(
|
|
48000
|
-
var fd = fs10.openSync(
|
|
48034
|
+
fs10.lutimesSync = function(path15, at, mt) {
|
|
48035
|
+
var fd = fs10.openSync(path15, constants2.O_SYMLINK);
|
|
48001
48036
|
var ret;
|
|
48002
48037
|
var threw = true;
|
|
48003
48038
|
try {
|
|
@@ -48125,11 +48160,11 @@ var require_legacy_streams = __commonJS({
|
|
|
48125
48160
|
ReadStream,
|
|
48126
48161
|
WriteStream
|
|
48127
48162
|
};
|
|
48128
|
-
function ReadStream(
|
|
48129
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
48163
|
+
function ReadStream(path15, options) {
|
|
48164
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path15, options);
|
|
48130
48165
|
Stream.call(this);
|
|
48131
48166
|
var self2 = this;
|
|
48132
|
-
this.path =
|
|
48167
|
+
this.path = path15;
|
|
48133
48168
|
this.fd = null;
|
|
48134
48169
|
this.readable = true;
|
|
48135
48170
|
this.paused = false;
|
|
@@ -48175,10 +48210,10 @@ var require_legacy_streams = __commonJS({
|
|
|
48175
48210
|
});
|
|
48176
48211
|
}
|
|
48177
48212
|
__name(ReadStream, "ReadStream");
|
|
48178
|
-
function WriteStream(
|
|
48179
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
48213
|
+
function WriteStream(path15, options) {
|
|
48214
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path15, options);
|
|
48180
48215
|
Stream.call(this);
|
|
48181
|
-
this.path =
|
|
48216
|
+
this.path = path15;
|
|
48182
48217
|
this.fd = null;
|
|
48183
48218
|
this.writable = true;
|
|
48184
48219
|
this.flags = "w";
|
|
@@ -48328,14 +48363,14 @@ var require_graceful_fs = __commonJS({
|
|
|
48328
48363
|
fs10.createWriteStream = createWriteStream;
|
|
48329
48364
|
var fs$readFile = fs10.readFile;
|
|
48330
48365
|
fs10.readFile = readFile3;
|
|
48331
|
-
function readFile3(
|
|
48366
|
+
function readFile3(path15, options, cb) {
|
|
48332
48367
|
if (typeof options === "function")
|
|
48333
48368
|
cb = options, options = null;
|
|
48334
|
-
return go$readFile(
|
|
48335
|
-
function go$readFile(
|
|
48336
|
-
return fs$readFile(
|
|
48369
|
+
return go$readFile(path15, options, cb);
|
|
48370
|
+
function go$readFile(path16, options2, cb2, startTime) {
|
|
48371
|
+
return fs$readFile(path16, options2, function(err) {
|
|
48337
48372
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
48338
|
-
enqueue([go$readFile, [
|
|
48373
|
+
enqueue([go$readFile, [path16, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
48339
48374
|
else {
|
|
48340
48375
|
if (typeof cb2 === "function")
|
|
48341
48376
|
cb2.apply(this, arguments);
|
|
@@ -48347,14 +48382,14 @@ var require_graceful_fs = __commonJS({
|
|
|
48347
48382
|
__name(readFile3, "readFile");
|
|
48348
48383
|
var fs$writeFile = fs10.writeFile;
|
|
48349
48384
|
fs10.writeFile = writeFile2;
|
|
48350
|
-
function writeFile2(
|
|
48385
|
+
function writeFile2(path15, data, options, cb) {
|
|
48351
48386
|
if (typeof options === "function")
|
|
48352
48387
|
cb = options, options = null;
|
|
48353
|
-
return go$writeFile(
|
|
48354
|
-
function go$writeFile(
|
|
48355
|
-
return fs$writeFile(
|
|
48388
|
+
return go$writeFile(path15, data, options, cb);
|
|
48389
|
+
function go$writeFile(path16, data2, options2, cb2, startTime) {
|
|
48390
|
+
return fs$writeFile(path16, data2, options2, function(err) {
|
|
48356
48391
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
48357
|
-
enqueue([go$writeFile, [
|
|
48392
|
+
enqueue([go$writeFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
48358
48393
|
else {
|
|
48359
48394
|
if (typeof cb2 === "function")
|
|
48360
48395
|
cb2.apply(this, arguments);
|
|
@@ -48367,14 +48402,14 @@ var require_graceful_fs = __commonJS({
|
|
|
48367
48402
|
var fs$appendFile = fs10.appendFile;
|
|
48368
48403
|
if (fs$appendFile)
|
|
48369
48404
|
fs10.appendFile = appendFile;
|
|
48370
|
-
function appendFile(
|
|
48405
|
+
function appendFile(path15, data, options, cb) {
|
|
48371
48406
|
if (typeof options === "function")
|
|
48372
48407
|
cb = options, options = null;
|
|
48373
|
-
return go$appendFile(
|
|
48374
|
-
function go$appendFile(
|
|
48375
|
-
return fs$appendFile(
|
|
48408
|
+
return go$appendFile(path15, data, options, cb);
|
|
48409
|
+
function go$appendFile(path16, data2, options2, cb2, startTime) {
|
|
48410
|
+
return fs$appendFile(path16, data2, options2, function(err) {
|
|
48376
48411
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
48377
|
-
enqueue([go$appendFile, [
|
|
48412
|
+
enqueue([go$appendFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
48378
48413
|
else {
|
|
48379
48414
|
if (typeof cb2 === "function")
|
|
48380
48415
|
cb2.apply(this, arguments);
|
|
@@ -48409,31 +48444,31 @@ var require_graceful_fs = __commonJS({
|
|
|
48409
48444
|
var fs$readdir = fs10.readdir;
|
|
48410
48445
|
fs10.readdir = readdir2;
|
|
48411
48446
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
48412
|
-
function readdir2(
|
|
48447
|
+
function readdir2(path15, options, cb) {
|
|
48413
48448
|
if (typeof options === "function")
|
|
48414
48449
|
cb = options, options = null;
|
|
48415
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? /* @__PURE__ */ __name(function go$readdir2(
|
|
48416
|
-
return fs$readdir(
|
|
48417
|
-
|
|
48450
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? /* @__PURE__ */ __name(function go$readdir2(path16, options2, cb2, startTime) {
|
|
48451
|
+
return fs$readdir(path16, fs$readdirCallback(
|
|
48452
|
+
path16,
|
|
48418
48453
|
options2,
|
|
48419
48454
|
cb2,
|
|
48420
48455
|
startTime
|
|
48421
48456
|
));
|
|
48422
|
-
}, "go$readdir") : /* @__PURE__ */ __name(function go$readdir2(
|
|
48423
|
-
return fs$readdir(
|
|
48424
|
-
|
|
48457
|
+
}, "go$readdir") : /* @__PURE__ */ __name(function go$readdir2(path16, options2, cb2, startTime) {
|
|
48458
|
+
return fs$readdir(path16, options2, fs$readdirCallback(
|
|
48459
|
+
path16,
|
|
48425
48460
|
options2,
|
|
48426
48461
|
cb2,
|
|
48427
48462
|
startTime
|
|
48428
48463
|
));
|
|
48429
48464
|
}, "go$readdir");
|
|
48430
|
-
return go$readdir(
|
|
48431
|
-
function fs$readdirCallback(
|
|
48465
|
+
return go$readdir(path15, options, cb);
|
|
48466
|
+
function fs$readdirCallback(path16, options2, cb2, startTime) {
|
|
48432
48467
|
return function(err, files) {
|
|
48433
48468
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
48434
48469
|
enqueue([
|
|
48435
48470
|
go$readdir,
|
|
48436
|
-
[
|
|
48471
|
+
[path16, options2, cb2],
|
|
48437
48472
|
err,
|
|
48438
48473
|
startTime || Date.now(),
|
|
48439
48474
|
Date.now()
|
|
@@ -48506,7 +48541,7 @@ var require_graceful_fs = __commonJS({
|
|
|
48506
48541
|
enumerable: true,
|
|
48507
48542
|
configurable: true
|
|
48508
48543
|
});
|
|
48509
|
-
function ReadStream(
|
|
48544
|
+
function ReadStream(path15, options) {
|
|
48510
48545
|
if (this instanceof ReadStream)
|
|
48511
48546
|
return fs$ReadStream.apply(this, arguments), this;
|
|
48512
48547
|
else
|
|
@@ -48528,7 +48563,7 @@ var require_graceful_fs = __commonJS({
|
|
|
48528
48563
|
});
|
|
48529
48564
|
}
|
|
48530
48565
|
__name(ReadStream$open, "ReadStream$open");
|
|
48531
|
-
function WriteStream(
|
|
48566
|
+
function WriteStream(path15, options) {
|
|
48532
48567
|
if (this instanceof WriteStream)
|
|
48533
48568
|
return fs$WriteStream.apply(this, arguments), this;
|
|
48534
48569
|
else
|
|
@@ -48548,24 +48583,24 @@ var require_graceful_fs = __commonJS({
|
|
|
48548
48583
|
});
|
|
48549
48584
|
}
|
|
48550
48585
|
__name(WriteStream$open, "WriteStream$open");
|
|
48551
|
-
function createReadStream(
|
|
48552
|
-
return new fs10.ReadStream(
|
|
48586
|
+
function createReadStream(path15, options) {
|
|
48587
|
+
return new fs10.ReadStream(path15, options);
|
|
48553
48588
|
}
|
|
48554
48589
|
__name(createReadStream, "createReadStream");
|
|
48555
|
-
function createWriteStream(
|
|
48556
|
-
return new fs10.WriteStream(
|
|
48590
|
+
function createWriteStream(path15, options) {
|
|
48591
|
+
return new fs10.WriteStream(path15, options);
|
|
48557
48592
|
}
|
|
48558
48593
|
__name(createWriteStream, "createWriteStream");
|
|
48559
48594
|
var fs$open = fs10.open;
|
|
48560
48595
|
fs10.open = open3;
|
|
48561
|
-
function open3(
|
|
48596
|
+
function open3(path15, flags, mode, cb) {
|
|
48562
48597
|
if (typeof mode === "function")
|
|
48563
48598
|
cb = mode, mode = null;
|
|
48564
|
-
return go$open(
|
|
48565
|
-
function go$open(
|
|
48566
|
-
return fs$open(
|
|
48599
|
+
return go$open(path15, flags, mode, cb);
|
|
48600
|
+
function go$open(path16, flags2, mode2, cb2, startTime) {
|
|
48601
|
+
return fs$open(path16, flags2, mode2, function(err, fd) {
|
|
48567
48602
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
48568
|
-
enqueue([go$open, [
|
|
48603
|
+
enqueue([go$open, [path16, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
48569
48604
|
else {
|
|
48570
48605
|
if (typeof cb2 === "function")
|
|
48571
48606
|
cb2.apply(this, arguments);
|
|
@@ -49103,7 +49138,7 @@ var require_mtime_precision = __commonJS({
|
|
|
49103
49138
|
var require_lockfile = __commonJS({
|
|
49104
49139
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
49105
49140
|
"use strict";
|
|
49106
|
-
var
|
|
49141
|
+
var path15 = __require("path");
|
|
49107
49142
|
var fs9 = require_graceful_fs();
|
|
49108
49143
|
var retry = require_retry3();
|
|
49109
49144
|
var onExit = require_signal_exit();
|
|
@@ -49115,7 +49150,7 @@ var require_lockfile = __commonJS({
|
|
|
49115
49150
|
__name(getLockFile, "getLockFile");
|
|
49116
49151
|
function resolveCanonicalPath(file3, options, callback) {
|
|
49117
49152
|
if (!options.realpath) {
|
|
49118
|
-
return callback(null,
|
|
49153
|
+
return callback(null, path15.resolve(file3));
|
|
49119
49154
|
}
|
|
49120
49155
|
options.fs.realpath(file3, callback);
|
|
49121
49156
|
}
|
|
@@ -50204,8 +50239,550 @@ var init_hooks_storage = __esm({
|
|
|
50204
50239
|
}
|
|
50205
50240
|
});
|
|
50206
50241
|
|
|
50207
|
-
// ../world-local/dist/
|
|
50242
|
+
// ../world-local/dist/streamer.js
|
|
50208
50243
|
import { EventEmitter } from "node:events";
|
|
50244
|
+
import fs4 from "node:fs/promises";
|
|
50245
|
+
import path7 from "node:path";
|
|
50246
|
+
function isEofByte(byte) {
|
|
50247
|
+
return byte === EOF_MARKER;
|
|
50248
|
+
}
|
|
50249
|
+
function serializeChunk(chunk) {
|
|
50250
|
+
const eofByte = Buffer.from([chunk.eof ? EOF_MARKER : 0]);
|
|
50251
|
+
return Buffer.concat([eofByte, chunk.chunk]);
|
|
50252
|
+
}
|
|
50253
|
+
function isEofChunk(serialized) {
|
|
50254
|
+
return isEofByte(serialized[0]);
|
|
50255
|
+
}
|
|
50256
|
+
function deserializeChunk(serialized) {
|
|
50257
|
+
const eof = isEofChunk(serialized);
|
|
50258
|
+
const chunk = Buffer.from(serialized.subarray(1));
|
|
50259
|
+
return { eof, chunk };
|
|
50260
|
+
}
|
|
50261
|
+
async function listChunkEntries(chunksDir) {
|
|
50262
|
+
try {
|
|
50263
|
+
return await fs4.readdir(chunksDir);
|
|
50264
|
+
} catch (error95) {
|
|
50265
|
+
if (error95.code === "ENOENT")
|
|
50266
|
+
return [];
|
|
50267
|
+
throw error95;
|
|
50268
|
+
}
|
|
50269
|
+
}
|
|
50270
|
+
function addChunkFilesByExtension(extMap, entries, sourceExtension, fileExtension = sourceExtension, include = () => true) {
|
|
50271
|
+
for (const entry of entries) {
|
|
50272
|
+
if (!entry.endsWith(sourceExtension))
|
|
50273
|
+
continue;
|
|
50274
|
+
const file3 = entry.slice(0, -sourceExtension.length);
|
|
50275
|
+
if (include(file3))
|
|
50276
|
+
extMap.set(file3, fileExtension);
|
|
50277
|
+
}
|
|
50278
|
+
}
|
|
50279
|
+
function chunkDirForStream(chunksBaseDir, name) {
|
|
50280
|
+
assertSafeEntityId("streamName", name);
|
|
50281
|
+
return path7.join(chunksBaseDir, name);
|
|
50282
|
+
}
|
|
50283
|
+
async function listChunkFilesForStream(chunksBaseDir, name, tag) {
|
|
50284
|
+
const dir = chunkDirForStream(chunksBaseDir, name);
|
|
50285
|
+
const entries = await listChunkEntries(dir);
|
|
50286
|
+
const extMap = /* @__PURE__ */ new Map();
|
|
50287
|
+
addChunkFilesByExtension(extMap, entries, ".json");
|
|
50288
|
+
addChunkFilesByExtension(extMap, entries, ".bin", ".bin", tag ? (file3) => !file3.endsWith(`.${tag}`) : void 0);
|
|
50289
|
+
if (tag) {
|
|
50290
|
+
const taggedExtension = `.${tag}.bin`;
|
|
50291
|
+
addChunkFilesByExtension(extMap, entries, taggedExtension);
|
|
50292
|
+
}
|
|
50293
|
+
const files = [...extMap.keys()].sort();
|
|
50294
|
+
return { files, extMap, dir };
|
|
50295
|
+
}
|
|
50296
|
+
async function purgeRunStreamData(basedir, runId, tag) {
|
|
50297
|
+
const chunksBaseDir = path7.join(basedir, "streams", "chunks");
|
|
50298
|
+
const tagSuffix = tag ? `.${tag}` : "";
|
|
50299
|
+
let names;
|
|
50300
|
+
try {
|
|
50301
|
+
assertSafeEntityId("runId", runId);
|
|
50302
|
+
const mapping = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
50303
|
+
names = mapping?.streams ?? [];
|
|
50304
|
+
} catch (error95) {
|
|
50305
|
+
logStreamPurgeFailure(`streams of ${runId}`, error95);
|
|
50306
|
+
return;
|
|
50307
|
+
}
|
|
50308
|
+
for (const name of names) {
|
|
50309
|
+
try {
|
|
50310
|
+
const dir = chunkDirForStream(chunksBaseDir, name);
|
|
50311
|
+
await write(path7.join(dir, `${PURGED_STREAM_TOMBSTONE_ID}${tagSuffix}.bin`), serializeChunk({ chunk: Buffer.from([]), eof: true }), { overwrite: true });
|
|
50312
|
+
for (const entry of await listChunkEntries(dir)) {
|
|
50313
|
+
if (entry.startsWith(PURGED_STREAM_TOMBSTONE_ID))
|
|
50314
|
+
continue;
|
|
50315
|
+
if (!entry.endsWith(".bin") && !entry.endsWith(".json"))
|
|
50316
|
+
continue;
|
|
50317
|
+
await withWindowsRetry(() => fs4.unlink(path7.join(dir, entry))).catch((error95) => {
|
|
50318
|
+
if (error95.code !== "ENOENT")
|
|
50319
|
+
logStreamPurgeFailure(entry, error95);
|
|
50320
|
+
});
|
|
50321
|
+
}
|
|
50322
|
+
} catch (error95) {
|
|
50323
|
+
logStreamPurgeFailure(name, error95);
|
|
50324
|
+
}
|
|
50325
|
+
}
|
|
50326
|
+
}
|
|
50327
|
+
function logStreamPurgeFailure(target2, error95) {
|
|
50328
|
+
console.warn(`[world-local] Failed to purge stream data for ${target2}:`, error95 instanceof Error ? error95.message : error95);
|
|
50329
|
+
}
|
|
50330
|
+
function createStreamer(basedir, tag) {
|
|
50331
|
+
const tagSuffix = tag ? `.${tag}` : "";
|
|
50332
|
+
const streamEmitter = new EventEmitter();
|
|
50333
|
+
const registeredStreams = /* @__PURE__ */ new Set();
|
|
50334
|
+
async function registerStreamForRun(runId, streamName) {
|
|
50335
|
+
assertSafeEntityId("runId", runId);
|
|
50336
|
+
assertSafeEntityId("streamName", streamName);
|
|
50337
|
+
const cacheKey = `${runId}:${streamName}`;
|
|
50338
|
+
if (registeredStreams.has(cacheKey)) {
|
|
50339
|
+
return;
|
|
50340
|
+
}
|
|
50341
|
+
const runStreamsPath = taggedPath(basedir, "streams/runs", runId, tag);
|
|
50342
|
+
const existing = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
50343
|
+
const streams = existing?.streams ?? [];
|
|
50344
|
+
if (!streams.includes(streamName)) {
|
|
50345
|
+
streams.push(streamName);
|
|
50346
|
+
await writeJSON(runStreamsPath, { streams }, { overwrite: true });
|
|
50347
|
+
}
|
|
50348
|
+
registeredStreams.add(cacheKey);
|
|
50349
|
+
}
|
|
50350
|
+
__name(registerStreamForRun, "registerStreamForRun");
|
|
50351
|
+
function toBuffer(chunk) {
|
|
50352
|
+
if (typeof chunk === "string") {
|
|
50353
|
+
return Buffer.from(new TextEncoder().encode(chunk));
|
|
50354
|
+
} else if (chunk instanceof Buffer) {
|
|
50355
|
+
return chunk;
|
|
50356
|
+
} else {
|
|
50357
|
+
return Buffer.from(chunk);
|
|
50358
|
+
}
|
|
50359
|
+
}
|
|
50360
|
+
__name(toBuffer, "toBuffer");
|
|
50361
|
+
return {
|
|
50362
|
+
streams: {
|
|
50363
|
+
async write(_runId, name, chunk) {
|
|
50364
|
+
const chunkId = `chnk_${monotonicUlid2()}`;
|
|
50365
|
+
const runId = await _runId;
|
|
50366
|
+
await registerStreamForRun(runId, name);
|
|
50367
|
+
const chunkBuffer = toBuffer(chunk);
|
|
50368
|
+
const serialized = serializeChunk({
|
|
50369
|
+
chunk: chunkBuffer,
|
|
50370
|
+
eof: false
|
|
50371
|
+
});
|
|
50372
|
+
const chunkPath = path7.join(chunkDirForStream(path7.join(basedir, "streams", "chunks"), name), `${chunkId}${tagSuffix}.bin`);
|
|
50373
|
+
await write(chunkPath, serialized);
|
|
50374
|
+
const chunkData = Uint8Array.from(chunkBuffer);
|
|
50375
|
+
streamEmitter.emit(`chunk:${name}`, {
|
|
50376
|
+
streamName: name,
|
|
50377
|
+
chunkData,
|
|
50378
|
+
chunkId
|
|
50379
|
+
});
|
|
50380
|
+
},
|
|
50381
|
+
async writeMulti(_runId, name, chunks) {
|
|
50382
|
+
if (chunks.length === 0)
|
|
50383
|
+
return;
|
|
50384
|
+
const chunkIds2 = chunks.map(() => `chnk_${monotonicUlid2()}`);
|
|
50385
|
+
const runId = await _runId;
|
|
50386
|
+
await registerStreamForRun(runId, name);
|
|
50387
|
+
const chunkBuffers = chunks.map((chunk) => toBuffer(chunk));
|
|
50388
|
+
const writePromises = chunkBuffers.map(async (chunkBuffer, i) => {
|
|
50389
|
+
const chunkId = chunkIds2[i];
|
|
50390
|
+
const serialized = serializeChunk({
|
|
50391
|
+
chunk: chunkBuffer,
|
|
50392
|
+
eof: false
|
|
50393
|
+
});
|
|
50394
|
+
const chunkPath = path7.join(chunkDirForStream(path7.join(basedir, "streams", "chunks"), name), `${chunkId}${tagSuffix}.bin`);
|
|
50395
|
+
await write(chunkPath, serialized);
|
|
50396
|
+
return {
|
|
50397
|
+
chunkId,
|
|
50398
|
+
chunkData: Uint8Array.from(chunkBuffer)
|
|
50399
|
+
};
|
|
50400
|
+
});
|
|
50401
|
+
for (const writePromise of writePromises) {
|
|
50402
|
+
const { chunkId, chunkData } = await writePromise;
|
|
50403
|
+
streamEmitter.emit(`chunk:${name}`, {
|
|
50404
|
+
streamName: name,
|
|
50405
|
+
chunkData,
|
|
50406
|
+
chunkId
|
|
50407
|
+
});
|
|
50408
|
+
}
|
|
50409
|
+
},
|
|
50410
|
+
async close(_runId, name) {
|
|
50411
|
+
const chunkId = `chnk_${monotonicUlid2()}`;
|
|
50412
|
+
const runId = await _runId;
|
|
50413
|
+
await registerStreamForRun(runId, name);
|
|
50414
|
+
const chunkPath = path7.join(chunkDirForStream(path7.join(basedir, "streams", "chunks"), name), `${chunkId}${tagSuffix}.bin`);
|
|
50415
|
+
await write(chunkPath, serializeChunk({ chunk: Buffer.from([]), eof: true }));
|
|
50416
|
+
streamEmitter.emit(`close:${name}`, { streamName: name });
|
|
50417
|
+
},
|
|
50418
|
+
async list(runId) {
|
|
50419
|
+
assertSafeEntityId("runId", runId);
|
|
50420
|
+
const data = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
50421
|
+
return data?.streams ?? [];
|
|
50422
|
+
},
|
|
50423
|
+
async getChunks(_runId, name, options) {
|
|
50424
|
+
const limit = options?.limit ?? 100;
|
|
50425
|
+
const chunksBaseDir = path7.join(basedir, "streams", "chunks");
|
|
50426
|
+
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
50427
|
+
let startIndex = 0;
|
|
50428
|
+
if (options?.cursor) {
|
|
50429
|
+
try {
|
|
50430
|
+
const decoded = JSON.parse(Buffer.from(options.cursor, "base64").toString("utf-8"));
|
|
50431
|
+
startIndex = decoded.i;
|
|
50432
|
+
} catch {
|
|
50433
|
+
startIndex = 0;
|
|
50434
|
+
}
|
|
50435
|
+
}
|
|
50436
|
+
let streamDone = false;
|
|
50437
|
+
const resultChunks = [];
|
|
50438
|
+
let dataIndex = 0;
|
|
50439
|
+
for (const file3 of chunkFiles) {
|
|
50440
|
+
const ext2 = fileExtMap.get(file3) ?? ".bin";
|
|
50441
|
+
const filePath = path7.join(chunksDir, `${file3}${ext2}`);
|
|
50442
|
+
if (dataIndex < startIndex) {
|
|
50443
|
+
if (isEofByte(await readFirstByte(filePath))) {
|
|
50444
|
+
streamDone = true;
|
|
50445
|
+
break;
|
|
50446
|
+
}
|
|
50447
|
+
dataIndex++;
|
|
50448
|
+
continue;
|
|
50449
|
+
}
|
|
50450
|
+
if (resultChunks.length >= limit) {
|
|
50451
|
+
if (isEofByte(await readFirstByte(filePath))) {
|
|
50452
|
+
streamDone = true;
|
|
50453
|
+
} else {
|
|
50454
|
+
dataIndex++;
|
|
50455
|
+
}
|
|
50456
|
+
break;
|
|
50457
|
+
}
|
|
50458
|
+
const chunk = deserializeChunk(await readBuffer(filePath));
|
|
50459
|
+
if (chunk.eof) {
|
|
50460
|
+
streamDone = true;
|
|
50461
|
+
break;
|
|
50462
|
+
}
|
|
50463
|
+
resultChunks.push({
|
|
50464
|
+
index: dataIndex,
|
|
50465
|
+
data: Uint8Array.from(chunk.chunk)
|
|
50466
|
+
});
|
|
50467
|
+
dataIndex++;
|
|
50468
|
+
}
|
|
50469
|
+
const hasMore = !streamDone && dataIndex > startIndex + resultChunks.length;
|
|
50470
|
+
const nextIndex = startIndex + resultChunks.length;
|
|
50471
|
+
const nextCursor = hasMore ? Buffer.from(JSON.stringify({ i: nextIndex })).toString("base64") : null;
|
|
50472
|
+
return {
|
|
50473
|
+
data: resultChunks,
|
|
50474
|
+
cursor: nextCursor,
|
|
50475
|
+
hasMore,
|
|
50476
|
+
done: streamDone
|
|
50477
|
+
};
|
|
50478
|
+
},
|
|
50479
|
+
async getInfo(_runId, name) {
|
|
50480
|
+
const chunksBaseDir = path7.join(basedir, "streams", "chunks");
|
|
50481
|
+
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
50482
|
+
let streamDone = false;
|
|
50483
|
+
let dataCount = 0;
|
|
50484
|
+
for (const file3 of chunkFiles) {
|
|
50485
|
+
const ext2 = fileExtMap.get(file3) ?? ".bin";
|
|
50486
|
+
if (isEofByte(await readFirstByte(path7.join(chunksDir, `${file3}${ext2}`)))) {
|
|
50487
|
+
streamDone = true;
|
|
50488
|
+
break;
|
|
50489
|
+
}
|
|
50490
|
+
dataCount++;
|
|
50491
|
+
}
|
|
50492
|
+
return { tailIndex: dataCount - 1, done: streamDone };
|
|
50493
|
+
},
|
|
50494
|
+
async get(_runId, name, startIndex = 0) {
|
|
50495
|
+
const chunksBaseDir = path7.join(basedir, "streams", "chunks");
|
|
50496
|
+
let teardown = /* @__PURE__ */ __name(() => {
|
|
50497
|
+
}, "teardown");
|
|
50498
|
+
let pollInterval = null;
|
|
50499
|
+
let streamClosed = false;
|
|
50500
|
+
return new ReadableStream({
|
|
50501
|
+
async start(controller) {
|
|
50502
|
+
const deliveredChunkIds = /* @__PURE__ */ new Set();
|
|
50503
|
+
const bufferedEventChunks = [];
|
|
50504
|
+
let isReadingFromDisk = true;
|
|
50505
|
+
let pendingClose = false;
|
|
50506
|
+
const chunkListener = /* @__PURE__ */ __name((event) => {
|
|
50507
|
+
if (event.chunkData.byteLength === 0) {
|
|
50508
|
+
deliveredChunkIds.add(event.chunkId);
|
|
50509
|
+
return;
|
|
50510
|
+
}
|
|
50511
|
+
if (isReadingFromDisk) {
|
|
50512
|
+
deliveredChunkIds.add(event.chunkId);
|
|
50513
|
+
bufferedEventChunks.push({
|
|
50514
|
+
chunkId: event.chunkId,
|
|
50515
|
+
chunkData: Uint8Array.from(event.chunkData)
|
|
50516
|
+
});
|
|
50517
|
+
} else if (!deliveredChunkIds.has(event.chunkId)) {
|
|
50518
|
+
deliveredChunkIds.add(event.chunkId);
|
|
50519
|
+
controller.enqueue(Uint8Array.from(event.chunkData));
|
|
50520
|
+
}
|
|
50521
|
+
}, "chunkListener");
|
|
50522
|
+
const closeListener = /* @__PURE__ */ __name(() => {
|
|
50523
|
+
if (isReadingFromDisk) {
|
|
50524
|
+
pendingClose = true;
|
|
50525
|
+
return;
|
|
50526
|
+
}
|
|
50527
|
+
streamClosed = true;
|
|
50528
|
+
teardown();
|
|
50529
|
+
try {
|
|
50530
|
+
controller.close();
|
|
50531
|
+
} catch {
|
|
50532
|
+
}
|
|
50533
|
+
}, "closeListener");
|
|
50534
|
+
teardown = /* @__PURE__ */ __name(() => {
|
|
50535
|
+
streamEmitter.off(`chunk:${name}`, chunkListener);
|
|
50536
|
+
streamEmitter.off(`close:${name}`, closeListener);
|
|
50537
|
+
if (pollInterval) {
|
|
50538
|
+
clearInterval(pollInterval);
|
|
50539
|
+
pollInterval = null;
|
|
50540
|
+
}
|
|
50541
|
+
}, "teardown");
|
|
50542
|
+
streamEmitter.on(`chunk:${name}`, chunkListener);
|
|
50543
|
+
streamEmitter.on(`close:${name}`, closeListener);
|
|
50544
|
+
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
50545
|
+
let dataChunkCount = chunkFiles.length;
|
|
50546
|
+
if (typeof startIndex === "number" && startIndex < 0 && chunkFiles.length > 0) {
|
|
50547
|
+
const lastFile = chunkFiles[chunkFiles.length - 1];
|
|
50548
|
+
const lastExt = fileExtMap.get(lastFile) ?? ".bin";
|
|
50549
|
+
if (isEofByte(await readFirstByte(path7.join(chunksDir, `${lastFile}${lastExt}`)))) {
|
|
50550
|
+
dataChunkCount--;
|
|
50551
|
+
}
|
|
50552
|
+
}
|
|
50553
|
+
const resolvedStartIndex = typeof startIndex === "number" && startIndex < 0 ? Math.max(0, dataChunkCount + startIndex) : startIndex;
|
|
50554
|
+
let isComplete = false;
|
|
50555
|
+
for (let i = resolvedStartIndex; i < chunkFiles.length; i++) {
|
|
50556
|
+
const file3 = chunkFiles[i];
|
|
50557
|
+
const chunkId = file3;
|
|
50558
|
+
if (deliveredChunkIds.has(chunkId)) {
|
|
50559
|
+
continue;
|
|
50560
|
+
}
|
|
50561
|
+
const ext2 = fileExtMap.get(file3) ?? ".bin";
|
|
50562
|
+
const chunk = deserializeChunk(await readBuffer(path7.join(chunksDir, `${file3}${ext2}`)));
|
|
50563
|
+
if (chunk?.eof === true) {
|
|
50564
|
+
isComplete = true;
|
|
50565
|
+
break;
|
|
50566
|
+
}
|
|
50567
|
+
deliveredChunkIds.add(chunkId);
|
|
50568
|
+
if (chunk.chunk.byteLength) {
|
|
50569
|
+
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
50570
|
+
}
|
|
50571
|
+
}
|
|
50572
|
+
isReadingFromDisk = false;
|
|
50573
|
+
bufferedEventChunks.sort((a, b) => a.chunkId.localeCompare(b.chunkId));
|
|
50574
|
+
for (const buffered of bufferedEventChunks) {
|
|
50575
|
+
controller.enqueue(Uint8Array.from(buffered.chunkData));
|
|
50576
|
+
}
|
|
50577
|
+
if (isComplete) {
|
|
50578
|
+
streamClosed = true;
|
|
50579
|
+
teardown();
|
|
50580
|
+
try {
|
|
50581
|
+
controller.close();
|
|
50582
|
+
} catch {
|
|
50583
|
+
}
|
|
50584
|
+
return;
|
|
50585
|
+
}
|
|
50586
|
+
if (pendingClose) {
|
|
50587
|
+
streamClosed = true;
|
|
50588
|
+
teardown();
|
|
50589
|
+
try {
|
|
50590
|
+
controller.close();
|
|
50591
|
+
} catch {
|
|
50592
|
+
}
|
|
50593
|
+
return;
|
|
50594
|
+
}
|
|
50595
|
+
for (let i = 0; i < resolvedStartIndex && i < chunkFiles.length; i++) {
|
|
50596
|
+
deliveredChunkIds.add(chunkFiles[i]);
|
|
50597
|
+
}
|
|
50598
|
+
if (streamClosed) {
|
|
50599
|
+
teardown();
|
|
50600
|
+
return;
|
|
50601
|
+
}
|
|
50602
|
+
let isPolling = false;
|
|
50603
|
+
pollInterval = setInterval(async () => {
|
|
50604
|
+
if (isPolling)
|
|
50605
|
+
return;
|
|
50606
|
+
isPolling = true;
|
|
50607
|
+
try {
|
|
50608
|
+
const { files: currentFiles, extMap: currentExtMap } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
50609
|
+
for (const file3 of currentFiles) {
|
|
50610
|
+
const chunkId = file3;
|
|
50611
|
+
if (deliveredChunkIds.has(chunkId))
|
|
50612
|
+
continue;
|
|
50613
|
+
deliveredChunkIds.add(chunkId);
|
|
50614
|
+
const ext2 = currentExtMap.get(file3) ?? ".bin";
|
|
50615
|
+
const chunk = deserializeChunk(await readBuffer(path7.join(chunksDir, `${file3}${ext2}`)));
|
|
50616
|
+
if (chunk?.eof === true) {
|
|
50617
|
+
streamClosed = true;
|
|
50618
|
+
teardown();
|
|
50619
|
+
try {
|
|
50620
|
+
controller.close();
|
|
50621
|
+
} catch {
|
|
50622
|
+
}
|
|
50623
|
+
return;
|
|
50624
|
+
}
|
|
50625
|
+
if (streamClosed)
|
|
50626
|
+
return;
|
|
50627
|
+
if (chunk.chunk.byteLength) {
|
|
50628
|
+
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
50629
|
+
}
|
|
50630
|
+
}
|
|
50631
|
+
} catch (err) {
|
|
50632
|
+
if (!(err instanceof Error && "code" in err)) {
|
|
50633
|
+
console.error("[world-local] Unexpected polling error:", err);
|
|
50634
|
+
}
|
|
50635
|
+
} finally {
|
|
50636
|
+
isPolling = false;
|
|
50637
|
+
}
|
|
50638
|
+
}, 100);
|
|
50639
|
+
},
|
|
50640
|
+
cancel() {
|
|
50641
|
+
streamClosed = true;
|
|
50642
|
+
teardown();
|
|
50643
|
+
}
|
|
50644
|
+
});
|
|
50645
|
+
}
|
|
50646
|
+
}
|
|
50647
|
+
};
|
|
50648
|
+
}
|
|
50649
|
+
var chunkIds, monotonicUlid2, RunStreamsSchema, EOF_MARKER, PURGED_STREAM_TOMBSTONE_ID;
|
|
50650
|
+
var init_streamer = __esm({
|
|
50651
|
+
"../world-local/dist/streamer.js"() {
|
|
50652
|
+
"use strict";
|
|
50653
|
+
init_dist5();
|
|
50654
|
+
init_node2();
|
|
50655
|
+
init_zod2();
|
|
50656
|
+
init_fs();
|
|
50657
|
+
chunkIds = globalSingleton2("@workflow/world-local//streamerMonotonicUlid", 1, () => ({ next: monotonicFactory2(() => Math.random()) }));
|
|
50658
|
+
monotonicUlid2 = /* @__PURE__ */ __name((seedTime) => chunkIds.next(seedTime), "monotonicUlid");
|
|
50659
|
+
RunStreamsSchema = external_exports2.object({
|
|
50660
|
+
streams: external_exports2.array(external_exports2.string())
|
|
50661
|
+
});
|
|
50662
|
+
EOF_MARKER = 1;
|
|
50663
|
+
__name(isEofByte, "isEofByte");
|
|
50664
|
+
__name(serializeChunk, "serializeChunk");
|
|
50665
|
+
__name(isEofChunk, "isEofChunk");
|
|
50666
|
+
__name(deserializeChunk, "deserializeChunk");
|
|
50667
|
+
__name(listChunkEntries, "listChunkEntries");
|
|
50668
|
+
__name(addChunkFilesByExtension, "addChunkFilesByExtension");
|
|
50669
|
+
__name(chunkDirForStream, "chunkDirForStream");
|
|
50670
|
+
__name(listChunkFilesForStream, "listChunkFilesForStream");
|
|
50671
|
+
PURGED_STREAM_TOMBSTONE_ID = `chnk_${"0".repeat(26)}`;
|
|
50672
|
+
__name(purgeRunStreamData, "purgeRunStreamData");
|
|
50673
|
+
__name(logStreamPurgeFailure, "logStreamPurgeFailure");
|
|
50674
|
+
__name(createStreamer, "createStreamer");
|
|
50675
|
+
}
|
|
50676
|
+
});
|
|
50677
|
+
|
|
50678
|
+
// ../world-local/dist/storage/run-retention.js
|
|
50679
|
+
import path8 from "node:path";
|
|
50680
|
+
function purgesUserDataOnFinish2(attributes) {
|
|
50681
|
+
const retention = readRunRetention(attributes);
|
|
50682
|
+
if (retention.unsupported) {
|
|
50683
|
+
console.warn(`[world-local] Ignoring unrecognized ${RETENTION_ATTRIBUTE2} value ${JSON.stringify(retention.raw)}; keeping the run's data.`);
|
|
50684
|
+
}
|
|
50685
|
+
return retention.mode === "none";
|
|
50686
|
+
}
|
|
50687
|
+
function withRunPayloadsPurged(run3, purgedAt) {
|
|
50688
|
+
return {
|
|
50689
|
+
...run3,
|
|
50690
|
+
input: void 0,
|
|
50691
|
+
output: void 0,
|
|
50692
|
+
error: void 0,
|
|
50693
|
+
expiredAt: purgedAt
|
|
50694
|
+
};
|
|
50695
|
+
}
|
|
50696
|
+
async function purgeRunEntityData(basedir, runId, tag) {
|
|
50697
|
+
await Promise.all([
|
|
50698
|
+
scrubEntityFiles(path8.join(basedir, "steps"), runId, (step) => {
|
|
50699
|
+
step.input = void 0;
|
|
50700
|
+
step.output = void 0;
|
|
50701
|
+
step.error = void 0;
|
|
50702
|
+
}),
|
|
50703
|
+
scrubEntityFiles(path8.join(basedir, "events"), runId, (event) => {
|
|
50704
|
+
const eventData = event.eventData;
|
|
50705
|
+
if (!eventData || typeof eventData !== "object")
|
|
50706
|
+
return;
|
|
50707
|
+
for (const field of getEventDataRefFields(String(event.eventType))) {
|
|
50708
|
+
delete eventData[field];
|
|
50709
|
+
}
|
|
50710
|
+
}),
|
|
50711
|
+
scrubHookMetadata(basedir, runId),
|
|
50712
|
+
purgeRunStreamData(basedir, runId, tag)
|
|
50713
|
+
]);
|
|
50714
|
+
}
|
|
50715
|
+
async function scrubEntityFiles(directory, runId, scrub) {
|
|
50716
|
+
let fileIds;
|
|
50717
|
+
try {
|
|
50718
|
+
fileIds = await listJSONFiles(directory);
|
|
50719
|
+
} catch (error95) {
|
|
50720
|
+
logPurgeFailure(directory, error95);
|
|
50721
|
+
return;
|
|
50722
|
+
}
|
|
50723
|
+
for (const fileId of fileIds) {
|
|
50724
|
+
if (!fileId.startsWith(`${runId}-`))
|
|
50725
|
+
continue;
|
|
50726
|
+
const filePath = path8.join(directory, `${fileId}.json`);
|
|
50727
|
+
try {
|
|
50728
|
+
const raw = await readJSON(filePath, RawEntitySchema);
|
|
50729
|
+
if (!raw)
|
|
50730
|
+
continue;
|
|
50731
|
+
scrub(raw);
|
|
50732
|
+
await writeJSON(filePath, raw, { overwrite: true });
|
|
50733
|
+
} catch (error95) {
|
|
50734
|
+
logPurgeFailure(filePath, error95);
|
|
50735
|
+
}
|
|
50736
|
+
}
|
|
50737
|
+
}
|
|
50738
|
+
async function scrubHookMetadata(basedir, runId) {
|
|
50739
|
+
let markers;
|
|
50740
|
+
try {
|
|
50741
|
+
await ensureHookIndexes(basedir);
|
|
50742
|
+
markers = await listHookByRunMarkers(basedir, runId);
|
|
50743
|
+
} catch (error95) {
|
|
50744
|
+
logPurgeFailure(`hooks of ${runId}`, error95);
|
|
50745
|
+
return;
|
|
50746
|
+
}
|
|
50747
|
+
for (const marker of markers) {
|
|
50748
|
+
if (!marker.hookId)
|
|
50749
|
+
continue;
|
|
50750
|
+
try {
|
|
50751
|
+
const hookPath = taggedPath(basedir, "hooks", marker.hookId, marker.tag);
|
|
50752
|
+
const hook = await readJSON(hookPath, RawEntitySchema);
|
|
50753
|
+
if (!hook || hook.runId !== runId)
|
|
50754
|
+
continue;
|
|
50755
|
+
hook.metadata = void 0;
|
|
50756
|
+
await writeJSON(hookPath, hook, { overwrite: true });
|
|
50757
|
+
} catch (error95) {
|
|
50758
|
+
logPurgeFailure(marker.hookId, error95);
|
|
50759
|
+
}
|
|
50760
|
+
}
|
|
50761
|
+
}
|
|
50762
|
+
function logPurgeFailure(target2, error95) {
|
|
50763
|
+
console.warn(`[world-local] Failed to purge user data for ${target2}:`, error95 instanceof Error ? error95.message : error95);
|
|
50764
|
+
}
|
|
50765
|
+
var RawEntitySchema;
|
|
50766
|
+
var init_run_retention = __esm({
|
|
50767
|
+
"../world-local/dist/storage/run-retention.js"() {
|
|
50768
|
+
"use strict";
|
|
50769
|
+
init_dist6();
|
|
50770
|
+
init_zod2();
|
|
50771
|
+
init_fs();
|
|
50772
|
+
init_streamer();
|
|
50773
|
+
init_hook_index();
|
|
50774
|
+
__name(purgesUserDataOnFinish2, "purgesUserDataOnFinish");
|
|
50775
|
+
__name(withRunPayloadsPurged, "withRunPayloadsPurged");
|
|
50776
|
+
__name(purgeRunEntityData, "purgeRunEntityData");
|
|
50777
|
+
RawEntitySchema = external_exports2.record(external_exports2.string(), external_exports2.any());
|
|
50778
|
+
__name(scrubEntityFiles, "scrubEntityFiles");
|
|
50779
|
+
__name(scrubHookMetadata, "scrubHookMetadata");
|
|
50780
|
+
__name(logPurgeFailure, "logPurgeFailure");
|
|
50781
|
+
}
|
|
50782
|
+
});
|
|
50783
|
+
|
|
50784
|
+
// ../world-local/dist/storage/run-status-signal.js
|
|
50785
|
+
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
50209
50786
|
function getRunStatusPollIntervalMs() {
|
|
50210
50787
|
return envNumber2("WORKFLOW_LOCAL_RUN_STATUS_POLL_INTERVAL_MS", RUN_STATUS_POLL_INTERVAL_MS, { integer: true, min: 1 });
|
|
50211
50788
|
}
|
|
@@ -50237,7 +50814,7 @@ var init_run_status_signal = __esm({
|
|
|
50237
50814
|
"../world-local/dist/storage/run-status-signal.js"() {
|
|
50238
50815
|
"use strict";
|
|
50239
50816
|
init_dist6();
|
|
50240
|
-
emitter = new
|
|
50817
|
+
emitter = new EventEmitter2();
|
|
50241
50818
|
emitter.setMaxListeners(0);
|
|
50242
50819
|
RUN_STATUS_POLL_INTERVAL_MS = 100;
|
|
50243
50820
|
__name(getRunStatusPollIntervalMs, "getRunStatusPollIntervalMs");
|
|
@@ -50247,7 +50824,7 @@ var init_run_status_signal = __esm({
|
|
|
50247
50824
|
});
|
|
50248
50825
|
|
|
50249
50826
|
// ../world-local/dist/storage/legacy.js
|
|
50250
|
-
import
|
|
50827
|
+
import fs5 from "node:fs/promises";
|
|
50251
50828
|
async function publishLegacyHookReceived(basedir, runId, eventId, serializedEvent, eventPath, currentRun) {
|
|
50252
50829
|
if (isTerminalWorkflowRunStatus2(currentRun.status) || await isRunTerminalCommitted(basedir, runId)) {
|
|
50253
50830
|
throw new RunExpiredError2(`Workflow run "${runId}" is already in a terminal state`);
|
|
@@ -50263,7 +50840,7 @@ async function publishLegacyHookReceived(basedir, runId, eventId, serializedEven
|
|
|
50263
50840
|
throw new RunExpiredError2(`Workflow run "${runId}" is already in a terminal state`);
|
|
50264
50841
|
}
|
|
50265
50842
|
} finally {
|
|
50266
|
-
await
|
|
50843
|
+
await fs5.unlink(stagedPath).catch(() => {
|
|
50267
50844
|
});
|
|
50268
50845
|
}
|
|
50269
50846
|
}
|
|
@@ -50292,13 +50869,18 @@ async function handleLegacyEvent(basedir, runId, data, currentRun, params) {
|
|
|
50292
50869
|
updatedAt: now,
|
|
50293
50870
|
attributes: currentRun.attributes
|
|
50294
50871
|
};
|
|
50872
|
+
const purged = purgesUserDataOnFinish2(run3.attributes);
|
|
50873
|
+
const stored = purged ? withRunPayloadsPurged(run3, now) : run3;
|
|
50295
50874
|
const runPath = resolveWithinBase(basedir, "runs", `${runId}.json`);
|
|
50296
|
-
await writeJSON(runPath,
|
|
50875
|
+
await writeJSON(runPath, stored, { overwrite: true });
|
|
50297
50876
|
signalRunTerminal(runId);
|
|
50298
50877
|
await deleteAllHooksForRun(basedir, runId);
|
|
50878
|
+
if (purged) {
|
|
50879
|
+
await purgeRunEntityData(basedir, runId, void 0);
|
|
50880
|
+
}
|
|
50299
50881
|
return {
|
|
50300
50882
|
event: void 0,
|
|
50301
|
-
run: filterRunData(
|
|
50883
|
+
run: filterRunData(stored, resolveData)
|
|
50302
50884
|
};
|
|
50303
50885
|
}
|
|
50304
50886
|
case "wait_completed":
|
|
@@ -50335,6 +50917,7 @@ var init_legacy = __esm({
|
|
|
50335
50917
|
init_filters();
|
|
50336
50918
|
init_helpers2();
|
|
50337
50919
|
init_hooks_storage();
|
|
50920
|
+
init_run_retention();
|
|
50338
50921
|
init_run_status_signal();
|
|
50339
50922
|
__name(publishLegacyHookReceived, "publishLegacyHookReceived");
|
|
50340
50923
|
__name(handleLegacyEvent, "handleLegacyEvent");
|
|
@@ -50342,7 +50925,7 @@ var init_legacy = __esm({
|
|
|
50342
50925
|
});
|
|
50343
50926
|
|
|
50344
50927
|
// ../world-local/dist/storage/runs-storage.js
|
|
50345
|
-
import
|
|
50928
|
+
import path9 from "node:path";
|
|
50346
50929
|
function withRunFileLock(key, fn) {
|
|
50347
50930
|
const prev = runLocks.byKey.get(key);
|
|
50348
50931
|
const taskBox = {};
|
|
@@ -50413,7 +50996,7 @@ function createRunsStorage(basedir, tag) {
|
|
|
50413
50996
|
list: /* @__PURE__ */ __name((async (params) => {
|
|
50414
50997
|
const resolveData = params?.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION;
|
|
50415
50998
|
const result2 = await paginatedFileSystemQuery({
|
|
50416
|
-
directory:
|
|
50999
|
+
directory: path9.join(basedir, "runs"),
|
|
50417
51000
|
schema: WorkflowRunSchema2,
|
|
50418
51001
|
fileIdFilter: params?.fileIdFilter,
|
|
50419
51002
|
filter: /* @__PURE__ */ __name((run3) => {
|
|
@@ -50498,8 +51081,8 @@ var init_runs_storage = __esm({
|
|
|
50498
51081
|
|
|
50499
51082
|
// ../world-local/dist/storage/events-storage.js
|
|
50500
51083
|
import assert3 from "node:assert";
|
|
50501
|
-
import
|
|
50502
|
-
import
|
|
51084
|
+
import fs6 from "node:fs/promises";
|
|
51085
|
+
import path10 from "node:path";
|
|
50503
51086
|
function getHookRetentionLimitMs() {
|
|
50504
51087
|
const days = Number(process.env.WORKFLOW_LOCAL_HOOK_RETENTION_LIMIT_DAYS ?? 30);
|
|
50505
51088
|
if (!Number.isFinite(days) || days <= 0) {
|
|
@@ -50555,7 +51138,7 @@ function eventSortKeyFromFileId(runId, fileId) {
|
|
|
50555
51138
|
}
|
|
50556
51139
|
async function findExistingHookCreatedEventId(basedir, runId, correlationId) {
|
|
50557
51140
|
const result2 = await paginatedFileSystemQuery({
|
|
50558
|
-
directory:
|
|
51141
|
+
directory: path10.join(basedir, "events"),
|
|
50559
51142
|
schema: EventSchema2,
|
|
50560
51143
|
filePrefix: `${runId}-`,
|
|
50561
51144
|
filter: /* @__PURE__ */ __name((event) => event.eventType === "hook_created" && event.correlationId === correlationId, "filter"),
|
|
@@ -50610,11 +51193,11 @@ function withInProcessLock(locks, key, fn) {
|
|
|
50610
51193
|
return task;
|
|
50611
51194
|
}
|
|
50612
51195
|
async function deleteAllWaitsForRun(basedir, runId) {
|
|
50613
|
-
const waitsDir =
|
|
51196
|
+
const waitsDir = path10.join(basedir, "waits");
|
|
50614
51197
|
const files = await listJSONFiles(waitsDir);
|
|
50615
51198
|
for (const file3 of files) {
|
|
50616
51199
|
if (file3.startsWith(`${runId}-`)) {
|
|
50617
|
-
const waitPath =
|
|
51200
|
+
const waitPath = path10.join(waitsDir, `${file3}.json`);
|
|
50618
51201
|
await deleteJSON(waitPath);
|
|
50619
51202
|
}
|
|
50620
51203
|
}
|
|
@@ -50622,17 +51205,19 @@ async function deleteAllWaitsForRun(basedir, runId) {
|
|
|
50622
51205
|
async function writeRunUnderLifecycleLock(basedir, runId, tag, proposed) {
|
|
50623
51206
|
return withRunFileLock(runId, async () => {
|
|
50624
51207
|
const fresh = await readJSON(taggedPath(basedir, "runs", runId, tag), WorkflowRunSchema2);
|
|
50625
|
-
const
|
|
50626
|
-
|
|
50627
|
-
|
|
50628
|
-
|
|
51208
|
+
const attributes = fresh?.attributes ?? proposed.attributes;
|
|
51209
|
+
let next2 = { ...proposed, attributes };
|
|
51210
|
+
const purged = isTerminalWorkflowRunStatus2(next2.status) && purgesUserDataOnFinish2(attributes);
|
|
51211
|
+
if (purged) {
|
|
51212
|
+
next2 = withRunPayloadsPurged(next2, /* @__PURE__ */ new Date());
|
|
51213
|
+
}
|
|
50629
51214
|
await writeJSON(taggedPath(basedir, "runs", runId, tag), next2, {
|
|
50630
51215
|
overwrite: true
|
|
50631
51216
|
});
|
|
50632
51217
|
if (isTerminalWorkflowRunStatus2(next2.status)) {
|
|
50633
51218
|
signalRunTerminal(runId);
|
|
50634
51219
|
}
|
|
50635
|
-
return next2;
|
|
51220
|
+
return { run: next2, purged };
|
|
50636
51221
|
});
|
|
50637
51222
|
}
|
|
50638
51223
|
function createEventsStorage(basedir, tag) {
|
|
@@ -50684,7 +51269,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
50684
51269
|
taggedPath(basedir, "events", fileId)
|
|
50685
51270
|
] : [taggedPath(basedir, "events", fileId)]) {
|
|
50686
51271
|
try {
|
|
50687
|
-
await
|
|
51272
|
+
await fs6.stat(candidate);
|
|
50688
51273
|
return true;
|
|
50689
51274
|
} catch (error95) {
|
|
50690
51275
|
if (error95.code !== "ENOENT") {
|
|
@@ -50799,7 +51384,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
50799
51384
|
}
|
|
50800
51385
|
__name(storeEvent, "storeEvent");
|
|
50801
51386
|
const queryRunEvents = /* @__PURE__ */ __name((runId, pagination) => paginatedFileSystemQuery({
|
|
50802
|
-
directory:
|
|
51387
|
+
directory: path10.join(basedir, "events"),
|
|
50803
51388
|
schema: EventSchema2,
|
|
50804
51389
|
cachedItems: eventCache,
|
|
50805
51390
|
filePrefix: `${runId}-`,
|
|
@@ -51071,6 +51656,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
51071
51656
|
event = { ...event, eventData };
|
|
51072
51657
|
}
|
|
51073
51658
|
let run3;
|
|
51659
|
+
let runPurged = false;
|
|
51074
51660
|
let step;
|
|
51075
51661
|
let hook;
|
|
51076
51662
|
let wait;
|
|
@@ -51134,7 +51720,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
51134
51720
|
maxEvents: getMaxEventsPerRun()
|
|
51135
51721
|
};
|
|
51136
51722
|
}
|
|
51137
|
-
|
|
51723
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
51138
51724
|
runId: currentRun.runId,
|
|
51139
51725
|
deploymentId: currentRun.deploymentId,
|
|
51140
51726
|
workflowName: currentRun.workflowName,
|
|
@@ -51152,11 +51738,13 @@ function createEventsStorage(basedir, tag) {
|
|
|
51152
51738
|
attributes: currentRun.attributes,
|
|
51153
51739
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
51154
51740
|
});
|
|
51741
|
+
run3 = written.run;
|
|
51742
|
+
runPurged = written.purged;
|
|
51155
51743
|
}
|
|
51156
51744
|
} else if (data.eventType === "run_completed" && "eventData" in data) {
|
|
51157
51745
|
const completedData = data.eventData;
|
|
51158
51746
|
if (currentRun) {
|
|
51159
|
-
|
|
51747
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
51160
51748
|
runId: currentRun.runId,
|
|
51161
51749
|
deploymentId: currentRun.deploymentId,
|
|
51162
51750
|
workflowName: currentRun.workflowName,
|
|
@@ -51174,6 +51762,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
51174
51762
|
attributes: currentRun.attributes,
|
|
51175
51763
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
51176
51764
|
});
|
|
51765
|
+
run3 = written.run;
|
|
51766
|
+
runPurged = written.purged;
|
|
51177
51767
|
await Promise.all([
|
|
51178
51768
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
51179
51769
|
deleteAllWaitsForRun(basedir, effectiveRunId)
|
|
@@ -51182,7 +51772,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
51182
51772
|
} else if (data.eventType === "run_failed" && "eventData" in data) {
|
|
51183
51773
|
const failedData = data.eventData;
|
|
51184
51774
|
if (currentRun) {
|
|
51185
|
-
|
|
51775
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
51186
51776
|
runId: currentRun.runId,
|
|
51187
51777
|
deploymentId: currentRun.deploymentId,
|
|
51188
51778
|
workflowName: currentRun.workflowName,
|
|
@@ -51201,6 +51791,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
51201
51791
|
attributes: currentRun.attributes,
|
|
51202
51792
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
51203
51793
|
});
|
|
51794
|
+
run3 = written.run;
|
|
51795
|
+
runPurged = written.purged;
|
|
51204
51796
|
await Promise.all([
|
|
51205
51797
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
51206
51798
|
deleteAllWaitsForRun(basedir, effectiveRunId)
|
|
@@ -51208,7 +51800,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
51208
51800
|
}
|
|
51209
51801
|
} else if (data.eventType === "run_cancelled") {
|
|
51210
51802
|
if (currentRun) {
|
|
51211
|
-
|
|
51803
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
51212
51804
|
runId: currentRun.runId,
|
|
51213
51805
|
deploymentId: currentRun.deploymentId,
|
|
51214
51806
|
workflowName: currentRun.workflowName,
|
|
@@ -51226,6 +51818,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
51226
51818
|
attributes: currentRun.attributes,
|
|
51227
51819
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
51228
51820
|
});
|
|
51821
|
+
run3 = written.run;
|
|
51822
|
+
runPurged = written.purged;
|
|
51229
51823
|
await Promise.all([
|
|
51230
51824
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
51231
51825
|
deleteAllWaitsForRun(basedir, effectiveRunId)
|
|
@@ -51578,7 +52172,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
51578
52172
|
}
|
|
51579
52173
|
const existingWait = await readJSONWithFallback(basedir, "waits", waitCompositeKey, WaitSchema2, tag);
|
|
51580
52174
|
if (!existingWait) {
|
|
51581
|
-
await
|
|
52175
|
+
await fs6.unlink(lockPath).catch(() => {
|
|
51582
52176
|
});
|
|
51583
52177
|
throw new WorkflowWorldError2(`Wait "${data.correlationId}" not found`);
|
|
51584
52178
|
}
|
|
@@ -51681,6 +52275,10 @@ function createEventsStorage(basedir, tag) {
|
|
|
51681
52275
|
await writeHookByRunMarker(basedir, hook.runId, hook.hookId, tag);
|
|
51682
52276
|
await writeJSON(taggedPath(basedir, "hooks", hook.hookId, tag), hook, hookEntityWriteOptions);
|
|
51683
52277
|
}
|
|
52278
|
+
if (runPurged) {
|
|
52279
|
+
await purgeRunEntityData(basedir, effectiveRunId, tag);
|
|
52280
|
+
clearRunCache(effectiveRunId);
|
|
52281
|
+
}
|
|
51684
52282
|
const resolveData = params?.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION;
|
|
51685
52283
|
const filteredEvent = stripEventDataRefs(event, resolveData);
|
|
51686
52284
|
let eventPage;
|
|
@@ -51753,7 +52351,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
51753
52351
|
assertSafeEntityId("runId", params.runId);
|
|
51754
52352
|
const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION;
|
|
51755
52353
|
const result2 = await paginatedFileSystemQuery({
|
|
51756
|
-
directory:
|
|
52354
|
+
directory: path10.join(basedir, "events"),
|
|
51757
52355
|
schema: EventSchema2,
|
|
51758
52356
|
cachedItems: eventCache,
|
|
51759
52357
|
// Scoped to the run's own event files, since a correlation id
|
|
@@ -51839,6 +52437,7 @@ var init_events_storage = __esm({
|
|
|
51839
52437
|
init_hook_index();
|
|
51840
52438
|
init_hooks_storage();
|
|
51841
52439
|
init_legacy();
|
|
52440
|
+
init_run_retention();
|
|
51842
52441
|
init_run_status_signal();
|
|
51843
52442
|
init_runs_storage();
|
|
51844
52443
|
DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -51871,7 +52470,7 @@ var init_events_storage = __esm({
|
|
|
51871
52470
|
});
|
|
51872
52471
|
|
|
51873
52472
|
// ../world-local/dist/storage/steps-storage.js
|
|
51874
|
-
import
|
|
52473
|
+
import path11 from "node:path";
|
|
51875
52474
|
function createStepsStorage(basedir, tag) {
|
|
51876
52475
|
return {
|
|
51877
52476
|
get: /* @__PURE__ */ __name((async (runId, stepId, params) => {
|
|
@@ -51889,7 +52488,7 @@ function createStepsStorage(basedir, tag) {
|
|
|
51889
52488
|
assertSafeEntityId("runId", params.runId);
|
|
51890
52489
|
const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION;
|
|
51891
52490
|
const result2 = await paginatedFileSystemQuery({
|
|
51892
|
-
directory:
|
|
52491
|
+
directory: path11.join(basedir, "steps"),
|
|
51893
52492
|
schema: StepSchema2,
|
|
51894
52493
|
filePrefix: `${params.runId}-`,
|
|
51895
52494
|
sortOrder: params.pagination?.sortOrder ?? "desc",
|
|
@@ -51958,409 +52557,10 @@ var init_storage2 = __esm({
|
|
|
51958
52557
|
}
|
|
51959
52558
|
});
|
|
51960
52559
|
|
|
51961
|
-
// ../world-local/dist/streamer.js
|
|
51962
|
-
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
51963
|
-
import fs6 from "node:fs/promises";
|
|
51964
|
-
import path10 from "node:path";
|
|
51965
|
-
function isEofByte(byte) {
|
|
51966
|
-
return byte === EOF_MARKER;
|
|
51967
|
-
}
|
|
51968
|
-
function serializeChunk(chunk) {
|
|
51969
|
-
const eofByte = Buffer.from([chunk.eof ? EOF_MARKER : 0]);
|
|
51970
|
-
return Buffer.concat([eofByte, chunk.chunk]);
|
|
51971
|
-
}
|
|
51972
|
-
function isEofChunk(serialized) {
|
|
51973
|
-
return isEofByte(serialized[0]);
|
|
51974
|
-
}
|
|
51975
|
-
function deserializeChunk(serialized) {
|
|
51976
|
-
const eof = isEofChunk(serialized);
|
|
51977
|
-
const chunk = Buffer.from(serialized.subarray(1));
|
|
51978
|
-
return { eof, chunk };
|
|
51979
|
-
}
|
|
51980
|
-
async function listChunkEntries(chunksDir) {
|
|
51981
|
-
try {
|
|
51982
|
-
return await fs6.readdir(chunksDir);
|
|
51983
|
-
} catch (error95) {
|
|
51984
|
-
if (error95.code === "ENOENT")
|
|
51985
|
-
return [];
|
|
51986
|
-
throw error95;
|
|
51987
|
-
}
|
|
51988
|
-
}
|
|
51989
|
-
function addChunkFilesByExtension(extMap, entries, sourceExtension, fileExtension = sourceExtension, include = () => true) {
|
|
51990
|
-
for (const entry of entries) {
|
|
51991
|
-
if (!entry.endsWith(sourceExtension))
|
|
51992
|
-
continue;
|
|
51993
|
-
const file3 = entry.slice(0, -sourceExtension.length);
|
|
51994
|
-
if (include(file3))
|
|
51995
|
-
extMap.set(file3, fileExtension);
|
|
51996
|
-
}
|
|
51997
|
-
}
|
|
51998
|
-
function chunkDirForStream(chunksBaseDir, name) {
|
|
51999
|
-
assertSafeEntityId("streamName", name);
|
|
52000
|
-
return path10.join(chunksBaseDir, name);
|
|
52001
|
-
}
|
|
52002
|
-
async function listChunkFilesForStream(chunksBaseDir, name, tag) {
|
|
52003
|
-
const dir = chunkDirForStream(chunksBaseDir, name);
|
|
52004
|
-
const entries = await listChunkEntries(dir);
|
|
52005
|
-
const extMap = /* @__PURE__ */ new Map();
|
|
52006
|
-
addChunkFilesByExtension(extMap, entries, ".json");
|
|
52007
|
-
addChunkFilesByExtension(extMap, entries, ".bin", ".bin", tag ? (file3) => !file3.endsWith(`.${tag}`) : void 0);
|
|
52008
|
-
if (tag) {
|
|
52009
|
-
const taggedExtension = `.${tag}.bin`;
|
|
52010
|
-
addChunkFilesByExtension(extMap, entries, taggedExtension);
|
|
52011
|
-
}
|
|
52012
|
-
const files = [...extMap.keys()].sort();
|
|
52013
|
-
return { files, extMap, dir };
|
|
52014
|
-
}
|
|
52015
|
-
function createStreamer(basedir, tag) {
|
|
52016
|
-
const tagSuffix = tag ? `.${tag}` : "";
|
|
52017
|
-
const streamEmitter = new EventEmitter2();
|
|
52018
|
-
const registeredStreams = /* @__PURE__ */ new Set();
|
|
52019
|
-
async function registerStreamForRun(runId, streamName) {
|
|
52020
|
-
assertSafeEntityId("runId", runId);
|
|
52021
|
-
assertSafeEntityId("streamName", streamName);
|
|
52022
|
-
const cacheKey = `${runId}:${streamName}`;
|
|
52023
|
-
if (registeredStreams.has(cacheKey)) {
|
|
52024
|
-
return;
|
|
52025
|
-
}
|
|
52026
|
-
const runStreamsPath = taggedPath(basedir, "streams/runs", runId, tag);
|
|
52027
|
-
const existing = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
52028
|
-
const streams = existing?.streams ?? [];
|
|
52029
|
-
if (!streams.includes(streamName)) {
|
|
52030
|
-
streams.push(streamName);
|
|
52031
|
-
await writeJSON(runStreamsPath, { streams }, { overwrite: true });
|
|
52032
|
-
}
|
|
52033
|
-
registeredStreams.add(cacheKey);
|
|
52034
|
-
}
|
|
52035
|
-
__name(registerStreamForRun, "registerStreamForRun");
|
|
52036
|
-
function toBuffer(chunk) {
|
|
52037
|
-
if (typeof chunk === "string") {
|
|
52038
|
-
return Buffer.from(new TextEncoder().encode(chunk));
|
|
52039
|
-
} else if (chunk instanceof Buffer) {
|
|
52040
|
-
return chunk;
|
|
52041
|
-
} else {
|
|
52042
|
-
return Buffer.from(chunk);
|
|
52043
|
-
}
|
|
52044
|
-
}
|
|
52045
|
-
__name(toBuffer, "toBuffer");
|
|
52046
|
-
return {
|
|
52047
|
-
streams: {
|
|
52048
|
-
async write(_runId, name, chunk) {
|
|
52049
|
-
const chunkId = `chnk_${monotonicUlid2()}`;
|
|
52050
|
-
const runId = await _runId;
|
|
52051
|
-
await registerStreamForRun(runId, name);
|
|
52052
|
-
const chunkBuffer = toBuffer(chunk);
|
|
52053
|
-
const serialized = serializeChunk({
|
|
52054
|
-
chunk: chunkBuffer,
|
|
52055
|
-
eof: false
|
|
52056
|
-
});
|
|
52057
|
-
const chunkPath = path10.join(chunkDirForStream(path10.join(basedir, "streams", "chunks"), name), `${chunkId}${tagSuffix}.bin`);
|
|
52058
|
-
await write(chunkPath, serialized);
|
|
52059
|
-
const chunkData = Uint8Array.from(chunkBuffer);
|
|
52060
|
-
streamEmitter.emit(`chunk:${name}`, {
|
|
52061
|
-
streamName: name,
|
|
52062
|
-
chunkData,
|
|
52063
|
-
chunkId
|
|
52064
|
-
});
|
|
52065
|
-
},
|
|
52066
|
-
async writeMulti(_runId, name, chunks) {
|
|
52067
|
-
if (chunks.length === 0)
|
|
52068
|
-
return;
|
|
52069
|
-
const chunkIds2 = chunks.map(() => `chnk_${monotonicUlid2()}`);
|
|
52070
|
-
const runId = await _runId;
|
|
52071
|
-
await registerStreamForRun(runId, name);
|
|
52072
|
-
const chunkBuffers = chunks.map((chunk) => toBuffer(chunk));
|
|
52073
|
-
const writePromises = chunkBuffers.map(async (chunkBuffer, i) => {
|
|
52074
|
-
const chunkId = chunkIds2[i];
|
|
52075
|
-
const serialized = serializeChunk({
|
|
52076
|
-
chunk: chunkBuffer,
|
|
52077
|
-
eof: false
|
|
52078
|
-
});
|
|
52079
|
-
const chunkPath = path10.join(chunkDirForStream(path10.join(basedir, "streams", "chunks"), name), `${chunkId}${tagSuffix}.bin`);
|
|
52080
|
-
await write(chunkPath, serialized);
|
|
52081
|
-
return {
|
|
52082
|
-
chunkId,
|
|
52083
|
-
chunkData: Uint8Array.from(chunkBuffer)
|
|
52084
|
-
};
|
|
52085
|
-
});
|
|
52086
|
-
for (const writePromise of writePromises) {
|
|
52087
|
-
const { chunkId, chunkData } = await writePromise;
|
|
52088
|
-
streamEmitter.emit(`chunk:${name}`, {
|
|
52089
|
-
streamName: name,
|
|
52090
|
-
chunkData,
|
|
52091
|
-
chunkId
|
|
52092
|
-
});
|
|
52093
|
-
}
|
|
52094
|
-
},
|
|
52095
|
-
async close(_runId, name) {
|
|
52096
|
-
const chunkId = `chnk_${monotonicUlid2()}`;
|
|
52097
|
-
const runId = await _runId;
|
|
52098
|
-
await registerStreamForRun(runId, name);
|
|
52099
|
-
const chunkPath = path10.join(chunkDirForStream(path10.join(basedir, "streams", "chunks"), name), `${chunkId}${tagSuffix}.bin`);
|
|
52100
|
-
await write(chunkPath, serializeChunk({ chunk: Buffer.from([]), eof: true }));
|
|
52101
|
-
streamEmitter.emit(`close:${name}`, { streamName: name });
|
|
52102
|
-
},
|
|
52103
|
-
async list(runId) {
|
|
52104
|
-
assertSafeEntityId("runId", runId);
|
|
52105
|
-
const data = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
52106
|
-
return data?.streams ?? [];
|
|
52107
|
-
},
|
|
52108
|
-
async getChunks(_runId, name, options) {
|
|
52109
|
-
const limit = options?.limit ?? 100;
|
|
52110
|
-
const chunksBaseDir = path10.join(basedir, "streams", "chunks");
|
|
52111
|
-
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
52112
|
-
let startIndex = 0;
|
|
52113
|
-
if (options?.cursor) {
|
|
52114
|
-
try {
|
|
52115
|
-
const decoded = JSON.parse(Buffer.from(options.cursor, "base64").toString("utf-8"));
|
|
52116
|
-
startIndex = decoded.i;
|
|
52117
|
-
} catch {
|
|
52118
|
-
startIndex = 0;
|
|
52119
|
-
}
|
|
52120
|
-
}
|
|
52121
|
-
let streamDone = false;
|
|
52122
|
-
const resultChunks = [];
|
|
52123
|
-
let dataIndex = 0;
|
|
52124
|
-
for (const file3 of chunkFiles) {
|
|
52125
|
-
const ext2 = fileExtMap.get(file3) ?? ".bin";
|
|
52126
|
-
const filePath = path10.join(chunksDir, `${file3}${ext2}`);
|
|
52127
|
-
if (dataIndex < startIndex) {
|
|
52128
|
-
if (isEofByte(await readFirstByte(filePath))) {
|
|
52129
|
-
streamDone = true;
|
|
52130
|
-
break;
|
|
52131
|
-
}
|
|
52132
|
-
dataIndex++;
|
|
52133
|
-
continue;
|
|
52134
|
-
}
|
|
52135
|
-
if (resultChunks.length >= limit) {
|
|
52136
|
-
if (isEofByte(await readFirstByte(filePath))) {
|
|
52137
|
-
streamDone = true;
|
|
52138
|
-
} else {
|
|
52139
|
-
dataIndex++;
|
|
52140
|
-
}
|
|
52141
|
-
break;
|
|
52142
|
-
}
|
|
52143
|
-
const chunk = deserializeChunk(await readBuffer(filePath));
|
|
52144
|
-
if (chunk.eof) {
|
|
52145
|
-
streamDone = true;
|
|
52146
|
-
break;
|
|
52147
|
-
}
|
|
52148
|
-
resultChunks.push({
|
|
52149
|
-
index: dataIndex,
|
|
52150
|
-
data: Uint8Array.from(chunk.chunk)
|
|
52151
|
-
});
|
|
52152
|
-
dataIndex++;
|
|
52153
|
-
}
|
|
52154
|
-
const hasMore = !streamDone && dataIndex > startIndex + resultChunks.length;
|
|
52155
|
-
const nextIndex = startIndex + resultChunks.length;
|
|
52156
|
-
const nextCursor = hasMore ? Buffer.from(JSON.stringify({ i: nextIndex })).toString("base64") : null;
|
|
52157
|
-
return {
|
|
52158
|
-
data: resultChunks,
|
|
52159
|
-
cursor: nextCursor,
|
|
52160
|
-
hasMore,
|
|
52161
|
-
done: streamDone
|
|
52162
|
-
};
|
|
52163
|
-
},
|
|
52164
|
-
async getInfo(_runId, name) {
|
|
52165
|
-
const chunksBaseDir = path10.join(basedir, "streams", "chunks");
|
|
52166
|
-
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
52167
|
-
let streamDone = false;
|
|
52168
|
-
let dataCount = 0;
|
|
52169
|
-
for (const file3 of chunkFiles) {
|
|
52170
|
-
const ext2 = fileExtMap.get(file3) ?? ".bin";
|
|
52171
|
-
if (isEofByte(await readFirstByte(path10.join(chunksDir, `${file3}${ext2}`)))) {
|
|
52172
|
-
streamDone = true;
|
|
52173
|
-
break;
|
|
52174
|
-
}
|
|
52175
|
-
dataCount++;
|
|
52176
|
-
}
|
|
52177
|
-
return { tailIndex: dataCount - 1, done: streamDone };
|
|
52178
|
-
},
|
|
52179
|
-
async get(_runId, name, startIndex = 0) {
|
|
52180
|
-
const chunksBaseDir = path10.join(basedir, "streams", "chunks");
|
|
52181
|
-
let teardown = /* @__PURE__ */ __name(() => {
|
|
52182
|
-
}, "teardown");
|
|
52183
|
-
let pollInterval = null;
|
|
52184
|
-
let streamClosed = false;
|
|
52185
|
-
return new ReadableStream({
|
|
52186
|
-
async start(controller) {
|
|
52187
|
-
const deliveredChunkIds = /* @__PURE__ */ new Set();
|
|
52188
|
-
const bufferedEventChunks = [];
|
|
52189
|
-
let isReadingFromDisk = true;
|
|
52190
|
-
let pendingClose = false;
|
|
52191
|
-
const chunkListener = /* @__PURE__ */ __name((event) => {
|
|
52192
|
-
if (event.chunkData.byteLength === 0) {
|
|
52193
|
-
deliveredChunkIds.add(event.chunkId);
|
|
52194
|
-
return;
|
|
52195
|
-
}
|
|
52196
|
-
if (isReadingFromDisk) {
|
|
52197
|
-
deliveredChunkIds.add(event.chunkId);
|
|
52198
|
-
bufferedEventChunks.push({
|
|
52199
|
-
chunkId: event.chunkId,
|
|
52200
|
-
chunkData: Uint8Array.from(event.chunkData)
|
|
52201
|
-
});
|
|
52202
|
-
} else if (!deliveredChunkIds.has(event.chunkId)) {
|
|
52203
|
-
deliveredChunkIds.add(event.chunkId);
|
|
52204
|
-
controller.enqueue(Uint8Array.from(event.chunkData));
|
|
52205
|
-
}
|
|
52206
|
-
}, "chunkListener");
|
|
52207
|
-
const closeListener = /* @__PURE__ */ __name(() => {
|
|
52208
|
-
if (isReadingFromDisk) {
|
|
52209
|
-
pendingClose = true;
|
|
52210
|
-
return;
|
|
52211
|
-
}
|
|
52212
|
-
streamClosed = true;
|
|
52213
|
-
teardown();
|
|
52214
|
-
try {
|
|
52215
|
-
controller.close();
|
|
52216
|
-
} catch {
|
|
52217
|
-
}
|
|
52218
|
-
}, "closeListener");
|
|
52219
|
-
teardown = /* @__PURE__ */ __name(() => {
|
|
52220
|
-
streamEmitter.off(`chunk:${name}`, chunkListener);
|
|
52221
|
-
streamEmitter.off(`close:${name}`, closeListener);
|
|
52222
|
-
if (pollInterval) {
|
|
52223
|
-
clearInterval(pollInterval);
|
|
52224
|
-
pollInterval = null;
|
|
52225
|
-
}
|
|
52226
|
-
}, "teardown");
|
|
52227
|
-
streamEmitter.on(`chunk:${name}`, chunkListener);
|
|
52228
|
-
streamEmitter.on(`close:${name}`, closeListener);
|
|
52229
|
-
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
52230
|
-
let dataChunkCount = chunkFiles.length;
|
|
52231
|
-
if (typeof startIndex === "number" && startIndex < 0 && chunkFiles.length > 0) {
|
|
52232
|
-
const lastFile = chunkFiles[chunkFiles.length - 1];
|
|
52233
|
-
const lastExt = fileExtMap.get(lastFile) ?? ".bin";
|
|
52234
|
-
if (isEofByte(await readFirstByte(path10.join(chunksDir, `${lastFile}${lastExt}`)))) {
|
|
52235
|
-
dataChunkCount--;
|
|
52236
|
-
}
|
|
52237
|
-
}
|
|
52238
|
-
const resolvedStartIndex = typeof startIndex === "number" && startIndex < 0 ? Math.max(0, dataChunkCount + startIndex) : startIndex;
|
|
52239
|
-
let isComplete = false;
|
|
52240
|
-
for (let i = resolvedStartIndex; i < chunkFiles.length; i++) {
|
|
52241
|
-
const file3 = chunkFiles[i];
|
|
52242
|
-
const chunkId = file3;
|
|
52243
|
-
if (deliveredChunkIds.has(chunkId)) {
|
|
52244
|
-
continue;
|
|
52245
|
-
}
|
|
52246
|
-
const ext2 = fileExtMap.get(file3) ?? ".bin";
|
|
52247
|
-
const chunk = deserializeChunk(await readBuffer(path10.join(chunksDir, `${file3}${ext2}`)));
|
|
52248
|
-
if (chunk?.eof === true) {
|
|
52249
|
-
isComplete = true;
|
|
52250
|
-
break;
|
|
52251
|
-
}
|
|
52252
|
-
deliveredChunkIds.add(chunkId);
|
|
52253
|
-
if (chunk.chunk.byteLength) {
|
|
52254
|
-
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
52255
|
-
}
|
|
52256
|
-
}
|
|
52257
|
-
isReadingFromDisk = false;
|
|
52258
|
-
bufferedEventChunks.sort((a, b) => a.chunkId.localeCompare(b.chunkId));
|
|
52259
|
-
for (const buffered of bufferedEventChunks) {
|
|
52260
|
-
controller.enqueue(Uint8Array.from(buffered.chunkData));
|
|
52261
|
-
}
|
|
52262
|
-
if (isComplete) {
|
|
52263
|
-
streamClosed = true;
|
|
52264
|
-
teardown();
|
|
52265
|
-
try {
|
|
52266
|
-
controller.close();
|
|
52267
|
-
} catch {
|
|
52268
|
-
}
|
|
52269
|
-
return;
|
|
52270
|
-
}
|
|
52271
|
-
if (pendingClose) {
|
|
52272
|
-
streamClosed = true;
|
|
52273
|
-
teardown();
|
|
52274
|
-
try {
|
|
52275
|
-
controller.close();
|
|
52276
|
-
} catch {
|
|
52277
|
-
}
|
|
52278
|
-
return;
|
|
52279
|
-
}
|
|
52280
|
-
for (let i = 0; i < resolvedStartIndex && i < chunkFiles.length; i++) {
|
|
52281
|
-
deliveredChunkIds.add(chunkFiles[i]);
|
|
52282
|
-
}
|
|
52283
|
-
if (streamClosed) {
|
|
52284
|
-
teardown();
|
|
52285
|
-
return;
|
|
52286
|
-
}
|
|
52287
|
-
let isPolling = false;
|
|
52288
|
-
pollInterval = setInterval(async () => {
|
|
52289
|
-
if (isPolling)
|
|
52290
|
-
return;
|
|
52291
|
-
isPolling = true;
|
|
52292
|
-
try {
|
|
52293
|
-
const { files: currentFiles, extMap: currentExtMap } = await listChunkFilesForStream(chunksBaseDir, name, tag);
|
|
52294
|
-
for (const file3 of currentFiles) {
|
|
52295
|
-
const chunkId = file3;
|
|
52296
|
-
if (deliveredChunkIds.has(chunkId))
|
|
52297
|
-
continue;
|
|
52298
|
-
deliveredChunkIds.add(chunkId);
|
|
52299
|
-
const ext2 = currentExtMap.get(file3) ?? ".bin";
|
|
52300
|
-
const chunk = deserializeChunk(await readBuffer(path10.join(chunksDir, `${file3}${ext2}`)));
|
|
52301
|
-
if (chunk?.eof === true) {
|
|
52302
|
-
streamClosed = true;
|
|
52303
|
-
teardown();
|
|
52304
|
-
try {
|
|
52305
|
-
controller.close();
|
|
52306
|
-
} catch {
|
|
52307
|
-
}
|
|
52308
|
-
return;
|
|
52309
|
-
}
|
|
52310
|
-
if (streamClosed)
|
|
52311
|
-
return;
|
|
52312
|
-
if (chunk.chunk.byteLength) {
|
|
52313
|
-
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
52314
|
-
}
|
|
52315
|
-
}
|
|
52316
|
-
} catch (err) {
|
|
52317
|
-
if (!(err instanceof Error && "code" in err)) {
|
|
52318
|
-
console.error("[world-local] Unexpected polling error:", err);
|
|
52319
|
-
}
|
|
52320
|
-
} finally {
|
|
52321
|
-
isPolling = false;
|
|
52322
|
-
}
|
|
52323
|
-
}, 100);
|
|
52324
|
-
},
|
|
52325
|
-
cancel() {
|
|
52326
|
-
streamClosed = true;
|
|
52327
|
-
teardown();
|
|
52328
|
-
}
|
|
52329
|
-
});
|
|
52330
|
-
}
|
|
52331
|
-
}
|
|
52332
|
-
};
|
|
52333
|
-
}
|
|
52334
|
-
var chunkIds, monotonicUlid2, RunStreamsSchema, EOF_MARKER;
|
|
52335
|
-
var init_streamer = __esm({
|
|
52336
|
-
"../world-local/dist/streamer.js"() {
|
|
52337
|
-
"use strict";
|
|
52338
|
-
init_dist5();
|
|
52339
|
-
init_node2();
|
|
52340
|
-
init_zod2();
|
|
52341
|
-
init_fs();
|
|
52342
|
-
chunkIds = globalSingleton2("@workflow/world-local//streamerMonotonicUlid", 1, () => ({ next: monotonicFactory2(() => Math.random()) }));
|
|
52343
|
-
monotonicUlid2 = /* @__PURE__ */ __name((seedTime) => chunkIds.next(seedTime), "monotonicUlid");
|
|
52344
|
-
RunStreamsSchema = external_exports2.object({
|
|
52345
|
-
streams: external_exports2.array(external_exports2.string())
|
|
52346
|
-
});
|
|
52347
|
-
EOF_MARKER = 1;
|
|
52348
|
-
__name(isEofByte, "isEofByte");
|
|
52349
|
-
__name(serializeChunk, "serializeChunk");
|
|
52350
|
-
__name(isEofChunk, "isEofChunk");
|
|
52351
|
-
__name(deserializeChunk, "deserializeChunk");
|
|
52352
|
-
__name(listChunkEntries, "listChunkEntries");
|
|
52353
|
-
__name(addChunkFilesByExtension, "addChunkFilesByExtension");
|
|
52354
|
-
__name(chunkDirForStream, "chunkDirForStream");
|
|
52355
|
-
__name(listChunkFilesForStream, "listChunkFilesForStream");
|
|
52356
|
-
__name(createStreamer, "createStreamer");
|
|
52357
|
-
}
|
|
52358
|
-
});
|
|
52359
|
-
|
|
52360
52560
|
// ../world-local/dist/index.js
|
|
52361
52561
|
import { promises as fs7 } from "node:fs";
|
|
52362
52562
|
import { rm } from "node:fs/promises";
|
|
52363
|
-
import
|
|
52563
|
+
import path12 from "node:path";
|
|
52364
52564
|
function createWorld(args) {
|
|
52365
52565
|
const definedArgs = args ? Object.fromEntries(Object.entries(args).filter(([, value]) => value !== void 0)) : {};
|
|
52366
52566
|
const mergedConfig = { ...config3.value, ...definedArgs };
|
|
@@ -52410,13 +52610,13 @@ function createWorld(args) {
|
|
|
52410
52610
|
clearStorageCache();
|
|
52411
52611
|
if (tag) {
|
|
52412
52612
|
const basedir = mergedConfig.dataDir;
|
|
52413
|
-
const hooksDir =
|
|
52613
|
+
const hooksDir = path12.join(basedir, "hooks");
|
|
52414
52614
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
52415
52615
|
const { HookSchema: HookSchema3 } = await Promise.resolve().then(() => (init_dist6(), dist_exports));
|
|
52416
52616
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
52417
|
-
const hook = await readJSON(
|
|
52617
|
+
const hook = await readJSON(path12.join(hooksDir, hookFile), HookSchema3);
|
|
52418
52618
|
if (hook?.token) {
|
|
52419
|
-
await deleteJSON(
|
|
52619
|
+
await deleteJSON(path12.join(hooksDir, "tokens", `${hashToken(hook.token)}.json`));
|
|
52420
52620
|
await deleteJSON(hookRecoveryMarkerPath(basedir, hook.token, hook.runId, hook.hookId));
|
|
52421
52621
|
}
|
|
52422
52622
|
}));
|
|
@@ -52430,12 +52630,12 @@ function createWorld(args) {
|
|
|
52430
52630
|
"streams/runs"
|
|
52431
52631
|
];
|
|
52432
52632
|
await Promise.all(entityDirs.map(async (dir) => {
|
|
52433
|
-
const fullDir =
|
|
52633
|
+
const fullDir = path12.join(basedir, dir);
|
|
52434
52634
|
const files = await listTaggedFiles(fullDir, tag);
|
|
52435
|
-
await Promise.all(files.map((f) => deleteJSON(
|
|
52635
|
+
await Promise.all(files.map((f) => deleteJSON(path12.join(fullDir, f))));
|
|
52436
52636
|
}));
|
|
52437
52637
|
for (const indexDir of ["token-index", "id-index"]) {
|
|
52438
|
-
const fullIndexDir =
|
|
52638
|
+
const fullIndexDir = path12.join(basedir, "hooks", indexDir);
|
|
52439
52639
|
let keyDirEntries;
|
|
52440
52640
|
try {
|
|
52441
52641
|
keyDirEntries = await fs7.readdir(fullIndexDir, {
|
|
@@ -52445,14 +52645,14 @@ function createWorld(args) {
|
|
|
52445
52645
|
keyDirEntries = [];
|
|
52446
52646
|
}
|
|
52447
52647
|
await Promise.all(keyDirEntries.filter((entry) => entry.isDirectory()).map(async (entry) => {
|
|
52448
|
-
const keyDir =
|
|
52648
|
+
const keyDir = path12.join(fullIndexDir, entry.name);
|
|
52449
52649
|
const taggedEntryFiles = await listTaggedFiles(keyDir, tag);
|
|
52450
|
-
await Promise.all(taggedEntryFiles.map((f) => deleteJSON(
|
|
52650
|
+
await Promise.all(taggedEntryFiles.map((f) => deleteJSON(path12.join(keyDir, f))));
|
|
52451
52651
|
}));
|
|
52452
52652
|
}
|
|
52453
|
-
await fs7.rm(
|
|
52653
|
+
await fs7.rm(path12.join(basedir, ".locks"), { recursive: true, force: true }).catch(() => {
|
|
52454
52654
|
});
|
|
52455
|
-
const chunksDir =
|
|
52655
|
+
const chunksDir = path12.join(basedir, "streams", "chunks");
|
|
52456
52656
|
let streamDirEntries;
|
|
52457
52657
|
try {
|
|
52458
52658
|
streamDirEntries = await fs7.readdir(chunksDir, {
|
|
@@ -52462,9 +52662,9 @@ function createWorld(args) {
|
|
|
52462
52662
|
streamDirEntries = [];
|
|
52463
52663
|
}
|
|
52464
52664
|
await Promise.all(streamDirEntries.filter((entry) => entry.isDirectory()).map(async (entry) => {
|
|
52465
|
-
const streamChunkDir =
|
|
52665
|
+
const streamChunkDir = path12.join(chunksDir, entry.name);
|
|
52466
52666
|
const taggedBinFiles = await listTaggedFilesByExtension(streamChunkDir, tag, ".bin");
|
|
52467
|
-
await Promise.all(taggedBinFiles.map((f) => fs7.unlink(
|
|
52667
|
+
await Promise.all(taggedBinFiles.map((f) => fs7.unlink(path12.join(streamChunkDir, f)).catch(() => {
|
|
52468
52668
|
})));
|
|
52469
52669
|
}));
|
|
52470
52670
|
clearCreatedFilesCache();
|
|
@@ -52616,7 +52816,7 @@ var require_token_io = __commonJS({
|
|
|
52616
52816
|
});
|
|
52617
52817
|
module.exports = __toCommonJS(token_io_exports);
|
|
52618
52818
|
var import_path = __toESM3(__require("path"));
|
|
52619
|
-
var
|
|
52819
|
+
var import_fs12 = __toESM3(__require("fs"));
|
|
52620
52820
|
var import_os = __toESM3(__require("os"));
|
|
52621
52821
|
var import_token_error = require_token_error();
|
|
52622
52822
|
function findRootDir() {
|
|
@@ -52624,7 +52824,7 @@ var require_token_io = __commonJS({
|
|
|
52624
52824
|
let dir = process.cwd();
|
|
52625
52825
|
while (dir !== import_path.default.dirname(dir)) {
|
|
52626
52826
|
const pkgPath = import_path.default.join(dir, ".vercel");
|
|
52627
|
-
if (
|
|
52827
|
+
if (import_fs12.default.existsSync(pkgPath)) {
|
|
52628
52828
|
return dir;
|
|
52629
52829
|
}
|
|
52630
52830
|
dir = import_path.default.dirname(dir);
|
|
@@ -52698,7 +52898,7 @@ var require_auth_config = __commonJS({
|
|
|
52698
52898
|
});
|
|
52699
52899
|
module.exports = __toCommonJS(auth_config_exports);
|
|
52700
52900
|
var fs9 = __toESM3(__require("fs"));
|
|
52701
|
-
var
|
|
52901
|
+
var path15 = __toESM3(__require("path"));
|
|
52702
52902
|
var import_token_util = require_token_util();
|
|
52703
52903
|
function getAuthConfigPath() {
|
|
52704
52904
|
const dataDir = (0, import_token_util.getVercelDataDir)();
|
|
@@ -52707,7 +52907,7 @@ var require_auth_config = __commonJS({
|
|
|
52707
52907
|
`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`
|
|
52708
52908
|
);
|
|
52709
52909
|
}
|
|
52710
|
-
return
|
|
52910
|
+
return path15.join(dataDir, "auth.json");
|
|
52711
52911
|
}
|
|
52712
52912
|
__name(getAuthConfigPath, "getAuthConfigPath");
|
|
52713
52913
|
function readAuthConfig() {
|
|
@@ -52728,7 +52928,7 @@ var require_auth_config = __commonJS({
|
|
|
52728
52928
|
__name(readAuthConfig, "readAuthConfig");
|
|
52729
52929
|
function writeAuthConfig(config4) {
|
|
52730
52930
|
const authPath = getAuthConfigPath();
|
|
52731
|
-
const authDir =
|
|
52931
|
+
const authDir = path15.dirname(authPath);
|
|
52732
52932
|
if (!fs9.existsSync(authDir)) {
|
|
52733
52933
|
fs9.mkdirSync(authDir, { mode: 504, recursive: true });
|
|
52734
52934
|
}
|
|
@@ -52934,7 +53134,7 @@ var require_token_util = __commonJS({
|
|
|
52934
53134
|
saveToken: /* @__PURE__ */ __name(() => saveToken, "saveToken")
|
|
52935
53135
|
});
|
|
52936
53136
|
module.exports = __toCommonJS(token_util_exports);
|
|
52937
|
-
var
|
|
53137
|
+
var path15 = __toESM3(__require("path"));
|
|
52938
53138
|
var fs9 = __toESM3(__require("fs"));
|
|
52939
53139
|
var import_token_error = require_token_error();
|
|
52940
53140
|
var import_token_io = require_token_io();
|
|
@@ -52947,7 +53147,7 @@ var require_token_util = __commonJS({
|
|
|
52947
53147
|
if (!dataDir) {
|
|
52948
53148
|
return null;
|
|
52949
53149
|
}
|
|
52950
|
-
return
|
|
53150
|
+
return path15.join(dataDir, vercelFolder);
|
|
52951
53151
|
}
|
|
52952
53152
|
__name(getVercelDataDir, "getVercelDataDir");
|
|
52953
53153
|
async function getVercelToken2(options) {
|
|
@@ -53027,7 +53227,7 @@ var require_token_util = __commonJS({
|
|
|
53027
53227
|
"Unable to find project root directory. Have you linked your project with `vc link?`"
|
|
53028
53228
|
);
|
|
53029
53229
|
}
|
|
53030
|
-
const prjPath =
|
|
53230
|
+
const prjPath = path15.join(dir, ".vercel", "project.json");
|
|
53031
53231
|
if (!fs9.existsSync(prjPath)) {
|
|
53032
53232
|
throw new import_token_error.VercelOidcTokenError(
|
|
53033
53233
|
"project.json not found, have you linked your project with `vc link?`"
|
|
@@ -53049,9 +53249,9 @@ var require_token_util = __commonJS({
|
|
|
53049
53249
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
53050
53250
|
);
|
|
53051
53251
|
}
|
|
53052
|
-
const tokenPath =
|
|
53252
|
+
const tokenPath = path15.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
53053
53253
|
const tokenJson = JSON.stringify(token);
|
|
53054
|
-
fs9.mkdirSync(
|
|
53254
|
+
fs9.mkdirSync(path15.dirname(tokenPath), { mode: 504, recursive: true });
|
|
53055
53255
|
fs9.writeFileSync(tokenPath, tokenJson);
|
|
53056
53256
|
fs9.chmodSync(tokenPath, 432);
|
|
53057
53257
|
return;
|
|
@@ -53064,7 +53264,7 @@ var require_token_util = __commonJS({
|
|
|
53064
53264
|
"Unable to find user data directory. Please reach out to Vercel support."
|
|
53065
53265
|
);
|
|
53066
53266
|
}
|
|
53067
|
-
const tokenPath =
|
|
53267
|
+
const tokenPath = path15.join(dir, "com.vercel.token", `${projectId}.json`);
|
|
53068
53268
|
if (!fs9.existsSync(tokenPath)) {
|
|
53069
53269
|
return null;
|
|
53070
53270
|
}
|
|
@@ -55646,16 +55846,16 @@ var require_filesystem = __commonJS({
|
|
|
55646
55846
|
var LDD_PATH = "/usr/bin/ldd";
|
|
55647
55847
|
var SELF_PATH = "/proc/self/exe";
|
|
55648
55848
|
var MAX_LENGTH = 2048;
|
|
55649
|
-
var readFileSync2 = /* @__PURE__ */ __name((
|
|
55650
|
-
const fd = fs9.openSync(
|
|
55849
|
+
var readFileSync2 = /* @__PURE__ */ __name((path15) => {
|
|
55850
|
+
const fd = fs9.openSync(path15, "r");
|
|
55651
55851
|
const buffer3 = Buffer.alloc(MAX_LENGTH);
|
|
55652
55852
|
const bytesRead = fs9.readSync(fd, buffer3, 0, MAX_LENGTH, 0);
|
|
55653
55853
|
fs9.close(fd, () => {
|
|
55654
55854
|
});
|
|
55655
55855
|
return buffer3.subarray(0, bytesRead);
|
|
55656
55856
|
}, "readFileSync");
|
|
55657
|
-
var readFile3 = /* @__PURE__ */ __name((
|
|
55658
|
-
fs9.open(
|
|
55857
|
+
var readFile3 = /* @__PURE__ */ __name((path15) => new Promise((resolve3, reject) => {
|
|
55858
|
+
fs9.open(path15, "r", (err, fd) => {
|
|
55659
55859
|
if (err) {
|
|
55660
55860
|
reject(err);
|
|
55661
55861
|
} else {
|
|
@@ -55774,11 +55974,11 @@ var require_detect_libc = __commonJS({
|
|
|
55774
55974
|
}
|
|
55775
55975
|
return null;
|
|
55776
55976
|
}, "familyFromCommand");
|
|
55777
|
-
var familyFromInterpreterPath = /* @__PURE__ */ __name((
|
|
55778
|
-
if (
|
|
55779
|
-
if (
|
|
55977
|
+
var familyFromInterpreterPath = /* @__PURE__ */ __name((path15) => {
|
|
55978
|
+
if (path15) {
|
|
55979
|
+
if (path15.includes("/ld-musl-")) {
|
|
55780
55980
|
return MUSL;
|
|
55781
|
-
} else if (
|
|
55981
|
+
} else if (path15.includes("/ld-linux-")) {
|
|
55782
55982
|
return GLIBC;
|
|
55783
55983
|
}
|
|
55784
55984
|
}
|
|
@@ -55825,8 +56025,8 @@ var require_detect_libc = __commonJS({
|
|
|
55825
56025
|
cachedFamilyInterpreter = null;
|
|
55826
56026
|
try {
|
|
55827
56027
|
const selfContent = await readFile3(SELF_PATH);
|
|
55828
|
-
const
|
|
55829
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
56028
|
+
const path15 = interpreterPath(selfContent);
|
|
56029
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path15);
|
|
55830
56030
|
} catch (e) {
|
|
55831
56031
|
}
|
|
55832
56032
|
return cachedFamilyInterpreter;
|
|
@@ -55838,8 +56038,8 @@ var require_detect_libc = __commonJS({
|
|
|
55838
56038
|
cachedFamilyInterpreter = null;
|
|
55839
56039
|
try {
|
|
55840
56040
|
const selfContent = readFileSync2(SELF_PATH);
|
|
55841
|
-
const
|
|
55842
|
-
cachedFamilyInterpreter = familyFromInterpreterPath(
|
|
56041
|
+
const path15 = interpreterPath(selfContent);
|
|
56042
|
+
cachedFamilyInterpreter = familyFromInterpreterPath(path15);
|
|
55843
56043
|
} catch (e) {
|
|
55844
56044
|
}
|
|
55845
56045
|
return cachedFamilyInterpreter;
|
|
@@ -55973,7 +56173,7 @@ var require_detect_libc = __commonJS({
|
|
|
55973
56173
|
var require_node_gyp_build_optional_packages = __commonJS({
|
|
55974
56174
|
"../../node_modules/.pnpm/node-gyp-build-optional-packages@5.1.1/node_modules/node-gyp-build-optional-packages/index.js"(exports, module) {
|
|
55975
56175
|
var fs9 = __require("fs");
|
|
55976
|
-
var
|
|
56176
|
+
var path15 = __require("path");
|
|
55977
56177
|
var url3 = __require("url");
|
|
55978
56178
|
var vars = process.config && process.config.variables || {};
|
|
55979
56179
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
@@ -55997,30 +56197,30 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
55997
56197
|
}
|
|
55998
56198
|
__name(load, "load");
|
|
55999
56199
|
load.path = function(dir) {
|
|
56000
|
-
dir =
|
|
56200
|
+
dir = path15.resolve(dir || ".");
|
|
56001
56201
|
var packageName = "";
|
|
56002
56202
|
try {
|
|
56003
56203
|
if (typeof __webpack_require__ === "function")
|
|
56004
|
-
packageName = __non_webpack_require__(
|
|
56204
|
+
packageName = __non_webpack_require__(path15.join(dir, "package.json")).name;
|
|
56005
56205
|
else
|
|
56006
|
-
packageName = __require(
|
|
56206
|
+
packageName = __require(path15.join(dir, "package.json")).name;
|
|
56007
56207
|
var varName = packageName.toUpperCase().replace(/-/g, "_") + "_PREBUILD";
|
|
56008
56208
|
if (process.env[varName]) dir = process.env[varName];
|
|
56009
56209
|
} catch (err) {
|
|
56010
56210
|
}
|
|
56011
56211
|
if (!prebuildsOnly) {
|
|
56012
|
-
var release = getFirst(
|
|
56212
|
+
var release = getFirst(path15.join(dir, "build/Release"), matchBuild);
|
|
56013
56213
|
if (release) return release;
|
|
56014
|
-
var debug = getFirst(
|
|
56214
|
+
var debug = getFirst(path15.join(dir, "build/Debug"), matchBuild);
|
|
56015
56215
|
if (debug) return debug;
|
|
56016
56216
|
}
|
|
56017
56217
|
var prebuild = resolve3(dir);
|
|
56018
56218
|
if (prebuild) return prebuild;
|
|
56019
|
-
var nearby = resolve3(
|
|
56219
|
+
var nearby = resolve3(path15.dirname(process.execPath));
|
|
56020
56220
|
if (nearby) return nearby;
|
|
56021
56221
|
var platformPackage = (packageName[0] == "@" ? "" : "@" + packageName + "/") + packageName + "-" + platform + "-" + arch;
|
|
56022
56222
|
try {
|
|
56023
|
-
var prebuildPackage =
|
|
56223
|
+
var prebuildPackage = path15.dirname(__require("module").createRequire(url3.pathToFileURL(path15.join(dir, "package.json"))).resolve(platformPackage));
|
|
56024
56224
|
return resolveFile(prebuildPackage);
|
|
56025
56225
|
} catch (error95) {
|
|
56026
56226
|
}
|
|
@@ -56039,17 +56239,17 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
56039
56239
|
].filter(Boolean).join(" ");
|
|
56040
56240
|
throw new Error("No native build was found for " + target2 + "\n attempted loading from: " + dir + " and package: " + platformPackage + "\n");
|
|
56041
56241
|
function resolve3(dir2) {
|
|
56042
|
-
var tuples = readdirSync(
|
|
56242
|
+
var tuples = readdirSync(path15.join(dir2, "prebuilds")).map(parseTuple);
|
|
56043
56243
|
var tuple3 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
56044
56244
|
if (!tuple3) return;
|
|
56045
|
-
return resolveFile(
|
|
56245
|
+
return resolveFile(path15.join(dir2, "prebuilds", tuple3.name));
|
|
56046
56246
|
}
|
|
56047
56247
|
__name(resolve3, "resolve");
|
|
56048
56248
|
function resolveFile(prebuilds) {
|
|
56049
56249
|
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
56050
56250
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
56051
56251
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
56052
|
-
if (winner) return
|
|
56252
|
+
if (winner) return path15.join(prebuilds, winner.file);
|
|
56053
56253
|
}
|
|
56054
56254
|
__name(resolveFile, "resolveFile");
|
|
56055
56255
|
};
|
|
@@ -56063,7 +56263,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
56063
56263
|
__name(readdirSync, "readdirSync");
|
|
56064
56264
|
function getFirst(dir, filter2) {
|
|
56065
56265
|
var files = readdirSync(dir).filter(filter2);
|
|
56066
|
-
return files[0] &&
|
|
56266
|
+
return files[0] && path15.join(dir, files[0]);
|
|
56067
56267
|
}
|
|
56068
56268
|
__name(getFirst, "getFirst");
|
|
56069
56269
|
function matchBuild(name) {
|
|
@@ -56209,11 +56409,56 @@ var version4;
|
|
|
56209
56409
|
var init_version3 = __esm({
|
|
56210
56410
|
"../world-vercel/dist/version.js"() {
|
|
56211
56411
|
"use strict";
|
|
56212
|
-
version4 = "5.0.0-beta.
|
|
56412
|
+
version4 = "5.0.0-beta.45";
|
|
56213
56413
|
}
|
|
56214
56414
|
});
|
|
56215
56415
|
|
|
56216
56416
|
// ../world-vercel/dist/http-client.js
|
|
56417
|
+
function getQueueAgentOptions2() {
|
|
56418
|
+
const timeoutMs = getQueueRequestTimeoutMs();
|
|
56419
|
+
return {
|
|
56420
|
+
...DEFAULT_AGENT_OPTIONS,
|
|
56421
|
+
connections: envNumber2("WORKFLOW_VERCEL_QUEUE_CONNECTIONS", QUEUE_AGENT_CONNECTIONS, { integer: true, min: 1, max: 1024 }),
|
|
56422
|
+
headersTimeout: timeoutMs,
|
|
56423
|
+
bodyTimeout: timeoutMs
|
|
56424
|
+
};
|
|
56425
|
+
}
|
|
56426
|
+
function deadlineInterceptor(timeoutMs) {
|
|
56427
|
+
class DeadlineHandler extends ForwardingHandler {
|
|
56428
|
+
static {
|
|
56429
|
+
__name(this, "DeadlineHandler");
|
|
56430
|
+
}
|
|
56431
|
+
#expired = false;
|
|
56432
|
+
#controller;
|
|
56433
|
+
#timer;
|
|
56434
|
+
constructor(handler) {
|
|
56435
|
+
super(handler);
|
|
56436
|
+
this.#timer = setTimeout(() => {
|
|
56437
|
+
this.#expired = true;
|
|
56438
|
+
this.#abort();
|
|
56439
|
+
}, timeoutMs);
|
|
56440
|
+
this.#timer.unref?.();
|
|
56441
|
+
}
|
|
56442
|
+
#abort() {
|
|
56443
|
+
this.#controller?.abort(new Error(`Queue request exceeded its ${timeoutMs}ms deadline`));
|
|
56444
|
+
}
|
|
56445
|
+
onRequestStart(controller, context2) {
|
|
56446
|
+
this.#controller = controller;
|
|
56447
|
+
super.onRequestStart(controller, context2);
|
|
56448
|
+
if (this.#expired)
|
|
56449
|
+
this.#abort();
|
|
56450
|
+
}
|
|
56451
|
+
onResponseEnd(controller, trailers) {
|
|
56452
|
+
clearTimeout(this.#timer);
|
|
56453
|
+
super.onResponseEnd(controller, trailers);
|
|
56454
|
+
}
|
|
56455
|
+
onResponseError(controller, error95) {
|
|
56456
|
+
clearTimeout(this.#timer);
|
|
56457
|
+
super.onResponseError(controller, error95);
|
|
56458
|
+
}
|
|
56459
|
+
}
|
|
56460
|
+
return (dispatch) => (opts, handler) => dispatch(opts, new DeadlineHandler(handler));
|
|
56461
|
+
}
|
|
56217
56462
|
function h2EventsEnabled() {
|
|
56218
56463
|
return process.env.WORKFLOW_H2_MULTIPLEX !== "0";
|
|
56219
56464
|
}
|
|
@@ -56326,7 +56571,7 @@ function getDispatcher(config4) {
|
|
|
56326
56571
|
return resolveDispatcher(config4, getDefaultDispatcher);
|
|
56327
56572
|
}
|
|
56328
56573
|
function getQueueDispatcher(config4) {
|
|
56329
|
-
return config4
|
|
56574
|
+
return resolveDispatcher(config4, getDefaultQueueDispatcher);
|
|
56330
56575
|
}
|
|
56331
56576
|
function getEventsDispatcher(config4) {
|
|
56332
56577
|
return resolveDispatcher(config4, () => eventsRecycler.get());
|
|
@@ -56359,6 +56604,13 @@ function withBoundLifecycle(agent, composed) {
|
|
|
56359
56604
|
function createStreamDispatcher(retryOptions, agentOverrides) {
|
|
56360
56605
|
return new import_undici2.RetryAgent(new import_undici2.Agent({ ...STREAM_AGENT_OPTIONS, ...agentOverrides }), retryOptions);
|
|
56361
56606
|
}
|
|
56607
|
+
function createQueueDispatcher() {
|
|
56608
|
+
return new import_undici2.RetryAgent(new import_undici2.Agent(getQueueAgentOptions2()).compose(deadlineInterceptor(getQueueRequestTimeoutMs())), RETRY_AGENT_OPTIONS);
|
|
56609
|
+
}
|
|
56610
|
+
function getDefaultQueueDispatcher() {
|
|
56611
|
+
pools.queueDispatcher ??= createQueueDispatcher();
|
|
56612
|
+
return pools.queueDispatcher;
|
|
56613
|
+
}
|
|
56362
56614
|
function getDefaultDispatcher() {
|
|
56363
56615
|
pools.dispatcher ??= makeRetryDispatcher(DEFAULT_AGENT_OPTIONS, RETRY_AGENT_OPTIONS);
|
|
56364
56616
|
return pools.dispatcher;
|
|
@@ -56371,7 +56623,7 @@ function getDefaultStreamCloseDispatcher() {
|
|
|
56371
56623
|
pools.streamCloseDispatcher ??= createStreamDispatcher(STREAM_CLOSE_RETRY_OPTIONS);
|
|
56372
56624
|
return pools.streamCloseDispatcher;
|
|
56373
56625
|
}
|
|
56374
|
-
var import_undici2, pools, BASE_AGENT_OPTIONS, NODE_HTTP_HEADERS_TIMEOUT_MS, NODE_HTTP_BODY_TIMEOUT_MS, H2_MAX_IN_FLIGHT_STREAMS, H2_STREAM_WINDOW_BYTES, H2_CONNECTION_WINDOW_BYTES, DEFAULT_AGENT_OPTIONS, EVENTS_AGENT_OPTIONS, EVENTS_AGENT_OPTIONS_NO_H2, STREAM_AGENT_OPTIONS, RETRY_AGENT_OPTIONS, STREAM_RETRY_OPTIONS, STREAM_CLOSE_RETRY_OPTIONS, H2_REBUFFER_MAX_BYTES, EVENTS_RECYCLE_AFTER_CONSECUTIVE_FAILURES, RECYCLE_MIN_INTERVAL_MS, RETIRED_CLOSE_DELAY_MS, RETIRED_DESTROY_DELAY_MS, RECYCLABLE_ERROR_CODES, MAX_CAUSE_DEPTH, eventsRecycler;
|
|
56626
|
+
var import_undici2, pools, BASE_AGENT_OPTIONS, NODE_HTTP_HEADERS_TIMEOUT_MS, NODE_HTTP_BODY_TIMEOUT_MS, H2_MAX_IN_FLIGHT_STREAMS, H2_STREAM_WINDOW_BYTES, H2_CONNECTION_WINDOW_BYTES, DEFAULT_AGENT_OPTIONS, QUEUE_AGENT_CONNECTIONS, QUEUE_REQUEST_TIMEOUT_MS, getQueueRequestTimeoutMs, ForwardingHandler, EVENTS_AGENT_OPTIONS, EVENTS_AGENT_OPTIONS_NO_H2, STREAM_AGENT_OPTIONS, RETRY_AGENT_OPTIONS, STREAM_RETRY_OPTIONS, STREAM_CLOSE_RETRY_OPTIONS, H2_REBUFFER_MAX_BYTES, EVENTS_RECYCLE_AFTER_CONSECUTIVE_FAILURES, RECYCLE_MIN_INTERVAL_MS, RETIRED_CLOSE_DELAY_MS, RETIRED_DESTROY_DELAY_MS, RECYCLABLE_ERROR_CODES, MAX_CAUSE_DEPTH, eventsRecycler;
|
|
56375
56627
|
var init_http_client = __esm({
|
|
56376
56628
|
"../world-vercel/dist/http-client.js"() {
|
|
56377
56629
|
"use strict";
|
|
@@ -56382,6 +56634,7 @@ var init_http_client = __esm({
|
|
|
56382
56634
|
init_version3();
|
|
56383
56635
|
pools = globalSingleton2("@workflow/world-vercel//httpPools", 1, () => ({
|
|
56384
56636
|
dispatcher: void 0,
|
|
56637
|
+
queueDispatcher: void 0,
|
|
56385
56638
|
streamDispatcher: void 0,
|
|
56386
56639
|
streamCloseDispatcher: void 0,
|
|
56387
56640
|
nodeHttpAgents: void 0
|
|
@@ -56402,6 +56655,16 @@ var init_http_client = __esm({
|
|
|
56402
56655
|
// head-of-line blocking that deadlocks the webhook respondWith mechanism.
|
|
56403
56656
|
pipelining: 1
|
|
56404
56657
|
};
|
|
56658
|
+
QUEUE_AGENT_CONNECTIONS = 64;
|
|
56659
|
+
QUEUE_REQUEST_TIMEOUT_MS = 3e4;
|
|
56660
|
+
getQueueRequestTimeoutMs = /* @__PURE__ */ __name(() => envNumber2("WORKFLOW_VERCEL_QUEUE_TIMEOUT_MS", QUEUE_REQUEST_TIMEOUT_MS, {
|
|
56661
|
+
integer: true,
|
|
56662
|
+
min: 5e3,
|
|
56663
|
+
max: 12e4
|
|
56664
|
+
}), "getQueueRequestTimeoutMs");
|
|
56665
|
+
__name(getQueueAgentOptions2, "getQueueAgentOptions");
|
|
56666
|
+
ForwardingHandler = import_undici2.DecoratorHandler;
|
|
56667
|
+
__name(deadlineInterceptor, "deadlineInterceptor");
|
|
56405
56668
|
EVENTS_AGENT_OPTIONS = {
|
|
56406
56669
|
...BASE_AGENT_OPTIONS,
|
|
56407
56670
|
allowH2: true,
|
|
@@ -56483,6 +56746,8 @@ var init_http_client = __esm({
|
|
|
56483
56746
|
__name(createEventsDispatcher, "createEventsDispatcher");
|
|
56484
56747
|
__name(withBoundLifecycle, "withBoundLifecycle");
|
|
56485
56748
|
__name(createStreamDispatcher, "createStreamDispatcher");
|
|
56749
|
+
__name(createQueueDispatcher, "createQueueDispatcher");
|
|
56750
|
+
__name(getDefaultQueueDispatcher, "getDefaultQueueDispatcher");
|
|
56486
56751
|
__name(getDefaultDispatcher, "getDefaultDispatcher");
|
|
56487
56752
|
__name(getDefaultStreamDispatcher, "getDefaultStreamDispatcher");
|
|
56488
56753
|
__name(getDefaultStreamCloseDispatcher, "getDefaultStreamCloseDispatcher");
|
|
@@ -64566,7 +64831,7 @@ var init_escape = __esm({
|
|
|
64566
64831
|
});
|
|
64567
64832
|
|
|
64568
64833
|
// ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/index.js
|
|
64569
|
-
var minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform,
|
|
64834
|
+
var minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path13, sep, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
|
|
64570
64835
|
var init_esm4 = __esm({
|
|
64571
64836
|
"../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/index.js"() {
|
|
64572
64837
|
init_esm3();
|
|
@@ -64635,11 +64900,11 @@ var init_esm4 = __esm({
|
|
|
64635
64900
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
64636
64901
|
}, "qmarksTestNoExtDot");
|
|
64637
64902
|
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
64638
|
-
|
|
64903
|
+
path13 = {
|
|
64639
64904
|
win32: { sep: "\\" },
|
|
64640
64905
|
posix: { sep: "/" }
|
|
64641
64906
|
};
|
|
64642
|
-
sep = defaultPlatform === "win32" ?
|
|
64907
|
+
sep = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
|
|
64643
64908
|
minimatch.sep = sep;
|
|
64644
64909
|
GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
|
|
64645
64910
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -65471,7 +65736,7 @@ var require_picocolors = __commonJS({
|
|
|
65471
65736
|
// ../../node_modules/.pnpm/@vercel+queue@0.5.0_@opentelemetry+api@1.9.1/node_modules/@vercel/queue/dist/index.mjs
|
|
65472
65737
|
import * as fs8 from "fs";
|
|
65473
65738
|
import * as net from "net";
|
|
65474
|
-
import * as
|
|
65739
|
+
import * as path14 from "path";
|
|
65475
65740
|
async function streamToBuffer(stream) {
|
|
65476
65741
|
let totalLength = 0;
|
|
65477
65742
|
const reader = stream.getReader();
|
|
@@ -65700,7 +65965,7 @@ function getDevRouteMappings() {
|
|
|
65700
65965
|
return g[ROUTE_MAPPINGS_KEY] ?? null;
|
|
65701
65966
|
}
|
|
65702
65967
|
try {
|
|
65703
|
-
const vercelJsonPath =
|
|
65968
|
+
const vercelJsonPath = path14.join(process.cwd(), "vercel.json");
|
|
65704
65969
|
if (!fs8.existsSync(vercelJsonPath)) {
|
|
65705
65970
|
g[ROUTE_MAPPINGS_KEY] = null;
|
|
65706
65971
|
return null;
|
|
@@ -65767,7 +66032,7 @@ function findMappingsForFile(absolutePath) {
|
|
|
65767
66032
|
const cwd = process.cwd();
|
|
65768
66033
|
let relative2;
|
|
65769
66034
|
try {
|
|
65770
|
-
relative2 =
|
|
66035
|
+
relative2 = path14.relative(cwd, absolutePath);
|
|
65771
66036
|
} catch {
|
|
65772
66037
|
return [];
|
|
65773
66038
|
}
|
|
@@ -65803,8 +66068,8 @@ function parseFrameFilePath(line) {
|
|
|
65803
66068
|
function getSdkPackageDir() {
|
|
65804
66069
|
if (_sdkPackageDir) return _sdkPackageDir;
|
|
65805
66070
|
try {
|
|
65806
|
-
const thisDir = typeof __dirname !== "undefined" ? __dirname :
|
|
65807
|
-
_sdkPackageDir =
|
|
66071
|
+
const thisDir = typeof __dirname !== "undefined" ? __dirname : path14.dirname(new URL(import.meta.url).pathname);
|
|
66072
|
+
_sdkPackageDir = path14.resolve(thisDir, "..");
|
|
65808
66073
|
} catch {
|
|
65809
66074
|
_sdkPackageDir = "";
|
|
65810
66075
|
}
|
|
@@ -65818,7 +66083,7 @@ function extractCallerFilePath() {
|
|
|
65818
66083
|
for (const line of lines) {
|
|
65819
66084
|
const fp = parseFrameFilePath(line);
|
|
65820
66085
|
if (!fp) continue;
|
|
65821
|
-
const absolute =
|
|
66086
|
+
const absolute = path14.isAbsolute(fp) ? fp : path14.resolve(process.cwd(), fp);
|
|
65822
66087
|
let realFp;
|
|
65823
66088
|
try {
|
|
65824
66089
|
realFp = fs8.realpathSync(absolute);
|
|
@@ -65838,7 +66103,7 @@ function getHandlerRegistry() {
|
|
|
65838
66103
|
return g[HANDLER_REGISTRY_KEY];
|
|
65839
66104
|
}
|
|
65840
66105
|
function registerHandlerForFile(filePath, handler, client, options) {
|
|
65841
|
-
const absolutePath =
|
|
66106
|
+
const absolutePath = path14.isAbsolute(filePath) ? filePath : path14.resolve(process.cwd(), filePath);
|
|
65842
66107
|
const fileMappings = findMappingsForFile(absolutePath);
|
|
65843
66108
|
if (fileMappings.length === 0) return false;
|
|
65844
66109
|
const registry3 = getHandlerRegistry();
|
|
@@ -65885,7 +66150,7 @@ function registerDevHandler(handler, client, options, _testCallerPath) {
|
|
|
65885
66150
|
const cwd = process.cwd();
|
|
65886
66151
|
let relative2;
|
|
65887
66152
|
try {
|
|
65888
|
-
relative2 =
|
|
66153
|
+
relative2 = path14.relative(cwd, callerPath).replace(/\\/g, "/");
|
|
65889
66154
|
} catch {
|
|
65890
66155
|
relative2 = callerPath;
|
|
65891
66156
|
}
|
|
@@ -66032,7 +66297,7 @@ async function ensureHandlersLoaded(topicName, options = {}) {
|
|
|
66032
66297
|
continue;
|
|
66033
66298
|
}
|
|
66034
66299
|
if (!alreadyRegistered) {
|
|
66035
|
-
const absolutePath =
|
|
66300
|
+
const absolutePath = path14.resolve(process.cwd(), route.filePath);
|
|
66036
66301
|
try {
|
|
66037
66302
|
await importAtRuntime(absolutePath);
|
|
66038
66303
|
} catch (error95) {
|
|
@@ -70335,9 +70600,9 @@ async function readRun(id, params, config4) {
|
|
|
70335
70600
|
searchParams.set("remoteRefBehavior", remoteRefBehavior);
|
|
70336
70601
|
if (waitMs !== void 0)
|
|
70337
70602
|
searchParams.set("waitMs", String(waitMs));
|
|
70338
|
-
const
|
|
70603
|
+
const path15 = waitMs === void 0 ? "" : "/status";
|
|
70339
70604
|
const queryString = searchParams.toString();
|
|
70340
|
-
const endpoint = `/v2/runs/${encodeURIComponent(id)}${
|
|
70605
|
+
const endpoint = `/v2/runs/${encodeURIComponent(id)}${path15}${queryString ? `?${queryString}` : ""}`;
|
|
70341
70606
|
const run3 = await makeRequest({
|
|
70342
70607
|
endpoint,
|
|
70343
70608
|
options: { method: "GET", ...signal ? { signal } : {} },
|
|
@@ -71008,6 +71273,44 @@ var init_storage3 = __esm({
|
|
|
71008
71273
|
}
|
|
71009
71274
|
});
|
|
71010
71275
|
|
|
71276
|
+
// ../world-vercel/dist/stream-chunks.js
|
|
71277
|
+
function normalizeStreamChunks(chunks) {
|
|
71278
|
+
const encoder4 = new TextEncoder();
|
|
71279
|
+
return chunks.map((chunk) => typeof chunk === "string" ? encoder4.encode(chunk) : chunk);
|
|
71280
|
+
}
|
|
71281
|
+
function encodeMultiChunks(chunks) {
|
|
71282
|
+
return encodeNormalizedMultiChunks(normalizeStreamChunks(chunks));
|
|
71283
|
+
}
|
|
71284
|
+
function encodeNormalizedMultiChunks(binaryChunks) {
|
|
71285
|
+
let totalSize = 0;
|
|
71286
|
+
for (const binary of binaryChunks) {
|
|
71287
|
+
totalSize += 4 + binary.length;
|
|
71288
|
+
if (totalSize > 4294967295) {
|
|
71289
|
+
throw new RangeError(`encoded stream chunks exceed the u32 body-length limit: ${totalSize} bytes`);
|
|
71290
|
+
}
|
|
71291
|
+
}
|
|
71292
|
+
const result2 = new Uint8Array(totalSize);
|
|
71293
|
+
const view = new DataView(result2.buffer);
|
|
71294
|
+
let offset = 0;
|
|
71295
|
+
for (const binary of binaryChunks) {
|
|
71296
|
+
view.setUint32(offset, binary.length, false);
|
|
71297
|
+
offset += 4;
|
|
71298
|
+
result2.set(binary, offset);
|
|
71299
|
+
offset += binary.length;
|
|
71300
|
+
}
|
|
71301
|
+
return result2;
|
|
71302
|
+
}
|
|
71303
|
+
var MAX_CHUNKS_PER_STREAM_WRITE;
|
|
71304
|
+
var init_stream_chunks = __esm({
|
|
71305
|
+
"../world-vercel/dist/stream-chunks.js"() {
|
|
71306
|
+
"use strict";
|
|
71307
|
+
MAX_CHUNKS_PER_STREAM_WRITE = 1e3;
|
|
71308
|
+
__name(normalizeStreamChunks, "normalizeStreamChunks");
|
|
71309
|
+
__name(encodeMultiChunks, "encodeMultiChunks");
|
|
71310
|
+
__name(encodeNormalizedMultiChunks, "encodeNormalizedMultiChunks");
|
|
71311
|
+
}
|
|
71312
|
+
});
|
|
71313
|
+
|
|
71011
71314
|
// ../world-vercel/dist/streamer.js
|
|
71012
71315
|
function getStreamUrl(name, runId, httpConfig) {
|
|
71013
71316
|
return new URL(`${httpConfig.baseUrl}/v2/runs/${encodeURIComponent(runId)}/stream/${encodeURIComponent(name)}`);
|
|
@@ -71048,26 +71351,6 @@ function createStreamRequestError(operation, url3, response, text) {
|
|
|
71048
71351
|
];
|
|
71049
71352
|
return new StreamError2(`Stream ${operation} failed: HTTP ${response.status} (${context2.join("; ")}): ${text}`, { url: url3.toString(), status: response.status });
|
|
71050
71353
|
}
|
|
71051
|
-
function encodeMultiChunks(chunks) {
|
|
71052
|
-
const encoder4 = new TextEncoder();
|
|
71053
|
-
const binaryChunks = [];
|
|
71054
|
-
let totalSize = 0;
|
|
71055
|
-
for (const chunk of chunks) {
|
|
71056
|
-
const binary = typeof chunk === "string" ? encoder4.encode(chunk) : chunk;
|
|
71057
|
-
binaryChunks.push(binary);
|
|
71058
|
-
totalSize += 4 + binary.length;
|
|
71059
|
-
}
|
|
71060
|
-
const result2 = new Uint8Array(totalSize);
|
|
71061
|
-
const view = new DataView(result2.buffer);
|
|
71062
|
-
let offset = 0;
|
|
71063
|
-
for (const binary of binaryChunks) {
|
|
71064
|
-
view.setUint32(offset, binary.length, false);
|
|
71065
|
-
offset += 4;
|
|
71066
|
-
result2.set(binary, offset);
|
|
71067
|
-
offset += binary.length;
|
|
71068
|
-
}
|
|
71069
|
-
return result2;
|
|
71070
|
-
}
|
|
71071
71354
|
function createStreamer2(config4) {
|
|
71072
71355
|
return {
|
|
71073
71356
|
streams: {
|
|
@@ -71252,9 +71535,11 @@ var init_streamer2 = __esm({
|
|
|
71252
71535
|
init_zod2();
|
|
71253
71536
|
init_http_client();
|
|
71254
71537
|
init_http_core();
|
|
71538
|
+
init_stream_chunks();
|
|
71255
71539
|
init_telemetry3();
|
|
71256
71540
|
init_utils4();
|
|
71257
|
-
|
|
71541
|
+
init_stream_chunks();
|
|
71542
|
+
MAX_CHUNKS_PER_REQUEST = MAX_CHUNKS_PER_STREAM_WRITE;
|
|
71258
71543
|
getMaxChunksPerRequest = /* @__PURE__ */ __name(() => envNumber2("WORKFLOW_MAX_CHUNKS_PER_REQUEST", MAX_CHUNKS_PER_REQUEST, {
|
|
71259
71544
|
integer: true,
|
|
71260
71545
|
min: 1
|
|
@@ -71265,7 +71550,6 @@ var init_streamer2 = __esm({
|
|
|
71265
71550
|
__name(createStreamReadError, "createStreamReadError");
|
|
71266
71551
|
__name(toStreamError, "toStreamError");
|
|
71267
71552
|
__name(createStreamRequestError, "createStreamRequestError");
|
|
71268
|
-
__name(encodeMultiChunks, "encodeMultiChunks");
|
|
71269
71553
|
StreamInfoResponseSchema = external_exports2.object({
|
|
71270
71554
|
tailIndex: external_exports2.number(),
|
|
71271
71555
|
done: external_exports2.boolean()
|
|
@@ -78891,7 +79175,7 @@ var version5;
|
|
|
78891
79175
|
var init_version4 = __esm({
|
|
78892
79176
|
"../core/dist/version.js"() {
|
|
78893
79177
|
"use strict";
|
|
78894
|
-
version5 = "5.0.0-beta.
|
|
79178
|
+
version5 = "5.0.0-beta.49";
|
|
78895
79179
|
}
|
|
78896
79180
|
});
|
|
78897
79181
|
|
|
@@ -80673,6 +80957,42 @@ async function getForwardedWritableEncryptionKey2(runId, deploymentId, encryptio
|
|
|
80673
80957
|
const rawKey = deploymentId ? await world.getEncryptionKeyForRun(runId, { deploymentId }) : await world.getEncryptionKeyForRun(await world.runs.get(runId));
|
|
80674
80958
|
return rawKey ? await importKey2(rawKey, ["encrypt"]) : void 0;
|
|
80675
80959
|
}
|
|
80960
|
+
function tagForwardedWritableTarget2(writable, { deploymentId, encryptionPublicKey }) {
|
|
80961
|
+
if (typeof deploymentId === "string") {
|
|
80962
|
+
Object.defineProperty(writable, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL2, {
|
|
80963
|
+
value: deploymentId,
|
|
80964
|
+
writable: false
|
|
80965
|
+
});
|
|
80966
|
+
}
|
|
80967
|
+
if (typeof encryptionPublicKey === "string") {
|
|
80968
|
+
Object.defineProperty(writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL2, {
|
|
80969
|
+
value: encryptionPublicKey,
|
|
80970
|
+
writable: false
|
|
80971
|
+
});
|
|
80972
|
+
}
|
|
80973
|
+
}
|
|
80974
|
+
function createForwardedWritable2({ global: global2, ops, runId, name, key, deploymentId, encryptionPublicKey, runReadyBarrier }) {
|
|
80975
|
+
const serialize5 = getSerializeStream2(getExternalReducers2(global2, ops, runId, key), key);
|
|
80976
|
+
const serverWritable = new WorkflowServerWritableStream2(runId, name, runReadyBarrier);
|
|
80977
|
+
const state = createFlushableState2();
|
|
80978
|
+
ops.push(state.promise);
|
|
80979
|
+
flushablePipe2(serialize5.readable, serverWritable, state).catch(() => {
|
|
80980
|
+
});
|
|
80981
|
+
pollWritableLock2(serialize5.writable, state);
|
|
80982
|
+
Object.defineProperty(serialize5.writable, STREAM_NAME_SYMBOL2, {
|
|
80983
|
+
value: name,
|
|
80984
|
+
writable: false
|
|
80985
|
+
});
|
|
80986
|
+
Object.defineProperty(serialize5.writable, STREAM_SERVER_RUN_ID_SYMBOL2, {
|
|
80987
|
+
value: runId,
|
|
80988
|
+
writable: false
|
|
80989
|
+
});
|
|
80990
|
+
tagForwardedWritableTarget2(serialize5.writable, {
|
|
80991
|
+
deploymentId,
|
|
80992
|
+
encryptionPublicKey
|
|
80993
|
+
});
|
|
80994
|
+
return serialize5.writable;
|
|
80995
|
+
}
|
|
80676
80996
|
function getRunReadableStream2(global2, ops, runId, name, startIndex, cryptoKey) {
|
|
80677
80997
|
let reader;
|
|
80678
80998
|
let lockState;
|
|
@@ -80789,34 +81109,15 @@ function getExternalRevivers2(global2 = globalThis, ops, runId, cryptoKey, optio
|
|
|
80789
81109
|
WritableStream: /* @__PURE__ */ __name((value) => {
|
|
80790
81110
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
80791
81111
|
const targetKey = targetRunId === runId ? cryptoKey : getForwardedWritableEncryptionKey2(targetRunId, value.deploymentId, value.encryptionPublicKey);
|
|
80792
|
-
|
|
80793
|
-
|
|
80794
|
-
|
|
80795
|
-
|
|
80796
|
-
|
|
80797
|
-
|
|
80798
|
-
|
|
80799
|
-
|
|
80800
|
-
value: value.name,
|
|
80801
|
-
writable: false
|
|
80802
|
-
});
|
|
80803
|
-
Object.defineProperty(serialize5.writable, STREAM_SERVER_RUN_ID_SYMBOL2, {
|
|
80804
|
-
value: targetRunId,
|
|
80805
|
-
writable: false
|
|
81112
|
+
return createForwardedWritable2({
|
|
81113
|
+
global: global2,
|
|
81114
|
+
ops,
|
|
81115
|
+
runId: targetRunId,
|
|
81116
|
+
name: value.name,
|
|
81117
|
+
key: targetKey,
|
|
81118
|
+
deploymentId: value.deploymentId,
|
|
81119
|
+
encryptionPublicKey: value.encryptionPublicKey
|
|
80806
81120
|
});
|
|
80807
|
-
if (typeof value.deploymentId === "string") {
|
|
80808
|
-
Object.defineProperty(serialize5.writable, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL2, {
|
|
80809
|
-
value: value.deploymentId,
|
|
80810
|
-
writable: false
|
|
80811
|
-
});
|
|
80812
|
-
}
|
|
80813
|
-
if (typeof value.encryptionPublicKey === "string") {
|
|
80814
|
-
Object.defineProperty(serialize5.writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL2, {
|
|
80815
|
-
value: value.encryptionPublicKey,
|
|
80816
|
-
writable: false
|
|
80817
|
-
});
|
|
80818
|
-
}
|
|
80819
|
-
return serialize5.writable;
|
|
80820
81121
|
}, "WritableStream"),
|
|
80821
81122
|
AbortController: /* @__PURE__ */ __name((value) => reviveAbortController2(value, ops, runId), "AbortController"),
|
|
80822
81123
|
AbortSignal: /* @__PURE__ */ __name((value) => reviveAbortSignal2(value, ops, runId), "AbortSignal")
|
|
@@ -81465,6 +81766,12 @@ var init_serialization4 = __esm({
|
|
|
81465
81766
|
pendingRunReady = void 0;
|
|
81466
81767
|
}
|
|
81467
81768
|
}, "ensureRunReady");
|
|
81769
|
+
const writerId = `wrtr_${defaultUlid2()}`;
|
|
81770
|
+
const writeSessionPromise = ensureRunReady().then(async () => {
|
|
81771
|
+
const world = await worldPromise;
|
|
81772
|
+
return world.streams.createWriteSession?.(runId, name, { writerId });
|
|
81773
|
+
});
|
|
81774
|
+
let nextChunkSeq = 0;
|
|
81468
81775
|
let buffer3 = [];
|
|
81469
81776
|
let bufferBytes = 0;
|
|
81470
81777
|
let inFlightChunks = 0;
|
|
@@ -81507,14 +81814,18 @@ var init_serialization4 = __esm({
|
|
|
81507
81814
|
const sendGroup = /* @__PURE__ */ __name(async (group, bytes, groupT0) => {
|
|
81508
81815
|
await ensureRunReady();
|
|
81509
81816
|
const world = await worldPromise;
|
|
81817
|
+
const session = await writeSessionPromise;
|
|
81510
81818
|
const dispatchAt = Date.now();
|
|
81511
|
-
if (
|
|
81819
|
+
if (session) {
|
|
81820
|
+
await session.write(nextChunkSeq, group);
|
|
81821
|
+
} else if (typeof world.streams.writeMulti === "function" && group.length > 1) {
|
|
81512
81822
|
await world.streams.writeMulti(runId, name, group);
|
|
81513
81823
|
} else {
|
|
81514
81824
|
for (const chunk of group) {
|
|
81515
81825
|
await world.streams.write(runId, name, chunk);
|
|
81516
81826
|
}
|
|
81517
81827
|
}
|
|
81828
|
+
nextChunkSeq += group.length;
|
|
81518
81829
|
if (groupT0 !== void 0) {
|
|
81519
81830
|
recordStreamWriteFlush2(groupT0, dispatchAt, runId, name, group.length, bytes, Date.now() - dispatchAt);
|
|
81520
81831
|
}
|
|
@@ -81629,8 +81940,13 @@ var init_serialization4 = __esm({
|
|
|
81629
81940
|
await drain();
|
|
81630
81941
|
await ensureRunReady();
|
|
81631
81942
|
const world = await worldPromise;
|
|
81943
|
+
const session = await writeSessionPromise;
|
|
81632
81944
|
const closeStart = Date.now();
|
|
81633
|
-
|
|
81945
|
+
if (session) {
|
|
81946
|
+
await session.close();
|
|
81947
|
+
} else {
|
|
81948
|
+
await world.streams.close(runId, name);
|
|
81949
|
+
}
|
|
81634
81950
|
recordStreamClose2(closeStart, runId, name);
|
|
81635
81951
|
},
|
|
81636
81952
|
async abort(reason) {
|
|
@@ -81646,6 +81962,8 @@ var init_serialization4 = __esm({
|
|
|
81646
81962
|
bufferBytes = 0;
|
|
81647
81963
|
sinkError ??= reason ?? new Error("Stream aborted");
|
|
81648
81964
|
rejectWaiters(sinkError);
|
|
81965
|
+
const session = await writeSessionPromise.catch(() => void 0);
|
|
81966
|
+
await session?.dispose?.();
|
|
81649
81967
|
}
|
|
81650
81968
|
});
|
|
81651
81969
|
Object.defineProperty(this, STREAM_DRAIN_SYMBOL2, {
|
|
@@ -81671,6 +81989,8 @@ var init_serialization4 = __esm({
|
|
|
81671
81989
|
__name(reviveAbortSignal2, "reviveAbortSignal");
|
|
81672
81990
|
__name(getCommonRevivers4, "getCommonRevivers");
|
|
81673
81991
|
__name(getForwardedWritableEncryptionKey2, "getForwardedWritableEncryptionKey");
|
|
81992
|
+
__name(tagForwardedWritableTarget2, "tagForwardedWritableTarget");
|
|
81993
|
+
__name(createForwardedWritable2, "createForwardedWritable");
|
|
81674
81994
|
__name(getRunReadableStream2, "getRunReadableStream");
|
|
81675
81995
|
__name(getExternalRevivers2, "getExternalRevivers");
|
|
81676
81996
|
__name(getWorkflowRevivers, "getWorkflowRevivers");
|
|
@@ -83481,16 +83801,16 @@ function parseAbsoluteUrl(input) {
|
|
|
83481
83801
|
}
|
|
83482
83802
|
function parseFileUrl(input) {
|
|
83483
83803
|
const match2 = fileRegex.exec(input);
|
|
83484
|
-
const
|
|
83485
|
-
return makeUrl("file:", "", match2[1] || "", "", isAbsolutePath(
|
|
83804
|
+
const path15 = match2[2];
|
|
83805
|
+
return makeUrl("file:", "", match2[1] || "", "", isAbsolutePath(path15) ? path15 : "/" + path15, match2[3] || "", match2[4] || "");
|
|
83486
83806
|
}
|
|
83487
|
-
function makeUrl(scheme, user, host, port,
|
|
83807
|
+
function makeUrl(scheme, user, host, port, path15, query, hash3) {
|
|
83488
83808
|
return {
|
|
83489
83809
|
scheme,
|
|
83490
83810
|
user,
|
|
83491
83811
|
host,
|
|
83492
83812
|
port,
|
|
83493
|
-
path:
|
|
83813
|
+
path: path15,
|
|
83494
83814
|
query,
|
|
83495
83815
|
hash: hash3,
|
|
83496
83816
|
type: 7
|
|
@@ -83520,11 +83840,11 @@ function parseUrl(input) {
|
|
|
83520
83840
|
url3.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
83521
83841
|
return url3;
|
|
83522
83842
|
}
|
|
83523
|
-
function stripPathFilename(
|
|
83524
|
-
if (
|
|
83525
|
-
return
|
|
83526
|
-
const index =
|
|
83527
|
-
return
|
|
83843
|
+
function stripPathFilename(path15) {
|
|
83844
|
+
if (path15.endsWith("/.."))
|
|
83845
|
+
return path15;
|
|
83846
|
+
const index = path15.lastIndexOf("/");
|
|
83847
|
+
return path15.slice(0, index + 1);
|
|
83528
83848
|
}
|
|
83529
83849
|
function mergePaths(url3, base) {
|
|
83530
83850
|
normalizePath(base, base.type);
|
|
@@ -83562,14 +83882,14 @@ function normalizePath(url3, type) {
|
|
|
83562
83882
|
pieces[pointer++] = piece;
|
|
83563
83883
|
positive++;
|
|
83564
83884
|
}
|
|
83565
|
-
let
|
|
83885
|
+
let path15 = "";
|
|
83566
83886
|
for (let i = 1; i < pointer; i++) {
|
|
83567
|
-
|
|
83887
|
+
path15 += "/" + pieces[i];
|
|
83568
83888
|
}
|
|
83569
|
-
if (!
|
|
83570
|
-
|
|
83889
|
+
if (!path15 || addTrailingSlash && !path15.endsWith("/..")) {
|
|
83890
|
+
path15 += "/";
|
|
83571
83891
|
}
|
|
83572
|
-
url3.path =
|
|
83892
|
+
url3.path = path15;
|
|
83573
83893
|
}
|
|
83574
83894
|
function resolve2(input, base) {
|
|
83575
83895
|
if (!input && !base)
|
|
@@ -83610,13 +83930,13 @@ function resolve2(input, base) {
|
|
|
83610
83930
|
case 3:
|
|
83611
83931
|
return queryHash;
|
|
83612
83932
|
case 4: {
|
|
83613
|
-
const
|
|
83614
|
-
if (!
|
|
83933
|
+
const path15 = url3.path.slice(1);
|
|
83934
|
+
if (!path15)
|
|
83615
83935
|
return queryHash || ".";
|
|
83616
|
-
if (isRelative(base || input) && !isRelative(
|
|
83617
|
-
return "./" +
|
|
83936
|
+
if (isRelative(base || input) && !isRelative(path15)) {
|
|
83937
|
+
return "./" + path15 + queryHash;
|
|
83618
83938
|
}
|
|
83619
|
-
return
|
|
83939
|
+
return path15 + queryHash;
|
|
83620
83940
|
}
|
|
83621
83941
|
case 5:
|
|
83622
83942
|
return url3.path + queryHash;
|
|
@@ -83647,10 +83967,10 @@ var init_resolve_uri = __esm({
|
|
|
83647
83967
|
});
|
|
83648
83968
|
|
|
83649
83969
|
// ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
83650
|
-
function stripFilename(
|
|
83651
|
-
if (!
|
|
83652
|
-
const index =
|
|
83653
|
-
return
|
|
83970
|
+
function stripFilename(path15) {
|
|
83971
|
+
if (!path15) return "";
|
|
83972
|
+
const index = path15.lastIndexOf("/");
|
|
83973
|
+
return path15.slice(0, index + 1);
|
|
83654
83974
|
}
|
|
83655
83975
|
function resolver(mapUrl, sourceRoot) {
|
|
83656
83976
|
const from = stripFilename(mapUrl);
|
|
@@ -93181,8 +93501,17 @@ Caused by: ${options.cause.stack}`;
|
|
|
93181
93501
|
static {
|
|
93182
93502
|
__name2(this, "RunExpiredError");
|
|
93183
93503
|
}
|
|
93184
|
-
|
|
93185
|
-
|
|
93504
|
+
runId;
|
|
93505
|
+
runStatus;
|
|
93506
|
+
expiredAt;
|
|
93507
|
+
constructor(message, runId, runStatus, expiredAt) {
|
|
93508
|
+
super(message, {
|
|
93509
|
+
status: 410,
|
|
93510
|
+
code: "run-expired"
|
|
93511
|
+
});
|
|
93512
|
+
this.runId = runId;
|
|
93513
|
+
this.runStatus = runStatus;
|
|
93514
|
+
this.expiredAt = expiredAt;
|
|
93186
93515
|
this.name = "RunExpiredError";
|
|
93187
93516
|
}
|
|
93188
93517
|
static is(value) {
|
|
@@ -95791,9 +96120,9 @@ function cloneDef(schema) {
|
|
|
95791
96120
|
return mergeDefs(schema._zod.def);
|
|
95792
96121
|
}
|
|
95793
96122
|
__name(cloneDef, "cloneDef");
|
|
95794
|
-
function getElementAtPath(obj,
|
|
95795
|
-
if (!
|
|
95796
|
-
return
|
|
96123
|
+
function getElementAtPath(obj, path15) {
|
|
96124
|
+
if (!path15) return obj;
|
|
96125
|
+
return path15.reduce((acc, key) => acc?.[key], obj);
|
|
95797
96126
|
}
|
|
95798
96127
|
__name(getElementAtPath, "getElementAtPath");
|
|
95799
96128
|
function promiseAllObject(promisesObj) {
|
|
@@ -96133,11 +96462,11 @@ function aborted(x, startIndex = 0) {
|
|
|
96133
96462
|
return false;
|
|
96134
96463
|
}
|
|
96135
96464
|
__name(aborted, "aborted");
|
|
96136
|
-
function prefixIssues(
|
|
96465
|
+
function prefixIssues(path15, issues) {
|
|
96137
96466
|
return issues.map((iss) => {
|
|
96138
96467
|
var _a22;
|
|
96139
96468
|
(_a22 = iss).path ?? (_a22.path = []);
|
|
96140
|
-
iss.path.unshift(
|
|
96469
|
+
iss.path.unshift(path15);
|
|
96141
96470
|
return iss;
|
|
96142
96471
|
});
|
|
96143
96472
|
}
|
|
@@ -96511,7 +96840,7 @@ function treeifyError(error482, mapper = (issue22) => issue22.message) {
|
|
|
96511
96840
|
const result2 = {
|
|
96512
96841
|
errors: []
|
|
96513
96842
|
};
|
|
96514
|
-
const processError = /* @__PURE__ */ __name2((error492,
|
|
96843
|
+
const processError = /* @__PURE__ */ __name2((error492, path15 = []) => {
|
|
96515
96844
|
var _a22, _b;
|
|
96516
96845
|
for (const issue22 of error492.issues) {
|
|
96517
96846
|
if (issue22.code === "invalid_union" && issue22.errors.length) {
|
|
@@ -96528,7 +96857,7 @@ function treeifyError(error482, mapper = (issue22) => issue22.message) {
|
|
|
96528
96857
|
}, issue22.path);
|
|
96529
96858
|
} else {
|
|
96530
96859
|
const fullpath = [
|
|
96531
|
-
...
|
|
96860
|
+
...path15,
|
|
96532
96861
|
...issue22.path
|
|
96533
96862
|
];
|
|
96534
96863
|
if (fullpath.length === 0) {
|
|
@@ -96567,8 +96896,8 @@ function treeifyError(error482, mapper = (issue22) => issue22.message) {
|
|
|
96567
96896
|
__name(treeifyError, "treeifyError");
|
|
96568
96897
|
function toDotPath(_path) {
|
|
96569
96898
|
const segs = [];
|
|
96570
|
-
const
|
|
96571
|
-
for (const seg of
|
|
96899
|
+
const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
96900
|
+
for (const seg of path15) {
|
|
96572
96901
|
if (typeof seg === "number") segs.push(`[${seg}]`);
|
|
96573
96902
|
else if (typeof seg === "symbol") segs.push(`[${JSON.stringify(String(seg))}]`);
|
|
96574
96903
|
else if (/[^\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`);
|
|
@@ -110922,13 +111251,13 @@ function resolveRef(ref, ctx) {
|
|
|
110922
111251
|
if (!ref.startsWith("#")) {
|
|
110923
111252
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
110924
111253
|
}
|
|
110925
|
-
const
|
|
110926
|
-
if (
|
|
111254
|
+
const path15 = ref.slice(1).split("/").filter(Boolean);
|
|
111255
|
+
if (path15.length === 0) {
|
|
110927
111256
|
return ctx.rootSchema;
|
|
110928
111257
|
}
|
|
110929
111258
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
110930
|
-
if (
|
|
110931
|
-
const key =
|
|
111259
|
+
if (path15[0] === defsKey) {
|
|
111260
|
+
const key = path15[1];
|
|
110932
111261
|
if (!key || !ctx.defs[key]) {
|
|
110933
111262
|
throw new Error(`Reference not found: ${ref}`);
|
|
110934
111263
|
}
|
|
@@ -111781,6 +112110,7 @@ __name(validateAttributeChanges, "validateAttributeChanges");
|
|
|
111781
112110
|
var RESERVED_ATTRIBUTE_KEY_PREFIX;
|
|
111782
112111
|
var ROOT_RUN_ID_ATTRIBUTE;
|
|
111783
112112
|
var PARENT_RUN_ID_ATTRIBUTE;
|
|
112113
|
+
var RETENTION_ATTRIBUTE;
|
|
111784
112114
|
var ATTRIBUTE_KEY_MAX_LENGTH;
|
|
111785
112115
|
var ATTRIBUTE_VALUE_MAX_BYTES;
|
|
111786
112116
|
var ATTRIBUTE_MAX_PER_RUN;
|
|
@@ -111792,6 +112122,7 @@ var init_attributes_validation = __esm2({
|
|
|
111792
112122
|
RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
|
|
111793
112123
|
ROOT_RUN_ID_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}rootRunId`;
|
|
111794
112124
|
PARENT_RUN_ID_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}parentRunId`;
|
|
112125
|
+
RETENTION_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}retention`;
|
|
111795
112126
|
ATTRIBUTE_KEY_MAX_LENGTH = 256;
|
|
111796
112127
|
ATTRIBUTE_VALUE_MAX_BYTES = 256;
|
|
111797
112128
|
ATTRIBUTE_MAX_PER_RUN = 64;
|
|
@@ -119529,7 +119860,7 @@ var version2;
|
|
|
119529
119860
|
var init_version = __esm2({
|
|
119530
119861
|
"../core/dist/version.js"() {
|
|
119531
119862
|
"use strict";
|
|
119532
|
-
version2 = "5.0.0-beta.
|
|
119863
|
+
version2 = "5.0.0-beta.49";
|
|
119533
119864
|
}
|
|
119534
119865
|
});
|
|
119535
119866
|
function getWorkflowQueueName(workflowName, namespace) {
|
|
@@ -126053,6 +126384,44 @@ async function getForwardedWritableEncryptionKey(runId, deploymentId, encryption
|
|
|
126053
126384
|
]) : void 0;
|
|
126054
126385
|
}
|
|
126055
126386
|
__name(getForwardedWritableEncryptionKey, "getForwardedWritableEncryptionKey");
|
|
126387
|
+
function tagForwardedWritableTarget(writable, { deploymentId, encryptionPublicKey }) {
|
|
126388
|
+
if (typeof deploymentId === "string") {
|
|
126389
|
+
Object.defineProperty(writable, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL, {
|
|
126390
|
+
value: deploymentId,
|
|
126391
|
+
writable: false
|
|
126392
|
+
});
|
|
126393
|
+
}
|
|
126394
|
+
if (typeof encryptionPublicKey === "string") {
|
|
126395
|
+
Object.defineProperty(writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL, {
|
|
126396
|
+
value: encryptionPublicKey,
|
|
126397
|
+
writable: false
|
|
126398
|
+
});
|
|
126399
|
+
}
|
|
126400
|
+
}
|
|
126401
|
+
__name(tagForwardedWritableTarget, "tagForwardedWritableTarget");
|
|
126402
|
+
function createForwardedWritable({ global: global2, ops, runId, name, key, deploymentId, encryptionPublicKey, runReadyBarrier }) {
|
|
126403
|
+
const serialize32 = getSerializeStream(getExternalReducers(global2, ops, runId, key), key);
|
|
126404
|
+
const serverWritable = new WorkflowServerWritableStream(runId, name, runReadyBarrier);
|
|
126405
|
+
const state = createFlushableState();
|
|
126406
|
+
ops.push(state.promise);
|
|
126407
|
+
flushablePipe(serialize32.readable, serverWritable, state).catch(() => {
|
|
126408
|
+
});
|
|
126409
|
+
pollWritableLock(serialize32.writable, state);
|
|
126410
|
+
Object.defineProperty(serialize32.writable, STREAM_NAME_SYMBOL, {
|
|
126411
|
+
value: name,
|
|
126412
|
+
writable: false
|
|
126413
|
+
});
|
|
126414
|
+
Object.defineProperty(serialize32.writable, STREAM_SERVER_RUN_ID_SYMBOL, {
|
|
126415
|
+
value: runId,
|
|
126416
|
+
writable: false
|
|
126417
|
+
});
|
|
126418
|
+
tagForwardedWritableTarget(serialize32.writable, {
|
|
126419
|
+
deploymentId,
|
|
126420
|
+
encryptionPublicKey
|
|
126421
|
+
});
|
|
126422
|
+
return serialize32.writable;
|
|
126423
|
+
}
|
|
126424
|
+
__name(createForwardedWritable, "createForwardedWritable");
|
|
126056
126425
|
function getRunReadableStream(global2, ops, runId, name, startIndex, cryptoKey) {
|
|
126057
126426
|
let reader;
|
|
126058
126427
|
let lockState;
|
|
@@ -126169,34 +126538,15 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey, option
|
|
|
126169
126538
|
WritableStream: /* @__PURE__ */ __name2((value) => {
|
|
126170
126539
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
126171
126540
|
const targetKey = targetRunId === runId ? cryptoKey : getForwardedWritableEncryptionKey(targetRunId, value.deploymentId, value.encryptionPublicKey);
|
|
126172
|
-
|
|
126173
|
-
|
|
126174
|
-
|
|
126175
|
-
|
|
126176
|
-
|
|
126177
|
-
|
|
126178
|
-
|
|
126179
|
-
|
|
126180
|
-
value: value.name,
|
|
126181
|
-
writable: false
|
|
126541
|
+
return createForwardedWritable({
|
|
126542
|
+
global: global2,
|
|
126543
|
+
ops,
|
|
126544
|
+
runId: targetRunId,
|
|
126545
|
+
name: value.name,
|
|
126546
|
+
key: targetKey,
|
|
126547
|
+
deploymentId: value.deploymentId,
|
|
126548
|
+
encryptionPublicKey: value.encryptionPublicKey
|
|
126182
126549
|
});
|
|
126183
|
-
Object.defineProperty(serialize32.writable, STREAM_SERVER_RUN_ID_SYMBOL, {
|
|
126184
|
-
value: targetRunId,
|
|
126185
|
-
writable: false
|
|
126186
|
-
});
|
|
126187
|
-
if (typeof value.deploymentId === "string") {
|
|
126188
|
-
Object.defineProperty(serialize32.writable, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL, {
|
|
126189
|
-
value: value.deploymentId,
|
|
126190
|
-
writable: false
|
|
126191
|
-
});
|
|
126192
|
-
}
|
|
126193
|
-
if (typeof value.encryptionPublicKey === "string") {
|
|
126194
|
-
Object.defineProperty(serialize32.writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL, {
|
|
126195
|
-
value: value.encryptionPublicKey,
|
|
126196
|
-
writable: false
|
|
126197
|
-
});
|
|
126198
|
-
}
|
|
126199
|
-
return serialize32.writable;
|
|
126200
126550
|
}, "WritableStream"),
|
|
126201
126551
|
AbortController: /* @__PURE__ */ __name2((value) => reviveAbortController(value, ops, runId), "AbortController"),
|
|
126202
126552
|
AbortSignal: /* @__PURE__ */ __name2((value) => reviveAbortSignal(value, ops, runId), "AbortSignal")
|
|
@@ -126696,6 +127046,14 @@ var init_serialization2 = __esm2({
|
|
|
126696
127046
|
pendingRunReady = void 0;
|
|
126697
127047
|
}
|
|
126698
127048
|
}, "ensureRunReady");
|
|
127049
|
+
const writerId = `wrtr_${defaultUlid()}`;
|
|
127050
|
+
const writeSessionPromise = ensureRunReady().then(async () => {
|
|
127051
|
+
const world = await worldPromise;
|
|
127052
|
+
return world.streams.createWriteSession?.(runId, name, {
|
|
127053
|
+
writerId
|
|
127054
|
+
});
|
|
127055
|
+
});
|
|
127056
|
+
let nextChunkSeq = 0;
|
|
126699
127057
|
let buffer22 = [];
|
|
126700
127058
|
let bufferBytes = 0;
|
|
126701
127059
|
let inFlightChunks = 0;
|
|
@@ -126741,14 +127099,18 @@ var init_serialization2 = __esm2({
|
|
|
126741
127099
|
const sendGroup = /* @__PURE__ */ __name2(async (group, bytes, groupT0) => {
|
|
126742
127100
|
await ensureRunReady();
|
|
126743
127101
|
const world = await worldPromise;
|
|
127102
|
+
const session = await writeSessionPromise;
|
|
126744
127103
|
const dispatchAt = Date.now();
|
|
126745
|
-
if (
|
|
127104
|
+
if (session) {
|
|
127105
|
+
await session.write(nextChunkSeq, group);
|
|
127106
|
+
} else if (typeof world.streams.writeMulti === "function" && group.length > 1) {
|
|
126746
127107
|
await world.streams.writeMulti(runId, name, group);
|
|
126747
127108
|
} else {
|
|
126748
127109
|
for (const chunk of group) {
|
|
126749
127110
|
await world.streams.write(runId, name, chunk);
|
|
126750
127111
|
}
|
|
126751
127112
|
}
|
|
127113
|
+
nextChunkSeq += group.length;
|
|
126752
127114
|
if (groupT0 !== void 0) {
|
|
126753
127115
|
recordStreamWriteFlush(groupT0, dispatchAt, runId, name, group.length, bytes, Date.now() - dispatchAt);
|
|
126754
127116
|
}
|
|
@@ -126859,8 +127221,13 @@ var init_serialization2 = __esm2({
|
|
|
126859
127221
|
await drain();
|
|
126860
127222
|
await ensureRunReady();
|
|
126861
127223
|
const world = await worldPromise;
|
|
127224
|
+
const session = await writeSessionPromise;
|
|
126862
127225
|
const closeStart = Date.now();
|
|
126863
|
-
|
|
127226
|
+
if (session) {
|
|
127227
|
+
await session.close();
|
|
127228
|
+
} else {
|
|
127229
|
+
await world.streams.close(runId, name);
|
|
127230
|
+
}
|
|
126864
127231
|
recordStreamClose(closeStart, runId, name);
|
|
126865
127232
|
},
|
|
126866
127233
|
async abort(reason) {
|
|
@@ -126876,6 +127243,8 @@ var init_serialization2 = __esm2({
|
|
|
126876
127243
|
bufferBytes = 0;
|
|
126877
127244
|
sinkError ??= reason ?? new Error("Stream aborted");
|
|
126878
127245
|
rejectWaiters(sinkError);
|
|
127246
|
+
const session = await writeSessionPromise.catch(() => void 0);
|
|
127247
|
+
await session?.dispose?.();
|
|
126879
127248
|
}
|
|
126880
127249
|
});
|
|
126881
127250
|
Object.defineProperty(this, STREAM_DRAIN_SYMBOL, {
|
|
@@ -126900,6 +127269,8 @@ var init_serialization2 = __esm2({
|
|
|
126900
127269
|
__name2(reviveAbortSignal, "reviveAbortSignal");
|
|
126901
127270
|
__name2(getCommonRevivers2, "getCommonRevivers");
|
|
126902
127271
|
__name2(getForwardedWritableEncryptionKey, "getForwardedWritableEncryptionKey");
|
|
127272
|
+
__name2(tagForwardedWritableTarget, "tagForwardedWritableTarget");
|
|
127273
|
+
__name2(createForwardedWritable, "createForwardedWritable");
|
|
126903
127274
|
__name2(getRunReadableStream, "getRunReadableStream");
|
|
126904
127275
|
__name2(getExternalRevivers, "getExternalRevivers");
|
|
126905
127276
|
__name2(getStepRevivers, "getStepRevivers");
|
|
@@ -127129,6 +127500,7 @@ __name2(getWorkflowVmFromEnv, "getWorkflowVmFromEnv");
|
|
|
127129
127500
|
init_wait_until();
|
|
127130
127501
|
init_world_compatibility();
|
|
127131
127502
|
var CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS = 2e3;
|
|
127503
|
+
var RETENTION_ZERO_ATTRIBUTE_VALUE = "0";
|
|
127132
127504
|
var ulid3 = monotonicFactory();
|
|
127133
127505
|
function resolveLineageAttributes() {
|
|
127134
127506
|
const store = contextStorage.getStore();
|
|
@@ -127234,14 +127606,27 @@ async function start(workflow, argsOrOptions, options) {
|
|
|
127234
127606
|
value
|
|
127235
127607
|
]));
|
|
127236
127608
|
}
|
|
127609
|
+
let retentionAttribute;
|
|
127610
|
+
if (opts.experimental_retention !== void 0 && opts.experimental_retention !== "default") {
|
|
127611
|
+
if (opts.experimental_retention !== 0) {
|
|
127612
|
+
throw new WorkflowRuntimeError(`start({ experimental_retention }) must be 0 or 'default'; received ${JSON.stringify(opts.experimental_retention)}.`);
|
|
127613
|
+
}
|
|
127614
|
+
if (specVersion < SPEC_VERSION_SUPPORTS_ATTRIBUTES) {
|
|
127615
|
+
throw new WorkflowRuntimeError("start({ experimental_retention }) requires a World that supports spec version 4 or later.");
|
|
127616
|
+
}
|
|
127617
|
+
retentionAttribute = {
|
|
127618
|
+
[RETENTION_ATTRIBUTE]: RETENTION_ZERO_ATTRIBUTE_VALUE
|
|
127619
|
+
};
|
|
127620
|
+
}
|
|
127237
127621
|
const lineage = specVersion >= SPEC_VERSION_SUPPORTS_ATTRIBUTES ? resolveLineageAttributes() : void 0;
|
|
127238
|
-
const runAttributes = lineage ? {
|
|
127622
|
+
const runAttributes = lineage || retentionAttribute ? {
|
|
127239
127623
|
...lineage,
|
|
127240
|
-
...attributes
|
|
127624
|
+
...attributes,
|
|
127625
|
+
...retentionAttribute
|
|
127241
127626
|
} : attributes;
|
|
127242
127627
|
const attributeSeed = runAttributes ? {
|
|
127243
127628
|
attributes: runAttributes,
|
|
127244
|
-
...allowReservedAttributes || lineage != null ? {
|
|
127629
|
+
...allowReservedAttributes || lineage != null || retentionAttribute != null ? {
|
|
127245
127630
|
allowReservedAttributes: true
|
|
127246
127631
|
} : {}
|
|
127247
127632
|
} : {};
|
|
@@ -127388,7 +127773,7 @@ __name2(start, "start");
|
|
|
127388
127773
|
value: "start",
|
|
127389
127774
|
configurable: true
|
|
127390
127775
|
});
|
|
127391
|
-
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.
|
|
127776
|
+
})(start, "step//@workflow/core/runtime/start@5.0.0-beta.49//start");
|
|
127392
127777
|
async function wakeUpRun(world, runId, options) {
|
|
127393
127778
|
try {
|
|
127394
127779
|
const run22 = await world.runs.get(runId, {
|
|
@@ -127476,6 +127861,11 @@ var PAYLOAD_TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
|
127476
127861
|
"completed",
|
|
127477
127862
|
"failed"
|
|
127478
127863
|
]);
|
|
127864
|
+
var NOT_FOUND_RETRY_DELAYS = [
|
|
127865
|
+
1e3,
|
|
127866
|
+
3e3,
|
|
127867
|
+
6e3
|
|
127868
|
+
];
|
|
127479
127869
|
function getReturnValuePollIntervalMs() {
|
|
127480
127870
|
return envNumber("WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS", RETURN_VALUE_POLL_INTERVAL_MS, {
|
|
127481
127871
|
integer: true,
|
|
@@ -127700,8 +128090,75 @@ var Run = class _Run {
|
|
|
127700
128090
|
}, "getTailIndex")
|
|
127701
128091
|
});
|
|
127702
128092
|
}
|
|
128093
|
+
/** The writable stream of the workflow run. */
|
|
128094
|
+
get writable() {
|
|
128095
|
+
return this.getWritable();
|
|
128096
|
+
}
|
|
128097
|
+
/**
|
|
128098
|
+
* Returns a writable that appends to this run's stream.
|
|
128099
|
+
*
|
|
128100
|
+
* Initialization is deferred until the first write. The run must already
|
|
128101
|
+
* exist. The writable may be forwarded through `start()` and into steps, but
|
|
128102
|
+
* grants no read access or additional authorization.
|
|
128103
|
+
*
|
|
128104
|
+
* @remarks
|
|
128105
|
+
* `writer.close()` closes the shared stream. Contributors should call
|
|
128106
|
+
* `releaseLock()`, which also drains pending writes.
|
|
128107
|
+
*
|
|
128108
|
+
* @param options - The writable stream options.
|
|
128109
|
+
*/
|
|
128110
|
+
getWritable(options = {}) {
|
|
128111
|
+
const { ops = [], global: global2 = globalThis, namespace } = options;
|
|
128112
|
+
const name = getWorkflowRunStreamId(this.runId, namespace);
|
|
128113
|
+
let targetPromise;
|
|
128114
|
+
let writable;
|
|
128115
|
+
const resolveTarget = /* @__PURE__ */ __name2(() => {
|
|
128116
|
+
targetPromise ??= this.#getMetadata().then(async (run22) => {
|
|
128117
|
+
const target2 = {
|
|
128118
|
+
key: await getForwardedWritableEncryptionKey(this.runId, run22.deploymentId, run22.encryptionPublicKey),
|
|
128119
|
+
deploymentId: run22.deploymentId,
|
|
128120
|
+
encryptionPublicKey: run22.encryptionPublicKey
|
|
128121
|
+
};
|
|
128122
|
+
tagForwardedWritableTarget(writable, target2);
|
|
128123
|
+
return target2;
|
|
128124
|
+
});
|
|
128125
|
+
return targetPromise;
|
|
128126
|
+
}, "resolveTarget");
|
|
128127
|
+
writable = createForwardedWritable({
|
|
128128
|
+
global: global2,
|
|
128129
|
+
ops,
|
|
128130
|
+
runId: this.runId,
|
|
128131
|
+
name,
|
|
128132
|
+
key: /* @__PURE__ */ __name2(() => resolveTarget().then(({ key }) => key), "key")
|
|
128133
|
+
});
|
|
128134
|
+
return writable;
|
|
128135
|
+
}
|
|
128136
|
+
/** Reads metadata, briefly retrying resilient starts. @internal */
|
|
128137
|
+
async #getMetadata() {
|
|
128138
|
+
const world = await this.#lazyWorldPromise;
|
|
128139
|
+
const maxRetries = this.#resilientStart ? NOT_FOUND_RETRY_DELAYS.length : 0;
|
|
128140
|
+
let attempt = 0;
|
|
128141
|
+
while (true) {
|
|
128142
|
+
try {
|
|
128143
|
+
return await world.runs.get(this.runId, {
|
|
128144
|
+
resolveData: "none"
|
|
128145
|
+
});
|
|
128146
|
+
} catch (error482) {
|
|
128147
|
+
if (!WorkflowRunNotFoundError.is(error482) || attempt >= maxRetries) {
|
|
128148
|
+
throw error482;
|
|
128149
|
+
}
|
|
128150
|
+
const delay = NOT_FOUND_RETRY_DELAYS[attempt];
|
|
128151
|
+
attempt++;
|
|
128152
|
+
await new Promise((resolve3) => setTimeout(resolve3, delay));
|
|
128153
|
+
}
|
|
128154
|
+
}
|
|
128155
|
+
}
|
|
127703
128156
|
/** @internal */
|
|
127704
128157
|
async #resolveTerminalReturnValue(run22) {
|
|
128158
|
+
const expiredAt = run22.expiredAt;
|
|
128159
|
+
if (expiredAt != null && expiredAt <= /* @__PURE__ */ new Date()) {
|
|
128160
|
+
throw new RunExpiredError(`Run "${this.runId}" ${run22.status === "completed" ? "completed" : `is ${run22.status}`}, but its data expired at ${expiredAt.toISOString()} and is no longer readable.`, this.runId, run22.status, expiredAt);
|
|
128161
|
+
}
|
|
127705
128162
|
if (run22.status === "completed") {
|
|
127706
128163
|
const encryptionKey = await this.#getEncryptionKey(run22);
|
|
127707
128164
|
return await hydrateWorkflowReturnValue(run22.output, this.runId, encryptionKey);
|
|
@@ -127731,12 +128188,7 @@ var Run = class _Run {
|
|
|
127731
128188
|
async #pollReturnValue() {
|
|
127732
128189
|
const world = await this.#lazyWorldPromise;
|
|
127733
128190
|
let notFoundRetries = 0;
|
|
127734
|
-
const NOT_FOUND_MAX_RETRIES = this.#resilientStart ?
|
|
127735
|
-
const NOT_FOUND_DELAYS = [
|
|
127736
|
-
1e3,
|
|
127737
|
-
3e3,
|
|
127738
|
-
6e3
|
|
127739
|
-
];
|
|
128191
|
+
const NOT_FOUND_MAX_RETRIES = this.#resilientStart ? NOT_FOUND_RETRY_DELAYS.length : 0;
|
|
127740
128192
|
const waitForTerminalStatus = isReturnValueLongPollEnabled() ? world.runs.waitForTerminalStatus?.bind(world.runs) : void 0;
|
|
127741
128193
|
let longPolls = 0;
|
|
127742
128194
|
const maxLongPolls = getReturnValueMaxLongPolls();
|
|
@@ -127770,7 +128222,7 @@ var Run = class _Run {
|
|
|
127770
128222
|
continue;
|
|
127771
128223
|
}
|
|
127772
128224
|
if (WorkflowRunNotFoundError.is(error482) && notFoundRetries < NOT_FOUND_MAX_RETRIES) {
|
|
127773
|
-
const delay =
|
|
128225
|
+
const delay = NOT_FOUND_RETRY_DELAYS[notFoundRetries];
|
|
127774
128226
|
notFoundRetries++;
|
|
127775
128227
|
await new Promise((resolve3) => setTimeout(resolve3, delay));
|
|
127776
128228
|
continue;
|
|
@@ -127788,7 +128240,7 @@ var Run = class _Run {
|
|
|
127788
128240
|
value: "wakeUp",
|
|
127789
128241
|
configurable: true
|
|
127790
128242
|
});
|
|
127791
|
-
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128243
|
+
})(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#wakeUp");
|
|
127792
128244
|
(function(__wf_fn, __wf_id) {
|
|
127793
128245
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127794
128246
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127797,7 +128249,7 @@ var Run = class _Run {
|
|
|
127797
128249
|
value: "cancel",
|
|
127798
128250
|
configurable: true
|
|
127799
128251
|
});
|
|
127800
|
-
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128252
|
+
})(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#cancel");
|
|
127801
128253
|
(function(__wf_fn, __wf_id) {
|
|
127802
128254
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127803
128255
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127806,7 +128258,16 @@ var Run = class _Run {
|
|
|
127806
128258
|
value: "getReadable",
|
|
127807
128259
|
configurable: true
|
|
127808
128260
|
});
|
|
127809
|
-
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128261
|
+
})(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#getReadable");
|
|
128262
|
+
(function(__wf_fn, __wf_id) {
|
|
128263
|
+
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
128264
|
+
__wf_reg.set(__wf_id, __wf_fn);
|
|
128265
|
+
__wf_fn.stepId = __wf_id;
|
|
128266
|
+
Object.defineProperty(__wf_fn, "name", {
|
|
128267
|
+
value: "getWritable",
|
|
128268
|
+
configurable: true
|
|
128269
|
+
});
|
|
128270
|
+
})(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#getWritable");
|
|
127810
128271
|
(function(__wf_fn, __wf_id) {
|
|
127811
128272
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127812
128273
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127815,7 +128276,7 @@ var Run = class _Run {
|
|
|
127815
128276
|
value: "exists",
|
|
127816
128277
|
configurable: true
|
|
127817
128278
|
});
|
|
127818
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128279
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#exists");
|
|
127819
128280
|
(function(__wf_fn, __wf_id) {
|
|
127820
128281
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127821
128282
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127824,7 +128285,7 @@ var Run = class _Run {
|
|
|
127824
128285
|
value: "status",
|
|
127825
128286
|
configurable: true
|
|
127826
128287
|
});
|
|
127827
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128288
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#status");
|
|
127828
128289
|
(function(__wf_fn, __wf_id) {
|
|
127829
128290
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127830
128291
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127833,7 +128294,7 @@ var Run = class _Run {
|
|
|
127833
128294
|
value: "returnValue",
|
|
127834
128295
|
configurable: true
|
|
127835
128296
|
});
|
|
127836
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128297
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#returnValue");
|
|
127837
128298
|
(function(__wf_fn, __wf_id) {
|
|
127838
128299
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127839
128300
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127842,7 +128303,7 @@ var Run = class _Run {
|
|
|
127842
128303
|
value: "workflowName",
|
|
127843
128304
|
configurable: true
|
|
127844
128305
|
});
|
|
127845
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128306
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#workflowName");
|
|
127846
128307
|
(function(__wf_fn, __wf_id) {
|
|
127847
128308
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127848
128309
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127851,7 +128312,7 @@ var Run = class _Run {
|
|
|
127851
128312
|
value: "createdAt",
|
|
127852
128313
|
configurable: true
|
|
127853
128314
|
});
|
|
127854
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128315
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#createdAt");
|
|
127855
128316
|
(function(__wf_fn, __wf_id) {
|
|
127856
128317
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127857
128318
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127860,7 +128321,7 @@ var Run = class _Run {
|
|
|
127860
128321
|
value: "startedAt",
|
|
127861
128322
|
configurable: true
|
|
127862
128323
|
});
|
|
127863
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128324
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#startedAt");
|
|
127864
128325
|
(function(__wf_fn, __wf_id) {
|
|
127865
128326
|
var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127866
128327
|
__wf_reg.set(__wf_id, __wf_fn);
|
|
@@ -127869,7 +128330,7 @@ var Run = class _Run {
|
|
|
127869
128330
|
value: "completedAt",
|
|
127870
128331
|
configurable: true
|
|
127871
128332
|
});
|
|
127872
|
-
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.
|
|
128333
|
+
})(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.49//Run#completedAt");
|
|
127873
128334
|
(function(__wf_cls, __wf_id) {
|
|
127874
128335
|
var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
|
|
127875
128336
|
__wf_reg.set(__wf_id, __wf_cls);
|
|
@@ -127879,7 +128340,7 @@ var Run = class _Run {
|
|
|
127879
128340
|
enumerable: false,
|
|
127880
128341
|
configurable: false
|
|
127881
128342
|
});
|
|
127882
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
128343
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.49//Run");
|
|
127883
128344
|
async function fetch2(...args) {
|
|
127884
128345
|
return globalThis.fetch(...args);
|
|
127885
128346
|
}
|
|
@@ -128117,8 +128578,8 @@ function defineHook({ schema } = {}) {
|
|
|
128117
128578
|
}
|
|
128118
128579
|
if (result2.issues) {
|
|
128119
128580
|
const lines = result2.issues.map((issue22) => {
|
|
128120
|
-
const
|
|
128121
|
-
return
|
|
128581
|
+
const path15 = issue22.path?.map((segment) => typeof segment === "object" && segment !== null ? String(segment.key) : String(segment)).join(".");
|
|
128582
|
+
return path15 ? ` at "${path15}": ${issue22.message}` : ` ${issue22.message}`;
|
|
128122
128583
|
});
|
|
128123
128584
|
throw new Error(`Hook payload did not match the defined schema:
|
|
128124
128585
|
${lines.join("\n")}`);
|
|
@@ -131741,6 +132202,7 @@ var PAYLOAD_TERMINAL_RUN_STATUSES2 = /* @__PURE__ */ new Set([
|
|
|
131741
132202
|
"completed",
|
|
131742
132203
|
"failed"
|
|
131743
132204
|
]);
|
|
132205
|
+
var NOT_FOUND_RETRY_DELAYS2 = [1e3, 3e3, 6e3];
|
|
131744
132206
|
function getReturnValuePollIntervalMs2() {
|
|
131745
132207
|
return envNumber2("WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS", RETURN_VALUE_POLL_INTERVAL_MS2, { integer: true, min: 1 });
|
|
131746
132208
|
}
|
|
@@ -131948,8 +132410,74 @@ var Run2 = class _Run2 {
|
|
|
131948
132410
|
}, "getTailIndex")
|
|
131949
132411
|
});
|
|
131950
132412
|
}
|
|
132413
|
+
/** The writable stream of the workflow run. */
|
|
132414
|
+
get writable() {
|
|
132415
|
+
return this.getWritable();
|
|
132416
|
+
}
|
|
132417
|
+
/**
|
|
132418
|
+
* Returns a writable that appends to this run's stream.
|
|
132419
|
+
*
|
|
132420
|
+
* Initialization is deferred until the first write. The run must already
|
|
132421
|
+
* exist. The writable may be forwarded through `start()` and into steps, but
|
|
132422
|
+
* grants no read access or additional authorization.
|
|
132423
|
+
*
|
|
132424
|
+
* @remarks
|
|
132425
|
+
* `writer.close()` closes the shared stream. Contributors should call
|
|
132426
|
+
* `releaseLock()`, which also drains pending writes.
|
|
132427
|
+
*
|
|
132428
|
+
* @param options - The writable stream options.
|
|
132429
|
+
*/
|
|
132430
|
+
getWritable(options = {}) {
|
|
132431
|
+
"use step";
|
|
132432
|
+
const { ops = [], global: global2 = globalThis, namespace } = options;
|
|
132433
|
+
const name = getWorkflowRunStreamId2(this.runId, namespace);
|
|
132434
|
+
let targetPromise;
|
|
132435
|
+
let writable;
|
|
132436
|
+
const resolveTarget = /* @__PURE__ */ __name(() => {
|
|
132437
|
+
targetPromise ??= this.#getMetadata().then(async (run3) => {
|
|
132438
|
+
const target2 = {
|
|
132439
|
+
key: await getForwardedWritableEncryptionKey2(this.runId, run3.deploymentId, run3.encryptionPublicKey),
|
|
132440
|
+
deploymentId: run3.deploymentId,
|
|
132441
|
+
encryptionPublicKey: run3.encryptionPublicKey
|
|
132442
|
+
};
|
|
132443
|
+
tagForwardedWritableTarget2(writable, target2);
|
|
132444
|
+
return target2;
|
|
132445
|
+
});
|
|
132446
|
+
return targetPromise;
|
|
132447
|
+
}, "resolveTarget");
|
|
132448
|
+
writable = createForwardedWritable2({
|
|
132449
|
+
global: global2,
|
|
132450
|
+
ops,
|
|
132451
|
+
runId: this.runId,
|
|
132452
|
+
name,
|
|
132453
|
+
key: /* @__PURE__ */ __name(() => resolveTarget().then(({ key }) => key), "key")
|
|
132454
|
+
});
|
|
132455
|
+
return writable;
|
|
132456
|
+
}
|
|
132457
|
+
/** Reads metadata, briefly retrying resilient starts. @internal */
|
|
132458
|
+
async #getMetadata() {
|
|
132459
|
+
const world = await this.#lazyWorldPromise;
|
|
132460
|
+
const maxRetries = this.#resilientStart ? NOT_FOUND_RETRY_DELAYS2.length : 0;
|
|
132461
|
+
let attempt = 0;
|
|
132462
|
+
while (true) {
|
|
132463
|
+
try {
|
|
132464
|
+
return await world.runs.get(this.runId, { resolveData: "none" });
|
|
132465
|
+
} catch (error95) {
|
|
132466
|
+
if (!WorkflowRunNotFoundError2.is(error95) || attempt >= maxRetries) {
|
|
132467
|
+
throw error95;
|
|
132468
|
+
}
|
|
132469
|
+
const delay = NOT_FOUND_RETRY_DELAYS2[attempt];
|
|
132470
|
+
attempt++;
|
|
132471
|
+
await new Promise((resolve3) => setTimeout(resolve3, delay));
|
|
132472
|
+
}
|
|
132473
|
+
}
|
|
132474
|
+
}
|
|
131951
132475
|
/** @internal */
|
|
131952
132476
|
async #resolveTerminalReturnValue(run3) {
|
|
132477
|
+
const expiredAt = run3.expiredAt;
|
|
132478
|
+
if (expiredAt != null && expiredAt <= /* @__PURE__ */ new Date()) {
|
|
132479
|
+
throw new RunExpiredError2(`Run "${this.runId}" ${run3.status === "completed" ? "completed" : `is ${run3.status}`}, but its data expired at ${expiredAt.toISOString()} and is no longer readable.`, this.runId, run3.status, expiredAt);
|
|
132480
|
+
}
|
|
131953
132481
|
if (run3.status === "completed") {
|
|
131954
132482
|
const encryptionKey = await this.#getEncryptionKey(run3);
|
|
131955
132483
|
return await hydrateWorkflowReturnValue2(run3.output, this.runId, encryptionKey);
|
|
@@ -131979,8 +132507,7 @@ var Run2 = class _Run2 {
|
|
|
131979
132507
|
async #pollReturnValue() {
|
|
131980
132508
|
const world = await this.#lazyWorldPromise;
|
|
131981
132509
|
let notFoundRetries = 0;
|
|
131982
|
-
const NOT_FOUND_MAX_RETRIES = this.#resilientStart ?
|
|
131983
|
-
const NOT_FOUND_DELAYS = [1e3, 3e3, 6e3];
|
|
132510
|
+
const NOT_FOUND_MAX_RETRIES = this.#resilientStart ? NOT_FOUND_RETRY_DELAYS2.length : 0;
|
|
131984
132511
|
const waitForTerminalStatus = isReturnValueLongPollEnabled2() ? world.runs.waitForTerminalStatus?.bind(world.runs) : void 0;
|
|
131985
132512
|
let longPolls = 0;
|
|
131986
132513
|
const maxLongPolls = getReturnValueMaxLongPolls2();
|
|
@@ -132015,7 +132542,7 @@ var Run2 = class _Run2 {
|
|
|
132015
132542
|
continue;
|
|
132016
132543
|
}
|
|
132017
132544
|
if (WorkflowRunNotFoundError2.is(error95) && notFoundRetries < NOT_FOUND_MAX_RETRIES) {
|
|
132018
|
-
const delay =
|
|
132545
|
+
const delay = NOT_FOUND_RETRY_DELAYS2[notFoundRetries];
|
|
132019
132546
|
notFoundRetries++;
|
|
132020
132547
|
await new Promise((resolve3) => setTimeout(resolve3, delay));
|
|
132021
132548
|
continue;
|
|
@@ -134845,11 +135372,16 @@ var Run = class _Run {
|
|
|
134845
135372
|
get readable() {
|
|
134846
135373
|
return this.getReadable();
|
|
134847
135374
|
}
|
|
135375
|
+
/** The writable stream of the workflow run. */
|
|
135376
|
+
get writable() {
|
|
135377
|
+
return this.getWritable();
|
|
135378
|
+
}
|
|
134848
135379
|
};
|
|
134849
|
-
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
134850
|
-
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
134851
|
-
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
134852
|
-
|
|
135380
|
+
Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#wakeUp");
|
|
135381
|
+
Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#cancel");
|
|
135382
|
+
Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#getReadable");
|
|
135383
|
+
Run.prototype["getWritable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#getWritable");
|
|
135384
|
+
var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#exists");
|
|
134853
135385
|
Object.defineProperty(Run.prototype, "exists", {
|
|
134854
135386
|
get() {
|
|
134855
135387
|
return __step_Run$exists.call(this);
|
|
@@ -134857,7 +135389,7 @@ Object.defineProperty(Run.prototype, "exists", {
|
|
|
134857
135389
|
configurable: true,
|
|
134858
135390
|
enumerable: false
|
|
134859
135391
|
});
|
|
134860
|
-
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
135392
|
+
var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#status");
|
|
134861
135393
|
Object.defineProperty(Run.prototype, "status", {
|
|
134862
135394
|
get() {
|
|
134863
135395
|
return __step_Run$status.call(this);
|
|
@@ -134865,7 +135397,7 @@ Object.defineProperty(Run.prototype, "status", {
|
|
|
134865
135397
|
configurable: true,
|
|
134866
135398
|
enumerable: false
|
|
134867
135399
|
});
|
|
134868
|
-
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
135400
|
+
var __step_Run$returnValue = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#returnValue");
|
|
134869
135401
|
Object.defineProperty(Run.prototype, "returnValue", {
|
|
134870
135402
|
get() {
|
|
134871
135403
|
return __step_Run$returnValue.call(this);
|
|
@@ -134873,7 +135405,7 @@ Object.defineProperty(Run.prototype, "returnValue", {
|
|
|
134873
135405
|
configurable: true,
|
|
134874
135406
|
enumerable: false
|
|
134875
135407
|
});
|
|
134876
|
-
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
135408
|
+
var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#workflowName");
|
|
134877
135409
|
Object.defineProperty(Run.prototype, "workflowName", {
|
|
134878
135410
|
get() {
|
|
134879
135411
|
return __step_Run$workflowName.call(this);
|
|
@@ -134881,7 +135413,7 @@ Object.defineProperty(Run.prototype, "workflowName", {
|
|
|
134881
135413
|
configurable: true,
|
|
134882
135414
|
enumerable: false
|
|
134883
135415
|
});
|
|
134884
|
-
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
135416
|
+
var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#createdAt");
|
|
134885
135417
|
Object.defineProperty(Run.prototype, "createdAt", {
|
|
134886
135418
|
get() {
|
|
134887
135419
|
return __step_Run$createdAt.call(this);
|
|
@@ -134889,7 +135421,7 @@ Object.defineProperty(Run.prototype, "createdAt", {
|
|
|
134889
135421
|
configurable: true,
|
|
134890
135422
|
enumerable: false
|
|
134891
135423
|
});
|
|
134892
|
-
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
135424
|
+
var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#startedAt");
|
|
134893
135425
|
Object.defineProperty(Run.prototype, "startedAt", {
|
|
134894
135426
|
get() {
|
|
134895
135427
|
return __step_Run$startedAt.call(this);
|
|
@@ -134897,7 +135429,7 @@ Object.defineProperty(Run.prototype, "startedAt", {
|
|
|
134897
135429
|
configurable: true,
|
|
134898
135430
|
enumerable: false
|
|
134899
135431
|
});
|
|
134900
|
-
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.
|
|
135432
|
+
var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.0.0-beta.49//Run#completedAt");
|
|
134901
135433
|
Object.defineProperty(Run.prototype, "completedAt", {
|
|
134902
135434
|
get() {
|
|
134903
135435
|
return __step_Run$completedAt.call(this);
|
|
@@ -134914,7 +135446,7 @@ Object.defineProperty(Run.prototype, "completedAt", {
|
|
|
134914
135446
|
enumerable: false,
|
|
134915
135447
|
configurable: false
|
|
134916
135448
|
});
|
|
134917
|
-
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.
|
|
135449
|
+
})(Run, "class//@workflow/core/runtime/run@5.0.0-beta.49//Run");
|
|
134918
135450
|
|
|
134919
135451
|
// ../core/dist/workflow/create-hook.js
|
|
134920
135452
|
aliasSerializationClass(RUN_CLASS_ID, Run);
|
|
@@ -134946,6 +135478,7 @@ __name(defineHook, "defineHook");
|
|
|
134946
135478
|
var RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
|
|
134947
135479
|
var ROOT_RUN_ID_ATTRIBUTE = \`\${RESERVED_ATTRIBUTE_KEY_PREFIX}rootRunId\`;
|
|
134948
135480
|
var PARENT_RUN_ID_ATTRIBUTE = \`\${RESERVED_ATTRIBUTE_KEY_PREFIX}parentRunId\`;
|
|
135481
|
+
var RETENTION_ATTRIBUTE = \`\${RESERVED_ATTRIBUTE_KEY_PREFIX}retention\`;
|
|
134949
135482
|
var textEncoder = new TextEncoder();
|
|
134950
135483
|
|
|
134951
135484
|
// ../core/dist/workflow/writable-stream.js
|
|
@@ -139544,7 +140077,7 @@ globalThis.__private_workflows.set("workflow//./workflows/inline-execution//hook
|
|
|
139544
140077
|
var latestNoOpWarning = globalSingleton("@workflow/core//latestNoOpWarning", 1, () => ({
|
|
139545
140078
|
warned: false
|
|
139546
140079
|
}));
|
|
139547
|
-
var start = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/start@5.0.0-beta.
|
|
140080
|
+
var start = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/start@5.0.0-beta.49//start");
|
|
139548
140081
|
|
|
139549
140082
|
// workflows/lineage.ts
|
|
139550
140083
|
var noop = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//./workflows/lineage//noop");
|