@agoric/cache 0.3.3-dev-75b00b2.0 → 0.3.3-dev-4f72580.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/package.json +9 -9
- package/src/cache.js +1 -1
- package/src/state.js +1 -1
- package/src/store.js +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cache",
|
|
3
|
-
"version": "0.3.3-dev-
|
|
3
|
+
"version": "0.3.3-dev-4f72580.0+4f72580",
|
|
4
4
|
"description": "Agoric's simple cache interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"author": "Agoric",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@agoric/internal": "0.3.3-dev-
|
|
23
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
24
|
-
"@agoric/store": "0.9.3-dev-
|
|
25
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
26
|
-
"@endo/far": "^0.
|
|
27
|
-
"@endo/marshal": "^0.
|
|
22
|
+
"@agoric/internal": "0.3.3-dev-4f72580.0+4f72580",
|
|
23
|
+
"@agoric/notifier": "0.6.3-dev-4f72580.0+4f72580",
|
|
24
|
+
"@agoric/store": "0.9.3-dev-4f72580.0+4f72580",
|
|
25
|
+
"@agoric/vat-data": "0.5.3-dev-4f72580.0+4f72580",
|
|
26
|
+
"@endo/far": "^1.0.1",
|
|
27
|
+
"@endo/marshal": "^1.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
30
|
+
"@agoric/zoe": "0.26.3-dev-4f72580.0+4f72580",
|
|
31
31
|
"ava": "^5.3.0",
|
|
32
32
|
"c8": "^7.13.0"
|
|
33
33
|
},
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"typeCoverage": {
|
|
50
50
|
"atLeast": 86.81
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "4f7258043c55cb9d60e1d50cbdddb712910950f4"
|
|
53
53
|
}
|
package/src/cache.js
CHANGED
|
@@ -12,7 +12,7 @@ import { makeScalarStoreCoordinator } from './store.js';
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @param {ERef<import('./types').Coordinator>} [coordinator]
|
|
15
|
+
* @param {ERef<import('./types.js').Coordinator>} [coordinator]
|
|
16
16
|
*/
|
|
17
17
|
export const makeCache = (coordinator = makeScalarStoreCoordinator()) => {
|
|
18
18
|
/**
|
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
|
@@ -40,9 +40,9 @@ const makeKeyToString = (sanitize = obj => obj) => {
|
|
|
40
40
|
* @param {(obj: unknown) => unknown} sanitize Process keys and values with
|
|
41
41
|
* this function before storing them
|
|
42
42
|
* @param {{
|
|
43
|
-
* get(key: string): import('./state').State;
|
|
44
|
-
* set(key: string, value: import('./state').State): void;
|
|
45
|
-
* init(key: string, value: import('./state').State): void;
|
|
43
|
+
* get(key: string): import('./state.js').State;
|
|
44
|
+
* set(key: string, value: import('./state.js').State): void;
|
|
45
|
+
* init(key: string, value: import('./state.js').State): void;
|
|
46
46
|
* }} stateStore
|
|
47
47
|
* @returns {Promise<unknown>} the value of the updated state
|
|
48
48
|
*/
|
|
@@ -56,8 +56,8 @@ const applyCacheTransaction = async (
|
|
|
56
56
|
/**
|
|
57
57
|
* Retrieve a potential updated state from the transaction.
|
|
58
58
|
*
|
|
59
|
-
* @param {import('./state').State} basisState
|
|
60
|
-
* @returns {Promise<import('./state').State | null>} the updated state, or null if no longer applicable
|
|
59
|
+
* @param {import('./state.js').State} basisState
|
|
60
|
+
* @returns {Promise<import('./state.js').State | null>} the updated state, or null if no longer applicable
|
|
61
61
|
*/
|
|
62
62
|
const getUpdatedState = async basisState => {
|
|
63
63
|
const { value } = basisState;
|
|
@@ -106,7 +106,7 @@ const applyCacheTransaction = async (
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* @param {MapStore<string, import('./state').State>} stateStore
|
|
109
|
+
* @param {MapStore<string, import('./state.js').State>} stateStore
|
|
110
110
|
* @param {ERef<Marshaller>} marshaller
|
|
111
111
|
* @returns {Promise<string>}
|
|
112
112
|
*/
|
|
@@ -124,7 +124,7 @@ const stringifyStateStore = async (stateStore, marshaller) => {
|
|
|
124
124
|
* Make a cache coordinator backed by a MapStore. This coordinator doesn't
|
|
125
125
|
* currently enforce any cache eviction, but that would be a useful feature.
|
|
126
126
|
*
|
|
127
|
-
* @param {MapStore<string, import('./state').State>} [stateStore]
|
|
127
|
+
* @param {MapStore<string, import('./state.js').State>} [stateStore]
|
|
128
128
|
* @param {(obj: unknown) => unknown} [sanitize] Process keys and values with
|
|
129
129
|
* this function before storing them. Defaults to deeplyFulfilled.
|
|
130
130
|
*/
|
|
@@ -136,7 +136,7 @@ export const makeScalarStoreCoordinator = (
|
|
|
136
136
|
|
|
137
137
|
const defaultStateStore = withGroundState(stateStore);
|
|
138
138
|
|
|
139
|
-
/** @type {import('./types').Coordinator} */
|
|
139
|
+
/** @type {import('./types.js').Coordinator} */
|
|
140
140
|
const coord = Far('store cache coordinator', {
|
|
141
141
|
getRecentValue: async key => {
|
|
142
142
|
const keyStr = await serializePassable(key);
|
|
@@ -169,7 +169,7 @@ export const makeScalarStoreCoordinator = (
|
|
|
169
169
|
/**
|
|
170
170
|
* Don't write any marshalled value that's older than what's already pushed
|
|
171
171
|
*
|
|
172
|
-
* @param {MapStore<string, import('./state').State>} stateStore
|
|
172
|
+
* @param {MapStore<string, import('./state.js').State>} stateStore
|
|
173
173
|
* @param {ERef<Marshaller>} marshaller
|
|
174
174
|
* @param {ERef<StorageNode>} storageNode
|
|
175
175
|
* @returns {<T>(storedValue: T) => Promise<T>}
|
|
@@ -216,7 +216,7 @@ export const makeChainStorageCoordinator = (storageNode, marshaller) => {
|
|
|
216
216
|
storageNode,
|
|
217
217
|
);
|
|
218
218
|
|
|
219
|
-
/** @type {import('./types').Coordinator} */
|
|
219
|
+
/** @type {import('./types.js').Coordinator} */
|
|
220
220
|
const coord = Far('store cache coordinator', {
|
|
221
221
|
getRecentValue: async key => {
|
|
222
222
|
const keyStr = await serializePassable(key);
|