diff --git a/.changeset/content-property.md b/.changeset/content-property.md deleted file mode 100644 index d229d58addf0..000000000000 --- a/.changeset/content-property.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -'@data-client/rest': patch ---- - -Add `content` property to RestEndpoint for typed response parsing - -Set `content` to control how the response body is parsed, with automatic return type inference: - -```ts -const downloadFile = new RestEndpoint({ - path: '/files/:id/download', - content: 'blob', - dataExpiryLength: 0, -}); -const blob: Blob = await ctrl.fetch(downloadFile, { id: '123' }); -``` - -Accepted values: `'json'`, `'blob'`, `'text'`, `'arrayBuffer'`, `'stream'`. - -Non-JSON content types (`'blob'`, `'text'`, `'arrayBuffer'`, `'stream'`) constrain `schema` to -`undefined` at the type level, with a runtime check that throws if a normalizable schema is set. - -When `content` is not set, auto-detection now handles binary Content-Types (`image/*`, -`application/octet-stream`, `application/pdf`, etc.) by returning `response.blob()` instead of -corrupting data via `.text()`. diff --git a/.changeset/deepclone-own-properties.md b/.changeset/deepclone-own-properties.md deleted file mode 100644 index 46bd9b8f602b..000000000000 --- a/.changeset/deepclone-own-properties.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/normalizr': patch ---- - -Fix deepClone to only copy own properties - -`deepClone` in the immutable store path now uses `Object.keys()` instead of `for...in`, preventing inherited properties from being copied into cloned state. diff --git a/.changeset/getdependency-switch.md b/.changeset/getdependency-switch.md deleted file mode 100644 index 1e3a6fa5aab3..000000000000 --- a/.changeset/getdependency-switch.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/normalizr': patch ---- - -Replace megamorphic computed dispatch in getDependency with switch - -`getDependency` used `delegate[array[index]](...spread)` which creates a temporary array, a computed property lookup, and a spread call on every invocation — a megamorphic pattern that prevents V8 from inlining or type-specializing the call site. Replaced with a `switch` on `path.length` for monomorphic dispatch. diff --git a/.changeset/globalcache-preallocate.md b/.changeset/globalcache-preallocate.md deleted file mode 100644 index 06bc3b4cd58e..000000000000 --- a/.changeset/globalcache-preallocate.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/normalizr': patch ---- - -Improve denormalization performance by pre-allocating the dependency tracking slot - -Replace `Array.prototype.unshift()` in `GlobalCache.getResults()` with a pre-allocated slot at index 0, avoiding O(n) element shifting on every cache-miss denormalization. diff --git a/.changeset/lazy-entity-clone.md b/.changeset/lazy-entity-clone.md deleted file mode 100644 index a1cb3cdca7ec..000000000000 --- a/.changeset/lazy-entity-clone.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/normalizr': patch ---- - -Move entity table POJO clone from getNewEntities to setEntity - -Lazy-clone entity and meta tables on first write per entity type instead of eagerly in getNewEntities. This keeps getNewEntities as a pure Map operation, eliminating its V8 Maglev bailout ("Insufficient type feedback for generic named access" on `this.entities`). diff --git a/.changeset/normalize-hidden-class.md b/.changeset/normalize-hidden-class.md deleted file mode 100644 index 0836597f9ff2..000000000000 --- a/.changeset/normalize-hidden-class.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@data-client/normalizr': patch ---- - -Avoid hidden class mutation in normalize() return object - -The normalize result object was constructed with `result: '' as any` then mutated via `ret.result = visit(...)`, causing a V8 hidden class transition when the property type changed from string to the actual result type. Restructured to compute the result first and construct the final object in a single step. diff --git a/examples/benchmark-react/CHANGELOG.md b/examples/benchmark-react/CHANGELOG.md index 5d83a873ce89..173ee83b2aea 100644 --- a/examples/benchmark-react/CHANGELOG.md +++ b/examples/benchmark-react/CHANGELOG.md @@ -1,5 +1,14 @@ # example-benchmark-react +## 0.1.7 + +### Patch Changes + +- Updated dependencies [[`8a7c8d9`](https://github.com/reactive/data-client/commit/8a7c8d9cc4228a6281849f56121699f237af4b0f)]: + - @data-client/rest@0.16.6 + - @data-client/react@0.16.0 + - @data-client/endpoint@0.16.3 + ## 0.1.6 ### Patch Changes diff --git a/examples/benchmark-react/package.json b/examples/benchmark-react/package.json index aa05d7d7c709..5dbbf9f2fb3b 100644 --- a/examples/benchmark-react/package.json +++ b/examples/benchmark-react/package.json @@ -1,6 +1,6 @@ { "name": "example-benchmark-react", - "version": "0.1.6", + "version": "0.1.7", "private": true, "description": "React rendering benchmark comparing @data-client/react against other data libraries", "scripts": { diff --git a/examples/benchmark/CHANGELOG.md b/examples/benchmark/CHANGELOG.md index a37a865e5f69..1f7861969cac 100644 --- a/examples/benchmark/CHANGELOG.md +++ b/examples/benchmark/CHANGELOG.md @@ -1,5 +1,13 @@ # example-benchmark +## 0.4.83 + +### Patch Changes + +- Updated dependencies [[`467a5f6`](https://github.com/reactive/data-client/commit/467a5f6f9d4cdaf0927fa7e22520c5d2c1462ff5), [`e9e96f1`](https://github.com/reactive/data-client/commit/e9e96f1751895c17e046461a1c38bb4bb093c141), [`7d28629`](https://github.com/reactive/data-client/commit/7d28629d07f6cade43e36f3cf1956f175f98d84f), [`7df6a49`](https://github.com/reactive/data-client/commit/7df6a49ee9fcdac10f9f24ec48c4df0931efa0b0), [`98a7831`](https://github.com/reactive/data-client/commit/98a78318770feaa8433708693bec90b81cbcb1b2)]: + - @data-client/normalizr@0.16.6 + - @data-client/endpoint@0.16.3 + ## 0.4.82 ### Patch Changes diff --git a/examples/benchmark/package.json b/examples/benchmark/package.json index 76debb138618..1a65d27076be 100644 --- a/examples/benchmark/package.json +++ b/examples/benchmark/package.json @@ -1,6 +1,6 @@ { "name": "example-benchmark", - "version": "0.4.82", + "version": "0.4.83", "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 74e32ebc123c..c5aafa1ad155 100644 --- a/examples/coin-app/CHANGELOG.md +++ b/examples/coin-app/CHANGELOG.md @@ -1,5 +1,12 @@ # coinbase-lite +## 0.0.22 + +### Patch Changes + +- Updated dependencies [[`8a7c8d9`](https://github.com/reactive/data-client/commit/8a7c8d9cc4228a6281849f56121699f237af4b0f)]: + - @data-client/rest@0.16.6 + ## 0.0.21 ### Patch Changes diff --git a/examples/coin-app/package.json b/examples/coin-app/package.json index 7db86cb88d8e..f4088dcb2b14 100644 --- a/examples/coin-app/package.json +++ b/examples/coin-app/package.json @@ -1,6 +1,6 @@ { "name": "coinbase-lite", - "version": "0.0.21", + "version": "0.0.22", "packageManager": "yarn@4.13.0", "description": "Coin App", "scripts": { @@ -46,7 +46,7 @@ "@babel/runtime-corejs3": "7.29.2", "@data-client/img": "0.16.0", "@data-client/react": "0.16.0", - "@data-client/rest": "0.16.5", + "@data-client/rest": "0.16.6", "core-js": "3.49.0", "d3": "7.9.0", "history": "*", diff --git a/examples/normalizr-github/CHANGELOG.md b/examples/normalizr-github/CHANGELOG.md index 6d29ad22c685..587e8d940470 100644 --- a/examples/normalizr-github/CHANGELOG.md +++ b/examples/normalizr-github/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-github-example +## 0.1.58 + +### Patch Changes + +- Updated dependencies [[`467a5f6`](https://github.com/reactive/data-client/commit/467a5f6f9d4cdaf0927fa7e22520c5d2c1462ff5), [`e9e96f1`](https://github.com/reactive/data-client/commit/e9e96f1751895c17e046461a1c38bb4bb093c141), [`7d28629`](https://github.com/reactive/data-client/commit/7d28629d07f6cade43e36f3cf1956f175f98d84f), [`7df6a49`](https://github.com/reactive/data-client/commit/7df6a49ee9fcdac10f9f24ec48c4df0931efa0b0), [`98a7831`](https://github.com/reactive/data-client/commit/98a78318770feaa8433708693bec90b81cbcb1b2)]: + - @data-client/normalizr@0.16.6 + - @data-client/endpoint@0.16.3 + ## 0.1.57 ### Patch Changes diff --git a/examples/normalizr-github/package.json b/examples/normalizr-github/package.json index 84fb63892e7e..e551986c0a14 100644 --- a/examples/normalizr-github/package.json +++ b/examples/normalizr-github/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-github-example", - "version": "0.1.57", + "version": "0.1.58", "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 a78b2bff1617..dfd29a80eb85 100644 --- a/examples/normalizr-redux/CHANGELOG.md +++ b/examples/normalizr-redux/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-redux-example +## 0.1.56 + +### Patch Changes + +- Updated dependencies [[`467a5f6`](https://github.com/reactive/data-client/commit/467a5f6f9d4cdaf0927fa7e22520c5d2c1462ff5), [`e9e96f1`](https://github.com/reactive/data-client/commit/e9e96f1751895c17e046461a1c38bb4bb093c141), [`7d28629`](https://github.com/reactive/data-client/commit/7d28629d07f6cade43e36f3cf1956f175f98d84f), [`7df6a49`](https://github.com/reactive/data-client/commit/7df6a49ee9fcdac10f9f24ec48c4df0931efa0b0), [`98a7831`](https://github.com/reactive/data-client/commit/98a78318770feaa8433708693bec90b81cbcb1b2)]: + - @data-client/normalizr@0.16.6 + - @data-client/endpoint@0.16.3 + ## 0.1.55 ### Patch Changes diff --git a/examples/normalizr-redux/package.json b/examples/normalizr-redux/package.json index 2d73a2b4df53..ecda13f220aa 100644 --- a/examples/normalizr-redux/package.json +++ b/examples/normalizr-redux/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-redux-example", - "version": "0.1.55", + "version": "0.1.56", "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 696a8e2b742d..0c6b8d676894 100644 --- a/examples/normalizr-relationships/CHANGELOG.md +++ b/examples/normalizr-relationships/CHANGELOG.md @@ -1,5 +1,13 @@ # normalizr-relationships +## 0.1.58 + +### Patch Changes + +- Updated dependencies [[`467a5f6`](https://github.com/reactive/data-client/commit/467a5f6f9d4cdaf0927fa7e22520c5d2c1462ff5), [`e9e96f1`](https://github.com/reactive/data-client/commit/e9e96f1751895c17e046461a1c38bb4bb093c141), [`7d28629`](https://github.com/reactive/data-client/commit/7d28629d07f6cade43e36f3cf1956f175f98d84f), [`7df6a49`](https://github.com/reactive/data-client/commit/7df6a49ee9fcdac10f9f24ec48c4df0931efa0b0), [`98a7831`](https://github.com/reactive/data-client/commit/98a78318770feaa8433708693bec90b81cbcb1b2)]: + - @data-client/normalizr@0.16.6 + - @data-client/endpoint@0.16.3 + ## 0.1.57 ### Patch Changes diff --git a/examples/normalizr-relationships/package.json b/examples/normalizr-relationships/package.json index 991e670d6bcb..95ef917e5b78 100644 --- a/examples/normalizr-relationships/package.json +++ b/examples/normalizr-relationships/package.json @@ -1,6 +1,6 @@ { "name": "normalizr-relationships", - "version": "0.1.57", + "version": "0.1.58", "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 index 442dafc84b92..82ce201cc5f2 100644 --- a/examples/test-bundlesize/CHANGELOG.md +++ b/examples/test-bundlesize/CHANGELOG.md @@ -1,5 +1,13 @@ # test-bundlesize +## 0.1.14 + +### Patch Changes + +- Updated dependencies [[`8a7c8d9`](https://github.com/reactive/data-client/commit/8a7c8d9cc4228a6281849f56121699f237af4b0f)]: + - @data-client/rest@0.16.6 + - @data-client/react@0.16.0 + ## 0.1.13 ### Patch Changes diff --git a/examples/test-bundlesize/package.json b/examples/test-bundlesize/package.json index 954b23486db9..10537b7b7e6b 100644 --- a/examples/test-bundlesize/package.json +++ b/examples/test-bundlesize/package.json @@ -1,6 +1,6 @@ { "name": "test-bundlesize", - "version": "0.1.13", + "version": "0.1.14", "packageManager": "yarn@4.13.0", "description": "Testing Bundled Size", "scripts": { diff --git a/packages/normalizr/CHANGELOG.md b/packages/normalizr/CHANGELOG.md index 64d689b03c55..3eaccbd9d964 100644 --- a/packages/normalizr/CHANGELOG.md +++ b/packages/normalizr/CHANGELOG.md @@ -1,5 +1,29 @@ # Change Log +## 0.16.6 + +### Patch Changes + +- [#3875](https://github.com/reactive/data-client/pull/3875) [`467a5f6`](https://github.com/reactive/data-client/commit/467a5f6f9d4cdaf0927fa7e22520c5d2c1462ff5) - Fix deepClone to only copy own properties + + `deepClone` in the immutable store path now uses `Object.keys()` instead of `for...in`, preventing inherited properties from being copied into cloned state. + +- [#3877](https://github.com/reactive/data-client/pull/3877) [`e9e96f1`](https://github.com/reactive/data-client/commit/e9e96f1751895c17e046461a1c38bb4bb093c141) - Replace megamorphic computed dispatch in getDependency with switch + + `getDependency` used `delegate[array[index]](...spread)` which creates a temporary array, a computed property lookup, and a spread call on every invocation — a megamorphic pattern that prevents V8 from inlining or type-specializing the call site. Replaced with a `switch` on `path.length` for monomorphic dispatch. + +- [#3876](https://github.com/reactive/data-client/pull/3876) [`7d28629`](https://github.com/reactive/data-client/commit/7d28629d07f6cade43e36f3cf1956f175f98d84f) - Improve denormalization performance by pre-allocating the dependency tracking slot + + Replace `Array.prototype.unshift()` in `GlobalCache.getResults()` with a pre-allocated slot at index 0, avoiding O(n) element shifting on every cache-miss denormalization. + +- [#3884](https://github.com/reactive/data-client/pull/3884) [`7df6a49`](https://github.com/reactive/data-client/commit/7df6a49ee9fcdac10f9f24ec48c4df0931efa0b0) - Move entity table POJO clone from getNewEntities to setEntity + + Lazy-clone entity and meta tables on first write per entity type instead of eagerly in getNewEntities. This keeps getNewEntities as a pure Map operation, eliminating its V8 Maglev bailout ("Insufficient type feedback for generic named access" on `this.entities`). + +- [#3878](https://github.com/reactive/data-client/pull/3878) [`98a7831`](https://github.com/reactive/data-client/commit/98a78318770feaa8433708693bec90b81cbcb1b2) - Avoid hidden class mutation in normalize() return object + + The normalize result object was constructed with `result: '' as any` then mutated via `ret.result = visit(...)`, causing a V8 hidden class transition when the property type changed from string to the actual result type. Restructured to compute the result first and construct the final object in a single step. + ## 0.16.0 ### Patch Changes diff --git a/packages/normalizr/package.json b/packages/normalizr/package.json index 64854706faeb..1b49c335ca4e 100644 --- a/packages/normalizr/package.json +++ b/packages/normalizr/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/normalizr", - "version": "0.16.0", + "version": "0.16.6", "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/rest/CHANGELOG.md b/packages/rest/CHANGELOG.md index 5b781b36b14e..c66246748a75 100644 --- a/packages/rest/CHANGELOG.md +++ b/packages/rest/CHANGELOG.md @@ -1,5 +1,34 @@ # @data-client/rest +## 0.16.6 + +### Patch Changes + +- [#3868](https://github.com/reactive/data-client/pull/3868) [`8a7c8d9`](https://github.com/reactive/data-client/commit/8a7c8d9cc4228a6281849f56121699f237af4b0f) - Add `content` property to RestEndpoint for typed response parsing + + Set `content` to control how the response body is parsed, with automatic return type inference: + + ```ts + const downloadFile = new RestEndpoint({ + path: '/files/:id/download', + content: 'blob', + dataExpiryLength: 0, + }); + const blob: Blob = await ctrl.fetch(downloadFile, { id: '123' }); + ``` + + Accepted values: `'json'`, `'blob'`, `'text'`, `'arrayBuffer'`, `'stream'`. + + Non-JSON content types (`'blob'`, `'text'`, `'arrayBuffer'`, `'stream'`) constrain `schema` to + `undefined` at the type level, with a runtime check that throws if a normalizable schema is set. + + When `content` is not set, auto-detection now handles binary Content-Types (`image/*`, + `application/octet-stream`, `application/pdf`, etc.) by returning `response.blob()` instead of + corrupting data via `.text()`. + +- Updated dependencies []: + - @data-client/endpoint@0.16.3 + ## 0.16.5 ### Patch Changes diff --git a/packages/rest/package.json b/packages/rest/package.json index 6e1dc341fe27..ef6de0802e42 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -1,6 +1,6 @@ { "name": "@data-client/rest", - "version": "0.16.5", + "version": "0.16.6", "description": "Quickly define typed REST resources and endpoints", "homepage": "https://dataclient.io/rest", "repository": { diff --git a/yarn.lock b/yarn.lock index c30d12158606..9f09ba601454 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3330,7 +3330,7 @@ __metadata: languageName: unknown linkType: soft -"@data-client/rest@npm:0.16.5, @data-client/rest@workspace:*, @data-client/rest@workspace:packages/rest": +"@data-client/rest@npm:0.16.6, @data-client/rest@workspace:*, @data-client/rest@workspace:packages/rest": version: 0.0.0-use.local resolution: "@data-client/rest@workspace:packages/rest" dependencies: @@ -11039,7 +11039,7 @@ __metadata: "@babel/runtime-corejs3": "npm:7.29.2" "@data-client/img": "npm:0.16.0" "@data-client/react": "npm:0.16.0" - "@data-client/rest": "npm:0.16.5" + "@data-client/rest": "npm:0.16.6" "@linaria/core": "npm:*" "@linaria/react": "npm:*" "@linaria/shaker": "npm:*"