@workflow/world-testing 4.0.1-beta.5 → 4.0.1-beta.6
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 +1444 -1440
- 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 +807 -799
- package/dist/.well-known/workflow/v1/step.js.map +1 -1
- package/package.json +3 -3
|
@@ -5257,6 +5257,14 @@ __name(__builtin_response_text, "__builtin_response_text");
|
|
|
5257
5257
|
registerStepFunction("__builtin_response_array_buffer", __builtin_response_array_buffer);
|
|
5258
5258
|
registerStepFunction("__builtin_response_json", __builtin_response_json);
|
|
5259
5259
|
registerStepFunction("__builtin_response_text", __builtin_response_text);
|
|
5260
|
+
// workflows/noop.ts
|
|
5261
|
+
var count = 0;
|
|
5262
|
+
async function noop(_i) {
|
|
5263
|
+
count++;
|
|
5264
|
+
return count;
|
|
5265
|
+
}
|
|
5266
|
+
__name(noop, "noop");
|
|
5267
|
+
registerStepFunction("step//workflows/noop.ts//noop", noop);
|
|
5260
5268
|
// ../errors/dist/index.js
|
|
5261
5269
|
var import_ms = __toESM(require_ms(), 1);
|
|
5262
5270
|
var BASE_URL = "https://useworkflow.dev/err";
|
|
@@ -5912,509 +5920,50 @@ var config = once(() => {
|
|
|
5912
5920
|
});
|
|
5913
5921
|
// ../world-local/dist/queue.js
|
|
5914
5922
|
var import_promises = require("node:timers/promises");
|
|
5915
|
-
// ../../node_modules/.pnpm
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
return (haystack, start2 = 0) => Buffer.prototype.indexOf.call(haystack, needle, start2);
|
|
5928
|
-
}
|
|
5929
|
-
__name(createSearch, "createSearch");
|
|
5930
|
-
function createPartialTailSearch(pattern) {
|
|
5931
|
-
const needle = new TextEncoder().encode(pattern);
|
|
5932
|
-
const byteIndexes = {};
|
|
5933
|
-
for (let i = 0; i < needle.length; ++i) {
|
|
5934
|
-
const byte = needle[i];
|
|
5935
|
-
if (byteIndexes[byte] === void 0)
|
|
5936
|
-
byteIndexes[byte] = [];
|
|
5937
|
-
byteIndexes[byte].push(i);
|
|
5938
|
-
}
|
|
5939
|
-
return function (haystack) {
|
|
5940
|
-
const haystackEnd = haystack.length - 1;
|
|
5941
|
-
if (haystack[haystackEnd] in byteIndexes) {
|
|
5942
|
-
const indexes = byteIndexes[haystack[haystackEnd]];
|
|
5943
|
-
for (let i = indexes.length - 1; i >= 0; --i) {
|
|
5944
|
-
for (let j = indexes[i], k = haystackEnd; j >= 0 && haystack[k] === needle[j]; --j, --k) {
|
|
5945
|
-
if (j === 0)
|
|
5946
|
-
return k;
|
|
5947
|
-
}
|
|
5948
|
-
}
|
|
5949
|
-
}
|
|
5950
|
-
return -1;
|
|
5951
|
-
};
|
|
5952
|
-
}
|
|
5953
|
-
__name(createPartialTailSearch, "createPartialTailSearch");
|
|
5954
|
-
function parseHeaders(headerBytes) {
|
|
5955
|
-
const headerText = new TextDecoder("iso-8859-1").decode(headerBytes);
|
|
5956
|
-
const lines = headerText.trim().split(/\r?\n/);
|
|
5957
|
-
const headerInit = [];
|
|
5958
|
-
for (const line of lines) {
|
|
5959
|
-
const colonIndex = line.indexOf(":");
|
|
5960
|
-
if (colonIndex > 0) {
|
|
5961
|
-
const name = line.slice(0, colonIndex).trim();
|
|
5962
|
-
const value = line.slice(colonIndex + 1).trim();
|
|
5963
|
-
headerInit.push([
|
|
5964
|
-
name,
|
|
5965
|
-
value
|
|
5966
|
-
]);
|
|
5923
|
+
// ../../node_modules/.pnpm/@vercel+queue@0.0.0-alpha.23/node_modules/@vercel/queue/dist/index.mjs
|
|
5924
|
+
async function streamToBuffer(stream) {
|
|
5925
|
+
let totalLength = 0;
|
|
5926
|
+
const reader = stream.getReader();
|
|
5927
|
+
const chunks = [];
|
|
5928
|
+
try {
|
|
5929
|
+
while (true) {
|
|
5930
|
+
const { done, value } = await reader.read();
|
|
5931
|
+
if (done)
|
|
5932
|
+
break;
|
|
5933
|
+
chunks.push(value);
|
|
5934
|
+
totalLength += value.length;
|
|
5967
5935
|
}
|
|
5968
5936
|
}
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
__name(parseHeaders, "parseHeaders");
|
|
5972
|
-
function extractBoundary(contentType) {
|
|
5973
|
-
const boundaryMatch = contentType.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
5974
|
-
if (!boundaryMatch) {
|
|
5975
|
-
throw new MultipartParseError("No boundary found in Content-Type header");
|
|
5937
|
+
finally {
|
|
5938
|
+
reader.releaseLock();
|
|
5976
5939
|
}
|
|
5977
|
-
return
|
|
5940
|
+
return Buffer.concat(chunks, totalLength);
|
|
5978
5941
|
}
|
|
5979
|
-
__name(
|
|
5980
|
-
var
|
|
5942
|
+
__name(streamToBuffer, "streamToBuffer");
|
|
5943
|
+
var JsonTransport = class {
|
|
5981
5944
|
static {
|
|
5982
|
-
__name(this, "
|
|
5983
|
-
}
|
|
5984
|
-
queue = [];
|
|
5985
|
-
waiters = [];
|
|
5986
|
-
finished = false;
|
|
5987
|
-
cancelled = false;
|
|
5988
|
-
error = null;
|
|
5989
|
-
/**
|
|
5990
|
-
* Producer: Enqueue a message for consumption
|
|
5991
|
-
*/
|
|
5992
|
-
enqueue(message) {
|
|
5993
|
-
if (this.finished || this.cancelled)
|
|
5994
|
-
return;
|
|
5995
|
-
if (this.waiters.length > 0) {
|
|
5996
|
-
const waiter = this.waiters.shift();
|
|
5997
|
-
waiter.resolve(message);
|
|
5998
|
-
}
|
|
5999
|
-
else {
|
|
6000
|
-
this.queue.push(message);
|
|
6001
|
-
}
|
|
6002
|
-
}
|
|
6003
|
-
/**
|
|
6004
|
-
* Producer: Signal completion (with optional error)
|
|
6005
|
-
*/
|
|
6006
|
-
finish(error45) {
|
|
6007
|
-
if (this.finished)
|
|
6008
|
-
return;
|
|
6009
|
-
this.finished = true;
|
|
6010
|
-
this.error = error45 || null;
|
|
6011
|
-
while (this.waiters.length > 0) {
|
|
6012
|
-
const waiter = this.waiters.shift();
|
|
6013
|
-
if (error45) {
|
|
6014
|
-
waiter.reject(error45);
|
|
6015
|
-
}
|
|
6016
|
-
else {
|
|
6017
|
-
waiter.resolve(null);
|
|
6018
|
-
}
|
|
6019
|
-
}
|
|
5945
|
+
__name(this, "JsonTransport");
|
|
6020
5946
|
}
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
this.cancelled = true;
|
|
6028
|
-
while (this.waiters.length > 0) {
|
|
6029
|
-
const waiter = this.waiters.shift();
|
|
6030
|
-
waiter.resolve(null);
|
|
6031
|
-
}
|
|
5947
|
+
contentType = "application/json";
|
|
5948
|
+
replacer;
|
|
5949
|
+
reviver;
|
|
5950
|
+
constructor(options = {}) {
|
|
5951
|
+
this.replacer = options.replacer;
|
|
5952
|
+
this.reviver = options.reviver;
|
|
6032
5953
|
}
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
*/
|
|
6036
|
-
async dequeue() {
|
|
6037
|
-
if (this.queue.length > 0) {
|
|
6038
|
-
return this.queue.shift();
|
|
6039
|
-
}
|
|
6040
|
-
if (this.finished || this.cancelled) {
|
|
6041
|
-
if (this.error)
|
|
6042
|
-
throw this.error;
|
|
6043
|
-
return null;
|
|
6044
|
-
}
|
|
6045
|
-
return new Promise((resolve, reject) => {
|
|
6046
|
-
this.waiters.push({
|
|
6047
|
-
resolve,
|
|
6048
|
-
reject
|
|
6049
|
-
});
|
|
6050
|
-
});
|
|
5954
|
+
serialize(value) {
|
|
5955
|
+
return Buffer.from(JSON.stringify(value, this.replacer), "utf8");
|
|
6051
5956
|
}
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
get isTerminal() {
|
|
6056
|
-
return this.finished || this.cancelled;
|
|
5957
|
+
async deserialize(stream) {
|
|
5958
|
+
const buffer = await streamToBuffer(stream);
|
|
5959
|
+
return JSON.parse(buffer.toString("utf8"), this.reviver);
|
|
6057
5960
|
}
|
|
6058
5961
|
};
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
if (!contentType) {
|
|
6065
|
-
throw new MultipartParseError("Missing Content-Type header");
|
|
6066
|
-
}
|
|
6067
|
-
const boundary = extractBoundary(contentType);
|
|
6068
|
-
const parser = new StreamingMultipartParser(boundary, options);
|
|
6069
|
-
yield* parser.parseStream(response.body);
|
|
6070
|
-
}
|
|
6071
|
-
__name(parseMultipartStream, "parseMultipartStream");
|
|
6072
|
-
var StreamingMultipartParser = class {
|
|
6073
|
-
static {
|
|
6074
|
-
__name(this, "StreamingMultipartParser");
|
|
6075
|
-
}
|
|
6076
|
-
boundary;
|
|
6077
|
-
findOpeningBoundary;
|
|
6078
|
-
openingBoundaryLength;
|
|
6079
|
-
findBoundary;
|
|
6080
|
-
findPartialTailBoundary;
|
|
6081
|
-
boundaryLength;
|
|
6082
|
-
findDoubleNewline;
|
|
6083
|
-
// Safety limits
|
|
6084
|
-
maxHeaderSize;
|
|
6085
|
-
maxBoundaryBuffer;
|
|
6086
|
-
state = 0;
|
|
6087
|
-
buffer = null;
|
|
6088
|
-
currentHeaders = new Headers();
|
|
6089
|
-
currentPayloadController = null;
|
|
6090
|
-
constructor(boundary, options = {}) {
|
|
6091
|
-
this.boundary = boundary;
|
|
6092
|
-
this.findOpeningBoundary = createSearch(`--${boundary}`);
|
|
6093
|
-
this.openingBoundaryLength = 2 + boundary.length;
|
|
6094
|
-
this.findBoundary = createSearch(`\r
|
|
6095
|
-
--${boundary}`);
|
|
6096
|
-
this.findPartialTailBoundary = createPartialTailSearch(`\r
|
|
6097
|
-
--${boundary}`);
|
|
6098
|
-
this.boundaryLength = 4 + boundary.length;
|
|
6099
|
-
this.findDoubleNewline = createSearch("\r\n\r\n");
|
|
6100
|
-
this.maxHeaderSize = options.maxHeaderSize ?? 65536;
|
|
6101
|
-
this.maxBoundaryBuffer = options.maxBoundaryBuffer ?? 8192;
|
|
6102
|
-
}
|
|
6103
|
-
async *parseStream(stream) {
|
|
6104
|
-
const reader = stream.getReader();
|
|
6105
|
-
const messageQueue = new AsyncMessageQueue();
|
|
6106
|
-
const producer = this.startProducer(reader, messageQueue);
|
|
6107
|
-
try {
|
|
6108
|
-
yield* this.consumeMessages(messageQueue);
|
|
6109
|
-
}
|
|
6110
|
-
finally {
|
|
6111
|
-
messageQueue.cancel();
|
|
6112
|
-
this.closeCurrentPayload();
|
|
6113
|
-
try {
|
|
6114
|
-
await reader.cancel();
|
|
6115
|
-
}
|
|
6116
|
-
catch (error45) {
|
|
6117
|
-
}
|
|
6118
|
-
await producer;
|
|
6119
|
-
}
|
|
6120
|
-
}
|
|
6121
|
-
/**
|
|
6122
|
-
* Producer: Continuously read chunks and parse messages
|
|
6123
|
-
*/
|
|
6124
|
-
async startProducer(reader, messageQueue) {
|
|
6125
|
-
try {
|
|
6126
|
-
while (!messageQueue.isTerminal) {
|
|
6127
|
-
let result;
|
|
6128
|
-
try {
|
|
6129
|
-
result = await reader.read();
|
|
6130
|
-
}
|
|
6131
|
-
catch (readError) {
|
|
6132
|
-
if (readError instanceof Error && (readError.name === "AbortError" || readError.constructor.name === "AbortError" || readError.name === "TimeoutError" || readError.constructor.name === "TimeoutError")) {
|
|
6133
|
-
break;
|
|
6134
|
-
}
|
|
6135
|
-
throw readError;
|
|
6136
|
-
}
|
|
6137
|
-
const { done, value } = result;
|
|
6138
|
-
if (done) {
|
|
6139
|
-
if (this.buffer !== null && this.buffer.length > 0) {
|
|
6140
|
-
const messages2 = this.write(new Uint8Array(0));
|
|
6141
|
-
for (const message of messages2) {
|
|
6142
|
-
if (messageQueue.isTerminal)
|
|
6143
|
-
break;
|
|
6144
|
-
messageQueue.enqueue(message);
|
|
6145
|
-
}
|
|
6146
|
-
}
|
|
6147
|
-
if (this.state !== 4) {
|
|
6148
|
-
if (this.state === 0) {
|
|
6149
|
-
throw new MultipartParseError("Invalid multipart stream: missing initial boundary");
|
|
6150
|
-
}
|
|
6151
|
-
throw new MultipartParseError("Unexpected end of stream");
|
|
6152
|
-
}
|
|
6153
|
-
break;
|
|
6154
|
-
}
|
|
6155
|
-
if (!(value instanceof Uint8Array)) {
|
|
6156
|
-
throw new MultipartParseError(`Invalid chunk type: expected Uint8Array, got ${typeof value}`);
|
|
6157
|
-
}
|
|
6158
|
-
const messages = this.write(value);
|
|
6159
|
-
for (const message of messages) {
|
|
6160
|
-
if (messageQueue.isTerminal)
|
|
6161
|
-
break;
|
|
6162
|
-
messageQueue.enqueue(message);
|
|
6163
|
-
}
|
|
6164
|
-
}
|
|
6165
|
-
if (!messageQueue.isTerminal) {
|
|
6166
|
-
messageQueue.finish();
|
|
6167
|
-
}
|
|
6168
|
-
}
|
|
6169
|
-
catch (error45) {
|
|
6170
|
-
this.closeCurrentPayload(error45);
|
|
6171
|
-
if (!messageQueue.isTerminal) {
|
|
6172
|
-
messageQueue.finish(error45);
|
|
6173
|
-
}
|
|
6174
|
-
}
|
|
6175
|
-
finally {
|
|
6176
|
-
try {
|
|
6177
|
-
reader.releaseLock();
|
|
6178
|
-
}
|
|
6179
|
-
catch (error45) {
|
|
6180
|
-
}
|
|
6181
|
-
}
|
|
6182
|
-
}
|
|
6183
|
-
/**
|
|
6184
|
-
* Consumer: Yield messages from the queue
|
|
6185
|
-
*/
|
|
6186
|
-
async *consumeMessages(messageQueue) {
|
|
6187
|
-
while (true) {
|
|
6188
|
-
const message = await messageQueue.dequeue();
|
|
6189
|
-
if (message === null) {
|
|
6190
|
-
break;
|
|
6191
|
-
}
|
|
6192
|
-
yield message;
|
|
6193
|
-
}
|
|
6194
|
-
}
|
|
6195
|
-
/**
|
|
6196
|
-
* Process a chunk of data through the state machine and return any complete messages.
|
|
6197
|
-
*
|
|
6198
|
-
* Returns an array because a single chunk can contain multiple complete messages
|
|
6199
|
-
* when small messages with headers + body + boundary all fit in one network chunk.
|
|
6200
|
-
* All messages must be captured and queued to maintain proper message ordering.
|
|
6201
|
-
*/
|
|
6202
|
-
write(chunk) {
|
|
6203
|
-
const newMessages = [];
|
|
6204
|
-
if (this.state === 4) {
|
|
6205
|
-
throw new MultipartParseError("Unexpected data after end of stream");
|
|
6206
|
-
}
|
|
6207
|
-
let index = 0;
|
|
6208
|
-
let chunkLength = chunk.length;
|
|
6209
|
-
if (this.buffer !== null) {
|
|
6210
|
-
const newSize = this.buffer.length + chunkLength;
|
|
6211
|
-
const maxAllowedSize = this.state === 2 ? this.maxHeaderSize : this.maxBoundaryBuffer;
|
|
6212
|
-
if (newSize > maxAllowedSize) {
|
|
6213
|
-
throw new MultipartParseError(`Buffer size limit exceeded: ${newSize} bytes > ${maxAllowedSize} bytes. This may indicate malformed multipart data with ${this.state === 2 ? "oversized headers" : "invalid boundaries"}.`);
|
|
6214
|
-
}
|
|
6215
|
-
const newChunk = new Uint8Array(newSize);
|
|
6216
|
-
newChunk.set(this.buffer, 0);
|
|
6217
|
-
newChunk.set(chunk, this.buffer.length);
|
|
6218
|
-
chunk = newChunk;
|
|
6219
|
-
chunkLength = chunk.length;
|
|
6220
|
-
this.buffer = null;
|
|
6221
|
-
}
|
|
6222
|
-
if (chunkLength === 0 && this.state === 0) {
|
|
6223
|
-
throw new MultipartParseError("Invalid multipart stream: missing initial boundary");
|
|
6224
|
-
}
|
|
6225
|
-
while (true) {
|
|
6226
|
-
if (this.state === 3) {
|
|
6227
|
-
if (chunkLength - index < this.boundaryLength) {
|
|
6228
|
-
const remainingData = chunk.subarray(index);
|
|
6229
|
-
if (remainingData.length > this.maxBoundaryBuffer) {
|
|
6230
|
-
throw new MultipartParseError(`Boundary buffer limit exceeded: ${remainingData.length} > ${this.maxBoundaryBuffer}`);
|
|
6231
|
-
}
|
|
6232
|
-
this.buffer = remainingData;
|
|
6233
|
-
break;
|
|
6234
|
-
}
|
|
6235
|
-
const boundaryIndex = this.findBoundary(chunk, index);
|
|
6236
|
-
if (boundaryIndex === -1) {
|
|
6237
|
-
const partialTailIndex = this.findPartialTailBoundary(chunk);
|
|
6238
|
-
if (partialTailIndex === -1) {
|
|
6239
|
-
this.writeBody(index === 0 ? chunk : chunk.subarray(index));
|
|
6240
|
-
}
|
|
6241
|
-
else {
|
|
6242
|
-
this.writeBody(chunk.subarray(index, partialTailIndex));
|
|
6243
|
-
const partialBoundary = chunk.subarray(partialTailIndex);
|
|
6244
|
-
if (partialBoundary.length > this.maxBoundaryBuffer) {
|
|
6245
|
-
throw new MultipartParseError(`Partial boundary too large: ${partialBoundary.length} > ${this.maxBoundaryBuffer}`);
|
|
6246
|
-
}
|
|
6247
|
-
this.buffer = partialBoundary;
|
|
6248
|
-
}
|
|
6249
|
-
break;
|
|
6250
|
-
}
|
|
6251
|
-
this.writeBody(chunk.subarray(index, boundaryIndex));
|
|
6252
|
-
this.finishMessage();
|
|
6253
|
-
index = boundaryIndex + this.boundaryLength;
|
|
6254
|
-
this.state = 1;
|
|
6255
|
-
}
|
|
6256
|
-
if (this.state === 1) {
|
|
6257
|
-
if (chunkLength - index < 2) {
|
|
6258
|
-
const remainingData = chunk.subarray(index);
|
|
6259
|
-
if (remainingData.length > this.maxBoundaryBuffer) {
|
|
6260
|
-
throw new MultipartParseError(`After-boundary buffer limit exceeded: ${remainingData.length} > ${this.maxBoundaryBuffer}`);
|
|
6261
|
-
}
|
|
6262
|
-
this.buffer = remainingData;
|
|
6263
|
-
break;
|
|
6264
|
-
}
|
|
6265
|
-
if (chunk[index] === 45 && chunk[index + 1] === 45) {
|
|
6266
|
-
this.state = 4;
|
|
6267
|
-
break;
|
|
6268
|
-
}
|
|
6269
|
-
if (chunk[index] === 13 && chunk[index + 1] === 10) {
|
|
6270
|
-
index += 2;
|
|
6271
|
-
}
|
|
6272
|
-
else if (chunk[index] === 10) {
|
|
6273
|
-
index += 1;
|
|
6274
|
-
}
|
|
6275
|
-
else {
|
|
6276
|
-
throw new MultipartParseError(`Invalid character after boundary: expected CRLF or LF, got 0x${chunk[index].toString(16)}`);
|
|
6277
|
-
}
|
|
6278
|
-
this.state = 2;
|
|
6279
|
-
}
|
|
6280
|
-
if (this.state === 2) {
|
|
6281
|
-
if (chunkLength - index < 4) {
|
|
6282
|
-
const remainingData = chunk.subarray(index);
|
|
6283
|
-
if (remainingData.length > this.maxHeaderSize) {
|
|
6284
|
-
throw new MultipartParseError(`Header buffer limit exceeded: ${remainingData.length} > ${this.maxHeaderSize}`);
|
|
6285
|
-
}
|
|
6286
|
-
this.buffer = remainingData;
|
|
6287
|
-
break;
|
|
6288
|
-
}
|
|
6289
|
-
let headerEndIndex = this.findDoubleNewline(chunk, index);
|
|
6290
|
-
let headerEndOffset = 4;
|
|
6291
|
-
if (headerEndIndex === -1) {
|
|
6292
|
-
const lfDoubleNewline = createSearch("\n\n");
|
|
6293
|
-
headerEndIndex = lfDoubleNewline(chunk, index);
|
|
6294
|
-
headerEndOffset = 2;
|
|
6295
|
-
}
|
|
6296
|
-
if (headerEndIndex === -1) {
|
|
6297
|
-
const headerData = chunk.subarray(index);
|
|
6298
|
-
if (headerData.length > this.maxHeaderSize) {
|
|
6299
|
-
throw new MultipartParseError(`Headers too large: ${headerData.length} > ${this.maxHeaderSize} bytes`);
|
|
6300
|
-
}
|
|
6301
|
-
this.buffer = headerData;
|
|
6302
|
-
break;
|
|
6303
|
-
}
|
|
6304
|
-
const headerBytes = chunk.subarray(index, headerEndIndex);
|
|
6305
|
-
this.currentHeaders = parseHeaders(headerBytes);
|
|
6306
|
-
const message = this.createStreamingMessage();
|
|
6307
|
-
newMessages.push(message);
|
|
6308
|
-
index = headerEndIndex + headerEndOffset;
|
|
6309
|
-
this.state = 3;
|
|
6310
|
-
continue;
|
|
6311
|
-
}
|
|
6312
|
-
if (this.state === 0) {
|
|
6313
|
-
if (chunkLength < this.openingBoundaryLength) {
|
|
6314
|
-
if (chunk.length > this.maxBoundaryBuffer) {
|
|
6315
|
-
throw new MultipartParseError(`Initial chunk too large for boundary detection: ${chunk.length} > ${this.maxBoundaryBuffer}`);
|
|
6316
|
-
}
|
|
6317
|
-
this.buffer = chunk;
|
|
6318
|
-
break;
|
|
6319
|
-
}
|
|
6320
|
-
const boundaryIndex = this.findOpeningBoundary(chunk);
|
|
6321
|
-
if (boundaryIndex !== 0) {
|
|
6322
|
-
throw new MultipartParseError("Invalid multipart stream: missing initial boundary");
|
|
6323
|
-
}
|
|
6324
|
-
index = this.openingBoundaryLength;
|
|
6325
|
-
this.state = 1;
|
|
6326
|
-
}
|
|
6327
|
-
}
|
|
6328
|
-
return newMessages;
|
|
6329
|
-
}
|
|
6330
|
-
createStreamingMessage() {
|
|
6331
|
-
const headers = new Headers(this.currentHeaders);
|
|
6332
|
-
const payload = new ReadableStream({
|
|
6333
|
-
start: /* @__PURE__ */ __name((controller) => {
|
|
6334
|
-
this.currentPayloadController = controller;
|
|
6335
|
-
}, "start")
|
|
6336
|
-
});
|
|
6337
|
-
this.currentHeaders = new Headers();
|
|
6338
|
-
return {
|
|
6339
|
-
headers,
|
|
6340
|
-
payload
|
|
6341
|
-
};
|
|
6342
|
-
}
|
|
6343
|
-
writeBody(chunk) {
|
|
6344
|
-
if (this.currentPayloadController) {
|
|
6345
|
-
this.currentPayloadController.enqueue(chunk);
|
|
6346
|
-
}
|
|
6347
|
-
}
|
|
6348
|
-
finishMessage() {
|
|
6349
|
-
if (this.currentPayloadController) {
|
|
6350
|
-
this.currentPayloadController.close();
|
|
6351
|
-
this.currentPayloadController = null;
|
|
6352
|
-
}
|
|
6353
|
-
}
|
|
6354
|
-
/**
|
|
6355
|
-
* Close current payload controller if open (used during cleanup)
|
|
6356
|
-
* If an error is provided, forwards it to the payload consumer
|
|
6357
|
-
*/
|
|
6358
|
-
closeCurrentPayload(error45) {
|
|
6359
|
-
if (this.currentPayloadController) {
|
|
6360
|
-
try {
|
|
6361
|
-
if (error45) {
|
|
6362
|
-
this.currentPayloadController.error(error45);
|
|
6363
|
-
}
|
|
6364
|
-
else {
|
|
6365
|
-
this.currentPayloadController.close();
|
|
6366
|
-
}
|
|
6367
|
-
}
|
|
6368
|
-
catch (controllerError) {
|
|
6369
|
-
}
|
|
6370
|
-
this.currentPayloadController = null;
|
|
6371
|
-
}
|
|
6372
|
-
}
|
|
6373
|
-
};
|
|
6374
|
-
// ../../node_modules/.pnpm/@vercel+queue@0.0.0-alpha.23/node_modules/@vercel/queue/dist/index.mjs
|
|
6375
|
-
async function streamToBuffer(stream) {
|
|
6376
|
-
let totalLength = 0;
|
|
6377
|
-
const reader = stream.getReader();
|
|
6378
|
-
const chunks = [];
|
|
6379
|
-
try {
|
|
6380
|
-
while (true) {
|
|
6381
|
-
const { done, value } = await reader.read();
|
|
6382
|
-
if (done)
|
|
6383
|
-
break;
|
|
6384
|
-
chunks.push(value);
|
|
6385
|
-
totalLength += value.length;
|
|
6386
|
-
}
|
|
6387
|
-
}
|
|
6388
|
-
finally {
|
|
6389
|
-
reader.releaseLock();
|
|
6390
|
-
}
|
|
6391
|
-
return Buffer.concat(chunks, totalLength);
|
|
6392
|
-
}
|
|
6393
|
-
__name(streamToBuffer, "streamToBuffer");
|
|
6394
|
-
var JsonTransport = class {
|
|
6395
|
-
static {
|
|
6396
|
-
__name(this, "JsonTransport");
|
|
6397
|
-
}
|
|
6398
|
-
contentType = "application/json";
|
|
6399
|
-
replacer;
|
|
6400
|
-
reviver;
|
|
6401
|
-
constructor(options = {}) {
|
|
6402
|
-
this.replacer = options.replacer;
|
|
6403
|
-
this.reviver = options.reviver;
|
|
6404
|
-
}
|
|
6405
|
-
serialize(value) {
|
|
6406
|
-
return Buffer.from(JSON.stringify(value, this.replacer), "utf8");
|
|
6407
|
-
}
|
|
6408
|
-
async deserialize(stream) {
|
|
6409
|
-
const buffer = await streamToBuffer(stream);
|
|
6410
|
-
return JSON.parse(buffer.toString("utf8"), this.reviver);
|
|
6411
|
-
}
|
|
6412
|
-
};
|
|
6413
|
-
var devRouteHandlers = /* @__PURE__ */ new Map();
|
|
6414
|
-
var wildcardRouteHandlers = /* @__PURE__ */ new Map();
|
|
6415
|
-
function clearDevHandlers() {
|
|
6416
|
-
devRouteHandlers.clear();
|
|
6417
|
-
wildcardRouteHandlers.clear();
|
|
5962
|
+
var devRouteHandlers = /* @__PURE__ */ new Map();
|
|
5963
|
+
var wildcardRouteHandlers = /* @__PURE__ */ new Map();
|
|
5964
|
+
function clearDevHandlers() {
|
|
5965
|
+
devRouteHandlers.clear();
|
|
5966
|
+
wildcardRouteHandlers.clear();
|
|
6418
5967
|
}
|
|
6419
5968
|
__name(clearDevHandlers, "clearDevHandlers");
|
|
6420
5969
|
if (process.env.NODE_ENV === "test" || process.env.VITEST) {
|
|
@@ -21256,220 +20805,679 @@ function createStorage(basedir) {
|
|
|
21256
20805
|
})
|
|
21257
20806
|
};
|
|
21258
20807
|
}
|
|
21259
|
-
return result;
|
|
20808
|
+
return result;
|
|
20809
|
+
}
|
|
20810
|
+
},
|
|
20811
|
+
// Hooks
|
|
20812
|
+
hooks: {
|
|
20813
|
+
async create(runId, data) {
|
|
20814
|
+
const now = /* @__PURE__ */ new Date();
|
|
20815
|
+
const result = {
|
|
20816
|
+
runId,
|
|
20817
|
+
hookId: data.hookId,
|
|
20818
|
+
token: data.token,
|
|
20819
|
+
metadata: data.metadata,
|
|
20820
|
+
ownerId: "embedded-owner",
|
|
20821
|
+
projectId: "embedded-project",
|
|
20822
|
+
environment: "embedded",
|
|
20823
|
+
createdAt: now
|
|
20824
|
+
};
|
|
20825
|
+
const hookPath = import_node_path2.default.join(basedir, "hooks", `${data.hookId}.json`);
|
|
20826
|
+
await writeJSON(hookPath, result);
|
|
20827
|
+
return result;
|
|
20828
|
+
},
|
|
20829
|
+
async get(hookId, params) {
|
|
20830
|
+
const hookPath = import_node_path2.default.join(basedir, "hooks", `${hookId}.json`);
|
|
20831
|
+
const hook = await readJSON(hookPath, HookSchema);
|
|
20832
|
+
if (!hook) {
|
|
20833
|
+
throw new Error(`Hook ${hookId} not found`);
|
|
20834
|
+
}
|
|
20835
|
+
const resolveData = params?.resolveData || DEFAULT_RESOLVE_DATA_OPTION;
|
|
20836
|
+
return filterHookData(hook, resolveData);
|
|
20837
|
+
},
|
|
20838
|
+
async getByToken(token) {
|
|
20839
|
+
const hooksDir = import_node_path2.default.join(basedir, "hooks");
|
|
20840
|
+
const files = await listJSONFiles(hooksDir);
|
|
20841
|
+
for (const file2 of files) {
|
|
20842
|
+
const hookPath = import_node_path2.default.join(hooksDir, `${file2}.json`);
|
|
20843
|
+
const hook = await readJSON(hookPath, HookSchema);
|
|
20844
|
+
if (hook && hook.token === token) {
|
|
20845
|
+
return hook;
|
|
20846
|
+
}
|
|
20847
|
+
}
|
|
20848
|
+
throw new Error(`Hook with token ${token} not found`);
|
|
20849
|
+
},
|
|
20850
|
+
async list(params) {
|
|
20851
|
+
const hooksDir = import_node_path2.default.join(basedir, "hooks");
|
|
20852
|
+
const resolveData = params.resolveData || DEFAULT_RESOLVE_DATA_OPTION;
|
|
20853
|
+
const result = await paginatedFileSystemQuery({
|
|
20854
|
+
directory: hooksDir,
|
|
20855
|
+
schema: HookSchema,
|
|
20856
|
+
sortOrder: params.pagination?.sortOrder,
|
|
20857
|
+
limit: params.pagination?.limit,
|
|
20858
|
+
cursor: params.pagination?.cursor,
|
|
20859
|
+
filePrefix: void 0,
|
|
20860
|
+
filter: /* @__PURE__ */ __name((hook) => {
|
|
20861
|
+
if (params.runId && hook.runId !== params.runId) {
|
|
20862
|
+
return false;
|
|
20863
|
+
}
|
|
20864
|
+
return true;
|
|
20865
|
+
}, "filter"),
|
|
20866
|
+
getCreatedAt: /* @__PURE__ */ __name(() => {
|
|
20867
|
+
return /* @__PURE__ */ new Date(0);
|
|
20868
|
+
}, "getCreatedAt"),
|
|
20869
|
+
getId: /* @__PURE__ */ __name((hook) => hook.hookId, "getId")
|
|
20870
|
+
});
|
|
20871
|
+
return {
|
|
20872
|
+
...result,
|
|
20873
|
+
data: result.data.map((hook) => filterHookData(hook, resolveData))
|
|
20874
|
+
};
|
|
20875
|
+
},
|
|
20876
|
+
async dispose(hookId) {
|
|
20877
|
+
const hookPath = import_node_path2.default.join(basedir, "hooks", `${hookId}.json`);
|
|
20878
|
+
const hook = await readJSON(hookPath, HookSchema);
|
|
20879
|
+
if (!hook) {
|
|
20880
|
+
throw new Error(`Hook ${hookId} not found`);
|
|
20881
|
+
}
|
|
20882
|
+
await deleteJSON(hookPath);
|
|
20883
|
+
return hook;
|
|
20884
|
+
}
|
|
20885
|
+
}
|
|
20886
|
+
};
|
|
20887
|
+
}
|
|
20888
|
+
__name(createStorage, "createStorage");
|
|
20889
|
+
// ../world-local/dist/streamer.js
|
|
20890
|
+
var import_node_events = require("node:events");
|
|
20891
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
20892
|
+
var monotonicUlid2 = monotonicFactory(() => Math.random());
|
|
20893
|
+
function serializeChunk(chunk) {
|
|
20894
|
+
const eofByte = Buffer.from([
|
|
20895
|
+
chunk.eof ? 1 : 0
|
|
20896
|
+
]);
|
|
20897
|
+
return Buffer.concat([
|
|
20898
|
+
eofByte,
|
|
20899
|
+
chunk.chunk
|
|
20900
|
+
]);
|
|
20901
|
+
}
|
|
20902
|
+
__name(serializeChunk, "serializeChunk");
|
|
20903
|
+
function deserializeChunk(serialized) {
|
|
20904
|
+
const eof = serialized[0] === 1;
|
|
20905
|
+
const chunk = serialized.subarray(1);
|
|
20906
|
+
return {
|
|
20907
|
+
eof,
|
|
20908
|
+
chunk
|
|
20909
|
+
};
|
|
20910
|
+
}
|
|
20911
|
+
__name(deserializeChunk, "deserializeChunk");
|
|
20912
|
+
function createStreamer(basedir) {
|
|
20913
|
+
const streamEmitter = new import_node_events.EventEmitter();
|
|
20914
|
+
return {
|
|
20915
|
+
async writeToStream(name, chunk) {
|
|
20916
|
+
const chunkId = `strm_${monotonicUlid2()}`;
|
|
20917
|
+
if (typeof chunk === "string") {
|
|
20918
|
+
chunk = new TextEncoder().encode(chunk);
|
|
20919
|
+
}
|
|
20920
|
+
const serialized = serializeChunk({
|
|
20921
|
+
chunk: Buffer.from(chunk),
|
|
20922
|
+
eof: false
|
|
20923
|
+
});
|
|
20924
|
+
const chunkPath = import_node_path3.default.join(basedir, "streams", "chunks", `${name}-${chunkId}.json`);
|
|
20925
|
+
await write(chunkPath, serialized);
|
|
20926
|
+
const chunkData = typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk instanceof Buffer ? new Uint8Array(chunk) : chunk;
|
|
20927
|
+
streamEmitter.emit(`chunk:${name}`, {
|
|
20928
|
+
streamName: name,
|
|
20929
|
+
chunkData,
|
|
20930
|
+
chunkId
|
|
20931
|
+
});
|
|
20932
|
+
},
|
|
20933
|
+
async closeStream(name) {
|
|
20934
|
+
const chunkId = `strm_${monotonicUlid2()}`;
|
|
20935
|
+
const chunkPath = import_node_path3.default.join(basedir, "streams", "chunks", `${name}-${chunkId}.json`);
|
|
20936
|
+
await write(chunkPath, serializeChunk({
|
|
20937
|
+
chunk: Buffer.from([]),
|
|
20938
|
+
eof: true
|
|
20939
|
+
}));
|
|
20940
|
+
streamEmitter.emit(`close:${name}`, {
|
|
20941
|
+
streamName: name
|
|
20942
|
+
});
|
|
20943
|
+
},
|
|
20944
|
+
async readFromStream(name, startIndex = 0) {
|
|
20945
|
+
const chunksDir = import_node_path3.default.join(basedir, "streams", "chunks");
|
|
20946
|
+
let removeListeners = /* @__PURE__ */ __name(() => {
|
|
20947
|
+
}, "removeListeners");
|
|
20948
|
+
return new ReadableStream({
|
|
20949
|
+
async start(controller) {
|
|
20950
|
+
const deliveredChunkIds = /* @__PURE__ */ new Set();
|
|
20951
|
+
const bufferedEventChunks = [];
|
|
20952
|
+
let isReadingFromDisk = true;
|
|
20953
|
+
const chunkListener = /* @__PURE__ */ __name((event) => {
|
|
20954
|
+
deliveredChunkIds.add(event.chunkId);
|
|
20955
|
+
if (isReadingFromDisk) {
|
|
20956
|
+
bufferedEventChunks.push({
|
|
20957
|
+
chunkId: event.chunkId,
|
|
20958
|
+
chunkData: event.chunkData
|
|
20959
|
+
});
|
|
20960
|
+
}
|
|
20961
|
+
else {
|
|
20962
|
+
controller.enqueue(event.chunkData);
|
|
20963
|
+
}
|
|
20964
|
+
}, "chunkListener");
|
|
20965
|
+
const closeListener = /* @__PURE__ */ __name(() => {
|
|
20966
|
+
streamEmitter.off(`chunk:${name}`, chunkListener);
|
|
20967
|
+
streamEmitter.off(`close:${name}`, closeListener);
|
|
20968
|
+
controller.close();
|
|
20969
|
+
}, "closeListener");
|
|
20970
|
+
removeListeners = closeListener;
|
|
20971
|
+
streamEmitter.on(`chunk:${name}`, chunkListener);
|
|
20972
|
+
streamEmitter.on(`close:${name}`, closeListener);
|
|
20973
|
+
const files = await listJSONFiles(chunksDir);
|
|
20974
|
+
const chunkFiles = files.filter((file2) => file2.startsWith(`${name}-`)).sort();
|
|
20975
|
+
let isComplete = false;
|
|
20976
|
+
for (let i = startIndex; i < chunkFiles.length; i++) {
|
|
20977
|
+
const file2 = chunkFiles[i];
|
|
20978
|
+
const chunkId = file2.substring(name.length + 1);
|
|
20979
|
+
if (deliveredChunkIds.has(chunkId)) {
|
|
20980
|
+
continue;
|
|
20981
|
+
}
|
|
20982
|
+
const chunk = deserializeChunk(await readBuffer(import_node_path3.default.join(chunksDir, `${file2}.json`)));
|
|
20983
|
+
if (chunk?.eof === true) {
|
|
20984
|
+
isComplete = true;
|
|
20985
|
+
break;
|
|
20986
|
+
}
|
|
20987
|
+
if (chunk.chunk.byteLength) {
|
|
20988
|
+
controller.enqueue(chunk.chunk);
|
|
20989
|
+
}
|
|
20990
|
+
}
|
|
20991
|
+
isReadingFromDisk = false;
|
|
20992
|
+
bufferedEventChunks.sort((a, b) => a.chunkId.localeCompare(b.chunkId));
|
|
20993
|
+
for (const buffered of bufferedEventChunks) {
|
|
20994
|
+
controller.enqueue(buffered.chunkData);
|
|
20995
|
+
}
|
|
20996
|
+
if (isComplete) {
|
|
20997
|
+
removeListeners();
|
|
20998
|
+
controller.close();
|
|
20999
|
+
return;
|
|
21000
|
+
}
|
|
21001
|
+
},
|
|
21002
|
+
cancel() {
|
|
21003
|
+
removeListeners();
|
|
21004
|
+
}
|
|
21005
|
+
});
|
|
21006
|
+
}
|
|
21007
|
+
};
|
|
21008
|
+
}
|
|
21009
|
+
__name(createStreamer, "createStreamer");
|
|
21010
|
+
// ../world-local/dist/index.js
|
|
21011
|
+
function createEmbeddedWorld({ dataDir, port }) {
|
|
21012
|
+
const dir = dataDir ?? config.value.dataDir;
|
|
21013
|
+
const queuePort = port ?? config.value.port;
|
|
21014
|
+
return {
|
|
21015
|
+
...createQueue(queuePort),
|
|
21016
|
+
...createStorage(dir),
|
|
21017
|
+
...createStreamer(dir)
|
|
21018
|
+
};
|
|
21019
|
+
}
|
|
21020
|
+
__name(createEmbeddedWorld, "createEmbeddedWorld");
|
|
21021
|
+
// ../../node_modules/.pnpm/mixpart@0.0.5-alpha.1/node_modules/mixpart/dist/index.mjs
|
|
21022
|
+
var MultipartParseError = class extends Error {
|
|
21023
|
+
static {
|
|
21024
|
+
__name(this, "MultipartParseError");
|
|
21025
|
+
}
|
|
21026
|
+
constructor(message) {
|
|
21027
|
+
super(message);
|
|
21028
|
+
this.name = "MultipartParseError";
|
|
21029
|
+
}
|
|
21030
|
+
};
|
|
21031
|
+
function createSearch(pattern) {
|
|
21032
|
+
const needle = new TextEncoder().encode(pattern);
|
|
21033
|
+
return (haystack, start2 = 0) => Buffer.prototype.indexOf.call(haystack, needle, start2);
|
|
21034
|
+
}
|
|
21035
|
+
__name(createSearch, "createSearch");
|
|
21036
|
+
function createPartialTailSearch(pattern) {
|
|
21037
|
+
const needle = new TextEncoder().encode(pattern);
|
|
21038
|
+
const byteIndexes = {};
|
|
21039
|
+
for (let i = 0; i < needle.length; ++i) {
|
|
21040
|
+
const byte = needle[i];
|
|
21041
|
+
if (byteIndexes[byte] === void 0)
|
|
21042
|
+
byteIndexes[byte] = [];
|
|
21043
|
+
byteIndexes[byte].push(i);
|
|
21044
|
+
}
|
|
21045
|
+
return function (haystack) {
|
|
21046
|
+
const haystackEnd = haystack.length - 1;
|
|
21047
|
+
if (haystack[haystackEnd] in byteIndexes) {
|
|
21048
|
+
const indexes = byteIndexes[haystack[haystackEnd]];
|
|
21049
|
+
for (let i = indexes.length - 1; i >= 0; --i) {
|
|
21050
|
+
for (let j = indexes[i], k = haystackEnd; j >= 0 && haystack[k] === needle[j]; --j, --k) {
|
|
21051
|
+
if (j === 0)
|
|
21052
|
+
return k;
|
|
21053
|
+
}
|
|
21260
21054
|
}
|
|
21261
|
-
}
|
|
21262
|
-
|
|
21263
|
-
|
|
21264
|
-
|
|
21265
|
-
|
|
21266
|
-
|
|
21267
|
-
|
|
21268
|
-
|
|
21269
|
-
|
|
21270
|
-
|
|
21271
|
-
|
|
21272
|
-
|
|
21273
|
-
|
|
21274
|
-
|
|
21275
|
-
|
|
21276
|
-
|
|
21277
|
-
|
|
21278
|
-
|
|
21279
|
-
|
|
21280
|
-
|
|
21281
|
-
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
21055
|
+
}
|
|
21056
|
+
return -1;
|
|
21057
|
+
};
|
|
21058
|
+
}
|
|
21059
|
+
__name(createPartialTailSearch, "createPartialTailSearch");
|
|
21060
|
+
function parseHeaders(headerBytes) {
|
|
21061
|
+
const headerText = new TextDecoder("iso-8859-1").decode(headerBytes);
|
|
21062
|
+
const lines = headerText.trim().split(/\r?\n/);
|
|
21063
|
+
const headerInit = [];
|
|
21064
|
+
for (const line of lines) {
|
|
21065
|
+
const colonIndex = line.indexOf(":");
|
|
21066
|
+
if (colonIndex > 0) {
|
|
21067
|
+
const name = line.slice(0, colonIndex).trim();
|
|
21068
|
+
const value = line.slice(colonIndex + 1).trim();
|
|
21069
|
+
headerInit.push([
|
|
21070
|
+
name,
|
|
21071
|
+
value
|
|
21072
|
+
]);
|
|
21073
|
+
}
|
|
21074
|
+
}
|
|
21075
|
+
return new Headers(headerInit);
|
|
21076
|
+
}
|
|
21077
|
+
__name(parseHeaders, "parseHeaders");
|
|
21078
|
+
function extractBoundary(contentType) {
|
|
21079
|
+
const boundaryMatch = contentType.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
21080
|
+
if (!boundaryMatch) {
|
|
21081
|
+
throw new MultipartParseError("No boundary found in Content-Type header");
|
|
21082
|
+
}
|
|
21083
|
+
return boundaryMatch[1] ?? boundaryMatch[2];
|
|
21084
|
+
}
|
|
21085
|
+
__name(extractBoundary, "extractBoundary");
|
|
21086
|
+
var AsyncMessageQueue = class {
|
|
21087
|
+
static {
|
|
21088
|
+
__name(this, "AsyncMessageQueue");
|
|
21089
|
+
}
|
|
21090
|
+
queue = [];
|
|
21091
|
+
waiters = [];
|
|
21092
|
+
finished = false;
|
|
21093
|
+
cancelled = false;
|
|
21094
|
+
error = null;
|
|
21095
|
+
/**
|
|
21096
|
+
* Producer: Enqueue a message for consumption
|
|
21097
|
+
*/
|
|
21098
|
+
enqueue(message) {
|
|
21099
|
+
if (this.finished || this.cancelled)
|
|
21100
|
+
return;
|
|
21101
|
+
if (this.waiters.length > 0) {
|
|
21102
|
+
const waiter = this.waiters.shift();
|
|
21103
|
+
waiter.resolve(message);
|
|
21104
|
+
}
|
|
21105
|
+
else {
|
|
21106
|
+
this.queue.push(message);
|
|
21107
|
+
}
|
|
21108
|
+
}
|
|
21109
|
+
/**
|
|
21110
|
+
* Producer: Signal completion (with optional error)
|
|
21111
|
+
*/
|
|
21112
|
+
finish(error45) {
|
|
21113
|
+
if (this.finished)
|
|
21114
|
+
return;
|
|
21115
|
+
this.finished = true;
|
|
21116
|
+
this.error = error45 || null;
|
|
21117
|
+
while (this.waiters.length > 0) {
|
|
21118
|
+
const waiter = this.waiters.shift();
|
|
21119
|
+
if (error45) {
|
|
21120
|
+
waiter.reject(error45);
|
|
21121
|
+
}
|
|
21122
|
+
else {
|
|
21123
|
+
waiter.resolve(null);
|
|
21124
|
+
}
|
|
21125
|
+
}
|
|
21126
|
+
}
|
|
21127
|
+
/**
|
|
21128
|
+
* Consumer: Cancel the queue (stops accepting new messages and notifies waiters)
|
|
21129
|
+
*/
|
|
21130
|
+
cancel() {
|
|
21131
|
+
if (this.cancelled || this.finished)
|
|
21132
|
+
return;
|
|
21133
|
+
this.cancelled = true;
|
|
21134
|
+
while (this.waiters.length > 0) {
|
|
21135
|
+
const waiter = this.waiters.shift();
|
|
21136
|
+
waiter.resolve(null);
|
|
21137
|
+
}
|
|
21138
|
+
}
|
|
21139
|
+
/**
|
|
21140
|
+
* Consumer: Dequeue next message (or null if finished/cancelled)
|
|
21141
|
+
*/
|
|
21142
|
+
async dequeue() {
|
|
21143
|
+
if (this.queue.length > 0) {
|
|
21144
|
+
return this.queue.shift();
|
|
21145
|
+
}
|
|
21146
|
+
if (this.finished || this.cancelled) {
|
|
21147
|
+
if (this.error)
|
|
21148
|
+
throw this.error;
|
|
21149
|
+
return null;
|
|
21150
|
+
}
|
|
21151
|
+
return new Promise((resolve, reject) => {
|
|
21152
|
+
this.waiters.push({
|
|
21153
|
+
resolve,
|
|
21154
|
+
reject
|
|
21155
|
+
});
|
|
21156
|
+
});
|
|
21157
|
+
}
|
|
21158
|
+
/**
|
|
21159
|
+
* Check if the queue is in a terminal state
|
|
21160
|
+
*/
|
|
21161
|
+
get isTerminal() {
|
|
21162
|
+
return this.finished || this.cancelled;
|
|
21163
|
+
}
|
|
21164
|
+
};
|
|
21165
|
+
async function* parseMultipartStream2(response, options) {
|
|
21166
|
+
if (!response.body) {
|
|
21167
|
+
throw new MultipartParseError("Response body is null");
|
|
21168
|
+
}
|
|
21169
|
+
const contentType = response.headers.get("content-type");
|
|
21170
|
+
if (!contentType) {
|
|
21171
|
+
throw new MultipartParseError("Missing Content-Type header");
|
|
21172
|
+
}
|
|
21173
|
+
const boundary = extractBoundary(contentType);
|
|
21174
|
+
const parser = new StreamingMultipartParser(boundary, options);
|
|
21175
|
+
yield* parser.parseStream(response.body);
|
|
21176
|
+
}
|
|
21177
|
+
__name(parseMultipartStream2, "parseMultipartStream");
|
|
21178
|
+
var StreamingMultipartParser = class {
|
|
21179
|
+
static {
|
|
21180
|
+
__name(this, "StreamingMultipartParser");
|
|
21181
|
+
}
|
|
21182
|
+
boundary;
|
|
21183
|
+
findOpeningBoundary;
|
|
21184
|
+
openingBoundaryLength;
|
|
21185
|
+
findBoundary;
|
|
21186
|
+
findPartialTailBoundary;
|
|
21187
|
+
boundaryLength;
|
|
21188
|
+
findDoubleNewline;
|
|
21189
|
+
// Safety limits
|
|
21190
|
+
maxHeaderSize;
|
|
21191
|
+
maxBoundaryBuffer;
|
|
21192
|
+
state = 0;
|
|
21193
|
+
buffer = null;
|
|
21194
|
+
currentHeaders = new Headers();
|
|
21195
|
+
currentPayloadController = null;
|
|
21196
|
+
constructor(boundary, options = {}) {
|
|
21197
|
+
this.boundary = boundary;
|
|
21198
|
+
this.findOpeningBoundary = createSearch(`--${boundary}`);
|
|
21199
|
+
this.openingBoundaryLength = 2 + boundary.length;
|
|
21200
|
+
this.findBoundary = createSearch(`\r
|
|
21201
|
+
--${boundary}`);
|
|
21202
|
+
this.findPartialTailBoundary = createPartialTailSearch(`\r
|
|
21203
|
+
--${boundary}`);
|
|
21204
|
+
this.boundaryLength = 4 + boundary.length;
|
|
21205
|
+
this.findDoubleNewline = createSearch("\r\n\r\n");
|
|
21206
|
+
this.maxHeaderSize = options.maxHeaderSize ?? 65536;
|
|
21207
|
+
this.maxBoundaryBuffer = options.maxBoundaryBuffer ?? 8192;
|
|
21208
|
+
}
|
|
21209
|
+
async *parseStream(stream) {
|
|
21210
|
+
const reader = stream.getReader();
|
|
21211
|
+
const messageQueue = new AsyncMessageQueue();
|
|
21212
|
+
const producer = this.startProducer(reader, messageQueue);
|
|
21213
|
+
try {
|
|
21214
|
+
yield* this.consumeMessages(messageQueue);
|
|
21215
|
+
}
|
|
21216
|
+
finally {
|
|
21217
|
+
messageQueue.cancel();
|
|
21218
|
+
this.closeCurrentPayload();
|
|
21219
|
+
try {
|
|
21220
|
+
await reader.cancel();
|
|
21221
|
+
}
|
|
21222
|
+
catch (error45) {
|
|
21223
|
+
}
|
|
21224
|
+
await producer;
|
|
21225
|
+
}
|
|
21226
|
+
}
|
|
21227
|
+
/**
|
|
21228
|
+
* Producer: Continuously read chunks and parse messages
|
|
21229
|
+
*/
|
|
21230
|
+
async startProducer(reader, messageQueue) {
|
|
21231
|
+
try {
|
|
21232
|
+
while (!messageQueue.isTerminal) {
|
|
21233
|
+
let result;
|
|
21234
|
+
try {
|
|
21235
|
+
result = await reader.read();
|
|
21285
21236
|
}
|
|
21286
|
-
|
|
21287
|
-
|
|
21288
|
-
|
|
21289
|
-
async getByToken(token) {
|
|
21290
|
-
const hooksDir = import_node_path2.default.join(basedir, "hooks");
|
|
21291
|
-
const files = await listJSONFiles(hooksDir);
|
|
21292
|
-
for (const file2 of files) {
|
|
21293
|
-
const hookPath = import_node_path2.default.join(hooksDir, `${file2}.json`);
|
|
21294
|
-
const hook = await readJSON(hookPath, HookSchema);
|
|
21295
|
-
if (hook && hook.token === token) {
|
|
21296
|
-
return hook;
|
|
21237
|
+
catch (readError) {
|
|
21238
|
+
if (readError instanceof Error && (readError.name === "AbortError" || readError.constructor.name === "AbortError" || readError.name === "TimeoutError" || readError.constructor.name === "TimeoutError")) {
|
|
21239
|
+
break;
|
|
21297
21240
|
}
|
|
21241
|
+
throw readError;
|
|
21298
21242
|
}
|
|
21299
|
-
|
|
21300
|
-
|
|
21301
|
-
|
|
21302
|
-
|
|
21303
|
-
|
|
21304
|
-
|
|
21305
|
-
|
|
21306
|
-
|
|
21307
|
-
sortOrder: params.pagination?.sortOrder,
|
|
21308
|
-
limit: params.pagination?.limit,
|
|
21309
|
-
cursor: params.pagination?.cursor,
|
|
21310
|
-
filePrefix: void 0,
|
|
21311
|
-
filter: /* @__PURE__ */ __name((hook) => {
|
|
21312
|
-
if (params.runId && hook.runId !== params.runId) {
|
|
21313
|
-
return false;
|
|
21243
|
+
const { done, value } = result;
|
|
21244
|
+
if (done) {
|
|
21245
|
+
if (this.buffer !== null && this.buffer.length > 0) {
|
|
21246
|
+
const messages2 = this.write(new Uint8Array(0));
|
|
21247
|
+
for (const message of messages2) {
|
|
21248
|
+
if (messageQueue.isTerminal)
|
|
21249
|
+
break;
|
|
21250
|
+
messageQueue.enqueue(message);
|
|
21314
21251
|
}
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
|
|
21322
|
-
|
|
21323
|
-
...result,
|
|
21324
|
-
data: result.data.map((hook) => filterHookData(hook, resolveData))
|
|
21325
|
-
};
|
|
21326
|
-
},
|
|
21327
|
-
async dispose(hookId) {
|
|
21328
|
-
const hookPath = import_node_path2.default.join(basedir, "hooks", `${hookId}.json`);
|
|
21329
|
-
const hook = await readJSON(hookPath, HookSchema);
|
|
21330
|
-
if (!hook) {
|
|
21331
|
-
throw new Error(`Hook ${hookId} not found`);
|
|
21252
|
+
}
|
|
21253
|
+
if (this.state !== 4) {
|
|
21254
|
+
if (this.state === 0) {
|
|
21255
|
+
throw new MultipartParseError("Invalid multipart stream: missing initial boundary");
|
|
21256
|
+
}
|
|
21257
|
+
throw new MultipartParseError("Unexpected end of stream");
|
|
21258
|
+
}
|
|
21259
|
+
break;
|
|
21332
21260
|
}
|
|
21333
|
-
|
|
21334
|
-
|
|
21261
|
+
if (!(value instanceof Uint8Array)) {
|
|
21262
|
+
throw new MultipartParseError(`Invalid chunk type: expected Uint8Array, got ${typeof value}`);
|
|
21263
|
+
}
|
|
21264
|
+
const messages = this.write(value);
|
|
21265
|
+
for (const message of messages) {
|
|
21266
|
+
if (messageQueue.isTerminal)
|
|
21267
|
+
break;
|
|
21268
|
+
messageQueue.enqueue(message);
|
|
21269
|
+
}
|
|
21270
|
+
}
|
|
21271
|
+
if (!messageQueue.isTerminal) {
|
|
21272
|
+
messageQueue.finish();
|
|
21335
21273
|
}
|
|
21336
21274
|
}
|
|
21337
|
-
|
|
21338
|
-
|
|
21339
|
-
|
|
21340
|
-
|
|
21341
|
-
var import_node_events = require("node:events");
|
|
21342
|
-
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
21343
|
-
var monotonicUlid2 = monotonicFactory(() => Math.random());
|
|
21344
|
-
function serializeChunk(chunk) {
|
|
21345
|
-
const eofByte = Buffer.from([
|
|
21346
|
-
chunk.eof ? 1 : 0
|
|
21347
|
-
]);
|
|
21348
|
-
return Buffer.concat([
|
|
21349
|
-
eofByte,
|
|
21350
|
-
chunk.chunk
|
|
21351
|
-
]);
|
|
21352
|
-
}
|
|
21353
|
-
__name(serializeChunk, "serializeChunk");
|
|
21354
|
-
function deserializeChunk(serialized) {
|
|
21355
|
-
const eof = serialized[0] === 1;
|
|
21356
|
-
const chunk = serialized.subarray(1);
|
|
21357
|
-
return {
|
|
21358
|
-
eof,
|
|
21359
|
-
chunk
|
|
21360
|
-
};
|
|
21361
|
-
}
|
|
21362
|
-
__name(deserializeChunk, "deserializeChunk");
|
|
21363
|
-
function createStreamer(basedir) {
|
|
21364
|
-
const streamEmitter = new import_node_events.EventEmitter();
|
|
21365
|
-
return {
|
|
21366
|
-
async writeToStream(name, chunk) {
|
|
21367
|
-
const chunkId = `strm_${monotonicUlid2()}`;
|
|
21368
|
-
if (typeof chunk === "string") {
|
|
21369
|
-
chunk = new TextEncoder().encode(chunk);
|
|
21275
|
+
catch (error45) {
|
|
21276
|
+
this.closeCurrentPayload(error45);
|
|
21277
|
+
if (!messageQueue.isTerminal) {
|
|
21278
|
+
messageQueue.finish(error45);
|
|
21370
21279
|
}
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21384
|
-
|
|
21385
|
-
const
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21405
|
-
|
|
21406
|
-
|
|
21407
|
-
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
|
|
21411
|
-
|
|
21412
|
-
|
|
21413
|
-
|
|
21414
|
-
|
|
21415
|
-
|
|
21416
|
-
|
|
21417
|
-
|
|
21418
|
-
|
|
21419
|
-
|
|
21420
|
-
|
|
21421
|
-
|
|
21422
|
-
|
|
21423
|
-
|
|
21424
|
-
|
|
21425
|
-
const
|
|
21426
|
-
|
|
21427
|
-
|
|
21428
|
-
|
|
21429
|
-
|
|
21430
|
-
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
|
|
21434
|
-
|
|
21435
|
-
|
|
21436
|
-
|
|
21437
|
-
|
|
21438
|
-
|
|
21439
|
-
|
|
21280
|
+
}
|
|
21281
|
+
finally {
|
|
21282
|
+
try {
|
|
21283
|
+
reader.releaseLock();
|
|
21284
|
+
}
|
|
21285
|
+
catch (error45) {
|
|
21286
|
+
}
|
|
21287
|
+
}
|
|
21288
|
+
}
|
|
21289
|
+
/**
|
|
21290
|
+
* Consumer: Yield messages from the queue
|
|
21291
|
+
*/
|
|
21292
|
+
async *consumeMessages(messageQueue) {
|
|
21293
|
+
while (true) {
|
|
21294
|
+
const message = await messageQueue.dequeue();
|
|
21295
|
+
if (message === null) {
|
|
21296
|
+
break;
|
|
21297
|
+
}
|
|
21298
|
+
yield message;
|
|
21299
|
+
}
|
|
21300
|
+
}
|
|
21301
|
+
/**
|
|
21302
|
+
* Process a chunk of data through the state machine and return any complete messages.
|
|
21303
|
+
*
|
|
21304
|
+
* Returns an array because a single chunk can contain multiple complete messages
|
|
21305
|
+
* when small messages with headers + body + boundary all fit in one network chunk.
|
|
21306
|
+
* All messages must be captured and queued to maintain proper message ordering.
|
|
21307
|
+
*/
|
|
21308
|
+
write(chunk) {
|
|
21309
|
+
const newMessages = [];
|
|
21310
|
+
if (this.state === 4) {
|
|
21311
|
+
throw new MultipartParseError("Unexpected data after end of stream");
|
|
21312
|
+
}
|
|
21313
|
+
let index = 0;
|
|
21314
|
+
let chunkLength = chunk.length;
|
|
21315
|
+
if (this.buffer !== null) {
|
|
21316
|
+
const newSize = this.buffer.length + chunkLength;
|
|
21317
|
+
const maxAllowedSize = this.state === 2 ? this.maxHeaderSize : this.maxBoundaryBuffer;
|
|
21318
|
+
if (newSize > maxAllowedSize) {
|
|
21319
|
+
throw new MultipartParseError(`Buffer size limit exceeded: ${newSize} bytes > ${maxAllowedSize} bytes. This may indicate malformed multipart data with ${this.state === 2 ? "oversized headers" : "invalid boundaries"}.`);
|
|
21320
|
+
}
|
|
21321
|
+
const newChunk = new Uint8Array(newSize);
|
|
21322
|
+
newChunk.set(this.buffer, 0);
|
|
21323
|
+
newChunk.set(chunk, this.buffer.length);
|
|
21324
|
+
chunk = newChunk;
|
|
21325
|
+
chunkLength = chunk.length;
|
|
21326
|
+
this.buffer = null;
|
|
21327
|
+
}
|
|
21328
|
+
if (chunkLength === 0 && this.state === 0) {
|
|
21329
|
+
throw new MultipartParseError("Invalid multipart stream: missing initial boundary");
|
|
21330
|
+
}
|
|
21331
|
+
while (true) {
|
|
21332
|
+
if (this.state === 3) {
|
|
21333
|
+
if (chunkLength - index < this.boundaryLength) {
|
|
21334
|
+
const remainingData = chunk.subarray(index);
|
|
21335
|
+
if (remainingData.length > this.maxBoundaryBuffer) {
|
|
21336
|
+
throw new MultipartParseError(`Boundary buffer limit exceeded: ${remainingData.length} > ${this.maxBoundaryBuffer}`);
|
|
21337
|
+
}
|
|
21338
|
+
this.buffer = remainingData;
|
|
21339
|
+
break;
|
|
21340
|
+
}
|
|
21341
|
+
const boundaryIndex = this.findBoundary(chunk, index);
|
|
21342
|
+
if (boundaryIndex === -1) {
|
|
21343
|
+
const partialTailIndex = this.findPartialTailBoundary(chunk);
|
|
21344
|
+
if (partialTailIndex === -1) {
|
|
21345
|
+
this.writeBody(index === 0 ? chunk : chunk.subarray(index));
|
|
21346
|
+
}
|
|
21347
|
+
else {
|
|
21348
|
+
this.writeBody(chunk.subarray(index, partialTailIndex));
|
|
21349
|
+
const partialBoundary = chunk.subarray(partialTailIndex);
|
|
21350
|
+
if (partialBoundary.length > this.maxBoundaryBuffer) {
|
|
21351
|
+
throw new MultipartParseError(`Partial boundary too large: ${partialBoundary.length} > ${this.maxBoundaryBuffer}`);
|
|
21440
21352
|
}
|
|
21353
|
+
this.buffer = partialBoundary;
|
|
21354
|
+
}
|
|
21355
|
+
break;
|
|
21356
|
+
}
|
|
21357
|
+
this.writeBody(chunk.subarray(index, boundaryIndex));
|
|
21358
|
+
this.finishMessage();
|
|
21359
|
+
index = boundaryIndex + this.boundaryLength;
|
|
21360
|
+
this.state = 1;
|
|
21361
|
+
}
|
|
21362
|
+
if (this.state === 1) {
|
|
21363
|
+
if (chunkLength - index < 2) {
|
|
21364
|
+
const remainingData = chunk.subarray(index);
|
|
21365
|
+
if (remainingData.length > this.maxBoundaryBuffer) {
|
|
21366
|
+
throw new MultipartParseError(`After-boundary buffer limit exceeded: ${remainingData.length} > ${this.maxBoundaryBuffer}`);
|
|
21441
21367
|
}
|
|
21442
|
-
|
|
21443
|
-
|
|
21444
|
-
|
|
21445
|
-
|
|
21368
|
+
this.buffer = remainingData;
|
|
21369
|
+
break;
|
|
21370
|
+
}
|
|
21371
|
+
if (chunk[index] === 45 && chunk[index + 1] === 45) {
|
|
21372
|
+
this.state = 4;
|
|
21373
|
+
break;
|
|
21374
|
+
}
|
|
21375
|
+
if (chunk[index] === 13 && chunk[index + 1] === 10) {
|
|
21376
|
+
index += 2;
|
|
21377
|
+
}
|
|
21378
|
+
else if (chunk[index] === 10) {
|
|
21379
|
+
index += 1;
|
|
21380
|
+
}
|
|
21381
|
+
else {
|
|
21382
|
+
throw new MultipartParseError(`Invalid character after boundary: expected CRLF or LF, got 0x${chunk[index].toString(16)}`);
|
|
21383
|
+
}
|
|
21384
|
+
this.state = 2;
|
|
21385
|
+
}
|
|
21386
|
+
if (this.state === 2) {
|
|
21387
|
+
if (chunkLength - index < 4) {
|
|
21388
|
+
const remainingData = chunk.subarray(index);
|
|
21389
|
+
if (remainingData.length > this.maxHeaderSize) {
|
|
21390
|
+
throw new MultipartParseError(`Header buffer limit exceeded: ${remainingData.length} > ${this.maxHeaderSize}`);
|
|
21446
21391
|
}
|
|
21447
|
-
|
|
21448
|
-
|
|
21449
|
-
|
|
21450
|
-
|
|
21392
|
+
this.buffer = remainingData;
|
|
21393
|
+
break;
|
|
21394
|
+
}
|
|
21395
|
+
let headerEndIndex = this.findDoubleNewline(chunk, index);
|
|
21396
|
+
let headerEndOffset = 4;
|
|
21397
|
+
if (headerEndIndex === -1) {
|
|
21398
|
+
const lfDoubleNewline = createSearch("\n\n");
|
|
21399
|
+
headerEndIndex = lfDoubleNewline(chunk, index);
|
|
21400
|
+
headerEndOffset = 2;
|
|
21401
|
+
}
|
|
21402
|
+
if (headerEndIndex === -1) {
|
|
21403
|
+
const headerData = chunk.subarray(index);
|
|
21404
|
+
if (headerData.length > this.maxHeaderSize) {
|
|
21405
|
+
throw new MultipartParseError(`Headers too large: ${headerData.length} > ${this.maxHeaderSize} bytes`);
|
|
21451
21406
|
}
|
|
21452
|
-
|
|
21453
|
-
|
|
21454
|
-
removeListeners();
|
|
21407
|
+
this.buffer = headerData;
|
|
21408
|
+
break;
|
|
21455
21409
|
}
|
|
21456
|
-
|
|
21410
|
+
const headerBytes = chunk.subarray(index, headerEndIndex);
|
|
21411
|
+
this.currentHeaders = parseHeaders(headerBytes);
|
|
21412
|
+
const message = this.createStreamingMessage();
|
|
21413
|
+
newMessages.push(message);
|
|
21414
|
+
index = headerEndIndex + headerEndOffset;
|
|
21415
|
+
this.state = 3;
|
|
21416
|
+
continue;
|
|
21417
|
+
}
|
|
21418
|
+
if (this.state === 0) {
|
|
21419
|
+
if (chunkLength < this.openingBoundaryLength) {
|
|
21420
|
+
if (chunk.length > this.maxBoundaryBuffer) {
|
|
21421
|
+
throw new MultipartParseError(`Initial chunk too large for boundary detection: ${chunk.length} > ${this.maxBoundaryBuffer}`);
|
|
21422
|
+
}
|
|
21423
|
+
this.buffer = chunk;
|
|
21424
|
+
break;
|
|
21425
|
+
}
|
|
21426
|
+
const boundaryIndex = this.findOpeningBoundary(chunk);
|
|
21427
|
+
if (boundaryIndex !== 0) {
|
|
21428
|
+
throw new MultipartParseError("Invalid multipart stream: missing initial boundary");
|
|
21429
|
+
}
|
|
21430
|
+
index = this.openingBoundaryLength;
|
|
21431
|
+
this.state = 1;
|
|
21432
|
+
}
|
|
21457
21433
|
}
|
|
21458
|
-
|
|
21459
|
-
}
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21434
|
+
return newMessages;
|
|
21435
|
+
}
|
|
21436
|
+
createStreamingMessage() {
|
|
21437
|
+
const headers = new Headers(this.currentHeaders);
|
|
21438
|
+
const payload = new ReadableStream({
|
|
21439
|
+
start: /* @__PURE__ */ __name((controller) => {
|
|
21440
|
+
this.currentPayloadController = controller;
|
|
21441
|
+
}, "start")
|
|
21442
|
+
});
|
|
21443
|
+
this.currentHeaders = new Headers();
|
|
21444
|
+
return {
|
|
21445
|
+
headers,
|
|
21446
|
+
payload
|
|
21447
|
+
};
|
|
21448
|
+
}
|
|
21449
|
+
writeBody(chunk) {
|
|
21450
|
+
if (this.currentPayloadController) {
|
|
21451
|
+
this.currentPayloadController.enqueue(chunk);
|
|
21452
|
+
}
|
|
21453
|
+
}
|
|
21454
|
+
finishMessage() {
|
|
21455
|
+
if (this.currentPayloadController) {
|
|
21456
|
+
this.currentPayloadController.close();
|
|
21457
|
+
this.currentPayloadController = null;
|
|
21458
|
+
}
|
|
21459
|
+
}
|
|
21460
|
+
/**
|
|
21461
|
+
* Close current payload controller if open (used during cleanup)
|
|
21462
|
+
* If an error is provided, forwards it to the payload consumer
|
|
21463
|
+
*/
|
|
21464
|
+
closeCurrentPayload(error45) {
|
|
21465
|
+
if (this.currentPayloadController) {
|
|
21466
|
+
try {
|
|
21467
|
+
if (error45) {
|
|
21468
|
+
this.currentPayloadController.error(error45);
|
|
21469
|
+
}
|
|
21470
|
+
else {
|
|
21471
|
+
this.currentPayloadController.close();
|
|
21472
|
+
}
|
|
21473
|
+
}
|
|
21474
|
+
catch (controllerError) {
|
|
21475
|
+
}
|
|
21476
|
+
this.currentPayloadController = null;
|
|
21477
|
+
}
|
|
21478
|
+
}
|
|
21479
|
+
};
|
|
21480
|
+
// ../../node_modules/.pnpm/@vercel+queue@0.0.0-alpha.28/node_modules/@vercel/queue/dist/index.mjs
|
|
21473
21481
|
var import_oidc = __toESM(require_dist(), 1);
|
|
21474
21482
|
async function streamToBuffer2(stream) {
|
|
21475
21483
|
let totalLength = 0;
|
|
@@ -21644,15 +21652,22 @@ var QueueClient = class {
|
|
|
21644
21652
|
}
|
|
21645
21653
|
baseUrl;
|
|
21646
21654
|
basePath;
|
|
21655
|
+
customHeaders = {};
|
|
21647
21656
|
token;
|
|
21648
21657
|
/**
|
|
21649
21658
|
* Create a new Vercel Queue Service client
|
|
21650
21659
|
* @param options Client configuration options
|
|
21651
21660
|
*/
|
|
21652
21661
|
constructor(options = {}) {
|
|
21653
|
-
this.baseUrl = options.baseUrl || "https://vercel-queue.com";
|
|
21654
|
-
this.basePath = options.basePath || "/api/v2/messages";
|
|
21655
|
-
this.token = options.token;
|
|
21662
|
+
this.baseUrl = options.baseUrl || process.env.VERCEL_QUEUE_BASE_URL || "https://vercel-queue.com";
|
|
21663
|
+
this.basePath = options.basePath || process.env.VERCEL_QUEUE_BASE_PATH || "/api/v2/messages";
|
|
21664
|
+
this.token = options.token || process.env.VERCEL_QUEUE_TOKEN;
|
|
21665
|
+
const VERCEL_QUEUE_HEADER_PREFIX = "VERCEL_QUEUE_HEADER_";
|
|
21666
|
+
this.customHeaders = Object.fromEntries(Object.entries(process.env).filter(([key]) => key.startsWith(VERCEL_QUEUE_HEADER_PREFIX)).map(([key, value]) => [
|
|
21667
|
+
// This allows headers to use dashes independent of shell used
|
|
21668
|
+
key.replace(VERCEL_QUEUE_HEADER_PREFIX, "").replaceAll("__", "-"),
|
|
21669
|
+
value || ""
|
|
21670
|
+
]));
|
|
21656
21671
|
}
|
|
21657
21672
|
async getToken() {
|
|
21658
21673
|
if (this.token) {
|
|
@@ -21679,7 +21694,8 @@ var QueueClient = class {
|
|
|
21679
21694
|
const headers = new Headers({
|
|
21680
21695
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
21681
21696
|
"Vqs-Queue-Name": queueName,
|
|
21682
|
-
"Content-Type": transport.contentType
|
|
21697
|
+
"Content-Type": transport.contentType,
|
|
21698
|
+
...this.customHeaders
|
|
21683
21699
|
});
|
|
21684
21700
|
const deploymentId = options.deploymentId || process.env.VERCEL_DEPLOYMENT_ID;
|
|
21685
21701
|
if (deploymentId) {
|
|
@@ -21694,8 +21710,8 @@ var QueueClient = class {
|
|
|
21694
21710
|
const body = transport.serialize(payload);
|
|
21695
21711
|
const response = await fetch(`${this.baseUrl}${this.basePath}`, {
|
|
21696
21712
|
method: "POST",
|
|
21697
|
-
|
|
21698
|
-
|
|
21713
|
+
body,
|
|
21714
|
+
headers
|
|
21699
21715
|
});
|
|
21700
21716
|
if (!response.ok) {
|
|
21701
21717
|
if (response.status === 400) {
|
|
@@ -21741,7 +21757,8 @@ var QueueClient = class {
|
|
|
21741
21757
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
21742
21758
|
"Vqs-Queue-Name": queueName,
|
|
21743
21759
|
"Vqs-Consumer-Group": consumerGroup,
|
|
21744
|
-
Accept: "multipart/mixed"
|
|
21760
|
+
Accept: "multipart/mixed",
|
|
21761
|
+
...this.customHeaders
|
|
21745
21762
|
});
|
|
21746
21763
|
if (visibilityTimeoutSeconds !== void 0) {
|
|
21747
21764
|
headers.set("Vqs-Visibility-Timeout", visibilityTimeoutSeconds.toString());
|
|
@@ -21781,7 +21798,7 @@ var QueueClient = class {
|
|
|
21781
21798
|
}
|
|
21782
21799
|
throw new Error(`Failed to receive messages: ${response.status} ${response.statusText}`);
|
|
21783
21800
|
}
|
|
21784
|
-
for await (const multipartMessage of
|
|
21801
|
+
for await (const multipartMessage of parseMultipartStream2(response)) {
|
|
21785
21802
|
try {
|
|
21786
21803
|
const parsedHeaders = parseQueueHeaders(multipartMessage.headers);
|
|
21787
21804
|
if (!parsedHeaders) {
|
|
@@ -21808,7 +21825,8 @@ var QueueClient = class {
|
|
|
21808
21825
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
21809
21826
|
"Vqs-Queue-Name": queueName,
|
|
21810
21827
|
"Vqs-Consumer-Group": consumerGroup,
|
|
21811
|
-
Accept: "multipart/mixed"
|
|
21828
|
+
Accept: "multipart/mixed",
|
|
21829
|
+
...this.customHeaders
|
|
21812
21830
|
});
|
|
21813
21831
|
if (visibilityTimeoutSeconds !== void 0) {
|
|
21814
21832
|
headers.set("Vqs-Visibility-Timeout", visibilityTimeoutSeconds.toString());
|
|
@@ -21868,7 +21886,7 @@ var QueueClient = class {
|
|
|
21868
21886
|
throw new Error("Transport is required when skipPayload is not true");
|
|
21869
21887
|
}
|
|
21870
21888
|
try {
|
|
21871
|
-
for await (const multipartMessage of
|
|
21889
|
+
for await (const multipartMessage of parseMultipartStream2(response)) {
|
|
21872
21890
|
try {
|
|
21873
21891
|
const parsedHeaders = parseQueueHeaders(multipartMessage.headers);
|
|
21874
21892
|
if (!parsedHeaders) {
|
|
@@ -21919,7 +21937,8 @@ var QueueClient = class {
|
|
|
21919
21937
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
21920
21938
|
"Vqs-Queue-Name": queueName,
|
|
21921
21939
|
"Vqs-Consumer-Group": consumerGroup,
|
|
21922
|
-
"Vqs-Ticket": ticket
|
|
21940
|
+
"Vqs-Ticket": ticket,
|
|
21941
|
+
...this.customHeaders
|
|
21923
21942
|
})
|
|
21924
21943
|
});
|
|
21925
21944
|
if (!response.ok) {
|
|
@@ -21967,7 +21986,8 @@ var QueueClient = class {
|
|
|
21967
21986
|
"Vqs-Queue-Name": queueName,
|
|
21968
21987
|
"Vqs-Consumer-Group": consumerGroup,
|
|
21969
21988
|
"Vqs-Ticket": ticket,
|
|
21970
|
-
"Vqs-Visibility-Timeout": visibilityTimeoutSeconds.toString()
|
|
21989
|
+
"Vqs-Visibility-Timeout": visibilityTimeoutSeconds.toString(),
|
|
21990
|
+
...this.customHeaders
|
|
21971
21991
|
})
|
|
21972
21992
|
});
|
|
21973
21993
|
if (!response.ok) {
|
|
@@ -22130,7 +22150,6 @@ function handleCallback(handlers) {
|
|
|
22130
22150
|
__name(handleCallback, "handleCallback");
|
|
22131
22151
|
var devRouteHandlers2 = /* @__PURE__ */ new Map();
|
|
22132
22152
|
var wildcardRouteHandlers2 = /* @__PURE__ */ new Map();
|
|
22133
|
-
var routeHandlerKeys = /* @__PURE__ */ new WeakMap();
|
|
22134
22153
|
function cleanupDeadRefs(key, refs) {
|
|
22135
22154
|
const aliveRefs = refs.filter((ref) => ref.deref() !== void 0);
|
|
22136
22155
|
if (aliveRefs.length === 0) {
|
|
@@ -22146,45 +22165,14 @@ function isDevMode() {
|
|
|
22146
22165
|
}
|
|
22147
22166
|
__name(isDevMode, "isDevMode");
|
|
22148
22167
|
function registerDevRouteHandler(routeHandler, handlers) {
|
|
22149
|
-
const existingKeys = routeHandlerKeys.get(routeHandler);
|
|
22150
|
-
if (existingKeys) {
|
|
22151
|
-
const newKeys = /* @__PURE__ */ new Set();
|
|
22152
|
-
for (const topicName in handlers) {
|
|
22153
|
-
for (const consumerGroup in handlers[topicName]) {
|
|
22154
|
-
newKeys.add(`${topicName}:${consumerGroup}`);
|
|
22155
|
-
}
|
|
22156
|
-
}
|
|
22157
|
-
for (const key of existingKeys) {
|
|
22158
|
-
if (!newKeys.has(key)) {
|
|
22159
|
-
const [topicPattern] = key.split(":");
|
|
22160
|
-
if (topicPattern.includes("*")) {
|
|
22161
|
-
const refs = wildcardRouteHandlers2.get(key);
|
|
22162
|
-
if (refs) {
|
|
22163
|
-
const filteredRefs = refs.filter((ref) => ref.deref() !== routeHandler);
|
|
22164
|
-
if (filteredRefs.length === 0) {
|
|
22165
|
-
wildcardRouteHandlers2.delete(key);
|
|
22166
|
-
}
|
|
22167
|
-
else {
|
|
22168
|
-
wildcardRouteHandlers2.set(key, filteredRefs);
|
|
22169
|
-
}
|
|
22170
|
-
}
|
|
22171
|
-
}
|
|
22172
|
-
else {
|
|
22173
|
-
devRouteHandlers2.delete(key);
|
|
22174
|
-
}
|
|
22175
|
-
}
|
|
22176
|
-
}
|
|
22177
|
-
}
|
|
22178
|
-
const keys = /* @__PURE__ */ new Set();
|
|
22179
22168
|
for (const topicName in handlers) {
|
|
22180
22169
|
for (const consumerGroup in handlers[topicName]) {
|
|
22181
22170
|
const key = `${topicName}:${consumerGroup}`;
|
|
22182
|
-
keys.add(key);
|
|
22183
22171
|
if (topicName.includes("*")) {
|
|
22184
|
-
const weakRef = new WeakRef(routeHandler);
|
|
22185
22172
|
const existing = wildcardRouteHandlers2.get(key) || [];
|
|
22186
22173
|
cleanupDeadRefs(key, existing);
|
|
22187
22174
|
const cleanedRefs = wildcardRouteHandlers2.get(key) || [];
|
|
22175
|
+
const weakRef = new WeakRef(routeHandler);
|
|
22188
22176
|
cleanedRefs.push(weakRef);
|
|
22189
22177
|
wildcardRouteHandlers2.set(key, cleanedRefs);
|
|
22190
22178
|
}
|
|
@@ -22196,7 +22184,6 @@ function registerDevRouteHandler(routeHandler, handlers) {
|
|
|
22196
22184
|
}
|
|
22197
22185
|
}
|
|
22198
22186
|
}
|
|
22199
|
-
routeHandlerKeys.set(routeHandler, keys);
|
|
22200
22187
|
}
|
|
22201
22188
|
__name(registerDevRouteHandler, "registerDevRouteHandler");
|
|
22202
22189
|
function findRouteHandlersForTopic(topicName) {
|
|
@@ -22590,51 +22577,6 @@ async function send(topicName, payload, options) {
|
|
|
22590
22577
|
};
|
|
22591
22578
|
}
|
|
22592
22579
|
__name(send, "send");
|
|
22593
|
-
// ../world-vercel/dist/queue.js
|
|
22594
|
-
var MessageWrapper = object({
|
|
22595
|
-
payload: QueuePayloadSchema,
|
|
22596
|
-
queueName: ValidQueueName
|
|
22597
|
-
});
|
|
22598
|
-
function createQueue2() {
|
|
22599
|
-
const queue = /* @__PURE__ */ __name(async (queueName, x, opts) => {
|
|
22600
|
-
const encoded = MessageWrapper.encode({
|
|
22601
|
-
payload: x,
|
|
22602
|
-
queueName
|
|
22603
|
-
});
|
|
22604
|
-
const sanitizedQueueName = queueName.replace(/[^A-Za-z0-9-_]/g, "-");
|
|
22605
|
-
const { messageId } = await send(sanitizedQueueName, encoded, opts);
|
|
22606
|
-
return {
|
|
22607
|
-
messageId: MessageId.parse(messageId)
|
|
22608
|
-
};
|
|
22609
|
-
}, "queue");
|
|
22610
|
-
const createQueueHandler = /* @__PURE__ */ __name((prefix, handler) => {
|
|
22611
|
-
return handleCallback({
|
|
22612
|
-
[`${prefix}*`]: {
|
|
22613
|
-
default: /* @__PURE__ */ __name((body, meta) => {
|
|
22614
|
-
const { payload, queueName } = MessageWrapper.parse(body);
|
|
22615
|
-
return handler(payload, {
|
|
22616
|
-
queueName,
|
|
22617
|
-
messageId: MessageId.parse(meta.messageId),
|
|
22618
|
-
attempt: meta.deliveryCount
|
|
22619
|
-
});
|
|
22620
|
-
}, "default")
|
|
22621
|
-
}
|
|
22622
|
-
});
|
|
22623
|
-
}, "createQueueHandler");
|
|
22624
|
-
const getDeploymentId = /* @__PURE__ */ __name(async () => {
|
|
22625
|
-
const deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
22626
|
-
if (!deploymentId) {
|
|
22627
|
-
throw new Error("VERCEL_DEPLOYMENT_ID environment variable is not set");
|
|
22628
|
-
}
|
|
22629
|
-
return deploymentId;
|
|
22630
|
-
}, "getDeploymentId");
|
|
22631
|
-
return {
|
|
22632
|
-
queue,
|
|
22633
|
-
createQueueHandler,
|
|
22634
|
-
getDeploymentId
|
|
22635
|
-
};
|
|
22636
|
-
}
|
|
22637
|
-
__name(createQueue2, "createQueue");
|
|
22638
22580
|
// ../world-vercel/dist/utils.js
|
|
22639
22581
|
var import_oidc2 = __toESM(require_dist(), 1);
|
|
22640
22582
|
var DEFAULT_RESOLVE_DATA_OPTION2 = "all";
|
|
@@ -22645,7 +22587,18 @@ function dateToStringReplacer(_key, value) {
|
|
|
22645
22587
|
return value;
|
|
22646
22588
|
}
|
|
22647
22589
|
__name(dateToStringReplacer, "dateToStringReplacer");
|
|
22648
|
-
|
|
22590
|
+
var getHttpUrl = /* @__PURE__ */ __name((config3) => {
|
|
22591
|
+
const projectConfig = config3?.projectConfig;
|
|
22592
|
+
const defaultUrl = "https://vercel-workflow.com/api";
|
|
22593
|
+
const defaultProxyUrl = "https://api.vercel.com/v1/workflow";
|
|
22594
|
+
const usingProxy = Boolean(config3?.baseUrl || projectConfig?.projectId && projectConfig?.teamId);
|
|
22595
|
+
const baseUrl = config3?.baseUrl || (usingProxy ? defaultProxyUrl : defaultUrl);
|
|
22596
|
+
return {
|
|
22597
|
+
baseUrl,
|
|
22598
|
+
usingProxy
|
|
22599
|
+
};
|
|
22600
|
+
}, "getHttpUrl");
|
|
22601
|
+
var getHeaders = /* @__PURE__ */ __name((config3) => {
|
|
22649
22602
|
const projectConfig = config3?.projectConfig;
|
|
22650
22603
|
const headers = new Headers(config3?.headers);
|
|
22651
22604
|
if (projectConfig) {
|
|
@@ -22657,18 +22610,19 @@ async function getHttpConfig(config3) {
|
|
|
22657
22610
|
headers.set("x-vercel-team-id", projectConfig.teamId);
|
|
22658
22611
|
}
|
|
22659
22612
|
}
|
|
22613
|
+
return headers;
|
|
22614
|
+
}, "getHeaders");
|
|
22615
|
+
async function getHttpConfig(config3) {
|
|
22616
|
+
const headers = getHeaders(config3);
|
|
22660
22617
|
const token = config3?.token ?? await (0, import_oidc2.getVercelOidcToken)();
|
|
22661
22618
|
if (token) {
|
|
22662
22619
|
headers.set("Authorization", `Bearer ${token}`);
|
|
22663
22620
|
}
|
|
22664
|
-
|
|
22665
|
-
if (!baseUrl) {
|
|
22666
|
-
const shouldUseProxy = projectConfig?.projectId && projectConfig?.teamId;
|
|
22667
|
-
baseUrl = shouldUseProxy ? `https://api.vercel.com/v1/workflow` : "https://vercel-workflow.com/api";
|
|
22668
|
-
}
|
|
22621
|
+
const { baseUrl, usingProxy } = getHttpUrl(config3);
|
|
22669
22622
|
return {
|
|
22670
22623
|
baseUrl,
|
|
22671
|
-
headers
|
|
22624
|
+
headers,
|
|
22625
|
+
usingProxy
|
|
22672
22626
|
};
|
|
22673
22627
|
}
|
|
22674
22628
|
__name(getHttpConfig, "getHttpConfig");
|
|
@@ -22711,6 +22665,66 @@ curl -X ${options.method} ${stringifiedHeaders} "${url2}"`);
|
|
|
22711
22665
|
}
|
|
22712
22666
|
}
|
|
22713
22667
|
__name(makeRequest, "makeRequest");
|
|
22668
|
+
// ../world-vercel/dist/queue.js
|
|
22669
|
+
var MessageWrapper = object({
|
|
22670
|
+
payload: QueuePayloadSchema,
|
|
22671
|
+
queueName: ValidQueueName
|
|
22672
|
+
});
|
|
22673
|
+
function createQueue2(config3) {
|
|
22674
|
+
const { baseUrl, usingProxy } = getHttpUrl(config3);
|
|
22675
|
+
const headers = getHeaders(config3);
|
|
22676
|
+
if (usingProxy) {
|
|
22677
|
+
process.env.VERCEL_QUEUE_BASE_URL = `${baseUrl}`;
|
|
22678
|
+
process.env.VERCEL_QUEUE_BASE_PATH = "/queues/v2/messages";
|
|
22679
|
+
if (config3?.token) {
|
|
22680
|
+
process.env.VERCEL_QUEUE_TOKEN = config3.token;
|
|
22681
|
+
}
|
|
22682
|
+
if (headers) {
|
|
22683
|
+
headers.forEach((value, key) => {
|
|
22684
|
+
const sanitizedKey = key.replaceAll("-", "__");
|
|
22685
|
+
process.env[`VERCEL_QUEUE_HEADER_${sanitizedKey}`] = value;
|
|
22686
|
+
});
|
|
22687
|
+
}
|
|
22688
|
+
}
|
|
22689
|
+
const queue = /* @__PURE__ */ __name(async (queueName, x, opts) => {
|
|
22690
|
+
const encoded = MessageWrapper.encode({
|
|
22691
|
+
payload: x,
|
|
22692
|
+
queueName
|
|
22693
|
+
});
|
|
22694
|
+
const sanitizedQueueName = queueName.replace(/[^A-Za-z0-9-_]/g, "-");
|
|
22695
|
+
const { messageId } = await send(sanitizedQueueName, encoded, opts);
|
|
22696
|
+
return {
|
|
22697
|
+
messageId: MessageId.parse(messageId)
|
|
22698
|
+
};
|
|
22699
|
+
}, "queue");
|
|
22700
|
+
const createQueueHandler = /* @__PURE__ */ __name((prefix, handler) => {
|
|
22701
|
+
return handleCallback({
|
|
22702
|
+
[`${prefix}*`]: {
|
|
22703
|
+
default: /* @__PURE__ */ __name((body, meta) => {
|
|
22704
|
+
const { payload, queueName } = MessageWrapper.parse(body);
|
|
22705
|
+
return handler(payload, {
|
|
22706
|
+
queueName,
|
|
22707
|
+
messageId: MessageId.parse(meta.messageId),
|
|
22708
|
+
attempt: meta.deliveryCount
|
|
22709
|
+
});
|
|
22710
|
+
}, "default")
|
|
22711
|
+
}
|
|
22712
|
+
});
|
|
22713
|
+
}, "createQueueHandler");
|
|
22714
|
+
const getDeploymentId = /* @__PURE__ */ __name(async () => {
|
|
22715
|
+
const deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
22716
|
+
if (!deploymentId) {
|
|
22717
|
+
throw new Error("VERCEL_DEPLOYMENT_ID environment variable is not set");
|
|
22718
|
+
}
|
|
22719
|
+
return deploymentId;
|
|
22720
|
+
}, "getDeploymentId");
|
|
22721
|
+
return {
|
|
22722
|
+
queue,
|
|
22723
|
+
createQueueHandler,
|
|
22724
|
+
getDeploymentId
|
|
22725
|
+
};
|
|
22726
|
+
}
|
|
22727
|
+
__name(createQueue2, "createQueue");
|
|
22714
22728
|
// ../world-vercel/dist/events.js
|
|
22715
22729
|
function filterEventData2(event, resolveData) {
|
|
22716
22730
|
if (resolveData === "none") {
|
|
@@ -23236,7 +23250,7 @@ __name(createStreamer2, "createStreamer");
|
|
|
23236
23250
|
// ../world-vercel/dist/index.js
|
|
23237
23251
|
function createVercelWorld(config3) {
|
|
23238
23252
|
return {
|
|
23239
|
-
...createQueue2(),
|
|
23253
|
+
...createQueue2(config3),
|
|
23240
23254
|
...createStorage2(config3),
|
|
23241
23255
|
...createStreamer2(config3)
|
|
23242
23256
|
};
|
|
@@ -23440,6 +23454,7 @@ function getCommonReducers(global2 = globalThis) {
|
|
|
23440
23454
|
const viewToBase64 = /* @__PURE__ */ __name((value) => abToBase64(value.buffer, value.byteOffset, value.byteLength), "viewToBase64");
|
|
23441
23455
|
return {
|
|
23442
23456
|
ArrayBuffer: /* @__PURE__ */ __name((value) => value instanceof global2.ArrayBuffer && abToBase64(value, 0, value.byteLength), "ArrayBuffer"),
|
|
23457
|
+
BigInt: /* @__PURE__ */ __name((value) => typeof value === "bigint" && value.toString(), "BigInt"),
|
|
23443
23458
|
BigInt64Array: /* @__PURE__ */ __name((value) => value instanceof global2.BigInt64Array && viewToBase64(value), "BigInt64Array"),
|
|
23444
23459
|
BigUint64Array: /* @__PURE__ */ __name((value) => value instanceof global2.BigUint64Array && viewToBase64(value), "BigUint64Array"),
|
|
23445
23460
|
Date: /* @__PURE__ */ __name((value) => {
|
|
@@ -23569,6 +23584,7 @@ function getCommonRevivers(global2 = globalThis) {
|
|
|
23569
23584
|
__name(reviveArrayBuffer, "reviveArrayBuffer");
|
|
23570
23585
|
return {
|
|
23571
23586
|
ArrayBuffer: reviveArrayBuffer,
|
|
23587
|
+
BigInt: /* @__PURE__ */ __name((value) => global2.BigInt(value), "BigInt"),
|
|
23572
23588
|
BigInt64Array: /* @__PURE__ */ __name((value) => {
|
|
23573
23589
|
const ab = reviveArrayBuffer(value);
|
|
23574
23590
|
return new global2.BigInt64Array(ab);
|
|
@@ -23898,14 +23914,6 @@ async function add(num, num2) {
|
|
|
23898
23914
|
}
|
|
23899
23915
|
__name(add, "add");
|
|
23900
23916
|
registerStepFunction("step//workflows/addition.ts//add", add);
|
|
23901
|
-
// workflows/noop.ts
|
|
23902
|
-
var count = 0;
|
|
23903
|
-
async function noop(_i) {
|
|
23904
|
-
count++;
|
|
23905
|
-
return count;
|
|
23906
|
-
}
|
|
23907
|
-
__name(noop, "noop");
|
|
23908
|
-
registerStepFunction("step//workflows/noop.ts//noop", noop);
|
|
23909
23917
|
// ../core/dist/runtime.js
|
|
23910
23918
|
var import_functions3 = __toESM(require_functions(), 1);
|
|
23911
23919
|
// ../core/dist/logger.js
|