@agoric/network 0.1.1-dev-c19f1b5.0 → 0.1.1-dev-27cc9b8.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 +11 -10
- package/src/bytes.d.ts +14 -1
- package/src/bytes.d.ts.map +1 -1
- package/src/bytes.js +30 -3
- package/src/network.d.ts +6 -6
- package/src/network.d.ts.map +1 -1
- package/src/network.js +0 -2
- package/src/router.d.ts +2 -2
- package/src/router.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-27cc9b8.0+27cc9b8",
|
|
4
4
|
"description": "Agoric's network protocol API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,20 +21,21 @@
|
|
|
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-27cc9b8.0+27cc9b8",
|
|
25
|
+
"@agoric/internal": "0.3.3-dev-27cc9b8.0+27cc9b8",
|
|
26
|
+
"@agoric/store": "0.9.3-dev-27cc9b8.0+27cc9b8",
|
|
27
|
+
"@agoric/vat-data": "0.5.3-dev-27cc9b8.0+27cc9b8",
|
|
28
28
|
"@endo/base64": "^1.0.5",
|
|
29
29
|
"@endo/far": "^1.1.2",
|
|
30
|
+
"@endo/pass-style": "^1.4.0",
|
|
30
31
|
"@endo/patterns": "^1.4.0",
|
|
31
32
|
"@endo/promise-kit": "^1.1.2"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
35
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
36
|
-
"@agoric/vow": "0.1.1-dev-
|
|
37
|
-
"@agoric/zone": "0.2.3-dev-
|
|
35
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-27cc9b8.0+27cc9b8",
|
|
36
|
+
"@agoric/swingset-vat": "0.32.3-dev-27cc9b8.0+27cc9b8",
|
|
37
|
+
"@agoric/vow": "0.1.1-dev-27cc9b8.0+27cc9b8",
|
|
38
|
+
"@agoric/zone": "0.2.3-dev-27cc9b8.0+27cc9b8",
|
|
38
39
|
"@endo/bundle-source": "^3.2.3",
|
|
39
40
|
"ava": "^5.3.0",
|
|
40
41
|
"c8": "^9.1.0"
|
|
@@ -67,5 +68,5 @@
|
|
|
67
68
|
"typeCoverage": {
|
|
68
69
|
"atLeast": 89.7
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "27cc9b8be59abb048f1ea226b96697c3dccc4d0f"
|
|
71
72
|
}
|
package/src/bytes.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Bytes} from './types.js';
|
|
3
|
+
*/
|
|
4
|
+
/** @typedef {Bytes | Buffer | Uint8Array | Iterable<number>} ByteSource */
|
|
5
|
+
/**
|
|
6
|
+
* This function is a coercer instead of an asserter because in a future where
|
|
7
|
+
* binary data has better support across vats and potentially its own type, we
|
|
8
|
+
* might allow more `specimen`s than just `ByteSource`.
|
|
9
|
+
*
|
|
10
|
+
* @param {unknown} specimen
|
|
11
|
+
* @returns {ByteSource}
|
|
12
|
+
*/
|
|
13
|
+
export function coerceToByteSource(specimen: unknown): ByteSource;
|
|
1
14
|
/**
|
|
2
15
|
* Convert a Uint8Array or other sequence of octets to a string representation
|
|
3
16
|
* that `@endo/marshal` accepts as Passable.
|
|
@@ -19,7 +32,7 @@ export function bytesToString(bytes: string): string;
|
|
|
19
32
|
* @param {ByteSource} byteSource
|
|
20
33
|
* @returns {string} base64 encoding
|
|
21
34
|
*/
|
|
22
|
-
export function
|
|
35
|
+
export function byteSourceToBase64(byteSource: ByteSource): string;
|
|
23
36
|
/**
|
|
24
37
|
* Decodes a base64 string into bytes.
|
|
25
38
|
*
|
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":"AAKA;;GAEG;AAEH,2EAA2E;AAE3E;;;;;;;GAOG;AACH,6CAHW,OAAO,GACL,UAAU,CAmBtB;AAuBD;;;;;;GAMG;AACH,oCAHW,UAAU,UAQpB;AAED;;;;;GAKG;AACH,8CAFa,MAAM,CAIlB;AAED;;;;;GAKG;AACH,+CAHW,UAAU,GACR,MAAM,CAKlB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,UAKhB"}
|
package/src/bytes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { Fail } from '@agoric/assert';
|
|
2
|
+
import { details, Fail } from '@agoric/assert';
|
|
4
3
|
import { encodeBase64, decodeBase64 } from '@endo/base64';
|
|
4
|
+
import { isObject } from '@endo/pass-style';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @import {Bytes} from './types.js';
|
|
@@ -9,6 +9,33 @@ import { encodeBase64, decodeBase64 } from '@endo/base64';
|
|
|
9
9
|
|
|
10
10
|
/** @typedef {Bytes | Buffer | Uint8Array | Iterable<number>} ByteSource */
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* This function is a coercer instead of an asserter because in a future where
|
|
14
|
+
* binary data has better support across vats and potentially its own type, we
|
|
15
|
+
* might allow more `specimen`s than just `ByteSource`.
|
|
16
|
+
*
|
|
17
|
+
* @param {unknown} specimen
|
|
18
|
+
* @returns {ByteSource}
|
|
19
|
+
*/
|
|
20
|
+
export function coerceToByteSource(specimen) {
|
|
21
|
+
if (typeof specimen === 'string') {
|
|
22
|
+
return specimen;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
isObject(specimen) ||
|
|
26
|
+
assert.fail(details`non-object ${specimen} is not a ByteSource`, TypeError);
|
|
27
|
+
|
|
28
|
+
const obj = /** @type {{}} */ (specimen);
|
|
29
|
+
typeof obj[Symbol.iterator] === 'function' ||
|
|
30
|
+
assert.fail(
|
|
31
|
+
details`non-iterable ${specimen} is not a ByteSource`,
|
|
32
|
+
TypeError,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Good enough... it's iterable and can be converted later.
|
|
36
|
+
return /** @type {ByteSource} */ (specimen);
|
|
37
|
+
}
|
|
38
|
+
|
|
12
39
|
/**
|
|
13
40
|
* @param {ByteSource} contents
|
|
14
41
|
*/
|
|
@@ -60,7 +87,7 @@ export function bytesToString(bytes) {
|
|
|
60
87
|
* @param {ByteSource} byteSource
|
|
61
88
|
* @returns {string} base64 encoding
|
|
62
89
|
*/
|
|
63
|
-
export function
|
|
90
|
+
export function byteSourceToBase64(byteSource) {
|
|
64
91
|
const bytes = coerceToByteArray(byteSource);
|
|
65
92
|
return encodeBase64(bytes);
|
|
66
93
|
}
|
package/src/network.d.ts
CHANGED
|
@@ -15,9 +15,9 @@ export function prepareLoopbackProtocolHandler(zone: import("@agoric/base-zone")
|
|
|
15
15
|
isRetryableReason?: ((reason: any) => boolean) | undefined;
|
|
16
16
|
} | undefined) => {
|
|
17
17
|
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>;
|
|
18
|
-
watch: <T_1 =
|
|
18
|
+
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(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<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>;
|
|
19
19
|
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>;
|
|
20
|
-
allVows: (vows:
|
|
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>;
|
|
23
23
|
generatePortID(_localAddr: any, _protocolHandler: any): Promise<string>;
|
|
@@ -72,9 +72,9 @@ export function prepareNetworkProtocol(zone: import("@agoric/base-zone").Zone, p
|
|
|
72
72
|
isRetryableReason?: ((reason: any) => boolean) | undefined;
|
|
73
73
|
} | undefined) => {
|
|
74
74
|
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>;
|
|
75
|
-
watch: <T_1 =
|
|
75
|
+
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(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<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>;
|
|
76
76
|
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>;
|
|
77
|
-
allVows: (vows:
|
|
77
|
+
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
78
78
|
}>): (protocolHandler: import("@agoric/vow").Remote<ProtocolHandler, {
|
|
79
79
|
/**
|
|
80
80
|
* Return unique suffix for local address
|
|
@@ -118,9 +118,9 @@ export function preparePortAllocator(zone: import("@agoric/base-zone").Zone, { w
|
|
|
118
118
|
isRetryableReason?: ((reason: any) => boolean) | undefined;
|
|
119
119
|
} | undefined) => {
|
|
120
120
|
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>;
|
|
121
|
-
watch: <T_1 =
|
|
121
|
+
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(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<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>;
|
|
122
122
|
makeVowKit: <T_2>() => import("@agoric/vow").VowKit<T_2>;
|
|
123
|
-
allVows: (vows:
|
|
123
|
+
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
124
124
|
}>): (args_0?: any) => import("@endo/exo").Guarded<{
|
|
125
125
|
allocateCustomIBCPort(specifiedName?: string): import("@agoric/vow").Vow<any>;
|
|
126
126
|
allocateICAControllerPort(): import("@agoric/vow").Vow<any>;
|
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;
|
|
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;;;uFAnwCoG,CAAC;;;oBAc7F,SAC1B;EAovCyD;;;;IAmCpD;;;;;OAKG;;;;IAgEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;GA8CV;AA/5CD;;GAEG;AAEH;;;GAGG;AACH,qCAAsC;AAG/B,0CADK,OAAO,aAWlB;AAyJM,0CARI,OAAO,cAAc,EAAE,IAAI,yMAKpB,cAAc,wFAgD/B;AA+6BM,6CAHI,OAAO,mBAAmB,EAAE,IAAI,UAChC,UAAU;;;;;;;EAAuC;;;;;gBAkC3D;AAOM,+CAFI,OAAO,mBAAmB,EAAE,IAAI;;QAsCnC;;;;WAIG;;QASH;;;;WAIG;;;;;YAjBH;;;;eAIG;;YASH;;;;eAIG;;;;;GAuBV;AAyKM,2CAHI,OAAO,mBAAmB,EAAE,IAAI,aAChC,UAAU;;;;;;;EAAuC;;;;;GA+DzD;oCArOW,UAAU,CAAC,OAAO,wBAAwB,CAAC;;;;;;OAjsC3C,CAAC,GAAC,CAAC;OACH,CAAC,GAAC,CAAC;;wCA7DyJ,YAAY;0BAAZ,YAAY;mCAAZ,YAAY;uCAAZ,YAAY;gCAAZ,YAAY;8BAAZ,YAAY;qCAAZ,YAAY;8BAAZ,YAAY"}
|
package/src/network.js
CHANGED
|
@@ -584,9 +584,7 @@ const preparePort = (zone, powers) => {
|
|
|
584
584
|
// Clean up everything we did.
|
|
585
585
|
const values = [...currentConnections.get(port).values()];
|
|
586
586
|
|
|
587
|
-
/** @type {import('@agoric/vow').Specimen[]} */
|
|
588
587
|
const ps = [];
|
|
589
|
-
|
|
590
588
|
ps.push(
|
|
591
589
|
...values.map(conn =>
|
|
592
590
|
watch(E(conn).close(), this.facets.sinkWatcher),
|
package/src/router.d.ts
CHANGED
|
@@ -35,9 +35,9 @@ export function prepareRouterProtocol(zone: import("@agoric/base-zone").Zone, po
|
|
|
35
35
|
isRetryableReason?: ((reason: any) => boolean) | undefined;
|
|
36
36
|
} | undefined) => {
|
|
37
37
|
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>;
|
|
38
|
-
watch: <T_1 =
|
|
38
|
+
watch: <T_1 = any, TResult1_1 = T_1, TResult2_1 = never, C = any>(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<Exclude<TResult1_1, void> | Exclude<TResult2_1, void> extends never ? TResult1_1 : Exclude<TResult1_1, void> | Exclude<TResult2_1, void>>;
|
|
39
39
|
makeVowKit: <T_2>() => VowKit<T_2>;
|
|
40
|
-
allVows: (vows:
|
|
40
|
+
allVows: (vows: unknown[]) => import("@agoric/vow").Vow<any[]>;
|
|
41
41
|
}>, E?: ((<T_3>(x: T_3) => import("../../../node_modules/@endo/eventual-send/src/E.js").ECallableOrMethods<import("@endo/eventual-send").RemoteFunctions<T_3>>) & {
|
|
42
42
|
readonly get: <T_1_1>(x: T_1_1) => import("../../../node_modules/@endo/eventual-send/src/E.js").EGetters<import("@endo/eventual-send").LocalRecord<T_1_1>>;
|
|
43
43
|
readonly resolve: {
|
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;;;;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