@agoric/store
Advanced tools
Comparing version 0.9.3-dev-83b106a.0 to 0.9.3-dev-83c2ebd.0
@@ -1,1 +0,1 @@ | ||
import './src/types.js'; | ||
// Dummy file for .d.ts twin to declare ambients |
{ | ||
"name": "@agoric/store", | ||
"version": "0.9.3-dev-83b106a.0+83b106a", | ||
"version": "0.9.3-dev-83c2ebd.0+83c2ebd", | ||
"description": "Wrapper for JavaScript map", | ||
@@ -8,3 +8,3 @@ "type": "module", | ||
"engines": { | ||
"node": ">=14.15.0" | ||
"node": "^18.12 || ^20.9" | ||
}, | ||
@@ -34,10 +34,11 @@ "scripts": { | ||
"dependencies": { | ||
"@endo/exo": "^1.2.1", | ||
"@endo/marshal": "^1.3.0", | ||
"@endo/pass-style": "^1.2.0", | ||
"@endo/patterns": "^1.2.0" | ||
"@endo/errors": "^1.2.9", | ||
"@endo/exo": "^1.5.8", | ||
"@endo/marshal": "^1.6.3", | ||
"@endo/pass-style": "^1.4.8", | ||
"@endo/patterns": "^1.4.8" | ||
}, | ||
"devDependencies": { | ||
"@endo/init": "^1.0.4", | ||
"@endo/ses-ava": "^1.1.2", | ||
"@endo/init": "^1.1.8", | ||
"@endo/ses-ava": "^1.2.9", | ||
"ava": "^5.3.0" | ||
@@ -55,3 +56,3 @@ }, | ||
"files": [ | ||
"test/**/test-*.js" | ||
"test/**/*.test.*" | ||
], | ||
@@ -64,5 +65,5 @@ "require": [ | ||
"typeCoverage": { | ||
"atLeast": 85.75 | ||
"atLeast": 89.69 | ||
}, | ||
"gitHead": "83b106a9f7096c609efa558b98a54e4dd1ef806f" | ||
"gitHead": "83c2ebdab859d3ac8365e2b7237e055360bd0536" | ||
} |
@@ -0,1 +1,6 @@ | ||
/** | ||
* @import {MustMatch} from '@agoric/internal'; | ||
*/ | ||
import { mustMatch as typelessMustMatch } from '@endo/patterns'; | ||
export { makeScalarWeakSetStore } from './stores/scalarWeakSetStore.js'; | ||
@@ -54,3 +59,2 @@ export { makeScalarSetStore } from './stores/scalarSetStore.js'; | ||
matches, | ||
mustMatch, | ||
isCopySet, | ||
@@ -60,2 +64,7 @@ isCopyMap, | ||
// XXX @agoric/store should not depend on @agoric/internal | ||
// TODO move to Endo | ||
/** @type {MustMatch} */ | ||
export const mustMatch = typelessMustMatch; | ||
export { | ||
@@ -72,1 +81,3 @@ initEmpty, | ||
export { makeLegacyWeakMap } from './legacy/legacyWeakMap.js'; | ||
// eslint-disable-next-line import/export | ||
export * from './types.js'; |
@@ -1,5 +0,5 @@ | ||
import '../types.js'; | ||
/** @import {LegacyMap, LegacyWeakMap} from '../types.js'; */ | ||
// TODO, once migrated to endo, import from @endo/errors instead | ||
const { Fail, quote: q } = assert; | ||
import { Fail, q } from '@endo/errors'; | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,5 +0,5 @@ | ||
import '../types.js'; | ||
/** @import {LegacyWeakMap} from '../types.js'; */ | ||
// TODO, once migrated to endo, import from @endo/errors instead | ||
const { Fail, quote: q } = assert; | ||
import { Fail, q } from '@endo/errors'; | ||
@@ -6,0 +6,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { q } from '@endo/errors'; | ||
import { | ||
@@ -18,3 +19,7 @@ Far, | ||
const { quote: q } = assert; | ||
/** | ||
* @import {Passable} from '@endo/pass-style'; | ||
* @import {Key, Pattern} from '@endo/patterns'; | ||
* @import {MapStore, MapStoreMethods, StoreOptions} from '../types.js'; | ||
*/ | ||
@@ -29,3 +34,3 @@ /** | ||
* @param {string} [tag] | ||
* @returns {MapStore<K, V>} | ||
* @returns {MapStoreMethods<K, V>} | ||
*/ | ||
@@ -132,7 +137,5 @@ export const makeMapStoreMethods = ( | ||
* | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @param {string} [tag] - the column name for the key | ||
* @param {StoreOptions} [options] | ||
* @returns {MapStore<K, V>} | ||
* @returns {MapStore<any, any>} | ||
*/ | ||
@@ -139,0 +142,0 @@ export const makeScalarMapStore = ( |
@@ -0,1 +1,2 @@ | ||
import { q } from '@endo/errors'; | ||
import { Far, filterIterable } from '@endo/pass-style'; | ||
@@ -13,6 +14,9 @@ import { compareRank } from '@endo/marshal'; | ||
const { quote: q } = assert; | ||
/** | ||
* @import {Key, Pattern} from '@endo/patterns'; | ||
* @import {SetStore, SetStoreMethods, StoreOptions} from '../types.js'; | ||
*/ | ||
/** | ||
* @template K | ||
* @template {Key} K | ||
* @param {Set<K>} jsset | ||
@@ -22,3 +26,3 @@ * @param {(k: K) => void} assertKeyOkToAdd | ||
* @param {string} [keyName] | ||
* @returns {SetStore<K>} | ||
* @returns {SetStoreMethods<K>} | ||
*/ | ||
@@ -25,0 +29,0 @@ export const makeSetStoreMethods = ( |
@@ -0,1 +1,2 @@ | ||
import { q, Fail } from '@endo/errors'; | ||
import { Far, assertPassable, passStyleOf } from '@endo/pass-style'; | ||
@@ -9,6 +10,11 @@ import { | ||
const { quote: q, Fail } = assert; | ||
/** | ||
* @import {Key} from '@endo/patterns'; | ||
* @import {Passable, RemotableObject} from '@endo/pass-style'; | ||
* @import {WeakMapStore, StoreOptions} from '../types.js'; | ||
*/ | ||
/** | ||
* @template K,V | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @param {WeakMap<K & object, V>} jsmap | ||
@@ -68,2 +74,3 @@ * @param {(k: K, v: V) => void} assertKVOkToAdd | ||
if (Object.isFrozen(entries) && isCopyMap(entries)) { | ||
// @ts-expect-error XXX | ||
entries = getCopyMapEntries(entries); | ||
@@ -99,3 +106,3 @@ } else { | ||
* @param {StoreOptions} [options] | ||
* @returns {WeakMapStore<K, V>} | ||
* @returns {RemotableObject & WeakMapStore<K, V>} | ||
*/ | ||
@@ -102,0 +109,0 @@ export const makeScalarWeakMapStore = ( |
@@ -0,1 +1,2 @@ | ||
import { q, Fail } from '@endo/errors'; | ||
import { Far, passStyleOf } from '@endo/pass-style'; | ||
@@ -9,6 +10,9 @@ import { | ||
const { quote: q, Fail } = assert; | ||
/** | ||
* @import {Key} from '@endo/patterns'; | ||
* @import {StoreOptions, WeakSetStore, WeakSetStoreMethods} from '@agoric/store'; | ||
*/ | ||
/** | ||
* @template K | ||
* @template {Key} K | ||
* @param {WeakSet<K & object>} jsset | ||
@@ -18,3 +22,3 @@ * @param {(k: K) => void} assertKeyOkToAdd | ||
* @param {string} [keyName] | ||
* @returns {WeakSetStore<K>} | ||
* @returns {WeakSetStoreMethods<K>} | ||
*/ | ||
@@ -53,2 +57,3 @@ export const makeWeakSetStoreMethods = ( | ||
if (Object.isFrozen(keys) && isCopySet(keys)) { | ||
// @ts-expect-error XXX | ||
keys = getCopySetKeys(keys); | ||
@@ -55,0 +60,0 @@ } else { |
@@ -0,9 +1,39 @@ | ||
import { Fail, q } from '@endo/errors'; | ||
import { Far } from '@endo/marshal'; | ||
import { M, matches } from '@endo/patterns'; | ||
/** @typedef {import('@endo/marshal').RankCompare} RankCompare */ | ||
/** | ||
* @import {RankCompare} from '@endo/marshal'; | ||
* @import {MapStore, WeakMapStore} from '../types.js'; | ||
* @import {Passable} from '@endo/pass-style'; | ||
* @import {Key} from '@endo/patterns'; | ||
*/ | ||
const { Fail, quote: q } = assert; | ||
// TODO: Undate `@endo/patterns` to export the original, and delete the | ||
// reimplementation here. | ||
/** | ||
* Should behave identically to the one in `@endo/patterns`, but reimplemented | ||
* for now because `@endo/patterns` forgot to export this one. This one is | ||
* simple enough that I prefer a reimplementation to a deep import. | ||
* | ||
* @param {unknown} s | ||
* @returns {s is CopySet} | ||
*/ | ||
export const isCopySet = s => matches(s, M.set()); | ||
// TODO: Undate `@endo/patterns` to export the original, and delete the | ||
// reimplementation here. | ||
/** | ||
* @template K,V | ||
* Should behave identically to the one in `@endo/patterns`, but reimplemented | ||
* for now because `@endo/patterns` forgot to export this one. This one is | ||
* simple enough that I prefer a reimplementation to a deep import. | ||
* | ||
* @param {unknown} m | ||
* @returns {m is CopyMap} | ||
*/ | ||
export const isCopyMap = m => matches(m, M.map()); | ||
/** | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @typedef {object} CurrentKeysKit | ||
@@ -16,3 +46,4 @@ * @property {(k: K, v?: V) => void} assertUpdateOnAdd | ||
/** | ||
* @template K,V | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @param {() => Iterable<K>} getRawKeys | ||
@@ -92,3 +123,4 @@ * @param {(k: K) => boolean} checkHas | ||
* | ||
* @template K,V | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @param {WeakMapStore<K, V>} mapStore | ||
@@ -118,4 +150,4 @@ * @param {K} key | ||
* | ||
* @template K | ||
* @template V | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @param {WeakMapStore<K, V>} store | ||
@@ -170,4 +202,4 @@ */ | ||
/** | ||
* @template K | ||
* @template V | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @typedef {ReturnType<typeof makeAtomicProvider<K, V>>} AtomicProvider<K, V> | ||
@@ -177,3 +209,4 @@ */ | ||
/** | ||
* @template K, V | ||
* @template {Key} K | ||
* @template {Passable} V | ||
* @param {MapStore<K, V[]>} mapStore | ||
@@ -180,0 +213,0 @@ * @param {K} key |
@@ -1,20 +0,13 @@ | ||
/// <reference types="ses"/> | ||
/// <reference types="ses" /> | ||
// Ensure this is a module. | ||
export {}; | ||
/** | ||
* Note TODO https://github.com/endojs/endo/issues/1488 | ||
* | ||
* @typedef {import('@endo/pass-style').Passable} Passable | ||
* @import {Passable, RemotableObject} from '@endo/pass-style' | ||
* @import {CopySet, CopyMap, Pattern} from '@endo/patterns' | ||
* @import {Key} from '@endo/patterns' | ||
*/ | ||
/** @typedef {import('@endo/pass-style').CopyTagged} CopyTagged */ | ||
/** @typedef {import('@endo/patterns').Pattern} Pattern */ | ||
/** @typedef {import('@endo/patterns').Key} Key */ | ||
/** | ||
* @template {Key} [K=Key] | ||
* @typedef {import('@endo/patterns').CopySet<K>} CopySet | ||
*/ | ||
/** | ||
* @template {Key} [K=Key] | ||
* @template {Passable} [V=Passable] | ||
* @typedef {import('@endo/patterns').CopyMap<K, V>} CopyMap | ||
*/ | ||
@@ -59,5 +52,6 @@ /** | ||
// TODO use Key for K | ||
/** | ||
* @template {Key & object} [K=Key] | ||
* @typedef {object} WeakSetStore | ||
* @template K | ||
* @typedef {object} WeakSetStoreMethods | ||
* @property {(key: K) => boolean} has Check if a key exists. The key can be any | ||
@@ -71,8 +65,13 @@ * JavaScript value, though the answer will always be false for keys that | ||
* @property {(key: K) => void} delete Remove the key. Throws if not found. | ||
* @property {(keys: CopySet<K> | Iterable<K>) => void} addAll | ||
* @property {(keys: CopySet<any> | Iterable<K>) => void} addAll | ||
*/ | ||
/** | ||
* @template K | ||
* @typedef {RemotableObject & WeakSetStoreMethods<K>} WeakSetStore | ||
*/ | ||
// TODO use Key for K | ||
/** | ||
* @template {Key} [K=Key] | ||
* @typedef {object} SetStore | ||
* @template K | ||
* @typedef {object} SetStoreMethods | ||
* @property {(key: K) => boolean} has Check if a key exists. The key can be any | ||
@@ -86,13 +85,19 @@ * JavaScript value, though the answer will always be false for keys that | ||
* @property {(key: K) => void} delete Remove the key. Throws if not found. | ||
* @property {(keys: CopySet<K> | Iterable<K>) => void} addAll | ||
* @property {(keys: CopySet<any> | Iterable<K>) => void} addAll | ||
* @property {(keyPatt?: Pattern) => Iterable<K>} keys | ||
* @property {(keyPatt?: Pattern) => Iterable<K>} values | ||
* @property {(keyPatt?: Pattern) => CopySet<K>} snapshot | ||
* @property {(keyPatt?: Pattern) => CopySet<any>} snapshot | ||
* @property {(keyPatt?: Pattern) => number} getSize | ||
* @property {(keyPatt?: Pattern) => void} clear | ||
*/ | ||
/** | ||
* @template K | ||
* @typedef {RemotableObject & SetStoreMethods<K>} SetStore | ||
*/ | ||
// TODO use Key for K | ||
// TODO use Passable for V | ||
/** | ||
* @template {Key & object} [K=Key] | ||
* @template {Passable} [V=Passable] | ||
* @template K | ||
* @template V | ||
* @typedef {object} WeakMapStore | ||
@@ -109,9 +114,11 @@ * @property {(key: K) => boolean} has Check if a key exists. The key can be any | ||
* @property {(key: K) => void} delete Remove the key. Throws if not found. | ||
* @property {(entries: CopyMap<K, V> | Iterable<[K, V]>) => void} addAll | ||
* @property {(entries: CopyMap<any, any> | Iterable<[K, V]>) => void} addAll | ||
*/ | ||
// TODO use Key for K | ||
// TODO use Passable for V | ||
/** | ||
* @template {Key} [K=Key] | ||
* @template {Passable} [V=Passable] | ||
* @typedef {object} MapStore | ||
* @template K | ||
* @template V | ||
* @typedef {object} MapStoreMethods | ||
* @property {(key: K) => boolean} has Check if a key exists. The key can be any | ||
@@ -127,10 +134,18 @@ * JavaScript value, though the answer will always be false for keys that | ||
* @property {(key: K) => void} delete Remove the key. Throws if not found. | ||
* @property {(entries: CopyMap<K, V> | Iterable<[K, V]>) => void} addAll | ||
* @property {(entries: CopyMap<any, Passable> | Iterable<[K, V]>) => void} addAll | ||
* @property {(keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<K>} keys | ||
* @property {(keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<V>} values | ||
* @property {(keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<[K, V]>} entries | ||
* @property {(keyPatt?: Pattern, valuePatt?: Pattern) => CopyMap<K, V>} snapshot | ||
* @property {( | ||
* keyPatt?: Pattern, | ||
* valuePatt?: Pattern, | ||
* ) => CopyMap<any, Passable>} snapshot | ||
* @property {(keyPatt?: Pattern, valuePatt?: Pattern) => number} getSize | ||
* @property {(keyPatt?: Pattern, valuePatt?: Pattern) => void} clear | ||
*/ | ||
/** | ||
* @template [K=any] | ||
* @template [V=any] | ||
* @typedef {RemotableObject & MapStoreMethods<K, V>} MapStore | ||
*/ | ||
@@ -137,0 +152,0 @@ // ///////////////////////// Deprecated Legacy ///////////////////////////////// |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
50228
1082
5
+ Added@endo/errors@^1.2.9
Updated@endo/exo@^1.5.8
Updated@endo/marshal@^1.6.3
Updated@endo/pass-style@^1.4.8
Updated@endo/patterns@^1.4.8