From cfbfb129973ec3e8ac93bb589c81ff4fabce10a6 Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 7 Oct 2024 18:09:56 -0400 Subject: [PATCH] DataProxy --- .../core/ApolloClient__Cache_Core_Cache.res | 44 +++--- ...olloClient__Cache_Core_Types_DataProxy.res | 138 +++++++++--------- .../core/ApolloClient__Core_ApolloClient.res | 44 +++--- 3 files changed, 113 insertions(+), 113 deletions(-) diff --git a/src/@apollo/client/cache/core/ApolloClient__Cache_Core_Cache.res b/src/@apollo/client/cache/core/ApolloClient__Cache_Core_Cache.res index cd97cb9..1a6e86e 100644 --- a/src/@apollo/client/cache/core/ApolloClient__Cache_Core_Cache.res +++ b/src/@apollo/client/cache/core/ApolloClient__Cache_Core_Cache.res @@ -188,9 +188,9 @@ module ApolloCache = { ~options={ id: id, fragment: Fragment.query, - fragmentName: fragmentName, - optimistic: optimistic, - canonizeResults: canonizeResults, + fragmentName: ?fragmentName, + optimistic: ?optimistic, + canonizeResults: ?canonizeResults, }, ~optimistic?, (), @@ -218,11 +218,11 @@ module ApolloCache = { ->Js_.readQuery( ~options=DataProxy.ReadQueryOptions.toJs( { - id: id, + id: ?id, query: Operation.query, variables: variables, - optimistic: optimistic, - canonizeResults: canonizeResults, + optimistic: ?optimistic, + canonizeResults: ?canonizeResults, }, ~mapJsVariables, ~serializeVariables=Operation.serializeVariables, @@ -247,12 +247,12 @@ module ApolloCache = { js->Js_.writeFragment( ~options=DataProxy.WriteFragmentOptions.toJs( { - broadcast: broadcast, + broadcast: ?broadcast, data: data, id: id, fragment: Fragment.query, - fragmentName: fragmentName, - overwrite: overwrite, + fragmentName: ?fragmentName, + overwrite: ?overwrite, }, ~serialize=Fragment.serialize, ), @@ -275,12 +275,12 @@ module ApolloCache = { js->Js_.writeQuery( ~options=DataProxy.WriteQueryOptions.toJs( { - broadcast: broadcast, + broadcast: ?broadcast, data: data, - id: id, + id: ?id, query: Operation.query, variables: variables, - overwrite: overwrite, + overwrite: ?overwrite, }, ~mapJsVariables, ~serialize=Operation.serialize, @@ -309,13 +309,13 @@ module ApolloCache = { js ->Js_.updateQuery(~options=DataProxy.UpdateQueryOptions.toJs( { - optimistic: optimistic, - canonizeResults: canonizeResults, - broadcast: broadcast, - id: id, + optimistic: ?optimistic, + canonizeResults: ?canonizeResults, + broadcast: ?broadcast, + id: ?id, query: Operation.query, variables: variables, - overwrite: overwrite, + overwrite: ?overwrite, }, ~mapJsVariables, ~serializeVariables=Operation.serializeVariables, @@ -347,13 +347,13 @@ module ApolloCache = { js ->Js_.updateFragment(~options=DataProxy.UpdateFragmentOptions.toJs({ - optimistic: optimistic, - canonizeResults: canonizeResults, - broadcast: broadcast, + optimistic: ?optimistic, + canonizeResults: ?canonizeResults, + broadcast: ?broadcast, id: id, fragment: Fragment.query, - fragmentName: fragmentName, - overwrite: overwrite, + fragmentName: ?fragmentName, + overwrite: ?overwrite, }), ~update=jsData => jsData ->Js.nullToOption diff --git a/src/@apollo/client/cache/core/types/ApolloClient__Cache_Core_Types_DataProxy.res b/src/@apollo/client/cache/core/types/ApolloClient__Cache_Core_Types_DataProxy.res index d8d1e46..e57b0c5 100644 --- a/src/@apollo/client/cache/core/types/ApolloClient__Cache_Core_Types_DataProxy.res +++ b/src/@apollo/client/cache/core/types/ApolloClient__Cache_Core_Types_DataProxy.res @@ -17,10 +17,10 @@ module ReadQueryOptions = { query: Graphql.documentNode, // We don't allow optional variables because it's not typesafe variables: 'jsVariables, - id: option, - // returnPartialData: option, - optimistic: option, - canonizeResults: option, + id?: string, + // returnPartialData?: bool, + optimistic?: bool, + canonizeResults?: bool, } } @@ -33,10 +33,10 @@ module ReadQueryOptions = { ) => Js_.t<'jsVariables> = (t, ~mapJsVariables=Utils.identity, ~serializeVariables) => { query: t.query, variables: t.variables->serializeVariables->mapJsVariables, - id: t.id, - // returnPartialData: t.returnPartialData, - optimistic: t.optimistic, - canonizeResults: t.canonizeResults, + id: ?t.id, + // returnPartialData: ?t.returnPartialData, + optimistic: ?t.optimistic, + canonizeResults: ?t.canonizeResults, } } @@ -58,10 +58,10 @@ module ReadFragmentOptions = { fragment: Graphql.documentNode, // We don't allow optional variables because it's not typesafe // variables: 'jsVariables, - fragmentName: option, - // returnPartialData: option, - optimistic: option, - canonizeResults: option, + fragmentName?: string, + // returnPartialData?: bool, + optimistic?: bool, + canonizeResults?: bool, } } @@ -70,10 +70,10 @@ module ReadFragmentOptions = { fragment: Graphql.documentNode, // We don't allow optional variables because it's not typesafe // variables: 'jsVariables, - fragmentName: option, - // returnPartialData: option, - optimistic: option, - canonizeResults: option, + fragmentName?: string, + // returnPartialData?: bool, + optimistic?: bool, + canonizeResults?: bool, } } @@ -85,23 +85,23 @@ module WriteQueryOptions = { // } type t<'jsData, 'jsVariables> = { data: 'jsData, - broadcast: option, - overwrite: option, + broadcast?: bool, + overwrite?: bool, // ...extends Query query: Graphql.documentNode, // We don't allow optional variables because it's not typesafe variables: 'jsVariables, - id: option, + id?: string, } } type t<'data, 'variables> = { data: 'data, - broadcast: option, - overwrite: option, + broadcast?: bool, + overwrite?: bool, query: Graphql.documentNode, variables: 'variables, - id: option, + id?: string, } let toJs: ( @@ -116,11 +116,11 @@ module WriteQueryOptions = { ~serializeVariables, ) => { data: t.data->serialize, - broadcast: t.broadcast, - overwrite: t.overwrite, + broadcast: ?t.broadcast, + overwrite: ?t.overwrite, query: t.query, variables: t.variables->serializeVariables->mapJsVariables, - id: t.id, + id: ?t.id, } } @@ -132,12 +132,12 @@ module WriteFragmentOptions = { // } type t<'jsData, 'jsVariables> = { data: 'jsData, - broadcast: option, - overwrite: option, + broadcast?: bool, + overwrite?: bool, // ...extends Fragment id: string, fragment: Graphql.documentNode, - fragmentName: option, + fragmentName?: string, // I think fragment variables are still experimental? // // We don't allow optional variables because it's not typesafe // variables: 'jsVariables, @@ -146,11 +146,11 @@ module WriteFragmentOptions = { type t<'data, 'variables> = { data: 'data, - broadcast: option, - overwrite: option, + broadcast?: bool, + overwrite?: bool, id: string, fragment: Graphql.documentNode, - fragmentName: option, + fragmentName?: string, // variables: 'variables, } @@ -161,11 +161,11 @@ module WriteFragmentOptions = { ) => // ~serializeVariables: 'variables => 'jsVariables Js_.t<'jsData, 'jsVariables> = (t, ~serialize) => { data: t.data->serialize, - broadcast: t.broadcast, - overwrite: t.overwrite, + broadcast: ?t.broadcast, + overwrite: ?t.overwrite, id: t.id, fragment: t.fragment, - fragmentName: t.fragmentName, + fragmentName: ?t.fragmentName, // variables: t.variables->serializeVariables->mapJsVariables, } } @@ -179,29 +179,29 @@ module UpdateQueryOptions = { type t<'jsVariables> = { // ReadQueryOptions // ...extends Query - id: option, + id?: string, query: Graphql.documentNode, // We don't allow optional variables because it's not typesafe variables: 'jsVariables, // ...extends ReadQueryOptions - optimistic: option, - canonizeResults: option, + optimistic?: bool, + canonizeResults?: bool, // ...extends Omit - // returnPartialData: option, // Don't believe this is supported by graphql-ppx - broadcast: option, - overwrite: option, + // returnPartialData?: bool, // Don't believe this is supported by graphql-ppx + broadcast?: bool, + overwrite?: bool, } } type t<'variables> = { - id: option, + id?: string, query: Graphql.documentNode, variables: 'variables, - optimistic: option, - canonizeResults: option, - // returnPartialData: option, // Don't believe this is supported by graphql-ppx - broadcast: option, - overwrite: option, + optimistic?: bool, + canonizeResults?: bool, + // returnPartialData?: bool, // Don't believe this is supported by graphql-ppx + broadcast?: bool, + overwrite?: bool, } let toJs: ( @@ -209,14 +209,14 @@ module UpdateQueryOptions = { ~mapJsVariables: 'jsVariables => 'jsVariables=?, ~serializeVariables: 'variables => 'jsVariables, ) => Js_.t<'jsVariables> = (t, ~mapJsVariables=Utils.identity, ~serializeVariables) => { - id: t.id, + id: ?t.id, query: t.query, variables: t.variables->serializeVariables->mapJsVariables, - optimistic: t.optimistic, - canonizeResults: t.canonizeResults, - broadcast: t.broadcast, - overwrite: t.overwrite, - // returnPartialData: t.returnPartialData, // Don't believe this is supported by graphql-ppx + optimistic: ?t.optimistic, + canonizeResults: ?t.canonizeResults, + broadcast: ?t.broadcast, + overwrite: ?t.overwrite, + // returnPartialData: ?t.returnPartialData, // Don't believe this is supported by graphql-ppx } } @@ -231,40 +231,40 @@ module UpdateFragmentOptions = { // ...extends Fragment id: string, fragment: Graphql.documentNode, - fragmentName: option, + fragmentName?: string, // We don't allow optional variables because it's not typesafe // variables: 'jsVariables, // ...extends ReadFragmentOptions - optimistic: option, - canonizeResults: option, + optimistic?: bool, + canonizeResults?: bool, // ...extends Omit - // returnPartialData: option, // Don't believe this is supported by graphql-ppx - broadcast: option, - overwrite: option, + // returnPartialData?: bool, // Don't believe this is supported by graphql-ppx + broadcast?: bool, + overwrite?: bool, } } type t<'variables> = { id: string, fragment: Graphql.documentNode, - fragmentName: option, + fragmentName?: string, // variables: 'variables, - optimistic: option, - canonizeResults: option, - // returnPartialData: option, // Don't believe this is supported by graphql-ppx - broadcast: option, - overwrite: option, + optimistic?: bool, + canonizeResults?: bool, + // returnPartialData?: bool, // Don't believe this is supported by graphql-ppx + broadcast?: bool, + overwrite?: bool, } let toJs: t<'variables> => Js_.t<'jsVariables> = t => { id: t.id, fragment: t.fragment, - fragmentName: t.fragmentName, + fragmentName: ?t.fragmentName, // variables: t.variables, - optimistic: t.optimistic, - canonizeResults: t.canonizeResults, - broadcast: t.broadcast, - overwrite: t.overwrite, + optimistic: ?t.optimistic, + canonizeResults: ?t.canonizeResults, + broadcast: ?t.broadcast, + overwrite: ?t.overwrite, // returnPartialData: t.returnPartialData, // Don't believe this is supported by graphql-ppx } } diff --git a/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res b/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res index d1f2033..6bb12ad 100644 --- a/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res +++ b/src/@apollo/client/core/ApolloClient__Core_ApolloClient.res @@ -779,9 +779,9 @@ let make: ( ~options={ id, fragment: Fragment.query, - fragmentName, - optimistic, - canonizeResults, + ?fragmentName, + ?optimistic, + ?canonizeResults, }, ~optimistic?, (), @@ -809,11 +809,11 @@ let make: ( jsClient, ~options=DataProxy.ReadQueryOptions.toJs( { - id, + ?id, query: Operation.query, variables, - optimistic, - canonizeResults, + ?optimistic, + ?canonizeResults, }, ~mapJsVariables, ~serializeVariables=Operation.serializeVariables, @@ -942,12 +942,12 @@ let make: ( jsClient->Js_.writeFragment( ~options=DataProxy.WriteFragmentOptions.toJs( { - broadcast, + ?broadcast, data, id, fragment: Fragment.query, - fragmentName, - overwrite, + ?fragmentName, + ?overwrite, }, ~serialize=Fragment.serialize, ), @@ -970,12 +970,12 @@ let make: ( jsClient->Js_.writeQuery( ~options=DataProxy.WriteQueryOptions.toJs( { - broadcast, + ?broadcast, data, - id, + ?id, query: Operation.query, variables, - overwrite, + ?overwrite, }, ~mapJsVariables, ~serialize=Operation.serialize, @@ -1005,13 +1005,13 @@ let make: ( ->Js_.updateQuery( ~options=DataProxy.UpdateQueryOptions.toJs( { - optimistic, - canonizeResults, - broadcast, - id, + ?optimistic, + ?canonizeResults, + ?broadcast, + ?id, query: Operation.query, variables, - overwrite, + ?overwrite, }, ~mapJsVariables, ~serializeVariables=Operation.serializeVariables, @@ -1045,13 +1045,13 @@ let make: ( jsClient ->Js_.updateFragment( ~options=DataProxy.UpdateFragmentOptions.toJs({ - optimistic, - canonizeResults, - broadcast, + ?optimistic, + ?canonizeResults, + ?broadcast, id, fragment: Fragment.query, - fragmentName, - overwrite, + ?fragmentName, + ?overwrite, }), ~update=jsData => jsData