@agoric/vat-data 0.5.3-other-dev-3eb1a1d.0 → 0.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/vat-data",
|
|
3
|
-
"version": "0.5.3-other-dev-
|
|
3
|
+
"version": "0.5.3-other-dev-d15096d.0.d15096d",
|
|
4
4
|
"description": "Safe access to VatData global",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/Agoric/agoric-sdk",
|
|
@@ -10,27 +10,27 @@
|
|
|
10
10
|
"test": "ava",
|
|
11
11
|
"test:xs": "exit 0",
|
|
12
12
|
"lint-fix": "yarn lint:eslint --fix",
|
|
13
|
-
"lint": "run-s --continue-on-error lint:*",
|
|
14
|
-
"lint:eslint": "eslint .",
|
|
15
|
-
"lint:types": "tsc"
|
|
13
|
+
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
14
|
+
"lint:eslint": "yarn run -T eslint .",
|
|
15
|
+
"lint:types": "yarn run -T tsc"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [],
|
|
18
18
|
"author": "Agoric",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@agoric/base-zone": "0.1.1-other-dev-
|
|
22
|
-
"@agoric/store": "0.9.3-other-dev-
|
|
23
|
-
"@agoric/swingset-liveslots": "0.10.3-other-dev-
|
|
24
|
-
"@endo/errors": "^1.2.
|
|
25
|
-
"@endo/exo": "^1.5.
|
|
26
|
-
"@endo/patterns": "^1.
|
|
21
|
+
"@agoric/base-zone": "0.1.1-other-dev-d15096d.0.d15096d",
|
|
22
|
+
"@agoric/store": "0.9.3-other-dev-d15096d.0.d15096d",
|
|
23
|
+
"@agoric/swingset-liveslots": "0.10.3-other-dev-d15096d.0.d15096d",
|
|
24
|
+
"@endo/errors": "^1.2.13",
|
|
25
|
+
"@endo/exo": "^1.5.12",
|
|
26
|
+
"@endo/patterns": "^1.7.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@endo/far": "^1.1.
|
|
30
|
-
"@endo/init": "^1.1.
|
|
31
|
-
"@endo/ses-ava": "^1.2
|
|
29
|
+
"@endo/far": "^1.1.14",
|
|
30
|
+
"@endo/init": "^1.1.12",
|
|
31
|
+
"@endo/ses-ava": "^1.3.2",
|
|
32
32
|
"ava": "^5.3.0",
|
|
33
|
-
"tsd": "^0.
|
|
33
|
+
"tsd": "^0.33.0"
|
|
34
34
|
},
|
|
35
35
|
"ava": {
|
|
36
36
|
"require": [
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
|
-
"node": "^
|
|
47
|
+
"node": "^20.9 || ^22.11"
|
|
48
48
|
},
|
|
49
49
|
"typeCoverage": {
|
|
50
50
|
"atLeast": 99.33
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "d15096dc4ff8b96e9b6cd11954c20d3a9efbb393"
|
|
53
53
|
}
|
package/src/exo-utils.js
CHANGED
|
@@ -8,6 +8,12 @@ import { provide, VatData as globalVatData } from './vat-data-bindings.js';
|
|
|
8
8
|
* @import {InterfaceGuard} from '@endo/patterns';
|
|
9
9
|
* @import {RemotableObject} from '@endo/pass-style';
|
|
10
10
|
* @import {Baggage, DefineKindOptions, DurableKindHandle, InterfaceGuardKit} from '@agoric/swingset-liveslots';
|
|
11
|
+
* @import {PlusContext} from '@agoric/swingset-liveslots';
|
|
12
|
+
* @import {VatData} from '@agoric/swingset-liveslots';
|
|
13
|
+
* @import {PrepareKind} from '@agoric/swingset-liveslots';
|
|
14
|
+
* @import {PrepareKindMulti} from '@agoric/swingset-liveslots';
|
|
15
|
+
* @import {Guarded} from '@endo/exo';
|
|
16
|
+
* @import {GuardedKit} from '@endo/exo';
|
|
11
17
|
*/
|
|
12
18
|
|
|
13
19
|
// Some feedback if the init function is async
|
|
@@ -25,7 +31,7 @@ import { provide, VatData as globalVatData } from './vat-data-bindings.js';
|
|
|
25
31
|
*
|
|
26
32
|
* @type {<T extends (...args: any) => any>(
|
|
27
33
|
* fn: T,
|
|
28
|
-
* ) =>
|
|
34
|
+
* ) => PlusContext<never, T>}
|
|
29
35
|
*/
|
|
30
36
|
export const ignoreContext =
|
|
31
37
|
fn =>
|
|
@@ -34,7 +40,7 @@ export const ignoreContext =
|
|
|
34
40
|
harden(ignoreContext);
|
|
35
41
|
|
|
36
42
|
// TODO: Find a good home for this function used by @agoric/vat-data and testing code
|
|
37
|
-
/** @param {
|
|
43
|
+
/** @param {VatData} VatData */
|
|
38
44
|
export const makeExoUtils = VatData => {
|
|
39
45
|
const {
|
|
40
46
|
defineKind,
|
|
@@ -56,7 +62,7 @@ export const makeExoUtils = VatData => {
|
|
|
56
62
|
|
|
57
63
|
/**
|
|
58
64
|
* @deprecated Use prepareExoClass instead
|
|
59
|
-
* @type {
|
|
65
|
+
* @type {PrepareKind}
|
|
60
66
|
*/
|
|
61
67
|
const prepareKind = (
|
|
62
68
|
baggage,
|
|
@@ -75,7 +81,7 @@ export const makeExoUtils = VatData => {
|
|
|
75
81
|
|
|
76
82
|
/**
|
|
77
83
|
* @deprecated Use prepareExoClassKit instead
|
|
78
|
-
* @type {
|
|
84
|
+
* @type {PrepareKindMulti}
|
|
79
85
|
*/
|
|
80
86
|
const prepareKindMulti = (
|
|
81
87
|
baggage,
|
|
@@ -107,7 +113,7 @@ export const makeExoUtils = VatData => {
|
|
|
107
113
|
* self: T;
|
|
108
114
|
* state: StateResult<I>;
|
|
109
115
|
* }>} [options]
|
|
110
|
-
* @returns {(...args: Parameters<I>) =>
|
|
116
|
+
* @returns {(...args: Parameters<I>) => Guarded<T>}
|
|
111
117
|
*/
|
|
112
118
|
const defineVirtualExoClass = (tag, interfaceGuard, init, methods, options) =>
|
|
113
119
|
// @ts-expect-error cast
|
|
@@ -126,14 +132,14 @@ export const makeExoUtils = VatData => {
|
|
|
126
132
|
* @param {I} init
|
|
127
133
|
* @param {T &
|
|
128
134
|
* ThisType<{
|
|
129
|
-
* facets:
|
|
135
|
+
* facets: GuardedKit<T>;
|
|
130
136
|
* state: StateResult<I>;
|
|
131
137
|
* }>} facets
|
|
132
138
|
* @param {DefineKindOptions<{
|
|
133
139
|
* facets: T;
|
|
134
140
|
* state: StateResult<I>;
|
|
135
141
|
* }>} [options]
|
|
136
|
-
* @returns {(...args: Parameters<I>) =>
|
|
142
|
+
* @returns {(...args: Parameters<I>) => GuardedKit<T>}
|
|
137
143
|
*/
|
|
138
144
|
const defineVirtualExoClassKit = (
|
|
139
145
|
tag,
|
|
@@ -165,7 +171,7 @@ export const makeExoUtils = VatData => {
|
|
|
165
171
|
* self: T;
|
|
166
172
|
* state: StateResult<I>;
|
|
167
173
|
* }>} [options]
|
|
168
|
-
* @returns {(...args: Parameters<I>) =>
|
|
174
|
+
* @returns {(...args: Parameters<I>) => Guarded<T>}
|
|
169
175
|
*/
|
|
170
176
|
const defineDurableExoClass = (
|
|
171
177
|
kindHandle,
|
|
@@ -190,14 +196,14 @@ export const makeExoUtils = VatData => {
|
|
|
190
196
|
* @param {I} init
|
|
191
197
|
* @param {T &
|
|
192
198
|
* ThisType<{
|
|
193
|
-
* facets:
|
|
199
|
+
* facets: GuardedKit<T>;
|
|
194
200
|
* state: StateResult<I>;
|
|
195
201
|
* }>} facets
|
|
196
202
|
* @param {DefineKindOptions<{
|
|
197
203
|
* facets: T;
|
|
198
204
|
* state: StateResult<I>;
|
|
199
205
|
* }>} [options]
|
|
200
|
-
* @returns {(...args: Parameters<I>) =>
|
|
206
|
+
* @returns {(...args: Parameters<I>) => GuardedKit<T>}
|
|
201
207
|
*/
|
|
202
208
|
const defineDurableExoClassKit = (
|
|
203
209
|
kindHandle,
|
|
@@ -230,7 +236,7 @@ export const makeExoUtils = VatData => {
|
|
|
230
236
|
* self: T;
|
|
231
237
|
* state: StateResult<I>;
|
|
232
238
|
* }>} [options]
|
|
233
|
-
* @returns {(...args: Parameters<I>) =>
|
|
239
|
+
* @returns {(...args: Parameters<I>) => Guarded<T>}
|
|
234
240
|
*/
|
|
235
241
|
const prepareExoClass = (
|
|
236
242
|
baggage,
|
|
@@ -258,14 +264,14 @@ export const makeExoUtils = VatData => {
|
|
|
258
264
|
* @param {I} init
|
|
259
265
|
* @param {T &
|
|
260
266
|
* ThisType<{
|
|
261
|
-
* facets:
|
|
267
|
+
* facets: GuardedKit<T>;
|
|
262
268
|
* state: StateResult<I>;
|
|
263
269
|
* }>} facets
|
|
264
270
|
* @param {DefineKindOptions<{
|
|
265
271
|
* facets: T;
|
|
266
272
|
* state: StateResult<I>;
|
|
267
273
|
* }>} [options]
|
|
268
|
-
* @returns {(...args: Parameters<I>) =>
|
|
274
|
+
* @returns {(...args: Parameters<I>) => GuardedKit<T>}
|
|
269
275
|
*/
|
|
270
276
|
const prepareExoClassKit = (
|
|
271
277
|
baggage,
|
|
@@ -294,7 +300,7 @@ export const makeExoUtils = VatData => {
|
|
|
294
300
|
* self: RemotableObject & M;
|
|
295
301
|
* }>} methods
|
|
296
302
|
* @param {DefineKindOptions<{ self: M }>} [options]
|
|
297
|
-
* @returns {
|
|
303
|
+
* @returns {Guarded<M>}
|
|
298
304
|
*/
|
|
299
305
|
const prepareExo = (
|
|
300
306
|
baggage,
|
|
@@ -323,7 +329,7 @@ export const makeExoUtils = VatData => {
|
|
|
323
329
|
* @param {string} kindName
|
|
324
330
|
* @param {M} methods
|
|
325
331
|
* @param {DefineKindOptions<{ self: M }>} [options]
|
|
326
|
-
* @returns {
|
|
332
|
+
* @returns {Guarded<M>}
|
|
327
333
|
*/
|
|
328
334
|
const prepareSingleton = (baggage, kindName, methods, options = undefined) =>
|
|
329
335
|
prepareExo(baggage, kindName, undefined, methods, options);
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// @jessie-check
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @import {DefineKindOptions} from '@agoric/swingset-liveslots';
|
|
5
|
+
* @import {MapStore} from '@agoric/swingset-liveslots';
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
/// <reference types="ses" />
|
|
4
9
|
export {
|
|
5
10
|
M,
|
|
@@ -44,9 +49,7 @@ export {
|
|
|
44
49
|
|
|
45
50
|
// TODO re-export these
|
|
46
51
|
/**
|
|
47
|
-
* @template T @typedef
|
|
48
|
-
* {import('@agoric/swingset-liveslots').DefineKindOptions<T>}
|
|
49
|
-
* DefineKindOptions
|
|
52
|
+
* @template T @typedef {DefineKindOptions<T>} DefineKindOptions
|
|
50
53
|
*/
|
|
51
54
|
// Copy this type because aliasing it by `import('@agoric/swingset-liveslots').Baggage`
|
|
52
55
|
// causes this error in typedoc: Expected a symbol for node with kind Identifier
|
|
@@ -8,6 +8,10 @@ import {
|
|
|
8
8
|
defineVirtualExoClassKit,
|
|
9
9
|
} from '../src/exo-utils.js';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @import {Amplify} from '@endo/exo';
|
|
13
|
+
*/
|
|
14
|
+
|
|
11
15
|
const UpCounterI = M.interface('UpCounter', {
|
|
12
16
|
incr: M.call().optional(M.gte(0)).returns(M.number()),
|
|
13
17
|
});
|
|
@@ -43,7 +47,7 @@ test('test amplify defineVirtualExoClass fails', t => {
|
|
|
43
47
|
});
|
|
44
48
|
|
|
45
49
|
test('test amplify defineVirtualExoClassKit', t => {
|
|
46
|
-
/** @type {
|
|
50
|
+
/** @type {Amplify} */
|
|
47
51
|
let amp;
|
|
48
52
|
const makeCounterKit = defineVirtualExoClassKit(
|
|
49
53
|
'Counter',
|
|
@@ -9,6 +9,10 @@ import {
|
|
|
9
9
|
defineVirtualExoClassKit,
|
|
10
10
|
} from '../src/exo-utils.js';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @import {IsInstance} from '@endo/exo';
|
|
14
|
+
*/
|
|
15
|
+
|
|
12
16
|
const UpCounterI = M.interface('UpCounter', {
|
|
13
17
|
incr: M.call().optional(M.gte(0)).returns(M.number()),
|
|
14
18
|
});
|
|
@@ -18,7 +22,7 @@ const DownCounterI = M.interface('DownCounter', {
|
|
|
18
22
|
});
|
|
19
23
|
|
|
20
24
|
test('test isInstance defineVirtualExoClass', t => {
|
|
21
|
-
/** @type {
|
|
25
|
+
/** @type {IsInstance} */
|
|
22
26
|
let isInstance;
|
|
23
27
|
const makeUpCounter = defineVirtualExoClass(
|
|
24
28
|
'UpCounter',
|
|
@@ -59,7 +63,7 @@ test('test isInstance defineVirtualExoClass', t => {
|
|
|
59
63
|
});
|
|
60
64
|
|
|
61
65
|
test('test isInstance defineVirtualExoClassKit', t => {
|
|
62
|
-
/** @type {
|
|
66
|
+
/** @type {IsInstance} */
|
|
63
67
|
let isInstance;
|
|
64
68
|
const makeCounterKit = defineVirtualExoClassKit(
|
|
65
69
|
'Counter',
|