From d59dc415c2fab55871f8d8dc6840280bc5e00ce2 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Thu, 25 Jan 2024 19:52:55 -0800 Subject: [PATCH] refactor: postponed removals and simplifications --- .github/workflows/test-all-packages.yml | 3 - packages/agoric-cli/src/sdk-package-names.js | 1 - packages/assert/src/types.js | 5 +- packages/internal/package.json | 1 + packages/internal/src/index.js | 3 + packages/internal/src/utils.js | 35 +- packages/internal/test/test-utils.js | 47 -- packages/same-structure/CHANGELOG.md | 496 ------------------ packages/same-structure/CONTRIBUTING.md | 49 -- packages/same-structure/NEWS.md | 31 -- packages/same-structure/README.md | 3 - packages/same-structure/index.js | 24 - packages/same-structure/package.json | 47 -- packages/same-structure/tsconfig.json | 10 - packages/store/src/index.js | 19 +- .../store/src/stores/scalarWeakMapStore.js | 8 +- .../store/src/stores/scalarWeakSetStore.js | 8 +- packages/store/src/stores/store-utils.js | 25 - .../src/virtualObjectManager.js | 36 +- 19 files changed, 36 insertions(+), 815 deletions(-) delete mode 100644 packages/same-structure/CHANGELOG.md delete mode 100644 packages/same-structure/CONTRIBUTING.md delete mode 100644 packages/same-structure/NEWS.md delete mode 100644 packages/same-structure/README.md delete mode 100644 packages/same-structure/index.js delete mode 100644 packages/same-structure/package.json delete mode 100644 packages/same-structure/tsconfig.json diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index 63489f5823d..e5eb87a627a 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -145,9 +145,6 @@ jobs: - name: yarn test (notifier) if: (success() || failure()) run: cd packages/notifier && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - - name: yarn test (same-structure) - if: (success() || failure()) - run: cd packages/same-structure && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: yarn test (sparse-ints) if: (success() || failure()) run: cd packages/sparse-ints && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT diff --git a/packages/agoric-cli/src/sdk-package-names.js b/packages/agoric-cli/src/sdk-package-names.js index c98ba06a741..6d55731c6e0 100644 --- a/packages/agoric-cli/src/sdk-package-names.js +++ b/packages/agoric-cli/src/sdk-package-names.js @@ -26,7 +26,6 @@ export default [ "@agoric/network", "@agoric/notifier", "@agoric/pegasus", - "@agoric/same-structure", "@agoric/smart-wallet", "@agoric/solo", "@agoric/sparse-ints", diff --git a/packages/assert/src/types.js b/packages/assert/src/types.js index a4c287e4179..b01ecee9e3b 100644 --- a/packages/assert/src/types.js +++ b/packages/assert/src/types.js @@ -26,7 +26,7 @@ /** * @callback AssertMakeError * - * The `assert.error` method, recording details for the console. + * The `makeError` function, recording details for the console. * * The optional `optDetails` can be a string. * @param {Details} [optDetails] The details of what was asserted @@ -154,7 +154,7 @@ /** * @callback AssertNote - * The `assert.note` method. + * The `errorNote` function. * * Annotate an error with details, potentially to be used by an * augmented console such as the causal console of `console.js`, to @@ -345,6 +345,7 @@ * details: DetailsTag, * Fail: FailTag, * quote: AssertQuote, + * bare: AssertQuote, * makeAssert: MakeAssert, * } } Assert */ diff --git a/packages/internal/package.json b/packages/internal/package.json index ff609e38e2f..127867b3bf2 100755 --- a/packages/internal/package.json +++ b/packages/internal/package.json @@ -22,6 +22,7 @@ "dependencies": { "@agoric/assert": "^0.6.0", "@agoric/base-zone": "^0.1.0", + "@endo/common": "^1.0.2", "@endo/far": "^1.0.2", "@endo/init": "^1.0.2", "@endo/marshal": "^1.1.0", diff --git a/packages/internal/src/index.js b/packages/internal/src/index.js index c13a3a4b456..ee98585a187 100644 --- a/packages/internal/src/index.js +++ b/packages/internal/src/index.js @@ -7,3 +7,6 @@ export * from './debug.js'; export * from './utils.js'; export * from './method-tools.js'; export * from './typeGuards.js'; + +export { objectMap } from '@endo/common/object-map.js'; +export { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; diff --git a/packages/internal/src/utils.js b/packages/internal/src/utils.js index 08a1adbdb96..e15d6a3c333 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -4,10 +4,9 @@ import { deeplyFulfilled, isObject } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; import { makeQueue } from '@endo/stream'; -import { asyncGenerate, makeSet } from 'jessie.js'; +import { asyncGenerate } from 'jessie.js'; const { fromEntries, keys, values } = Object; -const { ownKeys } = Reflect; const { quote: q, Fail } = assert; @@ -15,34 +14,6 @@ export const BASIS_POINTS = 10_000n; /** @template T @typedef {import('@endo/eventual-send').ERef} ERef */ -/** - * Throws if multiple entries use the same property name. Otherwise acts - * like `Object.fromEntries` but hardens the result. - * Use it to protect from property names computed from user-provided data. - * - * @template K,V - * @param {Iterable<[K,V]>} allEntries - * @returns {{[k: K]: V}} - */ -export const fromUniqueEntries = allEntries => { - const entriesArray = [...allEntries]; - const result = harden(fromEntries(entriesArray)); - if (ownKeys(result).length === entriesArray.length) { - return result; - } - const names = makeSet(); - for (const [name, _] of entriesArray) { - if (names.has(name)) { - Fail`collision on property name ${q(name)}: ${entriesArray}`; - } - names.add(name); - } - throw Fail`internal: failed to create object from unique entries`; -}; -harden(fromUniqueEntries); - -export { objectMap } from '@endo/patterns'; - /** * @template T * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify @@ -140,7 +111,8 @@ export const PromiseAllOrErrors = async items => { * trier: () => Promise, * finalizer: (error?: unknown) => Promise, * ) => Promise} - */ export const aggregateTryFinally = async (trier, finalizer) => + */ +export const aggregateTryFinally = async (trier, finalizer) => trier().then( async result => finalizer().then(() => result), async tryError => @@ -166,7 +138,6 @@ export const PromiseAllOrErrors = async items => { * @throws if any value in the object entries is not defined * @returns {asserts obj is AllDefined} */ - export const assertAllDefined = obj => { const missing = []; for (const [key, val] of Object.entries(obj)) { diff --git a/packages/internal/test/test-utils.js b/packages/internal/test/test-utils.js index ffced4aa0ed..5126686a6fb 100644 --- a/packages/internal/test/test-utils.js +++ b/packages/internal/test/test-utils.js @@ -3,8 +3,6 @@ import test from 'ava'; import { Far } from '@endo/far'; import { - fromUniqueEntries, - objectMap, makeMeasureSeconds, assertAllDefined, whileTrue, @@ -14,51 +12,6 @@ import { synchronizedTee, } from '../src/utils.js'; -test('fromUniqueEntries', t => { - /** @type {[string | symbol, number][]} */ - const goodEntries = [ - ['a', 7], - ['b', 8], - [Symbol.hasInstance, 9], - ]; - const goodObj1 = Object.fromEntries(goodEntries); - t.deepEqual(goodObj1, { - a: 7, - b: 8, - [Symbol.hasInstance]: 9, - }); - const goodObj2 = fromUniqueEntries(goodEntries); - t.deepEqual(goodObj2, goodObj1); - - /** @type {[string | symbol, number][]} */ - const badEntries = [ - ['a', 7], - ['a', 8], - [Symbol.hasInstance, 9], - ]; - const badObj = Object.fromEntries(badEntries); - t.deepEqual(badObj, { - a: 8, - [Symbol.hasInstance]: 9, - }); - t.throws(() => fromUniqueEntries(badEntries), { - message: /^collision on property name "a": .*$/, - }); -}); - -test('objectMap', t => { - // @ts-expect-error - t.throws(() => objectMap({ a: 1 }), { message: 'mapFn is not a function' }); - t.deepEqual( - objectMap({ a: 1 }, val => val * 2), - { a: 2 }, - ); - t.deepEqual( - objectMap({ a: 1 }, (val, key) => `${key}:${val}`), - { a: 'a:1' }, - ); -}); - test('deeplyFulfilledObject', async t => { const someFar = Far('somefar', { getAsync: () => Promise.resolve('async') }); const unfulfilled = harden({ diff --git a/packages/same-structure/CHANGELOG.md b/packages/same-structure/CHANGELOG.md deleted file mode 100644 index 36f1b54921d..00000000000 --- a/packages/same-structure/CHANGELOG.md +++ /dev/null @@ -1,496 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -### [0.2.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.6...@agoric/same-structure@0.2.7) (2023-06-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.5...@agoric/same-structure@0.2.6) (2023-05-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.3...@agoric/same-structure@0.2.5) (2023-05-19) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.3...@agoric/same-structure@0.2.4) (2023-02-17) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.2...@agoric/same-structure@0.2.3) (2022-10-05) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.1...@agoric/same-structure@0.2.2) (2022-09-20) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.0...@agoric/same-structure@0.2.1) (2022-05-28) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.2.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.31...@agoric/same-structure@0.2.0) (2022-04-18) - - -### ⚠ BREAKING CHANGES - -* consistent Node engine requirement (>=14.15.0) - -### Miscellaneous Chores - -* consistent Node engine requirement (>=14.15.0) ([ddc40fa](https://github.com/Agoric/agoric-sdk/commit/ddc40fa525f845ed900512c38b99f01458a3d131)) - - - -### [0.1.31](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.30...@agoric/same-structure@0.1.31) (2022-02-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.30](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.29...@agoric/same-structure@0.1.30) (2022-02-21) - - -### Bug Fixes - -* extract early changes from PR 4136 ([#4190](https://github.com/Agoric/agoric-sdk/issues/4190)) ([fea822e](https://github.com/Agoric/agoric-sdk/commit/fea822ec75c27c8758b872730424c0a3f1a1c623)) - - - -### [0.1.29](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.28...@agoric/same-structure@0.1.29) (2021-12-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.28](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.27...@agoric/same-structure@0.1.28) (2021-10-13) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.27](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.26...@agoric/same-structure@0.1.27) (2021-09-23) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.26](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.25...@agoric/same-structure@0.1.26) (2021-09-15) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.25](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.24...@agoric/same-structure@0.1.25) (2021-08-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.24](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.23...@agoric/same-structure@0.1.24) (2021-08-17) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.23](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.20...@agoric/same-structure@0.1.23) (2021-08-15) - - -### Bug Fixes - -* **same-structure:** Support NESM importers ([123227e](https://github.com/Agoric/agoric-sdk/commit/123227eb83c520b9c64506d2f898815163b4e9e0)) - -### 0.26.10 (2021-07-28) - - - -### [0.1.22](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.20...@agoric/same-structure@0.1.22) (2021-08-14) - - -### Bug Fixes - -* **same-structure:** Support NESM importers ([123227e](https://github.com/Agoric/agoric-sdk/commit/123227eb83c520b9c64506d2f898815163b4e9e0)) - -### 0.26.10 (2021-07-28) - - - -### [0.1.21](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.20...@agoric/same-structure@0.1.21) (2021-07-28) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.20](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.19...@agoric/same-structure@0.1.20) (2021-07-01) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.19](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.18...@agoric/same-structure@0.1.19) (2021-06-28) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.18](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.17...@agoric/same-structure@0.1.18) (2021-06-25) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.17](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.16...@agoric/same-structure@0.1.17) (2021-06-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.16](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.15...@agoric/same-structure@0.1.16) (2021-06-23) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.15](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.14...@agoric/same-structure@0.1.15) (2021-06-16) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.14](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.13...@agoric/same-structure@0.1.14) (2021-06-15) - - -### Bug Fixes - -* Pin ESM to forked version ([54dbb55](https://github.com/Agoric/agoric-sdk/commit/54dbb55d64d7ff7adb395bc4bd9d1461dd2d3c17)) - - - -## [0.1.13](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.12...@agoric/same-structure@0.1.13) (2021-05-10) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.11...@agoric/same-structure@0.1.12) (2021-05-05) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.10...@agoric/same-structure@0.1.11) (2021-05-05) - - -### Bug Fixes - -* settle REMOTE_STYLE name ([#2900](https://github.com/Agoric/agoric-sdk/issues/2900)) ([3dc6638](https://github.com/Agoric/agoric-sdk/commit/3dc66385b85cb3e8a1056b8d6e64cd3e448c041f)) -* split marshal module ([#2803](https://github.com/Agoric/agoric-sdk/issues/2803)) ([2e19e78](https://github.com/Agoric/agoric-sdk/commit/2e19e7878bc06dd71e166e13c9cce462b3d5ff7a)) - - - - - -## [0.1.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.9...@agoric/same-structure@0.1.10) (2021-04-22) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.8...@agoric/same-structure@0.1.9) (2021-04-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.7...@agoric/same-structure@0.1.8) (2021-04-16) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.6...@agoric/same-structure@0.1.7) (2021-04-14) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.5...@agoric/same-structure@0.1.6) (2021-04-07) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.4...@agoric/same-structure@0.1.5) (2021-04-06) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.3...@agoric/same-structure@0.1.4) (2021-03-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.2...@agoric/same-structure@0.1.3) (2021-03-16) - - -### Bug Fixes - -* make separate 'test:xs' target, remove XS from 'test' target ([b9c1a69](https://github.com/Agoric/agoric-sdk/commit/b9c1a6987093fc8e09e8aba7acd2a1618413bac8)), closes [#2647](https://github.com/Agoric/agoric-sdk/issues/2647) - - - - - -## [0.1.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.1...@agoric/same-structure@0.1.2) (2021-02-22) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.0...@agoric/same-structure@0.1.1) (2021-02-16) - - -### Bug Fixes - -* review comments ([7db7e5c](https://github.com/Agoric/agoric-sdk/commit/7db7e5c4c569dfedff8d748dd58893218b0a2458)) -* use assert rather than FooError constructors ([f860c5b](https://github.com/Agoric/agoric-sdk/commit/f860c5bf5add165a08cb5bd543502857c3f57998)) - - - - - -# [0.1.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.12...@agoric/same-structure@0.1.0) (2020-12-10) - - -### Features - -* **import-bundle:** Preliminary support Endo zip hex bundle format ([#1983](https://github.com/Agoric/agoric-sdk/issues/1983)) ([983681b](https://github.com/Agoric/agoric-sdk/commit/983681bfc4bf512b6bd90806ed9220cd4fefc13c)) - - - - - -## [0.0.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.12-dev.0...@agoric/same-structure@0.0.12) (2020-11-07) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.12-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11...@agoric/same-structure@0.0.12-dev.0) (2020-10-19) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11-dev.2...@agoric/same-structure@0.0.11) (2020-10-11) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11-dev.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11-dev.1...@agoric/same-structure@0.0.11-dev.2) (2020-09-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11-dev.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11-dev.0...@agoric/same-structure@0.0.11-dev.1) (2020-09-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.10...@agoric/same-structure@0.0.11-dev.0) (2020-09-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.9...@agoric/same-structure@0.0.10) (2020-09-16) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.8...@agoric/same-structure@0.0.9) (2020-08-31) - - -### Bug Fixes - -* reduce inconsistency among our linting rules ([#1492](https://github.com/Agoric/agoric-sdk/issues/1492)) ([b6b675e](https://github.com/Agoric/agoric-sdk/commit/b6b675e2de110e2af19cad784a66220cab21dacf)) -* use REMOTE_STYLE rather than 'presence' to prepare ([#1577](https://github.com/Agoric/agoric-sdk/issues/1577)) ([6b97ae8](https://github.com/Agoric/agoric-sdk/commit/6b97ae8670303631313a65d12393d7ad226b941d)) - - - - - -## [0.0.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.7...@agoric/same-structure@0.0.8) (2020-06-30) - - -### Bug Fixes - -* replace openDetail with quoting q ([#1134](https://github.com/Agoric/agoric-sdk/issues/1134)) ([67808a4](https://github.com/Agoric/agoric-sdk/commit/67808a4df515630ef7dc77c59054382f626ece96)) - - - - - -## [0.0.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.6...@agoric/same-structure@0.0.7) (2020-05-17) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.5...@agoric/same-structure@0.0.6) (2020-05-10) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.4...@agoric/same-structure@0.0.5) (2020-05-04) - - -### Bug Fixes - -* use the new (typed) harden package ([2eb1af0](https://github.com/Agoric/agoric-sdk/commit/2eb1af08fe3967629a3ce165752fd501a5c85a96)) - - - - - -## [0.0.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.4-alpha.0...@agoric/same-structure@0.0.4) (2020-04-13) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.4-alpha.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.3...@agoric/same-structure@0.0.4-alpha.0) (2020-04-12) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.3-alpha.0...@agoric/same-structure@0.0.3) (2020-04-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.3-alpha.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.2...@agoric/same-structure@0.0.3-alpha.0) (2020-04-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## 0.0.2 (2020-03-26) - - -### Bug Fixes - -* first draft use collection equality ([6acbde7](https://github.com/Agoric/agoric-sdk/commit/6acbde71ec82101ec8da9eaafc729bab1fdd6df9)) diff --git a/packages/same-structure/CONTRIBUTING.md b/packages/same-structure/CONTRIBUTING.md deleted file mode 100644 index 6012771398b..00000000000 --- a/packages/same-structure/CONTRIBUTING.md +++ /dev/null @@ -1,49 +0,0 @@ -# Contributing - -Thank you! - -## Contact - -We use github issues for all bug reports: -https://github.com/Agoric/agoric-sdk/issues Please add a [same-structure] -prefix to the title and `same-structure` tag to same-structure-related issues. - -## Installing, Testing - -You'll need Node.js version 11 or higher. - -* `git clone https://github.com/Agoric/agoric-sdk/` -* `cd agoric-sdk` -* `yarn install` -* `yarn build` (This *must* be done at the top level to build all of - the packages) -* `cd packages/same-structure` -* `yarn test` - -## Pull Requests - -Before submitting a pull request, please: - -* run `yarn test` within `packages/same-structure` and make sure all the unit - tests pass (running `yarn test` at the top level will test all the - monorepo packages, which can be a good integration test.) -* run `yarn run lint-fix` to reformat the code according to our - `eslint` profile, and fix any complaints that it can't automatically - correct - -## Making a Release - -* edit NEWS.md enumerating any user-visible changes. (If there are - changelogs/ snippets, consolidate them to build the new NEWS - entries, and then delete all the snippets.) -* make sure `yarn config set version-git-tag false` is the current - setting -* `yarn version` (interactive) or `yarn version --major` or `yarn version --minor` - * that changes `package.json` - * and does NOT do a `git commit` and `git tag` -* `git add .` -* `git commit -m "bump version"` -* `git tag -a same-structure-v$VERSION -m "same-structure-v$VERSION"` -* `yarn publish --access public` -* `git push` -* `git push origin same-structure-v$VERSION` diff --git a/packages/same-structure/NEWS.md b/packages/same-structure/NEWS.md deleted file mode 100644 index 2f20818b678..00000000000 --- a/packages/same-structure/NEWS.md +++ /dev/null @@ -1,31 +0,0 @@ -User-visible changes in @agoric/same-structure: - -## Next Release - -This entire package is now deprecated, with its code migrated -to `@agoric/store` with the exports renamed to their modern -names. This package remains for now in order to -re-export the new names from `@agoric/store` under the old -deprecated names that this package used to export. Please update -uses to the new names as imported from `@agoric/store`. -```js -import { - sameStructure, - isComparable, - mustBeComparable, - allComparable, -} from '@agoric/same-structure'; -``` -to -```js -import { - keyEQ, - isKey, - assertKey, - fulfillToKey, -} from '@endo/marshal'; - -## Release 0.0.1 (3-Feb-2020) - -Moved out of ERTP and created new package `@agoric/same-structure`. -Now depends on `@agoric/insist`. diff --git a/packages/same-structure/README.md b/packages/same-structure/README.md deleted file mode 100644 index eea59758c4c..00000000000 --- a/packages/same-structure/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Same Structure - -Deprecated. See [NEWS.md](./NEWS.md) diff --git a/packages/same-structure/index.js b/packages/same-structure/index.js deleted file mode 100644 index b6d9602d45d..00000000000 --- a/packages/same-structure/index.js +++ /dev/null @@ -1,24 +0,0 @@ -// This entire package is now deprecated, with its code migrated -// to `@endo/marshal` and `@agoric/store` with the exports renamed to their -// modern names. -// -// This package remains for now in order to -// re-export the new names from `@endo/marshal` and `@agoric/store` under -// the old deprecated names that this package used to export. Please update -// uses to the new names as imported from `@endo/marshal` -// and`@agoric/store`. - -import { keyEQ, isKey, assertKey } from '@agoric/store'; -import { deeplyFulfilled } from '@endo/marshal'; - -/** @deprecated Use `keyEQ` from `'@agoric/store'` */ -export const sameStructure = keyEQ; - -/** @deprecated Use `isKey` from `'@agoric/store'` */ -export const isComparable = isKey; - -/** @deprecated Use `assertKey` from `'@agoric/store'` */ -export const mustBeComparable = assertKey; - -/** @deprecated Use `deeplyFulfilled` from `'@endo/marshal'` */ -export const allComparable = deeplyFulfilled; diff --git a/packages/same-structure/package.json b/packages/same-structure/package.json deleted file mode 100644 index e82af41200b..00000000000 --- a/packages/same-structure/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@agoric/same-structure", - "version": "0.2.7", - "description": "Deep equals", - "type": "module", - "main": "index.js", - "engines": { - "node": ">=14.15.0" - }, - "scripts": { - "build": "exit 0", - "test": "exit 0", - "test:xs": "exit 0", - "lint": "run-s --continue-on-error lint:*", - "lint-fix": "yarn lint:eslint --fix", - "lint:eslint": "eslint ." - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Agoric/agoric-sdk.git" - }, - "keywords": [ - "deepEquals", - "equals" - ], - "author": "Agoric", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/Agoric/agoric-sdk/issues" - }, - "homepage": "https://github.com/Agoric/agoric-sdk#readme", - "dependencies": { - "@agoric/assert": "^0.6.0", - "@agoric/store": "^0.9.2", - "@endo/marshal": "^1.1.0" - }, - "files": [ - "*.js", - "NEWS.md" - ], - "publishConfig": { - "access": "public" - }, - "typeCoverage": { - "atLeast": 100 - } -} diff --git a/packages/same-structure/tsconfig.json b/packages/same-structure/tsconfig.json deleted file mode 100644 index d5d92ea21eb..00000000000 --- a/packages/same-structure/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -// This file can contain .js-specific Typescript compiler config. -{ - "extends": "../../tsconfig.json", - "include": [ - "*.js", - "scripts/**/*.js", - "src/**/*.js", - "test/**/*.js", - ], -} diff --git a/packages/store/src/index.js b/packages/store/src/index.js index 7cafb3cb149..92188765007 100755 --- a/packages/store/src/index.js +++ b/packages/store/src/index.js @@ -1,3 +1,13 @@ +export { makeScalarWeakSetStore } from './stores/scalarWeakSetStore.js'; +export { makeScalarSetStore } from './stores/scalarSetStore.js'; +export { makeScalarWeakMapStore } from './stores/scalarWeakMapStore.js'; +export { makeScalarMapStore } from './stores/scalarMapStore.js'; + +export { provideLazy } from './stores/store-utils.js'; + +// /////////////////////// Deprecated Re-exports /////////////////////////////// +// Importers should import directly from the packages shown below + export { isKey, assertKey, @@ -42,6 +52,8 @@ export { assertPattern, matches, mustMatch, + isCopySet, + isCopyMap, } from '@endo/patterns'; export { @@ -51,13 +63,6 @@ export { makeExo, } from '@endo/exo'; -export { makeScalarWeakSetStore } from './stores/scalarWeakSetStore.js'; -export { makeScalarSetStore } from './stores/scalarSetStore.js'; -export { makeScalarWeakMapStore } from './stores/scalarWeakMapStore.js'; -export { makeScalarMapStore } from './stores/scalarMapStore.js'; - -export { provideLazy, isCopyMap, isCopySet } from './stores/store-utils.js'; - // /////////////////////// Deprecated Legacy /////////////////////////////////// export { makeLegacyMap } from './legacy/legacyMap.js'; diff --git a/packages/store/src/stores/scalarWeakMapStore.js b/packages/store/src/stores/scalarWeakMapStore.js index 9bd3db54823..1062ac554b8 100644 --- a/packages/store/src/stores/scalarWeakMapStore.js +++ b/packages/store/src/stores/scalarWeakMapStore.js @@ -1,6 +1,10 @@ import { Far, assertPassable, passStyleOf } from '@endo/pass-style'; -import { getCopyMapEntries, mustMatch, assertPattern } from '@endo/patterns'; -import { isCopyMap } from './store-utils.js'; +import { + getCopyMapEntries, + mustMatch, + assertPattern, + isCopyMap, +} from '@endo/patterns'; const { quote: q, Fail } = assert; diff --git a/packages/store/src/stores/scalarWeakSetStore.js b/packages/store/src/stores/scalarWeakSetStore.js index 4a256ba9207..68bcdfd594e 100644 --- a/packages/store/src/stores/scalarWeakSetStore.js +++ b/packages/store/src/stores/scalarWeakSetStore.js @@ -1,6 +1,10 @@ import { Far, passStyleOf } from '@endo/pass-style'; -import { getCopySetKeys, mustMatch, assertPattern } from '@endo/patterns'; -import { isCopySet } from './store-utils.js'; +import { + getCopySetKeys, + mustMatch, + assertPattern, + isCopySet, +} from '@endo/patterns'; const { quote: q, Fail } = assert; diff --git a/packages/store/src/stores/store-utils.js b/packages/store/src/stores/store-utils.js index b6a359bbce8..df5661005c4 100644 --- a/packages/store/src/stores/store-utils.js +++ b/packages/store/src/stores/store-utils.js @@ -1,34 +1,9 @@ import { Far } from '@endo/marshal'; -import { M, matches } from '@endo/patterns'; /** @typedef {import('@endo/marshal').RankCompare} RankCompare */ 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 {Passable} 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. -/** - * 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 {Passable} m - * @returns {m is CopyMap} - */ -export const isCopyMap = m => matches(m, M.map()); - /** * @template K,V * @typedef {object} CurrentKeysKit diff --git a/packages/swingset-liveslots/src/virtualObjectManager.js b/packages/swingset-liveslots/src/virtualObjectManager.js index f5d59914e2c..9b92d589052 100644 --- a/packages/swingset-liveslots/src/virtualObjectManager.js +++ b/packages/swingset-liveslots/src/virtualObjectManager.js @@ -17,23 +17,9 @@ import { /** @template T @typedef {import('@agoric/vat-data').DefineKindOptions} DefineKindOptions */ /** - * @typedef {( - * representative: any - * ) => import('@endo/exo/src/exo-tools.js').ClassContext | undefined} ClassContextProvider - * Definition only temporarily copied from exo-tools.js to here. - * TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` incorporating - * https://github.com/endojs/endo/pull/1966 - * then replace with the following (fixing the implied "@") + * @typedef {import('@endo/exo/src/exo-tools.js').ClassContextProvider } ClassContextProvider * - * at-typedef {import('@endo/exo/src/exo-tools.js').ClassContextProvider } ClassContextProvider - * - * @typedef {(facet: any) => import('@endo/exo/src/exo-tools.js').KitContext | undefined} KitContextProvider - * Definition only temporarily copied from exo-tools.js to here. - * TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` incorporating - * https://github.com/endojs/endo/pull/1966 - * then replace with the following (fixing the implied "@") - * - * at-typedef {import('@endo/exo/src/exo-tools.js').KitContextProvider } KitContextProvider + * @typedef {import('@endo/exo/src/exo-tools.js').KitContextProvider } KitContextProvider */ /** @@ -1005,15 +991,6 @@ export const makeVirtualObjectManager = ( proto = defendPrototypeKit( tag, - // TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` - // incorporating https://github.com/endojs/endo/pull/1966 - // Then the following at-ts-ignore will no longer be needed. - // However, it is an at-ts-ignore rather than an - // at-ts-expect-error to be compat with endo both before and - // after, until we're safely across the transition. - // - // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error - // @ts-ignore harden(contextProviderKit), behavior, thisfulMethods, @@ -1028,15 +1005,6 @@ export const makeVirtualObjectManager = ( }; proto = defendPrototype( tag, - // TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` - // incorporating https://github.com/endojs/endo/pull/1966 - // Then the following at-ts-ignore will no longer be needed. - // However, it is an at-ts-ignore rather than an - // at-ts-expect-error to be compat with endo both before and - // after, until we're safely across the transition. - // - // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error - // @ts-ignore harden(contextProvider), behavior, thisfulMethods,