@endo/eventual-send
Advanced tools
Comparing version 1.2.2 to 1.2.3
{ | ||
"name": "@endo/eventual-send", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Extend a Promise class to implement the eventual-send API", | ||
@@ -13,4 +13,4 @@ "type": "module", | ||
"clean": "git clean -f '*.d.ts*'", | ||
"build:types": "tsc --build tsconfig.build.json", | ||
"clean:types": "git clean -f '*.d.ts*'", | ||
"prepack": "tsc --build tsconfig.build.json", | ||
"postpack": "git clean -f '*.d.ts*'", | ||
"lint-fix": "yarn lint:eslint --fix && yarn lint:types", | ||
@@ -40,9 +40,10 @@ "lint-check": "yarn lint", | ||
"dependencies": { | ||
"@endo/env-options": "^1.1.4" | ||
"@endo/env-options": "^1.1.5" | ||
}, | ||
"devDependencies": { | ||
"@endo/lockdown": "^1.0.7", | ||
"ava": "^6.1.2", | ||
"@endo/lockdown": "^1.0.8", | ||
"ava": "^6.1.3", | ||
"c8": "^7.14.0", | ||
"tsd": "^0.30.7" | ||
"tsd": "^0.30.7", | ||
"typescript": "5.5.2" | ||
}, | ||
@@ -70,3 +71,4 @@ "keywords": [ | ||
"files": [ | ||
"test/**/test-*.js" | ||
"test/**/test-*.*", | ||
"test/**/*.test.*" | ||
], | ||
@@ -78,3 +80,3 @@ "timeout": "2m" | ||
}, | ||
"gitHead": "08e59bc0d262565165636c2e3875bbe3dcb91cf8" | ||
"gitHead": "681b813ccb1fa177905dabf2ed3f5f248cb33ce7" | ||
} |
export default makeE; | ||
export type EProxy = ReturnType<(HandledPromise: { | ||
new <R>(executor: import("./handled-promise.js").HandledExecutor<R>, unfulfilledHandler?: import("./handled-promise.js").Handler<Promise<unknown>> | undefined): Promise<R>; | ||
prototype: Promise<unknown>; | ||
} & PromiseConstructor & import("./handled-promise.js").HandledPromiseStaticMethods) => (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
export type EProxy = ReturnType<(HandledPromise: import("./types").HandledPromiseConstructor) => (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
/** | ||
@@ -17,3 +14,3 @@ * E.get(x) returns a proxy on which you can get arbitrary properties. | ||
*/ | ||
readonly get: <T_1>(x: T_1) => EGetters<LocalRecord<T_1>>; | ||
readonly get: <T>(x: T) => EGetters<LocalRecord<T>>; | ||
/** | ||
@@ -30,4 +27,4 @@ * E.resolve(x) converts x to a handled promise. It is | ||
(): Promise<void>; | ||
<T_2>(value: T_2): Promise<Awaited<T_2>>; | ||
<T_3>(value: T_3 | PromiseLike<T_3>): Promise<Awaited<T_3>>; | ||
<T>(value: T): Promise<Awaited<T>>; | ||
<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>; | ||
}; | ||
@@ -43,3 +40,3 @@ /** | ||
*/ | ||
readonly sendOnly: <T_4>(x: T_4) => ESendOnlyCallableOrMethods<RemoteFunctions<T_4>>; | ||
readonly sendOnly: <T>(x: T) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>; | ||
/** | ||
@@ -57,3 +54,3 @@ * E.when(x, res, rej) is equivalent to | ||
*/ | ||
readonly when: <T_5, U = T_5>(x: T_5 | PromiseLike<T_5>, onfulfilled?: ((value: T_5) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>; | ||
readonly when: <T, U = T>(x: T | PromiseLike<T>, onfulfilled?: ((value: T) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>; | ||
}>; | ||
@@ -64,3 +61,3 @@ /** | ||
*/ | ||
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").RemotableBrand<Local, Primary>>; | ||
/** | ||
@@ -70,3 +67,3 @@ * `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").Callable>>; | ||
export type ERef<T> = PromiseLike<T> | T; | ||
@@ -78,4 +75,4 @@ export type ECallable<T extends import("./types").Callable> = (ReturnType<T> extends PromiseLike<infer U> ? T : (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>); | ||
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 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>>); | ||
/** | ||
@@ -96,11 +93,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").Callable ? (...args: Parameters<T>) => ReturnType<T> : Pick<T, FilteredKeys<T, import("./types").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_1, infer R_1> ? PickCallable<R_1> : 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_1, infer R_1> ? L_1 : T extends PromiseLike<infer U> ? Awaited<T> : T; | ||
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 EPromiseKit<R = unknown> = { | ||
promise: Promise<R>; | ||
settler: import('./types').Settler<R>; | ||
settler: import("./types").Settler<R>; | ||
}; | ||
@@ -111,7 +108,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").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); | ||
/** | ||
* @param {import('./types').HandledPromiseConstructor} HandledPromise | ||
*/ | ||
declare function makeE(HandledPromise: import('./types').HandledPromiseConstructor): (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
declare function makeE(HandledPromise: import("./types").HandledPromiseConstructor): (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
/** | ||
@@ -128,3 +125,3 @@ * E.get(x) returns a proxy on which you can get arbitrary properties. | ||
*/ | ||
readonly get: <T_1>(x: T_1) => EGetters<LocalRecord<T_1>>; | ||
readonly get: <T>(x: T) => EGetters<LocalRecord<T>>; | ||
/** | ||
@@ -141,4 +138,4 @@ * E.resolve(x) converts x to a handled promise. It is | ||
(): Promise<void>; | ||
<T_2>(value: T_2): Promise<Awaited<T_2>>; | ||
<T_3>(value: T_3 | PromiseLike<T_3>): Promise<Awaited<T_3>>; | ||
<T>(value: T): Promise<Awaited<T>>; | ||
<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>; | ||
}; | ||
@@ -154,3 +151,3 @@ /** | ||
*/ | ||
readonly sendOnly: <T_4>(x: T_4) => ESendOnlyCallableOrMethods<RemoteFunctions<T_4>>; | ||
readonly sendOnly: <T>(x: T) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>; | ||
/** | ||
@@ -168,4 +165,4 @@ * E.when(x, res, rej) is equivalent to | ||
*/ | ||
readonly when: <T_5, U = T_5>(x: T_5 | PromiseLike<T_5>, onfulfilled?: ((value: T_5) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>; | ||
readonly when: <T, U = T>(x: T | PromiseLike<T>, onfulfilled?: ((value: T) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>; | ||
}; | ||
//# sourceMappingURL=E.d.ts.map |
import { trackTurns } from './track-turns.js'; | ||
import { makeMessageBreakpointTester } from './message-breakpoints.js'; | ||
const { details: X, quote: q, Fail } = assert; | ||
const { details: X, quote: q, Fail, error: makeError } = assert; | ||
const { assign, create } = Object; | ||
@@ -55,3 +55,3 @@ | ||
return HandledPromise.reject( | ||
assert.error( | ||
makeError( | ||
X`Unexpected receiver for "${q(propertyKey)}" method of E(${q( | ||
@@ -58,0 +58,0 @@ recipient, |
@@ -12,3 +12,3 @@ /// <reference types="ses" /> | ||
const { Fail, details: X, quote: q } = assert; | ||
const { Fail, details: X, quote: q, note: annotateError } = assert; | ||
@@ -341,3 +341,3 @@ const { | ||
} catch (e) { | ||
assert.note(e, X`during resolveWithPresence`); | ||
annotateError(e, X`during resolveWithPresence`); | ||
handledReject(e); | ||
@@ -344,0 +344,0 @@ throw e; |
@@ -9,3 +9,3 @@ export function makeMessageBreakpointTester(optionName: string): MessageBreakpointTester | undefined; | ||
*/ | ||
export type MatchStringTag = string | '*'; | ||
export type MatchStringTag = string | "*"; | ||
/** | ||
@@ -17,3 +17,3 @@ * A star `'*'` matches any method name. Otherwise, the string is | ||
*/ | ||
export type MatchMethodName = string | '*'; | ||
export type MatchMethodName = string | "*"; | ||
/** | ||
@@ -26,3 +26,3 @@ * A star `'*'` will always breakpoint. Otherwise, the string | ||
*/ | ||
export type MatchCountdown = number | '*'; | ||
export type MatchCountdown = number | "*"; | ||
/** | ||
@@ -29,0 +29,0 @@ * This is the external JSON representation, in which |
@@ -1,17 +0,27 @@ | ||
export const E: (<T>(x: T) => import("./E.js").ECallableOrMethods<import("./E.js").RemoteFunctions<T>>) & { | ||
readonly get: <T_1>(x: T_1) => import("./E.js").EGetters<import("./E.js").LocalRecord<T_1>>; | ||
export const E: (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & { | ||
readonly get: <T>(x: T) => EGetters<LocalRecord<T>>; | ||
readonly resolve: { | ||
(): Promise<void>; | ||
<T_2>(value: T_2): Promise<Awaited<T_2>>; | ||
<T_3>(value: T_3 | PromiseLike<T_3>): Promise<Awaited<T_3>>; | ||
<T>(value: T): Promise<Awaited<T>>; | ||
<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>; | ||
}; | ||
readonly sendOnly: <T_4>(x: T_4) => import("./E.js").ESendOnlyCallableOrMethods<import("./E.js").RemoteFunctions<T_4>>; | ||
readonly when: <T_5, U = T_5>(x: T_5 | PromiseLike<T_5>, onfulfilled?: ((value: T_5) => import("./E.js").ERef<U>) | undefined, onrejected?: ((reason: any) => import("./E.js").ERef<U>) | undefined) => Promise<U>; | ||
readonly sendOnly: <T>(x: T) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>; | ||
readonly when: <T, U = T>(x: T | PromiseLike<T>, onfulfilled?: ((value: T) => ERef<U>) | undefined, onrejected?: ((reason: any) => ERef<U>) | undefined) => Promise<U>; | ||
}; | ||
export { hp as HandledPromise }; | ||
export * from "./exports.js"; | ||
import type { ECallableOrMethods } from './E.js'; | ||
import type { RemoteFunctions } from './E.js'; | ||
import type { EGetters } from './E.js'; | ||
import type { LocalRecord } from './E.js'; | ||
import type { ESendOnlyCallableOrMethods } from './E.js'; | ||
import type { ERef } from './E.js'; | ||
/** @import {Handler, HandledExecutor} from './handled-promise.js' */ | ||
/** @import {ECallableOrMethods, EGetters, ERef, ERemoteFunctions, ESendOnlyCallableOrMethods, LocalRecord, RemoteFunctions} from './E.js' */ | ||
declare const hp: { | ||
new <R>(executor: import("./handled-promise.js").HandledExecutor<R>, unfulfilledHandler?: import("./handled-promise.js").Handler<Promise<unknown>> | undefined): Promise<R>; | ||
new <R>(executor: HandledExecutor<R>, unfulfilledHandler?: Handler<Promise<unknown>>): Promise<R>; | ||
prototype: Promise<unknown>; | ||
} & PromiseConstructor & import("./handled-promise.js").HandledPromiseStaticMethods; | ||
import type { HandledExecutor } from './handled-promise.js'; | ||
import type { Handler } from './handled-promise.js'; | ||
//# sourceMappingURL=no-shim.d.ts.map |
import makeE from './E.js'; | ||
// XXX module exports for HandledPromise fail if these aren't in scope | ||
/** @import {Handler, HandledExecutor} from './handled-promise.js' */ | ||
/** @import {ECallableOrMethods, EGetters, ERef, ERemoteFunctions, ESendOnlyCallableOrMethods, LocalRecord, RemoteFunctions} from './E.js' */ | ||
const hp = HandledPromise; | ||
@@ -4,0 +8,0 @@ export const E = makeE(hp); |
@@ -1,2 +0,2 @@ | ||
export function makePostponedHandler(HandledPromise: import('./types').HandledPromiseConstructor): [Required<import('./types').Handler<any>>, () => void]; | ||
export function makePostponedHandler(HandledPromise: import("./types").HandledPromiseConstructor): [Required<import("./types").Handler<any>>, () => void]; | ||
//# sourceMappingURL=postponed.d.ts.map |
@@ -8,3 +8,6 @@ /* global globalThis */ | ||
// NOTE: We can't import these because they're not in scope before lockdown. | ||
// import { assert, details as X, Fail } from '@agoric/assert'; | ||
// We also cannot currently import them because it would create a cyclic | ||
// dependency, though this is more easily fixed. | ||
// import { assert, X, Fail } from '@endo/errors'; | ||
// See also https://github.com/Agoric/agoric-sdk/issues/9515 | ||
@@ -37,3 +40,3 @@ // WARNING: Global Mutable State! | ||
if (reason instanceof Error) { | ||
assert.note(reason, detailsNote); | ||
globalThis.assert.note(reason, detailsNote); | ||
} | ||
@@ -57,3 +60,3 @@ if (VERBOSE) { | ||
if (err instanceof Error) { | ||
assert.note( | ||
globalThis.assert.note( | ||
err, | ||
@@ -96,3 +99,3 @@ X`Thrown from: ${hiddenPriorError}:${hiddenCurrentTurn}.${hiddenCurrentEvent}`, | ||
} | ||
const { details: X } = assert; | ||
const { details: X, note: annotateError } = globalThis.assert; | ||
@@ -104,3 +107,3 @@ hiddenCurrentEvent += 1; | ||
if (hiddenPriorError !== undefined) { | ||
assert.note(sendingError, X`Caused by: ${hiddenPriorError}`); | ||
annotateError(sendingError, X`Caused by: ${hiddenPriorError}`); | ||
} | ||
@@ -107,0 +110,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
93777
1777
5
Updated@endo/env-options@^1.1.5