rescript-relay 0.0.0-version-3-aeebeaab → 0.0.0-version-3-3504d777
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/ppx-windows-latest +0 -0
- package/relay-compiler-linux-musl/relay +0 -0
- package/relay-compiler-linux-x64/relay +0 -0
- package/relay-compiler-macos-arm64/relay +0 -0
- package/relay-compiler-macos-x64/relay +0 -0
- package/relay-compiler-win-x64/relay.exe +0 -0
- package/src/RescriptRelay.bs.js +13 -23
- package/src/RescriptRelay.res +35 -81
- package/src/RescriptRelay.resi +20 -62
- package/src/RescriptRelayUtils.res +3 -5
- package/src/RescriptRelay_Fragment.bs.js +7 -7
- package/src/RescriptRelay_Fragment.res +8 -14
- package/src/RescriptRelay_Fragment.resi +1 -8
- package/src/RescriptRelay_Mutation.bs.js +2 -2
- package/src/RescriptRelay_Mutation.res +0 -2
- package/src/RescriptRelay_Mutation.resi +0 -2
- package/src/RescriptRelay_Query.bs.js +4 -4
- package/src/RescriptRelay_Query.res +3 -11
- package/src/RescriptRelay_Query.resi +1 -9
- package/src/RescriptRelay_Subscriptions.bs.js +1 -1
- package/src/RescriptRelay_Subscriptions.res +0 -1
- package/src/RescriptRelay_Subscriptions.resi +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ Dedicated tooling for migrating is coming, as well as docs.
|
|
|
8
8
|
|
|
9
9
|
## Breaking changes
|
|
10
10
|
|
|
11
|
+
- All trailing unit arguments are removed. Commit showing how this is migrated to in the tests: https://github.com/zth/rescript-relay/commit/2a16791268afb29d106362d0cf17915f69d5b4ff
|
|
12
|
+
|
|
13
|
+
# 0.0.0-version-3-aeebeaab
|
|
14
|
+
|
|
15
|
+
## Breaking changes
|
|
16
|
+
|
|
11
17
|
- 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
|
|
12
18
|
|
|
13
19
|
# 0.0.0-version-3-89bccc22
|
package/package.json
CHANGED
package/ppx-windows-latest
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/RescriptRelay.bs.js
CHANGED
|
@@ -27,7 +27,7 @@ function optArrayOfNullableToOptArrayOfOpt(x) {
|
|
|
27
27
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function getLinkedRecords(t, name, $$arguments
|
|
30
|
+
function getLinkedRecords(t, name, $$arguments) {
|
|
31
31
|
return optArrayOfNullableToOptArrayOfOpt(Caml_option.nullable_to_opt(t.getLinkedRecords(name, $$arguments)));
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -118,7 +118,7 @@ var Network = {};
|
|
|
118
118
|
|
|
119
119
|
var RecordSource = {};
|
|
120
120
|
|
|
121
|
-
function make(source, gcReleaseBufferSize, queryCacheExpirationTime
|
|
121
|
+
function make(source, gcReleaseBufferSize, queryCacheExpirationTime) {
|
|
122
122
|
return new RelayRuntime.Store(source, {
|
|
123
123
|
gcReleaseBufferSize: gcReleaseBufferSize,
|
|
124
124
|
queryCacheExpirationTime: queryCacheExpirationTime
|
|
@@ -135,26 +135,16 @@ function toJs(f) {
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
function make$1(network, store, getDataID, treatMissingFieldsAsNull, missingFieldHandlers, requiredFieldLogger, isServer
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
tmp.treatMissingFieldsAsNull = Caml_option.valFromOption(treatMissingFieldsAsNull);
|
|
149
|
-
}
|
|
150
|
-
var tmp$1 = Belt_Option.map(requiredFieldLogger, toJs);
|
|
151
|
-
if (tmp$1 !== undefined) {
|
|
152
|
-
tmp.requiredFieldLogger = Caml_option.valFromOption(tmp$1);
|
|
153
|
-
}
|
|
154
|
-
if (isServer !== undefined) {
|
|
155
|
-
tmp.isServer = Caml_option.valFromOption(isServer);
|
|
156
|
-
}
|
|
157
|
-
return new RelayRuntime.Environment(tmp);
|
|
138
|
+
function make$1(network, store, getDataID, treatMissingFieldsAsNull, missingFieldHandlers, requiredFieldLogger, isServer) {
|
|
139
|
+
return new RelayRuntime.Environment({
|
|
140
|
+
network: network,
|
|
141
|
+
store: store,
|
|
142
|
+
getDataID: getDataID,
|
|
143
|
+
treatMissingFieldsAsNull: treatMissingFieldsAsNull,
|
|
144
|
+
missingFieldHandlers: missingFieldHandlers !== undefined ? Belt_Array.concat(missingFieldHandlers, [nodeInterfaceMissingFieldHandler]) : [nodeInterfaceMissingFieldHandler],
|
|
145
|
+
requiredFieldLogger: Belt_Option.map(requiredFieldLogger, toJs),
|
|
146
|
+
isServer: isServer
|
|
147
|
+
});
|
|
158
148
|
}
|
|
159
149
|
|
|
160
150
|
var Environment = {
|
|
@@ -193,7 +183,7 @@ function useEnvironmentFromContext() {
|
|
|
193
183
|
}
|
|
194
184
|
|
|
195
185
|
function MakeLoadQuery(C) {
|
|
196
|
-
var load = function (environment, variables, fetchPolicy, fetchKey, networkCacheConfig
|
|
186
|
+
var load = function (environment, variables, fetchPolicy, fetchKey, networkCacheConfig) {
|
|
197
187
|
return ReactRelay.loadQuery(environment, C.query, C.convertVariables(variables), {
|
|
198
188
|
fetchKey: fetchKey,
|
|
199
189
|
fetchPolicy: fetchPolicy,
|
package/src/RescriptRelay.res
CHANGED
|
@@ -21,7 +21,7 @@ external makeUploadables: Js.Dict.t<'file> => uploadables = "%identity"
|
|
|
21
21
|
external unwrapUploadables: uploadables => Js.Dict.t<'file> = "%identity"
|
|
22
22
|
|
|
23
23
|
@module("relay-runtime")
|
|
24
|
-
external generateClientID: (~dataId: dataId, ~storageKey: string, ~index: int
|
|
24
|
+
external generateClientID: (~dataId: dataId, ~storageKey: string, ~index: int=?) => dataId =
|
|
25
25
|
"generateClientID"
|
|
26
26
|
|
|
27
27
|
@module("relay-runtime")
|
|
@@ -93,14 +93,14 @@ module RecordProxy = {
|
|
|
93
93
|
@send external getDataId: t => dataId = "getDataID"
|
|
94
94
|
|
|
95
95
|
@send @return(nullable)
|
|
96
|
-
external getLinkedRecord: (t, ~name: string, ~arguments: arguments
|
|
96
|
+
external getLinkedRecord: (t, ~name: string, ~arguments: arguments=?) => option<t> =
|
|
97
97
|
"getLinkedRecord"
|
|
98
98
|
|
|
99
99
|
@send @return(nullable)
|
|
100
100
|
external getLinkedRecords: (t, string, option<arguments>) => option<array<Js.Nullable.t<t>>> =
|
|
101
101
|
"getLinkedRecords"
|
|
102
102
|
|
|
103
|
-
let getLinkedRecords = (t, ~name, ~arguments
|
|
103
|
+
let getLinkedRecords = (t, ~name, ~arguments=?): option<array<option<t>>> =>
|
|
104
104
|
getLinkedRecords(t, name, arguments)->optArrayOfNullableToOptArrayOfOpt
|
|
105
105
|
|
|
106
106
|
@send
|
|
@@ -109,13 +109,12 @@ module RecordProxy = {
|
|
|
109
109
|
~name: string,
|
|
110
110
|
~typeName: string,
|
|
111
111
|
~arguments: arguments=?,
|
|
112
|
-
unit,
|
|
113
112
|
) => t = "getOrCreateLinkedRecord"
|
|
114
113
|
|
|
115
114
|
@send external getType: t => string = "getType"
|
|
116
115
|
|
|
117
116
|
@send @return(nullable)
|
|
118
|
-
external getValueString: (t, ~name: string, ~arguments: arguments
|
|
117
|
+
external getValueString: (t, ~name: string, ~arguments: arguments=?) => option<string> =
|
|
119
118
|
"getValue"
|
|
120
119
|
|
|
121
120
|
@send @return(nullable)
|
|
@@ -123,47 +122,40 @@ module RecordProxy = {
|
|
|
123
122
|
t,
|
|
124
123
|
~name: string,
|
|
125
124
|
~arguments: arguments=?,
|
|
126
|
-
unit,
|
|
127
125
|
) => option<array<option<string>>> = "getValue"
|
|
128
126
|
|
|
129
127
|
@send @return(nullable)
|
|
130
|
-
external getValueInt: (t, ~name: string, ~arguments: arguments
|
|
131
|
-
"getValue"
|
|
128
|
+
external getValueInt: (t, ~name: string, ~arguments: arguments=?) => option<int> = "getValue"
|
|
132
129
|
|
|
133
130
|
@send @return(nullable)
|
|
134
131
|
external getValueIntArray: (
|
|
135
132
|
t,
|
|
136
133
|
~name: string,
|
|
137
134
|
~arguments: arguments=?,
|
|
138
|
-
unit,
|
|
139
135
|
) => option<array<option<int>>> = "getValue"
|
|
140
136
|
|
|
141
137
|
@send @return(nullable)
|
|
142
|
-
external getValueFloat: (t, ~name: string, ~arguments: arguments
|
|
143
|
-
"getValue"
|
|
138
|
+
external getValueFloat: (t, ~name: string, ~arguments: arguments=?) => option<float> = "getValue"
|
|
144
139
|
|
|
145
140
|
@send @return(nullable)
|
|
146
141
|
external getValueFloatArray: (
|
|
147
142
|
t,
|
|
148
143
|
~name: string,
|
|
149
144
|
~arguments: arguments=?,
|
|
150
|
-
unit,
|
|
151
145
|
) => option<array<option<float>>> = "getValue"
|
|
152
146
|
|
|
153
147
|
@send @return(nullable)
|
|
154
|
-
external getValueBool: (t, ~name: string, ~arguments: arguments
|
|
155
|
-
"getValue"
|
|
148
|
+
external getValueBool: (t, ~name: string, ~arguments: arguments=?) => option<bool> = "getValue"
|
|
156
149
|
|
|
157
150
|
@send @return(nullable)
|
|
158
151
|
external getValueBoolArray: (
|
|
159
152
|
t,
|
|
160
153
|
~name: string,
|
|
161
154
|
~arguments: arguments=?,
|
|
162
|
-
unit,
|
|
163
155
|
) => option<array<option<bool>>> = "getValue"
|
|
164
156
|
|
|
165
157
|
@send
|
|
166
|
-
external setLinkedRecord: (t, ~record: t, ~name: string, ~arguments: arguments
|
|
158
|
+
external setLinkedRecord: (t, ~record: t, ~name: string, ~arguments: arguments=?) => t =
|
|
167
159
|
"setLinkedRecord"
|
|
168
160
|
|
|
169
161
|
// `setLinkedRecord` can't be used for "deleting" linked record fields.
|
|
@@ -176,7 +168,6 @@ module RecordProxy = {
|
|
|
176
168
|
@as(json`undefined`) _,
|
|
177
169
|
~name: string,
|
|
178
170
|
~arguments: arguments=?,
|
|
179
|
-
unit,
|
|
180
171
|
) => t = "setValue"
|
|
181
172
|
|
|
182
173
|
@send
|
|
@@ -185,7 +176,6 @@ module RecordProxy = {
|
|
|
185
176
|
@as(json`null`) _,
|
|
186
177
|
~name: string,
|
|
187
178
|
~arguments: arguments=?,
|
|
188
|
-
unit,
|
|
189
179
|
) => t = "setValue"
|
|
190
180
|
|
|
191
181
|
@send
|
|
@@ -194,7 +184,6 @@ module RecordProxy = {
|
|
|
194
184
|
~records: array<option<t>>,
|
|
195
185
|
~name: string,
|
|
196
186
|
~arguments: arguments=?,
|
|
197
|
-
unit,
|
|
198
187
|
) => t = "setLinkedRecords"
|
|
199
188
|
|
|
200
189
|
// `setLinkedRecords` can't be used for "deleting" linked records.
|
|
@@ -207,7 +196,6 @@ module RecordProxy = {
|
|
|
207
196
|
@as(json`undefined`) _,
|
|
208
197
|
~name: string,
|
|
209
198
|
~arguments: arguments=?,
|
|
210
|
-
unit,
|
|
211
199
|
) => t = "setValue"
|
|
212
200
|
|
|
213
201
|
@send
|
|
@@ -216,7 +204,6 @@ module RecordProxy = {
|
|
|
216
204
|
@as(json`null`) _,
|
|
217
205
|
~name: string,
|
|
218
206
|
~arguments: arguments=?,
|
|
219
|
-
unit,
|
|
220
207
|
) => t = "setValue"
|
|
221
208
|
|
|
222
209
|
@send
|
|
@@ -225,20 +212,14 @@ module RecordProxy = {
|
|
|
225
212
|
@as(json`undefined`) _,
|
|
226
213
|
~name: string,
|
|
227
214
|
~arguments: arguments=?,
|
|
228
|
-
unit,
|
|
229
215
|
) => t = "setValue"
|
|
230
216
|
|
|
231
217
|
@send
|
|
232
|
-
external setValueToNull: (
|
|
233
|
-
|
|
234
|
-
@as(json`null`) _,
|
|
235
|
-
~name: string,
|
|
236
|
-
~arguments: arguments=?,
|
|
237
|
-
unit,
|
|
238
|
-
) => t = "setValue"
|
|
218
|
+
external setValueToNull: (t, @as(json`null`) _, ~name: string, ~arguments: arguments=?) => t =
|
|
219
|
+
"setValue"
|
|
239
220
|
|
|
240
221
|
@send
|
|
241
|
-
external setValueString: (t, ~value: string, ~name: string, ~arguments: arguments
|
|
222
|
+
external setValueString: (t, ~value: string, ~name: string, ~arguments: arguments=?) => t =
|
|
242
223
|
"setValue"
|
|
243
224
|
|
|
244
225
|
@send
|
|
@@ -247,24 +228,17 @@ module RecordProxy = {
|
|
|
247
228
|
~value: array<string>,
|
|
248
229
|
~name: string,
|
|
249
230
|
~arguments: arguments=?,
|
|
250
|
-
unit,
|
|
251
231
|
) => t = "setValue"
|
|
252
232
|
|
|
253
233
|
@send
|
|
254
|
-
external setValueInt: (t, ~value: int, ~name: string, ~arguments: arguments
|
|
255
|
-
"setValue"
|
|
234
|
+
external setValueInt: (t, ~value: int, ~name: string, ~arguments: arguments=?) => t = "setValue"
|
|
256
235
|
|
|
257
236
|
@send
|
|
258
|
-
external setValueIntArray: (
|
|
259
|
-
|
|
260
|
-
~value: array<int>,
|
|
261
|
-
~name: string,
|
|
262
|
-
~arguments: arguments=?,
|
|
263
|
-
unit,
|
|
264
|
-
) => t = "setValue"
|
|
237
|
+
external setValueIntArray: (t, ~value: array<int>, ~name: string, ~arguments: arguments=?) => t =
|
|
238
|
+
"setValue"
|
|
265
239
|
|
|
266
240
|
@send
|
|
267
|
-
external setValueFloat: (t, ~value: float, ~name: string, ~arguments: arguments
|
|
241
|
+
external setValueFloat: (t, ~value: float, ~name: string, ~arguments: arguments=?) => t =
|
|
268
242
|
"setValue"
|
|
269
243
|
|
|
270
244
|
@send
|
|
@@ -273,12 +247,10 @@ module RecordProxy = {
|
|
|
273
247
|
~value: array<float>,
|
|
274
248
|
~name: string,
|
|
275
249
|
~arguments: arguments=?,
|
|
276
|
-
unit,
|
|
277
250
|
) => t = "setValue"
|
|
278
251
|
|
|
279
252
|
@send
|
|
280
|
-
external setValueBool: (t, ~value: bool, ~name: string, ~arguments: arguments
|
|
281
|
-
"setValue"
|
|
253
|
+
external setValueBool: (t, ~value: bool, ~name: string, ~arguments: arguments=?) => t = "setValue"
|
|
282
254
|
|
|
283
255
|
@send
|
|
284
256
|
external setValueBoolArray: (
|
|
@@ -286,7 +258,6 @@ module RecordProxy = {
|
|
|
286
258
|
~value: array<bool>,
|
|
287
259
|
~name: string,
|
|
288
260
|
~arguments: arguments=?,
|
|
289
|
-
unit,
|
|
290
261
|
) => t = "setValue"
|
|
291
262
|
|
|
292
263
|
@send external invalidateRecord: t => unit = "invalidateRecord"
|
|
@@ -423,7 +394,6 @@ module ConnectionHandler = {
|
|
|
423
394
|
~record: RecordProxy.t,
|
|
424
395
|
~key: string,
|
|
425
396
|
~filters: arguments=?,
|
|
426
|
-
unit,
|
|
427
397
|
) => option<RecordProxy.t> = "getConnection"
|
|
428
398
|
|
|
429
399
|
@module("relay-runtime") @scope("ConnectionHandler")
|
|
@@ -439,7 +409,6 @@ module ConnectionHandler = {
|
|
|
439
409
|
~connection: RecordProxy.t,
|
|
440
410
|
~newEdge: RecordProxy.t,
|
|
441
411
|
~cursor: string=?,
|
|
442
|
-
unit,
|
|
443
412
|
) => unit = "insertEdgeBefore"
|
|
444
413
|
|
|
445
414
|
@module("relay-runtime") @scope("ConnectionHandler")
|
|
@@ -447,7 +416,6 @@ module ConnectionHandler = {
|
|
|
447
416
|
~connection: RecordProxy.t,
|
|
448
417
|
~newEdge: RecordProxy.t,
|
|
449
418
|
~cursor: string=?,
|
|
450
|
-
unit,
|
|
451
419
|
) => unit = "insertEdgeAfter"
|
|
452
420
|
|
|
453
421
|
@module("relay-runtime") @scope("ConnectionHandler")
|
|
@@ -497,7 +465,6 @@ module Observable = {
|
|
|
497
465
|
~error: Js.Exn.t => unit=?,
|
|
498
466
|
~complete: unit => unit=?,
|
|
499
467
|
~unsubscribe: subscription => unit=?,
|
|
500
|
-
unit,
|
|
501
468
|
) => observer<'response> = ""
|
|
502
469
|
|
|
503
470
|
@module("relay-runtime") @scope("Observable")
|
|
@@ -541,14 +508,12 @@ module Network = {
|
|
|
541
508
|
external makePromiseBased: (
|
|
542
509
|
~fetchFunction: fetchFunctionPromise,
|
|
543
510
|
~subscriptionFunction: subscribeFn=?,
|
|
544
|
-
unit,
|
|
545
511
|
) => t = "create"
|
|
546
512
|
|
|
547
513
|
@module("relay-runtime") @scope("Network")
|
|
548
514
|
external makeObservableBased: (
|
|
549
515
|
~observableFunction: fetchFunctionObservable,
|
|
550
516
|
~subscriptionFunction: subscribeFn=?,
|
|
551
|
-
unit,
|
|
552
517
|
) => t = "create"
|
|
553
518
|
}
|
|
554
519
|
|
|
@@ -556,7 +521,7 @@ module RecordSource = {
|
|
|
556
521
|
type t
|
|
557
522
|
|
|
558
523
|
@module("relay-runtime") @new
|
|
559
|
-
external make: (~records: recordSourceRecords
|
|
524
|
+
external make: (~records: recordSourceRecords=?) => t = "RecordSource"
|
|
560
525
|
|
|
561
526
|
@send external toJSON: t => recordSourceRecords = "toJSON"
|
|
562
527
|
}
|
|
@@ -572,7 +537,7 @@ module Store = {
|
|
|
572
537
|
@module("relay-runtime") @new
|
|
573
538
|
external make: (RecordSource.t, storeConfig) => t = "Store"
|
|
574
539
|
|
|
575
|
-
let make = (~source, ~gcReleaseBufferSize=?, ~queryCacheExpirationTime
|
|
540
|
+
let make = (~source, ~gcReleaseBufferSize=?, ~queryCacheExpirationTime=?) =>
|
|
576
541
|
make(
|
|
577
542
|
source,
|
|
578
543
|
{
|
|
@@ -602,19 +567,14 @@ module RequiredFieldLogger = {
|
|
|
602
567
|
module Environment = {
|
|
603
568
|
type t
|
|
604
569
|
|
|
605
|
-
@deriving(abstract)
|
|
606
570
|
type environmentConfig<'a> = {
|
|
607
571
|
network: Network.t,
|
|
608
572
|
store: Store.t,
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
@optional
|
|
612
|
-
treatMissingFieldsAsNull: bool,
|
|
573
|
+
getDataID?: (~nodeObj: 'a, ~typeName: string) => string,
|
|
574
|
+
treatMissingFieldsAsNull?: bool,
|
|
613
575
|
missingFieldHandlers: array<MissingFieldHandler.t>,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
@optional
|
|
617
|
-
isServer: bool,
|
|
576
|
+
requiredFieldLogger?: RequiredFieldLogger.js,
|
|
577
|
+
isServer?: bool,
|
|
618
578
|
}
|
|
619
579
|
|
|
620
580
|
@module("relay-runtime") @new
|
|
@@ -628,23 +588,19 @@ module Environment = {
|
|
|
628
588
|
~missingFieldHandlers=?,
|
|
629
589
|
~requiredFieldLogger=?,
|
|
630
590
|
~isServer=?,
|
|
631
|
-
(),
|
|
632
591
|
) =>
|
|
633
|
-
make(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
(),
|
|
646
|
-
),
|
|
647
|
-
)
|
|
592
|
+
make({
|
|
593
|
+
network,
|
|
594
|
+
store,
|
|
595
|
+
?getDataID,
|
|
596
|
+
?treatMissingFieldsAsNull,
|
|
597
|
+
missingFieldHandlers: switch missingFieldHandlers {
|
|
598
|
+
| Some(handlers) => handlers->Belt.Array.concat([nodeInterfaceMissingFieldHandler])
|
|
599
|
+
| None => [nodeInterfaceMissingFieldHandler]
|
|
600
|
+
},
|
|
601
|
+
requiredFieldLogger: ?requiredFieldLogger->Belt.Option.map(RequiredFieldLogger.toJs),
|
|
602
|
+
?isServer,
|
|
603
|
+
})
|
|
648
604
|
|
|
649
605
|
@send external getStore: t => Store.t = "getStore"
|
|
650
606
|
@send
|
|
@@ -721,14 +677,12 @@ module MakeLoadQuery = (C: MakeLoadQueryConfig) => {
|
|
|
721
677
|
~fetchPolicy: fetchPolicy=?,
|
|
722
678
|
~fetchKey: string=?,
|
|
723
679
|
~networkCacheConfig: cacheConfig=?,
|
|
724
|
-
unit,
|
|
725
680
|
) => C.loadedQueryRef = (
|
|
726
681
|
~environment,
|
|
727
682
|
~variables,
|
|
728
683
|
~fetchPolicy=?,
|
|
729
684
|
~fetchKey=?,
|
|
730
685
|
~networkCacheConfig=?,
|
|
731
|
-
(),
|
|
732
686
|
) =>
|
|
733
687
|
loadQuery(
|
|
734
688
|
environment,
|
|
@@ -755,7 +709,7 @@ module MakeLoadQuery = (C: MakeLoadQueryConfig) => {
|
|
|
755
709
|
| None => resolve(Error())
|
|
756
710
|
| Some(o) =>
|
|
757
711
|
open Observable
|
|
758
|
-
let _: subscription = o->subscribe(makeObserver(~complete=() => resolve(Ok())
|
|
712
|
+
let _: subscription = o->subscribe(makeObserver(~complete=() => resolve(Ok())))
|
|
759
713
|
}
|
|
760
714
|
})
|
|
761
715
|
}
|
package/src/RescriptRelay.resi
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
699
|
-
|
|
700
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
)
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
@@ -22,7 +22,7 @@ let useQuery = (
|
|
|
22
22
|
`Query.usePreloaded()` to this whenever you can, as that will \
|
|
23
23
|
allow you to start loading data before your code actually \
|
|
24
24
|
renders.*/
|
|
25
|
-
(~variables: 'variables, ~fetchPolicy=?, ~fetchKey=?, ~networkCacheConfig
|
|
25
|
+
(~variables: 'variables, ~fetchPolicy=?, ~fetchKey=?, ~networkCacheConfig=?) => {
|
|
26
26
|
useLazyLoadQuery(
|
|
27
27
|
node,
|
|
28
28
|
RescriptRelay_Internal.internal_cleanObjectFromUndefinedRaw(variables->convertVariables),
|
|
@@ -55,7 +55,7 @@ let useLoader = (
|
|
|
55
55
|
() => {
|
|
56
56
|
let (nullableQueryRef, loadQueryFn, disposableFn) = useQueryLoader(node)
|
|
57
57
|
let loadQuery = React.useMemo1(
|
|
58
|
-
() => (~variables, ~fetchPolicy=?, ~networkCacheConfig
|
|
58
|
+
() => (~variables, ~fetchPolicy=?, ~networkCacheConfig=?) =>
|
|
59
59
|
loadQueryFn(variables->convertVariables, {?fetchPolicy, ?networkCacheConfig}),
|
|
60
60
|
[loadQueryFn],
|
|
61
61
|
)
|
|
@@ -106,7 +106,6 @@ let fetch = (
|
|
|
106
106
|
~onResult,
|
|
107
107
|
~networkCacheConfig=?,
|
|
108
108
|
~fetchPolicy=?,
|
|
109
|
-
(),
|
|
110
109
|
) => {
|
|
111
110
|
open Observable
|
|
112
111
|
|
|
@@ -120,7 +119,6 @@ let fetch = (
|
|
|
120
119
|
makeObserver(
|
|
121
120
|
~next=res => onResult(Ok(res->convertResponse)),
|
|
122
121
|
~error=err => onResult(Error(err)),
|
|
123
|
-
(),
|
|
124
122
|
),
|
|
125
123
|
)
|
|
126
124
|
->ignoreSubscription
|
|
@@ -133,13 +131,7 @@ let fetchPromised = (
|
|
|
133
131
|
~convertVariables: 'variables => 'variables,
|
|
134
132
|
) => {
|
|
135
133
|
/**Promise variant of `Query.fetch`.*/
|
|
136
|
-
(
|
|
137
|
-
~environment: Environment.t,
|
|
138
|
-
~variables: 'variables,
|
|
139
|
-
~networkCacheConfig=?,
|
|
140
|
-
~fetchPolicy=?,
|
|
141
|
-
(),
|
|
142
|
-
) => {
|
|
134
|
+
(~environment: Environment.t, ~variables: 'variables, ~networkCacheConfig=?, ~fetchPolicy=?) => {
|
|
143
135
|
fetchQuery(
|
|
144
136
|
environment,
|
|
145
137
|
node,
|
|
@@ -9,7 +9,6 @@ let useQuery: (
|
|
|
9
9
|
~fetchPolicy: fetchPolicy=?,
|
|
10
10
|
~fetchKey: string=?,
|
|
11
11
|
~networkCacheConfig: cacheConfig=?,
|
|
12
|
-
unit,
|
|
13
12
|
) => 'response
|
|
14
13
|
|
|
15
14
|
let useLoader: (
|
|
@@ -18,12 +17,7 @@ let useLoader: (
|
|
|
18
17
|
~mkQueryRef: option<'queryRef> => option<'queryRef>,
|
|
19
18
|
) => unit => (
|
|
20
19
|
option<'queryRef>,
|
|
21
|
-
(
|
|
22
|
-
~variables: 'variables,
|
|
23
|
-
~fetchPolicy: fetchPolicy=?,
|
|
24
|
-
~networkCacheConfig: cacheConfig=?,
|
|
25
|
-
unit,
|
|
26
|
-
) => unit,
|
|
20
|
+
(~variables: 'variables, ~fetchPolicy: fetchPolicy=?, ~networkCacheConfig: cacheConfig=?) => unit,
|
|
27
21
|
unit => unit,
|
|
28
22
|
)
|
|
29
23
|
|
|
@@ -43,7 +37,6 @@ let fetch: (
|
|
|
43
37
|
~onResult: result<'response, Js.Exn.t> => unit,
|
|
44
38
|
~networkCacheConfig: cacheConfig=?,
|
|
45
39
|
~fetchPolicy: fetchPolicy=?,
|
|
46
|
-
unit,
|
|
47
40
|
) => unit
|
|
48
41
|
|
|
49
42
|
let fetchPromised: (
|
|
@@ -55,7 +48,6 @@ let fetchPromised: (
|
|
|
55
48
|
~variables: 'variables,
|
|
56
49
|
~networkCacheConfig: cacheConfig=?,
|
|
57
50
|
~fetchPolicy: fetchPolicy=?,
|
|
58
|
-
unit,
|
|
59
51
|
) => promise<'response>
|
|
60
52
|
|
|
61
53
|
let retain: (
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var RelayRuntime = require("relay-runtime");
|
|
5
5
|
|
|
6
6
|
function subscribe(node, convertVariables, convertResponse) {
|
|
7
|
-
return function (environment, variables, onCompleted, onError, onNext, updater
|
|
7
|
+
return function (environment, variables, onCompleted, onError, onNext, updater) {
|
|
8
8
|
return RelayRuntime.requestSubscription(environment, {
|
|
9
9
|
subscription: node,
|
|
10
10
|
variables: convertVariables(variables),
|