@agoric/swingset-liveslots 0.10.3-u14.0 → 0.10.3-u16.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 (60) hide show
  1. package/README.md +2 -0
  2. package/package.json +27 -19
  3. package/src/cache.js +2 -1
  4. package/src/capdata.js +0 -1
  5. package/src/collectionManager.js +154 -72
  6. package/src/index.js +4 -1
  7. package/src/liveslots.js +52 -81
  8. package/src/message.js +4 -4
  9. package/src/types.js +8 -2
  10. package/src/vatDataTypes.d.ts +271 -0
  11. package/src/vatDataTypes.js +2 -0
  12. package/src/vatstore-iterators.js +2 -0
  13. package/src/virtualObjectManager.js +189 -70
  14. package/src/virtualReferences.js +51 -0
  15. package/src/watchedPromises.js +61 -16
  16. package/test/{test-baggage.js → baggage.test.js} +1 -2
  17. package/test/{test-cache.js → cache.test.js} +0 -1
  18. package/test/{test-collection-schema-refcount.js → collection-schema-refcount.test.js} +1 -2
  19. package/test/{test-collection-upgrade.js → collection-upgrade.test.js} +1 -3
  20. package/test/{test-collections.js → collections.test.js} +117 -14
  21. package/test/{test-dropped-collection-weakrefs.js → dropped-collection-weakrefs.test.js} +1 -2
  22. package/test/{test-durabilityChecks.js → durabilityChecks.test.js} +3 -3
  23. package/test/{test-facetiousness.js → facetiousness.test.js} +1 -2
  24. package/test/gc-and-finalize.js +30 -1
  25. package/test/gc-helpers.js +2 -3
  26. package/test/{test-gc-sensitivity.js → gc-sensitivity.test.js} +2 -2
  27. package/test/{test-handled-promises.js → handled-promises.test.js} +5 -7
  28. package/test/{test-initial-vrefs.js → initial-vrefs.test.js} +2 -3
  29. package/test/liveslots-helpers.js +6 -6
  30. package/test/{test-liveslots-mock-gc.js → liveslots-mock-gc.test.js} +2 -2
  31. package/test/{test-liveslots-real-gc.js → liveslots-real-gc.test.js} +44 -35
  32. package/test/{test-liveslots.js → liveslots.test.js} +13 -14
  33. package/test/mock-gc.js +1 -0
  34. package/test/storeGC/{test-lifecycle.js → lifecycle.test.js} +2 -2
  35. package/test/storeGC/{test-refcount-management.js → refcount-management.test.js} +1 -2
  36. package/test/storeGC/{test-scalar-store-kind.js → scalar-store-kind.test.js} +0 -1
  37. package/test/storeGC/{test-weak-key.js → weak-key.test.js} +1 -2
  38. package/test/util.js +2 -2
  39. package/test/vat-util.js +1 -1
  40. package/test/virtual-objects/{test-cease-recognition.js → cease-recognition.test.js} +2 -2
  41. package/test/virtual-objects/{test-cross-facet.js → cross-facet.test.js} +5 -4
  42. package/test/virtual-objects/{test-empty-data.js → empty-data.test.js} +1 -2
  43. package/test/virtual-objects/{test-facets.js → facets.test.js} +1 -2
  44. package/test/virtual-objects/{test-kind-changes.js → kind-changes.test.js} +2 -2
  45. package/test/virtual-objects/{test-reachable-vrefs.js → reachable-vrefs.test.js} +2 -2
  46. package/test/virtual-objects/{test-rep-tostring.js → rep-tostring.test.js} +2 -3
  47. package/test/virtual-objects/{test-retain-remotable.js → retain-remotable.test.js} +25 -24
  48. package/test/virtual-objects/{test-state-shape.js → state-shape.test.js} +2 -2
  49. package/test/virtual-objects/{test-virtualObjectGC.js → virtualObjectGC.test.js} +2 -2
  50. package/test/virtual-objects/{test-virtualObjectManager.js → virtualObjectManager.test.js} +6 -2
  51. package/test/virtual-objects/{test-vo-real-gc.js → vo-real-gc.test.js} +8 -8
  52. package/test/virtual-objects/{test-weakcollections-vref-handling.js → weakcollections-vref-handling.test.js} +1 -2
  53. package/test/{test-vo-test-harness.js → vo-test-harness.test.js} +0 -1
  54. package/test/{test-vpid-liveslots.js → vpid-liveslots.test.js} +4 -5
  55. package/test/waitUntilQuiescent.js +2 -1
  56. package/tools/fakeVirtualSupport.js +41 -24
  57. package/tools/prepare-test-env.js +13 -0
  58. package/tools/setup-vat-data.js +62 -0
  59. package/CHANGELOG.md +0 -93
  60. package/test/kmarshal.js +0 -79
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # SwingSet Liveslots
2
+
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@agoric/swingset-liveslots",
3
- "version": "0.10.3-u14.0",
3
+ "version": "0.10.3-u16.0",
4
4
  "description": "SwingSet ocap support layer",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "engines": {
8
- "node": ">=14.15.0"
8
+ "node": "^18.12 || ^20.9"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
@@ -13,26 +13,28 @@
13
13
  "test:xs": "exit 0",
14
14
  "lint-fix": "yarn lint:eslint --fix",
15
15
  "lint": "run-s --continue-on-error lint:*",
16
- "lint:types": "tsc -p jsconfig.json",
16
+ "lint:types": "tsc",
17
17
  "lint:eslint": "eslint ."
18
18
  },
19
19
  "dependencies": {
20
- "@agoric/assert": "^0.6.1-u11wf.0",
21
- "@agoric/internal": "^0.4.0-u14.0",
22
- "@agoric/store": "^0.9.3-u14.0",
23
- "@agoric/vat-data": "^0.5.3-u14.0",
24
- "@endo/eventual-send": "0.17.2",
25
- "@endo/exo": "0.2.2",
26
- "@endo/far": "0.2.18",
27
- "@endo/init": "0.5.56",
28
- "@endo/marshal": "0.8.5",
29
- "@endo/nat": "4.1.27",
30
- "@endo/pass-style": "0.1.3",
31
- "@endo/patterns": "0.2.2",
32
- "@endo/promise-kit": "0.2.56"
20
+ "@agoric/assert": "^0.6.1-u16.0",
21
+ "@agoric/internal": "^0.4.0-u16.0",
22
+ "@agoric/store": "^0.9.3-u16.0",
23
+ "@endo/env-options": "^1.1.4",
24
+ "@endo/errors": "^1.2.2",
25
+ "@endo/eventual-send": "^1.2.2",
26
+ "@endo/exo": "^1.5.0",
27
+ "@endo/far": "^1.1.2",
28
+ "@endo/init": "^1.1.2",
29
+ "@endo/marshal": "^1.5.0",
30
+ "@endo/nat": "^5.0.7",
31
+ "@endo/pass-style": "^1.4.0",
32
+ "@endo/patterns": "^1.4.0",
33
+ "@endo/promise-kit": "^1.1.2"
33
34
  },
34
35
  "devDependencies": {
35
- "ava": "^5.2.0"
36
+ "@agoric/kmarshal": "^0.1.1-u16.0",
37
+ "ava": "^5.3.0"
36
38
  },
37
39
  "files": [
38
40
  "src/**/*.js",
@@ -53,7 +55,10 @@
53
55
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
54
56
  "ava": {
55
57
  "files": [
56
- "test/**/test-*.js"
58
+ "test/**/*.test.*"
59
+ ],
60
+ "require": [
61
+ "@endo/init/debug.js"
57
62
  ],
58
63
  "timeout": "20m",
59
64
  "workerThreads": false
@@ -61,5 +66,8 @@
61
66
  "publishConfig": {
62
67
  "access": "public"
63
68
  },
64
- "gitHead": "b3a6f3374cb3bddab39fc6d6f426429cae6c29c6"
69
+ "typeCoverage": {
70
+ "atLeast": 75.29
71
+ },
72
+ "gitHead": "bbdf652c3f413381cb352a8a360db1063974fafd"
65
73
  }
package/src/cache.js CHANGED
@@ -4,7 +4,7 @@ import { Fail } from '@agoric/assert';
4
4
  * @template V
5
5
  * @callback CacheGet
6
6
  * @param {string} key
7
- * @returns {V}
7
+ * @returns {V | undefined}
8
8
  */
9
9
 
10
10
  /**
@@ -62,6 +62,7 @@ import { Fail } from '@agoric/assert';
62
62
  export function makeCache(readBacking, writeBacking, deleteBacking) {
63
63
  const stash = new Map();
64
64
  const dirtyKeys = new Set();
65
+ /** @type {Cache<V>} */
65
66
  const cache = {
66
67
  get: key => {
67
68
  assert.typeof(key, 'string');
package/src/capdata.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Fail } from '@agoric/assert';
2
2
 
3
- /* eslint-disable jsdoc/require-returns-check */
4
3
  /**
5
4
  * Assert function to ensure that something expected to be a capdata object
6
5
  * actually is. A capdata object should have a .body property that's a string
@@ -15,7 +15,10 @@ import {
15
15
  makeCopySet,
16
16
  makeCopyMap,
17
17
  getRankCover,
18
+ getCopyMapEntries,
19
+ getCopySetKeys,
18
20
  } from '@endo/patterns';
21
+ import { isCopyMap, isCopySet } from '@agoric/store';
19
22
  import { makeBaseRef, parseVatSlot } from './parseVatSlots.js';
20
23
  import {
21
24
  enumerateKeysStartEnd,
@@ -23,6 +26,10 @@ import {
23
26
  } from './vatstore-iterators.js';
24
27
  import { makeCache } from './cache.js';
25
28
 
29
+ /**
30
+ * @import {ToCapData, FromCapData} from '@endo/marshal';
31
+ */
32
+
26
33
  // XXX TODO: The following key length limit was put in place due to limitations
27
34
  // in LMDB. With the move away from LMDB, it is no longer relevant, but I'm
28
35
  // leaving it in place for the time being as a general defensive measure against
@@ -47,6 +54,14 @@ function throwNotDurable(value, slotIndex, serializedValue) {
47
54
  Fail`value is not durable: ${value} at slot ${q(slotIndex)} of ${serializedValue.body}`;
48
55
  }
49
56
 
57
+ function failNotFound(key, label) {
58
+ Fail`key ${key} not found in collection ${q(label)}`;
59
+ }
60
+
61
+ function failNotIterable(value) {
62
+ Fail`provided data source is not iterable: ${value}`;
63
+ }
64
+
50
65
  function prefixc(collectionID, dbEntryKey) {
51
66
  return `vc.${collectionID}.${dbEntryKey}`;
52
67
  }
@@ -101,8 +116,8 @@ function makeSchemaCache(syscall, unserialize) {
101
116
  * @param {(val: any) => string | undefined} convertValToSlot
102
117
  * @param {*} convertSlotToVal
103
118
  * @param {*} registerValue
104
- * @param {import('@endo/marshal').ToCapData<string>} serialize
105
- * @param {import('@endo/marshal').FromCapData<string>} unserialize
119
+ * @param {ToCapData<string>} serialize
120
+ * @param {FromCapData<string>} unserialize
106
121
  * @param {(capDatas: any) => void} assertAcceptableSyscallCapdataSize
107
122
  */
108
123
  export function makeCollectionManager(
@@ -244,7 +259,11 @@ export function makeCollectionManager(
244
259
  const kindInfo = storeKindInfo[kindName];
245
260
  kindInfo || Fail`unknown collection kind ${kindName}`;
246
261
  const { hasWeakKeys, durable } = kindInfo;
247
- const getSchema = () => schemaCache.get(collectionID);
262
+ const getSchema = () => {
263
+ const result = schemaCache.get(collectionID);
264
+ assert(result !== undefined);
265
+ return result;
266
+ };
248
267
  const dbKeyPrefix = `vc.${collectionID}.`;
249
268
  let currentGenerationNumber = 0;
250
269
 
@@ -336,24 +355,26 @@ export function makeCollectionManager(
336
355
  const { keyShape } = getSchema();
337
356
  if (!matches(key, keyShape)) {
338
357
  return false;
339
- }
340
- if (passStyleOf(key) === 'remotable') {
358
+ } else if (passStyleOf(key) === 'remotable') {
341
359
  return getOrdinal(key) !== undefined;
342
360
  } else {
343
361
  return syscall.vatstoreGet(keyToDBKey(key)) !== undefined;
344
362
  }
345
363
  }
346
364
 
365
+ function mustGet(key, label) {
366
+ if (passStyleOf(key) === 'remotable' && getOrdinal(key) === undefined) {
367
+ failNotFound(key, label);
368
+ }
369
+ const dbKey = keyToDBKey(key);
370
+ const result = syscall.vatstoreGet(dbKey) || failNotFound(key, label);
371
+ return { dbKey, result };
372
+ }
373
+
347
374
  function get(key) {
348
375
  const { keyShape, label } = getSchema();
349
376
  mustMatch(key, keyShape, makeInvalidKeyTypeMsg(label));
350
- if (passStyleOf(key) === 'remotable' && getOrdinal(key) === undefined) {
351
- throw Fail`key ${key} not found in collection ${q(label)}`;
352
- }
353
- const result = syscall.vatstoreGet(keyToDBKey(key));
354
- if (!result) {
355
- throw Fail`key ${key} not found in collection ${q(label)}`;
356
- }
377
+ const { result } = mustGet(key, label);
357
378
  return unserializeValue(JSON.parse(result));
358
379
  }
359
380
 
@@ -377,11 +398,11 @@ export function makeCollectionManager(
377
398
  currentGenerationNumber += 1;
378
399
  assertAcceptableSyscallCapdataSize([serializedValue]);
379
400
  if (durable) {
380
- serializedValue.slots.forEach((vref, slotIndex) => {
401
+ for (const [slotIndex, vref] of serializedValue.slots.entries()) {
381
402
  if (!vrm.isDurable(vref)) {
382
403
  throwNotDurable(value, slotIndex, serializedValue);
383
404
  }
384
- });
405
+ }
385
406
  }
386
407
  if (passStyleOf(key) === 'remotable') {
387
408
  /** @type {string} */
@@ -397,7 +418,9 @@ export function makeCollectionManager(
397
418
  vrm.addReachableVref(vref);
398
419
  }
399
420
  }
400
- serializedValue.slots.forEach(vrm.addReachableVref);
421
+ for (const vref of serializedValue.slots) {
422
+ vrm.addReachableVref(vref);
423
+ }
401
424
  syscall.vatstoreSet(keyToDBKey(key), JSON.stringify(serializedValue));
402
425
  updateEntryCount(1);
403
426
  };
@@ -416,15 +439,13 @@ export function makeCollectionManager(
416
439
  const after = serializeValue(harden(value));
417
440
  assertAcceptableSyscallCapdataSize([after]);
418
441
  if (durable) {
419
- after.slots.forEach((vref, i) => {
442
+ for (const [i, vref] of after.slots.entries()) {
420
443
  if (!vrm.isDurable(vref)) {
421
444
  throwNotDurable(value, i, after);
422
445
  }
423
- });
446
+ }
424
447
  }
425
- const dbKey = keyToDBKey(key);
426
- const rawBefore = syscall.vatstoreGet(dbKey);
427
- rawBefore || Fail`key ${key} not found in collection ${q(label)}`;
448
+ const { dbKey, result: rawBefore } = mustGet(key, label);
428
449
  const before = JSON.parse(rawBefore);
429
450
  vrm.updateReferenceCounts(before.slots, after.slots);
430
451
  syscall.vatstoreSet(dbKey, JSON.stringify(after));
@@ -433,12 +454,7 @@ export function makeCollectionManager(
433
454
  function deleteInternal(key) {
434
455
  const { keyShape, label } = getSchema();
435
456
  mustMatch(key, keyShape, makeInvalidKeyTypeMsg(label));
436
- if (passStyleOf(key) === 'remotable' && getOrdinal(key) === undefined) {
437
- throw Fail`key ${key} not found in collection ${q(label)}`;
438
- }
439
- const dbKey = keyToDBKey(key);
440
- const rawValue = syscall.vatstoreGet(dbKey);
441
- rawValue || Fail`key ${key} not found in collection ${q(label)}`;
457
+ const { dbKey, result: rawValue } = mustGet(key, label);
442
458
  const value = JSON.parse(rawValue);
443
459
  const doMoreGC1 = value.slots.map(vrm.removeReachableVref).some(b => b);
444
460
  syscall.vatstoreDelete(dbKey);
@@ -474,18 +490,15 @@ export function makeCollectionManager(
474
490
  const end = prefix(coverEnd); // exclusive
475
491
 
476
492
  const generationAtStart = currentGenerationNumber;
477
- function checkGen() {
478
- if (generationAtStart !== currentGenerationNumber) {
479
- Fail`keys in store cannot be added to during iteration`;
480
- }
481
- }
493
+ const checkGen = () =>
494
+ currentGenerationNumber === generationAtStart ||
495
+ Fail`keys in store cannot be added to during iteration`;
482
496
 
483
497
  const needToMatchKey = !matchAny(keyPatt);
484
498
  const needToMatchValue = !matchAny(valuePatt);
485
499
 
486
- // we always get the dbKey, but we might not need to unserialize it
500
+ // we might not need to unserialize the dbKey or get the dbValue
487
501
  const needKeys = yieldKeys || needToMatchKey;
488
- // we don't always need the dbValue
489
502
  const needValues = yieldValues || needToMatchValue;
490
503
 
491
504
  /**
@@ -513,7 +526,7 @@ export function makeCollectionManager(
513
526
  yield [yieldKeys ? key : undefined, yieldValues ? value : undefined];
514
527
  }
515
528
  }
516
-
529
+ harden(iter);
517
530
  return iter();
518
531
  }
519
532
 
@@ -523,6 +536,7 @@ export function makeCollectionManager(
523
536
  yield entry[0];
524
537
  }
525
538
  }
539
+ harden(iter);
526
540
  return iter();
527
541
  }
528
542
 
@@ -587,6 +601,7 @@ export function makeCollectionManager(
587
601
  yield entry[1];
588
602
  }
589
603
  }
604
+ harden(iter);
590
605
  return iter();
591
606
  }
592
607
 
@@ -596,12 +611,13 @@ export function makeCollectionManager(
596
611
  yield entry;
597
612
  }
598
613
  }
614
+ harden(iter);
599
615
  return iter();
600
616
  }
601
617
 
602
618
  function countEntries(keyPatt, valuePatt) {
603
619
  let count = 0;
604
- // eslint-disable-next-line no-use-before-define, no-unused-vars
620
+ // eslint-disable-next-line no-unused-vars
605
621
  for (const k of keys(keyPatt, valuePatt)) {
606
622
  count += 1;
607
623
  }
@@ -624,6 +640,34 @@ export function makeCollectionManager(
624
640
  const snapshotMap = (keyPatt, valuePatt) =>
625
641
  makeCopyMap(entries(keyPatt, valuePatt));
626
642
 
643
+ const addAllToSet = elems => {
644
+ if (typeof elems[Symbol.iterator] !== 'function') {
645
+ elems =
646
+ Object.isFrozen(elems) && isCopySet(elems)
647
+ ? getCopySetKeys(elems)
648
+ : failNotIterable(elems);
649
+ }
650
+ for (const elem of elems) {
651
+ addToSet(elem);
652
+ }
653
+ };
654
+
655
+ const addAllToMap = mapEntries => {
656
+ if (typeof mapEntries[Symbol.iterator] !== 'function') {
657
+ mapEntries =
658
+ Object.isFrozen(mapEntries) && isCopyMap(mapEntries)
659
+ ? getCopyMapEntries(mapEntries)
660
+ : failNotIterable(mapEntries);
661
+ }
662
+ for (const [key, value] of mapEntries) {
663
+ if (has(key)) {
664
+ set(key, value);
665
+ } else {
666
+ doInit(key, value, true);
667
+ }
668
+ }
669
+ };
670
+
627
671
  return {
628
672
  has,
629
673
  get,
@@ -635,6 +679,8 @@ export function makeCollectionManager(
635
679
  keys,
636
680
  values,
637
681
  entries,
682
+ addAllToSet,
683
+ addAllToMap,
638
684
  snapshotSet,
639
685
  snapshotMap,
640
686
  sizeInternal,
@@ -647,12 +693,23 @@ export function makeCollectionManager(
647
693
  const hasWeakKeys = storeKindInfo[kindName].hasWeakKeys;
648
694
  const raw = summonCollectionInternal(initial, collectionID, kindName);
649
695
 
650
- const { has, get, init, addToSet, set, delete: del } = raw;
696
+ const {
697
+ has,
698
+ get,
699
+ init,
700
+ addToSet,
701
+ addAllToMap,
702
+ addAllToSet,
703
+ set,
704
+ delete: del,
705
+ } = raw;
651
706
  const weakMethods = {
652
707
  has,
653
708
  get,
654
709
  init,
655
710
  addToSet,
711
+ addAllToSet,
712
+ addAllToMap,
656
713
  set,
657
714
  delete: del,
658
715
  };
@@ -700,7 +757,9 @@ export function makeCollectionManager(
700
757
  const collection = summonCollectionInternal(false, collectionID, kindName);
701
758
 
702
759
  let doMoreGC = collection.clearInternal(true);
703
- const { schemataCapData } = schemaCache.get(collectionID);
760
+ const record = schemaCache.get(collectionID);
761
+ assert(record !== undefined);
762
+ const { schemataCapData } = record;
704
763
  doMoreGC =
705
764
  schemataCapData.slots.map(vrm.removeReachableVref).some(b => b) ||
706
765
  doMoreGC;
@@ -747,13 +806,15 @@ export function makeCollectionManager(
747
806
  }
748
807
  const schemataCapData = serialize(harden(schemata));
749
808
  if (isDurable) {
750
- schemataCapData.slots.forEach((vref, slotIndex) => {
809
+ for (const [slotIndex, vref] of schemataCapData.slots.entries()) {
751
810
  if (!vrm.isDurable(vref)) {
752
811
  throwNotDurable(vref, slotIndex, schemataCapData);
753
812
  }
754
- });
813
+ }
814
+ }
815
+ for (const vref of schemataCapData.slots) {
816
+ vrm.addReachableVref(vref);
755
817
  }
756
- schemataCapData.slots.forEach(vrm.addReachableVref);
757
818
 
758
819
  schemaCache.set(
759
820
  collectionID,
@@ -764,12 +825,48 @@ export function makeCollectionManager(
764
825
  }
765
826
 
766
827
  function collectionToMapStore(collection) {
767
- const { snapshotSet: _, snapshotMap, ...rest } = collection;
768
- return Far('mapStore', { snapshot: snapshotMap, ...rest });
828
+ const {
829
+ has,
830
+ get,
831
+ init,
832
+ set,
833
+ delete: del,
834
+ addAllToMap,
835
+ keys,
836
+ values,
837
+ entries,
838
+ snapshotMap,
839
+ getSize,
840
+ clear,
841
+ } = collection;
842
+ const mapStore = {
843
+ has,
844
+ get,
845
+ init,
846
+ set,
847
+ delete: del,
848
+ addAll: addAllToMap,
849
+ keys,
850
+ values,
851
+ entries,
852
+ snapshot: snapshotMap,
853
+ getSize,
854
+ clear,
855
+ };
856
+ return Far('mapStore', mapStore);
769
857
  }
770
858
 
771
859
  function collectionToWeakMapStore(collection) {
772
- return Far('weakMapStore', collection);
860
+ const { has, get, init, set, delete: del, addAllToMap } = collection;
861
+ const weakMapStore = {
862
+ has,
863
+ get,
864
+ init,
865
+ set,
866
+ delete: del,
867
+ addAll: addAllToMap,
868
+ };
869
+ return Far('weakMapStore', weakMapStore);
773
870
  }
774
871
 
775
872
  function collectionToSetStore(collection) {
@@ -777,50 +874,35 @@ export function makeCollectionManager(
777
874
  has,
778
875
  addToSet,
779
876
  delete: del,
877
+ addAllToSet,
780
878
  keys,
781
- getSize,
782
879
  snapshotSet,
880
+ getSize,
783
881
  clear,
784
882
  } = collection;
785
- function* entries(patt) {
786
- for (const k of keys(patt)) {
787
- yield [k, k];
788
- }
789
- }
790
- function addAll(elems) {
791
- for (const elem of elems) {
792
- addToSet(elem, null);
793
- }
794
- }
795
883
 
796
884
  const setStore = {
797
885
  has,
798
886
  add: addToSet,
799
- addAll,
800
887
  delete: del,
888
+ addAll: addAllToSet,
801
889
  keys: patt => keys(patt),
802
890
  values: patt => keys(patt),
803
- entries,
804
- getSize: patt => getSize(patt),
805
891
  snapshot: snapshotSet,
892
+ getSize: patt => getSize(patt),
806
893
  clear,
807
894
  };
808
895
  return Far('setStore', setStore);
809
896
  }
810
897
 
811
898
  function collectionToWeakSetStore(collection) {
812
- const { has, addToSet, delete: del } = collection;
813
- function addAll(elems) {
814
- for (const elem of elems) {
815
- addToSet(elem);
816
- }
817
- }
899
+ const { has, addToSet, delete: del, addAllToSet } = collection;
818
900
 
819
901
  const weakSetStore = {
820
902
  has,
821
903
  add: addToSet,
822
- addAll,
823
904
  delete: del,
905
+ addAll: addAllToSet,
824
906
  };
825
907
  return Far('weakSetStore', weakSetStore);
826
908
  }
@@ -829,7 +911,7 @@ export function makeCollectionManager(
829
911
  * Produce a big map.
830
912
  *
831
913
  * @template K,V
832
- * @param {string} [label='map'] - diagnostic label for the store
914
+ * @param {string} [label] - diagnostic label for the store
833
915
  * @param {StoreOptions} [options]
834
916
  * @returns {MapStore<K,V>}
835
917
  */
@@ -873,7 +955,7 @@ export function makeCollectionManager(
873
955
  * Produce a weak big map.
874
956
  *
875
957
  * @template K,V
876
- * @param {string} [label='weakMap'] - diagnostic label for the store
958
+ * @param {string} [label] - diagnostic label for the store
877
959
  * @param {StoreOptions} [options]
878
960
  * @returns {WeakMapStore<K,V>}
879
961
  */
@@ -902,7 +984,7 @@ export function makeCollectionManager(
902
984
  * Produce a big set.
903
985
  *
904
986
  * @template K
905
- * @param {string} [label='set'] - diagnostic label for the store
987
+ * @param {string} [label] - diagnostic label for the store
906
988
  * @param {StoreOptions} [options]
907
989
  * @returns {SetStore<K>}
908
990
  */
@@ -929,7 +1011,7 @@ export function makeCollectionManager(
929
1011
  * Produce a weak big set.
930
1012
  *
931
1013
  * @template K
932
- * @param {string} [label='weakSet'] - diagnostic label for the store
1014
+ * @param {string} [label] - diagnostic label for the store
933
1015
  * @param {StoreOptions} [options]
934
1016
  * @returns {WeakSetStore<K>}
935
1017
  */
@@ -1006,7 +1088,7 @@ export function makeCollectionManager(
1006
1088
  * remotables.
1007
1089
  *
1008
1090
  * @template K,V
1009
- * @param {string} [label='map'] - diagnostic label for the store
1091
+ * @param {string} [label] - diagnostic label for the store
1010
1092
  * @param {StoreOptions} [options]
1011
1093
  * @returns {MapStore<K,V>}
1012
1094
  */
@@ -1018,7 +1100,7 @@ export function makeCollectionManager(
1018
1100
  * primitives, or remotables.
1019
1101
  *
1020
1102
  * @template K,V
1021
- * @param {string} [label='weakMap'] - diagnostic label for the store
1103
+ * @param {string} [label] - diagnostic label for the store
1022
1104
  * @param {StoreOptions} [options]
1023
1105
  * @returns {WeakMapStore<K,V>}
1024
1106
  */
@@ -1030,7 +1112,7 @@ export function makeCollectionManager(
1030
1112
  * remotables.
1031
1113
  *
1032
1114
  * @template K
1033
- * @param {string} [label='set'] - diagnostic label for the store
1115
+ * @param {string} [label] - diagnostic label for the store
1034
1116
  * @param {StoreOptions} [options]
1035
1117
  * @returns {SetStore<K>}
1036
1118
  */
@@ -1042,7 +1124,7 @@ export function makeCollectionManager(
1042
1124
  * primitives, or remotables.
1043
1125
  *
1044
1126
  * @template K
1045
- * @param {string} [label='weakSet'] - diagnostic label for the store
1127
+ * @param {string} [label] - diagnostic label for the store
1046
1128
  * @param {StoreOptions} [options]
1047
1129
  * @returns {WeakSetStore<K>}
1048
1130
  */
package/src/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ /// <reference types="@agoric/store/exported.js" />
2
+
3
+ /* eslint-disable import/export -- types files have no named runtime exports */
1
4
  export { makeLiveSlots, makeMarshaller } from './liveslots.js';
2
5
 
3
6
  export {
@@ -8,5 +11,5 @@ export {
8
11
  insistVatSyscallResult,
9
12
  } from './message.js';
10
13
 
11
- // eslint-disable-next-line import/export -- no named exports
12
14
  export * from './types.js';
15
+ export * from './vatDataTypes.js';