From abb6476f2816fceef02618a4d68ea27be516d841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnar=20K=C3=A1ri?= Date: Mon, 20 Sep 2021 11:37:05 +0000 Subject: [PATCH] feat: add apollo.extract method --- .../client/core/ApolloClient__Core_ApolloClient.res | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res b/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res index 33cd8c0..7e0539b 100644 --- a/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res +++ b/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res @@ -305,6 +305,11 @@ module Js_ = { @send external clearStore: t => Js.Promise.t> = "clearStore" + + // extract(optimistic?: boolean): TCacheShape; + @send + external extract: (t, ~optimistic: bool=?, unit) => Js.Json.t = "extract" + // mutate(options: MutationOptions): Promise>; @send external mutate: ( @@ -392,6 +397,8 @@ module Js_ = { type t = { @as("rescript_clearStore") clearStore: unit => Js.Promise.t, Js.Exn.t>>, + @as("rescript_extract") + extract: (~optimistic: bool=?, unit) => Js.Json.t, @as("rescript_mutate") mutate: 'data 'variables 'jsVariables. ( ~mutation: module(Operation with @@ -576,6 +583,8 @@ let make: ( ->Js.Promise.then_(value => Js.Promise.resolve(Ok(value)), _) ->Js.Promise.catch(e => Js.Promise.resolve(Error(Utils.ensureError(Any(e)))), _) + let extract = (~optimistic=?, ()) => jsClient->Js_.extract(~optimistic=?optimistic, ()) + let mutate = ( type data variables jsVariables, ~mutation as module(Operation: Operation with @@ -888,6 +897,7 @@ let make: ( jsClient, { clearStore: clearStore, + extract: extract, mutate: mutate, onClearStore: onClearStore, onResetStore: onResetStore,