From 8ea8b640f0446c0575d872f39a1988131ed0a565 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 7 Jun 2025 15:02:33 +0000 Subject: [PATCH] internal: Publish new version --- .changeset/big-impalas-tap.md | 28 -- .changeset/brave-bats-itch.md | 9 - .changeset/cold-walls-like.md | 6 - .changeset/forty-masks-join.md | 7 - .changeset/grumpy-dogs-decide.md | 36 --- .changeset/legal-files-fly.md | 24 -- .changeset/major-boxes-glow.md | 26 -- .changeset/open-shrimps-warn.md | 38 --- .changeset/poor-jobs-turn.md | 41 --- .changeset/proud-insects-smile.md | 49 ---- .changeset/proud-taxes-bake.md | 42 --- .changeset/shiny-olives-behave.md | 5 - .changeset/sixty-monkeys-open.md | 7 - .changeset/smart-dodos-hear.md | 5 - .changeset/sour-horses-give.md | 22 -- .changeset/stale-socks-accept.md | 18 -- .changeset/ten-lions-retire.md | 9 - .changeset/thirty-islands-hope.md | 8 - .changeset/tough-areas-show.md | 9 - .changeset/two-bees-scream.md | 6 - .changeset/wicked-bags-appear.md | 43 --- .changeset/wicked-feet-cheat.md | 7 - examples/benchmark/CHANGELOG.md | 9 + examples/benchmark/package.json | 2 +- examples/coin-app/CHANGELOG.md | 9 + examples/coin-app/package.json | 8 +- examples/normalizr-github/CHANGELOG.md | 8 + examples/normalizr-github/package.json | 2 +- examples/normalizr-redux/CHANGELOG.md | 8 + examples/normalizr-redux/package.json | 2 +- examples/normalizr-relationships/CHANGELOG.md | 8 + examples/normalizr-relationships/package.json | 2 +- examples/test-bundlesize/CHANGELOG.md | 10 + examples/test-bundlesize/package.json | 8 +- packages/core/CHANGELOG.md | 110 +++++++ packages/core/package.json | 4 +- packages/endpoint/CHANGELOG.md | 189 ++++++++++++ packages/endpoint/package.json | 2 +- packages/graphql/CHANGELOG.md | 143 +++++++++ packages/graphql/package.json | 4 +- packages/img/CHANGELOG.md | 13 + packages/img/package.json | 4 +- packages/normalizr/CHANGELOG.md | 273 ++++++++++++++++++ packages/normalizr/package.json | 2 +- packages/react/CHANGELOG.md | 128 ++++++++ packages/react/package.json | 4 +- packages/rest/CHANGELOG.md | 145 ++++++++++ packages/rest/package.json | 4 +- packages/test/CHANGELOG.md | 23 ++ packages/test/package.json | 2 +- yarn.lock | 34 +-- 51 files changed, 1118 insertions(+), 487 deletions(-) delete mode 100644 .changeset/big-impalas-tap.md delete mode 100644 .changeset/brave-bats-itch.md delete mode 100644 .changeset/cold-walls-like.md delete mode 100644 .changeset/forty-masks-join.md delete mode 100644 .changeset/grumpy-dogs-decide.md delete mode 100644 .changeset/legal-files-fly.md delete mode 100644 .changeset/major-boxes-glow.md delete mode 100644 .changeset/open-shrimps-warn.md delete mode 100644 .changeset/poor-jobs-turn.md delete mode 100644 .changeset/proud-insects-smile.md delete mode 100644 .changeset/proud-taxes-bake.md delete mode 100644 .changeset/shiny-olives-behave.md delete mode 100644 .changeset/sixty-monkeys-open.md delete mode 100644 .changeset/smart-dodos-hear.md delete mode 100644 .changeset/sour-horses-give.md delete mode 100644 .changeset/stale-socks-accept.md delete mode 100644 .changeset/ten-lions-retire.md delete mode 100644 .changeset/thirty-islands-hope.md delete mode 100644 .changeset/tough-areas-show.md delete mode 100644 .changeset/two-bees-scream.md delete mode 100644 .changeset/wicked-bags-appear.md delete mode 100644 .changeset/wicked-feet-cheat.md create mode 100644 examples/test-bundlesize/CHANGELOG.md diff --git a/.changeset/big-impalas-tap.md b/.changeset/big-impalas-tap.md deleted file mode 100644 index 41e74d826def..000000000000 --- a/.changeset/big-impalas-tap.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -'@data-client/normalizr': patch ---- - -Add /imm exports path for handling ImmutableJS state - -#### MemoCache - -```ts -import { MemoCache } from '@data-client/normalizr'; -import { MemoPolicy } from '@data-client/normalizr/imm'; - -const memo = new MemoCache(MemoPolicy); - -// entities is an ImmutableJS Map -const value = MemoCache.denormalize(Todo, '1', entities); -``` - -#### denormalize - -non-memoized denormalize - -```ts -import { denormalize } from '@data-client/normalizr/imm'; - -// entities is an ImmutableJS Map -const value = denormalize(Todo, '1', entities); -``` \ No newline at end of file diff --git a/.changeset/brave-bats-itch.md b/.changeset/brave-bats-itch.md deleted file mode 100644 index e8dfbefe7cdd..000000000000 --- a/.changeset/brave-bats-itch.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@data-client/normalizr': minor ---- - -BREAKING CHANGE: Denormalize always transforms immutablejs entities into the class - -Previously using ImmutableJS structures when calling denormalize() would maintain -nested schemas as immutablejs structures still. Now everything is converted to normal JS. -This is how the types have always been specified. diff --git a/.changeset/cold-walls-like.md b/.changeset/cold-walls-like.md deleted file mode 100644 index 406600556ad3..000000000000 --- a/.changeset/cold-walls-like.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@data-client/core': patch -'@data-client/react': patch ---- - -Fix controller.get and controller.getQueryMeta 'state' argument types diff --git a/.changeset/forty-masks-join.md b/.changeset/forty-masks-join.md deleted file mode 100644 index 8c0742b95ecb..000000000000 --- a/.changeset/forty-masks-join.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/endpoint': patch -'@data-client/graphql': patch -'@data-client/rest': patch ---- - -Fix: ensure string id in Entity set when process returns undefined (meaning INVALID) diff --git a/.changeset/grumpy-dogs-decide.md b/.changeset/grumpy-dogs-decide.md deleted file mode 100644 index 0aad634d55fd..000000000000 --- a/.changeset/grumpy-dogs-decide.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -'@data-client/react': minor ---- - -BREAKING CHANGE: useDebounce() returns [val, isPending] - -This was previously exported in `@data-client/react/next` to make migrations easy. This will -still be available there. - -#### Before - -```ts -import { useDebounce } from '@data-client/react'; -const debouncedQuery = useDebounce(query, 100); -``` - -#### After - -```ts -import { useDebounce } from '@data-client/react'; -const [debouncedQuery] = useDebounce(query, 100); -``` - -#### Before - -```ts -import { useDebounce } from '@data-client/react/next'; -const [debouncedQuery, isPending] = useDebounce(query, 100); -``` - -#### After - -```ts -import { useDebounce } from '@data-client/react'; -const [debouncedQuery, isPending] = useDebounce(query, 100); -``` \ No newline at end of file diff --git a/.changeset/legal-files-fly.md b/.changeset/legal-files-fly.md deleted file mode 100644 index b59f2aa1981e..000000000000 --- a/.changeset/legal-files-fly.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -'@data-client/normalizr': minor ---- - -BREAKING: denormalize no longer detects ImmutableJS state - -Use `/imm` exports to handle ImmutableJS state - -#### Before - -```ts -import { MemoCache, denormalize } from '@data-client/normalizr'; - -const memo = new MemoCache(); -``` - -#### After - -```ts -import { MemoCache } from '@data-client/normalizr'; -import { MemoPolicy, denormalize } from '@data-client/normalizr/imm'; - -const memo = new MemoCache(MemoPolicy); -``` diff --git a/.changeset/major-boxes-glow.md b/.changeset/major-boxes-glow.md deleted file mode 100644 index 262b40d0f24a..000000000000 --- a/.changeset/major-boxes-glow.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -'@data-client/normalizr': minor -'@data-client/endpoint': minor -'@data-client/rest': minor -'@data-client/graphql': minor ---- - -Add delegate.INVALID to queryKey - -This is used in schema.All.queryKey(). - -#### Before - -```ts -queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { - if (!found) return INVALID; -} -``` - -#### After - -```ts -queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { - if (!found) return delegate.INVALID; -} -``` diff --git a/.changeset/open-shrimps-warn.md b/.changeset/open-shrimps-warn.md deleted file mode 100644 index 423b862f1887..000000000000 --- a/.changeset/open-shrimps-warn.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -'@data-client/normalizr': minor -'@data-client/endpoint': minor -'@data-client/rest': minor -'@data-client/graphql': minor ---- - -Add delegate.invalidate() to normalization - -#### Before - -```ts -normalize( - input: any, - parent: any, - key: string | undefined, - args: any[], - visit: (...args: any) => any, - delegate: INormalizeDelegate, -): string { - delegate.setEntity(this as any, pk, INVALID); -} -``` - -#### After - -```ts -normalize( - input: any, - parent: any, - key: string | undefined, - args: any[], - visit: (...args: any) => any, - delegate: INormalizeDelegate, -): string { - delegate.invalidate(this as any, pk); -} -``` \ No newline at end of file diff --git a/.changeset/poor-jobs-turn.md b/.changeset/poor-jobs-turn.md deleted file mode 100644 index a39580602188..000000000000 --- a/.changeset/poor-jobs-turn.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -'@data-client/normalizr': minor ---- - -BREAKING CHANGE: MemoCache.query() and MemoCache.buildQueryKey() take state as one argument - -#### Before - -```ts -this.memo.buildQueryKey( - schema, - args, - state.entities, - state.indexes, - key, -); -``` - - -#### After - -```ts -this.memo.buildQueryKey( - schema, - args, - state, - key, -); -``` - -#### Before - -```ts -this.memo.query(schema, args, state.entities, state.indexes); -``` - -#### After - -```ts -this.memo.query(schema, args, state); -``` \ No newline at end of file diff --git a/.changeset/proud-insects-smile.md b/.changeset/proud-insects-smile.md deleted file mode 100644 index 4d4999da6293..000000000000 --- a/.changeset/proud-insects-smile.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -'@data-client/normalizr': minor -'@data-client/endpoint': minor -'@data-client/core': minor -'@data-client/graphql': minor -'@data-client/react': minor -'@data-client/rest': minor ---- - -BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate) - -We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. - -```ts -/** Helpers during schema.normalize() */ -export interface INormalizeDelegate { - /** Action meta-data for this normalize call */ - readonly meta: { fetchedAt: number; date: number; expiresAt: number }; - /** Gets any previously normalized entity from store */ - getEntity: GetEntity; - /** Updates an entity using merge lifecycles when it has previously been set */ - mergeEntity( - schema: Mergeable & { indexes?: any }, - pk: string, - incomingEntity: any, - ): void; - /** Sets an entity overwriting any previously set values */ - setEntity( - schema: { key: string; indexes?: any }, - pk: string, - entity: any, - meta?: { fetchedAt: number; date: number; expiresAt: number }, - ): void; - /** Returns true when we're in a cycle, so we should not continue recursing */ - checkLoop(key: string, pk: string, input: object): boolean; -} -``` - -#### Before - -```ts -addEntity(this, processedEntity, id); -``` - -#### After - -```ts -delegate.mergeEntity(this, id, processedEntity); -``` \ No newline at end of file diff --git a/.changeset/proud-taxes-bake.md b/.changeset/proud-taxes-bake.md deleted file mode 100644 index 7861fbb90a2a..000000000000 --- a/.changeset/proud-taxes-bake.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -'@data-client/normalizr': minor -'@data-client/endpoint': minor ---- - -delegate.getEntity(key) -> delegate.getEntities(this.key) - -Return value is a restricted interface with keys() and entries() iterator methods. -This applies to both schema.queryKey and schema.normalize method delegates. - -```ts -const entities = delegate.getEntities(key); - -// foreach on keys -for (const key of entities.keys()) {} -// Object.keys() (convert to array) -return [...entities.keys()]; -// foreach on full entry -for (const [key, entity] of entities.entries()) {} -``` - -#### Before - -```ts -const entities = delegate.getEntity(this.key); -if (entities) - Object.keys(entities).forEach(collectionPk => { - if (!filterCollections(JSON.parse(collectionPk))) return; - delegate.mergeEntity(this, collectionPk, normalizedValue); - }); -``` - -#### After - -```ts -const entities = delegate.getEntities(this.key); -if (entities) - for (const collectionKey of entities.keys()) { - if (!filterCollections(JSON.parse(collectionKey))) continue; - delegate.mergeEntity(this, collectionKey, normalizedValue); - } -``` \ No newline at end of file diff --git a/.changeset/shiny-olives-behave.md b/.changeset/shiny-olives-behave.md deleted file mode 100644 index 7e6dddb88ad9..000000000000 --- a/.changeset/shiny-olives-behave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@data-client/endpoint': patch ---- - -fix: export types needed for EntityMixin diff --git a/.changeset/sixty-monkeys-open.md b/.changeset/sixty-monkeys-open.md deleted file mode 100644 index 5693a0ecae32..000000000000 --- a/.changeset/sixty-monkeys-open.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/normalizr': minor -'@data-client/react': minor -'@data-client/core': minor ---- - -state.entityMeta -> state.entitiesMeta diff --git a/.changeset/smart-dodos-hear.md b/.changeset/smart-dodos-hear.md deleted file mode 100644 index 524304af1349..000000000000 --- a/.changeset/smart-dodos-hear.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@data-client/img': patch ---- - -Update readme example to useSuspense() diff --git a/.changeset/sour-horses-give.md b/.changeset/sour-horses-give.md deleted file mode 100644 index 7bb77527def9..000000000000 --- a/.changeset/sour-horses-give.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -'@data-client/core': minor -'@data-client/test': minor ---- - -Change NetworkManager bookkeeping data structure for inflight fetches - -BREAKING CHANGE: NetworkManager.fetched, NetworkManager.rejectors, NetworkManager.resolvers, NetworkManager.fetchedAt - -> NetworkManager.fetching - - -#### Before - -```ts -if (action.key in this.fetched) -``` - -#### After - -```ts -if (this.fetching.has(action.key)) -``` \ No newline at end of file diff --git a/.changeset/stale-socks-accept.md b/.changeset/stale-socks-accept.md deleted file mode 100644 index 6180a04613bf..000000000000 --- a/.changeset/stale-socks-accept.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -'@data-client/normalizr': minor ---- - -MemoCache.query returns `{ data, paths }` just like denormalize. `data` could be INVALID - -#### Before - -```ts -return this.memo.query(schema, args, state); -``` - -#### After - -```ts -const { data } = this.memo.query(schema, args, state); -return typeof data === 'symbol' ? undefined : (data as any); -``` \ No newline at end of file diff --git a/.changeset/ten-lions-retire.md b/.changeset/ten-lions-retire.md deleted file mode 100644 index c1d0f26c37c1..000000000000 --- a/.changeset/ten-lions-retire.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@data-client/normalizr': patch -'@data-client/core': patch -'@data-client/react': patch ---- - -Improve performance of get/denormalize for small responses - -- 10-20% performance improvement due to removing immutablejs check for every call \ No newline at end of file diff --git a/.changeset/thirty-islands-hope.md b/.changeset/thirty-islands-hope.md deleted file mode 100644 index 68c5d1c102f6..000000000000 --- a/.changeset/thirty-islands-hope.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@data-client/endpoint': patch ---- - -Fix: schema.All() polymorphic handling of Invalidated entities - -In case an Entity is invalidated, schema.All will continue to properly -filter it out of its list. \ No newline at end of file diff --git a/.changeset/tough-areas-show.md b/.changeset/tough-areas-show.md deleted file mode 100644 index 255e85185a7d..000000000000 --- a/.changeset/tough-areas-show.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@data-client/endpoint': minor -'@data-client/graphql': minor -'@data-client/rest': minor ---- - -Remove `INVALID` symbol export - -Schemas can use delegate.invalidate() in normalize() or return delegate.INVALID in queryKey(). \ No newline at end of file diff --git a/.changeset/two-bees-scream.md b/.changeset/two-bees-scream.md deleted file mode 100644 index a8422c9b3481..000000000000 --- a/.changeset/two-bees-scream.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@data-client/test': minor -'@data-client/img': minor ---- - -Support 0.15 of @data-client/react diff --git a/.changeset/wicked-bags-appear.md b/.changeset/wicked-bags-appear.md deleted file mode 100644 index 0f0e970c1c41..000000000000 --- a/.changeset/wicked-bags-appear.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -'@data-client/normalizr': minor -'@data-client/endpoint': minor -'@data-client/core': minor -'@data-client/graphql': minor -'@data-client/react': minor -'@data-client/rest': minor ---- - -BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate) -BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object. - -We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. - -Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments. - -```ts -/** Accessors to the currently processing state while building query */ -export interface IQueryDelegate { - getEntity: GetEntity; - getIndex: GetIndex; -} -``` - -#### Before - -```ts -queryKey(args, queryKey, getEntity, getIndex) { - getIndex(schema.key, indexName, value)[value]; - getEntity(this.key, id); - return queryKey(this.schema, args, getEntity, getIndex); -} -``` - -#### After - -```ts -queryKey(args, unvisit, delegate) { - delegate.getIndex(schema.key, indexName, value); - delegate.getEntity(this.key, id); - return unvisit(this.schema, args); -} -``` diff --git a/.changeset/wicked-feet-cheat.md b/.changeset/wicked-feet-cheat.md deleted file mode 100644 index 4fee53442d54..000000000000 --- a/.changeset/wicked-feet-cheat.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/endpoint': patch -'@data-client/react': patch -'@data-client/rest': patch ---- - -Include GPT link badge in readme diff --git a/examples/benchmark/CHANGELOG.md b/examples/benchmark/CHANGELOG.md index 0201158adc44..ff058a387677 100644 --- a/examples/benchmark/CHANGELOG.md +++ b/examples/benchmark/CHANGELOG.md @@ -1,5 +1,14 @@ # example-benchmark +## 0.4.75 + +### Patch Changes + +- Updated dependencies [[`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`246cde6`](https://github.com/reactive/data-client/commit/246cde6dbeca59eafd10e59d8cd05a6f232fb219), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`66e1906`](https://github.com/reactive/data-client/commit/66e19064d21225c70639f3b4799e54c259ce6905), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`d44d36a`](https://github.com/reactive/data-client/commit/d44d36a7de0a18817486c4f723bf2f0e86ac9677), [`25b153a`](https://github.com/reactive/data-client/commit/25b153a9d80db1bcd17ab5558dfa13b333f112b8), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/normalizr@0.15.0 + - @data-client/core@0.15.0 + - @data-client/endpoint@0.15.0 + ## 0.4.74 ### Patch Changes diff --git a/examples/benchmark/package.json b/examples/benchmark/package.json index fb4e0e7b0b3a..bed6db9b1ed0 100644 --- a/examples/benchmark/package.json +++ b/examples/benchmark/package.json @@ -1,6 +1,6 @@ { "name": "example-benchmark", - "version": "0.4.74", + "version": "0.4.75", "description": "Benchmark for normalizr", "main": "index.js", "author": "Nathaniel Tucker", diff --git a/examples/coin-app/CHANGELOG.md b/examples/coin-app/CHANGELOG.md index 5e5179197da6..c46e0839ba16 100644 --- a/examples/coin-app/CHANGELOG.md +++ b/examples/coin-app/CHANGELOG.md @@ -1,5 +1,14 @@ # coinbase-lite +## 0.0.10 + +### Patch Changes + +- Updated dependencies [[`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`997ca20`](https://github.com/reactive/data-client/commit/997ca209d36e8503ab7684bccc6ddc29d179a0b5), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`b978362`](https://github.com/reactive/data-client/commit/b97836216eb9e8d9a403dd1ed88797f2db777dbb), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`769cb78`](https://github.com/reactive/data-client/commit/769cb78966aed032c90864c701dae2bac0cc1e4d), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/react@0.15.0 + - @data-client/rest@0.15.0 + - @data-client/img@0.15.0 + ## 0.0.9 ### Patch Changes diff --git a/examples/coin-app/package.json b/examples/coin-app/package.json index cc210cb45c60..75e228ddfe23 100644 --- a/examples/coin-app/package.json +++ b/examples/coin-app/package.json @@ -1,6 +1,6 @@ { "name": "coinbase-lite", - "version": "0.0.9", + "version": "0.0.10", "packageManager": "yarn@4.9.2", "description": "Coin App", "scripts": { @@ -45,9 +45,9 @@ "@anansi/core": "^0.20.0", "@anansi/router": "^0.10.0", "@babel/runtime-corejs3": "^7.26.7", - "@data-client/img": "^0.14.0", - "@data-client/react": "^0.14.0", - "@data-client/rest": "^0.14.0", + "@data-client/img": "^0.15.0", + "@data-client/react": "^0.15.0", + "@data-client/rest": "^0.15.0", "core-js": "^3.40.0", "d3": "^7.9.0", "history": "*", diff --git a/examples/normalizr-github/CHANGELOG.md b/examples/normalizr-github/CHANGELOG.md index d0b246c77c8a..3823bc8029db 100644 --- a/examples/normalizr-github/CHANGELOG.md +++ b/examples/normalizr-github/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-github-example +## 0.1.51 + +### Patch Changes + +- Updated dependencies [[`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`246cde6`](https://github.com/reactive/data-client/commit/246cde6dbeca59eafd10e59d8cd05a6f232fb219), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`66e1906`](https://github.com/reactive/data-client/commit/66e19064d21225c70639f3b4799e54c259ce6905), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`25b153a`](https://github.com/reactive/data-client/commit/25b153a9d80db1bcd17ab5558dfa13b333f112b8), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/normalizr@0.15.0 + - @data-client/endpoint@0.15.0 + ## 0.1.50 ### Patch Changes diff --git a/examples/normalizr-github/package.json b/examples/normalizr-github/package.json index 3370793b72d4..8633ae9cf46c 100644 --- a/examples/normalizr-github/package.json +++ b/examples/normalizr-github/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-github-example", - "version": "0.1.50", + "version": "0.1.51", "description": "And example of using Normalizr with github", "main": "index.js", "author": "Paul Armstrong", diff --git a/examples/normalizr-redux/CHANGELOG.md b/examples/normalizr-redux/CHANGELOG.md index e4801ba8088c..6c4477cdb0e5 100644 --- a/examples/normalizr-redux/CHANGELOG.md +++ b/examples/normalizr-redux/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-redux-example +## 0.1.49 + +### Patch Changes + +- Updated dependencies [[`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`246cde6`](https://github.com/reactive/data-client/commit/246cde6dbeca59eafd10e59d8cd05a6f232fb219), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`66e1906`](https://github.com/reactive/data-client/commit/66e19064d21225c70639f3b4799e54c259ce6905), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`25b153a`](https://github.com/reactive/data-client/commit/25b153a9d80db1bcd17ab5558dfa13b333f112b8), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/normalizr@0.15.0 + - @data-client/endpoint@0.15.0 + ## 0.1.48 ### Patch Changes diff --git a/examples/normalizr-redux/package.json b/examples/normalizr-redux/package.json index a209a142a7b1..38436dcb093e 100644 --- a/examples/normalizr-redux/package.json +++ b/examples/normalizr-redux/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-redux-example", - "version": "0.1.48", + "version": "0.1.49", "description": "And example of using Normalizr with Redux", "main": "index.js", "author": "Paul Armstrong", diff --git a/examples/normalizr-relationships/CHANGELOG.md b/examples/normalizr-relationships/CHANGELOG.md index 21c1fc06e3a3..14749196c21e 100644 --- a/examples/normalizr-relationships/CHANGELOG.md +++ b/examples/normalizr-relationships/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-relationships +## 0.1.51 + +### Patch Changes + +- Updated dependencies [[`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`246cde6`](https://github.com/reactive/data-client/commit/246cde6dbeca59eafd10e59d8cd05a6f232fb219), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`66e1906`](https://github.com/reactive/data-client/commit/66e19064d21225c70639f3b4799e54c259ce6905), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`25b153a`](https://github.com/reactive/data-client/commit/25b153a9d80db1bcd17ab5558dfa13b333f112b8), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/normalizr@0.15.0 + - @data-client/endpoint@0.15.0 + ## 0.1.50 ### Patch Changes diff --git a/examples/normalizr-relationships/package.json b/examples/normalizr-relationships/package.json index c39b797540f1..7ad4de081274 100644 --- a/examples/normalizr-relationships/package.json +++ b/examples/normalizr-relationships/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-relationships", - "version": "0.1.50", + "version": "0.1.51", "description": "And example of using Normalizr with relationships", "main": "index.js", "author": "Paul Armstrong", diff --git a/examples/test-bundlesize/CHANGELOG.md b/examples/test-bundlesize/CHANGELOG.md new file mode 100644 index 000000000000..d797501ca8e5 --- /dev/null +++ b/examples/test-bundlesize/CHANGELOG.md @@ -0,0 +1,10 @@ +# test-bundlesize + +## 0.1.1 + +### Patch Changes + +- Updated dependencies [[`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`997ca20`](https://github.com/reactive/data-client/commit/997ca209d36e8503ab7684bccc6ddc29d179a0b5), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`b978362`](https://github.com/reactive/data-client/commit/b97836216eb9e8d9a403dd1ed88797f2db777dbb), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`769cb78`](https://github.com/reactive/data-client/commit/769cb78966aed032c90864c701dae2bac0cc1e4d), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/react@0.15.0 + - @data-client/rest@0.15.0 + - @data-client/img@0.15.0 diff --git a/examples/test-bundlesize/package.json b/examples/test-bundlesize/package.json index a1fb3f21f7a1..0aa4a97c9f9d 100644 --- a/examples/test-bundlesize/package.json +++ b/examples/test-bundlesize/package.json @@ -1,6 +1,6 @@ { "name": "test-bundlesize", - "version": "0.1.0", + "version": "0.1.1", "packageManager": "yarn@4.9.2", "description": "Testing Bundled Size", "scripts": { @@ -38,9 +38,9 @@ }, "dependencies": { "@babel/runtime-corejs3": "^7.26.7", - "@data-client/img": "^0.14.0", - "@data-client/react": "^0.14.0", - "@data-client/rest": "^0.14.0", + "@data-client/img": "^0.15.0", + "@data-client/react": "^0.15.0", + "@data-client/rest": "^0.15.0", "core-js": "^3.40.0", "react": "^19.0.0", "react-dom": "^19.0.0" diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 3422ddf2937a..ba68aff800ab 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,115 @@ # @data-client/core +## 0.15.0 + +### Minor Changes + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate) + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + ```ts + /** Helpers during schema.normalize() */ + export interface INormalizeDelegate { + /** Action meta-data for this normalize call */ + readonly meta: { fetchedAt: number; date: number; expiresAt: number }; + /** Gets any previously normalized entity from store */ + getEntity: GetEntity; + /** Updates an entity using merge lifecycles when it has previously been set */ + mergeEntity( + schema: Mergeable & { indexes?: any }, + pk: string, + incomingEntity: any, + ): void; + /** Sets an entity overwriting any previously set values */ + setEntity( + schema: { key: string; indexes?: any }, + pk: string, + entity: any, + meta?: { fetchedAt: number; date: number; expiresAt: number }, + ): void; + /** Returns true when we're in a cycle, so we should not continue recursing */ + checkLoop(key: string, pk: string, input: object): boolean; + } + ``` + + #### Before + + ```ts + addEntity(this, processedEntity, id); + ``` + + #### After + + ```ts + delegate.mergeEntity(this, id, processedEntity); + ``` + +- [#3451](https://github.com/reactive/data-client/pull/3451) [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d) Thanks [@ntucker](https://github.com/ntucker)! - state.entityMeta -> state.entitiesMeta + +- [#3394](https://github.com/reactive/data-client/pull/3394) [`d44d36a`](https://github.com/reactive/data-client/commit/d44d36a7de0a18817486c4f723bf2f0e86ac9677) Thanks [@ntucker](https://github.com/ntucker)! - Change NetworkManager bookkeeping data structure for inflight fetches + + BREAKING CHANGE: NetworkManager.fetched, NetworkManager.rejectors, NetworkManager.resolvers, NetworkManager.fetchedAt + -> NetworkManager.fetching + + #### Before + + ```ts + if (action.key in this.fetched) + ``` + + #### After + + ```ts + if (this.fetching.has(action.key)) + ``` + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate) + BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object. + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments. + + ```ts + /** Accessors to the currently processing state while building query */ + export interface IQueryDelegate { + getEntity: GetEntity; + getIndex: GetIndex; + } + ``` + + #### Before + + ```ts + queryKey(args, queryKey, getEntity, getIndex) { + getIndex(schema.key, indexName, value)[value]; + getEntity(this.key, id); + return queryKey(this.schema, args, getEntity, getIndex); + } + ``` + + #### After + + ```ts + queryKey(args, unvisit, delegate) { + delegate.getIndex(schema.key, indexName, value); + delegate.getEntity(this.key, id); + return unvisit(this.schema, args); + } + ``` + +### Patch Changes + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - Fix controller.get and controller.getQueryMeta 'state' argument types + +- [#3468](https://github.com/reactive/data-client/pull/3468) [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895) Thanks [@ntucker](https://github.com/ntucker)! - Improve performance of get/denormalize for small responses + + - 10-20% performance improvement due to removing immutablejs check for every call + +- Updated dependencies [[`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`246cde6`](https://github.com/reactive/data-client/commit/246cde6dbeca59eafd10e59d8cd05a6f232fb219), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`66e1906`](https://github.com/reactive/data-client/commit/66e19064d21225c70639f3b4799e54c259ce6905), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`25b153a`](https://github.com/reactive/data-client/commit/25b153a9d80db1bcd17ab5558dfa13b333f112b8), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7)]: + - @data-client/normalizr@0.15.0 + ## 0.14.24 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index f1da2832dcc5..b14d9ed54dd2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/core", - "version": "0.14.24", + "version": "0.15.0", "description": "Async State Management without the Management. REST, GraphQL, SSE, Websockets, Fetch", "sideEffects": false, "main": "dist/index.js", @@ -125,7 +125,7 @@ }, "dependencies": { "@babel/runtime": "^7.20.0", - "@data-client/normalizr": "^0.14.22", + "@data-client/normalizr": "^0.15.0", "flux-standard-action": "^2.1.1" }, "devDependencies": { diff --git a/packages/endpoint/CHANGELOG.md b/packages/endpoint/CHANGELOG.md index 05396a0319eb..35ad1a384e1d 100644 --- a/packages/endpoint/CHANGELOG.md +++ b/packages/endpoint/CHANGELOG.md @@ -1,5 +1,194 @@ # @data-client/endpoint +## 0.15.0 + +### Minor Changes + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.INVALID to queryKey + + This is used in schema.All.queryKey(). + + #### Before + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return INVALID; + } + ``` + + #### After + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return delegate.INVALID; + } + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.invalidate() to normalization + + #### Before + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.setEntity(this as any, pk, INVALID); + } + ``` + + #### After + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.invalidate(this as any, pk); + } + ``` + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate) + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + ```ts + /** Helpers during schema.normalize() */ + export interface INormalizeDelegate { + /** Action meta-data for this normalize call */ + readonly meta: { fetchedAt: number; date: number; expiresAt: number }; + /** Gets any previously normalized entity from store */ + getEntity: GetEntity; + /** Updates an entity using merge lifecycles when it has previously been set */ + mergeEntity( + schema: Mergeable & { indexes?: any }, + pk: string, + incomingEntity: any, + ): void; + /** Sets an entity overwriting any previously set values */ + setEntity( + schema: { key: string; indexes?: any }, + pk: string, + entity: any, + meta?: { fetchedAt: number; date: number; expiresAt: number }, + ): void; + /** Returns true when we're in a cycle, so we should not continue recursing */ + checkLoop(key: string, pk: string, input: object): boolean; + } + ``` + + #### Before + + ```ts + addEntity(this, processedEntity, id); + ``` + + #### After + + ```ts + delegate.mergeEntity(this, id, processedEntity); + ``` + +- [#3468](https://github.com/reactive/data-client/pull/3468) [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895) Thanks [@ntucker](https://github.com/ntucker)! - delegate.getEntity(key) -> delegate.getEntities(this.key) + + Return value is a restricted interface with keys() and entries() iterator methods. + This applies to both schema.queryKey and schema.normalize method delegates. + + ```ts + const entities = delegate.getEntities(key); + + // foreach on keys + for (const key of entities.keys()) { + } + // Object.keys() (convert to array) + return [...entities.keys()]; + // foreach on full entry + for (const [key, entity] of entities.entries()) { + } + ``` + + #### Before + + ```ts + const entities = delegate.getEntity(this.key); + if (entities) + Object.keys(entities).forEach(collectionPk => { + if (!filterCollections(JSON.parse(collectionPk))) return; + delegate.mergeEntity(this, collectionPk, normalizedValue); + }); + ``` + + #### After + + ```ts + const entities = delegate.getEntities(this.key); + if (entities) + for (const collectionKey of entities.keys()) { + if (!filterCollections(JSON.parse(collectionKey))) continue; + delegate.mergeEntity(this, collectionKey, normalizedValue); + } + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Remove `INVALID` symbol export + + Schemas can use delegate.invalidate() in normalize() or return delegate.INVALID in queryKey(). + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate) + BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object. + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments. + + ```ts + /** Accessors to the currently processing state while building query */ + export interface IQueryDelegate { + getEntity: GetEntity; + getIndex: GetIndex; + } + ``` + + #### Before + + ```ts + queryKey(args, queryKey, getEntity, getIndex) { + getIndex(schema.key, indexName, value)[value]; + getEntity(this.key, id); + return queryKey(this.schema, args, getEntity, getIndex); + } + ``` + + #### After + + ```ts + queryKey(args, unvisit, delegate) { + delegate.getIndex(schema.key, indexName, value); + delegate.getEntity(this.key, id); + return unvisit(this.schema, args); + } + ``` + +### Patch Changes + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - Fix: ensure string id in Entity set when process returns undefined (meaning INVALID) + +- [#3480](https://github.com/reactive/data-client/pull/3480) [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141) Thanks [@Tomaszal](https://github.com/Tomaszal)! - fix: export types needed for EntityMixin + +- [#3501](https://github.com/reactive/data-client/pull/3501) [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82) Thanks [@ntucker](https://github.com/ntucker)! - Fix: schema.All() polymorphic handling of Invalidated entities + + In case an Entity is invalidated, schema.All will continue to properly + filter it out of its list. + +- [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8) Thanks [@ntucker](https://github.com/ntucker)! - Include GPT link badge in readme + ## 0.14.25 ### Patch Changes diff --git a/packages/endpoint/package.json b/packages/endpoint/package.json index 97f12dc8aeb1..0efb40f20986 100644 --- a/packages/endpoint/package.json +++ b/packages/endpoint/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/endpoint", - "version": "0.14.25", + "version": "0.15.0", "description": "Declarative Network Interface Definitions", "homepage": "https://dataclient.io/docs/guides/custom-protocol", "keywords": [ diff --git a/packages/graphql/CHANGELOG.md b/packages/graphql/CHANGELOG.md index 6267173bc208..518da80ea6e8 100644 --- a/packages/graphql/CHANGELOG.md +++ b/packages/graphql/CHANGELOG.md @@ -1,5 +1,148 @@ # @data-client/graphql +## 0.15.0 + +### Minor Changes + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.INVALID to queryKey + + This is used in schema.All.queryKey(). + + #### Before + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return INVALID; + } + ``` + + #### After + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return delegate.INVALID; + } + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.invalidate() to normalization + + #### Before + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.setEntity(this as any, pk, INVALID); + } + ``` + + #### After + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.invalidate(this as any, pk); + } + ``` + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate) + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + ```ts + /** Helpers during schema.normalize() */ + export interface INormalizeDelegate { + /** Action meta-data for this normalize call */ + readonly meta: { fetchedAt: number; date: number; expiresAt: number }; + /** Gets any previously normalized entity from store */ + getEntity: GetEntity; + /** Updates an entity using merge lifecycles when it has previously been set */ + mergeEntity( + schema: Mergeable & { indexes?: any }, + pk: string, + incomingEntity: any, + ): void; + /** Sets an entity overwriting any previously set values */ + setEntity( + schema: { key: string; indexes?: any }, + pk: string, + entity: any, + meta?: { fetchedAt: number; date: number; expiresAt: number }, + ): void; + /** Returns true when we're in a cycle, so we should not continue recursing */ + checkLoop(key: string, pk: string, input: object): boolean; + } + ``` + + #### Before + + ```ts + addEntity(this, processedEntity, id); + ``` + + #### After + + ```ts + delegate.mergeEntity(this, id, processedEntity); + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Remove `INVALID` symbol export + + Schemas can use delegate.invalidate() in normalize() or return delegate.INVALID in queryKey(). + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate) + BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object. + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments. + + ```ts + /** Accessors to the currently processing state while building query */ + export interface IQueryDelegate { + getEntity: GetEntity; + getIndex: GetIndex; + } + ``` + + #### Before + + ```ts + queryKey(args, queryKey, getEntity, getIndex) { + getIndex(schema.key, indexName, value)[value]; + getEntity(this.key, id); + return queryKey(this.schema, args, getEntity, getIndex); + } + ``` + + #### After + + ```ts + queryKey(args, unvisit, delegate) { + delegate.getIndex(schema.key, indexName, value); + delegate.getEntity(this.key, id); + return unvisit(this.schema, args); + } + ``` + +### Patch Changes + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - Fix: ensure string id in Entity set when process returns undefined (meaning INVALID) + +- Updated dependencies [[`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141), [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/endpoint@0.15.0 + ## 0.14.25 ### Patch Changes diff --git a/packages/graphql/package.json b/packages/graphql/package.json index d62f3f852c52..764703924074 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/graphql", - "version": "0.14.25", + "version": "0.15.0", "description": "Quickly define typed GraphQL resources and endpoints", "homepage": "https://dataclient.io/docs/graphql", "repository": { @@ -107,7 +107,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.20.0", - "@data-client/endpoint": "^0.14.25" + "@data-client/endpoint": "^0.15.0" }, "devDependencies": { "@anansi/browserslist-config": "^1.4.2", diff --git a/packages/img/CHANGELOG.md b/packages/img/CHANGELOG.md index 2102fc416b8f..7b86b1ffad42 100644 --- a/packages/img/CHANGELOG.md +++ b/packages/img/CHANGELOG.md @@ -1,5 +1,18 @@ # @data-client/img +## 0.15.0 + +### Minor Changes + +- [`769cb78`](https://github.com/reactive/data-client/commit/769cb78966aed032c90864c701dae2bac0cc1e4d) Thanks [@ntucker](https://github.com/ntucker)! - Support 0.15 of @data-client/react + +### Patch Changes + +- [`b978362`](https://github.com/reactive/data-client/commit/b97836216eb9e8d9a403dd1ed88797f2db777dbb) Thanks [@ntucker](https://github.com/ntucker)! - Update readme example to useSuspense() + +- Updated dependencies [[`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141), [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/endpoint@0.15.0 + ## 0.14.21 ### Patch Changes diff --git a/packages/img/package.json b/packages/img/package.json index 5f0e8e5f7929..b890c8339b27 100644 --- a/packages/img/package.json +++ b/packages/img/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/img", - "version": "0.14.21", + "version": "0.15.0", "description": "Suspenseful images", "homepage": "https://dataclient.io/docs/guides/img-media#just-images", "repository": { @@ -75,7 +75,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.20.0", - "@data-client/endpoint": "^0.14.25" + "@data-client/endpoint": "^0.15.0" }, "peerDependencies": { "@data-client/react": "^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0", diff --git a/packages/normalizr/CHANGELOG.md b/packages/normalizr/CHANGELOG.md index 63f8e4f4e4b8..d6ac35998b74 100644 --- a/packages/normalizr/CHANGELOG.md +++ b/packages/normalizr/CHANGELOG.md @@ -1,5 +1,278 @@ # Change Log +## 0.15.0 + +### Minor Changes + +- [#3421](https://github.com/reactive/data-client/pull/3421) [`246cde6`](https://github.com/reactive/data-client/commit/246cde6dbeca59eafd10e59d8cd05a6f232fb219) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: Denormalize always transforms immutablejs entities into the class + + Previously using ImmutableJS structures when calling denormalize() would maintain + nested schemas as immutablejs structures still. Now everything is converted to normal JS. + This is how the types have always been specified. + +- [#3468](https://github.com/reactive/data-client/pull/3468) [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING: denormalize no longer detects ImmutableJS state + + Use `/imm` exports to handle ImmutableJS state + + #### Before + + ```ts + import { MemoCache, denormalize } from '@data-client/normalizr'; + + const memo = new MemoCache(); + ``` + + #### After + + ```ts + import { MemoCache } from '@data-client/normalizr'; + import { MemoPolicy, denormalize } from '@data-client/normalizr/imm'; + + const memo = new MemoCache(MemoPolicy); + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.INVALID to queryKey + + This is used in schema.All.queryKey(). + + #### Before + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return INVALID; + } + ``` + + #### After + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return delegate.INVALID; + } + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.invalidate() to normalization + + #### Before + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.setEntity(this as any, pk, INVALID); + } + ``` + + #### After + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.invalidate(this as any, pk); + } + ``` + +- [#3454](https://github.com/reactive/data-client/pull/3454) [`66e1906`](https://github.com/reactive/data-client/commit/66e19064d21225c70639f3b4799e54c259ce6905) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: MemoCache.query() and MemoCache.buildQueryKey() take state as one argument + + #### Before + + ```ts + this.memo.buildQueryKey(schema, args, state.entities, state.indexes, key); + ``` + + #### After + + ```ts + this.memo.buildQueryKey(schema, args, state, key); + ``` + + #### Before + + ```ts + this.memo.query(schema, args, state.entities, state.indexes); + ``` + + #### After + + ```ts + this.memo.query(schema, args, state); + ``` + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate) + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + ```ts + /** Helpers during schema.normalize() */ + export interface INormalizeDelegate { + /** Action meta-data for this normalize call */ + readonly meta: { fetchedAt: number; date: number; expiresAt: number }; + /** Gets any previously normalized entity from store */ + getEntity: GetEntity; + /** Updates an entity using merge lifecycles when it has previously been set */ + mergeEntity( + schema: Mergeable & { indexes?: any }, + pk: string, + incomingEntity: any, + ): void; + /** Sets an entity overwriting any previously set values */ + setEntity( + schema: { key: string; indexes?: any }, + pk: string, + entity: any, + meta?: { fetchedAt: number; date: number; expiresAt: number }, + ): void; + /** Returns true when we're in a cycle, so we should not continue recursing */ + checkLoop(key: string, pk: string, input: object): boolean; + } + ``` + + #### Before + + ```ts + addEntity(this, processedEntity, id); + ``` + + #### After + + ```ts + delegate.mergeEntity(this, id, processedEntity); + ``` + +- [#3468](https://github.com/reactive/data-client/pull/3468) [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895) Thanks [@ntucker](https://github.com/ntucker)! - delegate.getEntity(key) -> delegate.getEntities(this.key) + + Return value is a restricted interface with keys() and entries() iterator methods. + This applies to both schema.queryKey and schema.normalize method delegates. + + ```ts + const entities = delegate.getEntities(key); + + // foreach on keys + for (const key of entities.keys()) { + } + // Object.keys() (convert to array) + return [...entities.keys()]; + // foreach on full entry + for (const [key, entity] of entities.entries()) { + } + ``` + + #### Before + + ```ts + const entities = delegate.getEntity(this.key); + if (entities) + Object.keys(entities).forEach(collectionPk => { + if (!filterCollections(JSON.parse(collectionPk))) return; + delegate.mergeEntity(this, collectionPk, normalizedValue); + }); + ``` + + #### After + + ```ts + const entities = delegate.getEntities(this.key); + if (entities) + for (const collectionKey of entities.keys()) { + if (!filterCollections(JSON.parse(collectionKey))) continue; + delegate.mergeEntity(this, collectionKey, normalizedValue); + } + ``` + +- [#3451](https://github.com/reactive/data-client/pull/3451) [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d) Thanks [@ntucker](https://github.com/ntucker)! - state.entityMeta -> state.entitiesMeta + +- [#3372](https://github.com/reactive/data-client/pull/3372) [`25b153a`](https://github.com/reactive/data-client/commit/25b153a9d80db1bcd17ab5558dfa13b333f112b8) Thanks [@ntucker](https://github.com/ntucker)! - MemoCache.query returns `{ data, paths }` just like denormalize. `data` could be INVALID + + #### Before + + ```ts + return this.memo.query(schema, args, state); + ``` + + #### After + + ```ts + const { data } = this.memo.query(schema, args, state); + return typeof data === 'symbol' ? undefined : (data as any); + ``` + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate) + BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object. + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments. + + ```ts + /** Accessors to the currently processing state while building query */ + export interface IQueryDelegate { + getEntity: GetEntity; + getIndex: GetIndex; + } + ``` + + #### Before + + ```ts + queryKey(args, queryKey, getEntity, getIndex) { + getIndex(schema.key, indexName, value)[value]; + getEntity(this.key, id); + return queryKey(this.schema, args, getEntity, getIndex); + } + ``` + + #### After + + ```ts + queryKey(args, unvisit, delegate) { + delegate.getIndex(schema.key, indexName, value); + delegate.getEntity(this.key, id); + return unvisit(this.schema, args); + } + ``` + +### Patch Changes + +- [#3468](https://github.com/reactive/data-client/pull/3468) [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895) Thanks [@ntucker](https://github.com/ntucker)! - Add /imm exports path for handling ImmutableJS state + + #### MemoCache + + ```ts + import { MemoCache } from '@data-client/normalizr'; + import { MemoPolicy } from '@data-client/normalizr/imm'; + + const memo = new MemoCache(MemoPolicy); + + // entities is an ImmutableJS Map + const value = MemoCache.denormalize(Todo, '1', entities); + ``` + + #### denormalize + + non-memoized denormalize + + ```ts + import { denormalize } from '@data-client/normalizr/imm'; + + // entities is an ImmutableJS Map + const value = denormalize(Todo, '1', entities); + ``` + +- [#3468](https://github.com/reactive/data-client/pull/3468) [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895) Thanks [@ntucker](https://github.com/ntucker)! - Improve performance of get/denormalize for small responses + + - 10-20% performance improvement due to removing immutablejs check for every call + ## 0.14.22 ### Patch Changes diff --git a/packages/normalizr/package.json b/packages/normalizr/package.json index a9be596a9476..742b5658ec8a 100644 --- a/packages/normalizr/package.json +++ b/packages/normalizr/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/normalizr", - "version": "0.14.22", + "version": "0.15.0", "description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications", "homepage": "https://dataclient.io/docs/concepts/normalization", "keywords": [ diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index b4c21df345f2..11171547deb9 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,133 @@ # @data-client/react +## 0.15.0 + +### Minor Changes + +- [#3459](https://github.com/reactive/data-client/pull/3459) [`997ca20`](https://github.com/reactive/data-client/commit/997ca209d36e8503ab7684bccc6ddc29d179a0b5) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: useDebounce() returns [val, isPending] + + This was previously exported in `@data-client/react/next` to make migrations easy. This will + still be available there. + + #### Before + + ```ts + import { useDebounce } from '@data-client/react'; + const debouncedQuery = useDebounce(query, 100); + ``` + + #### After + + ```ts + import { useDebounce } from '@data-client/react'; + const [debouncedQuery] = useDebounce(query, 100); + ``` + + #### Before + + ```ts + import { useDebounce } from '@data-client/react/next'; + const [debouncedQuery, isPending] = useDebounce(query, 100); + ``` + + #### After + + ```ts + import { useDebounce } from '@data-client/react'; + const [debouncedQuery, isPending] = useDebounce(query, 100); + ``` + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate) + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + ```ts + /** Helpers during schema.normalize() */ + export interface INormalizeDelegate { + /** Action meta-data for this normalize call */ + readonly meta: { fetchedAt: number; date: number; expiresAt: number }; + /** Gets any previously normalized entity from store */ + getEntity: GetEntity; + /** Updates an entity using merge lifecycles when it has previously been set */ + mergeEntity( + schema: Mergeable & { indexes?: any }, + pk: string, + incomingEntity: any, + ): void; + /** Sets an entity overwriting any previously set values */ + setEntity( + schema: { key: string; indexes?: any }, + pk: string, + entity: any, + meta?: { fetchedAt: number; date: number; expiresAt: number }, + ): void; + /** Returns true when we're in a cycle, so we should not continue recursing */ + checkLoop(key: string, pk: string, input: object): boolean; + } + ``` + + #### Before + + ```ts + addEntity(this, processedEntity, id); + ``` + + #### After + + ```ts + delegate.mergeEntity(this, id, processedEntity); + ``` + +- [#3451](https://github.com/reactive/data-client/pull/3451) [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d) Thanks [@ntucker](https://github.com/ntucker)! - state.entityMeta -> state.entitiesMeta + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate) + BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object. + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments. + + ```ts + /** Accessors to the currently processing state while building query */ + export interface IQueryDelegate { + getEntity: GetEntity; + getIndex: GetIndex; + } + ``` + + #### Before + + ```ts + queryKey(args, queryKey, getEntity, getIndex) { + getIndex(schema.key, indexName, value)[value]; + getEntity(this.key, id); + return queryKey(this.schema, args, getEntity, getIndex); + } + ``` + + #### After + + ```ts + queryKey(args, unvisit, delegate) { + delegate.getIndex(schema.key, indexName, value); + delegate.getEntity(this.key, id); + return unvisit(this.schema, args); + } + ``` + +### Patch Changes + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - Fix controller.get and controller.getQueryMeta 'state' argument types + +- [#3468](https://github.com/reactive/data-client/pull/3468) [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895) Thanks [@ntucker](https://github.com/ntucker)! - Improve performance of get/denormalize for small responses + + - 10-20% performance improvement due to removing immutablejs check for every call + +- [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8) Thanks [@ntucker](https://github.com/ntucker)! - Include GPT link badge in readme + +- Updated dependencies [[`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4939456`](https://github.com/reactive/data-client/commit/4939456598c213ee81c1abef476a1aaccd19f82d), [`d44d36a`](https://github.com/reactive/data-client/commit/d44d36a7de0a18817486c4f723bf2f0e86ac9677), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7)]: + - @data-client/core@0.15.0 + ## 0.14.25 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index d79ec95b832e..1dd7fa9133f4 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/react", - "version": "0.14.25", + "version": "0.15.0", "description": "Async State Management without the Management. REST, GraphQL, SSE, Websockets, Fetch", "homepage": "https://dataclient.io", "repository": { @@ -170,7 +170,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.20.0", - "@data-client/core": "^0.14.24", + "@data-client/core": "^0.15.0", "@data-client/use-enhanced-reducer": "^0.1.14" }, "peerDependencies": { diff --git a/packages/rest/CHANGELOG.md b/packages/rest/CHANGELOG.md index 46f019d836cc..5bee03e5c4f0 100644 --- a/packages/rest/CHANGELOG.md +++ b/packages/rest/CHANGELOG.md @@ -1,5 +1,150 @@ # @data-client/rest +## 0.15.0 + +### Minor Changes + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.INVALID to queryKey + + This is used in schema.All.queryKey(). + + #### Before + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return INVALID; + } + ``` + + #### After + + ```ts + queryKey(args: any, unvisit: any, delegate: IQueryDelegate): any { + if (!found) return delegate.INVALID; + } + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Add delegate.invalidate() to normalization + + #### Before + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.setEntity(this as any, pk, INVALID); + } + ``` + + #### After + + ```ts + normalize( + input: any, + parent: any, + key: string | undefined, + args: any[], + visit: (...args: any) => any, + delegate: INormalizeDelegate, + ): string { + delegate.invalidate(this as any, pk); + } + ``` + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.normalize(...args, addEntity, getEntity, checkLoop) -> schema.normalize(...args, delegate) + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + ```ts + /** Helpers during schema.normalize() */ + export interface INormalizeDelegate { + /** Action meta-data for this normalize call */ + readonly meta: { fetchedAt: number; date: number; expiresAt: number }; + /** Gets any previously normalized entity from store */ + getEntity: GetEntity; + /** Updates an entity using merge lifecycles when it has previously been set */ + mergeEntity( + schema: Mergeable & { indexes?: any }, + pk: string, + incomingEntity: any, + ): void; + /** Sets an entity overwriting any previously set values */ + setEntity( + schema: { key: string; indexes?: any }, + pk: string, + entity: any, + meta?: { fetchedAt: number; date: number; expiresAt: number }, + ): void; + /** Returns true when we're in a cycle, so we should not continue recursing */ + checkLoop(key: string, pk: string, input: object): boolean; + } + ``` + + #### Before + + ```ts + addEntity(this, processedEntity, id); + ``` + + #### After + + ```ts + delegate.mergeEntity(this, id, processedEntity); + ``` + +- [#3461](https://github.com/reactive/data-client/pull/3461) [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2) Thanks [@ntucker](https://github.com/ntucker)! - Remove `INVALID` symbol export + + Schemas can use delegate.invalidate() in normalize() or return delegate.INVALID in queryKey(). + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: schema.queryKey(args, queryKey, getEntity, getIndex) -> schema.queryKey(args, unvisit, delegate) + BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object. + + We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument. + + Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments. + + ```ts + /** Accessors to the currently processing state while building query */ + export interface IQueryDelegate { + getEntity: GetEntity; + getIndex: GetIndex; + } + ``` + + #### Before + + ```ts + queryKey(args, queryKey, getEntity, getIndex) { + getIndex(schema.key, indexName, value)[value]; + getEntity(this.key, id); + return queryKey(this.schema, args, getEntity, getIndex); + } + ``` + + #### After + + ```ts + queryKey(args, unvisit, delegate) { + delegate.getIndex(schema.key, indexName, value); + delegate.getEntity(this.key, id); + return unvisit(this.schema, args); + } + ``` + +### Patch Changes + +- [#3449](https://github.com/reactive/data-client/pull/3449) [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7) Thanks [@ntucker](https://github.com/ntucker)! - Fix: ensure string id in Entity set when process returns undefined (meaning INVALID) + +- [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8) Thanks [@ntucker](https://github.com/ntucker)! - Include GPT link badge in readme + +- Updated dependencies [[`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`4dde1d6`](https://github.com/reactive/data-client/commit/4dde1d616e38d59b645573b12bbaba2f9cac7895), [`bab907c`](https://github.com/reactive/data-client/commit/bab907ce824c0f7da961d74c9fb8b64ce7c95141), [`5699005`](https://github.com/reactive/data-client/commit/5699005700206306bc70ff8237bf7ceaac241b82), [`939a4b0`](https://github.com/reactive/data-client/commit/939a4b01127ea1df9b4653931593487e4b0c23a2), [`1f491a9`](https://github.com/reactive/data-client/commit/1f491a9e0082dca64ad042aaf7d377e17f459ae7), [`35552c7`](https://github.com/reactive/data-client/commit/35552c716e3b688d69212654f9f95a05ea26a7f8)]: + - @data-client/endpoint@0.15.0 + ## 0.14.25 ### Patch Changes diff --git a/packages/rest/package.json b/packages/rest/package.json index dd1ffc90e6de..757180049210 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/rest", - "version": "0.14.25", + "version": "0.15.0", "description": "Quickly define typed REST resources and endpoints", "homepage": "https://dataclient.io/rest", "repository": { @@ -135,7 +135,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.20.0", - "@data-client/endpoint": "^0.14.25", + "@data-client/endpoint": "^0.15.0", "path-to-regexp": "^6.3.0" }, "devDependencies": { diff --git a/packages/test/CHANGELOG.md b/packages/test/CHANGELOG.md index 4d8251c10107..3e694d9d4b4c 100644 --- a/packages/test/CHANGELOG.md +++ b/packages/test/CHANGELOG.md @@ -1,5 +1,28 @@ # @data-client/test +## 0.15.0 + +### Minor Changes + +- [#3394](https://github.com/reactive/data-client/pull/3394) [`d44d36a`](https://github.com/reactive/data-client/commit/d44d36a7de0a18817486c4f723bf2f0e86ac9677) Thanks [@ntucker](https://github.com/ntucker)! - Change NetworkManager bookkeeping data structure for inflight fetches + + BREAKING CHANGE: NetworkManager.fetched, NetworkManager.rejectors, NetworkManager.resolvers, NetworkManager.fetchedAt + -> NetworkManager.fetching + + #### Before + + ```ts + if (action.key in this.fetched) + ``` + + #### After + + ```ts + if (this.fetching.has(action.key)) + ``` + +- [`769cb78`](https://github.com/reactive/data-client/commit/769cb78966aed032c90864c701dae2bac0cc1e4d) Thanks [@ntucker](https://github.com/ntucker)! - Support 0.15 of @data-client/react + ## 0.14.22 ### Patch Changes diff --git a/packages/test/package.json b/packages/test/package.json index 7dd337763f0f..28415e788f40 100644 --- a/packages/test/package.json +++ b/packages/test/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/test", - "version": "0.14.22", + "version": "0.15.0", "description": "Testing utilities for Data Client", "homepage": "https://dataclient.io/docs/guides/storybook", "repository": { diff --git a/yarn.lock b/yarn.lock index f020ac9306cd..3fddcc34c7bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3057,14 +3057,14 @@ __metadata: languageName: node linkType: hard -"@data-client/core@npm:^0.14.24, @data-client/core@workspace:*, @data-client/core@workspace:^, @data-client/core@workspace:packages/core": +"@data-client/core@npm:^0.15.0, @data-client/core@workspace:*, @data-client/core@workspace:^, @data-client/core@workspace:packages/core": version: 0.0.0-use.local resolution: "@data-client/core@workspace:packages/core" dependencies: "@anansi/browserslist-config": "npm:^1.4.2" "@babel/runtime": "npm:^7.20.0" "@data-client/endpoint": "workspace:*" - "@data-client/normalizr": "npm:^0.14.22" + "@data-client/normalizr": "npm:^0.15.0" "@types/jest": "npm:^29.5.14" "@types/node": "npm:^22.0.0" flux-standard-action: "npm:^2.1.1" @@ -3072,7 +3072,7 @@ __metadata: languageName: unknown linkType: soft -"@data-client/endpoint@npm:^0.14.25, @data-client/endpoint@workspace:*, @data-client/endpoint@workspace:^, @data-client/endpoint@workspace:packages/endpoint": +"@data-client/endpoint@npm:^0.15.0, @data-client/endpoint@workspace:*, @data-client/endpoint@workspace:^, @data-client/endpoint@workspace:packages/endpoint": version: 0.0.0-use.local resolution: "@data-client/endpoint@workspace:packages/endpoint" dependencies: @@ -3095,7 +3095,7 @@ __metadata: dependencies: "@anansi/browserslist-config": "npm:^1.4.2" "@babel/runtime": "npm:^7.20.0" - "@data-client/endpoint": "npm:^0.14.25" + "@data-client/endpoint": "npm:^0.15.0" "@types/jest": "npm:^29.5.14" "@types/node": "npm:^22.0.0" nock: "npm:13.3.1" @@ -3103,13 +3103,13 @@ __metadata: languageName: unknown linkType: soft -"@data-client/img@npm:^0.14.0, @data-client/img@workspace:packages/img": +"@data-client/img@npm:^0.15.0, @data-client/img@workspace:packages/img": version: 0.0.0-use.local resolution: "@data-client/img@workspace:packages/img" dependencies: "@anansi/browserslist-config": "npm:^1.4.2" "@babel/runtime": "npm:^7.20.0" - "@data-client/endpoint": "npm:^0.14.25" + "@data-client/endpoint": "npm:^0.15.0" "@data-client/react": "workspace:*" "@testing-library/react": "npm:^16.1.0" "@types/jest": "npm:^29.5.14" @@ -3127,7 +3127,7 @@ __metadata: languageName: unknown linkType: soft -"@data-client/normalizr@npm:^0.14.22, @data-client/normalizr@workspace:*, @data-client/normalizr@workspace:^, @data-client/normalizr@workspace:packages/normalizr": +"@data-client/normalizr@npm:^0.15.0, @data-client/normalizr@workspace:*, @data-client/normalizr@workspace:^, @data-client/normalizr@workspace:packages/normalizr": version: 0.0.0-use.local resolution: "@data-client/normalizr@workspace:packages/normalizr" dependencies: @@ -3142,13 +3142,13 @@ __metadata: languageName: unknown linkType: soft -"@data-client/react@npm:^0.14.0, @data-client/react@workspace:*, @data-client/react@workspace:packages/react": +"@data-client/react@npm:^0.15.0, @data-client/react@workspace:*, @data-client/react@workspace:packages/react": version: 0.0.0-use.local resolution: "@data-client/react@workspace:packages/react" dependencies: "@anansi/browserslist-config": "npm:^1.4.2" "@babel/runtime": "npm:^7.20.0" - "@data-client/core": "npm:^0.14.24" + "@data-client/core": "npm:^0.15.0" "@data-client/rest": "workspace:*" "@data-client/test": "workspace:*" "@data-client/use-enhanced-reducer": "npm:^0.1.14" @@ -3186,13 +3186,13 @@ __metadata: languageName: unknown linkType: soft -"@data-client/rest@npm:^0.14.0, @data-client/rest@workspace:*, @data-client/rest@workspace:packages/rest": +"@data-client/rest@npm:^0.15.0, @data-client/rest@workspace:*, @data-client/rest@workspace:packages/rest": version: 0.0.0-use.local resolution: "@data-client/rest@workspace:packages/rest" dependencies: "@anansi/browserslist-config": "npm:^1.4.2" "@babel/runtime": "npm:^7.20.0" - "@data-client/endpoint": "npm:^0.14.25" + "@data-client/endpoint": "npm:^0.15.0" "@data-client/react": "workspace:*" "@data-client/test": "workspace:*" "@types/jest": "npm:^29.5.14" @@ -10913,9 +10913,9 @@ __metadata: "@anansi/webpack-config": "npm:^21.0.0" "@babel/core": "npm:^7.22.15" "@babel/runtime-corejs3": "npm:^7.26.7" - "@data-client/img": "npm:^0.14.0" - "@data-client/react": "npm:^0.14.0" - "@data-client/rest": "npm:^0.14.0" + "@data-client/img": "npm:^0.15.0" + "@data-client/react": "npm:^0.15.0" + "@data-client/rest": "npm:^0.15.0" "@linaria/babel-preset": "npm:*" "@linaria/core": "npm:*" "@linaria/react": "npm:*" @@ -28686,9 +28686,9 @@ __metadata: "@anansi/webpack-config": "npm:^21.0.0" "@babel/core": "npm:^7.22.15" "@babel/runtime-corejs3": "npm:^7.26.7" - "@data-client/img": "npm:^0.14.0" - "@data-client/react": "npm:^0.14.0" - "@data-client/rest": "npm:^0.14.0" + "@data-client/img": "npm:^0.15.0" + "@data-client/react": "npm:^0.15.0" + "@data-client/rest": "npm:^0.15.0" "@types/react": "npm:*" "@types/react-dom": "npm:*" core-js: "npm:^3.40.0"