@poe-platform/safe-js 0.1.453 → 0.1.454
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-E2VDSNJC.js → chunk-GYKATDHU.js} +80 -1
- package/dist/safe-js/chunks/{chunk-E2VDSNJC.js.map → chunk-GYKATDHU.js.map} +3 -3
- package/dist/safe-js/chunks/{chunk-CEBPHXBL.js → chunk-IOBAVJXI.js} +2 -2
- 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-CEBPHXBL.js.map → chunk-IOBAVJXI.js.map} +0 -0
|
@@ -19606,6 +19606,79 @@ function relativeIndex(numeric, length) {
|
|
|
19606
19606
|
return integer2 < 0 ? Math.max(length + integer2, 0) : Math.min(integer2, length);
|
|
19607
19607
|
}
|
|
19608
19608
|
|
|
19609
|
+
// packages/safe-js/src/interp/globals/group-by.ts
|
|
19610
|
+
function createGroupBy(budget, keyMode) {
|
|
19611
|
+
return createSandboxClosure({
|
|
19612
|
+
guest: true,
|
|
19613
|
+
sandbox: true,
|
|
19614
|
+
name: "groupBy",
|
|
19615
|
+
length: 2,
|
|
19616
|
+
call: async ([items, callback], context) => {
|
|
19617
|
+
if (items === null || items === void 0) throw new TypeError("groupBy requires an iterable.");
|
|
19618
|
+
if (!isSandboxClosure(callback)) throw new TypeError("groupBy requires a callable callback.");
|
|
19619
|
+
const iterator = context === void 0 ? getSandboxIterator(items, budget) : await acquireSandboxIterator(items, budget, context);
|
|
19620
|
+
if (iterator === void 0) throw new TypeError("groupBy requires an iterable.");
|
|
19621
|
+
const groups = createSandboxMap([]);
|
|
19622
|
+
let value;
|
|
19623
|
+
let key;
|
|
19624
|
+
const release = retainValues(budget, () => [groups, callback, iterator.retainedValue, value, key]);
|
|
19625
|
+
const checkpoint = createDataCheckpoint(budget, context);
|
|
19626
|
+
const closeOnThrow = async (error) => {
|
|
19627
|
+
try {
|
|
19628
|
+
await closeIterator(iterator, true);
|
|
19629
|
+
} catch (closeError) {
|
|
19630
|
+
if (!isFatalSandboxError(error) && isFatalSandboxError(closeError)) throw closeError;
|
|
19631
|
+
}
|
|
19632
|
+
throw error;
|
|
19633
|
+
};
|
|
19634
|
+
try {
|
|
19635
|
+
let index = 0;
|
|
19636
|
+
while (true) {
|
|
19637
|
+
try {
|
|
19638
|
+
budget.visitNode();
|
|
19639
|
+
if (index >= Number.MAX_SAFE_INTEGER) throw new TypeError("groupBy input exceeds the maximum index.");
|
|
19640
|
+
} catch (error) {
|
|
19641
|
+
await closeOnThrow(error);
|
|
19642
|
+
}
|
|
19643
|
+
const next = await iterator.next();
|
|
19644
|
+
if ((await readIteratorResult(iterator, next, "done")).value) break;
|
|
19645
|
+
value = (await readIteratorResult(iterator, next, "value")).value;
|
|
19646
|
+
try {
|
|
19647
|
+
key = await invokeBuiltinClosure(callback, [value, index], budget, context, void 0);
|
|
19648
|
+
if (keyMode === "property") key = await toPropertyKey(key, budget, context);
|
|
19649
|
+
let group = groups.entries.get(key);
|
|
19650
|
+
const added = group === void 0;
|
|
19651
|
+
if (group === void 0) {
|
|
19652
|
+
budget.allocateCollectionEntries(groups.entries.size + 1);
|
|
19653
|
+
group = [];
|
|
19654
|
+
groups.entries.set(key, group);
|
|
19655
|
+
}
|
|
19656
|
+
budget.allocateArrayLength(group.length + 1);
|
|
19657
|
+
group.push(value);
|
|
19658
|
+
const growth = 1 + (added ? 2 : 0) + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData(added ? [key, value] : [value]));
|
|
19659
|
+
checkpoint(groups, growth);
|
|
19660
|
+
value = key = void 0;
|
|
19661
|
+
index++;
|
|
19662
|
+
} catch (error) {
|
|
19663
|
+
await closeOnThrow(error);
|
|
19664
|
+
}
|
|
19665
|
+
}
|
|
19666
|
+
checkpoint(groups, 0, true);
|
|
19667
|
+
if (keyMode === "identity") return allocateProducedSandboxValue(groups, budget);
|
|
19668
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
19669
|
+
setSandboxPrototype(result, null, budget);
|
|
19670
|
+
for (const [property, elements] of groups.entries) {
|
|
19671
|
+
budget.visitNode();
|
|
19672
|
+
defineOwnDataProperty(result, property, elements);
|
|
19673
|
+
}
|
|
19674
|
+
return allocateProducedSandboxValue(result, budget);
|
|
19675
|
+
} finally {
|
|
19676
|
+
release();
|
|
19677
|
+
}
|
|
19678
|
+
}
|
|
19679
|
+
});
|
|
19680
|
+
}
|
|
19681
|
+
|
|
19609
19682
|
// packages/safe-js/src/interp/globals/numeric-parsers.ts
|
|
19610
19683
|
function createNumericParsers(budget) {
|
|
19611
19684
|
return {
|
|
@@ -22030,6 +22103,7 @@ function createObjectArrayGlobals(options) {
|
|
|
22030
22103
|
call: ([left, right]) => Reflect.apply(Object.is, Object, [left, right]),
|
|
22031
22104
|
name: "is"
|
|
22032
22105
|
}),
|
|
22106
|
+
groupBy: createGroupBy(options.budget, "property"),
|
|
22033
22107
|
fromEntries: createSandboxClosure({
|
|
22034
22108
|
sandbox: true,
|
|
22035
22109
|
call: ([value], context) => {
|
|
@@ -30835,6 +30909,11 @@ function createCollectionGlobals(options) {
|
|
|
30835
30909
|
name: "Set"
|
|
30836
30910
|
});
|
|
30837
30911
|
mapConstructors.add(mapConstructor);
|
|
30912
|
+
Object.defineProperty(materializeFunctionProperties(mapConstructor), "groupBy", {
|
|
30913
|
+
value: createGroupBy(options.budget, "identity"),
|
|
30914
|
+
writable: true,
|
|
30915
|
+
configurable: true
|
|
30916
|
+
});
|
|
30838
30917
|
setConstructors.add(setConstructor);
|
|
30839
30918
|
installCollectionPrototypes(options.budget, mapConstructor, setConstructor);
|
|
30840
30919
|
return { Map: mapConstructor, Set: setConstructor };
|
|
@@ -55816,4 +55895,4 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
55816
55895
|
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.
|
|
55817
55896
|
|
|
55818
55897
|
*/
|
|
55819
|
-
//# sourceMappingURL=chunk-
|
|
55898
|
+
//# sourceMappingURL=chunk-GYKATDHU.js.map
|