@endo/eventual-send
Advanced tools
Comparing version 1.2.6 to 1.2.7
{ | ||
"name": "@endo/eventual-send", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "Extend a Promise class to implement the eventual-send API", | ||
@@ -42,3 +42,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@endo/lockdown": "^1.0.11", | ||
"@endo/lockdown": "^1.0.12", | ||
"ava": "^6.1.3", | ||
@@ -81,3 +81,3 @@ "c8": "^7.14.0", | ||
}, | ||
"gitHead": "bbf20fae6726f7d26456714b8852572787d34e05" | ||
"gitHead": "c242c28a68d1af29475150e44b5f3e9d0feda8cd" | ||
} |
export default makeE; | ||
export type EProxy = ReturnType<(HandledPromise: import("./types").HandledPromiseConstructor) => (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
export type EProxy = ReturnType<(HandledPromise: HandledPromiseConstructor) => (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
/** | ||
@@ -57,3 +57,3 @@ * E.get(x) returns a proxy on which you can get arbitrary properties. | ||
*/ | ||
export type FarRef<Primary, Local = DataOnly<Primary>> = ERef<Local & import("./types").RemotableBrand<Local, Primary>>; | ||
export type FarRef<Primary, Local = DataOnly<Primary>> = ERef<Local & import("./types.js").RemotableBrand<Local, Primary>>; | ||
/** | ||
@@ -63,11 +63,11 @@ * `DataOnly<T>` means to return a record type `T2` consisting only of | ||
*/ | ||
export type DataOnly<T> = Omit<T, FilteredKeys<T, import("./types").Callable>>; | ||
export type DataOnly<T> = Omit<T, FilteredKeys<T, import("./types.js").Callable>>; | ||
export type ERef<T> = PromiseLike<T> | T; | ||
export type ECallable<T extends import("./types").Callable> = (ReturnType<T> extends PromiseLike<infer U> ? T : (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>); | ||
export type EMethods<T> = { readonly [P in keyof T]: T[P] extends import("./types").Callable ? ECallable<T[P]> : never; }; | ||
export type ECallable<T extends import("./types.js").Callable> = (ReturnType<T> extends PromiseLike<infer U> ? T : (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>); | ||
export type EMethods<T> = { readonly [P in keyof T]: T[P] extends import("./types.js").Callable ? ECallable<T[P]> : never; }; | ||
export type EGetters<T> = { readonly [P in keyof T]: T[P] extends PromiseLike<infer U> ? T[P] : Promise<Awaited<T[P]>>; }; | ||
export type ESendOnlyCallable<T extends import("./types").Callable> = (...args: Parameters<T>) => Promise<void>; | ||
export type ESendOnlyMethods<T> = { readonly [P in keyof T]: T[P] extends import("./types").Callable ? ESendOnlyCallable<T[P]> : never; }; | ||
export type ESendOnlyCallableOrMethods<T> = (T extends import("./types").Callable ? ESendOnlyCallable<T> & ESendOnlyMethods<Required<T>> : ESendOnlyMethods<Required<T>>); | ||
export type ECallableOrMethods<T> = (T extends import("./types").Callable ? ECallable<T> & EMethods<Required<T>> : EMethods<Required<T>>); | ||
export type ESendOnlyCallable<T extends import("./types.js").Callable> = (...args: Parameters<T>) => Promise<void>; | ||
export type ESendOnlyMethods<T> = { readonly [P in keyof T]: T[P] extends import("./types.js").Callable ? ESendOnlyCallable<T[P]> : never; }; | ||
export type ESendOnlyCallableOrMethods<T> = (T extends import("./types.js").Callable ? ESendOnlyCallable<T> & ESendOnlyMethods<Required<T>> : ESendOnlyMethods<Required<T>>); | ||
export type ECallableOrMethods<T> = (T extends import("./types.js").Callable ? ECallable<T> & EMethods<Required<T>> : EMethods<Required<T>>); | ||
/** | ||
@@ -88,11 +88,11 @@ * Return a union of property names/symbols/numbers P for which the record element T[P]'s type extends U. | ||
*/ | ||
export type PickCallable<T> = (T extends import("./types").Callable ? (...args: Parameters<T>) => ReturnType<T> : Pick<T, FilteredKeys<T, import("./types").Callable>>); | ||
export type PickCallable<T> = (T extends import("./types.js").Callable ? (...args: Parameters<T>) => ReturnType<T> : Pick<T, FilteredKeys<T, import("./types.js").Callable>>); | ||
/** | ||
* `RemoteFunctions<T>` means to return the functions and properties that are remotely callable. | ||
*/ | ||
export type RemoteFunctions<T> = (T extends import("./types").RemotableBrand<infer L, infer R> ? PickCallable<R> : Awaited<T> extends import("./types").RemotableBrand<infer L, infer R> ? PickCallable<R> : T extends PromiseLike<infer U> ? Awaited<T> : T); | ||
export type LocalRecord<T> = (T extends import("./types").RemotableBrand<infer L, infer R> ? L : Awaited<T> extends import("./types").RemotableBrand<infer L, infer R> ? L : T extends PromiseLike<infer U> ? Awaited<T> : T); | ||
export type RemoteFunctions<T> = (T extends import("./types.js").RemotableBrand<infer L, infer R> ? PickCallable<R> : Awaited<T> extends import("./types.js").RemotableBrand<infer L, infer R> ? PickCallable<R> : T extends PromiseLike<infer U> ? Awaited<T> : T); | ||
export type LocalRecord<T> = (T extends import("./types.js").RemotableBrand<infer L, infer R> ? L : Awaited<T> extends import("./types.js").RemotableBrand<infer L, infer R> ? L : T extends PromiseLike<infer U> ? Awaited<T> : T); | ||
export type EPromiseKit<R = unknown> = { | ||
promise: Promise<R>; | ||
settler: import("./types").Settler<R>; | ||
settler: import("./types.js").Settler<R>; | ||
}; | ||
@@ -103,7 +103,7 @@ /** | ||
*/ | ||
export type EOnly<T> = (T extends import("./types").Callable ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>> : T extends Record<PropertyKey, import("./types").Callable> ? { [K in keyof T]: T[K] extends import("./types").Callable ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>> : T[K]; } : T); | ||
export type EOnly<T> = (T extends import("./types.js").Callable ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>> : T extends Record<PropertyKey, import("./types.js").Callable> ? { [K in keyof T]: T[K] extends import("./types.js").Callable ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>> : T[K]; } : T); | ||
/** | ||
* @param {import('./types').HandledPromiseConstructor} HandledPromise | ||
* @param {HandledPromiseConstructor} HandledPromise | ||
*/ | ||
declare function makeE(HandledPromise: import("./types").HandledPromiseConstructor): (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
declare function makeE(HandledPromise: HandledPromiseConstructor): (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
/** | ||
@@ -159,2 +159,3 @@ * E.get(x) returns a proxy on which you can get arbitrary properties. | ||
}; | ||
import type { HandledPromiseConstructor } from './types.js'; | ||
//# sourceMappingURL=E.d.ts.map |
48
src/E.js
@@ -7,2 +7,6 @@ import { trackTurns } from './track-turns.js'; | ||
/** | ||
* @import { HandledPromiseConstructor } from './types.js'; | ||
*/ | ||
const onSend = makeMessageBreakpointTester('ENDO_SEND_BREAKPOINTS'); | ||
@@ -39,3 +43,3 @@ | ||
* @param {any} recipient Any value passed to E(x) | ||
* @param {import('./types').HandledPromiseConstructor} HandledPromise | ||
* @param {HandledPromiseConstructor} HandledPromise | ||
* @returns {ProxyHandler<unknown>} the Proxy handler | ||
@@ -101,3 +105,3 @@ */ | ||
* @param {any} recipient Any value passed to E.sendOnly(x) | ||
* @param {import('./types').HandledPromiseConstructor} HandledPromise | ||
* @param {HandledPromiseConstructor} HandledPromise | ||
* @returns {ProxyHandler<unknown>} the Proxy handler | ||
@@ -159,3 +163,3 @@ */ | ||
* @param {any} x Any value passed to E.get(x) | ||
* @param {import('./types').HandledPromiseConstructor} HandledPromise | ||
* @param {HandledPromiseConstructor} HandledPromise | ||
* @returns {ProxyHandler<unknown>} the Proxy handler | ||
@@ -171,3 +175,3 @@ */ | ||
/** | ||
* @param {import('./types').HandledPromiseConstructor} HandledPromise | ||
* @param {HandledPromiseConstructor} HandledPromise | ||
*/ | ||
@@ -263,3 +267,3 @@ const makeE = HandledPromise => { | ||
* @template [Local=DataOnly<Primary>] The local properties of the object. | ||
* @typedef {ERef<Local & import('./types').RemotableBrand<Local, Primary>>} FarRef | ||
* @typedef {ERef<Local & import('./types.js').RemotableBrand<Local, Primary>>} FarRef | ||
*/ | ||
@@ -272,3 +276,3 @@ | ||
* @template T The type to be filtered. | ||
* @typedef {Omit<T, FilteredKeys<T, import('./types').Callable>>} DataOnly | ||
* @typedef {Omit<T, FilteredKeys<T, import('./types.js').Callable>>} DataOnly | ||
*/ | ||
@@ -283,3 +287,3 @@ | ||
/** | ||
* @template {import('./types').Callable} T | ||
* @template {import('./types.js').Callable} T | ||
* @typedef {( | ||
@@ -295,3 +299,3 @@ * ReturnType<T> extends PromiseLike<infer U> // if function returns a promise | ||
* @typedef {{ | ||
* readonly [P in keyof T]: T[P] extends import('./types').Callable | ||
* readonly [P in keyof T]: T[P] extends import('./types.js').Callable | ||
* ? ECallable<T[P]> | ||
@@ -312,3 +316,3 @@ * : never; | ||
/** | ||
* @template {import('./types').Callable} T | ||
* @template {import('./types.js').Callable} T | ||
* @typedef {(...args: Parameters<T>) => Promise<void>} ESendOnlyCallable | ||
@@ -320,3 +324,3 @@ */ | ||
* @typedef {{ | ||
* readonly [P in keyof T]: T[P] extends import('./types').Callable | ||
* readonly [P in keyof T]: T[P] extends import('./types.js').Callable | ||
* ? ESendOnlyCallable<T[P]> | ||
@@ -330,3 +334,3 @@ * : never; | ||
* @typedef {( | ||
* T extends import('./types').Callable | ||
* T extends import('./types.js').Callable | ||
* ? ESendOnlyCallable<T> & ESendOnlyMethods<Required<T>> | ||
@@ -340,3 +344,3 @@ * : ESendOnlyMethods<Required<T>> | ||
* @typedef {( | ||
* T extends import('./types').Callable | ||
* T extends import('./types.js').Callable | ||
* ? ECallable<T> & EMethods<Required<T>> | ||
@@ -368,5 +372,5 @@ * : EMethods<Required<T>> | ||
* @typedef {( | ||
* T extends import('./types').Callable | ||
* T extends import('./types.js').Callable | ||
* ? (...args: Parameters<T>) => ReturnType<T> // a root callable, no methods | ||
* : Pick<T, FilteredKeys<T, import('./types').Callable>> // any callable methods | ||
* : Pick<T, FilteredKeys<T, import('./types.js').Callable>> // any callable methods | ||
* )} PickCallable | ||
@@ -380,5 +384,5 @@ */ | ||
* @typedef {( | ||
* T extends import('./types').RemotableBrand<infer L, infer R> // if a given T is some remote interface R | ||
* T extends import('./types.js').RemotableBrand<infer L, infer R> // if a given T is some remote interface R | ||
* ? PickCallable<R> // then return the callable properties of R | ||
* : Awaited<T> extends import('./types').RemotableBrand<infer L, infer R> // otherwise, if the final resolution of T is some remote interface R | ||
* : Awaited<T> extends import('./types.js').RemotableBrand<infer L, infer R> // otherwise, if the final resolution of T is some remote interface R | ||
* ? PickCallable<R> // then return the callable properties of R | ||
@@ -394,5 +398,5 @@ * : T extends PromiseLike<infer U> // otherwise, if T is a promise | ||
* @typedef {( | ||
* T extends import('./types').RemotableBrand<infer L, infer R> | ||
* T extends import('./types.js').RemotableBrand<infer L, infer R> | ||
* ? L | ||
* : Awaited<T> extends import('./types').RemotableBrand<infer L, infer R> | ||
* : Awaited<T> extends import('./types.js').RemotableBrand<infer L, infer R> | ||
* ? L | ||
@@ -409,3 +413,3 @@ * : T extends PromiseLike<infer U> | ||
* promise: Promise<R>; | ||
* settler: import('./types').Settler<R>; | ||
* settler: import('./types.js').Settler<R>; | ||
* }} EPromiseKit | ||
@@ -420,7 +424,7 @@ */ | ||
* @typedef {( | ||
* T extends import('./types').Callable | ||
* T extends import('./types.js').Callable | ||
* ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>> | ||
* : T extends Record<PropertyKey, import('./types').Callable> | ||
* : T extends Record<PropertyKey, import('./types.js').Callable> | ||
* ? { | ||
* [K in keyof T]: T[K] extends import('./types').Callable | ||
* [K in keyof T]: T[K] extends import('./types.js').Callable | ||
* ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>> | ||
@@ -427,0 +431,0 @@ * : T[K]; |
@@ -1,2 +0,2 @@ | ||
export function makePostponedHandler(HandledPromise: import("./types").HandledPromiseConstructor): [Required<import("./types").Handler<any>>, () => void]; | ||
export function makePostponedHandler(HandledPromise: import("./types.js").HandledPromiseConstructor): [Required<import("./types.js").Handler<any>>, () => void]; | ||
//# sourceMappingURL=postponed.d.ts.map |
@@ -7,4 +7,4 @@ /// <reference types="ses" /> | ||
* | ||
* @param {import('./types').HandledPromiseConstructor} HandledPromise | ||
* @returns {[Required<import('./types').Handler<any>>, () => void]} postponedHandler and donePostponing callback. | ||
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise | ||
* @returns {[Required<import('./types.js').Handler<any>>, () => void]} postponedHandler and donePostponing callback. | ||
*/ | ||
@@ -33,3 +33,3 @@ export const makePostponedHandler = HandledPromise => { | ||
/** @type {Required<import('./types').Handler<any>>} */ | ||
/** @type {Required<import('./types.js').Handler<any>>} */ | ||
const postponedHandler = { | ||
@@ -36,0 +36,0 @@ get: makePostponedOperation('get'), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94816
1797