@agoric/internal 0.3.3-upgrade-16-fi-dev-8879538.0 → 0.3.3-upgrade-16-dev-24665a9.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 +5 -5
- package/src/batched-deliver.d.ts +4 -1
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +4 -1
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +24 -22
- package/src/chain-storage-paths.d.ts +2 -3
- package/src/chain-storage-paths.d.ts.map +1 -1
- package/src/chain-storage-paths.js +2 -3
- package/src/config.d.ts +7 -5
- package/src/config.d.ts.map +1 -1
- package/src/config.js +12 -8
- package/src/lib-chainStorage.d.ts +26 -11
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +69 -35
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -1
- package/src/lib-nodejs/spawnSubprocessWorker.js +7 -5
- package/src/lib-nodejs/worker-protocol.d.ts.map +1 -1
- package/src/lib-nodejs/worker-protocol.js +5 -7
- package/src/magic-cookie-test-only.js +2 -2
- package/src/marshal.d.ts +3 -2
- package/src/marshal.d.ts.map +1 -1
- package/src/marshal.js +18 -12
- package/src/method-tools.d.ts.map +1 -1
- package/src/method-tools.js +17 -16
- package/src/netstring.d.ts +4 -5
- package/src/netstring.d.ts.map +1 -1
- package/src/netstring.js +8 -11
- package/src/node/buffer-line-transform.d.ts +15 -10
- package/src/node/buffer-line-transform.d.ts.map +1 -1
- package/src/node/buffer-line-transform.js +11 -8
- package/src/node/fs-stream.js +1 -1
- package/src/node/utils.d.ts +9 -0
- package/src/node/utils.d.ts.map +1 -0
- package/src/node/utils.js +46 -0
- package/src/priority-senders.d.ts.map +1 -1
- package/src/priority-senders.js +7 -3
- package/src/queue.js +2 -2
- package/src/storage-test-utils.d.ts +17 -8
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +84 -33
- package/src/testing-utils.d.ts.map +1 -1
- package/src/testing-utils.js +7 -5
- package/src/types.d.ts +10 -1
- package/src/upgrade-api.d.ts +2 -2
- package/src/upgrade-api.d.ts.map +1 -1
- package/src/upgrade-api.js +8 -8
- package/src/utils.d.ts +23 -21
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +49 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-upgrade-16-
|
|
3
|
+
"version": "0.3.3-upgrade-16-dev-24665a9.0+24665a9",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"lint:types": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/assert": "0.6.1-upgrade-16-
|
|
24
|
-
"@agoric/base-zone": "0.1.1-upgrade-16-
|
|
23
|
+
"@agoric/assert": "0.6.1-upgrade-16-dev-24665a9.0+24665a9",
|
|
24
|
+
"@agoric/base-zone": "0.1.1-upgrade-16-dev-24665a9.0+24665a9",
|
|
25
25
|
"@endo/common": "^1.2.2",
|
|
26
26
|
"@endo/far": "^1.1.2",
|
|
27
27
|
"@endo/init": "^1.1.2",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"typeCoverage": {
|
|
59
|
-
"atLeast": 93.
|
|
59
|
+
"atLeast": 93.89
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "24665a97248b854fcb01185d360429301470ed57"
|
|
62
62
|
}
|
package/src/batched-deliver.d.ts
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @param {DeliverMessages} deliver
|
|
6
|
-
* @param {{
|
|
6
|
+
* @param {{
|
|
7
|
+
* clearTimeout: import('node:timers').clearTimeout;
|
|
8
|
+
* setTimeout: import('node:timers').setTimeout;
|
|
9
|
+
* }} io
|
|
7
10
|
* @param {number} batchTimeoutMs
|
|
8
11
|
*/
|
|
9
12
|
export function makeBatchedDeliver(deliver: DeliverMessages, { clearTimeout, setTimeout }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"batched-deliver.d.ts","sourceRoot":"","sources":["batched-deliver.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;;;;;GAOG;AACH,4CAPW,eAAe,gCACf;IACV,YAAgB,sBAAqC;IACrD,UAAc,oBAAmC;CAC9C,mBACO,MAAM,aATM,OAAO,EAAE,UAAU,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAiDjE;AApDD,4CAA6C;8BAGhC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC"}
|
package/src/batched-deliver.js
CHANGED
|
@@ -9,7 +9,10 @@ export const DEFAULT_BATCH_TIMEOUT_MS = 1000;
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {DeliverMessages} deliver
|
|
12
|
-
* @param {{
|
|
12
|
+
* @param {{
|
|
13
|
+
* clearTimeout: import('node:timers').clearTimeout;
|
|
14
|
+
* setTimeout: import('node:timers').setTimeout;
|
|
15
|
+
* }} io
|
|
13
16
|
* @param {number} batchTimeoutMs
|
|
14
17
|
*/
|
|
15
18
|
export function makeBatchedDeliver(
|
package/src/callback.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["callback.js"],"names":[],"mappings":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,cACD,CAAC,YACD,CAAC,eAWX;AAOM,qCAHI,GAAG,6BAeb;AAiBM,kCARI,CAAC,4BAFD,OAAO,mBAAmB,EAAE,IAAI,eAEhC,CAAC,EAAE;IAID,cAAc;IAEF,GAAG;;aAmEb,GAAG;;;uDAvDgB,GAAG,WAAW,OAAO,EAAE,KAAK,GAAG,KA0FhE;AAYM,yCAJI,CAAC,mHADD,OAAO,mBAAmB,EAAE,IAAI,kBAChC,CAAC;;gBAUQ,cAAc,CAAC,GAAG,CAAC,CACtC;2BAtSmC,CAAC,wCAFxB,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,GAwKxB,CAAC,4BAFD,OAAO,mBAAmB,EAAE,IAAI,eAEhC,CAAC,EAAE;IAID,cAAc;IAEF,GAAG;;;;;uDAYM,GAAG,WAAW,OAAO,EAAE,cA1LH,CAAC,KAC/C,OAAO,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;kCAhBI,YAAY;8BAAZ,YAAY;0BAD9B,WAAW"}
|
package/src/callback.js
CHANGED
|
@@ -3,8 +3,8 @@ import { E } from '@endo/far';
|
|
|
3
3
|
import { isObject, isPassableSymbol } from '@endo/marshal';
|
|
4
4
|
import { getInterfaceMethodKeys } from '@endo/patterns';
|
|
5
5
|
|
|
6
|
-
/** @import {
|
|
7
|
-
/** @import {
|
|
6
|
+
/** @import {ERef} from '@endo/far' */
|
|
7
|
+
/** @import {Callback, SyncCallback} from './types.js' */
|
|
8
8
|
|
|
9
9
|
const { Fail, quote: q } = assert;
|
|
10
10
|
|
|
@@ -12,19 +12,21 @@ const { fromEntries } = Object;
|
|
|
12
12
|
|
|
13
13
|
const { ownKeys: rawOwnKeys } = Reflect;
|
|
14
14
|
const ownKeys =
|
|
15
|
-
/** @type {<T extends PropertyKey>(obj: {[K in T]?: unknown}) => T[]} */ (
|
|
15
|
+
/** @type {<T extends PropertyKey>(obj: { [K in T]?: unknown }) => T[]} */ (
|
|
16
16
|
rawOwnKeys
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @template {import('@endo/exo').Methods} T
|
|
21
|
-
* @typedef {(
|
|
21
|
+
* @typedef {(
|
|
22
|
+
* ...args: Parameters<ReturnType<prepareAttenuator>>
|
|
23
|
+
* ) => import('@endo/exo').Farable<T>} MakeAttenuator
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* @param {unknown} key
|
|
26
28
|
* @returns {key is PropertyKey} FIXME: should be just `PropertyKey` but TS
|
|
27
|
-
*
|
|
29
|
+
* complains it can't be used as an index type.
|
|
28
30
|
*/
|
|
29
31
|
const isPropertyKey = key => {
|
|
30
32
|
switch (typeof key) {
|
|
@@ -94,9 +96,7 @@ harden(makeSyncFunctionCallback);
|
|
|
94
96
|
* Create a callback from a potentially far function.
|
|
95
97
|
*
|
|
96
98
|
* @template {(...args: unknown[]) => any} I
|
|
97
|
-
* @template {ERef<
|
|
98
|
-
* (...args: [...B, ...Parameters<I>]) => ReturnType<I>
|
|
99
|
-
* >} [T=ERef<I>]
|
|
99
|
+
* @template {ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>>} [T=ERef<I>]
|
|
100
100
|
* @template {unknown[]} [B=[]]
|
|
101
101
|
* @param {T} target
|
|
102
102
|
* @param {B} bound
|
|
@@ -117,7 +117,7 @@ harden(makeFunctionCallback);
|
|
|
117
117
|
* @template {(...args: unknown[]) => any} I
|
|
118
118
|
* @template {PropertyKey} P
|
|
119
119
|
* @template {{
|
|
120
|
-
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I
|
|
120
|
+
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
|
|
121
121
|
* }} [T={ [x in P]: I }]
|
|
122
122
|
* @template {unknown[]} [B=[]]
|
|
123
123
|
* @param {T} target
|
|
@@ -143,7 +143,7 @@ harden(makeSyncMethodCallback);
|
|
|
143
143
|
* @template {(...args: unknown[]) => any} I
|
|
144
144
|
* @template {PropertyKey} P
|
|
145
145
|
* @template {ERef<{
|
|
146
|
-
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I
|
|
146
|
+
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
|
|
147
147
|
* }>} [T=ERef<{ [x in P]: I }>]
|
|
148
148
|
* @template {unknown[]} [B=[]]
|
|
149
149
|
* @param {T} target
|
|
@@ -185,13 +185,14 @@ harden(isCallback);
|
|
|
185
185
|
* Prepare an attenuator class whose methods can be redirected via callbacks.
|
|
186
186
|
*
|
|
187
187
|
* @template {PropertyKey} M
|
|
188
|
-
* @param {import('@agoric/base-zone').Zone} zone The zone in which to allocate
|
|
188
|
+
* @param {import('@agoric/base-zone').Zone} zone The zone in which to allocate
|
|
189
|
+
* attenuators.
|
|
189
190
|
* @param {M[]} methodNames Methods to forward.
|
|
190
191
|
* @param {object} opts
|
|
191
192
|
* @param {import('@endo/patterns').InterfaceGuard<{
|
|
192
|
-
*
|
|
193
|
-
* }>} [opts.interfaceGuard]
|
|
194
|
-
* new attenuator.
|
|
193
|
+
* [K in M]: import('@endo/patterns').MethodGuard;
|
|
194
|
+
* }>} [opts.interfaceGuard]
|
|
195
|
+
* An interface guard for the new attenuator.
|
|
195
196
|
* @param {string} [opts.tag] A tag for the new attenuator exoClass.
|
|
196
197
|
*/
|
|
197
198
|
export const prepareAttenuator = (
|
|
@@ -201,7 +202,9 @@ export const prepareAttenuator = (
|
|
|
201
202
|
) => {
|
|
202
203
|
/**
|
|
203
204
|
* @typedef {(this: any, ...args: unknown[]) => any} Method
|
|
204
|
-
*
|
|
205
|
+
*
|
|
206
|
+
* @typedef {{ [K in M]?: Callback<any> | null }} Overrides
|
|
207
|
+
*
|
|
205
208
|
* @typedef {{ [K in M]: (this: any, ...args: unknown[]) => any }} Methods
|
|
206
209
|
*/
|
|
207
210
|
const methods = /** @type {Methods} */ (
|
|
@@ -244,14 +247,13 @@ export const prepareAttenuator = (
|
|
|
244
247
|
* and/or individual method override callbacks.
|
|
245
248
|
*
|
|
246
249
|
* @param {object} opts
|
|
247
|
-
* @param {unknown} [opts.target] The target for any methods that
|
|
248
|
-
*
|
|
250
|
+
* @param {unknown} [opts.target] The target for any methods that weren't
|
|
251
|
+
* specified in `opts.overrides`.
|
|
249
252
|
* @param {boolean} [opts.isSync=false] Whether the target should be treated
|
|
250
|
-
*
|
|
251
|
-
* @param {Overrides} [opts.overrides] Set individual
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* mean to throw.
|
|
253
|
+
* as synchronously available.
|
|
254
|
+
* @param {Overrides} [opts.overrides] Set individual callbacks for methods
|
|
255
|
+
* (whose names must be defined in the `prepareAttenuator` or
|
|
256
|
+
* `prepareGuardedAttenuator` call). Nullish overrides mean to throw.
|
|
255
257
|
*/
|
|
256
258
|
const makeAttenuator = zone.exoClass(
|
|
257
259
|
tag,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* These identify top-level paths for SwingSet chain storage
|
|
3
|
-
*
|
|
4
|
-
* To avoid collisions, they should remain synchronized with
|
|
2
|
+
* These identify top-level paths for SwingSet chain storage (and serve as
|
|
3
|
+
* prefixes). To avoid collisions, they should remain synchronized with
|
|
5
4
|
* golang/cosmos/x/swingset/keeper/keeper.go
|
|
6
5
|
*/
|
|
7
6
|
export const ACTION_QUEUE: "actionQueue";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-storage-paths.d.ts","sourceRoot":"","sources":["chain-storage-paths.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"chain-storage-paths.d.ts","sourceRoot":"","sources":["chain-storage-paths.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,yCAA0C;AAC1C,sDAAuD;AACvD,0DAA2D;AAC3D,sCAAuC;AACvC,8BAA+B;AAC/B,gCAAiC;AACjC,gCAAiC;AACjC,iCAAkC;AAClC,uCAAwC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* These identify top-level paths for SwingSet chain storage
|
|
5
|
-
*
|
|
6
|
-
* To avoid collisions, they should remain synchronized with
|
|
4
|
+
* These identify top-level paths for SwingSet chain storage (and serve as
|
|
5
|
+
* prefixes). To avoid collisions, they should remain synchronized with
|
|
7
6
|
* golang/cosmos/x/swingset/keeper/keeper.go
|
|
8
7
|
*/
|
|
9
8
|
export const ACTION_QUEUE = 'actionQueue';
|
package/src/config.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export namespace BridgeId {
|
|
|
9
9
|
let VTRANSFER: "vtransfer";
|
|
10
10
|
let WALLET: "wallet";
|
|
11
11
|
}
|
|
12
|
+
/** @typedef {(typeof BridgeId)[keyof typeof BridgeId]} BridgeIdValue */
|
|
13
|
+
export const VTRANSFER_IBC_EVENT: "VTRANSFER_IBC_EVENT";
|
|
12
14
|
export namespace CosmosInitKeyToBridgeId {
|
|
13
15
|
import vbankPort = BANK;
|
|
14
16
|
export { vbankPort };
|
|
@@ -16,17 +18,17 @@ export namespace CosmosInitKeyToBridgeId {
|
|
|
16
18
|
export { vibcPort };
|
|
17
19
|
}
|
|
18
20
|
export namespace WalletName {
|
|
19
|
-
let depositFacet:
|
|
21
|
+
let depositFacet: "depositFacet";
|
|
20
22
|
}
|
|
21
23
|
export namespace VBankAccount {
|
|
22
24
|
namespace reserve {
|
|
23
|
-
let module:
|
|
24
|
-
let address:
|
|
25
|
+
let module: "vbank/reserve";
|
|
26
|
+
let address: "agoric1ae0lmtzlgrcnla9xjkpaarq5d5dfez63h3nucl";
|
|
25
27
|
}
|
|
26
28
|
namespace provision {
|
|
27
|
-
let module_1:
|
|
29
|
+
let module_1: "vbank/provision";
|
|
28
30
|
export { module_1 as module };
|
|
29
|
-
let address_1:
|
|
31
|
+
let address_1: "agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346";
|
|
30
32
|
export { address_1 as address };
|
|
31
33
|
}
|
|
32
34
|
}
|
package/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.js"],"names":[],"mappings":";;;;;;;;;;;AA8BA,wEAAwE;AAExE,wDAAyD;;;;;;;;;;;;;;;;;;;;;;4BAF3C,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC"}
|
package/src/config.js
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @file
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Some of this config info may make more sense in a particular package. However
|
|
8
|
+
* due to https://github.com/Agoric/agoric-sdk/issues/4620 and our lax package
|
|
9
|
+
* dependency graph, sometimes rational placements cause type resolution
|
|
10
|
+
* errors.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
+
* So as a work-around some constants that need access from more than one
|
|
13
|
+
* package are placed here.
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -28,18 +30,20 @@ export const BridgeId = /** @type {const} */ ({
|
|
|
28
30
|
harden(BridgeId);
|
|
29
31
|
/** @typedef {(typeof BridgeId)[keyof typeof BridgeId]} BridgeIdValue */
|
|
30
32
|
|
|
33
|
+
export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT';
|
|
34
|
+
|
|
31
35
|
export const CosmosInitKeyToBridgeId = {
|
|
32
36
|
vbankPort: BridgeId.BANK,
|
|
33
37
|
vibcPort: BridgeId.DIBC,
|
|
34
38
|
};
|
|
35
39
|
|
|
36
|
-
export const WalletName = {
|
|
40
|
+
export const WalletName = /** @type {const} */ ({
|
|
37
41
|
depositFacet: 'depositFacet',
|
|
38
|
-
};
|
|
42
|
+
});
|
|
39
43
|
harden(WalletName);
|
|
40
44
|
|
|
41
45
|
// defined in golang/cosmos/x/vbank
|
|
42
|
-
export const VBankAccount = {
|
|
46
|
+
export const VBankAccount = /** @type {const} */ ({
|
|
43
47
|
reserve: {
|
|
44
48
|
module: 'vbank/reserve',
|
|
45
49
|
address: 'agoric1ae0lmtzlgrcnla9xjkpaarq5d5dfez63h3nucl',
|
|
@@ -48,5 +52,5 @@ export const VBankAccount = {
|
|
|
48
52
|
module: 'vbank/provision',
|
|
49
53
|
address: 'agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346',
|
|
50
54
|
},
|
|
51
|
-
};
|
|
55
|
+
});
|
|
52
56
|
harden(VBankAccount);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Create a heap-based root storage node for a given backing function and root
|
|
2
|
+
* Create a heap-based root storage node for a given backing function and root
|
|
3
|
+
* path.
|
|
3
4
|
*
|
|
4
5
|
* @param {(message: StorageMessage) => any} handleStorageMessage a function for
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* sending a storageMessage object to the storage implementation (cf.
|
|
7
|
+
* golang/cosmos/x/vstorage/vstorage.go)
|
|
7
8
|
* @param {string} rootPath
|
|
8
9
|
* @param {object} [rootOptions]
|
|
9
10
|
* @param {boolean} [rootOptions.sequence] employ a wrapping structure that
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* preserves each value set within a single block, and default child nodes to
|
|
12
|
+
* do the same
|
|
12
13
|
*/
|
|
13
14
|
export function makeChainStorageRoot(handleStorageMessage: (message: StorageMessage) => any, rootPath: string, rootOptions?: {
|
|
14
15
|
sequence?: boolean | undefined;
|
|
@@ -19,7 +20,12 @@ export function makeChainStorageRoot(handleStorageMessage: (message: StorageMess
|
|
|
19
20
|
* @type {() => Promise<VStorageKey>}
|
|
20
21
|
*/
|
|
21
22
|
getStoreKey(): Promise<VStorageKey>;
|
|
22
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* @type {(
|
|
25
|
+
* name: string,
|
|
26
|
+
* childNodeOptions?: { sequence?: boolean },
|
|
27
|
+
* ) => StorageNode}
|
|
28
|
+
*/
|
|
23
29
|
makeChildNode(name: string, childNodeOptions?: {
|
|
24
30
|
sequence?: boolean;
|
|
25
31
|
}): StorageNode;
|
|
@@ -49,7 +55,12 @@ export function prepareChainStorageNode(zone: import("@agoric/base-zone").Zone):
|
|
|
49
55
|
* @type {() => Promise<VStorageKey>}
|
|
50
56
|
*/
|
|
51
57
|
getStoreKey(): Promise<VStorageKey>;
|
|
52
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @type {(
|
|
60
|
+
* name: string,
|
|
61
|
+
* childNodeOptions?: { sequence?: boolean },
|
|
62
|
+
* ) => StorageNode}
|
|
63
|
+
*/
|
|
53
64
|
makeChildNode(name: string, childNodeOptions?: {
|
|
54
65
|
sequence?: boolean;
|
|
55
66
|
}): StorageNode;
|
|
@@ -83,7 +94,8 @@ export type StreamCell<T = unknown> = {
|
|
|
83
94
|
/**
|
|
84
95
|
* This represents a node in an IAVL tree.
|
|
85
96
|
*
|
|
86
|
-
* The active implementation is x/vstorage, an Agoric extension of the Cosmos
|
|
97
|
+
* The active implementation is x/vstorage, an Agoric extension of the Cosmos
|
|
98
|
+
* SDK.
|
|
87
99
|
*
|
|
88
100
|
* Vstorage is a hierarchical externally-reachable storage structure that
|
|
89
101
|
* identifies children by restricted ASCII name and is associated with arbitrary
|
|
@@ -95,7 +107,8 @@ export type StorageNode = {
|
|
|
95
107
|
*/
|
|
96
108
|
setValue: (data: string) => Promise<void>;
|
|
97
109
|
/**
|
|
98
|
-
* the chain storage path at which the node was
|
|
110
|
+
* the chain storage path at which the node was
|
|
111
|
+
* constructed
|
|
99
112
|
*/
|
|
100
113
|
getPath: () => string;
|
|
101
114
|
/**
|
|
@@ -108,7 +121,8 @@ export type StorageNode = {
|
|
|
108
121
|
};
|
|
109
122
|
export type StoredFacet = {
|
|
110
123
|
/**
|
|
111
|
-
* the chain storage path at which the
|
|
124
|
+
* the chain storage path at which the
|
|
125
|
+
* node was constructed
|
|
112
126
|
*/
|
|
113
127
|
getPath: () => Promise<string>;
|
|
114
128
|
/**
|
|
@@ -116,7 +130,8 @@ export type StoredFacet = {
|
|
|
116
130
|
*/
|
|
117
131
|
getStoreKey: StorageNode["getStoreKey"];
|
|
118
132
|
/**
|
|
119
|
-
* get the unserializer for the
|
|
133
|
+
* get the unserializer for the
|
|
134
|
+
* stored data
|
|
120
135
|
*/
|
|
121
136
|
getUnserializer: () => Unserializer;
|
|
122
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib-chainStorage.d.ts","sourceRoot":"","sources":["lib-chainStorage.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib-chainStorage.d.ts","sourceRoot":"","sources":["lib-chainStorage.js"],"names":[],"mappings":"AA0PA;;;;;;;;;;;;GAYG;AACH,2DATW,CAAC,OAAO,EAAE,cAAc,KAAK,GAAG,YAGhC,MAAM;;;;IAhEX;;;OAGG;mBADa,OAAO,CAAC,WAAW,CAAC;IASpC;;;;;OAKG;wBAHQ,MAAM,qBACO;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GACtC,WAAW;IAYnB,+CAA+C;oBAA5B,MAAM,GAAK,OAAO,CAAC,IAAI,CAAC;GAqDhD;AAWD;;;;;;;;GAQG;AACH,0FAHW,MAAM,GACJ,OAAO,CAAC,WAAW,CAAC,CAMhC;AAjOM,mCAHI,GAAG,GACD,IAAI,IAAI,UAAU,CAOa;AASrC,oCAHI,OAAO,GACL,OAAO,CAAC,IAAI,IAAI,OAAO,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAQnE;AAmBD,qCAAqC;AACrC,gCADW,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAI/B;AAyCK,8CAFI,OAAO,mBAAmB,EAAE,IAAI,uDAwBxB,cAAc,KAAK,GAAG;;;;IAenC;;;OAGG;mBADa,OAAO,CAAC,WAAW,CAAC;IASpC;;;;;OAKG;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ACJ,eAAe"}
|
package/src/lib-chainStorage.js
CHANGED
|
@@ -35,7 +35,8 @@ const { Fail } = assert;
|
|
|
35
35
|
/**
|
|
36
36
|
* This represents a node in an IAVL tree.
|
|
37
37
|
*
|
|
38
|
-
* The active implementation is x/vstorage, an Agoric extension of the Cosmos
|
|
38
|
+
* The active implementation is x/vstorage, an Agoric extension of the Cosmos
|
|
39
|
+
* SDK.
|
|
39
40
|
*
|
|
40
41
|
* Vstorage is a hierarchical externally-reachable storage structure that
|
|
41
42
|
* identifies children by restricted ASCII name and is associated with arbitrary
|
|
@@ -43,9 +44,13 @@ const { Fail } = assert;
|
|
|
43
44
|
*
|
|
44
45
|
* @typedef {object} StorageNode
|
|
45
46
|
* @property {(data: string) => Promise<void>} setValue publishes some data
|
|
46
|
-
* @property {() => string} getPath the chain storage path at which the node was
|
|
47
|
+
* @property {() => string} getPath the chain storage path at which the node was
|
|
48
|
+
* constructed
|
|
47
49
|
* @property {() => Promise<VStorageKey>} getStoreKey DEPRECATED use getPath
|
|
48
|
-
* @property {(
|
|
50
|
+
* @property {(
|
|
51
|
+
* subPath: string,
|
|
52
|
+
* options?: { sequence?: boolean },
|
|
53
|
+
* ) => StorageNode} makeChildNode
|
|
49
54
|
*/
|
|
50
55
|
|
|
51
56
|
const ChainStorageNodeI = M.interface('StorageNode', {
|
|
@@ -59,9 +64,8 @@ const ChainStorageNodeI = M.interface('StorageNode', {
|
|
|
59
64
|
|
|
60
65
|
/**
|
|
61
66
|
* This is an imperfect heuristic to navigate the migration from value cells to
|
|
62
|
-
* stream cells.
|
|
63
|
-
*
|
|
64
|
-
* and we do not intend to create any more legacy value cells.
|
|
67
|
+
* stream cells. At time of writing, no legacy cells have the same shape as a
|
|
68
|
+
* stream cell, and we do not intend to create any more legacy value cells.
|
|
65
69
|
*
|
|
66
70
|
* @param {any} cell
|
|
67
71
|
* @returns {cell is StreamCell}
|
|
@@ -91,9 +95,11 @@ harden(assertCapData);
|
|
|
91
95
|
|
|
92
96
|
/**
|
|
93
97
|
* @typedef {object} StoredFacet
|
|
94
|
-
* @property {() => Promise<string>} getPath the chain storage path at which the
|
|
98
|
+
* @property {() => Promise<string>} getPath the chain storage path at which the
|
|
99
|
+
* node was constructed
|
|
95
100
|
* @property {StorageNode['getStoreKey']} getStoreKey DEPRECATED use getPath
|
|
96
|
-
* @property {() => Unserializer} getUnserializer get the unserializer for the
|
|
101
|
+
* @property {() => Unserializer} getUnserializer get the unserializer for the
|
|
102
|
+
* stored data
|
|
97
103
|
*/
|
|
98
104
|
|
|
99
105
|
// TODO: Formalize segment constraints.
|
|
@@ -113,19 +119,36 @@ harden(assertPathSegment);
|
|
|
113
119
|
/**
|
|
114
120
|
* Must match the switch in vstorage.go using `vstorageMessage` type
|
|
115
121
|
*
|
|
116
|
-
* @typedef {
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
+
* @typedef {'get'
|
|
123
|
+
* | 'getStoreKey'
|
|
124
|
+
* | 'has'
|
|
125
|
+
* | 'children'
|
|
126
|
+
* | 'entries'
|
|
127
|
+
* | 'values'
|
|
128
|
+
* | 'size'} StorageGetByPathMessageMethod
|
|
129
|
+
*
|
|
130
|
+
*
|
|
131
|
+
* @typedef {'set' | 'setWithoutNotify' | 'append'} StorageUpdateEntriesMessageMethod
|
|
132
|
+
*
|
|
133
|
+
*
|
|
134
|
+
* @typedef {StorageGetByPathMessageMethod
|
|
135
|
+
* | StorageUpdateEntriesMessageMethod} StorageMessageMethod
|
|
136
|
+
*
|
|
137
|
+
*
|
|
138
|
+
* @typedef {[path: string]} StorageGetByPathMessageArgs
|
|
139
|
+
*
|
|
140
|
+
* @typedef {[path: string, value?: string | null]} StorageEntry
|
|
141
|
+
*
|
|
142
|
+
* @typedef {StorageEntry[]} StorageUpdateEntriesMessageArgs
|
|
143
|
+
*
|
|
122
144
|
* @typedef {{
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
145
|
+
* method: StorageGetByPathMessageMethod;
|
|
146
|
+
* args: StorageGetByPathMessageArgs;
|
|
147
|
+
* }
|
|
148
|
+
* | {
|
|
149
|
+
* method: StorageUpdateEntriesMessageMethod;
|
|
150
|
+
* args: StorageUpdateEntriesMessageArgs;
|
|
151
|
+
* }} StorageMessage
|
|
129
152
|
*/
|
|
130
153
|
|
|
131
154
|
/**
|
|
@@ -135,22 +158,26 @@ export const prepareChainStorageNode = zone => {
|
|
|
135
158
|
/**
|
|
136
159
|
* Create a storage node for a given backing storage interface and path.
|
|
137
160
|
*
|
|
138
|
-
* @param {import('./types.js').Callback<
|
|
139
|
-
*
|
|
140
|
-
*
|
|
161
|
+
* @param {import('./types.js').Callback<
|
|
162
|
+
* (message: StorageMessage) => any
|
|
163
|
+
* >} messenger
|
|
164
|
+
* a callback for sending a storageMessage object to the storage
|
|
165
|
+
* implementation (cf. golang/cosmos/x/vstorage/vstorage.go)
|
|
141
166
|
* @param {string} path
|
|
142
167
|
* @param {object} [options]
|
|
143
|
-
* @param {boolean} [options.sequence] set values with `append` messages
|
|
144
|
-
* so the backing implementation employs a
|
|
145
|
-
* preserves each value set within a single block.
|
|
146
|
-
*
|
|
168
|
+
* @param {boolean} [options.sequence] set values with `append` messages
|
|
169
|
+
* rather than `set` messages so the backing implementation employs a
|
|
170
|
+
* wrapping structure that preserves each value set within a single block.
|
|
171
|
+
* Child nodes default to inheriting this option from their parent.
|
|
147
172
|
* @returns {StorageNode}
|
|
148
173
|
*/
|
|
149
174
|
const makeChainStorageNode = zone.exoClass(
|
|
150
175
|
'ChainStorageNode',
|
|
151
176
|
ChainStorageNodeI,
|
|
152
177
|
/**
|
|
153
|
-
* @param {import('./types.js').Callback<
|
|
178
|
+
* @param {import('./types.js').Callback<
|
|
179
|
+
* (message: StorageMessage) => any
|
|
180
|
+
* >} messenger
|
|
154
181
|
* @param {string} path
|
|
155
182
|
* @param {object} [options]
|
|
156
183
|
* @param {boolean} [options.sequence]
|
|
@@ -175,7 +202,12 @@ export const prepareChainStorageNode = zone => {
|
|
|
175
202
|
args: [path],
|
|
176
203
|
});
|
|
177
204
|
},
|
|
178
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* @type {(
|
|
207
|
+
* name: string,
|
|
208
|
+
* childNodeOptions?: { sequence?: boolean },
|
|
209
|
+
* ) => StorageNode}
|
|
210
|
+
*/
|
|
179
211
|
makeChildNode(name, childNodeOptions = {}) {
|
|
180
212
|
const { sequence, path, messenger } = this.state;
|
|
181
213
|
assertPathSegment(name);
|
|
@@ -217,16 +249,17 @@ export const prepareChainStorageNode = zone => {
|
|
|
217
249
|
const makeHeapChainStorageNode = prepareChainStorageNode(makeHeapZone());
|
|
218
250
|
|
|
219
251
|
/**
|
|
220
|
-
* Create a heap-based root storage node for a given backing function and root
|
|
252
|
+
* Create a heap-based root storage node for a given backing function and root
|
|
253
|
+
* path.
|
|
221
254
|
*
|
|
222
255
|
* @param {(message: StorageMessage) => any} handleStorageMessage a function for
|
|
223
|
-
*
|
|
224
|
-
*
|
|
256
|
+
* sending a storageMessage object to the storage implementation (cf.
|
|
257
|
+
* golang/cosmos/x/vstorage/vstorage.go)
|
|
225
258
|
* @param {string} rootPath
|
|
226
259
|
* @param {object} [rootOptions]
|
|
227
260
|
* @param {boolean} [rootOptions.sequence] employ a wrapping structure that
|
|
228
|
-
*
|
|
229
|
-
*
|
|
261
|
+
* preserves each value set within a single block, and default child nodes to
|
|
262
|
+
* do the same
|
|
230
263
|
*/
|
|
231
264
|
export function makeChainStorageRoot(
|
|
232
265
|
handleStorageMessage,
|
|
@@ -241,7 +274,8 @@ export function makeChainStorageRoot(
|
|
|
241
274
|
}
|
|
242
275
|
|
|
243
276
|
/**
|
|
244
|
-
* @returns {StorageNode} an object that confirms to StorageNode API but does
|
|
277
|
+
* @returns {StorageNode} an object that confirms to StorageNode API but does
|
|
278
|
+
* not store anywhere.
|
|
245
279
|
*/
|
|
246
280
|
const makeNullStorageNode = () => {
|
|
247
281
|
// XXX re-use "ChainStorage" methods above which don't actually depend on chains
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawnSubprocessWorker.d.ts","sourceRoot":"","sources":["spawnSubprocessWorker.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"spawnSubprocessWorker.d.ts","sourceRoot":"","sources":["spawnSubprocessWorker.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;EA0DC;qBApEa,OAAO,eAAe,EAAE,MAAM;uBAC9B,OAAO,QAAQ,EAAE,QAAQ"}
|
|
@@ -18,14 +18,14 @@ function parentLog(first, ...args) {
|
|
|
18
18
|
// console.error(`--parent: ${first}`, ...args);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/** @typedef {
|
|
22
|
-
/** @typedef {
|
|
21
|
+
/** @typedef {import('child_process').IOType} IOType */
|
|
22
|
+
/** @typedef {import('stream').Writable} Writable */
|
|
23
23
|
|
|
24
24
|
// we send on fd3, and receive on fd4. We pass fd1/2 (stdout/err) through, so
|
|
25
25
|
// console log/err from the child shows up normally. We don't use Node's
|
|
26
26
|
// built-in serialization feature ('ipc') because the child process won't
|
|
27
27
|
// always be Node.
|
|
28
|
-
/** @type {
|
|
28
|
+
/** @type {IOType[]} */
|
|
29
29
|
const stdio = harden(['inherit', 'inherit', 'inherit', 'pipe', 'pipe']);
|
|
30
30
|
|
|
31
31
|
export function startSubprocessWorker(
|
|
@@ -68,13 +68,15 @@ export function startSubprocessWorker(
|
|
|
68
68
|
/* @type {typeof fromChild} */
|
|
69
69
|
const wrappedFromChild = {
|
|
70
70
|
on: (...args) =>
|
|
71
|
-
fromChild.on(
|
|
71
|
+
fromChild.on(
|
|
72
|
+
.../** @type {Parameters<(typeof fromChild)['on']>} */ (args),
|
|
73
|
+
),
|
|
72
74
|
};
|
|
73
75
|
/* @type {typeof toChild} */
|
|
74
76
|
const wrappedToChild = {
|
|
75
77
|
write: (...args) =>
|
|
76
78
|
toChild.write(
|
|
77
|
-
.../** @type {Parameters<typeof toChild['write']>} */ (args),
|
|
79
|
+
.../** @type {Parameters<(typeof toChild)['write']>} */ (args),
|
|
78
80
|
),
|
|
79
81
|
};
|
|
80
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-protocol.d.ts","sourceRoot":"","sources":["worker-protocol.js"],"names":[],"mappings":"AAMA,
|
|
1
|
+
{"version":3,"file":"worker-protocol.d.ts","sourceRoot":"","sources":["worker-protocol.js"],"names":[],"mappings":"AAMA,gDAqBC;AAED,gDAwBC;0BApDyB,QAAQ"}
|