rescript-relay 3.5.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,24 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
  'use strict';
3
3
 
4
- var React = require("react");
5
- var Caml_option = require("rescript/lib/js/caml_option.js");
6
- var ReactRelay = require("react-relay");
7
- var RescriptRelay_Internal = require("./RescriptRelay_Internal.bs.js");
8
- var Experimental = require("relay-runtime/experimental");
9
- var ResolverFragments = require("relay-runtime/lib/store/ResolverFragments");
4
+ let React = require("react");
5
+ let ReactRelay = require("react-relay");
6
+ let Primitive_option = require("@rescript/runtime/lib/js/Primitive_option.js");
7
+ let RescriptRelay_Internal = require("./RescriptRelay_Internal.bs.js");
8
+ let Experimental = require("relay-runtime/experimental");
9
+ let ResolverFragments = require("relay-runtime/lib/store/ResolverFragments");
10
10
 
11
11
  function useFragment(node, convertFragment, fRef) {
12
- var __x = ReactRelay.useFragment(node, fRef);
13
- return RescriptRelay_Internal.internal_useConvertedValue(convertFragment, __x);
12
+ return RescriptRelay_Internal.internal_useConvertedValue(convertFragment, ReactRelay.useFragment(node, fRef));
14
13
  }
15
14
 
16
15
  function useFragmentOpt(fRef, node, convertFragment) {
17
- var data = ReactRelay.useFragment(node, fRef);
18
- return React.useMemo((function () {
19
- if (!(data == null)) {
20
- return Caml_option.some(convertFragment(data));
21
- }
22
-
23
- }), [(data == null) ? undefined : Caml_option.some(data)]);
16
+ let data = ReactRelay.useFragment(node, fRef);
17
+ return React.useMemo(() => {
18
+ if (!(data == null)) {
19
+ return Primitive_option.some(convertFragment(data));
20
+ }
21
+ }, [(data == null) ? undefined : Primitive_option.some(data)]);
24
22
  }
25
23
 
26
24
  function readInlineData(node, convertFragment, fRef) {
@@ -31,85 +29,62 @@ function read(node, convertFragment, fRef) {
31
29
  return convertFragment(ResolverFragments.readFragment(node, fRef));
32
30
  }
33
31
 
34
- function internal_makeRefetchableFnOpts(fetchPolicy, onComplete, param) {
35
- return {
36
- fetchPolicy: fetchPolicy,
37
- onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
38
- };
39
- }
40
-
41
32
  function usePaginationFragment(node, fRef, convertFragment, convertRefetchVariables) {
42
- var p = ReactRelay.usePaginationFragment(node, fRef);
43
- var data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, p.data);
33
+ let p = ReactRelay.usePaginationFragment(node, fRef);
34
+ let data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, p.data);
44
35
  return {
45
- data: data,
46
- loadNext: React.useMemo((function () {
47
- return function (count, onComplete) {
48
- return p.loadNext(count, {
49
- onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
50
- });
51
- };
52
- }), [p.loadNext]),
53
- loadPrevious: React.useMemo((function () {
54
- return function (count, onComplete) {
55
- return p.loadPrevious(count, {
56
- onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
57
- });
58
- };
59
- }), [p.loadPrevious]),
60
- hasNext: p.hasNext,
61
- hasPrevious: p.hasPrevious,
62
- isLoadingNext: p.isLoadingNext,
63
- isLoadingPrevious: p.isLoadingPrevious,
64
- refetch: React.useMemo((function () {
65
- return function (variables, fetchPolicy, onComplete) {
66
- return p.refetch(RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(convertRefetchVariables(variables)), internal_makeRefetchableFnOpts(fetchPolicy, onComplete, undefined));
67
- };
68
- }), [p.refetch])
69
- };
36
+ data: data,
37
+ loadNext: React.useMemo(() => ((count, onComplete) => p.loadNext(count, {
38
+ onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
39
+ })), [p.loadNext]),
40
+ loadPrevious: React.useMemo(() => ((count, onComplete) => p.loadPrevious(count, {
41
+ onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
42
+ })), [p.loadPrevious]),
43
+ hasNext: p.hasNext,
44
+ hasPrevious: p.hasPrevious,
45
+ isLoadingNext: p.isLoadingNext,
46
+ isLoadingPrevious: p.isLoadingPrevious,
47
+ refetch: React.useMemo(() => ((variables, fetchPolicy, onComplete) => p.refetch(RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(convertRefetchVariables(variables)), {
48
+ fetchPolicy: fetchPolicy,
49
+ onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
50
+ })), [p.refetch])
51
+ };
70
52
  }
71
53
 
72
54
  function usePrefetchableForwardPagination(node, fRef, convertEdges, convertFragment, convertRefetchVariables, bufferSize, initialSize, prefetchingLoadMoreOptions, minimumFetchSize) {
73
- var p = ReactRelay.usePrefetchableForwardPaginationFragment(node, fRef, bufferSize, initialSize !== undefined ? Caml_option.valFromOption(initialSize) : undefined, prefetchingLoadMoreOptions !== undefined ? Caml_option.valFromOption(prefetchingLoadMoreOptions) : undefined, minimumFetchSize !== undefined ? Caml_option.valFromOption(minimumFetchSize) : undefined);
74
- var data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, p.data);
75
- var edges = RescriptRelay_Internal.internal_useConvertedValue(convertEdges, p.edges);
55
+ let p = ReactRelay.usePrefetchableForwardPaginationFragment(node, fRef, bufferSize, initialSize !== undefined ? Primitive_option.valFromOption(initialSize) : undefined, prefetchingLoadMoreOptions !== undefined ? Primitive_option.valFromOption(prefetchingLoadMoreOptions) : undefined, minimumFetchSize !== undefined ? Primitive_option.valFromOption(minimumFetchSize) : undefined);
56
+ let data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, p.data);
57
+ let edges = RescriptRelay_Internal.internal_useConvertedValue(convertEdges, p.edges);
76
58
  return {
77
- data: data,
78
- edges: edges,
79
- loadNext: React.useMemo((function () {
80
- return function (count, onComplete) {
81
- return p.loadNext(count, {
82
- onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
83
- });
84
- };
85
- }), [p.loadNext]),
86
- hasNext: p.hasNext,
87
- isLoadingNext: p.isLoadingNext,
88
- refetch: React.useMemo((function () {
89
- return function (variables, fetchPolicy, onComplete) {
90
- return p.refetch(RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(convertRefetchVariables(variables)), internal_makeRefetchableFnOpts(fetchPolicy, onComplete, undefined));
91
- };
92
- }), [p.refetch])
93
- };
59
+ data: data,
60
+ edges: edges,
61
+ loadNext: React.useMemo(() => ((count, onComplete) => p.loadNext(count, {
62
+ onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
63
+ })), [p.loadNext]),
64
+ hasNext: p.hasNext,
65
+ isLoadingNext: p.isLoadingNext,
66
+ refetch: React.useMemo(() => ((variables, fetchPolicy, onComplete) => p.refetch(RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(convertRefetchVariables(variables)), {
67
+ fetchPolicy: fetchPolicy,
68
+ onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
69
+ })), [p.refetch])
70
+ };
94
71
  }
95
72
 
96
73
  function useRefetchableFragment(node, convertFragment, convertRefetchVariables, fRef) {
97
- var match = ReactRelay.useRefetchableFragment(node, fRef);
98
- var refetchFn = match[1];
99
- var data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, match[0]);
74
+ let match = ReactRelay.useRefetchableFragment(node, fRef);
75
+ let refetchFn = match[1];
76
+ let data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, match[0]);
100
77
  return [
101
- data,
102
- React.useMemo((function () {
103
- return function (variables, fetchPolicy, onComplete) {
104
- return refetchFn(RescriptRelay_Internal.internal_removeUndefinedAndConvertNullsRaw(convertRefetchVariables(variables)), internal_makeRefetchableFnOpts(fetchPolicy, onComplete, undefined));
105
- };
106
- }), [refetchFn])
107
- ];
78
+ data,
79
+ React.useMemo(() => ((variables, fetchPolicy, onComplete) => refetchFn(RescriptRelay_Internal.internal_removeUndefinedAndConvertNullsRaw(convertRefetchVariables(variables)), {
80
+ fetchPolicy: fetchPolicy,
81
+ onComplete: RescriptRelay_Internal.internal_nullableToOptionalExnHandler(onComplete)
82
+ })), [refetchFn])
83
+ ];
108
84
  }
109
85
 
110
86
  async function waitForFragmentData(environment, node, convertFragment, fRef) {
111
- var fragmentData = await Experimental.waitForFragmentData(environment, node, fRef);
112
- return convertFragment(fragmentData);
87
+ return convertFragment(await Experimental.waitForFragmentData(environment, node, fRef));
113
88
  }
114
89
 
115
90
  exports.useFragment = useFragment;
@@ -15,14 +15,11 @@ let useFragment = (~node, ~convertFragment: 'fragment => 'fragment, ~fRef) => {
15
15
  User @inline {...}`) and then use `Fragment.readInline`. \
16
16
  This will allow you to get the fragment data, but outside \
17
17
  of React's render.*/
18
- (
19
- useFragment_(node, fRef)
20
- ->(RescriptRelay_Internal.internal_useConvertedValue(convertFragment, _))
21
- )
18
+ (useFragment_(node, fRef)->RescriptRelay_Internal.internal_useConvertedValue(convertFragment, _))
22
19
  }
23
20
 
24
21
  @module("react-relay")
25
- external useFragmentOpt_: (fragmentNode<'node>, option<'fragmentRef>) => Js.Nullable.t<'fragment> =
22
+ external useFragmentOpt_: (fragmentNode<'node>, option<'fragmentRef>) => Nullable.t<'fragment> =
26
23
  "useFragment"
27
24
 
28
25
  let useFragmentOpt = (~fRef, ~node, ~convertFragment: 'fragment => 'fragment) => {
@@ -33,7 +30,7 @@ let useFragmentOpt = (~fRef, ~node, ~convertFragment: 'fragment => 'fragment) =>
33
30
  back. Useful for scenarios where you don't have the \
34
31
  fragmentRefs yet.*/
35
32
  let data =
36
- useFragmentOpt_(node, fRef)->Js.Nullable.toOption
33
+ useFragmentOpt_(node, fRef)->Nullable.toOption
37
34
  React.useMemo1(() => {
38
35
  switch data {
39
36
  | Some(data) => Some(convertFragment(data))
@@ -64,16 +61,16 @@ let read = (~node, ~convertFragment: 'fragment => 'fragment, ~fRef) => {
64
61
 
65
62
  type refetchableFnOpts = {
66
63
  fetchPolicy?: fetchPolicy,
67
- onComplete?: Js.Nullable.t<Js.Exn.t> => unit,
64
+ onComplete?: Nullable.t<JsExn.t> => unit,
68
65
  }
69
66
 
70
67
  let internal_makeRefetchableFnOpts = (~fetchPolicy=?, ~onComplete=?, ()) => {
71
68
  ?fetchPolicy,
72
- onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler,
69
+ onComplete: ?(onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler),
73
70
  }
74
71
 
75
- type paginationLoadMoreOptions = {onComplete?: Js.Nullable.t<Js.Exn.t> => unit}
76
- type paginationLoadMoreFn = (~count: int, ~onComplete: option<Js.Exn.t> => unit=?) => Disposable.t
72
+ type paginationLoadMoreOptions = {onComplete?: Nullable.t<JsExn.t> => unit}
73
+ type paginationLoadMoreFn = (~count: int, ~onComplete: option<JsExn.t> => unit=?) => Disposable.t
77
74
  type paginationFragmentReturnRaw<'fragment, 'refetchVariables> = {
78
75
  data: 'fragment,
79
76
  loadNext: (int, paginationLoadMoreOptions) => Disposable.t,
@@ -95,7 +92,7 @@ type paginationFragmentReturn<'fragment, 'refetchVariables> = {
95
92
  refetch: (
96
93
  ~variables: 'refetchVariables,
97
94
  ~fetchPolicy: fetchPolicy=?,
98
- ~onComplete: option<Js.Exn.t> => unit=?,
95
+ ~onComplete: option<JsExn.t> => unit=?,
99
96
  ) => Disposable.t,
100
97
  }
101
98
 
@@ -116,30 +113,36 @@ let usePaginationFragment = (
116
113
  let data = RescriptRelay_Internal.internal_useConvertedValue(convertFragment, p.data)
117
114
  {
118
115
  data,
119
- loadNext: React.useMemo1(() => (~count, ~onComplete=?) => {
120
- p.loadNext(
121
- count,
122
- {onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler},
123
- )
124
- }, [p.loadNext]),
125
- loadPrevious: React.useMemo1(() => (~count, ~onComplete=?) => {
126
- p.loadPrevious(
127
- count,
128
- {onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler},
129
- )
130
- }, [p.loadPrevious]),
116
+ loadNext: React.useMemo1(() =>
117
+ (~count, ~onComplete=?) => {
118
+ p.loadNext(
119
+ count,
120
+ {onComplete: ?(onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler)},
121
+ )
122
+ }
123
+ , [p.loadNext]),
124
+ loadPrevious: React.useMemo1(() =>
125
+ (~count, ~onComplete=?) => {
126
+ p.loadPrevious(
127
+ count,
128
+ {onComplete: ?(onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler)},
129
+ )
130
+ }
131
+ , [p.loadPrevious]),
131
132
  hasNext: p.hasNext,
132
133
  hasPrevious: p.hasPrevious,
133
134
  isLoadingNext: p.isLoadingNext,
134
135
  isLoadingPrevious: p.isLoadingPrevious,
135
- refetch: React.useMemo1(() => (~variables, ~fetchPolicy=?, ~onComplete=?) => {
136
- p.refetch(
137
- RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(
138
- variables->convertRefetchVariables,
139
- ),
140
- internal_makeRefetchableFnOpts(~onComplete?, ~fetchPolicy?, ()),
141
- )
142
- }, [p.refetch]),
136
+ refetch: React.useMemo1(() =>
137
+ (~variables, ~fetchPolicy=?, ~onComplete=?) => {
138
+ p.refetch(
139
+ RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(
140
+ variables->convertRefetchVariables,
141
+ ),
142
+ internal_makeRefetchableFnOpts(~onComplete?, ~fetchPolicy?, ()),
143
+ )
144
+ }
145
+ , [p.refetch]),
143
146
  }
144
147
  }
145
148
 
@@ -160,7 +163,7 @@ type prefetchableForwardPaginationFragmentReturn<'fragment, 'edges, 'refetchVari
160
163
  refetch: (
161
164
  ~variables: 'refetchVariables,
162
165
  ~fetchPolicy: fetchPolicy=?,
163
- ~onComplete: option<Js.Exn.t> => unit=?,
166
+ ~onComplete: option<JsExn.t> => unit=?,
164
167
  ) => Disposable.t,
165
168
  }
166
169
 
@@ -200,22 +203,26 @@ let usePrefetchableForwardPagination = (
200
203
  {
201
204
  data,
202
205
  edges,
203
- loadNext: React.useMemo1(() => (~count, ~onComplete=?) => {
204
- p.loadNext(
205
- count,
206
- {onComplete: ?onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler},
207
- )
208
- }, [p.loadNext]),
206
+ loadNext: React.useMemo1(() =>
207
+ (~count, ~onComplete=?) => {
208
+ p.loadNext(
209
+ count,
210
+ {onComplete: ?(onComplete->RescriptRelay_Internal.internal_nullableToOptionalExnHandler)},
211
+ )
212
+ }
213
+ , [p.loadNext]),
209
214
  hasNext: p.hasNext,
210
215
  isLoadingNext: p.isLoadingNext,
211
- refetch: React.useMemo1(() => (~variables, ~fetchPolicy=?, ~onComplete=?) => {
212
- p.refetch(
213
- RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(
214
- variables->convertRefetchVariables,
215
- ),
216
- internal_makeRefetchableFnOpts(~onComplete?, ~fetchPolicy?, ()),
217
- )
218
- }, [p.refetch]),
216
+ refetch: React.useMemo1(() =>
217
+ (~variables, ~fetchPolicy=?, ~onComplete=?) => {
218
+ p.refetch(
219
+ RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(
220
+ variables->convertRefetchVariables,
221
+ ),
222
+ internal_makeRefetchableFnOpts(~onComplete?, ~fetchPolicy?, ()),
223
+ )
224
+ }
225
+ , [p.refetch]),
219
226
  }
220
227
  }
221
228
 
@@ -247,13 +254,14 @@ let useRefetchableFragment = (
247
254
  (
248
255
  data,
249
256
  React.useMemo1(
250
- () => (~variables: 'refetchVariables, ~fetchPolicy=?, ~onComplete=?) =>
251
- refetchFn(
252
- RescriptRelay_Internal.internal_removeUndefinedAndConvertNullsRaw(
253
- variables->convertRefetchVariables,
257
+ () =>
258
+ (~variables: 'refetchVariables, ~fetchPolicy=?, ~onComplete=?) =>
259
+ refetchFn(
260
+ RescriptRelay_Internal.internal_removeUndefinedAndConvertNullsRaw(
261
+ variables->convertRefetchVariables,
262
+ ),
263
+ internal_makeRefetchableFnOpts(~fetchPolicy?, ~onComplete?, ()),
254
264
  ),
255
- internal_makeRefetchableFnOpts(~fetchPolicy?, ~onComplete?, ()),
256
- ),
257
265
  [refetchFn],
258
266
  ),
259
267
  )
@@ -24,9 +24,9 @@ let read: (
24
24
  ~fRef: 'b,
25
25
  ) => 'fragment
26
26
 
27
- type paginationLoadMoreOptions = {onComplete?: Js.Nullable.t<Js.Exn.t> => unit}
27
+ type paginationLoadMoreOptions = {onComplete?: Nullable.t<JsExn.t> => unit}
28
28
 
29
- type paginationLoadMoreFn = (~count: int, ~onComplete: option<Js.Exn.t> => unit=?) => Disposable.t
29
+ type paginationLoadMoreFn = (~count: int, ~onComplete: option<JsExn.t> => unit=?) => Disposable.t
30
30
 
31
31
  type paginationFragmentReturn<'fragment, 'refetchVariables> = {
32
32
  data: 'fragment,
@@ -39,7 +39,7 @@ type paginationFragmentReturn<'fragment, 'refetchVariables> = {
39
39
  refetch: (
40
40
  ~variables: 'refetchVariables,
41
41
  ~fetchPolicy: fetchPolicy=?,
42
- ~onComplete: option<Js.Exn.t> => unit=?,
42
+ ~onComplete: option<JsExn.t> => unit=?,
43
43
  ) => Disposable.t,
44
44
  }
45
45
 
@@ -59,7 +59,7 @@ type prefetchableForwardPaginationFragmentReturn<'fragment, 'edges, 'refetchVari
59
59
  refetch: (
60
60
  ~variables: 'refetchVariables,
61
61
  ~fetchPolicy: fetchPolicy=?,
62
- ~onComplete: option<Js.Exn.t> => unit=?,
62
+ ~onComplete: option<JsExn.t> => unit=?,
63
63
  ) => Disposable.t,
64
64
  }
65
65
 
@@ -85,7 +85,7 @@ let useRefetchableFragment: (
85
85
  (
86
86
  ~variables: 'refetchVariables,
87
87
  ~fetchPolicy: fetchPolicy=?,
88
- ~onComplete: option<Js.Exn.t> => unit=?,
88
+ ~onComplete: option<JsExn.t> => unit=?,
89
89
  ) => Disposable.t,
90
90
  )
91
91
 
@@ -1,74 +1,65 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
  'use strict';
3
3
 
4
- var React = require("react");
5
- var Js_dict = require("rescript/lib/js/js_dict.js");
6
- var Caml_obj = require("rescript/lib/js/caml_obj.js");
7
- var Belt_Array = require("rescript/lib/js/belt_Array.js");
8
- var Belt_Option = require("rescript/lib/js/belt_Option.js");
9
- var Caml_option = require("rescript/lib/js/caml_option.js");
4
+ let React = require("react");
5
+ let Stdlib_Array = require("@rescript/runtime/lib/js/Stdlib_Array.js");
6
+ let Stdlib_Option = require("@rescript/runtime/lib/js/Stdlib_Option.js");
7
+ let Primitive_object = require("@rescript/runtime/lib/js/Primitive_object.js");
8
+ let Primitive_option = require("@rescript/runtime/lib/js/Primitive_option.js");
10
9
 
11
10
  function internal_keepMapFieldsRaw(record, f) {
12
- return Belt_Option.map(record, (function (obj) {
13
- return Js_dict.fromArray(Belt_Array.keepMap(Js_dict.entries(obj), f));
14
- }));
11
+ return Stdlib_Option.map(record, obj => Object.fromEntries(Stdlib_Array.filterMap(Object.entries(obj), f)));
15
12
  }
16
13
 
17
14
  function internal_cleanObjectFromUndefinedRaw(record) {
18
- var v = internal_keepMapFieldsRaw(record, (function (param) {
19
- var value = param[1];
20
- if (value !== undefined) {
21
- return [
22
- param[0],
23
- Caml_option.valFromOption(value)
24
- ];
25
- }
26
-
27
- }));
15
+ let v = internal_keepMapFieldsRaw(record, param => {
16
+ let value = param[1];
17
+ if (value !== undefined) {
18
+ return [
19
+ param[0],
20
+ Primitive_option.valFromOption(value)
21
+ ];
22
+ }
23
+ });
28
24
  if (v !== undefined) {
29
- return Caml_option.valFromOption(v);
25
+ return Primitive_option.valFromOption(v);
30
26
  } else {
31
27
  return {};
32
28
  }
33
29
  }
34
30
 
35
31
  function internal_removeUndefinedAndConvertNullsRaw(record) {
36
- return internal_keepMapFieldsRaw(record, (function (param) {
37
- var value = param[1];
38
- var key = param[0];
39
- var match = Caml_obj.equal(value, Caml_option.some(undefined));
40
- if (value !== undefined) {
41
- return [
42
- key,
43
- Caml_option.valFromOption(value)
44
- ];
45
- } else if (match) {
46
- return [
47
- key,
48
- null
49
- ];
50
- } else {
51
- return ;
52
- }
53
- }));
32
+ return internal_keepMapFieldsRaw(record, param => {
33
+ let value = param[1];
34
+ let key = param[0];
35
+ let match = Primitive_object.equal(value, Primitive_option.some(undefined));
36
+ if (value !== undefined) {
37
+ return [
38
+ key,
39
+ Primitive_option.valFromOption(value)
40
+ ];
41
+ } else if (match) {
42
+ return [
43
+ key,
44
+ null
45
+ ];
46
+ } else {
47
+ return;
48
+ }
49
+ });
54
50
  }
55
51
 
56
52
  function internal_useConvertedValue(convert, v) {
57
- return React.useMemo((function () {
58
- return convert(v);
59
- }), [v]);
53
+ return React.useMemo(() => convert(v), [v]);
60
54
  }
61
55
 
62
56
  function internal_nullableToOptionalExnHandler(x) {
63
57
  if (x !== undefined) {
64
- return (function (maybeExn) {
65
- return x((maybeExn == null) ? undefined : Caml_option.some(maybeExn));
66
- });
58
+ return maybeExn => x((maybeExn == null) ? undefined : Primitive_option.some(maybeExn));
67
59
  }
68
-
69
60
  }
70
61
 
71
- var unwrapUnion = (function unwrapUnion(union, members) {
62
+ let unwrapUnion = (function unwrapUnion(union, members) {
72
63
  if (union != null && members.indexOf(union.__typename) === -1) {
73
64
  return Object.assign({}, union, {__typename: "__unselected"});
74
65
  }
@@ -80,7 +71,7 @@ function wrapUnion(union) {
80
71
  return union;
81
72
  }
82
73
 
83
- var applyCodesplitMetadata = (function applyCodesplitMetadata(node, meta) {
74
+ let applyCodesplitMetadata = (function applyCodesplitMetadata(node, meta) {
84
75
  if (node != null && node.params != null) {
85
76
  let metadata = node.params.metadata;
86
77
  if (metadata == null) {
@@ -1,7 +1,7 @@
1
1
  let internal_keepMapFieldsRaw = (record, f) =>
2
2
  record
3
3
  ->Obj.magic
4
- ->Belt.Option.map(obj => obj->Js.Dict.entries->Belt.Array.keepMap(f)->Js.Dict.fromArray)
4
+ ->Option.map(obj => obj->Dict.toArray->Array.filterMap(f)->Dict.fromArray)
5
5
  ->Obj.magic
6
6
 
7
7
  // we need to do this until we can use @obj on record types
@@ -20,8 +20,8 @@ let internal_cleanObjectFromUndefinedRaw = record =>
20
20
  let internal_removeUndefinedAndConvertNullsRaw = record =>
21
21
  internal_keepMapFieldsRaw(record, ((key, value)) => {
22
22
  switch (value, value == Some(None)) {
23
- | (Some(value), _) => Some((key, Js.Nullable.return(value)))
24
- | (_, true) => Some((key, Js.Nullable.null))
23
+ | (Some(value), _) => Some((key, Nullable.make(value)))
24
+ | (_, true) => Some((key, Nullable.null))
25
25
  | (None, _) => None
26
26
  }
27
27
  })
@@ -31,7 +31,7 @@ let internal_useConvertedValue = (convert, v) => React.useMemo1(() => convert(v)
31
31
  let internal_nullableToOptionalExnHandler = x =>
32
32
  switch x {
33
33
  | None => None
34
- | Some(handler) => Some(maybeExn => maybeExn->Js.Nullable.toOption->handler)
34
+ | Some(handler) => Some(maybeExn => maybeExn->Nullable.toOption->handler)
35
35
  }
36
36
 
37
37
  @live @unboxed type rec arg = Arg(_): arg
@@ -56,7 +56,7 @@ external internal_resolverFragmentRefsToFragmentRefsPlural: RescriptRelay.resolv
56
56
  'a,
57
57
  > => array<RescriptRelay.fragmentRefs<'a>> = "%identity"
58
58
 
59
- let applyCodesplitMetadata: ('node, array<(string, dict<Js.Json.t> => unit)>) => 'node = %raw(`
59
+ let applyCodesplitMetadata: ('node, array<(string, dict<JSON.t> => unit)>) => 'node = %raw(`
60
60
  function applyCodesplitMetadata(node, meta) {
61
61
  if (node != null && node.params != null) {
62
62
  let metadata = node.params.metadata;
@@ -1,9 +1,7 @@
1
1
  let internal_useConvertedValue: ('a => 'a, 'a) => 'a
2
2
  let internal_cleanObjectFromUndefinedRaw: 't => 't
3
3
  let internal_removeUndefinedAndConvertNullsRaw: 't => 't
4
- let internal_nullableToOptionalExnHandler: option<option<'b> => 'a> => option<
5
- Js.Nullable.t<'b> => 'a,
6
- >
4
+ let internal_nullableToOptionalExnHandler: option<option<'b> => 'a> => option<Nullable.t<'b> => 'a>
7
5
  @live @unboxed type rec arg = Arg(_): arg
8
6
 
9
7
  let unwrapUnion: ('a, array<string>) => 'a
@@ -17,4 +15,4 @@ external internal_resolverFragmentRefsToFragmentRefsPlural: RescriptRelay.resolv
17
15
  'a,
18
16
  > => array<RescriptRelay.fragmentRefs<'a>> = "%identity"
19
17
 
20
- let applyCodesplitMetadata: ('node, array<(string, dict<Js.Json.t> => unit)>) => 'node
18
+ let applyCodesplitMetadata: ('node, array<(string, dict<JSON.t> => unit)>) => 'node