rescript-relay 0.0.0-autocodesplit-09ee6f6c

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +942 -0
  2. package/README.md +111 -0
  3. package/cli/cli.js +472 -0
  4. package/compiler.js +11 -0
  5. package/package.json +65 -0
  6. package/postinstall.js +189 -0
  7. package/ppx-linux +0 -0
  8. package/ppx-macos-arm64 +0 -0
  9. package/ppx-macos-latest +0 -0
  10. package/ppx-windows-latest +0 -0
  11. package/relay-compiler-linux-musl/relay +0 -0
  12. package/relay-compiler-linux-x64/relay +0 -0
  13. package/relay-compiler-macos-arm64/relay +0 -0
  14. package/relay-compiler-macos-x64/relay +0 -0
  15. package/relay-compiler-win-x64/relay.exe +0 -0
  16. package/rescript.json +19 -0
  17. package/src/ReactDOMExperimental.bs.js +23 -0
  18. package/src/ReactDOMExperimental.res +16 -0
  19. package/src/ReactExperimental.bs.js +23 -0
  20. package/src/ReactExperimental.res +21 -0
  21. package/src/ReactExperimental.resi +18 -0
  22. package/src/RescriptRelay.bs.js +329 -0
  23. package/src/RescriptRelay.res +858 -0
  24. package/src/RescriptRelay.resi +897 -0
  25. package/src/RescriptRelayUtils.bs.js +76 -0
  26. package/src/RescriptRelayUtils.res +89 -0
  27. package/src/RescriptRelayUtils.resi +36 -0
  28. package/src/RescriptRelay_Fragment.bs.js +122 -0
  29. package/src/RescriptRelay_Fragment.res +243 -0
  30. package/src/RescriptRelay_Fragment.resi +85 -0
  31. package/src/RescriptRelay_Internal.bs.js +102 -0
  32. package/src/RescriptRelay_Internal.res +71 -0
  33. package/src/RescriptRelay_Internal.resi +20 -0
  34. package/src/RescriptRelay_Mutation.bs.js +57 -0
  35. package/src/RescriptRelay_Mutation.res +144 -0
  36. package/src/RescriptRelay_Mutation.resi +52 -0
  37. package/src/RescriptRelay_Query.bs.js +101 -0
  38. package/src/RescriptRelay_Query.res +177 -0
  39. package/src/RescriptRelay_Query.resi +62 -0
  40. package/src/RescriptRelay_RelayResolvers.bs.js +13 -0
  41. package/src/RescriptRelay_RelayResolvers.res +21 -0
  42. package/src/RescriptRelay_RelayResolvers.resi +10 -0
  43. package/src/RescriptRelay_Subscriptions.bs.js +24 -0
  44. package/src/RescriptRelay_Subscriptions.res +50 -0
  45. package/src/RescriptRelay_Subscriptions.resi +14 -0
  46. package/src/utils.js +418 -0
  47. package/src/utils.mjs +418 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,942 @@
1
+ # master
2
+
3
+ **All work on version `2.x` is in the [2.x branch](https://github.com/zth/rescript-relay/tree/2.x).**
4
+
5
+ # **Version 3**
6
+
7
+ # Unreleased
8
+
9
+ - Support `@alias` fragments.
10
+
11
+ # 3.0.0-rc.9
12
+
13
+ - Fix client extension enums mixup with `FutureAddedValue`.
14
+
15
+ # 3.0.0-rc.8
16
+
17
+ - Initial implementation of more advanced Relay resolvers. More to come. https://github.com/zth/rescript-relay/pull/515
18
+ - BREAKING: Relay resolvers using fragments should now be exported with a function name that matches the field name for the resolver, and not `default` like before.
19
+ - BREAKING: Client extension enums are now (correctly) not emitted with a `FutureAddedValue` case.
20
+
21
+ # 3.0.0-rc.7
22
+
23
+ - Fix for not deleting removed artifacts.
24
+
25
+ # 3.0.0-rc.6
26
+
27
+ - **Upgrade versions**: `react-relay` and `relay-runtime` to `17.0.0`.
28
+ - BREAKING: The `customScalars` option in the Relay config is now called `customScalarTypes`.
29
+ - BREAKING: `requiredFieldLogger` in the `Environment` config is now called `relayFieldLogger`.
30
+
31
+ # 3.0.0-rc.5
32
+
33
+ - Support for Relay `@updatable` queries and fragments (https://relay.dev/docs/guided-tour/updating-data/imperatively-modifying-store-data/#optimistic-updaters-vs-updaters). https://github.com/zth/rescript-relay/pull/501
34
+ - Attempt 2: Fix an error in postinstall.js when reinstalling rescript-relay dependency (https://github.com/zth/rescript-relay/pull/493)
35
+ - Suppress more false positives for unused things in generated Relay files.
36
+
37
+ # 3.0.0-rc.4
38
+
39
+ - Set explicit peer dependencies: `@rescript/react >= 0.12.1`, `react-relay@16.0.0`, `relay-runtime@16.0.0`.
40
+ - Clean up connection handler generators now that v3 let us use a better representation.
41
+ - Fix issue with default args in connection id makers. https://github.com/zth/rescript-relay/pull/488
42
+ - Fix issue with PPX not actually converting all functions to uncurried.
43
+ - Rename `bsconfig.json` -> `rescript.json`.
44
+ - Fix an error in postinstall.js when reinstalling rescript-relay dependency (https://github.com/zth/rescript-relay/pull/487)
45
+
46
+ # 3.0.0-rc.3
47
+
48
+ - Fix issue with custom scalars in arrays not being autoconverted properly.
49
+
50
+ # 3.0.0-rc.2
51
+
52
+ - Depend on ReScript v11 and RescriptReact 0.12.0.
53
+ - BREAKING: Use zero cost tagged variants for `RequiredFieldLogger`.
54
+ - Add support for the `relay_resolver.error` event kind.
55
+
56
+ # 3.0.0-rc.1
57
+
58
+ - Get rid of functor for creating `loadQuery`.
59
+ - Support for the `@preloadable` directive.
60
+
61
+ # 3.0.0-rc.0
62
+
63
+ - First RC version.
64
+
65
+ # 3.0.0-alpha.5
66
+
67
+ ## Improvements
68
+
69
+ - Emit `@live` for union variant cases to prevent false positives in unions.
70
+ - Set `@rescript/tools` version explicitly.
71
+ - First class support for input unions, leveraging the `@oneOf` directive.
72
+
73
+ # 3.0.0-alpha.4
74
+
75
+ ## Improvements
76
+
77
+ - Enums in input objects are now (properly) typed as their input variants.
78
+ - Single item enums are now not emitted as `@unboxed`.
79
+ - Remove unused fields CLI now properly account for only record fields.
80
+
81
+ # 3.0.0-alpha.3
82
+
83
+ ## Improvements
84
+
85
+ - Use an up-to-date `reanalyze` from the new `@rescript/tools` package, for powering the CLI.
86
+
87
+ # 3.0.0-alpha.2
88
+
89
+ This brings the supported Relay version to 16.
90
+
91
+ ## Upgrade versions
92
+
93
+ - `react-relay` and `relay-runtime` to `>=16.0.0`
94
+
95
+ # 3.0.0-alpha.1
96
+
97
+ Below is a series of releases for version 3 of RescriptRelay, which contain a large amount of breaking changes. The releases are cut up with a few breaking changes for each, to make them slightly less hard to migrate to. You're encouraged to start from the bottom and work your way up through the versions.
98
+
99
+ Dedicated tooling for migrating is coming, as well as docs.
100
+
101
+ # 0.0.0-version-3-8b552902
102
+
103
+ ## Breaking changes
104
+
105
+ - Unions are now represented as regular variants. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/3b5df51b80a0e1222b376fcfc730bb5dd0de099a
106
+
107
+ # 0.0.0-version-3-3504d777
108
+
109
+ ## Breaking changes
110
+
111
+ - All trailing unit arguments are removed. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/2a16791268afb29d106362d0cf17915f69d5b4ff
112
+
113
+ # 0.0.0-version-3-aeebeaab
114
+
115
+ ## Breaking changes
116
+
117
+ - Object maker functions are removed, and leverage optional fields for all variables/input objects. Also a large change, tooling upcoming. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/fd6b07a1b26620c91e5de61f930235c35517da6a
118
+
119
+ # 0.0.0-version-3-89bccc22
120
+
121
+ ## Breaking changes
122
+
123
+ - Remove "top level node field" transform. Previously, a single selection on the top level `node` field (like `node(id: $id) { ... on User { id, name }}`) would skip the union mechanism and automatically collapse the generated types to `option<user>`. This has now changed and the top level node field behaves just like any union. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/9ce73196794dbc6eba435414fcff708e7c53df78
124
+ - Enums are now (unboxed) regular variants rather than polyvariants. This is a large change, but we're going to provide some tools for easing the transition. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/9da425a3e65ce3e9403168af421522028424a4f0
125
+
126
+ # 2.0.0
127
+
128
+ RescriptRelay `2.0.0` is here! This isn't a large release really, but it's a major release just because it relies on functionality from ReScript `v11`. Meaning the lower bound of the required ReScript version is `>=11.0.0-beta.2`.
129
+
130
+ ### Uncurried mode
131
+
132
+ `2.0.0` is built to work with uncurried mode. It's not fully _optimized_, that'll come in `3.0.0`, but it works well in uncurried mode.
133
+
134
+ You can activate uncurried mode with `RescriptRelay` by setting `"uncurried": true` (`true` is also the default in ReScript `>=11.0.0-beta.2`) in your `bsconfig.json`, and then ensuring that you pass `-uncurried` to `rescript-relay/ppx` in `ppx-flags`: `"ppx-flags": [["rescript-relay/ppx", "-uncurried"]]`.
135
+
136
+ # 2.0.0-alpha.1
137
+
138
+ ## Improvements
139
+
140
+ - `%relay.deferredComponent` now works with uncurried mode.
141
+
142
+ # 2.0.0-alpha.0
143
+
144
+ First alpha of the `2.x` series of releases. `2.x` focuses on compat with ReScript `v11`, including uncurried mode.
145
+
146
+ ### Uncurried mode
147
+
148
+ You can activate uncurried mode with `RescriptRelay` by setting `"uncurried": true` in your `bsconfig.json`, and then ensuring that you pass `-uncurried` to `rescript-relay/ppx` in `ppx-flags`: `"ppx-flags": [["rescript-relay/ppx", "-uncurried"]]`.
149
+
150
+ ## Upgrade versions
151
+
152
+ - `rescript` to `>=11.0.0-beta.0`
153
+ - `@rescript/react` to `>=0.12.0-alpha.2`
154
+
155
+ ## Improvements
156
+
157
+ - Leverage variant's new `string` representation + `@as()` to get rid of `mapFetchPolicy`. This was internal so it should not affect you as an end user.
158
+
159
+ # 1.2.0
160
+
161
+ This release mainly makes preparations under the hood for the upcoming `2.0` (ReScript v11 + uncurried mode support) and `3.0` (lots of changes, full uncurried mode only).
162
+
163
+ ## Breaking changes
164
+
165
+ - A trailing unit `()` arg is no longer needed in `Query.usePreloaded()`. What was previously `Query.usePreloaded(~queryRef, ())` is now just `Query.usePreloaded(~queryRef)`.
166
+
167
+ ## Improvements
168
+
169
+ - Add `@live` annotations to generated JSXv4 dynamic import compat modules, so they don't show up in dead code analysis (which they shouldn't).
170
+ - Preparations under the hood for ReScript v11 + uncurried mode.
171
+
172
+ # 1.1.1
173
+
174
+ - Fix M1 binary to include new JSXv4 dynamic import compat changes.
175
+
176
+ # 1.1.0
177
+
178
+ Notable changes:
179
+
180
+ - _JSX v4 is now required_
181
+ - Relay and @rescript/react upgraded
182
+ - M1 support for the PPX (should speed up builds for anyone on an M1)
183
+
184
+ ## Upgrade versions
185
+
186
+ - `react-relay` and `relay-runtime` to `>=15.0.0`
187
+ - `@rescript/react` to `>=0.11.0`
188
+
189
+ ## Breaking changes
190
+
191
+ - The signature for missing field handlers has changed. Previously you got an open type `{..}` as record, now instead you get a proper `RecordProxy.t` from the store. Check out [the changelog for Relay 15](https://github.com/facebook/relay/releases/tag/v15.0.0).
192
+ - ReScript `>=10.1` and JSX v4 is now required.
193
+ - Work around issue with JSX v4 and `%relay.deferredComponent`. You now need to annotate any component you want to use with `%relay.deferredComponent` with `@relay.deferredComponent`. https://github.com/zth/rescript-relay/pull/439
194
+
195
+ ## Improvements
196
+
197
+ - Experimental support for allowing `null` in operation variables. Add `@rescriptRelayNullableVariables` to your operation (query, mutation, subscription) and you'll be allowed to pass `Js.null` (via the `Js.Null` module) to your server. https://github.com/zth/rescript-relay/pull/426
198
+ - :tada: M1 support for the PPX! This should speed up builds some. https://github.com/zth/rescript-relay/pull/435
199
+
200
+ ## Bug Fixes
201
+
202
+ - Fix issue with conversion of custom scalars, where custom scalars represented as arrays would get converted "internally" although they should've really just been left alone. https://github.com/zth/rescript-relay/pull/433
203
+
204
+ # 1.0.5
205
+
206
+ ## Bug Fixes
207
+
208
+ - Fix fairly large performance issue with runtime conversion. This should give a large speedup in certain cases.
209
+
210
+ # 1.0.4
211
+
212
+ ## Improvements
213
+
214
+ - Improved autocomplete for fragments etc (pulled from upstream Relay compiler). https://github.com/facebook/relay/pull/4134
215
+
216
+ # 1.0.3
217
+
218
+ ## Improvements
219
+
220
+ - Add `RescriptRelay.Disposable.ignore` for more ergonomic handling of ignoring disposables.
221
+
222
+ ## Bug Fixes
223
+
224
+ - Fix the `remove-unused-fields` script for CI with Node.js version >14 in [#409](https://github.com/zth/rescript-relay/pull/409)
225
+
226
+ # 1.0.2
227
+
228
+ ## Bug Fixes
229
+
230
+ - `private` is now correctly marked as a reserved word.
231
+
232
+ ## Improvements
233
+
234
+ - Add ReScript 10 compat in peerDependencies https://github.com/zth/rescript-relay/pull/397 @MoOx
235
+ - `makeConnectionId` helpers are now marked as `@live` to not trigger the dead code analysis.
236
+
237
+ # 1.0.1
238
+
239
+ ## Bug Fixes
240
+
241
+ - Fix issue with custom scalar of JSON values being accidentally mangled https://github.com/zth/rescript-relay/pull/395 @tsnobip
242
+
243
+ # 1.0.0
244
+
245
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/5831c2f1f0f13eedc1cb60468c32fd32b2dc01d3)_
246
+
247
+ The time has finally come - RescriptRelay `1.0.0` is released! This version brings a ton of new features and improvements. One of the the big major things this release brings is that the ReScript type generation for the Relay compiler has been completely rewritten, and fully integrated into the new Relay Rust compiler. The RescriptRelay fork of the compiler is available and maintained [here])(https://github.com/zth/relay/tree/rescript-relay).
248
+
249
+ ## Upgrade versions
250
+
251
+ - `react-relay` and `relay-runtime` to `>=14.1.0`
252
+ - `react` and `react-dom` to `>=18.0.0`
253
+
254
+ ## Remove Packages
255
+
256
+ You can go ahead and remove these packages, that are no longer needed, as the compiler is now shipped in the main package:
257
+
258
+ - `relay-config`
259
+ - `relay-compiler`
260
+ - `graphql` (if you don't use it for anything else)
261
+
262
+ ## Improvements
263
+
264
+ - The compiler itself should be _much_ faster than the old one. An order of magnitude faster. Especially for incremental compilation in watch mode.
265
+ - There's no longer any need to manually select `__typename` on interfaces and unions for RescriptRelay's sake, unless you actually want to use it yourself.
266
+ - We now support the `@required` directive from Relay, which is a new directive that lets you force non-nullability for nullable fields on the client side. You can then choose to throw an error if null values are encountered, or let the null value bubble up. Docs are coming soon.
267
+ - The errors reported by the compiler is now quite a lot better.
268
+ - Full support for `reanalyze` as all false positive dead code results from generated code are now suppressed.
269
+ - Bindings for `requiredFieldLogger` for logging when missing fields are encountered (kudos [Emilios1995](https://github.com/Emilios1995)).
270
+ - Improved utils for [dealing with enums](https://rescript-relay-documentation.vercel.app/docs/enums).
271
+ - `recordSourceRecords` is now typed as `Js.Json.t` rather than being abstract.
272
+ - Project now works in `"type": "module"` mode in `package.json` (kudos [cometkim](https://github.com/cometkim))
273
+ - The field name of the `id` field of the `Node` interface is now configurable via `schemaConfig: {nodeInterfaceIdField: "idNameHere"}`.
274
+ - Add support for experimental [Relay Resolvers](https://relay.dev/docs/next/guides/relay-resolvers). Undocumented so far, but looking at the [test](https://github.com/zth/rescript-relay/blob/master/packages/rescript-relay/__tests__/Test_relayResolvers.res) and [definition file](https://github.com/zth/rescript-relay/blob/master/packages/rescript-relay/__tests__/TestRelayUserResolver.res) should give you a hint of how it works.
275
+ - Support `@rescriptRelayIgnoreUnused` directive on fragment definitions to insert annotations that makes `reanalyze` consider all fields in the fragment used, even if they aren't.
276
+ - Support `@rescriptRelayAllowUnsafeEnum` directive on fields selecting enums, which will ignore safety measures for enums, meaning you won't need to add a catch all clause, etc. It'll essentially output the enum as an _input_ enum (as desribed in the docs).
277
+ - Support [provided variables](https://relay.dev/docs/api-reference/graphql-and-directives/#provided-variables). More info in the docs.
278
+ - Windows support! :tada:
279
+ - A `RelaySchemaAssets_graphql.res` is now emitted, containing type definitions for all enums and all input objects. This is designed to help with accessing and using enums and input objects outside of Relay's context. This means it'll be much easier to share makers for input objects, pass enums around, etc.
280
+ - Each fragment with a `@connection` now emits a `makeConnectionId` function that allows you to generate _type safe_ connection IDs. More on why this is useful in the documentation.
281
+
282
+ ## Breaking changes
283
+
284
+ - The list of disallowed field names has been adapted to ReScript (it was never properly updated for ReScript when moving from ReasonML). This means that _some of your variable prop names might be renamed_. One example - if you previously had a variable in GraphQL called `$to`, you'd interact with that as `to_` in ReScript. This is because RescriptRelay would pin `to` as a reserved word, and rename it for you. But, `to` _isn't_ actually a keyword in ReScript (it was in ReasonML), so with this release, that `to_` in ReScript will be renamed to `to`. The fix is to just update all `to_` to `to` - let the compiler guide you!
285
+ - Using variable names that are reserved words in ReScript is now _disallowed at the Relay compiler level_. This means that Relay won't compile your project if you have variables whose names are reserved words. The fix is to simply rename the variables.
286
+ - `refetchVariables` now works as intended with regards to supplying only the variables you want _changed_ when refetching, as [detailed under `variables` here](https://relay.dev/docs/next/api-reference/use-refetchable-fragment/#return-value). This means that what was previously `makeRefetchVariables(~someValue=123, ())` should now be `makeRefetchVariables(~someValue=Some(123), ())`.
287
+ Crash course:
288
+
289
+ - `makeRefetchVariables(~someValue=Some(123), ())` means _refetch, use the same values for all variables that was used in the last fetch, but change `someValue` to `123`_.
290
+ - `makeRefetchVariables(~someValue=None, ())` means _refetch, use the same values for all variables that was used in the last fetch, but change `someValue` to `null` (unsetting it)_.
291
+ - `makeRefetchVariables()` means _refetch, use the same values for all variables that was used in the last fetch, change nothing_.
292
+
293
+ This way you can surgically change only certain values when refetching, without having to keep track of the current values for the other values.
294
+
295
+ More details on this [in the docs](https://rescript-relay-documentation.vercel.app/docs/refetching-and-loading-more-data#makerefetchvariables). Thanks to [@tsnobip](https://github.com/tsnobip) for fixing this!
296
+
297
+ - All enum type definitions now reside in `RelaySchemaAssets_graphql.enum_<yourEnumName>`, and are _not_ generated on the operation itself anymore. So, if you previously referred to the actual enum _type_, like `Fragment.Types.enum_MyFineEnum`, you'll now need to refer to that enum type as `RelaySchemaAssets_graphql.enum_MyFineEnum`.
298
+ - Input object fields with illegal names in ReScript previously had their maker function argument names suffixed with `_`, like `~type_: string`. This is now instead _prefixed_, like `~_type: string`. Prefixing like this instead of suffixing means we can ship fully zero cost maker functions, which we couldn't before for input objects with illegal field names.
299
+
300
+ ## Assorted Changes and Fixes
301
+
302
+ - Add Environment isServer option @MoOx
303
+ - Remove rescript from dependencies @anmonteiro
304
+ - Add undocumented holdGC method on relay store @MoOx
305
+ - Fixed `setLinkedRecordToNull`, `setLinkedRecordToUndefined`, `setLinkedRecordsToNull` and `setLinkedRecordsToUndefined` methods by binding them to `setValue` instead of `setLinkedRecord/s`. Previously they were throwing an error because `setLinkedRecord/s` did not support "deleting" values using them. (@reck753)
306
+ - Fix long standing bug that would make whether connection helpers were emitted or not unreliable.
307
+
308
+ ## 1.0.0 development changelog
309
+
310
+ - Fix bug in the new type safe connection ID makers where null default values wouldn't turn the variable into a `Js.Null.t<t>`, leading to type errors.
311
+ - Fix bug with connection handling where connections behind a `@include` or `@skip` directive would not be found.
312
+ - Move `getConnectionNodes` back into generated and auto included `Utils` module. This means that failing to generate `getConnectionNodes`, which can happen for various reasons, won't break the build, but rather not just emit the helper.
313
+
314
+ ### rc.5
315
+
316
+ - Fix compat with `rescript@10.1.0-alpha.1`.
317
+
318
+ ### rc.4
319
+
320
+ - _potentially breaking_ All enum type definitions now reside in `RelaySchemaAssets_graphql.enum_<yourEnumName>`, and are _not_ generated on the operation itself anymore. So, if you previously referred to the actual enum _type_, like `Fragment.Types.enum_MyFineEnum`, you'll now need to refer to that enum type as `RelaySchemaAssets_graphql.enum_MyFineEnum`.
321
+ - Fix bug in the new type safe connection ID makers where different types could end up in the same array, yielding type errors in ReScript.
322
+
323
+ ### rc.3
324
+
325
+ - Fix bug in the new type safe connection ID makers where constant value `null` couldn't be used.
326
+
327
+ ### rc.2
328
+
329
+ - Fix long standing bug that would make whether connection helpers were emitted or not unreliable.
330
+
331
+ ### rc.1
332
+
333
+ - Restore half-broken connection helper function inlining.
334
+
335
+ ### rc.0
336
+
337
+ - _potentially breaking_ `getConnectionNodes` and `connectionKey` is now located directly in the generated module, and not in a nested `Utils` module. `connectionKey` is also no longer exposed on the `Fragment` module, but only via the generated module for that fragment (`WhateverYourFragmentIsCalled_whatever_graphql.res`)
338
+ - Support [provided variables](https://relay.dev/docs/api-reference/graphql-and-directives/#provided-variables). More info in the docs.
339
+ - Windows support! :tada:
340
+ - Fixed `setLinkedRecordToNull`, `setLinkedRecordToUndefined`, `setLinkedRecordsToNull` and `setLinkedRecordsToUndefined` methods by binding them to `setValue` instead of `setLinkedRecord/s`. Previously they were throwing an error because `setLinkedRecord/s` did not support "deleting" values using them. (@reck753)
341
+ - A `RelaySchemaAssets_graphql.res` is now emitted, containing type definitions for all enums and all input objects. This is designed to help with accessing and using enums and input objects outside of Relay's context. This means it'll be much easier to share makers for input objects, pass enums around, etc.
342
+ - Each fragment with a `@connection` now emits a `makeConnectionId` function that allows you to generate _type safe_ connection IDs. More on why this is useful in the documentation.
343
+ - _breaking_ Input object fields with illegal names in ReScript previously had their maker function argument names suffixed with `_`, like `~type_: string`. This is now instead _prefixed_, like `~_type: string`. Prefixing like this instead of suffixing means we can ship fully zero cost maker functions, which we couldn't before for input objects with illegal field names.
344
+
345
+ ## beta.26
346
+
347
+ - Upgrade Relay packages to version `14.1.0`.
348
+
349
+ ## beta.25
350
+
351
+ - Change signature of preload function (router related).
352
+
353
+ ## beta.24
354
+
355
+ - Fix compatibility with ReScript v10
356
+
357
+ ## beta.23
358
+
359
+ - Add Environment isServer option @MoOx
360
+ - Fix incorrect react-relay peerDependencies version @MoOx
361
+ - Remove rescript from dependencies @anmonteiro
362
+ - Fix instantiation of Relay context @vikfroberg
363
+ - Add undocumented holdGC method on relay store @MoOx
364
+
365
+ ### beta.22
366
+
367
+ - Fix locations for `%relay.deferredComponent` so jump-to-definition, hover etc works as expected (pointing to the dynamically imported module rather than what the PPX produces).
368
+ - Add links for `Operation` module in `Query`, `Mutation`, `Subscription` and `Fragment` ([XiNiHa](https://github.com/XiNiHa))
369
+
370
+ ### beta.21
371
+
372
+ - Support formatting commented out operations in the CLI ([reck753](https://github.com/reck753)).
373
+ - Support `@rescriptRelayIgnoreUnused` directive on fragment definitions to insert annotations that makes `reanalyze` consider all fields in the fragment used, even if they aren't.
374
+ - Support `@rescriptRelayAllowUnsafeEnum` directive on fields selecting enums, which will ignore safety measures for enums, meaning you won't need to add a catch all clause, etc. It'll essentially output the enum as an _input_ enum (as desribed in the docs).
375
+
376
+ ### beta.20
377
+
378
+ - Fix enums appearing in `@raw_response_type` (local query updates, optimistic responses) to be input enums.
379
+
380
+ ### beta.19
381
+
382
+ - Fix top level node interface issue.
383
+
384
+ ### beta.18
385
+
386
+ - Fix `useTransition` bindings, where `startTransition` broke after going to React 18. Kudos to [Emilios1995](https://github.com/Emilios1995) for researching and finding the issue!
387
+
388
+ ### beta.17
389
+
390
+ - Upgrade to stable React 18
391
+
392
+ ### beta.16
393
+
394
+ - Fix bug that caused issues when using unions in optimistic responses and `commitLocalPayload`.
395
+ - Add support for experimental [Relay Resolvers](https://relay.dev/docs/next/guides/relay-resolvers). Undocumented so far, but looking at the [test](https://github.com/zth/rescript-relay/blob/master/packages/rescript-relay/__tests__/Test_relayResolvers.res) and [definition file](https://github.com/zth/rescript-relay/blob/master/packages/rescript-relay/__tests__/TestRelayUserResolver.res) should give you a hint of how it works.
396
+
397
+ ### beta.15
398
+
399
+ - Fixes for input objects.
400
+
401
+ ### beta.14
402
+
403
+ - Fixes a few issues introduced in `beta.13`.
404
+ - The list of disallowed field names has been adapted to ReScript. This means that _some of your variable prop names might be renamed_. Check out the Breaking Changes section above for details.
405
+
406
+ ### beta.13
407
+
408
+ - `refetchVariables` now works as intended with regards to supplying only the variables you want _changed_ when refetching, as [detailed under `variables` here](https://relay.dev/docs/next/api-reference/use-refetchable-fragment/#return-value). Check out the [docs](https://rescript-relay-documentation.vercel.app/docs/refetching-and-loading-more-data#makerefetchvariables).
409
+ - Make all object makers inlined. This should improve bundle size some.
410
+ - Support more Linux versions in CI (like the images Vercel uses).
411
+
412
+ ### beta.12
413
+
414
+ - Make CLI work with `relay.config.cjs`.
415
+
416
+ ### beta.11
417
+
418
+ - Another batch of experimental stuff... Nothing new in this version compared to `beta.9`.
419
+
420
+ ### beta.10
421
+
422
+ - Sneaking out some experimental stuff... Nothing new in this version compared to `beta.9`.
423
+
424
+ ### beta.9
425
+
426
+ - `recordSourceRecords` is now typed as `Js.Json.t` rather than being abstract.
427
+ - The field name of the `id` field of the `Node` interface is now configurable via `schemaConfig: {nodeInterfaceIdField: "idNameHere"}`.
428
+
429
+ ### beta.8
430
+
431
+ - More fixes for conversion instructions in variables and input objects.
432
+ - Project now works in `"type": "module"` mode in `package.json` (kudos [cometkim](https://github.com/cometkim))
433
+
434
+ ### beta.7
435
+
436
+ - Full support for `reanalyze` as all false positive dead code results from generated code are now suppressed.
437
+ - Bindings for `requiredFieldLogger` for logging when missing fields are encountered (kudos [Emilios1995](https://github.com/Emilios1995)).
438
+ - Fix bug with conversion instructions in variables with input instructions.
439
+
440
+ ### beta.6
441
+
442
+ - Fix wrong enum type being printed in input objects
443
+ - Fix `__typename` not being automatically selected (and by that forcing a manual select) in some cases, even though it's not supposed to be required to select manually anymore
444
+
445
+ ### beta.5
446
+
447
+ - Generate helpers for moving between unsafe enums coming from the server, and safe enums. Also, provide a "fromString" function for each enum used, that can be used to turn any string into your enum.
448
+ - Suppress dead code warnings _in most places_ when running `reanalyze` on a `rescript-relay` code base. Still a few things left to fix, that requires changes to reanalyze. But this should be much better than before.
449
+
450
+ ### beta.4
451
+
452
+ - Revert JSON.parse micro optimization experiment.
453
+
454
+ ### beta.3
455
+
456
+ - Fix issue with duplicate keys being printed in the conversion instructions.
457
+ - Get rid of the need of nullability conversion instructions, and infer them instead.
458
+
459
+ ### beta.2
460
+
461
+ - Fix issue with recursive input objects not being converted correctly.
462
+
463
+ # 0.23.0
464
+
465
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/6e96dfafaec918b1d4e9519d3fcbf5e5c46be6c0)_
466
+
467
+ Finally, a new release! This brings the Relay version to 12, and the React version to 18 (in rc.1 at the time of writing). This release has a few breaking changes which are necessary as we're slowly approaching version 1.0.0 of RescriptRelay. Check the new "Migrations" section below for a few scripts you can run to help the migration.
468
+
469
+ ## Upgrade versions
470
+
471
+ - `react-relay` to `12.0.0`
472
+ - `relay-compiler` to `12.0.0`
473
+ - `relay-config` to `12.0.0`
474
+ - `relay-runtime` to `12.0.0`
475
+
476
+ React to React 18 rc:
477
+
478
+ - `react` to `rc` (`yarn add react@rc`)
479
+ - `react-dom` to `rc`(`yarn add react-dom@rc`)
480
+
481
+ ## Migrations
482
+
483
+ Want help migrating most of the changes in this release? Install [comby](https://comby.dev) and run the migrations below (paste them into your terminal at the root of your project). Comby will guide you through the proposed changes.
484
+
485
+ - `comby 'ReactExperimental.unstable_useDeferredValue(:[1])' 'ReactExperimental.useDeferredValue(:[1])' .res -matcher .re -exclude-dir node_modules -review`
486
+ - `comby 'ReactExperimental.renderConcurrentRootAtElementWithId' 'ReactDOMExperimental.renderConcurrentRootAtElementWithId' .res -matcher .re -exclude-dir node_modules -review`
487
+ - `comby 'let (:[1], :[2]) = ReactExperimental.unstable_useTransition()' 'let (:[2], :[1]) = ReactExperimental.useTransition()' .res -matcher .re -exclude-dir node_modules -review`
488
+
489
+ ## Breaking changes
490
+
491
+ - Remove `reason-promise` (unless you're using it for something else yourself and want to keep it). We're waiting for the official new Promise bindings, but since they seem to be quite far away, we'll have to revert back to stock `Js.Promise` for now. This is because `reason-promise` clashes with other Promise bindings that people might want to use before the new official ones are actually shipped.
492
+ - `ReactExperimental.unstable_useTransition` is now called `ReactExperimental.useTransition`, and the order of the tuple that's returned has been reversed to align with the underlying API. This means that what was before `let (startTransition, isTransitioning) = ReactExperimental.unstable_useTransition()` is now `let (isTransitioning, startTransition) = ReactExperimental.useTransition()` (migration available above).
493
+ - `ReactExperimental.unstable_useDeferredValue` is now called `ReactExperimental.useDeferredValue` (migration available above).
494
+ - `ReactExperimental.renderConcurrentRootAtElementWithId` has moved to `ReactDOMExperimental`: `ReactDOMExperimental.renderConcurrentRootAtElementWithId` (migration available above).
495
+
496
+ ## Fixes & misc
497
+
498
+ - You're now allowed to configure Relay via `package.json`.
499
+
500
+ # 0.22.0
501
+
502
+ This release brings a few `rescript-relay-cli` improvements under the hood, as well as the breaking (but very easily fixable) change of uncurrying the `sink` methods received back from `RescriptRelay.Observable.make`.
503
+
504
+ ## Breaking changes
505
+
506
+ - Uncurry `sink` methods. What was previously `sink => sink.error(err)` etc should now instead be `sink => sink.error(. err)`.
507
+
508
+ ## Fixes & misc
509
+
510
+ - Improvements to the `remove-unused-fields` CLI.
511
+
512
+ # 0.21.1
513
+
514
+ - A few bug fixes to the `remove-unused-fields` command in the CLI.
515
+
516
+ # 0.21.0
517
+
518
+ - Adds `rescript-relay-cli`, a CLI for removing unused fields and formatting GraphQL in your project. Read more [here](https://github.com/zth/rescript-relay/blob/master/packages/rescript-relay-cli/README.md) (especially look at `remove-unused-fields`).
519
+
520
+ # 0.20.1
521
+
522
+ Quick patch release fixing the Linux binaries that broke with the last release.
523
+
524
+ # 0.20.0
525
+
526
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/05e045c05eb704e6e102ebf2b361a9a16cef2fb5)_
527
+
528
+ Other than bug fixes, the major thing about this release is the fact that we've now moved to the new `rescript` package :tada:!
529
+
530
+ ## Fixes & misc
531
+
532
+ - `getConnectioNodes` is now also generated for aliased connections.
533
+ - Fix bug with type gen for refetchable queries without arguments not working properly.
534
+ - `.mjs` extensions in Rescript are now handled properly (kudos @sgrove).
535
+ - We've now moved from `bs-platform` to `rescript`.
536
+
537
+ # 0.19.0
538
+
539
+ A quick release with a few fixes. More details below.
540
+
541
+ ## Fixes & misc
542
+
543
+ - Turn off various warnings to ease creation of interface files. ([@tsnobip](https://github.com/tsnobip))
544
+ - Fix multiple `fragmentRefs` appearing in generated object maker functions when multiple fragment refs are present.
545
+
546
+ # 0.18.2
547
+
548
+ Another small patch release, fixing an annoying warning in the generated files, and adding bindings from Relay's [missing field handlers](https://relay.dev/docs/guided-tour/reusing-cached-data/filling-in-missing-data/).
549
+
550
+ ## Fixes & misc
551
+
552
+ - Turn off warnings for unused opens in generated files.
553
+
554
+ ## New bindings
555
+
556
+ - Bind `missingFieldHandlers` on `Environment`. Read [this section of the Relay docs](https://relay.dev/docs/guided-tour/reusing-cached-data/filling-in-missing-data/) for more information. Add custom ones by passing `array<MissingFieldHandler.t>` to `Environment.make`.
557
+
558
+ # 0.18.1
559
+
560
+ Minor patch release, removing an inline `require` to further enhance ES modules compability.
561
+
562
+ # 0.18.0
563
+
564
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/49bf382d80c71207a11fe9aa1271a7cf06a98817)_
565
+
566
+ ## Fixes & misc
567
+
568
+ - Support ES6 imports for `@refetchable` queries. This for example allows the use of Vite and similar bundlers.
569
+
570
+ # 0.17.1
571
+
572
+ Small patch release, mainly fixing the broken `getConnectionID` binding.
573
+
574
+ ## Fixes & misc
575
+
576
+ - Fix broken `getConnectionID` binding. It's now _properly_ exposed on `ConnectionHandler.getConnectionID`, so use that instead.
577
+ - Remove `getConnectionID` generation from PPX. Prefer `ConnectionHandler.getConnectionID`. Even though it's slightly more cumbersome, it's guaranteed to not give you dependency cycles.
578
+
579
+ # 0.17.0
580
+
581
+ Small release, mainly bringing stable references to functions produced by the PPX, and a fix for enums in input positions.
582
+
583
+ ## Fixes & misc
584
+
585
+ - Every enum now gets an exact version output of itself too, and that exact version is now wired up to be used in variables and inputs, where it doesn't make sense to use the open enum we use for responses/fragments (that is open to enforce adding a catch-all case for any enums that the server might add in the future).
586
+ - All hooks produced by the PPX now have _stable references_ (or as stable as they can be), meaning you won't get a new function on each render for most of the callbacks and functions the PPX returns.
587
+
588
+ # 0.16.0
589
+
590
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/bfb904065c22bdfc1c5bd268704b8d061c7f85ec)_
591
+
592
+ Finally, we've renamed to `RescriptRelay`! In addition to that, Relay has also released their hook APIs as stable, which means that we for the first time in history can depend on a stable Relay version. Weehoo!
593
+
594
+ In general, this release will involve quite some renaming etc for you, but other than that, the actual breaking changes are minimal. Read the full changelog below for instructions and information about what exactly has changed.
595
+
596
+ ## Upgrade versions
597
+
598
+ - `react-relay` to `11.0.0`
599
+ - `relay-compiler` to `11.0.0`
600
+ - `relay-config` to `11.0.0`
601
+ - `relay-runtime` to `11.0.0`
602
+
603
+ ## Breaking changes
604
+
605
+ - `ReasonRelay` is now called `RescriptRelay` :tada:. Just search-and-replace `ReasonRelay` to `RescriptRelay`, and `reason-relay` to `rescript-relay`, and you should be fine.
606
+ - `defaultRenderPolicy` on `Environment` is gone. It defaults to `Partial` and will be removed in Relay centrally. Migration strategy: Just remove the config.
607
+ - `renderPolicy` is now 100% _gone_ from the API. Relay will remove this in the next release (everything will always be what as previously `Partial`), and there should be no practical downsides to using `Partial` as opposed to `Full`. Migration strategy: Remove any usage of `renderPolicy`.
608
+
609
+ ## New bindings
610
+
611
+ - Any fragment with a `@connection` directive now also exposes a `Fragment.getConnectionID(parentDataId, maybeFilters)` function for making it very simple to construct a connection `dataId` for that particular fragment that can be used with things like `@appendNode` and friends.
612
+ - A `ReasonRelay.getConnectionID(parentDataId, connectionKey, 'filters)` is also exposed for the same reason as above, but should be avoided in any situation where the generated function from the fragment can be used.
613
+ - All generated _modules_ (so `SomeFragment_user_graphql.res` that's generated by the compiler)
614
+ - `SuspenseList` is now bound via `ReactExperimental` again since the current RescriptReact bindings to that is broken.
615
+
616
+ # 0.15.0
617
+
618
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/reason-relay/commit/5aea01a511f9c084a23a8db09c30bbecca59ca32)_
619
+
620
+ This is the final release before ReasonRelay will rename to RescriptRelay! Do this to upgrade:
621
+
622
+ 1. We now depend on `@rescript/react` instead of `reason-react`. _Remove_ `reason-react` and add `@rescript/react@0.10.0`.
623
+ 2. The compiler now outputs `res` instead of `re`. For this to work smoothly, you should _delete your entire `__generated__` directory_ and re-run the ReasonRelay compiler.
624
+
625
+ ## Upgrade versions
626
+
627
+ _Remove_ `reason-react` and add `@rescript/react@0.10.0`.
628
+
629
+ ## Breaking changes
630
+
631
+ - Internal functions generated by the PPX are now actually marked as private. This should not be a breaking change unless you somehow rely on things from the `Internal` module generated by each extension node, which you shouldn't be anyway.
632
+
633
+ ## New bindings
634
+
635
+ - Bind `Environment.retain` (a way to ensure a specific query is not garbage collected). [@webican](https://github.com/webican)
636
+ - Add `Query.retain(~environment, ~variables)` as a way of retaining a query so it's not garbade collected. More info [in the Relay docs here](https://relay.dev/docs/en/experimental/a-guided-tour-of-relay#retaining-queries) on what that means.
637
+
638
+ ## Fixes & misc
639
+
640
+ - Binaries are now statically linked on Linux, which means that build issues on things like Vercel and Netlify should now be gone. [@fakenickels](https://github.com/webican) (and honorary mention [bdj](https://github.com/bdj))
641
+ - The compiler now outputs `res` files and syntax instead of `re` syntax. In order to make this work smoothly, make sure you remove all contents of your `__generated__` folder before you re-run the Relay compiler after upgrading.
642
+ - Fix a bug where store updater directives on scalars (like `deletedUserId`) would not have their connection array arg type transformed from `string` to `dataId`.
643
+
644
+ # 0.14.0
645
+
646
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/reason-relay/commit/bf0599b7b5078ff73a4b91cfb30a6c742037852e)_
647
+
648
+ This release brings new versions of Relay and React, and a few other minor changes.
649
+
650
+ ## Upgrade versions
651
+
652
+ - `react` to `0.0.0-experimental-4e08fb10c`
653
+ - `react-dom` to `0.0.0-experimental-4e08fb10c`
654
+ - `react-relay` to `0.0.0-experimental-4c4107dd`
655
+ - `relay-compiler` to `10.1.3`
656
+ - `relay-config` to `10.1.3`
657
+ - `relay-runtime` to `10.1.3`
658
+
659
+ ## Breaking changes
660
+
661
+ - _BREAKING CHANGE_ Lists of connection ids passed into the store updater directives (@appendEdge, @appendNode, etc) are now properly typed a `array<ReasonRelay.dataId>` rather than `array<string>`.
662
+
663
+ ## Fixes & misc
664
+
665
+ - `/* @generated */` JS comment is now preserved in the output, helping various tooling understand that the generated files are indeed generated.
666
+ - Prebuilt JS files are now shipped with the package to simplify building a project without needing to build your ReScript project again. _Warning_: This is not "officially" supported in the sense that if you use this, you're on your own. We still recommend you to always build your ReScript project before delivering it, and not relying on prebuilt files.
667
+ - Added comment to generated connection record types, giving a hint to use the generated `getConnectionNodes` helper for turning a connection into a list of non-nullable nodes.
668
+
669
+ # 0.13.0
670
+
671
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/reason-relay/commit/4c8fb3d36dfa84267cb28ffb081a30a9f55c6554)_
672
+
673
+ > Make sure you read the breaking changes below!
674
+
675
+ This release marks the start of ReasonRelay's journey towards two things:
676
+
677
+ 1. Supporting the new Relay Rust compiler. While this release still uses the JS based compiler, it takes steps needed to support the Rust based compiler in the future.
678
+ 2. Fully embracing ReScript.
679
+
680
+ Point 1 is something that you as a user will hopefully notice a minimal amount of churn from. But point 2 is important to address. In sum, the following will happen in the coming months:
681
+
682
+ - ReasonRelay will be renamed, probably to ReScriptRelay.
683
+ - ReasonML and ReScript syntax will continue to be supported for the foreseeable future, but I will focus my tooling and documentation efforts on ReScript.
684
+ - Docs will be converted to ReScript (this is 90% done).
685
+ - A dedicated VSCode extension I'm working on will be released, _only_ supporting ReScript syntax (sneak peak already released).
686
+ - Source files emitted by the compiler will eventually be converted to `.res` files rather than `.re` files.
687
+
688
+ The reason for all of this is simply that I believe ReScript is where the future is at, and I don't have the resources to focus my efforts on tooling etc for two syntaxes. I love ReasonML and its syntax, but I've still come to the conclusion that ReScript syntax is what will the most powerful alternative in the future.
689
+
690
+ [Check out the sneak peak release](https://reason-relay-documentation.zth.now.sh/docs/vscode-extension) of the dedicated VSCode extension.
691
+
692
+ ## Breaking changes
693
+
694
+ - _BREAKING CHANGE_ Operations are now defined through a single extension node rather than multiple per operation type. `relay.fragment`, `relay.query` etc are now gone. What was previously `[%relay.fragment {| fragment Blabla on Blabla {....|}]` should now instead be: `[%relay {| fragment Blabla on Blabla {....|}]`.
695
+
696
+ Migration path: Install [`comby`](https://comby.dev/docs/get-started), and run this command in your root (for `.re` files): `comby '%relay.:[~(fragment|subscription|mutation|query)]' '%relay' -i .re -exclude-dir node_modules`, or this command for `.res` files: `comby '%relay.:[~(fragment|subscription|mutation|query)]' '%relay' -i .res -matcher .re -exclude-dir node_modules`. That will take care of migrating all of your extension points.
697
+
698
+ - _BREAKING CHANGE_ Add binding for passing `uploadables` to network fetch functions. This is breaking because it changes the signature of `fetchFunctionPromise` and `fetchFunctionObservable` to include another argument `uploadables`. Migration path: What was previously something like `let fetchQuery: ReasonRelay.Network.fetchFunctionPromise = (operation, variables, _cacheConfig) => {...}` should now be `let fetchQuery: ReasonRelay.Network.fetchFunctionPromise = (operation, variables, _cacheConfig, _uploadables) => {...}`. Read more in the API reference section of the docs. ([@hariroshan](https://github.com/hariroshan))
699
+
700
+ ## New bindings
701
+
702
+ - Add back `Query.fetchPromised` to simplify working with SSR.
703
+ - Bind `id` in `operation` to allow using persisted queries. ([@hariroshan](https://github.com/hariroshan))
704
+
705
+ ## Fixes & misc
706
+
707
+ - Almost the entire Reason codegen has moved from being JS based to Reason native. As a user you shouldn't really notice anything other than the builds being a bit quicker. This is mainly a preparation for the upcoming Relay Rust compiler.
708
+
709
+ # 0.12.1
710
+
711
+ A quick patch with a bug fix.
712
+
713
+ ## Fixes & misc
714
+
715
+ - Fix a bug where `@raw_response_type` together with unions would crash the type generation.
716
+
717
+ # 0.12.0
718
+
719
+ This release packs a bunch of new, cool things! Full list of details below, but some highlights:
720
+
721
+ - Support for using ReasonRelay with ReScript ([@sorenhoyer](https://github.com/sorenhoyer))
722
+ - Relay `10.1.0`
723
+
724
+ [Check out this](https://github.com/zth/reason-relay/commit/f95bbf9d9eb35297e9b48dec2c098e48c391f8d6) for an example diff of upgrading a project.
725
+
726
+ This version also reverts back to shipping our own bindings for `ReactExperimental`. It's likely that React will remain in experimental for a while longer with concurrent mode, and we don't want to be tied to the bindings in `ReasonReact`, since they usually take a while to update. Hence this change.
727
+
728
+ A _big_ thanks to all contributors who's helped pack this release with great changes. It contains a bit of churn (and the coming releases probably will too), but hopefully nothing that isn't easily handled.
729
+
730
+ ## Upgrade versions
731
+
732
+ - `react` to `0.0.0-experimental-4ead6b530`
733
+ - `react-dom` to `0.0.0-experimental-4ead6b530`
734
+ - `react-relay` to `0.0.0-experimental-c818bac3`
735
+ - `relay-compiler` to `10.1.0`
736
+ - `relay-config` to `10.1.0`
737
+ - `relay-runtime` to `10.1.0`
738
+ - `bs-platform` to `8.3.3` (recommended, but not required)
739
+
740
+ ## FAQ
741
+
742
+ - If you get an error with `bs-platform` > `8.3.0` for code looking like this `let ReasonRelay.{data, hasNext} = ...`, just remove `ReasonRelay.` from that code and the error should be gone. Later versions of `bs-platform` now properly infer record destruction, which prior versions did not do.
743
+
744
+ ## Breaking changes
745
+
746
+ - _BREAKING CHANGE_ Replace unsetValue with setValueToUndefined and setValueToNull [#105](https://github.com/zth/reason-relay/pull/105) ([@tsnobip](https://github.com/tsnobip))
747
+ - _BREAKING CHANGE_ Replace `React.useTransition(~config={timeoutMs: 5000}, ())` with `ReactExperimental.unstable_useTransition()` [#121](https://github.com/zth/reason-relay/pull/121) ([@sorenhoyer](https://github.com/sorenhoyer))
748
+ - _BREAKING CHANGE_ Replace `React.useDeferredValue` with `ReactExperimental.unstable_useDeferredValue` [#121](https://github.com/zth/reason-relay/pull/121) ([@sorenhoyer](https://github.com/sorenhoyer))
749
+ - _BREAKING CHANGE_ Replace `ReactDOMRe.Experimental.createRoot` with `ReactDOMExperimental.unstable_createRoot` [#121](https://github.com/zth/reason-relay/pull/121) ([@sorenhoyer](https://github.com/sorenhoyer))
750
+ - _BREAKING CHANGE_ Remove `Query.fetchPromised`. Users can convert the fetch to a promise themselves if needed. ([@zth](https://github.com/zth))
751
+ - _BREAKING CHANGE_ Remove `Mutation.commitMutationPromised`. Users can convert the mutation to a promise themselves if needed. ([@zth](https://github.com/zth))
752
+
753
+ ## New bindings
754
+
755
+ - Bind `Store.publish()`, which allows you to publish a `RecordSource` to your current store. Useful for various SSR cases (think Next.js and similar). ([@zth](https://github.com/zth))
756
+ - Bind `readInlineData` for fragments annotated with `@inline` [#117](https://github.com/zth/reason-relay/pull/117) ([@zth](https://github.com/zth))
757
+ - Clean bindings, renamed internal raw types and functions with names ending with `Raw` [#105](https://github.com/zth/reason-relay/pull/105) ([@tsnobip](https://github.com/tsnobip))
758
+
759
+ ## Fixes & misc
760
+
761
+ - Relay upgraded to `10.1.0` ([@zth](https://github.com/zth))
762
+ - Generate a `commitLocalPayload` for any query annotated with `@raw_response_type`, to allow comitting local only payloads in a type safe way. [#118](https://github.com/zth/reason-relay/pull/118) ([@zth](https://github.com/zth))
763
+ - Use abstract records instead of Js.t objects for a more robust type-check and to avoid undefined fields [#105](https://github.com/zth/reason-relay/pull/105) ([@tsnobip](https://github.com/tsnobip))
764
+ - Add support for parsing ReScript (.res) files [#115](https://github.com/zth/reason-relay/pull/115) ([@sorenhoyer](https://github.com/sorenhoyer))
765
+ - Move a bunch of things from the bindings to the PPX. This will simplify a lot of things, improve the type safety some, and pave the way for some pretty interesting upcoming editor tooling. ([@zth](https://github.com/zth))
766
+ - Remove `internal_cleanVariablesRaw`, since `bs-platform` since `7.3` does what that did by default. ([@zth](https://github.com/zth))
767
+
768
+ # 0.11.0
769
+
770
+ Another release, primarily to enable zero cost enums via `bs-platform` `8.2.0`. No new Relay version, and hopefully a managable amount of breaking changes.
771
+
772
+ [Check out this](https://github.com/zth/reason-relay/commit/7880e10aad73c8f302b5cb2eeef424c6d8fc8368) for an example diff of upgrading a project.
773
+
774
+ ## Upgrade versions
775
+
776
+ - `bs-platform@^8.2.0` Note this _must_ be `8.2.0` as we rely on things from that release.
777
+
778
+ ## Breaking changes
779
+
780
+ - _BREAKING CHANGE_ All enums are now zero cost as `bs-platform` > `8.2.0` models polyvariants without payloads as strings. This does however force us to remove the `FutureAddedValue(string)` case, but it's worth it in the long run.
781
+ _Migration path_: Where you previously matched on `FutureAddedValue(_)`, now instead match on a default `_`. So `FutureAddedValue(_) => ...` becomes `_ => ...`. But hey, maybe you were using that string `FutureAddedValue` provided?! You can still get it, every module with enums will now contain `toString` functions for turning your enum into an actual string. If you have an enum called `OnlineStatus`, your module will have a function like `Fragment.onlineStatus_toString(enumGoesHere)`.
782
+ - _BREAKING CHANGE_ All `getConnectionNodes_path_to_connection` generated functions are now named just `getConnectionNodes`, since Relay only allows a single `@connection` per operation/fragment, which makes name clashes impossible.
783
+ _Migration path_: Rename all calls to `getConnectionNodes_some_path_here` to just `getConnectionNodes`.
784
+ - _BREAKING CHANGE_ All `refetch` functions now properly return a `Disposable.t`.
785
+ _Migration path_: Handle the new return properly, via `let _ = refetch(...)` or `refetch(...)->ignore` for example.
786
+
787
+ ## New bindings
788
+
789
+ No new bindings this release.
790
+
791
+ ## Fixes & misc
792
+
793
+ - Fixed a bug where `fragmentRefs` would produce a circular reference which can't be stringified.
794
+ - Types are now always emitted as recursive, fixing a bug where types wouldn't/can't be printed in the right order.
795
+
796
+ # 0.10.0
797
+
798
+ A new, fresh release! This brings Relay to version `10.0.1`, binds a bunch of new things, and changes a few APIs (and their implementations) to be more ergonomic.
799
+
800
+ I'd like to highlight contributions from [Arnarkari93](https://github.com/Arnarkari93), [tsnobip](https://github.com/tsnobip) and [wokalski](https://github.com/wokalski), who all have made significant and great contributions for this release.
801
+
802
+ [Check out this](https://github.com/zth/reason-relay/commit/8ed636db21a2de5648cc0ff85d2827997a195654) for an example diff of upgrading a project.
803
+
804
+ ## Upgrade versions
805
+
806
+ - `reason-react@^0.9.1`
807
+ - `bs-platform@^8.0.3` (although anything > `7` should work)
808
+ - `react-relay` to `0.0.0-experimental-8058ef82`, the rest of the Relay packages to `10.0.1`
809
+
810
+ ## Breaking changes
811
+
812
+ - Bindings in `ReactExperimental` for `Suspense`, `SuspenseList`, `ConcurrentModeRoot.render`, `createRoot` and `useTransition` have been moved to the official community bindings in [Reason-React](https://github.com/reasonml/reason-react).
813
+ _Migration path_: Change `ReactExperimental` to just `React` for said modules and functions.
814
+ - Fragment refs are now typed through polymorphic variants. Previously, all fragment refs for an object would be retrieved by doing `someObject.getFragmentRefs()`. That call would return a `Js.t` object containing all fragment references, which would then be structurally matched to ensure fragment type safety. This is now replaced with a regular prop called `fragmentRefs` that'll appear on any object with fragments spread. This improves the experience of using fragments immensely.
815
+ _Migration path_: Where you previously did `someObj.getFragmentRefs()` now do `someObj.fragmentRefs` instead.
816
+ - The top level `node` field is now enhanced by a) collapsing the union it was previously typed as if there's only one selection anyway, and b) automatically resolve any existing node from the cache through the `node` root field.
817
+ - `Query.fetch` and `Query.fetchPromised` now need to be applied with `()` unless all args are specified. Two new args have been added: `fetchPolicy`, which controls cache behavior at the store level, and `networkCacheConfig` which controls caching at the network layer.
818
+ _Migration path_: Add a trailing `()` to all `Query.fetch` and `Query.fetchPromised` calls.
819
+ - What was previously called `Query.preload` is now called `Query.load`, to align with Relay's naming. The return type of `Query.load` has also been renamed to `queryRef` (from `preloadToken`), and all names related to that have been changed accordingly.
820
+ _Migration path_: Change all `Query.preload` to `Query.load`.
821
+ - `Observable.make` returns the optional subscription object. The `sink` provided by `Observable` now also has the correct `complete` prop (`completed` -> `complete`). And, `Observable.t` now correctly takes a type param for the `'response`; `Observable.t('response)`.
822
+
823
+ ## New bindings
824
+
825
+ - Add `toPromise` binding for `Observable`, allowing for an easy way of turning an observable into a promise.
826
+ - Bindings for `queryCacheExpirationTime` (setting an expiration time for all cache items in `ms`) when creating the store.
827
+ - Bind `useSubscribeToInvalidationState`, which allows listening and reacting to invalidations of records in the store.
828
+ - Bind and document `Query.useLoader`.
829
+ - Bind `RelayFeatureFlags`.
830
+
831
+ ## Fixes & misc
832
+
833
+ - Cleaned up the bindings to Relay and their interface files to reduce runtime size
834
+ - Fix refetching with pagination when the parent queries have variables that are left unchanged in the refetch
835
+
836
+ # 0.9.2
837
+
838
+ - Automatic conversion of custom scalars! Heavily inspired by the upcoming `graphql_ppx` release which also has this, it's now possible to have ReasonRelay automatically convert your custom scalars at runtime. More info in the docs for custom scalars.
839
+
840
+ # 0.9.1
841
+
842
+ - Fix bug with `bs-platform >7.3.0`.
843
+
844
+ # 0.9.0
845
+
846
+ - _BREAKING CHANGE_ `preload` is now _only_ exposed via the generated module, not via what's generated by the PPX. This is to reduce confusion of which one to use. If you previously used `Query.preload`, you should now use `OperationNameOfYourQuery_graphql.preload`.
847
+ - `preloadToken` can now be converted to an observable _and_ a promise. This is paving the way for doing SSR efficiently.
848
+ - Fragments can now be on unions, which previously wasn't supported in ReasonRelay (but has always been valid in Relay itself). Thanks to [Arnar Kári Ágústsson](https://github.com/Arnarkari93) for finding this!
849
+ - _BREAKING CHANGE_ All variants of doing mutations will no longer get an optional `'response` in its `onComplete` handlers (or in the `Belt.Result.t` for `commitMutationPromised`). Thanks to [Renan](https://github.com/renanmav) for finding this issue, and for the initial fix.
850
+ - Fragments now have a `Fragment.useOpt` that take an _optional_ fragment ref object, and returns an _optional_ `'fragment`. This is useful for scenarios where you haven't fetched data for a fragment yet, but it still makes sense to have the fragment hook present in your render body. Pass `None` to `Fragment.useOpt` and you'll get `None` back.
851
+
852
+ # 0.8.3
853
+
854
+ - `preload` for queries are now exposed right on the raw generated GraphQL module coming from the Relay compiler, in addition to on the module generated from the PPX. This primarily paves the way for effective code splitting.
855
+
856
+ # 0.8.2
857
+
858
+ - Fix subscriptions function bindings, which was previously wrong (thanks @
859
+ Arnarkari93 !)
860
+ - Fix bug when input objects contain circular dependencies.
861
+
862
+ # 0.8.1
863
+
864
+ - Fix "unused varible this" warning introduced in `0.8.0`.
865
+
866
+ # 0.8.0
867
+
868
+ - Enum + union definitions are now also inlined in the record they appear, to improve editor integrations/hints in the editor.
869
+ - _BREAKING CHANGE_ Tons of changes to APIs for interacting with the store. Too many to list, but they're mostly about changing APIs taking `options` to allow omitting the optional prop if you apply the function with `()`.
870
+ - _BREAKING CHANGE_ All generated types now reside in `YourModule.Types` and are named according to at what path they were found. This includes unions as well. So, if you were previously relying on using the generated types manually for annotation, you can now find them all inside of `YourModule.Types`, named after the path in the fragment/operation where they are located.
871
+ - A promise based version of `Query.fetch` called `fetchPromised` added. Also a promise based version of `Mutation.commitMutation` called `commitMutationPromised` added.
872
+ - `commitMutation` result type changed to the actual `'response` rather than `Js.Json.t`. However, this is actually unsafe, because `'response` _may_ have been altered by the `updater` of the mutation. However, this case is so uncommon that it's better to support the broad use case of accessing the actual `'response` in the complete handler.
873
+ - `reason-promise` is now a peer dependency.
874
+
875
+ # 0.7.0
876
+
877
+ - _BREAKING CHANGE_ `SchemaAssets.re` has been retired. If you were relying on code from there for converting enums to/from strings, you can now find equivalent functions attached on your `ModuleName.Operation.unwrap_enum_EnumName` (for string -> polymorphic variant) and `ModuleName.Operation.wrap_enum_EnumName` (polymorphic variant -> string). You may need to remove the old `SchemaAssets.re` manually.
878
+ - _BREAKING CHANGE_ `commitMutation` no longer returns a promise, but a `Disposable.t` instead. It now uses callbacks (which is how Relay handles this natively anyway) `onCompleted` and `onError` to indicate done/error states.
879
+ - _BREAKING CHANGE_ The `fetch` function generated by `[%relay.query]` no longer returns a promise, but rather uses a new callback `onResult` to deliver the result as a proper `Result.t`. If you previously did `Query.fetch(~environment, ~variables=...) |> Js.Promise.then_(res => ...)` you should now do `Query.fetch(~environment, ~variables=..., ~onResult=res => switch(res) { | Ok(res) => ... | Error(_) => ... })` and handle `Result.t` accordingly. This is part of an ongoing effort to remove the dependencies on promises, and to improve type inference which wasn't working out here before.
880
+ - _BREAKING CHANGE_ `FutureAddedValue(Js.Json.t)` for unions/interfaces is now `UnselectedUnionMember(string)` where `string` is the `__typename`, because... well, this makes more sense.
881
+
882
+ # 0.6.0
883
+
884
+ - Rename object properties if reserved words are encountered. E.g. `input SomeGraphQLInput { and: String! }` will now produce this type: `type someGraphQLInput = { [@bs.as "and"] and_: string }`.
885
+ - Emit maker functions for any input object with at least one optional prop. This is to greatly simplify working with complex input objects with lots of properties.
886
+ - Fix bug with `null` inputs wouldn't be properly filtered when refetching connections.
887
+ - _BREAKING CHANGE_ Rename unknown enum and union values to `FutureAddedValue(payload)` to align with convention discussed with the folks behind `graphql_ppx`.
888
+ - _BREAKING CHANGE_ Bind `RenderPolicy` for control over whether Relay is allowed to partially render the UI with the data it already has while fetching. This is a breaking change because it changes the signature for `Query.usePreloaded` from `usePreloaded(token)` to `usePreloaded(~token: token, ~renderPolicy: renderPolicy=?, ())`.
889
+ - Bind APIs for invalidating store records and the full store for forcing refetches etc. `RecordProxy.invalidateRecord` and `RecordSourceProxy.invalidateStore`.
890
+ - Bind `useMutation` from Relay experimental, giving us a cleaner and nicer hooks based API for doing mutations, rather than just `commitMutation`.
891
+ - _POTENTIALLY BREAKING CHANGE_ All record types for all GraphQL operations are now emitted with their name as the path they're found at joined together. Previously, I was being smart and setting the name to the simplest possible, but this will enable some smart tooling down the line.
892
+
893
+ # 0.5.3
894
+
895
+ - Fix bug where complex inputs (nested objects) were not automatically converted.
896
+ - `RecordProxy` now has functions for unsetting values `unsetValue/unsetLinkedRecord/unsetLinkedRecords`, for more fine-grained control of the cache.
897
+
898
+ # 0.5.2
899
+
900
+ - Inlines enum definition in generated files to improve code lens/view definition in editors. Previously, all that would show up when hovering an enum would be `SchemaAssets.Enum_enumName.t`, but now the full enum definition will show. This will work fine with `SchemaAssets` since polymorphic variants match structurally, so the definitions will be equivalent.
901
+ - Inlines union definition and references that in the local types, for the same reason as enums - improving code lens/view definition.
902
+ - Autogenerate helper function for turning a @connection into an array of nodes. This replaces the functionality of the previous `ReasonRelayUtils.collectConnectionNodes` that's no longer usable after moving from `Js.t` to records.
903
+ - _BREAKING CHANGE_ Move from manually unwrapping fragments via a unique function per record (Like `user->Fragment.unwrapFragment_user`) to instead using a function to each record called `getFragmentRefs()` that extracts the fragments refs needed. This means `user->Fragment.unwrapFragment_user` is now instead simply `user.getFragmentRefs()`. Should be much more ergonomic, and hopefully make more sense.
904
+
905
+ # 0.5.1
906
+
907
+ - Fix nasty bug with new record types generation and autodecoding where things nested inside of unions would not be autodecoded.
908
+
909
+ # 0.5.0
910
+
911
+ - Adds validation for illegal field names (reserved words and capitalized words are illegal as field names in Reason) to the Relay compiler.
912
+ - Moves validation of explicit `__typename` selection to Relay compiler, from the PPX.
913
+ - Upgrade to BuckleScript 7, and convert lots of things to use records instead of `Js.t` under the hood.
914
+ - _BREAKING CHANGE_ Add `'response` as second parameter to mutation/subscription `updater` functions. This was simply not bound before in ReasonRelay, but Relay has always provided it.
915
+ - _BREAKING CHANGE_ Change signature of `loadNext` / `loadPrevious` pagination functions to follow the convention of providing only the arguments wanted and applying the function manually via `unit`. This: `loadNext(~count=2, ~onComplete=None)` will now instead be applied like `loadNext(~count=2, ())`.
916
+ - _BREAKING CHANGE_ Replace module `SuspenseConfig` with simple record `suspenseConfig`.
917
+ - _BREAKING CHANGE_ Bump Relay versions to `8.0.0` and `react-relay` to `0.0.0-experimental-5f1cb628`.
918
+ - Fix bug with unused generated files not being deleted by the Relay compiler.
919
+ - Bind `generateClientID`, `generateUniqueClientID` and `isClientID` helpers.
920
+ - _SUPER BREAKING CHANGE_ All emitted types are now _records_ instead of _Js.t_, and `Js.Nullable.t`/enums/unions are now autoconverted with _no manual intervention needed_. This should _greatly_ simplify working with ReasonRelay.
921
+ - _BREAKING CHANGE_ Remove `collectConnectionNodes` from `ReasonRelayUtils`, since it operated on `Js.t` and nothing is typed as `Js.t` anymore.
922
+
923
+ # 0.4.4
924
+
925
+ - Moved `ReactSuspenseConfig` module to `ReactExperimental` and renamed it to simply `SuspenseConfig`.
926
+ - Added abstract type `recordSourceRecords` to represent the records from the store serialized to a saveable format.
927
+ - Allow passing initial `recordSourceRecords` to `RecordSource.make()`.
928
+ - Add full chain of methods needed to serialize the records from the store of the current environment, like: `environment->Environment.getStore->Store.getSource->RecordSource.toJSON`.
929
+
930
+ ## 0.4.3
931
+
932
+ - _BREAKING CHANGE_ Added `gcReleaseBufferSize` to creation of store, which is breaking because it turns the signature for `make` from `RecordSource.t => t` to `(~source: RecordSource.t, ~gcReleaseBufferSize: option(int), ()) => t`.
933
+
934
+ ## 0.4.2
935
+
936
+ - `ReactExperimental` is now included in the distributed package.
937
+
938
+ ## 0.4.1
939
+
940
+ - ReasonRelay now depends on `react@experimental` and `react-dom@experimental`.
941
+ - Added `useTransition`, `useDeferredValue`, `<Suspense />`, `<SuspenseList />`, `createRoot` and `createRootAtElementWithId` experimental API bindings to `ReactExperimental`.
942
+ - Added `ReactExperimental` module for binding experimental React APIs.