Skip to content

Commit

Permalink
DataProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
illusionalsagacity committed Oct 7, 2024
1 parent 21b820f commit cfbfb12
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 113 deletions.
44 changes: 22 additions & 22 deletions src/@apollo/client/cache/core/ApolloClient__Cache_Core_Cache.res
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
(),
Expand Down Expand Up @@ -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,
Expand All @@ -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,
),
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module ReadQueryOptions = {
query: Graphql.documentNode,
// We don't allow optional variables because it's not typesafe
variables: 'jsVariables,
id: option<string>,
// returnPartialData: option<bool>,
optimistic: option<bool>,
canonizeResults: option<bool>,
id?: string,
// returnPartialData?: bool,
optimistic?: bool,
canonizeResults?: bool,
}
}

Expand All @@ -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,
}
}

Expand All @@ -58,10 +58,10 @@ module ReadFragmentOptions = {
fragment: Graphql.documentNode,
// We don't allow optional variables because it's not typesafe
// variables: 'jsVariables,
fragmentName: option<string>,
// returnPartialData: option<bool>,
optimistic: option<bool>,
canonizeResults: option<bool>,
fragmentName?: string,
// returnPartialData?: bool,
optimistic?: bool,
canonizeResults?: bool,
}
}

Expand All @@ -70,10 +70,10 @@ module ReadFragmentOptions = {
fragment: Graphql.documentNode,
// We don't allow optional variables because it's not typesafe
// variables: 'jsVariables,
fragmentName: option<string>,
// returnPartialData: option<bool>,
optimistic: option<bool>,
canonizeResults: option<bool>,
fragmentName?: string,
// returnPartialData?: bool,
optimistic?: bool,
canonizeResults?: bool,
}
}

Expand All @@ -85,23 +85,23 @@ module WriteQueryOptions = {
// }
type t<'jsData, 'jsVariables> = {
data: 'jsData,
broadcast: option<bool>,
overwrite: option<bool>,
broadcast?: bool,
overwrite?: bool,
// ...extends Query
query: Graphql.documentNode,
// We don't allow optional variables because it's not typesafe
variables: 'jsVariables,
id: option<string>,
id?: string,
}
}

type t<'data, 'variables> = {
data: 'data,
broadcast: option<bool>,
overwrite: option<bool>,
broadcast?: bool,
overwrite?: bool,
query: Graphql.documentNode,
variables: 'variables,
id: option<string>,
id?: string,
}

let toJs: (
Expand All @@ -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,
}
}

Expand All @@ -132,12 +132,12 @@ module WriteFragmentOptions = {
// }
type t<'jsData, 'jsVariables> = {
data: 'jsData,
broadcast: option<bool>,
overwrite: option<bool>,
broadcast?: bool,
overwrite?: bool,
// ...extends Fragment
id: string,
fragment: Graphql.documentNode,
fragmentName: option<string>,
fragmentName?: string,
// I think fragment variables are still experimental?
// // We don't allow optional variables because it's not typesafe
// variables: 'jsVariables,
Expand All @@ -146,11 +146,11 @@ module WriteFragmentOptions = {

type t<'data, 'variables> = {
data: 'data,
broadcast: option<bool>,
overwrite: option<bool>,
broadcast?: bool,
overwrite?: bool,
id: string,
fragment: Graphql.documentNode,
fragmentName: option<string>,
fragmentName?: string,
// variables: 'variables,
}

Expand All @@ -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,
}
}
Expand All @@ -179,44 +179,44 @@ module UpdateQueryOptions = {
type t<'jsVariables> = {
// ReadQueryOptions<TData, TVariables>
// ...extends Query
id: option<string>,
id?: string,
query: Graphql.documentNode,
// We don't allow optional variables because it's not typesafe
variables: 'jsVariables,
// ...extends ReadQueryOptions
optimistic: option<bool>,
canonizeResults: option<bool>,
optimistic?: bool,
canonizeResults?: bool,
// ...extends Omit<WriteQueryOptions, 'data'>
// returnPartialData: option<bool>, // Don't believe this is supported by graphql-ppx
broadcast: option<bool>,
overwrite: option<bool>,
// returnPartialData?: bool, // Don't believe this is supported by graphql-ppx
broadcast?: bool,
overwrite?: bool,
}
}

type t<'variables> = {
id: option<string>,
id?: string,
query: Graphql.documentNode,
variables: 'variables,
optimistic: option<bool>,
canonizeResults: option<bool>,
// returnPartialData: option<bool>, // Don't believe this is supported by graphql-ppx
broadcast: option<bool>,
overwrite: option<bool>,
optimistic?: bool,
canonizeResults?: bool,
// returnPartialData?: bool, // Don't believe this is supported by graphql-ppx
broadcast?: bool,
overwrite?: bool,
}

let toJs: (
t<'variables>,
~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
}
}

Expand All @@ -231,40 +231,40 @@ module UpdateFragmentOptions = {
// ...extends Fragment
id: string,
fragment: Graphql.documentNode,
fragmentName: option<string>,
fragmentName?: string,
// We don't allow optional variables because it's not typesafe
// variables: 'jsVariables,
// ...extends ReadFragmentOptions
optimistic: option<bool>,
canonizeResults: option<bool>,
optimistic?: bool,
canonizeResults?: bool,
// ...extends Omit<WriteFragmentOptions, 'data'>
// returnPartialData: option<bool>, // Don't believe this is supported by graphql-ppx
broadcast: option<bool>,
overwrite: option<bool>,
// 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<string>,
fragmentName?: string,
// variables: 'variables,
optimistic: option<bool>,
canonizeResults: option<bool>,
// returnPartialData: option<bool>, // Don't believe this is supported by graphql-ppx
broadcast: option<bool>,
overwrite: option<bool>,
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
}
}
Loading

0 comments on commit cfbfb12

Please sign in to comment.