@agoric/internal 0.3.3-dev-6c8bf5c.0 → 0.3.3-dev-35d20eb.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 (45) hide show
  1. package/package.json +4 -4
  2. package/src/batched-deliver.d.ts +4 -1
  3. package/src/batched-deliver.d.ts.map +1 -1
  4. package/src/batched-deliver.js +4 -1
  5. package/src/callback.d.ts.map +1 -1
  6. package/src/callback.js +24 -22
  7. package/src/chain-storage-paths.d.ts +2 -3
  8. package/src/chain-storage-paths.d.ts.map +1 -1
  9. package/src/chain-storage-paths.js +2 -3
  10. package/src/config.d.ts.map +1 -1
  11. package/src/config.js +6 -4
  12. package/src/lib-chainStorage.d.ts +26 -11
  13. package/src/lib-chainStorage.d.ts.map +1 -1
  14. package/src/lib-chainStorage.js +69 -35
  15. package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -1
  16. package/src/lib-nodejs/spawnSubprocessWorker.js +7 -5
  17. package/src/lib-nodejs/worker-protocol.d.ts.map +1 -1
  18. package/src/lib-nodejs/worker-protocol.js +5 -7
  19. package/src/magic-cookie-test-only.js +2 -2
  20. package/src/marshal.d.ts +3 -2
  21. package/src/marshal.d.ts.map +1 -1
  22. package/src/marshal.js +18 -12
  23. package/src/method-tools.d.ts.map +1 -1
  24. package/src/method-tools.js +17 -16
  25. package/src/netstring.d.ts +4 -5
  26. package/src/netstring.d.ts.map +1 -1
  27. package/src/netstring.js +8 -11
  28. package/src/node/buffer-line-transform.d.ts +15 -10
  29. package/src/node/buffer-line-transform.d.ts.map +1 -1
  30. package/src/node/buffer-line-transform.js +11 -8
  31. package/src/node/fs-stream.js +1 -1
  32. package/src/priority-senders.d.ts.map +1 -1
  33. package/src/priority-senders.js +7 -3
  34. package/src/queue.js +2 -2
  35. package/src/storage-test-utils.d.ts +8 -8
  36. package/src/storage-test-utils.d.ts.map +1 -1
  37. package/src/storage-test-utils.js +43 -33
  38. package/src/testing-utils.d.ts.map +1 -1
  39. package/src/testing-utils.js +7 -5
  40. package/src/upgrade-api.d.ts +2 -2
  41. package/src/upgrade-api.d.ts.map +1 -1
  42. package/src/upgrade-api.js +8 -8
  43. package/src/utils.d.ts +24 -14
  44. package/src/utils.d.ts.map +1 -1
  45. package/src/utils.js +50 -29
package/src/utils.d.ts CHANGED
@@ -1,27 +1,32 @@
1
1
  export const BASIS_POINTS: 10000n;
2
- /** @import { ERef } from '@endo/far' */
2
+ /** @import {ERef} from '@endo/far' */
3
3
  /**
4
4
  * @template T
5
- * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify
6
- * flatten the type output to improve type hints shown in editors
7
- * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
5
+ * @typedef {{ [KeyType in keyof T]: T[KeyType] } & {}} Simplify flatten the
6
+ * type output to improve type hints shown in editors
7
+ * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
8
8
  */
9
9
  /**
10
10
  * @typedef {(...args: any[]) => any} Callable
11
11
  */
12
12
  /**
13
13
  * @template {{}} T
14
- * @typedef {{ [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]> }} DeeplyAwaitedObject
14
+ * @typedef {{
15
+ * [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]>;
16
+ * }} DeeplyAwaitedObject
15
17
  */
16
18
  /**
17
19
  * @template T
18
- * @typedef {T extends PromiseLike<any> ? Awaited<T> : T extends {} ? Simplify<DeeplyAwaitedObject<T>> : Awaited<T>} DeeplyAwaited
20
+ * @typedef {T extends PromiseLike<any>
21
+ * ? Awaited<T>
22
+ * : T extends {}
23
+ * ? Simplify<DeeplyAwaitedObject<T>>
24
+ * : Awaited<T>} DeeplyAwaited
19
25
  */
20
26
  /**
21
27
  * A more constrained version of {deeplyFulfilled} for type safety until
22
- * https://github.com/endojs/endo/issues/1257
23
- * Useful in starting contracts that need all terms to be fulfilled
24
- * in order to be durable.
28
+ * https://github.com/endojs/endo/issues/1257 Useful in starting contracts that
29
+ * need all terms to be fulfilled in order to be durable.
25
30
  *
26
31
  * @type {<T extends {}>(unfulfilledTerms: T) => Promise<DeeplyAwaited<T>>}
27
32
  */
@@ -34,7 +39,7 @@ export function PromiseAllOrErrors<T>(items: readonly (T | PromiseLike<T>)[]): P
34
39
  /**
35
40
  * @type {<T>(
36
41
  * trier: () => Promise<T>,
37
- * finalizer: (error?: unknown) => Promise<void>,
42
+ * finalizer: (error?: unknown) => Promise<void>,
38
43
  * ) => Promise<T>}
39
44
  */
40
45
  export const aggregateTryFinally: <T>(trier: () => Promise<T>, finalizer: (error?: unknown) => Promise<void>) => Promise<T>;
@@ -42,14 +47,19 @@ export function assertAllDefined<T extends Record<string, unknown>>(obj: T): ass
42
47
  export const forever: AsyncIterable<undefined>;
43
48
  export function whileTrue<T>(produce: () => T): AsyncIterable<Awaited<T>>;
44
49
  export function untilTrue<T>(produce: () => T): AsyncIterable<Awaited<T>>;
45
- /** @type { <X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */
50
+ /** @type {<X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */
46
51
  export const zip: <X, Y>(xs: X[], ys: Y[]) => [X, Y][];
47
- /** @type { <T extends Record<string, ERef<any>>>(obj: T) => Promise<{ [K in keyof T]: Awaited<T[K]>}> } */
52
+ /**
53
+ * @type {<T extends Record<string, ERef<any>>>(
54
+ * obj: T,
55
+ * ) => Promise<{ [K in keyof T]: Awaited<T[K]> }>}
56
+ */
48
57
  export const allValues: <T extends Record<string, any>>(obj: T) => Promise<{ [K in keyof T]: Awaited<T[K]>; }>;
49
58
  export function synchronizedTee<T = unknown>(sourceStream: AsyncIterator<T, void, void>, readerCount: number): AsyncGenerator<T, void, void>[];
50
59
  /**
51
- * flatten the type output to improve type hints shown in editors
52
- * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
60
+ * flatten the
61
+ * type output to improve type hints shown in editors
62
+ * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
53
63
  */
54
64
  export type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
55
65
  export type Callable = (...args: any[]) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AAYA,kCAAoC;AAEpC,wCAAwC;AAExC;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;;;GAOG;AACH,oCAFU,CAAC,CAAC,SAAS,EAAE,EAAE,gBAAgB,EAA8B,CAAC,AAA5B,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAKxE;AAUK,wDAHI,cAAc,YAAY,EAAE,WAAW,CAAC,GAAG,GACzC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAWjF;AAOM,mCAFc,CAAC,SADX,SAAS,CACC,CAAC,AADA,GAAG,WAAW,CACf,CAAC,AADgB,CAAC,CAAC,EAAE,GAC7B,OAAO,CAAC,CAAC,EAAE,CAAC,CAiBxB;AAED;;;;;GAKG;AACH,kCALU,CAAC,CAAC,EACX,KAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,SAAY,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,KACzC,OAAO,CAAC,CAAC,CAAC,CAYd;AAgBG,iCAFgC,CAAC,uCAAD,CAAC,AAF5B,GAEC,OAAO,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAYxC;AAQD,+CAAoD;AAU7C,0BAF4B,CAAC,WAJzB,MAIwB,CAAC,AAJlB,GAIL,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAYlC;AAUG,0BAF4B,CAAC,WAJzB,MAIwB,CAAC,AAJlB,G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_000n;
14
14
 
15
- /** @import { ERef } from '@endo/far' */
15
+ /** @import {ERef} from '@endo/far' */
16
16
 
17
17
  /**
18
18
  * @template T
19
- * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify
20
- * flatten the type output to improve type hints shown in editors
21
- * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
19
+ * @typedef {{ [KeyType in keyof T]: T[KeyType] } & {}} Simplify flatten the
20
+ * type output to improve type hints shown in editors
21
+ * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
22
22
  */
23
23
 
24
24
  /**
@@ -27,19 +27,24 @@ export const BASIS_POINTS = 10_000n;
27
27
 
28
28
  /**
29
29
  * @template {{}} T
30
- * @typedef {{ [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]> }} DeeplyAwaitedObject
30
+ * @typedef {{
31
+ * [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]>;
32
+ * }} DeeplyAwaitedObject
31
33
  */
32
34
 
33
35
  /**
34
36
  * @template T
35
- * @typedef {T extends PromiseLike<any> ? Awaited<T> : T extends {} ? Simplify<DeeplyAwaitedObject<T>> : Awaited<T>} DeeplyAwaited
37
+ * @typedef {T extends PromiseLike<any>
38
+ * ? Awaited<T>
39
+ * : T extends {}
40
+ * ? Simplify<DeeplyAwaitedObject<T>>
41
+ * : Awaited<T>} DeeplyAwaited
36
42
  */
37
43
 
38
44
  /**
39
45
  * A more constrained version of {deeplyFulfilled} for type safety until
40
- * https://github.com/endojs/endo/issues/1257
41
- * Useful in starting contracts that need all terms to be fulfilled
42
- * in order to be durable.
46
+ * https://github.com/endojs/endo/issues/1257 Useful in starting contracts that
47
+ * need all terms to be fulfilled in order to be durable.
43
48
  *
44
49
  * @type {<T extends {}>(unfulfilledTerms: T) => Promise<DeeplyAwaited<T>>}
45
50
  */
@@ -54,7 +59,9 @@ export const deeplyFulfilledObject = async obj => {
54
59
  * and report the result in seconds to match our telemetry standard.
55
60
  *
56
61
  * @param {typeof import('perf_hooks').performance.now} currentTimeMillisec
57
- * @returns {<T>(fn: () => Promise<T>) => Promise<{ result: T, duration: number }>}
62
+ * @returns {<T>(
63
+ * fn: () => Promise<T>,
64
+ * ) => Promise<{ result: T; duration: number }>}
58
65
  */
59
66
  export const makeMeasureSeconds = currentTimeMillisec => {
60
67
  /** @param {() => any} fn */
@@ -92,7 +99,7 @@ export const PromiseAllOrErrors = async items => {
92
99
  /**
93
100
  * @type {<T>(
94
101
  * trier: () => Promise<T>,
95
- * finalizer: (error?: unknown) => Promise<void>,
102
+ * finalizer: (error?: unknown) => Promise<void>,
96
103
  * ) => Promise<T>}
97
104
  */
98
105
  export const aggregateTryFinally = async (trier, finalizer) =>
@@ -109,7 +116,7 @@ export const aggregateTryFinally = async (trier, finalizer) =>
109
116
 
110
117
  /**
111
118
  * @template {Record<string, unknown>} T
112
- * @typedef {{[P in keyof T]: Exclude<T[P], undefined>;}} AllDefined
119
+ * @typedef {{ [P in keyof T]: Exclude<T[P], undefined> }} AllDefined
113
120
  */
114
121
 
115
122
  /**
@@ -118,8 +125,8 @@ export const aggregateTryFinally = async (trier, finalizer) =>
118
125
  *
119
126
  * @template {Record<string, unknown>} T
120
127
  * @param {T} obj
121
- * @throws if any value in the object entries is not defined
122
128
  * @returns {asserts obj is AllDefined<T>}
129
+ * @throws if any value in the object entries is not defined
123
130
  */
124
131
  export const assertAllDefined = obj => {
125
132
  const missing = [];
@@ -143,10 +150,9 @@ export const forever = asyncGenerate(() => notDone);
143
150
 
144
151
  /**
145
152
  * @template T
146
- * @param {() => T} produce
147
- * The value of `await produce()` is used for its truthiness vs falsiness.
148
- * IOW, it is coerced to a boolean so the caller need not bother doing this
149
- * themselves.
153
+ * @param {() => T} produce The value of `await produce()` is used for its
154
+ * truthiness vs falsiness. IOW, it is coerced to a boolean so the caller need
155
+ * not bother doing this themselves.
150
156
  * @returns {AsyncIterable<Awaited<T>>}
151
157
  */
152
158
  export const whileTrue = produce =>
@@ -163,10 +169,9 @@ export const whileTrue = produce =>
163
169
 
164
170
  /**
165
171
  * @template T
166
- * @param {() => T} produce
167
- * The value of `await produce()` is used for its truthiness vs falsiness.
168
- * IOW, it is coerced to a boolean so the caller need not bother doing this
169
- * themselves.
172
+ * @param {() => T} produce The value of `await produce()` is used for its
173
+ * truthiness vs falsiness. IOW, it is coerced to a boolean so the caller need
174
+ * not bother doing this themselves.
170
175
  * @returns {AsyncIterable<Awaited<T>>}
171
176
  */
172
177
  export const untilTrue = produce =>
@@ -184,10 +189,14 @@ export const untilTrue = produce =>
184
189
  });
185
190
  });
186
191
 
187
- /** @type { <X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */
192
+ /** @type {<X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */
188
193
  export const zip = (xs, ys) => harden(xs.map((x, i) => [x, ys[+i]]));
189
194
 
190
- /** @type { <T extends Record<string, ERef<any>>>(obj: T) => Promise<{ [K in keyof T]: Awaited<T[K]>}> } */
195
+ /**
196
+ * @type {<T extends Record<string, ERef<any>>>(
197
+ * obj: T,
198
+ * ) => Promise<{ [K in keyof T]: Awaited<T[K]> }>}
199
+ */
191
200
  export const allValues = async obj => {
192
201
  const resolved = await Promise.all(values(obj));
193
202
  // @ts-expect-error cast
@@ -195,9 +204,9 @@ export const allValues = async obj => {
195
204
  };
196
205
 
197
206
  /**
198
- * A tee implementation where all readers are synchronized with each other.
199
- * They all consume the source stream in lockstep, and any one returning or
200
- * throwing early will affect the others.
207
+ * A tee implementation where all readers are synchronized with each other. They
208
+ * all consume the source stream in lockstep, and any one returning or throwing
209
+ * early will affect the others.
201
210
  *
202
211
  * @template [T=unknown]
203
212
  * @param {AsyncIterator<T, void, void>} sourceStream
@@ -207,7 +216,11 @@ export const synchronizedTee = (sourceStream, readerCount) => {
207
216
  /** @type {IteratorReturnResult<void> | undefined} */
208
217
  let doneResult;
209
218
 
210
- /** @typedef {IteratorResult<(value: PromiseLike<IteratorResult<T>>) => void>} QueuePayload */
219
+ /**
220
+ * @typedef {IteratorResult<
221
+ * (value: PromiseLike<IteratorResult<T>>) => void
222
+ * >} QueuePayload
223
+ */
211
224
  /** @type {import('@endo/stream').AsyncQueue<QueuePayload>[]} */
212
225
  const queues = [];
213
226
 
@@ -267,13 +280,21 @@ export const synchronizedTee = (sourceStream, readerCount) => {
267
280
  /** @type {AsyncGenerator<T, void, void>} */
268
281
  const reader = harden({
269
282
  async next() {
270
- /** @type {import('@endo/promise-kit').PromiseKit<IteratorResult<T>>} */
283
+ /**
284
+ * @type {import('@endo/promise-kit').PromiseKit<
285
+ * IteratorResult<T>
286
+ * >}
287
+ */
271
288
  const { promise, resolve } = makePromiseKit();
272
289
  queue.put({ value: resolve, done: false });
273
290
  return promise;
274
291
  },
275
292
  async return() {
276
- /** @type {import('@endo/promise-kit').PromiseKit<IteratorResult<T>>} */
293
+ /**
294
+ * @type {import('@endo/promise-kit').PromiseKit<
295
+ * IteratorResult<T>
296
+ * >}
297
+ */
277
298
  const { promise, resolve } = makePromiseKit();
278
299
  queue.put({ value: resolve, done: true });
279
300
  return promise;