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

@agoric/eventual-send

Package Overview
Dependencies
Maintainers
5
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.14.2-dev-9024f07.0 to 0.14.2-dev-9a70686.0

8

package.json
{
"name": "@agoric/eventual-send",
"version": "0.14.2-dev-9024f07.0+9024f07",
"version": "0.14.2-dev-9a70686.0+9a70686",
"description": "Extend a Promise class to implement the eventual-send API",

@@ -29,4 +29,4 @@ "type": "module",

"devDependencies": {
"@endo/lockdown": "^0.1.7",
"@endo/ses-ava": "^0.2.19",
"@endo/lockdown": "^0.1.9",
"@endo/ses-ava": "^0.2.21",
"ava": "^3.12.1",

@@ -58,3 +58,3 @@ "c8": "^7.7.2"

},
"gitHead": "9024f07c4dddda67a71a0235263570a913ad5b94"
"gitHead": "9a706869faedc9c3edd5380d4ee722b7235d6f78"
}

@@ -26,3 +26,3 @@ // @ts-check

* @param {*} x Any value passed to E(x)
* @param {*} HandledPromise
* @param {import('./index').HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler} the Proxy handler

@@ -57,3 +57,3 @@ */

* @param {*} x Any value passed to E.sendOnly(x)
* @param {*} HandledPromise
* @param {import('./index').HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler} the Proxy handler

@@ -81,2 +81,6 @@ */

/**
* @param {import('./index').HandledPromiseConstructor} HandledPromise
* @returns {import('./index').EProxy}
*/
export default function makeE(HandledPromise) {

@@ -83,0 +87,0 @@ function E(x) {

@@ -19,7 +19,16 @@ /* eslint-disable no-shadow,no-unused-vars,no-use-before-define,no-var,vars-on-top */

type Unpromise<T> = T extends ERef<infer U> ? U : T;
type FilteredKeys<T, U> = {
[P in keyof T]: T[P] extends U ? P : never;
}[keyof T];
type Parameters<T> = T extends (...args: infer T) => any ? T : any;
type ReturnType<T> = T extends (...args: any[]) => infer T ? T : any;
type DataOnly<T> = Omit<T, FilteredKeys<T, Function>>;
type FunctionOnly<T> = Pick<T, FilteredKeys<T, Function>> &
(T extends Function ? (...args: Parameters<T>) => ReturnType<T> : {});
interface Remotable<T> {
__Remote__: T;
}
type Remote<Primary, Local = DataOnly<Primary>> = ERef<
Local & Remotable<Primary>
>;
interface EHandler<T> {

@@ -61,3 +70,3 @@ get?: (p: T, name: Property, returnedP?: Promise<unknown>) => any;

declare interface HandledPromiseStaticMethods {
resolve<T>(x: T): Promise<Unpromise<T>>;
resolve<T>(x: T): Promise<Awaited<T>>;
resolve(): Promise<undefined>;

@@ -98,10 +107,10 @@ applyFunction(target: unknown, args: unknown[]): Promise<unknown>;

...args: Parameters<T[P]>
) => Promise<Unpromise<ReturnType<T[P]>>>;
) => Promise<Awaited<ReturnType<T[P]>>>;
};
type ESingleCall<T> = T extends Function
? ((...args: Parameters<T>) => Promise<Unpromise<ReturnType<T>>>) &
? ((...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>) &
ESingleMethod<Required<T>>
: ESingleMethod<Required<T>>;
type ESingleGet<T> = {
readonly [P in keyof T]: Promise<Unpromise<T[P]>>;
readonly [P in keyof T]: Promise<Awaited<T[P]>>;
};

@@ -121,3 +130,3 @@

interface ESendOnly {
<T>(x: T): ESingleCallOnly<Unpromise<T>>;
<T>(x: T): ESingleCallOnly<Awaited<T>>;
}

@@ -135,3 +144,9 @@

*/
<T>(x: T): ESingleCall<Unpromise<T>>;
<T>(x: T): ESingleCall<
T extends Remotable<infer U>
? FunctionOnly<U>
: Awaited<T> extends Remotable<infer U>
? FunctionOnly<U>
: Awaited<T>
>;

@@ -147,3 +162,11 @@ /**

*/
readonly get: <T>(x: T) => ESingleGet<Unpromise<T>>;
readonly get: <T>(
x: T,
) => ESingleGet<
T extends Remotable<infer U>
? DataOnly<U>
: Awaited<T> extends Remotable<infer U>
? DataOnly<U>
: Awaited<T>
>;

@@ -154,3 +177,3 @@ /**

*/
readonly resolve: <T>(x: T) => Promise<Unpromise<T>>;
readonly resolve: <T>(x: T) => Promise<Awaited<T>>;

@@ -163,3 +186,3 @@ /**

x: T,
onfulfilled?: (value: Unpromise<T>) => ERef<U>,
onfulfilled?: (value: Awaited<T>) => ERef<U>,
onrejected?: (reason: any) => ERef<U>,

@@ -166,0 +189,0 @@ ) => Promise<U>;

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