@agoric/internal 0.3.3-dev-412bc11.0.412bc11 → 0.3.3-dev-f213780.0.f213780
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/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/lib-chainStorage.d.ts +4 -3
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +2 -2
- package/src/marshal/board-client-utils.d.ts +19 -0
- package/src/marshal/board-client-utils.d.ts.map +1 -0
- package/src/{marshal.js → marshal/board-client-utils.js} +27 -52
- package/src/marshal/cap-data.d.ts +3 -0
- package/src/marshal/cap-data.d.ts.map +1 -0
- package/src/marshal/cap-data.js +20 -0
- package/src/marshal/inaccessible-val.d.ts +2 -0
- package/src/marshal/inaccessible-val.d.ts.map +1 -0
- package/src/marshal/inaccessible-val.js +15 -0
- package/src/marshal/pure-data.d.ts +8 -0
- package/src/marshal/pure-data.d.ts.map +1 -0
- package/src/marshal/pure-data.js +14 -0
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +1 -1
- package/src/marshal.d.ts +0 -33
- package/src/marshal.d.ts.map +0 -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-f213780.0.f213780",
|
|
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": "yarn run -T tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
23
|
+
"@agoric/base-zone": "0.1.1-dev-f213780.0.f213780",
|
|
24
24
|
"@endo/common": "^1.2.13",
|
|
25
25
|
"@endo/compartment-mapper": "^1.6.3",
|
|
26
26
|
"@endo/errors": "^1.2.13",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"jessie.js": "^0.3.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
40
|
+
"@agoric/cosmic-proto": "0.4.1-dev-f213780.0.f213780",
|
|
41
41
|
"@endo/exo": "^1.5.12",
|
|
42
42
|
"@endo/init": "^1.1.12",
|
|
43
43
|
"@endo/ses-ava": "^1.3.2",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"typeCoverage": {
|
|
66
66
|
"atLeast": 93.22
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f21378072c99ad0d8246ccd3cf00ee24ad668a42"
|
|
69
69
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export * from "./tmpDir.js";
|
|
|
11
11
|
export * from "./typeCheck.js";
|
|
12
12
|
export * from "./typeGuards.js";
|
|
13
13
|
export * from "./types-index.js";
|
|
14
|
-
export { pureDataMarshaller } from "./marshal.js";
|
|
14
|
+
export { pureDataMarshaller } from "./marshal/pure-data.js";
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export * from './config.js';
|
|
|
15
15
|
export * from './debug.js';
|
|
16
16
|
export * from './errors.js';
|
|
17
17
|
export * from './js-utils.js';
|
|
18
|
-
export { pureDataMarshaller } from './marshal.js';
|
|
18
|
+
export { pureDataMarshaller } from './marshal/pure-data.js';
|
|
19
19
|
export * from './method-tools.js';
|
|
20
20
|
export * from './metrics.js';
|
|
21
21
|
export * from './natural-sort.js';
|
|
@@ -33,10 +33,10 @@ export function makeChainStorageRoot(handleStorageMessage: (message: StorageMess
|
|
|
33
33
|
export function makeStorageNodeChild(storageNodeRef: ERef<Remote<StorageNode> | null>, childName: string): Promise<Remote<StorageNode>>;
|
|
34
34
|
/**
|
|
35
35
|
* @import {ERef} from '@endo/far';
|
|
36
|
-
* @import {Passable} from '@endo/marshal';
|
|
36
|
+
* @import {Marshal, Passable} from '@endo/marshal';
|
|
37
37
|
* @import {Remote, ERemote, TypedPattern} from './types.js';
|
|
38
38
|
*/
|
|
39
|
-
/** @typedef {
|
|
39
|
+
/** @typedef {Marshal<unknown>} Marshaller */
|
|
40
40
|
/** @typedef {Pick<Marshaller, 'fromCapData'>} Unserializer */
|
|
41
41
|
/**
|
|
42
42
|
* Defined by vstorageStoreKey in vstorage.go
|
|
@@ -70,7 +70,7 @@ export function prepareChainStorageNode(zone: import("@agoric/base-zone").Zone):
|
|
|
70
70
|
setValue(value: string): Promise<void>;
|
|
71
71
|
}>;
|
|
72
72
|
export function makeSerializeToStorage(storageNode: ERemote<StorageNode>, marshaller: ERemote<Marshaller>): (value: Passable) => Promise<void>;
|
|
73
|
-
export type Marshaller =
|
|
73
|
+
export type Marshaller = Marshal<unknown>;
|
|
74
74
|
export type Unserializer = Pick<Marshaller, "fromCapData">;
|
|
75
75
|
/**
|
|
76
76
|
* Defined by vstorageStoreKey in vstorage.go
|
|
@@ -172,4 +172,5 @@ import type { ERef } from '@endo/far';
|
|
|
172
172
|
import type { TypedPattern } from './types.js';
|
|
173
173
|
import type { ERemote } from './types.js';
|
|
174
174
|
import type { Passable } from '@endo/marshal';
|
|
175
|
+
import type { Marshal } from '@endo/marshal';
|
|
175
176
|
//# sourceMappingURL=lib-chainStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib-chainStorage.d.ts","sourceRoot":"","sources":["lib-chainStorage.js"],"names":[],"mappings":"AAkPA;;;;;;;;;;;;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,OAA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GED
|
@@ -8,11 +8,11 @@ import * as cb from './callback.js';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @import {ERef} from '@endo/far';
|
|
11
|
-
* @import {Passable} from '@endo/marshal';
|
|
11
|
+
* @import {Marshal, Passable} from '@endo/marshal';
|
|
12
12
|
* @import {Remote, ERemote, TypedPattern} from './types.js';
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/** @typedef {
|
|
15
|
+
/** @typedef {Marshal<unknown>} Marshaller */
|
|
16
16
|
/** @typedef {Pick<Marshaller, 'fromCapData'>} Unserializer */
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function makeBoardRemote<BoardId = string | null>({ boardId, iface }: {
|
|
2
|
+
boardId: BoardId;
|
|
3
|
+
iface?: string;
|
|
4
|
+
}): BoardRemote<BoardId>;
|
|
5
|
+
export function slotToBoardRemote<BoardId = string>(boardId: BoardId, iface: string): BoardRemote<BoardId>;
|
|
6
|
+
export function boardSlottingMarshaller<BoardId = string | null>(slotToVal?: (slot: BoardId, iface: string) => any): Omit<Marshal<BoardId>, "serialize" | "unserialize">;
|
|
7
|
+
export function unmarshalFromVstorage(data: Map<string, string>, key: string, fromCapData: FromCapData<string>, index: number): any;
|
|
8
|
+
export function makeHistoryReviver(entries: [string, string][], slotToVal?: (slot: string, iface?: string) => any): {
|
|
9
|
+
getItem: (key: string) => any;
|
|
10
|
+
children: (prefix: string) => string[];
|
|
11
|
+
has: (k: string) => boolean;
|
|
12
|
+
};
|
|
13
|
+
export type BoardRemote<BoardId = string | null> = {
|
|
14
|
+
getBoardId: () => BoardId;
|
|
15
|
+
} & RemotableObject;
|
|
16
|
+
import type { Marshal } from '@endo/marshal';
|
|
17
|
+
import type { FromCapData } from '@endo/marshal';
|
|
18
|
+
import type { RemotableObject } from '@endo/pass-style';
|
|
19
|
+
//# sourceMappingURL=board-client-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-client-utils.d.ts","sourceRoot":"","sources":["board-client-utils.js"],"names":[],"mappings":"AAsBO,gCAJO,OAAO,sCACV;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAClC,WAAW,CAAC,OAAO,CAAC,CAKhC;AAOM,kCAJO,OAAO,oBACV,OAAO,SACP,MAAM,wBAGoB;AAsB9B,wCAJO,OAAO,8BACV,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,GACnC,IAAI,CAAC,QAAQ,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,CAU/D;AAYM,4CAPI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OACnB,MAAM,eACN,YAAY,MAAM,CAAC,SACnB,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;wBArHa,OAAO,oBACR;IAAE,UAAU,EAAE,MAAM,OAAO,CAAA;CAAE,GAAG,eAAe;6BALM,eAAe;iCAAf,eAAe;qCAD/C,kBAAkB"}
|
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
import { Fail } from '@endo/errors';
|
|
3
3
|
import { Far } from '@endo/far';
|
|
4
4
|
import { makeMarshal } from '@endo/marshal';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { isStreamCell } from '../lib-chainStorage.js';
|
|
6
|
+
import { assertCapData } from './cap-data.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @import {
|
|
10
|
-
* @import {
|
|
9
|
+
* @import {RemotableObject} from '@endo/pass-style';
|
|
10
|
+
* @import {CapData, FromCapData, ConvertValToSlot, Marshal} from '@endo/marshal';
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @typedef {{ getBoardId: () => string | null }} BoardRemote
|
|
14
|
+
* @template [BoardId=(string | null)]
|
|
15
|
+
* @typedef {{ getBoardId: () => BoardId } & RemotableObject} BoardRemote
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
19
|
+
* @template [BoardId=(string | null)]
|
|
20
|
+
* @param {{ boardId: BoardId; iface?: string }} slotInfo
|
|
21
|
+
* @returns {BoardRemote<BoardId>}
|
|
23
22
|
*/
|
|
24
23
|
export const makeBoardRemote = ({ boardId, iface }) => {
|
|
25
24
|
const nonalleged = iface ? iface.replace(/^Alleged: /, '') : '';
|
|
@@ -27,13 +26,17 @@ export const makeBoardRemote = ({ boardId, iface }) => {
|
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
|
-
* @
|
|
29
|
+
* @template [BoardId=string]
|
|
30
|
+
* @param {BoardId} boardId
|
|
31
31
|
* @param {string} iface
|
|
32
32
|
*/
|
|
33
33
|
export const slotToBoardRemote = (boardId, iface) =>
|
|
34
34
|
makeBoardRemote({ boardId, iface });
|
|
35
35
|
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @param {BoardRemote<any> | object} val
|
|
38
|
+
* @returns {val extends BoardRemote<infer BoardId> ? BoardId : never}
|
|
39
|
+
*/
|
|
37
40
|
const boardValToSlot = val => {
|
|
38
41
|
if ('getBoardId' in val) {
|
|
39
42
|
return val.getBoardId();
|
|
@@ -46,47 +49,26 @@ const boardValToSlot = val => {
|
|
|
46
49
|
* allows the caller to pick their slots. The deserializer is configurable: the
|
|
47
50
|
* default cannot handle Remotable-bearing data.
|
|
48
51
|
*
|
|
49
|
-
* @
|
|
50
|
-
* @
|
|
51
|
-
*
|
|
52
|
-
* 'serialize' | 'unserialize'
|
|
53
|
-
* >}
|
|
52
|
+
* @template [BoardId=(string | null)]
|
|
53
|
+
* @param {(slot: BoardId, iface: string) => any} [slotToVal]
|
|
54
|
+
* @returns {Omit<Marshal<BoardId>, 'serialize' | 'unserialize'>}
|
|
54
55
|
*/
|
|
55
56
|
export const boardSlottingMarshaller = (slotToVal = undefined) => {
|
|
56
|
-
return makeMarshal(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
*
|
|
71
|
-
* @param {unknown} data
|
|
72
|
-
* @returns {asserts data is CapData<unknown>}
|
|
73
|
-
*/
|
|
74
|
-
export const assertCapData = data => {
|
|
75
|
-
assert.typeof(data, 'object');
|
|
76
|
-
assert(data);
|
|
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}`;
|
|
57
|
+
return makeMarshal(
|
|
58
|
+
/** @type {ConvertValToSlot<BoardId>} */ (boardValToSlot),
|
|
59
|
+
slotToVal,
|
|
60
|
+
{
|
|
61
|
+
serializeBodyFormat: 'smallcaps',
|
|
62
|
+
},
|
|
63
|
+
);
|
|
79
64
|
};
|
|
80
|
-
harden(assertCapData);
|
|
81
65
|
|
|
82
66
|
/**
|
|
83
67
|
* Read and unmarshal a value from a map representation of vstorage data
|
|
84
68
|
*
|
|
85
69
|
* @param {Map<string, string>} data
|
|
86
70
|
* @param {string} key
|
|
87
|
-
* @param {
|
|
88
|
-
* typeof import('@endo/marshal').makeMarshal
|
|
89
|
-
* >['fromCapData']} fromCapData
|
|
71
|
+
* @param {FromCapData<string>} fromCapData
|
|
90
72
|
* @param {number} index index of the desired value in a deserialized stream
|
|
91
73
|
* cell
|
|
92
74
|
* @returns {any}
|
|
@@ -107,7 +89,7 @@ export const unmarshalFromVstorage = (data, key, fromCapData, index) => {
|
|
|
107
89
|
const marshalled = values.at(index);
|
|
108
90
|
assert.typeof(marshalled, 'string');
|
|
109
91
|
|
|
110
|
-
/** @type {
|
|
92
|
+
/** @type {CapData<string>} */
|
|
111
93
|
const capData = harden(JSON.parse(marshalled));
|
|
112
94
|
assertCapData(capData);
|
|
113
95
|
|
|
@@ -147,10 +129,3 @@ export const makeHistoryReviver = (entries, slotToVal = undefined) => {
|
|
|
147
129
|
|
|
148
130
|
return harden({ getItem, children, has });
|
|
149
131
|
};
|
|
150
|
-
|
|
151
|
-
/** @param {import('@endo/marshal').CapData<unknown>} cap */
|
|
152
|
-
const rejectOCap = cap => Fail`${cap} is not pure data`;
|
|
153
|
-
export const pureDataMarshaller = makeMarshal(rejectOCap, rejectOCap, {
|
|
154
|
-
serializeBodyFormat: 'smallcaps',
|
|
155
|
-
});
|
|
156
|
-
harden(pureDataMarshaller);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cap-data.d.ts","sourceRoot":"","sources":["cap-data.js"],"names":[],"mappings":"AAaO,oCAHI,OAAO,GACL,QAAQ,IAAI,IAAI,QAAQ,OAAO,CAAC,CAO5C;6BAdyB,eAAe"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { Fail } from '@endo/errors';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @import {CapData} from '@endo/marshal';
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Assert that this is CapData
|
|
10
|
+
*
|
|
11
|
+
* @param {unknown} data
|
|
12
|
+
* @returns {asserts data is CapData<unknown>}
|
|
13
|
+
*/
|
|
14
|
+
export const assertCapData = data => {
|
|
15
|
+
assert.typeof(data, 'object');
|
|
16
|
+
assert(data);
|
|
17
|
+
typeof data.body === 'string' || Fail`data has non-string .body ${data.body}`;
|
|
18
|
+
Array.isArray(data.slots) || Fail`data has non-Array slots ${data.slots}`;
|
|
19
|
+
};
|
|
20
|
+
harden(assertCapData);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inaccessible-val.d.ts","sourceRoot":"","sources":["inaccessible-val.js"],"names":[],"mappings":"AASO,2CAHI,MAAM,GAAG,SAAS,GAChB,GAAG,CAOf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { Far } from '@endo/far';
|
|
3
|
+
|
|
4
|
+
const ifaceAllegedPrefix = 'Alleged: ';
|
|
5
|
+
const ifaceInaccessiblePrefix = 'SEVERED: ';
|
|
6
|
+
/**
|
|
7
|
+
* @param {string | undefined} iface
|
|
8
|
+
* @returns {any}
|
|
9
|
+
*/
|
|
10
|
+
export const makeInaccessibleVal = iface => {
|
|
11
|
+
if (typeof iface === 'string' && iface.startsWith(ifaceAllegedPrefix)) {
|
|
12
|
+
iface = iface.slice(ifaceAllegedPrefix.length);
|
|
13
|
+
}
|
|
14
|
+
return Far(`${ifaceInaccessiblePrefix}${iface}`, {});
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const pureDataMarshaller: {
|
|
2
|
+
toCapData: import("@endo/marshal").ToCapData<CapData<unknown>>;
|
|
3
|
+
fromCapData: import("@endo/marshal").FromCapData<CapData<unknown>>;
|
|
4
|
+
serialize: import("@endo/marshal").ToCapData<CapData<unknown>>;
|
|
5
|
+
unserialize: import("@endo/marshal").FromCapData<CapData<unknown>>;
|
|
6
|
+
};
|
|
7
|
+
import type { CapData } from '@endo/marshal';
|
|
8
|
+
//# sourceMappingURL=pure-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pure-data.d.ts","sourceRoot":"","sources":["pure-data.js"],"names":[],"mappings":"AAUA;;;;;EAEG;6BAPuB,eAAe"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { Fail } from '@endo/errors';
|
|
3
|
+
import { makeMarshal } from '@endo/marshal';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @import {CapData} from '@endo/marshal';
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @param {CapData<unknown>} cap */
|
|
10
|
+
const rejectOCap = cap => Fail`${cap} is not pure data`;
|
|
11
|
+
export const pureDataMarshaller = makeMarshal(rejectOCap, rejectOCap, {
|
|
12
|
+
serializeBodyFormat: 'smallcaps',
|
|
13
|
+
});
|
|
14
|
+
harden(pureDataMarshaller);
|
|
@@ -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;;;;;oBAwFrC,CAAb;;;;UAuDkB,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,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC,iBAkDL;6BAxGa,UAAU,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;aAIrC,CACT,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,UAAU,EACvB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO;UAKD,MAAM,MAAM,EAAE;;mCAEd,WAAW,GAAG,2BAA2B;qCAhQJ,uBAAuB;iCAOU,uBAAuB;oCAAvB,uBAAuB;gCAAvB,uBAAuB"}
|
|
@@ -5,7 +5,7 @@ import { makeMarshal, Remotable } from '@endo/marshal';
|
|
|
5
5
|
import { makeTracer } from './debug.js';
|
|
6
6
|
import { NonNullish } from './errors.js';
|
|
7
7
|
import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js';
|
|
8
|
-
import { unmarshalFromVstorage } from './marshal.js';
|
|
8
|
+
import { unmarshalFromVstorage } from './marshal/board-client-utils.js';
|
|
9
9
|
import { bindAllMethods } from './method-tools.js';
|
|
10
10
|
import { eventLoopIteration } from './testing-utils.js';
|
|
11
11
|
|
package/src/marshal.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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): 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>;
|
|
12
|
-
export function unmarshalFromVstorage(data: Map<string, string>, key: string, fromCapData: ReturnType<typeof import("@endo/marshal").makeMarshal>["fromCapData"], index: number): any;
|
|
13
|
-
export function makeHistoryReviver(entries: [string, string][], slotToVal?: (slot: string, iface?: string) => any): {
|
|
14
|
-
getItem: (key: string) => any;
|
|
15
|
-
children: (prefix: string) => string[];
|
|
16
|
-
has: (k: string) => boolean;
|
|
17
|
-
};
|
|
18
|
-
export const pureDataMarshaller: {
|
|
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>>;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Should be a union with Remotable, but that's `any`, making this type
|
|
26
|
-
* meaningless
|
|
27
|
-
*/
|
|
28
|
-
export type BoardRemote = {
|
|
29
|
-
getBoardId: () => string | null;
|
|
30
|
-
};
|
|
31
|
-
import type { CapData } from '@endo/marshal';
|
|
32
|
-
import type { TypedPattern } from './types.js';
|
|
33
|
-
//# sourceMappingURL=marshal.d.ts.map
|
package/src/marshal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|