@agoric/internal 0.3.3-other-dev-d15096d.0.d15096d → 0.3.3-other-dev-ecf44df.0.ecf44df

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 (132) hide show
  1. package/package.json +32 -36
  2. package/src/action-types.d.ts +47 -20
  3. package/src/action-types.d.ts.map +1 -1
  4. package/src/action-types.js +21 -21
  5. package/src/ava-force-exit.d.mts +2 -0
  6. package/src/ava-force-exit.d.mts.map +1 -0
  7. package/src/ava-force-exit.mjs +7 -0
  8. package/src/batched-deliver.d.ts +2 -2
  9. package/src/batched-deliver.d.ts.map +1 -1
  10. package/src/batched-deliver.js +2 -3
  11. package/src/build-cache-types.d.ts +33 -0
  12. package/src/build-cache-types.d.ts.map +1 -0
  13. package/src/build-cache-types.js +42 -0
  14. package/src/build-cache.d.ts +12 -0
  15. package/src/build-cache.d.ts.map +1 -0
  16. package/src/build-cache.js +184 -0
  17. package/src/callback.d.ts +1 -1
  18. package/src/callback.d.ts.map +1 -1
  19. package/src/callback.js +1 -0
  20. package/src/chain-storage-paths.d.ts.map +1 -1
  21. package/src/chain-storage-paths.js +0 -2
  22. package/src/config.d.ts +3 -3
  23. package/src/config.d.ts.map +1 -1
  24. package/src/config.js +6 -5
  25. package/src/debug.d.ts +2 -2
  26. package/src/debug.d.ts.map +1 -1
  27. package/src/debug.js +19 -5
  28. package/src/hex.d.ts.map +1 -1
  29. package/src/hex.js +18 -22
  30. package/src/index.d.ts +1 -0
  31. package/src/index.js +1 -2
  32. package/src/js-utils.d.ts +17 -2
  33. package/src/js-utils.d.ts.map +1 -1
  34. package/src/js-utils.js +49 -3
  35. package/src/keyMirror.d.ts +3 -0
  36. package/src/keyMirror.d.ts.map +1 -0
  37. package/src/keyMirror.js +45 -0
  38. package/src/kv-store.d.ts +33 -0
  39. package/src/kv-store.d.ts.map +1 -0
  40. package/src/kv-store.js +265 -0
  41. package/src/lib-chainStorage.d.ts +25 -42
  42. package/src/lib-chainStorage.d.ts.map +1 -1
  43. package/src/lib-chainStorage.js +38 -14
  44. package/src/lib-nodejs/ava-unhandled-rejection.d.ts +18 -3
  45. package/src/lib-nodejs/ava-unhandled-rejection.d.ts.map +1 -1
  46. package/src/lib-nodejs/ava-unhandled-rejection.js +217 -20
  47. package/src/lib-nodejs/engine-gc.js +2 -2
  48. package/src/lib-nodejs/gc-and-finalize.d.ts +2 -1
  49. package/src/lib-nodejs/gc-and-finalize.d.ts.map +1 -1
  50. package/src/lib-nodejs/gc-and-finalize.js +1 -0
  51. package/src/lib-nodejs/spawnSubprocessWorker.d.ts +11 -4
  52. package/src/lib-nodejs/spawnSubprocessWorker.d.ts.map +1 -1
  53. package/src/lib-nodejs/spawnSubprocessWorker.js +14 -4
  54. package/src/lib-nodejs/worker-protocol.d.ts +1 -1
  55. package/src/lib-nodejs/worker-protocol.d.ts.map +1 -1
  56. package/src/lib-nodejs/worker-protocol.js +5 -6
  57. package/src/magic-cookie-test-only.d.ts.map +1 -1
  58. package/src/magic-cookie-test-only.js +0 -2
  59. package/src/marshal/board-client-utils.d.ts.map +1 -1
  60. package/src/marshal/board-client-utils.js +4 -1
  61. package/src/marshal/cap-data.d.ts +9 -1
  62. package/src/marshal/cap-data.d.ts.map +1 -1
  63. package/src/marshal/cap-data.js +1 -2
  64. package/src/marshal/wrap-marshaller.d.ts +34 -7
  65. package/src/marshal/wrap-marshaller.d.ts.map +1 -1
  66. package/src/marshal/wrap-marshaller.js +64 -68
  67. package/src/metrics.d.ts +1 -4
  68. package/src/metrics.d.ts.map +1 -1
  69. package/src/metrics.js +7 -2
  70. package/src/module-utils.d.ts +1 -0
  71. package/src/module-utils.d.ts.map +1 -1
  72. package/src/module-utils.js +17 -0
  73. package/src/natural-sort.d.ts.map +1 -1
  74. package/src/natural-sort.js +7 -3
  75. package/src/netstring.d.ts +1 -1
  76. package/src/netstring.d.ts.map +1 -1
  77. package/src/netstring.js +5 -6
  78. package/src/node/buffer-line-transform.d.ts.map +1 -1
  79. package/src/node/buffer-line-transform.js +0 -1
  80. package/src/node/createBundles.d.ts +7 -3
  81. package/src/node/createBundles.d.ts.map +1 -1
  82. package/src/node/createBundles.js +31 -10
  83. package/src/node/fs-stream.d.ts +8 -5
  84. package/src/node/fs-stream.d.ts.map +1 -1
  85. package/src/node/fs-stream.js +120 -8
  86. package/src/node/read-json.d.ts +2 -0
  87. package/src/node/read-json.d.ts.map +1 -0
  88. package/src/node/read-json.js +16 -0
  89. package/src/node/shutdown.d.ts +6 -2
  90. package/src/node/shutdown.d.ts.map +1 -1
  91. package/src/node/shutdown.js +9 -3
  92. package/src/priority-senders.d.ts.map +1 -1
  93. package/src/priority-senders.js +1 -0
  94. package/src/queue.d.ts.map +1 -1
  95. package/src/queue.js +10 -2
  96. package/src/scratch.d.ts +32 -10
  97. package/src/scratch.d.ts.map +1 -1
  98. package/src/scratch.js +11 -0
  99. package/src/ses-utils.d.ts +14 -3
  100. package/src/ses-utils.d.ts.map +1 -1
  101. package/src/ses-utils.js +13 -15
  102. package/src/storage-test-utils.d.ts +4 -11
  103. package/src/storage-test-utils.d.ts.map +1 -1
  104. package/src/storage-test-utils.js +16 -14
  105. package/src/tagged.d.ts +18 -1
  106. package/src/testing-utils.d.ts +22 -1
  107. package/src/testing-utils.d.ts.map +1 -1
  108. package/src/testing-utils.js +131 -6
  109. package/src/tmpDir.d.ts.map +1 -1
  110. package/src/tmpDir.js +1 -1
  111. package/src/typeCheck.d.ts +4 -8
  112. package/src/typeCheck.d.ts.map +1 -1
  113. package/src/typeCheck.js +13 -6
  114. package/src/typeGuards.d.ts +5 -5
  115. package/src/typeGuards.d.ts.map +1 -1
  116. package/src/typeGuards.js +4 -5
  117. package/src/types-index.d.ts +1 -0
  118. package/src/types.d.ts +41 -14
  119. package/src/types.d.ts.map +1 -1
  120. package/src/types.js +161 -0
  121. package/src/upgrade-api.d.ts +2 -2
  122. package/src/upgrade-api.d.ts.map +1 -1
  123. package/src/upgrade-api.js +4 -3
  124. package/src/work-pool.d.ts.map +1 -1
  125. package/src/work-pool.js +9 -2
  126. package/vendor/anylogger.d.ts +98 -0
  127. package/vendor/anylogger.d.ts.map +1 -0
  128. package/vendor/anylogger.js +60 -0
  129. package/vendor/anylogger.ts +160 -0
  130. package/vendor/tsconfig.anylogger.json +15 -0
  131. package/exported.js +0 -2
  132. package/src/types.ts +0 -133
@@ -10,7 +10,7 @@ import { makeInaccessibleVal } from './inaccessible-val.js';
10
10
  /**
11
11
  * @import {WeakMapAPI} from '@endo/cache-map';
12
12
  * @import {EOnly} from '@endo/eventual-send';
13
- * @import {RemotableObject, Simplify} from '@endo/pass-style';
13
+ * @import {PassStyled, Simplify} from '@endo/pass-style';
14
14
  * @import {CapData, Passable, Marshal, MakeMarshalOptions} from '@endo/marshal';
15
15
  * @import {ERemote} from '../types.js';
16
16
  */
@@ -23,70 +23,63 @@ import { makeInaccessibleVal } from './inaccessible-val.js';
23
23
  * @typedef {Simplify<EOnly<Marshal<Slot>>>} EMarshaller
24
24
  */
25
25
 
26
- const { slotToWrapper, wrapperToSlot } = (() => {
27
- /** @typedef {'Remotable' | `Alleged: ${string}`} InterfaceSpec */
28
-
29
- /** @template [Slot=unknown] */
30
- class SlotWrapper {
31
- /** @type {Slot} */
32
- #slot;
33
-
34
- /** @type {InterfaceSpec} */
35
- [Symbol.toStringTag];
36
-
37
- /**
38
- * @param {Slot} slot
39
- * @param {string} [iface]
40
- */
41
- constructor(slot, iface) {
42
- if (iface == null || iface === 'Remotable') {
43
- iface = 'Remotable';
44
- } else if (!iface.startsWith('Alleged: ')) {
45
- iface = `Alleged: ${iface}`;
46
- }
47
- this.#slot = slot;
48
- this[Symbol.toStringTag] = /** @type {InterfaceSpec} */ (iface);
49
- }
26
+ /** @typedef {'Remotable' | `Alleged: ${string}`} InterfaceSpec */
27
+
28
+ /** @template [Slot=unknown] */
29
+ class SlotWrapper {
30
+ /** @type {Slot} */
31
+ #slot;
50
32
 
51
- /** @param {SlotWrapper} wrapper */
52
- static getSlot(wrapper) {
53
- return wrapper.#slot;
33
+ /** @type {InterfaceSpec} */
34
+ [Symbol.toStringTag] = 'Alleged: SlotWrapper';
35
+
36
+ /**
37
+ * @param {Slot} slot
38
+ * @param {string} [iface]
39
+ */
40
+ constructor(slot, iface) {
41
+ if (iface == null || iface === 'Remotable') {
42
+ iface = 'Remotable';
43
+ } else if (!iface.startsWith('Alleged: ')) {
44
+ iface = `Alleged: ${iface}`;
54
45
  }
46
+ this.#slot = slot;
47
+ this[Symbol.toStringTag] = /** @type {InterfaceSpec} */ (iface);
55
48
  }
56
- Object.defineProperties(SlotWrapper.prototype, {
57
- [PASS_STYLE]: { value: 'remotable' },
58
- [Symbol.toStringTag]: { value: 'Alleged: SlotWrapper' },
59
- });
60
- Reflect.deleteProperty(SlotWrapper.prototype, 'constructor');
61
- harden(SlotWrapper);
62
49
 
63
50
  /**
64
- * @type {<Slot = unknown>(
65
- * wrapper: SlotWrapper<Slot> & RemotableObject<InterfaceSpec>,
66
- * ) => Slot}
51
+ * @template [Slot=unknown]
52
+ * @param {SlotWrapper<Slot>} wrapper
53
+ * @returns {Slot}
67
54
  */
68
- const getSlot = SlotWrapper.getSlot;
69
-
70
- return {
71
- /**
72
- * @template [Slot=unknown]
73
- * @param {Slot} slot
74
- * @param {string} [iface]
75
- */
76
- slotToWrapper: (slot, iface) =>
77
- /** @type {SlotWrapper<Slot> & RemotableObject<InterfaceSpec>} */ (
78
- harden(new SlotWrapper(slot, iface))
79
- ),
80
-
81
- wrapperToSlot: getSlot,
82
- };
83
- })();
55
+ static getSlot(wrapper) {
56
+ return wrapper.#slot;
57
+ }
58
+ }
59
+ Object.defineProperties(SlotWrapper.prototype, {
60
+ [PASS_STYLE]: { value: 'remotable' },
61
+ [Symbol.toStringTag]: { value: 'Alleged: SlotWrapper' },
62
+ });
63
+ Reflect.deleteProperty(SlotWrapper.prototype, 'constructor');
64
+ harden(SlotWrapper);
84
65
 
85
66
  /**
86
- * @template [Slot=unknown] @typedef {ReturnType<typeof slotToWrapper<Slot>>}
87
- * SlotWrapper
67
+ * @template [Slot=unknown]
68
+ * @typedef {SlotWrapper<Slot> & PassStyled<'remotable', InterfaceSpec>} RemotableSlotWrapper
88
69
  */
89
70
 
71
+ /**
72
+ * @template [Slot=unknown]
73
+ * @param {Slot} slot
74
+ * @param {string} [iface]
75
+ */
76
+ const slotToWrapper = (slot, iface) =>
77
+ /** @type {RemotableSlotWrapper<Slot>} */ (
78
+ harden(new SlotWrapper(slot, iface))
79
+ );
80
+
81
+ const wrapperToSlot = SlotWrapper.getSlot;
82
+
90
83
  const capacityOfDefaultCache = 50;
91
84
 
92
85
  // TODO(https://github.com/Agoric/agoric-sdk/issues/12111)
@@ -160,7 +153,7 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
160
153
  marshalOptions,
161
154
  );
162
155
 
163
- /** @type {Map<Slot, SlotWrapper<NonNullable<Slot>>>} */
156
+ /** @type {Map<Slot, RemotableSlotWrapper<NonNullable<Slot>>>} */
164
157
  const currentSlotToWrapper = new Map();
165
158
 
166
159
  const convertWrapperToSlot = /** @type {typeof wrapperToSlot<Slot>} */ (
@@ -200,16 +193,16 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
200
193
  * marshaller to recreate the passable data.
201
194
  *
202
195
  * @param {Slot[]} slots
203
- * @param {(index: number) => SlotWrapper<NonNullable<Slot>>} getWrapper
196
+ * @param {(index: number) => RemotableSlotWrapper<NonNullable<Slot>>} getWrapper
204
197
  * @returns {Promise<(object | null)[]>}
205
198
  */
206
199
  const mapSlotsToCaps = async (slots, getWrapper) => {
207
200
  let hasRemoteCap = false;
208
201
  const { length } = slots;
209
- /** @type {(SlotWrapper<NonNullable<Slot>> | null | undefined)[]} */
210
- const slotWrapperMappedSlots = Array.from({ length });
202
+ /** @type {(RemotableSlotWrapper<NonNullable<Slot>> | null | undefined)[]} */
203
+ const slotWrapperMappedSlots = new Array(length).fill(undefined);
211
204
  /** @type {(object | null | undefined)[]} */
212
- const locallyResolvedCapSlots = Array.from({ length });
205
+ const locallyResolvedCapSlots = new Array(length).fill(undefined);
213
206
 
214
207
  for (const [index, slot] of slots.entries()) {
215
208
  if (slot === null) {
@@ -255,7 +248,7 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
255
248
  }
256
249
  }
257
250
 
258
- return harden(locallyResolvedCapSlots);
251
+ return harden(/** @type {(object | null)[]} */ (locallyResolvedCapSlots));
259
252
  };
260
253
 
261
254
  /**
@@ -270,14 +263,14 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
270
263
  */
271
264
  const mapCapsToSlots = async caps => {
272
265
  if (caps.length === 0) {
273
- return caps;
266
+ return /** @type {Slot[]} */ (caps);
274
267
  }
275
268
  let hasRemoteCap = false;
276
269
  const { length } = caps;
277
270
  /** @type {(Slot | null | undefined)[]} */
278
- const locallyResolvedSlots = Array.from({ length });
271
+ const locallyResolvedSlots = new Array(length).fill(undefined);
279
272
  /** @type {(object | null | undefined)[]} */
280
- const remoteCapsToResolve = Array.from({ length });
273
+ const remoteCapsToResolve = new Array(length).fill(undefined);
281
274
 
282
275
  for (const [index, cap] of caps.entries()) {
283
276
  if (cap === null) {
@@ -301,10 +294,11 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
301
294
 
302
295
  await null;
303
296
  if (hasRemoteCap) {
304
- const remotelyResolvedSlotsCapData =
305
- await E(marshaller).toCapData(remoteCapsToResolve);
297
+ const remotelyResolvedSlotsCapData = await E(marshaller).toCapData(
298
+ /** @type {Passable} */ (remoteCapsToResolve),
299
+ );
306
300
  try {
307
- /** @type {(SlotWrapper<Slot> | null | undefined)[]} */
301
+ /** @type {(RemotableSlotWrapper<Slot> | null | undefined)[]} */
308
302
  const slotWrapperMappedSlots = slotWrapperMarshaller.fromCapData(
309
303
  remotelyResolvedSlotsCapData,
310
304
  );
@@ -375,7 +369,9 @@ export const wrapRemoteMarshallerSendSlotsOnly = (
375
369
  */
376
370
  const toCapData = async val => {
377
371
  const capData = passThroughMarshaller.toCapData(val);
378
- const mappedSlots = await mapCapsToSlots(capData.slots);
372
+ const mappedSlots = await mapCapsToSlots(
373
+ /** @type {object[]} */ (capData.slots),
374
+ );
379
375
  return harden({ ...capData, slots: mappedSlots });
380
376
  };
381
377
 
package/src/metrics.d.ts CHANGED
@@ -152,6 +152,7 @@ export type QueueMetrics<QueueName extends string> = {
152
152
  */
153
153
  decLength: (queue: QueueName, delta?: number) => void;
154
154
  };
155
+ export type MetricType = (typeof MetricType)[keyof typeof MetricType];
155
156
  export type KernelMetricMeta = {
156
157
  key: string;
157
158
  name: string;
@@ -171,10 +172,6 @@ declare const HISTOGRAM_SECONDS_LATENCY_BOUNDARIES: number[];
171
172
  declare const HISTOGRAM_MS_LATENCY_BOUNDARIES: number[];
172
173
  import type { MetricAttributes } from '@opentelemetry/api';
173
174
  import type { Meter as OTelMeter } from '@opentelemetry/api';
174
- /**
175
- * MetricType
176
- */
177
- type MetricType = (typeof MetricType)[keyof typeof MetricType];
178
175
  declare namespace MetricType {
179
176
  let Counter: "counter";
180
177
  let Gauge: "gauge";
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["metrics.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAqH2C,MAAM,EAAE;;;;;;;;;;gCAQxC,CAAC,OAAO,iBAAiB,EAAE,MAAM,OAAO,iBAAiB,CAAC;;;;;;AAiB9D,iDAPI,MAAM,cACN,MAAM,GACJ,MAAM,CACd,iBAAiB,EACrB;IAAM,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAC5C,CAoBH;AA0BM,iCARe,SAAS,SAAlB,MAAQ,mDAElB;IAA0B,SAAS,EAA3B,SAAS;IACM,UAAU,EAAzB,MAAM;IACS,UAAU,EAAzB,MAAM;IACyB,OAAO;CAC9C,GAAU,YAAY,CAAC,SAAS,CAAC,CA8GnC;AAQD;;;;;;;;GAQG;AACH,qDAAqD;AACrD,uCADW,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,EAAE,CAkF/C;AAEF,qDAAqD;AACrD,0CADW,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,EAAE,CA4D/C;AAGF,iCAAiC;AACjC,mCADW,gBAAgB,EAAE,CAI1B;yBA3SmB,SAAS,SAAlB,MAAQ;;;;;iBAEP,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI;mBAE5C,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI;;;;;eAC5C,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI;;;;;eAE1C,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI;;;SAsI1C,MAAM;UACN,MAAM;;mBACO,MAAM;eAAS,MAAM;;iBAClC,MAAM;;gBAEN,UAAU;;AAnRxB,6DACuD;AApBvD;;;GAGG;AAEH,wDAaE;sCAjBqD,oBAAoB;wCAApB,oBAAoB;;;;kBAyRhE,CAAC,OAAO,UAAU,EAAE,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["metrics.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAqH2C,MAAM,EAAE;;;;;;;;;;gCAQrC,CAAC,OAAO,iBAAiB,EAAE,MAAM,OAAO,iBAAiB,CAAC;;;;;;AAiBjE,iDAPI,MAAM,cACN,MAAM,GACJ,MAAM,CACd,iBAAiB,EACrB;IAAM,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAC5C,CAoBH;AA0BM,iCARe,SAAS,SAAlB,MAAQ,mDAElB;IAA0B,SAAS,EAA3B,SAAS;IACM,UAAU,EAAzB,MAAM;IACS,UAAU,EAAzB,MAAM;IACyB,OAAO;CAC9C,GAAU,YAAY,CAAC,SAAS,CAAC,CAmHnC;AAQD;;;;;;;;GAQG;AACH,qDAAqD;AACrD,uCADW,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,EAAE,CAkF/C;AAEF,qDAAqD;AACrD,0CADW,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,EAAE,CA4D/C;AAGF,iCAAiC;AACjC,mCADW,gBAAgB,EAAE,CAI1B;yBAhTmB,SAAS,SAAlB,MAAQ;;;;;iBAEP,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI;mBAE5C,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI;;;;;eAC5C,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI;;;;;eAE1C,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI;;yBAoI1C,CAAC,OAAO,UAAU,EAAE,MAAM,OAAO,UAAU,CAAC;;SAO5C,MAAM;UACN,MAAM;;mBACO,MAAM;eAAS,MAAM;;iBAClC,MAAM;;gBAEN,UAAU;;AAxRxB,6DACuD;AApBvD;;;GAGG;AAEH,wDAaE;sCAjBqD,oBAAoB;wCAApB,oBAAoB"}
package/src/metrics.js CHANGED
@@ -123,7 +123,7 @@ export const BLOCK_HISTOGRAM_METRICS = /** @type {const} */ ({
123
123
  },
124
124
  });
125
125
 
126
- /** @enum {(typeof QueueMetricAspect)[keyof typeof QueueMetricAspect]} */
126
+ /** @typedef {(typeof QueueMetricAspect)[keyof typeof QueueMetricAspect]} QueueMetricAspect */
127
127
  export const QueueMetricAspect = /** @type {const} */ ({
128
128
  Length: 'length',
129
129
  IncrementCount: 'increments',
@@ -230,6 +230,11 @@ export const makeQueueMetrics = ({
230
230
 
231
231
  let ready = false;
232
232
  const lengths = /** @type {TotalMap<string, number>} */ (new Map());
233
+ /**
234
+ * @param {string} queueName
235
+ * @param {number} delta
236
+ * @param {boolean} [init]
237
+ */
233
238
  const nudge = (queueName, delta, init = false) => {
234
239
  if (!lengths.has(queueName)) {
235
240
  if (!init) console?.warn('Unknown queue', queueName);
@@ -295,7 +300,7 @@ export const makeQueueMetrics = ({
295
300
  };
296
301
 
297
302
  // All the kernel metrics we are prepared for.
298
- /** @enum {(typeof MetricType)[keyof typeof MetricType]} MetricType */
303
+ /** @typedef {(typeof MetricType)[keyof typeof MetricType]} MetricType */
299
304
  const MetricType = /** @type {const} */ ({
300
305
  Counter: 'counter',
301
306
  Gauge: 'gauge',
@@ -1,2 +1,3 @@
1
1
  export function getSpecifier(fileUrl: string): Promise<string>;
2
+ export function resolveToPath(specifier: string, baseURL: string): string;
2
3
  //# sourceMappingURL=module-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-utils.d.ts","sourceRoot":"","sources":["module-utils.js"],"names":[],"mappings":"AAaO,sCAHI,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAc3B"}
1
+ {"version":3,"file":"module-utils.d.ts","sourceRoot":"","sources":["module-utils.js"],"names":[],"mappings":"AAcO,sCAHI,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAe3B;AAWM,yCAJI,MAAM,WACN,MAAM,GACJ,MAAM,CAMlB"}
@@ -1,5 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { fileURLToPath } from 'node:url';
3
+ import { resolve as importMetaResolve } from 'import-meta-resolve';
3
4
  import { search } from '@endo/compartment-mapper';
4
5
  import { Fail } from '@endo/errors';
5
6
 
@@ -14,6 +15,7 @@ import { Fail } from '@endo/errors';
14
15
  export const getSpecifier = async fileUrl => {
15
16
  // eslint-disable-next-line no-new
16
17
  new URL(fileUrl); // validates fileUrl
18
+ /** @param {string} location */
17
19
  const read = async location => {
18
20
  const path = fileURLToPath(new URL(location, fileUrl));
19
21
  return readFile(path);
@@ -25,3 +27,18 @@ export const getSpecifier = async fileUrl => {
25
27
  return `${name}/${moduleSpecifier.replace(/^\.\//, '')}`;
26
28
  };
27
29
  harden(getSpecifier);
30
+
31
+ /**
32
+ * Given an import specifier and importer URL (usually import.meta.url), return
33
+ * a file system path corresponding with the specifier for the importer.
34
+ *
35
+ * @param {string} specifier
36
+ * @param {string} baseURL
37
+ * @returns {string}
38
+ */
39
+ export const resolveToPath = (specifier, baseURL) => {
40
+ const resolved = importMetaResolve(specifier, baseURL);
41
+ const resolvedURL = new URL(resolved);
42
+ return fileURLToPath(resolvedURL);
43
+ };
44
+ harden(resolveToPath);
@@ -1 +1 @@
1
- {"version":3,"file":"natural-sort.d.ts","sourceRoot":"","sources":["natural-sort.js"],"names":[],"mappings":"AAgDO,kCAJI,MAAM,KACN,MAAM,GACJ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAmCtB"}
1
+ {"version":3,"file":"natural-sort.d.ts","sourceRoot":"","sources":["natural-sort.js"],"names":[],"mappings":"AAoDO,kCAJI,MAAM,KACN,MAAM,GACJ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAmCtB"}
@@ -15,13 +15,17 @@ const compareNats = (a, b) => {
15
15
  (Number.isFinite(diff) && diff) ||
16
16
  (a === b ? 0 : Number(BigInt(a) - BigInt(b)) || a.length - b.length);
17
17
 
18
- // @ts-expect-error this call really does return -1 | 0 | 1
19
- return Math.sign(finiteDiff);
18
+ return /** @type {-1 | 0 | 1} */ (Math.sign(finiteDiff));
20
19
  };
21
20
 
22
21
  // TODO: compareByCodePoints
23
22
  // https://github.com/endojs/endo/pull/2008
24
- // eslint-disable-next-line no-nested-ternary
23
+
24
+ /**
25
+ * @param {string} a
26
+ * @param {string} b
27
+ * @returns {-1 | 0 | 1}
28
+ */
25
29
  const compareStrings = (a, b) => (a > b ? 1 : a < b ? -1 : 0);
26
30
 
27
31
  const rCaptureDigits = /([0-9]+)/;
@@ -20,5 +20,5 @@ export function decode(data: Buffer, optMaxChunkSize?: number): {
20
20
  * @returns {Transform}
21
21
  */
22
22
  export function netstringDecoderStream(optMaxChunkSize?: number): Transform;
23
- import { Transform } from 'stream';
23
+ import { Transform } from 'node:stream';
24
24
  //# sourceMappingURL=netstring.d.ts.map
@@ -1 +1 @@
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,oBAEN,MAAM,GACJ;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAmCpD;AAED;;;GAGG;AAEH,yDAJW,MAAM,GACJ,SAAS,CAqCrB;0BAxHyB,QAAQ"}
1
+ {"version":3,"file":"netstring.d.ts","sourceRoot":"","sources":["netstring.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH,6BAHW,MAAM,GACJ,MAAM,CAMlB;AAGD,oDAsBC;AAED;;;;;;GAMG;AACH,6BANW,MAAM,oBAEN,MAAM,GACJ;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAmCpD;AAED;;;GAGG;AAEH,yDAJW,MAAM,GACJ,SAAS,CAqCrB;0BAxHyB,aAAa"}
package/src/netstring.js CHANGED
@@ -1,8 +1,7 @@
1
- /* eslint-env node */
2
1
  import { Fail } from '@endo/errors';
3
2
 
4
3
  // adapted from 'netstring-stream', https://github.com/tlivings/netstring-stream/
5
- import { Transform } from 'stream';
4
+ import { Transform } from 'node:stream';
6
5
 
7
6
  const COLON = 58;
8
7
  const COMMA = 44;
@@ -21,11 +20,11 @@ export function encode(data) {
21
20
  export function netstringEncoderStream() {
22
21
  /**
23
22
  * @param {Buffer} chunk
24
- * @param {BufferEncoding} encoding
23
+ * @param {BufferEncoding} _encoding
25
24
  * @param {any} callback
26
25
  * @this {{ push: (b: Buffer) => void }}
27
26
  */
28
- function transform(chunk, encoding, callback) {
27
+ function transform(chunk, _encoding, callback) {
29
28
  if (!Buffer.isBuffer(chunk)) {
30
29
  throw Error('stream requires Buffers');
31
30
  }
@@ -93,11 +92,11 @@ export function netstringDecoderStream(optMaxChunkSize) {
93
92
  let buffered = Buffer.from('');
94
93
  /**
95
94
  * @param {Buffer} chunk
96
- * @param {BufferEncoding} encoding
95
+ * @param {BufferEncoding} _encoding
97
96
  * @param {any} callback
98
97
  * @this {{ push: (b: Buffer) => void }}
99
98
  */
100
- function transform(chunk, encoding, callback) {
99
+ function transform(chunk, _encoding, callback) {
101
100
  if (!Buffer.isBuffer(chunk)) {
102
101
  throw Error('stream requires Buffers');
103
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buffer-line-transform.d.ts","sourceRoot":"","sources":["buffer-line-transform.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;;;GAMG;AAEH;IACE;;;;;OAKG;IACH,sBAFW,gBAAgB,GAAG,0BAA0B,EAyBvD;IAhBC,uDAAmC;IACnC,2CAAmC;IAWnC,qBAA+B;IAE/B,uBAAuB;IACvB,SADW,MAAM,EAAE,CACF;IAGnB;;;;;OAKG;IACH,2BALW,GAAG,YACH,cAAc,GAAG,QAAQ,MACzB,iBAAiB,QAiD3B;IAeD,2BAA2B;IAC3B,iBADY,MAAM,QAOjB;CACF;;;;;;;;;;;;;0BA1HyB,aAAa;uCAIH,aAAa;sCADd,aAAa"}
1
+ {"version":3,"file":"buffer-line-transform.d.ts","sourceRoot":"","sources":["buffer-line-transform.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;;;GAMG;AAEH;IACE;;;;;OAKG;IACH,sBAFW,gBAAgB,GAAG,0BAA0B,EAyBvD;IAhBC,uDAAmC;IACnC,2CAAmC;IAWnC,qBAA+B;IAE/B,uBAAuB;IACvB,SADW,MAAM,EAAE,CACF;IAGnB;;;;;OAKG;IACH,2BALW,GAAG,YACH,cAAc,GAAG,QAAQ,MACzB,iBAAiB,QAiD3B;IAeD,2BAA2B;IAC3B,iBADY,MAAM,QAOjB;CACF;;;;;;;;;;;;;0BA1HyB,aAAa;uCAIH,aAAa;sCADd,aAAa"}
@@ -1,4 +1,3 @@
1
- /* eslint-env node */
2
1
  /* eslint-disable no-underscore-dangle */
3
2
 
4
3
  import { Transform } from 'node:stream';
@@ -1,4 +1,8 @@
1
- export function createBundlesFromAbsolute(sourceBundles: any): Promise<void>;
2
- export function createBundles(sourceBundles: any, dirname?: string): Promise<void>;
3
- export function extractProposalBundles(dirProposalBuilder: any, dirname?: string): Promise<void>;
1
+ export function createBundlesFromAbsolute(sourceBundles: Iterable<readonly [srcPath: string, bundlePath: string]>): Promise<void>;
2
+ export function createBundles(sourceBundles: Array<readonly [srcPath: string, bundlePath: string]>, dirname?: string): Promise<void>;
3
+ export function extractProposalBundles(dirProposalBuilder: Array<readonly [dir: string, proposalBuilder: ProposalBuilder]>, dirname?: string): Promise<void>;
4
+ export type ProposalBuilder = (powers: {
5
+ publishRef: (x: unknown) => unknown;
6
+ install: (src: string, bundleName?: string) => Promise<void>;
7
+ }) => Promise<unknown>;
4
8
  //# sourceMappingURL=createBundles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createBundles.d.ts","sourceRoot":"","sources":["createBundles.js"],"names":[],"mappings":"AAYO,6EAgCN;AAEM,mFAMN;AAEM,iGAkCN"}
1
+ {"version":3,"file":"createBundles.d.ts","sourceRoot":"","sources":["createBundles.js"],"names":[],"mappings":"AAUO,yDADK,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,iBAiCnE;AAMM,6CAHI,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,YACrD,MAAM,iBAWhB;AAYM,2DAHI,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC,YAC/D,MAAM,iBA0ChB;8BAjDY,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D,KAAK,OAAO,CAAC,OAAO,CAAC"}
@@ -1,15 +1,13 @@
1
- /* eslint-env node */
2
- // Use modules not prefixed with `node:` since some deploy scripts may
3
- // still be running in esm emulation
4
- import path from 'path';
5
- import { spawnSync } from 'child_process';
6
- import { createRequire } from 'module';
1
+ import path from 'node:path';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { createRequire } from 'node:module';
7
4
 
8
5
  import { Fail, q } from '@endo/errors';
9
6
 
10
7
  const BUNDLE_SOURCE_PROGRAM = 'bundle-source';
11
8
  const req = createRequire(import.meta.url);
12
9
 
10
+ /** @param {Iterable<readonly [srcPath: string, bundlePath: string]>} sourceBundles */
13
11
  export const createBundlesFromAbsolute = async sourceBundles => {
14
12
  const prog = req.resolve(`.bin/${BUNDLE_SOURCE_PROGRAM}`);
15
13
 
@@ -44,24 +42,47 @@ export const createBundlesFromAbsolute = async sourceBundles => {
44
42
  }
45
43
  };
46
44
 
45
+ /**
46
+ * @param {Array<readonly [srcPath: string, bundlePath: string]>} sourceBundles
47
+ * @param {string} [dirname]
48
+ */
47
49
  export const createBundles = async (sourceBundles, dirname = '.') => {
48
- const absBundleSources = sourceBundles.map(([srcPath, bundlePath]) => [
49
- req.resolve(srcPath, { paths: [dirname] }),
50
- path.resolve(dirname, bundlePath),
51
- ]);
50
+ const absBundleSources = sourceBundles.map(
51
+ ([srcPath, bundlePath]) =>
52
+ /** @type {readonly [string, string]} */ ([
53
+ req.resolve(srcPath, { paths: [dirname] }),
54
+ path.resolve(dirname, bundlePath),
55
+ ]),
56
+ );
52
57
  return createBundlesFromAbsolute(absBundleSources);
53
58
  };
54
59
 
60
+ /**
61
+ * @typedef {(powers: {
62
+ * publishRef: (x: unknown) => unknown,
63
+ * install: (src: string, bundleName?: string) => Promise<void>,
64
+ * }) => Promise<unknown>} ProposalBuilder
65
+ */
66
+ /**
67
+ * @param {Array<readonly [dir: string, proposalBuilder: ProposalBuilder]>} dirProposalBuilder
68
+ * @param {string} [dirname]
69
+ */
55
70
  export const extractProposalBundles = async (
56
71
  dirProposalBuilder,
57
72
  dirname = '.',
58
73
  ) => {
74
+ /** @type {Map<string, string>} */
59
75
  const toBundle = new Map();
60
76
 
61
77
  await Promise.all(
62
78
  dirProposalBuilder.map(async ([dir, proposalBuilder]) => {
63
79
  const home = path.resolve(dirname, dir);
80
+ /** @param {unknown} x */
64
81
  const publishRef = x => x;
82
+ /**
83
+ * @param {string} src
84
+ * @param {string} [bundleName]
85
+ */
65
86
  const install = async (src, bundleName) => {
66
87
  if (bundleName) {
67
88
  const bundlePath = path.resolve(home, bundleName);
@@ -1,11 +1,14 @@
1
- export function fsStreamReady(stream: ReadStream | WriteStream | Socket): Promise<void>;
1
+ export function fsStreamReady(stream: StreamLike): Promise<void>;
2
2
  export function makeFsStreamWriter(filePath: string | undefined | null): Promise<{
3
- write: (data: any) => Promise<void>;
3
+ write: (data: string | Uint8Array) => Promise<void>;
4
4
  flush: () => Promise<void>;
5
5
  close: () => Promise<void>;
6
6
  } | undefined>;
7
+ export type StreamLike = ReadStream | WriteStream | Socket;
8
+ export type EventName = "drain" | "ready";
9
+ export type WriteBufferIsFull = boolean;
7
10
  export type FsStreamWriter = NonNullable<Awaited<ReturnType<typeof makeFsStreamWriter>>>;
8
- import type { ReadStream } from 'fs';
9
- import type { WriteStream } from 'fs';
10
- import type { Socket } from 'net';
11
+ import type { ReadStream } from 'node:fs';
12
+ import type { WriteStream } from 'node:fs';
13
+ import type { Socket } from 'node:net';
11
14
  //# sourceMappingURL=fs-stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fs-stream.d.ts","sourceRoot":"","sources":["fs-stream.js"],"names":[],"mappings":"AAcO,sCAHI,UAAU,GAAG,WAAW,GAAG,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC,CAgCtB;AAIG,6CADK,MAAM,GAAG,SAAS,GAAG,IAAI;;;;eAsEpC;6BAvEa,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;gCAzC5C,IAAI;iCACH,IAAI;4BACT,KAAK"}
1
+ {"version":3,"file":"fs-stream.d.ts","sourceRoot":"","sources":["fs-stream.js"],"names":[],"mappings":"AAiBO,sCAHI,UAAU,GACR,OAAO,CAAC,IAAI,CAAC,CAgCtB;AA6GG,6CADK,MAAM,GAAG,SAAS,GAAG,IAAI;kBA0CvB,MAAM,GAAG,UAAU;;;eAgChC;yBA5Na,UAAU,GAAG,WAAW,GAAG,MAAM;wBACjC,OAAO,GAAG,OAAO;gCACjB,OAAO;6BA+IP,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;gCArJ/B,SAAS;iCAAT,SAAS;4BAC1B,UAAU"}