@data-client/core 0.15.0-beta-20251006024044-92bd01c4976f2921993b8c9f1e4dbb87af87ba7b → 0.15.0-beta-20251022142546-a457d1596871fb28f1a91f2531cc259db4d55a9c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1174 -0
- package/package.json +5 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,1174 @@
|
|
|
1
|
+
# @data-client/core
|
|
2
|
+
|
|
3
|
+
## 0.15.0-beta-20251022142546-a457d1596871fb28f1a91f2531cc259db4d55a9c
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a457d15`](https://github.com/reactive/data-client/commit/a457d1596871fb28f1a91f2531cc259db4d55a9c) Thanks [@ntucker](https://github.com/ntucker)! - Republish to fix dependency refernces
|
|
8
|
+
|
|
9
|
+
## 0.15.0-beta-20251006024044-92bd01c4976f2921993b8c9f1e4dbb87af87ba7b
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#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)
|
|
14
|
+
|
|
15
|
+
We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
/** Helpers during schema.normalize() */
|
|
19
|
+
export interface INormalizeDelegate {
|
|
20
|
+
/** Action meta-data for this normalize call */
|
|
21
|
+
readonly meta: { fetchedAt: number; date: number; expiresAt: number };
|
|
22
|
+
/** Gets any previously normalized entity from store */
|
|
23
|
+
getEntity: GetEntity;
|
|
24
|
+
/** Updates an entity using merge lifecycles when it has previously been set */
|
|
25
|
+
mergeEntity(
|
|
26
|
+
schema: Mergeable & { indexes?: any },
|
|
27
|
+
pk: string,
|
|
28
|
+
incomingEntity: any,
|
|
29
|
+
): void;
|
|
30
|
+
/** Sets an entity overwriting any previously set values */
|
|
31
|
+
setEntity(
|
|
32
|
+
schema: { key: string; indexes?: any },
|
|
33
|
+
pk: string,
|
|
34
|
+
entity: any,
|
|
35
|
+
meta?: { fetchedAt: number; date: number; expiresAt: number },
|
|
36
|
+
): void;
|
|
37
|
+
/** Returns true when we're in a cycle, so we should not continue recursing */
|
|
38
|
+
checkLoop(key: string, pk: string, input: object): boolean;
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### Before
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
addEntity(this, processedEntity, id);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### After
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
delegate.mergeEntity(this, id, processedEntity);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- [#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
|
|
55
|
+
|
|
56
|
+
- [#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
|
|
57
|
+
|
|
58
|
+
BREAKING CHANGE: NetworkManager.fetched, NetworkManager.rejectors, NetworkManager.resolvers, NetworkManager.fetchedAt
|
|
59
|
+
-> NetworkManager.fetching
|
|
60
|
+
|
|
61
|
+
#### Before
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
if (action.key in this.fetched)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### After
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
if (this.fetching.has(action.key))
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- [#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)
|
|
74
|
+
BREAKING CHANGE: delegate.getIndex() returns the index directly, rather than object.
|
|
75
|
+
|
|
76
|
+
We consolidate all 'callback' functions during recursion calls into a single 'delegate' argument.
|
|
77
|
+
|
|
78
|
+
Our recursive call is renamed from queryKey to unvisit, and does not require the last two arguments.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
/** Accessors to the currently processing state while building query */
|
|
82
|
+
export interface IQueryDelegate {
|
|
83
|
+
getEntity: GetEntity;
|
|
84
|
+
getIndex: GetIndex;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Before
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
queryKey(args, queryKey, getEntity, getIndex) {
|
|
92
|
+
getIndex(schema.key, indexName, value)[value];
|
|
93
|
+
getEntity(this.key, id);
|
|
94
|
+
return queryKey(this.schema, args, getEntity, getIndex);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### After
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
queryKey(args, unvisit, delegate) {
|
|
102
|
+
delegate.getIndex(schema.key, indexName, value);
|
|
103
|
+
delegate.getEntity(this.key, id);
|
|
104
|
+
return unvisit(this.schema, args);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- [#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
|
|
111
|
+
|
|
112
|
+
- [#3558](https://github.com/reactive/data-client/pull/3558) [`fcb7d7d`](https://github.com/reactive/data-client/commit/fcb7d7db8061c2a7e12632071ecb9c6ddd8d154f) Thanks [@ntucker](https://github.com/ntucker)! - Normalize delegate.invalidate() first argument only has `key` param.
|
|
113
|
+
|
|
114
|
+
`indexes` optional param no longer provided as it was never used.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
normalize(
|
|
118
|
+
input: any,
|
|
119
|
+
parent: any,
|
|
120
|
+
key: string | undefined,
|
|
121
|
+
args: any[],
|
|
122
|
+
visit: (...args: any) => any,
|
|
123
|
+
delegate: INormalizeDelegate,
|
|
124
|
+
): string {
|
|
125
|
+
delegate.invalidate({ key: this._entity.key }, pk);
|
|
126
|
+
return pk;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- [#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
|
|
131
|
+
- 10-20% performance improvement due to removing immutablejs check for every call
|
|
132
|
+
|
|
133
|
+
- 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), [`fcb7d7d`](https://github.com/reactive/data-client/commit/fcb7d7db8061c2a7e12632071ecb9c6ddd8d154f), [`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)]:
|
|
134
|
+
- @data-client/normalizr@0.15.0-beta-20251006024044-92bd01c4976f2921993b8c9f1e4dbb87af87ba7b
|
|
135
|
+
|
|
136
|
+
## 0.14.24
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- [`d41f658`](https://github.com/reactive/data-client/commit/d41f6582478f9392bcbcbcc1213f7a2d9646e9c4) Thanks [@ntucker](https://github.com/ntucker)! - Improve performance by using Map() instead of Object for unbounded keys [#3390](https://github.com/reactive/data-client/pull/3390)
|
|
141
|
+
|
|
142
|
+
## 0.14.23
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- [`9bf7e7a`](https://github.com/reactive/data-client/commit/9bf7e7ab783eda767dd9f17bbf65c4b85c05d522) Thanks [@ntucker](https://github.com/ntucker)! - Improve performance by using Map() instead of Object for unbounded keys [#3390](https://github.com/reactive/data-client/pull/3390)
|
|
147
|
+
|
|
148
|
+
## 0.14.21
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- [#3384](https://github.com/reactive/data-client/pull/3384) [`24ad679`](https://github.com/reactive/data-client/commit/24ad679f58c7eb0d0e6917790b4ebb5ee234e1d3) Thanks [@ntucker](https://github.com/ntucker)! - Reduce bundle sizes by 30% by removing unneeded polyfills
|
|
153
|
+
|
|
154
|
+
- Updated dependencies [[`24ad679`](https://github.com/reactive/data-client/commit/24ad679f58c7eb0d0e6917790b4ebb5ee234e1d3)]:
|
|
155
|
+
- @data-client/normalizr@0.14.21
|
|
156
|
+
|
|
157
|
+
## 0.14.20
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- [`c3514c6`](https://github.com/reactive/data-client/commit/c3514c6afa2cd76dafa02adcfad6f6481a34b5de) Thanks [@ntucker](https://github.com/ntucker)! - Remove unnecessary polyfills in build
|
|
162
|
+
|
|
163
|
+
- Updated dependencies [[`c3514c6`](https://github.com/reactive/data-client/commit/c3514c6afa2cd76dafa02adcfad6f6481a34b5de)]:
|
|
164
|
+
- @data-client/normalizr@0.14.20
|
|
165
|
+
|
|
166
|
+
## 0.14.19
|
|
167
|
+
|
|
168
|
+
### Patch Changes
|
|
169
|
+
|
|
170
|
+
- [#3343](https://github.com/reactive/data-client/pull/3343) [`1df829e`](https://github.com/reactive/data-client/commit/1df829e0a005f5973d59669aaf0a226250346a40) Thanks [@ntucker](https://github.com/ntucker)! - Add initManager()
|
|
171
|
+
|
|
172
|
+
- [#3373](https://github.com/reactive/data-client/pull/3373) [`f796b6c`](https://github.com/reactive/data-client/commit/f796b6cbd33cce1f258bd5e95a7d6b1d51365f2f) Thanks [@ntucker](https://github.com/ntucker)! - Add Controller.getQueryMeta and Controller.getResponseMeta
|
|
173
|
+
|
|
174
|
+
- [#3373](https://github.com/reactive/data-client/pull/3373) [`f796b6c`](https://github.com/reactive/data-client/commit/f796b6cbd33cce1f258bd5e95a7d6b1d51365f2f) Thanks [@ntucker](https://github.com/ntucker)! - Controller.snapshot() methods have stronger argument typing
|
|
175
|
+
|
|
176
|
+
- [#3365](https://github.com/reactive/data-client/pull/3365) [`66e7336`](https://github.com/reactive/data-client/commit/66e7336bab0f6768d93c76882188894d36f84f88) Thanks [@ntucker](https://github.com/ntucker)! - internal: Controller.bindMiddleware() to be used in applyMiddleware.
|
|
177
|
+
|
|
178
|
+
This API is not intended to be used elsewhere, but will become the standard interface between
|
|
179
|
+
Controller's and applyMiddleware.
|
|
180
|
+
|
|
181
|
+
- [#3343](https://github.com/reactive/data-client/pull/3343) [`1df829e`](https://github.com/reactive/data-client/commit/1df829e0a005f5973d59669aaf0a226250346a40) Thanks [@ntucker](https://github.com/ntucker)! - Add GCPolicy to control Garbage Collection of data in the store.
|
|
182
|
+
|
|
183
|
+
This can be configured with constructor options, or custom GCPolicies implemented by extending
|
|
184
|
+
or simply building your own. Use `ImmortalGCPolicy` to never GC (to maintain existing behavior).
|
|
185
|
+
|
|
186
|
+
### constructor
|
|
187
|
+
|
|
188
|
+
#### intervalMS = 60 \* 1000 \* 5
|
|
189
|
+
|
|
190
|
+
How long between low priority GC sweeps.
|
|
191
|
+
|
|
192
|
+
Longer values may result in more memory usage, but less performance impact.
|
|
193
|
+
|
|
194
|
+
#### expiryMultiplier = 2
|
|
195
|
+
|
|
196
|
+
Used in the default `hasExpired` policy.
|
|
197
|
+
|
|
198
|
+
Represents how many 'stale' lifetimes data should persist before being
|
|
199
|
+
garbage collected.
|
|
200
|
+
|
|
201
|
+
#### expiresAt
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
expiresAt({
|
|
205
|
+
fetchedAt,
|
|
206
|
+
expiresAt,
|
|
207
|
+
}: {
|
|
208
|
+
expiresAt: number;
|
|
209
|
+
date: number;
|
|
210
|
+
fetchedAt: number;
|
|
211
|
+
}): number {
|
|
212
|
+
return (
|
|
213
|
+
Math.max(
|
|
214
|
+
(expiresAt - fetchedAt) * this.options.expiryMultiplier,
|
|
215
|
+
120000,
|
|
216
|
+
) + fetchedAt
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Indicates at what timestamp it is acceptable to remove unused data from the store.
|
|
222
|
+
|
|
223
|
+
Data not currently rendered in any components is considered unused. However, unused
|
|
224
|
+
data may be used again in the future (as a cache).
|
|
225
|
+
|
|
226
|
+
This results in a tradeoff between memory usage and cache hit rate (and thus performance).
|
|
227
|
+
|
|
228
|
+
- [#3371](https://github.com/reactive/data-client/pull/3371) [`679d76a`](https://github.com/reactive/data-client/commit/679d76a36234dcf5993c0358f94d7e1db0505cc6) Thanks [@ntucker](https://github.com/ntucker)! - Add react-native entry to package.json exports
|
|
229
|
+
|
|
230
|
+
- [#3353](https://github.com/reactive/data-client/pull/3353) [`165afed`](https://github.com/reactive/data-client/commit/165afed083c0c63e9356bc8d1ee30dee8b916ed6) Thanks [@renovate](https://github.com/apps/renovate)! - Polyfills no longer pollute global scope
|
|
231
|
+
|
|
232
|
+
- Updated dependencies [[`679d76a`](https://github.com/reactive/data-client/commit/679d76a36234dcf5993c0358f94d7e1db0505cc6), [`165afed`](https://github.com/reactive/data-client/commit/165afed083c0c63e9356bc8d1ee30dee8b916ed6)]:
|
|
233
|
+
- @data-client/normalizr@0.14.19
|
|
234
|
+
|
|
235
|
+
## 0.14.18
|
|
236
|
+
|
|
237
|
+
### Patch Changes
|
|
238
|
+
|
|
239
|
+
- [`3906fc2`](https://github.com/reactive/data-client/commit/3906fc2fec2b958a44d718934919b524e851f298) Thanks [@ntucker](https://github.com/ntucker)! - SUBSCRIBE action field ordering consistent with other actions
|
|
240
|
+
|
|
241
|
+
## 0.14.16
|
|
242
|
+
|
|
243
|
+
### Patch Changes
|
|
244
|
+
|
|
245
|
+
- [#3244](https://github.com/reactive/data-client/pull/3244) [`109c922`](https://github.com/reactive/data-client/commit/109c922919ef401dee3c3c34d705819271f9e140) Thanks [@ntucker](https://github.com/ntucker)! - Add [actionTypes](https://dataclient.io/docs/api/Actions) without \_TYPE suffix
|
|
246
|
+
|
|
247
|
+
(Not breaking - we keep the old actionTypes name as well.)
|
|
248
|
+
|
|
249
|
+
```ts title="Before"
|
|
250
|
+
import type { Manager, Middleware } from '@data-client/react';
|
|
251
|
+
import { actionTypes } from '@data-client/react';
|
|
252
|
+
|
|
253
|
+
export default class LoggingManager implements Manager {
|
|
254
|
+
middleware: Middleware = controller => next => async action => {
|
|
255
|
+
switch (action.type) {
|
|
256
|
+
case actionTypes.SET_RESPONSE_TYPE:
|
|
257
|
+
console.info(
|
|
258
|
+
`${action.endpoint.name} ${JSON.stringify(action.response)}`,
|
|
259
|
+
);
|
|
260
|
+
default:
|
|
261
|
+
return next(action);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
cleanup() {}
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
```ts title="After"
|
|
270
|
+
import type { Manager, Middleware } from '@data-client/react';
|
|
271
|
+
import { actionTypes } from '@data-client/react';
|
|
272
|
+
|
|
273
|
+
export default class LoggingManager implements Manager {
|
|
274
|
+
middleware: Middleware = controller => next => async action => {
|
|
275
|
+
switch (action.type) {
|
|
276
|
+
case actionTypes.SET_RESPONSE:
|
|
277
|
+
console.info(
|
|
278
|
+
`${action.endpoint.name} ${JSON.stringify(action.response)}`,
|
|
279
|
+
);
|
|
280
|
+
default:
|
|
281
|
+
return next(action);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
cleanup() {}
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
- Updated dependencies [[`43a955c`](https://github.com/reactive/data-client/commit/43a955c18684b4e0f5c1d79b2504e8ad2910816b)]:
|
|
290
|
+
- @data-client/normalizr@0.14.16
|
|
291
|
+
|
|
292
|
+
## 0.14.13
|
|
293
|
+
|
|
294
|
+
### Patch Changes
|
|
295
|
+
|
|
296
|
+
- [`191716f`](https://github.com/reactive/data-client/commit/191716fa120c24bf63b8c960b7d5ee505f5f0fdb) Thanks [@ntucker](https://github.com/ntucker)! - README: Update logo
|
|
297
|
+
|
|
298
|
+
## 0.14.10
|
|
299
|
+
|
|
300
|
+
### Patch Changes
|
|
301
|
+
|
|
302
|
+
- [#3188](https://github.com/reactive/data-client/pull/3188) [`cde7121`](https://github.com/reactive/data-client/commit/cde71212706a46bbfd13dd76e8cfc478b22fe2ab) Thanks [@ntucker](https://github.com/ntucker)! - Update README to remove Entity.pk() when it is default ('id')
|
|
303
|
+
|
|
304
|
+
- Updated dependencies [[`cde7121`](https://github.com/reactive/data-client/commit/cde71212706a46bbfd13dd76e8cfc478b22fe2ab)]:
|
|
305
|
+
- @data-client/normalizr@0.14.10
|
|
306
|
+
|
|
307
|
+
## 0.14.8
|
|
308
|
+
|
|
309
|
+
### Patch Changes
|
|
310
|
+
|
|
311
|
+
- [`bad1fb9`](https://github.com/reactive/data-client/commit/bad1fb909f8d60f19450bbf40df00d90e03a61c2) Thanks [@ntucker](https://github.com/ntucker)! - Update package description
|
|
312
|
+
|
|
313
|
+
## 0.14.6
|
|
314
|
+
|
|
315
|
+
### Patch Changes
|
|
316
|
+
|
|
317
|
+
- [#3165](https://github.com/reactive/data-client/pull/3165) [`3fa9eb9`](https://github.com/reactive/data-client/commit/3fa9eb907d8760171da065168796b87e802d6666) Thanks [@ntucker](https://github.com/ntucker)! - [Query](https://dataclient.io/rest/api/Query) can take [Object Schemas](https://dataclient.io/rest/api/Object)
|
|
318
|
+
|
|
319
|
+
This enables joining arbitrary objects (whose pk works with the same arguments.)
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
class Ticker extends Entity {
|
|
323
|
+
product_id = '';
|
|
324
|
+
price = 0;
|
|
325
|
+
|
|
326
|
+
pk(): string {
|
|
327
|
+
return this.product_id;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
class Stats extends Entity {
|
|
331
|
+
product_id = '';
|
|
332
|
+
last = 0;
|
|
333
|
+
|
|
334
|
+
pk(): string {
|
|
335
|
+
return this.product_id;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
const queryPrice = new schema.Query(
|
|
339
|
+
{ ticker: Ticker, stats: Stats },
|
|
340
|
+
({ ticker, stats }) => ticker?.price ?? stats?.last,
|
|
341
|
+
);
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
- Updated dependencies [[`3fa9eb9`](https://github.com/reactive/data-client/commit/3fa9eb907d8760171da065168796b87e802d6666)]:
|
|
345
|
+
- @data-client/normalizr@0.14.6
|
|
346
|
+
|
|
347
|
+
## 0.14.5
|
|
348
|
+
|
|
349
|
+
### Patch Changes
|
|
350
|
+
|
|
351
|
+
- [#3164](https://github.com/reactive/data-client/pull/3164) [`ffea6fc`](https://github.com/reactive/data-client/commit/ffea6fcfe142e966d1b9527bf2505a5695b98300) Thanks [@ntucker](https://github.com/ntucker)! - Manager.getMiddleware() -> Manager.middleware
|
|
352
|
+
|
|
353
|
+
`getMiddleware()` is still supported to make this change non-breaking
|
|
354
|
+
|
|
355
|
+
- [`82fbb85`](https://github.com/reactive/data-client/commit/82fbb8595d3bec835b3cd4a41f154b7935ccaee2) Thanks [@ntucker](https://github.com/ntucker)! - Middleware types include union of possible actions
|
|
356
|
+
|
|
357
|
+
- [`262587c`](https://github.com/reactive/data-client/commit/262587c0c3e4bc8b779b1ff22ac84d4bddddf5bc) Thanks [@ntucker](https://github.com/ntucker)! - Add SchemaClass type export
|
|
358
|
+
|
|
359
|
+
## 0.14.4
|
|
360
|
+
|
|
361
|
+
### Patch Changes
|
|
362
|
+
|
|
363
|
+
- [#3161](https://github.com/reactive/data-client/pull/3161) [`b932dca`](https://github.com/reactive/data-client/commit/b932dca45a4fcf60c00db8da509162f253065769) Thanks [@ntucker](https://github.com/ntucker)! - Add jsdocs to IdlingNetworkManager
|
|
364
|
+
|
|
365
|
+
- [`e4751d9`](https://github.com/reactive/data-client/commit/e4751d9cd0ee26567d7632ea4707ca181901ff89) Thanks [@ntucker](https://github.com/ntucker)! - NetworkManager constructor uses keyword args
|
|
366
|
+
|
|
367
|
+
#### Before
|
|
368
|
+
|
|
369
|
+
```ts
|
|
370
|
+
new NetworkManager(42, 7);
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
#### After
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
new NetworkManager({ dataExpiryLength: 42, errorExpiryLength: 7 });
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
- [`09ad848`](https://github.com/reactive/data-client/commit/09ad848879db55bb441d93336dd7442d3f484d49) Thanks [@ntucker](https://github.com/ntucker)! - state.endpoints moved above indexes
|
|
380
|
+
|
|
381
|
+
`entites` and `endpoints` are the most commonly inspected
|
|
382
|
+
parts of state when debugging, so it is better to have endpoints
|
|
383
|
+
above indexes.
|
|
384
|
+
|
|
385
|
+
## 0.14.2
|
|
386
|
+
|
|
387
|
+
### Patch Changes
|
|
388
|
+
|
|
389
|
+
- [`597a1b2`](https://github.com/reactive/data-client/commit/597a1b228c81940bdbaf15900ab1e624be3f520e) Thanks [@ntucker](https://github.com/ntucker)! - Disable devtools dispatch feature as it is not usable
|
|
390
|
+
|
|
391
|
+
- [`d8666bf`](https://github.com/reactive/data-client/commit/d8666bf9e059a24b35c8f22b7525ce55c23c84f3) Thanks [@ntucker](https://github.com/ntucker)! - Minor store creation optimizations
|
|
392
|
+
|
|
393
|
+
- [`597a1b2`](https://github.com/reactive/data-client/commit/597a1b228c81940bdbaf15900ab1e624be3f520e) Thanks [@ntucker](https://github.com/ntucker)! - fix: Devtools correctly logs fetch actions
|
|
394
|
+
|
|
395
|
+
We inspect fetches against inflight to see if they are throttled;
|
|
396
|
+
However, we previously did this after we sent the action to NetworkManager, which
|
|
397
|
+
meant it would also skip logging any throttlable fetches - even if they were not throttled.
|
|
398
|
+
|
|
399
|
+
- [`d84b43c`](https://github.com/reactive/data-client/commit/d84b43cf728d714da7182f2c19b39f49e0ec0366) Thanks [@ntucker](https://github.com/ntucker)! - Move NetworkManager missing detection to initialization (applyManager())
|
|
400
|
+
|
|
401
|
+
- [`06df291`](https://github.com/reactive/data-client/commit/06df291a1f1d91afa331310dfb8319bc8d1a3ba8) Thanks [@ntucker](https://github.com/ntucker)! - Reorder action members for easier debuggability
|
|
402
|
+
- `key` at top - easiest to read 'subject'
|
|
403
|
+
- `response` or `value` after - 'object' being set
|
|
404
|
+
|
|
405
|
+
- [`597a1b2`](https://github.com/reactive/data-client/commit/597a1b228c81940bdbaf15900ab1e624be3f520e) Thanks [@ntucker](https://github.com/ntucker)! - Improve typing for devtools options
|
|
406
|
+
|
|
407
|
+
## 0.14.1
|
|
408
|
+
|
|
409
|
+
### Patch Changes
|
|
410
|
+
|
|
411
|
+
- [`7427519`](https://github.com/reactive/data-client/commit/742751933f799c77b12cec7f8a7e4582db4cd779) Thanks [@ntucker](https://github.com/ntucker)! - Update README
|
|
412
|
+
|
|
413
|
+
- Updated dependencies [[`428d618`](https://github.com/reactive/data-client/commit/428d618ce057d4eef23592a64ec9d1c6fb82f43f)]:
|
|
414
|
+
- @data-client/normalizr@0.14.1
|
|
415
|
+
|
|
416
|
+
## 0.14.0
|
|
417
|
+
|
|
418
|
+
### Minor Changes
|
|
419
|
+
|
|
420
|
+
- [#3141](https://github.com/reactive/data-client/pull/3141) [`d225595`](https://github.com/reactive/data-client/commit/d2255959489b71cfdfcaf4be72fd272231d392f1) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: setResponseAction.payload -> setResponseAction.response
|
|
421
|
+
|
|
422
|
+
This only affects those writing custom [Managers](https://dataclient.io/docs/concepts/managers) that
|
|
423
|
+
handle [SET_RESPONSE](/docs/api/Actions#set_response).
|
|
424
|
+
|
|
425
|
+
#### Before
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
import {
|
|
429
|
+
SET_RESPONSE_TYPE,
|
|
430
|
+
type Manager,
|
|
431
|
+
type Middleware,
|
|
432
|
+
} from '@data-client/react';
|
|
433
|
+
|
|
434
|
+
export default class MyManager implements Manager {
|
|
435
|
+
getMiddleware = (): Middleware => controller => next => async action => {
|
|
436
|
+
switch (action.type) {
|
|
437
|
+
case SET_RESPONSE_TYPE:
|
|
438
|
+
console.log('Resolved with value', action.payload);
|
|
439
|
+
return next(action);
|
|
440
|
+
default:
|
|
441
|
+
return next(action);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
cleanup() {}
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
#### After
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
import {
|
|
453
|
+
SET_RESPONSE_TYPE,
|
|
454
|
+
type Manager,
|
|
455
|
+
type Middleware,
|
|
456
|
+
} from '@data-client/react';
|
|
457
|
+
|
|
458
|
+
export default class MyManager implements Manager {
|
|
459
|
+
getMiddleware = (): Middleware => controller => next => async action => {
|
|
460
|
+
switch (action.type) {
|
|
461
|
+
case SET_RESPONSE_TYPE:
|
|
462
|
+
console.log('Resolved with value', action.response);
|
|
463
|
+
return next(action);
|
|
464
|
+
default:
|
|
465
|
+
return next(action);
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
cleanup() {}
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
- [`96f7eb0`](https://github.com/reactive/data-client/commit/96f7eb0c97db75bd0ec663d0fb0db8cf3ee808d5) Thanks [@ntucker](https://github.com/ntucker)! - Renamed FETCH action.meta.createdAt to fetchedAt to be consistent with other actions like
|
|
474
|
+
SET_RESPONSE.
|
|
475
|
+
|
|
476
|
+
BREAKING CHANGE: fetchAction.meta.createdAt -> fetchAction.meta.fetchedAt
|
|
477
|
+
|
|
478
|
+
- [#3138](https://github.com/reactive/data-client/pull/3138) [`ee509fb`](https://github.com/reactive/data-client/commit/ee509fb9c7681f060521f358f76b55ca0cb600ec) Thanks [@ntucker](https://github.com/ntucker)! - Remove throttle from FETCH_TYPE action
|
|
479
|
+
|
|
480
|
+
BREAKING CHANGE: action.meta.throttle -> !action.endpoint.sideEffect
|
|
481
|
+
|
|
482
|
+
- [#3143](https://github.com/reactive/data-client/pull/3143) [`f4cf8a4`](https://github.com/reactive/data-client/commit/f4cf8a4df3dfe852d98058abd06178f751ae8716) Thanks [@ntucker](https://github.com/ntucker)! - action.meta.args -> action.args
|
|
483
|
+
|
|
484
|
+
- [#3143](https://github.com/reactive/data-client/pull/3143) [`f4cf8a4`](https://github.com/reactive/data-client/commit/f4cf8a4df3dfe852d98058abd06178f751ae8716) Thanks [@ntucker](https://github.com/ntucker)! - Add `actions` export
|
|
485
|
+
|
|
486
|
+
`actions` is a namespace for all action creators. It is typically
|
|
487
|
+
preferred to use [Controller's](https://dataclient.io/docs/api/Controller) type-safe dispatch methods, as
|
|
488
|
+
members of this namespace could have breaking changes in a minor release.
|
|
489
|
+
|
|
490
|
+
```ts
|
|
491
|
+
import { actions, type Manager, type Middleware } from '@data-client/core';
|
|
492
|
+
|
|
493
|
+
export default class MyManager implements Manager {
|
|
494
|
+
getMiddleware = (): Middleware => controller => next => {
|
|
495
|
+
const todo = { id: '5', title: 'my first todo' };
|
|
496
|
+
|
|
497
|
+
// These do the same thing
|
|
498
|
+
controller.dispatch(
|
|
499
|
+
actions.createSet(Todo, { args: [{ id: todo.id }], value: todo }),
|
|
500
|
+
);
|
|
501
|
+
// This is simpler; type-enforced; and will only change in major versions
|
|
502
|
+
controller.set(Todo, { id: todo.id }, todo);
|
|
503
|
+
|
|
504
|
+
return async action => next(action);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
cleanup() {}
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
BREAKING CHANGE: Removed `createFetch`, `createSet`, `createSetResponse` from export. Use action.createFetch instead.
|
|
512
|
+
|
|
513
|
+
- [#3141](https://github.com/reactive/data-client/pull/3141) [`d225595`](https://github.com/reactive/data-client/commit/d2255959489b71cfdfcaf4be72fd272231d392f1) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: remove fetchAction.payload
|
|
514
|
+
|
|
515
|
+
This only affects those writing custom [Managers](https://dataclient.io/docs/concepts/managers) that
|
|
516
|
+
handle [FETCH](/docs/api/Actions#fetch).
|
|
517
|
+
|
|
518
|
+
#### Before
|
|
519
|
+
|
|
520
|
+
```ts
|
|
521
|
+
import {
|
|
522
|
+
FETCH_TYPE,
|
|
523
|
+
type Manager,
|
|
524
|
+
type Middleware,
|
|
525
|
+
} from '@data-client/react';
|
|
526
|
+
|
|
527
|
+
export default class MyManager implements Manager {
|
|
528
|
+
getMiddleware = (): Middleware => controller => next => async action => {
|
|
529
|
+
switch (action.type) {
|
|
530
|
+
case FETCH_TYPE:
|
|
531
|
+
// consume fetch, and print the resolution
|
|
532
|
+
action.payload().then(response => console.log(response));
|
|
533
|
+
default:
|
|
534
|
+
return next(action);
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
cleanup() {}
|
|
539
|
+
}
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
#### After
|
|
543
|
+
|
|
544
|
+
```ts
|
|
545
|
+
import {
|
|
546
|
+
FETCH_TYPE,
|
|
547
|
+
type Manager,
|
|
548
|
+
type Middleware,
|
|
549
|
+
} from '@data-client/react';
|
|
550
|
+
|
|
551
|
+
export default class MyManager implements Manager {
|
|
552
|
+
getMiddleware = (): Middleware => controller => next => async action => {
|
|
553
|
+
switch (action.type) {
|
|
554
|
+
case FETCH_TYPE:
|
|
555
|
+
// consume fetch, and print the resolution
|
|
556
|
+
action
|
|
557
|
+
.endpoint(...action.meta.args)
|
|
558
|
+
.then(response => console.log(response));
|
|
559
|
+
default:
|
|
560
|
+
return next(action);
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
cleanup() {}
|
|
565
|
+
}
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
- [#3143](https://github.com/reactive/data-client/pull/3143) [`f4cf8a4`](https://github.com/reactive/data-client/commit/f4cf8a4df3dfe852d98058abd06178f751ae8716) Thanks [@ntucker](https://github.com/ntucker)! - action.meta.key -> action.key
|
|
569
|
+
|
|
570
|
+
- [#3139](https://github.com/reactive/data-client/pull/3139) [`9df0f7c`](https://github.com/reactive/data-client/commit/9df0f7c670c919d956312d2535c298d2553f5840) Thanks [@ntucker](https://github.com/ntucker)! - Get rid of fetch action.meta.nm. This is not used anywhere.
|
|
571
|
+
|
|
572
|
+
### Patch Changes
|
|
573
|
+
|
|
574
|
+
- [`3ffa454`](https://github.com/reactive/data-client/commit/3ffa454def38b35a23520444f80b307732a8a89b) Thanks [@ntucker](https://github.com/ntucker)! - internal: Simplify fetchReducer code
|
|
575
|
+
|
|
576
|
+
- [#3134](https://github.com/reactive/data-client/pull/3134) [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36) Thanks [@ntucker](https://github.com/ntucker)! - Change Schema.normalize `visit()` interface; removing non-contextual arguments.
|
|
577
|
+
|
|
578
|
+
```ts
|
|
579
|
+
/** Visits next data + schema while recurisvely normalizing */
|
|
580
|
+
export interface Visit {
|
|
581
|
+
(schema: any, value: any, parent: any, key: any, args: readonly any[]): any;
|
|
582
|
+
creating?: boolean;
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
This results in a 10% normalize performance boost.
|
|
587
|
+
|
|
588
|
+
```ts title="Before"
|
|
589
|
+
processedEntity[key] = visit(
|
|
590
|
+
processedEntity[key],
|
|
591
|
+
processedEntity,
|
|
592
|
+
key,
|
|
593
|
+
this.schema[key],
|
|
594
|
+
addEntity,
|
|
595
|
+
visitedEntities,
|
|
596
|
+
storeEntities,
|
|
597
|
+
args,
|
|
598
|
+
);
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
```ts title="After"
|
|
602
|
+
processedEntity[key] = visit(
|
|
603
|
+
this.schema[key],
|
|
604
|
+
processedEntity[key],
|
|
605
|
+
processedEntity,
|
|
606
|
+
key,
|
|
607
|
+
args,
|
|
608
|
+
);
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
The information needed from these arguments are provided by [closing](<https://en.wikipedia.org/wiki/Closure_(computer_programming)>) `visit()` around them.
|
|
612
|
+
|
|
613
|
+
- [#3134](https://github.com/reactive/data-client/pull/3134) [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36) Thanks [@ntucker](https://github.com/ntucker)! - Change Schema.normalize interface from direct data access, to using functions like `getEntity`
|
|
614
|
+
|
|
615
|
+
```ts
|
|
616
|
+
interface SchemaSimple {
|
|
617
|
+
normalize(
|
|
618
|
+
input: any,
|
|
619
|
+
parent: any,
|
|
620
|
+
key: any,
|
|
621
|
+
args: any[],
|
|
622
|
+
visit: (
|
|
623
|
+
schema: any,
|
|
624
|
+
value: any,
|
|
625
|
+
parent: any,
|
|
626
|
+
key: any,
|
|
627
|
+
args: readonly any[],
|
|
628
|
+
) => any,
|
|
629
|
+
addEntity: (...args: any) => any,
|
|
630
|
+
getEntity: (...args: any) => any,
|
|
631
|
+
checkLoop: (...args: any) => any,
|
|
632
|
+
): any;
|
|
633
|
+
}
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
We also add `checkLoop()`, which moves some logic in [Entity](https://dataclient.io/rest/api/Entity)
|
|
637
|
+
to the core normalize algorithm.
|
|
638
|
+
|
|
639
|
+
```ts
|
|
640
|
+
/** Returns true if a circular reference is found */
|
|
641
|
+
export interface CheckLoop {
|
|
642
|
+
(entityKey: string, pk: string, input: object): boolean;
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
- [#3134](https://github.com/reactive/data-client/pull/3134) [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36) Thanks [@ntucker](https://github.com/ntucker)! - Change Schema.denormalize `unvisit` to have [schema](https://dataclient.io/rest/api/schema) argument first.
|
|
647
|
+
|
|
648
|
+
```ts
|
|
649
|
+
interface SchemaSimple {
|
|
650
|
+
denormalize(
|
|
651
|
+
input: {},
|
|
652
|
+
args: readonly any[],
|
|
653
|
+
unvisit: (schema: any, input: any) => any,
|
|
654
|
+
): T;
|
|
655
|
+
}
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
- Updated dependencies [[`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36), [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36), [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36), [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36), [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36), [`2ad1811`](https://github.com/reactive/data-client/commit/2ad1811149cdc419f6462ace08efdb7766195b36)]:
|
|
659
|
+
- @data-client/normalizr@0.14.0
|
|
660
|
+
|
|
661
|
+
## 0.13.5
|
|
662
|
+
|
|
663
|
+
### Patch Changes
|
|
664
|
+
|
|
665
|
+
- [#3129](https://github.com/reactive/data-client/pull/3129) [`2503402`](https://github.com/reactive/data-client/commit/2503402c28a51b2a686bf61132b74d673950e63e) Thanks [@ntucker](https://github.com/ntucker)! - Allow ctrl.set() value to be a function
|
|
666
|
+
|
|
667
|
+
This [prevents race conditions](https://react.dev/reference/react/useState#updating-state-based-on-the-previous-state).
|
|
668
|
+
|
|
669
|
+
```ts
|
|
670
|
+
const id = '2';
|
|
671
|
+
ctrl.set(Article, { id }, article => ({ id, votes: article.votes + 1 }));
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
Note: the response must include values sufficient to compute Entity.pk()
|
|
675
|
+
|
|
676
|
+
- [#3127](https://github.com/reactive/data-client/pull/3127) [`c18fbf7`](https://github.com/reactive/data-client/commit/c18fbf7fdc7c421d15dc26cc5add3b5840ddca6d) Thanks [@ntucker](https://github.com/ntucker)! - Remove RIC export
|
|
677
|
+
|
|
678
|
+
- [#3127](https://github.com/reactive/data-client/pull/3127) [`c18fbf7`](https://github.com/reactive/data-client/commit/c18fbf7fdc7c421d15dc26cc5add3b5840ddca6d) Thanks [@ntucker](https://github.com/ntucker)! - Add NetworkManager.idleCallback overridable method
|
|
679
|
+
|
|
680
|
+
This allows platform specific implementations by overriding the method.
|
|
681
|
+
For instance, on web:
|
|
682
|
+
|
|
683
|
+
```ts
|
|
684
|
+
import { NetworkManager } from '@data-client/core';
|
|
685
|
+
|
|
686
|
+
export default class WebNetworkManager extends NetworkManager {
|
|
687
|
+
static {
|
|
688
|
+
if (typeof requestIdleCallback === 'function') {
|
|
689
|
+
WebNetworkManager.prototype.idleCallback = requestIdleCallback;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
## 0.13.1
|
|
696
|
+
|
|
697
|
+
### Patch Changes
|
|
698
|
+
|
|
699
|
+
- [`327d666`](https://github.com/reactive/data-client/commit/327d6668958e45119eb075f6af4de7239fc1dda6) Thanks [@ntucker](https://github.com/ntucker)! - Add ctrl.set() to README
|
|
700
|
+
|
|
701
|
+
## 0.13.0
|
|
702
|
+
|
|
703
|
+
### Minor Changes
|
|
704
|
+
|
|
705
|
+
- [#3105](https://github.com/reactive/data-client/pull/3105) [`cf770de`](https://github.com/reactive/data-client/commit/cf770de244ad890b286c59ac305ceb6c3b1288ea) Thanks [@ntucker](https://github.com/ntucker)! - Add controller.set()
|
|
706
|
+
|
|
707
|
+
```ts
|
|
708
|
+
ctrl.set(
|
|
709
|
+
Todo,
|
|
710
|
+
{ id: '5' },
|
|
711
|
+
{ id: '5', title: 'tell me friends how great Data Client is' },
|
|
712
|
+
);
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
BREAKING CHANGE:
|
|
716
|
+
- actionTypes.SET_TYPE -> actionTypes.SET_RESPONSE_TYPE
|
|
717
|
+
- SetAction -> SetResponseAction
|
|
718
|
+
|
|
719
|
+
## 0.12.5
|
|
720
|
+
|
|
721
|
+
### Patch Changes
|
|
722
|
+
|
|
723
|
+
- [`e4d5f01`](https://github.com/reactive/data-client/commit/e4d5f019f7c3817fb740094244e8ce17ccd5452d) Thanks [@ntucker](https://github.com/ntucker)! - [DevToolsManager](https://dataclient.io/docs/api/DevToolsManager) uses [maxAge](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md#maxage) to set buffer size
|
|
724
|
+
|
|
725
|
+
- [`c3481ad`](https://github.com/reactive/data-client/commit/c3481ad578c77a6dc73f45f1afcec353ba032534) Thanks [@ntucker](https://github.com/ntucker)! - Fix DevToolsManager() config parameter correctly sets devtools config
|
|
726
|
+
|
|
727
|
+
## 0.12.3
|
|
728
|
+
|
|
729
|
+
### Patch Changes
|
|
730
|
+
|
|
731
|
+
- [`00d4205`](https://github.com/reactive/data-client/commit/00d4205f03562cfe4acd18215718e23ae5466b8d) Thanks [@ntucker](https://github.com/ntucker)! - Add funding package.json field
|
|
732
|
+
|
|
733
|
+
- [`8a8634c`](https://github.com/reactive/data-client/commit/8a8634c7a263cf99e9ce426b2c9b92fd2a12a259) Thanks [@ntucker](https://github.com/ntucker)! - Reduce GC pressure by reusing AbortOptimistic instance
|
|
734
|
+
|
|
735
|
+
- Updated dependencies [[`00d4205`](https://github.com/reactive/data-client/commit/00d4205f03562cfe4acd18215718e23ae5466b8d)]:
|
|
736
|
+
- @data-client/normalizr@0.12.3
|
|
737
|
+
|
|
738
|
+
## 0.12.1
|
|
739
|
+
|
|
740
|
+
### Patch Changes
|
|
741
|
+
|
|
742
|
+
- [#3043](https://github.com/reactive/data-client/pull/3043) [`5b64cbf`](https://github.com/reactive/data-client/commit/5b64cbf3126c404b70853960a4bdedc268e3328c) Thanks [@ntucker](https://github.com/ntucker)! - Improve [controller](https://dataclient.io/docs/api/Controller) type matching for its methods
|
|
743
|
+
|
|
744
|
+
## 0.11.5
|
|
745
|
+
|
|
746
|
+
### Patch Changes
|
|
747
|
+
|
|
748
|
+
- [#3033](https://github.com/reactive/data-client/pull/3033) [`2152b41`](https://github.com/reactive/data-client/commit/2152b41afc56027175bd36e7ef89c433a2e5e025) Thanks [@ntucker](https://github.com/ntucker)! - Environments without RequestIdleCallback will call immediately
|
|
749
|
+
|
|
750
|
+
## 0.11.4
|
|
751
|
+
|
|
752
|
+
### Patch Changes
|
|
753
|
+
|
|
754
|
+
- [#3020](https://github.com/reactive/data-client/pull/3020) [`dcb6b2f`](https://github.com/reactive/data-client/commit/dcb6b2fd4a5015242f43edc155352da6789cdb5d) Thanks [@ntucker](https://github.com/ntucker)! - Add NI<> utility type that is back-compat NoInfer<>
|
|
755
|
+
|
|
756
|
+
- Updated dependencies [[`dcb6b2f`](https://github.com/reactive/data-client/commit/dcb6b2fd4a5015242f43edc155352da6789cdb5d)]:
|
|
757
|
+
- @data-client/normalizr@0.11.4
|
|
758
|
+
|
|
759
|
+
## 0.11.0
|
|
760
|
+
|
|
761
|
+
[Release notes and migration guide](https://dataclient.io/blog/2024/04/08/v0.11-queries-querable-usequery)
|
|
762
|
+
|
|
763
|
+
### Minor Changes
|
|
764
|
+
|
|
765
|
+
- [#2921](https://github.com/reactive/data-client/pull/2921) [`6e55026`](https://github.com/reactive/data-client/commit/6e550260672507592d75c4781dc2563a50e664fa) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING: new AbortOptimistic() -> [snapshot.abort](https://dataclient/docs/api/Snapshot#abort)
|
|
766
|
+
|
|
767
|
+
#### Before
|
|
768
|
+
|
|
769
|
+
```ts
|
|
770
|
+
getOptimisticResponse(snapshot, { id }) {
|
|
771
|
+
const { data } = snapshot.getResponse(Base.get, { id });
|
|
772
|
+
if (!data) throw new AbortOptimistic();
|
|
773
|
+
return {
|
|
774
|
+
id,
|
|
775
|
+
votes: data.votes + 1,
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
#### After
|
|
781
|
+
|
|
782
|
+
```ts
|
|
783
|
+
getOptimisticResponse(snapshot, { id }) {
|
|
784
|
+
const { data } = snapshot.getResponse(Base.get, { id });
|
|
785
|
+
if (!data) throw snapshot.abort;
|
|
786
|
+
return {
|
|
787
|
+
id,
|
|
788
|
+
votes: data.votes + 1,
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
- [#2977](https://github.com/reactive/data-client/pull/2977) [`59a407a`](https://github.com/reactive/data-client/commit/59a407a5bcaa8e5c6a948a85f5c52f106b24c5af) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING: Schema.infer -> Schema.queryKey
|
|
794
|
+
|
|
795
|
+
```ts title="Before"
|
|
796
|
+
class MyEntity extends Entity {
|
|
797
|
+
// highlight-next-line
|
|
798
|
+
static infer(
|
|
799
|
+
args: readonly any[],
|
|
800
|
+
indexes: NormalizedIndex,
|
|
801
|
+
recurse: any,
|
|
802
|
+
entities: any,
|
|
803
|
+
): any {
|
|
804
|
+
if (SILLYCONDITION) return undefined;
|
|
805
|
+
return super.infer(args, indexes, recurse, entities);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
```ts title="After"
|
|
811
|
+
class MyEntity extends Entity {
|
|
812
|
+
// highlight-next-line
|
|
813
|
+
static queryKey(
|
|
814
|
+
args: readonly any[],
|
|
815
|
+
queryKey: (...args: any) => any,
|
|
816
|
+
getEntity: GetEntity,
|
|
817
|
+
getIndex: GetIndex,
|
|
818
|
+
): any {
|
|
819
|
+
if (SILLYCONDITION) return undefined;
|
|
820
|
+
return super.queryKey(args, queryKey, getEntity, getIndex);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
- [#2921](https://github.com/reactive/data-client/pull/2921) [`6e55026`](https://github.com/reactive/data-client/commit/6e550260672507592d75c4781dc2563a50e664fa) Thanks [@ntucker](https://github.com/ntucker)! - Add [controller.get](https://dataclient.io/docs/api/Controller#get) / [snapshot.get](https://dataclient.io/docs/api/Snapshot#get) to directly read [Querable Schemas](https://dataclient.io/docs/api/useQuery#queryable)
|
|
826
|
+
|
|
827
|
+
#### Before
|
|
828
|
+
|
|
829
|
+
```tsx
|
|
830
|
+
export const PostResource = createResource({
|
|
831
|
+
path: '/posts/:id',
|
|
832
|
+
schema: Post,
|
|
833
|
+
}).extend(Base => ({
|
|
834
|
+
vote: new RestEndpoint({
|
|
835
|
+
path: '/posts/:id/vote',
|
|
836
|
+
method: 'POST',
|
|
837
|
+
body: undefined,
|
|
838
|
+
schema: Post,
|
|
839
|
+
getOptimisticResponse(snapshot, { id }) {
|
|
840
|
+
const { data } = snapshot.getResponse(Base.get, { id });
|
|
841
|
+
if (!data) throw new AbortOptimistic();
|
|
842
|
+
return {
|
|
843
|
+
id,
|
|
844
|
+
votes: data.votes + 1,
|
|
845
|
+
};
|
|
846
|
+
},
|
|
847
|
+
}),
|
|
848
|
+
}));
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
#### After
|
|
852
|
+
|
|
853
|
+
```tsx
|
|
854
|
+
export const PostResource = createResource({
|
|
855
|
+
path: '/posts/:id',
|
|
856
|
+
schema: Post,
|
|
857
|
+
}).extend('vote', {
|
|
858
|
+
path: '/posts/:id/vote',
|
|
859
|
+
method: 'POST',
|
|
860
|
+
body: undefined,
|
|
861
|
+
schema: Post,
|
|
862
|
+
getOptimisticResponse(snapshot, { id }) {
|
|
863
|
+
const post = snapshot.get(Post, { id });
|
|
864
|
+
if (!post) throw new AbortOptimistic();
|
|
865
|
+
return {
|
|
866
|
+
id,
|
|
867
|
+
votes: post.votes + 1,
|
|
868
|
+
};
|
|
869
|
+
},
|
|
870
|
+
});
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
- [#2957](https://github.com/reactive/data-client/pull/2957) [`c129a25`](https://github.com/reactive/data-client/commit/c129a2558ecb21b5d9985c13747c555b88c51b3a) Thanks [@ntucker](https://github.com/ntucker)! - Add [snapshot.abort](https://dataclient.io/docs/api/Snapshot#abort)
|
|
874
|
+
|
|
875
|
+
```ts
|
|
876
|
+
getOptimisticResponse(snapshot, { id }) {
|
|
877
|
+
const { data } = snapshot.getResponse(Base.get, { id });
|
|
878
|
+
if (!data) throw snapshot.abort;
|
|
879
|
+
return {
|
|
880
|
+
id,
|
|
881
|
+
votes: data.votes + 1,
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
- [#2977](https://github.com/reactive/data-client/pull/2977) [`59a407a`](https://github.com/reactive/data-client/commit/59a407a5bcaa8e5c6a948a85f5c52f106b24c5af) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING: inferResults() -> buildQueryKey()
|
|
887
|
+
|
|
888
|
+
- [#2971](https://github.com/reactive/data-client/pull/2971) [`b738e18`](https://github.com/reactive/data-client/commit/b738e18f7dc2976907198192ed4ec62775e52161) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING: Internal state.results -> state.endpoints
|
|
889
|
+
|
|
890
|
+
### Patch Changes
|
|
891
|
+
|
|
892
|
+
- [`2e169b7`](https://github.com/reactive/data-client/commit/2e169b705e4f8e2eea8005291a0e76e9d11764a4) Thanks [@ntucker](https://github.com/ntucker)! - Fix schema.All denormalize INVALID case should also work when class name mangling is performed in production builds
|
|
893
|
+
- `unvisit()` always returns `undefined` with `undefined` as input.
|
|
894
|
+
- `All` returns INVALID from `queryKey()` to invalidate what was previously a special case in `unvisit()` (when there is no table entry for the given entity)
|
|
895
|
+
|
|
896
|
+
- [`ca79a62`](https://github.com/reactive/data-client/commit/ca79a6266cc6834ee8d8e228b4715513d13185e0) Thanks [@ntucker](https://github.com/ntucker)! - Update description in package.json
|
|
897
|
+
|
|
898
|
+
- [#2921](https://github.com/reactive/data-client/pull/2921) [`6e55026`](https://github.com/reactive/data-client/commit/6e550260672507592d75c4781dc2563a50e664fa) Thanks [@ntucker](https://github.com/ntucker)! - Improve controller.getResponse() type matching
|
|
899
|
+
|
|
900
|
+
Uses function overloading to more precisely match argument
|
|
901
|
+
expectations for fetchable Endpoints vs only keyable Endpoints.
|
|
902
|
+
|
|
903
|
+
- [#2921](https://github.com/reactive/data-client/pull/2921) [`6e55026`](https://github.com/reactive/data-client/commit/6e550260672507592d75c4781dc2563a50e664fa) Thanks [@ntucker](https://github.com/ntucker)! - Update README
|
|
904
|
+
|
|
905
|
+
- Updated dependencies [[`2e169b7`](https://github.com/reactive/data-client/commit/2e169b705e4f8e2eea8005291a0e76e9d11764a4), [`6e55026`](https://github.com/reactive/data-client/commit/6e550260672507592d75c4781dc2563a50e664fa), [`ca79a62`](https://github.com/reactive/data-client/commit/ca79a6266cc6834ee8d8e228b4715513d13185e0), [`f68750f`](https://github.com/reactive/data-client/commit/f68750f8b0cafa66f6d50521e474db5e3d3c9cdd), [`f68750f`](https://github.com/reactive/data-client/commit/f68750f8b0cafa66f6d50521e474db5e3d3c9cdd), [`59a407a`](https://github.com/reactive/data-client/commit/59a407a5bcaa8e5c6a948a85f5c52f106b24c5af), [`73de27f`](https://github.com/reactive/data-client/commit/73de27fadb214c3c2995ca558daa9736312de7a9), [`446f0b9`](https://github.com/reactive/data-client/commit/446f0b905f57c290e120c6f11a6b4708554283d1), [`b738e18`](https://github.com/reactive/data-client/commit/b738e18f7dc2976907198192ed4ec62775e52161), [`6e55026`](https://github.com/reactive/data-client/commit/6e550260672507592d75c4781dc2563a50e664fa), [`446f0b9`](https://github.com/reactive/data-client/commit/446f0b905f57c290e120c6f11a6b4708554283d1), [`f68750f`](https://github.com/reactive/data-client/commit/f68750f8b0cafa66f6d50521e474db5e3d3c9cdd), [`f68750f`](https://github.com/reactive/data-client/commit/f68750f8b0cafa66f6d50521e474db5e3d3c9cdd), [`c129a25`](https://github.com/reactive/data-client/commit/c129a2558ecb21b5d9985c13747c555b88c51b3a), [`10432b7`](https://github.com/reactive/data-client/commit/10432b7eeab8f1e31ed764d46b0775e36ea74041), [`59a407a`](https://github.com/reactive/data-client/commit/59a407a5bcaa8e5c6a948a85f5c52f106b24c5af)]:
|
|
906
|
+
- @data-client/normalizr@0.11.0
|
|
907
|
+
|
|
908
|
+
## 0.10.0
|
|
909
|
+
|
|
910
|
+
### Minor Changes
|
|
911
|
+
|
|
912
|
+
- [#2912](https://github.com/reactive/data-client/pull/2912) [`922be79`](https://github.com/reactive/data-client/commit/922be79169a3eeea8e336eee519c165431ead474) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGE: `null` inputs are no longer filtered from Array or Object
|
|
913
|
+
- `[]` and [schema.Array](https://dataclient.io/rest/api/Array) now behave in the same manner.
|
|
914
|
+
- `null` values are now consistently handled everywhere (being retained).
|
|
915
|
+
- These were already being retained in [nested Entities](https://dataclient.io/rest/guides/relational-data#nesting)
|
|
916
|
+
- `undefined` is still filtered out.
|
|
917
|
+
|
|
918
|
+
### Patch Changes
|
|
919
|
+
|
|
920
|
+
- [`4e6a39e`](https://github.com/reactive/data-client/commit/4e6a39ea2bfdb1390051f12781e899488609e1a8) Thanks [@ntucker](https://github.com/ntucker)! - Limit DevToolsManager action buffer depth to 100
|
|
921
|
+
|
|
922
|
+
This will avoid memory leaks in long running applications, or ones with frequent updates.
|
|
923
|
+
|
|
924
|
+
- [`69834b5`](https://github.com/reactive/data-client/commit/69834b50c6d2b33f46d7c63cabdc0744abf160ae) Thanks [@ntucker](https://github.com/ntucker)! - Update README with API links
|
|
925
|
+
|
|
926
|
+
- Updated dependencies [[`67f4e0b`](https://github.com/reactive/data-client/commit/67f4e0b45068da32d20e250267cb1cd2cea51226), [`053e823`](https://github.com/reactive/data-client/commit/053e82377bd29f200cd7dfbc700da7a3ad7fa8d7), [`922be79`](https://github.com/reactive/data-client/commit/922be79169a3eeea8e336eee519c165431ead474)]:
|
|
927
|
+
- @data-client/normalizr@0.10.0
|
|
928
|
+
|
|
929
|
+
## 0.9.7
|
|
930
|
+
|
|
931
|
+
### Patch Changes
|
|
932
|
+
|
|
933
|
+
- [`6c6678bd9d`](https://github.com/reactive/data-client/commit/6c6678bd9d0051c3bf1996c064457ca6f2389c62) Thanks [@ntucker](https://github.com/ntucker)! - docs: README uses svg version of logo
|
|
934
|
+
|
|
935
|
+
## 0.9.4
|
|
936
|
+
|
|
937
|
+
### Patch Changes
|
|
938
|
+
|
|
939
|
+
- [`d1b51af7ac`](https://github.com/reactive/data-client/commit/d1b51af7ac4a8a7c0559f478cc9503be8e61514c) Thanks [@ntucker](https://github.com/ntucker)! - Fix unpkg bundles by ensuring dependencies are built in order
|
|
940
|
+
|
|
941
|
+
- Updated dependencies [[`d1b51af7ac`](https://github.com/reactive/data-client/commit/d1b51af7ac4a8a7c0559f478cc9503be8e61514c)]:
|
|
942
|
+
- @data-client/normalizr@0.9.4
|
|
943
|
+
|
|
944
|
+
## 0.9.3
|
|
945
|
+
|
|
946
|
+
### Patch Changes
|
|
947
|
+
|
|
948
|
+
- [#2818](https://github.com/reactive/data-client/pull/2818) [`fc0092883f`](https://github.com/reactive/data-client/commit/fc0092883f5af42a5d270250482b7f0ba9845e95) Thanks [@ntucker](https://github.com/ntucker)! - Fix unpkg bundles and update names
|
|
949
|
+
- Client packages namespace into RDC
|
|
950
|
+
- @data-client/react - RDC
|
|
951
|
+
- @data-client/core - RDC.Core
|
|
952
|
+
- @data-client/redux - RDC.Redux
|
|
953
|
+
- Definition packages namespace top level
|
|
954
|
+
- @data-client/rest - Rest
|
|
955
|
+
- @data-client/graphql - GraphQL
|
|
956
|
+
- @data-client/img - Img
|
|
957
|
+
- @data-client/endpoint - Endpoint
|
|
958
|
+
- Utility
|
|
959
|
+
- @data-client/normalizr - normalizr
|
|
960
|
+
- @data-client/use-enhanced-reducer - EnhancedReducer
|
|
961
|
+
|
|
962
|
+
- [`327b94bedc`](https://github.com/reactive/data-client/commit/327b94bedc280e25c1766b3a51cc20078bfa1739) Thanks [@ntucker](https://github.com/ntucker)! - docs: Add logo to readme
|
|
963
|
+
|
|
964
|
+
- Updated dependencies [[`fc0092883f`](https://github.com/reactive/data-client/commit/fc0092883f5af42a5d270250482b7f0ba9845e95)]:
|
|
965
|
+
- @data-client/normalizr@0.9.3
|
|
966
|
+
|
|
967
|
+
## 0.9.2
|
|
968
|
+
|
|
969
|
+
### Patch Changes
|
|
970
|
+
|
|
971
|
+
- [`c9ca31f3f4`](https://github.com/reactive/data-client/commit/c9ca31f3f4f2f6e3174c74172ebc194edbe56bb2) Thanks [@ntucker](https://github.com/ntucker)! - Better track state changes between each action
|
|
972
|
+
|
|
973
|
+
Since React 18 batches updates, the real state can
|
|
974
|
+
sometimes update from multiple actions, making it harder
|
|
975
|
+
to debug. When devtools are open, instead of getting
|
|
976
|
+
the real state - track a shadow state that accurately reflects
|
|
977
|
+
changes from each action.
|
|
978
|
+
|
|
979
|
+
- [`4ea0bc83f6`](https://github.com/reactive/data-client/commit/4ea0bc83f65f49cb2155f6aecdc5f8d1b168fd5e) Thanks [@ntucker](https://github.com/ntucker)! - Docs: Update repo links to reactive organization
|
|
980
|
+
|
|
981
|
+
- Updated dependencies [[`4ea0bc83f6`](https://github.com/reactive/data-client/commit/4ea0bc83f65f49cb2155f6aecdc5f8d1b168fd5e)]:
|
|
982
|
+
- @data-client/normalizr@0.9.2
|
|
983
|
+
|
|
984
|
+
## 0.9.0
|
|
985
|
+
|
|
986
|
+
### Patch Changes
|
|
987
|
+
|
|
988
|
+
- [`a7da00e82d`](https://github.com/reactive/data-client/commit/a7da00e82d5473f12881b85c9736a79e016ee526) Thanks [@ntucker](https://github.com/ntucker)! - Endpoint properties fully visible in devtool
|
|
989
|
+
|
|
990
|
+
- [`2d2e94126e`](https://github.com/reactive/data-client/commit/2d2e94126e5962511e250df5d813d056646de41b) Thanks [@ntucker](https://github.com/ntucker)! - DevTools no longer forgets history if not open on page load
|
|
991
|
+
|
|
992
|
+
- [#2803](https://github.com/reactive/data-client/pull/2803) [`386372ed4d`](https://github.com/reactive/data-client/commit/386372ed4d0b454687847ba2b8eed4369ef7cdf7) Thanks [@ntucker](https://github.com/ntucker)! - DevtoolsManager closing start queueing messages to improve efficiency
|
|
993
|
+
|
|
994
|
+
## 0.8.1
|
|
995
|
+
|
|
996
|
+
### Patch Changes
|
|
997
|
+
|
|
998
|
+
- [#2797](https://github.com/reactive/data-client/pull/2797) [`c6ee872c7d`](https://github.com/reactive/data-client/commit/c6ee872c7d4bb669fa7b08a5343b24419c797cee) Thanks [@ntucker](https://github.com/ntucker)! - Fix published dependency range
|
|
999
|
+
|
|
1000
|
+
## 0.8.0
|
|
1001
|
+
|
|
1002
|
+
### Minor Changes
|
|
1003
|
+
|
|
1004
|
+
- [`837cf57883`](https://github.com/reactive/data-client/commit/837cf57883544c7640344a01f43bf6d9e3369083) Thanks [@ntucker](https://github.com/ntucker)! - Remove newActions export
|
|
1005
|
+
|
|
1006
|
+
(All members continue to be exported at top level)
|
|
1007
|
+
|
|
1008
|
+
- [`f65cf832f0`](https://github.com/reactive/data-client/commit/f65cf832f0cdc4d01cb2f389a2dc2b37f1e5cf04) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING: Remove all /next exports
|
|
1009
|
+
|
|
1010
|
+
- [#2786](https://github.com/reactive/data-client/pull/2786) [`c865415ce5`](https://github.com/reactive/data-client/commit/c865415ce598d2b882262f795c4a816b2aa0808a) Thanks [@ntucker](https://github.com/ntucker)! - [Middleware](https://dataclient.io/docs/api/Manager#getmiddleware) no longer gets `controller` prop.
|
|
1011
|
+
|
|
1012
|
+
The entire API is controller itself:
|
|
1013
|
+
`({controller}) => next => async action => {}` ->
|
|
1014
|
+
`(controller) => next => async action => {}`
|
|
1015
|
+
|
|
1016
|
+
```ts
|
|
1017
|
+
class LoggingManager implements Manager {
|
|
1018
|
+
getMiddleware = (): Middleware => controller => next => async action => {
|
|
1019
|
+
console.log('before', action, controller.getState());
|
|
1020
|
+
await next(action);
|
|
1021
|
+
console.log('after', action, controller.getState());
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
cleanup() {}
|
|
1025
|
+
}
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
Note this has been possible for some time this simply drops
|
|
1029
|
+
legacy compatibility.
|
|
1030
|
+
|
|
1031
|
+
- [#2784](https://github.com/reactive/data-client/pull/2784) [`c535f6c0ac`](https://github.com/reactive/data-client/commit/c535f6c0ac915b5242c1c7694308b7ee7aab16a1) Thanks [@ntucker](https://github.com/ntucker)! - BREAKING CHANGES:
|
|
1032
|
+
- DELETE removed -> INVALIDATE
|
|
1033
|
+
- drop all support for legacy schemas
|
|
1034
|
+
- entity.expiresAt removed
|
|
1035
|
+
- Collections.infer does entity check
|
|
1036
|
+
- all Entity overrides for backcompat are removed - operates just like EntitySchema, except with extra validation
|
|
1037
|
+
|
|
1038
|
+
- [#2782](https://github.com/reactive/data-client/pull/2782) [`d3343d42b9`](https://github.com/reactive/data-client/commit/d3343d42b970d075eda201cb85d201313120807c) Thanks [@ntucker](https://github.com/ntucker)! - Remove all 'receive' action names (use 'set' instead)
|
|
1039
|
+
|
|
1040
|
+
BREAKING CHANGE:
|
|
1041
|
+
- remove ReceiveAction
|
|
1042
|
+
- ReceiveTypes -> SetTypes
|
|
1043
|
+
- remove Controller.receive Controller.receiveError
|
|
1044
|
+
- NetworkManager.handleReceive -> handleSet
|
|
1045
|
+
|
|
1046
|
+
- [#2781](https://github.com/reactive/data-client/pull/2781) [`5ff1d65eb5`](https://github.com/reactive/data-client/commit/5ff1d65eb526306f2a78635b659f29554625e853) Thanks [@ntucker](https://github.com/ntucker)! - Prefix action types with 'rdc'
|
|
1047
|
+
|
|
1048
|
+
BREAKING CHANGE: Action types have new names
|
|
1049
|
+
|
|
1050
|
+
### Patch Changes
|
|
1051
|
+
|
|
1052
|
+
- [#2779](https://github.com/reactive/data-client/pull/2779) [`ff51e71f45`](https://github.com/reactive/data-client/commit/ff51e71f45857eb172f3fe05829e34c9abb68252) Thanks [@ntucker](https://github.com/ntucker)! - Update jsdocs references to dataclient.io
|
|
1053
|
+
|
|
1054
|
+
- Updated dependencies [[`ff51e71f45`](https://github.com/reactive/data-client/commit/ff51e71f45857eb172f3fe05829e34c9abb68252), [`c535f6c0ac`](https://github.com/reactive/data-client/commit/c535f6c0ac915b5242c1c7694308b7ee7aab16a1), [`79e286109b`](https://github.com/reactive/data-client/commit/79e286109b5566f8e7acfdf0f44201263072d1d1), [`35ccedceb5`](https://github.com/reactive/data-client/commit/35ccedceb53d91dd54dd996990c7c75719be2b85)]:
|
|
1055
|
+
- @data-client/normalizr@0.8.0
|
|
1056
|
+
|
|
1057
|
+
## 0.4.3
|
|
1058
|
+
|
|
1059
|
+
### Patch Changes
|
|
1060
|
+
|
|
1061
|
+
- f95dbc64d1: [Collections](https://dataclient.io/rest/api/Collection) can filter based on FormData arguments
|
|
1062
|
+
|
|
1063
|
+
```ts
|
|
1064
|
+
ctrl.fetch(getPosts.push, { group: 'react' }, new FormData(e.currentTarget));
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
Say our FormData contained an `author` field. Now that newly created
|
|
1068
|
+
item will be properly added to the [collection list](https://dataclient.io/rest/api/Collection) for that author.
|
|
1069
|
+
|
|
1070
|
+
```ts
|
|
1071
|
+
useSuspense(getPosts, {
|
|
1072
|
+
group: 'react',
|
|
1073
|
+
author: 'bob',
|
|
1074
|
+
});
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
In this case if `FormData.get('author') === 'bob'`, it will show
|
|
1078
|
+
up in that [useSuspense()](https://dataclient.io/docs/api/useSuspense) call.
|
|
1079
|
+
|
|
1080
|
+
See more in the [Collection nonFilterArgumentKeys example](https://dataclient.io/rest/api/Collection#nonfilterargumentkeys)
|
|
1081
|
+
|
|
1082
|
+
## 0.4.2
|
|
1083
|
+
|
|
1084
|
+
### Patch Changes
|
|
1085
|
+
|
|
1086
|
+
- b60a4a558e: Change internal organization of some types
|
|
1087
|
+
|
|
1088
|
+
## 0.4.1
|
|
1089
|
+
|
|
1090
|
+
### Patch Changes
|
|
1091
|
+
|
|
1092
|
+
- a097d25e7a: controller.fetchIfStale() resolves to data from store if it does not fetch
|
|
1093
|
+
|
|
1094
|
+
## 0.4.0
|
|
1095
|
+
|
|
1096
|
+
### Minor Changes
|
|
1097
|
+
|
|
1098
|
+
- 5cedd4485e: Add controller.fetchIfStale()
|
|
1099
|
+
|
|
1100
|
+
Fetches only if endpoint is considered '[stale](../concepts/expiry-policy.md#stale)'; otherwise returns undefined.
|
|
1101
|
+
|
|
1102
|
+
This can be useful when prefetching data, as it avoids overfetching fresh data.
|
|
1103
|
+
|
|
1104
|
+
An [example](https://stackblitz.com/github/reactive/data-client/tree/master/examples/github-app?file=src%2Frouting%2Froutes.tsx) with a fetch-as-you-render router:
|
|
1105
|
+
|
|
1106
|
+
```ts
|
|
1107
|
+
{
|
|
1108
|
+
name: 'IssueList',
|
|
1109
|
+
component: lazyPage('IssuesPage'),
|
|
1110
|
+
title: 'issue list',
|
|
1111
|
+
resolveData: async (
|
|
1112
|
+
controller: Controller,
|
|
1113
|
+
{ owner, repo }: { owner: string; repo: string },
|
|
1114
|
+
searchParams: URLSearchParams,
|
|
1115
|
+
) => {
|
|
1116
|
+
const q = searchParams?.get('q') || 'is:issue is:open';
|
|
1117
|
+
await controller.fetchIfStale(IssueResource.search, {
|
|
1118
|
+
owner,
|
|
1119
|
+
repo,
|
|
1120
|
+
q,
|
|
1121
|
+
});
|
|
1122
|
+
},
|
|
1123
|
+
},
|
|
1124
|
+
```
|
|
1125
|
+
|
|
1126
|
+
## 0.3.0
|
|
1127
|
+
|
|
1128
|
+
### Minor Changes
|
|
1129
|
+
|
|
1130
|
+
- 6fd842e464: Add controller.expireAll() that sets all responses to _STALE_
|
|
1131
|
+
|
|
1132
|
+
```ts
|
|
1133
|
+
controller.expireAll(ArticleResource.getList);
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
This is like controller.invalidateAll(); but will continue showing
|
|
1137
|
+
stale data while it is refetched.
|
|
1138
|
+
|
|
1139
|
+
This is sometimes useful to trigger refresh of only data presently shown
|
|
1140
|
+
when there are many parameterizations in cache.
|
|
1141
|
+
|
|
1142
|
+
## 0.2.1
|
|
1143
|
+
|
|
1144
|
+
### Patch Changes
|
|
1145
|
+
|
|
1146
|
+
- 7b835f113a: Improve package tags
|
|
1147
|
+
- Updated dependencies [7b835f113a]
|
|
1148
|
+
- @data-client/normalizr@0.2.2
|
|
1149
|
+
|
|
1150
|
+
## 0.2.0
|
|
1151
|
+
|
|
1152
|
+
### Minor Changes
|
|
1153
|
+
|
|
1154
|
+
- bf141cb5a5: Removed deprecated Endpoint.optimisticUpdate -> use Endpoint.getOptimisticResponse
|
|
1155
|
+
- bf141cb5a5: legacyActions were removed. use action imports directly
|
|
1156
|
+
New action types match previously exported newActions and have different form
|
|
1157
|
+
This will likely require updating any custom Managers
|
|
1158
|
+
- bf141cb5a5: Deprecations:
|
|
1159
|
+
- controller.receive, controller.receiveError
|
|
1160
|
+
- RECEIVE_TYPE
|
|
1161
|
+
- MiddlewareAPI.controller (MiddlewareAPI is just controller itself)
|
|
1162
|
+
- ({controller}) => {} -> (controller) => {}
|
|
1163
|
+
- bf141cb5a5: NetworkManager interface changed to only support new actions
|
|
1164
|
+
SubscriptionManager/PollingSubscription interfaces simplified based on new actions
|
|
1165
|
+
- bf141cb5a5: reducer -> createReducer(new Controller())
|
|
1166
|
+
- 9788090c55: Controller.fetch() returns denormalized form when Endpoint has a Schema
|
|
1167
|
+
- bf141cb5a5: resetAction requires a date
|
|
1168
|
+
- bf141cb5a5: state.lastReset must be number
|
|
1169
|
+
|
|
1170
|
+
### Patch Changes
|
|
1171
|
+
|
|
1172
|
+
- Updated dependencies [bf141cb5a5]
|
|
1173
|
+
- Updated dependencies [87475a0cae]
|
|
1174
|
+
- @data-client/normalizr@0.2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-client/core",
|
|
3
|
-
"version": "0.15.0-beta-
|
|
3
|
+
"version": "0.15.0-beta-20251022142546-a457d1596871fb28f1a91f2531cc259db4d55a9c",
|
|
4
4
|
"description": "Async State Management without the Management. REST, GraphQL, SSE, Websockets, Fetch",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -125,14 +125,14 @@
|
|
|
125
125
|
},
|
|
126
126
|
"dependencies": {
|
|
127
127
|
"@babel/runtime": "^7.20.0",
|
|
128
|
-
"@data-client/normalizr": "0.15.0-beta-20251006024044-92bd01c4976f2921993b8c9f1e4dbb87af87ba7b",
|
|
128
|
+
"@data-client/normalizr": "^0.15.0-beta-20251006024044-92bd01c4976f2921993b8c9f1e4dbb87af87ba7b",
|
|
129
129
|
"flux-standard-action": "^2.1.1"
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
132
|
"@anansi/browserslist-config": "^1.4.2",
|
|
133
|
-
"@data-client/endpoint": "
|
|
133
|
+
"@data-client/endpoint": "0.15.0-beta-20251022010821-0e5f6bd2963b6deecb68b5febe71cdd3b10c801a",
|
|
134
134
|
"@types/jest": "30.0.0",
|
|
135
135
|
"@types/node": "^22.0.0",
|
|
136
|
-
"rollup-plugins": "
|
|
136
|
+
"rollup-plugins": "1.0.0"
|
|
137
137
|
}
|
|
138
|
-
}
|
|
138
|
+
}
|