@poe-platform/safe-js 0.1.454 → 0.1.455
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-IOBAVJXI.js → chunk-JB2Z6L3C.js} +2 -2
- package/dist/safe-js/chunks/{chunk-GYKATDHU.js → chunk-TZUXEKIQ.js} +87 -1
- package/dist/safe-js/chunks/{chunk-GYKATDHU.js.map → chunk-TZUXEKIQ.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-IOBAVJXI.js.map → chunk-JB2Z6L3C.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-TZUXEKIQ.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-JB2Z6L3C.js.map
|
|
@@ -30729,6 +30729,91 @@ function defineDataProperty2(target, key, value) {
|
|
|
30729
30729
|
});
|
|
30730
30730
|
}
|
|
30731
30731
|
|
|
30732
|
+
// packages/safe-js/src/interp/globals/set-operations.ts
|
|
30733
|
+
var setOperationNames = ["union", "intersection", "difference", "symmetricDifference", "isSubsetOf", "isSupersetOf", "isDisjointFrom"];
|
|
30734
|
+
function createSetOperation(name, budget) {
|
|
30735
|
+
return createSandboxClosure({
|
|
30736
|
+
guest: true,
|
|
30737
|
+
sandbox: true,
|
|
30738
|
+
name,
|
|
30739
|
+
length: 1,
|
|
30740
|
+
call: async ([other], context) => {
|
|
30741
|
+
const receiver = context?.thisValue;
|
|
30742
|
+
if (!isSandboxSet(receiver)) throw new TypeError(`Set.prototype.${name} requires a Set receiver.`);
|
|
30743
|
+
if (typeof other !== "object" || other === null) throw new TypeError("Expected a set-like object.");
|
|
30744
|
+
const read = async (object, key) => context?.getProperty !== void 0 ? context.getProperty(object, key) : readPropertyDescriptor(getSandboxPropertyDescriptor(object, key, budget) ?? { value: void 0 }, object, context);
|
|
30745
|
+
const iterationContext = { ...context, thisValue: receiver, stack: context?.stack ?? [], getProperty: read };
|
|
30746
|
+
const result = createSandboxSet([]);
|
|
30747
|
+
let iterator;
|
|
30748
|
+
let current;
|
|
30749
|
+
let has;
|
|
30750
|
+
let keys;
|
|
30751
|
+
const release = retainValues(budget, () => [receiver, other, result, current, has, keys, iterator?.retainedValue]);
|
|
30752
|
+
const checkpoint = createDataCheckpoint(budget, context);
|
|
30753
|
+
const add = (value) => {
|
|
30754
|
+
budget.visitNode();
|
|
30755
|
+
if (result.values.has(value)) return;
|
|
30756
|
+
budget.allocateCollectionEntries(result.values.size + 1);
|
|
30757
|
+
result.values.add(value);
|
|
30758
|
+
checkpoint(result, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([value])));
|
|
30759
|
+
};
|
|
30760
|
+
try {
|
|
30761
|
+
const numericSize = await sandboxNumber(await read(other, "size"), budget, context);
|
|
30762
|
+
if (Number.isNaN(numericSize)) throw new TypeError("Invalid set-like size.");
|
|
30763
|
+
const size = Math.trunc(numericSize);
|
|
30764
|
+
if (size < 0) throw new RangeError("Negative set-like size.");
|
|
30765
|
+
has = await read(other, "has");
|
|
30766
|
+
if (!isSandboxClosure(has)) throw new TypeError("Set-like has must be callable.");
|
|
30767
|
+
keys = await read(other, "keys");
|
|
30768
|
+
if (!isSandboxClosure(keys)) throw new TypeError("Set-like keys must be callable.");
|
|
30769
|
+
if (name === "isSubsetOf" && receiver.values.size > size || name === "isSupersetOf" && receiver.values.size < size) return false;
|
|
30770
|
+
const visitReceiver = name === "isSubsetOf" || (name === "intersection" || name === "difference" || name === "isDisjointFrom") && receiver.values.size <= size;
|
|
30771
|
+
if (name === "union" || name === "symmetricDifference")
|
|
30772
|
+
iterator = await getSandboxIteratorFromMethod(other, keys, budget, iterationContext);
|
|
30773
|
+
if (name === "union" || name === "symmetricDifference" || name === "difference")
|
|
30774
|
+
for (const value of receiver.values) add(value);
|
|
30775
|
+
if (visitReceiver) {
|
|
30776
|
+
const target = name === "difference" ? result : receiver;
|
|
30777
|
+
const cursor = enterKeyedCollectionCallback(target, target.values, budget);
|
|
30778
|
+
try {
|
|
30779
|
+
for (let next = cursor.next(); !next.done; next = cursor.next()) {
|
|
30780
|
+
current = next.value;
|
|
30781
|
+
const found = Boolean(await invokeBuiltinClosure(has, [current], budget, context, other));
|
|
30782
|
+
if (name === "isSubsetOf" && !found || name === "isDisjointFrom" && found) return false;
|
|
30783
|
+
if (name === "intersection" && found) add(current);
|
|
30784
|
+
if (name === "difference" && found) result.values.delete(current);
|
|
30785
|
+
current = void 0;
|
|
30786
|
+
}
|
|
30787
|
+
} finally {
|
|
30788
|
+
cursor.leave();
|
|
30789
|
+
}
|
|
30790
|
+
} else {
|
|
30791
|
+
iterator ??= await getSandboxIteratorFromMethod(other, keys, budget, iterationContext);
|
|
30792
|
+
while (true) {
|
|
30793
|
+
budget.visitNode();
|
|
30794
|
+
const next = await iterator.next();
|
|
30795
|
+
if ((await readIteratorResult(iterator, next, "done")).value) break;
|
|
30796
|
+
current = (await readIteratorResult(iterator, next, "value")).value;
|
|
30797
|
+
const found = receiver.values.has(current);
|
|
30798
|
+
if (name === "isSupersetOf" && !found || name === "isDisjointFrom" && found) {
|
|
30799
|
+
await closeIterator(iterator);
|
|
30800
|
+
return false;
|
|
30801
|
+
}
|
|
30802
|
+
if (name === "union" || name === "intersection" && found || name === "symmetricDifference" && !found) add(current);
|
|
30803
|
+
else if (name === "difference" || name === "symmetricDifference" && found) result.values.delete(current);
|
|
30804
|
+
current = void 0;
|
|
30805
|
+
}
|
|
30806
|
+
}
|
|
30807
|
+
if (name === "isSubsetOf" || name === "isSupersetOf" || name === "isDisjointFrom") return true;
|
|
30808
|
+
checkpoint(result, 0, true);
|
|
30809
|
+
return allocateProducedSandboxValue(result, budget);
|
|
30810
|
+
} finally {
|
|
30811
|
+
release();
|
|
30812
|
+
}
|
|
30813
|
+
}
|
|
30814
|
+
});
|
|
30815
|
+
}
|
|
30816
|
+
|
|
30732
30817
|
// packages/safe-js/src/interp/globals/collection-prototypes.ts
|
|
30733
30818
|
function installCollectionPrototypes(budget, mapConstructor, setConstructor) {
|
|
30734
30819
|
const mapMethods = Object.fromEntries([...mapMethodNames].map((name) => [name, createSandboxClosure({
|
|
@@ -30760,6 +30845,7 @@ function installCollectionPrototypes(budget, mapConstructor, setConstructor) {
|
|
|
30760
30845
|
}
|
|
30761
30846
|
})]));
|
|
30762
30847
|
setMethods.keys = setMethods.values;
|
|
30848
|
+
for (const name of setOperationNames) setMethods[name] = createSetOperation(name, budget);
|
|
30763
30849
|
const mapSize = createSandboxClosure({
|
|
30764
30850
|
guest: true,
|
|
30765
30851
|
sandbox: true,
|
|
@@ -55895,4 +55981,4 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
55895
55981
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
55896
55982
|
|
|
55897
55983
|
*/
|
|
55898
|
-
//# sourceMappingURL=chunk-
|
|
55984
|
+
//# sourceMappingURL=chunk-TZUXEKIQ.js.map
|