@poe-platform/safe-js 0.1.310 → 0.1.312
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/safe-js/chunks/{chunk-S2EJB3SL.js → chunk-DXPIMJKO.js} +2 -2
- package/dist/safe-js/chunks/{chunk-K33MF7AA.js → chunk-UKPTA2FY.js} +127 -2
- package/dist/safe-js/chunks/{chunk-K33MF7AA.js.map → chunk-UKPTA2FY.js.map} +3 -3
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-S2EJB3SL.js.map → chunk-DXPIMJKO.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-UKPTA2FY.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-DXPIMJKO.js.map
|
|
@@ -9551,6 +9551,8 @@ async function acquireSandboxIterator(value, budget, context, asyncProtocol = fa
|
|
|
9551
9551
|
const iterator = await invokeBuiltinClosure(factory, [], budget, context, value);
|
|
9552
9552
|
if (typeof iterator !== "object" && typeof iterator !== "function" || iterator === null)
|
|
9553
9553
|
throw new TypeError("Iterator must be an object.");
|
|
9554
|
+
if (!asyncProtocol && isSandboxGenerator(iterator) && !iterator.async && !hasExplicitSandboxPrototype(iterator) && getSandboxPropertyDescriptor(iterator, "next", budget) === void 0)
|
|
9555
|
+
return getSandboxIterator(iterator, budget, context);
|
|
9554
9556
|
const next = await context.getProperty(iterator, "next");
|
|
9555
9557
|
return guestIterator(iterator, next, asyncProtocol, budget, context, signal);
|
|
9556
9558
|
}
|
|
@@ -14555,7 +14557,7 @@ function createFloat32ArrayGlobal(budget, nativePrototype = false) {
|
|
|
14555
14557
|
const prototype = candidate !== null && typeof candidate === "object" ? candidate : float32Prototypes.get(budget);
|
|
14556
14558
|
const release = retainValues(budget, () => [prototype, ...args]);
|
|
14557
14559
|
try {
|
|
14558
|
-
const result = allocateFloat32Array(args[0], budget);
|
|
14560
|
+
const result = args[0] !== null && typeof args[0] === "object" && !isFloat32Array(args[0]) ? await allocateFloat32Input(args[0], budget, context) : allocateFloat32Array(args[0], budget);
|
|
14559
14561
|
setSandboxPrototype(result, prototype, budget);
|
|
14560
14562
|
return result;
|
|
14561
14563
|
} finally {
|
|
@@ -14567,6 +14569,57 @@ function createFloat32ArrayGlobal(budget, nativePrototype = false) {
|
|
|
14567
14569
|
constructors.add(constructor);
|
|
14568
14570
|
return constructor;
|
|
14569
14571
|
}
|
|
14572
|
+
async function allocateFloat32Input(source, budget, context) {
|
|
14573
|
+
const callerContext = context;
|
|
14574
|
+
const bridge = {
|
|
14575
|
+
...callerContext,
|
|
14576
|
+
stack: callerContext?.stack ?? [],
|
|
14577
|
+
thisValue: void 0,
|
|
14578
|
+
getProperty: callerContext?.getProperty ?? ((value, key) => {
|
|
14579
|
+
const descriptor = getSandboxPropertyDescriptor(value, key, budget);
|
|
14580
|
+
return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, bridge);
|
|
14581
|
+
}),
|
|
14582
|
+
invokeClosure: callerContext?.invokeClosure ?? ((callee, values2, receiver, construct) => invokeBuiltinClosure(callee, values2, budget, callerContext, receiver, construct))
|
|
14583
|
+
};
|
|
14584
|
+
const values = [];
|
|
14585
|
+
let iterator;
|
|
14586
|
+
let current;
|
|
14587
|
+
let result;
|
|
14588
|
+
const release = retainValues(budget, () => [source, values, iterator?.retainedValue, current, result]);
|
|
14589
|
+
const checkData = createDataCheckpoint(budget, bridge);
|
|
14590
|
+
try {
|
|
14591
|
+
iterator = await acquireSandboxIterator(source, budget, bridge);
|
|
14592
|
+
let length;
|
|
14593
|
+
if (iterator !== void 0) {
|
|
14594
|
+
while (true) {
|
|
14595
|
+
budget.visitNode();
|
|
14596
|
+
const next = await iterator.next();
|
|
14597
|
+
if (typeof next !== "object" || next === null) throw new TypeError("Iterator result must be an object.");
|
|
14598
|
+
if ((await readIteratorResult(iterator, next, "done")).value) break;
|
|
14599
|
+
current = (await readIteratorResult(iterator, next, "value")).value;
|
|
14600
|
+
budget.allocateArrayLength(values.length + 1);
|
|
14601
|
+
values.push(current);
|
|
14602
|
+
checkData(values, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([current])));
|
|
14603
|
+
}
|
|
14604
|
+
length = values.length;
|
|
14605
|
+
} else {
|
|
14606
|
+
current = await bridge.getProperty(source, "length");
|
|
14607
|
+
const number = await sandboxNumber(current, budget, bridge);
|
|
14608
|
+
length = Number.isNaN(number) || number <= 0 ? 0 : Math.min(Math.trunc(number), Number.MAX_SAFE_INTEGER);
|
|
14609
|
+
}
|
|
14610
|
+
checkFloat32Allocation(length, budget);
|
|
14611
|
+
result = new Float32Array(length);
|
|
14612
|
+
checkData(result, 0, true);
|
|
14613
|
+
for (let index = 0; index < length; index++) {
|
|
14614
|
+
budget.visitNode();
|
|
14615
|
+
current = iterator === void 0 ? await bridge.getProperty(source, String(index)) : values[index];
|
|
14616
|
+
result[index] = await sandboxNumber(current, budget, bridge);
|
|
14617
|
+
}
|
|
14618
|
+
return result;
|
|
14619
|
+
} finally {
|
|
14620
|
+
release();
|
|
14621
|
+
}
|
|
14622
|
+
}
|
|
14570
14623
|
function allocateFloat32Array(source, budget) {
|
|
14571
14624
|
if (Array.isArray(source) || isFloat32Array(source)) {
|
|
14572
14625
|
const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
|
|
@@ -14604,6 +14657,78 @@ function createFloat32ArrayPrototypes(budget, constructor) {
|
|
|
14604
14657
|
construct: abstractCall
|
|
14605
14658
|
});
|
|
14606
14659
|
Object.defineProperty(materializeFunctionProperties(typedArray), "prototype", { value: shared, writable: false });
|
|
14660
|
+
Object.defineProperty(materializeFunctionProperties(typedArray), "from", {
|
|
14661
|
+
writable: true,
|
|
14662
|
+
configurable: true,
|
|
14663
|
+
value: createSandboxClosure({
|
|
14664
|
+
guest: true,
|
|
14665
|
+
sandbox: true,
|
|
14666
|
+
name: "from",
|
|
14667
|
+
length: 1,
|
|
14668
|
+
call: async (args, context) => {
|
|
14669
|
+
const target = context?.thisValue;
|
|
14670
|
+
const [source, mapper, receiver] = args;
|
|
14671
|
+
if (!isSandboxClosure(target) || target.construct === void 0)
|
|
14672
|
+
throw new TypeError("TypedArray.from requires a constructor receiver.");
|
|
14673
|
+
if (mapper !== void 0 && !isSandboxClosure(mapper))
|
|
14674
|
+
throw new TypeError("TypedArray.from mapper must be callable.");
|
|
14675
|
+
if (source === null || source === void 0)
|
|
14676
|
+
throw new TypeError("TypedArray.from requires a non-null source.");
|
|
14677
|
+
const callerContext = context;
|
|
14678
|
+
context = {
|
|
14679
|
+
...callerContext,
|
|
14680
|
+
stack: callerContext?.stack ?? [],
|
|
14681
|
+
thisValue: target,
|
|
14682
|
+
getProperty: callerContext?.getProperty ?? ((value, key) => {
|
|
14683
|
+
const descriptor = getSandboxPropertyDescriptor(value, key, budget);
|
|
14684
|
+
return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, context);
|
|
14685
|
+
}),
|
|
14686
|
+
invokeClosure: callerContext?.invokeClosure ?? ((callee, values2, thisValue, construct) => invokeBuiltinClosure(callee, values2, budget, callerContext, thisValue, construct))
|
|
14687
|
+
};
|
|
14688
|
+
let result;
|
|
14689
|
+
let current;
|
|
14690
|
+
let iterator;
|
|
14691
|
+
const values = [];
|
|
14692
|
+
const release = retainValues(budget, () => [target, result, current, iterator?.retainedValue, values, ...args]);
|
|
14693
|
+
const checkData = createDataCheckpoint(budget, context);
|
|
14694
|
+
const read = (key) => context?.getProperty === void 0 ? getSandboxDataProperty(source, key, budget) : context.getProperty(source, key);
|
|
14695
|
+
try {
|
|
14696
|
+
iterator = await acquireSandboxIterator(source, budget, context);
|
|
14697
|
+
let length;
|
|
14698
|
+
if (iterator !== void 0) {
|
|
14699
|
+
while (true) {
|
|
14700
|
+
budget.visitNode();
|
|
14701
|
+
const next = await iterator.next();
|
|
14702
|
+
if (typeof next !== "object" || next === null) throw new TypeError("Iterator result must be an object.");
|
|
14703
|
+
if ((await readIteratorResult(iterator, next, "done")).value) break;
|
|
14704
|
+
current = (await readIteratorResult(iterator, next, "value")).value;
|
|
14705
|
+
budget.allocateArrayLength(values.length + 1);
|
|
14706
|
+
values.push(current);
|
|
14707
|
+
checkData(values, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([current])));
|
|
14708
|
+
}
|
|
14709
|
+
length = values.length;
|
|
14710
|
+
} else {
|
|
14711
|
+
const number = await sandboxNumber(await read("length"), budget, context);
|
|
14712
|
+
length = Number.isNaN(number) || number <= 0 ? 0 : Math.min(Math.trunc(number), Number.MAX_SAFE_INTEGER);
|
|
14713
|
+
}
|
|
14714
|
+
result = await invokeBuiltinClosure(target, [length], budget, context, void 0, true);
|
|
14715
|
+
if (!isFloat32Array(result) || float32Storage(result).length < length)
|
|
14716
|
+
throw new TypeError("TypedArray.from constructor must return sufficient typed storage.");
|
|
14717
|
+
checkData(result, 0, true);
|
|
14718
|
+
for (let index = 0; index < length; index++) {
|
|
14719
|
+
budget.visitNode();
|
|
14720
|
+
current = iterator === void 0 ? await read(String(index)) : values[index];
|
|
14721
|
+
if (mapper !== void 0)
|
|
14722
|
+
current = await invokeBuiltinClosure(mapper, [current, index], budget, context, receiver);
|
|
14723
|
+
result[index] = await sandboxNumber(current, budget, context);
|
|
14724
|
+
}
|
|
14725
|
+
return result;
|
|
14726
|
+
} finally {
|
|
14727
|
+
release();
|
|
14728
|
+
}
|
|
14729
|
+
}
|
|
14730
|
+
})
|
|
14731
|
+
});
|
|
14607
14732
|
Object.defineProperty(materializeFunctionProperties(typedArray), "of", {
|
|
14608
14733
|
writable: true,
|
|
14609
14734
|
configurable: true,
|
|
@@ -41667,4 +41792,4 @@ export {
|
|
|
41667
41792
|
FileSnapshotBackend,
|
|
41668
41793
|
run
|
|
41669
41794
|
};
|
|
41670
|
-
//# sourceMappingURL=chunk-
|
|
41795
|
+
//# sourceMappingURL=chunk-UKPTA2FY.js.map
|