@agoric/internal 0.3.3-other-dev-fbe72e7.0.fbe72e7 → 0.3.3-other-dev-d15096d.0.d15096d
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/README.md +1 -4
- package/package.json +7 -5
- package/src/batched-deliver.d.ts +6 -2
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +7 -2
- package/src/callback.d.ts +9 -11
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +16 -10
- package/src/config.d.ts +19 -0
- package/src/config.d.ts.map +1 -1
- package/src/config.js +21 -0
- package/src/debug.d.ts +4 -1
- package/src/debug.d.ts.map +1 -1
- package/src/debug.js +26 -13
- package/src/index.d.ts +1 -1
- package/src/index.js +9 -1
- package/src/js-utils.d.ts +6 -2
- package/src/js-utils.d.ts.map +1 -1
- package/src/js-utils.js +23 -1
- package/src/lib-chainStorage.d.ts +23 -12
- package/src/lib-chainStorage.d.ts.map +1 -1
- package/src/lib-chainStorage.js +18 -18
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts +0 -2
- package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -1
- package/src/lib-nodejs/spawnSubprocessWorker.js +5 -3
- package/src/lib-nodejs/waitUntilQuiescent.d.ts +3 -0
- package/src/lib-nodejs/waitUntilQuiescent.d.ts.map +1 -1
- package/src/lib-nodejs/waitUntilQuiescent.js +5 -1
- 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/marshal/wrap-marshaller.d.ts +33 -0
- package/src/marshal/wrap-marshaller.d.ts.map +1 -0
- package/src/marshal/wrap-marshaller.js +439 -0
- package/src/natural-sort.d.ts.map +1 -1
- package/src/natural-sort.js +47 -12
- package/src/node/buffer-line-transform.d.ts +10 -5
- package/src/node/buffer-line-transform.d.ts.map +1 -1
- package/src/node/buffer-line-transform.js +8 -4
- package/src/node/fs-stream.d.ts +4 -1
- package/src/node/fs-stream.d.ts.map +1 -1
- package/src/node/fs-stream.js +8 -6
- package/src/node/shutdown.d.ts.map +1 -1
- package/src/node/shutdown.js +2 -0
- package/src/priority-senders.d.ts +2 -1
- package/src/priority-senders.d.ts.map +1 -1
- package/src/priority-senders.js +6 -4
- package/src/ses-utils.d.ts +15 -4
- package/src/ses-utils.d.ts.map +1 -1
- package/src/ses-utils.js +112 -14
- package/src/storage-test-utils.d.ts +13 -3
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +61 -7
- package/src/typeGuards.d.ts +6 -2
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +5 -1
- package/src/types.d.ts +18 -17
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +22 -18
- package/src/work-pool.d.ts +13 -0
- package/src/work-pool.d.ts.map +1 -0
- package/src/work-pool.js +233 -0
- package/src/marshal.d.ts +0 -33
- package/src/marshal.d.ts.map +0 -1
package/src/lib-chainStorage.js
CHANGED
|
@@ -8,11 +8,14 @@ import * as cb from './callback.js';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @import {ERef} from '@endo/far';
|
|
11
|
-
* @import {
|
|
12
|
-
* @import {TypedPattern} from './types.js';
|
|
11
|
+
* @import {Marshal, Passable} from '@endo/marshal';
|
|
12
|
+
* @import {Remote, ERemote, TypedPattern} from './types.js';
|
|
13
|
+
* @import {EMarshaller} from './marshal/wrap-marshaller.js';
|
|
14
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
15
|
+
* @import {Callback} from './types.js';
|
|
13
16
|
*/
|
|
14
17
|
|
|
15
|
-
/** @typedef {
|
|
18
|
+
/** @typedef {Marshal<unknown>} Marshaller */
|
|
16
19
|
/** @typedef {Pick<Marshaller, 'fromCapData'>} Unserializer */
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -28,7 +31,8 @@ import * as cb from './callback.js';
|
|
|
28
31
|
/**
|
|
29
32
|
* @template [T=unknown]
|
|
30
33
|
* @typedef StreamCell
|
|
31
|
-
* @property {string} blockHeight
|
|
34
|
+
* @property {string} blockHeight corresponding with the write of `values`
|
|
35
|
+
* (decimal representation of a natural number)
|
|
32
36
|
* @property {T[]} values
|
|
33
37
|
*/
|
|
34
38
|
|
|
@@ -143,17 +147,15 @@ harden(assertPathSegment);
|
|
|
143
147
|
*/
|
|
144
148
|
|
|
145
149
|
/**
|
|
146
|
-
* @param {
|
|
150
|
+
* @param {Zone} zone
|
|
147
151
|
*/
|
|
148
152
|
export const prepareChainStorageNode = zone => {
|
|
149
153
|
/**
|
|
150
154
|
* Create a storage node for a given backing storage interface and path.
|
|
151
155
|
*
|
|
152
|
-
* @param {
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* a callback for sending a storageMessage object to the storage
|
|
156
|
-
* implementation (cf. golang/cosmos/x/vstorage/vstorage.go)
|
|
156
|
+
* @param {Callback<(message: StorageMessage) => any>} messenger a callback
|
|
157
|
+
* for sending a storageMessage object to the storage implementation (cf.
|
|
158
|
+
* golang/cosmos/x/vstorage/vstorage.go)
|
|
157
159
|
* @param {string} path
|
|
158
160
|
* @param {object} [options]
|
|
159
161
|
* @param {boolean} [options.sequence] set values with `append` messages
|
|
@@ -166,9 +168,7 @@ export const prepareChainStorageNode = zone => {
|
|
|
166
168
|
'ChainStorageNode',
|
|
167
169
|
ChainStorageNodeI,
|
|
168
170
|
/**
|
|
169
|
-
* @param {
|
|
170
|
-
* (message: StorageMessage) => any
|
|
171
|
-
* >} messenger
|
|
171
|
+
* @param {Callback<(message: StorageMessage) => any>} messenger
|
|
172
172
|
* @param {string} path
|
|
173
173
|
* @param {object} [options]
|
|
174
174
|
* @param {boolean} [options.sequence]
|
|
@@ -281,9 +281,9 @@ const makeNullStorageNode = () => {
|
|
|
281
281
|
* falling back to an inert object with the correct interface (but incomplete
|
|
282
282
|
* behavior) when that is unavailable.
|
|
283
283
|
*
|
|
284
|
-
* @param {ERef<StorageNode
|
|
284
|
+
* @param {ERef<Remote<StorageNode> | null>} storageNodeRef
|
|
285
285
|
* @param {string} childName
|
|
286
|
-
* @returns {Promise<StorageNode
|
|
286
|
+
* @returns {Promise<Remote<StorageNode>>}
|
|
287
287
|
*/
|
|
288
288
|
export async function makeStorageNodeChild(storageNodeRef, childName) {
|
|
289
289
|
const existingStorageNode = await storageNodeRef;
|
|
@@ -294,9 +294,9 @@ harden(makeStorageNodeChild);
|
|
|
294
294
|
|
|
295
295
|
// TODO find a better module for this
|
|
296
296
|
/**
|
|
297
|
-
* @param {
|
|
298
|
-
* @param {
|
|
299
|
-
* @returns {(value:
|
|
297
|
+
* @param {ERemote<StorageNode>} storageNode
|
|
298
|
+
* @param {ERemote<EMarshaller>} marshaller
|
|
299
|
+
* @returns {(value: Passable) => Promise<void>}
|
|
300
300
|
*/
|
|
301
301
|
export const makeSerializeToStorage = (storageNode, marshaller) => {
|
|
302
302
|
return async value => {
|
|
@@ -10,6 +10,4 @@ export function startSubprocessWorker(execPath: any, procArgs?: any[], { netstri
|
|
|
10
10
|
terminate: () => void;
|
|
11
11
|
done: Promise<any>;
|
|
12
12
|
};
|
|
13
|
-
export type IOType = import("child_process").IOType;
|
|
14
|
-
export type Writable = import("stream").Writable;
|
|
15
13
|
//# sourceMappingURL=spawnSubprocessWorker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawnSubprocessWorker.d.ts","sourceRoot":"","sources":["spawnSubprocessWorker.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spawnSubprocessWorker.d.ts","sourceRoot":"","sources":["spawnSubprocessWorker.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;EA0DC"}
|
|
@@ -8,6 +8,11 @@ import {
|
|
|
8
8
|
netstringDecoderStream,
|
|
9
9
|
} from '../netstring.js';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @import {IOType} from 'child_process'
|
|
13
|
+
* @import {Writable} from 'stream'
|
|
14
|
+
*/
|
|
15
|
+
|
|
11
16
|
// Start a subprocess from a given executable, and arrange a bidirectional
|
|
12
17
|
// message channel with a "supervisor" within that process. Return a {
|
|
13
18
|
// toChild, fromChild } pair of Streams which accept/emit hardened Arrays of
|
|
@@ -18,9 +23,6 @@ function parentLog(first, ...args) {
|
|
|
18
23
|
// console.error(`--parent: ${first}`, ...args);
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
/** @typedef {import('child_process').IOType} IOType */
|
|
22
|
-
/** @typedef {import('stream').Writable} Writable */
|
|
23
|
-
|
|
24
26
|
// we send on fd3, and receive on fd4. We pass fd1/2 (stdout/err) through, so
|
|
25
27
|
// console log/err from the child shows up normally. We don't use Node's
|
|
26
28
|
// built-in serialization feature ('ipc') because the child process won't
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitUntilQuiescent.d.ts","sourceRoot":"","sources":["waitUntilQuiescent.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"waitUntilQuiescent.d.ts","sourceRoot":"","sources":["waitUntilQuiescent.js"],"names":[],"mappings":"AAGA;;GAEG;AAKH,oDAWC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/* global setImmediate */
|
|
2
2
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {PromiseKit} from '@endo/promise-kit';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
// This can only be imported from the Start Compartment, where 'setImmediate'
|
|
5
9
|
// is available.
|
|
6
10
|
|
|
@@ -11,7 +15,7 @@ export function waitUntilQuiescent() {
|
|
|
11
15
|
// lower-priority than the Promise queue on browsers and Node 11, but on
|
|
12
16
|
// Node 10 it is higher. So this trick requires Node 11.
|
|
13
17
|
// https://jsblog.insiderattack.net/new-changes-to-timers-and-microtasks-from-node-v11-0-0-and-above-68d112743eb3
|
|
14
|
-
/** @type {
|
|
18
|
+
/** @type {PromiseKit<void>} */
|
|
15
19
|
const { promise: queueEmptyP, resolve } = makePromiseKit();
|
|
16
20
|
setImmediate(() => resolve());
|
|
17
21
|
return queueEmptyP;
|
|
@@ -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);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function wrapRemoteMarshallerSendSlotsOnly<Slot = unknown>(marshaller: ERemote<Pick<EMarshaller<Slot>, "fromCapData" | "toCapData">>, { serializeBodyFormat, errorTagging, ...otherMarshalOptions }?: MakeMarshalOptions, { valToSlot, slotToVal, cacheSeveredVal, }?: {
|
|
2
|
+
valToSlot?: WeakMapAPI<any, Slot> | null | undefined;
|
|
3
|
+
slotToVal?: WeakMapAPI<Slot, any> | null | undefined;
|
|
4
|
+
cacheSeveredVal?: boolean | undefined;
|
|
5
|
+
}): ReturnType<typeof Far<EMarshaller<Slot>>>;
|
|
6
|
+
export function wrapRemoteMarshallerDirectSend<Slot = unknown>(marshaller: ERemote<Pick<EMarshaller<Slot>, "fromCapData" | "toCapData">>): ReturnType<typeof Far<EMarshaller<Slot>>>;
|
|
7
|
+
export function wrapRemoteMarshaller<Slot = unknown>(marshaller: ERemote<Pick<EMarshaller<Slot>, "fromCapData" | "toCapData">>, { serializeBodyFormat, errorTagging, ...otherMarshalOptions }?: MakeMarshalOptions, { valToSlot, slotToVal, cacheSeveredVal, }?: {
|
|
8
|
+
valToSlot?: WeakMapAPI<any, Slot> | null | undefined;
|
|
9
|
+
slotToVal?: WeakMapAPI<Slot, any> | null | undefined;
|
|
10
|
+
cacheSeveredVal?: boolean | undefined;
|
|
11
|
+
}): ReturnType<typeof Far<EMarshaller<Slot>>>;
|
|
12
|
+
/**
|
|
13
|
+
* A Marshaller which methods may be async. Use this type to indicate accepting
|
|
14
|
+
* either a sync or async marshaller, usually through `E` eventual-sends.
|
|
15
|
+
*/
|
|
16
|
+
export type EMarshaller<Slot = unknown> = Simplify<EOnly<Marshal<Slot>>>;
|
|
17
|
+
export type SlotWrapper<Slot = unknown> = ReturnType<typeof slotToWrapper<Slot>>;
|
|
18
|
+
import type { ERemote } from '../types.js';
|
|
19
|
+
import type { MakeMarshalOptions } from '@endo/marshal';
|
|
20
|
+
import type { WeakMapAPI } from '@endo/cache-map';
|
|
21
|
+
import { Far } from '@endo/far';
|
|
22
|
+
import type { Marshal } from '@endo/marshal';
|
|
23
|
+
import type { EOnly } from '@endo/eventual-send';
|
|
24
|
+
import type { Simplify } from '@endo/pass-style';
|
|
25
|
+
declare function slotToWrapper<Slot = unknown>(slot: Slot, iface?: string): {
|
|
26
|
+
/** @type {Slot} */
|
|
27
|
+
"__#private@#slot": Slot;
|
|
28
|
+
/** @type {InterfaceSpec} */
|
|
29
|
+
[Symbol.toStringTag]: `Alleged: ${string}` | "Remotable";
|
|
30
|
+
} & RemotableObject<`Alleged: ${string}` | "Remotable">;
|
|
31
|
+
import type { RemotableObject } from '@endo/pass-style';
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=wrap-marshaller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-marshaller.d.ts","sourceRoot":"","sources":["wrap-marshaller.js"],"names":[],"mappings":"AA4HO,kDATO,IAAI,wBACP,QAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC,kEAC7D,kBAAkB,+CAE1B;IAAiD,SAAS;IACT,SAAS;IACjC,eAAe;CACxC,GAAU,UAAU,CAAC,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CA4RrD;AAOM,+CAJO,IAAI,wBACP,QAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC,GAC3D,UAAU,CAAC,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAyBrD;AAxTM,qCATO,IAAI,wBACP,QAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC,kEAC7D,kBAAkB,+CAE1B;IAAiD,SAAS;IACT,SAAS;IACjC,eAAe;CACxC,GAAU,UAAU,CAAC,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CA4RrD;;;;;wBAjYa,IAAI,cACL,SAAS,MAAM,QAAQ,IAAI,CAAC,CAAC,CAAC;wBA+D7B,IAAI,cAAoB,UAAU,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;6BAvElD,aAAa;wCAD0B,eAAe;gCAHnD,iBAAiB;oBAN1B,WAAW;6BASkC,eAAe;2BAFxD,qBAAqB;8BACD,kBAAkB;AA+D3C,+BAJD,IAAI,kBACP,IAAI,UACJ,MAAM,GAGJ;IA9Cb,mBAAmB;;IAGnB,4BAA4B;;IA2CK,mDAA8B,CAE5D;qCAlEqC,kBAAkB"}
|