Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to @apollo/utils packages for createSHA and isNodeLike #1765

Merged
merged 2 commits into from
Apr 23, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions gateway-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"@apollo/core-schema": "~0.3.0",
"@apollo/federation-internals": "file:../internals-js",
"@apollo/query-planner": "file:../query-planner-js",
"@apollo/utils.createhash": "^1.0.0",
"@apollo/utils.isnodelike": "^1.0.0",
"@apollo/utils.logger": "^1.0.0",
"@josephg/resolvable": "^1.0.1",
"@opentelemetry/api": "^1.0.1",
Expand All @@ -42,8 +44,7 @@
"async-retry": "^1.3.3",
"loglevel": "^1.6.1",
"make-fetch-happen": "^8.0.0",
"pretty-format": "^27.0.0",
"sha.js": "^2.4.11"
"pretty-format": "^27.0.0"
},
"peerDependencies": {
"graphql": "^16.0.0"
Expand Down
2 changes: 1 addition & 1 deletion gateway-js/src/__tests__/gateway/lifecycle-hooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {
fixtures,
fixturesWithUpdate,
} from 'apollo-federation-integration-testsuite';
import { createHash } from '@apollo/utils.createhash';
import type { Logger } from '@apollo/utils.logger';
import resolvable from '@josephg/resolvable';
import { createHash } from '../../utilities/createHash';
import { getTestingSupergraphSdl } from '../execution-utils';

// The order of this was specified to preserve existing test coverage. Typically
Expand Down
2 changes: 1 addition & 1 deletion gateway-js/src/__tests__/gateway/supergraphSdl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SupergraphSdlUpdateFunction,
} from '@apollo/gateway';
import { fixturesWithUpdate } from 'apollo-federation-integration-testsuite';
import { createHash } from '../../utilities/createHash';
import { createHash } from '@apollo/utils.createhash';
import { ApolloServer } from 'apollo-server';
import type { Logger } from '@apollo/utils.logger';
import { fetch } from '../../__mocks__/make-fetch-happen-fetcher';
Expand Down
4 changes: 2 additions & 2 deletions gateway-js/src/datasources/RemoteGraphQLDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { fetch, Request, Headers, Response } from 'apollo-server-env';
import { isObject } from '../utilities/predicates';
import { GraphQLDataSource, GraphQLDataSourceProcessOptions, GraphQLDataSourceRequestKind } from './types';
import createSHA from 'apollo-server-core/dist/utils/createSHA';
import { createHash } from '@apollo/utils.createhash';
import { parseCacheControlHeader } from './parseCacheControlHeader';
import fetcher from 'make-fetch-happen';
export class RemoteGraphQLDataSource<
Expand Down Expand Up @@ -112,7 +112,7 @@ export class RemoteGraphQLDataSource<
: null;

if (this.apq) {
const apqHash = createSHA('sha256').update(request.query).digest('hex');
const apqHash = createHash('sha256').update(request.query).digest('hex');

// Take the original extensions and extend them with
// the necessary "extensions" for APQ handshaking.
Expand Down
2 changes: 1 addition & 1 deletion gateway-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
GraphQLExecutionResult,
GraphQLRequestContextExecutionDidStart,
} from 'apollo-server-types';
import { createHash } from '@apollo/utils.createhash';
import type { Logger } from '@apollo/utils.logger';
import { InMemoryLRUCache } from 'apollo-server-caching';
import {
Expand Down Expand Up @@ -53,7 +54,6 @@ import {
} from './config';
import { SpanStatusCode } from '@opentelemetry/api';
import { OpenTelemetrySpanNames, tracer } from './utilities/opentelemetry';
import { createHash } from './utilities/createHash';
import { addExtensions } from './schema-helper/addExtensions';
import {
IntrospectAndCompose,
Expand Down
10 changes: 0 additions & 10 deletions gateway-js/src/utilities/createHash.ts

This file was deleted.

11 changes: 0 additions & 11 deletions gateway-js/src/utilities/isNodeLike.ts

This file was deleted.

44 changes: 40 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.