rescript-relay 0.0.0-test-linux-7ced6072 → 0.0.0-test-rust-compiler-d42079d3
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 +61 -0
- package/README.md +1 -1
- package/bsconfig.json +1 -1
- package/cli/cli.js +478 -0
- package/package.json +15 -20
- package/postinstall.js +40 -13
- package/ppx-darwin +0 -0
- package/ppx-linux +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/src/ReactDOMExperimental.bs.js +19 -1
- package/src/ReactDOMExperimental.res +16 -3
- package/src/ReactExperimental.bs.js +1 -16
- package/src/ReactExperimental.res +4 -20
- package/src/RescriptRelay.bs.js +19 -20
- package/src/RescriptRelay.res +28 -26
- package/src/RescriptRelay.resi +22 -34
- package/src/experimental-router/RescriptRelayRouter.bs.js +419 -0
- package/src/experimental-router/RescriptRelayRouter.res +377 -0
- package/src/experimental-router/RescriptRelayRouter.resi +76 -0
- package/src/utils.js +8 -10
- package/bin-darwin +0 -0
- package/bin-linux +0 -0
- package/compiler/compiler-cli.js +0 -54
- package/language-plugin/dist/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rescript-relay",
|
|
3
|
-
"version": "0.0.0-test-
|
|
3
|
+
"version": "0.0.0-test-rust-compiler-d42079d3",
|
|
4
4
|
"main": "src/RescriptRelay.res",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gabriel Nordeborn",
|
|
@@ -20,49 +20,44 @@
|
|
|
20
20
|
"rescript"
|
|
21
21
|
],
|
|
22
22
|
"bin": {
|
|
23
|
-
"rescript-relay-compiler": "compiler
|
|
23
|
+
"rescript-relay-compiler": "compiler.js",
|
|
24
|
+
"rescript-relay-cli": "cli/cli.js"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"build": "rescript build -with-deps",
|
|
27
|
-
"build:test": "compiler
|
|
28
|
+
"build:test": "./build-compiler-dev.sh && ./rescript-relay-compiler",
|
|
28
29
|
"postinstall": "node postinstall.js",
|
|
29
30
|
"test": "jest",
|
|
30
31
|
"test:ci": "jest --ci --runInBand"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@rescript/react": "0.10.3",
|
|
34
|
-
"@testing-library/jest-dom": "^
|
|
35
|
-
"@testing-library/react": "^
|
|
35
|
+
"@testing-library/jest-dom": "^5.16.1",
|
|
36
|
+
"@testing-library/react": "^13.0.0-alpha.5",
|
|
36
37
|
"bs-fetch": "^0.5.0",
|
|
37
38
|
"graphql": "14.5.0",
|
|
38
39
|
"graphql-query-test-mock": "^0.12.1",
|
|
39
|
-
"jest": "^
|
|
40
|
+
"jest": "^27.2.4",
|
|
40
41
|
"nock": "^11.7.0",
|
|
41
42
|
"node-fetch": "^2.6.0",
|
|
42
|
-
"react": "0.0.0
|
|
43
|
-
"react-dom": "0.0.0
|
|
44
|
-
"react-relay": "
|
|
45
|
-
"
|
|
46
|
-
"relay-compiler": "^11.0.0",
|
|
47
|
-
"relay-config": "^11.0.0",
|
|
48
|
-
"relay-runtime": "^11.0.0"
|
|
43
|
+
"react": "^18.0.0-rc.0",
|
|
44
|
+
"react-dom": "^18.0.0-rc.0",
|
|
45
|
+
"react-relay": "12.0.0",
|
|
46
|
+
"relay-runtime": "12.0.0"
|
|
49
47
|
},
|
|
50
48
|
"peerDependencies": {
|
|
51
49
|
"@rescript/react": "*",
|
|
52
50
|
"graphql": "*",
|
|
53
51
|
"react-relay": "*",
|
|
54
|
-
"rescript": "^9.1.2",
|
|
55
|
-
"reason-promise": "^1.0.2",
|
|
56
|
-
"relay-compiler": "*",
|
|
57
52
|
"relay-config": "*",
|
|
58
|
-
"relay-runtime": "*"
|
|
53
|
+
"relay-runtime": "*",
|
|
54
|
+
"rescript": "^9.1.2"
|
|
59
55
|
},
|
|
60
56
|
"dependencies": {
|
|
61
|
-
"mkdirp-sync": "^0.0.3",
|
|
62
57
|
"rescript": "^9.1.2"
|
|
63
58
|
},
|
|
64
59
|
"resolutions": {
|
|
65
|
-
"react": "0.0.0
|
|
66
|
-
"react-dom": "0.0.0
|
|
60
|
+
"react": "18.0.0-rc.0",
|
|
61
|
+
"react-dom": "18.0.0-rc.0"
|
|
67
62
|
}
|
|
68
63
|
}
|
package/postinstall.js
CHANGED
|
@@ -10,16 +10,27 @@
|
|
|
10
10
|
var path = require("path");
|
|
11
11
|
var cp = require("child_process");
|
|
12
12
|
var fs = require("fs");
|
|
13
|
-
var os = require("os");
|
|
14
13
|
var platform = process.platform;
|
|
15
14
|
|
|
15
|
+
function getRelayCompilerPlatformSuffix() {
|
|
16
|
+
if (process.platform === "darwin" && process.arch === "x64") {
|
|
17
|
+
return "macos-x64";
|
|
18
|
+
} else if (process.platform === "darwin" && process.arch === "arm64") {
|
|
19
|
+
return "macos-arm64";
|
|
20
|
+
} else if (process.platform === "linux" && process.arch === "x64") {
|
|
21
|
+
return "linux-x64";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return "linux-x64";
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
/**
|
|
17
28
|
* Since os.arch returns node binary's target arch, not
|
|
18
29
|
* the system arch.
|
|
19
30
|
* Credits: https://github.com/feross/arch/blob/af080ff61346315559451715c5393d8e86a6d33c/index.js#L10-L58
|
|
20
31
|
*/
|
|
21
32
|
|
|
22
|
-
function
|
|
33
|
+
function ppxArch() {
|
|
23
34
|
/**
|
|
24
35
|
* Use Rosetta for ARM on macOS
|
|
25
36
|
*/
|
|
@@ -80,39 +91,55 @@ function arch() {
|
|
|
80
91
|
}
|
|
81
92
|
|
|
82
93
|
function copyPlatformBinaries(platform) {
|
|
94
|
+
/**
|
|
95
|
+
* Copy the PPX
|
|
96
|
+
*/
|
|
83
97
|
fs.copyFileSync(
|
|
84
98
|
path.join(__dirname, "ppx-" + platform),
|
|
85
99
|
path.join(__dirname, "ppx")
|
|
86
100
|
);
|
|
87
101
|
fs.chmodSync(path.join(__dirname, "ppx"), 0777);
|
|
88
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Copy the Relay compiler
|
|
105
|
+
*/
|
|
106
|
+
|
|
89
107
|
fs.copyFileSync(
|
|
90
|
-
path.join(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
path.join(
|
|
109
|
+
__dirname,
|
|
110
|
+
"relay-compiler-" + getRelayCompilerPlatformSuffix(),
|
|
111
|
+
"relay"
|
|
112
|
+
),
|
|
113
|
+
path.join(__dirname, "rescript-relay-compiler.exe")
|
|
96
114
|
);
|
|
115
|
+
fs.chmodSync(path.join(__dirname, "rescript-relay-compiler.exe"), 0777);
|
|
97
116
|
}
|
|
98
117
|
|
|
99
118
|
function removeInitialBinaries() {
|
|
100
119
|
fs.unlinkSync(path.join(__dirname, "ppx-darwin"));
|
|
101
120
|
fs.unlinkSync(path.join(__dirname, "ppx-linux"));
|
|
102
|
-
fs.
|
|
103
|
-
|
|
121
|
+
fs.rmSync(path.join(__dirname, "relay-compiler-linux-x64"), {
|
|
122
|
+
recursive: true,
|
|
123
|
+
force: true,
|
|
124
|
+
});
|
|
125
|
+
fs.rmSync(path.join(__dirname, "relay-compiler-macos-x64"), {
|
|
126
|
+
recursive: true,
|
|
127
|
+
force: true,
|
|
128
|
+
});
|
|
129
|
+
fs.rmSync(path.join(__dirname, "relay-compiler-macos-arm64"), {
|
|
130
|
+
recursive: true,
|
|
131
|
+
force: true,
|
|
132
|
+
});
|
|
104
133
|
}
|
|
105
134
|
|
|
106
135
|
switch (platform) {
|
|
107
136
|
case "win32": {
|
|
108
|
-
if (
|
|
137
|
+
if (ppxArch() !== "x64") {
|
|
109
138
|
console.warn("error: x86 is currently not supported on Windows");
|
|
110
139
|
process.exit(1);
|
|
111
140
|
}
|
|
112
141
|
|
|
113
142
|
throw new Error("Windows currently not supported.");
|
|
114
|
-
copyPlatformBinaries("windows");
|
|
115
|
-
break;
|
|
116
143
|
}
|
|
117
144
|
case "linux":
|
|
118
145
|
case "darwin":
|
package/ppx-darwin
CHANGED
|
Binary file
|
package/ppx-linux
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var ReactDom = require("react-dom");
|
|
5
|
+
|
|
6
|
+
function renderConcurrentRootAtElementWithId(content, id) {
|
|
7
|
+
var element = document.getElementById(id);
|
|
8
|
+
if (element == null) {
|
|
9
|
+
throw {
|
|
10
|
+
RE_EXN_ID: "Invalid_argument",
|
|
11
|
+
_1: "ReactExperimental.renderConcurrentRootAtElementWithId : no element of id " + id + " found in the HTML.",
|
|
12
|
+
Error: new Error()
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
ReactDom.createRoot(element).render(content);
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.renderConcurrentRootAtElementWithId = renderConcurrentRootAtElementWithId;
|
|
20
|
+
/* react-dom Not a pure module */
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
include ReactDOM.Experimental
|
|
2
2
|
|
|
3
3
|
@module("react-dom")
|
|
4
|
-
external
|
|
4
|
+
external createRoot: Dom.element => root = "createRoot"
|
|
5
5
|
|
|
6
|
-
@
|
|
7
|
-
external
|
|
6
|
+
@val @return(nullable)
|
|
7
|
+
external getElementById: string => option<Dom.element> = "document.getElementById"
|
|
8
|
+
|
|
9
|
+
let renderConcurrentRootAtElementWithId: (React.element, string) => unit = (content, id) =>
|
|
10
|
+
switch getElementById(id) {
|
|
11
|
+
| None =>
|
|
12
|
+
raise(
|
|
13
|
+
Invalid_argument(
|
|
14
|
+
"ReactExperimental.renderConcurrentRootAtElementWithId : no element of id " ++
|
|
15
|
+
id ++ " found in the HTML.",
|
|
16
|
+
),
|
|
17
|
+
)
|
|
18
|
+
| Some(element) =>
|
|
19
|
+
createRoot(element)->render(content)
|
|
20
|
+
}
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var ReactDom = require("react-dom");
|
|
5
4
|
|
|
6
5
|
var SuspenseList = {};
|
|
7
6
|
|
|
8
|
-
function renderConcurrentRootAtElementWithId(content, id) {
|
|
9
|
-
var element = document.getElementById(id);
|
|
10
|
-
if (element == null) {
|
|
11
|
-
throw {
|
|
12
|
-
RE_EXN_ID: "Invalid_argument",
|
|
13
|
-
_1: "ReactExperimental.renderConcurrentRootAtElementWithId : no element of id " + id + " found in the HTML.",
|
|
14
|
-
Error: new Error()
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
ReactDom.unstable_createRoot(element).render(content);
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
7
|
exports.SuspenseList = SuspenseList;
|
|
22
|
-
|
|
23
|
-
/* react-dom Not a pure module */
|
|
8
|
+
/* No side effect */
|
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
type callback<'input, 'output> = 'input => 'output
|
|
2
2
|
|
|
3
3
|
@module("react")
|
|
4
|
-
external
|
|
4
|
+
external useDeferredValue: 'value => 'value = "useDeferredValue"
|
|
5
5
|
|
|
6
6
|
@module("react")
|
|
7
|
-
external
|
|
8
|
-
"
|
|
7
|
+
external useTransition: unit => (bool, callback<callback<unit, unit>, unit>) =
|
|
8
|
+
"useTransition"
|
|
9
9
|
|
|
10
10
|
module SuspenseList = {
|
|
11
11
|
@module("react") @react.component
|
|
12
12
|
external make: (
|
|
13
13
|
~children: React.element,
|
|
14
14
|
~revealOrder: [#forwards | #backwards | #together]=?,
|
|
15
|
-
) => React.element = "
|
|
15
|
+
) => React.element = "SuspenseList"
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
@val @return(nullable)
|
|
19
|
-
external getElementById: string => option<Dom.element> = "document.getElementById"
|
|
20
|
-
|
|
21
|
-
let renderConcurrentRootAtElementWithId: (React.element, string) => unit = (content, id) =>
|
|
22
|
-
switch getElementById(id) {
|
|
23
|
-
| None =>
|
|
24
|
-
raise(
|
|
25
|
-
Invalid_argument(
|
|
26
|
-
"ReactExperimental.renderConcurrentRootAtElementWithId : no element of id " ++
|
|
27
|
-
id ++ " found in the HTML.",
|
|
28
|
-
),
|
|
29
|
-
)
|
|
30
|
-
| Some(element) =>
|
|
31
|
-
ReactDOMExperimental.unstable_createRoot(element)->ReactDOMExperimental.render(content)
|
|
32
|
-
}
|
package/src/RescriptRelay.bs.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
var Curry = require("rescript/lib/js/curry.js");
|
|
5
5
|
var React = require("react");
|
|
6
6
|
var Utils = require("./utils");
|
|
7
|
-
var $$Promise = require("reason-promise/src/js/promise.bs.js");
|
|
8
7
|
var Belt_Array = require("rescript/lib/js/belt_Array.js");
|
|
9
8
|
var Caml_option = require("rescript/lib/js/caml_option.js");
|
|
10
9
|
var ReactRelay = require("react-relay");
|
|
@@ -220,25 +219,25 @@ function MakeLoadQuery(C) {
|
|
|
220
219
|
return Caml_option.nullable_to_opt(token.source);
|
|
221
220
|
};
|
|
222
221
|
var queryRefToPromise = function (token) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
222
|
+
return new Promise((function (resolve, param) {
|
|
223
|
+
var o = queryRefToObservable(token);
|
|
224
|
+
if (o !== undefined) {
|
|
225
|
+
Caml_option.valFromOption(o).subscribe({
|
|
226
|
+
complete: (function (param) {
|
|
227
|
+
return resolve({
|
|
228
|
+
TAG: /* Ok */0,
|
|
229
|
+
_0: undefined
|
|
230
|
+
});
|
|
231
|
+
})
|
|
232
|
+
});
|
|
233
|
+
return ;
|
|
234
|
+
} else {
|
|
235
|
+
return resolve({
|
|
236
|
+
TAG: /* Error */1,
|
|
237
|
+
_0: undefined
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}));
|
|
242
241
|
};
|
|
243
242
|
return {
|
|
244
243
|
load: load,
|
package/src/RescriptRelay.res
CHANGED
|
@@ -371,12 +371,16 @@ module MissingFieldHandler = {
|
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
// This handler below enables automatic resolution of all cached items through the Node interface
|
|
374
|
-
let nodeInterfaceMissingFieldHandler = MissingFieldHandler.makeLinkedMissingFieldHandler(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
374
|
+
let nodeInterfaceMissingFieldHandler = MissingFieldHandler.makeLinkedMissingFieldHandler((
|
|
375
|
+
field,
|
|
376
|
+
record,
|
|
377
|
+
args,
|
|
378
|
+
_store,
|
|
379
|
+
) =>
|
|
380
|
+
switch (Js.Nullable.toOption(record), field["name"], Js.Nullable.toOption(args["id"])) {
|
|
381
|
+
| (Some(record), "node", argsId) if record["__typename"] == storeRootType => argsId
|
|
382
|
+
| _ => None
|
|
383
|
+
}
|
|
380
384
|
)
|
|
381
385
|
|
|
382
386
|
module ConnectionHandler = {
|
|
@@ -443,9 +447,9 @@ module Observable = {
|
|
|
443
447
|
}
|
|
444
448
|
|
|
445
449
|
type sink<'response> = {
|
|
446
|
-
next: 'response => unit,
|
|
447
|
-
error: Js.Exn.t => unit,
|
|
448
|
-
complete: unit => unit,
|
|
450
|
+
next: (. 'response) => unit,
|
|
451
|
+
error: (. Js.Exn.t) => unit,
|
|
452
|
+
complete: (. unit) => unit,
|
|
449
453
|
closed: bool,
|
|
450
454
|
}
|
|
451
455
|
|
|
@@ -453,11 +457,11 @@ module Observable = {
|
|
|
453
457
|
|
|
454
458
|
@obj
|
|
455
459
|
external makeObserver: (
|
|
456
|
-
~start: subscription => unit=?,
|
|
457
|
-
~next: 'response => unit=?,
|
|
458
|
-
~error: Js.Exn.t => unit=?,
|
|
459
|
-
~complete: unit => unit=?,
|
|
460
|
-
~unsubscribe: subscription => unit=?,
|
|
460
|
+
~start: @uncurry subscription => unit=?,
|
|
461
|
+
~next: @uncurry 'response => unit=?,
|
|
462
|
+
~error: @uncurry Js.Exn.t => unit=?,
|
|
463
|
+
~complete: @uncurry unit => unit=?,
|
|
464
|
+
~unsubscribe: @uncurry subscription => unit=?,
|
|
461
465
|
unit,
|
|
462
466
|
) => observer<'response> = ""
|
|
463
467
|
|
|
@@ -467,7 +471,7 @@ module Observable = {
|
|
|
467
471
|
@send
|
|
468
472
|
external subscribe: (t<'response>, observer<'response>) => subscription = "subscribe"
|
|
469
473
|
|
|
470
|
-
@send external toPromise: t<'t> => Promise.t<'t> = "toPromise"
|
|
474
|
+
@send external toPromise: t<'t> => Js.Promise.t<'t> = "toPromise"
|
|
471
475
|
}
|
|
472
476
|
|
|
473
477
|
module Network = {
|
|
@@ -705,18 +709,16 @@ module MakeLoadQuery = (C: MakeLoadQueryConfig) => {
|
|
|
705
709
|
}
|
|
706
710
|
|
|
707
711
|
let queryRefToPromise = token => {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
712
|
+
Js.Promise.make((~resolve, ~reject as _) => {
|
|
713
|
+
switch token->queryRefToObservable {
|
|
714
|
+
| None => resolve(. Error())
|
|
715
|
+
| Some(o) =>
|
|
716
|
+
let _: Observable.subscription = o->{
|
|
717
|
+
open Observable
|
|
718
|
+
subscribe(makeObserver(~complete=() => resolve(. Ok()), ()))
|
|
719
|
+
}
|
|
716
720
|
}
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
promise
|
|
721
|
+
})
|
|
720
722
|
}
|
|
721
723
|
}
|
|
722
724
|
|
package/src/RescriptRelay.resi
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
)
|
|
4
4
|
type arguments
|
|
5
5
|
|
|
6
|
-
@ocaml.doc(
|
|
7
|
-
"Abstract type for uploadables.
|
|
6
|
+
@ocaml.doc("Abstract type for uploadables.
|
|
8
7
|
|
|
9
8
|
### Constructing an `uploadables`
|
|
10
9
|
Use `makeUploadable`: `makeUploadable({ \"someFile\": theFileYouWantToUpload })` to construct an `uploadables`, and then pass it to your mutation via the `uploadables` prop.
|
|
11
10
|
|
|
12
|
-
Please note that you'll need to handle _sending_ the uploadables to your server yourself in the network layer. [Here's an example](https://github.com/facebook/relay/issues/1844#issuecomment-316893590) in regular JS that you can adapt to ReScript as you need/want."
|
|
13
|
-
)
|
|
11
|
+
Please note that you'll need to handle _sending_ the uploadables to your server yourself in the network layer. [Here's an example](https://github.com/facebook/relay/issues/1844#issuecomment-316893590) in regular JS that you can adapt to ReScript as you need/want.")
|
|
14
12
|
type uploadables
|
|
15
13
|
|
|
16
14
|
@ocaml.doc(
|
|
@@ -55,12 +53,10 @@ external dataIdToString: dataId => string = "%identity"
|
|
|
55
53
|
@ocaml.doc("Turns a `string` into a `dataId`.")
|
|
56
54
|
external makeDataId: string => dataId = "%identity"
|
|
57
55
|
|
|
58
|
-
@ocaml.doc(
|
|
59
|
-
"Construct an `arguments` object for use with certain Relay store APIs.
|
|
56
|
+
@ocaml.doc("Construct an `arguments` object for use with certain Relay store APIs.
|
|
60
57
|
|
|
61
58
|
### Usage
|
|
62
|
-
Use it like this: `makeArguments({ \"someArgument\": someValue, \"anotherArgument\": anotherValue })`. Notice the \"\" surrounding the property names - these are important and tells ReScript that we want this to be a JS object."
|
|
63
|
-
)
|
|
59
|
+
Use it like this: `makeArguments({ \"someArgument\": someValue, \"anotherArgument\": anotherValue })`. Notice the \"\" surrounding the property names - these are important and tells ReScript that we want this to be a JS object.")
|
|
64
60
|
external makeArguments: {..} => arguments = "%identity"
|
|
65
61
|
|
|
66
62
|
@ocaml.doc(
|
|
@@ -110,11 +106,9 @@ type featureFlags = {
|
|
|
110
106
|
@module("relay-runtime")
|
|
111
107
|
external relayFeatureFlags: featureFlags = "RelayFeatureFlags"
|
|
112
108
|
|
|
113
|
-
@ocaml.doc(
|
|
114
|
-
"An abstract type representing all records in the store serialized to JSON in a way that you can use to re-hydrate the store.
|
|
109
|
+
@ocaml.doc("An abstract type representing all records in the store serialized to JSON in a way that you can use to re-hydrate the store.
|
|
115
110
|
|
|
116
|
-
See `RecordSource.toJSON` for how to produce it."
|
|
117
|
-
)
|
|
111
|
+
See `RecordSource.toJSON` for how to produce it.")
|
|
118
112
|
type recordSourceRecords
|
|
119
113
|
|
|
120
114
|
@ocaml.doc(
|
|
@@ -357,13 +351,11 @@ module RecordProxy: {
|
|
|
357
351
|
unit,
|
|
358
352
|
) => t = "setLinkedRecords"
|
|
359
353
|
|
|
360
|
-
@ocaml.doc(
|
|
361
|
-
"Invalidates this record.
|
|
354
|
+
@ocaml.doc("Invalidates this record.
|
|
362
355
|
|
|
363
356
|
Invalidating a record means that the _next_ time Relay evaluates this record, it'll be treated as missing.
|
|
364
357
|
|
|
365
|
-
_Beware_ that this doesn't mean that queries using this record will refetch immediately. Rather, it'll happen the next time the query _renders_. Have a look at `useSubscribeToInvalidationState`, that'll allow you to subscribe to whenever records are invalidated, if you're looking for a way to refetch immediately as something invalidates."
|
|
366
|
-
)
|
|
358
|
+
_Beware_ that this doesn't mean that queries using this record will refetch immediately. Rather, it'll happen the next time the query _renders_. Have a look at `useSubscribeToInvalidationState`, that'll allow you to subscribe to whenever records are invalidated, if you're looking for a way to refetch immediately as something invalidates.")
|
|
367
359
|
@send
|
|
368
360
|
external invalidateRecord: t => unit = "invalidateRecord"
|
|
369
361
|
}
|
|
@@ -426,11 +418,9 @@ module ReadOnlyRecordSourceProxy: {
|
|
|
426
418
|
external getRoot: t => RecordProxy.t = "getRoot"
|
|
427
419
|
}
|
|
428
420
|
|
|
429
|
-
@ocaml.doc(
|
|
430
|
-
"A missing field handler, which is a way of teaching Relay more about the relations in your schema, so it can fulfill more things from the cache. Read more [in this section of the Relay docs](https://relay.dev/docs/guided-tour/reusing-cached-data/filling-in-missing-data/).
|
|
421
|
+
@ocaml.doc("A missing field handler, which is a way of teaching Relay more about the relations in your schema, so it can fulfill more things from the cache. Read more [in this section of the Relay docs](https://relay.dev/docs/guided-tour/reusing-cached-data/filling-in-missing-data/).
|
|
431
422
|
|
|
432
|
-
Feed a list of missing field handlers into `Environment.make` if you want to use them."
|
|
433
|
-
)
|
|
423
|
+
Feed a list of missing field handlers into `Environment.make` if you want to use them.")
|
|
434
424
|
module MissingFieldHandler: {
|
|
435
425
|
@@ocaml.warning("-30")
|
|
436
426
|
|
|
@@ -607,9 +597,9 @@ module Observable: {
|
|
|
607
597
|
|
|
608
598
|
@ocaml.doc("This sink can be used to give the observable new data.")
|
|
609
599
|
type sink<'response> = {
|
|
610
|
-
next: 'response => unit,
|
|
611
|
-
error: Js.Exn.t => unit,
|
|
612
|
-
complete: unit => unit,
|
|
600
|
+
next: (. 'response) => unit,
|
|
601
|
+
error: (. Js.Exn.t) => unit,
|
|
602
|
+
complete: (. unit) => unit,
|
|
613
603
|
closed: bool,
|
|
614
604
|
}
|
|
615
605
|
|
|
@@ -624,10 +614,10 @@ module Observable: {
|
|
|
624
614
|
|
|
625
615
|
@ocaml.doc("Create an observer.") @obj
|
|
626
616
|
external makeObserver: (
|
|
627
|
-
~start: subscription => unit=?,
|
|
628
|
-
~next: 'response => unit=?,
|
|
629
|
-
~error: Js.Exn.t => unit=?,
|
|
630
|
-
~complete: unit => unit=?,
|
|
617
|
+
~start: @uncurry subscription => unit=?,
|
|
618
|
+
~next: @uncurry 'response => unit=?,
|
|
619
|
+
~error: @uncurry Js.Exn.t => unit=?,
|
|
620
|
+
~complete: @uncurry unit => unit=?,
|
|
631
621
|
~unsubscribe: subscription => unit=?,
|
|
632
622
|
unit,
|
|
633
623
|
) => observer<'response> = ""
|
|
@@ -646,7 +636,7 @@ module Observable: {
|
|
|
646
636
|
"Turns an `Observable` into a promise. _Beware_ that reading the response in the resulting promise is currently _not safe_ due to some internals of how ReScript Relay works. This will be resolved in the future."
|
|
647
637
|
)
|
|
648
638
|
@send
|
|
649
|
-
external toPromise: t<'t> => Promise.t<'t> = "toPromise"
|
|
639
|
+
external toPromise: t<'t> => Js.Promise.t<'t> = "toPromise"
|
|
650
640
|
}
|
|
651
641
|
|
|
652
642
|
@ocaml.doc("Represents the network layer.")
|
|
@@ -737,7 +727,7 @@ module Store: {
|
|
|
737
727
|
~source: RecordSource.t,
|
|
738
728
|
~gcReleaseBufferSize: /* `gcReleaseBufferSize` controls how many queries are allowed to be cached by default. Increase this to increase the size of the cache. */
|
|
739
729
|
int=?,
|
|
740
|
-
~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.
|
|
730
|
+
~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. */,
|
|
741
731
|
unit,
|
|
742
732
|
) => t
|
|
743
733
|
|
|
@@ -790,10 +780,8 @@ module Environment: {
|
|
|
790
780
|
@ocaml.doc("Given an `operationDescriptor`, commits the corresponding payload.") @send
|
|
791
781
|
external commitPayload: (t, operationDescriptor, 'payload) => unit = "commitPayload"
|
|
792
782
|
|
|
793
|
-
@ocaml.doc(
|
|
794
|
-
|
|
795
|
-
You should use the generated `Query.retain` function on your queries instead of using this directly."
|
|
796
|
-
)
|
|
783
|
+
@ocaml.doc("Given an `operationDescriptor`, retains the corresponding operation so any data referenced by it isn't garbage collected.
|
|
784
|
+
You should use the generated `Query.retain` function on your queries instead of using this directly.")
|
|
797
785
|
@send
|
|
798
786
|
external retain: (t, operationDescriptor) => Disposable.t = "retain"
|
|
799
787
|
}
|
|
@@ -897,5 +885,5 @@ module MakeLoadQuery: (C: MakeLoadQueryConfig) =>
|
|
|
897
885
|
) => C.loadedQueryRef
|
|
898
886
|
|
|
899
887
|
let queryRefToObservable: C.loadedQueryRef => option<Observable.t<C.response>>
|
|
900
|
-
let queryRefToPromise: C.loadedQueryRef => Promise.t<Belt.Result.t<unit, unit>>
|
|
888
|
+
let queryRefToPromise: C.loadedQueryRef => Js.Promise.t<Belt.Result.t<unit, unit>>
|
|
901
889
|
}
|