rescript-relay 1.0.0-beta.21 → 1.0.0-beta.24

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
@@ -1,6 +1,6 @@
1
1
  # master
2
2
 
3
- # 1.0.0-beta.21
3
+ # 1.0.0-beta.24
4
4
 
5
5
  _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/5831c2f1f0f13eedc1cb60468c32fd32b2dc01d3)_
6
6
 
@@ -49,6 +49,23 @@ You can go ahead and remove these packages, that are no longer needed, as the co
49
49
 
50
50
  ### unreleased
51
51
 
52
+ ## beta.24
53
+
54
+ - Fix compatibility with ReScript v10
55
+
56
+ ## beta.23
57
+
58
+ - Add Environment isServer option @MoOx
59
+ - Fix incorrect react-relay peerDependencies version @MoOx
60
+ - Remove rescript from dependencies @anmonteiro
61
+ - Fix instantiation of Relay context @vikfroberg
62
+ - Add undocumented holdGC method on relay store @MoOx
63
+
64
+ ### beta.22
65
+
66
+ - Fix locations for `%relay.deferredComponent` so jump-to-definition, hover etc works as expected (pointing to the dynamically imported module rather than what the PPX produces).
67
+ - Add links for `Operation` module in `Query`, `Mutation`, `Subscription` and `Fragment` ([XiNiHa](https://github.com/XiNiHa))
68
+
52
69
  ### beta.21
53
70
 
54
71
  - Support formatting commented out operations in the CLI ([reck753](https://github.com/reck753)).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "1.0.0-beta.21",
3
+ "version": "1.0.0-beta.24",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
@@ -39,6 +39,7 @@
39
39
  "test:ci": "jest --ci --runInBand"
40
40
  },
41
41
  "devDependencies": {
42
+ "rescript": "^9.1.2",
42
43
  "@rescript/react": "0.10.3",
43
44
  "@testing-library/jest-dom": "^5.16.3",
44
45
  "@testing-library/react": "^13.0.0-alpha.6",
@@ -54,13 +55,12 @@
54
55
  },
55
56
  "peerDependencies": {
56
57
  "@rescript/react": "*",
57
- "react-relay": "*",
58
+ "react-relay": ">=11.0.0",
58
59
  "relay-runtime": "*",
59
60
  "rescript": "^9.1.2"
60
61
  },
61
62
  "dependencies": {
62
- "detect-libc": "^2.0.1",
63
- "rescript": "^9.1.2"
63
+ "detect-libc": "^2.0.1"
64
64
  },
65
65
  "resolutions": {
66
66
  "react": "18.0.0",
package/ppx-darwin CHANGED
Binary file
package/ppx-linux CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -10,7 +10,6 @@ var Caml_option = require("rescript/lib/js/caml_option.js");
10
10
  var ReactRelay = require("react-relay");
11
11
  var RelayRuntime = require("relay-runtime");
12
12
  var Caml_exceptions = require("rescript/lib/js/caml_exceptions.js");
13
- var Hooks = require("react-relay/hooks");
14
13
 
15
14
  function convertObj(prim0, prim1, prim2, prim3) {
16
15
  return Utils.traverser(prim0, prim1, prim2, prim3);
@@ -135,7 +134,7 @@ function toJs(f, arg) {
135
134
  return Curry._3(f, arg.kind, arg.owner, arg.fieldPath);
136
135
  }
137
136
 
138
- function make$1(network, store, getDataID, treatMissingFieldsAsNull, missingFieldHandlers, requiredFieldLogger, param) {
137
+ function make$1(network, store, getDataID, treatMissingFieldsAsNull, missingFieldHandlers, requiredFieldLogger, isServer, param) {
139
138
  var tmp = {
140
139
  network: network,
141
140
  store: store,
@@ -151,6 +150,9 @@ function make$1(network, store, getDataID, treatMissingFieldsAsNull, missingFiel
151
150
  if (tmp$1 !== undefined) {
152
151
  tmp.requiredFieldLogger = Caml_option.valFromOption(tmp$1);
153
152
  }
153
+ if (isServer !== undefined) {
154
+ tmp.isServer = Caml_option.valFromOption(isServer);
155
+ }
154
156
  return new RelayRuntime.Environment(tmp);
155
157
  }
156
158
 
@@ -158,11 +160,10 @@ var Environment = {
158
160
  make: make$1
159
161
  };
160
162
 
161
- var provider = ReactRelay.ReactRelayContext.Provider;
162
-
163
163
  function RescriptRelay$Context$Provider(Props) {
164
164
  var environment = Props.environment;
165
165
  var children = Props.children;
166
+ var provider = ReactRelay.ReactRelayContext.Provider;
166
167
  return React.createElement(provider, {
167
168
  value: {
168
169
  environment: environment
@@ -175,6 +176,10 @@ var Provider = {
175
176
  make: RescriptRelay$Context$Provider
176
177
  };
177
178
 
179
+ var Context = {
180
+ Provider: Provider
181
+ };
182
+
178
183
  var EnvironmentNotFoundInContext = /* @__PURE__ */Caml_exceptions.create("RescriptRelay.EnvironmentNotFoundInContext");
179
184
 
180
185
  function useEnvironmentFromContext(param) {
@@ -218,7 +223,7 @@ function mapFetchQueryFetchPolicy(x) {
218
223
 
219
224
  function MakeLoadQuery(C) {
220
225
  var load = function (environment, variables, fetchPolicy, fetchKey, networkCacheConfig, param) {
221
- return Hooks.loadQuery(environment, C.query, Curry._1(C.convertVariables, variables), {
226
+ return ReactRelay.loadQuery(environment, C.query, Curry._1(C.convertVariables, variables), {
222
227
  fetchKey: fetchKey,
223
228
  fetchPolicy: mapFetchPolicy(fetchPolicy),
224
229
  networkCacheConfig: networkCacheConfig
@@ -259,10 +264,6 @@ var Mutation_failed = /* @__PURE__ */Caml_exceptions.create("RescriptRelay.Mutat
259
264
 
260
265
  var RequiredFieldLogger = {};
261
266
 
262
- var Context = {
263
- Provider: Provider
264
- };
265
-
266
267
  exports.convertObj = convertObj;
267
268
  exports.RecordProxy = RecordProxy;
268
269
  exports.RecordSourceSelectorProxy = RecordSourceSelectorProxy;
@@ -572,6 +572,7 @@ module Store = {
572
572
 
573
573
  @send external getSource: t => RecordSource.t = "getSource"
574
574
  @send external publish: (t, RecordSource.t) => unit = "publish"
575
+ @send external holdGC: t => unit = "holdGC"
575
576
  }
576
577
 
577
578
  module RequiredFieldLogger = {
@@ -601,6 +602,8 @@ module Environment = {
601
602
  missingFieldHandlers: array<MissingFieldHandler.t>,
602
603
  @optional
603
604
  requiredFieldLogger: RequiredFieldLogger.js,
605
+ @optional
606
+ isServer: bool,
604
607
  }
605
608
 
606
609
  @module("relay-runtime") @new
@@ -613,6 +616,7 @@ module Environment = {
613
616
  ~treatMissingFieldsAsNull=?,
614
617
  ~missingFieldHandlers=?,
615
618
  ~requiredFieldLogger=?,
619
+ ~isServer=?,
616
620
  (),
617
621
  ) =>
618
622
  make(
@@ -626,6 +630,7 @@ module Environment = {
626
630
  | None => [nodeInterfaceMissingFieldHandler]
627
631
  },
628
632
  ~requiredFieldLogger=?requiredFieldLogger->Belt.Option.map(RequiredFieldLogger.toJs),
633
+ ~isServer?,
629
634
  (),
630
635
  ),
631
636
  )
@@ -643,15 +648,16 @@ module Context = {
643
648
 
644
649
  @module("react-relay")
645
650
  external context: React.Context.t<option<contextShape>> = "ReactRelayContext"
646
- let provider = React.Context.provider(context)
647
651
 
648
652
  module Provider = {
649
653
  @react.component
650
- let make = (~environment: Environment.t, ~children) =>
654
+ let make = (~environment: Environment.t, ~children) => {
655
+ let provider = React.Context.provider(context)
651
656
  React.createElement(
652
657
  provider,
653
658
  {"value": Some({"environment": environment}), "children": children},
654
659
  )
660
+ }
655
661
  }
656
662
  }
657
663
 
@@ -703,7 +709,7 @@ type loadQueryConfig = {
703
709
  networkCacheConfig: option<cacheConfig>,
704
710
  }
705
711
 
706
- @module("react-relay/hooks")
712
+ @module("react-relay")
707
713
  external loadQuery: (Environment.t, queryNode<'a>, 'variables, loadQueryConfig) => 'queryResponse =
708
714
  "loadQuery"
709
715
 
@@ -775,6 +781,6 @@ external commitLocalUpdate: (
775
781
  ~updater: RecordSourceSelectorProxy.t => unit,
776
782
  ) => unit = "commitLocalUpdate"
777
783
 
778
- @module("react-relay/hooks")
784
+ @module("react-relay")
779
785
  external useSubscribeToInvalidationState: (array<dataId>, unit => unit) => Disposable.t =
780
786
  "useSubscribeToInvalidationState"
@@ -765,6 +765,12 @@ module Store: {
765
765
  )
766
766
  @send
767
767
  external publish: (t, RecordSource.t) => unit = "publish"
768
+
769
+ @ocaml.doc(
770
+ "Informes the store to stop its normal garbage collection processes. This prevents data being lost between calling relay's `fetchQuery` any serialization process (eg: toJSON)"
771
+ )
772
+ @send
773
+ external holdGC: t => unit = "holdGC"
768
774
  }
769
775
 
770
776
  @ocaml.doc("Internal, do not use.")
@@ -810,6 +816,7 @@ module Environment: {
810
816
  ~treatMissingFieldsAsNull: bool=?,
811
817
  ~missingFieldHandlers: array<MissingFieldHandler.t>=?,
812
818
  ~requiredFieldLogger: RequiredFieldLogger.t=?,
819
+ ~isServer: bool=?,
813
820
  unit,
814
821
  ) => t
815
822
 
@@ -891,7 +898,7 @@ external commitLocalUpdate: (
891
898
  @ocaml.doc(
892
899
  "Allows you to subscribe to when a record, connection, or even the store itself is invalidated, and then react to that."
893
900
  )
894
- @module("react-relay/hooks")
901
+ @module("react-relay")
895
902
  external useSubscribeToInvalidationState: (array<dataId>, unit => unit) => Disposable.t =
896
903
  "useSubscribeToInvalidationState"
897
904