Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@agoric/eventual-send

Package Overview
Dependencies
Maintainers
4
Versions
322
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agoric/eventual-send - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

128

dist/eventual-send.cjs.js

@@ -50,3 +50,3 @@ 'use strict';

function makeE(HandledPromise) {
return harden(function E(x) {
function E(x) {
// p = E(x).name(args)

@@ -61,3 +61,89 @@ //

return harden(new Proxy({}, handler));
});
}
let EChain;
const makers = {
G(x) {
// Return getter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return EChain(HandledPromise.get(x, prop));
},
},
);
},
D(x) {
// Return deleter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return EChain(HandledPromise.delete(x, prop));
},
},
);
},
S(x) {
// Return setter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return harden(value => EChain(HandledPromise.set(x, prop, value)));
},
},
);
},
M(x) {
// Return method-caller.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return harden((...args) =>
EChain(HandledPromise.applyMethod(x, prop, args)),
);
},
apply(_target, _thisArg, args = []) {
return EChain(HandledPromise.applyFunction(x, args));
},
},
);
},
P(x) {
// Return as promise.
return Promise.resolve(x);
},
};
EChain = x => {
return new Proxy(
{}, // empty shadow
{
has(_target, prop) {
return Object.keys(makers).indexOf(prop) >= 0;
},
get(_target, prop) {
return harden(makers[prop](x));
},
},
);
};
E.C = EChain;
return harden(E);
}

@@ -117,5 +203,4 @@

},
// TODO: Change HandledPromise.apply to be
// HandledPromise.applyFunction
// to avoid conflict with constructor .apply behaviour.
// TODO: Remove when making HandledPromise a constructor
// to avoid conflict with Function.prototype.apply
apply(target, args) {

@@ -127,2 +212,8 @@ return EPromise.resolve(target).post(undefined, args);

},
applyFunction(target, args) {
return EPromise.resolve(target).post(undefined, args);
},
applyFunctionSendOnly(target, args) {
EPromise.resolve(target).post(undefined, args);
},
applyMethod(target, key, args) {

@@ -274,4 +365,10 @@ return EPromise.resolve(target).post(key, args);

const handledP = new Promise((resolve, reject) => {
handledResolve = resolve;
handledReject = reject;
handledResolve = value => {
fulfilled = true;
resolve(value);
};
handledReject = err => {
fulfilled = true;
reject(err);
};
});

@@ -336,3 +433,2 @@

}
fulfilled = true;
handledReject(reason);

@@ -342,8 +438,7 @@ continueForwarding(reason);

let presence = null;
let resolvedPresence = null;
function resolveWithPresence(presenceHandler) {
if (fulfilled) {
return presence;
return resolvedPresence;
}
fulfilled = true;
try {

@@ -354,8 +449,8 @@ // Sanity checks.

// Validate and install our mapped target (i.e. presence).
presence = Object.create(null);
resolvedPresence = Object.create(null);
// Create table entries for the presence mapped to the
// fulfilledHandler.
presenceToPromise.set(presence, handledP);
presenceToHandler.set(presence, presenceHandler);
presenceToPromise.set(resolvedPresence, handledP);
presenceToHandler.set(resolvedPresence, presenceHandler);

@@ -367,5 +462,5 @@ // Remove the mapping, as our presenceHandler should be

// We committed to this presence, so resolve.
handledResolve(presence);
handledResolve(resolvedPresence);
continueForwarding();
return presence;
return resolvedPresence;
} catch (e) {

@@ -382,3 +477,2 @@ handledReject(e);

}
fulfilled = true;
try {

@@ -385,0 +479,0 @@ if (deprecatedPresenceHandler) {

@@ -46,3 +46,3 @@ /* global globalThis window */

function makeE(HandledPromise) {
return harden(function E(x) {
function E(x) {
// p = E(x).name(args)

@@ -57,3 +57,89 @@ //

return harden(new Proxy({}, handler));
});
}
let EChain;
const makers = {
G(x) {
// Return getter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return EChain(HandledPromise.get(x, prop));
},
},
);
},
D(x) {
// Return deleter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return EChain(HandledPromise.delete(x, prop));
},
},
);
},
S(x) {
// Return setter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return harden(value => EChain(HandledPromise.set(x, prop, value)));
},
},
);
},
M(x) {
// Return method-caller.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return harden((...args) =>
EChain(HandledPromise.applyMethod(x, prop, args)),
);
},
apply(_target, _thisArg, args = []) {
return EChain(HandledPromise.applyFunction(x, args));
},
},
);
},
P(x) {
// Return as promise.
return Promise.resolve(x);
},
};
EChain = x => {
return new Proxy(
{}, // empty shadow
{
has(_target, prop) {
return Object.keys(makers).indexOf(prop) >= 0;
},
get(_target, prop) {
return harden(makers[prop](x));
},
},
);
};
E.C = EChain;
return harden(E);
}

@@ -113,5 +199,4 @@

},
// TODO: Change HandledPromise.apply to be
// HandledPromise.applyFunction
// to avoid conflict with constructor .apply behaviour.
// TODO: Remove when making HandledPromise a constructor
// to avoid conflict with Function.prototype.apply
apply(target, args) {

@@ -123,2 +208,8 @@ return EPromise.resolve(target).post(undefined, args);

},
applyFunction(target, args) {
return EPromise.resolve(target).post(undefined, args);
},
applyFunctionSendOnly(target, args) {
EPromise.resolve(target).post(undefined, args);
},
applyMethod(target, key, args) {

@@ -270,4 +361,10 @@ return EPromise.resolve(target).post(key, args);

const handledP = new Promise((resolve, reject) => {
handledResolve = resolve;
handledReject = reject;
handledResolve = value => {
fulfilled = true;
resolve(value);
};
handledReject = err => {
fulfilled = true;
reject(err);
};
});

@@ -332,3 +429,2 @@

}
fulfilled = true;
handledReject(reason);

@@ -338,8 +434,7 @@ continueForwarding(reason);

let presence = null;
let resolvedPresence = null;
function resolveWithPresence(presenceHandler) {
if (fulfilled) {
return presence;
return resolvedPresence;
}
fulfilled = true;
try {

@@ -350,8 +445,8 @@ // Sanity checks.

// Validate and install our mapped target (i.e. presence).
presence = Object.create(null);
resolvedPresence = Object.create(null);
// Create table entries for the presence mapped to the
// fulfilledHandler.
presenceToPromise.set(presence, handledP);
presenceToHandler.set(presence, presenceHandler);
presenceToPromise.set(resolvedPresence, handledP);
presenceToHandler.set(resolvedPresence, presenceHandler);

@@ -363,5 +458,5 @@ // Remove the mapping, as our presenceHandler should be

// We committed to this presence, so resolve.
handledResolve(presence);
handledResolve(resolvedPresence);
continueForwarding();
return presence;
return resolvedPresence;
} catch (e) {

@@ -378,3 +473,2 @@ handledReject(e);

}
fulfilled = true;
try {

@@ -381,0 +475,0 @@ if (deprecatedPresenceHandler) {

@@ -52,3 +52,3 @@ (function (global, factory) {

function makeE(HandledPromise) {
return harden(function E(x) {
function E(x) {
// p = E(x).name(args)

@@ -63,3 +63,89 @@ //

return harden(new Proxy({}, handler));
});
}
let EChain;
const makers = {
G(x) {
// Return getter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return EChain(HandledPromise.get(x, prop));
},
},
);
},
D(x) {
// Return deleter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return EChain(HandledPromise.delete(x, prop));
},
},
);
},
S(x) {
// Return setter.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return harden(value => EChain(HandledPromise.set(x, prop, value)));
},
},
);
},
M(x) {
// Return method-caller.
return new Proxy(
{},
{
has(_target, _prop) {
return true;
},
get(_target, prop) {
return harden((...args) =>
EChain(HandledPromise.applyMethod(x, prop, args)),
);
},
apply(_target, _thisArg, args = []) {
return EChain(HandledPromise.applyFunction(x, args));
},
},
);
},
P(x) {
// Return as promise.
return Promise.resolve(x);
},
};
EChain = x => {
return new Proxy(
{}, // empty shadow
{
has(_target, prop) {
return Object.keys(makers).indexOf(prop) >= 0;
},
get(_target, prop) {
return harden(makers[prop](x));
},
},
);
};
E.C = EChain;
return harden(E);
}

@@ -119,5 +205,4 @@

},
// TODO: Change HandledPromise.apply to be
// HandledPromise.applyFunction
// to avoid conflict with constructor .apply behaviour.
// TODO: Remove when making HandledPromise a constructor
// to avoid conflict with Function.prototype.apply
apply(target, args) {

@@ -129,2 +214,8 @@ return EPromise.resolve(target).post(undefined, args);

},
applyFunction(target, args) {
return EPromise.resolve(target).post(undefined, args);
},
applyFunctionSendOnly(target, args) {
EPromise.resolve(target).post(undefined, args);
},
applyMethod(target, key, args) {

@@ -276,4 +367,10 @@ return EPromise.resolve(target).post(key, args);

const handledP = new Promise((resolve, reject) => {
handledResolve = resolve;
handledReject = reject;
handledResolve = value => {
fulfilled = true;
resolve(value);
};
handledReject = err => {
fulfilled = true;
reject(err);
};
});

@@ -338,3 +435,2 @@

}
fulfilled = true;
handledReject(reason);

@@ -344,8 +440,7 @@ continueForwarding(reason);

let presence = null;
let resolvedPresence = null;
function resolveWithPresence(presenceHandler) {
if (fulfilled) {
return presence;
return resolvedPresence;
}
fulfilled = true;
try {

@@ -356,8 +451,8 @@ // Sanity checks.

// Validate and install our mapped target (i.e. presence).
presence = Object.create(null);
resolvedPresence = Object.create(null);
// Create table entries for the presence mapped to the
// fulfilledHandler.
presenceToPromise.set(presence, handledP);
presenceToHandler.set(presence, presenceHandler);
presenceToPromise.set(resolvedPresence, handledP);
presenceToHandler.set(resolvedPresence, presenceHandler);

@@ -369,5 +464,5 @@ // Remove the mapping, as our presenceHandler should be

// We committed to this presence, so resolve.
handledResolve(presence);
handledResolve(resolvedPresence);
continueForwarding();
return presence;
return resolvedPresence;
} catch (e) {

@@ -384,3 +479,2 @@ handledReject(e);

}
fulfilled = true;
try {

@@ -387,0 +481,0 @@ if (deprecatedPresenceHandler) {

2

package.json
{
"name": "@agoric/eventual-send",
"version": "0.4.0",
"version": "0.4.1",
"description": "Extend a Promise class to implement the eventual-send API",

@@ -5,0 +5,0 @@ "main": "dist/eventual-send.cjs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc