@swan-io/graphql-client
Advanced tools
Comparing version 0.1.0-beta6 to 0.1.0-beta7
@@ -5,2 +5,5 @@ import { DocumentNode, OperationDefinitionNode } from "@0no-co/graphql.web"; | ||
export declare const getCacheKeyFromJson: (json: unknown) => Option<symbol>; | ||
export type SchemaConfig = { | ||
interfaceToTypes: Record<string, string[]>; | ||
}; | ||
export declare const getCacheKeyFromOperationNode: (operationNode: OperationDefinitionNode) => Option<symbol>; | ||
@@ -11,3 +14,3 @@ export declare class ClientCache { | ||
schemaConfig: Record<string, Set<string>>; | ||
constructor(schemaConfig: Record<string, string[]>); | ||
constructor(schemaConfig: SchemaConfig); | ||
isTypeCompatible(typename: string, typeCondition: string): boolean; | ||
@@ -14,0 +17,0 @@ dump(): Map<symbol, unknown>; |
import { DocumentNode } from "@0no-co/graphql.web"; | ||
import { Future, Option, Result } from "@swan-io/boxed"; | ||
import { ClientCache } from "./cache/cache"; | ||
import { ClientCache, SchemaConfig } from "./cache/cache"; | ||
import { ClientError } from "./errors"; | ||
@@ -19,3 +19,3 @@ import { Connection, Edge, TypedDocumentNode } from "./types"; | ||
makeRequest?: MakeRequest; | ||
schemaConfig: Record<string, string[]>; | ||
schemaConfig: SchemaConfig; | ||
}; | ||
@@ -22,0 +22,0 @@ type ConnectionUpdate<Node> = [ |
@@ -101,3 +101,6 @@ 'use strict'; | ||
this.schemaConfig = Object.fromEntries( | ||
Object.entries(schemaConfig).map(([key, value]) => [key, new Set(value)]) | ||
Object.entries(schemaConfig.interfaceToTypes).map(([key, value]) => [ | ||
key, | ||
new Set(value) | ||
]) | ||
); | ||
@@ -1257,3 +1260,3 @@ } | ||
var ClientContext = react.createContext( | ||
new Client({ url: "/graphql", schemaConfig: {} }) | ||
new Client({ url: "/graphql", schemaConfig: { interfaceToTypes: {} } }) | ||
); | ||
@@ -1260,0 +1263,0 @@ var useDeferredQuery = (query, { optimize = false, debounce } = {}) => { |
{ | ||
"name": "@swan-io/graphql-client", | ||
"version": "0.1.0-beta6", | ||
"version": "0.1.0-beta7", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "A simple, typesafe GraphQL client for React", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
343064
3262