@agoric/internal 0.3.3-dev-7ffae88.0 → 0.3.3-dev-c5284e4.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 +14 -14
- package/src/batched-deliver.d.ts +3 -3
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +4 -1
- package/src/config.d.ts +7 -0
- package/src/config.js +6 -0
- package/src/marshal.d.ts +10 -8
- package/src/marshal.d.ts.map +1 -1
- package/src/marshal.js +18 -6
- package/src/queue.d.ts +1 -1
- package/src/queue.d.ts.map +1 -1
- package/src/queue.js +4 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-dev-
|
|
3
|
+
"version": "0.3.3-dev-c5284e4.0+c5284e4",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"lint:types": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/assert": "0.6.1-dev-
|
|
24
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
25
|
-
"@endo/common": "^1.0
|
|
26
|
-
"@endo/far": "^1.0.
|
|
27
|
-
"@endo/init": "^1.0.
|
|
28
|
-
"@endo/marshal": "^1.
|
|
29
|
-
"@endo/patterns": "^1.
|
|
30
|
-
"@endo/promise-kit": "^1.0.
|
|
31
|
-
"@endo/stream": "^1.0
|
|
23
|
+
"@agoric/assert": "0.6.1-dev-c5284e4.0+c5284e4",
|
|
24
|
+
"@agoric/base-zone": "0.1.1-dev-c5284e4.0+c5284e4",
|
|
25
|
+
"@endo/common": "^1.1.0",
|
|
26
|
+
"@endo/far": "^1.0.4",
|
|
27
|
+
"@endo/init": "^1.0.4",
|
|
28
|
+
"@endo/marshal": "^1.3.0",
|
|
29
|
+
"@endo/patterns": "^1.2.0",
|
|
30
|
+
"@endo/promise-kit": "^1.0.4",
|
|
31
|
+
"@endo/stream": "^1.1.0",
|
|
32
32
|
"anylogger": "^0.21.0",
|
|
33
33
|
"jessie.js": "^0.3.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@endo/init": "^1.0.
|
|
36
|
+
"@endo/init": "^1.0.4",
|
|
37
37
|
"ava": "^5.3.0",
|
|
38
|
-
"tsd": "^0.
|
|
38
|
+
"tsd": "^0.30.4"
|
|
39
39
|
},
|
|
40
40
|
"ava": {
|
|
41
41
|
"require": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"typeCoverage": {
|
|
54
|
-
"atLeast": 92.
|
|
54
|
+
"atLeast": 92.83
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "c5284e4721ad2702c4551f216bb8eed7abe4d7cf"
|
|
57
57
|
}
|
package/src/batched-deliver.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {(message:
|
|
2
|
+
* @typedef {(message: unknown[], ackNum: number) => Promise<void>} DeliverMessages
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @param {DeliverMessages} deliver
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export function makeBatchedDeliver(deliver: DeliverMessages, { clearTimeout, setTimeout }: {
|
|
10
10
|
clearTimeout: typeof clearTimeout;
|
|
11
11
|
setTimeout: typeof setTimeout;
|
|
12
|
-
}, batchTimeoutMs?: number): (message:
|
|
12
|
+
}, batchTimeoutMs?: number): (message: unknown[], ackNum: number) => Promise<void>;
|
|
13
13
|
export const DEFAULT_BATCH_TIMEOUT_MS: 1000;
|
|
14
|
-
export type DeliverMessages = (message:
|
|
14
|
+
export type DeliverMessages = (message: unknown[], ackNum: number) => Promise<void>;
|
|
15
15
|
//# sourceMappingURL=batched-deliver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;;GAIG;AACH,4CAJW,eAAe,gCACf;IAAE,kCAAiD;IAAC,8BAA4C;CAAE,mBAClG,MAAM,aANM,OAAO,EAAE,UAAU,MAAM,KAAK,QAAQ,IAAI,CAAC,CA8CjE;AAjDD,4CAA6C;wCAGtB,OAAO,EAAE,UAAU,MAAM,KAAK,QAAQ,IAAI,CAAC"}
|
package/src/batched-deliver.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
|
+
// @ts-check
|
|
2
3
|
|
|
3
4
|
export const DEFAULT_BATCH_TIMEOUT_MS = 1000;
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* @typedef {(message:
|
|
7
|
+
* @typedef {(message: unknown[], ackNum: number) => Promise<void>} DeliverMessages
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -16,8 +17,10 @@ export function makeBatchedDeliver(
|
|
|
16
17
|
{ clearTimeout, setTimeout },
|
|
17
18
|
batchTimeoutMs = DEFAULT_BATCH_TIMEOUT_MS,
|
|
18
19
|
) {
|
|
20
|
+
/** @type {unknown[]} */
|
|
19
21
|
let batchedMessages = [];
|
|
20
22
|
let latestAckNum = 0;
|
|
23
|
+
/** @type {NodeJS.Timeout} */
|
|
21
24
|
let deliverTimeout;
|
|
22
25
|
|
|
23
26
|
/**
|
package/src/config.d.ts
CHANGED
|
@@ -5,8 +5,15 @@ export namespace BridgeId {
|
|
|
5
5
|
let STORAGE: string;
|
|
6
6
|
let PROVISION: string;
|
|
7
7
|
let PROVISION_SMART_WALLET: string;
|
|
8
|
+
let VLOCALCHAIN: string;
|
|
8
9
|
let WALLET: string;
|
|
9
10
|
}
|
|
11
|
+
export namespace CosmosInitKeyToBridgeId {
|
|
12
|
+
import vbankPort = BridgeId.BANK;
|
|
13
|
+
export { vbankPort };
|
|
14
|
+
import vibcPort = BridgeId.DIBC;
|
|
15
|
+
export { vibcPort };
|
|
16
|
+
}
|
|
10
17
|
export namespace WalletName {
|
|
11
18
|
let depositFacet: string;
|
|
12
19
|
}
|
package/src/config.js
CHANGED
|
@@ -21,10 +21,16 @@ export const BridgeId = {
|
|
|
21
21
|
STORAGE: 'storage',
|
|
22
22
|
PROVISION: 'provision',
|
|
23
23
|
PROVISION_SMART_WALLET: 'provisionWallet',
|
|
24
|
+
VLOCALCHAIN: 'vlocalchain',
|
|
24
25
|
WALLET: 'wallet',
|
|
25
26
|
};
|
|
26
27
|
harden(BridgeId);
|
|
27
28
|
|
|
29
|
+
export const CosmosInitKeyToBridgeId = {
|
|
30
|
+
vbankPort: BridgeId.BANK,
|
|
31
|
+
vibcPort: BridgeId.DIBC,
|
|
32
|
+
};
|
|
33
|
+
|
|
28
34
|
export const WalletName = {
|
|
29
35
|
depositFacet: 'depositFacet',
|
|
30
36
|
};
|
package/src/marshal.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
export function makeBoardRemote({ boardId, iface }:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export function makeBoardRemote({ boardId, iface }: {
|
|
2
|
+
boardId: string | null;
|
|
3
|
+
iface?: string;
|
|
4
|
+
}): BoardRemote;
|
|
5
|
+
export function slotToBoardRemote(boardId: string, iface: string): BoardRemote;
|
|
6
|
+
export function boardSlottingMarshaller(slotToVal?: ((slot: string, iface: string) => any) | undefined): Omit<import('@endo/marshal').Marshal<string | null>, 'serialize' | 'unserialize'>;
|
|
5
7
|
export function unmarshalFromVstorage(data: Map<string, string>, key: string, fromCapData: ReturnType<typeof import('@endo/marshal').makeMarshal>['fromCapData'], index: number): any;
|
|
6
8
|
export function makeHistoryReviver(entries: Array<[string, string]>, slotToVal?: ((slot: string, iface?: string) => any) | undefined): {
|
|
7
|
-
getItem: (key:
|
|
8
|
-
children: (prefix:
|
|
9
|
-
has: (k:
|
|
9
|
+
getItem: (key: string) => any;
|
|
10
|
+
children: (prefix: string) => string[];
|
|
11
|
+
has: (k: string) => boolean;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* Should be a union with Remotable, but that's `any`, making this type meaningless
|
|
13
15
|
*/
|
|
14
16
|
export type BoardRemote = {
|
|
15
|
-
getBoardId: () => string;
|
|
17
|
+
getBoardId: () => string | null;
|
|
16
18
|
};
|
|
17
19
|
//# sourceMappingURL=marshal.d.ts.map
|
package/src/marshal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marshal.d.ts","sourceRoot":"","sources":["marshal.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marshal.d.ts","sourceRoot":"","sources":["marshal.js"],"names":[],"mappings":"AAiBO,oDAHI;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC,WAAW,CAKvB;AAMM,2CAHI,MAAM,SACN,MAAM,eAGoB;AAmB9B,4DAHW,MAAM,SAAS,MAAM,KAAK,GAAG,gBAClC,KAAK,OAAO,eAAe,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,CAM7F;AAyBM,4CALI,IAAI,MAAM,EAAE,MAAM,CAAC,OACnB,MAAM,eACN,WAAW,cAAc,eAAe,EAAE,WAAW,CAAC,CAAC,aAAa,CAAC,SACrE,MAAM,OAwBhB;AASM,4CAHI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,sBAChB,MAAM,UAAU,MAAM,KAAK,GAAG;mBAQlC,MAAM;uBAEN,MAAM;aAYN,MAAM;EAInB;;;;0BAxHY;IAAE,UAAU,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;CAAE"}
|
package/src/marshal.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { Far } from '@endo/far';
|
|
2
3
|
import { makeMarshal } from '@endo/marshal';
|
|
3
4
|
import { isStreamCell } from './lib-chainStorage.js';
|
|
@@ -7,11 +8,11 @@ const { Fail } = assert;
|
|
|
7
8
|
/**
|
|
8
9
|
* Should be a union with Remotable, but that's `any`, making this type meaningless
|
|
9
10
|
*
|
|
10
|
-
* @typedef {{ getBoardId: () => string }} BoardRemote
|
|
11
|
+
* @typedef {{ getBoardId: () => string | null }} BoardRemote
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* @param {
|
|
15
|
+
* @param {{ boardId: string | null, iface?: string }} slotInfo
|
|
15
16
|
* @returns {BoardRemote}
|
|
16
17
|
*/
|
|
17
18
|
export const makeBoardRemote = ({ boardId, iface }) => {
|
|
@@ -19,14 +20,19 @@ export const makeBoardRemote = ({ boardId, iface }) => {
|
|
|
19
20
|
return Far(`BoardRemote${nonalleged}`, { getBoardId: () => boardId });
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} boardId
|
|
25
|
+
* @param {string} iface
|
|
26
|
+
*/
|
|
22
27
|
export const slotToBoardRemote = (boardId, iface) =>
|
|
23
28
|
makeBoardRemote({ boardId, iface });
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
/** @param {BoardRemote | object} val */
|
|
31
|
+
const boardValToSlot = val => {
|
|
26
32
|
if ('getBoardId' in val) {
|
|
27
33
|
return val.getBoardId();
|
|
28
34
|
}
|
|
29
|
-
Fail`unknown obj in boardSlottingMarshaller.valToSlot ${val}`;
|
|
35
|
+
throw Fail`unknown obj in boardSlottingMarshaller.valToSlot ${val}`;
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
/**
|
|
@@ -36,7 +42,7 @@ export const boardValToSlot = val => {
|
|
|
36
42
|
* Remotable-bearing data.
|
|
37
43
|
*
|
|
38
44
|
* @param {(slot: string, iface: string) => any} [slotToVal]
|
|
39
|
-
* @returns {Omit<import('@endo/marshal').Marshal<string>, 'serialize' | 'unserialize'>}
|
|
45
|
+
* @returns {Omit<import('@endo/marshal').Marshal<string | null>, 'serialize' | 'unserialize'>}
|
|
40
46
|
*/
|
|
41
47
|
export const boardSlottingMarshaller = (slotToVal = undefined) => {
|
|
42
48
|
return makeMarshal(boardValToSlot, slotToVal, {
|
|
@@ -101,9 +107,12 @@ harden(unmarshalFromVstorage);
|
|
|
101
107
|
export const makeHistoryReviver = (entries, slotToVal = undefined) => {
|
|
102
108
|
const board = boardSlottingMarshaller(slotToVal);
|
|
103
109
|
const vsMap = new Map(entries);
|
|
110
|
+
/** @param {...unknown} args } */
|
|
104
111
|
const fromCapData = (...args) =>
|
|
105
112
|
Reflect.apply(board.fromCapData, board, args);
|
|
113
|
+
/** @param {string} key } */
|
|
106
114
|
const getItem = key => unmarshalFromVstorage(vsMap, key, fromCapData, -1);
|
|
115
|
+
/** @param {string} prefix } */
|
|
107
116
|
const children = prefix => {
|
|
108
117
|
prefix.endsWith('.') || Fail`prefix must end with '.'`;
|
|
109
118
|
return harden([
|
|
@@ -115,5 +124,8 @@ export const makeHistoryReviver = (entries, slotToVal = undefined) => {
|
|
|
115
124
|
),
|
|
116
125
|
]);
|
|
117
126
|
};
|
|
118
|
-
|
|
127
|
+
/** @param {string} k } */
|
|
128
|
+
const has = k => vsMap.get(k) !== undefined;
|
|
129
|
+
|
|
130
|
+
return harden({ getItem, children, has });
|
|
119
131
|
};
|
package/src/queue.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function makeWithQueue(): <T extends any[]
|
|
1
|
+
export function makeWithQueue(): <T extends (...args: any[]) => any>(inner: T) => (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
2
2
|
//# sourceMappingURL=queue.d.ts.map
|
package/src/queue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["queue.js"],"names":[],"mappings":"AASO,
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["queue.js"],"names":[],"mappings":"AASO,sDAwBmB,GAAG,EAAE,KAAK,GAAG,2EAwBtC"}
|
package/src/queue.js
CHANGED
|
@@ -31,14 +31,13 @@ export const makeWithQueue = () => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @template {any[]} T
|
|
35
|
-
* @
|
|
36
|
-
* @param {(...args: T) => Promise<R>} inner
|
|
34
|
+
* @template {(...args: any[]) => any} T
|
|
35
|
+
* @param {T} inner
|
|
37
36
|
*/
|
|
38
37
|
return function withQueue(inner) {
|
|
39
38
|
/**
|
|
40
|
-
* @param {T} args
|
|
41
|
-
* @returns {Promise<
|
|
39
|
+
* @param {Parameters<T>} args
|
|
40
|
+
* @returns {Promise<Awaited<ReturnType<T>>>}
|
|
42
41
|
*/
|
|
43
42
|
return function queueCall(...args) {
|
|
44
43
|
// Curry the arguments into the inner function, and
|