@agoric/network 0.1.1-calypso-dev-84eb287.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/src/types.d.ts ADDED
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Rearrange the exo types to make a cast of the methods (M) and init function (I) to a specific type.
3
+ */
4
+ export type ExoClassMethods<M extends import("@endo/exo").Methods, I extends (...args: any[]) => any> = M & ThisType<{
5
+ self: import("@endo/exo").Guarded<M>;
6
+ state: ReturnType<I>;
7
+ }>;
8
+ /**
9
+ * Each character code carries 8-bit octets. Eventually we want to use passable Uint8Arrays.
10
+ */
11
+ export type Bytes = string;
12
+ /**
13
+ * A local or remote address See multiaddr.js for an
14
+ * opinionated router implementation
15
+ */
16
+ export type Endpoint = string;
17
+ /**
18
+ * A closable object
19
+ */
20
+ export type ClosableI = {
21
+ /**
22
+ * Terminate the object
23
+ */
24
+ close: () => PromiseVow<void>;
25
+ };
26
+ export type Closable = RemotableObject & ClosableI;
27
+ /**
28
+ * The network Protocol
29
+ */
30
+ export type Protocol = {
31
+ /**
32
+ * Claim a port, or if
33
+ * ending in ENDPOINT_SEPARATOR, a fresh name
34
+ */
35
+ bindPort: (prefix: Endpoint) => PromiseVow<Port>;
36
+ };
37
+ /**
38
+ * A port that has been bound to a protocol
39
+ */
40
+ export type Port = {
41
+ /**
42
+ * Get the locally bound name of this
43
+ * port
44
+ */
45
+ getLocalAddress: () => Endpoint;
46
+ /**
47
+ * Begin accepting incoming connections
48
+ */
49
+ addListener: (acceptHandler: Remote<ListenHandler>) => PromiseVow<void>;
50
+ /**
51
+ * Make an outbound connection
52
+ */
53
+ connect: (remote: Endpoint, connectionHandler?: Remote<ConnectionHandler>) => PromiseVow<Connection>;
54
+ /**
55
+ * Remove the currently-bound listener
56
+ */
57
+ removeListener: (acceptHandler: Remote<ListenHandler>) => PromiseVow<void>;
58
+ /**
59
+ * Deallocate the port entirely, removing all
60
+ * listeners and closing all active connections
61
+ */
62
+ revoke: () => PromiseVow<void>;
63
+ };
64
+ /**
65
+ * A handler for incoming connections
66
+ */
67
+ export type ListenHandler = {
68
+ /**
69
+ * The listener has been registered
70
+ */
71
+ onListen?: ((port: Remote<Port>, l: Remote<ListenHandler>) => PromiseVow<void>) | undefined;
72
+ /**
73
+ * A new connection is incoming
74
+ */
75
+ onAccept: (port: Remote<Port>, localAddr: Endpoint, remoteAddr: Endpoint, l: Remote<ListenHandler>) => PromiseVow<Remote<ConnectionHandler>>;
76
+ /**
77
+ * The connection was rejected
78
+ */
79
+ onReject?: ((port: Remote<Port>, localAddr: Endpoint, remoteAddr: Endpoint, l: Remote<ListenHandler>) => PromiseVow<void>) | undefined;
80
+ /**
81
+ * There was an error while listening
82
+ */
83
+ onError?: ((port: Remote<Port>, rej: any, l: Remote<ListenHandler>) => PromiseVow<void>) | undefined;
84
+ /**
85
+ * The
86
+ * listener has been removed
87
+ */
88
+ onRemove?: ((port: Remote<Port>, l: Remote<ListenHandler>) => PromiseVow<void>) | undefined;
89
+ };
90
+ export type ConnectionI = {
91
+ /**
92
+ * Send a packet on the connection
93
+ */
94
+ send: (packetBytes: Bytes, opts?: Record<string, any>) => PromiseVow<Bytes>;
95
+ /**
96
+ * Close both ends of the connection
97
+ */
98
+ close: () => PromiseVow<void>;
99
+ /**
100
+ * Get the locally bound name of this
101
+ * connection
102
+ */
103
+ getLocalAddress: () => Endpoint;
104
+ /**
105
+ * Get the name of the counterparty
106
+ */
107
+ getRemoteAddress: () => Endpoint;
108
+ };
109
+ export type Connection = RemotableObject & ConnectionI;
110
+ /**
111
+ * A handler for a given Connection
112
+ */
113
+ export type ConnectionHandler = {
114
+ /**
115
+ * The connection has been opened
116
+ */
117
+ onOpen?: ((connection: Remote<Connection>, localAddr: Endpoint, remoteAddr: Endpoint, c: Remote<ConnectionHandler>) => PromiseVow<void>) | undefined;
118
+ /**
119
+ * The connection received a packet
120
+ */
121
+ onReceive?: ((connection: Remote<Connection>, ack: Bytes, c: Remote<ConnectionHandler>, opts?: Record<string, any>) => PromiseVow<Bytes>) | undefined;
122
+ /**
123
+ * The connection has been closed
124
+ */
125
+ onClose?: ((connection: Remote<Connection>, reason?: CloseReason, c?: Remote<ConnectionHandler>) => PromiseVow<void>) | undefined;
126
+ };
127
+ /**
128
+ * The reason a connection was closed
129
+ */
130
+ export type CloseReason = any | null;
131
+ export type AttemptDescription = {
132
+ handler: Remote<ConnectionHandler>;
133
+ remoteAddress?: string | undefined;
134
+ localAddress?: string | undefined;
135
+ };
136
+ /**
137
+ * A handler for things the protocol
138
+ * implementation will invoke
139
+ */
140
+ export type ProtocolHandler = {
141
+ /**
142
+ * This protocol is created
143
+ */
144
+ onCreate: (protocol: Remote<ProtocolImpl>, p: Remote<ProtocolHandler>) => PromiseVow<void>;
145
+ /**
146
+ * Create a fresh port identifier for this protocol
147
+ */
148
+ generatePortID: (localAddr: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<string>;
149
+ /**
150
+ * A port will be bound
151
+ */
152
+ onBind: (port: Remote<Port>, localAddr: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<void>;
153
+ /**
154
+ * A port was listening
155
+ */
156
+ onListen: (port: Remote<Port>, localAddr: Endpoint, listenHandler: Remote<ListenHandler>, p: Remote<ProtocolHandler>) => PromiseVow<void>;
157
+ /**
158
+ * A port listener has been reset
159
+ */
160
+ onListenRemove: (port: Remote<Port>, localAddr: Endpoint, listenHandler: Remote<ListenHandler>, p: Remote<ProtocolHandler>) => PromiseVow<void>;
161
+ /**
162
+ * Return unique suffix for local address
163
+ */
164
+ onInstantiate?: ((port: Remote<Port>, localAddr: Endpoint, remote: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<Endpoint>) | undefined;
165
+ /**
166
+ * A port initiates an outbound connection
167
+ */
168
+ onConnect: (port: Remote<Port>, localAddr: Endpoint, remote: Endpoint, c: Remote<ConnectionHandler>, p: Remote<ProtocolHandler>) => PromiseVow<AttemptDescription>;
169
+ /**
170
+ * The port is being completely destroyed
171
+ */
172
+ onRevoke: (port: Remote<Port>, localAddr: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<void>;
173
+ };
174
+ /**
175
+ * An inbound connection attempt
176
+ */
177
+ export type InboundAttempt = {
178
+ /**
179
+ * Establish the connection
180
+ */
181
+ accept: (desc: AttemptDescription) => PromiseVow<Connection>;
182
+ /**
183
+ * Return the local address for this
184
+ * attempt
185
+ */
186
+ getLocalAddress: () => Endpoint;
187
+ /**
188
+ * Return the remote address for
189
+ * this attempt
190
+ */
191
+ getRemoteAddress: () => Endpoint;
192
+ /**
193
+ * Abort the attempt
194
+ */
195
+ close: () => PromiseVow<void>;
196
+ };
197
+ /**
198
+ * Things the protocol can do for us
199
+ */
200
+ export type ProtocolImpl = {
201
+ /**
202
+ * Claim a port, or if
203
+ * ending in ENDPOINT_SEPARATOR, a fresh name
204
+ */
205
+ bindPort: (prefix: Endpoint) => PromiseVow<Remote<Port>>;
206
+ /**
207
+ * Make an attempt to connect into this protocol
208
+ */
209
+ inbound: (listenAddr: Endpoint, remoteAddr: Endpoint) => PromiseVow<InboundAttempt>;
210
+ /**
211
+ * Create an outbound connection
212
+ */
213
+ outbound: (port: Remote<Port>, remoteAddr: Endpoint, connectionHandler: Remote<ConnectionHandler>) => PromiseVow<Connection>;
214
+ };
215
+ import type { PromiseVow } from '@agoric/vow';
216
+ import type { RemotableObject } from '@endo/pass-style';
217
+ import type { Remote } from '@agoric/vow';
218
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
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,EA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C;;;;eAEd,CACb,IAAQ,EAAE,OAAO,IAAI,CAAC,EACtB,SAAa,EAAE,QAAQ,EACvB,MAAU,EAAE,QAAQ,EACpB,CAAK,EAAE,OAAO,iBAAiB,CAAC,EAChC,CAAK,EAAE,OAAO,eAAe,CAAC,KACvB,WAAW,kBAAkB,CAAC;;;;cAExB,CACb,IAAQ,EAAE,OAAO,IAAI,CAAC,EACtB,SAAa,EAAE,QAAQ,EACvB,CAAK,EAAE,OAAO,eAAe,CAAC,KACvB,WAAW,IAAI,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,CACb,UAAc,EAAE,QAAQ,EACxB,UAAc,EAAE,QAAQ,KACjB,WAAW,cAAc,CAAC;;;;cAEpB,CACb,IAAQ,EAAE,OAAO,IAAI,CAAC,EACtB,UAAc,EAAE,QAAQ,EACxB,iBAAqB,EAAE,OAAO,iBAAiB,CAAC,KACzC,WAAW,UAAU,CAAC;;gCAhMO,aAAa;qCADN,kBAAkB;4BACzB,aAAa"}
package/src/types.js ADDED
@@ -0,0 +1,202 @@
1
+ // @ts-check
2
+
3
+ // Ensure this is a module.
4
+ export {};
5
+
6
+ /**
7
+ * @import {Passable, RemotableObject} from '@endo/pass-style';
8
+ * @import {PromiseVow, Remote} from '@agoric/vow';
9
+ */
10
+
11
+ /**
12
+ * @template {import('@endo/exo').Methods} M
13
+ * @template {(...args: any[]) => any} I
14
+ * @typedef {M & ThisType<{ self: import('@endo/exo').Guarded<M>, state: ReturnType<I> }>} ExoClassMethods
15
+ * Rearrange the exo types to make a cast of the methods (M) and init function (I) to a specific type.
16
+ */
17
+
18
+ /**
19
+ * @typedef {string} Bytes Each character code carries 8-bit octets. Eventually we want to use passable Uint8Arrays.
20
+ */
21
+
22
+ /**
23
+ * @typedef {string} Endpoint A local or remote address See multiaddr.js for an
24
+ * opinionated router implementation
25
+ */
26
+
27
+ /**
28
+ * @typedef {object} ClosableI A closable object
29
+ * @property {() => PromiseVow<void>} close Terminate the object
30
+ */
31
+ /**
32
+ * @typedef {RemotableObject & ClosableI} Closable
33
+ */
34
+
35
+ /**
36
+ * @typedef {object} Protocol The network Protocol
37
+ * @property {(prefix: Endpoint) => PromiseVow<Port>} bindPort Claim a port, or if
38
+ * ending in ENDPOINT_SEPARATOR, a fresh name
39
+ */
40
+
41
+ /**
42
+ * @typedef {object} Port A port that has been bound to a protocol
43
+ * @property {() => Endpoint} getLocalAddress Get the locally bound name of this
44
+ * port
45
+ * @property {(acceptHandler: Remote<ListenHandler>) => PromiseVow<void>} addListener
46
+ * Begin accepting incoming connections
47
+ * @property {(
48
+ * remote: Endpoint,
49
+ * connectionHandler?: Remote<ConnectionHandler>,
50
+ * ) => PromiseVow<Connection>} connect
51
+ * Make an outbound connection
52
+ * @property {(acceptHandler: Remote<ListenHandler>) => PromiseVow<void>} removeListener
53
+ * Remove the currently-bound listener
54
+ * @property {() => PromiseVow<void>} revoke Deallocate the port entirely, removing all
55
+ * listeners and closing all active connections
56
+ */
57
+
58
+ /**
59
+ * @typedef {object} ListenHandler A handler for incoming connections
60
+ * @property {(port: Remote<Port>, l: Remote<ListenHandler>) => PromiseVow<void>} [onListen] The listener has been registered
61
+ * @property {(
62
+ * port: Remote<Port>,
63
+ * localAddr: Endpoint,
64
+ * remoteAddr: Endpoint,
65
+ * l: Remote<ListenHandler>,
66
+ * ) => PromiseVow<Remote<ConnectionHandler>>} onAccept
67
+ * A new connection is incoming
68
+ * @property {(
69
+ * port: Remote<Port>,
70
+ * localAddr: Endpoint,
71
+ * remoteAddr: Endpoint,
72
+ * l: Remote<ListenHandler>,
73
+ * ) => PromiseVow<void>} [onReject]
74
+ * The connection was rejected
75
+ * @property {(port: Remote<Port>, rej: any, l: Remote<ListenHandler>) => PromiseVow<void>} [onError]
76
+ * There was an error while listening
77
+ * @property {(port: Remote<Port>, l: Remote<ListenHandler>) => PromiseVow<void>} [onRemove] The
78
+ * listener has been removed
79
+ */
80
+
81
+ /**
82
+ * @typedef {object} ConnectionI
83
+ * @property {(
84
+ * packetBytes: Bytes,
85
+ * opts?: Record<string, any>,
86
+ * ) => PromiseVow<Bytes>} send
87
+ * Send a packet on the connection
88
+ * @property {() => PromiseVow<void>} close Close both ends of the connection
89
+ * @property {() => Endpoint} getLocalAddress Get the locally bound name of this
90
+ * connection
91
+ * @property {() => Endpoint} getRemoteAddress Get the name of the counterparty
92
+ */
93
+ /**
94
+ * @typedef {RemotableObject & ConnectionI} Connection
95
+ */
96
+
97
+ /**
98
+ * @typedef {object} ConnectionHandler A handler for a given Connection
99
+ * @property {(
100
+ * connection: Remote<Connection>,
101
+ * localAddr: Endpoint,
102
+ * remoteAddr: Endpoint,
103
+ * c: Remote<ConnectionHandler>,
104
+ * ) => PromiseVow<void>} [onOpen]
105
+ * The connection has been opened
106
+ * @property {(
107
+ * connection: Remote<Connection>,
108
+ * ack: Bytes,
109
+ * c: Remote<ConnectionHandler>,
110
+ * opts?: Record<string, any>,
111
+ * ) => PromiseVow<Bytes>} [onReceive]
112
+ * The connection received a packet
113
+ * @property {(
114
+ * connection: Remote<Connection>,
115
+ * reason?: CloseReason,
116
+ * c?: Remote<ConnectionHandler>,
117
+ * ) => PromiseVow<void>} [onClose]
118
+ * The connection has been closed
119
+ *
120
+ * @typedef {any | null} CloseReason The reason a connection was closed
121
+ */
122
+
123
+ /**
124
+ * @typedef {object} AttemptDescription
125
+ * @property {Remote<ConnectionHandler>} handler
126
+ * @property {Endpoint} [remoteAddress]
127
+ * @property {Endpoint} [localAddress]
128
+ */
129
+
130
+ /**
131
+ * @typedef {object} ProtocolHandler A handler for things the protocol
132
+ * implementation will invoke
133
+ * @property {(protocol: Remote<ProtocolImpl>, p: Remote<ProtocolHandler>) => PromiseVow<void>} onCreate
134
+ * This protocol is created
135
+ * @property {(localAddr: Endpoint, p: Remote<ProtocolHandler>) => PromiseVow<string>} generatePortID
136
+ * Create a fresh port identifier for this protocol
137
+ * @property {(
138
+ * port: Remote<Port>,
139
+ * localAddr: Endpoint,
140
+ * p: Remote<ProtocolHandler>,
141
+ * ) => PromiseVow<void>} onBind
142
+ * A port will be bound
143
+ * @property {(
144
+ * port: Remote<Port>,
145
+ * localAddr: Endpoint,
146
+ * listenHandler: Remote<ListenHandler>,
147
+ * p: Remote<ProtocolHandler>,
148
+ * ) => PromiseVow<void>} onListen
149
+ * A port was listening
150
+ * @property {(
151
+ * port: Remote<Port>,
152
+ * localAddr: Endpoint,
153
+ * listenHandler: Remote<ListenHandler>,
154
+ * p: Remote<ProtocolHandler>,
155
+ * ) => PromiseVow<void>} onListenRemove
156
+ * A port listener has been reset
157
+ * @property {(
158
+ * port: Remote<Port>,
159
+ * localAddr: Endpoint,
160
+ * remote: Endpoint,
161
+ * p: Remote<ProtocolHandler>,
162
+ * ) => PromiseVow<Endpoint>} [onInstantiate]
163
+ * Return unique suffix for local address
164
+ * @property {(
165
+ * port: Remote<Port>,
166
+ * localAddr: Endpoint,
167
+ * remote: Endpoint,
168
+ * c: Remote<ConnectionHandler>,
169
+ * p: Remote<ProtocolHandler>,
170
+ * ) => PromiseVow<AttemptDescription>} onConnect
171
+ * A port initiates an outbound connection
172
+ * @property {(
173
+ * port: Remote<Port>,
174
+ * localAddr: Endpoint,
175
+ * p: Remote<ProtocolHandler>,
176
+ * ) => PromiseVow<void>} onRevoke
177
+ * The port is being completely destroyed
178
+ *
179
+ * @typedef {object} InboundAttempt An inbound connection attempt
180
+ * @property {(desc: AttemptDescription) => PromiseVow<Connection>} accept
181
+ * Establish the connection
182
+ * @property {() => Endpoint} getLocalAddress Return the local address for this
183
+ * attempt
184
+ * @property {() => Endpoint} getRemoteAddress Return the remote address for
185
+ * this attempt
186
+ * @property {() => PromiseVow<void>} close Abort the attempt
187
+ *
188
+ * @typedef {object} ProtocolImpl Things the protocol can do for us
189
+ * @property {(prefix: Endpoint) => PromiseVow<Remote<Port>>} bindPort Claim a port, or if
190
+ * ending in ENDPOINT_SEPARATOR, a fresh name
191
+ * @property {(
192
+ * listenAddr: Endpoint,
193
+ * remoteAddr: Endpoint,
194
+ * ) => PromiseVow<InboundAttempt>} inbound
195
+ * Make an attempt to connect into this protocol
196
+ * @property {(
197
+ * port: Remote<Port>,
198
+ * remoteAddr: Endpoint,
199
+ * connectionHandler: Remote<ConnectionHandler>,
200
+ * ) => PromiseVow<Connection>} outbound
201
+ * Create an outbound connection
202
+ */