From 18dbe6c86afdb76ab14a447535a657129cf36a41 Mon Sep 17 00:00:00 2001 From: vangorra Date: Mon, 6 Mar 2017 20:26:58 -0800 Subject: [PATCH 1/5] Adding a 'this' definition on the middleware and afterware apply functions. --- src/transport/afterware.ts | 6 ++++-- src/transport/middleware.ts | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/transport/afterware.ts b/src/transport/afterware.ts index f7480c4b8cf..2f0de6b42e2 100644 --- a/src/transport/afterware.ts +++ b/src/transport/afterware.ts @@ -1,10 +1,12 @@ +import { NetworkInterface } from './networkInterface'; + export interface AfterwareResponse { response: Response; options: RequestInit; } export interface AfterwareInterface { - applyAfterware(response: AfterwareResponse, next: Function): any; + applyAfterware(this: NetworkInterface, response: AfterwareResponse, next: Function): any; } export interface BatchAfterwareResponse { @@ -13,5 +15,5 @@ export interface BatchAfterwareResponse { } export interface BatchAfterwareInterface { - applyBatchAfterware(response: BatchAfterwareResponse, next: Function): any; + applyBatchAfterware(this: NetworkInterface, response: BatchAfterwareResponse, next: Function): any; } diff --git a/src/transport/middleware.ts b/src/transport/middleware.ts index 2d80590f5da..27c7486e8b9 100644 --- a/src/transport/middleware.ts +++ b/src/transport/middleware.ts @@ -1,4 +1,4 @@ -import { Request } from './networkInterface'; +import { Request, NetworkInterface } from './networkInterface'; export interface MiddlewareRequest { request: Request; @@ -6,7 +6,7 @@ export interface MiddlewareRequest { } export interface MiddlewareInterface { - applyMiddleware(request: MiddlewareRequest, next: Function): void; + applyMiddleware(this: NetworkInterface, request: MiddlewareRequest, next: Function): void; } export interface BatchMiddlewareRequest { @@ -15,5 +15,5 @@ export interface BatchMiddlewareRequest { } export interface BatchMiddlewareInterface { - applyBatchMiddleware(request: BatchMiddlewareRequest, next: Function): void; + applyBatchMiddleware(this: NetworkInterface, request: BatchMiddlewareRequest, next: Function): void; } From ddec42117ba27da2dcef5134be8eade386731069 Mon Sep 17 00:00:00 2001 From: vangorra Date: Mon, 6 Mar 2017 20:53:07 -0800 Subject: [PATCH 2/5] Updating readme --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22f647dd6a8..d1763496799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Expect active development and potentially significant breaking changes in the `0 - Fix: make sure maybeDeepFreeze is called on results returned from setVariables and refetch [PR #1362](https://github.com/apollographql/apollo-client/pull/1362) - Fix: use setTimeout to throw uncaught errors in observer.next and observer.error[PR #1367](https://github.com/apollographql/apollo-client/pull/1367) - Remove returnPartialData option [PR #1370](https://github.com/apollographql/apollo-client/pull/1370) - +- Update TypeScript Middleware and Afterware interfaces to include a datatype for 'this' in apply function. ### 0.10.1 - Address deprecation warnings coming from `graphql-tag` [graphql-tag#54](https://github.com/apollographql/graphql-tag/issues/54) From 01d6e5c8020cabb28e9e940689d31f7af8a305a2 Mon Sep 17 00:00:00 2001 From: vangorra Date: Wed, 8 Mar 2017 19:59:42 -0800 Subject: [PATCH 3/5] Making the tsdef for apply middle/after ware function more specific. --- src/transport/afterware.ts | 7 ++++--- src/transport/middleware.ts | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/transport/afterware.ts b/src/transport/afterware.ts index 2f0de6b42e2..9f327e1975b 100644 --- a/src/transport/afterware.ts +++ b/src/transport/afterware.ts @@ -1,4 +1,5 @@ -import { NetworkInterface } from './networkInterface'; +import { HTTPFetchNetworkInterface } from './networkInterface'; +import { HTTPBatchedNetworkInterface } from './batchedNetworkInterface'; export interface AfterwareResponse { response: Response; @@ -6,7 +7,7 @@ export interface AfterwareResponse { } export interface AfterwareInterface { - applyAfterware(this: NetworkInterface, response: AfterwareResponse, next: Function): any; + applyAfterware(this: HTTPFetchNetworkInterface, response: AfterwareResponse, next: Function): any; } export interface BatchAfterwareResponse { @@ -15,5 +16,5 @@ export interface BatchAfterwareResponse { } export interface BatchAfterwareInterface { - applyBatchAfterware(this: NetworkInterface, response: BatchAfterwareResponse, next: Function): any; + applyBatchAfterware(this: HTTPBatchedNetworkInterface, response: BatchAfterwareResponse, next: Function): any; } diff --git a/src/transport/middleware.ts b/src/transport/middleware.ts index 27c7486e8b9..27dfcb845bc 100644 --- a/src/transport/middleware.ts +++ b/src/transport/middleware.ts @@ -1,4 +1,6 @@ -import { Request, NetworkInterface } from './networkInterface'; +import { Request, HTTPFetchNetworkInterface } from './networkInterface'; +import { HTTPBatchedNetworkInterface } from './batchedNetworkInterface'; + export interface MiddlewareRequest { request: Request; @@ -6,7 +8,7 @@ export interface MiddlewareRequest { } export interface MiddlewareInterface { - applyMiddleware(this: NetworkInterface, request: MiddlewareRequest, next: Function): void; + applyMiddleware(this: HTTPFetchNetworkInterface, request: MiddlewareRequest, next: Function): void; } export interface BatchMiddlewareRequest { @@ -15,5 +17,5 @@ export interface BatchMiddlewareRequest { } export interface BatchMiddlewareInterface { - applyBatchMiddleware(this: NetworkInterface, request: BatchMiddlewareRequest, next: Function): void; + applyBatchMiddleware(this: HTTPBatchedNetworkInterface, request: BatchMiddlewareRequest, next: Function): void; } From 0631e132867091d057e9eb32fe1bb50d0d656044 Mon Sep 17 00:00:00 2001 From: vangorra Date: Wed, 8 Mar 2017 20:02:24 -0800 Subject: [PATCH 4/5] Adding pull request number and link to readme. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1763496799..ea02b5c0143 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Expect active development and potentially significant breaking changes in the `0 - Fix: make sure maybeDeepFreeze is called on results returned from setVariables and refetch [PR #1362](https://github.com/apollographql/apollo-client/pull/1362) - Fix: use setTimeout to throw uncaught errors in observer.next and observer.error[PR #1367](https://github.com/apollographql/apollo-client/pull/1367) - Remove returnPartialData option [PR #1370](https://github.com/apollographql/apollo-client/pull/1370) -- Update TypeScript Middleware and Afterware interfaces to include a datatype for 'this' in apply function. +- Update TypeScript Middleware and Afterware interfaces to include a datatype for 'this' in apply function. [PR #1372](https://github.com/apollographql/apollo-client/pull/1372) ### 0.10.1 - Address deprecation warnings coming from `graphql-tag` [graphql-tag#54](https://github.com/apollographql/graphql-tag/issues/54) From f77d64c0acc98f8e24484744e3b7549a413813a7 Mon Sep 17 00:00:00 2001 From: vangorra Date: Tue, 14 Mar 2017 13:46:43 -0700 Subject: [PATCH 5/5] Fixing readme. --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dd95eedba0..563ae5f126c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Expect active development and potentially significant breaking changes in the `0.x` track. We'll try to be diligent about releasing a `1.0` version in a timely fashion (ideally within 3 to 6 months), to signal the start of a more stable API. ### vNEXT +- Fix: Update TypeScript Middleware and Afterware interfaces to include a datatype for 'this' in apply function. [PR #1372](https://github.com/apollographql/apollo-client/pull/1372) ### 1.0.0-rc.2 - throw error if deprecated options are being used [PR #1396](https://github.com/apollographql/apollo-client/pull/1396) @@ -14,10 +15,10 @@ Expect active development and potentially significant breaking changes in the `0 - Breaking: remove deprecated reduxRootKey [PR #1362](https://github.com/apollographql/apollo-client/pull/1362) - Fix: make sure maybeDeepFreeze is called on results returned from setVariables and refetch [PR #1362](https://github.com/apollographql/apollo-client/pull/1362) - Fix: use setTimeout to throw uncaught errors in observer.next and observer.error[PR #1367](https://github.com/apollographql/apollo-client/pull/1367) -- Fix: Update TypeScript Middleware and Afterware interfaces to include a datatype for 'this' in apply function. [PR #1372](https://github.com/apollographql/apollo-client/pull/1372) - Breaking: Remove returnPartialData option [PR #1370](https://github.com/apollographql/apollo-client/pull/1370) - Breaking: Implement fetchPolicy to replace noFetch and forceFetch [PR #1371](https://github.com/apollographql/apollo-client/pull/1371) + ### 0.10.1 - Address deprecation warnings coming from `graphql-tag` [graphql-tag#54](https://github.com/apollographql/graphql-tag/issues/54) - Do not stringify error stack traces [PR #1347](https://github.com/apollographql/apollo-client/pull/1347) @@ -520,4 +521,4 @@ This release has a minor version bump, which means npm will not automatically up ### v0.1.0 -Initial release. We didn't track changes before this version. +Initial release. We didn't track changes before this version. \ No newline at end of file