@agoric/internal 0.3.3-dev-727e4af.0 → 0.3.3-dev-96c9ff5.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/lib-chainStorage.d.ts +6 -5
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +5 -2
- package/src/marshal.d.ts.map +1 -1
- package/src/marshal.js +1 -0
- package/src/priority-senders.d.ts +1 -1
- package/src/scratch.d.ts +1 -1
- package/src/storage-test-utils.d.ts +27 -62
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +21 -6
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-96c9ff5.0+96c9ff5",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,21 +20,21 @@
|
|
|
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.2.
|
|
26
|
-
"@endo/far": "^1.1.
|
|
27
|
-
"@endo/init": "^1.1.
|
|
28
|
-
"@endo/marshal": "^1.
|
|
29
|
-
"@endo/pass-style": "^1.
|
|
30
|
-
"@endo/patterns": "^1.
|
|
31
|
-
"@endo/promise-kit": "^1.1.
|
|
32
|
-
"@endo/stream": "^1.2.
|
|
23
|
+
"@agoric/assert": "0.6.1-dev-96c9ff5.0+96c9ff5",
|
|
24
|
+
"@agoric/base-zone": "0.1.1-dev-96c9ff5.0+96c9ff5",
|
|
25
|
+
"@endo/common": "^1.2.2",
|
|
26
|
+
"@endo/far": "^1.1.2",
|
|
27
|
+
"@endo/init": "^1.1.2",
|
|
28
|
+
"@endo/marshal": "^1.5.0",
|
|
29
|
+
"@endo/pass-style": "^1.4.0",
|
|
30
|
+
"@endo/patterns": "^1.4.0",
|
|
31
|
+
"@endo/promise-kit": "^1.1.2",
|
|
32
|
+
"@endo/stream": "^1.2.2",
|
|
33
33
|
"anylogger": "^0.21.0",
|
|
34
34
|
"jessie.js": "^0.3.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@endo/init": "^1.1.
|
|
37
|
+
"@endo/init": "^1.1.2",
|
|
38
38
|
"ava": "^5.3.0",
|
|
39
39
|
"tsd": "^0.30.7"
|
|
40
40
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"typeCoverage": {
|
|
56
|
-
"atLeast": 93.
|
|
56
|
+
"atLeast": 93.81
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "96c9ff577fe14cebeb5a38543ba7f8598ffcd0c7"
|
|
59
59
|
}
|
|
@@ -57,11 +57,11 @@ export function prepareChainStorageNode(zone: import("@agoric/base-zone").Zone):
|
|
|
57
57
|
setValue(value: string): Promise<void>;
|
|
58
58
|
}>;
|
|
59
59
|
export function makeSerializeToStorage(storageNode: ERef<StorageNode>, marshaller: ERef<{
|
|
60
|
-
toCapData: import("
|
|
61
|
-
fromCapData: import("
|
|
62
|
-
serialize: import("
|
|
63
|
-
unserialize: import("
|
|
64
|
-
}>): (value:
|
|
60
|
+
toCapData: import("@endo/marshal").ToCapData<unknown>;
|
|
61
|
+
fromCapData: import("@endo/marshal").FromCapData<unknown>;
|
|
62
|
+
serialize: import("@endo/marshal").ToCapData<unknown>;
|
|
63
|
+
unserialize: import("@endo/marshal").FromCapData<unknown>;
|
|
64
|
+
}>): (value: PassableCap) => Promise<void>;
|
|
65
65
|
export type Marshaller = ReturnType<typeof import("@endo/marshal").makeMarshal>;
|
|
66
66
|
export type Unserializer = Pick<Marshaller, "fromCapData">;
|
|
67
67
|
/**
|
|
@@ -155,4 +155,5 @@ export type StorageMessage = {
|
|
|
155
155
|
args: StorageUpdateEntriesMessageArgs;
|
|
156
156
|
};
|
|
157
157
|
import type { ERef } from '@endo/far';
|
|
158
|
+
import type { PassableCap } from '@endo/marshal';
|
|
158
159
|
//# sourceMappingURL=lib-chainStorage.d.ts.map
|
|
@@ -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":"AA0NA;;;;;;;;;;;GAWG;AACH,2DATW,CAAC,OAAO,EAAE,cAAc,KAAK,GAAG,YAGhC,MAAM;;;;IA1DX;;;OAGG;mBADa,OAAO,CAAC,WAAW,CAAC;IASpC,qFAAqF;wBAAnE,MAAM,qBAAqB;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,GAAK,WAAW;IAWjF,+CAA+C;oBAA5B,MAAM,GAAK,OAAO,CAAC,IAAI,CAAC;GAoDhD;AAUD;;;;;;;;GAQG;AACH,0FAHW,MAAM,GACJ,OAAO,CAAC,WAAW,CAAC,CAMhC;AAnMM,mCAHI,GAAG,GACD,IAAI,IAAI,UAAU,CAOa;AASrC,oCAHI,OAAO,GACL,OAAO,CAAC,IAAI,IAAI,OAAO,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAQnE;AAiBD,qCAAqC;AACrC,gCADW,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAI/B;AAwBK,8CAFI,OAAO,mBAAmB,EAAE,IAAI,uDAqBY,cAAc,KAAK,GAAG;;;;IAcvE;;;OAGG;mBADa,OAAO,CAAC,WAAW,CAAC;IASpC,qFAAqF;wBAAnE,MAAM,qBAAqB;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,GAAK,WAAW;IAWjF,+CAA+C;oBAA5B,MAAM,GAAK,OAAO,CAAC,IAAI,CAAC;GA0BhD;AA0DM;;;;;6BAF8B,OAAO,CAAC,IAAI,CAAC,CAQjD;yBAxQa,UAAU,CAAC,cAAc,eAAe,EAAE,WAAW,CAAC;2BACtD,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC;;;;;eAM/B,MAAM;iBACN,MAAM;qBACN,MAAM;;;uBAQN,CAAC;;;;iBADD,MAAM;YACN,CAAC,EAAE;;;;;;;;;;;;;;;cAaH,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;;;;aAC/B,MAAM,MAAM;;;;iBACZ,MAAM,OAAO,CAAC,WAAW,CAAC;mBAC1B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,KAAK,WAAW;;;;;;aA8ChE,MAAM,OAAO,CAAC,MAAM,CAAC;;;;iBACrB,WAAW,CAAC,aAAa,CAAC;;;;qBAC1B,MAAM,YAAY;;;;;4CAoBlB,KAAK,GAAG,aAAa,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAE,MAAM;;;;gDACzE,KAAK,GAAG,kBAAkB,GAAG,QAAQ;;;;mCACtC,6BAA6B,GAAG,iCAAiC;;;;0CAChE,CAAC,IAAI,EAAE,MAAM,CAAC;;;;2BACd,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;;;;8CACrC,YAAY,EAAE;;;;6BACf;IACZ,MAAU,EAAE,6BAA6B,CAAC;IAC1C,IAAQ,EAAE,2BAA2B,CAAC;CAClC,GAAG;IACP,MAAU,EAAE,iCAAiC,CAAC;IAC9C,IAAQ,EAAE,+BAA+B,CAAC;CACvC;0BAvHmB,WAAW;iCACJ,eAAe"}
|
package/src/lib-chainStorage.js
CHANGED
|
@@ -5,7 +5,10 @@ import { M } from '@endo/patterns';
|
|
|
5
5
|
import { makeHeapZone } from '@agoric/base-zone/heap.js';
|
|
6
6
|
import * as cb from './callback.js';
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @import {ERef} from '@endo/far';
|
|
10
|
+
* @import {PassableCap} from '@endo/marshal';
|
|
11
|
+
*/
|
|
9
12
|
|
|
10
13
|
const { Fail } = assert;
|
|
11
14
|
|
|
@@ -265,7 +268,7 @@ harden(makeStorageNodeChild);
|
|
|
265
268
|
/**
|
|
266
269
|
* @param {ERef<StorageNode>} storageNode
|
|
267
270
|
* @param {ERef<Marshaller>} marshaller
|
|
268
|
-
* @returns {(value:
|
|
271
|
+
* @returns {(value: PassableCap) => Promise<void>}
|
|
269
272
|
*/
|
|
270
273
|
export const makeSerializeToStorage = (storageNode, marshaller) => {
|
|
271
274
|
return async value => {
|
package/src/marshal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,IAAI,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,CAM7F;
|
|
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,IAAI,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,CAM7F;AA0BM,4CANI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OACnB,MAAM,eACN,UAAU,CAAC,cAAc,eAAe,EAAE,WAAW,CAAC,CAAC,aAAa,CAAC,SACrE,MAAM,GACL,GAAG,CAwBd;AASM,4CAHI,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,sBAChB,MAAM,UAAU,MAAM,KAAK,GAAG;mBAQlC,MAAM;uBAEN,MAAM;aAYN,MAAM;EAInB;;;;0BAzHY;IAAE,UAAU,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;CAAE"}
|
package/src/marshal.js
CHANGED
|
@@ -72,6 +72,7 @@ harden(assertCapData);
|
|
|
72
72
|
* @param {string} key
|
|
73
73
|
* @param {ReturnType<typeof import('@endo/marshal').makeMarshal>['fromCapData']} fromCapData
|
|
74
74
|
* @param {number} index index of the desired value in a deserialized stream cell
|
|
75
|
+
* @return {any}
|
|
75
76
|
*/
|
|
76
77
|
export const unmarshalFromVstorage = (data, key, fromCapData, index) => {
|
|
77
78
|
const serialized = data.get(key) || Fail`no data for ${key}`;
|
|
@@ -13,7 +13,7 @@ export function makePrioritySendersManager(sendersNode: ERef<import("./lib-chain
|
|
|
13
13
|
* @returns {Promise<void>}
|
|
14
14
|
*/
|
|
15
15
|
remove: (rawNamespace: string, address: string) => Promise<void>;
|
|
16
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
16
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
17
17
|
/**
|
|
18
18
|
* @param {string} rawNamespace
|
|
19
19
|
* @param {string} address
|
package/src/scratch.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export default function makeScratchPad(): {
|
|
|
6
6
|
keys: () => Promise<any[]>;
|
|
7
7
|
list: () => Promise<any[]>;
|
|
8
8
|
set: (keyP: any, objP: any) => Promise<any>;
|
|
9
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
9
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
10
10
|
delete: (keyP: any) => Promise<void>;
|
|
11
11
|
get: (keyP: any) => Promise<any>;
|
|
12
12
|
lookup: (...path: any[]) => any;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export function slotToRemotable(_slotId: string, iface?: string): import("@endo/eventual-send").RemotableBrand<{}, {}>;
|
|
1
|
+
export function slotToRemotable(_slotId: string, iface?: string): import("@endo/marshal").RemotableObject<string> & import("@endo/eventual-send").RemotableBrand<{}, {}>;
|
|
2
2
|
/**
|
|
3
3
|
* A basic marshaller whose unserializer produces Remotables. It can
|
|
4
4
|
* only serialize plain data, not Remotables.
|
|
5
5
|
*/
|
|
6
6
|
export const defaultMarshaller: {
|
|
7
|
-
toCapData: import("
|
|
8
|
-
fromCapData: import("
|
|
9
|
-
serialize: import("
|
|
10
|
-
unserialize: import("
|
|
7
|
+
toCapData: import("@endo/marshal").ToCapData<string>;
|
|
8
|
+
fromCapData: import("@endo/marshal").FromCapData<string>;
|
|
9
|
+
serialize: import("@endo/marshal").ToCapData<string>;
|
|
10
|
+
unserialize: import("@endo/marshal").FromCapData<string>;
|
|
11
11
|
};
|
|
12
12
|
export const slotStringUnserialize: (capData: any) => any;
|
|
13
13
|
export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<typeof makeChainStorageRoot>[2]): {
|
|
@@ -16,69 +16,17 @@ export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<ty
|
|
|
16
16
|
getStoreKey(): Promise<globalThis.VStorageKey>;
|
|
17
17
|
makeChildNode(name: string, childNodeOptions?: {
|
|
18
18
|
sequence?: boolean;
|
|
19
|
-
}):
|
|
19
|
+
}): StorageNode;
|
|
20
20
|
setValue(value: string): Promise<void>;
|
|
21
21
|
}>;
|
|
22
22
|
data: Map<string, string>;
|
|
23
|
-
messages:
|
|
24
|
-
toStorage: (message:
|
|
23
|
+
messages: StorageMessage[];
|
|
24
|
+
toStorage: (message: StorageMessage) => string | number | any[] | {
|
|
25
25
|
storeName: string;
|
|
26
26
|
storeSubkey: string;
|
|
27
27
|
} | null | undefined;
|
|
28
28
|
};
|
|
29
|
-
export function makeMockChainStorageRoot():
|
|
30
|
-
/**
|
|
31
|
-
* Defaults to deserializing slot references into plain Remotable
|
|
32
|
-
* objects having the specified interface name (as from `Far(iface)`),
|
|
33
|
-
* but can accept a different marshaller for producing Remotables
|
|
34
|
-
* that e.g. embed the slot string in their iface name.
|
|
35
|
-
*
|
|
36
|
-
* @param {string} path
|
|
37
|
-
* @param {import('./lib-chainStorage.js').Marshaller} marshaller
|
|
38
|
-
* @param {number} [index]
|
|
39
|
-
* @returns {unknown}
|
|
40
|
-
*/
|
|
41
|
-
getBody: (path: string, marshaller?: import("./lib-chainStorage.js").Marshaller, index?: number | undefined) => unknown;
|
|
42
|
-
keys: () => string[];
|
|
43
|
-
getPath(): string;
|
|
44
|
-
getStoreKey(): Promise<globalThis.VStorageKey>;
|
|
45
|
-
makeChildNode(name: string, childNodeOptions?: {
|
|
46
|
-
sequence?: boolean;
|
|
47
|
-
}): globalThis.StorageNode;
|
|
48
|
-
setValue(value: string): Promise<void>;
|
|
49
|
-
__getInterfaceGuard__?: (() => import("@endo/patterns").InterfaceGuard<{
|
|
50
|
-
getPath: import("@endo/patterns").MethodGuard;
|
|
51
|
-
getStoreKey: import("@endo/patterns").MethodGuard;
|
|
52
|
-
makeChildNode: import("@endo/patterns").MethodGuard;
|
|
53
|
-
setValue: import("@endo/patterns").MethodGuard;
|
|
54
|
-
}> | undefined) | undefined;
|
|
55
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
56
|
-
/**
|
|
57
|
-
* Defaults to deserializing slot references into plain Remotable
|
|
58
|
-
* objects having the specified interface name (as from `Far(iface)`),
|
|
59
|
-
* but can accept a different marshaller for producing Remotables
|
|
60
|
-
* that e.g. embed the slot string in their iface name.
|
|
61
|
-
*
|
|
62
|
-
* @param {string} path
|
|
63
|
-
* @param {import('./lib-chainStorage.js').Marshaller} marshaller
|
|
64
|
-
* @param {number} [index]
|
|
65
|
-
* @returns {unknown}
|
|
66
|
-
*/
|
|
67
|
-
getBody: (path: string, marshaller?: import("./lib-chainStorage.js").Marshaller, index?: number | undefined) => unknown;
|
|
68
|
-
keys: () => string[];
|
|
69
|
-
getPath(): string;
|
|
70
|
-
getStoreKey(): Promise<globalThis.VStorageKey>;
|
|
71
|
-
makeChildNode(name: string, childNodeOptions?: {
|
|
72
|
-
sequence?: boolean;
|
|
73
|
-
}): globalThis.StorageNode;
|
|
74
|
-
setValue(value: string): Promise<void>;
|
|
75
|
-
__getInterfaceGuard__?: (() => import("@endo/patterns").InterfaceGuard<{
|
|
76
|
-
getPath: import("@endo/patterns").MethodGuard;
|
|
77
|
-
getStoreKey: import("@endo/patterns").MethodGuard;
|
|
78
|
-
makeChildNode: import("@endo/patterns").MethodGuard;
|
|
79
|
-
setValue: import("@endo/patterns").MethodGuard;
|
|
80
|
-
}> | undefined) | undefined;
|
|
81
|
-
}>;
|
|
29
|
+
export function makeMockChainStorageRoot(): MockChainStorageRoot;
|
|
82
30
|
/**
|
|
83
31
|
* A map corresponding with a total function such that `get(key)`
|
|
84
32
|
* is assumed to always succeed.
|
|
@@ -88,6 +36,23 @@ export type TotalMap<K, V> = { [k in Exclude<keyof Map<K, V>, "get">]: Map<K, V>
|
|
|
88
36
|
};
|
|
89
37
|
export type TotalMapFrom<T> = T extends Map<infer K, infer V> ? TotalMap<K, V> : never;
|
|
90
38
|
export type FakeStorageKit = ReturnType<typeof makeFakeStorageKit>;
|
|
91
|
-
export type
|
|
39
|
+
export type MockChainStorageRootMethods = {
|
|
40
|
+
/**
|
|
41
|
+
* Defaults to deserializing slot references into plain Remotable
|
|
42
|
+
* objects having the specified interface name (as from `Far(iface)`),
|
|
43
|
+
* but can accept a different marshaller for producing Remotables
|
|
44
|
+
* that e.g. embed the slot string in their iface name.
|
|
45
|
+
*/
|
|
46
|
+
getBody: (path: string, marshaller?: {
|
|
47
|
+
toCapData: import("@endo/marshal").ToCapData<unknown>;
|
|
48
|
+
fromCapData: import("@endo/marshal").FromCapData<unknown>;
|
|
49
|
+
serialize: import("@endo/marshal").ToCapData<unknown>;
|
|
50
|
+
unserialize: import("@endo/marshal").FromCapData<unknown>;
|
|
51
|
+
} | undefined, index?: number) => unknown;
|
|
52
|
+
keys: () => string[];
|
|
53
|
+
};
|
|
54
|
+
export type MockChainStorageRoot = StorageNode & MockChainStorageRootMethods;
|
|
92
55
|
import { makeChainStorageRoot } from './lib-chainStorage.js';
|
|
56
|
+
import type { StorageNode } from './lib-chainStorage.js';
|
|
57
|
+
import type { StorageMessage } from './lib-chainStorage.js';
|
|
93
58
|
//# sourceMappingURL=storage-test-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAmCO,yCAHI,MAAM,UACN,MAAM,0GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;AA4CH,8CAtBwB,GAAG,KAAK,GAAG,CAsB8B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;uDA+FtC;YAAE,QAAQ,CAAC,UAAS;SAAC;;;UAUf,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;EAIvC;AAgBM,4CADO,oBAAoB,CAyBjC;;;;;qBAhOiF,CAAC,EAAK,CAAC,IAA5E,GAAE,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAA6C,CAAC,AAA5C,EAAiD,CAAC,AAA/C,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,CAAyB,CAAC,AAAxB,EAA6B,CAAC,AAA3B,CAAC,CAAC,CAAC,CAAC,GAAC,GAAG;IAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;CAAC;yBAI7E,CAAC,IAAD,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK;6BAsLvD,UAAU,CAAE,OAAO,kBAAkB,CAAC;;;;;;;;oBAI/B,MAAM;;;;;2BAAmC,MAAM,KAAK,OAAO;UAKlE,MAAM,MAAM,EAAE;;;qCAnNuB,uBAAuB;iCAIF,uBAAuB;oCAAvB,uBAAuB"}
|
|
@@ -6,6 +6,10 @@ import { makeTracer } from './debug.js';
|
|
|
6
6
|
import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js';
|
|
7
7
|
import { bindAllMethods } from './method-tools.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @import {Marshaller, StorageEntry, StorageMessage, StorageNode} from './lib-chainStorage.js';
|
|
11
|
+
*/
|
|
12
|
+
|
|
9
13
|
const { Fail } = assert;
|
|
10
14
|
|
|
11
15
|
const trace = makeTracer('StorTU', false);
|
|
@@ -113,9 +117,9 @@ export const makeFakeStorageKit = (rootPath, rootOptions) => {
|
|
|
113
117
|
}
|
|
114
118
|
return childEntries;
|
|
115
119
|
};
|
|
116
|
-
/** @type {
|
|
120
|
+
/** @type {StorageMessage[]} */
|
|
117
121
|
const messages = [];
|
|
118
|
-
/** @param {
|
|
122
|
+
/** @param {StorageMessage} message */
|
|
119
123
|
|
|
120
124
|
const toStorage = message => {
|
|
121
125
|
messages.push(message);
|
|
@@ -143,7 +147,7 @@ export const makeFakeStorageKit = (rootPath, rootOptions) => {
|
|
|
143
147
|
case 'set':
|
|
144
148
|
case 'setWithoutNotify': {
|
|
145
149
|
trace('toStorage set', message);
|
|
146
|
-
/** @type {
|
|
150
|
+
/** @type {StorageEntry[]} */
|
|
147
151
|
const newEntries = message.args;
|
|
148
152
|
for (const [key, value] of newEntries) {
|
|
149
153
|
if (value != null) {
|
|
@@ -156,7 +160,7 @@ export const makeFakeStorageKit = (rootPath, rootOptions) => {
|
|
|
156
160
|
}
|
|
157
161
|
case 'append': {
|
|
158
162
|
trace('toStorage append', message);
|
|
159
|
-
/** @type {
|
|
163
|
+
/** @type {StorageEntry[]} */
|
|
160
164
|
const newEntries = message.args;
|
|
161
165
|
for (const [key, value] of newEntries) {
|
|
162
166
|
value != null || Fail`attempt to append with no value`;
|
|
@@ -203,6 +207,18 @@ export const makeFakeStorageKit = (rootPath, rootOptions) => {
|
|
|
203
207
|
harden(makeFakeStorageKit);
|
|
204
208
|
/** @typedef {ReturnType< typeof makeFakeStorageKit>} FakeStorageKit */
|
|
205
209
|
|
|
210
|
+
/**
|
|
211
|
+
* @typedef MockChainStorageRootMethods
|
|
212
|
+
* @property {(path: string, marshaller?: Marshaller, index?: number) => unknown} getBody
|
|
213
|
+
* Defaults to deserializing slot references into plain Remotable
|
|
214
|
+
* objects having the specified interface name (as from `Far(iface)`),
|
|
215
|
+
* but can accept a different marshaller for producing Remotables
|
|
216
|
+
* that e.g. embed the slot string in their iface name.
|
|
217
|
+
* @property {() => string[]} keys
|
|
218
|
+
*/
|
|
219
|
+
/** @typedef {StorageNode & MockChainStorageRootMethods} MockChainStorageRoot */
|
|
220
|
+
|
|
221
|
+
/** @returns {MockChainStorageRoot} */
|
|
206
222
|
export const makeMockChainStorageRoot = () => {
|
|
207
223
|
const { rootNode, data } = makeFakeStorageKit('mockChainStorageRoot');
|
|
208
224
|
return Far('mockChainStorage', {
|
|
@@ -214,7 +230,7 @@ export const makeMockChainStorageRoot = () => {
|
|
|
214
230
|
* that e.g. embed the slot string in their iface name.
|
|
215
231
|
*
|
|
216
232
|
* @param {string} path
|
|
217
|
-
* @param {
|
|
233
|
+
* @param {Marshaller} marshaller
|
|
218
234
|
* @param {number} [index]
|
|
219
235
|
* @returns {unknown}
|
|
220
236
|
*/
|
|
@@ -228,4 +244,3 @@ export const makeMockChainStorageRoot = () => {
|
|
|
228
244
|
keys: () => [...data.keys()],
|
|
229
245
|
});
|
|
230
246
|
};
|
|
231
|
-
/** @typedef {ReturnType<typeof makeMockChainStorageRoot>} MockChainStorageRoot */
|