@agoric/network 0.1.1-dev-62c73f5.0 → 0.1.1-dev-0cfea88.0
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/package.json +10 -10
- package/src/bytes.d.ts +6 -4
- package/src/bytes.d.ts.map +1 -1
- package/src/network.d.ts +21 -41
- package/src/network.d.ts.map +1 -1
- package/src/router.d.ts +10 -24
- package/src/router.d.ts.map +1 -1
- package/src/types.d.ts +5 -5
- package/src/types.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/network",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-0cfea88.0+0cfea88",
|
|
4
4
|
"description": "Agoric's network protocol API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"author": "Agoric",
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@agoric/assert": "0.6.1-dev-
|
|
25
|
-
"@agoric/internal": "0.3.3-dev-
|
|
26
|
-
"@agoric/store": "0.9.3-dev-
|
|
27
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
24
|
+
"@agoric/assert": "0.6.1-dev-0cfea88.0+0cfea88",
|
|
25
|
+
"@agoric/internal": "0.3.3-dev-0cfea88.0+0cfea88",
|
|
26
|
+
"@agoric/store": "0.9.3-dev-0cfea88.0+0cfea88",
|
|
27
|
+
"@agoric/vat-data": "0.5.3-dev-0cfea88.0+0cfea88",
|
|
28
28
|
"@endo/base64": "^1.0.5",
|
|
29
29
|
"@endo/far": "^1.1.2",
|
|
30
30
|
"@endo/pass-style": "^1.4.0",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@endo/promise-kit": "^1.1.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
36
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
37
|
-
"@agoric/vow": "0.1.1-dev-
|
|
38
|
-
"@agoric/zone": "0.2.3-dev-
|
|
35
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-0cfea88.0+0cfea88",
|
|
36
|
+
"@agoric/swingset-vat": "0.32.3-dev-0cfea88.0+0cfea88",
|
|
37
|
+
"@agoric/vow": "0.1.1-dev-0cfea88.0+0cfea88",
|
|
38
|
+
"@agoric/zone": "0.2.3-dev-0cfea88.0+0cfea88",
|
|
39
39
|
"@endo/bundle-source": "^3.2.3",
|
|
40
40
|
"ava": "^5.3.0",
|
|
41
41
|
"c8": "^9.1.0"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"typeCoverage": {
|
|
69
69
|
"atLeast": 89.7
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "0cfea88fb59d27dddb8b031a5b5539127b6a305e"
|
|
72
72
|
}
|
package/src/bytes.d.ts
CHANGED
|
@@ -18,14 +18,14 @@ export function coerceToByteSource(specimen: unknown): ByteSource;
|
|
|
18
18
|
* @param {ByteSource} byteSource
|
|
19
19
|
* @returns {Bytes}
|
|
20
20
|
*/
|
|
21
|
-
export function toBytes(byteSource: ByteSource):
|
|
21
|
+
export function toBytes(byteSource: ByteSource): Bytes;
|
|
22
22
|
/**
|
|
23
23
|
* Convert bytes to a String.
|
|
24
24
|
*
|
|
25
25
|
* @param {Bytes} bytes
|
|
26
26
|
* @returns {string}
|
|
27
27
|
*/
|
|
28
|
-
export function bytesToString(bytes:
|
|
28
|
+
export function bytesToString(bytes: Bytes): string;
|
|
29
29
|
/**
|
|
30
30
|
* Base64, as specified in https://tools.ietf.org/html/rfc4648#section-4
|
|
31
31
|
*
|
|
@@ -39,6 +39,8 @@ export function byteSourceToBase64(byteSource: ByteSource): string;
|
|
|
39
39
|
* @param {string} string Base64-encoded string
|
|
40
40
|
* @returns {Bytes} decoded bytes
|
|
41
41
|
*/
|
|
42
|
-
export function base64ToBytes(string: string):
|
|
43
|
-
export type ByteSource =
|
|
42
|
+
export function base64ToBytes(string: string): Bytes;
|
|
43
|
+
export type ByteSource = Bytes | Buffer | Uint8Array | Iterable<number>;
|
|
44
|
+
import type { Bytes } from './types.js';
|
|
45
|
+
import type { Bytes as Bytes_1 } from './types.js';
|
|
44
46
|
//# sourceMappingURL=bytes.d.ts.map
|
package/src/bytes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["bytes.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH,2EAA2E;AAE3E;;;;;;;GAOG;AACH,6CAHW,OAAO,GACL,UAAU,CAmBtB;AAuBD;;;;;;GAMG;AACH,oCAHW,UAAU,
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["bytes.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH,2EAA2E;AAE3E;;;;;;;GAOG;AACH,6CAHW,OAAO,GACL,UAAU,CAmBtB;AAuBD;;;;;;GAMG;AACH,oCAHW,UAAU,GACR,KAAK,CAOjB;AAED;;;;;GAKG;AACH,qCAHW,KAAK,GACH,MAAM,CAIlB;AAED;;;;;GAKG;AACH,+CAHW,UAAU,GACR,MAAM,CAKlB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,GACJ,KAAK,CAIjB;yBA7Fa,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;2BAHpC,YAAY;sCAAZ,YAAY"}
|
package/src/network.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone")
|
|
|
15
15
|
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined;
|
|
16
16
|
} | undefined) => {
|
|
17
17
|
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>;
|
|
18
|
-
watch: <
|
|
19
|
-
makeVowKit: <
|
|
18
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C = any>(specimenP: import("@agoric/vow").ERef<T | import("@agoric/vow").Vow<T>>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
19
|
+
makeVowKit: <T>() => import("@agoric/vow").VowKit<T>;
|
|
20
20
|
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
21
21
|
}>): (instancePrefix?: string | undefined) => import("@endo/exo").Guarded<{
|
|
22
22
|
onCreate(_impl: any, _protocolHandler: any): Promise<void>;
|
|
@@ -28,7 +28,7 @@ export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone")
|
|
|
28
28
|
* @param {Endpoint} remoteAddr
|
|
29
29
|
* @returns {import('@agoric/vow').PromiseVow<AttemptDescription>}}
|
|
30
30
|
*/
|
|
31
|
-
onConnect(_port: any, localAddr:
|
|
31
|
+
onConnect(_port: any, localAddr: Endpoint, remoteAddr: Endpoint): import("@agoric/vow").PromiseVow<AttemptDescription>;
|
|
32
32
|
onInstantiate(_port: any, _localAddr: any, _remote: any, _protocol: any): Promise<string>;
|
|
33
33
|
onListen(port: any, localAddr: any, listenHandler: any, _protocolHandler: any): Promise<void>;
|
|
34
34
|
/**
|
|
@@ -37,25 +37,7 @@ export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone")
|
|
|
37
37
|
* @param {import('@agoric/vow').Remote<ListenHandler>} listenHandler
|
|
38
38
|
* @param {*} _protocolHandler
|
|
39
39
|
*/
|
|
40
|
-
onListenRemove(port: import("@agoric/vow").Remote<Port
|
|
41
|
-
/**
|
|
42
|
-
* The listener has been registered
|
|
43
|
-
*/
|
|
44
|
-
onListen?: undefined;
|
|
45
|
-
/**
|
|
46
|
-
* The connection was rejected
|
|
47
|
-
*/
|
|
48
|
-
onReject?: undefined;
|
|
49
|
-
/**
|
|
50
|
-
* There was an error while listening
|
|
51
|
-
*/
|
|
52
|
-
onError?: undefined;
|
|
53
|
-
/**
|
|
54
|
-
* The
|
|
55
|
-
* listener has been removed
|
|
56
|
-
*/
|
|
57
|
-
onRemove?: undefined;
|
|
58
|
-
}>, _protocolHandler: any): Promise<void>;
|
|
40
|
+
onListenRemove(port: import("@agoric/vow").Remote<Port>, localAddr: Endpoint, listenHandler: import("@agoric/vow").Remote<ListenHandler>, _protocolHandler: any): Promise<void>;
|
|
59
41
|
onRevoke(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
|
|
60
42
|
}>;
|
|
61
43
|
/**
|
|
@@ -67,20 +49,15 @@ export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone")
|
|
|
67
49
|
*/
|
|
68
50
|
export const ENDPOINT_SEPARATOR: "/";
|
|
69
51
|
export function rethrowUnlessMissing(err: unknown): undefined;
|
|
70
|
-
export function crossoverConnection(zone: import("@agoric/zone").Zone, handler0: import("@agoric/vow").Remote<Required<ConnectionHandler
|
|
52
|
+
export function crossoverConnection(zone: import("@agoric/zone").Zone, handler0: import("@agoric/vow").Remote<Required<ConnectionHandler>>, addr0: Endpoint, handler1: import("@agoric/vow").Remote<Required<ConnectionHandler>>, addr1: Endpoint, makeConnection: (opts: ConnectionOpts) => Connection, current?: globalThis.WeakSetStore<Closable> | undefined): Connection[];
|
|
71
53
|
export function prepareNetworkProtocol(zone: import("@agoric/base-zone").Zone, powers: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: {
|
|
72
54
|
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined;
|
|
73
55
|
} | undefined) => {
|
|
74
56
|
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>;
|
|
75
|
-
watch: <
|
|
76
|
-
makeVowKit: <
|
|
57
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C = any>(specimenP: import("@agoric/vow").ERef<T | import("@agoric/vow").Vow<T>>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
58
|
+
makeVowKit: <T>() => import("@agoric/vow").VowKit<T>;
|
|
77
59
|
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
78
|
-
}>): (protocolHandler: import("@agoric/vow").Remote<ProtocolHandler
|
|
79
|
-
/**
|
|
80
|
-
* Return unique suffix for local address
|
|
81
|
-
*/
|
|
82
|
-
onInstantiate?: undefined;
|
|
83
|
-
}>) => Protocol;
|
|
60
|
+
}>): (protocolHandler: import("@agoric/vow").Remote<ProtocolHandler>) => Protocol;
|
|
84
61
|
export function prepareEchoConnectionKit(zone: import("@agoric/base-zone").Zone): () => import("@endo/exo").GuardedKit<{
|
|
85
62
|
handler: {
|
|
86
63
|
/**
|
|
@@ -88,13 +65,13 @@ export function prepareEchoConnectionKit(zone: import("@agoric/base-zone").Zone)
|
|
|
88
65
|
* @param {Bytes} bytes
|
|
89
66
|
* @param {ConnectionHandler} _connectionHandler
|
|
90
67
|
*/
|
|
91
|
-
onReceive(_connection: Connection, bytes:
|
|
68
|
+
onReceive(_connection: Connection, bytes: Bytes, _connectionHandler: ConnectionHandler): Promise<string>;
|
|
92
69
|
/**
|
|
93
70
|
* @param {Connection} _connection
|
|
94
71
|
* @param {CloseReason} [_reason]
|
|
95
72
|
* @param {ConnectionHandler} [_connectionHandler]
|
|
96
73
|
*/
|
|
97
|
-
onClose(_connection: Connection, _reason?:
|
|
74
|
+
onClose(_connection: Connection, _reason?: CloseReason, _connectionHandler?: ConnectionHandler | undefined): Promise<void>;
|
|
98
75
|
};
|
|
99
76
|
listener: {
|
|
100
77
|
onAccept(_port: any, _localAddr: any, _remoteAddr: any, _listenHandler: any): Promise<import("@endo/exo").Guarded<{
|
|
@@ -103,13 +80,13 @@ export function prepareEchoConnectionKit(zone: import("@agoric/base-zone").Zone)
|
|
|
103
80
|
* @param {Bytes} bytes
|
|
104
81
|
* @param {ConnectionHandler} _connectionHandler
|
|
105
82
|
*/
|
|
106
|
-
onReceive(_connection: Connection, bytes:
|
|
83
|
+
onReceive(_connection: Connection, bytes: Bytes, _connectionHandler: ConnectionHandler): Promise<string>;
|
|
107
84
|
/**
|
|
108
85
|
* @param {Connection} _connection
|
|
109
86
|
* @param {CloseReason} [_reason]
|
|
110
87
|
* @param {ConnectionHandler} [_connectionHandler]
|
|
111
88
|
*/
|
|
112
|
-
onClose(_connection: Connection, _reason?:
|
|
89
|
+
onClose(_connection: Connection, _reason?: CloseReason, _connectionHandler?: ConnectionHandler | undefined): Promise<void>;
|
|
113
90
|
}>>;
|
|
114
91
|
onListen(port: any, _listenHandler: any): Promise<void>;
|
|
115
92
|
};
|
|
@@ -118,8 +95,8 @@ export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { w
|
|
|
118
95
|
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined;
|
|
119
96
|
} | undefined) => {
|
|
120
97
|
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>;
|
|
121
|
-
watch: <
|
|
122
|
-
makeVowKit: <
|
|
98
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C = any>(specimenP: import("@agoric/vow").ERef<T | import("@agoric/vow").Vow<T>>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
99
|
+
makeVowKit: <T>() => import("@agoric/vow").VowKit<T>;
|
|
123
100
|
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
124
101
|
}>): (args_0: {
|
|
125
102
|
protocol: Protocol;
|
|
@@ -131,14 +108,15 @@ export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { w
|
|
|
131
108
|
}>;
|
|
132
109
|
export type MakeEchoConnectionKit = ReturnType<typeof prepareEchoConnectionKit>;
|
|
133
110
|
export type ConnectionOpts = {
|
|
134
|
-
addrs:
|
|
135
|
-
handlers: import("@agoric/vow").Remote<Required<ConnectionHandler
|
|
136
|
-
conns:
|
|
137
|
-
current:
|
|
111
|
+
addrs: Endpoint[];
|
|
112
|
+
handlers: import("@agoric/vow").Remote<Required<ConnectionHandler>>[];
|
|
113
|
+
conns: MapStore<number, Connection>;
|
|
114
|
+
current: WeakSetStore<Closable>;
|
|
138
115
|
l: 0 | 1;
|
|
139
116
|
r: 0 | 1;
|
|
140
117
|
};
|
|
141
118
|
export type PortAllocator = ReturnType<ReturnType<typeof preparePortAllocator>>;
|
|
119
|
+
import type { Endpoint } from './types.js';
|
|
142
120
|
import type { AttemptDescription } from './types.js';
|
|
143
121
|
import type { Port } from './types.js';
|
|
144
122
|
import type { ListenHandler } from './types.js';
|
|
@@ -147,4 +125,6 @@ import type { Connection } from './types.js';
|
|
|
147
125
|
import type { Closable } from './types.js';
|
|
148
126
|
import type { ProtocolHandler } from './types.js';
|
|
149
127
|
import type { Protocol } from './types.js';
|
|
128
|
+
import type { Bytes } from './types.js';
|
|
129
|
+
import type { CloseReason } from './types.js';
|
|
150
130
|
//# 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":"AAkCA;;;;GAIG;AACH,kCAFW,MAAM,YAahB;AAutCD,mFAAmF;AAEnF;;;;;GAKG;AACH,qDAHW,OAAO,mBAAmB,EAAE,IAAI,sBAChC,UAAU
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["network.js"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,kCAFW,MAAM,YAahB;AAutCD,mFAAmF;AAEnF;;;;;GAKG;AACH,qDAHW,OAAO,mBAAmB,EAAE,IAAI,sBAChC,UAAU,CAAC;;;;;;;CAAqC,CAAC;;;;IAmCpD;;;;;OAKG;qBAJQ,GAAC,aACD,QAAQ,cACR,QAAQ,GACN,OAAO,aAAa,EAAE,UAAU,CAAC,kBAAkB,CAAC;;;IAiEjE;;;;;OAKG;yBAJQ,OAAO,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,aAClC,QAAQ,iBACR,OAAO,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,oBAC3C,GAAC;;GA+CnB;AA/5CD;;GAEG;AAEH;;;GAGG;AACH,qCAAsC;AAG/B,0CADK,OAAO,aAWlB;AAyJM,0CARI,OAAO,cAAc,EAAE,IAAI,YAC3B,OAAO,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,SACzD,QAAQ,YACR,OAAO,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,SACzD,QAAQ,kBACR,CAAC,IAAI,EAAE,cAAc,KAAK,UAAU,yEAgD9C;AA+6BM,6CAHI,OAAO,mBAAmB,EAAE,IAAI,UAChC,UAAU,CAAC;;;;;;;CAAqC,CAAC,qBAM/C,OAAO,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC,KAC3C,QAAQ,CA2BtB;AAOM,+CAFI,OAAO,mBAAmB,EAAE,IAAI;;QAsCnC;;;;WAIG;+BAHQ,UAAU,SACV,KAAK,sBACL,iBAAiB;QAU5B;;;;WAIG;6BAHQ,UAAU,YACV,WAAW;;;;YAftB;;;;eAIG;mCAHQ,UAAU,SACV,KAAK,sBACL,iBAAiB;YAU5B;;;;eAIG;iCAHQ,UAAU,YACV,WAAW;;;;GAyB7B;AAyKM,2CAHI,OAAO,mBAAmB,EAAE,IAAI,aAChC,UAAU,CAAC;;;;;;;CAAqC,CAAC;cAkB7C,QAAQ;;;;;;GAkDpB;oCA1OW,UAAU,CAAC,OAAO,wBAAwB,CAAC;;WArsC3C,QAAQ,EAAE;cACV,OAAO,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE;WAC3D,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;aAC5B,YAAY,CAAC,QAAQ,CAAC;OACtB,CAAC,GAAC,CAAC;OACH,CAAC,GAAC,CAAC;;4BA26CH,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;8BAx+CyG,YAAY;wCAAZ,YAAY;0BAAZ,YAAY;mCAAZ,YAAY;uCAAZ,YAAY;gCAAZ,YAAY;8BAAZ,YAAY;qCAAZ,YAAY;8BAAZ,YAAY;2BAAZ,YAAY;iCAAZ,YAAY"}
|
package/src/router.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export const RouterI: import("@endo/patterns").InterfaceGuard<{
|
|
|
19
19
|
}>;
|
|
20
20
|
export function prepareRouter<T>(zone: import("@agoric/base-zone").Zone): () => import("@endo/exo").Guarded<{
|
|
21
21
|
/** @param {Endpoint} addr */
|
|
22
|
-
getRoutes(addr:
|
|
22
|
+
getRoutes(addr: Endpoint): [string, T][];
|
|
23
23
|
/**
|
|
24
24
|
* @param {string} prefix
|
|
25
25
|
* @param {T} route
|
|
@@ -35,33 +35,18 @@ export function prepareRouterProtocol(zone: import("@agoric/base-zone").Zone, po
|
|
|
35
35
|
isRetryableReason?: import("@agoric/vow").IsRetryableReason | undefined;
|
|
36
36
|
} | undefined) => {
|
|
37
37
|
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>;
|
|
38
|
-
watch: <
|
|
39
|
-
makeVowKit: <
|
|
38
|
+
watch: <T = any, TResult1 = T, TResult2 = never, C = any>(specimenP: import("@agoric/vow").ERef<T | import("@agoric/vow").Vow<T>>, watcher?: import("@agoric/vow").Watcher<T, TResult1, TResult2> | undefined, watcherContext?: C | undefined) => import("@agoric/vow").Vow<Exclude<TResult1, void> | Exclude<TResult2, void> extends never ? TResult1 : Exclude<TResult1, void> | Exclude<TResult2, void>>;
|
|
39
|
+
makeVowKit: <T>() => VowKit<T>;
|
|
40
40
|
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
41
|
-
}>, E?: ((<
|
|
42
|
-
readonly get: <
|
|
41
|
+
}>, E?: ((<T>(x: T) => import("../../../node_modules/@endo/eventual-send/src/E.js").ECallableOrMethods<import("@endo/eventual-send").RemoteFunctions<T>>) & {
|
|
42
|
+
readonly get: <T_1>(x: T_1) => import("../../../node_modules/@endo/eventual-send/src/E.js").EGetters<import("@endo/eventual-send").LocalRecord<T_1>>;
|
|
43
43
|
readonly resolve: {
|
|
44
44
|
(): Promise<void>;
|
|
45
|
-
<
|
|
46
|
-
<
|
|
47
|
-
/**
|
|
48
|
-
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js';
|
|
49
|
-
* @import {PromiseVow, Remote, VowKit, VowResolver, VowTools} from '@agoric/vow';
|
|
50
|
-
*/
|
|
51
|
-
/**
|
|
52
|
-
* @template T
|
|
53
|
-
* @typedef {object} Router A delimited string router implementation
|
|
54
|
-
* @property {(addr: string) => [string, T][]} getRoutes Return the match and
|
|
55
|
-
* route in order of preference
|
|
56
|
-
* @property {(prefix: string, route: T) => void} register Add a prefix->route
|
|
57
|
-
* to the database
|
|
58
|
-
* @property {(prefix: string, route: T) => void} unregister Remove a
|
|
59
|
-
* prefix->route from the database
|
|
60
|
-
*/
|
|
61
|
-
PromiseLike<T_3_1>): Promise<Awaited<T_3_1>>;
|
|
45
|
+
<T_2>(value: T_2): Promise<Awaited<T_2>>;
|
|
46
|
+
<T_3>(value: T_3 | PromiseLike<T_3>): Promise<Awaited<T_3>>;
|
|
62
47
|
};
|
|
63
48
|
readonly sendOnly: <T_4>(x: T_4) => import("../../../node_modules/@endo/eventual-send/src/E.js").ESendOnlyCallableOrMethods<import("@endo/eventual-send").RemoteFunctions<T_4>>;
|
|
64
|
-
readonly when: <T_5, U = T_5>(x: T_5 | PromiseLike<T_5>, onfulfilled?: ((value: T_5) => import("
|
|
49
|
+
readonly when: <T_5, U = T_5>(x: T_5 | PromiseLike<T_5>, onfulfilled?: ((value: T_5) => import("@endo/eventual-send").ERef<U>) | undefined, onrejected?: ((reason: any) => import("@endo/eventual-send").ERef<U>) | undefined) => Promise<U>;
|
|
65
50
|
}) | undefined): () => import("@endo/exo").Guarded<{
|
|
66
51
|
/**
|
|
67
52
|
* @param {string[]} paths
|
|
@@ -74,7 +59,7 @@ export function prepareRouterProtocol(zone: import("@agoric/base-zone").Zone, po
|
|
|
74
59
|
*/
|
|
75
60
|
unregisterProtocolHandler(prefix: string, protocolHandler: Remote<ProtocolHandler>): void;
|
|
76
61
|
/** @param {Endpoint} localAddr */
|
|
77
|
-
bindPort(localAddr:
|
|
62
|
+
bindPort(localAddr: Endpoint): Promise<Port | import("@agoric/vow").Vow<Port>>;
|
|
78
63
|
}>;
|
|
79
64
|
/**
|
|
80
65
|
* A delimited string router implementation
|
|
@@ -101,6 +86,7 @@ export type RouterProtocol = {
|
|
|
101
86
|
registerProtocolHandler: (paths: string[], protocolHandler: ProtocolHandler) => void;
|
|
102
87
|
unregisterProtocolHandler: (prefix: string, protocolHandler: ProtocolHandler) => void;
|
|
103
88
|
};
|
|
89
|
+
import type { Endpoint } from './types.js';
|
|
104
90
|
import type { VowKit } from '@agoric/vow';
|
|
105
91
|
import type { ProtocolHandler } from './types.js';
|
|
106
92
|
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;;;GAGG;AAEH;;;;;;;;;GASG;AAEH;;;;GAIG;AAMI,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["router.js"],"names":[],"mappings":"AAWA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH;;;;GAIG;AAMI,8BAHM,CAAC,QACH,OAAO,mBAAmB,EAAE,IAAI;IAiBrC,6BAA6B;oBAAjB,QAAQ;IAyBpB;;;OAGG;qBAFQ,MAAM,SACN,CAAC;IAKZ;;;OAGG;uBAFQ,MAAM,SACN,CAAC;GAWjB;AAgBM,4CAJI,OAAO,mBAAmB,EAAE,IAAI,UAChC,UAAU,CAAC;;;;;;;CAAqC,CAAC;;;;;;;;wEAjGJ,CAAC,0BACxD,qBAEE,kCAEe,CAAC,2BAA4B,qBAAO;;IAgIhD;;;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;;8BA3FkG,YAAY;4BAClH,aAAa;qCADyF,YAAY;4BAClH,aAAa;0BADyF,YAAY;gCAClH,aAAa"}
|
package/src/types.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export type Port = {
|
|
|
50
50
|
/**
|
|
51
51
|
* Make an outbound connection
|
|
52
52
|
*/
|
|
53
|
-
connect: (remote: Endpoint, connectionHandler?: Remote<ConnectionHandler>
|
|
53
|
+
connect: (remote: Endpoint, connectionHandler?: Remote<ConnectionHandler>) => PromiseVow<Connection>;
|
|
54
54
|
/**
|
|
55
55
|
* Remove the currently-bound listener
|
|
56
56
|
*/
|
|
@@ -91,7 +91,7 @@ export type ConnectionI = {
|
|
|
91
91
|
/**
|
|
92
92
|
* Send a packet on the connection
|
|
93
93
|
*/
|
|
94
|
-
send: (packetBytes: Bytes, opts?: Record<string, any>) => PromiseVow<
|
|
94
|
+
send: (packetBytes: Bytes, opts?: Record<string, any>) => PromiseVow<Bytes>;
|
|
95
95
|
/**
|
|
96
96
|
* Close both ends of the connection
|
|
97
97
|
*/
|
|
@@ -118,11 +118,11 @@ export type ConnectionHandler = {
|
|
|
118
118
|
/**
|
|
119
119
|
* The connection received a packet
|
|
120
120
|
*/
|
|
121
|
-
onReceive?: ((connection: Remote<Connection>, ack: Bytes, c: Remote<ConnectionHandler>, opts?: Record<string, any>) => PromiseVow<
|
|
121
|
+
onReceive?: ((connection: Remote<Connection>, ack: Bytes, c: Remote<ConnectionHandler>, opts?: Record<string, any>) => PromiseVow<Bytes>) | undefined;
|
|
122
122
|
/**
|
|
123
123
|
* The connection has been closed
|
|
124
124
|
*/
|
|
125
|
-
onClose?: ((connection: Remote<Connection>, reason?: CloseReason, c?: Remote<ConnectionHandler>
|
|
125
|
+
onClose?: ((connection: Remote<Connection>, reason?: CloseReason, c?: Remote<ConnectionHandler>) => PromiseVow<void>) | undefined;
|
|
126
126
|
};
|
|
127
127
|
/**
|
|
128
128
|
* The reason a connection was closed
|
|
@@ -161,7 +161,7 @@ export type ProtocolHandler = {
|
|
|
161
161
|
/**
|
|
162
162
|
* Return unique suffix for local address
|
|
163
163
|
*/
|
|
164
|
-
onInstantiate?: ((port: Remote<Port>, localAddr: Endpoint, remote: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<
|
|
164
|
+
onInstantiate?: ((port: Remote<Port>, localAddr: Endpoint, remote: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<Endpoint>) | undefined;
|
|
165
165
|
/**
|
|
166
166
|
* A port initiates an outbound connection
|
|
167
167
|
*/
|
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":";;;4BAW2C,CAAC,SAA/B,OAAQ,WAAW,EAAE,OAAQ,EACH,CAAC,SAA3B,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAI,IACzB,CAAC,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,OAAO,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;;;;oBAK5E,MAAM;;;;;uBAIN,MAAM;;;;;;;;WAML,MAAM,WAAW,IAAI,CAAC;;uBAGvB,eAAe,GAAG,SAAS;;;;;;;;;cAK1B,CAAC,MAAM,EAAE,QAAQ,KAAK,WAAW,IAAI,C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