@khanacademy/wonder-blocks-data 14.0.6 → 14.1.0
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 +217 -193
- package/LICENSE +21 -0
- package/dist/components/data.d.ts +1 -1
- package/dist/es/index.js +13 -13
- package/dist/hooks/use-cached-effect.d.ts +1 -1
- package/dist/hooks/use-hydratable-effect.d.ts +1 -1
- package/dist/hooks/use-request-interception.d.ts +1 -1
- package/dist/hooks/use-shared-cache.d.ts +1 -1
- package/dist/index.js +18 -24
- package/dist/util/data-error.d.ts +1 -1
- package/dist/util/gql-error.d.ts +1 -1
- package/dist/util/graphql-document-node-parser.d.ts +1 -1
- package/dist/util/hydration-cache-api.d.ts +1 -1
- package/dist/util/result-from-cache-response.d.ts +1 -1
- package/dist/util/status.d.ts +4 -4
- package/package.json +11 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,234 +1,258 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-data
|
|
2
2
|
|
|
3
|
+
## 14.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f03298f: Tooling:
|
|
8
|
+
|
|
9
|
+
- Switching to `pnpm`.
|
|
10
|
+
- Upgrading `rollup` to v4 and `@babel/runtime` to match the current webapp version.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- bb2a026: pnpm: Switch to workspace protocol to handle dependency versions with changesets on monorepo setup"
|
|
15
|
+
- Updated dependencies [969864b]
|
|
16
|
+
- Updated dependencies [bb2a026]
|
|
17
|
+
- Updated dependencies [f03298f]
|
|
18
|
+
- @khanacademy/wonder-blocks-core@12.1.0
|
|
19
|
+
|
|
20
|
+
## 14.0.7
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [0199324d]
|
|
25
|
+
- @khanacademy/wonder-blocks-core@12.0.0
|
|
26
|
+
|
|
3
27
|
## 14.0.6
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
6
30
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
31
|
+
- Updated dependencies [7516b239]
|
|
32
|
+
- @khanacademy/wonder-blocks-core@11.1.0
|
|
9
33
|
|
|
10
34
|
## 14.0.5
|
|
11
35
|
|
|
12
36
|
### Patch Changes
|
|
13
37
|
|
|
14
|
-
-
|
|
38
|
+
- faf7bd21: Version bump to verify release protections
|
|
15
39
|
|
|
16
40
|
## 14.0.4
|
|
17
41
|
|
|
18
42
|
### Patch Changes
|
|
19
43
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
44
|
+
- 11a0f5c6: No functional changes. Adding prepublishOnly script.
|
|
45
|
+
- Updated dependencies [11a0f5c6]
|
|
46
|
+
- @khanacademy/wonder-blocks-core@11.0.1
|
|
23
47
|
|
|
24
48
|
## 14.0.3
|
|
25
49
|
|
|
26
50
|
### Patch Changes
|
|
27
51
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
52
|
+
- Updated dependencies [d23c9c5f]
|
|
53
|
+
- @khanacademy/wonder-blocks-core@11.0.0
|
|
30
54
|
|
|
31
55
|
## 14.0.2
|
|
32
56
|
|
|
33
57
|
### Patch Changes
|
|
34
58
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
59
|
+
- Updated dependencies [b6009b77]
|
|
60
|
+
- Updated dependencies [897686bc]
|
|
61
|
+
- Updated dependencies [56d961f1]
|
|
62
|
+
- @khanacademy/wonder-blocks-core@10.0.0
|
|
39
63
|
|
|
40
64
|
## 14.0.1
|
|
41
65
|
|
|
42
66
|
### Patch Changes
|
|
43
67
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
68
|
+
- Updated dependencies [f4abd572]
|
|
69
|
+
- @khanacademy/wonder-blocks-core@9.0.0
|
|
46
70
|
|
|
47
71
|
## 14.0.0
|
|
48
72
|
|
|
49
73
|
### Major Changes
|
|
50
74
|
|
|
51
|
-
-
|
|
75
|
+
- e6abdd17: Upgrade to React 18
|
|
52
76
|
|
|
53
77
|
### Patch Changes
|
|
54
78
|
|
|
55
|
-
-
|
|
56
|
-
-
|
|
79
|
+
- Updated dependencies [e6abdd17]
|
|
80
|
+
- @khanacademy/wonder-blocks-core@8.0.0
|
|
57
81
|
|
|
58
82
|
## 13.0.12
|
|
59
83
|
|
|
60
84
|
### Patch Changes
|
|
61
85
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
86
|
+
- 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
|
|
87
|
+
- Updated dependencies [02a1b298]
|
|
88
|
+
- @khanacademy/wonder-blocks-core@7.0.1
|
|
65
89
|
|
|
66
90
|
## 13.0.11
|
|
67
91
|
|
|
68
92
|
### Patch Changes
|
|
69
93
|
|
|
70
|
-
-
|
|
71
|
-
-
|
|
94
|
+
- Updated dependencies [07f7f407]
|
|
95
|
+
- @khanacademy/wonder-blocks-core@7.0.0
|
|
72
96
|
|
|
73
97
|
## 13.0.10
|
|
74
98
|
|
|
75
99
|
### Patch Changes
|
|
76
100
|
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
101
|
+
- 559e82d5: Update to build tooling, generating smaller output
|
|
102
|
+
- Updated dependencies [559e82d5]
|
|
103
|
+
- @khanacademy/wonder-blocks-core@6.4.3
|
|
80
104
|
|
|
81
105
|
## 13.0.9
|
|
82
106
|
|
|
83
107
|
### Patch Changes
|
|
84
108
|
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
109
|
+
- eab37b8b: Test file changes only. No external changes at all.
|
|
110
|
+
- Updated dependencies [eab37b8b]
|
|
111
|
+
- @khanacademy/wonder-blocks-core@6.4.2
|
|
88
112
|
|
|
89
113
|
## 13.0.8
|
|
90
114
|
|
|
91
115
|
### Patch Changes
|
|
92
116
|
|
|
93
|
-
-
|
|
94
|
-
-
|
|
117
|
+
- Updated dependencies [5dfac06e]
|
|
118
|
+
- @khanacademy/wonder-blocks-core@6.4.1
|
|
95
119
|
|
|
96
120
|
## 13.0.7
|
|
97
121
|
|
|
98
122
|
### Patch Changes
|
|
99
123
|
|
|
100
|
-
-
|
|
101
|
-
-
|
|
124
|
+
- Updated dependencies [58075352]
|
|
125
|
+
- @khanacademy/wonder-blocks-core@6.4.0
|
|
102
126
|
|
|
103
127
|
## 13.0.6
|
|
104
128
|
|
|
105
129
|
### Patch Changes
|
|
106
130
|
|
|
107
|
-
-
|
|
108
|
-
-
|
|
131
|
+
- Updated dependencies [6df21f71]
|
|
132
|
+
- @khanacademy/wonder-blocks-core@6.3.1
|
|
109
133
|
|
|
110
134
|
## 13.0.5
|
|
111
135
|
|
|
112
136
|
### Patch Changes
|
|
113
137
|
|
|
114
|
-
-
|
|
115
|
-
-
|
|
138
|
+
- Updated dependencies [7055ca94]
|
|
139
|
+
- @khanacademy/wonder-blocks-core@6.3.0
|
|
116
140
|
|
|
117
141
|
## 13.0.4
|
|
118
142
|
|
|
119
143
|
### Patch Changes
|
|
120
144
|
|
|
121
|
-
-
|
|
122
|
-
-
|
|
145
|
+
- Updated dependencies [4b97b9a2]
|
|
146
|
+
- @khanacademy/wonder-blocks-core@6.2.0
|
|
123
147
|
|
|
124
148
|
## 13.0.3
|
|
125
149
|
|
|
126
150
|
### Patch Changes
|
|
127
151
|
|
|
128
|
-
-
|
|
129
|
-
-
|
|
152
|
+
- Updated dependencies [2871f0a9]
|
|
153
|
+
- @khanacademy/wonder-blocks-core@6.1.1
|
|
130
154
|
|
|
131
155
|
## 13.0.2
|
|
132
156
|
|
|
133
157
|
### Patch Changes
|
|
134
158
|
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
159
|
+
- Updated dependencies [efb59c29]
|
|
160
|
+
- Updated dependencies [8bc40ed2]
|
|
161
|
+
- @khanacademy/wonder-blocks-core@6.1.0
|
|
138
162
|
|
|
139
163
|
## 13.0.1
|
|
140
164
|
|
|
141
165
|
### Patch Changes
|
|
142
166
|
|
|
143
|
-
-
|
|
144
|
-
-
|
|
167
|
+
- Updated dependencies [f19da46e]
|
|
168
|
+
- @khanacademy/wonder-blocks-core@6.0.2
|
|
145
169
|
|
|
146
170
|
## 13.0.0
|
|
147
171
|
|
|
148
172
|
### Major Changes
|
|
149
173
|
|
|
150
|
-
-
|
|
174
|
+
- 65c02cff: Return new no-data state from useCachedEffect when it is not loading and there is no data to return
|
|
151
175
|
|
|
152
176
|
### Patch Changes
|
|
153
177
|
|
|
154
|
-
-
|
|
155
|
-
-
|
|
178
|
+
- Updated dependencies [1920feb8]
|
|
179
|
+
- @khanacademy/wonder-blocks-core@6.0.1
|
|
156
180
|
|
|
157
181
|
## 12.0.0
|
|
158
182
|
|
|
159
183
|
### Major Changes
|
|
160
184
|
|
|
161
|
-
-
|
|
185
|
+
- 674a1e5c: POJOs have been replace with TS enums
|
|
162
186
|
|
|
163
187
|
### Patch Changes
|
|
164
188
|
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
189
|
+
- 674a1e5c: We're no longer building flow types
|
|
190
|
+
- Updated dependencies [674a1e5c]
|
|
191
|
+
- Updated dependencies [674a1e5c]
|
|
192
|
+
- @khanacademy/wonder-blocks-core@6.0.0
|
|
169
193
|
|
|
170
194
|
## 11.0.16
|
|
171
195
|
|
|
172
196
|
### Patch Changes
|
|
173
197
|
|
|
174
|
-
-
|
|
175
|
-
-
|
|
198
|
+
- Updated dependencies [1344436f]
|
|
199
|
+
- @khanacademy/wonder-blocks-core@5.4.0
|
|
176
200
|
|
|
177
201
|
## 11.0.15
|
|
178
202
|
|
|
179
203
|
### Patch Changes
|
|
180
204
|
|
|
181
|
-
-
|
|
182
|
-
-
|
|
205
|
+
- Updated dependencies [9f3752d4]
|
|
206
|
+
- @khanacademy/wonder-blocks-core@5.3.1
|
|
183
207
|
|
|
184
208
|
## 11.0.14
|
|
185
209
|
|
|
186
210
|
### Patch Changes
|
|
187
211
|
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
212
|
+
- Updated dependencies [c37b99aa]
|
|
213
|
+
- Updated dependencies [c4cef3e6]
|
|
214
|
+
- @khanacademy/wonder-blocks-core@5.3.0
|
|
191
215
|
|
|
192
216
|
## 11.0.13
|
|
193
217
|
|
|
194
218
|
### Patch Changes
|
|
195
219
|
|
|
196
|
-
-
|
|
197
|
-
-
|
|
220
|
+
- Updated dependencies [d4c412b5]
|
|
221
|
+
- @khanacademy/wonder-blocks-core@5.2.3
|
|
198
222
|
|
|
199
223
|
## 11.0.12
|
|
200
224
|
|
|
201
225
|
### Patch Changes
|
|
202
226
|
|
|
203
|
-
-
|
|
204
|
-
-
|
|
227
|
+
- Updated dependencies [64a188e3]
|
|
228
|
+
- @khanacademy/wonder-blocks-core@5.2.2
|
|
205
229
|
|
|
206
230
|
## 11.0.11
|
|
207
231
|
|
|
208
232
|
### Patch Changes
|
|
209
233
|
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
-
|
|
234
|
+
- 5a1ea891: Make sure that React contexts are named
|
|
235
|
+
- Updated dependencies [5a1ea891]
|
|
236
|
+
- Updated dependencies [df9a10aa]
|
|
237
|
+
- @khanacademy/wonder-blocks-core@5.2.1
|
|
214
238
|
|
|
215
239
|
## 11.0.10
|
|
216
240
|
|
|
217
241
|
### Patch Changes
|
|
218
242
|
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
-
|
|
243
|
+
- Updated dependencies [fa70c895]
|
|
244
|
+
- Updated dependencies [19ab0408]
|
|
245
|
+
- Updated dependencies [fa70c895]
|
|
246
|
+
- @khanacademy/wonder-blocks-core@5.2.0
|
|
223
247
|
|
|
224
248
|
## 11.0.9
|
|
225
249
|
|
|
226
250
|
### Patch Changes
|
|
227
251
|
|
|
228
|
-
-
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
252
|
+
- a6164ed0: Don't use React.FC<> for functional components
|
|
253
|
+
- Updated dependencies [3c400719]
|
|
254
|
+
- Updated dependencies [a6164ed0]
|
|
255
|
+
- @khanacademy/wonder-blocks-core@5.1.0
|
|
232
256
|
|
|
233
257
|
## 11.0.8
|
|
234
258
|
|
|
@@ -238,343 +262,343 @@
|
|
|
238
262
|
|
|
239
263
|
### Patch Changes
|
|
240
264
|
|
|
241
|
-
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
265
|
+
- c20f48f3: Don't transpile classes when building bundles
|
|
266
|
+
- Updated dependencies [c20f48f3]
|
|
267
|
+
- @khanacademy/wonder-blocks-core@5.0.4
|
|
244
268
|
|
|
245
269
|
## 11.0.5
|
|
246
270
|
|
|
247
271
|
### Patch Changes
|
|
248
272
|
|
|
249
|
-
-
|
|
273
|
+
- 43155769: Fix DocumentNode type definition
|
|
250
274
|
|
|
251
275
|
## 11.0.4
|
|
252
276
|
|
|
253
277
|
### Patch Changes
|
|
254
278
|
|
|
255
|
-
-
|
|
279
|
+
- bedcbcf8: Update <Data>'s 'children' prop to allow a ReactNode to be returned
|
|
256
280
|
|
|
257
281
|
## 11.0.3
|
|
258
282
|
|
|
259
283
|
### Patch Changes
|
|
260
284
|
|
|
261
|
-
-
|
|
262
|
-
-
|
|
285
|
+
- Updated dependencies [b281e2eb]
|
|
286
|
+
- @khanacademy/wonder-blocks-core@5.0.3
|
|
263
287
|
|
|
264
288
|
## 11.0.2
|
|
265
289
|
|
|
266
290
|
### Patch Changes
|
|
267
291
|
|
|
268
|
-
-
|
|
269
|
-
-
|
|
292
|
+
- Updated dependencies [21ce20c7]
|
|
293
|
+
- @khanacademy/wonder-blocks-core@5.0.2
|
|
270
294
|
|
|
271
295
|
## 11.0.1
|
|
272
296
|
|
|
273
297
|
### Patch Changes
|
|
274
298
|
|
|
275
|
-
-
|
|
276
|
-
-
|
|
277
|
-
-
|
|
278
|
-
-
|
|
279
|
-
-
|
|
299
|
+
- ccb6fe00: Miscellaneous TS type fixes
|
|
300
|
+
- d4c2b18c: Fix a variety of issues with Flow types generated by flowgen
|
|
301
|
+
- Updated dependencies [ccb6fe00]
|
|
302
|
+
- Updated dependencies [d4c2b18c]
|
|
303
|
+
- @khanacademy/wonder-blocks-core@5.0.1
|
|
280
304
|
|
|
281
305
|
## 11.0.0
|
|
282
306
|
|
|
283
307
|
### Major Changes
|
|
284
308
|
|
|
285
|
-
-
|
|
309
|
+
- 1ca4d7e3: Fix minor issue with generate Flow types (this is a major bump b/c I forgot to do one after doing the TS conversion)
|
|
286
310
|
|
|
287
311
|
### Patch Changes
|
|
288
312
|
|
|
289
|
-
-
|
|
290
|
-
-
|
|
313
|
+
- Updated dependencies [1ca4d7e3]
|
|
314
|
+
- @khanacademy/wonder-blocks-core@5.0.0
|
|
291
315
|
|
|
292
316
|
## 10.1.3
|
|
293
317
|
|
|
294
318
|
### Patch Changes
|
|
295
319
|
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
320
|
+
- b5ba5568: Ensure that flow lib defs use React.ElementConfig<> isntead of JSX.LibraryManagedAttributes<>
|
|
321
|
+
- Updated dependencies [b5ba5568]
|
|
322
|
+
- @khanacademy/wonder-blocks-core@4.9.1
|
|
299
323
|
|
|
300
324
|
## 10.1.2
|
|
301
325
|
|
|
302
326
|
### Patch Changes
|
|
303
327
|
|
|
304
|
-
-
|
|
305
|
-
-
|
|
328
|
+
- Updated dependencies [779b031d]
|
|
329
|
+
- @khanacademy/wonder-blocks-core@4.9.0
|
|
306
330
|
|
|
307
331
|
## 10.1.1
|
|
308
332
|
|
|
309
333
|
### Patch Changes
|
|
310
334
|
|
|
311
|
-
-
|
|
312
|
-
-
|
|
313
|
-
-
|
|
314
|
-
-
|
|
315
|
-
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
-
|
|
322
|
-
-
|
|
323
|
-
-
|
|
324
|
-
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
327
|
-
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
335
|
+
- d816af08: Update build and test configs use TypeScript
|
|
336
|
+
- 3891f544: Update babel config to include plugins that Storybook needed
|
|
337
|
+
- 3813715d: Update wonder-stuff dependencies (non-functional changes)
|
|
338
|
+
- 0d28bb1c: Configured TypeScript
|
|
339
|
+
- 3d05f764: Fix HOCs and other type errors
|
|
340
|
+
- c2ec4902: Update eslint configuration, fix lint
|
|
341
|
+
- 2983c05b: Include 'types' field in package.json
|
|
342
|
+
- 77ff6a66: Generate Flow types from TypeScript types
|
|
343
|
+
- ec8d4b7f: Fix miscellaneous TypeScript errors
|
|
344
|
+
- Updated dependencies [d816af08]
|
|
345
|
+
- Updated dependencies [3891f544]
|
|
346
|
+
- Updated dependencies [0d28bb1c]
|
|
347
|
+
- Updated dependencies [873f4a14]
|
|
348
|
+
- Updated dependencies [3d05f764]
|
|
349
|
+
- Updated dependencies [c2ec4902]
|
|
350
|
+
- Updated dependencies [2983c05b]
|
|
351
|
+
- Updated dependencies [77ff6a66]
|
|
352
|
+
- Updated dependencies [ec8d4b7f]
|
|
353
|
+
- @khanacademy/wonder-blocks-core@4.8.0
|
|
330
354
|
|
|
331
355
|
## 10.1.0
|
|
332
356
|
|
|
333
357
|
### Minor Changes
|
|
334
358
|
|
|
335
|
-
-
|
|
359
|
+
- 91cb727c: Convert enums to POJOs
|
|
336
360
|
|
|
337
361
|
### Patch Changes
|
|
338
362
|
|
|
339
|
-
-
|
|
340
|
-
-
|
|
341
|
-
-
|
|
342
|
-
-
|
|
343
|
-
-
|
|
363
|
+
- 91cb727c: Update wonder-stuff dependencies
|
|
364
|
+
- 91cb727c: Remove file extensions from imports
|
|
365
|
+
- Updated dependencies [91cb727c]
|
|
366
|
+
- Updated dependencies [91cb727c]
|
|
367
|
+
- @khanacademy/wonder-blocks-core@4.7.0
|
|
344
368
|
|
|
345
369
|
## 10.0.5
|
|
346
370
|
|
|
347
371
|
### Patch Changes
|
|
348
372
|
|
|
349
|
-
-
|
|
373
|
+
- 1a5624d4: Update wonder-stuff dependencies to use newly published packages after migrating wonder-stuff to TypeScript
|
|
350
374
|
|
|
351
375
|
## 10.0.4
|
|
352
376
|
|
|
353
377
|
### Patch Changes
|
|
354
378
|
|
|
355
|
-
-
|
|
356
|
-
-
|
|
379
|
+
- Updated dependencies [496119f2]
|
|
380
|
+
- @khanacademy/wonder-blocks-core@4.6.2
|
|
357
381
|
|
|
358
382
|
## 10.0.3
|
|
359
383
|
|
|
360
384
|
### Patch Changes
|
|
361
385
|
|
|
362
|
-
-
|
|
386
|
+
- @khanacademy/wonder-blocks-core@4.6.1
|
|
363
387
|
|
|
364
388
|
## 10.0.2
|
|
365
389
|
|
|
366
390
|
### Patch Changes
|
|
367
391
|
|
|
368
|
-
-
|
|
369
|
-
-
|
|
370
|
-
-
|
|
371
|
-
-
|
|
392
|
+
- Updated dependencies [b561425a]
|
|
393
|
+
- Updated dependencies [a566e232]
|
|
394
|
+
- Updated dependencies [d2b21a6e]
|
|
395
|
+
- @khanacademy/wonder-blocks-core@4.6.0
|
|
372
396
|
|
|
373
397
|
## 10.0.1
|
|
374
398
|
|
|
375
399
|
### Patch Changes
|
|
376
400
|
|
|
377
|
-
-
|
|
378
|
-
-
|
|
401
|
+
- Updated dependencies [175a2dd2]
|
|
402
|
+
- @khanacademy/wonder-blocks-core@4.5.0
|
|
379
403
|
|
|
380
404
|
## 10.0.0
|
|
381
405
|
|
|
382
406
|
### Major Changes
|
|
383
407
|
|
|
384
|
-
-
|
|
408
|
+
- 5a3ec7f9: Make sure request ID generation handles objects like Date and Error instances better
|
|
385
409
|
|
|
386
410
|
## 9.1.2
|
|
387
411
|
|
|
388
412
|
### Patch Changes
|
|
389
413
|
|
|
390
|
-
-
|
|
391
|
-
-
|
|
414
|
+
- Updated dependencies [6ee20af9]
|
|
415
|
+
- @khanacademy/wonder-blocks-core@4.4.0
|
|
392
416
|
|
|
393
417
|
## 9.1.1
|
|
394
418
|
|
|
395
419
|
### Patch Changes
|
|
396
420
|
|
|
397
|
-
-
|
|
421
|
+
- eb59ce34: Update to latest Wonder Stuff Core
|
|
398
422
|
|
|
399
423
|
## 9.1.0
|
|
400
424
|
|
|
401
425
|
### Minor Changes
|
|
402
426
|
|
|
403
|
-
-
|
|
427
|
+
- 944c3071: Make sure objects and arrays in variables are sorted and readable in generated request identifiers
|
|
404
428
|
|
|
405
429
|
## 9.0.0
|
|
406
430
|
|
|
407
431
|
### Major Changes
|
|
408
432
|
|
|
409
|
-
-
|
|
410
|
-
-
|
|
433
|
+
- 778f8e43: `SharedCache` export added for interacting with the shared in-memory cache. `purgeSharedCache` method has been removed.
|
|
434
|
+
- 778f8e43: Rename `ScopedCache` type to `RawScopedCache`
|
|
411
435
|
|
|
412
436
|
## 8.0.5
|
|
413
437
|
|
|
414
438
|
### Patch Changes
|
|
415
439
|
|
|
416
|
-
-
|
|
440
|
+
- 08238b89: Export the `getGqlDataFromResponse` method so we can use it in custom `gqlFetch` scenarios for a consistent experience
|
|
417
441
|
|
|
418
442
|
## 8.0.4
|
|
419
443
|
|
|
420
444
|
### Patch Changes
|
|
421
445
|
|
|
422
|
-
-
|
|
446
|
+
- dc2e00f4: Do not fetch if FetchPolicy is CacheBeforeNetwork and there is already a cached value, even if the requestId changes
|
|
423
447
|
|
|
424
448
|
## 8.0.3
|
|
425
449
|
|
|
426
450
|
### Patch Changes
|
|
427
451
|
|
|
428
|
-
-
|
|
429
|
-
-
|
|
430
|
-
-
|
|
431
|
-
-
|
|
432
|
-
-
|
|
452
|
+
- 5f4a4297: Make dependency on `flow-enums-runtime` explicit
|
|
453
|
+
- 2b96fd59: Change flow-enums-runtime to be peer dependencies
|
|
454
|
+
- Updated dependencies [5f4a4297]
|
|
455
|
+
- Updated dependencies [2b96fd59]
|
|
456
|
+
- @khanacademy/wonder-blocks-core@4.3.2
|
|
433
457
|
|
|
434
458
|
## 8.0.2
|
|
435
459
|
|
|
436
460
|
### Patch Changes
|
|
437
461
|
|
|
438
|
-
-
|
|
462
|
+
- 580141ed: Always initialize SSR-only cache
|
|
439
463
|
|
|
440
464
|
## 8.0.1
|
|
441
465
|
|
|
442
466
|
### Patch Changes
|
|
443
467
|
|
|
444
|
-
-
|
|
468
|
+
- e5fa4d9e: Make sure ssr-only cache is initialized when purging caches in test environment
|
|
445
469
|
|
|
446
470
|
## 8.0.0
|
|
447
471
|
|
|
448
472
|
### Major Changes
|
|
449
473
|
|
|
450
|
-
-
|
|
451
|
-
-
|
|
452
|
-
-
|
|
453
|
-
-
|
|
454
|
-
-
|
|
474
|
+
- 0720470e: Renamed `initializeCache` to `initializeHydrationCache`, deleted `removeFromCache`, renamed `removeAllFromCache` to `purgeHydrationCache`
|
|
475
|
+
- cf9ed87f: Add `fetchPolicy` to `useCachedEffect` options, add `refetch` to `useCachedEffect` return value (return value is now a tuple of [result, refetch]), add abort API to request fulfillment (not truly aborting though)
|
|
476
|
+
- b882b082: Stop exporting `RequestFulfillment`, update `useCachedEffect` to consider scope with sharing inflight requests
|
|
477
|
+
- 0720470e: Rename `fulfillAllDataRequests` to `fetchTrackedRequests`, rename `hasUnfulfilledRequests` to `hasTrackedRequestsToBeFetched`
|
|
478
|
+
- 0720470e: Renamed `clearSharedCache` to `purgeSharedCache`
|
|
455
479
|
|
|
456
480
|
### Minor Changes
|
|
457
481
|
|
|
458
|
-
-
|
|
459
|
-
-
|
|
460
|
-
-
|
|
482
|
+
- 0720470e: Add `purgeCaches` export for purging all caches with one call
|
|
483
|
+
- 75c10036: Add `abortInflightRequests` to exports
|
|
484
|
+
- a85f2f3a: Provide `getGqlRequestId` function
|
|
461
485
|
|
|
462
486
|
### Patch Changes
|
|
463
487
|
|
|
464
|
-
-
|
|
488
|
+
- 1385f468: Removed unnecessary `new` on tracking context creation
|
|
465
489
|
|
|
466
490
|
## 7.0.1
|
|
467
491
|
|
|
468
492
|
### Patch Changes
|
|
469
493
|
|
|
470
|
-
-
|
|
494
|
+
- @khanacademy/wonder-blocks-core@4.3.1
|
|
471
495
|
|
|
472
496
|
## 7.0.0
|
|
473
497
|
|
|
474
498
|
### Major Changes
|
|
475
499
|
|
|
476
|
-
-
|
|
500
|
+
- 34407c4a: `useServerEffect` now has a `skip` option, preventing the request from getting tracked for server-side fulfillment
|
|
477
501
|
|
|
478
502
|
## 6.0.1
|
|
479
503
|
|
|
480
504
|
### Patch Changes
|
|
481
505
|
|
|
482
|
-
-
|
|
506
|
+
- 5ad01891: [FIX] Make sure hydratable effect properly renders when requestId changes
|
|
483
507
|
|
|
484
508
|
## 6.0.0
|
|
485
509
|
|
|
486
510
|
### Major Changes
|
|
487
511
|
|
|
488
|
-
-
|
|
489
|
-
-
|
|
490
|
-
-
|
|
491
|
-
-
|
|
492
|
-
-
|
|
512
|
+
- 1f34c4e8: `Result<TData>` is now the main return type, `useGql` supports context modification, and context overrides that are set explicitly to null now mean those values are deleted when merging
|
|
513
|
+
- 885fe62b: [NEW] `useCachedEffect` hook for performing asynchronous work client-side and caching the result. Updated `useHydratableEffect` to use `useCachedEffect`. `useServerEffect` handler is now interceptable with Wonder Blocks Data `InterceptData` component.
|
|
514
|
+
- 5c852025: [NEW] Added the `useHydratableEffect` hook and updated the `Data` component to use it. Breaking change: `Data` props have been renamed and retyped to fit `useHydratableResult` API.
|
|
515
|
+
- c91f3959: New `DataError` type and changes to the `GqlError` type. Also changes what errors are thrown in various code
|
|
516
|
+
- 753220a4: Exported in-flight request tracking mechanism and reworked Data component so that client-side requests don't get morphed to and from a cache-style value
|
|
493
517
|
|
|
494
518
|
### Minor Changes
|
|
495
519
|
|
|
496
|
-
-
|
|
520
|
+
- 5d614ed4: Changed `Result<TData>` error status so that error field is an error object, not a string
|
|
497
521
|
|
|
498
522
|
### Patch Changes
|
|
499
523
|
|
|
500
|
-
-
|
|
501
|
-
-
|
|
524
|
+
- Updated dependencies [246a921d]
|
|
525
|
+
- @khanacademy/wonder-blocks-core@4.3.0
|
|
502
526
|
|
|
503
527
|
## 5.0.1
|
|
504
528
|
|
|
505
529
|
### Patch Changes
|
|
506
530
|
|
|
507
|
-
-
|
|
531
|
+
- c9922b34: Export resultFromCachedResponse
|
|
508
532
|
|
|
509
533
|
## 5.0.0
|
|
510
534
|
|
|
511
535
|
### Major Changes
|
|
512
536
|
|
|
513
|
-
-
|
|
537
|
+
- 5b5f85ac: Replace `InterceptData` with `InterceptRequests` and introduce new `useRequestInterception` hook
|
|
514
538
|
|
|
515
539
|
## 4.0.0
|
|
516
540
|
|
|
517
541
|
### Major Changes
|
|
518
542
|
|
|
519
|
-
-
|
|
520
|
-
-
|
|
521
|
-
-
|
|
522
|
-
-
|
|
523
|
-
-
|
|
524
|
-
-
|
|
543
|
+
- febc7309: Rename types and update signatures
|
|
544
|
+
- `ValidData` is now `ValidCacheData`
|
|
545
|
+
- `Cache` type is now `ResponseCache` (old `ResponseCache` can be created with `$ReadOnly<ResponseCache>`)
|
|
546
|
+
- `CacheEntry` type is now `CachedResponse`
|
|
547
|
+
- Signatures that were typed as `$ReadOnly<Cache>` previously are now typed as `ResponseCache` which is more appropriate to how they work
|
|
548
|
+
- bffc345e: Simplified, more versatile API
|
|
525
549
|
|
|
526
|
-
-
|
|
527
|
-
-
|
|
528
|
-
-
|
|
550
|
+
- NEW: `useServerEffect` hook - a way to perform asynchronous tasks on the server and have the value available for hydration
|
|
551
|
+
- UPDATED: `Data` component - New API that does away with the `IRequestHandler` interface. Includes new props to control behavior on hydration and when new requests occur.
|
|
552
|
+
- UPDATED: `InterceptData` component - New API to reflect changes in `Data` component.
|
|
529
553
|
|
|
530
|
-
-
|
|
531
|
-
-
|
|
554
|
+
- REMOVED: `IRequestHandler` API. All associated call signatures have been updated to reflect this.
|
|
555
|
+
- REMOVED: `useData` hook - The `Data` component should be used
|
|
532
556
|
|
|
533
557
|
### Minor Changes
|
|
534
558
|
|
|
535
|
-
-
|
|
536
|
-
-
|
|
559
|
+
- 7c9dd09b: - New `useSharedData` hook
|
|
560
|
+
- New `ScopedInMemoryCache` export
|
|
537
561
|
|
|
538
562
|
## 3.2.0
|
|
539
563
|
|
|
540
564
|
### Minor Changes
|
|
541
565
|
|
|
542
|
-
-
|
|
566
|
+
- 6973afa2: useGql method now merges defaultContext and partial context by ignoring values explicitly set to undefined in the partial context. This ensures that that existing default context values are not overridden unless explicitly given a value other than undefined.
|
|
543
567
|
|
|
544
568
|
## 3.1.3
|
|
545
569
|
|
|
546
570
|
### Patch Changes
|
|
547
571
|
|
|
548
|
-
-
|
|
572
|
+
- 9931ae6b: Simplify GQL types
|
|
549
573
|
|
|
550
574
|
## 3.1.2
|
|
551
575
|
|
|
552
576
|
### Patch Changes
|
|
553
577
|
|
|
554
|
-
-
|
|
578
|
+
- @khanacademy/wonder-blocks-core@4.2.1
|
|
555
579
|
|
|
556
580
|
## 3.1.1
|
|
557
581
|
|
|
558
582
|
### Patch Changes
|
|
559
583
|
|
|
560
|
-
-
|
|
584
|
+
- 4ff59815: Add GraphQL fetch mock support to wonder-blocks-testing
|
|
561
585
|
|
|
562
586
|
## 3.1.0
|
|
563
587
|
|
|
564
588
|
### Minor Changes
|
|
565
589
|
|
|
566
|
-
-
|
|
567
|
-
-
|
|
590
|
+
- b68cedfe: Add GqlRouter component
|
|
591
|
+
- c7233a97: Implement useGql hook
|
|
568
592
|
|
|
569
593
|
## 3.0.1
|
|
570
594
|
|
|
571
595
|
### Patch Changes
|
|
572
596
|
|
|
573
|
-
-
|
|
597
|
+
- d281dac8: Ensure server-side request fulfillments can be intercepted
|
|
574
598
|
|
|
575
599
|
## 3.0.0
|
|
576
600
|
|
|
577
601
|
### Major Changes
|
|
578
602
|
|
|
579
|
-
-
|
|
580
|
-
-
|
|
603
|
+
- b252d9c8: Remove client-side caching
|
|
604
|
+
- b252d9c8: Introduce useData hook
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Khan Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -27,7 +27,7 @@ TData extends ValidCacheData> = {
|
|
|
27
27
|
*
|
|
28
28
|
* Default is `OnClientRender.ExecuteWhenNoSuccessResult`.
|
|
29
29
|
*/
|
|
30
|
-
clientBehavior?: typeof WhenClientSide[keyof typeof WhenClientSide];
|
|
30
|
+
clientBehavior?: (typeof WhenClientSide)[keyof typeof WhenClientSide];
|
|
31
31
|
/**
|
|
32
32
|
* When true, the children will be rendered with the existing result
|
|
33
33
|
* until the pending load is completed. Otherwise, the children will be
|
package/dist/es/index.js
CHANGED
|
@@ -36,7 +36,7 @@ class DataError extends KindError {
|
|
|
36
36
|
|
|
37
37
|
class ScopedInMemoryCache {
|
|
38
38
|
constructor(initialCache = {}) {
|
|
39
|
-
this._cache =
|
|
39
|
+
this._cache = undefined;
|
|
40
40
|
this._cache = initialCache;
|
|
41
41
|
}
|
|
42
42
|
get inUse() {
|
|
@@ -58,7 +58,7 @@ class ScopedInMemoryCache {
|
|
|
58
58
|
}
|
|
59
59
|
get(scope, id) {
|
|
60
60
|
var _this$_cache$scope$id, _this$_cache$scope2;
|
|
61
|
-
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ?
|
|
61
|
+
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ? undefined : _this$_cache$scope2[id]) != null ? _this$_cache$scope$id : null;
|
|
62
62
|
}
|
|
63
63
|
purge(scope, id) {
|
|
64
64
|
var _this$_cache$scope3;
|
|
@@ -130,8 +130,8 @@ class SsrCache {
|
|
|
130
130
|
return _default$2;
|
|
131
131
|
}
|
|
132
132
|
constructor(hydrationCache = null, ssrOnlyCache = null) {
|
|
133
|
-
this._hydrationCache =
|
|
134
|
-
this._ssrOnlyCache =
|
|
133
|
+
this._hydrationCache = undefined;
|
|
134
|
+
this._ssrOnlyCache = undefined;
|
|
135
135
|
this.initialize = source => {
|
|
136
136
|
if (this._hydrationCache.inUse) {
|
|
137
137
|
throw new Error("Cannot initialize data response cache more than once");
|
|
@@ -249,8 +249,8 @@ class RequestTracker {
|
|
|
249
249
|
}
|
|
250
250
|
constructor(responseCache) {
|
|
251
251
|
this._trackedRequests = {};
|
|
252
|
-
this._responseCache =
|
|
253
|
-
this._requestFulfillment =
|
|
252
|
+
this._responseCache = undefined;
|
|
253
|
+
this._requestFulfillment = undefined;
|
|
254
254
|
this.trackDataRequest = (id, handler, hydrate) => {
|
|
255
255
|
if (this._trackedRequests[id] == null) {
|
|
256
256
|
this._trackedRequests[id] = {
|
|
@@ -428,7 +428,7 @@ const useServerEffect = (requestId, handler, options = {}) => {
|
|
|
428
428
|
const cachedResult = SsrCache.Default.getEntry(requestId);
|
|
429
429
|
const maybeTrack = useContext(TrackerContext);
|
|
430
430
|
if (!skip && cachedResult == null && Server.isServerSide()) {
|
|
431
|
-
maybeTrack == null
|
|
431
|
+
maybeTrack == null || maybeTrack(requestId, interceptedHandler, hydrate);
|
|
432
432
|
}
|
|
433
433
|
return cachedResult == null ? null : resultFromCachedResponse(cachedResult);
|
|
434
434
|
};
|
|
@@ -450,7 +450,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
450
450
|
const currentRequestRef = React.useRef();
|
|
451
451
|
const fetchRequest = React.useMemo(() => {
|
|
452
452
|
var _currentRequestRef$cu;
|
|
453
|
-
(_currentRequestRef$cu = currentRequestRef.current) == null
|
|
453
|
+
(_currentRequestRef$cu = currentRequestRef.current) == null || _currentRequestRef$cu.cancel();
|
|
454
454
|
currentRequestRef.current = null;
|
|
455
455
|
networkResultRef.current = null;
|
|
456
456
|
const fetchFn = () => {
|
|
@@ -461,11 +461,11 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
461
461
|
const request = RequestFulfillment.Default.fulfill(`${requestId}|${scope}`, {
|
|
462
462
|
handler: interceptedHandler
|
|
463
463
|
});
|
|
464
|
-
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ?
|
|
464
|
+
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ? undefined : _currentRequestRef$cu2.request)) {
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
467
|
networkResultRef.current = null;
|
|
468
|
-
(_currentRequestRef$cu3 = currentRequestRef.current) == null
|
|
468
|
+
(_currentRequestRef$cu3 = currentRequestRef.current) == null || _currentRequestRef$cu3.cancel();
|
|
469
469
|
let cancel = false;
|
|
470
470
|
request.then(result => {
|
|
471
471
|
currentRequestRef.current = null;
|
|
@@ -513,7 +513,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
513
513
|
fetchRequest();
|
|
514
514
|
return () => {
|
|
515
515
|
var _currentRequestRef$cu4;
|
|
516
|
-
(_currentRequestRef$cu4 = currentRequestRef.current) == null
|
|
516
|
+
(_currentRequestRef$cu4 = currentRequestRef.current) == null || _currentRequestRef$cu4.cancel();
|
|
517
517
|
currentRequestRef.current = null;
|
|
518
518
|
};
|
|
519
519
|
}, [shouldFetch, fetchRequest]);
|
|
@@ -552,7 +552,7 @@ const useHydratableEffect = (requestId, handler, options = {}) => {
|
|
|
552
552
|
case WhenClientSide.ExecuteWhenNoResult:
|
|
553
553
|
return serverResult;
|
|
554
554
|
case WhenClientSide.ExecuteWhenNoSuccessResult:
|
|
555
|
-
if ((serverResult == null ?
|
|
555
|
+
if ((serverResult == null ? undefined : serverResult.status) === "success") {
|
|
556
556
|
return serverResult;
|
|
557
557
|
}
|
|
558
558
|
return null;
|
|
@@ -745,7 +745,7 @@ function graphQLDocumentNodeParser(document) {
|
|
|
745
745
|
const definitions = queries.length ? queries : mutations;
|
|
746
746
|
const definition = definitions[0];
|
|
747
747
|
const variables = definition.variableDefinitions || [];
|
|
748
|
-
const name = ((_definition$name = definition.name) == null ?
|
|
748
|
+
const name = ((_definition$name = definition.name) == null ? undefined : _definition$name.kind) === "Name" ? definition.name.value : "data";
|
|
749
749
|
const payload = {
|
|
750
750
|
name,
|
|
751
751
|
type,
|
|
@@ -7,7 +7,7 @@ type CachedEffectOptions<TData extends ValidCacheData> = {
|
|
|
7
7
|
*
|
|
8
8
|
* Defaults to `FetchPolicy.CacheBeforeNetwork`.
|
|
9
9
|
*/
|
|
10
|
-
fetchPolicy?: typeof FetchPolicy[keyof typeof FetchPolicy];
|
|
10
|
+
fetchPolicy?: (typeof FetchPolicy)[keyof typeof FetchPolicy];
|
|
11
11
|
/**
|
|
12
12
|
* When `true`, the effect will not be executed; otherwise, the effect will
|
|
13
13
|
* be executed.
|
|
@@ -45,7 +45,7 @@ type HydratableEffectOptions<TData extends ValidCacheData> = {
|
|
|
45
45
|
* Changing this value after the first call is irrelevant as it only
|
|
46
46
|
* affects the initial render behavior.
|
|
47
47
|
*/
|
|
48
|
-
clientBehavior?: typeof WhenClientSide[keyof typeof WhenClientSide];
|
|
48
|
+
clientBehavior?: (typeof WhenClientSide)[keyof typeof WhenClientSide];
|
|
49
49
|
/**
|
|
50
50
|
* When `true`, the effect will not be executed; otherwise, the effect will
|
|
51
51
|
* be executed.
|
|
@@ -11,4 +11,4 @@ import type { ValidCacheData } from "../util/types";
|
|
|
11
11
|
* an intercepted handler, and then invoke `useServerEffect` (or other things)
|
|
12
12
|
* with that intercepted handler.
|
|
13
13
|
*/
|
|
14
|
-
export declare const useRequestInterception: <TData extends ValidCacheData>(requestId: string, handler: () => Promise<TData>) => () => Promise<TData
|
|
14
|
+
export declare const useRequestInterception: <TData extends ValidCacheData>(requestId: string, handler: () => Promise<TData>) => (() => Promise<TData>);
|
|
@@ -28,5 +28,5 @@ export declare const SharedCache: ScopedCache;
|
|
|
28
28
|
* sure this toggling is optional - or we could use a callback argument, to
|
|
29
29
|
* achieve this on an as-needed basis.
|
|
30
30
|
*/
|
|
31
|
-
export declare const useSharedCache: <TValue extends ValidCacheData>(id: string, scope: string, initialValue?: TValue | (() => TValue | null | undefined)
|
|
31
|
+
export declare const useSharedCache: <TValue extends ValidCacheData>(id: string, scope: string, initialValue?: TValue | null | undefined | (() => TValue | null | undefined)) => [TValue | null | undefined, CacheValueFn<TValue>];
|
|
32
32
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
6
4
|
var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
|
|
7
5
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
8
6
|
var React = require('react');
|
|
9
7
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function _interopNamespace(e) {
|
|
13
|
-
if (e && e.__esModule) return e;
|
|
8
|
+
function _interopNamespaceDefault(e) {
|
|
14
9
|
var n = Object.create(null);
|
|
15
10
|
if (e) {
|
|
16
11
|
Object.keys(e).forEach(function (k) {
|
|
@@ -23,12 +18,11 @@ function _interopNamespace(e) {
|
|
|
23
18
|
}
|
|
24
19
|
});
|
|
25
20
|
}
|
|
26
|
-
n
|
|
21
|
+
n.default = e;
|
|
27
22
|
return Object.freeze(n);
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
var
|
|
31
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
32
26
|
|
|
33
27
|
let FetchPolicy = function (FetchPolicy) {
|
|
34
28
|
FetchPolicy["CacheBeforeNetwork"] = "CacheBeforeNetwork";
|
|
@@ -62,7 +56,7 @@ class DataError extends wonderStuffCore.KindError {
|
|
|
62
56
|
|
|
63
57
|
class ScopedInMemoryCache {
|
|
64
58
|
constructor(initialCache = {}) {
|
|
65
|
-
this._cache =
|
|
59
|
+
this._cache = undefined;
|
|
66
60
|
this._cache = initialCache;
|
|
67
61
|
}
|
|
68
62
|
get inUse() {
|
|
@@ -84,7 +78,7 @@ class ScopedInMemoryCache {
|
|
|
84
78
|
}
|
|
85
79
|
get(scope, id) {
|
|
86
80
|
var _this$_cache$scope$id, _this$_cache$scope2;
|
|
87
|
-
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ?
|
|
81
|
+
return (_this$_cache$scope$id = (_this$_cache$scope2 = this._cache[scope]) == null ? undefined : _this$_cache$scope2[id]) != null ? _this$_cache$scope$id : null;
|
|
88
82
|
}
|
|
89
83
|
purge(scope, id) {
|
|
90
84
|
var _this$_cache$scope3;
|
|
@@ -156,8 +150,8 @@ class SsrCache {
|
|
|
156
150
|
return _default$2;
|
|
157
151
|
}
|
|
158
152
|
constructor(hydrationCache = null, ssrOnlyCache = null) {
|
|
159
|
-
this._hydrationCache =
|
|
160
|
-
this._ssrOnlyCache =
|
|
153
|
+
this._hydrationCache = undefined;
|
|
154
|
+
this._ssrOnlyCache = undefined;
|
|
161
155
|
this.initialize = source => {
|
|
162
156
|
if (this._hydrationCache.inUse) {
|
|
163
157
|
throw new Error("Cannot initialize data response cache more than once");
|
|
@@ -275,8 +269,8 @@ class RequestTracker {
|
|
|
275
269
|
}
|
|
276
270
|
constructor(responseCache) {
|
|
277
271
|
this._trackedRequests = {};
|
|
278
|
-
this._responseCache =
|
|
279
|
-
this._requestFulfillment =
|
|
272
|
+
this._responseCache = undefined;
|
|
273
|
+
this._requestFulfillment = undefined;
|
|
280
274
|
this.trackDataRequest = (id, handler, hydrate) => {
|
|
281
275
|
if (this._trackedRequests[id] == null) {
|
|
282
276
|
this._trackedRequests[id] = {
|
|
@@ -297,7 +291,7 @@ class RequestTracker {
|
|
|
297
291
|
for (const requestKey of Object.keys(this._trackedRequests)) {
|
|
298
292
|
const options = this._trackedRequests[requestKey];
|
|
299
293
|
try {
|
|
300
|
-
promises.push(this._requestFulfillment.fulfill(requestKey,
|
|
294
|
+
promises.push(this._requestFulfillment.fulfill(requestKey, _extends({}, options)).then(result => {
|
|
301
295
|
switch (result.status) {
|
|
302
296
|
case "success":
|
|
303
297
|
cacheData(requestKey, result.data, options.hydrate);
|
|
@@ -454,7 +448,7 @@ const useServerEffect = (requestId, handler, options = {}) => {
|
|
|
454
448
|
const cachedResult = SsrCache.Default.getEntry(requestId);
|
|
455
449
|
const maybeTrack = React.useContext(TrackerContext);
|
|
456
450
|
if (!skip && cachedResult == null && wonderBlocksCore.Server.isServerSide()) {
|
|
457
|
-
maybeTrack == null
|
|
451
|
+
maybeTrack == null || maybeTrack(requestId, interceptedHandler, hydrate);
|
|
458
452
|
}
|
|
459
453
|
return cachedResult == null ? null : resultFromCachedResponse(cachedResult);
|
|
460
454
|
};
|
|
@@ -476,7 +470,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
476
470
|
const currentRequestRef = React__namespace.useRef();
|
|
477
471
|
const fetchRequest = React__namespace.useMemo(() => {
|
|
478
472
|
var _currentRequestRef$cu;
|
|
479
|
-
(_currentRequestRef$cu = currentRequestRef.current) == null
|
|
473
|
+
(_currentRequestRef$cu = currentRequestRef.current) == null || _currentRequestRef$cu.cancel();
|
|
480
474
|
currentRequestRef.current = null;
|
|
481
475
|
networkResultRef.current = null;
|
|
482
476
|
const fetchFn = () => {
|
|
@@ -487,11 +481,11 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
487
481
|
const request = RequestFulfillment.Default.fulfill(`${requestId}|${scope}`, {
|
|
488
482
|
handler: interceptedHandler
|
|
489
483
|
});
|
|
490
|
-
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ?
|
|
484
|
+
if (request === ((_currentRequestRef$cu2 = currentRequestRef.current) == null ? undefined : _currentRequestRef$cu2.request)) {
|
|
491
485
|
return;
|
|
492
486
|
}
|
|
493
487
|
networkResultRef.current = null;
|
|
494
|
-
(_currentRequestRef$cu3 = currentRequestRef.current) == null
|
|
488
|
+
(_currentRequestRef$cu3 = currentRequestRef.current) == null || _currentRequestRef$cu3.cancel();
|
|
495
489
|
let cancel = false;
|
|
496
490
|
request.then(result => {
|
|
497
491
|
currentRequestRef.current = null;
|
|
@@ -539,7 +533,7 @@ const useCachedEffect = (requestId, handler, options = {}) => {
|
|
|
539
533
|
fetchRequest();
|
|
540
534
|
return () => {
|
|
541
535
|
var _currentRequestRef$cu4;
|
|
542
|
-
(_currentRequestRef$cu4 = currentRequestRef.current) == null
|
|
536
|
+
(_currentRequestRef$cu4 = currentRequestRef.current) == null || _currentRequestRef$cu4.cancel();
|
|
543
537
|
currentRequestRef.current = null;
|
|
544
538
|
};
|
|
545
539
|
}, [shouldFetch, fetchRequest]);
|
|
@@ -578,7 +572,7 @@ const useHydratableEffect = (requestId, handler, options = {}) => {
|
|
|
578
572
|
case WhenClientSide.ExecuteWhenNoResult:
|
|
579
573
|
return serverResult;
|
|
580
574
|
case WhenClientSide.ExecuteWhenNoSuccessResult:
|
|
581
|
-
if ((serverResult == null ?
|
|
575
|
+
if ((serverResult == null ? undefined : serverResult.status) === "success") {
|
|
582
576
|
return serverResult;
|
|
583
577
|
}
|
|
584
578
|
return null;
|
|
@@ -771,7 +765,7 @@ function graphQLDocumentNodeParser(document) {
|
|
|
771
765
|
const definitions = queries.length ? queries : mutations;
|
|
772
766
|
const definition = definitions[0];
|
|
773
767
|
const variables = definition.variableDefinitions || [];
|
|
774
|
-
const name = ((_definition$name = definition.name) == null ?
|
|
768
|
+
const name = ((_definition$name = definition.name) == null ? undefined : _definition$name.kind) === "Name" ? definition.name.value : "data";
|
|
775
769
|
const payload = {
|
|
776
770
|
name,
|
|
777
771
|
type,
|
|
@@ -817,7 +811,7 @@ const mergeGqlContext = (defaultContext, overrides) => {
|
|
|
817
811
|
}
|
|
818
812
|
}
|
|
819
813
|
return acc;
|
|
820
|
-
},
|
|
814
|
+
}, _extends({}, defaultContext));
|
|
821
815
|
};
|
|
822
816
|
|
|
823
817
|
const useGqlRouterContext = (contextOverrides = {}) => {
|
|
@@ -41,5 +41,5 @@ export declare const DataErrors: Readonly<{
|
|
|
41
41
|
* `${kind}DataError`
|
|
42
42
|
*/
|
|
43
43
|
export declare class DataError extends KindError {
|
|
44
|
-
constructor(message: string, kind: typeof DataErrors[keyof typeof DataErrors], { metadata, cause }?: ErrorOptions);
|
|
44
|
+
constructor(message: string, kind: (typeof DataErrors)[keyof typeof DataErrors], { metadata, cause }?: ErrorOptions);
|
|
45
45
|
}
|
package/dist/util/gql-error.d.ts
CHANGED
|
@@ -24,5 +24,5 @@ export declare const GqlErrors: Readonly<{
|
|
|
24
24
|
* `${kind}GqlError`
|
|
25
25
|
*/
|
|
26
26
|
export declare class GqlError extends KindError {
|
|
27
|
-
constructor(message: string, kind: typeof GqlErrors[keyof typeof GqlErrors], { metadata, cause }?: ErrorOptions);
|
|
27
|
+
constructor(message: string, kind: (typeof GqlErrors)[keyof typeof GqlErrors], { metadata, cause }?: ErrorOptions);
|
|
28
28
|
}
|
|
@@ -3,7 +3,7 @@ export declare const DocumentTypes: Readonly<{
|
|
|
3
3
|
query: "query";
|
|
4
4
|
mutation: "mutation";
|
|
5
5
|
}>;
|
|
6
|
-
export type DocumentType = typeof DocumentTypes[keyof typeof DocumentTypes];
|
|
6
|
+
export type DocumentType = (typeof DocumentTypes)[keyof typeof DocumentTypes];
|
|
7
7
|
export interface IDocumentDefinition {
|
|
8
8
|
type: DocumentType;
|
|
9
9
|
name: string;
|
|
@@ -14,4 +14,4 @@ export declare const initializeHydrationCache: (source: ResponseCache) => void;
|
|
|
14
14
|
* the cached hydration responses. If no predicate is provided, all cached
|
|
15
15
|
* hydration responses will be purged.
|
|
16
16
|
*/
|
|
17
|
-
export declare const purgeHydrationCache: (predicate?: (
|
|
17
|
+
export declare const purgeHydrationCache: (predicate?: (key: string, cacheEntry?: Readonly<CachedResponse<ValidCacheData>> | null | undefined) => boolean) => void;
|
|
@@ -2,4 +2,4 @@ import type { ValidCacheData, CachedResponse, Result } from "./types";
|
|
|
2
2
|
/**
|
|
3
3
|
* Turns a cache entry into a stateful result.
|
|
4
4
|
*/
|
|
5
|
-
export declare const resultFromCachedResponse: <TData extends ValidCacheData>(cacheEntry?: CachedResponse<TData> | null
|
|
5
|
+
export declare const resultFromCachedResponse: <TData extends ValidCacheData>(cacheEntry?: CachedResponse<TData> | null) => Result<TData> | null | undefined;
|
package/dist/util/status.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type { Result, ValidCacheData } from "./types";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const Status: Readonly<{
|
|
6
6
|
loading: <TData extends ValidCacheData = ValidCacheData>() => Result<TData>;
|
|
7
|
-
noData: <
|
|
8
|
-
aborted: <
|
|
9
|
-
success: <
|
|
10
|
-
error: <
|
|
7
|
+
noData: <TData extends ValidCacheData = ValidCacheData>() => Result<TData>;
|
|
8
|
+
aborted: <TData extends ValidCacheData = ValidCacheData>() => Result<TData>;
|
|
9
|
+
success: <TData extends ValidCacheData>(data: TData) => Result<TData>;
|
|
10
|
+
error: <TData extends ValidCacheData = ValidCacheData>(error: Error) => Result<TData>;
|
|
11
11
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-data",
|
|
3
|
-
"version": "14.0
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,23 +9,22 @@
|
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"module": "dist/es/index.js",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
|
|
15
|
-
},
|
|
16
12
|
"dependencies": {
|
|
17
|
-
"@babel/runtime": "^7.
|
|
18
|
-
"@khanacademy/wonder-blocks-core": "
|
|
13
|
+
"@babel/runtime": "^7.24.5",
|
|
14
|
+
"@khanacademy/wonder-blocks-core": "12.1.0"
|
|
19
15
|
},
|
|
20
16
|
"peerDependencies": {
|
|
21
|
-
"@khanacademy/wonder-stuff-core": "^1.
|
|
17
|
+
"@khanacademy/wonder-stuff-core": "^1.5.4",
|
|
22
18
|
"react": "18.2.0"
|
|
23
19
|
},
|
|
24
20
|
"devDependencies": {
|
|
25
|
-
"@khanacademy/
|
|
26
|
-
"@khanacademy/
|
|
27
|
-
"@khanacademy/wonder-blocks-testing-core": "
|
|
21
|
+
"@khanacademy/wonder-stuff-testing": "^3.0.5",
|
|
22
|
+
"@khanacademy/wb-dev-build-settings": "2.1.0",
|
|
23
|
+
"@khanacademy/wonder-blocks-testing-core": "2.1.0"
|
|
28
24
|
},
|
|
29
25
|
"author": "",
|
|
30
|
-
"license": "MIT"
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
29
|
+
}
|
|
31
30
|
}
|