@poe-platform/safe-js 0.1.271 → 0.1.272
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-XEN2XAGO.js → chunk-3ANG72OY.js} +2 -2
- package/dist/safe-js/chunks/{chunk-KAZ53U6F.js → chunk-5AXKUJ6N.js} +183 -89
- package/dist/safe-js/chunks/chunk-5AXKUJ6N.js.map +7 -0
- 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-KAZ53U6F.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-XEN2XAGO.js.map → chunk-3ANG72OY.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-5AXKUJ6N.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-3ANG72OY.js.map
|
|
@@ -11677,87 +11677,108 @@ function createPromiseGlobals(options) {
|
|
|
11677
11677
|
}
|
|
11678
11678
|
return pending;
|
|
11679
11679
|
};
|
|
11680
|
+
const species = createSandboxClosure({
|
|
11681
|
+
guest: true,
|
|
11682
|
+
sandbox: true,
|
|
11683
|
+
name: "get [Symbol.species]",
|
|
11684
|
+
length: 0,
|
|
11685
|
+
call: (_args, context) => context?.thisValue
|
|
11686
|
+
});
|
|
11687
|
+
const properties = {
|
|
11688
|
+
prototype,
|
|
11689
|
+
all: createSandboxClosure({
|
|
11690
|
+
sandbox: true,
|
|
11691
|
+
call: ([values], context) => settleIterable(
|
|
11692
|
+
values,
|
|
11693
|
+
"all",
|
|
11694
|
+
options.budget,
|
|
11695
|
+
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11696
|
+
context
|
|
11697
|
+
),
|
|
11698
|
+
name: "all"
|
|
11699
|
+
}),
|
|
11700
|
+
race: createSandboxClosure({
|
|
11701
|
+
sandbox: true,
|
|
11702
|
+
call: ([values], context) => settleIterable(
|
|
11703
|
+
values,
|
|
11704
|
+
"race",
|
|
11705
|
+
options.budget,
|
|
11706
|
+
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11707
|
+
context
|
|
11708
|
+
),
|
|
11709
|
+
name: "race"
|
|
11710
|
+
}),
|
|
11711
|
+
allSettled: createSandboxClosure({
|
|
11712
|
+
sandbox: true,
|
|
11713
|
+
call: ([values], context) => settleIterable(
|
|
11714
|
+
values,
|
|
11715
|
+
"allSettled",
|
|
11716
|
+
options.budget,
|
|
11717
|
+
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11718
|
+
context
|
|
11719
|
+
),
|
|
11720
|
+
name: "allSettled"
|
|
11721
|
+
}),
|
|
11722
|
+
any: createSandboxClosure({
|
|
11723
|
+
sandbox: true,
|
|
11724
|
+
call: ([values], context) => settleIterable(
|
|
11725
|
+
values,
|
|
11726
|
+
"any",
|
|
11727
|
+
options.budget,
|
|
11728
|
+
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11729
|
+
context
|
|
11730
|
+
),
|
|
11731
|
+
name: "any"
|
|
11732
|
+
}),
|
|
11733
|
+
resolve: createSandboxClosure({
|
|
11734
|
+
sandbox: true,
|
|
11735
|
+
call: ([value], context) => {
|
|
11736
|
+
const constructor = context === void 0 ? promiseConstructor : context.thisValue;
|
|
11737
|
+
if (typeof constructor !== "object" || constructor === null) {
|
|
11738
|
+
throw new TypeError("Promise.resolve requires an object receiver.");
|
|
11739
|
+
}
|
|
11740
|
+
const finish = (actualConstructor2) => {
|
|
11741
|
+
if (isSandboxPromise(value) && actualConstructor2 === constructor) return value;
|
|
11742
|
+
return isSandboxPromiseConstructor(constructor) ? createSandboxPromise(resolveSandboxValue(value, { budget: options.budget })) : settleConstructedPromise(constructor, value, "fulfilled", options.budget, context);
|
|
11743
|
+
};
|
|
11744
|
+
if (!isSandboxPromise(value)) return finish(void 0);
|
|
11745
|
+
const descriptor = getSandboxPropertyDescriptor(value, "constructor", options.budget);
|
|
11746
|
+
const actualConstructor = descriptor === void 0 ? getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
|
|
11747
|
+
return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
|
|
11748
|
+
},
|
|
11749
|
+
name: "resolve"
|
|
11750
|
+
}),
|
|
11751
|
+
reject: createSandboxClosure({
|
|
11752
|
+
sandbox: true,
|
|
11753
|
+
call: ([reason], context) => {
|
|
11754
|
+
const constructor = context === void 0 ? promiseConstructor : context.thisValue;
|
|
11755
|
+
return isSandboxPromiseConstructor(constructor) ? createRejectedSandboxPromise(reason, options.budget, context?.span) : settleConstructedPromise(constructor, reason, "rejected", options.budget, context);
|
|
11756
|
+
},
|
|
11757
|
+
name: "reject"
|
|
11758
|
+
})
|
|
11759
|
+
};
|
|
11680
11760
|
const promiseConstructor = createSandboxClosure({
|
|
11761
|
+
guest: true,
|
|
11681
11762
|
sandbox: true,
|
|
11682
11763
|
name: "Promise",
|
|
11764
|
+
length: 1,
|
|
11683
11765
|
construct,
|
|
11684
11766
|
call: () => {
|
|
11685
11767
|
throw new TypeError("Constructor Promise requires 'new'.");
|
|
11686
|
-
},
|
|
11687
|
-
properties: {
|
|
11688
|
-
prototype,
|
|
11689
|
-
all: createSandboxClosure({
|
|
11690
|
-
sandbox: true,
|
|
11691
|
-
call: ([values], context) => settleIterable(
|
|
11692
|
-
values,
|
|
11693
|
-
"all",
|
|
11694
|
-
options.budget,
|
|
11695
|
-
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11696
|
-
context
|
|
11697
|
-
),
|
|
11698
|
-
name: "all"
|
|
11699
|
-
}),
|
|
11700
|
-
race: createSandboxClosure({
|
|
11701
|
-
sandbox: true,
|
|
11702
|
-
call: ([values], context) => settleIterable(
|
|
11703
|
-
values,
|
|
11704
|
-
"race",
|
|
11705
|
-
options.budget,
|
|
11706
|
-
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11707
|
-
context
|
|
11708
|
-
),
|
|
11709
|
-
name: "race"
|
|
11710
|
-
}),
|
|
11711
|
-
allSettled: createSandboxClosure({
|
|
11712
|
-
sandbox: true,
|
|
11713
|
-
call: ([values], context) => settleIterable(
|
|
11714
|
-
values,
|
|
11715
|
-
"allSettled",
|
|
11716
|
-
options.budget,
|
|
11717
|
-
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11718
|
-
context
|
|
11719
|
-
),
|
|
11720
|
-
name: "allSettled"
|
|
11721
|
-
}),
|
|
11722
|
-
any: createSandboxClosure({
|
|
11723
|
-
sandbox: true,
|
|
11724
|
-
call: ([values], context) => settleIterable(
|
|
11725
|
-
values,
|
|
11726
|
-
"any",
|
|
11727
|
-
options.budget,
|
|
11728
|
-
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11729
|
-
context
|
|
11730
|
-
),
|
|
11731
|
-
name: "any"
|
|
11732
|
-
}),
|
|
11733
|
-
resolve: createSandboxClosure({
|
|
11734
|
-
sandbox: true,
|
|
11735
|
-
call: ([value], context) => {
|
|
11736
|
-
const constructor = context === void 0 ? promiseConstructor : context.thisValue;
|
|
11737
|
-
if (typeof constructor !== "object" || constructor === null) {
|
|
11738
|
-
throw new TypeError("Promise.resolve requires an object receiver.");
|
|
11739
|
-
}
|
|
11740
|
-
const finish = (actualConstructor2) => {
|
|
11741
|
-
if (isSandboxPromise(value) && actualConstructor2 === constructor) return value;
|
|
11742
|
-
return isSandboxPromiseConstructor(constructor) ? createSandboxPromise(resolveSandboxValue(value, { budget: options.budget })) : settleConstructedPromise(constructor, value, "fulfilled", options.budget, context);
|
|
11743
|
-
};
|
|
11744
|
-
if (!isSandboxPromise(value)) return finish(void 0);
|
|
11745
|
-
const descriptor = getSandboxPropertyDescriptor(value, "constructor", options.budget);
|
|
11746
|
-
const actualConstructor = descriptor === void 0 ? getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
|
|
11747
|
-
return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
|
|
11748
|
-
},
|
|
11749
|
-
name: "resolve"
|
|
11750
|
-
}),
|
|
11751
|
-
reject: createSandboxClosure({
|
|
11752
|
-
sandbox: true,
|
|
11753
|
-
call: ([reason], context) => {
|
|
11754
|
-
const constructor = context === void 0 ? promiseConstructor : context.thisValue;
|
|
11755
|
-
return isSandboxPromiseConstructor(constructor) ? createRejectedSandboxPromise(reason, options.budget, context?.span) : settleConstructedPromise(constructor, reason, "rejected", options.budget, context);
|
|
11756
|
-
},
|
|
11757
|
-
name: "reject"
|
|
11758
|
-
})
|
|
11759
11768
|
}
|
|
11760
11769
|
});
|
|
11770
|
+
const constructorProperties = materializeFunctionProperties(promiseConstructor);
|
|
11771
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
11772
|
+
Object.defineProperty(constructorProperties, key, {
|
|
11773
|
+
value,
|
|
11774
|
+
writable: key !== "prototype",
|
|
11775
|
+
configurable: key !== "prototype"
|
|
11776
|
+
});
|
|
11777
|
+
}
|
|
11778
|
+
Object.defineProperty(constructorProperties, Symbol.species, {
|
|
11779
|
+
get: accessorAdapter(species, "get"),
|
|
11780
|
+
configurable: true
|
|
11781
|
+
});
|
|
11761
11782
|
Object.defineProperty(prototype, "constructor", {
|
|
11762
11783
|
value: promiseConstructor,
|
|
11763
11784
|
writable: true,
|
|
@@ -11765,9 +11786,12 @@ function createPromiseGlobals(options) {
|
|
|
11765
11786
|
});
|
|
11766
11787
|
promiseConstructors.add(promiseConstructor);
|
|
11767
11788
|
intrinsicPromiseConstructors.set(options.budget, promiseConstructor);
|
|
11789
|
+
registerIntrinsicFunction(options.budget, species);
|
|
11790
|
+
registerIntrinsicFunction(options.budget, promiseConstructor);
|
|
11768
11791
|
return { Promise: promiseConstructor };
|
|
11769
11792
|
}
|
|
11770
11793
|
function getPromiseMember(property, budget) {
|
|
11794
|
+
if (!intrinsicPromiseConstructors.has(budget)) createPromiseGlobals({ budget });
|
|
11771
11795
|
const prototype = getPromisePrototype(budget);
|
|
11772
11796
|
return Object.hasOwn(prototype, property) ? prototype[property] : void 0;
|
|
11773
11797
|
}
|
|
@@ -11842,7 +11866,23 @@ function getPromisePrototype(budget) {
|
|
|
11842
11866
|
const target = context?.thisValue;
|
|
11843
11867
|
if (!isSandboxPromise(target))
|
|
11844
11868
|
throw new TypeError("Promise.then requires a promise receiver.");
|
|
11845
|
-
const finish = () => {
|
|
11869
|
+
const finish = (constructor2) => {
|
|
11870
|
+
if (!isSandboxPromiseConstructor(constructor2)) {
|
|
11871
|
+
return createPromiseCapability(constructor2, budget, context).then((capability) => {
|
|
11872
|
+
observeSandboxPromise(target);
|
|
11873
|
+
createSandboxPromise(target.promise.then(
|
|
11874
|
+
(value) => {
|
|
11875
|
+
consumeSettledHostCall(target);
|
|
11876
|
+
return runCapabilityReaction(onFulfilled, value, "fulfilled", capability, budget, context);
|
|
11877
|
+
},
|
|
11878
|
+
(reason) => {
|
|
11879
|
+
consumeSettledHostCall(target);
|
|
11880
|
+
return runCapabilityReaction(onRejected, reason, "rejected", capability, budget, context);
|
|
11881
|
+
}
|
|
11882
|
+
));
|
|
11883
|
+
return capability.promise;
|
|
11884
|
+
});
|
|
11885
|
+
}
|
|
11846
11886
|
observeSandboxPromise(target);
|
|
11847
11887
|
const chained = createSandboxPromise(
|
|
11848
11888
|
target.promise.then(
|
|
@@ -11858,8 +11898,8 @@ function getPromisePrototype(budget) {
|
|
|
11858
11898
|
);
|
|
11859
11899
|
return chained;
|
|
11860
11900
|
};
|
|
11861
|
-
const
|
|
11862
|
-
return
|
|
11901
|
+
const constructor = getPromiseSpeciesConstructor(target, prototype, budget, context);
|
|
11902
|
+
return constructor instanceof Promise ? constructor.then(finish) : finish(constructor);
|
|
11863
11903
|
},
|
|
11864
11904
|
name: "then"
|
|
11865
11905
|
}),
|
|
@@ -11890,13 +11930,13 @@ function getPromisePrototype(budget) {
|
|
|
11890
11930
|
if (typeof target !== "object" || target === null) {
|
|
11891
11931
|
throw new TypeError("Promise.finally requires an object receiver.");
|
|
11892
11932
|
}
|
|
11893
|
-
const invoke = (then) => {
|
|
11933
|
+
const invoke = (then, constructor2) => {
|
|
11894
11934
|
if (!isSandboxClosure(then))
|
|
11895
11935
|
throw new TypeError("Promise.finally requires a callable then.");
|
|
11896
11936
|
const handlers = isSandboxClosure(onFinally) ? ["fulfilled", "rejected"].map(
|
|
11897
11937
|
(state) => createSandboxClosure({
|
|
11898
11938
|
sandbox: true,
|
|
11899
|
-
retainedValues: () => [onFinally],
|
|
11939
|
+
retainedValues: () => [onFinally, constructor2],
|
|
11900
11940
|
call: async ([value]) => {
|
|
11901
11941
|
const result = await callPromiseClosure(
|
|
11902
11942
|
onFinally,
|
|
@@ -11905,8 +11945,16 @@ function getPromisePrototype(budget) {
|
|
|
11905
11945
|
budget,
|
|
11906
11946
|
context
|
|
11907
11947
|
);
|
|
11908
|
-
|
|
11909
|
-
const
|
|
11948
|
+
let pending;
|
|
11949
|
+
const actualConstructor = isSandboxPromise(result) ? await readPromiseProperty(result, "constructor", prototype, budget, context) : void 0;
|
|
11950
|
+
if (isSandboxPromise(result) && actualConstructor === constructor2) {
|
|
11951
|
+
pending = result;
|
|
11952
|
+
} else if (isSandboxPromiseConstructor(constructor2)) {
|
|
11953
|
+
pending = createSandboxPromise(resolveSandboxValue(result, { budget }));
|
|
11954
|
+
} else {
|
|
11955
|
+
pending = await settleConstructedPromise(constructor2, result, "fulfilled", budget, context);
|
|
11956
|
+
}
|
|
11957
|
+
const cleanupThen = await readPromiseProperty(pending, "then", prototype, budget, context);
|
|
11910
11958
|
if (!isSandboxClosure(cleanupThen))
|
|
11911
11959
|
throw new TypeError("Promise cleanup requires a callable then.");
|
|
11912
11960
|
return callPromiseClosure(
|
|
@@ -11935,13 +11983,13 @@ function getPromisePrototype(budget) {
|
|
|
11935
11983
|
newTarget: void 0
|
|
11936
11984
|
});
|
|
11937
11985
|
};
|
|
11938
|
-
const finish = () => {
|
|
11986
|
+
const finish = (constructor2) => {
|
|
11939
11987
|
const descriptor = getSandboxPropertyDescriptor(target, "then", budget);
|
|
11940
11988
|
const then = descriptor === void 0 ? readPromiseReceiverProperty(target, "then", prototype, context) : readPropertyDescriptor(descriptor, target, context, true);
|
|
11941
|
-
return then instanceof Promise ? then.then(invoke) : invoke(then);
|
|
11989
|
+
return then instanceof Promise ? then.then((method) => invoke(method, constructor2)) : invoke(then, constructor2);
|
|
11942
11990
|
};
|
|
11943
|
-
const
|
|
11944
|
-
return
|
|
11991
|
+
const constructor = getPromiseSpeciesConstructor(target, prototype, budget, context);
|
|
11992
|
+
return constructor instanceof Promise ? constructor.then(finish) : finish(constructor);
|
|
11945
11993
|
},
|
|
11946
11994
|
name: "finally"
|
|
11947
11995
|
})
|
|
@@ -11958,15 +12006,32 @@ function readPromiseReceiverProperty(receiver, property, prototype, context) {
|
|
|
11958
12006
|
const properties = isSandboxPromise(receiver) ? prototype : isSandboxClosure(receiver) ? receiver.properties : receiver;
|
|
11959
12007
|
return typeof properties === "object" && properties !== null && Object.hasOwn(properties, property) ? properties[property] : void 0;
|
|
11960
12008
|
}
|
|
11961
|
-
function
|
|
12009
|
+
function getPromiseSpeciesConstructor(receiver, prototype, budget, context) {
|
|
12010
|
+
const defaultConstructor = intrinsicPromiseConstructors.get(budget);
|
|
11962
12011
|
const validate = (constructor2) => {
|
|
11963
|
-
if (constructor2
|
|
12012
|
+
if (constructor2 === void 0) return defaultConstructor;
|
|
12013
|
+
if (typeof constructor2 !== "object" || constructor2 === null)
|
|
11964
12014
|
throw new TypeError("Promise constructor property must be an object.");
|
|
12015
|
+
const finish = (species2) => {
|
|
12016
|
+
if (species2 === void 0 || species2 === null) return defaultConstructor;
|
|
12017
|
+
if (!isSandboxClosure(species2) || species2.construct === void 0)
|
|
12018
|
+
throw new TypeError("Promise species must be a constructor.");
|
|
12019
|
+
return species2;
|
|
12020
|
+
};
|
|
12021
|
+
const species = readPromiseProperty(constructor2, Symbol.species, prototype, budget, context);
|
|
12022
|
+
return species instanceof Promise ? species.then(finish) : finish(species);
|
|
11965
12023
|
};
|
|
11966
|
-
const
|
|
11967
|
-
const constructor = descriptor === void 0 ? readPromiseReceiverProperty(receiver, "constructor", prototype, context) : readPropertyDescriptor(descriptor, receiver, context, true);
|
|
12024
|
+
const constructor = readPromiseProperty(receiver, "constructor", prototype, budget, context);
|
|
11968
12025
|
return constructor instanceof Promise ? constructor.then(validate) : validate(constructor);
|
|
11969
12026
|
}
|
|
12027
|
+
function readPromiseProperty(receiver, property, prototype, budget, context) {
|
|
12028
|
+
const descriptor = getSandboxPropertyDescriptor(receiver, property, budget);
|
|
12029
|
+
if (descriptor !== void 0 && !("value" in descriptor) && context?.invokeClosure === void 0) {
|
|
12030
|
+
const getter = accessorClosure(descriptor.get);
|
|
12031
|
+
return getter?.call([], { ...context, stack: context?.stack ?? [], thisValue: receiver });
|
|
12032
|
+
}
|
|
12033
|
+
return descriptor === void 0 ? typeof property === "string" ? readPromiseReceiverProperty(receiver, property, prototype, context) : void 0 : readPropertyDescriptor(descriptor, receiver, context, true);
|
|
12034
|
+
}
|
|
11970
12035
|
async function settleIterable(iterable, method, budget, constructor, context) {
|
|
11971
12036
|
const capability = await createPromiseCapability(constructor, budget, context);
|
|
11972
12037
|
const prototype = getPromisePrototype(budget);
|
|
@@ -12217,6 +12282,35 @@ function resolveThenable(value, then, options) {
|
|
|
12217
12282
|
).catch(reject);
|
|
12218
12283
|
});
|
|
12219
12284
|
}
|
|
12285
|
+
function runCapabilityReaction(handler, value, state, capability, budget, context) {
|
|
12286
|
+
return runPromiseJob(async () => {
|
|
12287
|
+
if (value instanceof SandboxError && (value.code === "budgetExceeded" || value.code === "reentry")) {
|
|
12288
|
+
throw value;
|
|
12289
|
+
}
|
|
12290
|
+
let completion = state;
|
|
12291
|
+
let result = state === "rejected" && value instanceof Error ? coerceThrownValue(value, budget, []) : value;
|
|
12292
|
+
if (isSandboxClosure(handler)) {
|
|
12293
|
+
try {
|
|
12294
|
+
result = await callPromiseClosure(handler, [result], void 0, budget, context);
|
|
12295
|
+
completion = "fulfilled";
|
|
12296
|
+
} catch (error) {
|
|
12297
|
+
if (error instanceof SandboxError && (error.code === "budgetExceeded" || error.code === "reentry")) {
|
|
12298
|
+
throw error;
|
|
12299
|
+
}
|
|
12300
|
+
completion = "rejected";
|
|
12301
|
+
result = error;
|
|
12302
|
+
}
|
|
12303
|
+
}
|
|
12304
|
+
await callPromiseClosure(
|
|
12305
|
+
completion === "fulfilled" ? capability.resolve : capability.reject,
|
|
12306
|
+
[result],
|
|
12307
|
+
void 0,
|
|
12308
|
+
budget,
|
|
12309
|
+
context
|
|
12310
|
+
);
|
|
12311
|
+
return void 0;
|
|
12312
|
+
});
|
|
12313
|
+
}
|
|
12220
12314
|
function runPromiseReaction(handler, value, state, budget, self, context) {
|
|
12221
12315
|
return new Promise((resolve, reject) => {
|
|
12222
12316
|
if (state === "rejected" && value instanceof SandboxError && (value.code === "budgetExceeded" || value.code === "reentry")) {
|
|
@@ -40106,4 +40200,4 @@ export {
|
|
|
40106
40200
|
FileSnapshotBackend,
|
|
40107
40201
|
run
|
|
40108
40202
|
};
|
|
40109
|
-
//# sourceMappingURL=chunk-
|
|
40203
|
+
//# sourceMappingURL=chunk-5AXKUJ6N.js.map
|