@agoric/cache 0.3.3-upgrade-14-dev-0169c7e.0 → 0.3.3-upgrade-16-dev-8879538.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.
package/CHANGELOG.md CHANGED
@@ -3,38 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ### [0.3.3-u13.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cache@0.3.3-u12.0...@agoric/cache@0.3.3-u13.0) (2023-12-07)
7
-
8
- **Note:** Version bump only for package @agoric/cache
9
-
10
-
11
-
12
-
13
-
14
- ### [0.3.3-u12.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cache@0.3.3-u11wf.0...@agoric/cache@0.3.3-u12.0) (2023-11-10)
15
-
16
- **Note:** Version bump only for package @agoric/cache
17
-
18
-
19
-
20
-
21
-
22
- ### [0.3.3-u11wf.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cache@0.3.3-u11.0...@agoric/cache@0.3.3-u11wf.0) (2023-09-23)
23
-
24
- **Note:** Version bump only for package @agoric/cache
25
-
26
-
27
-
28
-
29
-
30
- ### [0.3.3-u11.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cache@0.3.2...@agoric/cache@0.3.3-u11.0) (2023-08-24)
31
-
32
- **Note:** Version bump only for package @agoric/cache
33
-
34
-
35
-
36
-
37
-
38
6
  ### [0.3.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/cache@0.3.1...@agoric/cache@0.3.2) (2023-06-02)
39
7
 
40
8
  **Note:** Version bump only for package @agoric/cache
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cache",
3
- "version": "0.3.3-upgrade-14-dev-0169c7e.0+0169c7e",
3
+ "version": "0.3.3-upgrade-16-dev-8879538.0+8879538",
4
4
  "description": "Agoric's simple cache interface",
5
5
  "type": "module",
6
6
  "main": "src/main.js",
@@ -12,36 +12,42 @@
12
12
  "test:xs": "exit 0",
13
13
  "lint-fix": "yarn lint:eslint --fix",
14
14
  "lint": "run-s --continue-on-error lint:*",
15
- "lint:types": "tsc -p jsconfig.json",
15
+ "lint:types": "tsc",
16
16
  "lint:eslint": "eslint --ext .js,.ts ."
17
17
  },
18
18
  "keywords": [],
19
19
  "author": "Agoric",
20
20
  "license": "Apache-2.0",
21
21
  "dependencies": {
22
- "@agoric/internal": "0.4.0-upgrade-14-dev-0169c7e.0+0169c7e",
23
- "@agoric/notifier": "0.6.3-upgrade-14-dev-0169c7e.0+0169c7e",
24
- "@agoric/store": "0.9.3-upgrade-14-dev-0169c7e.0+0169c7e",
25
- "@agoric/vat-data": "0.5.3-upgrade-14-dev-0169c7e.0+0169c7e",
26
- "@endo/far": "0.2.18",
27
- "@endo/marshal": "0.8.5"
22
+ "@agoric/internal": "0.3.3-upgrade-16-dev-8879538.0+8879538",
23
+ "@agoric/notifier": "0.6.3-upgrade-16-dev-8879538.0+8879538",
24
+ "@agoric/store": "0.9.3-upgrade-16-dev-8879538.0+8879538",
25
+ "@agoric/vat-data": "0.5.3-upgrade-16-dev-8879538.0+8879538",
26
+ "@endo/far": "^1.1.2",
27
+ "@endo/marshal": "^1.5.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@agoric/zoe": "0.26.3-upgrade-14-dev-0169c7e.0+0169c7e",
31
- "ava": "^5.2.0",
32
- "c8": "^7.13.0"
30
+ "@agoric/zoe": "0.26.3-upgrade-16-dev-8879538.0+8879538",
31
+ "ava": "^5.3.0",
32
+ "c8": "^9.1.0"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
37
  "engines": {
38
- "node": ">=14.15.0"
38
+ "node": "^18.12 || ^20.9"
39
39
  },
40
40
  "ava": {
41
41
  "files": [
42
- "test/**/test-*.js"
42
+ "test/**/*.test.*"
43
+ ],
44
+ "require": [
45
+ "@endo/init/debug.js"
43
46
  ],
44
47
  "timeout": "20m"
45
48
  },
46
- "gitHead": "0169c7e505099fdcfa8e4d1436e5d3b372f1c320"
49
+ "typeCoverage": {
50
+ "atLeast": 94.12
51
+ },
52
+ "gitHead": "8879538cd1d125a08346f02dd5701d0d70c90bb8"
47
53
  }
package/src/cache.js CHANGED
@@ -4,22 +4,26 @@ import { E, Far } from '@endo/far';
4
4
 
5
5
  import { makeScalarStoreCoordinator } from './store.js';
6
6
 
7
+ /**
8
+ * @import {Passable, RemotableObject} from '@endo/pass-style';
9
+ */
10
+
7
11
  /**
8
12
  * @typedef {{ [x: PropertyKey]: any } | string | symbol | bigint | null |
9
- * undefined | number | ((oldValue: any) => ERef<unknown>)} Update a `newValue`
13
+ * undefined | number | ((oldValue: any) => ERef<Passable>)} Update a `newValue`
10
14
  * to update to. If a function, then it should take an oldValue and return a
11
15
  * `newValue` or promise for `newValue`
12
16
  */
13
17
 
14
18
  /**
15
- * @param {ERef<import('./types').Coordinator>} [coordinator]
19
+ * @param {ERef<import('./types.js').Coordinator>} [coordinator]
16
20
  */
17
21
  export const makeCache = (coordinator = makeScalarStoreCoordinator()) => {
18
22
  /**
19
23
  * The ground state for a cache key value is `undefined`. It is impossible to
20
24
  * distinguish a set value of `undefined` from an unset key
21
25
  *
22
- * @param {unknown} key the cache key (any key type acceptable to the cache)
26
+ * @param {Passable} key the cache key (any key type acceptable to the cache)
23
27
  * @param {[] | [Update] | [Update, Pattern]} optUpdateGuardPattern an optional
24
28
  */
25
29
  const cache = (key, ...optUpdateGuardPattern) => {
package/src/main.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // @jessie-check
2
+ /// <reference types="@agoric/internal/exported" />
2
3
 
3
4
  // eslint-disable-next-line import/export
4
5
  export * from './types.js';
package/src/state.js CHANGED
@@ -30,7 +30,7 @@ export const makeState = (value, priorState = GROUND_STATE) =>
30
30
  /**
31
31
  * Wrap a state store to have a default value using the GROUND_STATE
32
32
  *
33
- * @param {MapStore<string, import('./state').State>} stateStore
33
+ * @param {MapStore<string, import('./state.js').State>} stateStore
34
34
  */
35
35
  export const withGroundState = stateStore => ({
36
36
  ...stateStore,
package/src/store.js CHANGED
@@ -4,11 +4,10 @@ import { matches, makeScalarMapStore } from '@agoric/store';
4
4
  import { makeScalarBigMapStore } from '@agoric/vat-data';
5
5
  import { untilTrue } from '@agoric/internal';
6
6
  import { withGroundState, makeState } from './state.js';
7
-
8
- import './types.js';
7
+ /** @import {Passable} from '@endo/pass-style' */
9
8
 
10
9
  /**
11
- * @param {(obj: unknown) => unknown} [sanitize]
10
+ * @param {(obj: Passable) => Passable} [sanitize]
12
11
  * @returns {(key: Passable) => Promise<string>}
13
12
  */
14
13
  const makeKeyToString = (sanitize = obj => obj) => {
@@ -37,16 +36,16 @@ const makeKeyToString = (sanitize = obj => obj) => {
37
36
 
38
37
  /**
39
38
  * @param {string} keyStr
40
- * @param {(oldValue: unknown) => unknown} txn
39
+ * @param {(oldValue: Passable) => Passable} txn
41
40
  * @param {Pattern} guardPattern
42
- * @param {(obj: unknown) => unknown} sanitize Process keys and values with
41
+ * @param {(obj: Passable) => Passable} sanitize Process keys and values with
43
42
  * this function before storing them
44
43
  * @param {{
45
- * get(key: string): import('./state').State;
46
- * set(key: string, value: import('./state').State): void;
47
- * init(key: string, value: import('./state').State): void;
44
+ * get(key: string): import('./state.js').State;
45
+ * set(key: string, value: import('./state.js').State): void;
46
+ * init(key: string, value: import('./state.js').State): void;
48
47
  * }} stateStore
49
- * @returns {Promise<unknown>} the value of the updated state
48
+ * @returns {Promise<Passable>} the value of the updated state
50
49
  */
51
50
  const applyCacheTransaction = async (
52
51
  keyStr,
@@ -58,8 +57,8 @@ const applyCacheTransaction = async (
58
57
  /**
59
58
  * Retrieve a potential updated state from the transaction.
60
59
  *
61
- * @param {import('./state').State} basisState
62
- * @returns {Promise<import('./state').State | null>} the updated state, or null if no longer applicable
60
+ * @param {import('./state.js').State} basisState
61
+ * @returns {Promise<import('./state.js').State | null>} the updated state, or null if no longer applicable
63
62
  */
64
63
  const getUpdatedState = async basisState => {
65
64
  const { value } = basisState;
@@ -108,11 +107,12 @@ const applyCacheTransaction = async (
108
107
  };
109
108
 
110
109
  /**
111
- * @param {MapStore<string, import('./state').State>} stateStore
110
+ * @param {MapStore<string, import('./state.js').State>} stateStore
112
111
  * @param {ERef<Marshaller>} marshaller
113
112
  * @returns {Promise<string>}
114
113
  */
115
114
  const stringifyStateStore = async (stateStore, marshaller) => {
115
+ /** @type {Passable} */
116
116
  const obj = {};
117
117
  for (const [key, value] of stateStore.entries()) {
118
118
  obj[key] = E(marshaller).toCapData(value);
@@ -126,8 +126,8 @@ const stringifyStateStore = async (stateStore, marshaller) => {
126
126
  * Make a cache coordinator backed by a MapStore. This coordinator doesn't
127
127
  * currently enforce any cache eviction, but that would be a useful feature.
128
128
  *
129
- * @param {MapStore<string, import('./state').State>} [stateStore]
130
- * @param {(obj: unknown) => unknown} [sanitize] Process keys and values with
129
+ * @param {MapStore<string, import('./state.js').State>} [stateStore]
130
+ * @param {(obj: Passable) => Passable} [sanitize] Process keys and values with
131
131
  * this function before storing them. Defaults to deeplyFulfilled.
132
132
  */
133
133
  export const makeScalarStoreCoordinator = (
@@ -138,7 +138,7 @@ export const makeScalarStoreCoordinator = (
138
138
 
139
139
  const defaultStateStore = withGroundState(stateStore);
140
140
 
141
- /** @type {import('./types').Coordinator} */
141
+ /** @type {import('./types.js').Coordinator} */
142
142
  const coord = Far('store cache coordinator', {
143
143
  getRecentValue: async key => {
144
144
  const keyStr = await serializePassable(key);
@@ -171,7 +171,7 @@ export const makeScalarStoreCoordinator = (
171
171
  /**
172
172
  * Don't write any marshalled value that's older than what's already pushed
173
173
  *
174
- * @param {MapStore<string, import('./state').State>} stateStore
174
+ * @param {MapStore<string, import('./state.js').State>} stateStore
175
175
  * @param {ERef<Marshaller>} marshaller
176
176
  * @param {ERef<StorageNode>} storageNode
177
177
  * @returns {<T>(storedValue: T) => Promise<T>}
@@ -218,7 +218,7 @@ export const makeChainStorageCoordinator = (storageNode, marshaller) => {
218
218
  storageNode,
219
219
  );
220
220
 
221
- /** @type {import('./types').Coordinator} */
221
+ /** @type {import('./types.js').Coordinator} */
222
222
  const coord = Far('store cache coordinator', {
223
223
  getRecentValue: async key => {
224
224
  const keyStr = await serializePassable(key);
package/src/types.js CHANGED
@@ -1,13 +1,16 @@
1
1
  // @jessie-check
2
2
 
3
+ /// <reference types="@agoric/store/exported.js" />
4
+
3
5
  // XXX package factoring debt
4
- import '@agoric/notifier/exported.js';
5
- import '@agoric/store/exported.js';
6
6
 
7
7
  // Ensure this is a module.
8
8
  export {};
9
9
 
10
- /** @template T @typedef {import('@endo/far').ERef<T>} ERef */
10
+ /**
11
+ * @import { ERef } from '@endo/far'
12
+ * @import {Passable} from '@endo/pass-style'
13
+ */
11
14
 
12
15
  /**
13
16
  * @typedef {object} Updater
@@ -1,7 +1,5 @@
1
1
  // Must be first to set up globals
2
- // import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
3
- // eslint-disable-next-line import/no-extraneous-dependencies -- XXX
4
- import '@agoric/swingset-vat/tools/prepare-test-env.js';
2
+ import '@agoric/zoe/tools/prepare-test-env.js';
5
3
 
6
4
  import test from 'ava';
7
5
  import { makeChainStorageRoot } from '@agoric/internal/src/lib-chainStorage.js';
@@ -1,6 +1,7 @@
1
1
  // This file can contain .js-specific Typescript compiler config.
2
2
  {
3
3
  "extends": "../../tsconfig.json",
4
+ "compilerOptions": {},
4
5
  "include": [
5
6
  "*.js",
6
7
  "public/**/*.js",
File without changes