@agoric/network 0.1.1-other-dev-fbe72e7.0.fbe72e7 → 0.1.1-other-dev-d15096d.0.d15096d
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/README.md +7 -1
- package/package.json +9 -9
- package/src/network.d.ts +13 -12
- package/src/network.d.ts.map +1 -1
- package/src/network.js +13 -12
- package/src/router.d.ts +6 -2
- package/src/router.d.ts.map +1 -1
- package/src/router.js +5 -3
- package/src/types.d.ts +4 -2
- package/src/types.d.ts.map +1 -1
- package/src/types.js +4 -2
package/README.md
CHANGED
|
@@ -48,7 +48,13 @@ You must also prepare a `ConnectionHandler` object to manage the connection you'
|
|
|
48
48
|
Then you will call the `connect()` method on your local `Port`. This will return a `Promise` that will fire with a new `Connection` object, on which you can send data. Your `ConnectionHandler` will be notified about the new channel, and will receive inbound data from the other side.
|
|
49
49
|
|
|
50
50
|
```js
|
|
51
|
-
|
|
51
|
+
import { encodeIbcEndpoint } from '@agoric/vats/tools/ibc-utils.js';
|
|
52
|
+
const remoteEndpoint = encodeIbcEndpoint({
|
|
53
|
+
hops: [connectionID],
|
|
54
|
+
portID,
|
|
55
|
+
order: 'ordered',
|
|
56
|
+
version
|
|
57
|
+
});;
|
|
52
58
|
E(home.ibcport[0]).connect(remoteEndpoint, connectionHandler)
|
|
53
59
|
.then(conn => doSomethingWithConnection(conn));
|
|
54
60
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/network",
|
|
3
|
-
"version": "0.1.1-other-dev-
|
|
3
|
+
"version": "0.1.1-other-dev-d15096d.0.d15096d",
|
|
4
4
|
"description": "Agoric's network protocol API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"author": "Agoric",
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@agoric/internal": "0.3.3-other-dev-
|
|
25
|
-
"@agoric/store": "0.9.3-other-dev-
|
|
26
|
-
"@agoric/vat-data": "0.5.3-other-dev-
|
|
24
|
+
"@agoric/internal": "0.3.3-other-dev-d15096d.0.d15096d",
|
|
25
|
+
"@agoric/store": "0.9.3-other-dev-d15096d.0.d15096d",
|
|
26
|
+
"@agoric/vat-data": "0.5.3-other-dev-d15096d.0.d15096d",
|
|
27
27
|
"@endo/base64": "^1.0.12",
|
|
28
28
|
"@endo/errors": "^1.2.13",
|
|
29
29
|
"@endo/far": "^1.1.14",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@endo/promise-kit": "^1.1.13"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@agoric/swingset-liveslots": "0.10.3-other-dev-
|
|
36
|
-
"@agoric/swingset-vat": "0.32.3-other-dev-
|
|
37
|
-
"@agoric/vow": "0.1.1-other-dev-
|
|
38
|
-
"@agoric/zone": "0.2.3-other-dev-
|
|
35
|
+
"@agoric/swingset-liveslots": "0.10.3-other-dev-d15096d.0.d15096d",
|
|
36
|
+
"@agoric/swingset-vat": "0.32.3-other-dev-d15096d.0.d15096d",
|
|
37
|
+
"@agoric/vow": "0.1.1-other-dev-d15096d.0.d15096d",
|
|
38
|
+
"@agoric/zone": "0.2.3-other-dev-d15096d.0.d15096d",
|
|
39
39
|
"@endo/bundle-source": "^4.1.2",
|
|
40
40
|
"ava": "^5.3.0",
|
|
41
41
|
"c8": "^10.1.3"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"typeCoverage": {
|
|
69
69
|
"atLeast": 91.16
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "d15096dc4ff8b96e9b6cd11954c20d3a9efbb393"
|
|
72
72
|
}
|
package/src/network.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ export function getPrefixes(addr: string): string[];
|
|
|
8
8
|
/**
|
|
9
9
|
* Create a protocol handler that just connects to itself.
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {Zone} zone
|
|
12
12
|
* @param {VowTools} powers
|
|
13
13
|
*/
|
|
14
|
-
export function prepareLoopbackProtocolHandler(zone:
|
|
14
|
+
export function prepareLoopbackProtocolHandler(zone: Zone, { watch, allVows }: VowTools): (instancePrefix?: string) => import("@endo/exo").Guarded<{
|
|
15
15
|
onCreate(_impl: any, _protocolHandler: any): Promise<void>;
|
|
16
16
|
generatePortID(_localAddr: any, _protocolHandler: any): Promise<string>;
|
|
17
17
|
onBind(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
|
|
@@ -19,9 +19,9 @@ export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone")
|
|
|
19
19
|
* @param {*} _port
|
|
20
20
|
* @param {Endpoint} localAddr
|
|
21
21
|
* @param {Endpoint} remoteAddr
|
|
22
|
-
* @returns {
|
|
22
|
+
* @returns {PromiseVow<AttemptDescription>}}
|
|
23
23
|
*/
|
|
24
|
-
onConnect(_port: any, localAddr: Endpoint, remoteAddr: Endpoint):
|
|
24
|
+
onConnect(_port: any, localAddr: Endpoint, remoteAddr: Endpoint): PromiseVow<AttemptDescription>;
|
|
25
25
|
onInstantiate(_port: any, _localAddr: any, _remote: any, _protocol: any): Promise<string>;
|
|
26
26
|
onListen(port: any, localAddr: any, listenHandler: any, _protocolHandler: any): Promise<void>;
|
|
27
27
|
/**
|
|
@@ -40,9 +40,9 @@ export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone")
|
|
|
40
40
|
export const ENDPOINT_SEPARATOR: "/";
|
|
41
41
|
export const CLOSE_REASON_FINALIZER: "closed-by-finalizer";
|
|
42
42
|
export function rethrowUnlessMissing(err: unknown): undefined;
|
|
43
|
-
export function crossoverConnection(zone:
|
|
44
|
-
export function prepareNetworkProtocol(zone:
|
|
45
|
-
export function prepareEchoConnectionKit(zone:
|
|
43
|
+
export function crossoverConnection(zone: Zone, handler0: Remote<Required<ConnectionHandler>>, addr0: Endpoint, handler1: Remote<Required<ConnectionHandler>>, addr1: Endpoint, makeConnection: (opts: ConnectionOpts) => Connection, finalizer: Finalizer, current?: WeakSetStore<Closable>): Connection[];
|
|
44
|
+
export function prepareNetworkProtocol(zone: Zone, powers: Powers): (protocolHandler: Remote<ProtocolHandler>) => Protocol;
|
|
45
|
+
export function prepareEchoConnectionKit(zone: Zone): () => import("@endo/exo").GuardedKit<{
|
|
46
46
|
handler: {
|
|
47
47
|
/**
|
|
48
48
|
* @param {Connection} _connection
|
|
@@ -75,7 +75,7 @@ export function prepareEchoConnectionKit(zone: import("@agoric/base-zone").Zone)
|
|
|
75
75
|
onListen(port: any, _listenHandler: any): Promise<void>;
|
|
76
76
|
};
|
|
77
77
|
}>;
|
|
78
|
-
export function preparePortAllocator(zone:
|
|
78
|
+
export function preparePortAllocator(zone: Zone, { watch }: Powers): (args_0: {
|
|
79
79
|
protocol: Protocol;
|
|
80
80
|
}) => import("@endo/exo").Guarded<{
|
|
81
81
|
allocateCustomIBCPort(specifiedName?: string): Promise<import("@agoric/vow").Vow<Port>>;
|
|
@@ -83,7 +83,7 @@ export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { w
|
|
|
83
83
|
allocateICQControllerPort(): Promise<import("@agoric/vow").Vow<Port>>;
|
|
84
84
|
allocateCustomLocalPort(specifiedName?: string): Promise<import("@agoric/vow").Vow<Port>>;
|
|
85
85
|
}>;
|
|
86
|
-
export function prepareNetworkPowers(zone:
|
|
86
|
+
export function prepareNetworkPowers(zone: Zone, vowTools: VowTools): Powers;
|
|
87
87
|
export type MakeEchoConnectionKit = ReturnType<typeof prepareEchoConnectionKit>;
|
|
88
88
|
export type Powers = VowTools & {
|
|
89
89
|
finalizer: Finalizer;
|
|
@@ -98,9 +98,11 @@ export type ConnectionOpts = {
|
|
|
98
98
|
};
|
|
99
99
|
export type PortAllocator = ReturnType<ReturnType<typeof preparePortAllocator>>;
|
|
100
100
|
export type Finalizer = ReturnType<typeof prepareFinalizer>;
|
|
101
|
+
import type { Zone } from '@agoric/base-zone';
|
|
101
102
|
import type { VowTools } from '@agoric/vow';
|
|
102
103
|
import type { Endpoint } from './types.js';
|
|
103
104
|
import type { AttemptDescription } from './types.js';
|
|
105
|
+
import type { PromiseVow } from '@agoric/vow';
|
|
104
106
|
import type { Port } from './types.js';
|
|
105
107
|
import type { Remote } from '@agoric/vow';
|
|
106
108
|
import type { ListenHandler } from './types.js';
|
|
@@ -120,10 +122,10 @@ import type { CloseReason } from './types.js';
|
|
|
120
122
|
* The reason this functionality wasn't just baked into the other network exos
|
|
121
123
|
* is to maintain upgrade-compatible with minimal additional changes.
|
|
122
124
|
*
|
|
123
|
-
* @param {
|
|
125
|
+
* @param {Zone} zone
|
|
124
126
|
* @param {VowTools} vowTools
|
|
125
127
|
*/
|
|
126
|
-
declare function prepareFinalizer(zone:
|
|
128
|
+
declare function prepareFinalizer(zone: Zone, { watch }: VowTools): import("@endo/exo").Guarded<{
|
|
127
129
|
has(obj: any): boolean;
|
|
128
130
|
/**
|
|
129
131
|
* Add a connection and handler for an `onClose` method to be called upon
|
|
@@ -143,6 +145,5 @@ declare function prepareFinalizer(zone: import("@agoric/base-zone").Zone, { watc
|
|
|
143
145
|
finalize(obj: any): import("@agoric/vow").Vow<any> | undefined;
|
|
144
146
|
unpin(obj: any): void;
|
|
145
147
|
}>;
|
|
146
|
-
import type { PromiseVow } from '@agoric/vow';
|
|
147
148
|
export {};
|
|
148
149
|
//# sourceMappingURL=network.d.ts.map
|
package/src/network.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["network.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["network.js"],"names":[],"mappings":"AA4CA;;;;GAIG;AACH,kCAFW,MAAM,YAahB;AA4tCD,mFAAmF;AAEnF;;;;;GAKG;AACH,qDAHW,IAAI,sBACJ,QAAQ,qBAkJL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,CAAC;OACtB,CAAC,GAAC,CAAC;OACH,CAAC,GAAC,CAAC;;4BA86CH,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;wBA4EnD,UAAU,CAAC,OAAO,gBAAgB,CAAC;0BA/jD1B,mBAAmB;8BADK,aAAa;8BAD2H,YAAY;wCAAZ,YAAY;gCACpJ,aAAa;0BAD2H,YAAY;4BACpJ,aAAa;mCAD2H,YAAY;uCAAZ,YAAY;gCAAZ,YAAY;8BAAZ,YAAY;qCAAZ,YAAY;8BAAZ,YAAY;2BAAZ,YAAY;iCAAZ,YAAY;AAq/CnM,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;;;GA0BlD"}
|
package/src/network.js
CHANGED
|
@@ -12,6 +12,7 @@ import { Shape } from './shapes.js';
|
|
|
12
12
|
/**
|
|
13
13
|
* @import {AttemptDescription, Bytes, CloseReason, Closable, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl, SendOptions} from './types.js';
|
|
14
14
|
* @import {PromiseVow, Remote, VowTools} from '@agoric/vow';
|
|
15
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
/** @typedef {VowTools & { finalizer: Finalizer }} Powers */
|
|
@@ -84,7 +85,7 @@ function throwIfInvalidPortName(specifiedName) {
|
|
|
84
85
|
*/
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
|
-
* @param {
|
|
88
|
+
* @param {Zone} zone
|
|
88
89
|
* @param {Powers} powers
|
|
89
90
|
*/
|
|
90
91
|
const prepareHalfConnection = (zone, { watch, allVows, finalizer }) => {
|
|
@@ -190,7 +191,7 @@ const prepareHalfConnection = (zone, { watch, allVows, finalizer }) => {
|
|
|
190
191
|
};
|
|
191
192
|
|
|
192
193
|
/**
|
|
193
|
-
* @param {
|
|
194
|
+
* @param {Zone} zone
|
|
194
195
|
* @param {Remote<Required<ConnectionHandler>>} handler0
|
|
195
196
|
* @param {Endpoint} addr0
|
|
196
197
|
* @param {Remote<Required<ConnectionHandler>>} handler1
|
|
@@ -252,7 +253,7 @@ export const crossoverConnection = (
|
|
|
252
253
|
};
|
|
253
254
|
|
|
254
255
|
/**
|
|
255
|
-
* @param {
|
|
256
|
+
* @param {Zone} zone
|
|
256
257
|
* @param {(opts: ConnectionOpts) => Connection} makeConnection
|
|
257
258
|
* @param {Powers} powers
|
|
258
259
|
*/
|
|
@@ -417,7 +418,7 @@ const RevokeState = /** @type {const} */ ({
|
|
|
417
418
|
harden(RevokeState);
|
|
418
419
|
|
|
419
420
|
/**
|
|
420
|
-
* @param {
|
|
421
|
+
* @param {Zone} zone
|
|
421
422
|
* @param {Powers} powers
|
|
422
423
|
*/
|
|
423
424
|
const preparePort = (zone, powers) => {
|
|
@@ -665,7 +666,7 @@ const preparePort = (zone, powers) => {
|
|
|
665
666
|
};
|
|
666
667
|
|
|
667
668
|
/**
|
|
668
|
-
* @param {
|
|
669
|
+
* @param {Zone} zone
|
|
669
670
|
* @param {Powers} powers
|
|
670
671
|
*/
|
|
671
672
|
const prepareBinder = (zone, powers) => {
|
|
@@ -1182,7 +1183,7 @@ const prepareBinder = (zone, powers) => {
|
|
|
1182
1183
|
};
|
|
1183
1184
|
|
|
1184
1185
|
/**
|
|
1185
|
-
* @param {
|
|
1186
|
+
* @param {Zone} zone
|
|
1186
1187
|
* @param {Powers} powers
|
|
1187
1188
|
*/
|
|
1188
1189
|
export const prepareNetworkProtocol = (zone, powers) => {
|
|
@@ -1222,7 +1223,7 @@ export const prepareNetworkProtocol = (zone, powers) => {
|
|
|
1222
1223
|
/**
|
|
1223
1224
|
* Create a ConnectionHandler that just echoes its packets.
|
|
1224
1225
|
*
|
|
1225
|
-
* @param {
|
|
1226
|
+
* @param {Zone} zone
|
|
1226
1227
|
*/
|
|
1227
1228
|
export const prepareEchoConnectionKit = zone => {
|
|
1228
1229
|
const makeEchoConnectionKit = zone.exoClassKit(
|
|
@@ -1306,7 +1307,7 @@ export const prepareEchoConnectionKit = zone => {
|
|
|
1306
1307
|
/**
|
|
1307
1308
|
* Create a protocol handler that just connects to itself.
|
|
1308
1309
|
*
|
|
1309
|
-
* @param {
|
|
1310
|
+
* @param {Zone} zone
|
|
1310
1311
|
* @param {VowTools} powers
|
|
1311
1312
|
*/
|
|
1312
1313
|
export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
|
|
@@ -1346,7 +1347,7 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
|
|
|
1346
1347
|
* @param {*} _port
|
|
1347
1348
|
* @param {Endpoint} localAddr
|
|
1348
1349
|
* @param {Endpoint} remoteAddr
|
|
1349
|
-
* @returns {
|
|
1350
|
+
* @returns {PromiseVow<AttemptDescription>}}
|
|
1350
1351
|
*/
|
|
1351
1352
|
async onConnect(_port, localAddr, remoteAddr) {
|
|
1352
1353
|
const { listeners } = this.state;
|
|
@@ -1464,7 +1465,7 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
|
|
|
1464
1465
|
|
|
1465
1466
|
/**
|
|
1466
1467
|
*
|
|
1467
|
-
* @param {
|
|
1468
|
+
* @param {Zone} zone
|
|
1468
1469
|
* @param {Powers} powers
|
|
1469
1470
|
*/
|
|
1470
1471
|
export const preparePortAllocator = (zone, { watch }) =>
|
|
@@ -1544,7 +1545,7 @@ export const preparePortAllocator = (zone, { watch }) =>
|
|
|
1544
1545
|
* The reason this functionality wasn't just baked into the other network exos
|
|
1545
1546
|
* is to maintain upgrade-compatible with minimal additional changes.
|
|
1546
1547
|
*
|
|
1547
|
-
* @param {
|
|
1548
|
+
* @param {Zone} zone
|
|
1548
1549
|
* @param {VowTools} vowTools
|
|
1549
1550
|
*/
|
|
1550
1551
|
const prepareFinalizer = (zone, { watch }) => {
|
|
@@ -1601,7 +1602,7 @@ const prepareFinalizer = (zone, { watch }) => {
|
|
|
1601
1602
|
harden(prepareFinalizer);
|
|
1602
1603
|
|
|
1603
1604
|
/**
|
|
1604
|
-
* @param {
|
|
1605
|
+
* @param {Zone} zone
|
|
1605
1606
|
* @param {VowTools} vowTools
|
|
1606
1607
|
* @returns {Powers}
|
|
1607
1608
|
*/
|
package/src/router.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {Endpoint, Port, Protocol, ProtocolHandler} from './types.js';
|
|
3
3
|
* @import {PromiseVow, Remote, VowTools} from '@agoric/vow';
|
|
4
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
5
|
+
* @import {Powers} from './network.js';
|
|
4
6
|
*/
|
|
5
7
|
/**
|
|
6
8
|
* @template T
|
|
@@ -17,7 +19,7 @@ export const RouterI: import("@endo/patterns").InterfaceGuard<{
|
|
|
17
19
|
register: import("@endo/patterns").MethodGuard;
|
|
18
20
|
unregister: import("@endo/patterns").MethodGuard;
|
|
19
21
|
}>;
|
|
20
|
-
export function prepareRouter<T>(zone:
|
|
22
|
+
export function prepareRouter<T>(zone: Zone): () => import("@endo/exo").Guarded<{
|
|
21
23
|
/** @param {Endpoint} addr */
|
|
22
24
|
getRoutes(addr: Endpoint): [string, T][];
|
|
23
25
|
/**
|
|
@@ -31,7 +33,7 @@ export function prepareRouter<T>(zone: import("@agoric/base-zone").Zone): () =>
|
|
|
31
33
|
*/
|
|
32
34
|
unregister(prefix: string, route: T): void;
|
|
33
35
|
}>;
|
|
34
|
-
export function prepareRouterProtocol(zone:
|
|
36
|
+
export function prepareRouterProtocol(zone: Zone, powers: Powers, E?: typeof defaultE): () => import("@endo/exo").Guarded<{
|
|
35
37
|
/**
|
|
36
38
|
* @param {string[]} paths
|
|
37
39
|
* @param {Remote<ProtocolHandler>} protocolHandler
|
|
@@ -70,7 +72,9 @@ export type RouterProtocol = {
|
|
|
70
72
|
registerProtocolHandler: (paths: string[], protocolHandler: ProtocolHandler) => void;
|
|
71
73
|
unregisterProtocolHandler: (prefix: string, protocolHandler: ProtocolHandler) => void;
|
|
72
74
|
};
|
|
75
|
+
import type { Zone } from '@agoric/base-zone';
|
|
73
76
|
import type { Endpoint } from './types.js';
|
|
77
|
+
import type { Powers } from './network.js';
|
|
74
78
|
import { E as defaultE } from '@endo/far';
|
|
75
79
|
import type { ProtocolHandler } from './types.js';
|
|
76
80
|
import type { Remote } from '@agoric/vow';
|
package/src/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["router.js"],"names":[],"mappings":"AAWA
|
|
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,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI;;;cA8ElC,CAAC,MAAM,EAAE,MAAM,KAAK,WAAW,IAAI,CAAC;6BACpC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,eAAe,KAAK,IAAI;+BAC3D,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,KAAK,IAAI;;0BA3FjD,mBAAmB;8BAFkB,YAAY;4BAG/C,cAAc;8BATT,WAAW;qCAMmB,YAAY;4BACzB,aAAa;0BADA,YAAY;gCACzB,aAAa"}
|
package/src/router.js
CHANGED
|
@@ -12,6 +12,8 @@ import { Shape } from './shapes.js';
|
|
|
12
12
|
/**
|
|
13
13
|
* @import {Endpoint, Port, Protocol, ProtocolHandler} from './types.js';
|
|
14
14
|
* @import {PromiseVow, Remote, VowTools} from '@agoric/vow';
|
|
15
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
16
|
+
* @import {Powers} from './network.js';
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -33,7 +35,7 @@ export const RouterI = M.interface('Router', {
|
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* @template T
|
|
36
|
-
* @param {
|
|
38
|
+
* @param {Zone} zone
|
|
37
39
|
*/
|
|
38
40
|
export const prepareRouter = zone => {
|
|
39
41
|
const detached = zone.detached();
|
|
@@ -107,8 +109,8 @@ export const prepareRouter = zone => {
|
|
|
107
109
|
/**
|
|
108
110
|
* Create a router that behaves like a Protocol.
|
|
109
111
|
*
|
|
110
|
-
* @param {
|
|
111
|
-
* @param {
|
|
112
|
+
* @param {Zone} zone
|
|
113
|
+
* @param {Powers} powers
|
|
112
114
|
* @param {typeof defaultE} [E] Eventual sender
|
|
113
115
|
*/
|
|
114
116
|
export const prepareRouterProtocol = (zone, powers, E = defaultE) => {
|
package/src/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rearrange the exo types to make a cast of the methods (M) and init function (I) to a specific type.
|
|
3
3
|
*/
|
|
4
|
-
export type ExoClassMethods<M extends
|
|
5
|
-
self:
|
|
4
|
+
export type ExoClassMethods<M extends Methods, I extends (...args: any[]) => any> = M & ThisType<{
|
|
5
|
+
self: Guarded<M>;
|
|
6
6
|
state: ReturnType<I>;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
@@ -219,6 +219,8 @@ export type ProtocolImpl = {
|
|
|
219
219
|
*/
|
|
220
220
|
outbound: (port: Remote<Port>, remoteAddr: Endpoint, connectionHandler: Remote<ConnectionHandler>) => PromiseVow<Connection>;
|
|
221
221
|
};
|
|
222
|
+
import type { Methods } from '@endo/exo';
|
|
223
|
+
import type { Guarded } from '@endo/exo';
|
|
222
224
|
import type { PromiseVow } from '@agoric/vow';
|
|
223
225
|
import type { RemotableObject } from '@endo/pass-style';
|
|
224
226
|
import type { Remote } from '@agoric/vow';
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;4BAauB,CAAC,SAAX,OAAS,EACiB,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,IACzB,CAAC,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;;;;oBAKxD,MAAM;;;;;uBAIN,MAAM;;;;;;;;WAML,MAAM,WAAW,IAAI,CAAC;;uBAGvB,eAAe,GAAG,SAAS;;;;;;;;;cAK1B,CAAC,MAAM,EAAE,QAAQ,KAAK,WAAW,IAAI,CAAC;;;;;;;;;;qBAMtC,MAAM,QAAQ;;;;iBAEd,CAAC,aAAa,EAAE,OAAO,aAAa,CAAC,KAAK,WAAW,IAAI,CAAC;;;;aAE1D,CACT,MAAM,EAAE,QAA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I,CAAC;;;;;;;;;YAIV,CAAC,IAAI,EAAE,kBAAkB,KAAK,WAAW,UAAU,CAAC;;;;;qBAEpD,MAAM,QAAQ;;;;;sBAEd,MAAM,QAAQ;;;;WAEd,MAAM,WAAW,IAAI,CAAC;;;;;;;;;;cAGtB,CAAC,MAAM,EAAE,QAAQ,KAAK,WAAW,OAAO,IAAI,CAAC,CAAC;;;;aAE9C,CACT,UAAU,EAAE,QAAQ,EACpB,UAAU,EAAE,QAAQ,KACjB,WAAW,cAAc,CAAC;;;;cAEpB,CACT,IAAI,EAAE,OAAO,IAAI,CAAC,EAClB,UAAU,EAAE,QAAQ,EACpB,iBAAiB,EAAE,OAAO,iBAAiB,CAAC,KACzC,WAAW,UAAU,CAAC;;6BA1MJ,WAAW;6BACX,WAAW;gCAFA,aAAa;qCADN,kBAAkB;4BACzB,aAAa"}
|
package/src/types.js
CHANGED
|
@@ -6,12 +6,14 @@ export {};
|
|
|
6
6
|
/**
|
|
7
7
|
* @import {Passable, RemotableObject} from '@endo/pass-style';
|
|
8
8
|
* @import {PromiseVow, Remote} from '@agoric/vow';
|
|
9
|
+
* @import {Methods} from '@endo/exo';
|
|
10
|
+
* @import {Guarded} from '@endo/exo';
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
|
-
* @template {
|
|
14
|
+
* @template {Methods} M
|
|
13
15
|
* @template {(...args: any[]) => any} I
|
|
14
|
-
* @typedef {M & ThisType<{ self:
|
|
16
|
+
* @typedef {M & ThisType<{ self: Guarded<M>, state: ReturnType<I> }>} ExoClassMethods
|
|
15
17
|
* Rearrange the exo types to make a cast of the methods (M) and init function (I) to a specific type.
|
|
16
18
|
*/
|
|
17
19
|
|