Skip to content

Releases: teamwalnut/rescript-urql

@urql/rescript

27 Mar 20:24
8936280
Compare
Choose a tag to compare

This release adds support for several major version upgrades of dependencies, including:

This release also includes a name change. This package will now be published under the @urql scope as @urql/rescript. To install it, run:

yarn add @urql/rescript

Changed

Diff

v3.4.0...v4.0.0

🔎 Persisted Fetch and Refocus Exchanges

19 Jan 05:05
Compare
Choose a tag to compare

This release adds bindings for two additional ecosystem exchanges:

Added

  • Bindings for @urql/exchange-persisted-fetch and @urql/exchange-refocus were added. Consumers of reason-urql will need to install @urql/exchange-persisted-fetch to call Client.Exchanges.persistedFetchExchange and @urql/exchange-refocus to call Client.Exchanges.refocusExchange. PR by @parkerziegler here.

Diff

v3.3.0...v3.4.0

🔁 Retry and Request Policy Exchanges

05 Jan 16:23
Compare
Choose a tag to compare

This release adds bindings for two additional ecosystem exchanges:

Added

  • Bindings for @urql/exchange-retry and @urql/exchange-request-policy were added. Consumers of reason-urql will need to install @urql/exchange-retry to call Client.Exchanges.retryExchange and @urql/exchange-request-policy to call Client.Exchanges.requestPolicyExchange. PRs by @parkerziegler here and here.

Diff

v3.2.0...v3.3.0

🗂️ Multipart Fetch Support

21 Dec 17:13
Compare
Choose a tag to compare

This release adds a thin binding for @urql/exchange-multipart-fetch.

Added

  • A thin binding for @urql/exchange-multipart-fetch was added. Consumers of reason-urql will need to install @urql/exchange-multipart-fetch to call Client.Exchanges.multipartFetchExchange. PR by @parkerziegler here. Fixes #169.

Diff

v3.1.0...v3.2.0

Migration to ReScript

09 Dec 17:10
Compare
Choose a tag to compare

This release migrates our internal syntax from Reason to ReScript. It also revises our binding of CombinedError to be compatible with ReScript, which doesn't support binding JS classes to OCaml classes as BuckleScript once did. The experience for end users should be no different.

Changed

  • The codebase is now written in ReScript. PR by @parkerziegler here.
  • The binding to CombinedError is now a record rather than an OCaml class being bound to a JS class. This change was made to both increase simplicity and to prepare for the BuckleScript to ReScript migration. PR by @parkerziegler here.

Diff

v3.0.0...v3.1.0

🌟 v3

17 Nov 00:53
Compare
Choose a tag to compare

This release migrates us to using @reasonml-community/graphql-ppx as our GraphQL PPX preprocessor of choice in lieu of @baransu/graphql_ppx_re. It also converts urql to a peerDependency of the library rather than bundling urql as a direct dependency. Finally, this release includes support for BuckleScript / ReScript > 8.0.0.

Changed

  • urql, along with its own peerDependencies, should be installed alongside reason-urql, which no longer bundles urql as a direct dependency. See updated installation instructions in the README. PR by @parkerziegler here.

  • Users should install @reasonml-community/graphql-ppx as a peerDependency of reason-urql.

  • Users depending on bs-platform>=8.0.0 will need to specify a resolution for wonka v5 using yarn resolutions. See updated installation instructions in the README.

  • Client.execute* methods underwent four major API changes:

    1. There is no longer a ~request labelled argument. Instead, the GraphQL operation is passed using ~query for Client.executeQuery, ~mutation for Client.executeMutation, and ~subscription for Client.executeSubscription. This applies to Client.query, Client.mutation, Client.subscription, and Client.readQuery as well.
    2. GraphQL operations are passed as first-class modules to Client.execute* methods. This means you pass your entire GraphQL query module as a function argument, like so:
    open ReasonUrql;
    
    module GetAllDogs = [%graphql {|
      query getAllDogs {
        dogs {
          name
          breed
          likes
        }
      }
    |}];
    
    /* Pass GetAllDogs as a first-class module to Client.executeQuery. */
    Client.executeQuery(~query=(module GetAllDogs), ())
    1. Variables are passed as the last positional argument to Client.execute* methods, if they are required. PR by @parkerziegler here. We interface with @reasonml-community/graphql-ppx to typecheck your variables based on the signature of your GraphQL operation. If your query, mutation, or subscription requires variables, pass them as a record in the last position, like so:
    open ReasonUrql;
    
    module GetDog = [%graphql {|
      query getDog($key: ID!) {
        dog(key: $key) {
          name
          breed
          likes
        }
      }
    |}];
    
    /* Pass GetDog as a first-class module to Client.executeQuery,
        with required variables as a record in the final position. */
    Client.executeQuery(~query=(module GetDog), {key: "12345"})
    1. The response variant for Client.execute* methods was renamed to operationResponse and should be referenced from the Types module rather than the Client module.
  • The hooks APIs underwent three major API changes:

    1. There is no longer a ~request labelled argument. Instead, the GraphQL operation is passed using ~query for useQuery, ~mutation for useMutation, and ~subscription for useSubscription.
    2. GraphQL operations are passed as first-class modules to each hook. This means you pass your entire GraphQL query module as a function argument, like so:
    open ReasonUrql;
    
    module GetAllDogs = [%graphql {|
      query getAllDogs {
        dogs {
          name
          breed
          likes
        }
      }
    |}];
    
    [@react.component]
    let make = () => {
      /* Pass GetAllDogs as a first-class module to useQuery. */
      let (Hooks.{response}, _) = Hooks.useQuery(~query=(module GetAllDogs), ());
    
      /* Return the JSX for your component. */
    }
    1. Variables are passed as the last positional argument to a hook, if they are required. PR by @amiralies here. We interface with @reasonml-community/graphql-ppx to typecheck your variables based on the signature of your GraphQL operation. If your query, mutation, or subscription requires variables, pass them as a record in the last position, like so:
    module GetDog = [%graphql {|
      query getDog($key: ID!) {
        dog(key: $key) {
          name
          breed
          likes
        }
      }
    |}];
    
    [@react.component]
    let make = () => {
      /* Pass GetDog as a first-class module to useQuery,
        with required variables as a record in the final position. */
      let (Hooks.{response}, _) = Hooks.useQuery(~query=(module GetDog), {key: "12345"});
    
      /* Return the JSX for your component. */
    }

Removed

  • The useDynamicMutation hook was removed. useMutation now consolidates the former use case for this hook and brings our APIs more inline with how urql works.

Diff

v2.1.0...v3.0.0

First Release Candidate for v3!

12 Nov 23:40
Compare
Choose a tag to compare
Pre-release

This release is the first release candidate for v3.0.0, which will use @reasonml-community/graphql-ppx as our PPX preprocessor for GraphQL operations. Breaking changes will be listed in the release notes for the first stable release of v3.0.0.

Diff

v2.1.0...v3.0.0-rc.0

🦅 urql 1.10 Compatibility

18 Sep 04:55
Compare
Choose a tag to compare

This release brings our urql dependency up to v1.10.0, at parity with the current state of urql 🙌. There are no code changes involved from the previous RC release.

Diff

v2.1.0-rc.0...v2.1.0

Binding to urql 1.10

10 Sep 17:27
Compare
Choose a tag to compare
Binding to urql 1.10 Pre-release
Pre-release

This release fixes some important bugs identified in the v2.0.0 release.

Fixed

  • Properly handle null on the data field in the GraphQL response. This was a regression from v1.7.0. PR by @parkerziegler and @gaku-sei here.
  • Revert to using [@bs.deriving abstract] to internally create Partial<OperationContext> objects. PR by @parkerziegler here.

Diff

v2.0.0...v2.1.0-rc0

🌟 v2

04 Aug 01:08
Compare
Choose a tag to compare

This release includes full support for BuckleScript 7 and widely reorganizes reason-urql to be more modular and easier to contribute to. Most of the public API has stayed the same, with some exceptions (documented below).

Users who upgrade to v2 should be on BuckleScript 7, as this library relies heavily on direct record to object compilation.

Added

  • All hooks and Client.execute* methods that accepted a partial operation context argument now accept each key of the operationContext record type as an optional function argument. For example, you can now write code like this:
open ReasonUrql;

/* Define query to execute. */
let subscription = Client.executeQuery(~query, ~requestPolicy=`CacheFirst, ~pollInterval=200, ());

reason-urql will handle compiling each argument and passing it along to urql properly.

  • Interface files (.rei) were added for all modules.
  • The stale flag is now returned on all results returned by reason-urql hooks, which indicates that the result returned by the hook is stale and that another request is being sent in the background. This is particularly useful with the `CacheAndNetwork request policy.

Changed

  • The response variant now has 5 constructors – Fetching, Data(d), PartialData(d, e), Error(e), and Empty. You can read more about each of these here.
  • The UrqlTypes module is now just Types.
  • The Exchanges module is now a sub-module of the Client module. Once ReasonUrql is brought into scope it can be refrenced as Client.Exchanges.
  • ssrExchange now accepts ssrExchangeParams as its first labeled argument, not ssrExchangeOpts. ssrExchangeParams is also a record type while ssrExchangeOpts was a [@bs.deriving abstract]. This brings it more in line with urql's implementation.
  • serializedResult is now a record type rather than a [@bs.deriving abstract].
  • The signature of exchanges has changed to properly support uncurrying syntax.
type t =
  exchangeInput =>
  (. Wonka.Types.sourceT(UrqlClientTypes.operation)) =>
  Wonka.Types.sourceT(UrqlClientTypes.operationResult);
  • Local binding of graphQLError is now a record type rather than a [@bs.deriving abstract] and has its own module GraphQLError.

Removed

  • Component bindings for Query, Mutation, Subscription, and SubscriptionWithHandler were removed. Just use the hooks APIs!
  • Client methods for executeRequestOperation, reexecuteOperation, createRequestOperation, and dispatchOperation were removed. These are no longer in urql's public facing API.

Diff

v1.7.0...v2.0.0