@agoric/vat-data 0.5.3-dev-bb3d92f.0 → 0.5.3-dev-22cbfe3.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.
Files changed (2) hide show
  1. package/package.json +7 -7
  2. package/src/exo-utils.js +27 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vat-data",
3
- "version": "0.5.3-dev-bb3d92f.0+bb3d92f",
3
+ "version": "0.5.3-dev-22cbfe3.0+22cbfe3",
4
4
  "description": "Safe access to VatData global",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/Agoric/agoric-sdk",
@@ -19,11 +19,11 @@
19
19
  "author": "Agoric",
20
20
  "license": "Apache-2.0",
21
21
  "dependencies": {
22
- "@agoric/assert": "0.6.1-dev-bb3d92f.0+bb3d92f",
23
- "@agoric/base-zone": "0.1.1-dev-bb3d92f.0+bb3d92f",
24
- "@agoric/store": "0.9.3-dev-bb3d92f.0+bb3d92f",
25
- "@agoric/swingset-liveslots": "0.10.3-dev-bb3d92f.0+bb3d92f",
26
- "@agoric/vow": "0.1.1-dev-bb3d92f.0+bb3d92f",
22
+ "@agoric/assert": "0.6.1-dev-22cbfe3.0+22cbfe3",
23
+ "@agoric/base-zone": "0.1.1-dev-22cbfe3.0+22cbfe3",
24
+ "@agoric/store": "0.9.3-dev-22cbfe3.0+22cbfe3",
25
+ "@agoric/swingset-liveslots": "0.10.3-dev-22cbfe3.0+22cbfe3",
26
+ "@agoric/vow": "0.1.1-dev-22cbfe3.0+22cbfe3",
27
27
  "@endo/exo": "^1.5.0",
28
28
  "@endo/patterns": "^1.4.0"
29
29
  },
@@ -51,5 +51,5 @@
51
51
  "typeCoverage": {
52
52
  "atLeast": 99.33
53
53
  },
54
- "gitHead": "bb3d92fdf0763723117190b29ed1a2e44389e771"
54
+ "gitHead": "22cbfe3672f7878718fd90c35c760ee67c2d08a0"
55
55
  }
package/src/exo-utils.js CHANGED
@@ -10,6 +10,15 @@ import { provide, VatData as globalVatData } from './vat-data-bindings.js';
10
10
  * @import {Baggage, DefineKindOptions, DurableKindHandle, InterfaceGuardKit} from '@agoric/swingset-liveslots';
11
11
  */
12
12
 
13
+ // Some feedback if the init function is async
14
+ /**
15
+ * @typedef {(...args: any[]) => any} InitState
16
+ */
17
+ /**
18
+ * @template {InitState} I
19
+ * @typedef {ReturnType<I> extends Promise<any> ? never : ReturnType<I>} StateResult
20
+ */
21
+
13
22
  /**
14
23
  * Make a version of the argument function that takes a kind context but
15
24
  * ignores it.
@@ -82,18 +91,18 @@ export const makeExoUtils = VatData => {
82
91
  harden(prepareKindMulti);
83
92
 
84
93
  /**
85
- * @template {(...args: any) => any} I init state function
94
+ * @template {InitState} I init state function
86
95
  * @template T behavior
87
96
  * @param {string} tag
88
97
  * @param {InterfaceGuard | undefined} interfaceGuard
89
98
  * @param {I} init
90
99
  * @param {T & ThisType<{
91
100
  * self: T,
92
- * state: ReturnType<I>
101
+ * state: StateResult<I>
93
102
  * }>} methods
94
103
  * @param {DefineKindOptions<{
95
104
  * self: T,
96
- * state: ReturnType<I>
105
+ * state: StateResult<I>
97
106
  * }>} [options]
98
107
  * @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>}
99
108
  */
@@ -107,18 +116,18 @@ export const makeExoUtils = VatData => {
107
116
  harden(defineVirtualExoClass);
108
117
 
109
118
  /**
110
- * @template {(...args: any) => any} I init state function
119
+ * @template {InitState} I init state function
111
120
  * @template {Record<string, Record<PropertyKey, CallableFunction>>} T facets
112
121
  * @param {string} tag
113
122
  * @param {InterfaceGuardKit | undefined} interfaceGuardKit
114
123
  * @param {I} init
115
124
  * @param {T & ThisType<{
116
125
  * facets: import('@endo/exo').GuardedKit<T>,
117
- * state: ReturnType<I>
126
+ * state: StateResult<I>
118
127
  * }> } facets
119
128
  * @param {DefineKindOptions<{
120
129
  * facets: T,
121
- * state: ReturnType<I>
130
+ * state: StateResult<I>
122
131
  * }>} [options]
123
132
  * @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>}
124
133
  */
@@ -138,18 +147,18 @@ export const makeExoUtils = VatData => {
138
147
  harden(defineVirtualExoClassKit);
139
148
 
140
149
  /**
141
- * @template {(...args: any) => any} I init state function
150
+ * @template {InitState} I init state function
142
151
  * @template {Record<PropertyKey, CallableFunction>} T methods
143
152
  * @param {DurableKindHandle} kindHandle
144
153
  * @param {InterfaceGuard | undefined} interfaceGuard
145
154
  * @param {I} init
146
155
  * @param {T & ThisType<{
147
156
  * self: T,
148
- * state: ReturnType<I>
157
+ * state: StateResult<I>
149
158
  * }>} methods
150
159
  * @param {DefineKindOptions<{
151
160
  * self: T,
152
- * state: ReturnType<I>
161
+ * state: StateResult<I>
153
162
  * }>} [options]
154
163
  * @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>}
155
164
  */
@@ -169,18 +178,18 @@ export const makeExoUtils = VatData => {
169
178
  harden(defineDurableExoClass);
170
179
 
171
180
  /**
172
- * @template {(...args: any) => any} I init state function
181
+ * @template {InitState} I init state function
173
182
  * @template {Record<string, Record<PropertyKey, CallableFunction>>} T facets
174
183
  * @param {DurableKindHandle} kindHandle
175
184
  * @param {InterfaceGuardKit | undefined} interfaceGuardKit
176
185
  * @param {I} init
177
186
  * @param {T & ThisType<{
178
187
  * facets: import('@endo/exo').GuardedKit<T>,
179
- * state: ReturnType<I>
188
+ * state: StateResult<I>
180
189
  * }> } facets
181
190
  * @param {DefineKindOptions<{
182
191
  * facets: T,
183
- * state: ReturnType<I>
192
+ * state: StateResult<I>
184
193
  * }>} [options]
185
194
  * @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>}
186
195
  */
@@ -200,7 +209,7 @@ export const makeExoUtils = VatData => {
200
209
  harden(defineDurableExoClassKit);
201
210
 
202
211
  /**
203
- * @template {(...args: any) => any} I init state function
212
+ * @template {InitState} I init state function
204
213
  * @template {Record<PropertyKey, CallableFunction>} T methods
205
214
  * @param {Baggage} baggage
206
215
  * @param {string} kindName
@@ -208,11 +217,11 @@ export const makeExoUtils = VatData => {
208
217
  * @param {I} init
209
218
  * @param {T & ThisType<{
210
219
  * self: RemotableObject & T,
211
- * state: ReturnType<I>
220
+ * state: StateResult<I>
212
221
  * }>} methods
213
222
  * @param {DefineKindOptions<{
214
223
  * self: T,
215
- * state: ReturnType<I>
224
+ * state: StateResult<I>
216
225
  * }>} [options]
217
226
  * @returns {(...args: Parameters<I>) => import('@endo/exo').Guarded<T>}
218
227
  */
@@ -234,7 +243,7 @@ export const makeExoUtils = VatData => {
234
243
  harden(prepareExoClass);
235
244
 
236
245
  /**
237
- * @template {(...args: any) => any} I init state function
246
+ * @template {InitState} I init state function
238
247
  * @template {Record<string, Record<PropertyKey, CallableFunction>>} T facets
239
248
  * @param {Baggage} baggage
240
249
  * @param {string} kindName
@@ -242,11 +251,11 @@ export const makeExoUtils = VatData => {
242
251
  * @param {I} init
243
252
  * @param {T & ThisType<{
244
253
  * facets: import('@endo/exo').GuardedKit<T>,
245
- * state: ReturnType<I>
254
+ * state: StateResult<I>
246
255
  * }> } facets
247
256
  * @param {DefineKindOptions<{
248
257
  * facets: T,
249
- * state: ReturnType<I>
258
+ * state: StateResult<I>
250
259
  * }>} [options]
251
260
  * @returns {(...args: Parameters<I>) => import('@endo/exo').GuardedKit<T>}
252
261
  */