rescript-relay 3.0.0-rc.1 → 3.0.0-rc.3

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 CHANGED
@@ -4,10 +4,20 @@
4
4
 
5
5
  # **Version 3**
6
6
 
7
+ # 3.0.0-rc.3
8
+
9
+ - Fix issue with custom scalars in arrays not being autoconverted properly.
10
+
11
+ # 3.0.0-rc.2
12
+
13
+ - Depend on ReScript v11 and RescriptReact 0.12.0.
14
+ - BREAKING: Use zero cost tagged variants for `RequiredFieldLogger`.
15
+ - Add support for the `relay_resolver.error` event kind.
16
+
7
17
  # 3.0.0-rc.1
8
18
 
9
19
  - Get rid of functor for creating `loadQuery`.
10
- - Support for the `@preloadable` directive
20
+ - Support for the `@preloadable` directive.
11
21
 
12
22
  # 3.0.0-rc.0
13
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.0-rc.3",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@glennsl/rescript-fetch": "^0.2.0",
43
- "@rescript/react": "0.12.0-alpha.2",
43
+ "@rescript/react": "0.12.0",
44
44
  "@testing-library/jest-dom": "^5.16.3",
45
45
  "@testing-library/react": "^13.0.0-alpha.6",
46
46
  "graphql-query-test-mock": "^0.12.1",
@@ -51,19 +51,15 @@
51
51
  "react-dom": "18.2.0",
52
52
  "react-relay": "16.0.0",
53
53
  "relay-runtime": "16.0.0",
54
- "rescript": "^11.0.0-rc.4"
54
+ "rescript": "^11.0.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@rescript/react": "^0.12.0-alpha.2 || next",
58
- "react-relay": ">=15.0.0",
57
+ "@rescript/react": "^0.12.0",
58
+ "react-relay": ">=16.0.0",
59
59
  "relay-runtime": "*",
60
- "rescript": "^11.0.0-alpha.0 || next"
60
+ "rescript": "^11.0.0"
61
61
  },
62
62
  "dependencies": {
63
63
  "detect-libc": "^2.0.1"
64
- },
65
- "resolutions": {
66
- "react": "18.2.0",
67
- "react-dom": "18.2.0"
68
64
  }
69
65
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -4,7 +4,6 @@
4
4
  var React = require("react");
5
5
  var Utils = require("./utils");
6
6
  var Belt_Array = require("rescript/lib/js/belt_Array.js");
7
- var Belt_Option = require("rescript/lib/js/belt_Option.js");
8
7
  var Caml_option = require("rescript/lib/js/caml_option.js");
9
8
  var ReactRelay = require("react-relay");
10
9
  var RelayRuntime = require("relay-runtime");
@@ -129,11 +128,7 @@ var Store = {
129
128
  make: make
130
129
  };
131
130
 
132
- function toJs(f) {
133
- return function (arg) {
134
- f(arg.kind, arg.owner, arg.fieldPath);
135
- };
136
- }
131
+ var RequiredFieldLogger = {};
137
132
 
138
133
  function make$1(network, store, getDataID, treatMissingFieldsAsNull, missingFieldHandlers, requiredFieldLogger, isServer) {
139
134
  return new RelayRuntime.Environment({
@@ -142,7 +137,7 @@ function make$1(network, store, getDataID, treatMissingFieldsAsNull, missingFiel
142
137
  getDataID: getDataID,
143
138
  treatMissingFieldsAsNull: treatMissingFieldsAsNull,
144
139
  missingFieldHandlers: missingFieldHandlers !== undefined ? Belt_Array.concat(missingFieldHandlers, [nodeInterfaceMissingFieldHandler]) : [nodeInterfaceMissingFieldHandler],
145
- requiredFieldLogger: Belt_Option.map(requiredFieldLogger, toJs),
140
+ requiredFieldLogger: requiredFieldLogger,
146
141
  isServer: isServer
147
142
  });
148
143
  }
@@ -223,8 +218,6 @@ function MakeLoadQuery(C) {
223
218
 
224
219
  var Mutation_failed = /* @__PURE__ */Caml_exceptions.create("RescriptRelay.Mutation_failed");
225
220
 
226
- var RequiredFieldLogger = {};
227
-
228
221
  exports.convertObj = convertObj;
229
222
  exports.RecordProxy = RecordProxy;
230
223
  exports.RecordSourceSelectorProxy = RecordSourceSelectorProxy;
@@ -552,16 +552,18 @@ module Store = {
552
552
  }
553
553
 
554
554
  module RequiredFieldLogger = {
555
- type kind = [#"missing_field.log" | #"missing_field.throw"]
556
-
557
- type arg = {"kind": kind, "owner": string, "fieldPath": string}
558
-
559
- type js = arg => unit
560
-
561
- type t = (~kind: kind, ~owner: string, ~fieldPath: string) => unit
562
-
563
- let toJs: t => js = f => arg =>
564
- f(~kind=arg["kind"], ~owner=arg["owner"], ~fieldPath=arg["fieldPath"])
555
+ @tag("kind")
556
+ type arg =
557
+ | @as("missing_field.log") MissingFieldLog({owner: string, fieldPath: string})
558
+ | @as("missing_field.throw") MissingFieldThrow({owner: string, fieldPath: string})
559
+ | @as("relay_resolver.error")
560
+ RelayResolverError({
561
+ owner: string,
562
+ fieldPath: string,
563
+ error: Js.Exn.t,
564
+ })
565
+
566
+ type t = arg => unit
565
567
  }
566
568
 
567
569
  module Environment = {
@@ -573,7 +575,7 @@ module Environment = {
573
575
  getDataID?: (~nodeObj: 'a, ~typeName: string) => string,
574
576
  treatMissingFieldsAsNull?: bool,
575
577
  missingFieldHandlers: array<MissingFieldHandler.t>,
576
- requiredFieldLogger?: RequiredFieldLogger.js,
578
+ requiredFieldLogger?: RequiredFieldLogger.t,
577
579
  isServer?: bool,
578
580
  }
579
581
 
@@ -598,7 +600,7 @@ module Environment = {
598
600
  | Some(handlers) => handlers->Belt.Array.concat([nodeInterfaceMissingFieldHandler])
599
601
  | None => [nodeInterfaceMissingFieldHandler]
600
602
  },
601
- requiredFieldLogger: ?requiredFieldLogger->Belt.Option.map(RequiredFieldLogger.toJs),
603
+ ?requiredFieldLogger,
602
604
  ?isServer,
603
605
  })
604
606
 
@@ -689,10 +689,19 @@ module Disposable: {
689
689
 
690
690
  /**A required field logger, which gets called when a field annotated with the @required directive was missing from the response*/
691
691
  module RequiredFieldLogger: {
692
- type kind = [#"missing_field.log" | #"missing_field.throw"]
692
+ @tag("kind")
693
+ type arg =
694
+ | @as("missing_field.log") MissingFieldLog({owner: string, fieldPath: string})
695
+ | @as("missing_field.throw") MissingFieldThrow({owner: string, fieldPath: string})
696
+ | @as("relay_resolver.error")
697
+ RelayResolverError({
698
+ owner: string,
699
+ fieldPath: string,
700
+ error: Js.Exn.t,
701
+ })
693
702
 
694
703
  /**A required field logger, which gets called when a field annotated with the @required directive was missing from the response*/
695
- type t = (~kind: kind, ~owner: string, ~fieldPath: string) => unit
704
+ type t = arg => unit
696
705
  }
697
706
 
698
707
  /**Module representing the environment, which you'll need to use and pass to various functions. Takes a few configuration options like store and network layer.*/