Skip to content

Commit

Permalink
fixes for react-apollo-2 components, bump cli
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Aug 17, 2020
1 parent f026bca commit 27e8d02
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/apollo-client-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@graphql-codegen/typescript": "1.17.8",
"@graphql-codegen/typescript-operations": "1.17.8",
"@graphql-typed-document-node/core": "^3.1.0",
"@graphql-typed-document-node/patch-cli": "^3.0.3",
"@graphql-typed-document-node/patch-cli": "^3.0.4",
"@types/node": "14.0.27",
"@types/react": "^16.9.46",
"apollo-cache": "^1.3.5",
Expand Down
8 changes: 4 additions & 4 deletions examples/apollo-client-2/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,10 @@
resolved "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.1.0.tgz#0eee6373e11418bfe0b5638f654df7a4ca6a3950"
integrity sha512-wYn6r8zVZyQJ6rQaALBEln5B1pzxb9shV5Ef97kTvn6yVGrqyXVnDqnU24MXnFubR+rZjBY9NWuxX3FB2sTsjg==

"@graphql-typed-document-node/patch-cli@^3.0.3":
version "3.0.3"
resolved "https://registry.npmjs.org/@graphql-typed-document-node/patch-cli/-/patch-cli-3.0.3.tgz#e18f4861f2f5a43717af164ffe506880bd0fd333"
integrity sha512-8kGMaobPES2H23nC8o7vhr8Y2PPLDaX239J5RGOMvg2uRkjYQ1rTQCfmLsJOsHjDWlz913RoTlryFE5eR+lLTw==
"@graphql-typed-document-node/patch-cli@^3.0.4":
version "3.0.4"
resolved "https://registry.npmjs.org/@graphql-typed-document-node/patch-cli/-/patch-cli-3.0.4.tgz#9678f380006a858aa4b5423c8e720da44f2adf53"
integrity sha512-7f0olPBvcSqO3ms2Cx56isETDNd3c+j8owFK+p5VA2jsWIvQEtpfoqx7pHjUEh3yH6E7WjM89T43em7JRNXHKw==
dependencies:
patch-package "6.2.2"
semver "7.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/patch-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-typed-document-node/patch-cli",
"version": "3.0.3",
"version": "3.0.4",
"repository": "git@github.com:dotansimha/graphql-typed-document-node.git",
"author": "Dotan Simha <dotansimha@gmail.com>",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
diff --git a/node_modules/@apollo/react-components/lib/Mutation.d.ts b/node_modules/@apollo/react-components/lib/Mutation.d.ts
index fe10391..bdbda63 100644
--- a/node_modules/@apollo/react-components/lib/Mutation.d.ts
+++ b/node_modules/@apollo/react-components/lib/Mutation.d.ts
@@ -1,19 +1,4 @@
/// <reference types="react" />
import { OperationVariables } from '@apollo/react-common';
-import PropTypes from 'prop-types';
import { MutationComponentOptions } from './types';
export declare function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): JSX.Element | null;
-export declare namespace Mutation {
- const propTypes: {
- mutation: PropTypes.Validator<object>;
- variables: PropTypes.Requireable<object>;
- optimisticResponse: PropTypes.Requireable<object>;
- refetchQueries: PropTypes.Requireable<((...args: any[]) => any) | (string | object | null | undefined)[]>;
- awaitRefetchQueries: PropTypes.Requireable<boolean>;
- update: PropTypes.Requireable<(...args: any[]) => any>;
- children: PropTypes.Validator<(...args: any[]) => any>;
- onCompleted: PropTypes.Requireable<(...args: any[]) => any>;
- onError: PropTypes.Requireable<(...args: any[]) => any>;
- fetchPolicy: PropTypes.Requireable<string>;
- };
-}
diff --git a/node_modules/@apollo/react-components/lib/Query.d.ts b/node_modules/@apollo/react-components/lib/Query.d.ts
index da129ed..de30044 100644
--- a/node_modules/@apollo/react-components/lib/Query.d.ts
+++ b/node_modules/@apollo/react-components/lib/Query.d.ts
@@ -1,21 +1,5 @@
/// <reference types="react" />
import { OperationVariables } from '@apollo/react-common';
-import PropTypes from 'prop-types';
import { QueryComponentOptions } from './types';
export declare function Query<TData = any, TVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): JSX.Element | null;
-export declare namespace Query {
- const propTypes: {
- client: PropTypes.Requireable<object>;
- children: PropTypes.Validator<(...args: any[]) => any>;
- fetchPolicy: PropTypes.Requireable<string>;
- notifyOnNetworkStatusChange: PropTypes.Requireable<boolean>;
- onCompleted: PropTypes.Requireable<(...args: any[]) => any>;
- onError: PropTypes.Requireable<(...args: any[]) => any>;
- pollInterval: PropTypes.Requireable<number>;
- query: PropTypes.Validator<object>;
- variables: PropTypes.Requireable<object>;
- ssr: PropTypes.Requireable<boolean>;
- partialRefetch: PropTypes.Requireable<boolean>;
- returnPartialData: PropTypes.Requireable<boolean>;
- };
-}
+
diff --git a/node_modules/@apollo/react-components/lib/Subscription.d.ts b/node_modules/@apollo/react-components/lib/Subscription.d.ts
index b63d3d2..e320783 100644
--- a/node_modules/@apollo/react-components/lib/Subscription.d.ts
+++ b/node_modules/@apollo/react-components/lib/Subscription.d.ts
@@ -1,15 +1,4 @@
/// <reference types="react" />
import { OperationVariables } from '@apollo/react-common';
-import PropTypes from 'prop-types';
import { SubscriptionComponentOptions } from './types';
export declare function Subscription<TData = any, TVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): JSX.Element | null;
\ No newline at end of file
-export declare namespace Subscription {
- const propTypes: {
- subscription: PropTypes.Validator<object>;
- variables: PropTypes.Requireable<object>;
- children: PropTypes.Requireable<(...args: any[]) => any>;
- onSubscriptionData: PropTypes.Requireable<(...args: any[]) => any>;
- onSubscriptionComplete: PropTypes.Requireable<(...args: any[]) => any>;
- shouldResubscribe: PropTypes.Requireable<boolean | ((...args: any[]) => any)>;
- };
-}
diff --git a/node_modules/@apollo/react-components/lib/types.d.ts b/node_modules/@apollo/react-components/lib/types.d.ts
index 0c82d57..d9ceb13 100644
--- a/node_modules/@apollo/react-components/lib/types.d.ts
Expand Down
43 changes: 43 additions & 0 deletions packages/patch-cli/src/patches/apollo-cache+~1.3.0.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
diff --git a/node_modules/apollo-cache/lib/cache.d.ts b/node_modules/apollo-cache/lib/cache.d.ts
index 7d2c3c3..e04213b 100644
--- a/node_modules/apollo-cache/lib/cache.d.ts
+++ b/node_modules/apollo-cache/lib/cache.d.ts
@@ -2,7 +2,7 @@ import { DocumentNode } from 'graphql';
import { DataProxy, Cache } from './types';
export declare type Transaction<T> = (c: ApolloCache<T>) => void;
export declare abstract class ApolloCache<TSerialized> implements DataProxy {
- abstract read<T, TVariables = any>(query: Cache.ReadOptions<TVariables>): T | null;
+ abstract read<T, TVariables = any>(query: Cache.ReadOptions<TVariables, T>): T | null;
abstract write<TResult = any, TVariables = any>(write: Cache.WriteOptions<TResult, TVariables>): void;
abstract diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T>;
abstract watch(watch: Cache.WatchOptions): () => void;
@@ -15,8 +15,8 @@ export declare abstract class ApolloCache<TSerialized> implements DataProxy {
abstract recordOptimisticTransaction(transaction: Transaction<TSerialized>, id: string): void;
transformDocument(document: DocumentNode): DocumentNode;
transformForLink(document: DocumentNode): DocumentNode;
- readQuery<QueryType, TVariables = any>(options: DataProxy.Query<TVariables>, optimistic?: boolean): QueryType | null;
- readFragment<FragmentType, TVariables = any>(options: DataProxy.Fragment<TVariables>, optimistic?: boolean): FragmentType | null;
+ readQuery<QueryType, TVariables = any>(options: DataProxy.Query<TVariables, QueryType>, optimistic?: boolean): QueryType | null;
+ readFragment<FragmentType, TVariables = any>(options: DataProxy.Fragment<TVariables, FragmentType>, optimistic?: boolean): FragmentType | null;
writeQuery<TData = any, TVariables = any>(options: Cache.WriteQueryOptions<TData, TVariables>): void;
writeFragment<TData = any, TVariables = any>(options: Cache.WriteFragmentOptions<TData, TVariables>): void;
writeData<TData = any>({ id, data, }: Cache.WriteDataOptions<TData>): void;
diff --git a/node_modules/apollo-cache/lib/types/Cache.d.ts b/node_modules/apollo-cache/lib/types/Cache.d.ts
index f73aeb1..dfec0ef 100644
--- a/node_modules/apollo-cache/lib/types/Cache.d.ts
+++ b/node_modules/apollo-cache/lib/types/Cache.d.ts
@@ -4,12 +4,12 @@ export declare namespace Cache {
interface EvictionResult {
success: Boolean;
}
- interface ReadOptions<TVariables = any> extends DataProxy.Query<TVariables> {
+ interface ReadOptions<TVariables = any, TData = any> extends DataProxy.Query<TVariables, TData> {
rootId?: string;
previousResult?: any;
optimistic: boolean;
}
- interface WriteOptions<TResult = any, TVariables = any> extends DataProxy.Query<TVariables> {
+ interface WriteOptions<TResult = any, TVariables = any> extends DataProxy.Query<TVariables, TResult> {
dataId: string;
result: TResult;
}
diff --git a/node_modules/apollo-cache/lib/types/DataProxy.d.ts b/node_modules/apollo-cache/lib/types/DataProxy.d.ts
index 992df92..d3ff21a 100644
--- a/node_modules/apollo-cache/lib/types/DataProxy.d.ts
Expand Down

0 comments on commit 27e8d02

Please sign in to comment.