@agoric/network
Advanced tools
Comparing version 0.1.1-dev-5375019.0 to 0.1.1-dev-537ffd0.0
{ | ||
"name": "@agoric/network", | ||
"version": "0.1.1-dev-5375019.0+5375019", | ||
"version": "0.1.1-dev-537ffd0.0+537ffd0", | ||
"description": "Agoric's network protocol API", | ||
@@ -11,5 +11,5 @@ "type": "module", | ||
"prepack": "tsc --build tsconfig.build.json", | ||
"postpack": "git clean -f '*.d.ts*'", | ||
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'", | ||
"test": "ava", | ||
"test:c8": "c8 $C8_OPTIONS ava", | ||
"test:c8": "c8 --all $C8_OPTIONS ava", | ||
"test:xs": "exit 0", | ||
@@ -25,20 +25,20 @@ "lint-fix": "yarn lint:eslint --fix", | ||
"dependencies": { | ||
"@agoric/assert": "0.6.1-dev-5375019.0+5375019", | ||
"@agoric/internal": "0.3.3-dev-5375019.0+5375019", | ||
"@agoric/store": "0.9.3-dev-5375019.0+5375019", | ||
"@agoric/vat-data": "0.5.3-dev-5375019.0+5375019", | ||
"@endo/base64": "^1.0.5", | ||
"@endo/far": "^1.1.2", | ||
"@endo/pass-style": "^1.4.0", | ||
"@endo/patterns": "^1.4.0", | ||
"@endo/promise-kit": "^1.1.2" | ||
"@agoric/internal": "0.3.3-dev-537ffd0.0+537ffd0", | ||
"@agoric/store": "0.9.3-dev-537ffd0.0+537ffd0", | ||
"@agoric/vat-data": "0.5.3-dev-537ffd0.0+537ffd0", | ||
"@endo/base64": "^1.0.9", | ||
"@endo/errors": "^1.2.8", | ||
"@endo/far": "^1.1.9", | ||
"@endo/pass-style": "^1.4.7", | ||
"@endo/patterns": "^1.4.7", | ||
"@endo/promise-kit": "^1.1.8" | ||
}, | ||
"devDependencies": { | ||
"@agoric/swingset-liveslots": "0.10.3-dev-5375019.0+5375019", | ||
"@agoric/swingset-vat": "0.32.3-dev-5375019.0+5375019", | ||
"@agoric/vow": "0.1.1-dev-5375019.0+5375019", | ||
"@agoric/zone": "0.2.3-dev-5375019.0+5375019", | ||
"@endo/bundle-source": "^3.2.3", | ||
"@agoric/swingset-liveslots": "0.10.3-dev-537ffd0.0+537ffd0", | ||
"@agoric/swingset-vat": "0.32.3-dev-537ffd0.0+537ffd0", | ||
"@agoric/vow": "0.1.1-dev-537ffd0.0+537ffd0", | ||
"@agoric/zone": "0.2.3-dev-537ffd0.0+537ffd0", | ||
"@endo/bundle-source": "^3.5.0", | ||
"ava": "^5.3.0", | ||
"c8": "^9.1.0" | ||
"c8": "^10.1.2" | ||
}, | ||
@@ -71,5 +71,5 @@ "exports": { | ||
"typeCoverage": { | ||
"atLeast": 89.7 | ||
"atLeast": 91.16 | ||
}, | ||
"gitHead": "5375019b35f3488bd2c7be2834f2a7030f62b404" | ||
"gitHead": "537ffd077b75c175412e54f116c885cbb64d80fc" | ||
} |
@@ -21,3 +21,3 @@ /** | ||
*/ | ||
export function toBytes(byteSource: ByteSource): string; | ||
export function toBytes(byteSource: ByteSource): Bytes; | ||
/** | ||
@@ -29,3 +29,3 @@ * Convert bytes to a String. | ||
*/ | ||
export function bytesToString(bytes: string): string; | ||
export function bytesToString(bytes: Bytes): string; | ||
/** | ||
@@ -44,4 +44,6 @@ * Base64, as specified in https://tools.ietf.org/html/rfc4648#section-4 | ||
*/ | ||
export function base64ToBytes(string: string): string; | ||
export type ByteSource = string | Iterable<number> | Buffer | Uint8Array; | ||
export function base64ToBytes(string: string): Bytes; | ||
export type ByteSource = Bytes | Buffer | Uint8Array | Iterable<number>; | ||
import type { Bytes } from './types.js'; | ||
import type { Bytes as Bytes_1 } from './types.js'; | ||
//# sourceMappingURL=bytes.d.ts.map |
// @ts-check | ||
import { details, Fail } from '@agoric/assert'; | ||
import { X, Fail } from '@endo/errors'; | ||
import { encodeBase64, decodeBase64 } from '@endo/base64'; | ||
@@ -26,10 +26,7 @@ import { isObject } from '@endo/pass-style'; | ||
isObject(specimen) || | ||
assert.fail(details`non-object ${specimen} is not a ByteSource`, TypeError); | ||
assert.fail(X`non-object ${specimen} is not a ByteSource`, TypeError); | ||
const obj = /** @type {{}} */ (specimen); | ||
typeof obj[Symbol.iterator] === 'function' || | ||
assert.fail( | ||
details`non-iterable ${specimen} is not a ByteSource`, | ||
TypeError, | ||
); | ||
assert.fail(X`non-iterable ${specimen} is not a ByteSource`, TypeError); | ||
@@ -36,0 +33,0 @@ // Good enough... it's iterable and can be converted later. |
@@ -12,12 +12,5 @@ /** | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {VowTools} powers | ||
*/ | ||
export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone").Zone, { watch, allVows }: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: { | ||
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined; | ||
} | undefined) => { | ||
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>; | ||
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(specimenP: import("@agoric/vow").ERef<T_1 | import("@agoric/vow").Vow<T_1>>, watcher?: import("@agoric/vow").Watcher<T_1, TResult1_1, TResult2_1> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>; | ||
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>; | ||
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>; | ||
}>): (instancePrefix?: string | undefined) => import("@endo/exo").Guarded<{ | ||
export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone").Zone, { watch, allVows }: VowTools): (instancePrefix?: string) => import("@endo/exo").Guarded<{ | ||
onCreate(_impl: any, _protocolHandler: any): Promise<void>; | ||
@@ -32,36 +25,15 @@ generatePortID(_localAddr: any, _protocolHandler: any): Promise<string>; | ||
*/ | ||
onConnect(_port: any, localAddr: string, remoteAddr: string): import("@agoric/vow").PromiseVow<AttemptDescription>; | ||
onConnect(_port: any, localAddr: Endpoint, remoteAddr: Endpoint): import("@agoric/vow").PromiseVow<AttemptDescription>; | ||
onInstantiate(_port: any, _localAddr: any, _remote: any, _protocol: any): Promise<string>; | ||
onListen(port: any, localAddr: any, listenHandler: any, _protocolHandler: any): Promise<void>; | ||
/** | ||
* @param {import('@agoric/vow').Remote<Port>} port | ||
* @param {Remote<Port>} port | ||
* @param {Endpoint} localAddr | ||
* @param {import('@agoric/vow').Remote<ListenHandler>} listenHandler | ||
* @param {Remote<ListenHandler>} listenHandler | ||
* @param {*} _protocolHandler | ||
*/ | ||
onListenRemove(port: import("@agoric/vow").Remote<Port, {}>, localAddr: string, listenHandler: import("@agoric/vow").Remote<ListenHandler, { | ||
/** | ||
* The listener has been registered | ||
*/ | ||
onListen?: undefined; | ||
/** | ||
* The connection was rejected | ||
*/ | ||
onReject?: undefined; | ||
/** | ||
* There was an error while listening | ||
*/ | ||
onError?: undefined; | ||
/** | ||
* The | ||
* listener has been removed | ||
*/ | ||
onRemove?: undefined; | ||
}>, _protocolHandler: any): Promise<void>; | ||
onListenRemove(port: Remote<Port>, localAddr: Endpoint, listenHandler: Remote<ListenHandler>, _protocolHandler: any): Promise<void>; | ||
onRevoke(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>; | ||
}>; | ||
/** | ||
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js'; | ||
*/ | ||
/** | ||
* Compatibility note: this must match what our peers use, so don't change it | ||
@@ -71,17 +43,6 @@ * casually. | ||
export const ENDPOINT_SEPARATOR: "/"; | ||
export const CLOSE_REASON_FINALIZER: "closed-by-finalizer"; | ||
export function rethrowUnlessMissing(err: unknown): undefined; | ||
export function crossoverConnection(zone: import("@agoric/zone").Zone, handler0: import("@agoric/vow").Remote<Required<ConnectionHandler>, {}>, addr0: string, handler1: import("@agoric/vow").Remote<Required<ConnectionHandler>, {}>, addr1: string, makeConnection: (opts: ConnectionOpts) => Connection, current?: globalThis.WeakSetStore<Closable> | undefined): Connection[]; | ||
export function prepareNetworkProtocol(zone: import("@agoric/base-zone").Zone, powers: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: { | ||
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined; | ||
} | undefined) => { | ||
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>; | ||
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(specimenP: import("@agoric/vow").ERef<T_1 | import("@agoric/vow").Vow<T_1>>, watcher?: import("@agoric/vow").Watcher<T_1, TResult1_1, TResult2_1> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>; | ||
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>; | ||
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>; | ||
}>): (protocolHandler: import("@agoric/vow").Remote<ProtocolHandler, { | ||
/** | ||
* Return unique suffix for local address | ||
*/ | ||
onInstantiate?: undefined; | ||
}>) => Protocol; | ||
export function crossoverConnection(zone: import("@agoric/zone").Zone, handler0: Remote<Required<ConnectionHandler>>, addr0: Endpoint, handler1: Remote<Required<ConnectionHandler>>, addr1: Endpoint, makeConnection: (opts: ConnectionOpts) => Connection, finalizer: Finalizer, current?: WeakSetStore<Closable>): Connection[]; | ||
export function prepareNetworkProtocol(zone: import("@agoric/base-zone").Zone, powers: Powers): (protocolHandler: Remote<ProtocolHandler>) => Protocol; | ||
export function prepareEchoConnectionKit(zone: import("@agoric/base-zone").Zone): () => import("@endo/exo").GuardedKit<{ | ||
@@ -94,9 +55,9 @@ handler: { | ||
*/ | ||
onReceive(_connection: Connection, bytes: string, _connectionHandler: ConnectionHandler): Promise<string>; | ||
onReceive(_connection: Connection, bytes: Bytes, _connectionHandler: ConnectionHandler): Promise<string>; | ||
/** | ||
* @param {Connection} _connection | ||
* @param {CloseReason} [_reason] | ||
* @param {CloseReason} [reason] | ||
* @param {ConnectionHandler} [_connectionHandler] | ||
*/ | ||
onClose(_connection: Connection, _reason?: any, _connectionHandler?: ConnectionHandler | undefined): Promise<void>; | ||
onClose(_connection: Connection, reason?: CloseReason, _connectionHandler?: ConnectionHandler): Promise<void>; | ||
}; | ||
@@ -110,9 +71,9 @@ listener: { | ||
*/ | ||
onReceive(_connection: Connection, bytes: string, _connectionHandler: ConnectionHandler): Promise<string>; | ||
onReceive(_connection: Connection, bytes: Bytes, _connectionHandler: ConnectionHandler): Promise<string>; | ||
/** | ||
* @param {Connection} _connection | ||
* @param {CloseReason} [_reason] | ||
* @param {CloseReason} [reason] | ||
* @param {ConnectionHandler} [_connectionHandler] | ||
*/ | ||
onClose(_connection: Connection, _reason?: any, _connectionHandler?: ConnectionHandler | undefined): Promise<void>; | ||
onClose(_connection: Connection, reason?: CloseReason, _connectionHandler?: ConnectionHandler): Promise<void>; | ||
}>>; | ||
@@ -122,10 +83,3 @@ onListen(port: any, _listenHandler: any): Promise<void>; | ||
}>; | ||
export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { watch }: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: { | ||
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined; | ||
} | undefined) => { | ||
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>; | ||
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(specimenP: import("@agoric/vow").ERef<T_1 | import("@agoric/vow").Vow<T_1>>, watcher?: import("@agoric/vow").Watcher<T_1, TResult1_1, TResult2_1> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>; | ||
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>; | ||
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>; | ||
}>): (args_0: { | ||
export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { watch }: Powers): (args_0: { | ||
protocol: Protocol; | ||
@@ -138,8 +92,12 @@ }) => import("@endo/exo").Guarded<{ | ||
}>; | ||
export function prepareNetworkPowers(zone: import("@agoric/base-zone").Zone, vowTools: VowTools): Powers; | ||
export type MakeEchoConnectionKit = ReturnType<typeof prepareEchoConnectionKit>; | ||
export type Powers = VowTools & { | ||
finalizer: Finalizer; | ||
}; | ||
export type ConnectionOpts = { | ||
addrs: string[]; | ||
handlers: import("@agoric/vow").Remote<Required<ConnectionHandler>, {}>[]; | ||
conns: globalThis.MapStore<number, Connection>; | ||
current: globalThis.WeakSetStore<Closable>; | ||
addrs: Endpoint[]; | ||
handlers: Remote<Required<ConnectionHandler>>[]; | ||
conns: MapStore<number, Connection>; | ||
current: WeakSetStore<Closable>; | ||
l: 0 | 1; | ||
@@ -149,4 +107,8 @@ r: 0 | 1; | ||
export type PortAllocator = ReturnType<ReturnType<typeof preparePortAllocator>>; | ||
export type Finalizer = ReturnType<typeof prepareFinalizer>; | ||
import type { VowTools } from '@agoric/vow'; | ||
import type { Endpoint } from './types.js'; | ||
import type { AttemptDescription } from './types.js'; | ||
import type { Port } from './types.js'; | ||
import type { Remote } from '@agoric/vow'; | ||
import type { ListenHandler } from './types.js'; | ||
@@ -158,2 +120,38 @@ import type { ConnectionHandler } from './types.js'; | ||
import type { Protocol } from './types.js'; | ||
import type { Bytes } from './types.js'; | ||
import type { CloseReason } from './types.js'; | ||
/** @typedef {ReturnType<ReturnType<typeof preparePortAllocator>>} PortAllocator */ | ||
/** | ||
* Return a package-specific singleton that pins objects until they are | ||
* explicitly unpinned or finalized. It needs to pin objects only because they | ||
* are resources that need to be released. | ||
* | ||
* The reason this functionality wasn't just baked into the other network exos | ||
* is to maintain upgrade-compatible with minimal additional changes. | ||
* | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {VowTools} vowTools | ||
*/ | ||
declare function prepareFinalizer(zone: import("@agoric/base-zone").Zone, { watch }: VowTools): import("@endo/exo").Guarded<{ | ||
has(obj: any): boolean; | ||
/** | ||
* Add a connection and handler for an `onClose` method to be called upon | ||
* finalization. | ||
* @param {Remote<Connection>} conn | ||
* @param {Remote<Required<ConnectionHandler>>} handler | ||
*/ | ||
initConnection(conn: Remote<Connection>, handler: Remote<Required<ConnectionHandler>>): void; | ||
/** | ||
* Add an object with a `close` method to be called (such as an | ||
* `inboundAttempt`) upon finalization. | ||
* @param {Remote<{ close(): PromiseVow<any> }>} closer | ||
*/ | ||
initCloser(closer: Remote<{ | ||
close(): PromiseVow<any>; | ||
}>): void; | ||
finalize(obj: any): import("@agoric/vow").Vow<any> | undefined; | ||
unpin(obj: any): void; | ||
}>; | ||
import type { PromiseVow } from '@agoric/vow'; | ||
export {}; | ||
//# sourceMappingURL=network.d.ts.map |
@@ -5,5 +5,5 @@ // @ts-check | ||
import { Fail } from '@endo/errors'; | ||
import { E } from '@endo/far'; | ||
import { M } from '@endo/patterns'; | ||
import { Fail } from '@agoric/assert'; | ||
import { toBytes } from './bytes.js'; | ||
@@ -14,5 +14,11 @@ import { Shape } from './shapes.js'; | ||
/** | ||
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js'; | ||
* @import {AttemptDescription, Bytes, CloseReason, Closable, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js'; | ||
* @import {PromiseVow, Remote, VowTools} from '@agoric/vow'; | ||
*/ | ||
/** @typedef {VowTools & { finalizer: Finalizer }} Powers */ | ||
const sink = () => {}; | ||
harden(sink); | ||
/** | ||
@@ -24,2 +30,5 @@ * Compatibility note: this must match what our peers use, so don't change it | ||
// Mark the finalizer close reason. | ||
export const CLOSE_REASON_FINALIZER = 'closed-by-finalizer'; | ||
/** @param {unknown} err */ | ||
@@ -66,3 +75,3 @@ export const rethrowUnlessMissing = err => { | ||
if (!portNameRegex.test(specifiedName)) { | ||
throw new Error(`Invalid IBC port name: ${specifiedName}`); | ||
throw Error(`Invalid IBC port name: ${specifiedName}`); | ||
} | ||
@@ -74,3 +83,3 @@ } | ||
* @property {Endpoint[]} addrs | ||
* @property {import('@agoric/vow').Remote<Required<ConnectionHandler>>[]} handlers | ||
* @property {Remote<Required<ConnectionHandler>>[]} handlers | ||
* @property {MapStore<number, Connection>} conns | ||
@@ -84,5 +93,5 @@ * @property {WeakSetStore<Closable>} current | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {Powers} powers | ||
*/ | ||
const prepareHalfConnection = (zone, { watch }) => { | ||
const prepareHalfConnection = (zone, { watch, allVows, finalizer }) => { | ||
const makeHalfConnectionKit = zone.exoClassKit( | ||
@@ -132,3 +141,3 @@ 'Connection', | ||
async close() { | ||
const { closed, current, conns, l, handlers } = this.state; | ||
const { closed, current, conns, l, r } = this.state; | ||
if (closed) { | ||
@@ -138,9 +147,11 @@ throw Error(closed); | ||
this.state.closed = 'Connection closed'; | ||
current.delete(conns.get(l)); | ||
// Tear down both sides. | ||
const lconn = conns.get(l); | ||
const rconn = conns.get(r); | ||
current.delete(lconn); | ||
current.delete(rconn); | ||
const innerVow = watch( | ||
E(this.state.handlers[l]).onClose( | ||
conns.get(l), | ||
undefined, | ||
handlers[l], | ||
), | ||
allVows([finalizer.finalize(lconn), finalizer.finalize(rconn)]), | ||
this.facets.sinkWatcher, | ||
@@ -187,7 +198,8 @@ ); | ||
* @param {import('@agoric/zone').Zone} zone | ||
* @param {import('@agoric/vow').Remote<Required<ConnectionHandler>>} handler0 | ||
* @param {Remote<Required<ConnectionHandler>>} handler0 | ||
* @param {Endpoint} addr0 | ||
* @param {import('@agoric/vow').Remote<Required<ConnectionHandler>>} handler1 | ||
* @param {Remote<Required<ConnectionHandler>>} handler1 | ||
* @param {Endpoint} addr1 | ||
* @param {(opts: ConnectionOpts) => Connection} makeConnection | ||
* @param {Finalizer} finalizer | ||
* @param {WeakSetStore<Closable>} [current] | ||
@@ -202,2 +214,3 @@ */ | ||
makeConnection, | ||
finalizer, | ||
current = zone.detached().weakSetStore('crossoverCurrentConnections'), | ||
@@ -210,3 +223,3 @@ ) => { | ||
/** @type {import('@agoric/vow').Remote<Required<ConnectionHandler>>[]} */ | ||
/** @type {Remote<Required<ConnectionHandler>>[]} */ | ||
const handlers = harden([handler0, handler1]); | ||
@@ -229,5 +242,9 @@ /** @type {Endpoint[]} */ | ||
const openHalfConnection = (l, r) => { | ||
current.add(conns.get(l)); | ||
const lconn = conns.get(l); | ||
current.add(lconn); | ||
if (!finalizer.has(lconn)) { | ||
finalizer.initConnection(lconn, handlers[l]); | ||
} | ||
E(handlers[l]) | ||
.onOpen(conns.get(l), addrs[l], addrs[r], handlers[l]) | ||
.onOpen(lconn, addrs[l], addrs[r], handlers[l]) | ||
.catch(rethrowUnlessMissing); | ||
@@ -248,5 +265,5 @@ }; | ||
* @param {(opts: ConnectionOpts) => Connection} makeConnection | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {Powers} powers | ||
*/ | ||
const prepareInboundAttempt = (zone, makeConnection, { watch }) => { | ||
const prepareInboundAttempt = (zone, makeConnection, { watch, finalizer }) => { | ||
const makeInboundAttemptKit = zone.exoClassKit( | ||
@@ -261,3 +278,3 @@ 'InboundAttempt', | ||
* @param {string} opts.listenPrefix | ||
* @param {MapStore<Endpoint, [Port, import('@agoric/vow').Remote<Required<ListenHandler>>]>} opts.listening | ||
* @param {MapStore<Endpoint, [Port, Remote<Required<ListenHandler>>]>} opts.listening | ||
*/ | ||
@@ -305,2 +322,3 @@ ({ | ||
current.delete(this.facets.inboundAttempt); | ||
finalizer.unpin(this.facets.inboundAttempt); | ||
@@ -318,3 +336,3 @@ const innerVow = watch( | ||
* @param {string} [opts.remoteAddress] | ||
* @param {import('@agoric/vow').Remote<ConnectionHandler>} opts.handler | ||
* @param {Remote<ConnectionHandler>} opts.handler | ||
*/ | ||
@@ -361,11 +379,8 @@ async accept({ localAddress, remoteAddress, handler: rchandler }) { | ||
zone, | ||
/** @type {import('@agoric/vow').Remote<Required<ConnectionHandler>>} */ ( | ||
lchandler | ||
), | ||
/** @type {Remote<Required<ConnectionHandler>>} */ (lchandler), | ||
localAddress, | ||
/** @type {import('@agoric/vow').Remote<Required<ConnectionHandler>>} */ ( | ||
rchandler | ||
), | ||
/** @type {Remote<Required<ConnectionHandler>>} */ (rchandler), | ||
remoteAddress, | ||
makeConnection, | ||
finalizer, | ||
current, | ||
@@ -409,3 +424,3 @@ )[1]; | ||
/** @enum {number} */ | ||
/** @enum {typeof RevokeState[keyof typeof RevokeState]} */ | ||
const RevokeState = /** @type {const} */ ({ | ||
@@ -416,6 +431,7 @@ NOT_REVOKED: 0, | ||
}); | ||
harden(RevokeState); | ||
/** | ||
* @param {import('@agoric/zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {Powers} powers | ||
*/ | ||
@@ -425,3 +441,3 @@ const preparePort = (zone, powers) => { | ||
const { watch, allVows } = powers; | ||
const { finalizer, watch, allVows } = powers; | ||
@@ -431,8 +447,8 @@ /** | ||
* @param {Endpoint} opts.localAddr | ||
* @param {MapStore<Endpoint, [Port, import('@agoric/vow').Remote<Required<ListenHandler>>]>} opts.listening | ||
* @param {SetStore<import('@agoric/vow').Remote<Connection>>} opts.openConnections | ||
* @param {MapStore<Endpoint, [Port, Remote<Required<ListenHandler>>]>} opts.listening | ||
* @param {SetStore<Remote<Connection>>} opts.openConnections | ||
* @param {MapStore<Port, SetStore<Closable>>} opts.currentConnections | ||
* @param {MapStore<string, Port>} opts.boundPorts | ||
* @param {import('@agoric/vow').Remote<ProtocolHandler>} opts.protocolHandler | ||
* @param {import('@agoric/vow').Remote<ProtocolImpl>} opts.protocolImpl | ||
* @param {Remote<ProtocolHandler>} opts.protocolHandler | ||
* @param {Remote<ProtocolImpl>} opts.protocolImpl | ||
*/ | ||
@@ -467,3 +483,3 @@ const initPort = ({ | ||
}, | ||
/** @param {import('@agoric/vow').Remote<ListenHandler>} listenHandler */ | ||
/** @param {Remote<ListenHandler>} listenHandler */ | ||
async addListener(listenHandler) { | ||
@@ -483,5 +499,3 @@ const { revoked, listening, localAddr, protocolHandler } = this.state; | ||
this.facets.port, | ||
/** @type {import('@agoric/vow').Remote<Required<ListenHandler>>} */ ( | ||
listenHandler | ||
), | ||
/** @type {Remote<Required<ListenHandler>>} */ (listenHandler), | ||
]); | ||
@@ -494,5 +508,3 @@ E(lhandler).onRemove(lport, lhandler).catch(rethrowUnlessMissing); | ||
this.facets.port, | ||
/** @type {import('@agoric/vow').Remote<Required<ListenHandler>>} */ ( | ||
listenHandler | ||
), | ||
/** @type {Remote<Required<ListenHandler>>} */ (listenHandler), | ||
]), | ||
@@ -516,3 +528,3 @@ ); | ||
}, | ||
/** @param {import('@agoric/vow').Remote<ListenHandler>} listenHandler */ | ||
/** @param {Remote<ListenHandler>} listenHandler */ | ||
async removeListener(listenHandler) { | ||
@@ -539,7 +551,7 @@ const { listening, localAddr, protocolHandler } = this.state; | ||
* @param {Endpoint} remotePort | ||
* @param {import('@agoric/vow').Remote<ConnectionHandler>} [connectionHandler] | ||
* @param {Remote<ConnectionHandler>} [connectionHandler] | ||
*/ | ||
async connect( | ||
remotePort, | ||
connectionHandler = /** @type {import('@agoric/vow').Remote<ConnectionHandler>} */ ( | ||
connectionHandler = /** @type {Remote<ConnectionHandler>} */ ( | ||
makeIncapable() | ||
@@ -556,3 +568,3 @@ ), | ||
this.facets.portConnectWatcher, | ||
{ revoked }, | ||
{ chandler: connectionHandler }, | ||
); | ||
@@ -568,3 +580,2 @@ }, | ||
this.state.revoked = RevokeState.REVOKING; | ||
const revokeVow = watch( | ||
@@ -595,11 +606,12 @@ E(protocolHandler).onRevoke( | ||
portConnectWatcher: { | ||
onFulfilled(conn, watchContext) { | ||
const { revoked } = watchContext; | ||
const { openConnections } = this.state; | ||
onFulfilled(conn, { chandler }) { | ||
const { openConnections, revoked } = this.state; | ||
if (!finalizer.has(conn)) { | ||
finalizer.initConnection(conn, chandler); | ||
} | ||
if (revoked) { | ||
void E(conn).close(); | ||
} else { | ||
openConnections.add(conn); | ||
return finalizer.finalize(conn); | ||
} | ||
openConnections.add(conn); | ||
return conn; | ||
@@ -618,4 +630,4 @@ }, | ||
ps.push( | ||
...values.map(conn => | ||
watch(E(conn).close(), this.facets.sinkWatcher), | ||
...values.map(obj => | ||
watch(finalizer.finalize(obj), this.facets.sinkWatcher), | ||
), | ||
@@ -683,3 +695,3 @@ ); | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {Powers} powers | ||
*/ | ||
@@ -689,3 +701,3 @@ const prepareBinder = (zone, powers) => { | ||
const { watch } = powers; | ||
const { watch, finalizer } = powers; | ||
@@ -765,4 +777,4 @@ const makeInboundAttempt = prepareInboundAttempt( | ||
* @param {MapStore<string, Port>} opts.boundPorts | ||
* @param {MapStore<Endpoint, [Port, import('@agoric/vow').Remote<Required<ListenHandler>>]>} opts.listening | ||
* @param {import('@agoric/vow').Remote<ProtocolHandler>} opts.protocolHandler | ||
* @param {MapStore<Endpoint, [Port, Remote<Required<ListenHandler>>]>} opts.listening | ||
* @param {Remote<ProtocolHandler>} opts.protocolHandler | ||
*/ | ||
@@ -813,3 +825,3 @@ ({ currentConnections, boundPorts, listening, protocolHandler }) => { | ||
E( | ||
/** @type {import('@agoric/vow').Remote<Required<ProtocolHandler>>} */ ( | ||
/** @type {Remote<Required<ProtocolHandler>>} */ ( | ||
protocolHandler | ||
@@ -856,3 +868,3 @@ ), | ||
E( | ||
/** @type {import('@agoric/vow').Remote<Required<ProtocolHandler>>} */ ( | ||
/** @type {Remote<Required<ProtocolHandler>>} */ ( | ||
protocolHandler | ||
@@ -942,2 +954,3 @@ ), | ||
current.add(inboundAttempt); | ||
finalizer.initCloser(inboundAttempt); | ||
return inboundAttempt; | ||
@@ -984,3 +997,3 @@ }, | ||
E( | ||
/** @type {import('@agoric/vow').Remote<Required<ProtocolHandler>>} */ ( | ||
/** @type {Remote<Required<ProtocolHandler>>} */ ( | ||
protocolHandler | ||
@@ -1048,11 +1061,8 @@ ), | ||
zone, | ||
/** @type {import('@agoric/vow').Remote<Required<ConnectionHandler>>} */ ( | ||
lchandler | ||
), | ||
/** @type {Remote<Required<ConnectionHandler>>} */ (lchandler), | ||
negotiatedLocalAddress || requestedLocalAddress, | ||
/** @type {import('@agoric/vow').Remote<Required<ConnectionHandler>>} */ ( | ||
rchandler | ||
), | ||
/** @type {Remote<Required<ConnectionHandler>>} */ (rchandler), | ||
negotiatedRemoteAddress || requestedRemoteAddress, | ||
makeConnection, | ||
finalizer, | ||
current, | ||
@@ -1210,3 +1220,3 @@ )[0]; | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {Powers} powers | ||
*/ | ||
@@ -1217,3 +1227,3 @@ export const prepareNetworkProtocol = (zone, powers) => { | ||
/** | ||
* @param {import('@agoric/vow').Remote<ProtocolHandler>} protocolHandler | ||
* @param {Remote<ProtocolHandler>} protocolHandler | ||
* @returns {Protocol} | ||
@@ -1230,3 +1240,3 @@ */ | ||
/** @type {MapStore<Endpoint, [Port, import('@agoric/vow').Remote<Required<ListenHandler>>]>} */ | ||
/** @type {MapStore<Endpoint, [Port, Remote<Required<ListenHandler>>]>} */ | ||
const listening = detached.mapStore('listening'); | ||
@@ -1305,6 +1315,6 @@ | ||
* @param {Connection} _connection | ||
* @param {CloseReason} [_reason] | ||
* @param {CloseReason} [reason] | ||
* @param {ConnectionHandler} [_connectionHandler] | ||
*/ | ||
async onClose(_connection, _reason, _connectionHandler) { | ||
async onClose(_connection, reason, _connectionHandler) { | ||
const { closed } = this.state; | ||
@@ -1316,3 +1326,3 @@ | ||
this.state.closed = 'Connection closed'; | ||
this.state.closed = reason || 'Connection closed'; | ||
}, | ||
@@ -1339,3 +1349,3 @@ }, | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {VowTools} powers | ||
*/ | ||
@@ -1347,3 +1357,3 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) { | ||
const initHandler = (instancePrefix = 'nonce/') => { | ||
/** @type {MapStore<string, [import('@agoric/vow').Remote<Port>, import('@agoric/vow').Remote<Required<ListenHandler>>]>} */ | ||
/** @type {MapStore<string, [Remote<Port>, Remote<Required<ListenHandler>>]>} */ | ||
const listeners = detached.mapStore('localAddr'); | ||
@@ -1427,3 +1437,3 @@ | ||
port, | ||
/** @type {import('@agoric/vow').Remote<Required<ListenHandler>>} */ ( | ||
/** @type {Remote<Required<ListenHandler>>} */ ( | ||
listenHandler | ||
@@ -1439,5 +1449,3 @@ ), | ||
port, | ||
/** @type {import('@agoric/vow').Remote<Required<ListenHandler>>} */ ( | ||
listenHandler | ||
), | ||
/** @type {Remote<Required<ListenHandler>>} */ (listenHandler), | ||
]), | ||
@@ -1448,5 +1456,5 @@ ); | ||
/** | ||
* @param {import('@agoric/vow').Remote<Port>} port | ||
* @param {Remote<Port>} port | ||
* @param {Endpoint} localAddr | ||
* @param {import('@agoric/vow').Remote<ListenHandler>} listenHandler | ||
* @param {Remote<ListenHandler>} listenHandler | ||
* @param {*} _protocolHandler | ||
@@ -1504,3 +1512,3 @@ */ | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {Powers} powers | ||
*/ | ||
@@ -1575,1 +1583,77 @@ export const preparePortAllocator = (zone, { watch }) => | ||
/** @typedef {ReturnType<ReturnType<typeof preparePortAllocator>>} PortAllocator */ | ||
/** | ||
* Return a package-specific singleton that pins objects until they are | ||
* explicitly unpinned or finalized. It needs to pin objects only because they | ||
* are resources that need to be released. | ||
* | ||
* The reason this functionality wasn't just baked into the other network exos | ||
* is to maintain upgrade-compatible with minimal additional changes. | ||
* | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {VowTools} vowTools | ||
*/ | ||
const prepareFinalizer = (zone, { watch }) => { | ||
/** | ||
* @type {MapStore<{}, | ||
* { conn: Remote<Connection>, handler: Remote<Required<ConnectionHandler>>} | | ||
* { closer: Remote<{ close(): PromiseVow<any> }> } | ||
* >} | ||
*/ | ||
const objToFinalizerInfo = zone.mapStore('objToFinalizerInfo'); | ||
return zone.exo('NetworkFinalizer', undefined, { | ||
has(obj) { | ||
return objToFinalizerInfo.has(obj); | ||
}, | ||
/** | ||
* Add a connection and handler for an `onClose` method to be called upon | ||
* finalization. | ||
* @param {Remote<Connection>} conn | ||
* @param {Remote<Required<ConnectionHandler>>} handler | ||
*/ | ||
initConnection(conn, handler) { | ||
objToFinalizerInfo.init(conn, harden({ conn, handler })); | ||
}, | ||
/** | ||
* Add an object with a `close` method to be called (such as an | ||
* `inboundAttempt`) upon finalization. | ||
* @param {Remote<{ close(): PromiseVow<any> }>} closer | ||
*/ | ||
initCloser(closer) { | ||
objToFinalizerInfo.init(closer, harden({ closer })); | ||
}, | ||
finalize(obj) { | ||
if (!objToFinalizerInfo.has(obj)) { | ||
return; | ||
} | ||
const disposeInfo = objToFinalizerInfo.get(obj); | ||
if ('conn' in disposeInfo) { | ||
// A connection+handler. | ||
const { conn, handler } = disposeInfo; | ||
objToFinalizerInfo.delete(obj); | ||
return watch(E(handler).onClose(conn, CLOSE_REASON_FINALIZER, handler)); | ||
} else if ('closer' in disposeInfo) { | ||
// Just something with a `close` method. | ||
const { closer } = disposeInfo; | ||
objToFinalizerInfo.delete(obj); | ||
return watch(E(closer).close()); | ||
} | ||
}, | ||
unpin(obj) { | ||
objToFinalizerInfo.delete(obj); | ||
}, | ||
}); | ||
}; | ||
harden(prepareFinalizer); | ||
/** | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {VowTools} vowTools | ||
* @returns {Powers} | ||
*/ | ||
export const prepareNetworkPowers = (zone, vowTools) => { | ||
const finalizer = prepareFinalizer(zone, vowTools); | ||
return harden({ ...vowTools, finalizer }); | ||
}; | ||
/** @typedef {ReturnType<typeof prepareFinalizer>} Finalizer */ |
/** | ||
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js'; | ||
* @import {PromiseVow, Remote, VowKit, VowResolver, VowTools} from '@agoric/vow'; | ||
* @import {Endpoint, Port, Protocol, ProtocolHandler} from './types.js'; | ||
* @import {PromiseVow, Remote, VowTools} from '@agoric/vow'; | ||
*/ | ||
@@ -22,3 +22,3 @@ /** | ||
/** @param {Endpoint} addr */ | ||
getRoutes(addr: string): [string, T][]; | ||
getRoutes(addr: Endpoint): [string, T][]; | ||
/** | ||
@@ -35,34 +35,3 @@ * @param {string} prefix | ||
}>; | ||
export function prepareRouterProtocol(zone: import("@agoric/base-zone").Zone, powers: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: { | ||
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined; | ||
} | undefined) => { | ||
when: <T, TResult1 = import("@agoric/vow").EUnwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").EUnwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>; | ||
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(specimenP: import("@agoric/vow").ERef<T_1 | import("@agoric/vow").Vow<T_1>>, watcher?: import("@agoric/vow").Watcher<T_1, TResult1_1, TResult2_1> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>; | ||
makeVowKit: <T_2>() => VowKit<T_2>; | ||
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>; | ||
}>, E?: ((<T_3>(x: T_3) => import("../../../node_modules/@endo/eventual-send/src/E.js").ECallableOrMethods<import("@endo/eventual-send").RemoteFunctions<T_3>>) & { | ||
readonly get: <T_1_1>(x: T_1_1) => import("../../../node_modules/@endo/eventual-send/src/E.js").EGetters<import("@endo/eventual-send").LocalRecord<T_1_1>>; | ||
readonly resolve: { | ||
(): Promise<void>; | ||
<T_2_1>(value: T_2_1): Promise<Awaited<T_2_1>>; | ||
<T_3_1>(value: T_3_1 | | ||
/** | ||
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js'; | ||
* @import {PromiseVow, Remote, VowKit, VowResolver, VowTools} from '@agoric/vow'; | ||
*/ | ||
/** | ||
* @template T | ||
* @typedef {object} Router A delimited string router implementation | ||
* @property {(addr: string) => [string, T][]} getRoutes Return the match and | ||
* route in order of preference | ||
* @property {(prefix: string, route: T) => void} register Add a prefix->route | ||
* to the database | ||
* @property {(prefix: string, route: T) => void} unregister Remove a | ||
* prefix->route from the database | ||
*/ | ||
PromiseLike<T_3_1>): Promise<Awaited<T_3_1>>; | ||
}; | ||
readonly sendOnly: <T_4>(x: T_4) => import("../../../node_modules/@endo/eventual-send/src/E.js").ESendOnlyCallableOrMethods<import("@endo/eventual-send").RemoteFunctions<T_4>>; | ||
readonly when: <T_5, U = T_5>(x: T_5 | PromiseLike<T_5>, onfulfilled?: ((value: T_5) => import("../../../node_modules/@endo/eventual-send/src/E.js").ERef<U>) | undefined, onrejected?: ((reason: any) => import("../../../node_modules/@endo/eventual-send/src/E.js").ERef<U>) | undefined) => Promise<U>; | ||
}) | undefined): () => import("@endo/exo").Guarded<{ | ||
export function prepareRouterProtocol(zone: import("@agoric/base-zone").Zone, powers: import("./network.js").Powers, E?: typeof defaultE): () => import("@endo/exo").Guarded<{ | ||
/** | ||
@@ -79,3 +48,3 @@ * @param {string[]} paths | ||
/** @param {Endpoint} localAddr */ | ||
bindPort(localAddr: string): Promise<Port | import("@agoric/vow").Vow<Port>>; | ||
bindPort(localAddr: Endpoint): Promise<Port | import("@agoric/vow").Vow<Port>>; | ||
}>; | ||
@@ -107,3 +76,4 @@ /** | ||
}; | ||
import type { VowKit } from '@agoric/vow'; | ||
import type { Endpoint } from './types.js'; | ||
import { E as defaultE } from '@endo/far'; | ||
import type { ProtocolHandler } from './types.js'; | ||
@@ -110,0 +80,0 @@ import type { Remote } from '@agoric/vow'; |
@@ -6,5 +6,5 @@ // @ts-check | ||
import { Fail } from '@endo/errors'; | ||
import { E as defaultE } from '@endo/far'; | ||
import { M } from '@endo/patterns'; | ||
import { Fail } from '@agoric/assert'; | ||
import { ENDPOINT_SEPARATOR, prepareNetworkProtocol } from './network.js'; | ||
@@ -14,4 +14,4 @@ import { Shape } from './shapes.js'; | ||
/** | ||
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js'; | ||
* @import {PromiseVow, Remote, VowKit, VowResolver, VowTools} from '@agoric/vow'; | ||
* @import {Endpoint, Port, Protocol, ProtocolHandler} from './types.js'; | ||
* @import {PromiseVow, Remote, VowTools} from '@agoric/vow'; | ||
*/ | ||
@@ -113,3 +113,3 @@ | ||
* @param {import('@agoric/base-zone').Zone} zone | ||
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers | ||
* @param {import('./network.js').Powers} powers | ||
* @param {typeof defaultE} [E] Eventual sender | ||
@@ -116,0 +116,0 @@ */ |
@@ -161,3 +161,3 @@ // @ts-check | ||
protocolHandlerAcceptWatcher: M.interface('ProtocolHandlerAcceptWatcher', { | ||
onFulfilled: M.call(M.any()).rest(M.any()).returns(), | ||
onFulfilled: M.call(M.any()).rest(M.any()).returns(M.any()), | ||
}), | ||
@@ -167,3 +167,3 @@ protocolHandlerInstantiateWatcher: M.interface( | ||
{ | ||
onFulfilled: M.call(M.any()).rest(M.any()).returns(), | ||
onFulfilled: M.call(M.any()).rest(M.any()).returns(M.any()), | ||
}, | ||
@@ -174,3 +174,3 @@ ), | ||
{ | ||
onFulfilled: M.call(M.any()).rest(M.any()).returns(), | ||
onFulfilled: M.call(M.any()).rest(M.any()).returns(M.any()), | ||
}, | ||
@@ -177,0 +177,0 @@ ), |
@@ -53,3 +53,3 @@ /** | ||
*/ | ||
connect: (remote: Endpoint, connectionHandler?: Remote<ConnectionHandler> | undefined) => PromiseVow<Connection>; | ||
connect: (remote: Endpoint, connectionHandler?: Remote<ConnectionHandler>) => PromiseVow<Connection>; | ||
/** | ||
@@ -95,3 +95,3 @@ * Remove the currently-bound listener | ||
*/ | ||
send: (packetBytes: Bytes, opts?: Record<string, any>) => PromiseVow<string>; | ||
send: (packetBytes: Bytes, opts?: Record<string, any>) => PromiseVow<Bytes>; | ||
/** | ||
@@ -123,7 +123,7 @@ * Close both ends of the connection | ||
*/ | ||
onReceive?: ((connection: Remote<Connection>, ack: Bytes, c: Remote<ConnectionHandler>, opts?: Record<string, any>) => PromiseVow<string>) | undefined; | ||
onReceive?: ((connection: Remote<Connection>, ack: Bytes, c: Remote<ConnectionHandler>, opts?: Record<string, any>) => PromiseVow<Bytes>) | undefined; | ||
/** | ||
* The connection has been closed | ||
*/ | ||
onClose?: ((connection: Remote<Connection>, reason?: CloseReason, c?: Remote<ConnectionHandler> | undefined) => PromiseVow<void>) | undefined; | ||
onClose?: ((connection: Remote<Connection>, reason?: CloseReason, c?: Remote<ConnectionHandler>) => PromiseVow<void>) | undefined; | ||
}; | ||
@@ -167,3 +167,3 @@ /** | ||
*/ | ||
onInstantiate?: ((port: Remote<Port>, localAddr: Endpoint, remote: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<string>) | undefined; | ||
onInstantiate?: ((port: Remote<Port>, localAddr: Endpoint, remote: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<Endpoint>) | undefined; | ||
/** | ||
@@ -170,0 +170,0 @@ * A port initiates an outbound connection |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
130400
2850
1
+ Added@endo/errors@^1.2.8
Updated@endo/base64@^1.0.9
Updated@endo/far@^1.1.9
Updated@endo/pass-style@^1.4.7
Updated@endo/patterns@^1.4.7
Updated@endo/promise-kit@^1.1.8