@agoric/vat-data 0.5.3-u16.1 → 0.5.3-u17.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/CHANGELOG.md +1 -9
- package/package.json +12 -13
- package/src/exo-utils.js +48 -40
- package/src/index.js +5 -1
- package/src/vat-data-bindings.js +29 -25
package/CHANGELOG.md
CHANGED
|
@@ -3,15 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [0.5.3-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @agoric/vat-data
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### [0.5.3-u16.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/vat-data@0.5.2...@agoric/vat-data@0.5.3-u16.0) (2024-07-02)
|
|
6
|
+
### [0.5.3-u17.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/vat-data@0.5.2...@agoric/vat-data@0.5.3-u17.0) (2024-09-17)
|
|
15
7
|
|
|
16
8
|
|
|
17
9
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/vat-data",
|
|
3
|
-
"version": "0.5.3-
|
|
3
|
+
"version": "0.5.3-u17.0",
|
|
4
4
|
"description": "Safe access to VatData global",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/Agoric/agoric-sdk",
|
|
@@ -19,20 +19,19 @@
|
|
|
19
19
|
"author": "Agoric",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@agoric/
|
|
23
|
-
"@agoric/
|
|
24
|
-
"@agoric/
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@endo/
|
|
28
|
-
"@endo/patterns": "^1.4.0"
|
|
22
|
+
"@agoric/base-zone": "^0.1.1-u17.0",
|
|
23
|
+
"@agoric/store": "^0.9.3-u17.0",
|
|
24
|
+
"@agoric/swingset-liveslots": "^0.10.3-u17.0",
|
|
25
|
+
"@endo/errors": "^1.2.5",
|
|
26
|
+
"@endo/exo": "^1.5.3",
|
|
27
|
+
"@endo/patterns": "^1.4.3"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@endo/far": "^1.1.
|
|
32
|
-
"@endo/init": "^1.1.
|
|
33
|
-
"@endo/ses-ava": "^1.2.
|
|
30
|
+
"@endo/far": "^1.1.5",
|
|
31
|
+
"@endo/init": "^1.1.4",
|
|
32
|
+
"@endo/ses-ava": "^1.2.5",
|
|
34
33
|
"ava": "^5.3.0",
|
|
35
|
-
"tsd": "^0.
|
|
34
|
+
"tsd": "^0.31.1"
|
|
36
35
|
},
|
|
37
36
|
"ava": {
|
|
38
37
|
"require": [
|
|
@@ -51,5 +50,5 @@
|
|
|
51
50
|
"typeCoverage": {
|
|
52
51
|
"atLeast": 99.33
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "515c4c0efccfc91b97da30037c10fc4b076851e2"
|
|
55
54
|
}
|
package/src/exo-utils.js
CHANGED
|
@@ -20,10 +20,12 @@ import { provide, VatData as globalVatData } from './vat-data-bindings.js';
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Make a version of the argument function that takes a kind context but
|
|
24
|
-
*
|
|
23
|
+
* Make a version of the argument function that takes a kind context but ignores
|
|
24
|
+
* it.
|
|
25
25
|
*
|
|
26
|
-
* @type {<T extends (...args: any) => any>(
|
|
26
|
+
* @type {<T extends (...args: any) => any>(
|
|
27
|
+
* fn: T,
|
|
28
|
+
* ) => import('@agoric/swingset-liveslots').PlusContext<never, T>}
|
|
27
29
|
*/
|
|
28
30
|
export const ignoreContext =
|
|
29
31
|
fn =>
|
|
@@ -96,13 +98,14 @@ export const makeExoUtils = VatData => {
|
|
|
96
98
|
* @param {string} tag
|
|
97
99
|
* @param {InterfaceGuard | undefined} interfaceGuard
|
|
98
100
|
* @param {I} init
|
|
99
|
-
* @param {T &
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
101
|
+
* @param {T &
|
|
102
|
+
* ThisType<{
|
|
103
|
+
* self: T;
|
|
104
|
+
* state: StateResult<I>;
|
|
105
|
+
* }>} methods
|
|
103
106
|
* @param {DefineKindOptions<{
|
|
104
|
-
* self: T
|
|
105
|
-
* state: StateResult<I
|
|
107
|
+
* self: T;
|
|
108
|
+
* state: StateResult<I>;
|
|
106
109
|
* }>} [options]
|
|
107
110
|
* @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>}
|
|
108
111
|
*/
|
|
@@ -121,13 +124,14 @@ export const makeExoUtils = VatData => {
|
|
|
121
124
|
* @param {string} tag
|
|
122
125
|
* @param {InterfaceGuardKit | undefined} interfaceGuardKit
|
|
123
126
|
* @param {I} init
|
|
124
|
-
* @param {T &
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
127
|
+
* @param {T &
|
|
128
|
+
* ThisType<{
|
|
129
|
+
* facets: import('@endo/exo').GuardedKit<T>;
|
|
130
|
+
* state: StateResult<I>;
|
|
131
|
+
* }>} facets
|
|
128
132
|
* @param {DefineKindOptions<{
|
|
129
|
-
* facets: T
|
|
130
|
-
* state: StateResult<I
|
|
133
|
+
* facets: T;
|
|
134
|
+
* state: StateResult<I>;
|
|
131
135
|
* }>} [options]
|
|
132
136
|
* @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>}
|
|
133
137
|
*/
|
|
@@ -152,13 +156,14 @@ export const makeExoUtils = VatData => {
|
|
|
152
156
|
* @param {DurableKindHandle} kindHandle
|
|
153
157
|
* @param {InterfaceGuard | undefined} interfaceGuard
|
|
154
158
|
* @param {I} init
|
|
155
|
-
* @param {T &
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
+
* @param {T &
|
|
160
|
+
* ThisType<{
|
|
161
|
+
* self: T;
|
|
162
|
+
* state: StateResult<I>;
|
|
163
|
+
* }>} methods
|
|
159
164
|
* @param {DefineKindOptions<{
|
|
160
|
-
* self: T
|
|
161
|
-
* state: StateResult<I
|
|
165
|
+
* self: T;
|
|
166
|
+
* state: StateResult<I>;
|
|
162
167
|
* }>} [options]
|
|
163
168
|
* @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>}
|
|
164
169
|
*/
|
|
@@ -183,13 +188,14 @@ export const makeExoUtils = VatData => {
|
|
|
183
188
|
* @param {DurableKindHandle} kindHandle
|
|
184
189
|
* @param {InterfaceGuardKit | undefined} interfaceGuardKit
|
|
185
190
|
* @param {I} init
|
|
186
|
-
* @param {T &
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
191
|
+
* @param {T &
|
|
192
|
+
* ThisType<{
|
|
193
|
+
* facets: import('@endo/exo').GuardedKit<T>;
|
|
194
|
+
* state: StateResult<I>;
|
|
195
|
+
* }>} facets
|
|
190
196
|
* @param {DefineKindOptions<{
|
|
191
|
-
* facets: T
|
|
192
|
-
* state: StateResult<I
|
|
197
|
+
* facets: T;
|
|
198
|
+
* state: StateResult<I>;
|
|
193
199
|
* }>} [options]
|
|
194
200
|
* @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>}
|
|
195
201
|
*/
|
|
@@ -215,13 +221,14 @@ export const makeExoUtils = VatData => {
|
|
|
215
221
|
* @param {string} kindName
|
|
216
222
|
* @param {InterfaceGuard | undefined} interfaceGuard
|
|
217
223
|
* @param {I} init
|
|
218
|
-
* @param {T &
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
224
|
+
* @param {T &
|
|
225
|
+
* ThisType<{
|
|
226
|
+
* self: RemotableObject & T;
|
|
227
|
+
* state: StateResult<I>;
|
|
228
|
+
* }>} methods
|
|
222
229
|
* @param {DefineKindOptions<{
|
|
223
|
-
* self: T
|
|
224
|
-
* state: StateResult<I
|
|
230
|
+
* self: T;
|
|
231
|
+
* state: StateResult<I>;
|
|
225
232
|
* }>} [options]
|
|
226
233
|
* @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>}
|
|
227
234
|
*/
|
|
@@ -249,13 +256,14 @@ export const makeExoUtils = VatData => {
|
|
|
249
256
|
* @param {string} kindName
|
|
250
257
|
* @param {InterfaceGuardKit | undefined} interfaceGuardKit
|
|
251
258
|
* @param {I} init
|
|
252
|
-
* @param {T &
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
259
|
+
* @param {T &
|
|
260
|
+
* ThisType<{
|
|
261
|
+
* facets: import('@endo/exo').GuardedKit<T>;
|
|
262
|
+
* state: StateResult<I>;
|
|
263
|
+
* }>} facets
|
|
256
264
|
* @param {DefineKindOptions<{
|
|
257
|
-
* facets: T
|
|
258
|
-
* state: StateResult<I
|
|
265
|
+
* facets: T;
|
|
266
|
+
* state: StateResult<I>;
|
|
259
267
|
* }>} [options]
|
|
260
268
|
* @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>}
|
|
261
269
|
*/
|
|
@@ -306,8 +314,8 @@ export const makeExoUtils = VatData => {
|
|
|
306
314
|
harden(prepareExo);
|
|
307
315
|
|
|
308
316
|
/**
|
|
309
|
-
* @template {Record<PropertyKey, CallableFunction>} M methods
|
|
310
317
|
* @deprecated Use prepareExo instead.
|
|
318
|
+
* @template {Record<PropertyKey, CallableFunction>} M methods
|
|
311
319
|
* @param {Baggage} baggage
|
|
312
320
|
* @param {string} kindName
|
|
313
321
|
* @param {M} methods
|
package/src/index.js
CHANGED
|
@@ -43,7 +43,11 @@ export {
|
|
|
43
43
|
} from './exo-utils.js';
|
|
44
44
|
|
|
45
45
|
// TODO re-export these
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* @template T @typedef
|
|
48
|
+
* {import('@agoric/swingset-liveslots').DefineKindOptions<T>}
|
|
49
|
+
* DefineKindOptions
|
|
50
|
+
*/
|
|
47
51
|
// Copy this type because aliasing it by `import('@agoric/swingset-liveslots').Baggage`
|
|
48
52
|
// causes this error in typedoc: Expected a symbol for node with kind Identifier
|
|
49
53
|
/** @typedef {MapStore<string, any>} Baggage */
|
package/src/vat-data-bindings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* global globalThis */
|
|
2
2
|
|
|
3
|
-
import { Fail } from '@
|
|
3
|
+
import { Fail } from '@endo/errors';
|
|
4
4
|
import { provideLazy } from '@agoric/store';
|
|
5
5
|
|
|
6
6
|
/** @import {Baggage, PickFacet, VatData} from '@agoric/swingset-liveslots' */
|
|
@@ -57,7 +57,8 @@ export const {
|
|
|
57
57
|
} = VatDataGlobal;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* When making a multi-facet kind, it's common to pick one facet to expose.
|
|
60
|
+
* When making a multi-facet kind, it's common to pick one facet to expose.
|
|
61
|
+
* E.g.,
|
|
61
62
|
*
|
|
62
63
|
* const makeFoo = (a, b, c, d) => makeFooBase(a, b, c, d).self;
|
|
63
64
|
*
|
|
@@ -89,36 +90,39 @@ harden(partialAssign);
|
|
|
89
90
|
/** @import {StoreOptions} from '@agoric/store' */
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
|
-
* Unlike `provideLazy`, `provide` should be called at most once
|
|
93
|
-
*
|
|
93
|
+
* Unlike `provideLazy`, `provide` should be called at most once within any vat
|
|
94
|
+
* incarnation with a given `baggage`,`key` pair.
|
|
94
95
|
*
|
|
95
|
-
* `provide` should only
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* our expected durability patterns: What we store in baggage are
|
|
102
|
-
* * kindHandles, which are per kind, which must be low cardinality
|
|
103
|
-
* * data "variables" for reestablishing the lexical scope, especially
|
|
104
|
-
* of singletons
|
|
105
|
-
* * named non-baggage collections at the leaves of the baggage tree.
|
|
96
|
+
* `provide` should only be used to populate baggage, where the total number of
|
|
97
|
+
* calls to `provide` must be low cardinality, since we keep the bookkeeping to
|
|
98
|
+
* detect collisions in normal language-heap memory. All the other
|
|
99
|
+
* baggage-oriented `provide*` and `prepare*` functions call `provide`, and so
|
|
100
|
+
* impose the same constraints. This is consistent with our expected durability
|
|
101
|
+
* patterns: What we store in baggage are
|
|
106
102
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
103
|
+
* - kindHandles, which are per kind, which must be low cardinality
|
|
104
|
+
* - data "variables" for reestablishing the lexical scope, especially of
|
|
105
|
+
* singletons
|
|
106
|
+
* - named non-baggage collections at the leaves of the baggage tree.
|
|
109
107
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
108
|
+
* What is expected to be high cardinality are the instances of the kinds, and
|
|
109
|
+
* the members of the non-bagggage collections.
|
|
110
|
+
*
|
|
111
|
+
* TODO https://github.com/Agoric/agoric-sdk/pull/5875 : Implement
|
|
112
|
+
* development-time instrumentation to detect when `provide` violates the above
|
|
113
|
+
* prescription, and is called more than once in the same vat incarnation with
|
|
114
|
+
* the same baggage,key pair.
|
|
115
115
|
*/
|
|
116
116
|
|
|
117
117
|
export const provide =
|
|
118
118
|
// XXX cast because provideLazy is `any` due to broken type import
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
/**
|
|
120
|
+
* @type {<K, V>(
|
|
121
|
+
* baggage: Baggage,
|
|
122
|
+
* key: K,
|
|
123
|
+
* makeValue: (key: K) => V,
|
|
124
|
+
* ) => V}
|
|
125
|
+
*/ (provideLazy);
|
|
122
126
|
|
|
123
127
|
// TODO: Find a good home for this function used by @agoric/vat-data and testing code
|
|
124
128
|
/** @param {VatData} VatData */
|