@workflow/world-testing 4.1.23 → 4.1.24
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.
|
@@ -50526,7 +50526,7 @@ init_dist();
|
|
|
50526
50526
|
init_node();
|
|
50527
50527
|
|
|
50528
50528
|
// ../core/dist/version.js
|
|
50529
|
-
var version2 = "4.8.
|
|
50529
|
+
var version2 = "4.8.9";
|
|
50530
50530
|
|
|
50531
50531
|
// ../core/dist/runtime/world.js
|
|
50532
50532
|
var import_node_module = require("node:module");
|
|
@@ -63626,10 +63626,10 @@ var getWorld = /* @__PURE__ */ __name(() => {
|
|
|
63626
63626
|
}, "getWorld");
|
|
63627
63627
|
|
|
63628
63628
|
// ../core/dist/runtime/helpers.js
|
|
63629
|
-
var SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
63629
|
+
var SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@()[\]]+$/;
|
|
63630
63630
|
function getWorkflowQueueName(workflowName, namespace) {
|
|
63631
63631
|
if (!SAFE_WORKFLOW_NAME_PATTERN.test(workflowName)) {
|
|
63632
|
-
throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or
|
|
63632
|
+
throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, at signs, parentheses, or square brackets`);
|
|
63633
63633
|
}
|
|
63634
63634
|
const prefix = getQueueTopicPrefix("workflow", resolveQueueNamespace(namespace));
|
|
63635
63635
|
return `${prefix}${workflowName}`;
|
|
@@ -63895,7 +63895,7 @@ var import_node_util3 = require("node:util");
|
|
|
63895
63895
|
var WORKFLOW_SERIALIZE = /* @__PURE__ */ Symbol.for("workflow-serialize");
|
|
63896
63896
|
var WORKFLOW_DESERIALIZE = /* @__PURE__ */ Symbol.for("workflow-deserialize");
|
|
63897
63897
|
|
|
63898
|
-
// ../../node_modules/.pnpm/devalue@5.
|
|
63898
|
+
// ../../node_modules/.pnpm/devalue@5.9.2/node_modules/devalue/src/constants.js
|
|
63899
63899
|
var UNDEFINED = -1;
|
|
63900
63900
|
var HOLE = -2;
|
|
63901
63901
|
var NAN = -3;
|
|
@@ -63906,7 +63906,7 @@ var SPARSE = -7;
|
|
|
63906
63906
|
var MAX_ARRAY_LEN = 2 ** 32 - 1;
|
|
63907
63907
|
var MAX_ARRAY_INDEX = MAX_ARRAY_LEN - 1;
|
|
63908
63908
|
|
|
63909
|
-
// ../../node_modules/.pnpm/devalue@5.
|
|
63909
|
+
// ../../node_modules/.pnpm/devalue@5.9.2/node_modules/devalue/src/utils.js
|
|
63910
63910
|
var DevalueError = class extends Error {
|
|
63911
63911
|
static {
|
|
63912
63912
|
__name(this, "DevalueError");
|
|
@@ -63925,10 +63925,6 @@ var DevalueError = class extends Error {
|
|
|
63925
63925
|
this.root = root;
|
|
63926
63926
|
}
|
|
63927
63927
|
};
|
|
63928
|
-
function is_primitive(thing) {
|
|
63929
|
-
return thing === null || typeof thing !== "object" && typeof thing !== "function";
|
|
63930
|
-
}
|
|
63931
|
-
__name(is_primitive, "is_primitive");
|
|
63932
63928
|
var object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
63933
63929
|
function is_plain_object(thing) {
|
|
63934
63930
|
const proto = Object.getPrototypeOf(thing);
|
|
@@ -64016,19 +64012,23 @@ function is_valid_array_index_string(s) {
|
|
|
64016
64012
|
return is_valid_array_index(+s);
|
|
64017
64013
|
}
|
|
64018
64014
|
__name(is_valid_array_index_string, "is_valid_array_index_string");
|
|
64019
|
-
function
|
|
64020
|
-
const keys = Object.keys(array2);
|
|
64015
|
+
function array_index_cut(keys) {
|
|
64021
64016
|
for (var i = keys.length - 1; i >= 0; i--) {
|
|
64022
64017
|
if (is_valid_array_index_string(keys[i])) {
|
|
64023
64018
|
break;
|
|
64024
64019
|
}
|
|
64025
64020
|
}
|
|
64026
|
-
|
|
64021
|
+
return i + 1;
|
|
64022
|
+
}
|
|
64023
|
+
__name(array_index_cut, "array_index_cut");
|
|
64024
|
+
function valid_array_indices(array2) {
|
|
64025
|
+
const keys = Object.keys(array2);
|
|
64026
|
+
keys.length = array_index_cut(keys);
|
|
64027
64027
|
return keys;
|
|
64028
64028
|
}
|
|
64029
64029
|
__name(valid_array_indices, "valid_array_indices");
|
|
64030
64030
|
|
|
64031
|
-
// ../../node_modules/.pnpm/devalue@5.
|
|
64031
|
+
// ../../node_modules/.pnpm/devalue@5.9.2/node_modules/devalue/src/base64.js
|
|
64032
64032
|
function encode_native(array_buffer) {
|
|
64033
64033
|
return new Uint8Array(array_buffer).toBase64();
|
|
64034
64034
|
}
|
|
@@ -64071,12 +64071,109 @@ var buffer = typeof process === "object" && process.versions?.node !== void 0;
|
|
|
64071
64071
|
var encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
|
|
64072
64072
|
var decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
|
|
64073
64073
|
|
|
64074
|
-
// ../../node_modules/.pnpm/devalue@5.
|
|
64075
|
-
function
|
|
64076
|
-
|
|
64074
|
+
// ../../node_modules/.pnpm/devalue@5.9.2/node_modules/devalue/src/operations.js
|
|
64075
|
+
function merge_operations(defaults2, overrides) {
|
|
64076
|
+
if (!overrides) return defaults2;
|
|
64077
|
+
const merged = (
|
|
64078
|
+
/** @type {T} */
|
|
64079
|
+
{}
|
|
64080
|
+
);
|
|
64081
|
+
for (
|
|
64082
|
+
const key of
|
|
64083
|
+
/** @type {(keyof T)[]} */
|
|
64084
|
+
Object.keys(defaults2)
|
|
64085
|
+
) {
|
|
64086
|
+
merged[key] = overrides[key] ?? defaults2[key];
|
|
64087
|
+
}
|
|
64088
|
+
return merged;
|
|
64089
|
+
}
|
|
64090
|
+
__name(merge_operations, "merge_operations");
|
|
64091
|
+
var NOT_PLAIN = Object.freeze({ kind: "not-plain" });
|
|
64092
|
+
var SYMBOL_KEYS = Object.freeze({ kind: "symbol-keys" });
|
|
64093
|
+
var stringify_operations = {
|
|
64094
|
+
identify: /* @__PURE__ */ __name((value) => value, "identify"),
|
|
64095
|
+
typeOf: /* @__PURE__ */ __name((value) => value === null ? "null" : typeof value, "typeOf"),
|
|
64096
|
+
toPrimitive: /* @__PURE__ */ __name((value) => value, "toPrimitive"),
|
|
64097
|
+
tagOf: /* @__PURE__ */ __name((value) => get_type(value), "tagOf"),
|
|
64098
|
+
isThenable: /* @__PURE__ */ __name((value) => typeof value.then === "function", "isThenable"),
|
|
64099
|
+
toPromise: /* @__PURE__ */ __name((thenable) => Promise.resolve(thenable), "toPromise"),
|
|
64100
|
+
unbox: /* @__PURE__ */ __name((boxed) => boxed.valueOf(), "unbox"),
|
|
64101
|
+
toISOString: /* @__PURE__ */ __name((date5) => isNaN(date5.getDate()) ? "" : date5.toISOString(), "toISOString"),
|
|
64102
|
+
toStringValue: /* @__PURE__ */ __name((value) => value.toString(), "toStringValue"),
|
|
64103
|
+
regExpInfo: /* @__PURE__ */ __name((regexp) => ({ source: regexp.source, flags: regexp.flags }), "regExpInfo"),
|
|
64104
|
+
valuesOf: /* @__PURE__ */ __name((set2) => set2, "valuesOf"),
|
|
64105
|
+
entriesOf: /* @__PURE__ */ __name((map2) => map2, "entriesOf"),
|
|
64106
|
+
viewInfo: /* @__PURE__ */ __name((view) => ({
|
|
64107
|
+
buffer: view.buffer,
|
|
64108
|
+
byteOffset: view.byteOffset,
|
|
64109
|
+
byteLength: view.byteLength,
|
|
64110
|
+
length: view.length,
|
|
64111
|
+
bufferByteLength: view.buffer.byteLength
|
|
64112
|
+
}), "viewInfo"),
|
|
64113
|
+
toArrayBuffer: /* @__PURE__ */ __name((buffer2) => buffer2, "toArrayBuffer"),
|
|
64114
|
+
lengthOf: /* @__PURE__ */ __name((array2) => array2.length, "lengthOf"),
|
|
64115
|
+
hasOwn: /* @__PURE__ */ __name((value, key) => Object.hasOwn(value, key), "hasOwn"),
|
|
64116
|
+
indicesOf: /* @__PURE__ */ __name((array2) => valid_array_indices(array2), "indicesOf"),
|
|
64117
|
+
shapeOf: /* @__PURE__ */ __name((value) => {
|
|
64118
|
+
if (!is_plain_object(value)) return NOT_PLAIN;
|
|
64119
|
+
if (enumerable_symbols(value).length > 0) return SYMBOL_KEYS;
|
|
64120
|
+
return {
|
|
64121
|
+
kind: Object.getPrototypeOf(value) === null ? "null-proto" : "plain",
|
|
64122
|
+
keys: Object.keys(value)
|
|
64123
|
+
};
|
|
64124
|
+
}, "shapeOf"),
|
|
64125
|
+
get: /* @__PURE__ */ __name((value, key) => value[key], "get")
|
|
64126
|
+
};
|
|
64127
|
+
var default_stringify_operations = Object.freeze(stringify_operations);
|
|
64128
|
+
var parse_operations = {
|
|
64129
|
+
fromPrimitive: /* @__PURE__ */ __name((primitive) => primitive, "fromPrimitive"),
|
|
64130
|
+
fromISOString: /* @__PURE__ */ __name((iso) => new Date(iso), "fromISOString"),
|
|
64131
|
+
fromStringValue: /* @__PURE__ */ __name((tag, text) => {
|
|
64132
|
+
if (tag === "URL") return new URL(text);
|
|
64133
|
+
if (tag === "URLSearchParams") return new URLSearchParams(text);
|
|
64134
|
+
return Temporal[tag.slice(9)].from(text);
|
|
64135
|
+
}, "fromStringValue"),
|
|
64136
|
+
fromArrayBuffer: /* @__PURE__ */ __name((buffer2) => buffer2, "fromArrayBuffer"),
|
|
64137
|
+
fromRegExpInfo: /* @__PURE__ */ __name((source, flags) => new RegExp(source, flags), "fromRegExpInfo"),
|
|
64138
|
+
fromViewInfo: /* @__PURE__ */ __name((tag, buffer2, byteOffset, length) => {
|
|
64139
|
+
const Constructor = (
|
|
64140
|
+
/** @type {any} */
|
|
64141
|
+
globalThis[tag]
|
|
64142
|
+
);
|
|
64143
|
+
return byteOffset !== void 0 ? new Constructor(buffer2, byteOffset, length) : new Constructor(buffer2);
|
|
64144
|
+
}, "fromViewInfo"),
|
|
64145
|
+
box: /* @__PURE__ */ __name((value) => Object(value), "box"),
|
|
64146
|
+
createArray: /* @__PURE__ */ __name((length) => new Array(length), "createArray"),
|
|
64147
|
+
createSparseArray: /* @__PURE__ */ __name((length) => {
|
|
64148
|
+
const array2 = [];
|
|
64149
|
+
array2[MAX_ARRAY_INDEX] = void 0;
|
|
64150
|
+
delete array2[MAX_ARRAY_INDEX];
|
|
64151
|
+
array2.length = length;
|
|
64152
|
+
return array2;
|
|
64153
|
+
}, "createSparseArray"),
|
|
64154
|
+
createObject: /* @__PURE__ */ __name(() => ({}), "createObject"),
|
|
64155
|
+
createNullPrototypeObject: /* @__PURE__ */ __name(() => /* @__PURE__ */ Object.create(null), "createNullPrototypeObject"),
|
|
64156
|
+
createSet: /* @__PURE__ */ __name(() => /* @__PURE__ */ new Set(), "createSet"),
|
|
64157
|
+
createMap: /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "createMap"),
|
|
64158
|
+
set: /* @__PURE__ */ __name((target2, key, value) => {
|
|
64159
|
+
target2[key] = value;
|
|
64160
|
+
}, "set"),
|
|
64161
|
+
addValue: /* @__PURE__ */ __name((set2, value) => {
|
|
64162
|
+
set2.add(value);
|
|
64163
|
+
}, "addValue"),
|
|
64164
|
+
addEntry: /* @__PURE__ */ __name((map2, key, value) => {
|
|
64165
|
+
map2.set(key, value);
|
|
64166
|
+
}, "addEntry")
|
|
64167
|
+
};
|
|
64168
|
+
var default_parse_operations = Object.freeze(parse_operations);
|
|
64169
|
+
|
|
64170
|
+
// ../../node_modules/.pnpm/devalue@5.9.2/node_modules/devalue/src/parse.js
|
|
64171
|
+
function parse3(serialized, revivers, options) {
|
|
64172
|
+
return unflatten(JSON.parse(serialized), revivers, options);
|
|
64077
64173
|
}
|
|
64078
64174
|
__name(parse3, "parse");
|
|
64079
|
-
function unflatten(parsed, revivers) {
|
|
64175
|
+
function unflatten(parsed, revivers, options) {
|
|
64176
|
+
const ops = merge_operations(default_parse_operations, options?.operations);
|
|
64080
64177
|
if (typeof parsed === "number") return hydrate(parsed, true);
|
|
64081
64178
|
if (!Array.isArray(parsed) || parsed.length === 0) {
|
|
64082
64179
|
throw new Error("Invalid input");
|
|
@@ -64088,18 +64185,21 @@ function unflatten(parsed, revivers) {
|
|
|
64088
64185
|
const hydrated = Array(values.length);
|
|
64089
64186
|
let hydrating = null;
|
|
64090
64187
|
function hydrate(index, standalone = false) {
|
|
64091
|
-
if (index === UNDEFINED) return void 0;
|
|
64092
|
-
if (index === NAN) return NaN;
|
|
64093
|
-
if (index === POSITIVE_INFINITY) return Infinity;
|
|
64094
|
-
if (index === NEGATIVE_INFINITY) return -Infinity;
|
|
64095
|
-
if (index === NEGATIVE_ZERO) return -0;
|
|
64188
|
+
if (index === UNDEFINED) return ops.fromPrimitive(void 0);
|
|
64189
|
+
if (index === NAN) return ops.fromPrimitive(NaN);
|
|
64190
|
+
if (index === POSITIVE_INFINITY) return ops.fromPrimitive(Infinity);
|
|
64191
|
+
if (index === NEGATIVE_INFINITY) return ops.fromPrimitive(-Infinity);
|
|
64192
|
+
if (index === NEGATIVE_ZERO) return ops.fromPrimitive(-0);
|
|
64096
64193
|
if (standalone || typeof index !== "number") {
|
|
64097
64194
|
throw new Error(`Invalid input`);
|
|
64098
64195
|
}
|
|
64099
64196
|
if (index in hydrated) return hydrated[index];
|
|
64197
|
+
if (index >= values.length) {
|
|
64198
|
+
throw new Error(`Invalid input`);
|
|
64199
|
+
}
|
|
64100
64200
|
const value = values[index];
|
|
64101
64201
|
if (!value || typeof value !== "object") {
|
|
64102
|
-
hydrated[index] = value;
|
|
64202
|
+
hydrated[index] = ops.fromPrimitive(value);
|
|
64103
64203
|
} else if (Array.isArray(value)) {
|
|
64104
64204
|
if (typeof value[0] === "string") {
|
|
64105
64205
|
const type = value[0];
|
|
@@ -64109,6 +64209,9 @@ function unflatten(parsed, revivers) {
|
|
|
64109
64209
|
if (typeof i !== "number") {
|
|
64110
64210
|
i = values.push(value[1]) - 1;
|
|
64111
64211
|
}
|
|
64212
|
+
if (Object.hasOwn(hydrated, i)) {
|
|
64213
|
+
return hydrated[index] = reviver(hydrated[i]);
|
|
64214
|
+
}
|
|
64112
64215
|
hydrating ??= /* @__PURE__ */ new Set();
|
|
64113
64216
|
if (hydrating.has(i)) {
|
|
64114
64217
|
throw new Error("Invalid circular reference");
|
|
@@ -64120,44 +64223,44 @@ function unflatten(parsed, revivers) {
|
|
|
64120
64223
|
}
|
|
64121
64224
|
switch (type) {
|
|
64122
64225
|
case "Date":
|
|
64123
|
-
hydrated[index] =
|
|
64226
|
+
hydrated[index] = ops.fromISOString(value[1]);
|
|
64124
64227
|
break;
|
|
64125
64228
|
case "Set":
|
|
64126
|
-
const set2 =
|
|
64229
|
+
const set2 = ops.createSet();
|
|
64127
64230
|
hydrated[index] = set2;
|
|
64128
64231
|
for (let i = 1; i < value.length; i += 1) {
|
|
64129
|
-
|
|
64232
|
+
ops.addValue(set2, hydrate(value[i]));
|
|
64130
64233
|
}
|
|
64131
64234
|
break;
|
|
64132
64235
|
case "Map":
|
|
64133
|
-
const map2 =
|
|
64236
|
+
const map2 = ops.createMap();
|
|
64134
64237
|
hydrated[index] = map2;
|
|
64135
64238
|
for (let i = 1; i < value.length; i += 2) {
|
|
64136
|
-
|
|
64239
|
+
ops.addEntry(map2, hydrate(value[i]), hydrate(value[i + 1]));
|
|
64137
64240
|
}
|
|
64138
64241
|
break;
|
|
64139
64242
|
case "RegExp":
|
|
64140
|
-
hydrated[index] =
|
|
64243
|
+
hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
|
|
64141
64244
|
break;
|
|
64142
64245
|
case "Object": {
|
|
64143
64246
|
const wrapped_index = value[1];
|
|
64144
64247
|
if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") {
|
|
64145
64248
|
throw new Error("Invalid input");
|
|
64146
64249
|
}
|
|
64147
|
-
hydrated[index] =
|
|
64250
|
+
hydrated[index] = ops.box(hydrate(wrapped_index));
|
|
64148
64251
|
break;
|
|
64149
64252
|
}
|
|
64150
64253
|
case "BigInt":
|
|
64151
|
-
hydrated[index] = BigInt(value[1]);
|
|
64254
|
+
hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
|
|
64152
64255
|
break;
|
|
64153
64256
|
case "null":
|
|
64154
|
-
const obj =
|
|
64257
|
+
const obj = ops.createNullPrototypeObject();
|
|
64155
64258
|
hydrated[index] = obj;
|
|
64156
64259
|
for (let i = 1; i < value.length; i += 2) {
|
|
64157
64260
|
if (value[i] === "__proto__") {
|
|
64158
64261
|
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
64159
64262
|
}
|
|
64160
|
-
obj
|
|
64263
|
+
ops.set(obj, value[i], hydrate(value[i + 1]));
|
|
64161
64264
|
}
|
|
64162
64265
|
break;
|
|
64163
64266
|
case "Int8Array":
|
|
@@ -64176,9 +64279,8 @@ function unflatten(parsed, revivers) {
|
|
|
64176
64279
|
if (values[value[1]][0] !== "ArrayBuffer") {
|
|
64177
64280
|
throw new Error("Invalid data");
|
|
64178
64281
|
}
|
|
64179
|
-
const TypedArrayConstructor = globalThis[type];
|
|
64180
64282
|
const buffer2 = hydrate(value[1]);
|
|
64181
|
-
hydrated[index] =
|
|
64283
|
+
hydrated[index] = ops.fromViewInfo(type, buffer2, value[2], value[3]);
|
|
64182
64284
|
break;
|
|
64183
64285
|
}
|
|
64184
64286
|
case "ArrayBuffer": {
|
|
@@ -64186,10 +64288,11 @@ function unflatten(parsed, revivers) {
|
|
|
64186
64288
|
if (typeof base643 !== "string") {
|
|
64187
64289
|
throw new Error("Invalid ArrayBuffer encoding");
|
|
64188
64290
|
}
|
|
64189
|
-
|
|
64190
|
-
hydrated[index] = arraybuffer;
|
|
64291
|
+
hydrated[index] = ops.fromArrayBuffer(decode64(base643));
|
|
64191
64292
|
break;
|
|
64192
64293
|
}
|
|
64294
|
+
case "URL":
|
|
64295
|
+
case "URLSearchParams":
|
|
64193
64296
|
case "Temporal.Duration":
|
|
64194
64297
|
case "Temporal.Instant":
|
|
64195
64298
|
case "Temporal.PlainDate":
|
|
@@ -64198,18 +64301,7 @@ function unflatten(parsed, revivers) {
|
|
|
64198
64301
|
case "Temporal.PlainMonthDay":
|
|
64199
64302
|
case "Temporal.PlainYearMonth":
|
|
64200
64303
|
case "Temporal.ZonedDateTime": {
|
|
64201
|
-
|
|
64202
|
-
hydrated[index] = Temporal[temporalName].from(value[1]);
|
|
64203
|
-
break;
|
|
64204
|
-
}
|
|
64205
|
-
case "URL": {
|
|
64206
|
-
const url2 = new URL(value[1]);
|
|
64207
|
-
hydrated[index] = url2;
|
|
64208
|
-
break;
|
|
64209
|
-
}
|
|
64210
|
-
case "URLSearchParams": {
|
|
64211
|
-
const url2 = new URLSearchParams(value[1]);
|
|
64212
|
-
hydrated[index] = url2;
|
|
64304
|
+
hydrated[index] = ops.fromStringValue(type, value[1]);
|
|
64213
64305
|
break;
|
|
64214
64306
|
}
|
|
64215
64307
|
default:
|
|
@@ -64220,36 +64312,32 @@ function unflatten(parsed, revivers) {
|
|
|
64220
64312
|
if (!is_valid_array_len(len)) {
|
|
64221
64313
|
throw new Error("Invalid input");
|
|
64222
64314
|
}
|
|
64223
|
-
const array2 =
|
|
64315
|
+
const array2 = ops.createSparseArray(len);
|
|
64224
64316
|
hydrated[index] = array2;
|
|
64225
|
-
array2[MAX_ARRAY_INDEX] = void 0;
|
|
64226
|
-
delete array2[MAX_ARRAY_INDEX];
|
|
64227
64317
|
for (let i = 2; i < value.length; i += 2) {
|
|
64228
64318
|
const idx = value[i];
|
|
64229
64319
|
if (!is_valid_array_index(idx) || idx >= len) {
|
|
64230
64320
|
throw new Error("Invalid input");
|
|
64231
64321
|
}
|
|
64232
|
-
array2
|
|
64322
|
+
ops.set(array2, idx, hydrate(value[i + 1]));
|
|
64233
64323
|
}
|
|
64234
|
-
array2.length = len;
|
|
64235
64324
|
} else {
|
|
64236
|
-
const array2 =
|
|
64325
|
+
const array2 = ops.createArray(value.length);
|
|
64237
64326
|
hydrated[index] = array2;
|
|
64238
64327
|
for (let i = 0; i < value.length; i += 1) {
|
|
64239
64328
|
const n = value[i];
|
|
64240
64329
|
if (n === HOLE) continue;
|
|
64241
|
-
array2
|
|
64330
|
+
ops.set(array2, i, hydrate(n));
|
|
64242
64331
|
}
|
|
64243
64332
|
}
|
|
64244
64333
|
} else {
|
|
64245
|
-
const object2 =
|
|
64334
|
+
const object2 = ops.createObject();
|
|
64246
64335
|
hydrated[index] = object2;
|
|
64247
64336
|
for (const key of Object.keys(value)) {
|
|
64248
64337
|
if (key === "__proto__") {
|
|
64249
64338
|
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
64250
64339
|
}
|
|
64251
|
-
|
|
64252
|
-
object2[key] = hydrate(n);
|
|
64340
|
+
ops.set(object2, key, hydrate(value[key]));
|
|
64253
64341
|
}
|
|
64254
64342
|
}
|
|
64255
64343
|
return hydrated[index];
|
|
@@ -64259,13 +64347,14 @@ function unflatten(parsed, revivers) {
|
|
|
64259
64347
|
}
|
|
64260
64348
|
__name(unflatten, "unflatten");
|
|
64261
64349
|
|
|
64262
|
-
// ../../node_modules/.pnpm/devalue@5.
|
|
64263
|
-
function stringify(value, reducers) {
|
|
64264
|
-
const stringified = run(false, value, reducers);
|
|
64350
|
+
// ../../node_modules/.pnpm/devalue@5.9.2/node_modules/devalue/src/stringify.js
|
|
64351
|
+
function stringify(value, reducers, options) {
|
|
64352
|
+
const stringified = run(false, value, reducers, options);
|
|
64265
64353
|
return typeof stringified === "string" ? stringified : `[${stringified.join(",")}]`;
|
|
64266
64354
|
}
|
|
64267
64355
|
__name(stringify, "stringify");
|
|
64268
|
-
function run(async, value, reducers) {
|
|
64356
|
+
function run(async, value, reducers, options) {
|
|
64357
|
+
const ops = merge_operations(default_stringify_operations, options?.operations);
|
|
64269
64358
|
const stringified = [];
|
|
64270
64359
|
const indexes = /* @__PURE__ */ new Map();
|
|
64271
64360
|
const custom2 = [];
|
|
@@ -64277,17 +64366,24 @@ function run(async, value, reducers) {
|
|
|
64277
64366
|
const keys = [];
|
|
64278
64367
|
let p = 0;
|
|
64279
64368
|
function flatten(thing, index2) {
|
|
64280
|
-
|
|
64281
|
-
if (
|
|
64282
|
-
|
|
64283
|
-
if (
|
|
64284
|
-
|
|
64285
|
-
|
|
64369
|
+
const type = ops.typeOf(thing);
|
|
64370
|
+
if (type === "undefined") return UNDEFINED;
|
|
64371
|
+
let number4;
|
|
64372
|
+
if (type === "number") {
|
|
64373
|
+
number4 = /** @type {number} */
|
|
64374
|
+
ops.toPrimitive(thing);
|
|
64375
|
+
if (Number.isNaN(number4)) return NAN;
|
|
64376
|
+
if (number4 === Infinity) return POSITIVE_INFINITY;
|
|
64377
|
+
if (number4 === -Infinity) return NEGATIVE_INFINITY;
|
|
64378
|
+
if (number4 === 0 && 1 / number4 < 0) return NEGATIVE_ZERO;
|
|
64379
|
+
}
|
|
64380
|
+
const id = ops.identify(thing);
|
|
64381
|
+
if (indexes.has(id)) return (
|
|
64286
64382
|
/** @type {number} */
|
|
64287
|
-
indexes.get(
|
|
64383
|
+
indexes.get(id)
|
|
64288
64384
|
);
|
|
64289
64385
|
index2 ??= p++;
|
|
64290
|
-
indexes.set(
|
|
64386
|
+
indexes.set(id, index2);
|
|
64291
64387
|
for (const { key, fn } of custom2) {
|
|
64292
64388
|
const value2 = fn(thing);
|
|
64293
64389
|
if (value2) {
|
|
@@ -64295,15 +64391,15 @@ function run(async, value, reducers) {
|
|
|
64295
64391
|
return index2;
|
|
64296
64392
|
}
|
|
64297
64393
|
}
|
|
64298
|
-
if (
|
|
64394
|
+
if (type === "function") {
|
|
64299
64395
|
throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
|
|
64300
|
-
} else if (
|
|
64396
|
+
} else if (type === "symbol") {
|
|
64301
64397
|
throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
|
|
64302
64398
|
}
|
|
64303
64399
|
let str = "";
|
|
64304
|
-
if (
|
|
64305
|
-
str = stringify_primitive(thing);
|
|
64306
|
-
} else if (
|
|
64400
|
+
if (type !== "object") {
|
|
64401
|
+
str = stringify_primitive(type === "number" ? number4 : ops.toPrimitive(thing));
|
|
64402
|
+
} else if (ops.isThenable(thing)) {
|
|
64307
64403
|
if (!async) {
|
|
64308
64404
|
throw new DevalueError(
|
|
64309
64405
|
`Cannot stringify a Promise or thenable \u2014 use stringifyAsync instead`,
|
|
@@ -64312,59 +64408,56 @@ function run(async, value, reducers) {
|
|
|
64312
64408
|
value
|
|
64313
64409
|
);
|
|
64314
64410
|
}
|
|
64315
|
-
str =
|
|
64411
|
+
str = ops.toPromise(thing).then((value2) => {
|
|
64316
64412
|
const i = flatten(value2, index2);
|
|
64317
64413
|
if (i < 0) stringified[index2] = i;
|
|
64318
64414
|
});
|
|
64319
64415
|
} else {
|
|
64320
|
-
const
|
|
64321
|
-
switch (
|
|
64416
|
+
const tag = ops.tagOf(thing);
|
|
64417
|
+
switch (tag) {
|
|
64322
64418
|
case "Number":
|
|
64323
64419
|
case "String":
|
|
64324
64420
|
case "Boolean":
|
|
64325
64421
|
case "BigInt":
|
|
64326
|
-
str = `["Object",${flatten(
|
|
64422
|
+
str = `["Object",${flatten(ops.unbox(thing))}]`;
|
|
64327
64423
|
break;
|
|
64328
64424
|
case "Date":
|
|
64329
|
-
|
|
64330
|
-
str = `["Date","${valid ? thing.toISOString() : ""}"]`;
|
|
64425
|
+
str = `["Date","${ops.toISOString(thing)}"]`;
|
|
64331
64426
|
break;
|
|
64332
64427
|
case "URL":
|
|
64333
|
-
str = `["URL",${stringify_string(
|
|
64428
|
+
str = `["URL",${stringify_string(ops.toStringValue(thing))}]`;
|
|
64334
64429
|
break;
|
|
64335
64430
|
case "URLSearchParams":
|
|
64336
|
-
str = `["URLSearchParams",${stringify_string(
|
|
64431
|
+
str = `["URLSearchParams",${stringify_string(ops.toStringValue(thing))}]`;
|
|
64337
64432
|
break;
|
|
64338
64433
|
case "RegExp":
|
|
64339
|
-
const { source, flags } = thing;
|
|
64434
|
+
const { source, flags } = ops.regExpInfo(thing);
|
|
64340
64435
|
str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
|
|
64341
64436
|
break;
|
|
64342
64437
|
case "Array": {
|
|
64343
64438
|
let mostly_dense = false;
|
|
64439
|
+
const length = ops.lengthOf(thing);
|
|
64344
64440
|
str = "[";
|
|
64345
|
-
for (let i = 0; i <
|
|
64441
|
+
for (let i = 0; i < length; i += 1) {
|
|
64346
64442
|
if (i > 0) str += ",";
|
|
64347
|
-
if (
|
|
64443
|
+
if (ops.hasOwn(thing, i)) {
|
|
64348
64444
|
keys.push(`[${i}]`);
|
|
64349
|
-
str += flatten(thing
|
|
64445
|
+
str += flatten(ops.get(thing, i));
|
|
64350
64446
|
keys.pop();
|
|
64351
64447
|
} else if (mostly_dense) {
|
|
64352
64448
|
str += HOLE;
|
|
64353
64449
|
} else {
|
|
64354
|
-
const populated_keys =
|
|
64355
|
-
/** @type {any[]} */
|
|
64356
|
-
thing
|
|
64357
|
-
);
|
|
64450
|
+
const populated_keys = ops.indicesOf(thing);
|
|
64358
64451
|
const population = populated_keys.length;
|
|
64359
|
-
const d = String(
|
|
64360
|
-
const hole_cost = (
|
|
64452
|
+
const d = String(length).length;
|
|
64453
|
+
const hole_cost = (length - population) * 3;
|
|
64361
64454
|
const sparse_cost = 4 + d + population * (d + 1);
|
|
64362
64455
|
if (hole_cost > sparse_cost) {
|
|
64363
|
-
str = "[" + SPARSE + "," +
|
|
64456
|
+
str = "[" + SPARSE + "," + length;
|
|
64364
64457
|
for (let j = 0; j < populated_keys.length; j++) {
|
|
64365
64458
|
const key = populated_keys[j];
|
|
64366
64459
|
keys.push(`[${key}]`);
|
|
64367
|
-
str += "," + key + "," + flatten(thing
|
|
64460
|
+
str += "," + key + "," + flatten(ops.get(thing, key));
|
|
64368
64461
|
keys.pop();
|
|
64369
64462
|
}
|
|
64370
64463
|
break;
|
|
@@ -64379,15 +64472,19 @@ function run(async, value, reducers) {
|
|
|
64379
64472
|
}
|
|
64380
64473
|
case "Set":
|
|
64381
64474
|
str = '["Set"';
|
|
64382
|
-
for (const value2 of thing) {
|
|
64475
|
+
for (const value2 of ops.valuesOf(thing)) {
|
|
64383
64476
|
str += `,${flatten(value2)}`;
|
|
64384
64477
|
}
|
|
64385
64478
|
str += "]";
|
|
64386
64479
|
break;
|
|
64387
64480
|
case "Map":
|
|
64388
64481
|
str = '["Map"';
|
|
64389
|
-
for (const [key, value2] of thing) {
|
|
64390
|
-
|
|
64482
|
+
for (const [key, value2] of ops.entriesOf(thing)) {
|
|
64483
|
+
const key_type = ops.typeOf(key);
|
|
64484
|
+
const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
|
|
64485
|
+
keys.push(
|
|
64486
|
+
`.get(${key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "..."})`
|
|
64487
|
+
);
|
|
64391
64488
|
str += `,${flatten(key)},${flatten(value2)}`;
|
|
64392
64489
|
keys.pop();
|
|
64393
64490
|
}
|
|
@@ -64404,19 +64501,26 @@ function run(async, value, reducers) {
|
|
|
64404
64501
|
case "Float32Array":
|
|
64405
64502
|
case "Float64Array":
|
|
64406
64503
|
case "BigInt64Array":
|
|
64407
|
-
case "BigUint64Array":
|
|
64504
|
+
case "BigUint64Array": {
|
|
64505
|
+
const info = ops.viewInfo(thing);
|
|
64506
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
64507
|
+
if (info.byteLength !== info.bufferByteLength) {
|
|
64508
|
+
str += `,${info.byteOffset},${info.length}`;
|
|
64509
|
+
}
|
|
64510
|
+
str += "]";
|
|
64511
|
+
break;
|
|
64512
|
+
}
|
|
64408
64513
|
case "DataView": {
|
|
64409
|
-
const
|
|
64410
|
-
str = '["' +
|
|
64411
|
-
if (
|
|
64412
|
-
str += `,${
|
|
64514
|
+
const info = ops.viewInfo(thing);
|
|
64515
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
64516
|
+
if (info.byteLength !== info.bufferByteLength) {
|
|
64517
|
+
str += `,${info.byteOffset},${info.byteLength}`;
|
|
64413
64518
|
}
|
|
64414
64519
|
str += "]";
|
|
64415
64520
|
break;
|
|
64416
64521
|
}
|
|
64417
64522
|
case "ArrayBuffer": {
|
|
64418
|
-
const
|
|
64419
|
-
const base643 = encode64(arraybuffer);
|
|
64523
|
+
const base643 = encode64(ops.toArrayBuffer(thing));
|
|
64420
64524
|
str = `["ArrayBuffer","${base643}"]`;
|
|
64421
64525
|
break;
|
|
64422
64526
|
}
|
|
@@ -64428,18 +64532,19 @@ function run(async, value, reducers) {
|
|
|
64428
64532
|
case "Temporal.PlainMonthDay":
|
|
64429
64533
|
case "Temporal.PlainYearMonth":
|
|
64430
64534
|
case "Temporal.ZonedDateTime":
|
|
64431
|
-
str = `["${
|
|
64535
|
+
str = `["${tag}",${stringify_string(ops.toStringValue(thing))}]`;
|
|
64432
64536
|
break;
|
|
64433
|
-
default:
|
|
64434
|
-
|
|
64537
|
+
default: {
|
|
64538
|
+
const shape = ops.shapeOf(thing);
|
|
64539
|
+
if (shape.kind === "not-plain") {
|
|
64435
64540
|
throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
|
|
64436
64541
|
}
|
|
64437
|
-
if (
|
|
64542
|
+
if (shape.kind === "symbol-keys") {
|
|
64438
64543
|
throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
|
|
64439
64544
|
}
|
|
64440
|
-
if (
|
|
64545
|
+
if (shape.kind === "null-proto") {
|
|
64441
64546
|
str = '["null"';
|
|
64442
|
-
for (const key of
|
|
64547
|
+
for (const key of shape.keys) {
|
|
64443
64548
|
if (key === "__proto__") {
|
|
64444
64549
|
throw new DevalueError(
|
|
64445
64550
|
`Cannot stringify objects with __proto__ keys`,
|
|
@@ -64449,14 +64554,14 @@ function run(async, value, reducers) {
|
|
|
64449
64554
|
);
|
|
64450
64555
|
}
|
|
64451
64556
|
keys.push(stringify_key(key));
|
|
64452
|
-
str += `,${stringify_string(key)},${flatten(thing
|
|
64557
|
+
str += `,${stringify_string(key)},${flatten(ops.get(thing, key))}`;
|
|
64453
64558
|
keys.pop();
|
|
64454
64559
|
}
|
|
64455
64560
|
str += "]";
|
|
64456
64561
|
} else {
|
|
64457
64562
|
str = "{";
|
|
64458
64563
|
let started = false;
|
|
64459
|
-
for (const key of
|
|
64564
|
+
for (const key of shape.keys) {
|
|
64460
64565
|
if (key === "__proto__") {
|
|
64461
64566
|
throw new DevalueError(
|
|
64462
64567
|
`Cannot stringify objects with __proto__ keys`,
|
|
@@ -64468,11 +64573,12 @@ function run(async, value, reducers) {
|
|
|
64468
64573
|
if (started) str += ",";
|
|
64469
64574
|
started = true;
|
|
64470
64575
|
keys.push(stringify_key(key));
|
|
64471
|
-
str += `${stringify_string(key)}:${flatten(thing
|
|
64576
|
+
str += `${stringify_string(key)}:${flatten(ops.get(thing, key))}`;
|
|
64472
64577
|
keys.pop();
|
|
64473
64578
|
}
|
|
64474
64579
|
str += "}";
|
|
64475
64580
|
}
|
|
64581
|
+
}
|
|
64476
64582
|
}
|
|
64477
64583
|
}
|
|
64478
64584
|
stringified[index2] = str;
|