@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/marshal.js CHANGED
@@ -6,13 +6,14 @@ import { isStreamCell } from './lib-chainStorage.js';
6
6
  const { Fail } = assert;
7
7
 
8
8
  /**
9
- * Should be a union with Remotable, but that's `any`, making this type meaningless
9
+ * Should be a union with Remotable, but that's `any`, making this type
10
+ * meaningless
10
11
  *
11
12
  * @typedef {{ getBoardId: () => string | null }} BoardRemote
12
13
  */
13
14
 
14
15
  /**
15
- * @param {{ boardId: string | null, iface?: string }} slotInfo
16
+ * @param {{ boardId: string | null; iface?: string }} slotInfo
16
17
  * @returns {BoardRemote}
17
18
  */
18
19
  export const makeBoardRemote = ({ boardId, iface }) => {
@@ -36,13 +37,15 @@ const boardValToSlot = val => {
36
37
  };
37
38
 
38
39
  /**
39
- * A marshaller which can serialize getBoardId() -bearing
40
- * Remotables. This allows the caller to pick their slots. The
41
- * deserializer is configurable: the default cannot handle
42
- * Remotable-bearing data.
40
+ * A marshaller which can serialize getBoardId() -bearing Remotables. This
41
+ * allows the caller to pick their slots. The deserializer is configurable: the
42
+ * default cannot handle Remotable-bearing data.
43
43
  *
44
44
  * @param {(slot: string, iface: string) => any} [slotToVal]
45
- * @returns {Omit<import('@endo/marshal').Marshal<string | null>, 'serialize' | 'unserialize'>}
45
+ * @returns {Omit<
46
+ * import('@endo/marshal').Marshal<string | null>,
47
+ * 'serialize' | 'unserialize'
48
+ * >}
46
49
  */
47
50
  export const boardSlottingMarshaller = (slotToVal = undefined) => {
48
51
  return makeMarshal(boardValToSlot, slotToVal, {
@@ -70,9 +73,12 @@ harden(assertCapData);
70
73
  *
71
74
  * @param {Map<string, string>} data
72
75
  * @param {string} key
73
- * @param {ReturnType<typeof import('@endo/marshal').makeMarshal>['fromCapData']} fromCapData
74
- * @param {number} index index of the desired value in a deserialized stream cell
75
- * @return {any}
76
+ * @param {ReturnType<
77
+ * typeof import('@endo/marshal').makeMarshal
78
+ * >['fromCapData']} fromCapData
79
+ * @param {number} index index of the desired value in a deserialized stream
80
+ * cell
81
+ * @returns {any}
76
82
  */
77
83
  export const unmarshalFromVstorage = (data, key, fromCapData, index) => {
78
84
  const serialized = data.get(key) || Fail`no data for ${key}`;
@@ -90,7 +96,7 @@ export const unmarshalFromVstorage = (data, key, fromCapData, index) => {
90
96
  const marshalled = values.at(index);
91
97
  assert.typeof(marshalled, 'string');
92
98
 
93
- /** @type {import("@endo/marshal").CapData<string>} */
99
+ /** @type {import('@endo/marshal').CapData<string>} */
94
100
  const capData = harden(JSON.parse(marshalled));
95
101
  assertCapData(capData);
96
102
 
@@ -102,7 +108,7 @@ harden(unmarshalFromVstorage);
102
108
  /**
103
109
  * Provide access to object graphs serialized in vstorage.
104
110
  *
105
- * @param {Array<[string, string]>} entries
111
+ * @param {[string, string][]} entries
106
112
  * @param {(slot: string, iface?: string) => any} [slotToVal]
107
113
  */
108
114
  export const makeHistoryReviver = (entries, slotToVal = undefined) => {
@@ -1 +1 @@
1
- {"version":3,"file":"method-tools.d.ts","sourceRoot":"","sources":["method-tools.js"],"names":[],"mappings":"AAyCO,+BAFM,CAAC,2BADH,MAAM,CACJ,CAAC,AADK,EAAE,GAAG,CAAC,GACZ,CAAC,EAAE,CAsBf;AAUM,qCAHW,CAAC,2BAAR,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GACZ,MAAM,EAAE,CAKlB;AA+BI,+BAFM,CAAC,wCAAD,CAAC,AADF,GACC,CAAC,CAiBX"}
1
+ {"version":3,"file":"method-tools.d.ts","sourceRoot":"","sources":["method-tools.js"],"names":[],"mappings":"AA0CO,+BAFM,CAAC,2BADH,MAAM,CACJ,CAAC,AADK,EAAE,GAAG,CAAC,GACZ,CAAC,EAAE,CAsBf;AAUM,qCAHW,CAAC,2BAAR,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GACZ,MAAM,EAAE,CAKlB;AA+BI,+BAFM,CAAC,wCAAD,CAAC,AADF,GACC,CAAC,CAiBX"}
@@ -2,7 +2,8 @@
2
2
  import { isObject } from '@endo/marshal';
3
3
 
4
4
  /**
5
- * @file method-tools use dynamic property lookup, which is not Jessie-compatible
5
+ * @file method-tools use dynamic property lookup, which is not
6
+ * Jessie-compatible
6
7
  */
7
8
 
8
9
  const { getPrototypeOf, create, fromEntries, getOwnPropertyDescriptors } =
@@ -12,8 +13,8 @@ const { ownKeys, apply } = Reflect;
12
13
  /**
13
14
  * Prioritize symbols as earlier than strings.
14
15
  *
15
- * @param {string|symbol} a
16
- * @param {string|symbol} b
16
+ * @param {string | symbol} a
17
+ * @param {string | symbol} b
17
18
  * @returns {-1 | 0 | 1}
18
19
  */
19
20
  const compareStringified = (a, b) => {
@@ -77,22 +78,22 @@ export const getStringMethodNames = val =>
77
78
  /**
78
79
  * TODO This function exists only to ease the
79
80
  * https://github.com/Agoric/agoric-sdk/pull/5970 transition, from all methods
80
- * being own properties to methods being inherited from a common prototype.
81
- * This transition breaks two patterns used in prior code: autobinding,
82
- * and enumerating methods by enumerating own properties. For both, the
83
- * preferred repairs are
84
- * * autobinding: Replace, for example,
85
- * `foo(obj.method)` with `foo(arg => `obj.method(arg))`. IOW, stop relying
86
- * on expressions like `obj.method` to extract a method still bound to the
87
- * state of `obj` because, for virtual and durable objects,
88
- * they no longer will after #5970.
89
- * * method enumeration: Replace, for example
90
- * `Reflect.ownKeys(obj)` with `getMethodNames(obj)`.
81
+ * being own properties to methods being inherited from a common prototype. This
82
+ * transition breaks two patterns used in prior code: autobinding, and
83
+ * enumerating methods by enumerating own properties. For both, the preferred
84
+ * repairs are
85
+ *
86
+ * - autobinding: Replace, for example, `foo(obj.method)` with `foo(arg =>
87
+ * `obj.method(arg))`. IOW, stop relying on expressions like `obj.method`to
88
+ * extract a method still bound to the state of`obj` because, for virtual and
89
+ * durable objects, they no longer will after #5970.
90
+ * - method enumeration: Replace, for example `Reflect.ownKeys(obj)` with
91
+ * `getMethodNames(obj)`.
91
92
  *
92
93
  * Once all problematic cases have been converted in this manner, this
93
94
  * `bindAllMethods` hack can and TODO should be deleted. However, we currently
94
- * have no reliable static way to track down and fix all autobinding sites.
95
- * For those objects that have not yet been fully repaired by the above two
95
+ * have no reliable static way to track down and fix all autobinding sites. For
96
+ * those objects that have not yet been fully repaired by the above two
96
97
  * techniques, `bindAllMethods` creates an object that acts much like the
97
98
  * pre-#5970 objects, with all their methods as instance-bound own properties.
98
99
  * It does this by making a new object inheriting from `obj` where the new
@@ -5,19 +5,18 @@
5
5
  export function encode(data: Buffer): Buffer;
6
6
  export function netstringEncoderStream(): Transform;
7
7
  /**
8
- *
9
8
  * @param {Buffer} data containing zero or more netstrings and maybe some
10
- * leftover bytes
9
+ * leftover bytes
11
10
  * @param {number} [optMaxChunkSize]
12
- * @returns {{ leftover: Buffer, payloads: Buffer[] }} zero or more decoded Buffers, one per netstring,
11
+ * @returns {{ leftover: Buffer; payloads: Buffer[] }} zero or more decoded
12
+ * Buffers, one per netstring,
13
13
  */
14
14
  export function decode(data: Buffer, optMaxChunkSize?: number | undefined): {
15
15
  leftover: Buffer;
16
16
  payloads: Buffer[];
17
17
  };
18
18
  /**
19
- *
20
- * @param {number} [optMaxChunkSize ]
19
+ * @param {number} [optMaxChunkSize]
21
20
  * @returns {Transform}
22
21
  */
23
22
  export function netstringDecoderStream(optMaxChunkSize?: number | undefined): Transform;
@@ -1 +1 @@
1
- {"version":3,"file":"netstring.d.ts","sourceRoot":"","sources":["netstring.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,6BAHW,MAAM,GACJ,MAAM,CAMlB;AAGD,oDAuBC;AAED;;;;;;GAMG;AACH,6BALW,MAAM,yCAGJ;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAkCpD;AAED;;;;GAIG;AAEH,8EAHa,SAAS,CAqCrB;0BA1HyB,QAAQ"}
1
+ {"version":3,"file":"netstring.d.ts","sourceRoot":"","sources":["netstring.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,6BAHW,MAAM,GACJ,MAAM,CAMlB;AAGD,oDAsBC;AAED;;;;;;GAMG;AACH,6BANW,MAAM,yCAGJ;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAmCpD;AAED;;;GAGG;AAEH,8EAHa,SAAS,CAoCrB;0BAvHyB,QAAQ"}
package/src/netstring.js CHANGED
@@ -20,11 +20,10 @@ export function encode(data) {
20
20
  // input is a sequence of strings, output is a byte pipe
21
21
  export function netstringEncoderStream() {
22
22
  /**
23
- *
24
- * @this {{ push: (b: Buffer) => void }}
25
23
  * @param {Buffer} chunk
26
24
  * @param {BufferEncoding} encoding
27
- * @param {*} callback
25
+ * @param {any} callback
26
+ * @this {{ push: (b: Buffer) => void }}
28
27
  */
29
28
  function transform(chunk, encoding, callback) {
30
29
  if (!Buffer.isBuffer(chunk)) {
@@ -44,11 +43,11 @@ export function netstringEncoderStream() {
44
43
  }
45
44
 
46
45
  /**
47
- *
48
46
  * @param {Buffer} data containing zero or more netstrings and maybe some
49
- * leftover bytes
47
+ * leftover bytes
50
48
  * @param {number} [optMaxChunkSize]
51
- * @returns {{ leftover: Buffer, payloads: Buffer[] }} zero or more decoded Buffers, one per netstring,
49
+ * @returns {{ leftover: Buffer; payloads: Buffer[] }} zero or more decoded
50
+ * Buffers, one per netstring,
52
51
  */
53
52
  export function decode(data, optMaxChunkSize) {
54
53
  // TODO: it would be more efficient to accumulate pending data in an array,
@@ -85,19 +84,17 @@ export function decode(data, optMaxChunkSize) {
85
84
  }
86
85
 
87
86
  /**
88
- *
89
- * @param {number} [optMaxChunkSize ]
87
+ * @param {number} [optMaxChunkSize]
90
88
  * @returns {Transform}
91
89
  */
92
90
  // input is a byte pipe, output is a sequence of Buffers
93
91
  export function netstringDecoderStream(optMaxChunkSize) {
94
92
  let buffered = Buffer.from('');
95
93
  /**
96
- *
97
- * @this {{ push: (b: Buffer) => void }}
98
94
  * @param {Buffer} chunk
99
95
  * @param {BufferEncoding} encoding
100
- * @param {*} callback
96
+ * @param {any} callback
97
+ * @this {{ push: (b: Buffer) => void }}
101
98
  */
102
99
  function transform(chunk, encoding, callback) {
103
100
  if (!Buffer.isBuffer(chunk)) {
@@ -1,26 +1,29 @@
1
1
  /**
2
2
  * @typedef {object} BufferLineTransformOptions
3
- * @property {Buffer | string | number} [break] line break matcher for Buffer.indexOf() (default: 10)
4
- * @property {BufferEncoding} [breakEncoding] if break is a string, the encoding to use
3
+ * @property {Buffer | string | number} [break] line break matcher for
4
+ * Buffer.indexOf() (default: 10)
5
+ * @property {BufferEncoding} [breakEncoding] if break is a string, the encoding
6
+ * to use
5
7
  */
6
8
  export default class BufferLineTransform extends Transform {
7
9
  /**
8
- * The BufferLineTransform is reading String or Buffer content from a Readable stream
9
- * and writing each line as a Buffer in object mode
10
+ * The BufferLineTransform is reading String or Buffer content from a Readable
11
+ * stream and writing each line as a Buffer in object mode
10
12
  *
11
- * @param {import('node:stream').TransformOptions & BufferLineTransformOptions} [options]
13
+ * @param {import('node:stream').TransformOptions &
14
+ * BufferLineTransformOptions} [options]
12
15
  */
13
16
  constructor(options?: (import("stream").TransformOptions & BufferLineTransformOptions) | undefined);
14
17
  _breakValue: string | number | Buffer;
15
18
  _breakEncoding: BufferEncoding | undefined;
16
19
  _breakLength: number;
17
- /** @type {Array<Buffer>} */
18
- _chunks: Array<Buffer>;
20
+ /** @type {Buffer[]} */
21
+ _chunks: Buffer[];
19
22
  /**
20
- * @override
21
23
  * @param {any} chunk
22
24
  * @param {BufferEncoding | 'buffer'} encoding
23
25
  * @param {import('node:stream').TransformCallback} cb
26
+ * @override
24
27
  */
25
28
  override _transform(chunk: any, encoding: BufferEncoding | "buffer", cb: import("node:stream").TransformCallback): void;
26
29
  /** @param {Buffer} line */
@@ -28,11 +31,13 @@ export default class BufferLineTransform extends Transform {
28
31
  }
29
32
  export type BufferLineTransformOptions = {
30
33
  /**
31
- * line break matcher for Buffer.indexOf() (default: 10)
34
+ * line break matcher for
35
+ * Buffer.indexOf() (default: 10)
32
36
  */
33
37
  break?: string | number | Buffer | undefined;
34
38
  /**
35
- * if break is a string, the encoding to use
39
+ * if break is a string, the encoding
40
+ * to use
36
41
  */
37
42
  breakEncoding?: BufferEncoding | undefined;
38
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"buffer-line-transform.d.ts","sourceRoot":"","sources":["buffer-line-transform.js"],"names":[],"mappings":"AAKA;;;;GAIG;AAEH;IACE;;;;;OAKG;IACH,oGAuBC;IAhBC,sCAAmC;IACnC,2CAAmC;IAWnC,qBAA+B;IAE/B,4BAA4B;IAC5B,SADW,KAAK,CAAC,MAAM,CAAC,CACP;IAGnB;;;;;OAKG;IACH,2BAJW,GAAG,YACH,cAAc,GAAG,QAAQ,MACzB,OAAO,aAAa,EAAE,iBAAiB,QAgDjD;IAeD,2BAA2B;IAC3B,iBADY,MAAM,QAOjB;CACF;;;;;;;;;;;0BAnHyB,aAAa"}
1
+ {"version":3,"file":"buffer-line-transform.d.ts","sourceRoot":"","sources":["buffer-line-transform.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;IACE;;;;;;OAMG;IACH,oGAuBC;IAhBC,sCAAmC;IACnC,2CAAmC;IAWnC,qBAA+B;IAE/B,uBAAuB;IACvB,SADW,MAAM,EAAE,CACF;IAGnB;;;;;OAKG;IACH,2BALW,GAAG,YACH,cAAc,GAAG,QAAQ,MACzB,OAAO,aAAa,EAAE,iBAAiB,QAiDjD;IAeD,2BAA2B;IAC3B,iBADY,MAAM,QAOjB;CACF;;;;;;;;;;;;;0BAtHyB,aAAa"}
@@ -5,16 +5,19 @@ import { Transform } from 'node:stream';
5
5
 
6
6
  /**
7
7
  * @typedef {object} BufferLineTransformOptions
8
- * @property {Buffer | string | number} [break] line break matcher for Buffer.indexOf() (default: 10)
9
- * @property {BufferEncoding} [breakEncoding] if break is a string, the encoding to use
8
+ * @property {Buffer | string | number} [break] line break matcher for
9
+ * Buffer.indexOf() (default: 10)
10
+ * @property {BufferEncoding} [breakEncoding] if break is a string, the encoding
11
+ * to use
10
12
  */
11
13
 
12
14
  export default class BufferLineTransform extends Transform {
13
15
  /**
14
- * The BufferLineTransform is reading String or Buffer content from a Readable stream
15
- * and writing each line as a Buffer in object mode
16
+ * The BufferLineTransform is reading String or Buffer content from a Readable
17
+ * stream and writing each line as a Buffer in object mode
16
18
  *
17
- * @param {import('node:stream').TransformOptions & BufferLineTransformOptions} [options]
19
+ * @param {import('node:stream').TransformOptions &
20
+ * BufferLineTransformOptions} [options]
18
21
  */
19
22
  constructor(options) {
20
23
  const {
@@ -37,15 +40,15 @@ export default class BufferLineTransform extends Transform {
37
40
  }
38
41
  this._breakLength = breakLength;
39
42
 
40
- /** @type {Array<Buffer>} */
43
+ /** @type {Buffer[]} */
41
44
  this._chunks = [];
42
45
  }
43
46
 
44
47
  /**
45
- * @override
46
48
  * @param {any} chunk
47
49
  * @param {BufferEncoding | 'buffer'} encoding
48
50
  * @param {import('node:stream').TransformCallback} cb
51
+ * @override
49
52
  */
50
53
  _transform(chunk, encoding, cb) {
51
54
  try {
@@ -96,8 +99,8 @@ export default class BufferLineTransform extends Transform {
96
99
  }
97
100
 
98
101
  /**
99
- * @override
100
102
  * @param {import('node:stream').TransformCallback} cb
103
+ * @override
101
104
  */
102
105
  _flush(cb) {
103
106
  if (this._chunks.length) {
@@ -2,7 +2,7 @@ import { createWriteStream } from 'node:fs';
2
2
  import { open } from 'node:fs/promises';
3
3
 
4
4
  /**
5
- * @param {import("fs").ReadStream | import("fs").WriteStream} stream
5
+ * @param {import('fs').ReadStream | import('fs').WriteStream} stream
6
6
  * @returns {Promise<void>}
7
7
  */
8
8
  export const fsStreamReady = stream =>
@@ -1 +1 @@
1
- {"version":3,"file":"priority-senders.d.ts","sourceRoot":"","sources":["priority-senders.js"],"names":[],"mappings":"AAMA,4CAA4C;AAC5C,uCADW,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAMtC;AAQK,wDAFI,IAAI,CAAC,OAAO,uBAAuB,EAAE,WAAW,CAAC;IAsCxD;;;;OAIG;wBAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;IAe1B;;;;OAIG;2BAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;;IArB1B;;;;OAIG;wBAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;IAe1B;;;;OAIG;2BAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;GAuB7B;qCAGa,UAAU,CAAC,OAAO,0BAA0B,CAAC"}
1
+ {"version":3,"file":"priority-senders.d.ts","sourceRoot":"","sources":["priority-senders.js"],"names":[],"mappings":"AAMA,4CAA4C;AAC5C,uCADW,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAMtC;AAQK,wDAFI,IAAI,CAAC,OAAO,uBAAuB,EAAE,WAAW,CAAC;IA0CxD;;;;OAIG;wBAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;IAe1B;;;;OAIG;2BAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;;IArB1B;;;;OAIG;wBAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;IAe1B;;;;OAIG;2BAHQ,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,IAAI,CAAC;GAuB7B;qCAGa,UAAU,CAAC,OAAO,0BAA0B,CAAC"}
@@ -20,9 +20,13 @@ harden(normalizeSenderNamespace);
20
20
  */
21
21
  export const makePrioritySendersManager = sendersNode => {
22
22
  /**
23
- * address to tuple with storage node and set of namespaces that requested priority
23
+ * address to tuple with storage node and set of namespaces that requested
24
+ * priority
24
25
  *
25
- * @type {Map<string, readonly [node: StorageNode, namespaces: Set<string>]>}
26
+ * @type {Map<
27
+ * string,
28
+ * readonly [node: StorageNode, namespaces: Set<string>]
29
+ * >}
26
30
  */
27
31
  const addressRecords = new Map();
28
32
 
@@ -47,7 +51,7 @@ export const makePrioritySendersManager = sendersNode => {
47
51
  const node = await E(sendersNode).makeChildNode(address, {
48
52
  sequence: false,
49
53
  });
50
- /** @type {readonly [ node: StorageNode, namespaces: Set<string> ]} */
54
+ /** @type {readonly [node: StorageNode, namespaces: Set<string>]} */
51
55
  const r = [node, new Set()];
52
56
  addressRecords.set(address, r);
53
57
  return r;
package/src/queue.js CHANGED
@@ -3,8 +3,8 @@
3
3
  import { makePromiseKit } from '@endo/promise-kit';
4
4
 
5
5
  /**
6
- * Return a function that can wrap an async or sync method, but
7
- * ensures only one of them (in order) is running at a time.
6
+ * Return a function that can wrap an async or sync method, but ensures only one
7
+ * of them (in order) is running at a time.
8
8
  */
9
9
  export const makeWithQueue = () => {
10
10
  const queue = [];
@@ -1,7 +1,7 @@
1
1
  export function slotToRemotable(_slotId: string, iface?: string): import("@endo/marshal").RemotableObject<string> & import("@endo/eventual-send").RemotableBrand<{}, {}>;
2
2
  /**
3
- * A basic marshaller whose unserializer produces Remotables. It can
4
- * only serialize plain data, not Remotables.
3
+ * A basic marshaller whose unserializer produces Remotables. It can only
4
+ * serialize plain data, not Remotables.
5
5
  */
6
6
  export const defaultMarshaller: {
7
7
  toCapData: import("@endo/marshal").ToCapData<string>;
@@ -28,8 +28,8 @@ export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<ty
28
28
  };
29
29
  export function makeMockChainStorageRoot(): MockChainStorageRoot;
30
30
  /**
31
- * A map corresponding with a total function such that `get(key)`
32
- * is assumed to always succeed.
31
+ * A map corresponding with a total function such that `get(key)` is assumed to
32
+ * always succeed.
33
33
  */
34
34
  export type TotalMap<K, V> = { [k in Exclude<keyof Map<K, V>, "get">]: Map<K, V>[k]; } & {
35
35
  get: (key: K) => V;
@@ -38,10 +38,10 @@ export type TotalMapFrom<T> = T extends Map<infer K, infer V> ? TotalMap<K, V> :
38
38
  export type FakeStorageKit = ReturnType<typeof makeFakeStorageKit>;
39
39
  export type MockChainStorageRootMethods = {
40
40
  /**
41
- * Defaults to deserializing slot references into plain Remotable
42
- * objects having the specified interface name (as from `Far(iface)`),
43
- * but can accept a different marshaller for producing Remotables
44
- * that e.g. embed the slot string in their iface name.
41
+ * Defaults to deserializing slot references into plain Remotable objects having
42
+ * the specified interface name (as from `Far(iface)`), but can accept a
43
+ * different marshaller for producing Remotables that e.g. embed the slot
44
+ * string in their iface name.
45
45
  */
46
46
  getBody: (path: string, marshaller?: {
47
47
  toCapData: import("@endo/marshal").ToCapData<unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAmCO,yCAHI,MAAM,UACN,MAAM,0GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;AA4CH,8CAtBwB,GAAG,KAAK,GAAG,CAsB8B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;uDA+FtC;YAAE,QAAQ,CAAC,UAAS;SAAC;;;UAUf,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;EAIvC;AAgBM,4CADO,oBAAoB,CAyBjC;;;;;qBAhOiF,CAAC,EAAK,CAAC,IAA5E,GAAE,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAA6C,CAAC,AAA5C,EAAiD,CAAC,AAA/C,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,CAAyB,CAAC,AAAxB,EAA6B,CAAC,AAA3B,CAAC,CAAC,CAAC,CAAC,GAAC,GAAG;IAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;CAAC;yBAI7E,CAAC,IAAD,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK;6BAsLvD,UAAU,CAAE,OAAO,kBAAkB,CAAC;;;;;;;;oBAI/B,MAAM;;;;;2BAAmC,MAAM,KAAK,OAAO;UAKlE,MAAM,MAAM,EAAE;;;qCAnNuB,uBAAuB;iCAIF,uBAAuB;oCAAvB,uBAAuB"}
1
+ {"version":3,"file":"storage-test-utils.d.ts","sourceRoot":"","sources":["storage-test-utils.js"],"names":[],"mappings":"AAqCO,yCAHI,MAAM,UACN,MAAM,0GAGC;AAElB;;;GAGG;AACH;;;;;EAEG;AA4CH,8CAtBuB,GAAG,KAAK,GAAG,CAsB+B;AAU1D,6CAHI,MAAM,gBACN,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;uDAqGtC;YAAE,QAAS,CAAC,UAAS;SAAE;;;UAIjB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;EAIvC;AAoBM,4CADO,oBAAoB,CA6BjC;;;;;qBAzOe,CAAC,EAAK,CAAC,IADV,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CACtB,CAAC,AADuB,EAClB,CAAC,AADoB,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,CAC1C,CAAC,AAD2C,EACtC,CAAC,AADwC,CAAC,CAAC,CAAC,CAAC,GAAE,GAAG;IACvE,GAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;CACpB;yBAIS,CAAC,IAAD,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK;6BAsLvD,UAAU,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;oBAKxC,MAAM;;;;;2BAEJ,MAAM,KACX,OAAO;UAKD,MAAM,MAAM,EAAE;;;qCAzNuB,uBAAuB;iCAIF,uBAAuB;oCAAvB,uBAAuB"}
@@ -15,11 +15,13 @@ const { Fail } = assert;
15
15
  const trace = makeTracer('StorTU', false);
16
16
 
17
17
  /**
18
- * A map corresponding with a total function such that `get(key)`
19
- * is assumed to always succeed.
18
+ * A map corresponding with a total function such that `get(key)` is assumed to
19
+ * always succeed.
20
20
  *
21
21
  * @template K, V
22
- * @typedef {{[k in Exclude<keyof Map<K, V>, 'get'>]: Map<K, V>[k]} & {get: (key: K) => V}} TotalMap
22
+ * @typedef {{ [k in Exclude<keyof Map<K, V>, 'get'>]: Map<K, V>[k] } & {
23
+ * get: (key: K) => V;
24
+ * }} TotalMap
23
25
  */
24
26
  /**
25
27
  * @template T
@@ -27,8 +29,8 @@ const trace = makeTracer('StorTU', false);
27
29
  */
28
30
 
29
31
  /**
30
- * A convertSlotToVal function that produces basic Remotables. Assumes
31
- * that all slots are Remotables (i.e. none are Promises).
32
+ * A convertSlotToVal function that produces basic Remotables. Assumes that all
33
+ * slots are Remotables (i.e. none are Promises).
32
34
  *
33
35
  * @param {string} _slotId
34
36
  * @param {string} iface
@@ -37,34 +39,34 @@ export const slotToRemotable = (_slotId, iface = 'Remotable') =>
37
39
  Remotable(iface);
38
40
 
39
41
  /**
40
- * A basic marshaller whose unserializer produces Remotables. It can
41
- * only serialize plain data, not Remotables.
42
+ * A basic marshaller whose unserializer produces Remotables. It can only
43
+ * serialize plain data, not Remotables.
42
44
  */
43
45
  export const defaultMarshaller = makeMarshal(undefined, slotToRemotable, {
44
46
  serializeBodyFormat: 'smallcaps',
45
47
  });
46
48
 
47
49
  /**
48
- * A deserializer which produces slot strings instead of Remotables,
49
- * so if `a = Far('iface')`, and serializing `{ a }` into `capData`
50
- * assigned it slot `board123`, then `slotStringUnserialize(capData)`
51
- * would produce `{ a: 'board123' }`.
50
+ * A deserializer which produces slot strings instead of Remotables, so if `a =
51
+ * Far('iface')`, and serializing `{ a }` into `capData` assigned it slot
52
+ * `board123`, then `slotStringUnserialize(capData)` would produce `{ a:
53
+ * 'board123' }`.
52
54
  *
53
55
  * This may be useful for display purposes.
54
56
  *
55
57
  * Limitations:
56
- * * it cannot handle Symbols (registered or well-known)
57
- * * it can handle BigInts, but serialized data that contains a
58
- * particular unusual string will be unserialized into a BigInt by
59
- * mistake
60
- * * it cannot handle Promises, NaN, +/- Infinity, undefined, or
61
- * other non-JSONable JavaScript values
58
+ *
59
+ * - it cannot handle Symbols (registered or well-known)
60
+ * - it can handle BigInts, but serialized data that contains a particular unusual
61
+ * string will be unserialized into a BigInt by mistake
62
+ * - it cannot handle Promises, NaN, +/- Infinity, undefined, or other
63
+ * non-JSONable JavaScript values
62
64
  */
63
65
  const makeSlotStringUnserialize = () => {
64
- /** @type { (slot: string, iface: string) => any } */
66
+ /** @type {(slot: string, iface: string) => any} */
65
67
  const identitySlotToValFn = (slot, _) => Far('unk', { toJSON: () => slot });
66
68
  const { fromCapData } = makeMarshal(undefined, identitySlotToValFn);
67
- /** @type { (capData: any) => any } */
69
+ /** @type {(capData: any) => any} */
68
70
  const unserialize = capData =>
69
71
  JSON.parse(
70
72
  JSON.stringify(fromCapData(capData), (_, val) => {
@@ -89,9 +91,9 @@ const makeSlotStringUnserialize = () => {
89
91
  export const slotStringUnserialize = makeSlotStringUnserialize();
90
92
 
91
93
  /**
92
- * For testing, creates a chainStorage root node over an in-memory map
93
- * and exposes both the map and the sequence of received messages.
94
- * The `sequence` option defaults to true.
94
+ * For testing, creates a chainStorage root node over an in-memory map and
95
+ * exposes both the map and the sequence of received messages. The `sequence`
96
+ * option defaults to true.
95
97
  *
96
98
  * @param {string} rootPath
97
99
  * @param {Parameters<typeof makeChainStorageRoot>[2]} [rootOptions]
@@ -205,15 +207,19 @@ export const makeFakeStorageKit = (rootPath, rootOptions) => {
205
207
  };
206
208
  };
207
209
  harden(makeFakeStorageKit);
208
- /** @typedef {ReturnType< typeof makeFakeStorageKit>} FakeStorageKit */
210
+ /** @typedef {ReturnType<typeof makeFakeStorageKit>} FakeStorageKit */
209
211
 
210
212
  /**
211
213
  * @typedef MockChainStorageRootMethods
212
- * @property {(path: string, marshaller?: Marshaller, index?: number) => unknown} getBody
213
- * Defaults to deserializing slot references into plain Remotable
214
- * objects having the specified interface name (as from `Far(iface)`),
215
- * but can accept a different marshaller for producing Remotables
216
- * that e.g. embed the slot string in their iface name.
214
+ * @property {(
215
+ * path: string,
216
+ * marshaller?: Marshaller,
217
+ * index?: number,
218
+ * ) => unknown} getBody
219
+ * Defaults to deserializing slot references into plain Remotable objects having
220
+ * the specified interface name (as from `Far(iface)`), but can accept a
221
+ * different marshaller for producing Remotables that e.g. embed the slot
222
+ * string in their iface name.
217
223
  * @property {() => string[]} keys
218
224
  */
219
225
  /** @typedef {StorageNode & MockChainStorageRootMethods} MockChainStorageRoot */
@@ -224,10 +230,10 @@ export const makeMockChainStorageRoot = () => {
224
230
  return Far('mockChainStorage', {
225
231
  ...bindAllMethods(rootNode),
226
232
  /**
227
- * Defaults to deserializing slot references into plain Remotable
228
- * objects having the specified interface name (as from `Far(iface)`),
229
- * but can accept a different marshaller for producing Remotables
230
- * that e.g. embed the slot string in their iface name.
233
+ * Defaults to deserializing slot references into plain Remotable objects
234
+ * having the specified interface name (as from `Far(iface)`), but can
235
+ * accept a different marshaller for producing Remotables that e.g. embed
236
+ * the slot string in their iface name.
231
237
  *
232
238
  * @param {string} path
233
239
  * @param {Marshaller} marshaller
@@ -236,7 +242,11 @@ export const makeMockChainStorageRoot = () => {
236
242
  */
237
243
  getBody: (path, marshaller = defaultMarshaller, index = -1) => {
238
244
  data.size || Fail`no data in storage`;
239
- /** @type {ReturnType<typeof import('@endo/marshal').makeMarshal>['fromCapData']} */
245
+ /**
246
+ * @type {ReturnType<
247
+ * typeof import('@endo/marshal').makeMarshal
248
+ * >['fromCapData']}
249
+ */
240
250
  const fromCapData = (...args) =>
241
251
  Reflect.apply(marshaller.fromCapData, marshaller, args);
242
252
  return unmarshalFromVstorage(data, path, fromCapData, index);
@@ -1 +1 @@
1
- {"version":3,"file":"testing-utils.d.ts","sourceRoot":"","sources":["testing-utils.js"],"names":[],"mappings":"AAWO,mDACwC"}
1
+ {"version":3,"file":"testing-utils.d.ts","sourceRoot":"","sources":["testing-utils.js"],"names":[],"mappings":"AAaO,mDACwC"}
@@ -1,13 +1,15 @@
1
- /** @file note this cannot be called test-utils.js due to https://github.com/Agoric/agoric-sdk/issues/7503 */
1
+ /**
2
+ * @file note this cannot be called test-utils.js due to
3
+ * https://github.com/Agoric/agoric-sdk/issues/7503
4
+ */
2
5
  /* global setImmediate */
3
6
 
4
7
  /**
5
8
  * A workaround for some issues with fake time in tests.
6
9
  *
7
- * Lines of test code can depend on async promises outside the test
8
- * resolving before they run. Awaiting this function result ensures
9
- * that all promises that can do resolve.
10
- * Note that this doesn't mean all outstanding promises.
10
+ * Lines of test code can depend on async promises outside the test resolving
11
+ * before they run. Awaiting this function result ensures that all promises that
12
+ * can do resolve. Note that this doesn't mean all outstanding promises.
11
13
  */
12
14
  export const eventLoopIteration = async () =>
13
15
  new Promise(resolve => setImmediate(resolve));
@@ -6,8 +6,8 @@ export namespace UpgradeDisconnectionShape {
6
6
  export function makeUpgradeDisconnection(upgradeMessage: string, toIncarnationNumber: number): UpgradeDisconnection;
7
7
  export function isUpgradeDisconnection(reason: any): reason is UpgradeDisconnection;
8
8
  /**
9
- * An Error-like object for use as the rejection reason of promises
10
- * abandoned by upgrade.
9
+ * An Error-like object for use as the rejection reason of promises abandoned by
10
+ * upgrade.
11
11
  */
12
12
  export type UpgradeDisconnection = {
13
13
  name: "vatUpgraded";
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-api.d.ts","sourceRoot":"","sources":["upgrade-api.js"],"names":[],"mappings":";;;;;AAgCO,yDAJI,MAAM,uBACN,MAAM,GACJ,oBAAoB,CAO7B;AASG,+CALI,GAAG,GAGD,MAAM,IAAI,oBAAoB,CAGqB;;;;;mCApCnD;IACZ,IAAQ,EAAE,aAAa,CAAC;IACxB,cAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAqB,EAAE,MAAM,CAAA;CAC1B"}
1
+ {"version":3,"file":"upgrade-api.d.ts","sourceRoot":"","sources":["upgrade-api.js"],"names":[],"mappings":";;;;;AAgCO,yDAJI,MAAM,uBACN,MAAM,GACJ,oBAAoB,CAO7B;AASG,+CALI,GAAG,GAGD,MAAM,IAAI,oBAAoB,CAGqB;;;;;mCApCnD;IACZ,IAAQ,EAAE,aAAa,CAAC;IACxB,cAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAqB,EAAE,MAAM,CAAC;CAC3B"}
@@ -6,13 +6,13 @@ import { M, matches } from '@endo/patterns';
6
6
  const { isFrozen } = Object;
7
7
 
8
8
  /**
9
- * An Error-like object for use as the rejection reason of promises
10
- * abandoned by upgrade.
9
+ * An Error-like object for use as the rejection reason of promises abandoned by
10
+ * upgrade.
11
11
  *
12
12
  * @typedef {{
13
- * name: 'vatUpgraded',
14
- * upgradeMessage: string,
15
- * incarnationNumber: number
13
+ * name: 'vatUpgraded';
14
+ * upgradeMessage: string;
15
+ * incarnationNumber: number;
16
16
  * }} UpgradeDisconnection
17
17
  */
18
18
 
@@ -39,9 +39,9 @@ export const makeUpgradeDisconnection = (upgradeMessage, toIncarnationNumber) =>
39
39
  harden(makeUpgradeDisconnection);
40
40
 
41
41
  /**
42
- * @param {any} reason
43
- * If `reason` is not frozen, it cannot be an UpgradeDisconnection,
44
- * so returns false without even checking against the shape.
42
+ * @param {any} reason If `reason` is not frozen, it cannot be an
43
+ * UpgradeDisconnection, so returns false without even checking against the
44
+ * shape.
45
45
  * @returns {reason is UpgradeDisconnection}
46
46
  */
47
47
  export const isUpgradeDisconnection = reason =>