@agoric/swingset-liveslots 0.10.3-dev-7244c71.0 → 0.10.3-getting-started-dev-26244e8.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 (51) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/package.json +17 -23
  3. package/src/collectionManager.js +66 -135
  4. package/src/index.js +1 -2
  5. package/src/liveslots.js +74 -47
  6. package/src/virtualObjectManager.js +14 -56
  7. package/src/virtualReferences.js +0 -51
  8. package/test/gc-helpers.js +1 -1
  9. package/test/kmarshal.js +79 -0
  10. package/test/liveslots-helpers.js +6 -6
  11. package/test/mock-gc.js +0 -1
  12. package/test/storeGC/test-lifecycle.js +2 -2
  13. package/test/storeGC/test-refcount-management.js +2 -1
  14. package/test/storeGC/test-scalar-store-kind.js +1 -0
  15. package/test/storeGC/test-weak-key.js +2 -1
  16. package/test/test-baggage.js +2 -1
  17. package/test/test-cache.js +1 -0
  18. package/test/test-collection-schema-refcount.js +2 -1
  19. package/test/test-collection-upgrade.js +3 -1
  20. package/test/test-collections.js +14 -117
  21. package/test/test-dropped-collection-weakrefs.js +2 -1
  22. package/test/test-durabilityChecks.js +3 -2
  23. package/test/test-facetiousness.js +2 -1
  24. package/test/test-gc-sensitivity.js +2 -2
  25. package/test/test-handled-promises.js +7 -5
  26. package/test/test-initial-vrefs.js +3 -2
  27. package/test/test-liveslots-mock-gc.js +2 -2
  28. package/test/test-liveslots-real-gc.js +2 -2
  29. package/test/test-liveslots.js +14 -13
  30. package/test/test-vo-test-harness.js +1 -0
  31. package/test/test-vpid-liveslots.js +4 -3
  32. package/test/util.js +2 -2
  33. package/test/vat-util.js +1 -1
  34. package/test/virtual-objects/test-cease-recognition.js +2 -2
  35. package/test/virtual-objects/test-cross-facet.js +2 -1
  36. package/test/virtual-objects/test-empty-data.js +2 -1
  37. package/test/virtual-objects/test-facets.js +2 -1
  38. package/test/virtual-objects/test-kind-changes.js +2 -2
  39. package/test/virtual-objects/test-reachable-vrefs.js +2 -2
  40. package/test/virtual-objects/test-rep-tostring.js +3 -2
  41. package/test/virtual-objects/test-retain-remotable.js +1 -1
  42. package/test/virtual-objects/test-state-shape.js +2 -2
  43. package/test/virtual-objects/test-virtualObjectGC.js +2 -2
  44. package/test/virtual-objects/test-virtualObjectManager.js +2 -6
  45. package/test/virtual-objects/test-vo-real-gc.js +2 -2
  46. package/test/virtual-objects/test-weakcollections-vref-handling.js +2 -1
  47. package/tools/fakeVirtualSupport.js +19 -37
  48. package/src/vatDataTypes.d.ts +0 -230
  49. package/src/vatDataTypes.js +0 -2
  50. package/tools/prepare-test-env.js +0 -13
  51. package/tools/setup-vat-data.js +0 -54
package/CHANGELOG.md ADDED
@@ -0,0 +1,77 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ### [0.10.3-u12.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swingset-liveslots@0.10.3-u11wf.0...@agoric/swingset-liveslots@0.10.3-u12.0) (2023-11-10)
7
+
8
+ **Note:** Version bump only for package @agoric/swingset-liveslots
9
+
10
+
11
+
12
+
13
+
14
+ ### [0.10.3-u11wf.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swingset-liveslots@0.10.3-u11.0...@agoric/swingset-liveslots@0.10.3-u11wf.0) (2023-09-23)
15
+
16
+ **Note:** Version bump only for package @agoric/swingset-liveslots
17
+
18
+
19
+
20
+
21
+
22
+ ### [0.10.3-u11.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swingset-liveslots@0.10.2...@agoric/swingset-liveslots@0.10.3-u11.0) (2023-08-24)
23
+
24
+ **Note:** Version bump only for package @agoric/swingset-liveslots
25
+
26
+
27
+
28
+
29
+
30
+ ### [0.10.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/swingset-liveslots@0.10.1...@agoric/swingset-liveslots@0.10.2) (2023-06-02)
31
+
32
+ **Note:** Version bump only for package @agoric/swingset-liveslots
33
+
34
+
35
+
36
+
37
+
38
+ ### [0.10.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/swingset-liveslots@0.10.0...@agoric/swingset-liveslots@0.10.1) (2023-05-24)
39
+
40
+ **Note:** Version bump only for package @agoric/swingset-liveslots
41
+
42
+
43
+
44
+
45
+
46
+ ## 0.10.0 (2023-05-19)
47
+
48
+
49
+ ### Features
50
+
51
+ * better diagnostic for failed reanimate ([c0c9c94](https://github.com/Agoric/agoric-sdk/commit/c0c9c9433648d520aa2bcdbadbbfe877831567c7)), closes [Error#1](https://github.com/Agoric/Error/issues/1)
52
+ * **swingset-liveslots:** label virtual instances ([4191eb6](https://github.com/Agoric/agoric-sdk/commit/4191eb62d0e64048c3c715e5f71a53a747267350))
53
+ * add APIs for tracking/debugging undesired object retention (aka "leaks") ([0a7221b](https://github.com/Agoric/agoric-sdk/commit/0a7221b3c04f3b2894c30346fa2ea6fb0130c046)), closes [#7318](https://github.com/Agoric/agoric-sdk/issues/7318)
54
+ * move liveslots and specific tests to a new package ([0921a89](https://github.com/Agoric/agoric-sdk/commit/0921a8903b72cfefdf05a5906bcfb826cac1cc2f)), closes [#6596](https://github.com/Agoric/agoric-sdk/issues/6596)
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * **liveslots:** allow new Kind upgrade to add new facets ([6bc6694](https://github.com/Agoric/agoric-sdk/commit/6bc6694968e6d2f529e7c91ec1efb11fdff2e2d3)), closes [#7437](https://github.com/Agoric/agoric-sdk/issues/7437)
60
+ * **liveslots:** retain WeakRefs to voAware collections ([3935723](https://github.com/Agoric/agoric-sdk/commit/393572396781afd17691e1366abeba696228a24e)), closes [#7371](https://github.com/Agoric/agoric-sdk/issues/7371)
61
+ * **swingset-liveslots:** prevent VOM infinite loop if `globalThis.WeakSet` etc are replaced ([d7b35e2](https://github.com/Agoric/agoric-sdk/commit/d7b35e28715a715ef510f2717e0040fa017caab4))
62
+ * adding dup entries to virtual sets is OK ([c81d367](https://github.com/Agoric/agoric-sdk/commit/c81d3677d8085eb4debe5baa416816ff94d582cf)), closes [#7234](https://github.com/Agoric/agoric-sdk/issues/7234)
63
+ * code updates for new marshal ([292f971](https://github.com/Agoric/agoric-sdk/commit/292f971769db69e61782f96638c2f687c3f95ac2))
64
+ * **SwingSet:** Don't send stopVat during upgrade ([5cc47d2](https://github.com/Agoric/agoric-sdk/commit/5cc47d2d8892690f8c1653630b41dd64cc42d73b)), closes [#6650](https://github.com/Agoric/agoric-sdk/issues/6650)
65
+ * **types:** return value of deleter ([457f576](https://github.com/Agoric/agoric-sdk/commit/457f5765b9fc0a693e6eb5e6644ddf4af3b791db))
66
+ * move many type definitions from swingset to liveslots ([727143d](https://github.com/Agoric/agoric-sdk/commit/727143d5562498e2e3013c34304f229b4dd11da5))
67
+ * move rejectAllPromises from stopVat to kernels-side upgradeVat ([d79623f](https://github.com/Agoric/agoric-sdk/commit/d79623f3fb3b87653dba1c71eb1153711c9d962c)), closes [#6694](https://github.com/Agoric/agoric-sdk/issues/6694)
68
+ * Move upgrade-time abandonExports responsibility into the kernel ([66ac657](https://github.com/Agoric/agoric-sdk/commit/66ac657d51d3d1be61ee4a6e9a621a664086ee57)), closes [#6696](https://github.com/Agoric/agoric-sdk/issues/6696)
69
+ * only the exo api change ([5cf3bf1](https://github.com/Agoric/agoric-sdk/commit/5cf3bf10a71dd02094365a66e87032e5d17d004f))
70
+ * **liveslots:** use Map for vrefStatus, not object ([1456e2a](https://github.com/Agoric/agoric-sdk/commit/1456e2ae006bb1c702383cedda5e5c407968840e))
71
+ * **swingset:** move a bunch of types from swingset to swingset-liveslots ([14f9bb0](https://github.com/Agoric/agoric-sdk/commit/14f9bb00c82c085dc647f23b6c90b26e6a0a6dfd))
72
+ * **swingset-liveslots:** Move promise rejection responsibility into the kernel ([dd29ff3](https://github.com/Agoric/agoric-sdk/commit/dd29ff35c5dc72efbbf7087849182aa7f04b2bb1)), closes [#6694](https://github.com/Agoric/agoric-sdk/issues/6694)
73
+ * add 'v'/'d' virtual/durable annotations to vrefs ([b859e92](https://github.com/Agoric/agoric-sdk/commit/b859e92fe041415d6e34250f672a10ad927aa33e)), closes [#6695](https://github.com/Agoric/agoric-sdk/issues/6695)
74
+ * update description of "FINALIZED" state ([809f366](https://github.com/Agoric/agoric-sdk/commit/809f3660c083467e76deb1487015cb24205a801d))
75
+ * without assertKeyPattern ([#7035](https://github.com/Agoric/agoric-sdk/issues/7035)) ([c9fcd7f](https://github.com/Agoric/agoric-sdk/commit/c9fcd7f82757732435cd96f3377e4fbfb6586ce7))
76
+ * **swingset-liveslots:** copy helper files to new liveslots package ([be7229f](https://github.com/Agoric/agoric-sdk/commit/be7229f7217c1ecc523069a57945a372f4a1e00e))
77
+ * **swingset-liveslots:** update imports of helper files ([0b4b38a](https://github.com/Agoric/agoric-sdk/commit/0b4b38a1f9efbb3e1e860172b0b802548d18ae2e))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/swingset-liveslots",
3
- "version": "0.10.3-dev-7244c71.0+7244c71",
3
+ "version": "0.10.3-getting-started-dev-26244e8.0+26244e8",
4
4
  "description": "SwingSet ocap support layer",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -13,26 +13,26 @@
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",
16
+ "lint:types": "tsc -p jsconfig.json",
17
17
  "lint:eslint": "eslint ."
18
18
  },
19
19
  "dependencies": {
20
- "@agoric/assert": "0.6.1-dev-7244c71.0+7244c71",
21
- "@agoric/internal": "0.3.3-dev-7244c71.0+7244c71",
22
- "@agoric/store": "0.9.3-dev-7244c71.0+7244c71",
23
- "@endo/eventual-send": "^0.17.5",
24
- "@endo/exo": "^0.2.5",
25
- "@endo/far": "^0.2.21",
26
- "@endo/init": "^0.5.59",
27
- "@endo/marshal": "^0.8.8",
28
- "@endo/nat": "^4.1.30",
29
- "@endo/pass-style": "^0.1.6",
30
- "@endo/patterns": "^0.2.5",
31
- "@endo/promise-kit": "^0.2.59"
20
+ "@agoric/assert": "0.6.1-getting-started-dev-26244e8.0+26244e8",
21
+ "@agoric/internal": "0.4.0-getting-started-dev-26244e8.0+26244e8",
22
+ "@agoric/store": "0.9.3-getting-started-dev-26244e8.0+26244e8",
23
+ "@agoric/vat-data": "0.5.3-getting-started-dev-26244e8.0+26244e8",
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"
32
33
  },
33
34
  "devDependencies": {
34
- "@agoric/kmarshal": "0.1.1-dev-7244c71.0+7244c71",
35
- "ava": "^5.3.0"
35
+ "ava": "^5.2.0"
36
36
  },
37
37
  "files": [
38
38
  "src/**/*.js",
@@ -55,17 +55,11 @@
55
55
  "files": [
56
56
  "test/**/test-*.js"
57
57
  ],
58
- "require": [
59
- "@endo/init/debug.js"
60
- ],
61
58
  "timeout": "20m",
62
59
  "workerThreads": false
63
60
  },
64
61
  "publishConfig": {
65
62
  "access": "public"
66
63
  },
67
- "typeCoverage": {
68
- "atLeast": 71.48
69
- },
70
- "gitHead": "7244c710962174a886903cf039c0fbe18874287f"
64
+ "gitHead": "26244e821f1a83cd5868f0c7d54aa480c8c17e5e"
71
65
  }
@@ -15,10 +15,7 @@ import {
15
15
  makeCopySet,
16
16
  makeCopyMap,
17
17
  getRankCover,
18
- getCopyMapEntries,
19
- getCopySetKeys,
20
18
  } from '@endo/patterns';
21
- import { isCopyMap, isCopySet } from '@agoric/store';
22
19
  import { makeBaseRef, parseVatSlot } from './parseVatSlots.js';
23
20
  import {
24
21
  enumerateKeysStartEnd,
@@ -50,14 +47,6 @@ function throwNotDurable(value, slotIndex, serializedValue) {
50
47
  Fail`value is not durable: ${value} at slot ${q(slotIndex)} of ${serializedValue.body}`;
51
48
  }
52
49
 
53
- function failNotFound(key, label) {
54
- Fail`key ${key} not found in collection ${q(label)}`;
55
- }
56
-
57
- function failNotIterable(value) {
58
- Fail`provided data source is not iterable: ${value}`;
59
- }
60
-
61
50
  function prefixc(collectionID, dbEntryKey) {
62
51
  return `vc.${collectionID}.${dbEntryKey}`;
63
52
  }
@@ -347,26 +336,24 @@ export function makeCollectionManager(
347
336
  const { keyShape } = getSchema();
348
337
  if (!matches(key, keyShape)) {
349
338
  return false;
350
- } else if (passStyleOf(key) === 'remotable') {
339
+ }
340
+ if (passStyleOf(key) === 'remotable') {
351
341
  return getOrdinal(key) !== undefined;
352
342
  } else {
353
343
  return syscall.vatstoreGet(keyToDBKey(key)) !== undefined;
354
344
  }
355
345
  }
356
346
 
357
- function mustGet(key, label) {
358
- if (passStyleOf(key) === 'remotable' && getOrdinal(key) === undefined) {
359
- failNotFound(key, label);
360
- }
361
- const dbKey = keyToDBKey(key);
362
- const result = syscall.vatstoreGet(dbKey) || failNotFound(key, label);
363
- return { dbKey, result };
364
- }
365
-
366
347
  function get(key) {
367
348
  const { keyShape, label } = getSchema();
368
349
  mustMatch(key, keyShape, makeInvalidKeyTypeMsg(label));
369
- const { result } = mustGet(key, 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
+ }
370
357
  return unserializeValue(JSON.parse(result));
371
358
  }
372
359
 
@@ -390,11 +377,11 @@ export function makeCollectionManager(
390
377
  currentGenerationNumber += 1;
391
378
  assertAcceptableSyscallCapdataSize([serializedValue]);
392
379
  if (durable) {
393
- for (const [slotIndex, vref] of serializedValue.slots.entries()) {
380
+ serializedValue.slots.forEach((vref, slotIndex) => {
394
381
  if (!vrm.isDurable(vref)) {
395
382
  throwNotDurable(value, slotIndex, serializedValue);
396
383
  }
397
- }
384
+ });
398
385
  }
399
386
  if (passStyleOf(key) === 'remotable') {
400
387
  /** @type {string} */
@@ -410,9 +397,7 @@ export function makeCollectionManager(
410
397
  vrm.addReachableVref(vref);
411
398
  }
412
399
  }
413
- for (const vref of serializedValue.slots) {
414
- vrm.addReachableVref(vref);
415
- }
400
+ serializedValue.slots.forEach(vrm.addReachableVref);
416
401
  syscall.vatstoreSet(keyToDBKey(key), JSON.stringify(serializedValue));
417
402
  updateEntryCount(1);
418
403
  };
@@ -431,13 +416,15 @@ export function makeCollectionManager(
431
416
  const after = serializeValue(harden(value));
432
417
  assertAcceptableSyscallCapdataSize([after]);
433
418
  if (durable) {
434
- for (const [i, vref] of after.slots.entries()) {
419
+ after.slots.forEach((vref, i) => {
435
420
  if (!vrm.isDurable(vref)) {
436
421
  throwNotDurable(value, i, after);
437
422
  }
438
- }
423
+ });
439
424
  }
440
- const { dbKey, result: rawBefore } = mustGet(key, label);
425
+ const dbKey = keyToDBKey(key);
426
+ const rawBefore = syscall.vatstoreGet(dbKey);
427
+ rawBefore || Fail`key ${key} not found in collection ${q(label)}`;
441
428
  const before = JSON.parse(rawBefore);
442
429
  vrm.updateReferenceCounts(before.slots, after.slots);
443
430
  syscall.vatstoreSet(dbKey, JSON.stringify(after));
@@ -446,7 +433,12 @@ export function makeCollectionManager(
446
433
  function deleteInternal(key) {
447
434
  const { keyShape, label } = getSchema();
448
435
  mustMatch(key, keyShape, makeInvalidKeyTypeMsg(label));
449
- const { dbKey, result: rawValue } = mustGet(key, 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)}`;
450
442
  const value = JSON.parse(rawValue);
451
443
  const doMoreGC1 = value.slots.map(vrm.removeReachableVref).some(b => b);
452
444
  syscall.vatstoreDelete(dbKey);
@@ -482,15 +474,18 @@ export function makeCollectionManager(
482
474
  const end = prefix(coverEnd); // exclusive
483
475
 
484
476
  const generationAtStart = currentGenerationNumber;
485
- const checkGen = () =>
486
- currentGenerationNumber === generationAtStart ||
487
- Fail`keys in store cannot be added to during iteration`;
477
+ function checkGen() {
478
+ if (generationAtStart !== currentGenerationNumber) {
479
+ Fail`keys in store cannot be added to during iteration`;
480
+ }
481
+ }
488
482
 
489
483
  const needToMatchKey = !matchAny(keyPatt);
490
484
  const needToMatchValue = !matchAny(valuePatt);
491
485
 
492
- // we might not need to unserialize the dbKey or get the dbValue
486
+ // we always get the dbKey, but we might not need to unserialize it
493
487
  const needKeys = yieldKeys || needToMatchKey;
488
+ // we don't always need the dbValue
494
489
  const needValues = yieldValues || needToMatchValue;
495
490
 
496
491
  /**
@@ -629,34 +624,6 @@ export function makeCollectionManager(
629
624
  const snapshotMap = (keyPatt, valuePatt) =>
630
625
  makeCopyMap(entries(keyPatt, valuePatt));
631
626
 
632
- const addAllToSet = elems => {
633
- if (typeof elems[Symbol.iterator] !== 'function') {
634
- elems =
635
- Object.isFrozen(elems) && isCopySet(elems)
636
- ? getCopySetKeys(elems)
637
- : failNotIterable(elems);
638
- }
639
- for (const elem of elems) {
640
- addToSet(elem);
641
- }
642
- };
643
-
644
- const addAllToMap = mapEntries => {
645
- if (typeof mapEntries[Symbol.iterator] !== 'function') {
646
- mapEntries =
647
- Object.isFrozen(mapEntries) && isCopyMap(mapEntries)
648
- ? getCopyMapEntries(mapEntries)
649
- : failNotIterable(mapEntries);
650
- }
651
- for (const [key, value] of mapEntries) {
652
- if (has(key)) {
653
- set(key, value);
654
- } else {
655
- doInit(key, value, true);
656
- }
657
- }
658
- };
659
-
660
627
  return {
661
628
  has,
662
629
  get,
@@ -668,8 +635,6 @@ export function makeCollectionManager(
668
635
  keys,
669
636
  values,
670
637
  entries,
671
- addAllToSet,
672
- addAllToMap,
673
638
  snapshotSet,
674
639
  snapshotMap,
675
640
  sizeInternal,
@@ -682,23 +647,12 @@ export function makeCollectionManager(
682
647
  const hasWeakKeys = storeKindInfo[kindName].hasWeakKeys;
683
648
  const raw = summonCollectionInternal(initial, collectionID, kindName);
684
649
 
685
- const {
686
- has,
687
- get,
688
- init,
689
- addToSet,
690
- addAllToMap,
691
- addAllToSet,
692
- set,
693
- delete: del,
694
- } = raw;
650
+ const { has, get, init, addToSet, set, delete: del } = raw;
695
651
  const weakMethods = {
696
652
  has,
697
653
  get,
698
654
  init,
699
655
  addToSet,
700
- addAllToSet,
701
- addAllToMap,
702
656
  set,
703
657
  delete: del,
704
658
  };
@@ -793,15 +747,13 @@ export function makeCollectionManager(
793
747
  }
794
748
  const schemataCapData = serialize(harden(schemata));
795
749
  if (isDurable) {
796
- for (const [slotIndex, vref] of schemataCapData.slots.entries()) {
750
+ schemataCapData.slots.forEach((vref, slotIndex) => {
797
751
  if (!vrm.isDurable(vref)) {
798
752
  throwNotDurable(vref, slotIndex, schemataCapData);
799
753
  }
800
- }
801
- }
802
- for (const vref of schemataCapData.slots) {
803
- vrm.addReachableVref(vref);
754
+ });
804
755
  }
756
+ schemataCapData.slots.forEach(vrm.addReachableVref);
805
757
 
806
758
  schemaCache.set(
807
759
  collectionID,
@@ -812,48 +764,12 @@ export function makeCollectionManager(
812
764
  }
813
765
 
814
766
  function collectionToMapStore(collection) {
815
- const {
816
- has,
817
- get,
818
- init,
819
- set,
820
- delete: del,
821
- addAllToMap,
822
- keys,
823
- values,
824
- entries,
825
- snapshotMap,
826
- getSize,
827
- clear,
828
- } = collection;
829
- const mapStore = {
830
- has,
831
- get,
832
- init,
833
- set,
834
- delete: del,
835
- addAll: addAllToMap,
836
- keys,
837
- values,
838
- entries,
839
- snapshot: snapshotMap,
840
- getSize,
841
- clear,
842
- };
843
- return Far('mapStore', mapStore);
767
+ const { snapshotSet: _, snapshotMap, ...rest } = collection;
768
+ return Far('mapStore', { snapshot: snapshotMap, ...rest });
844
769
  }
845
770
 
846
771
  function collectionToWeakMapStore(collection) {
847
- const { has, get, init, set, delete: del, addAllToMap } = collection;
848
- const weakMapStore = {
849
- has,
850
- get,
851
- init,
852
- set,
853
- delete: del,
854
- addAll: addAllToMap,
855
- };
856
- return Far('weakMapStore', weakMapStore);
772
+ return Far('weakMapStore', collection);
857
773
  }
858
774
 
859
775
  function collectionToSetStore(collection) {
@@ -861,35 +777,50 @@ export function makeCollectionManager(
861
777
  has,
862
778
  addToSet,
863
779
  delete: del,
864
- addAllToSet,
865
780
  keys,
866
- snapshotSet,
867
781
  getSize,
782
+ snapshotSet,
868
783
  clear,
869
784
  } = 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
+ }
870
795
 
871
796
  const setStore = {
872
797
  has,
873
798
  add: addToSet,
799
+ addAll,
874
800
  delete: del,
875
- addAll: addAllToSet,
876
801
  keys: patt => keys(patt),
877
802
  values: patt => keys(patt),
878
- snapshot: snapshotSet,
803
+ entries,
879
804
  getSize: patt => getSize(patt),
805
+ snapshot: snapshotSet,
880
806
  clear,
881
807
  };
882
808
  return Far('setStore', setStore);
883
809
  }
884
810
 
885
811
  function collectionToWeakSetStore(collection) {
886
- const { has, addToSet, delete: del, addAllToSet } = collection;
812
+ const { has, addToSet, delete: del } = collection;
813
+ function addAll(elems) {
814
+ for (const elem of elems) {
815
+ addToSet(elem);
816
+ }
817
+ }
887
818
 
888
819
  const weakSetStore = {
889
820
  has,
890
821
  add: addToSet,
822
+ addAll,
891
823
  delete: del,
892
- addAll: addAllToSet,
893
824
  };
894
825
  return Far('weakSetStore', weakSetStore);
895
826
  }
@@ -898,7 +829,7 @@ export function makeCollectionManager(
898
829
  * Produce a big map.
899
830
  *
900
831
  * @template K,V
901
- * @param {string} [label] - diagnostic label for the store
832
+ * @param {string} [label='map'] - diagnostic label for the store
902
833
  * @param {StoreOptions} [options]
903
834
  * @returns {MapStore<K,V>}
904
835
  */
@@ -942,7 +873,7 @@ export function makeCollectionManager(
942
873
  * Produce a weak big map.
943
874
  *
944
875
  * @template K,V
945
- * @param {string} [label] - diagnostic label for the store
876
+ * @param {string} [label='weakMap'] - diagnostic label for the store
946
877
  * @param {StoreOptions} [options]
947
878
  * @returns {WeakMapStore<K,V>}
948
879
  */
@@ -971,7 +902,7 @@ export function makeCollectionManager(
971
902
  * Produce a big set.
972
903
  *
973
904
  * @template K
974
- * @param {string} [label] - diagnostic label for the store
905
+ * @param {string} [label='set'] - diagnostic label for the store
975
906
  * @param {StoreOptions} [options]
976
907
  * @returns {SetStore<K>}
977
908
  */
@@ -998,7 +929,7 @@ export function makeCollectionManager(
998
929
  * Produce a weak big set.
999
930
  *
1000
931
  * @template K
1001
- * @param {string} [label] - diagnostic label for the store
932
+ * @param {string} [label='weakSet'] - diagnostic label for the store
1002
933
  * @param {StoreOptions} [options]
1003
934
  * @returns {WeakSetStore<K>}
1004
935
  */
@@ -1075,7 +1006,7 @@ export function makeCollectionManager(
1075
1006
  * remotables.
1076
1007
  *
1077
1008
  * @template K,V
1078
- * @param {string} [label] - diagnostic label for the store
1009
+ * @param {string} [label='map'] - diagnostic label for the store
1079
1010
  * @param {StoreOptions} [options]
1080
1011
  * @returns {MapStore<K,V>}
1081
1012
  */
@@ -1087,7 +1018,7 @@ export function makeCollectionManager(
1087
1018
  * primitives, or remotables.
1088
1019
  *
1089
1020
  * @template K,V
1090
- * @param {string} [label] - diagnostic label for the store
1021
+ * @param {string} [label='weakMap'] - diagnostic label for the store
1091
1022
  * @param {StoreOptions} [options]
1092
1023
  * @returns {WeakMapStore<K,V>}
1093
1024
  */
@@ -1099,7 +1030,7 @@ export function makeCollectionManager(
1099
1030
  * remotables.
1100
1031
  *
1101
1032
  * @template K
1102
- * @param {string} [label] - diagnostic label for the store
1033
+ * @param {string} [label='set'] - diagnostic label for the store
1103
1034
  * @param {StoreOptions} [options]
1104
1035
  * @returns {SetStore<K>}
1105
1036
  */
@@ -1111,7 +1042,7 @@ export function makeCollectionManager(
1111
1042
  * primitives, or remotables.
1112
1043
  *
1113
1044
  * @template K
1114
- * @param {string} [label] - diagnostic label for the store
1045
+ * @param {string} [label='weakSet'] - diagnostic label for the store
1115
1046
  * @param {StoreOptions} [options]
1116
1047
  * @returns {WeakSetStore<K>}
1117
1048
  */
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/export -- types files have no named runtime exports */
2
1
  export { makeLiveSlots, makeMarshaller } from './liveslots.js';
3
2
 
4
3
  export {
@@ -9,5 +8,5 @@ export {
9
8
  insistVatSyscallResult,
10
9
  } from './message.js';
11
10
 
11
+ // eslint-disable-next-line import/export -- no named exports
12
12
  export * from './types.js';
13
- export * from './vatDataTypes.js';