@apollo/gateway 0.50.1 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/datasources/LocalGraphQLDataSource.d.ts +2 -2
- package/dist/datasources/LocalGraphQLDataSource.d.ts.map +1 -1
- package/dist/datasources/LocalGraphQLDataSource.js +0 -2
- package/dist/datasources/LocalGraphQLDataSource.js.map +1 -1
- package/dist/datasources/RemoteGraphQLDataSource.d.ts +11 -10
- package/dist/datasources/RemoteGraphQLDataSource.d.ts.map +1 -1
- package/dist/datasources/RemoteGraphQLDataSource.js +30 -31
- package/dist/datasources/RemoteGraphQLDataSource.js.map +1 -1
- package/dist/datasources/types.d.ts +5 -5
- package/dist/datasources/types.d.ts.map +1 -1
- package/dist/executeQueryPlan.d.ts +3 -3
- package/dist/executeQueryPlan.d.ts.map +1 -1
- package/dist/executeQueryPlan.js +2 -2
- package/dist/executeQueryPlan.js.map +1 -1
- package/dist/index.d.ts +7 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -35
- package/dist/index.js.map +1 -1
- package/dist/supergraphManagers/IntrospectAndCompose/loadServicesFromRemoteEndpoint.d.ts.map +1 -1
- package/dist/supergraphManagers/IntrospectAndCompose/loadServicesFromRemoteEndpoint.js.map +1 -1
- package/dist/supergraphManagers/UplinkFetcher/index.d.ts +2 -2
- package/dist/supergraphManagers/UplinkFetcher/index.d.ts.map +1 -1
- package/dist/supergraphManagers/UplinkFetcher/index.js.map +1 -1
- package/dist/supergraphManagers/UplinkFetcher/loadSupergraphSdlFromStorage.d.ts +3 -3
- package/dist/supergraphManagers/UplinkFetcher/loadSupergraphSdlFromStorage.d.ts.map +1 -1
- package/dist/supergraphManagers/UplinkFetcher/loadSupergraphSdlFromStorage.js +14 -13
- package/dist/supergraphManagers/UplinkFetcher/loadSupergraphSdlFromStorage.js.map +1 -1
- package/dist/supergraphManagers/UplinkFetcher/outOfBandReporter.d.ts +6 -5
- package/dist/supergraphManagers/UplinkFetcher/outOfBandReporter.d.ts.map +1 -1
- package/dist/supergraphManagers/UplinkFetcher/outOfBandReporter.js +3 -3
- package/dist/supergraphManagers/UplinkFetcher/outOfBandReporter.js.map +1 -1
- package/dist/typings/graphql.d.ts +24 -0
- package/dist/typings/graphql.d.ts.map +1 -0
- package/dist/{schema-helper/resolverMap.js → typings/graphql.js} +1 -1
- package/dist/typings/graphql.js.map +1 -0
- package/package.json +11 -13
- package/src/__generated__/graphqlTypes.ts +1 -1
- package/src/__tests__/executeQueryPlan.test.ts +15 -6
- package/src/__tests__/execution-utils.ts +4 -4
- package/src/__tests__/gateway/buildService.test.ts +81 -83
- package/src/__tests__/gateway/endToEnd.test.ts +1 -1
- package/src/__tests__/gateway/executor.test.ts +20 -17
- package/src/__tests__/gateway/opentelemetry.test.ts +3 -7
- package/src/__tests__/gateway/reporting.test.ts +1 -1
- package/src/__tests__/gateway/supergraphSdl.test.ts +11 -13
- package/src/__tests__/integration/complex-key.test.ts +2 -2
- package/src/config.ts +4 -6
- package/src/datasources/LocalGraphQLDataSource.ts +2 -4
- package/src/datasources/RemoteGraphQLDataSource.ts +72 -60
- package/src/datasources/__tests__/LocalGraphQLDataSource.test.ts +3 -3
- package/src/datasources/__tests__/RemoteGraphQLDataSource.test.ts +120 -159
- package/src/datasources/types.ts +12 -5
- package/src/executeQueryPlan.ts +18 -18
- package/src/index.ts +25 -71
- package/src/supergraphManagers/IntrospectAndCompose/__tests__/IntrospectAndCompose.test.ts +0 -6
- package/src/supergraphManagers/IntrospectAndCompose/loadServicesFromRemoteEndpoint.ts +2 -2
- package/src/supergraphManagers/UplinkFetcher/__tests__/loadSupergraphSdlFromStorage.test.ts +70 -74
- package/src/supergraphManagers/UplinkFetcher/index.ts +2 -2
- package/src/supergraphManagers/UplinkFetcher/loadSupergraphSdlFromStorage.ts +23 -17
- package/src/supergraphManagers/UplinkFetcher/outOfBandReporter.ts +9 -7
- package/src/typings/graphql.ts +31 -0
- package/dist/cache.d.ts +0 -18
- package/dist/cache.d.ts.map +0 -1
- package/dist/cache.js +0 -46
- package/dist/cache.js.map +0 -1
- package/dist/schema-helper/addResolversToSchema.d.ts +0 -4
- package/dist/schema-helper/addResolversToSchema.d.ts.map +0 -1
- package/dist/schema-helper/addResolversToSchema.js +0 -62
- package/dist/schema-helper/addResolversToSchema.js.map +0 -1
- package/dist/schema-helper/index.d.ts +0 -3
- package/dist/schema-helper/index.d.ts.map +0 -1
- package/dist/schema-helper/index.js +0 -19
- package/dist/schema-helper/index.js.map +0 -1
- package/dist/schema-helper/resolverMap.d.ts +0 -16
- package/dist/schema-helper/resolverMap.d.ts.map +0 -1
- package/dist/schema-helper/resolverMap.js.map +0 -1
- package/dist/utilities/createHash.d.ts +0 -2
- package/dist/utilities/createHash.d.ts.map +0 -1
- package/dist/utilities/createHash.js +0 -15
- package/dist/utilities/createHash.js.map +0 -1
- package/src/__mocks__/apollo-server-env.ts +0 -56
- package/src/__mocks__/make-fetch-happen-fetcher.ts +0 -57
- package/src/cache.ts +0 -66
- package/src/make-fetch-happen.d.ts +0 -59
- package/src/schema-helper/addResolversToSchema.ts +0 -83
- package/src/schema-helper/index.ts +0 -2
- package/src/schema-helper/resolverMap.ts +0 -23
- package/src/utilities/createHash.ts +0 -10
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GraphQLSchema,
|
|
3
|
-
isObjectType,
|
|
4
|
-
GraphQLEnumType,
|
|
5
|
-
isAbstractType,
|
|
6
|
-
isScalarType,
|
|
7
|
-
isEnumType,
|
|
8
|
-
GraphQLEnumValueConfig,
|
|
9
|
-
} from 'graphql';
|
|
10
|
-
|
|
11
|
-
import { GraphQLResolverMap } from './resolverMap';
|
|
12
|
-
|
|
13
|
-
export function addResolversToSchema(
|
|
14
|
-
schema: GraphQLSchema,
|
|
15
|
-
resolvers: GraphQLResolverMap<any>
|
|
16
|
-
) {
|
|
17
|
-
for (const [typeName, fieldConfigs] of Object.entries(resolvers)) {
|
|
18
|
-
const type = schema.getType(typeName);
|
|
19
|
-
|
|
20
|
-
if (isAbstractType(type)) {
|
|
21
|
-
for (const [fieldName, fieldConfig] of Object.entries(fieldConfigs)) {
|
|
22
|
-
if (fieldName.startsWith("__")) {
|
|
23
|
-
(type as any)[fieldName.substring(2)] = fieldConfig;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isScalarType(type)) {
|
|
29
|
-
for (const fn in fieldConfigs) {
|
|
30
|
-
(type as any)[fn] = (fieldConfigs as any)[fn];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (isEnumType(type)) {
|
|
35
|
-
const values = type.getValues();
|
|
36
|
-
const newValues: { [key: string]: GraphQLEnumValueConfig } = {};
|
|
37
|
-
values.forEach(value => {
|
|
38
|
-
let newValue = (fieldConfigs as any)[value.name];
|
|
39
|
-
if (newValue === undefined) {
|
|
40
|
-
newValue = value.name;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
newValues[value.name] = {
|
|
44
|
-
value: newValue,
|
|
45
|
-
deprecationReason: value.deprecationReason,
|
|
46
|
-
description: value.description,
|
|
47
|
-
astNode: value.astNode,
|
|
48
|
-
extensions: undefined
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// In place updating hack to get around pulling in the full
|
|
53
|
-
// schema walking and immutable updating machinery from graphql-tools
|
|
54
|
-
Object.assign(
|
|
55
|
-
type,
|
|
56
|
-
new GraphQLEnumType({
|
|
57
|
-
...type.toConfig(),
|
|
58
|
-
values: newValues
|
|
59
|
-
})
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (!isObjectType(type)) continue;
|
|
64
|
-
|
|
65
|
-
const fieldMap = type.getFields();
|
|
66
|
-
|
|
67
|
-
for (const [fieldName, fieldConfig] of Object.entries(fieldConfigs)) {
|
|
68
|
-
if (fieldName.startsWith("__")) {
|
|
69
|
-
(type as any)[fieldName.substring(2)] = fieldConfig;
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const field = fieldMap[fieldName];
|
|
74
|
-
if (!field) continue;
|
|
75
|
-
|
|
76
|
-
if (typeof fieldConfig === "function") {
|
|
77
|
-
field.resolve = fieldConfig;
|
|
78
|
-
} else {
|
|
79
|
-
field.resolve = fieldConfig.resolve;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { GraphQLFieldResolver, GraphQLScalarType, DocumentNode } from 'graphql';
|
|
2
|
-
|
|
3
|
-
export interface GraphQLSchemaModule {
|
|
4
|
-
typeDefs: DocumentNode;
|
|
5
|
-
resolvers?: GraphQLResolverMap<any>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
9
|
-
export interface GraphQLResolverMap<TContext = {}> {
|
|
10
|
-
[typeName: string]:
|
|
11
|
-
| {
|
|
12
|
-
[fieldName: string]:
|
|
13
|
-
| GraphQLFieldResolver<any, TContext, any>
|
|
14
|
-
| {
|
|
15
|
-
requires?: string;
|
|
16
|
-
resolve: GraphQLFieldResolver<any, TContext, any>;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
| GraphQLScalarType
|
|
20
|
-
| {
|
|
21
|
-
[enumValue: string]: string | number;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import isNodeLike from './isNodeLike';
|
|
2
|
-
|
|
3
|
-
export function createHash (kind: string): import('crypto').Hash {
|
|
4
|
-
if (isNodeLike) {
|
|
5
|
-
// Use module.require instead of just require to avoid bundling whatever
|
|
6
|
-
// crypto polyfills a non-Node bundler might fall back to.
|
|
7
|
-
return module.require('crypto').createHash(kind);
|
|
8
|
-
}
|
|
9
|
-
return require('sha.js')(kind);
|
|
10
|
-
}
|