@agoric/internal 0.3.3-dev-8234e6b.0 → 0.3.3-dev-9811552.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 +4 -4
- package/src/lib-chainStorage.d.ts +25 -1
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +7 -15
- package/src/marshal.d.ts +11 -4
- package/src/marshal.d.ts.map +1 -1
- package/src/marshal.js +19 -7
- package/src/storage-test-utils.d.ts.map +1 -1
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-9811552.0+9811552",
|
|
4
4
|
"description": "Externally unsupported utilities internal to agoric-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint:types": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/base-zone": "0.1.1-dev-9811552.0+9811552",
|
|
24
24
|
"@endo/common": "^1.2.10",
|
|
25
25
|
"@endo/compartment-mapper": "^1.6.0",
|
|
26
26
|
"@endo/errors": "^1.2.10",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"jessie.js": "^0.3.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
39
|
+
"@agoric/cosmic-proto": "0.4.1-dev-9811552.0+9811552",
|
|
40
40
|
"@endo/exo": "^1.5.9",
|
|
41
41
|
"@endo/init": "^1.1.9",
|
|
42
42
|
"@fast-check/ava": "^2.0.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"typeCoverage": {
|
|
64
64
|
"atLeast": 92.65
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "9811552a271432f4b73e4435e05953e3c1c50100"
|
|
67
67
|
}
|
|
@@ -31,8 +31,31 @@ export function makeChainStorageRoot(handleStorageMessage: (message: StorageMess
|
|
|
31
31
|
* @returns {Promise<StorageNode>}
|
|
32
32
|
*/
|
|
33
33
|
export function makeStorageNodeChild(storageNodeRef: ERef<StorageNode | null>, childName: string): Promise<StorageNode>;
|
|
34
|
+
/**
|
|
35
|
+
* @import {ERef} from '@endo/far';
|
|
36
|
+
* @import {PassableCap} from '@endo/marshal';
|
|
37
|
+
* @import {TypedPattern} from './types.js';
|
|
38
|
+
*/
|
|
39
|
+
/** @typedef {ReturnType<typeof import('@endo/marshal').makeMarshal>} Marshaller */
|
|
40
|
+
/** @typedef {Pick<Marshaller, 'fromCapData'>} Unserializer */
|
|
41
|
+
/**
|
|
42
|
+
* Defined by vstorageStoreKey in vstorage.go
|
|
43
|
+
*
|
|
44
|
+
* @typedef VStorageKey
|
|
45
|
+
* @property {string} storeName
|
|
46
|
+
* @property {string} storeSubkey
|
|
47
|
+
* @property {string} dataPrefixBytes
|
|
48
|
+
* @property {string} [noDataValue]
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @template [T=unknown]
|
|
52
|
+
* @typedef StreamCell
|
|
53
|
+
* @property {string} blockHeight decimal representation of a natural number
|
|
54
|
+
* @property {T[]} values
|
|
55
|
+
*/
|
|
56
|
+
/** @type {TypedPattern<StreamCell>} */
|
|
57
|
+
export const StreamCellShape: TypedPattern<StreamCell>;
|
|
34
58
|
export function isStreamCell(cell: any): cell is StreamCell;
|
|
35
|
-
export function assertCapData(data: unknown): asserts data is import("@endo/marshal").CapData<string>;
|
|
36
59
|
/** @type {(name: string) => void} */
|
|
37
60
|
export const assertPathSegment: (name: string) => void;
|
|
38
61
|
export function prepareChainStorageNode(zone: import("@agoric/base-zone").Zone): (messenger: import("./types.js").Callback<(message: StorageMessage) => any>, path: string, args_2?: {
|
|
@@ -143,5 +166,6 @@ export type StorageMessage = {
|
|
|
143
166
|
args: StorageUpdateEntriesMessageArgs;
|
|
144
167
|
};
|
|
145
168
|
import type { ERef } from '@endo/far';
|
|
169
|
+
import type { TypedPattern } from './types.js';
|
|
146
170
|
import type { PassableCap } from '@endo/marshal';
|
|
147
171
|
//# 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":"AAiPA;;;;;;;;;;;;GAYG;AACH,2DATW,CAAC,OAAO,EAAE,cAAc,KAAK,GAAG,YAGhC,MAAM,gBAEd;IAA8B,QAAQ;CAGxC;;mBAnEqB,OAAO,CAAC,WAAW,CAAC;wBAWzB,MAAM,qBACO;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GACtC,WAAW;oBAYA,MAAM,GAAK,OAAO,CAAC,IAAI,CAAC;GAqDhD;AAcD;;;;;;;;GAQG;AACH,qDAJW,KAAK,WAAW,OAAC,CAAC,aAClB,MAAM,GACJ,OAAO,CAAC,WAAW,CAAC,CAMhC;AA3RD;;;;GAIG;AAEH,mFAAmF;AACnF,8DAA8D;AAE9D;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH,uCAAuC;AACvC,8BADW,aAAa,UAAU,CAAC,CAIhC;AAwCI,mCAHI,GAAG,GACD,IAAI,IAAI,UAAU,CAOa;AAmB5C,qCAAqC;AACrC,gCADW,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAI/B;AAyCK,8CAFI,OAAO,mBAAmB,EAAE,IAAI,uDAwBxB,cAAc,KAAK,GAAG;;;;mBAiBnB,OAAO,CAAC,WAAW,CAAC;wBAWzB,MAAM,qBACO;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAA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CADb,eAAe"}
|
package/src/lib-chainStorage.js
CHANGED
|
@@ -9,6 +9,7 @@ import * as cb from './callback.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* @import {ERef} from '@endo/far';
|
|
11
11
|
* @import {PassableCap} from '@endo/marshal';
|
|
12
|
+
* @import {TypedPattern} from './types.js';
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
/** @typedef {ReturnType<typeof import('@endo/marshal').makeMarshal>} Marshaller */
|
|
@@ -31,6 +32,12 @@ import * as cb from './callback.js';
|
|
|
31
32
|
* @property {T[]} values
|
|
32
33
|
*/
|
|
33
34
|
|
|
35
|
+
/** @type {TypedPattern<StreamCell>} */
|
|
36
|
+
export const StreamCellShape = harden({
|
|
37
|
+
blockHeight: M.string(),
|
|
38
|
+
values: M.array(),
|
|
39
|
+
});
|
|
40
|
+
|
|
34
41
|
/**
|
|
35
42
|
* This represents a node in an IAVL tree.
|
|
36
43
|
*
|
|
@@ -77,21 +84,6 @@ export const isStreamCell = cell =>
|
|
|
77
84
|
/^0$|^[1-9][0-9]*$/.test(cell.blockHeight);
|
|
78
85
|
harden(isStreamCell);
|
|
79
86
|
|
|
80
|
-
// TODO: Consolidate with `insistCapData` functions from swingset-liveslots,
|
|
81
|
-
// swingset-xsnap-supervisor, etc.
|
|
82
|
-
/**
|
|
83
|
-
* @param {unknown} data
|
|
84
|
-
* @returns {asserts data is import('@endo/marshal').CapData<string>}
|
|
85
|
-
*/
|
|
86
|
-
export const assertCapData = data => {
|
|
87
|
-
assert.typeof(data, 'object');
|
|
88
|
-
assert(data);
|
|
89
|
-
assert.typeof(data.body, 'string');
|
|
90
|
-
assert(Array.isArray(data.slots));
|
|
91
|
-
// XXX check that the .slots array elements are actually strings
|
|
92
|
-
};
|
|
93
|
-
harden(assertCapData);
|
|
94
|
-
|
|
95
87
|
/**
|
|
96
88
|
* @typedef {object} StoredFacet
|
|
97
89
|
* @property {() => Promise<string>} getPath the chain storage path at which the
|
package/src/marshal.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ export function makeBoardRemote({ boardId, iface }: {
|
|
|
4
4
|
}): BoardRemote;
|
|
5
5
|
export function slotToBoardRemote(boardId: string, iface: string): BoardRemote;
|
|
6
6
|
export function boardSlottingMarshaller(slotToVal?: (slot: string, iface: string) => any): Omit<import("@endo/marshal").Marshal<string | null>, "serialize" | "unserialize">;
|
|
7
|
+
/**
|
|
8
|
+
* @type {TypedPattern<CapData<any>>}
|
|
9
|
+
*/
|
|
10
|
+
export const CapDataShape: TypedPattern<CapData<any>>;
|
|
11
|
+
export function assertCapData(data: unknown): asserts data is CapData<unknown>;
|
|
7
12
|
export function unmarshalFromVstorage(data: Map<string, string>, key: string, fromCapData: ReturnType<typeof import("@endo/marshal").makeMarshal>["fromCapData"], index: number): any;
|
|
8
13
|
export function makeHistoryReviver(entries: [string, string][], slotToVal?: (slot: string, iface?: string) => any): {
|
|
9
14
|
getItem: (key: string) => any;
|
|
@@ -11,10 +16,10 @@ export function makeHistoryReviver(entries: [string, string][], slotToVal?: (slo
|
|
|
11
16
|
has: (k: string) => boolean;
|
|
12
17
|
};
|
|
13
18
|
export const pureDataMarshaller: {
|
|
14
|
-
toCapData: import("@endo/marshal").ToCapData<
|
|
15
|
-
fromCapData: import("@endo/marshal").FromCapData<
|
|
16
|
-
serialize: import("@endo/marshal").ToCapData<
|
|
17
|
-
unserialize: import("@endo/marshal").FromCapData<
|
|
19
|
+
toCapData: import("@endo/marshal").ToCapData<CapData<unknown>>;
|
|
20
|
+
fromCapData: import("@endo/marshal").FromCapData<CapData<unknown>>;
|
|
21
|
+
serialize: import("@endo/marshal").ToCapData<CapData<unknown>>;
|
|
22
|
+
unserialize: import("@endo/marshal").FromCapData<CapData<unknown>>;
|
|
18
23
|
};
|
|
19
24
|
/**
|
|
20
25
|
* Should be a union with Remotable, but that's `any`, making this type
|
|
@@ -23,4 +28,6 @@ export const pureDataMarshaller: {
|
|
|
23
28
|
export type BoardRemote = {
|
|
24
29
|
getBoardId: () => string | null;
|
|
25
30
|
};
|
|
31
|
+
import type { CapData } from '@endo/marshal';
|
|
32
|
+
import type { TypedPattern } from './types.js';
|
|
26
33
|
//# 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":"AAuBO,oDAHI;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC,WAAW,CAKvB;AAMM,2CAHI,MAAM,SACN,MAAM,eAGoB;AAqB9B,oDANI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,GAClC,IAAI,CAChB,OAAW,eAAe,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAClD,WAAe,GAAG,aAAa,CAC5B,CAMH;AAGD;;GAEG;AACH,2BAFU,aAAa,QAAQ,GAAG,CAAC,CAAC,CAE+B;AAS5D,oCAHI,OAAO,GACL,QAAQ,IAAI,IAAI,QAAQ,OAAO,CAAC,CAO5C;AAeM,4CATI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OACnB,MAAM,eACN,UAAU,CACpB,cAAkB,eAAe,EAAE,WAAW,CAC3C,CAAC,aAAa,CAAC,SACR,MAAM,GAEJ,GAAG,CAwBf;AASM,4CAHI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,cAClB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG;mBAQlC,MAAM;uBAEN,MAAM;aAYN,MAAM;EAInB;AAID;;;;;EAEG;;;;;0BA1IU;IAAE,UAAU,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;CAAE;6BARtB,eAAe;kCACV,YAAY"}
|
package/src/marshal.js
CHANGED
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
import { Fail } from '@endo/errors';
|
|
3
3
|
import { Far } from '@endo/far';
|
|
4
4
|
import { makeMarshal } from '@endo/marshal';
|
|
5
|
+
import { M } from '@endo/patterns';
|
|
5
6
|
import { isStreamCell } from './lib-chainStorage.js';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @import {CapData} from '@endo/marshal';
|
|
10
|
+
* @import {TypedPattern} from './types.js';
|
|
11
|
+
*/
|
|
12
|
+
|
|
7
13
|
/**
|
|
8
14
|
* Should be a union with Remotable, but that's `any`, making this type
|
|
9
15
|
* meaningless
|
|
@@ -52,18 +58,24 @@ export const boardSlottingMarshaller = (slotToVal = undefined) => {
|
|
|
52
58
|
});
|
|
53
59
|
};
|
|
54
60
|
|
|
55
|
-
// TODO
|
|
56
|
-
// swingset-xsnap-supervisor, etc.
|
|
61
|
+
// TODO move CapDataShape to Endo
|
|
57
62
|
/**
|
|
63
|
+
* @type {TypedPattern<CapData<any>>}
|
|
64
|
+
*/
|
|
65
|
+
export const CapDataShape = { body: M.string(), slots: M.array() };
|
|
66
|
+
harden(CapDataShape);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Assert that this is CapData
|
|
70
|
+
*
|
|
58
71
|
* @param {unknown} data
|
|
59
|
-
* @returns {asserts data is
|
|
72
|
+
* @returns {asserts data is CapData<unknown>}
|
|
60
73
|
*/
|
|
61
|
-
const assertCapData = data => {
|
|
74
|
+
export const assertCapData = data => {
|
|
62
75
|
assert.typeof(data, 'object');
|
|
63
76
|
assert(data);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// XXX check that the .slots array elements are actually strings
|
|
77
|
+
typeof data.body === 'string' || Fail`data has non-string .body ${data.body}`;
|
|
78
|
+
Array.isArray(data.slots) || Fail`data has non-Array slots ${data.slots}`;
|
|
67
79
|
};
|
|
68
80
|
harden(assertCapData);
|
|
69
81
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAyBO,yCAHI,MAAM,UACN,MAAM,6GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;;eAMU,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO;mBAEzB,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM;;AA8CjC,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;
|
|
1
|
+
{"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAyBO,yCAHI,MAAM,UACN,MAAM,6GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;;eAMU,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO;mBAEzB,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM;;AA8CjC,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;oBAuFhB,CAAC;;;;UAwDjB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;sBAd3B,MAAM,KACJ,MAAM,EAAE;;0BA9FP,cAAc;;;8IAAd,cAAc;;;;EAiH7B;AAoBM,4CADO,oBAAoB,CA6BjC;AAUM,yCAPI,OAAO,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,WACvC,oBAAoB,GAAG,cAAc,QACrC,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9D,CAAK;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,EAAE,CAAC,GAAG;IAChD,SAAS,CA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