From 4e78b59662bfecd636a17e029a69a16046e1606b Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sun, 16 Jun 2024 18:15:19 +0200 Subject: [PATCH] upgrade the compiler and deps to Relay 17.0.0 --- CHANGELOG.md | 4 +++ packages/relay | 2 +- .../__tests__/TestRelayUserResolver.res | 5 +-- .../__tests__/Test_requiredFieldLogger.res | 8 ++--- .../RelaySchemaAssets_graphql.res | 13 +++++++ .../TestRelayResolversQuery_graphql.res | 2 +- packages/rescript-relay/package.json | 10 +++--- packages/rescript-relay/relay.config.js | 2 +- packages/rescript-relay/src/RescriptRelay.res | 8 ++--- .../rescript-relay/src/RescriptRelay.resi | 4 +-- .../src/RescriptRelay_Fragment.res | 2 +- packages/rescript-relay/yarn.lock | 34 +++++++++---------- 12 files changed, 54 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7621ff7f..a1fd721c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ # Unreleased +- **Upgrade versions**: `react-relay` and `relay-runtime` to `17.0.0`. +- BREAKING: The `customScalars` option in the Relay config is now called `customScalarTypes`. +- BREAKING: `requiredFieldLogger` in the `Environment` config is now called `relayFieldLogger`. + # 3.0.0-rc.5 - Support for Relay `@updatable` queries and fragments (https://relay.dev/docs/guided-tour/updating-data/imperatively-modifying-store-data/#optimistic-updaters-vs-updaters). https://github.com/zth/rescript-relay/pull/501 diff --git a/packages/relay b/packages/relay index a30773b8..9cf65b4b 160000 --- a/packages/relay +++ b/packages/relay @@ -1 +1 @@ -Subproject commit a30773b8097f9bf2e69157763be5c6c6398ca318 +Subproject commit 9cf65b4bcbcc3e020f4c760a742e6d4523dd9abc diff --git a/packages/rescript-relay/__tests__/TestRelayUserResolver.res b/packages/rescript-relay/__tests__/TestRelayUserResolver.res index 39fad097..6d581d58 100644 --- a/packages/rescript-relay/__tests__/TestRelayUserResolver.res +++ b/packages/rescript-relay/__tests__/TestRelayUserResolver.res @@ -1,8 +1,5 @@ /** - * @RelayResolver - * - * @onType User - * @fieldName fullName + * @RelayResolver User.fullName:RelayResolverValue * @rootFragment TestRelayUserResolver * * A users full name. diff --git a/packages/rescript-relay/__tests__/Test_requiredFieldLogger.res b/packages/rescript-relay/__tests__/Test_requiredFieldLogger.res index 3214215a..272c0635 100644 --- a/packages/rescript-relay/__tests__/Test_requiredFieldLogger.res +++ b/packages/rescript-relay/__tests__/Test_requiredFieldLogger.res @@ -7,13 +7,13 @@ module Query = %relay(` `) module Logger = { - let loggedArg = ref((None: option)) + let loggedArg = ref((None: option)) - let mock: RescriptRelay.RequiredFieldLogger.t = arg => loggedArg := Some(arg) + let mock: RescriptRelay.RelayFieldLogger.t = arg => loggedArg := Some(arg) let getLoggedArg = () => loggedArg.contents - let expectedArg: RescriptRelay.RequiredFieldLogger.arg = MissingFieldLog({ + let expectedArg: RescriptRelay.RelayFieldLogger.arg = MissingFieldLog({ owner: "TestRequiredFieldLoggerQuery", fieldPath: "loggedInUser.firstName", }) @@ -26,7 +26,7 @@ let test_requiredFieldLogger = () => { let environment = RescriptRelay.Environment.make( ~network, ~store=RescriptRelay.Store.make(~source=RescriptRelay.RecordSource.make()), - ~requiredFieldLogger=Logger.mock, + ~relayFieldLogger=Logger.mock, ) Js.Promise.make((~resolve, ~reject as _) => { diff --git a/packages/rescript-relay/__tests__/__generated__/RelaySchemaAssets_graphql.res b/packages/rescript-relay/__tests__/__generated__/RelaySchemaAssets_graphql.res index 59f38eaa..ce5e24da 100644 --- a/packages/rescript-relay/__tests__/__generated__/RelaySchemaAssets_graphql.res +++ b/packages/rescript-relay/__tests__/__generated__/RelaySchemaAssets_graphql.res @@ -70,6 +70,19 @@ type enum_RequiredFieldAction_input = | THROW +@live @unboxed +type enum_CatchFieldTo = + | NULL + | RESULT + | FutureAddedValue(string) + + +@live @unboxed +type enum_CatchFieldTo_input = + | NULL + | RESULT + + @live type rec input_InputA = { time: TestsUtils.Datetime.t, diff --git a/packages/rescript-relay/__tests__/__generated__/TestRelayResolversQuery_graphql.res b/packages/rescript-relay/__tests__/__generated__/TestRelayResolversQuery_graphql.res index 9a2ee3b1..5ac7478f 100644 --- a/packages/rescript-relay/__tests__/__generated__/TestRelayResolversQuery_graphql.res +++ b/packages/rescript-relay/__tests__/__generated__/TestRelayResolversQuery_graphql.res @@ -155,7 +155,7 @@ let node: operationType = %raw(json` { }, "kind": "RelayResolver", "storageKey": null, - "isOutputType": false + "isOutputType": true }, { "alias": null, diff --git a/packages/rescript-relay/package.json b/packages/rescript-relay/package.json index a80c5c13..7ecedd9b 100644 --- a/packages/rescript-relay/package.json +++ b/packages/rescript-relay/package.json @@ -40,7 +40,7 @@ }, "devDependencies": { "@glennsl/rescript-fetch": "^0.2.0", - "@rescript/react": "0.12.1", + "@rescript/react": "0.12.2", "@testing-library/jest-dom": "^5.16.3", "@testing-library/react": "^13.0.0-alpha.6", "graphql-query-test-mock": "^0.12.1", @@ -49,13 +49,13 @@ "node-fetch": "^2.6.0", "react": "18.2.0", "react-dom": "18.2.0", - "react-relay": "16.0.0", - "relay-runtime": "16.0.0", - "rescript": "^11.0.0" + "react-relay": "17.0.0", + "relay-runtime": "17.0.0", + "rescript": "11.1.1" }, "peerDependencies": { "@rescript/react": "^0.12.1", - "react-relay": "16.0.0", + "react-relay": "17.0.0", "relay-runtime": "*", "rescript": "^11.0.0" }, diff --git a/packages/rescript-relay/relay.config.js b/packages/rescript-relay/relay.config.js index 431f1799..1b126ecd 100644 --- a/packages/rescript-relay/relay.config.js +++ b/packages/rescript-relay/relay.config.js @@ -7,7 +7,7 @@ module.exports = { : "./__tests__/__generated__", src: PERSISTING ? "./__tests_preloaded__" : "./__tests__", language: "rescript", - customScalars: { + customScalarTypes: { Datetime: "TestsUtils.Datetime", IntString: "TestsUtils.IntString", JSON: "Js.Json.t", diff --git a/packages/rescript-relay/src/RescriptRelay.res b/packages/rescript-relay/src/RescriptRelay.res index a4ca8f2f..d2d3e8c1 100644 --- a/packages/rescript-relay/src/RescriptRelay.res +++ b/packages/rescript-relay/src/RescriptRelay.res @@ -552,7 +552,7 @@ module Store = { @send external holdGC: t => unit = "holdGC" } -module RequiredFieldLogger = { +module RelayFieldLogger = { @tag("kind") type arg = | @as("missing_field.log") MissingFieldLog({owner: string, fieldPath: string}) @@ -576,7 +576,7 @@ module Environment = { getDataID?: (~nodeObj: 'a, ~typeName: string) => string, treatMissingFieldsAsNull?: bool, missingFieldHandlers: array, - requiredFieldLogger?: RequiredFieldLogger.t, + relayFieldLogger?: RelayFieldLogger.t, isServer?: bool, } @@ -589,7 +589,7 @@ module Environment = { ~getDataID=?, ~treatMissingFieldsAsNull=?, ~missingFieldHandlers=?, - ~requiredFieldLogger=?, + ~relayFieldLogger=?, ~isServer=?, ) => make({ @@ -601,7 +601,7 @@ module Environment = { | Some(handlers) => handlers->Belt.Array.concat([nodeInterfaceMissingFieldHandler]) | None => [nodeInterfaceMissingFieldHandler] }, - ?requiredFieldLogger, + ?relayFieldLogger, ?isServer, }) diff --git a/packages/rescript-relay/src/RescriptRelay.resi b/packages/rescript-relay/src/RescriptRelay.resi index 58b5ee1e..c0fc4380 100644 --- a/packages/rescript-relay/src/RescriptRelay.resi +++ b/packages/rescript-relay/src/RescriptRelay.resi @@ -691,7 +691,7 @@ module Disposable: { } /**A required field logger, which gets called when a field annotated with the @required directive was missing from the response*/ -module RequiredFieldLogger: { +module RelayFieldLogger: { @tag("kind") type arg = | @as("missing_field.log") MissingFieldLog({owner: string, fieldPath: string}) @@ -722,7 +722,7 @@ module Environment: { ) => string=?, ~treatMissingFieldsAsNull: bool=?, ~missingFieldHandlers: array=?, - ~requiredFieldLogger: RequiredFieldLogger.t=?, + ~relayFieldLogger: RelayFieldLogger.t=?, ~isServer: bool=?, ) => t diff --git a/packages/rescript-relay/src/RescriptRelay_Fragment.res b/packages/rescript-relay/src/RescriptRelay_Fragment.res index bbbdb13a..6476aa92 100644 --- a/packages/rescript-relay/src/RescriptRelay_Fragment.res +++ b/packages/rescript-relay/src/RescriptRelay_Fragment.res @@ -148,7 +148,7 @@ let usePaginationFragment = ( } } -@module("react-relay/lib/relay-hooks/useBlockingPaginationFragment") +@module("react-relay/lib/relay-hooks/legacy/useBlockingPaginationFragment") external useBlockingPaginationFragment_: ( fragmentNode<'node>, 'fragmentRef, diff --git a/packages/rescript-relay/yarn.lock b/packages/rescript-relay/yarn.lock index e5bede3c..b263a2bd 100644 --- a/packages/rescript-relay/yarn.lock +++ b/packages/rescript-relay/yarn.lock @@ -521,10 +521,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@rescript/react@0.12.1": - version "0.12.1" - resolved "https://registry.yarnpkg.com/@rescript/react/-/react-0.12.1.tgz#7bddb957a1bc08b944c6597f28549ac410982d64" - integrity sha512-ZD7nhDr5FZgLYqRH9s4CNM+LRz/3IMuTb+LH12fd2Akk0xYkYUP+DZveB2VQUC2UohJnTf/c8yPSNsiFihVCCg== +"@rescript/react@0.12.2": + version "0.12.2" + resolved "https://registry.yarnpkg.com/@rescript/react/-/react-0.12.2.tgz#a4a216cb317723005387be297008daca106540ff" + integrity sha512-EOF19dLTG4Y9K59JqMjG5yfvIsrMZqfxGC2J/oe9gGgrMiUrzZh3KH9khTcR1Z3Ih0lRViSh0/iYnJz20gGoag== "@sinonjs/commons@^1.7.0": version "1.8.3" @@ -2541,16 +2541,16 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== -react-relay@16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/react-relay/-/react-relay-16.0.0.tgz#50201d309559401c19184f9a6e2cf32127175d21" - integrity sha512-3Dje0NLJFwt6b3xqgbiCGlTnpxoZe1OTPsXIPtFdftgDWQzSfrwqkBYUKab6bV2HhCKWCzXWafb8wURLDAlNJQ== +react-relay@17.0.0: + version "17.0.0" + resolved "https://registry.yarnpkg.com/react-relay/-/react-relay-17.0.0.tgz#1f8b6aefaa73b8af8378300d419289a57a6f94c9" + integrity sha512-Kn0CMiKZtWc+EisFPmzuZ53RtDeLlJO+EUVJwqxNkOs5g1jDjVi1v+k48kHeTyim2X43Rr0S2aeailllci5SgQ== dependencies: "@babel/runtime" "^7.0.0" fbjs "^3.0.2" invariant "^2.2.4" nullthrows "^1.1.1" - relay-runtime "16.0.0" + relay-runtime "17.0.0" react@18.2.0: version "18.2.0" @@ -2581,10 +2581,10 @@ regexp.prototype.flags@^1.2.0: define-properties "^1.1.3" functions-have-names "^1.2.2" -relay-runtime@16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-16.0.0.tgz#66efc4ea95a291885dab04f90676ab4c004442ea" - integrity sha512-gJ70upfOxmFgtvFEKn7sU72uN2XF9Bg5Bml9oGRqe0rFWJDj1ItsljWzOZ972EyDE+pZG/VKbqiz3gUjhbsejQ== +relay-runtime@17.0.0: + version "17.0.0" + resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-17.0.0.tgz#771084ea3b44f2f1eb578da861511a5558c4e07b" + integrity sha512-7b2R3G3DP7VHq7/1ltwQfYn3KkTHIB2NNt3KijIZoNQ73avwpOXBEL0MelSXwq8L+K8lcgAW5VAT7o0LUhnJPQ== dependencies: "@babel/runtime" "^7.0.0" fbjs "^3.0.2" @@ -2595,10 +2595,10 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -rescript@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/rescript/-/rescript-11.0.0.tgz#9a0b6fc998c360543c459aba49b77a572a0306cd" - integrity sha512-uIUwDZZmDUb7ymGkBiiGioxMg8hXh1mze/2k/qhYQcZGgi7PrLHQIW9AksM7gb9WnpjCAvFsA8U2VgC0nA468w== +rescript@11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/rescript/-/rescript-11.1.1.tgz#3e3b59751e5d7472156615e13d957c70d5342c5c" + integrity sha512-FMELeoiR1n3LzBdBt+k7U4l0vsz5Xh0HBSHf+0NhyhzZkMRLkEKEDNrcqZc6RIux9bxmxoO+zEa9qFM01VOXAw== resolve-cwd@^3.0.0: version "3.0.0"