@workflow/world-testing 4.1.0-beta.65 → 4.1.0-beta.66
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.
|
@@ -45611,6 +45611,193 @@ var WaitSchema = external_exports.object({
|
|
|
45611
45611
|
specVersion: external_exports.number().optional()
|
|
45612
45612
|
});
|
|
45613
45613
|
|
|
45614
|
+
// ../../node_modules/.pnpm/ulid@3.0.1/node_modules/ulid/dist/node/index.js
|
|
45615
|
+
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
45616
|
+
var ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
45617
|
+
var ENCODING_LEN = 32;
|
|
45618
|
+
var RANDOM_LEN = 16;
|
|
45619
|
+
var TIME_LEN = 10;
|
|
45620
|
+
var TIME_MAX = 281474976710655;
|
|
45621
|
+
var ULIDErrorCode;
|
|
45622
|
+
(function(ULIDErrorCode2) {
|
|
45623
|
+
ULIDErrorCode2["Base32IncorrectEncoding"] = "B32_ENC_INVALID";
|
|
45624
|
+
ULIDErrorCode2["DecodeTimeInvalidCharacter"] = "DEC_TIME_CHAR";
|
|
45625
|
+
ULIDErrorCode2["DecodeTimeValueMalformed"] = "DEC_TIME_MALFORMED";
|
|
45626
|
+
ULIDErrorCode2["EncodeTimeNegative"] = "ENC_TIME_NEG";
|
|
45627
|
+
ULIDErrorCode2["EncodeTimeSizeExceeded"] = "ENC_TIME_SIZE_EXCEED";
|
|
45628
|
+
ULIDErrorCode2["EncodeTimeValueMalformed"] = "ENC_TIME_MALFORMED";
|
|
45629
|
+
ULIDErrorCode2["PRNGDetectFailure"] = "PRNG_DETECT";
|
|
45630
|
+
ULIDErrorCode2["ULIDInvalid"] = "ULID_INVALID";
|
|
45631
|
+
ULIDErrorCode2["Unexpected"] = "UNEXPECTED";
|
|
45632
|
+
ULIDErrorCode2["UUIDInvalid"] = "UUID_INVALID";
|
|
45633
|
+
})(ULIDErrorCode || (ULIDErrorCode = {}));
|
|
45634
|
+
var ULIDError = class extends Error {
|
|
45635
|
+
static {
|
|
45636
|
+
__name(this, "ULIDError");
|
|
45637
|
+
}
|
|
45638
|
+
constructor(errorCode, message) {
|
|
45639
|
+
super(`${message} (${errorCode})`);
|
|
45640
|
+
this.name = "ULIDError";
|
|
45641
|
+
this.code = errorCode;
|
|
45642
|
+
}
|
|
45643
|
+
};
|
|
45644
|
+
function randomChar(prng) {
|
|
45645
|
+
const randomPosition = Math.floor(prng() * ENCODING_LEN) % ENCODING_LEN;
|
|
45646
|
+
return ENCODING.charAt(randomPosition);
|
|
45647
|
+
}
|
|
45648
|
+
__name(randomChar, "randomChar");
|
|
45649
|
+
function replaceCharAt(str, index, char) {
|
|
45650
|
+
if (index > str.length - 1) {
|
|
45651
|
+
return str;
|
|
45652
|
+
}
|
|
45653
|
+
return str.substr(0, index) + char + str.substr(index + 1);
|
|
45654
|
+
}
|
|
45655
|
+
__name(replaceCharAt, "replaceCharAt");
|
|
45656
|
+
function incrementBase32(str) {
|
|
45657
|
+
let done = void 0, index = str.length, char, charIndex, output = str;
|
|
45658
|
+
const maxCharIndex = ENCODING_LEN - 1;
|
|
45659
|
+
while (!done && index-- >= 0) {
|
|
45660
|
+
char = output[index];
|
|
45661
|
+
charIndex = ENCODING.indexOf(char);
|
|
45662
|
+
if (charIndex === -1) {
|
|
45663
|
+
throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Incorrectly encoded string");
|
|
45664
|
+
}
|
|
45665
|
+
if (charIndex === maxCharIndex) {
|
|
45666
|
+
output = replaceCharAt(output, index, ENCODING[0]);
|
|
45667
|
+
continue;
|
|
45668
|
+
}
|
|
45669
|
+
done = replaceCharAt(output, index, ENCODING[charIndex + 1]);
|
|
45670
|
+
}
|
|
45671
|
+
if (typeof done === "string") {
|
|
45672
|
+
return done;
|
|
45673
|
+
}
|
|
45674
|
+
throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Failed incrementing string");
|
|
45675
|
+
}
|
|
45676
|
+
__name(incrementBase32, "incrementBase32");
|
|
45677
|
+
function decodeTime(id) {
|
|
45678
|
+
if (id.length !== TIME_LEN + RANDOM_LEN) {
|
|
45679
|
+
throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, "Malformed ULID");
|
|
45680
|
+
}
|
|
45681
|
+
const time3 = id.substr(0, TIME_LEN).toUpperCase().split("").reverse().reduce((carry, char, index) => {
|
|
45682
|
+
const encodingIndex = ENCODING.indexOf(char);
|
|
45683
|
+
if (encodingIndex === -1) {
|
|
45684
|
+
throw new ULIDError(ULIDErrorCode.DecodeTimeInvalidCharacter, `Time decode error: Invalid character: ${char}`);
|
|
45685
|
+
}
|
|
45686
|
+
return carry += encodingIndex * Math.pow(ENCODING_LEN, index);
|
|
45687
|
+
}, 0);
|
|
45688
|
+
if (time3 > TIME_MAX) {
|
|
45689
|
+
throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, `Malformed ULID: timestamp too large: ${time3}`);
|
|
45690
|
+
}
|
|
45691
|
+
return time3;
|
|
45692
|
+
}
|
|
45693
|
+
__name(decodeTime, "decodeTime");
|
|
45694
|
+
function detectPRNG(root) {
|
|
45695
|
+
const rootLookup = detectRoot();
|
|
45696
|
+
const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || (typeof import_node_crypto.default !== "undefined" ? import_node_crypto.default : null);
|
|
45697
|
+
if (typeof globalCrypto?.getRandomValues === "function") {
|
|
45698
|
+
return () => {
|
|
45699
|
+
const buffer = new Uint8Array(1);
|
|
45700
|
+
globalCrypto.getRandomValues(buffer);
|
|
45701
|
+
return buffer[0] / 255;
|
|
45702
|
+
};
|
|
45703
|
+
} else if (typeof globalCrypto?.randomBytes === "function") {
|
|
45704
|
+
return () => globalCrypto.randomBytes(1).readUInt8() / 255;
|
|
45705
|
+
} else if (import_node_crypto.default?.randomBytes) {
|
|
45706
|
+
return () => import_node_crypto.default.randomBytes(1).readUInt8() / 255;
|
|
45707
|
+
}
|
|
45708
|
+
throw new ULIDError(ULIDErrorCode.PRNGDetectFailure, "Failed to find a reliable PRNG");
|
|
45709
|
+
}
|
|
45710
|
+
__name(detectPRNG, "detectPRNG");
|
|
45711
|
+
function detectRoot() {
|
|
45712
|
+
if (inWebWorker())
|
|
45713
|
+
return self;
|
|
45714
|
+
if (typeof window !== "undefined") {
|
|
45715
|
+
return window;
|
|
45716
|
+
}
|
|
45717
|
+
if (typeof global !== "undefined") {
|
|
45718
|
+
return global;
|
|
45719
|
+
}
|
|
45720
|
+
if (typeof globalThis !== "undefined") {
|
|
45721
|
+
return globalThis;
|
|
45722
|
+
}
|
|
45723
|
+
return null;
|
|
45724
|
+
}
|
|
45725
|
+
__name(detectRoot, "detectRoot");
|
|
45726
|
+
function encodeRandom(len, prng) {
|
|
45727
|
+
let str = "";
|
|
45728
|
+
for (; len > 0; len--) {
|
|
45729
|
+
str = randomChar(prng) + str;
|
|
45730
|
+
}
|
|
45731
|
+
return str;
|
|
45732
|
+
}
|
|
45733
|
+
__name(encodeRandom, "encodeRandom");
|
|
45734
|
+
function encodeTime(now, len = TIME_LEN) {
|
|
45735
|
+
if (isNaN(now)) {
|
|
45736
|
+
throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be a number: ${now}`);
|
|
45737
|
+
} else if (now > TIME_MAX) {
|
|
45738
|
+
throw new ULIDError(ULIDErrorCode.EncodeTimeSizeExceeded, `Cannot encode a time larger than ${TIME_MAX}: ${now}`);
|
|
45739
|
+
} else if (now < 0) {
|
|
45740
|
+
throw new ULIDError(ULIDErrorCode.EncodeTimeNegative, `Time must be positive: ${now}`);
|
|
45741
|
+
} else if (Number.isInteger(now) === false) {
|
|
45742
|
+
throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be an integer: ${now}`);
|
|
45743
|
+
}
|
|
45744
|
+
let mod, str = "";
|
|
45745
|
+
for (let currentLen = len; currentLen > 0; currentLen--) {
|
|
45746
|
+
mod = now % ENCODING_LEN;
|
|
45747
|
+
str = ENCODING.charAt(mod) + str;
|
|
45748
|
+
now = (now - mod) / ENCODING_LEN;
|
|
45749
|
+
}
|
|
45750
|
+
return str;
|
|
45751
|
+
}
|
|
45752
|
+
__name(encodeTime, "encodeTime");
|
|
45753
|
+
function inWebWorker() {
|
|
45754
|
+
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
|
|
45755
|
+
}
|
|
45756
|
+
__name(inWebWorker, "inWebWorker");
|
|
45757
|
+
function monotonicFactory(prng) {
|
|
45758
|
+
const currentPRNG = prng || detectPRNG();
|
|
45759
|
+
let lastTime = 0, lastRandom;
|
|
45760
|
+
return /* @__PURE__ */ __name(function _ulid2(seedTime) {
|
|
45761
|
+
const seed = !seedTime || isNaN(seedTime) ? Date.now() : seedTime;
|
|
45762
|
+
if (seed <= lastTime) {
|
|
45763
|
+
const incrementedRandom = lastRandom = incrementBase32(lastRandom);
|
|
45764
|
+
return encodeTime(lastTime, TIME_LEN) + incrementedRandom;
|
|
45765
|
+
}
|
|
45766
|
+
lastTime = seed;
|
|
45767
|
+
const newRandom = lastRandom = encodeRandom(RANDOM_LEN, currentPRNG);
|
|
45768
|
+
return encodeTime(seed, TIME_LEN) + newRandom;
|
|
45769
|
+
}, "_ulid");
|
|
45770
|
+
}
|
|
45771
|
+
__name(monotonicFactory, "monotonicFactory");
|
|
45772
|
+
|
|
45773
|
+
// ../world/dist/ulid.js
|
|
45774
|
+
var UlidSchema = external_exports.string().ulid();
|
|
45775
|
+
var DEFAULT_TIMESTAMP_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
45776
|
+
function ulidToDate(maybeUlid) {
|
|
45777
|
+
const ulid5 = UlidSchema.safeParse(maybeUlid);
|
|
45778
|
+
if (!ulid5.success) {
|
|
45779
|
+
return null;
|
|
45780
|
+
}
|
|
45781
|
+
return new Date(decodeTime(ulid5.data));
|
|
45782
|
+
}
|
|
45783
|
+
__name(ulidToDate, "ulidToDate");
|
|
45784
|
+
function validateUlidTimestamp(prefixedUlid, prefix, thresholdMs = DEFAULT_TIMESTAMP_THRESHOLD_MS) {
|
|
45785
|
+
const raw = prefixedUlid.startsWith(prefix) ? prefixedUlid.slice(prefix.length) : prefixedUlid;
|
|
45786
|
+
const ulidTimestamp = ulidToDate(raw);
|
|
45787
|
+
if (!ulidTimestamp) {
|
|
45788
|
+
return `Invalid runId: "${prefixedUlid}" is not a valid ULID`;
|
|
45789
|
+
}
|
|
45790
|
+
const serverTimestamp = /* @__PURE__ */ new Date();
|
|
45791
|
+
const driftMs = Math.abs(serverTimestamp.getTime() - ulidTimestamp.getTime());
|
|
45792
|
+
if (driftMs <= thresholdMs) {
|
|
45793
|
+
return null;
|
|
45794
|
+
}
|
|
45795
|
+
const driftSeconds = Math.round(driftMs / 1e3);
|
|
45796
|
+
const thresholdSeconds = Math.round(thresholdMs / 1e3);
|
|
45797
|
+
return `Invalid runId timestamp: embedded timestamp differs from server time by ${driftSeconds}s (threshold: ${thresholdSeconds}s)`;
|
|
45798
|
+
}
|
|
45799
|
+
__name(validateUlidTimestamp, "validateUlidTimestamp");
|
|
45800
|
+
|
|
45614
45801
|
// ../core/dist/encryption.js
|
|
45615
45802
|
var NONCE_LENGTH = 12;
|
|
45616
45803
|
var TAG_LENGTH = 128;
|
|
@@ -45948,169 +46135,13 @@ var webhookLogger = createLogger("webhook");
|
|
|
45948
46135
|
var eventsLogger = createLogger("events");
|
|
45949
46136
|
var adapterLogger = createLogger("adapter");
|
|
45950
46137
|
|
|
45951
|
-
// ../../node_modules/.pnpm/ulid@3.0.1/node_modules/ulid/dist/node/index.js
|
|
45952
|
-
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
45953
|
-
var ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
45954
|
-
var ENCODING_LEN = 32;
|
|
45955
|
-
var RANDOM_LEN = 16;
|
|
45956
|
-
var TIME_LEN = 10;
|
|
45957
|
-
var TIME_MAX = 281474976710655;
|
|
45958
|
-
var ULIDErrorCode;
|
|
45959
|
-
(function(ULIDErrorCode2) {
|
|
45960
|
-
ULIDErrorCode2["Base32IncorrectEncoding"] = "B32_ENC_INVALID";
|
|
45961
|
-
ULIDErrorCode2["DecodeTimeInvalidCharacter"] = "DEC_TIME_CHAR";
|
|
45962
|
-
ULIDErrorCode2["DecodeTimeValueMalformed"] = "DEC_TIME_MALFORMED";
|
|
45963
|
-
ULIDErrorCode2["EncodeTimeNegative"] = "ENC_TIME_NEG";
|
|
45964
|
-
ULIDErrorCode2["EncodeTimeSizeExceeded"] = "ENC_TIME_SIZE_EXCEED";
|
|
45965
|
-
ULIDErrorCode2["EncodeTimeValueMalformed"] = "ENC_TIME_MALFORMED";
|
|
45966
|
-
ULIDErrorCode2["PRNGDetectFailure"] = "PRNG_DETECT";
|
|
45967
|
-
ULIDErrorCode2["ULIDInvalid"] = "ULID_INVALID";
|
|
45968
|
-
ULIDErrorCode2["Unexpected"] = "UNEXPECTED";
|
|
45969
|
-
ULIDErrorCode2["UUIDInvalid"] = "UUID_INVALID";
|
|
45970
|
-
})(ULIDErrorCode || (ULIDErrorCode = {}));
|
|
45971
|
-
var ULIDError = class extends Error {
|
|
45972
|
-
static {
|
|
45973
|
-
__name(this, "ULIDError");
|
|
45974
|
-
}
|
|
45975
|
-
constructor(errorCode, message) {
|
|
45976
|
-
super(`${message} (${errorCode})`);
|
|
45977
|
-
this.name = "ULIDError";
|
|
45978
|
-
this.code = errorCode;
|
|
45979
|
-
}
|
|
45980
|
-
};
|
|
45981
|
-
function randomChar(prng) {
|
|
45982
|
-
const randomPosition = Math.floor(prng() * ENCODING_LEN) % ENCODING_LEN;
|
|
45983
|
-
return ENCODING.charAt(randomPosition);
|
|
45984
|
-
}
|
|
45985
|
-
__name(randomChar, "randomChar");
|
|
45986
|
-
function replaceCharAt(str, index, char) {
|
|
45987
|
-
if (index > str.length - 1) {
|
|
45988
|
-
return str;
|
|
45989
|
-
}
|
|
45990
|
-
return str.substr(0, index) + char + str.substr(index + 1);
|
|
45991
|
-
}
|
|
45992
|
-
__name(replaceCharAt, "replaceCharAt");
|
|
45993
|
-
function incrementBase32(str) {
|
|
45994
|
-
let done = void 0, index = str.length, char, charIndex, output = str;
|
|
45995
|
-
const maxCharIndex = ENCODING_LEN - 1;
|
|
45996
|
-
while (!done && index-- >= 0) {
|
|
45997
|
-
char = output[index];
|
|
45998
|
-
charIndex = ENCODING.indexOf(char);
|
|
45999
|
-
if (charIndex === -1) {
|
|
46000
|
-
throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Incorrectly encoded string");
|
|
46001
|
-
}
|
|
46002
|
-
if (charIndex === maxCharIndex) {
|
|
46003
|
-
output = replaceCharAt(output, index, ENCODING[0]);
|
|
46004
|
-
continue;
|
|
46005
|
-
}
|
|
46006
|
-
done = replaceCharAt(output, index, ENCODING[charIndex + 1]);
|
|
46007
|
-
}
|
|
46008
|
-
if (typeof done === "string") {
|
|
46009
|
-
return done;
|
|
46010
|
-
}
|
|
46011
|
-
throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Failed incrementing string");
|
|
46012
|
-
}
|
|
46013
|
-
__name(incrementBase32, "incrementBase32");
|
|
46014
|
-
function decodeTime(id) {
|
|
46015
|
-
if (id.length !== TIME_LEN + RANDOM_LEN) {
|
|
46016
|
-
throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, "Malformed ULID");
|
|
46017
|
-
}
|
|
46018
|
-
const time3 = id.substr(0, TIME_LEN).toUpperCase().split("").reverse().reduce((carry, char, index) => {
|
|
46019
|
-
const encodingIndex = ENCODING.indexOf(char);
|
|
46020
|
-
if (encodingIndex === -1) {
|
|
46021
|
-
throw new ULIDError(ULIDErrorCode.DecodeTimeInvalidCharacter, `Time decode error: Invalid character: ${char}`);
|
|
46022
|
-
}
|
|
46023
|
-
return carry += encodingIndex * Math.pow(ENCODING_LEN, index);
|
|
46024
|
-
}, 0);
|
|
46025
|
-
if (time3 > TIME_MAX) {
|
|
46026
|
-
throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, `Malformed ULID: timestamp too large: ${time3}`);
|
|
46027
|
-
}
|
|
46028
|
-
return time3;
|
|
46029
|
-
}
|
|
46030
|
-
__name(decodeTime, "decodeTime");
|
|
46031
|
-
function detectPRNG(root) {
|
|
46032
|
-
const rootLookup = detectRoot();
|
|
46033
|
-
const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || (typeof import_node_crypto.default !== "undefined" ? import_node_crypto.default : null);
|
|
46034
|
-
if (typeof globalCrypto?.getRandomValues === "function") {
|
|
46035
|
-
return () => {
|
|
46036
|
-
const buffer = new Uint8Array(1);
|
|
46037
|
-
globalCrypto.getRandomValues(buffer);
|
|
46038
|
-
return buffer[0] / 255;
|
|
46039
|
-
};
|
|
46040
|
-
} else if (typeof globalCrypto?.randomBytes === "function") {
|
|
46041
|
-
return () => globalCrypto.randomBytes(1).readUInt8() / 255;
|
|
46042
|
-
} else if (import_node_crypto.default?.randomBytes) {
|
|
46043
|
-
return () => import_node_crypto.default.randomBytes(1).readUInt8() / 255;
|
|
46044
|
-
}
|
|
46045
|
-
throw new ULIDError(ULIDErrorCode.PRNGDetectFailure, "Failed to find a reliable PRNG");
|
|
46046
|
-
}
|
|
46047
|
-
__name(detectPRNG, "detectPRNG");
|
|
46048
|
-
function detectRoot() {
|
|
46049
|
-
if (inWebWorker())
|
|
46050
|
-
return self;
|
|
46051
|
-
if (typeof window !== "undefined") {
|
|
46052
|
-
return window;
|
|
46053
|
-
}
|
|
46054
|
-
if (typeof global !== "undefined") {
|
|
46055
|
-
return global;
|
|
46056
|
-
}
|
|
46057
|
-
if (typeof globalThis !== "undefined") {
|
|
46058
|
-
return globalThis;
|
|
46059
|
-
}
|
|
46060
|
-
return null;
|
|
46061
|
-
}
|
|
46062
|
-
__name(detectRoot, "detectRoot");
|
|
46063
|
-
function encodeRandom(len, prng) {
|
|
46064
|
-
let str = "";
|
|
46065
|
-
for (; len > 0; len--) {
|
|
46066
|
-
str = randomChar(prng) + str;
|
|
46067
|
-
}
|
|
46068
|
-
return str;
|
|
46069
|
-
}
|
|
46070
|
-
__name(encodeRandom, "encodeRandom");
|
|
46071
|
-
function encodeTime(now, len = TIME_LEN) {
|
|
46072
|
-
if (isNaN(now)) {
|
|
46073
|
-
throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be a number: ${now}`);
|
|
46074
|
-
} else if (now > TIME_MAX) {
|
|
46075
|
-
throw new ULIDError(ULIDErrorCode.EncodeTimeSizeExceeded, `Cannot encode a time larger than ${TIME_MAX}: ${now}`);
|
|
46076
|
-
} else if (now < 0) {
|
|
46077
|
-
throw new ULIDError(ULIDErrorCode.EncodeTimeNegative, `Time must be positive: ${now}`);
|
|
46078
|
-
} else if (Number.isInteger(now) === false) {
|
|
46079
|
-
throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be an integer: ${now}`);
|
|
46080
|
-
}
|
|
46081
|
-
let mod, str = "";
|
|
46082
|
-
for (let currentLen = len; currentLen > 0; currentLen--) {
|
|
46083
|
-
mod = now % ENCODING_LEN;
|
|
46084
|
-
str = ENCODING.charAt(mod) + str;
|
|
46085
|
-
now = (now - mod) / ENCODING_LEN;
|
|
46086
|
-
}
|
|
46087
|
-
return str;
|
|
46088
|
-
}
|
|
46089
|
-
__name(encodeTime, "encodeTime");
|
|
46090
|
-
function inWebWorker() {
|
|
46091
|
-
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
|
|
46092
|
-
}
|
|
46093
|
-
__name(inWebWorker, "inWebWorker");
|
|
46094
|
-
function monotonicFactory(prng) {
|
|
46095
|
-
const currentPRNG = prng || detectPRNG();
|
|
46096
|
-
let lastTime = 0, lastRandom;
|
|
46097
|
-
return /* @__PURE__ */ __name(function _ulid2(seedTime) {
|
|
46098
|
-
const seed = !seedTime || isNaN(seedTime) ? Date.now() : seedTime;
|
|
46099
|
-
if (seed <= lastTime) {
|
|
46100
|
-
const incrementedRandom = lastRandom = incrementBase32(lastRandom);
|
|
46101
|
-
return encodeTime(lastTime, TIME_LEN) + incrementedRandom;
|
|
46102
|
-
}
|
|
46103
|
-
lastTime = seed;
|
|
46104
|
-
const newRandom = lastRandom = encodeRandom(RANDOM_LEN, currentPRNG);
|
|
46105
|
-
return encodeTime(seed, TIME_LEN) + newRandom;
|
|
46106
|
-
}, "_ulid");
|
|
46107
|
-
}
|
|
46108
|
-
__name(monotonicFactory, "monotonicFactory");
|
|
46109
|
-
|
|
46110
46138
|
// ../core/dist/runtime/world.js
|
|
46111
46139
|
var import_node_module = require("node:module");
|
|
46112
46140
|
var import_node_path9 = require("node:path");
|
|
46113
46141
|
|
|
46142
|
+
// ../world-local/dist/index.js
|
|
46143
|
+
var import_promises4 = require("node:fs/promises");
|
|
46144
|
+
|
|
46114
46145
|
// ../utils/dist/get-port.js
|
|
46115
46146
|
var import_node_child_process = require("node:child_process");
|
|
46116
46147
|
var import_promises = require("node:fs/promises");
|
|
@@ -48982,6 +49013,7 @@ function createQueue(config3) {
|
|
|
48982
49013
|
const generateId2 = monotonicFactory();
|
|
48983
49014
|
const semaphore = new import_async_sema.Sema(WORKFLOW_LOCAL_QUEUE_CONCURRENCY);
|
|
48984
49015
|
const inflightMessages = /* @__PURE__ */ new Map();
|
|
49016
|
+
const directHandlers = /* @__PURE__ */ new Map();
|
|
48985
49017
|
const queue = /* @__PURE__ */ __name(async (queueName, message, opts) => {
|
|
48986
49018
|
const cleanup = [];
|
|
48987
49019
|
if (opts?.idempotencyKey) {
|
|
@@ -48992,10 +49024,13 @@ function createQueue(config3) {
|
|
|
48992
49024
|
}
|
|
48993
49025
|
const body = transport.serialize(message);
|
|
48994
49026
|
let pathname;
|
|
49027
|
+
let prefix;
|
|
48995
49028
|
if (queueName.startsWith("__wkf_step_")) {
|
|
48996
49029
|
pathname = `step`;
|
|
49030
|
+
prefix = "__wkf_step_";
|
|
48997
49031
|
} else if (queueName.startsWith("__wkf_workflow_")) {
|
|
48998
49032
|
pathname = `flow`;
|
|
49033
|
+
prefix = "__wkf_workflow_";
|
|
48999
49034
|
} else {
|
|
49000
49035
|
throw new Error("Unknown queue name prefix");
|
|
49001
49036
|
}
|
|
@@ -49015,22 +49050,34 @@ function createQueue(config3) {
|
|
|
49015
49050
|
}
|
|
49016
49051
|
try {
|
|
49017
49052
|
let defaultRetriesLeft = 3;
|
|
49018
|
-
const
|
|
49053
|
+
const directHandler = directHandlers.get(prefix);
|
|
49019
49054
|
for (let attempt = 0; defaultRetriesLeft > 0; attempt++) {
|
|
49020
49055
|
defaultRetriesLeft--;
|
|
49021
|
-
|
|
49022
|
-
|
|
49023
|
-
|
|
49024
|
-
|
|
49025
|
-
|
|
49026
|
-
|
|
49027
|
-
|
|
49028
|
-
|
|
49029
|
-
|
|
49030
|
-
|
|
49031
|
-
|
|
49032
|
-
|
|
49033
|
-
|
|
49056
|
+
let response;
|
|
49057
|
+
const headers = {
|
|
49058
|
+
...opts?.headers,
|
|
49059
|
+
"content-type": "application/json",
|
|
49060
|
+
"x-vqs-queue-name": queueName,
|
|
49061
|
+
"x-vqs-message-id": messageId,
|
|
49062
|
+
"x-vqs-message-attempt": String(attempt + 1)
|
|
49063
|
+
};
|
|
49064
|
+
if (directHandler) {
|
|
49065
|
+
const req = new Request("http://localhost/.well-known/workflow/v1/" + pathname, {
|
|
49066
|
+
method: "POST",
|
|
49067
|
+
headers,
|
|
49068
|
+
body
|
|
49069
|
+
});
|
|
49070
|
+
response = await directHandler(req);
|
|
49071
|
+
} else {
|
|
49072
|
+
const baseUrl = await resolveBaseUrl(config3);
|
|
49073
|
+
response = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
|
|
49074
|
+
method: "POST",
|
|
49075
|
+
duplex: "half",
|
|
49076
|
+
dispatcher: httpAgent,
|
|
49077
|
+
headers,
|
|
49078
|
+
body
|
|
49079
|
+
});
|
|
49080
|
+
}
|
|
49034
49081
|
if (response.ok) {
|
|
49035
49082
|
return;
|
|
49036
49083
|
}
|
|
@@ -49112,6 +49159,9 @@ function createQueue(config3) {
|
|
|
49112
49159
|
queue,
|
|
49113
49160
|
createQueueHandler,
|
|
49114
49161
|
getDeploymentId,
|
|
49162
|
+
registerHandler(prefix, handler) {
|
|
49163
|
+
directHandlers.set(prefix, handler);
|
|
49164
|
+
},
|
|
49115
49165
|
async close() {
|
|
49116
49166
|
await httpAgent.close();
|
|
49117
49167
|
}
|
|
@@ -49232,7 +49282,6 @@ var import_node_path5 = __toESM(require("node:path"), 1);
|
|
|
49232
49282
|
var import_node_fs = require("node:fs");
|
|
49233
49283
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
49234
49284
|
var ulid3 = monotonicFactory(() => Math.random());
|
|
49235
|
-
var Ulid = external_exports.string().ulid();
|
|
49236
49285
|
var isWindows = process.platform === "win32";
|
|
49237
49286
|
async function withWindowsRetry(fn, maxRetries = 5) {
|
|
49238
49287
|
if (!isWindows)
|
|
@@ -49254,14 +49303,6 @@ async function withWindowsRetry(fn, maxRetries = 5) {
|
|
|
49254
49303
|
}
|
|
49255
49304
|
__name(withWindowsRetry, "withWindowsRetry");
|
|
49256
49305
|
var createdFilesCache = /* @__PURE__ */ new Set();
|
|
49257
|
-
function ulidToDate(maybeUlid) {
|
|
49258
|
-
const ulid5 = Ulid.safeParse(maybeUlid);
|
|
49259
|
-
if (!ulid5.success) {
|
|
49260
|
-
return null;
|
|
49261
|
-
}
|
|
49262
|
-
return new Date(decodeTime(ulid5.data));
|
|
49263
|
-
}
|
|
49264
|
-
__name(ulidToDate, "ulidToDate");
|
|
49265
49306
|
async function ensureDir(dirPath) {
|
|
49266
49307
|
try {
|
|
49267
49308
|
await import_node_fs.promises.mkdir(dirPath, { recursive: true });
|
|
@@ -49672,6 +49713,12 @@ function createEventsStorage(basedir) {
|
|
|
49672
49713
|
} else {
|
|
49673
49714
|
effectiveRunId = runId;
|
|
49674
49715
|
}
|
|
49716
|
+
if (data.eventType === "run_created" && runId && runId !== "") {
|
|
49717
|
+
const validationError = validateUlidTimestamp(effectiveRunId, "wrun_");
|
|
49718
|
+
if (validationError) {
|
|
49719
|
+
throw new WorkflowAPIError(validationError, { status: 400 });
|
|
49720
|
+
}
|
|
49721
|
+
}
|
|
49675
49722
|
const effectiveSpecVersion = data.specVersion ?? SPEC_VERSION_CURRENT;
|
|
49676
49723
|
const isRunTerminal = /* @__PURE__ */ __name((status) => ["completed", "failed", "cancelled"].includes(status), "isRunTerminal");
|
|
49677
49724
|
const isStepTerminal = /* @__PURE__ */ __name((status) => ["completed", "failed"].includes(status), "isStepTerminal");
|
|
@@ -50486,6 +50533,10 @@ function createLocalWorld(args) {
|
|
|
50486
50533
|
},
|
|
50487
50534
|
async close() {
|
|
50488
50535
|
await queue.close();
|
|
50536
|
+
},
|
|
50537
|
+
async clear() {
|
|
50538
|
+
await (0, import_promises4.rm)(mergedConfig.dataDir, { recursive: true, force: true });
|
|
50539
|
+
await initDataDir(mergedConfig.dataDir);
|
|
50489
50540
|
}
|
|
50490
50541
|
};
|
|
50491
50542
|
}
|
|
@@ -53025,7 +53076,7 @@ var RpcService3 = SemanticConvention3("rpc.service");
|
|
|
53025
53076
|
var RpcMethod3 = SemanticConvention3("rpc.method");
|
|
53026
53077
|
|
|
53027
53078
|
// ../world-vercel/dist/version.js
|
|
53028
|
-
var version2 = "4.1.0-beta.
|
|
53079
|
+
var version2 = "4.1.0-beta.39";
|
|
53029
53080
|
|
|
53030
53081
|
// ../world-vercel/dist/utils.js
|
|
53031
53082
|
var WORKFLOW_SERVER_URL_OVERRIDE = "";
|
|
@@ -53885,6 +53936,12 @@ async function createWorkflowRunEvent(id, data, params, config3) {
|
|
|
53885
53936
|
});
|
|
53886
53937
|
return { event: wireResult2 };
|
|
53887
53938
|
}
|
|
53939
|
+
if (data.eventType === "run_created" && id) {
|
|
53940
|
+
const validationError = validateUlidTimestamp(id, "wrun_");
|
|
53941
|
+
if (validationError) {
|
|
53942
|
+
throw new WorkflowAPIError(validationError, { status: 400 });
|
|
53943
|
+
}
|
|
53944
|
+
}
|
|
53888
53945
|
const runIdPath = id === null ? "null" : id;
|
|
53889
53946
|
const remoteRefBehavior = eventsNeedingResolve.has(data.eventType) ? "resolve" : "lazy";
|
|
53890
53947
|
if (remoteRefBehavior === "resolve") {
|
|
@@ -58882,7 +58939,7 @@ function getWritable(options = {}) {
|
|
|
58882
58939
|
__name(getWritable, "getWritable");
|
|
58883
58940
|
|
|
58884
58941
|
// ../workflow/dist/stdlib.js
|
|
58885
|
-
var fetch = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//workflow@4.2.0-beta.
|
|
58942
|
+
var fetch = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//workflow@4.2.0-beta.65//fetch");
|
|
58886
58943
|
|
|
58887
58944
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
58888
58945
|
var NEVER = Object.freeze({
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
"steps": {
|
|
4
4
|
"workflow/dist/stdlib.js": {
|
|
5
5
|
"fetch": {
|
|
6
|
-
"stepId": "step//workflow@4.2.0-beta.
|
|
6
|
+
"stepId": "step//workflow@4.2.0-beta.65//fetch"
|
|
7
7
|
}
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"stepId": "
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"stepId": "__builtin_response_text"
|
|
9
|
+
"workflows/hooks.ts": {
|
|
10
|
+
"writeEvent": {
|
|
11
|
+
"stepId": "step//./workflows/hooks//writeEvent"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"workflows/addition.ts": {
|
|
15
|
+
"add": {
|
|
16
|
+
"stepId": "step//./workflows/addition//add"
|
|
18
17
|
}
|
|
19
18
|
},
|
|
20
19
|
"workflows/noop.ts": {
|
|
@@ -27,9 +26,15 @@
|
|
|
27
26
|
"stepId": "step//./workflows/null-byte//nullByteStep"
|
|
28
27
|
}
|
|
29
28
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"stepId": "
|
|
29
|
+
"workflow/dist/internal/builtins.js": {
|
|
30
|
+
"__builtin_response_array_buffer": {
|
|
31
|
+
"stepId": "__builtin_response_array_buffer"
|
|
32
|
+
},
|
|
33
|
+
"__builtin_response_json": {
|
|
34
|
+
"stepId": "__builtin_response_json"
|
|
35
|
+
},
|
|
36
|
+
"__builtin_response_text": {
|
|
37
|
+
"stepId": "__builtin_response_text"
|
|
33
38
|
}
|
|
34
39
|
},
|
|
35
40
|
"workflows/retriable-and-fatal.ts": {
|
|
@@ -39,24 +44,19 @@
|
|
|
39
44
|
"stepThatThrowsRetryableError": {
|
|
40
45
|
"stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
|
|
41
46
|
}
|
|
42
|
-
},
|
|
43
|
-
"workflows/hooks.ts": {
|
|
44
|
-
"writeEvent": {
|
|
45
|
-
"stepId": "step//./workflows/hooks//writeEvent"
|
|
46
|
-
}
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"workflows": {
|
|
50
|
-
"workflows/
|
|
51
|
-
"
|
|
52
|
-
"workflowId": "workflow//./workflows/
|
|
50
|
+
"workflows/hooks.ts": {
|
|
51
|
+
"collectWithHook": {
|
|
52
|
+
"workflowId": "workflow//./workflows/hooks//collectWithHook",
|
|
53
53
|
"graph": {
|
|
54
54
|
"nodes": [
|
|
55
55
|
{
|
|
56
56
|
"id": "start",
|
|
57
57
|
"type": "workflowStart",
|
|
58
58
|
"data": {
|
|
59
|
-
"label": "Start:
|
|
59
|
+
"label": "Start: collectWithHook",
|
|
60
60
|
"nodeKind": "workflow_start"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
"workflows/
|
|
84
|
-
"
|
|
85
|
-
"workflowId": "workflow//./workflows/
|
|
83
|
+
"workflows/addition.ts": {
|
|
84
|
+
"addition": {
|
|
85
|
+
"workflowId": "workflow//./workflows/addition//addition",
|
|
86
86
|
"graph": {
|
|
87
87
|
"nodes": [
|
|
88
88
|
{
|
|
89
89
|
"id": "start",
|
|
90
90
|
"type": "workflowStart",
|
|
91
91
|
"data": {
|
|
92
|
-
"label": "Start:
|
|
92
|
+
"label": "Start: addition",
|
|
93
93
|
"nodeKind": "workflow_start"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
@@ -113,16 +113,16 @@
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
|
-
"workflows/
|
|
117
|
-
"
|
|
118
|
-
"workflowId": "workflow//./workflows/
|
|
116
|
+
"workflows/noop.ts": {
|
|
117
|
+
"brokenWf": {
|
|
118
|
+
"workflowId": "workflow//./workflows/noop//brokenWf",
|
|
119
119
|
"graph": {
|
|
120
120
|
"nodes": [
|
|
121
121
|
{
|
|
122
122
|
"id": "start",
|
|
123
123
|
"type": "workflowStart",
|
|
124
124
|
"data": {
|
|
125
|
-
"label": "Start:
|
|
125
|
+
"label": "Start: brokenWf",
|
|
126
126
|
"nodeKind": "workflow_start"
|
|
127
127
|
}
|
|
128
128
|
},
|
|
@@ -146,16 +146,16 @@
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
|
-
"workflows/
|
|
150
|
-
"
|
|
151
|
-
"workflowId": "workflow//./workflows/
|
|
149
|
+
"workflows/null-byte.ts": {
|
|
150
|
+
"nullByteWorkflow": {
|
|
151
|
+
"workflowId": "workflow//./workflows/null-byte//nullByteWorkflow",
|
|
152
152
|
"graph": {
|
|
153
153
|
"nodes": [
|
|
154
154
|
{
|
|
155
155
|
"id": "start",
|
|
156
156
|
"type": "workflowStart",
|
|
157
157
|
"data": {
|
|
158
|
-
"label": "Start:
|
|
158
|
+
"label": "Start: nullByteWorkflow",
|
|
159
159
|
"nodeKind": "workflow_start"
|
|
160
160
|
}
|
|
161
161
|
},
|
|
@@ -179,16 +179,16 @@
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
"workflows/
|
|
183
|
-
"
|
|
184
|
-
"workflowId": "workflow//./workflows/
|
|
182
|
+
"workflows/retriable-and-fatal.ts": {
|
|
183
|
+
"retryableAndFatalErrorWorkflow": {
|
|
184
|
+
"workflowId": "workflow//./workflows/retriable-and-fatal//retryableAndFatalErrorWorkflow",
|
|
185
185
|
"graph": {
|
|
186
186
|
"nodes": [
|
|
187
187
|
{
|
|
188
188
|
"id": "start",
|
|
189
189
|
"type": "workflowStart",
|
|
190
190
|
"data": {
|
|
191
|
-
"label": "Start:
|
|
191
|
+
"label": "Start: retryableAndFatalErrorWorkflow",
|
|
192
192
|
"nodeKind": "workflow_start"
|
|
193
193
|
}
|
|
194
194
|
},
|