@agoric/store 0.9.3-dev-2da8e5c.0.2da8e5c → 0.9.3-dev-3294e0c.0.3294e0c

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/store",
3
- "version": "0.9.3-dev-2da8e5c.0.2da8e5c",
3
+ "version": "0.9.3-dev-3294e0c.0.3294e0c",
4
4
  "description": "Wrapper for JavaScript map",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -62,5 +62,5 @@
62
62
  "typeCoverage": {
63
63
  "atLeast": 89.98
64
64
  },
65
- "gitHead": "2da8e5ce15f4ccc3b25a87ea32954aec37eae2cb"
65
+ "gitHead": "3294e0c1e81f8d145c6b57624d080908b935f524"
66
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"legacyWeakMap.d.ts","sourceRoot":"","sources":["legacyWeakMap.js"],"names":[],"mappings":"AAcO,kCALgB,CAAC,SAAV,OAAQ,EACT,CAAC,QACH,MAAM,GACJ,cAAc,CAAC,EAAE,CAAC,CAAC,CAkC/B;mCA9CgC,aAAa"}
1
+ {"version":3,"file":"legacyWeakMap.d.ts","sourceRoot":"","sources":["legacyWeakMap.js"],"names":[],"mappings":"AAcO,kCALgB,CAAC,SAAV,OAAQ,EACT,CAAC,QACH,MAAM,GACJ,cAAc,CAAC,EAAE,CAAC,CAAC,CA4C/B;mCAxDgC,aAAa"}
@@ -13,7 +13,17 @@ import { Fail, q } from '@endo/errors';
13
13
  * @returns {LegacyWeakMap<K, V>}
14
14
  */
15
15
  export const makeLegacyWeakMap = (tag = 'key') => {
16
- /** @type {WeakMap<K & object, V>} */
16
+ /**
17
+ * The keys are always objects, so back onto a `WeakMap` keyed by `K & object`
18
+ * while operating on the public key type `K` via this bivariant view.
19
+ *
20
+ * @type {{
21
+ * has(key: any): boolean,
22
+ * get(key: any): V | undefined,
23
+ * set(key: any, value: V): unknown,
24
+ * delete(key: any): boolean,
25
+ * }}
26
+ */
17
27
  const wm = new WeakMap();
18
28
  const assertKeyDoesNotExist = key =>
19
29
  !wm.has(key) || Fail`${q(tag)} already registered: ${key}`;
@@ -1,5 +1,18 @@
1
- export function makeWeakMapStoreMethods<K extends Key, V extends Passable>(jsmap: WeakMap<K & object, V>, assertKVOkToAdd: (k: K, v: V) => void, assertKVOkToSet: (k: K, v: V) => void, assertKeyOkToDelete?: (k: K) => void, keyName?: string): WeakMapStore<K, V>;
1
+ export function makeWeakMapStoreMethods<K extends Key, V extends Passable>(jsmap: WeakMapStoreBacking<V>, assertKVOkToAdd: (k: K, v: V) => void, assertKVOkToSet: (k: K, v: V) => void, assertKeyOkToDelete?: (k: K) => void, keyName?: string): WeakMapStore<K, V>;
2
2
  export function makeScalarWeakMapStore<K, V>(tag?: string, { longLived, keyShape, valueShape }?: StoreOptions): RemotableObject & WeakMapStore<K, V>;
3
+ /**
4
+ * A minimal view of the backing collection keyed in terms of the public key
5
+ * type `K`. The scalar weak map only ever stores object (remotable) keys, so it
6
+ * backs onto a `WeakMap` keyed by `K & object`; the non-weak scalar map store
7
+ * reuses these methods over a `Map<K, V>`. The bivariant `any` key lets both
8
+ * satisfy this view while the methods operate on `K` internally.
9
+ */
10
+ export type WeakMapStoreBacking<V extends Passable> = {
11
+ has(key: any): boolean;
12
+ get(key: any): V | undefined;
13
+ set(key: any, value: V): unknown;
14
+ delete(key: any): boolean;
15
+ };
3
16
  import type { Key } from '@endo/patterns';
4
17
  import type { Passable } from '@endo/pass-style';
5
18
  import type { WeakMapStore } from '../types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"scalarWeakMapStore.d.ts","sourceRoot":"","sources":["scalarWeakMapStore.js"],"names":[],"mappings":"AAyBO,wCATY,CAAC,SAAP,GAAK,EACM,CAAC,SAAZ,QAAU,SACZ,OAAO,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,mBACtB,CAAC,CAAC,EAAE,CAAC,EAAE,CAA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aAAa;kCAAb,aAAa;qCADd,kBAAkB"}
@@ -13,10 +13,26 @@ import {
13
13
  * @import {WeakMapStore, StoreOptions} from '../types.js';
14
14
  */
15
15
 
16
+ /**
17
+ * A minimal view of the backing collection keyed in terms of the public key
18
+ * type `K`. The scalar weak map only ever stores object (remotable) keys, so it
19
+ * backs onto a `WeakMap` keyed by `K & object`; the non-weak scalar map store
20
+ * reuses these methods over a `Map<K, V>`. The bivariant `any` key lets both
21
+ * satisfy this view while the methods operate on `K` internally.
22
+ *
23
+ * @template {Passable} V
24
+ * @typedef {{
25
+ * has(key: any): boolean,
26
+ * get(key: any): V | undefined,
27
+ * set(key: any, value: V): unknown,
28
+ * delete(key: any): boolean,
29
+ * }} WeakMapStoreBacking
30
+ */
31
+
16
32
  /**
17
33
  * @template {Key} K
18
34
  * @template {Passable} V
19
- * @param {WeakMap<K & object, V>} jsmap
35
+ * @param {WeakMapStoreBacking<V>} jsmap
20
36
  * @param {(k: K, v: V) => void} assertKVOkToAdd
21
37
  * @param {(k: K, v: V) => void} assertKVOkToSet
22
38
  * @param {(k: K) => void} [assertKeyOkToDelete]
@@ -1,5 +1,17 @@
1
- export function makeWeakSetStoreMethods<K extends Key>(jsset: WeakSet<K & object>, assertKeyOkToAdd: (k: K) => void, assertKeyOkToDelete?: (k: K) => void, keyName?: string): WeakSetStoreMethods<K>;
1
+ export function makeWeakSetStoreMethods<K extends Key>(jsset: WeakSetStoreBacking, assertKeyOkToAdd: (k: K) => void, assertKeyOkToDelete?: (k: K) => void, keyName?: string): WeakSetStoreMethods<K>;
2
2
  export function makeScalarWeakSetStore<K>(tag?: string, { longLived, keyShape }?: StoreOptions): WeakSetStore<K>;
3
+ /**
4
+ * A minimal view of the backing collection keyed in terms of the public key
5
+ * type `K`. The scalar weak set only ever stores object (remotable) keys, so it
6
+ * backs onto a `WeakSet` keyed by `K & object`; the non-weak scalar set store
7
+ * reuses these methods over a `Set<K>`. The bivariant `any` key lets both
8
+ * satisfy this view while the methods operate on `K` internally.
9
+ */
10
+ export type WeakSetStoreBacking = {
11
+ has(key: any): boolean;
12
+ add(key: any): unknown;
13
+ delete(key: any): boolean;
14
+ };
3
15
  import type { Key } from '@endo/patterns';
4
16
  import type { WeakSetStoreMethods } from '@agoric/store';
5
17
  import type { StoreOptions } from '@agoric/store';
@@ -1 +1 @@
1
- {"version":3,"file":"scalarWeakSetStore.d.ts","sourceRoot":"","sources":["scalarWeakSetStore.js"],"names":[],"mappings":"AAsBO,wCAPY,CAAC,SAAP,GAAK,SACP,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,oBACnB,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,wBACd,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,YACd,MAAM,GACJ,oBAAoB,CAAC,CAAC,CA8ClC;AAmBM,uCALM,CAAC,QACH,MAAM,4BACN,YAAY,GACV,aAAa,CAAC,CAAC,CAyB3B;yBAlGqB,gBAAgB;yCAC4B,eAAe;kCAAf,eAAe;kCAAf,eAAe"}
1
+ {"version":3,"file":"scalarWeakSetStore.d.ts","sourceRoot":"","sources":["scalarWeakSetStore.js"],"names":[],"mappings":"AAoCO,wCAPY,CAAC,SAAP,GAAK,SACP,mBAAmB,oBACnB,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,wBACd,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,YACd,MAAM,GACJ,oBAAoB,CAAC,CAAC,CA8ClC;AAmBM,uCALM,CAAC,QACH,MAAM,4BACN,YAAY,GACV,aAAa,CAAC,CAAC,CAyB3B;;;;;;;;kCArGY;IACR,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC;IACvB,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC;IACvB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC;CAC3B;yBAfkB,gBAAgB;yCAC4B,eAAe;kCAAf,eAAe;kCAAf,eAAe"}
@@ -12,9 +12,23 @@ import {
12
12
  * @import {StoreOptions, WeakSetStore, WeakSetStoreMethods} from '@agoric/store';
13
13
  */
14
14
 
15
+ /**
16
+ * A minimal view of the backing collection keyed in terms of the public key
17
+ * type `K`. The scalar weak set only ever stores object (remotable) keys, so it
18
+ * backs onto a `WeakSet` keyed by `K & object`; the non-weak scalar set store
19
+ * reuses these methods over a `Set<K>`. The bivariant `any` key lets both
20
+ * satisfy this view while the methods operate on `K` internally.
21
+ *
22
+ * @typedef {{
23
+ * has(key: any): boolean,
24
+ * add(key: any): unknown,
25
+ * delete(key: any): boolean,
26
+ * }} WeakSetStoreBacking
27
+ */
28
+
15
29
  /**
16
30
  * @template {Key} K
17
- * @param {WeakSet<K & object>} jsset
31
+ * @param {WeakSetStoreBacking} jsset
18
32
  * @param {(k: K) => void} assertKeyOkToAdd
19
33
  * @param {(k: K) => void} [assertKeyOkToDelete]
20
34
  * @param {string} [keyName]