@workflow/world-testing 4.0.1-beta.15 → 4.0.1-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.well-known/workflow/v1/flow.js +27 -13
- package/dist/.well-known/workflow/v1/flow.js.map +1 -1
- package/dist/.well-known/workflow/v1/manifest.debug.json +5 -5
- package/dist/.well-known/workflow/v1/step.js +59 -33
- package/dist/.well-known/workflow/v1/step.js.map +1 -1
- package/dist/src/idempotency.mjs +1 -1
- package/dist/src/idempotency.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -43854,7 +43854,8 @@ __name(deserializeChunk, "deserializeChunk");
|
|
|
43854
43854
|
function createStreamer(basedir) {
|
|
43855
43855
|
const streamEmitter = new import_node_events15.EventEmitter();
|
|
43856
43856
|
return {
|
|
43857
|
-
async writeToStream(name, chunk) {
|
|
43857
|
+
async writeToStream(name, _runId, chunk) {
|
|
43858
|
+
await _runId;
|
|
43858
43859
|
const chunkId = `strm_${monotonicUlid2()}`;
|
|
43859
43860
|
if (typeof chunk === "string") {
|
|
43860
43861
|
chunk = new TextEncoder().encode(chunk);
|
|
@@ -43872,7 +43873,8 @@ function createStreamer(basedir) {
|
|
|
43872
43873
|
chunkId
|
|
43873
43874
|
});
|
|
43874
43875
|
},
|
|
43875
|
-
async closeStream(name) {
|
|
43876
|
+
async closeStream(name, _runId) {
|
|
43877
|
+
await _runId;
|
|
43876
43878
|
const chunkId = `strm_${monotonicUlid2()}`;
|
|
43877
43879
|
const chunkPath = import_node_path8.default.join(basedir, "streams", "chunks", `${name}-${chunkId}.json`);
|
|
43878
43880
|
await write(chunkPath, serializeChunk({ chunk: Buffer.from([]), eof: true }));
|
|
@@ -45484,7 +45486,7 @@ __name(send, "send");
|
|
|
45484
45486
|
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
45485
45487
|
var import_oidc2 = __toESM(require_dist(), 1);
|
|
45486
45488
|
// ../world-vercel/dist/version.js
|
|
45487
|
-
var version2 = "4.0.1-beta.
|
|
45489
|
+
var version2 = "4.0.1-beta.9";
|
|
45488
45490
|
// ../world-vercel/dist/utils.js
|
|
45489
45491
|
var DEFAULT_RESOLVE_DATA_OPTION2 = "all";
|
|
45490
45492
|
function dateToStringReplacer(_key, value) {
|
|
@@ -45836,7 +45838,9 @@ var WorkflowRunWireWithRefsSchema = WorkflowRunWireBaseSchema.omit({
|
|
|
45836
45838
|
inputRef: external_exports.any().optional(),
|
|
45837
45839
|
outputRef: external_exports.any().optional(),
|
|
45838
45840
|
input: external_exports.array(external_exports.any()).optional(),
|
|
45839
|
-
output: external_exports.any().optional()
|
|
45841
|
+
output: external_exports.any().optional(),
|
|
45842
|
+
blobStorageBytes: external_exports.number().optional(),
|
|
45843
|
+
streamStorageBytes: external_exports.number().optional()
|
|
45840
45844
|
});
|
|
45841
45845
|
function filterRunData2(run, resolveData) {
|
|
45842
45846
|
if (resolveData === "none") {
|
|
@@ -46144,32 +46148,37 @@ function createStorage2(config3) {
|
|
|
46144
46148
|
}
|
|
46145
46149
|
__name(createStorage2, "createStorage");
|
|
46146
46150
|
// ../world-vercel/dist/streamer.js
|
|
46147
|
-
function getStreamUrl(name, httpConfig) {
|
|
46151
|
+
function getStreamUrl(name, runId, httpConfig) {
|
|
46152
|
+
if (runId) {
|
|
46153
|
+
return new URL(`${httpConfig.baseUrl}/v1/runs/${runId}/stream/${encodeURIComponent(name)}`);
|
|
46154
|
+
}
|
|
46148
46155
|
return new URL(`${httpConfig.baseUrl}/v1/stream/${encodeURIComponent(name)}`);
|
|
46149
46156
|
}
|
|
46150
46157
|
__name(getStreamUrl, "getStreamUrl");
|
|
46151
46158
|
function createStreamer2(config3) {
|
|
46152
46159
|
return {
|
|
46153
|
-
async writeToStream(name, chunk) {
|
|
46160
|
+
async writeToStream(name, runId, chunk) {
|
|
46161
|
+
const resolvedRunId = await runId;
|
|
46154
46162
|
const httpConfig = await getHttpConfig(config3);
|
|
46155
|
-
await fetch(getStreamUrl(name, httpConfig), {
|
|
46163
|
+
await fetch(getStreamUrl(name, resolvedRunId, httpConfig), {
|
|
46156
46164
|
method: "PUT",
|
|
46157
46165
|
body: chunk,
|
|
46158
46166
|
headers: httpConfig.headers,
|
|
46159
46167
|
duplex: "half"
|
|
46160
46168
|
});
|
|
46161
46169
|
},
|
|
46162
|
-
async closeStream(name) {
|
|
46170
|
+
async closeStream(name, runId) {
|
|
46171
|
+
const resolvedRunId = await runId;
|
|
46163
46172
|
const httpConfig = await getHttpConfig(config3);
|
|
46164
46173
|
httpConfig.headers.set("X-Stream-Done", "true");
|
|
46165
|
-
await fetch(getStreamUrl(name, httpConfig), {
|
|
46174
|
+
await fetch(getStreamUrl(name, resolvedRunId, httpConfig), {
|
|
46166
46175
|
method: "PUT",
|
|
46167
46176
|
headers: httpConfig.headers
|
|
46168
46177
|
});
|
|
46169
46178
|
},
|
|
46170
46179
|
async readFromStream(name, startIndex) {
|
|
46171
46180
|
const httpConfig = await getHttpConfig(config3);
|
|
46172
|
-
const url2 = getStreamUrl(name, httpConfig);
|
|
46181
|
+
const url2 = getStreamUrl(name, void 0, httpConfig);
|
|
46173
46182
|
if (typeof startIndex === "number") {
|
|
46174
46183
|
url2.searchParams.set("startIndex", String(startIndex));
|
|
46175
46184
|
}
|
|
@@ -46784,17 +46793,22 @@ var WorkflowServerWritableStream = class extends WritableStream {
|
|
|
46784
46793
|
static {
|
|
46785
46794
|
__name(this, "WorkflowServerWritableStream");
|
|
46786
46795
|
}
|
|
46787
|
-
constructor(name) {
|
|
46796
|
+
constructor(name, runId) {
|
|
46797
|
+
if (typeof runId !== "string" && !(runId instanceof Promise)) {
|
|
46798
|
+
throw new Error(`"runId" must be a string or a promise that resolves to a string, got "${typeof runId}"`);
|
|
46799
|
+
}
|
|
46788
46800
|
if (typeof name !== "string" || name.length === 0) {
|
|
46789
46801
|
throw new Error(`"name" is required, got "${name}"`);
|
|
46790
46802
|
}
|
|
46791
46803
|
const world = getWorld();
|
|
46792
46804
|
super({
|
|
46793
46805
|
async write(chunk) {
|
|
46794
|
-
await
|
|
46806
|
+
const _runId = await runId;
|
|
46807
|
+
await world.writeToStream(name, _runId, chunk);
|
|
46795
46808
|
},
|
|
46796
46809
|
async close() {
|
|
46797
|
-
await
|
|
46810
|
+
const _runId = await runId;
|
|
46811
|
+
await world.closeStream(name, _runId);
|
|
46798
46812
|
}
|
|
46799
46813
|
});
|
|
46800
46814
|
}
|