From 3aa1b084b70a139c1ee9885e43e537be18480822 Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Mon, 7 Sep 2020 12:33:28 +0000 Subject: [PATCH] Remove import of `apollo-env`. We're only importing `apollo-env`, which is primarily a polyfill library, for one of its helper utilities. Inlining these few lines seems like a win. (The import removed from the `RemoteGraphQLDataSource.test.ts` test was unused.) --- gateway-js/package.json | 1 - .../datasources/__tests__/RemoteGraphQLDataSource.test.ts | 1 - gateway-js/src/utilities/array.ts | 6 +++++- package-lock.json | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gateway-js/package.json b/gateway-js/package.json index f8a1cae02..f8f0a945a 100644 --- a/gateway-js/package.json +++ b/gateway-js/package.json @@ -23,7 +23,6 @@ "@apollo/query-planner-wasm": "0.0.2", "@types/node-fetch": "2.5.4", "apollo-engine-reporting-protobuf": "^0.5.2", - "apollo-env": "^0.6.1", "apollo-graphql": "^0.6.0", "apollo-server-caching": "^0.5.2", "apollo-server-core": "^2.17.0", diff --git a/gateway-js/src/datasources/__tests__/RemoteGraphQLDataSource.test.ts b/gateway-js/src/datasources/__tests__/RemoteGraphQLDataSource.test.ts index f81b39afb..c2b0e45b2 100644 --- a/gateway-js/src/datasources/__tests__/RemoteGraphQLDataSource.test.ts +++ b/gateway-js/src/datasources/__tests__/RemoteGraphQLDataSource.test.ts @@ -9,7 +9,6 @@ import { import { RemoteGraphQLDataSource } from '../RemoteGraphQLDataSource'; import { Headers } from 'apollo-server-env'; import { GraphQLRequestContext } from 'apollo-server-types'; -import { Response } from '../../../../../../apollo-tooling/packages/apollo-env/lib'; beforeEach(() => { fetch.mockReset(); diff --git a/gateway-js/src/utilities/array.ts b/gateway-js/src/utilities/array.ts index a2456a90f..1141d4207 100644 --- a/gateway-js/src/utilities/array.ts +++ b/gateway-js/src/utilities/array.ts @@ -1,4 +1,8 @@ -import { isNotNullOrUndefined } from 'apollo-env'; +function isNotNullOrUndefined( + value: T | null | undefined, +): value is T { + return value !== null && typeof value !== 'undefined'; +} export function compactMap( array: T[], diff --git a/package-lock.json b/package-lock.json index 6704236b6..3bedf7f2f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,6 @@ "@apollo/query-planner-wasm": "0.0.2", "@types/node-fetch": "2.5.4", "apollo-engine-reporting-protobuf": "^0.5.2", - "apollo-env": "^0.6.1", "apollo-graphql": "^0.6.0", "apollo-server-caching": "^0.5.2", "apollo-server-core": "^2.17.0",