@agoric/network 0.1.1-orchestration-dev-096c4e8.0 → 0.1.1-upgrade-16-fi-dev-8879538.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/README.md +4 -7
- package/package.json +21 -24
- package/src/bytes.d.ts +10 -8
- package/src/bytes.d.ts.map +1 -1
- package/src/bytes.js +39 -26
- package/src/index.d.ts +2 -0
- package/src/index.js +3 -0
- package/src/multiaddr.d.ts.map +1 -1
- package/src/network.d.ts +55 -79
- package/src/network.d.ts.map +1 -1
- package/src/network.js +999 -502
- package/src/router.d.ts +44 -20
- package/src/router.d.ts.map +1 -1
- package/src/router.js +19 -16
- package/src/shapes.d.ts +117 -0
- package/src/shapes.d.ts.map +1 -0
- package/src/shapes.js +191 -0
- package/src/types.d.ts +55 -42
- package/src/types.d.ts.map +1 -1
- package/src/types.js +65 -50
- package/exported.js +0 -1
- package/tsconfig.build.json +0 -6
- package/tsconfig.json +0 -14
- package/typedoc.json +0 -9
package/README.md
CHANGED
|
@@ -57,15 +57,12 @@ E(home.ibcport[0]).connect(remoteEndpoint, connectionHandler)
|
|
|
57
57
|
|
|
58
58
|
The other side of `connect()` is a "listening port". These ports are waiting for inbound connections to be established.
|
|
59
59
|
|
|
60
|
-
To get a listening port, you need a `NetworkInterface` object (such as the one on your `ag-solo` under `home.network`) and ask it
|
|
60
|
+
To get a listening port, you need a `NetworkInterface` object (such as the one on your `ag-solo` under `home.network`) and ask it for a port, via the `PortAllocator`.
|
|
61
61
|
|
|
62
62
|
```js
|
|
63
63
|
// ask for a random allocation - ends with a slash
|
|
64
|
-
E(home.network).
|
|
65
|
-
.then(
|
|
66
|
-
|
|
67
|
-
// or ask for a specific port name
|
|
68
|
-
E(home.network).bind('/ibc-port/my-cool-port-name')
|
|
64
|
+
E(home.network).getPortAllocator()
|
|
65
|
+
.then(portAllocator => E(portAllocator).allocateCustomIBCPort())
|
|
69
66
|
.then(port => usePort(port));
|
|
70
67
|
```
|
|
71
68
|
|
|
@@ -147,7 +144,7 @@ Note that if you want to listen on this port again, you can just call `port.addL
|
|
|
147
144
|
|
|
148
145
|
### Closing the Port Entirely
|
|
149
146
|
|
|
150
|
-
Removing a listener doesn't release the port address to make it available for other `
|
|
147
|
+
Removing a listener doesn't release the port address to make it available for other `PortAllocator` requests. You can call:
|
|
151
148
|
|
|
152
149
|
```js
|
|
153
150
|
port.revoke();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/network",
|
|
3
|
-
"version": "0.1.1-
|
|
3
|
+
"version": "0.1.1-upgrade-16-fi-dev-8879538.0+8879538",
|
|
4
4
|
"description": "Agoric's network protocol API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,45 +21,42 @@
|
|
|
21
21
|
"author": "Agoric",
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@agoric/assert": "0.6.1-
|
|
25
|
-
"@agoric/internal": "0.3.3-
|
|
26
|
-
"@agoric/store": "0.9.3-
|
|
27
|
-
"@agoric/vat-data": "0.5.3-
|
|
28
|
-
"@endo/base64": "^1.0.
|
|
29
|
-
"@endo/far": "^1.
|
|
30
|
-
"@endo/patterns": "^1.
|
|
31
|
-
"@endo/promise-kit": "^1.
|
|
24
|
+
"@agoric/assert": "0.6.1-upgrade-16-fi-dev-8879538.0+8879538",
|
|
25
|
+
"@agoric/internal": "0.3.3-upgrade-16-fi-dev-8879538.0+8879538",
|
|
26
|
+
"@agoric/store": "0.9.3-upgrade-16-fi-dev-8879538.0+8879538",
|
|
27
|
+
"@agoric/vat-data": "0.5.3-upgrade-16-fi-dev-8879538.0+8879538",
|
|
28
|
+
"@endo/base64": "^1.0.5",
|
|
29
|
+
"@endo/far": "^1.1.2",
|
|
30
|
+
"@endo/patterns": "^1.4.0",
|
|
31
|
+
"@endo/promise-kit": "^1.1.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@agoric/swingset-liveslots": "0.10.3-
|
|
35
|
-
"@agoric/swingset-vat": "0.32.3-
|
|
36
|
-
"@agoric/
|
|
37
|
-
"@
|
|
34
|
+
"@agoric/swingset-liveslots": "0.10.3-upgrade-16-fi-dev-8879538.0+8879538",
|
|
35
|
+
"@agoric/swingset-vat": "0.32.3-upgrade-16-fi-dev-8879538.0+8879538",
|
|
36
|
+
"@agoric/vow": "0.1.1-upgrade-16-fi-dev-8879538.0+8879538",
|
|
37
|
+
"@agoric/zone": "0.2.3-upgrade-16-fi-dev-8879538.0+8879538",
|
|
38
|
+
"@endo/bundle-source": "^3.2.3",
|
|
38
39
|
"ava": "^5.3.0",
|
|
39
|
-
"c8": "^
|
|
40
|
+
"c8": "^9.1.0"
|
|
40
41
|
},
|
|
41
42
|
"exports": {
|
|
42
|
-
".": "./src/index.js"
|
|
43
|
-
"./exported.js": "./exported.js"
|
|
43
|
+
".": "./src/index.js"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"CHANGELOG.md",
|
|
47
47
|
"src/",
|
|
48
48
|
"scripts/",
|
|
49
|
-
"tools/"
|
|
50
|
-
"*.json",
|
|
51
|
-
"globals.d.ts",
|
|
52
|
-
"exported.js"
|
|
49
|
+
"tools/"
|
|
53
50
|
],
|
|
54
51
|
"publishConfig": {
|
|
55
52
|
"access": "public"
|
|
56
53
|
},
|
|
57
54
|
"engines": {
|
|
58
|
-
"node": "
|
|
55
|
+
"node": "^18.12 || ^20.9"
|
|
59
56
|
},
|
|
60
57
|
"ava": {
|
|
61
58
|
"files": [
|
|
62
|
-
"test
|
|
59
|
+
"test/**/*.test.*"
|
|
63
60
|
],
|
|
64
61
|
"require": [
|
|
65
62
|
"@endo/init/debug.js"
|
|
@@ -68,7 +65,7 @@
|
|
|
68
65
|
"workerThreads": false
|
|
69
66
|
},
|
|
70
67
|
"typeCoverage": {
|
|
71
|
-
"atLeast":
|
|
68
|
+
"atLeast": 89.39
|
|
72
69
|
},
|
|
73
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "8879538cd1d125a08346f02dd5701d0d70c90bb8"
|
|
74
71
|
}
|
package/src/bytes.d.ts
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Convert
|
|
2
|
+
* Convert a Uint8Array or other sequence of octets to a string representation
|
|
3
|
+
* that `@endo/marshal` accepts as Passable.
|
|
3
4
|
*
|
|
4
|
-
* @param {
|
|
5
|
+
* @param {ByteSource} byteSource
|
|
5
6
|
* @returns {Bytes}
|
|
6
7
|
*/
|
|
7
|
-
export function toBytes(
|
|
8
|
+
export function toBytes(byteSource: ByteSource): string;
|
|
8
9
|
/**
|
|
9
10
|
* Convert bytes to a String.
|
|
10
11
|
*
|
|
11
12
|
* @param {Bytes} bytes
|
|
12
13
|
* @returns {string}
|
|
13
14
|
*/
|
|
14
|
-
export function bytesToString(bytes:
|
|
15
|
+
export function bytesToString(bytes: string): string;
|
|
15
16
|
/**
|
|
16
17
|
* Base64, as specified in https://tools.ietf.org/html/rfc4648#section-4
|
|
17
18
|
*
|
|
18
|
-
* @param {
|
|
19
|
+
* @param {ByteSource} byteSource
|
|
19
20
|
* @returns {string} base64 encoding
|
|
20
21
|
*/
|
|
21
|
-
export function dataToBase64(
|
|
22
|
+
export function dataToBase64(byteSource: ByteSource): string;
|
|
22
23
|
/**
|
|
23
|
-
* Decodes a string into
|
|
24
|
+
* Decodes a base64 string into bytes.
|
|
24
25
|
*
|
|
25
26
|
* @param {string} string Base64-encoded string
|
|
26
27
|
* @returns {Bytes} decoded bytes
|
|
27
28
|
*/
|
|
28
|
-
export function base64ToBytes(string: string):
|
|
29
|
+
export function base64ToBytes(string: string): string;
|
|
30
|
+
export type ByteSource = string | Iterable<number> | Buffer | Uint8Array;
|
|
29
31
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["bytes.js"],"names":[],"mappings":"AAgCA;;;;;;GAMG;AACH,oCAHW,UAAU,UAQpB;AAED;;;;;GAKG;AACH,8CAFa,MAAM,CAIlB;AAED;;;;;GAKG;AACH,yCAHW,UAAU,GACR,MAAM,CAKlB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,UAKhB"}
|
package/src/bytes.js
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
/// <reference path="./types.js" />
|
|
3
|
+
import { Fail } from '@agoric/assert';
|
|
2
4
|
import { encodeBase64, decodeBase64 } from '@endo/base64';
|
|
3
5
|
|
|
4
|
-
/* eslint-disable no-bitwise */
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* @import {Bytes} from './types.js';
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @typedef {Bytes | Buffer | Uint8Array | Iterable<number>} ByteSource */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {ByteSource} contents
|
|
10
14
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const coerceToByteArray = contents => {
|
|
16
|
+
if (typeof contents === 'string') {
|
|
17
|
+
return Uint8Array.from(contents, c => {
|
|
18
|
+
const b = c.charCodeAt(0);
|
|
19
|
+
b <= 0xff || Fail`character cannot be coerced to an octet: ${c}`;
|
|
20
|
+
return b;
|
|
21
|
+
});
|
|
22
|
+
} else if (contents instanceof Uint8Array) {
|
|
23
|
+
// Reconstruct to ensure we have a Uint8Array and not a Buffer.
|
|
24
|
+
return new Uint8Array(
|
|
25
|
+
contents.buffer,
|
|
26
|
+
contents.byteOffset,
|
|
27
|
+
contents.byteLength,
|
|
28
|
+
);
|
|
17
29
|
}
|
|
30
|
+
return new Uint8Array(contents);
|
|
31
|
+
};
|
|
18
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Convert a Uint8Array or other sequence of octets to a string representation
|
|
35
|
+
* that `@endo/marshal` accepts as Passable.
|
|
36
|
+
*
|
|
37
|
+
* @param {ByteSource} byteSource
|
|
38
|
+
* @returns {Bytes}
|
|
39
|
+
*/
|
|
40
|
+
export function toBytes(byteSource) {
|
|
19
41
|
// We return the raw characters in the lower half of
|
|
20
42
|
// the String's representation.
|
|
21
|
-
const buf =
|
|
22
|
-
return String.fromCharCode
|
|
43
|
+
const buf = coerceToByteArray(byteSource);
|
|
44
|
+
return String.fromCharCode(...buf);
|
|
23
45
|
}
|
|
24
46
|
|
|
25
47
|
/**
|
|
@@ -35,25 +57,16 @@ export function bytesToString(bytes) {
|
|
|
35
57
|
/**
|
|
36
58
|
* Base64, as specified in https://tools.ietf.org/html/rfc4648#section-4
|
|
37
59
|
*
|
|
38
|
-
* @param {
|
|
60
|
+
* @param {ByteSource} byteSource
|
|
39
61
|
* @returns {string} base64 encoding
|
|
40
62
|
*/
|
|
41
|
-
export function dataToBase64(
|
|
42
|
-
|
|
43
|
-
let bytes;
|
|
44
|
-
if (typeof data === 'string') {
|
|
45
|
-
bytes = new Uint8Array(data.length);
|
|
46
|
-
for (let i = 0; i < data.length; i += 1) {
|
|
47
|
-
bytes[i] = data.charCodeAt(i);
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
bytes = new Uint8Array(data);
|
|
51
|
-
}
|
|
63
|
+
export function dataToBase64(byteSource) {
|
|
64
|
+
const bytes = coerceToByteArray(byteSource);
|
|
52
65
|
return encodeBase64(bytes);
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
/**
|
|
56
|
-
* Decodes a string into
|
|
69
|
+
* Decodes a base64 string into bytes.
|
|
57
70
|
*
|
|
58
71
|
* @param {string} string Base64-encoded string
|
|
59
72
|
* @returns {Bytes} decoded bytes
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from './network.js';
|
|
2
|
+
export * from './shapes.js';
|
|
2
3
|
export { prepareRouter, prepareRouterProtocol } from './router.js';
|
|
3
4
|
export * from './multiaddr.js';
|
|
4
5
|
export * from './bytes.js';
|
|
6
|
+
// eslint-disable-next-line import/export -- doesn't know types
|
|
7
|
+
export * from './types.js';
|
package/src/multiaddr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiaddr.d.ts","sourceRoot":"","sources":["multiaddr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;GAKG;AACH,0BAHW,QAAQ,
|
|
1
|
+
{"version":3,"file":"multiaddr.d.ts","sourceRoot":"","sources":["multiaddr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;GAKG;AACH,0BAHW,QAAQ,GACN,SAAS,CA0BrB;AAED;;;;;GAKG;AACH,4BAHW,SAAS,GAAG,QAAQ,GAClB,QAAQ,CAQpB;;;;;;;;;;;;;;;;;;;;;;wBAlDY,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;;;;;uBAElB,MAAM"}
|
package/src/network.d.ts
CHANGED
|
@@ -10,137 +10,113 @@ export function getPrefixes(addr: string): string[];
|
|
|
10
10
|
* @param {import('@agoric/base-zone').Zone} zone
|
|
11
11
|
* @param {ReturnType<import('@agoric/vow').prepareVowTools>} powers
|
|
12
12
|
*/
|
|
13
|
-
export function prepareLoopbackProtocolHandler(zone: import(
|
|
13
|
+
export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone").Zone, { watch, allVows }: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: {
|
|
14
14
|
isRetryableReason?: ((reason: any) => boolean) | undefined;
|
|
15
|
-
watchPromise?: ((p: PromiseLike<any>, watcher: import("@agoric/vow/src/watch-promise.js").PromiseWatcher, ...args: unknown[]) => void) | undefined;
|
|
16
15
|
} | undefined) => {
|
|
17
|
-
when: <T
|
|
18
|
-
watch: <T_1 =
|
|
16
|
+
when: <T, TResult1 = import("@agoric/vow").Unwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").Unwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
17
|
+
watch: <T_1 = unknown, TResult1_1 = T_1, TResult2_1 = T_1, C = unknown>(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<TResult1_1 | TResult2_1>;
|
|
19
18
|
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>;
|
|
20
|
-
|
|
19
|
+
allVows: (vows: any) => import("@agoric/vow").Vow<any>;
|
|
20
|
+
}>): (instancePrefix?: string | undefined) => import("@endo/exo").Guarded<{
|
|
21
21
|
onCreate(_impl: any, _protocolHandler: any): Promise<void>;
|
|
22
22
|
generatePortID(_localAddr: any, _protocolHandler: any): Promise<string>;
|
|
23
23
|
onBind(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
/**
|
|
25
|
+
* @param {*} _port
|
|
26
|
+
* @param {Endpoint} localAddr
|
|
27
|
+
* @param {Endpoint} remoteAddr
|
|
28
|
+
* @returns {import('@agoric/vow').PromiseVow<AttemptDescription>}}
|
|
29
|
+
*/
|
|
30
|
+
onConnect(_port: any, localAddr: string, remoteAddr: string): import("@agoric/vow").PromiseVow<AttemptDescription>;
|
|
28
31
|
onInstantiate(_port: any, _localAddr: any, _remote: any, _protocol: any): Promise<string>;
|
|
29
32
|
onListen(port: any, localAddr: any, listenHandler: any, _protocolHandler: any): Promise<void>;
|
|
30
33
|
/**
|
|
31
|
-
* @param {Port} port
|
|
34
|
+
* @param {import('@agoric/vow').Remote<Port>} port
|
|
32
35
|
* @param {Endpoint} localAddr
|
|
33
|
-
* @param {ListenHandler} listenHandler
|
|
36
|
+
* @param {import('@agoric/vow').Remote<ListenHandler>} listenHandler
|
|
34
37
|
* @param {*} _protocolHandler
|
|
35
38
|
*/
|
|
36
|
-
onListenRemove(port: Port, localAddr:
|
|
39
|
+
onListenRemove(port: import("@agoric/vow").Remote<Port, never>, localAddr: string, listenHandler: import("@agoric/vow").Remote<ListenHandler, never>, _protocolHandler: any): Promise<void>;
|
|
37
40
|
onRevoke(_port: any, _localAddr: any, _protocolHandler: any): Promise<void>;
|
|
38
41
|
}>;
|
|
42
|
+
/**
|
|
43
|
+
* @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js';
|
|
44
|
+
*/
|
|
39
45
|
/**
|
|
40
46
|
* Compatibility note: this must match what our peers use, so don't change it
|
|
41
47
|
* casually.
|
|
42
48
|
*/
|
|
43
49
|
export const ENDPOINT_SEPARATOR: "/";
|
|
44
|
-
export namespace Shape {
|
|
45
|
-
let ConnectionI: import("@endo/patterns").InterfaceGuard<{
|
|
46
|
-
send: import("@endo/patterns").MethodGuard;
|
|
47
|
-
close: import("@endo/patterns").MethodGuard;
|
|
48
|
-
getLocalAddress: import("@endo/patterns").MethodGuard;
|
|
49
|
-
getRemoteAddress: import("@endo/patterns").MethodGuard;
|
|
50
|
-
}>;
|
|
51
|
-
let InboundAttemptI: import("@endo/patterns").InterfaceGuard<{
|
|
52
|
-
accept: import("@endo/patterns").MethodGuard;
|
|
53
|
-
getLocalAddress: import("@endo/patterns").MethodGuard;
|
|
54
|
-
getRemoteAddress: import("@endo/patterns").MethodGuard;
|
|
55
|
-
close: import("@endo/patterns").MethodGuard;
|
|
56
|
-
}>;
|
|
57
|
-
let PortI: import("@endo/patterns").InterfaceGuard<{
|
|
58
|
-
getLocalAddress: import("@endo/patterns").MethodGuard;
|
|
59
|
-
addListener: import("@endo/patterns").MethodGuard;
|
|
60
|
-
connect: import("@endo/patterns").MethodGuard;
|
|
61
|
-
removeListener: import("@endo/patterns").MethodGuard;
|
|
62
|
-
revoke: import("@endo/patterns").MethodGuard;
|
|
63
|
-
}>;
|
|
64
|
-
let ProtocolHandlerI: import("@endo/patterns").InterfaceGuard<{
|
|
65
|
-
onCreate: import("@endo/patterns").MethodGuard;
|
|
66
|
-
generatePortID: import("@endo/patterns").MethodGuard;
|
|
67
|
-
onBind: import("@endo/patterns").MethodGuard;
|
|
68
|
-
onListen: import("@endo/patterns").MethodGuard;
|
|
69
|
-
onListenRemove: import("@endo/patterns").MethodGuard;
|
|
70
|
-
onInstantiate: import("@endo/patterns").MethodGuard;
|
|
71
|
-
onConnect: import("@endo/patterns").MethodGuard;
|
|
72
|
-
onRevoke: import("@endo/patterns").MethodGuard;
|
|
73
|
-
}>;
|
|
74
|
-
let ProtocolImplI: import("@endo/patterns").InterfaceGuard<{
|
|
75
|
-
bind: import("@endo/patterns").MethodGuard;
|
|
76
|
-
inbound: import("@endo/patterns").MethodGuard;
|
|
77
|
-
outbound: import("@endo/patterns").MethodGuard;
|
|
78
|
-
}>;
|
|
79
|
-
function Vow$(shape: any): import("@endo/patterns").Matcher;
|
|
80
|
-
let AttemptDescription: import("@endo/patterns").Matcher;
|
|
81
|
-
let Opts: import("@endo/patterns").Matcher;
|
|
82
|
-
let Data: import("@endo/patterns").Matcher;
|
|
83
|
-
let Bytes: import("@endo/patterns").Matcher;
|
|
84
|
-
let Endpoint: import("@endo/patterns").Matcher;
|
|
85
|
-
let Vow: import("@endo/patterns").Matcher;
|
|
86
|
-
let ConnectionHandler: import("@endo/patterns").Matcher;
|
|
87
|
-
let Connection: import("@endo/patterns").Matcher;
|
|
88
|
-
let InboundAttempt: import("@endo/patterns").Matcher;
|
|
89
|
-
let Listener: import("@endo/patterns").Matcher;
|
|
90
|
-
let ListenHandler: import("@endo/patterns").Matcher;
|
|
91
|
-
let Port: import("@endo/patterns").Matcher;
|
|
92
|
-
let ProtocolHandler: import("@endo/patterns").Matcher;
|
|
93
|
-
let ProtocolImpl: import("@endo/patterns").Matcher;
|
|
94
|
-
}
|
|
95
50
|
export function rethrowUnlessMissing(err: unknown): undefined;
|
|
96
|
-
export function crossoverConnection(zone: import(
|
|
97
|
-
export function prepareNetworkProtocol(zone: import(
|
|
51
|
+
export function crossoverConnection(zone: import("@agoric/zone").Zone, handler0: import("@agoric/vow").Remote<Required<ConnectionHandler>, never>, addr0: string, handler1: import("@agoric/vow").Remote<Required<ConnectionHandler>, never>, addr1: string, makeConnection: (opts: ConnectionOpts) => Connection, current?: globalThis.WeakSetStore<Closable> | undefined): Connection[];
|
|
52
|
+
export function prepareNetworkProtocol(zone: import("@agoric/base-zone").Zone, powers: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: {
|
|
98
53
|
isRetryableReason?: ((reason: any) => boolean) | undefined;
|
|
99
|
-
watchPromise?: ((p: PromiseLike<any>, watcher: import("@agoric/vow/src/watch-promise.js").PromiseWatcher, ...args: unknown[]) => void) | undefined;
|
|
100
54
|
} | undefined) => {
|
|
101
|
-
when: <T
|
|
102
|
-
watch: <T_1 =
|
|
55
|
+
when: <T, TResult1 = import("@agoric/vow").Unwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").Unwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
56
|
+
watch: <T_1 = unknown, TResult1_1 = T_1, TResult2_1 = T_1, C = unknown>(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<TResult1_1 | TResult2_1>;
|
|
103
57
|
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>;
|
|
104
|
-
|
|
105
|
-
|
|
58
|
+
allVows: (vows: any) => import("@agoric/vow").Vow<any>;
|
|
59
|
+
}>): (protocolHandler: import("@agoric/vow").Remote<ProtocolHandler, never>) => Protocol;
|
|
60
|
+
export function prepareEchoConnectionKit(zone: import("@agoric/base-zone").Zone): () => import("@endo/exo").GuardedKit<{
|
|
106
61
|
handler: {
|
|
107
62
|
/**
|
|
108
63
|
* @param {Connection} _connection
|
|
109
64
|
* @param {Bytes} bytes
|
|
110
65
|
* @param {ConnectionHandler} _connectionHandler
|
|
111
66
|
*/
|
|
112
|
-
onReceive(_connection: Connection, bytes:
|
|
67
|
+
onReceive(_connection: Connection, bytes: string, _connectionHandler: ConnectionHandler): Promise<string>;
|
|
113
68
|
/**
|
|
114
69
|
* @param {Connection} _connection
|
|
115
70
|
* @param {CloseReason} [_reason]
|
|
116
71
|
* @param {ConnectionHandler} [_connectionHandler]
|
|
117
72
|
*/
|
|
118
|
-
onClose(_connection: Connection, _reason?:
|
|
73
|
+
onClose(_connection: Connection, _reason?: any, _connectionHandler?: ConnectionHandler | undefined): Promise<void>;
|
|
119
74
|
};
|
|
120
75
|
listener: {
|
|
121
|
-
onAccept(_port: any, _localAddr: any, _remoteAddr: any, _listenHandler: any): Promise<import("@endo/exo
|
|
76
|
+
onAccept(_port: any, _localAddr: any, _remoteAddr: any, _listenHandler: any): Promise<import("@endo/exo").Guarded<{
|
|
122
77
|
/**
|
|
123
78
|
* @param {Connection} _connection
|
|
124
79
|
* @param {Bytes} bytes
|
|
125
80
|
* @param {ConnectionHandler} _connectionHandler
|
|
126
81
|
*/
|
|
127
|
-
onReceive(_connection: Connection, bytes:
|
|
82
|
+
onReceive(_connection: Connection, bytes: string, _connectionHandler: ConnectionHandler): Promise<string>;
|
|
128
83
|
/**
|
|
129
84
|
* @param {Connection} _connection
|
|
130
85
|
* @param {CloseReason} [_reason]
|
|
131
86
|
* @param {ConnectionHandler} [_connectionHandler]
|
|
132
87
|
*/
|
|
133
|
-
onClose(_connection: Connection, _reason?:
|
|
88
|
+
onClose(_connection: Connection, _reason?: any, _connectionHandler?: ConnectionHandler | undefined): Promise<void>;
|
|
134
89
|
}>>;
|
|
135
90
|
onListen(port: any, _listenHandler: any): Promise<void>;
|
|
136
91
|
};
|
|
137
92
|
}>;
|
|
93
|
+
export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { watch }: ReturnType<(zone: import("@agoric/base-zone").Zone, powers?: {
|
|
94
|
+
isRetryableReason?: ((reason: any) => boolean) | undefined;
|
|
95
|
+
} | undefined) => {
|
|
96
|
+
when: <T, TResult1 = import("@agoric/vow").Unwrap<T>, TResult2 = never>(specimenP: T, onFulfilled?: ((value: import("@agoric/vow").Unwrap<T>) => TResult1 | PromiseLike<TResult1>) | undefined, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined) => Promise<TResult1 | TResult2>;
|
|
97
|
+
watch: <T_1 = unknown, TResult1_1 = T_1, TResult2_1 = T_1, C = unknown>(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<TResult1_1 | TResult2_1>;
|
|
98
|
+
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>;
|
|
99
|
+
allVows: (vows: any) => import("@agoric/vow").Vow<any>;
|
|
100
|
+
}>): (args_0?: any) => import("@endo/exo").Guarded<{
|
|
101
|
+
allocateCustomIBCPort(specifiedName?: string): import("@agoric/vow").Vow<any>;
|
|
102
|
+
allocateICAControllerPort(): import("@agoric/vow").Vow<any>;
|
|
103
|
+
allocateICQControllerPort(): import("@agoric/vow").Vow<any>;
|
|
104
|
+
allocateCustomLocalPort(specifiedName?: string): import("@agoric/vow").Vow<any>;
|
|
105
|
+
}>;
|
|
138
106
|
export type ConnectionOpts = {
|
|
139
|
-
addrs:
|
|
140
|
-
handlers: ConnectionHandler[];
|
|
141
|
-
conns: MapStore<number, Connection>;
|
|
142
|
-
current: WeakSetStore<Closable>;
|
|
107
|
+
addrs: string[];
|
|
108
|
+
handlers: import("@agoric/vow").Remote<Required<ConnectionHandler>, never>[];
|
|
109
|
+
conns: globalThis.MapStore<number, Connection>;
|
|
110
|
+
current: globalThis.WeakSetStore<Closable>;
|
|
143
111
|
l: 0 | 1;
|
|
144
112
|
r: 0 | 1;
|
|
145
113
|
};
|
|
114
|
+
import type { AttemptDescription } from './types.js';
|
|
115
|
+
import type { Port } from './types.js';
|
|
116
|
+
import type { ListenHandler } from './types.js';
|
|
117
|
+
import type { ConnectionHandler } from './types.js';
|
|
118
|
+
import type { Connection } from './types.js';
|
|
119
|
+
import type { Closable } from './types.js';
|
|
120
|
+
import type { ProtocolHandler } from './types.js';
|
|
121
|
+
import type { Protocol } from './types.js';
|
|
146
122
|
//# 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":"AAkCA;;;;GAIG;AACH,kCAFW,MAAM,YAahB;AA0tCD;;;;;GAKG;AACH,qDAHW,OAAO,mBAAmB,EAAE,IAAI,sBAChC,UAAU;;;uFApwCoG,CAAC;;;;EAowC9D;;;;IAmCpD;;;;;OAKG;;;;IAgEH;;;;;OAKG;;;GA8CV;AAh6CD;;GAEG;AAEH;;;GAGG;AACH,qCAAsC;AAG/B,0CADK,OAAO,aAWlB;AAyJM,0CARI,OAAO,cAAc,EAAE,IAAI,+MAKpB,cAAc,wFAgD/B;AAi7BM,6CAHI,OAAO,mBAAmB,EAAE,IAAI,UAChC,UAAU;;;;;;;EAAuC,uFAkC3D;AAOM,+CAFI,OAAO,mBAAmB,EAAE,IAAI;;QAsCnC;;;;WAIG;;QASH;;;;WAIG;;;;;YAjBH;;;;eAIG;;YASH;;;;eAIG;;;;;GAuBV;AAwKM,2CAHI,OAAO,mBAAmB,EAAE,IAAI,aAChC,UAAU;;;;;;;EAAuC;;;;;GA+DzD;;;;;;OAv6CW,CAAC,GAAC,CAAC;OACH,CAAC,GAAC,CAAC;;wCA7DyJ,YAAY;0BAAZ,YAAY;mCAAZ,YAAY;uCAAZ,YAAY;gCAAZ,YAAY;8BAAZ,YAAY;qCAAZ,YAAY;8BAAZ,YAAY"}
|