@agoric/network 0.1.1-other-dev-d15096d.0.d15096d → 0.1.1-other-dev-ecf44df.0.ecf44df

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/network.d.ts CHANGED
@@ -16,23 +16,54 @@ export function prepareLoopbackProtocolHandler(zone: Zone, { watch, allVows }: V
16
16
  generatePortID(_localAddr: any, _protocolHandler: any): Promise<string>;
17
17
  onBind(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
18
18
  /**
19
- * @param {*} _port
19
+ * @param {Remote<Port>} _port
20
20
  * @param {Endpoint} localAddr
21
21
  * @param {Endpoint} remoteAddr
22
22
  * @returns {PromiseVow<AttemptDescription>}}
23
23
  */
24
- onConnect(_port: any, localAddr: Endpoint, remoteAddr: Endpoint): PromiseVow<AttemptDescription>;
24
+ onConnect(_port: Remote<Port>, localAddr: Endpoint, remoteAddr: Endpoint): PromiseVow<AttemptDescription>;
25
25
  onInstantiate(_port: any, _localAddr: any, _remote: any, _protocol: any): Promise<string>;
26
- onListen(port: any, localAddr: any, listenHandler: any, _protocolHandler: any): Promise<void>;
27
26
  /**
28
27
  * @param {Remote<Port>} port
29
28
  * @param {Endpoint} localAddr
30
- * @param {Remote<ListenHandler>} listenHandler
31
- * @param {*} _protocolHandler
29
+ * @param {Remote<Required<ListenHandler>>} listenHandler
30
+ * @param {unknown} _protocolHandler
32
31
  */
33
- onListenRemove(port: Remote<Port>, localAddr: Endpoint, listenHandler: Remote<ListenHandler>, _protocolHandler: any): Promise<void>;
32
+ onListen(port: Remote<Port>, localAddr: Endpoint, listenHandler: Remote<Required<ListenHandler>>, _protocolHandler: unknown): Promise<void>;
33
+ /**
34
+ * @param {Remote<Port>} port
35
+ * @param {Endpoint} localAddr
36
+ * @param {Remote<Required<ListenHandler>>} listenHandler
37
+ * @param {unknown} _protocolHandler
38
+ */
39
+ onListenRemove(port: Remote<Port>, localAddr: Endpoint, listenHandler: Remote<Required<ListenHandler>>, _protocolHandler: unknown): Promise<void>;
34
40
  onRevoke(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
35
- }>;
41
+ }, import("@endo/patterns").InterfaceGuard<{
42
+ onCreate: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
43
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
44
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
45
+ generatePortID: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
46
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
47
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
48
+ onBind: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
49
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
50
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
51
+ onListen: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
52
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
53
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
54
+ onListenRemove: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
55
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
56
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
57
+ onInstantiate: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
58
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
59
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
60
+ onConnect: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
61
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
62
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
63
+ onRevoke: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
64
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
65
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
66
+ }>>;
36
67
  /**
37
68
  * Compatibility note: this must match what our peers use, so don't change it
38
69
  * casually.
@@ -71,18 +102,51 @@ export function prepareEchoConnectionKit(zone: Zone): () => import("@endo/exo").
71
102
  * @param {ConnectionHandler} [_connectionHandler]
72
103
  */
73
104
  onClose(_connection: Connection, reason?: CloseReason, _connectionHandler?: ConnectionHandler): Promise<void>;
74
- }>>;
105
+ }, import("@endo/patterns").InterfaceGuard<{
106
+ onReceive: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], [import("@endo/patterns").MatcherOf<"splitRecord", [{}, {
107
+ relativeTimeoutNs: import("@endo/patterns").MatcherOf<"bigint", bigint>;
108
+ }, never]>], import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").SyncValueGuard>;
109
+ onClose: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>], [import("@endo/patterns").MatcherOf<"any", any>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").SyncValueGuard>;
110
+ }>>>;
75
111
  onListen(port: any, _listenHandler: any): Promise<void>;
76
112
  };
113
+ }, {
114
+ handler: import("@endo/patterns").InterfaceGuard<{
115
+ onReceive: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], [import("@endo/patterns").MatcherOf<"splitRecord", [{}, {
116
+ relativeTimeoutNs: import("@endo/patterns").MatcherOf<"bigint", bigint>;
117
+ }, never]>], import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").SyncValueGuard>;
118
+ onClose: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>], [import("@endo/patterns").MatcherOf<"any", any>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").SyncValueGuard>;
119
+ }>;
120
+ listener: import("@endo/patterns").InterfaceGuard<{
121
+ onListen: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
122
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
123
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
124
+ onAccept: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"remotable", any>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
125
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
126
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
127
+ }>;
77
128
  }>;
78
129
  export function preparePortAllocator(zone: Zone, { watch }: Powers): (args_0: {
79
130
  protocol: Protocol;
80
131
  }) => import("@endo/exo").Guarded<{
81
- allocateCustomIBCPort(specifiedName?: string): Promise<import("@agoric/vow").Vow<Port>>;
82
- allocateICAControllerPort(): Promise<import("@agoric/vow").Vow<Port>>;
83
- allocateICQControllerPort(): Promise<import("@agoric/vow").Vow<Port>>;
84
- allocateCustomLocalPort(specifiedName?: string): Promise<import("@agoric/vow").Vow<Port>>;
85
- }>;
132
+ allocateCustomIBCPort: (args_0?: string | undefined) => Promise<any>;
133
+ allocateICAControllerPort: () => Promise<any>;
134
+ allocateICQControllerPort: () => Promise<any>;
135
+ allocateCustomLocalPort: (args_0?: string | undefined) => Promise<any>;
136
+ }, import("@endo/patterns").InterfaceGuard<{
137
+ allocateCustomIBCPort: import("@endo/patterns").MethodGuard<"async", [], [import("@endo/patterns").MatcherOf<"string", string>], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
138
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
139
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
140
+ allocateICAControllerPort: import("@endo/patterns").MethodGuard<"async", [], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
141
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
142
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
143
+ allocateICQControllerPort: import("@endo/patterns").MethodGuard<"async", [], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
144
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
145
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
146
+ allocateCustomLocalPort: import("@endo/patterns").MethodGuard<"async", [], [import("@endo/patterns").MatcherOf<"string", string>], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
147
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", import("@endo/pass-style").Passable<import("@endo/pass-style").PassableCap, Error>>;
148
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
149
+ }>>;
86
150
  export function prepareNetworkPowers(zone: Zone, vowTools: VowTools): Powers;
87
151
  export type MakeEchoConnectionKit = ReturnType<typeof prepareEchoConnectionKit>;
88
152
  export type Powers = VowTools & {
@@ -96,23 +160,31 @@ export type ConnectionOpts = {
96
160
  l: 0 | 1;
97
161
  r: 0 | 1;
98
162
  };
163
+ export type RevokeState = (typeof RevokeState)[keyof typeof RevokeState];
99
164
  export type PortAllocator = ReturnType<ReturnType<typeof preparePortAllocator>>;
100
165
  export type Finalizer = ReturnType<typeof prepareFinalizer>;
101
166
  import type { Zone } from '@agoric/base-zone';
102
167
  import type { VowTools } from '@agoric/vow';
168
+ import type { Port } from './types.js';
169
+ import type { Remote } from '@agoric/vow';
103
170
  import type { Endpoint } from './types.js';
104
171
  import type { AttemptDescription } from './types.js';
105
172
  import type { PromiseVow } from '@agoric/vow';
106
- import type { Port } from './types.js';
107
- import type { Remote } from '@agoric/vow';
108
173
  import type { ListenHandler } from './types.js';
109
174
  import type { ConnectionHandler } from './types.js';
110
175
  import type { Connection } from './types.js';
111
176
  import type { Closable } from './types.js';
177
+ import type { WeakSetStore } from '@agoric/store';
112
178
  import type { ProtocolHandler } from './types.js';
113
179
  import type { Protocol } from './types.js';
114
180
  import type { Bytes } from './types.js';
115
181
  import type { CloseReason } from './types.js';
182
+ import type { MapStore } from '@agoric/store';
183
+ declare namespace RevokeState {
184
+ let NOT_REVOKED: 0;
185
+ let REVOKING: 1;
186
+ let REVOKED: 2;
187
+ }
116
188
  /** @typedef {ReturnType<ReturnType<typeof preparePortAllocator>>} PortAllocator */
117
189
  /**
118
190
  * Return a package-specific singleton that pins obj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,CAAC;OACH,CAAC,GAAC,CAAC;;0BAoVH,CAAA,OAAO,WAAW,EAAC,MAAM,OAAO,WAAW,CAAC;4BAkrC5C,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;wBA6EnD,UAAU,CAAC,OAAO,gBAAgB,CAAC;0BA3pD1B,mBAAmB;8BADK,aAAa;0BAD2I,YAAY;4BACpK,aAAa;8BAD2I,YAAY;wCAAZ,YAAY;gCACpK,aAAa;mCAD2I,YAAY;uCAAZ,YAAY;gCAAZ,YAAY;8BAAZ,YAAY;kCAIpL,eAAe;qCAJyJ,YAAY;8BAAZ,YAAY;2BAAZ,YAAY;iCAAZ,YAAY;8BAGxL,eAAe;;;;;;AA6kD1C,mFAAmF;AAEnF;;;;;;;;;;GAUG;AACH,wCAHW,IAAI,aACJ,QAAQ;;IAcf;;;;;OAKG;yBAFQ,OAAO,UAAU,CAAC,WAClB,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAK9C;;;;OAIG;uBADQ,OAAO;QAAE,KAAK,IAAI,WAAW,GAAG,CAAC,CAAA;KAAE,CAAC;;;GA2BlD"}
package/src/network.js CHANGED
@@ -1,7 +1,5 @@
1
1
  // @ts-check
2
2
 
3
- /// <reference types="@agoric/store/exported.js" />
4
-
5
3
  import { Fail } from '@endo/errors';
6
4
  import { E } from '@endo/far';
7
5
  import { M } from '@endo/patterns';
@@ -10,9 +8,12 @@ import { Shape } from './shapes.js';
10
8
 
11
9
  /// <reference path="./types.js" />
12
10
  /**
13
- * @import {AttemptDescription, Bytes, CloseReason, Closable, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl, SendOptions} from './types.js';
11
+ * @import {AttemptDescription, Bytes, CloseReason, Closable, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl, SendOptions, InboundAttempt} from './types.js';
14
12
  * @import {PromiseVow, Remote, VowTools} from '@agoric/vow';
15
13
  * @import {Zone} from '@agoric/base-zone';
14
+ * @import {MapStore} from '@agoric/store';
15
+ * @import {WeakSetStore} from '@agoric/store';
16
+ * @import {SetStore} from '@agoric/store';
16
17
  */
17
18
 
18
19
  /** @typedef {VowTools & { finalizer: Finalizer }} Powers */
@@ -158,6 +159,9 @@ const prepareHalfConnection = (zone, { watch, allVows, finalizer }) => {
158
159
  },
159
160
  },
160
161
  openConnectionAckWatcher: {
162
+ /**
163
+ * @param {Bytes | undefined} ack
164
+ */
161
165
  onFulfilled(ack) {
162
166
  return toBytes(ack || '');
163
167
  },
@@ -359,6 +363,15 @@ const prepareInboundAttempt = (zone, makeConnection, { watch, finalizer }) => {
359
363
  },
360
364
  },
361
365
  inboundAttemptAcceptWatcher: {
366
+ /**
367
+ * @param {unknown} lchandler
368
+ * @param {{
369
+ * localAddress: string;
370
+ * rchandler: Remote<ConnectionHandler>;
371
+ * remoteAddress: string;
372
+ * current: SetStore<Closable>;
373
+ * }} watchContext
374
+ */
362
375
  onFulfilled(lchandler, watchContext) {
363
376
  const { localAddress, rchandler, remoteAddress, current } =
364
377
  watchContext;
@@ -409,7 +422,7 @@ const prepareInboundAttempt = (zone, makeConnection, { watch, finalizer }) => {
409
422
  return makeInboundAttempt;
410
423
  };
411
424
 
412
- /** @enum {typeof RevokeState[keyof typeof RevokeState]} */
425
+ /** @typedef {typeof RevokeState[keyof typeof RevokeState]} RevokeState */
413
426
  const RevokeState = /** @type {const} */ ({
414
427
  NOT_REVOKED: 0,
415
428
  REVOKING: 1,
@@ -568,18 +581,30 @@ const preparePort = (zone, powers) => {
568
581
  },
569
582
  },
570
583
  portAddListenerWatcher: {
584
+ /**
585
+ * @param {unknown} _value
586
+ * @param {{ listenHandler: Remote<Required<ListenHandler>> }} watcherContext
587
+ */
571
588
  onFulfilled(_value, watcherContext) {
572
589
  const { listenHandler } = watcherContext;
573
590
  return E(listenHandler).onListen(this.facets.port, listenHandler);
574
591
  },
575
592
  },
576
593
  portRemoveListenerWatcher: {
594
+ /**
595
+ * @param {unknown} _value
596
+ * @param {{ listenHandler: Remote<Required<ListenHandler>> }} watcherContext
597
+ */
577
598
  onFulfilled(_value, watcherContext) {
578
599
  const { listenHandler } = watcherContext;
579
600
  return E(listenHandler).onRemove(this.facets.port, listenHandler);
580
601
  },
581
602
  },
582
603
  portConnectWatcher: {
604
+ /**
605
+ * @param {Remote<Connection>} conn
606
+ * @param {{ chandler: Remote<Required<ConnectionHandler>> }} ctx
607
+ */
583
608
  onFulfilled(conn, { chandler }) {
584
609
  const { openConnections, revoked } = this.state;
585
610
 
@@ -902,6 +927,15 @@ const prepareBinder = (zone, powers) => {
902
927
  },
903
928
  },
904
929
  binderInboundInstantiateWatcher: {
930
+ /**
931
+ * @param {string | undefined} localInstance
932
+ * @param {{
933
+ * listenAddr: string;
934
+ * remoteAddr: string;
935
+ * port: Port;
936
+ * listenPrefixIndex: number;
937
+ * }} watchContext
938
+ */
905
939
  onFulfilled(localInstance, watchContext) {
906
940
  const { listenAddr, remoteAddr, port, listenPrefixIndex } =
907
941
  watchContext;
@@ -926,6 +960,15 @@ const prepareBinder = (zone, powers) => {
926
960
  },
927
961
  },
928
962
  binderInboundInstantiateCatchWatcher: {
963
+ /**
964
+ * @param {Error} e
965
+ * @param {{
966
+ * lastFailure: Error;
967
+ * listenPrefixIndex: number;
968
+ * listenAddr: string;
969
+ * remoteAddr: string;
970
+ * }} watchContext
971
+ */
929
972
  onRejected(e, watchContext) {
930
973
  let { lastFailure, listenPrefixIndex } = watchContext;
931
974
 
@@ -993,6 +1036,10 @@ const prepareBinder = (zone, powers) => {
993
1036
  },
994
1037
  },
995
1038
  binderOutboundInstantiateWatcher: {
1039
+ /**
1040
+ * @param {string | undefined} localInstance
1041
+ * @param {{ localAddr: string }} watchContext
1042
+ */
996
1043
  onFulfilled(localInstance, watchContext) {
997
1044
  const { localAddr } = watchContext;
998
1045
 
@@ -1000,6 +1047,16 @@ const prepareBinder = (zone, powers) => {
1000
1047
  },
1001
1048
  },
1002
1049
  binderOutboundConnectWatcher: {
1050
+ /**
1051
+ * @param {{ handler: Remote<ConnectionHandler>; remoteAddress: string; localAddress: string }} arg0
1052
+ * @param {{
1053
+ * lastFailure: Error;
1054
+ * lchandler: Remote<ConnectionHandler>;
1055
+ * localAddr: string;
1056
+ * remoteAddr: string;
1057
+ * port: Port;
1058
+ * }} watchContext
1059
+ */
1003
1060
  onFulfilled(
1004
1061
  {
1005
1062
  handler: rchandler,
@@ -1037,6 +1094,15 @@ const prepareBinder = (zone, powers) => {
1037
1094
  },
1038
1095
  },
1039
1096
  binderOutboundCatchWatcher: {
1097
+ /**
1098
+ * @param {Error} e
1099
+ * @param {{
1100
+ * port: Port;
1101
+ * remoteAddr: string;
1102
+ * lchandler: Remote<ConnectionHandler>;
1103
+ * localAddr: string;
1104
+ * }} watchContext
1105
+ */
1040
1106
  onRejected(e, watchContext) {
1041
1107
  let lastFailure;
1042
1108
 
@@ -1070,6 +1136,10 @@ const prepareBinder = (zone, powers) => {
1070
1136
  },
1071
1137
  },
1072
1138
  binderOutboundInboundWatcher: {
1139
+ /**
1140
+ * @param {string | undefined} initialLocalAddress
1141
+ * @param {{ remoteAddr: string; localAddr: string }} watchContext
1142
+ */
1073
1143
  onFulfilled(initialLocalAddress, watchContext) {
1074
1144
  const { remoteAddr, localAddr } = watchContext;
1075
1145
 
@@ -1085,12 +1155,20 @@ const prepareBinder = (zone, powers) => {
1085
1155
  },
1086
1156
  },
1087
1157
  binderOutboundAcceptWatcher: {
1158
+ /**
1159
+ * @param {InboundAttempt} attempt
1160
+ * @param {{ handler: Remote<Required<ConnectionHandler>> }} watchContext
1161
+ */
1088
1162
  onFulfilled(attempt, watchContext) {
1089
1163
  const { handler } = watchContext;
1090
1164
  return E(attempt).accept({ handler });
1091
1165
  },
1092
1166
  },
1093
1167
  binderBindGeneratePortWatcher: {
1168
+ /**
1169
+ * @param {string} portID
1170
+ * @param {{ localAddr: string; underspecified: boolean }} watchContext
1171
+ */
1094
1172
  onFulfilled(portID, watchContext) {
1095
1173
  const { localAddr, underspecified } = watchContext;
1096
1174
  const { protocolHandler, boundPorts } = this.state;
@@ -1111,6 +1189,10 @@ const prepareBinder = (zone, powers) => {
1111
1189
  },
1112
1190
  },
1113
1191
  binderPortWatcher: {
1192
+ /**
1193
+ * @param {unknown} _value
1194
+ * @param {{ port: Port; localAddr: string }} watchContext
1195
+ */
1114
1196
  onFulfilled(_value, watchContext) {
1115
1197
  const { port, localAddr } = watchContext;
1116
1198
  const { boundPorts, currentConnections } = this.state;
@@ -1344,7 +1426,7 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
1344
1426
  // noop, for now; Maybe handle a bind?
1345
1427
  },
1346
1428
  /**
1347
- * @param {*} _port
1429
+ * @param {Remote<Port>} _port
1348
1430
  * @param {Endpoint} localAddr
1349
1431
  * @param {Endpoint} remoteAddr
1350
1432
  * @returns {PromiseVow<AttemptDescription>}}
@@ -1382,6 +1464,12 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
1382
1464
  this.state.instanceNonce += 1n;
1383
1465
  return `${instancePrefix}${this.state.instanceNonce}`;
1384
1466
  },
1467
+ /**
1468
+ * @param {Remote<Port>} port
1469
+ * @param {Endpoint} localAddr
1470
+ * @param {Remote<Required<ListenHandler>>} listenHandler
1471
+ * @param {unknown} _protocolHandler
1472
+ */
1385
1473
  async onListen(port, localAddr, listenHandler, _protocolHandler) {
1386
1474
  const { listeners } = this.state;
1387
1475
 
@@ -1413,8 +1501,8 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
1413
1501
  /**
1414
1502
  * @param {Remote<Port>} port
1415
1503
  * @param {Endpoint} localAddr
1416
- * @param {Remote<ListenHandler>} listenHandler
1417
- * @param {*} _protocolHandler
1504
+ * @param {Remote<Required<ListenHandler>>} listenHandler
1505
+ * @param {unknown} _protocolHandler
1418
1506
  */
1419
1507
  async onListenRemove(port, localAddr, listenHandler, _protocolHandler) {
1420
1508
  const { listeners } = this.state;
@@ -1434,6 +1522,7 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
1434
1522
  },
1435
1523
  },
1436
1524
  protocolHandlerConnectWatcher: {
1525
+ /** @param {[InboundAttempt, Remote<Required<ConnectionHandler>>]} results */
1437
1526
  onFulfilled(results) {
1438
1527
  return {
1439
1528
  remoteInstance: results[0],
@@ -1579,7 +1668,7 @@ const prepareFinalizer = (zone, { watch }) => {
1579
1668
  },
1580
1669
  finalize(obj) {
1581
1670
  if (!objToFinalizerInfo.has(obj)) {
1582
- return;
1671
+ return undefined;
1583
1672
  }
1584
1673
  const disposeInfo = objToFinalizerInfo.get(obj);
1585
1674
  if ('conn' in disposeInfo) {
@@ -1593,6 +1682,7 @@ const prepareFinalizer = (zone, { watch }) => {
1593
1682
  objToFinalizerInfo.delete(obj);
1594
1683
  return watch(E(closer).close());
1595
1684
  }
1685
+ return undefined;
1596
1686
  },
1597
1687
  unpin(obj) {
1598
1688
  objToFinalizerInfo.delete(obj);
package/src/router.d.ts CHANGED
@@ -3,9 +3,11 @@
3
3
  * @import {PromiseVow, Remote, VowTools} from '@agoric/vow';
4
4
  * @import {Zone} from '@agoric/base-zone';
5
5
  * @import {Powers} from './network.js';
6
+ * @import {MapStore} from '@agoric/store';
7
+ * @import {CopyTagged, Passable} from '@endo/pass-style';
6
8
  */
7
9
  /**
8
- * @template T
10
+ * @template {Protocol} T
9
11
  * @typedef {object} Router A delimited string router implementation
10
12
  * @property {(addr: string) => [string, T][]} getRoutes Return the match and
11
13
  * route in order of preference
@@ -15,11 +17,11 @@
15
17
  * prefix->route from the database
16
18
  */
17
19
  export const RouterI: import("@endo/patterns").InterfaceGuard<{
18
- getRoutes: import("@endo/patterns").MethodGuard;
19
- register: import("@endo/patterns").MethodGuard;
20
- unregister: import("@endo/patterns").MethodGuard;
20
+ getRoutes: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"string", string>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"arrayOf", (import("@endo/patterns").MatcherOf<"string", string> | import("@endo/patterns").MatcherOf<"any", any>)[]>, import("@endo/patterns").SyncValueGuard>;
21
+ register: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").SyncValueGuard>;
22
+ unregister: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").SyncValueGuard>;
21
23
  }>;
22
- export function prepareRouter<T>(zone: Zone): () => import("@endo/exo").Guarded<{
24
+ export function prepareRouter<T extends Passable>(zone: Zone): () => import("@endo/exo").Guarded<{
23
25
  /** @param {Endpoint} addr */
24
26
  getRoutes(addr: Endpoint): [string, T][];
25
27
  /**
@@ -32,25 +34,26 @@ export function prepareRouter<T>(zone: Zone): () => import("@endo/exo").Guarded<
32
34
  * @param {T} route
33
35
  */
34
36
  unregister(prefix: string, route: T): void;
35
- }>;
37
+ }, import("@endo/patterns").InterfaceGuard<{
38
+ getRoutes: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"string", string>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"arrayOf", (import("@endo/patterns").MatcherOf<"string", string> | import("@endo/patterns").MatcherOf<"any", any>)[]>, import("@endo/patterns").SyncValueGuard>;
39
+ register: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").SyncValueGuard>;
40
+ unregister: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"any", any>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"kind", "undefined">, import("@endo/patterns").SyncValueGuard>;
41
+ }>>;
36
42
  export function prepareRouterProtocol(zone: Zone, powers: Powers, E?: typeof defaultE): () => import("@endo/exo").Guarded<{
37
- /**
38
- * @param {string[]} paths
39
- * @param {Remote<ProtocolHandler>} protocolHandler
40
- */
41
- registerProtocolHandler(paths: string[], protocolHandler: Remote<ProtocolHandler>): void;
42
- /**
43
- * @param {string} prefix
44
- * @param {Remote<ProtocolHandler>} protocolHandler
45
- */
46
- unregisterProtocolHandler(prefix: string, protocolHandler: Remote<ProtocolHandler>): void;
47
- /** @param {Endpoint} localAddr */
48
- bindPort(localAddr: Endpoint): Promise<Port | import("@agoric/vow").Vow<Port>>;
49
- }>;
43
+ registerProtocolHandler: (args_0: string[], args_1: any) => any;
44
+ unregisterProtocolHandler: (args_0: string, args_1: any) => any;
45
+ bindPort: (args_0: string) => Promise<any>;
46
+ }, import("@endo/patterns").InterfaceGuard<{
47
+ registerProtocolHandler: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"arrayOf", import("@endo/patterns").MatcherOf<"string", string>>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
48
+ unregisterProtocolHandler: import("@endo/patterns").MethodGuard<"sync", [import("@endo/patterns").MatcherOf<"string", string>, import("@endo/patterns").MatcherOf<"remotable", any>], import("@endo/patterns").ArgGuard[], any, import("@endo/patterns").SyncValueGuard>;
49
+ bindPort: import("@endo/patterns").MethodGuard<"async", [import("@endo/patterns").MatcherOf<"string", string>], import("@endo/patterns").ArgGuard[], import("@endo/patterns").MatcherOf<"or", [any, import("@endo/patterns").MatcherOf<"tagged", ["Vow", {
50
+ vowV0: import("@endo/patterns").MatcherOf<"remotable", Passable<import("@endo/pass-style").PassableCap, Error>>;
51
+ }]>]>, import("@endo/patterns").SyncValueGuard>;
52
+ }>>;
50
53
  /**
51
54
  * A delimited string router implementation
52
55
  */
53
- export type Router<T> = {
56
+ export type Router<T extends Protocol> = {
54
57
  /**
55
58
  * Return the match and
56
59
  * route in order of preference
@@ -72,12 +75,13 @@ export type RouterProtocol = {
72
75
  registerProtocolHandler: (paths: string[], protocolHandler: ProtocolHandler) => void;
73
76
  unregisterProtocolHandler: (prefix: string, protocolHandler: ProtocolHandler) => void;
74
77
  };
78
+ import type { Passable } from '@endo/pass-style';
75
79
  import type { Zone } from '@agoric/base-zone';
76
80
  import type { Endpoint } from './types.js';
77
81
  import type { Powers } from './network.js';
78
82
  import { E as defaultE } from '@endo/far';
79
- import type { ProtocolHandler } from './types.js';
80
- import type { Remote } from '@agoric/vow';
83
+ import type { Protocol } from './types.js';
81
84
  import type { Port } from './types.js';
82
85
  import type { PromiseVow } from '@agoric/vow';
86
+ import type { ProtocolHandler } from './types.js';
83
87
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["router.js"],"names":[],"mappings":"AAWA;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH;;;;GAIG;AAMI,8BAHM,CAAC,QACH,IAAI;IAiBT,6BAA6B;oBAAjB,QAAQ;IAyBpB;;;OAGG;qBAFQ,MAAM,SACN,CAAC;IAKZ;;;OAGG;uBAFQ,MAAM,SACN,CAAC;GAWjB;AAgBM,4CAJI,IAAI,UACJ,MAAM,MACN,OAAO,QAAQ;IAmCpB;;;OAGG;mCAFQ,MAAM,EAAE,mBACR,OAAO,eAAe,CAAC;IAYlC;;;OAGG;sCAFQ,MAAM,mBACN,OAAO,eAAe,CAAC;IAclC,kCAAkC;wBAAtB,QAAQ;GAUzB;;;;mBAzKY,CAAC;;;;;eAEA,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE;;;;;cAE/B,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI;;;;;gBAElC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,YAAY;4BAG/C,cAAc;8BATT,WAAW;8BAMmB,YAAY;0BAAZ,YAAY;gCACzB,aAAa;qCADA,YAAY"}
package/src/router.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // @ts-check
2
2
 
3
- /// <reference types="@agoric/store/exported.js" />
4
3
  /// <reference path="./types.js" />
5
4
 
6
5
  import { Fail } from '@endo/errors';
@@ -14,10 +13,12 @@ import { Shape } from './shapes.js';
14
13
  * @import {PromiseVow, Remote, VowTools} from '@agoric/vow';
15
14
  * @import {Zone} from '@agoric/base-zone';
16
15
  * @import {Powers} from './network.js';
16
+ * @import {MapStore} from '@agoric/store';
17
+ * @import {CopyTagged, Passable} from '@endo/pass-style';
17
18
  */
18
19
 
19
20
  /**
20
- * @template T
21
+ * @template {Protocol} T
21
22
  * @typedef {object} Router A delimited string router implementation
22
23
  * @property {(addr: string) => [string, T][]} getRoutes Return the match and
23
24
  * route in order of preference
@@ -34,7 +35,7 @@ export const RouterI = M.interface('Router', {
34
35
  });
35
36
 
36
37
  /**
37
- * @template T
38
+ * @template {Passable} T
38
39
  * @param {Zone} zone
39
40
  */
40
41
  export const prepareRouter = zone => {
@@ -131,6 +132,7 @@ export const prepareRouterProtocol = (zone, powers, E = defaultE) => {
131
132
  }),
132
133
  () => {
133
134
  /** @type {Router<Protocol>} */
135
+ // @ts-expect-error cast
134
136
  const router = makeRouter();
135
137
 
136
138
  /** @type {MapStore<string, Protocol>} */