@agoric/internal 0.3.3-dev-581ea13.0.581ea13 → 0.3.3-dev-e208259.0.e208259
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/internal",
|
|
3
|
-
"version": "0.3.3-dev-
|
|
3
|
+
"version": "0.3.3-dev-e208259.0.e208259",
|
|
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-e208259.0.e208259",
|
|
24
24
|
"@endo/cache-map": "^1.1.0",
|
|
25
25
|
"@endo/common": "^1.2.13",
|
|
26
26
|
"@endo/compartment-mapper": "^1.6.3",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"jessie.js": "^0.3.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
41
|
+
"@agoric/cosmic-proto": "0.4.1-dev-e208259.0.e208259",
|
|
42
42
|
"@endo/exo": "^1.5.12",
|
|
43
43
|
"@endo/init": "^1.1.12",
|
|
44
44
|
"@endo/ses-ava": "^1.3.2",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"typeCoverage": {
|
|
67
67
|
"atLeast": 92.84
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "e20825970026246ddb5ae96694ba944748ee23fc"
|
|
70
70
|
}
|
|
@@ -14,7 +14,8 @@ export function wrapRemoteMarshaller<Slot = unknown>(marshaller: ERemote<Pick<EM
|
|
|
14
14
|
* either a sync or async marshaller, usually through `E` eventual-sends.
|
|
15
15
|
*/
|
|
16
16
|
export type EMarshaller<Slot = unknown> = Simplify<EOnly<Marshal<Slot>>>;
|
|
17
|
-
export type
|
|
17
|
+
export type InterfaceSpec = "Remotable" | `Alleged: ${string}`;
|
|
18
|
+
export type RemotableSlotWrapper<Slot = unknown> = SlotWrapper<Slot> & PassStyled<"remotable", InterfaceSpec>;
|
|
18
19
|
import type { ERemote } from '../types.js';
|
|
19
20
|
import type { MakeMarshalOptions } from '@endo/marshal';
|
|
20
21
|
import type { WeakMapAPI } from '@endo/cache-map';
|
|
@@ -22,12 +23,38 @@ import { Far } from '@endo/far';
|
|
|
22
23
|
import type { Marshal } from '@endo/marshal';
|
|
23
24
|
import type { EOnly } from '@endo/eventual-send';
|
|
24
25
|
import type { Simplify } from '@endo/pass-style';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* @import {WeakMapAPI} from '@endo/cache-map';
|
|
28
|
+
* @import {EOnly} from '@endo/eventual-send';
|
|
29
|
+
* @import {PassStyled, Simplify} from '@endo/pass-style';
|
|
30
|
+
* @import {CapData, Passable, Marshal, MakeMarshalOptions} from '@endo/marshal';
|
|
31
|
+
* @import {ERemote} from '../types.js';
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* A Marshaller which methods may be async. Use this type to indicate accepting
|
|
35
|
+
* either a sync or async marshaller, usually through `E` eventual-sends.
|
|
36
|
+
*
|
|
37
|
+
* @template [Slot=unknown]
|
|
38
|
+
* @typedef {Simplify<EOnly<Marshal<Slot>>>} EMarshaller
|
|
39
|
+
*/
|
|
40
|
+
/** @typedef {'Remotable' | `Alleged: ${string}`} InterfaceSpec */
|
|
41
|
+
/** @template [Slot=unknown] */
|
|
42
|
+
declare class SlotWrapper<Slot = unknown> {
|
|
43
|
+
/**
|
|
44
|
+
* @template [Slot=unknown]
|
|
45
|
+
* @param {SlotWrapper<Slot>} wrapper
|
|
46
|
+
* @returns {Slot}
|
|
47
|
+
*/
|
|
48
|
+
static getSlot<Slot_1 = unknown>(wrapper: SlotWrapper<Slot_1>): Slot_1;
|
|
49
|
+
/**
|
|
50
|
+
* @param {Slot} slot
|
|
51
|
+
* @param {string} [iface]
|
|
52
|
+
*/
|
|
53
|
+
constructor(slot: Slot, iface?: string);
|
|
28
54
|
/** @type {InterfaceSpec} */
|
|
29
|
-
[Symbol.toStringTag]:
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
[Symbol.toStringTag]: InterfaceSpec;
|
|
56
|
+
#private;
|
|
57
|
+
}
|
|
58
|
+
import type { PassStyled } from '@endo/pass-style';
|
|
32
59
|
export {};
|
|
33
60
|
//# sourceMappingURL=wrap-marshaller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-marshaller.d.ts","sourceRoot":"","sources":["wrap-marshaller.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wrap-marshaller.d.ts","sourceRoot":"","sources":["wrap-marshaller.js"],"names":[],"mappings":"AAqHO,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;;;;;wBA1Xa,IAAI,cACL,SAAS,MAAM,QAAQ,IAAI,CAAC,CAAC,CAAC;4BAG7B,WAAW,GAAG,YAAY,MAAM,EAAE;iCAyClC,IAAI,cACL,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,WAAW,EAAE,aAAa,CAAC;6BArD7C,aAAa;wCAD0B,eAAe;gCAHnD,iBAAiB;oBAN1B,WAAW;6BASkC,eAAe;2BAFxD,qBAAqB;8BACN,kBAAkB;AAHzD;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH,kEAAkE;AAElE,+BAA+B;AAC/B,0BADe,IAAI;IAsBjB;;;;OAIG;IACH,0CAHW,WAAW,CAAC,MAAI,CAAC,GACf,MAAI,CAIhB;IArBD;;;OAGG;IACH,kBAHW,IAAI,UACJ,MAAM,EAUhB;IAfD,4BAA4B;IAC5B,sBADW,aAAa,CACH;;CAwBtB;gCA7CsC,kBAAkB"}
|
|
@@ -10,7 +10,7 @@ import { makeInaccessibleVal } from './inaccessible-val.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* @import {WeakMapAPI} from '@endo/cache-map';
|
|
12
12
|
* @import {EOnly} from '@endo/eventual-send';
|
|
13
|
-
* @import {
|
|
13
|
+
* @import {PassStyled, Simplify} from '@endo/pass-style';
|
|
14
14
|
* @import {CapData, Passable, Marshal, MakeMarshalOptions} from '@endo/marshal';
|
|
15
15
|
* @import {ERemote} from '../types.js';
|
|
16
16
|
*/
|
|
@@ -23,69 +23,62 @@ import { makeInaccessibleVal } from './inaccessible-val.js';
|
|
|
23
23
|
* @typedef {Simplify<EOnly<Marshal<Slot>>>} EMarshaller
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#slot;
|
|
33
|
-
|
|
34
|
-
/** @type {InterfaceSpec} */
|
|
35
|
-
[Symbol.toStringTag];
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param {Slot} slot
|
|
39
|
-
* @param {string} [iface]
|
|
40
|
-
*/
|
|
41
|
-
constructor(slot, iface) {
|
|
42
|
-
if (iface == null || iface === 'Remotable') {
|
|
43
|
-
iface = 'Remotable';
|
|
44
|
-
} else if (!iface.startsWith('Alleged: ')) {
|
|
45
|
-
iface = `Alleged: ${iface}`;
|
|
46
|
-
}
|
|
47
|
-
this.#slot = slot;
|
|
48
|
-
this[Symbol.toStringTag] = /** @type {InterfaceSpec} */ (iface);
|
|
49
|
-
}
|
|
26
|
+
/** @typedef {'Remotable' | `Alleged: ${string}`} InterfaceSpec */
|
|
27
|
+
|
|
28
|
+
/** @template [Slot=unknown] */
|
|
29
|
+
class SlotWrapper {
|
|
30
|
+
/** @type {Slot} */
|
|
31
|
+
#slot;
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
/** @type {InterfaceSpec} */
|
|
34
|
+
[Symbol.toStringTag];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {Slot} slot
|
|
38
|
+
* @param {string} [iface]
|
|
39
|
+
*/
|
|
40
|
+
constructor(slot, iface) {
|
|
41
|
+
if (iface == null || iface === 'Remotable') {
|
|
42
|
+
iface = 'Remotable';
|
|
43
|
+
} else if (!iface.startsWith('Alleged: ')) {
|
|
44
|
+
iface = `Alleged: ${iface}`;
|
|
54
45
|
}
|
|
46
|
+
this.#slot = slot;
|
|
47
|
+
this[Symbol.toStringTag] = /** @type {InterfaceSpec} */ (iface);
|
|
55
48
|
}
|
|
56
|
-
Object.defineProperties(SlotWrapper.prototype, {
|
|
57
|
-
[PASS_STYLE]: { value: 'remotable' },
|
|
58
|
-
[Symbol.toStringTag]: { value: 'Alleged: SlotWrapper' },
|
|
59
|
-
});
|
|
60
|
-
Reflect.deleteProperty(SlotWrapper.prototype, 'constructor');
|
|
61
|
-
harden(SlotWrapper);
|
|
62
49
|
|
|
63
50
|
/**
|
|
64
|
-
* @
|
|
65
|
-
*
|
|
66
|
-
*
|
|
51
|
+
* @template [Slot=unknown]
|
|
52
|
+
* @param {SlotWrapper<Slot>} wrapper
|
|
53
|
+
* @returns {Slot}
|
|
67
54
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
})();
|
|
55
|
+
static getSlot(wrapper) {
|
|
56
|
+
return wrapper.#slot;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
Object.defineProperties(SlotWrapper.prototype, {
|
|
60
|
+
[PASS_STYLE]: { value: 'remotable' },
|
|
61
|
+
[Symbol.toStringTag]: { value: 'Alleged: SlotWrapper' },
|
|
62
|
+
});
|
|
63
|
+
Reflect.deleteProperty(SlotWrapper.prototype, 'constructor');
|
|
64
|
+
harden(SlotWrapper);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @template [Slot=unknown]
|
|
68
|
+
* @typedef {SlotWrapper<Slot> & PassStyled<'remotable', InterfaceSpec>} RemotableSlotWrapper
|
|
69
|
+
*/
|
|
84
70
|
|
|
85
71
|
/**
|
|
86
|
-
* @template [Slot=unknown]
|
|
87
|
-
*
|
|
72
|
+
* @template [Slot=unknown]
|
|
73
|
+
* @param {Slot} slot
|
|
74
|
+
* @param {string} [iface]
|
|
88
75
|
*/
|
|
76
|
+
const slotToWrapper = (slot, iface) =>
|
|
77
|
+
/** @type {RemotableSlotWrapper<Slot>} */ (
|
|
78
|
+
harden(new SlotWrapper(slot, iface))
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const wrapperToSlot = SlotWrapper.getSlot;
|
|
89
82
|
|
|
90
83
|
const capacityOfDefaultCache = 50;
|
|
91
84
|
|
|
@@ -160,7 +153,7 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
|
|
|
160
153
|
marshalOptions,
|
|
161
154
|
);
|
|
162
155
|
|
|
163
|
-
/** @type {Map<Slot,
|
|
156
|
+
/** @type {Map<Slot, RemotableSlotWrapper<NonNullable<Slot>>>} */
|
|
164
157
|
const currentSlotToWrapper = new Map();
|
|
165
158
|
|
|
166
159
|
const convertWrapperToSlot = /** @type {typeof wrapperToSlot<Slot>} */ (
|
|
@@ -200,13 +193,13 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
|
|
|
200
193
|
* marshaller to recreate the passable data.
|
|
201
194
|
*
|
|
202
195
|
* @param {Slot[]} slots
|
|
203
|
-
* @param {(index: number) =>
|
|
196
|
+
* @param {(index: number) => RemotableSlotWrapper<NonNullable<Slot>>} getWrapper
|
|
204
197
|
* @returns {Promise<(object | null)[]>}
|
|
205
198
|
*/
|
|
206
199
|
const mapSlotsToCaps = async (slots, getWrapper) => {
|
|
207
200
|
let hasRemoteCap = false;
|
|
208
201
|
const { length } = slots;
|
|
209
|
-
/** @type {(
|
|
202
|
+
/** @type {(RemotableSlotWrapper<NonNullable<Slot>> | null | undefined)[]} */
|
|
210
203
|
const slotWrapperMappedSlots = Array.from({ length });
|
|
211
204
|
/** @type {(object | null | undefined)[]} */
|
|
212
205
|
const locallyResolvedCapSlots = Array.from({ length });
|
|
@@ -304,7 +297,7 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
|
|
|
304
297
|
const remotelyResolvedSlotsCapData =
|
|
305
298
|
await E(marshaller).toCapData(remoteCapsToResolve);
|
|
306
299
|
try {
|
|
307
|
-
/** @type {(
|
|
300
|
+
/** @type {(RemotableSlotWrapper<Slot> | null | undefined)[]} */
|
|
308
301
|
const slotWrapperMappedSlots = slotWrapperMarshaller.fromCapData(
|
|
309
302
|
remotelyResolvedSlotsCapData,
|
|
310
303
|
);
|