@agoric/store 0.10.0 → 0.10.1-upgrade-23-dev-bd79330.0.bd79330

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.10.0",
3
+ "version": "0.10.1-upgrade-23-dev-bd79330.0.bd79330",
4
4
  "description": "Wrapper for JavaScript map",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -14,9 +14,9 @@
14
14
  "lint-fix": "yarn lint:eslint --fix",
15
15
  "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
16
16
  "lint:types": "yarn run -T tsc",
17
- "lint:eslint": "yarn run -T eslint .",
18
- "prepack": "yarn run -T tsc --build tsconfig.build.json",
19
- "postpack": "git clean -f '*.d.*ts*' '*.tsbuildinfo'"
17
+ "lint:eslint": "node ../../scripts/eslint-repo.mjs .",
18
+ "prepack": "yarn run -T prepack-package",
19
+ "postpack": "yarn run -T postpack-package"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
@@ -41,11 +41,10 @@
41
41
  "devDependencies": {
42
42
  "@endo/init": "^1.1.12",
43
43
  "@endo/ses-ava": "^1.3.2",
44
- "ava": "^5.3.0"
44
+ "ava": "^6.4.1"
45
45
  },
46
46
  "files": [
47
47
  "src/",
48
- "exported.js",
49
48
  "NEWS.md"
50
49
  ],
51
50
  "publishConfig": {
@@ -61,7 +60,7 @@
61
60
  "timeout": "2m"
62
61
  },
63
62
  "typeCoverage": {
64
- "atLeast": 89.63
63
+ "atLeast": 89.98
65
64
  },
66
- "gitHead": "0922d0447ab8fae9d2d87415964403330b5ca313"
65
+ "gitHead": "bd79330f78dae2faf9cc3d8b10063567700da07b"
67
66
  }
package/src/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { makeScalarMapStore } from "./stores/scalarMapStore.js";
6
6
  export const mustMatch: MustMatch;
7
7
  export { makeLegacyMap } from "./legacy/legacyMap.js";
8
8
  export { makeLegacyWeakMap } from "./legacy/legacyWeakMap.js";
9
- export * from "./types.js";
9
+ export * from "./types-index.js";
10
10
  import type { MustMatch } from '@agoric/internal';
11
11
  export { makeAtomicProvider, provideLazy } from "./stores/store-utils.js";
12
12
  export { isKey, assertKey, assertScalarKey, makeCopySet, getCopySetKeys, makeCopyBag, makeCopyBagFromElements, getCopyBagEntries, makeCopyMap, getCopyMapEntries, coerceToElements, coerceToBagEntries, compareKeys, keyLT, keyLTE, keyEQ, keyGTE, keyGT, elementsIsSuperset, elementsIsDisjoint, elementsCompare, elementsUnion, elementsDisjointUnion, elementsIntersection, elementsDisjointSubtract, setIsSuperset, setIsDisjoint, setCompare, setUnion, setDisjointUnion, setIntersection, setDisjointSubtract, bagIsSuperbag, bagCompare, bagUnion, bagIntersection, bagDisjointSubtract, M, getRankCover, isPattern, assertPattern, matches, isCopySet, isCopyMap } from "@endo/patterns";
package/src/index.js CHANGED
@@ -77,4 +77,4 @@ export {
77
77
  export { makeLegacyMap } from './legacy/legacyMap.js';
78
78
  export { makeLegacyWeakMap } from './legacy/legacyWeakMap.js';
79
79
  // eslint-disable-next-line import/export
80
- export * from './types.js';
80
+ export * from './types-index.js';
@@ -1,3 +1,3 @@
1
- export function makeLegacyWeakMap<K, V>(tag?: string): LegacyWeakMap<K, V>;
1
+ export function makeLegacyWeakMap<K extends WeakKey, V>(tag?: string): LegacyWeakMap<K, V>;
2
2
  import type { LegacyWeakMap } from '../types.js';
3
3
  //# sourceMappingURL=legacyWeakMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacyWeakMap.d.ts","sourceRoot":"","sources":["legacyWeakMap.js"],"names":[],"mappings":"AAaO,kCAJM,CAAC,EAAC,CAAC,QACL,MAAM,GACJ,cAAc,CAAC,EAAE,CAAC,CAAC,CAkC/B;mCA7CgC,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,CAkC/B;mCA9CgC,aAAa"}
@@ -7,7 +7,8 @@ import { Fail, q } from '@endo/errors';
7
7
  * See doccomment in the closely related `legacyMap.js` module.
8
8
  *
9
9
  * @deprecated switch to ScalarWeakMap if possible, WeakMap otherwise
10
- * @template K,V
10
+ * @template {WeakKey} K
11
+ * @template V
11
12
  * @param {string} [tag] - tag for debugging
12
13
  * @returns {LegacyWeakMap<K, V>}
13
14
  */
@@ -36,7 +36,7 @@ export const makeMapStoreMethods = (
36
36
  jsmap,
37
37
  assertKVOkToAdd,
38
38
  assertKVOkToSet,
39
- assertKeyOkToDelete = undefined,
39
+ assertKeyOkToDelete,
40
40
  tag = 'key',
41
41
  ) => {
42
42
  const { assertUpdateOnAdd, assertUpdateOnDelete, iterableKeys } =
@@ -54,7 +54,7 @@ export const makeMapStoreMethods = (
54
54
  * @param {Pattern} [valuePatt]
55
55
  * @returns {Iterable<K>}
56
56
  */
57
- const keys = (keyPatt = undefined, valuePatt = undefined) => {
57
+ const keys = (keyPatt, valuePatt) => {
58
58
  if (keyPatt === undefined && valuePatt === undefined) {
59
59
  return iterableKeys;
60
60
  }
@@ -76,7 +76,7 @@ export const makeMapStoreMethods = (
76
76
  * @param {Pattern} [valuePatt]
77
77
  * @returns {Iterable<V>}
78
78
  */
79
- const values = (keyPatt = undefined, valuePatt = undefined) =>
79
+ const values = (keyPatt, valuePatt) =>
80
80
  mapIterable(keys(keyPatt, valuePatt), k => /** @type {V} */ (jsmap.get(k)));
81
81
 
82
82
  /**
@@ -84,7 +84,7 @@ export const makeMapStoreMethods = (
84
84
  * @param {Pattern} [valuePatt]
85
85
  * @returns {Iterable<[K, V]>}
86
86
  */
87
- const entries = (keyPatt = undefined, valuePatt = undefined) =>
87
+ const entries = (keyPatt, valuePatt) =>
88
88
  mapIterable(keys(keyPatt, valuePatt), k => [
89
89
  k,
90
90
  /** @type {V} */ (jsmap.get(k)),
@@ -140,7 +140,7 @@ export const makeMapStoreMethods = (
140
140
  */
141
141
  export const makeScalarMapStore = (
142
142
  tag = 'key',
143
- { keyShape = undefined, valueShape = undefined } = {},
143
+ { keyShape, valueShape } = {},
144
144
  ) => {
145
145
  const jsmap = new Map();
146
146
  if (keyShape !== undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"scalarSetStore.d.ts","sourceRoot":"","sources":["scalarSetStore.js"],"names":[],"mappings":"AA0BO,oCAPY,CAAC,SAAP,GAAK,SACP,GAAG,CAAC,CAAC,CAAC,oBACN,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,wBACd,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,YACd,MAAM,GACJ,gBAAgB,CAAC,CAAC,CAqD9B;AAkBM,mCALM,CAAC,QACH,MAAM,iBACN,YAAY,GACV,SAAS,CAAC,CAAC,CAyBvB;yBAxG8B,gBAAgB;qCACW,aAAa;kCAAb,aAAa;8BAAb,aAAa"}
1
+ {"version":3,"file":"scalarSetStore.d.ts","sourceRoot":"","sources":["scalarSetStore.js"],"names":[],"mappings":"AA0BO,oCAPY,CAAC,SAAP,GAAK,SACP,GAAG,CAAC,CAAC,CAAC,oBACN,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,wBACd,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,YACd,MAAM,GACJ,gBAAgB,CAAC,CAAC,CAqD9B;AAkBM,mCALM,CAAC,QACH,MAAM,iBACN,YAAY,GACV,SAAS,CAAC,CAAC,CAsBvB;yBArG8B,gBAAgB;qCACW,aAAa;kCAAb,aAAa;8BAAb,aAAa"}
@@ -27,7 +27,7 @@ import { makeCurrentKeysKit } from './store-utils.js';
27
27
  export const makeSetStoreMethods = (
28
28
  jsset,
29
29
  assertKeyOkToAdd,
30
- assertKeyOkToDelete = undefined,
30
+ assertKeyOkToDelete,
31
31
  keyName = 'key',
32
32
  ) => {
33
33
  const { assertUpdateOnAdd, assertUpdateOnDelete, iterableKeys } =
@@ -44,7 +44,7 @@ export const makeSetStoreMethods = (
44
44
  * @param {Pattern} [keyPatt]
45
45
  * @returns {Iterable<K>}
46
46
  */
47
- const keys = (keyPatt = undefined) =>
47
+ const keys = keyPatt =>
48
48
  keyPatt === undefined
49
49
  ? iterableKeys
50
50
  : filterIterable(iterableKeys, k => matches(k, keyPatt));
@@ -93,10 +93,7 @@ export const makeSetStoreMethods = (
93
93
  * @param {StoreOptions} [options]
94
94
  * @returns {SetStore<K>}
95
95
  */
96
- export const makeScalarSetStore = (
97
- tag = 'key',
98
- { keyShape = undefined } = {},
99
- ) => {
96
+ export const makeScalarSetStore = (tag = 'key', { keyShape } = {}) => {
100
97
  const jsset = new Set();
101
98
  if (keyShape !== undefined) {
102
99
  assertPattern(keyShape);
@@ -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,CAAC,EAAE,CAAC,KAAK,IAAI,mBACpB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,wBACpB,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,YACd,MAAM,GACJ,aAAa,CAAC,EAAE,CAAC,CAAC,CA8D9B;AAoBM,uCALM,CAAC,EAAC,CAAC,QACL,MAAM,wCACN,YAAY,GACV,eAAe,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC,CA8ChD;yBA3IqB,gBAAgB;8BACM,kBAAkB;kCACjB,aAAa;kCAAb,aAAa;qCADd,kBAAkB"}
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,CAAC,EAAE,CAAC,KAAK,IAAI,mBACpB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,wBACpB,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,YACd,MAAM,GACJ,aAAa,CAAC,EAAE,CAAC,CAAC,CA8D9B;AAoBM,uCALM,CAAC,EAAC,CAAC,QACL,MAAM,wCACN,YAAY,GACV,eAAe,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC,CA+ChD;yBA5IqB,gBAAgB;8BACM,kBAAkB;kCACjB,aAAa;kCAAb,aAAa;qCADd,kBAAkB"}
@@ -107,7 +107,8 @@ export const makeScalarWeakMapStore = (
107
107
  tag = 'key',
108
108
  { longLived = true, keyShape = undefined, valueShape = undefined } = {},
109
109
  ) => {
110
- const jsmap = new (longLived ? WeakMap : Map)();
110
+ /** @type {WeakMap<K & object, V>} */
111
+ const jsmap = longLived ? new WeakMap() : new Map();
111
112
  if (keyShape !== undefined) {
112
113
  assertPattern(keyShape);
113
114
  }
@@ -1 +1 @@
1
- {"version":3,"file":"store-utils.d.ts","sourceRoot":"","sources":["store-utils.js"],"names":[],"mappings":"AAiCO,mCAVY,CAAC,SAAP,GAAK,EACM,CAAC,SAAZ,QAAU,cACZ,MAAM,QAAQ,CAAC,CAAC,CAAC,YACjB,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,WACjB,WAAW,iBACX,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,qBACrB,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,YACd,MAAM,GACJ,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CA4DhC;AAeM,4BAPY,CAAC,SAAP,GAAK,EACM,CAAC,SAAZ,QAAU,YACZ,aAA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yName = 'key',
41
41
  ) => {
42
42
  let updateCount = 0;
43
+ /** @type {Array<K> | undefined} */
43
44
  let sortedKeysMemo;
44
45
 
45
46
  const assertUpdateOnAdd = (k, v = undefined) => {
@@ -61,6 +62,7 @@ export const makeCurrentKeysKit = (
61
62
  [Symbol.iterator]: () => {
62
63
  const generation = updateCount;
63
64
  getSortedKeys();
65
+ // @ts-expect-error TS doesn't track that sortedKeysMemo is defined
64
66
  const len = sortedKeysMemo.length;
65
67
  let i = 0;
66
68
  return Far('Iterator of keys', {
@@ -70,13 +72,16 @@ export const makeCurrentKeysKit = (
70
72
  // we started with.
71
73
  for (;;) {
72
74
  if (i < len) {
75
+ // @ts-expect-error TS doesn't track that sortedKeysMemo is defined
73
76
  const value = sortedKeysMemo[i];
74
77
  i += 1;
75
78
  if (checkHas(value)) {
76
- return harden({ done: false, value });
79
+ return harden(/** @type {const} */ ({ done: false, value }));
77
80
  }
78
81
  } else {
79
- return harden({ done: true, value: undefined });
82
+ return harden(
83
+ /** @type {const} */ ({ done: true, value: undefined }),
84
+ );
80
85
  }
81
86
  }
82
87
  },
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line import/export -- just types
2
+ export type * from './types.js';
@@ -0,0 +1 @@
1
+ export {};
package/exported.js DELETED
@@ -1 +0,0 @@
1
- // Dummy file for .d.ts twin to declare ambients