Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module StorageType = {

module FieldFunctionOptions = {
type unimplemented

type reference = {__typename: string, id: string}

module Js_ = {
// export interface FieldFunctionOptions<TArgs = Record<string, any>, TVars = Record<string, any>> {
// args: TArgs | null;
Expand Down Expand Up @@ -55,7 +56,7 @@ module FieldFunctionOptions = {
"canRead"
@bs.send external readField: t => ReadFieldFunction.Js_.t = "readField"
@bs.send
external toReference: t => ToReferenceFunction.t = "toReference"
external toReference: (t, reference) => string = "toReference"
}

type t = {
Expand All @@ -65,7 +66,7 @@ module FieldFunctionOptions = {
field: Js.nullable<FieldNode.t>,
variables: option<Js.Dict.t<Js.Json.t>>,
isReference: bool,
toReference: unimplemented,
toReference: (~id: string, ~typename: string,) => string,
storage: Js.nullable<StorageType.t>,
cache: ApolloCache.t<Js.Json.t>,
readField: unimplemented,
Expand All @@ -80,7 +81,9 @@ module FieldFunctionOptions = {
field: js.field,
variables: js.variables,
isReference: js.isReference,
toReference: js.toReference,
toReference: (~id, ~typename) => {
js->Js_.toReference({id: id, __typename: typename})
},
storage: js.storage,
cache: js.cache,
readField: js.readField,
Expand Down