rescript-relay 2.0.0 → 3.0.0-alpha.1

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.
@@ -53,7 +53,7 @@ external unwrapUploadables: uploadables => Js.Dict.t<'file> = "%identity"
53
53
 
54
54
  /**This generates a `dataId` for use on the _client_ side. However, this is farily low level, and what you're probably really looking for is `generateUniqueClientID` that'll let you generate a new, unique `dataId` that you can use for client side only records (like when doing optimistic updates).*/
55
55
  @module("relay-runtime")
56
- external generateClientID: (~dataId: dataId, ~storageKey: string, ~index: int=?, unit) => dataId =
56
+ external generateClientID: (~dataId: dataId, ~storageKey: string, ~index: int=?) => dataId =
57
57
  "generateClientID"
58
58
 
59
59
  /**This generates a unique `dataId` that's safe to use on the _client_ side. Useful when doing optimistic updates and you need to create IDs that the optimistic update can use.*/
@@ -139,16 +139,11 @@ module RecordProxy: {
139
139
  /**Gets a single linked record. A linked record is another object in the store, and not a scalar field like an int or float.*/
140
140
  @send
141
141
  @return(nullable)
142
- external getLinkedRecord: (t, ~name: string, ~arguments: arguments=?, unit) => option<t> =
142
+ external getLinkedRecord: (t, ~name: string, ~arguments: arguments=?) => option<t> =
143
143
  "getLinkedRecord"
144
144
 
145
145
  /**Gets an array of linked records, for when a field is a list (meaning a link to multiple records).*/
146
- let getLinkedRecords: (
147
- t,
148
- ~name: string,
149
- ~arguments: arguments=?,
150
- unit,
151
- ) => option<array<option<t>>>
146
+ let getLinkedRecords: (t, ~name: string, ~arguments: arguments=?) => option<array<option<t>>>
152
147
 
153
148
  /**This returns an existing linked record, or creates one at the configured place if one does not already exist.*/
154
149
  @send
@@ -157,7 +152,6 @@ module RecordProxy: {
157
152
  ~name: string,
158
153
  ~typeName: string,
159
154
  ~arguments: arguments=?,
160
- unit,
161
155
  ) => t = "getOrCreateLinkedRecord"
162
156
 
163
157
  /**Returns the `__typename` of this particular record.*/
@@ -167,7 +161,7 @@ module RecordProxy: {
167
161
  /**Returns a field value, expecting it to be a string.*/
168
162
  @send
169
163
  @return(nullable)
170
- external getValueString: (t, ~name: string, ~arguments: arguments=?, unit) => option<string> =
164
+ external getValueString: (t, ~name: string, ~arguments: arguments=?) => option<string> =
171
165
  "getValue"
172
166
 
173
167
  /**Returns a field value, expecting it to be an array of strings.*/
@@ -177,14 +171,12 @@ module RecordProxy: {
177
171
  t,
178
172
  ~name: string,
179
173
  ~arguments: arguments=?,
180
- unit,
181
174
  ) => option<array<option<string>>> = "getValue"
182
175
 
183
176
  /**Returns a field value, expecting it to be an int.*/
184
177
  @send
185
178
  @return(nullable)
186
- external getValueInt: (t, ~name: string, ~arguments: arguments=?, unit) => option<int> =
187
- "getValue"
179
+ external getValueInt: (t, ~name: string, ~arguments: arguments=?) => option<int> = "getValue"
188
180
 
189
181
  /**Returns a field value, expecting it to be an array of ints.*/
190
182
  @send
@@ -193,14 +185,12 @@ module RecordProxy: {
193
185
  t,
194
186
  ~name: string,
195
187
  ~arguments: arguments=?,
196
- unit,
197
188
  ) => option<array<option<int>>> = "getValue"
198
189
 
199
190
  /**Returns a field value, expecting it to be a float.*/
200
191
  @send
201
192
  @return(nullable)
202
- external getValueFloat: (t, ~name: string, ~arguments: arguments=?, unit) => option<float> =
203
- "getValue"
193
+ external getValueFloat: (t, ~name: string, ~arguments: arguments=?) => option<float> = "getValue"
204
194
 
205
195
  /**Returns a field value, expecting it to be an array of floats.*/
206
196
  @send
@@ -209,14 +199,12 @@ module RecordProxy: {
209
199
  t,
210
200
  ~name: string,
211
201
  ~arguments: arguments=?,
212
- unit,
213
202
  ) => option<array<option<float>>> = "getValue"
214
203
 
215
204
  /**Returns a field value, expecting it to be a boolean.*/
216
205
  @send
217
206
  @return(nullable)
218
- external getValueBool: (t, ~name: string, ~arguments: arguments=?, unit) => option<bool> =
219
- "getValue"
207
+ external getValueBool: (t, ~name: string, ~arguments: arguments=?) => option<bool> = "getValue"
220
208
 
221
209
  /**Returns a field value, expecting it to be an array of booleans.*/
222
210
  @send
@@ -225,12 +213,11 @@ module RecordProxy: {
225
213
  t,
226
214
  ~name: string,
227
215
  ~arguments: arguments=?,
228
- unit,
229
216
  ) => option<array<option<bool>>> = "getValue"
230
217
 
231
218
  /**Sets a `RecordProxy.t` as the linked record for a particular field.*/
232
219
  @send
233
- external setLinkedRecord: (t, ~record: t, ~name: string, ~arguments: arguments=?, unit) => t =
220
+ external setLinkedRecord: (t, ~record: t, ~name: string, ~arguments: arguments=?) => t =
234
221
  "setLinkedRecord"
235
222
 
236
223
  /**Sets an array of `RecordProxy.t` as the linked records for a particular field.*/
@@ -240,12 +227,11 @@ module RecordProxy: {
240
227
  ~records: array<option<t>>,
241
228
  ~name: string,
242
229
  ~arguments: arguments=?,
243
- unit,
244
230
  ) => t = "setLinkedRecords"
245
231
 
246
232
  /**Sets a string as field value.*/
247
233
  @send
248
- external setValueString: (t, ~value: string, ~name: string, ~arguments: arguments=?, unit) => t =
234
+ external setValueString: (t, ~value: string, ~name: string, ~arguments: arguments=?) => t =
249
235
  "setValue"
250
236
 
251
237
  /**Sets an array of strings as field value.*/
@@ -255,27 +241,20 @@ module RecordProxy: {
255
241
  ~value: array<string>,
256
242
  ~name: string,
257
243
  ~arguments: arguments=?,
258
- unit,
259
244
  ) => t = "setValue"
260
245
 
261
246
  /**Sets an int as field value.*/
262
247
  @send
263
- external setValueInt: (t, ~value: int, ~name: string, ~arguments: arguments=?, unit) => t =
264
- "setValue"
248
+ external setValueInt: (t, ~value: int, ~name: string, ~arguments: arguments=?) => t = "setValue"
265
249
 
266
250
  /**Sets an array of ints as field value.*/
267
251
  @send
268
- external setValueIntArray: (
269
- t,
270
- ~value: array<int>,
271
- ~name: string,
272
- ~arguments: arguments=?,
273
- unit,
274
- ) => t = "setValue"
252
+ external setValueIntArray: (t, ~value: array<int>, ~name: string, ~arguments: arguments=?) => t =
253
+ "setValue"
275
254
 
276
255
  /**Sets a float as field value.*/
277
256
  @send
278
- external setValueFloat: (t, ~value: float, ~name: string, ~arguments: arguments=?, unit) => t =
257
+ external setValueFloat: (t, ~value: float, ~name: string, ~arguments: arguments=?) => t =
279
258
  "setValue"
280
259
 
281
260
  /**Sets an array of floats as field value.*/
@@ -285,13 +264,11 @@ module RecordProxy: {
285
264
  ~value: array<float>,
286
265
  ~name: string,
287
266
  ~arguments: arguments=?,
288
- unit,
289
267
  ) => t = "setValue"
290
268
 
291
269
  /**Sets a boolean as field value.*/
292
270
  @send
293
- external setValueBool: (t, ~value: bool, ~name: string, ~arguments: arguments=?, unit) => t =
294
- "setValue"
271
+ external setValueBool: (t, ~value: bool, ~name: string, ~arguments: arguments=?) => t = "setValue"
295
272
 
296
273
  /**Sets an array of booleans as field value.*/
297
274
  @send
@@ -300,7 +277,6 @@ module RecordProxy: {
300
277
  ~value: array<bool>,
301
278
  ~name: string,
302
279
  ~arguments: arguments=?,
303
- unit,
304
280
  ) => t = "setValue"
305
281
 
306
282
  /**Sets the field value to `undefined` (meaning Relay will treat it as missing data).*/
@@ -310,18 +286,12 @@ module RecordProxy: {
310
286
  @as(json`undefined`) _,
311
287
  ~name: string,
312
288
  ~arguments: arguments=?,
313
- unit,
314
289
  ) => t = "setValue"
315
290
 
316
291
  /**Sets the field value to `null`.*/
317
292
  @send
318
- external setValueToNull: (
319
- t,
320
- @as(json`null`) _,
321
- ~name: string,
322
- ~arguments: arguments=?,
323
- unit,
324
- ) => t = "setValue"
293
+ external setValueToNull: (t, @as(json`null`) _, ~name: string, ~arguments: arguments=?) => t =
294
+ "setValue"
325
295
 
326
296
  /**Sets this linked record to `undefined` (meaning Relay will treat it as missing data).*/
327
297
  @send
@@ -330,7 +300,6 @@ module RecordProxy: {
330
300
  @as(json`undefined`) _,
331
301
  ~name: string,
332
302
  ~arguments: arguments=?,
333
- unit,
334
303
  ) => t = "setValue"
335
304
 
336
305
  /**Sets this linked record to `null`.*/
@@ -340,7 +309,6 @@ module RecordProxy: {
340
309
  @as(json`null`) _,
341
310
  ~name: string,
342
311
  ~arguments: arguments=?,
343
- unit,
344
312
  ) => t = "setValue"
345
313
 
346
314
  /**Sets the field holding these linked records to `undefined` (meaning Relay will treat it as missing data).*/
@@ -350,7 +318,6 @@ module RecordProxy: {
350
318
  @as(json`undefined`) _,
351
319
  ~name: string,
352
320
  ~arguments: arguments=?,
353
- unit,
354
321
  ) => t = "setValue"
355
322
 
356
323
  /**Sets the field holding these linked records to `null`.*/
@@ -360,7 +327,6 @@ module RecordProxy: {
360
327
  @as(json`null`) _,
361
328
  ~name: string,
362
329
  ~arguments: arguments=?,
363
- unit,
364
330
  ) => t = "setValue"
365
331
 
366
332
  /**Invalidates this record.
@@ -518,7 +484,6 @@ module ConnectionHandler: {
518
484
  ~record: RecordProxy.t,
519
485
  ~key: string,
520
486
  ~filters: arguments=?,
521
- unit,
522
487
  ) => option<RecordProxy.t> = "getConnection"
523
488
 
524
489
  /**Creates an edge for a particular connection.*/
@@ -538,7 +503,6 @@ module ConnectionHandler: {
538
503
  ~connection: RecordProxy.t,
539
504
  ~newEdge: RecordProxy.t,
540
505
  ~cursor: string=?,
541
- unit,
542
506
  ) => unit = "insertEdgeBefore"
543
507
 
544
508
  /**Inserts an edge into a connection _after_ the provided cursor. If no cursor is provided, it inserts the edge at the end of the connection list.*/
@@ -548,7 +512,6 @@ module ConnectionHandler: {
548
512
  ~connection: RecordProxy.t,
549
513
  ~newEdge: RecordProxy.t,
550
514
  ~cursor: string=?,
551
- unit,
552
515
  ) => unit = "insertEdgeAfter"
553
516
 
554
517
  /**Deletes any edge from the connection where the node of the edge has the provided `dataId`. Please not that this _will not_ remove the actual node from the store. Use `RecordSourceSelectorProxy.delete` for that.*/
@@ -600,7 +563,6 @@ module Observable: {
600
563
  ~error: Js.Exn.t => unit=?,
601
564
  ~complete: unit => unit=?,
602
565
  ~unsubscribe: subscription => unit=?,
603
- unit,
604
566
  ) => observer<'response> = ""
605
567
 
606
568
  /**Create a new observable, getting fed an `Observable.sink` for interacting with the observable, and optionally returning a `Observable.subscription` if you have things you want to unsubscribe from as the observable closes.*/
@@ -657,7 +619,6 @@ module Network: {
657
619
  external makePromiseBased: (
658
620
  ~fetchFunction: fetchFunctionPromise,
659
621
  ~subscriptionFunction: subscribeFn=?,
660
- unit,
661
622
  ) => t = "create"
662
623
 
663
624
  /**Create a new `NetworkLayer` using a fetch function that returns an `Observable`.*/
@@ -666,7 +627,6 @@ module Network: {
666
627
  external makeObservableBased: (
667
628
  ~observableFunction: fetchFunctionObservable,
668
629
  ~subscriptionFunction: subscribeFn=?,
669
- unit,
670
630
  ) => t = "create"
671
631
  }
672
632
 
@@ -678,7 +638,7 @@ module RecordSource: {
678
638
  /**Create a new `RecordSource`. Here's where you pass an existing `recordSourceRecords` if you have existing records you want to hydrate the store with, when doing SSR or similar.*/
679
639
  @module("relay-runtime")
680
640
  @new
681
- external make: (~records: recordSourceRecords=?, unit) => t = "RecordSource"
641
+ external make: (~records: recordSourceRecords=?) => t = "RecordSource"
682
642
 
683
643
  /**Serializes the `RecordSource` into `recordSourceRecords` that you can use to rehydrate another store. Typically used for SSR.*/
684
644
  @send
@@ -695,9 +655,9 @@ module Store: {
695
655
  ~source: RecordSource.t,
696
656
  ~gcReleaseBufferSize: /* `gcReleaseBufferSize` controls how many queries are allowed to be cached by default. Increase this to increase the size of the cache. */
697
657
  int=?,
698
- ~queryCacheExpirationTime: int=? /* `queryCacheExpirationTime` sets a TTL (time to live) for all queries. If that time passes, the data is considered stale and is evicted from the store. Default is no TTL. */,
699
- unit,
700
- ) => t
658
+ ~queryCacheExpirationTime: int=?,
659
+ ) => /* `queryCacheExpirationTime` sets a TTL (time to live) for all queries. If that time passes, the data is considered stale and is evicted from the store. Default is no TTL. */
660
+ t
701
661
 
702
662
  /**Gets the `RecordSource` for this `Store`.*/
703
663
  @send
@@ -752,7 +712,6 @@ module Environment: {
752
712
  ~missingFieldHandlers: array<MissingFieldHandler.t>=?,
753
713
  ~requiredFieldLogger: RequiredFieldLogger.t=?,
754
714
  ~isServer: bool=?,
755
- unit,
756
715
  ) => t
757
716
 
758
717
  /**Get the `Store` for this `Environment`.*/
@@ -862,7 +821,6 @@ module MakeLoadQuery: (C: MakeLoadQueryConfig) =>
862
821
  ~fetchPolicy: fetchPolicy=?,
863
822
  ~fetchKey: string=?,
864
823
  ~networkCacheConfig: cacheConfig=?,
865
- unit,
866
824
  ) => C.loadedQueryRef
867
825
 
868
826
  let queryRefToObservable: C.loadedQueryRef => option<Observable.t<C.response>>
@@ -14,7 +14,7 @@ let resolveNestedRecord = (
14
14
  let currentPath = path->Belt.List.get(i)
15
15
  switch (currentRecord.contents, currentPath) {
16
16
  | (Some(record), Some(currentPath)) =>
17
- currentRecord := record->RescriptRelay.RecordProxy.getLinkedRecord(~name=currentPath, ())
17
+ currentRecord := record->RescriptRelay.RecordProxy.getLinkedRecord(~name=currentPath)
18
18
  | _ => currentRecord := None
19
19
  }
20
20
  }
@@ -58,7 +58,6 @@ let removeNodeFromConnections = (~store, ~node, ~connections) =>
58
58
  ~record=owner,
59
59
  ~key=connectionConfig.key,
60
60
  ~filters=?connectionConfig.filters,
61
- (),
62
61
  ) {
63
62
  | Some(connection) =>
64
63
  ConnectionHandler.deleteNode(~connection, ~nodeId=node->RecordProxy.getDataId)
@@ -76,13 +75,12 @@ let createAndAddEdgeToConnections = (~store, ~node, ~connections, ~edgeName, ~in
76
75
  ~record=connectionOwner,
77
76
  ~key=connectionConfig.key,
78
77
  ~filters=?connectionConfig.filters,
79
- (),
80
78
  ) {
81
79
  | Some(connection) =>
82
80
  let edge = ConnectionHandler.createEdge(~store, ~connection, ~node, ~edgeType=edgeName)
83
81
  switch insertAt {
84
- | Start => ConnectionHandler.insertEdgeAfter(~connection, ~newEdge=edge, ())
85
- | End => ConnectionHandler.insertEdgeBefore(~connection, ~newEdge=edge, ())
82
+ | Start => ConnectionHandler.insertEdgeAfter(~connection, ~newEdge=edge)
83
+ | End => ConnectionHandler.insertEdgeBefore(~connection, ~newEdge=edge)
86
84
  }
87
85
  | None => ()
88
86
  }
@@ -38,14 +38,14 @@ function usePaginationFragment(node, fRef, convertFragment, convertRefetchVariab
38
38
  return {
39
39
  data: data,
40
40
  loadNext: React.useMemo((function () {
41
- return function (count, onComplete, param) {
41
+ return function (count, onComplete) {
42
42
  return p.loadNext(count, {
43
43
  onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
44
44
  });
45
45
  };
46
46
  }), [p.loadNext]),
47
47
  loadPrevious: React.useMemo((function () {
48
- return function (count, onComplete, param) {
48
+ return function (count, onComplete) {
49
49
  return p.loadPrevious(count, {
50
50
  onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
51
51
  });
@@ -56,7 +56,7 @@ function usePaginationFragment(node, fRef, convertFragment, convertRefetchVariab
56
56
  isLoadingNext: p.isLoadingNext,
57
57
  isLoadingPrevious: p.isLoadingPrevious,
58
58
  refetch: React.useMemo((function () {
59
- return function (variables, fetchPolicy, onComplete, param) {
59
+ return function (variables, fetchPolicy, onComplete) {
60
60
  return p.refetch(RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(convertRefetchVariables(variables)), internal_makeRefetchableFnOpts(fetchPolicy, onComplete, undefined));
61
61
  };
62
62
  }), [p.refetch])
@@ -69,14 +69,14 @@ function useBlockingPaginationFragment(node, fRef, convertFragment, convertRefet
69
69
  return {
70
70
  data: data,
71
71
  loadNext: React.useMemo((function () {
72
- return function (count, onComplete, param) {
72
+ return function (count, onComplete) {
73
73
  return p.loadNext(count, {
74
74
  onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
75
75
  });
76
76
  };
77
77
  }), [p.loadNext]),
78
78
  loadPrevious: React.useMemo((function () {
79
- return function (count, onComplete, param) {
79
+ return function (count, onComplete) {
80
80
  return p.loadPrevious(count, {
81
81
  onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
82
82
  });
@@ -85,7 +85,7 @@ function useBlockingPaginationFragment(node, fRef, convertFragment, convertRefet
85
85
  hasNext: p.hasNext,
86
86
  hasPrevious: p.hasPrevious,
87
87
  refetch: React.useMemo((function () {
88
- return function (variables, fetchPolicy, onComplete, param) {
88
+ return function (variables, fetchPolicy, onComplete) {
89
89
  return p.refetch(RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(convertRefetchVariables(variables)), internal_makeRefetchableFnOpts(fetchPolicy, onComplete, undefined));
90
90
  };
91
91
  }), [p.refetch])
@@ -99,7 +99,7 @@ function useRefetchableFragment(node, convertFragment, convertRefetchVariables,
99
99
  return [
100
100
  data,
101
101
  React.useMemo((function () {
102
- return function (variables, fetchPolicy, onComplete, param) {
102
+ return function (variables, fetchPolicy, onComplete) {
103
103
  return refetchFn(RescriptRelay_Internal.internal_removeUndefinedAndConvertNullsRaw(convertRefetchVariables(variables)), internal_makeRefetchableFnOpts(fetchPolicy, onComplete, undefined));
104
104
  };
105
105
  }), [refetchFn])
@@ -63,11 +63,7 @@ let internal_makeRefetchableFnOpts = (~fetchPolicy=?, ~onComplete=?, ()) => {
63
63
  }
64
64
 
65
65
  type paginationLoadMoreOptions = {onComplete?: Js.Nullable.t<Js.Exn.t> => unit}
66
- type paginationLoadMoreFn = (
67
- ~count: int,
68
- ~onComplete: option<Js.Exn.t> => unit=?,
69
- unit,
70
- ) => Disposable.t
66
+ type paginationLoadMoreFn = (~count: int, ~onComplete: option<Js.Exn.t> => unit=?) => Disposable.t
71
67
  type paginationFragmentReturnRaw<'fragment, 'refetchVariables> = {
72
68
  data: 'fragment,
73
69
  loadNext: (int, paginationLoadMoreOptions) => Disposable.t,
@@ -88,7 +84,6 @@ type paginationBlockingFragmentReturn<'fragment, 'refetchVariables> = {
88
84
  ~variables: 'refetchVariables,
89
85
  ~fetchPolicy: fetchPolicy=?,
90
86
  ~onComplete: option<Js.Exn.t> => unit=?,
91
- unit,
92
87
  ) => Disposable.t,
93
88
  }
94
89
  type paginationFragmentReturn<'fragment, 'refetchVariables> = {
@@ -103,7 +98,6 @@ type paginationFragmentReturn<'fragment, 'refetchVariables> = {
103
98
  ~variables: 'refetchVariables,
104
99
  ~fetchPolicy: fetchPolicy=?,
105
100
  ~onComplete: option<Js.Exn.t> => unit=?,
106
- unit,
107
101
  ) => Disposable.t,
108
102
  }
109
103
 
@@ -127,13 +121,13 @@ let usePaginationFragment = (
127
121
  let data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, p.data)
128
122
  {
129
123
  data,
130
- loadNext: React.useMemo1(() => (~count, ~onComplete=?, ()) => {
124
+ loadNext: React.useMemo1(() => (~count, ~onComplete=?) => {
131
125
  p.loadNext(
132
126
  count,
133
127
  {onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler},
134
128
  )
135
129
  }, [p.loadNext]),
136
- loadPrevious: React.useMemo1(() => (~count, ~onComplete=?, ()) => {
130
+ loadPrevious: React.useMemo1(() => (~count, ~onComplete=?) => {
137
131
  p.loadPrevious(
138
132
  count,
139
133
  {onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler},
@@ -143,7 +137,7 @@ let usePaginationFragment = (
143
137
  hasPrevious: p.hasPrevious,
144
138
  isLoadingNext: p.isLoadingNext,
145
139
  isLoadingPrevious: p.isLoadingPrevious,
146
- refetch: React.useMemo1(() => (~variables, ~fetchPolicy=?, ~onComplete=?, ()) => {
140
+ refetch: React.useMemo1(() => (~variables, ~fetchPolicy=?, ~onComplete=?) => {
147
141
  p.refetch(
148
142
  RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(
149
143
  variables->convertRefetchVariables,
@@ -173,13 +167,13 @@ let useBlockingPaginationFragment = (
173
167
  let data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, p.data)
174
168
  {
175
169
  data,
176
- loadNext: React.useMemo1(() => (~count, ~onComplete=?, ()) => {
170
+ loadNext: React.useMemo1(() => (~count, ~onComplete=?) => {
177
171
  p.loadNext(
178
172
  count,
179
173
  {onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler},
180
174
  )
181
175
  }, [p.loadNext]),
182
- loadPrevious: React.useMemo1(() => (~count, ~onComplete=?, ()) => {
176
+ loadPrevious: React.useMemo1(() => (~count, ~onComplete=?) => {
183
177
  p.loadPrevious(
184
178
  count,
185
179
  {onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler},
@@ -187,7 +181,7 @@ let useBlockingPaginationFragment = (
187
181
  }, [p.loadPrevious]),
188
182
  hasNext: p.hasNext,
189
183
  hasPrevious: p.hasPrevious,
190
- refetch: React.useMemo1(() => (~variables, ~fetchPolicy=?, ~onComplete=?, ()) => {
184
+ refetch: React.useMemo1(() => (~variables, ~fetchPolicy=?, ~onComplete=?) => {
191
185
  p.refetch(
192
186
  RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(
193
187
  variables->convertRefetchVariables,
@@ -226,7 +220,7 @@ let useRefetchableFragment = (
226
220
  (
227
221
  data,
228
222
  React.useMemo1(
229
- () => (~variables: 'refetchVariables, ~fetchPolicy=?, ~onComplete=?, ()) =>
223
+ () => (~variables: 'refetchVariables, ~fetchPolicy=?, ~onComplete=?) =>
230
224
  refetchFn(
231
225
  RescriptRelay_Internal.internal_removeUndefinedAndConvertNullsRaw(
232
226
  variables->convertRefetchVariables,
@@ -20,11 +20,7 @@ let readInlineData: (
20
20
 
21
21
  type paginationLoadMoreOptions = {onComplete?: Js.Nullable.t<Js.Exn.t> => unit}
22
22
 
23
- type paginationLoadMoreFn = (
24
- ~count: int,
25
- ~onComplete: option<Js.Exn.t> => unit=?,
26
- unit,
27
- ) => Disposable.t
23
+ type paginationLoadMoreFn = (~count: int, ~onComplete: option<Js.Exn.t> => unit=?) => Disposable.t
28
24
 
29
25
  type paginationBlockingFragmentReturn<'fragment, 'refetchVariables> = {
30
26
  data: 'fragment,
@@ -36,7 +32,6 @@ type paginationBlockingFragmentReturn<'fragment, 'refetchVariables> = {
36
32
  ~variables: 'refetchVariables,
37
33
  ~fetchPolicy: fetchPolicy=?,
38
34
  ~onComplete: option<Js.Exn.t> => unit=?,
39
- unit,
40
35
  ) => Disposable.t,
41
36
  }
42
37
 
@@ -52,7 +47,6 @@ type paginationFragmentReturn<'fragment, 'refetchVariables> = {
52
47
  ~variables: 'refetchVariables,
53
48
  ~fetchPolicy: fetchPolicy=?,
54
49
  ~onComplete: option<Js.Exn.t> => unit=?,
55
- unit,
56
50
  ) => Disposable.t,
57
51
  }
58
52
 
@@ -81,6 +75,5 @@ let useRefetchableFragment: (
81
75
  ~variables: 'refetchVariables,
82
76
  ~fetchPolicy: fetchPolicy=?,
83
77
  ~onComplete: option<Js.Exn.t> => unit=?,
84
- unit,
85
78
  ) => Disposable.t,
86
79
  )
@@ -68,8 +68,22 @@ function internal_nullableToOptionalExnHandler(x) {
68
68
 
69
69
  }
70
70
 
71
+ var unwrapUnion = (function unwrapUnion(union, members) {
72
+ if (union != null && members.indexOf(union.__typename) === -1) {
73
+ return Object.assign({}, union, {__typename: "__unselected"});
74
+ }
75
+
76
+ return union;
77
+ });
78
+
79
+ function wrapUnion(union) {
80
+ return union;
81
+ }
82
+
71
83
  exports.internal_useConvertedValue = internal_useConvertedValue;
72
84
  exports.internal_cleanObjectFromUndefinedRaw = internal_cleanObjectFromUndefinedRaw;
73
85
  exports.internal_removeUndefinedAndConvertNullsRaw = internal_removeUndefinedAndConvertNullsRaw;
74
86
  exports.internal_nullableToOptionalExnHandler = internal_nullableToOptionalExnHandler;
87
+ exports.unwrapUnion = unwrapUnion;
88
+ exports.wrapUnion = wrapUnion;
75
89
  /* react Not a pure module */
@@ -35,3 +35,15 @@ let internal_nullableToOptionalExnHandler = x =>
35
35
  }
36
36
 
37
37
  @live @unboxed type rec arg = Arg(_): arg
38
+
39
+ let unwrapUnion: ('a, array<string>) => 'a = %raw(`
40
+ function unwrapUnion(union, members) {
41
+ if (union != null && members.indexOf(union.__typename) === -1) {
42
+ return Object.assign({}, union, {__typename: "__unselected"});
43
+ }
44
+
45
+ return union;
46
+ }
47
+ `)
48
+
49
+ let wrapUnion = union => union
@@ -5,3 +5,6 @@ let internal_nullableToOptionalExnHandler: option<option<'b> => 'a> => option<
5
5
  Js.Nullable.t<'b> => 'a,
6
6
  >
7
7
  @live @unboxed type rec arg = Arg(_): arg
8
+
9
+ let unwrapUnion: ('a, array<string>) => 'a
10
+ let wrapUnion: 'a => 'a
@@ -7,7 +7,7 @@ var ReactRelay = require("react-relay");
7
7
  var RelayRuntime = require("relay-runtime");
8
8
 
9
9
  function commitMutation(convertVariables, node, convertResponse, convertWrapRawResponse) {
10
- return function (environment, variables, optimisticUpdater, optimisticResponse, updater, onCompleted, onError, uploadables, param) {
10
+ return function (environment, variables, optimisticUpdater, optimisticResponse, updater, onCompleted, onError, uploadables) {
11
11
  return RelayRuntime.commitMutation(environment, {
12
12
  mutation: node,
13
13
  variables: convertVariables(variables),
@@ -31,7 +31,7 @@ function useMutation(convertVariables, node, convertResponse, convertWrapRawResp
31
31
  var mutate = match[0];
32
32
  return [
33
33
  React.useMemo((function () {
34
- return function (variables, optimisticUpdater, optimisticResponse, updater, onCompleted, onError, uploadables, param) {
34
+ return function (variables, optimisticUpdater, optimisticResponse, updater, onCompleted, onError, uploadables) {
35
35
  return mutate({
36
36
  onError: onError,
37
37
  onCompleted: onCompleted !== undefined ? (function (res, err) {
@@ -70,7 +70,6 @@ let commitMutation = (
70
70
  ~onCompleted=?,
71
71
  ~onError=?,
72
72
  ~uploadables=?,
73
- (),
74
73
  ) => {
75
74
  commitMutation_(
76
75
  environment,
@@ -120,7 +119,6 @@ let useMutation = (
120
119
  ~onCompleted=?,
121
120
  ~onError=?,
122
121
  ~uploadables=?,
123
- (),
124
122
  ) => {
125
123
  mutate({
126
124
  onCompleted: ?switch onCompleted {
@@ -31,7 +31,6 @@ let commitMutation: (
31
31
  ~onCompleted: ('response, option<array<mutationError>>) => unit=?,
32
32
  ~onError: mutationError => unit=?,
33
33
  ~uploadables: uploadables=?,
34
- unit,
35
34
  ) => Disposable.t
36
35
 
37
36
  let useMutation: (
@@ -48,7 +47,6 @@ let useMutation: (
48
47
  ~onCompleted: ('response, option<array<mutationError>>) => unit=?,
49
48
  ~onError: mutationError => unit=?,
50
49
  ~uploadables: uploadables=?,
51
- unit,
52
50
  ) => Disposable.t,
53
51
  bool,
54
52
  )
@@ -9,7 +9,7 @@ var RelayRuntime = require("relay-runtime");
9
9
  var RescriptRelay_Internal = require("./RescriptRelay_Internal.bs.js");
10
10
 
11
11
  function useQuery(convertVariables, node, convertResponse) {
12
- return function (variables, fetchPolicy, fetchKey, networkCacheConfig, param) {
12
+ return function (variables, fetchPolicy, fetchKey, networkCacheConfig) {
13
13
  var __x = ReactRelay.useLazyLoadQuery(node, RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(convertVariables(variables)), {
14
14
  fetchKey: fetchKey,
15
15
  fetchPolicy: fetchPolicy,
@@ -24,7 +24,7 @@ function useLoader(convertVariables, node, mkQueryRef) {
24
24
  var match = ReactRelay.useQueryLoader(node);
25
25
  var loadQueryFn = match[1];
26
26
  var loadQuery = React.useMemo((function () {
27
- return function (variables, fetchPolicy, networkCacheConfig, param) {
27
+ return function (variables, fetchPolicy, networkCacheConfig) {
28
28
  loadQueryFn(convertVariables(variables), {
29
29
  fetchPolicy: fetchPolicy,
30
30
  networkCacheConfig: networkCacheConfig
@@ -47,7 +47,7 @@ function usePreloaded(node, convertResponse, mkQueryRef) {
47
47
  }
48
48
 
49
49
  function $$fetch(node, convertResponse, convertVariables) {
50
- return function (environment, variables, onResult, networkCacheConfig, fetchPolicy, param) {
50
+ return function (environment, variables, onResult, networkCacheConfig, fetchPolicy) {
51
51
  ReactRelay.fetchQuery(environment, node, convertVariables(variables), {
52
52
  networkCacheConfig: networkCacheConfig,
53
53
  fetchPolicy: fetchPolicy
@@ -69,7 +69,7 @@ function $$fetch(node, convertResponse, convertVariables) {
69
69
  }
70
70
 
71
71
  function fetchPromised(node, convertResponse, convertVariables) {
72
- return function (environment, variables, networkCacheConfig, fetchPolicy, param) {
72
+ return function (environment, variables, networkCacheConfig, fetchPolicy) {
73
73
  return Js_promise2.then(ReactRelay.fetchQuery(environment, node, convertVariables(variables), {
74
74
  networkCacheConfig: networkCacheConfig,
75
75
  fetchPolicy: fetchPolicy