@graphql-tools/schema 8.5.2-alpha-33fb2950.0 → 8.5.2-alpha-420b7771.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/cjs/addResolversToSchema.js +1 -1
- package/cjs/assertResolversPresent.js +1 -1
- package/cjs/chainResolvers.js +1 -1
- package/cjs/makeExecutableSchema.js +1 -1
- package/esm/addResolversToSchema.js +1 -1
- package/esm/assertResolversPresent.js +1 -1
- package/esm/chainResolvers.js +1 -1
- package/esm/makeExecutableSchema.js +1 -1
- package/package.json +8 -6
- package/typings/addResolversToSchema.d.cts +3 -0
- package/typings/addResolversToSchema.d.ts +1 -1
- package/typings/assertResolversPresent.d.cts +3 -0
- package/typings/assertResolversPresent.d.ts +1 -1
- package/typings/chainResolvers.d.cts +5 -0
- package/typings/chainResolvers.d.ts +1 -1
- package/typings/checkForResolveTypeResolver.d.cts +3 -0
- package/typings/checkForResolveTypeResolver.d.ts +1 -1
- package/typings/extendResolversFromInterfaces.d.cts +3 -0
- package/typings/extendResolversFromInterfaces.d.ts +1 -1
- package/typings/index.d.cts +8 -0
- package/typings/makeExecutableSchema.d.cts +47 -0
- package/typings/makeExecutableSchema.d.ts +1 -1
- package/typings/merge-schemas.d.cts +16 -0
- package/typings/merge-schemas.d.ts +1 -1
- package/typings/types.d.cts +42 -0
- package/typings/types.d.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addResolversToSchema = void 0;
|
|
4
|
-
const graphql_1 = require("
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
5
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
6
|
const checkForResolveTypeResolver_js_1 = require("./checkForResolveTypeResolver.js");
|
|
7
7
|
const extendResolversFromInterfaces_js_1 = require("./extendResolversFromInterfaces.js");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertResolversPresent = void 0;
|
|
4
|
-
const graphql_1 = require("
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
5
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
6
|
function assertResolversPresent(schema, resolverValidationOptions = {}) {
|
|
7
7
|
const { requireResolversForArgs, requireResolversForNonScalar, requireResolversForAllFields } = resolverValidationOptions;
|
package/cjs/chainResolvers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.chainResolvers = void 0;
|
|
4
|
-
const graphql_1 = require("
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
5
|
function chainResolvers(resolvers) {
|
|
6
6
|
return (root, args, ctx, info) => resolvers.reduce((prev, curResolver) => {
|
|
7
7
|
if (curResolver != null) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeExecutableSchema = void 0;
|
|
4
|
-
const graphql_1 = require("
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
5
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
6
|
const addResolversToSchema_js_1 = require("./addResolversToSchema.js");
|
|
7
7
|
const assertResolversPresent_js_1 = require("./assertResolversPresent.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLEnumType, isSchema, GraphQLScalarType, GraphQLUnionType, GraphQLInterfaceType, GraphQLObjectType, isSpecifiedScalarType, isScalarType, isEnumType, isUnionType, isInterfaceType, isObjectType, } from '
|
|
1
|
+
import { GraphQLEnumType, isSchema, GraphQLScalarType, GraphQLUnionType, GraphQLInterfaceType, GraphQLObjectType, isSpecifiedScalarType, isScalarType, isEnumType, isUnionType, isInterfaceType, isObjectType, } from 'graphql';
|
|
2
2
|
import { mapSchema, MapperKind, forEachDefaultValue, serializeInputValue, healSchema, parseInputValue, forEachField, } from '@graphql-tools/utils';
|
|
3
3
|
import { checkForResolveTypeResolver } from './checkForResolveTypeResolver.js';
|
|
4
4
|
import { extendResolversFromInterfaces } from './extendResolversFromInterfaces.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNamedType, isScalarType } from '
|
|
1
|
+
import { getNamedType, isScalarType } from 'graphql';
|
|
2
2
|
import { forEachField } from '@graphql-tools/utils';
|
|
3
3
|
export function assertResolversPresent(schema, resolverValidationOptions = {}) {
|
|
4
4
|
const { requireResolversForArgs, requireResolversForNonScalar, requireResolversForAllFields } = resolverValidationOptions;
|
package/esm/chainResolvers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildASTSchema, buildSchema, isSchema } from '
|
|
1
|
+
import { buildASTSchema, buildSchema, isSchema } from 'graphql';
|
|
2
2
|
import { asArray, pruneSchema } from '@graphql-tools/utils';
|
|
3
3
|
import { addResolversToSchema } from './addResolversToSchema.js';
|
|
4
4
|
import { assertResolversPresent } from './assertResolversPresent.js';
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/schema",
|
|
3
|
-
"version": "8.5.2-alpha-
|
|
3
|
+
"version": "8.5.2-alpha-420b7771.0",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
8
|
+
},
|
|
6
9
|
"dependencies": {
|
|
7
|
-
"@graphql-tools/merge": "8.3.2-alpha-
|
|
8
|
-
"@graphql-tools/utils": "8.9.1-alpha-
|
|
9
|
-
"@graphql-tools/graphql": "0.1.0-alpha-33fb2950.0",
|
|
10
|
+
"@graphql-tools/merge": "8.3.2-alpha-420b7771.0",
|
|
11
|
+
"@graphql-tools/utils": "8.9.1-alpha-420b7771.0",
|
|
10
12
|
"tslib": "^2.4.0",
|
|
11
13
|
"value-or-promise": "1.0.11"
|
|
12
14
|
},
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
"exports": {
|
|
27
29
|
".": {
|
|
28
30
|
"require": {
|
|
29
|
-
"types": "./typings/index.d.
|
|
31
|
+
"types": "./typings/index.d.cts",
|
|
30
32
|
"default": "./cjs/index.js"
|
|
31
33
|
},
|
|
32
34
|
"import": {
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
},
|
|
41
43
|
"./*": {
|
|
42
44
|
"require": {
|
|
43
|
-
"types": "./typings/*.d.
|
|
45
|
+
"types": "./typings/*.d.cts",
|
|
44
46
|
"default": "./cjs/*.js"
|
|
45
47
|
},
|
|
46
48
|
"import": {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { IResolvers, IResolverValidationOptions, IAddResolversToSchemaOptions } from '@graphql-tools/utils';
|
|
3
|
+
export declare function addResolversToSchema(schemaOrOptions: GraphQLSchema | IAddResolversToSchemaOptions, legacyInputResolvers?: IResolvers, legacyInputValidationOptions?: IResolverValidationOptions): GraphQLSchema;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GraphQLSchema } from '
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { IResolvers, IResolverValidationOptions, IAddResolversToSchemaOptions } from '@graphql-tools/utils';
|
|
3
3
|
export declare function addResolversToSchema(schemaOrOptions: GraphQLSchema | IAddResolversToSchemaOptions, legacyInputResolvers?: IResolvers, legacyInputValidationOptions?: IResolverValidationOptions): GraphQLSchema;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GraphQLSchema } from '
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { IResolverValidationOptions } from '@graphql-tools/utils';
|
|
3
3
|
export declare function assertResolversPresent(schema: GraphQLSchema, resolverValidationOptions?: IResolverValidationOptions): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GraphQLResolveInfo, GraphQLFieldResolver } from 'graphql';
|
|
2
|
+
import { Maybe } from '@graphql-tools/utils';
|
|
3
|
+
export declare function chainResolvers<TArgs extends {
|
|
4
|
+
[argName: string]: any;
|
|
5
|
+
}>(resolvers: Array<Maybe<GraphQLFieldResolver<any, any, TArgs>>>): (root: any, args: TArgs, ctx: any, info: GraphQLResolveInfo) => any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLResolveInfo, GraphQLFieldResolver } from '
|
|
1
|
+
import { GraphQLResolveInfo, GraphQLFieldResolver } from 'graphql';
|
|
2
2
|
import { Maybe } from '@graphql-tools/utils';
|
|
3
3
|
export declare function chainResolvers<TArgs extends {
|
|
4
4
|
[argName: string]: any;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GraphQLSchema } from '
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { ValidatorBehavior } from '@graphql-tools/utils';
|
|
3
3
|
export declare function checkForResolveTypeResolver(schema: GraphQLSchema, requireResolversForResolveType?: ValidatorBehavior): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { assertResolversPresent } from './assertResolversPresent.js';
|
|
2
|
+
export { chainResolvers } from './chainResolvers.js';
|
|
3
|
+
export { addResolversToSchema } from './addResolversToSchema.js';
|
|
4
|
+
export { checkForResolveTypeResolver } from './checkForResolveTypeResolver.js';
|
|
5
|
+
export { extendResolversFromInterfaces } from './extendResolversFromInterfaces.js';
|
|
6
|
+
export * from './makeExecutableSchema.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './merge-schemas.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { IExecutableSchemaDefinition } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Builds a schema from the provided type definitions and resolvers.
|
|
5
|
+
*
|
|
6
|
+
* The type definitions are written using Schema Definition Language (SDL). They
|
|
7
|
+
* can be provided as a string, a `DocumentNode`, a function, or an array of any
|
|
8
|
+
* of these. If a function is provided, it will be passed no arguments and
|
|
9
|
+
* should return an array of strings or `DocumentNode`s.
|
|
10
|
+
*
|
|
11
|
+
* Note: You can use `graphql-tag` to not only parse a string into a
|
|
12
|
+
* `DocumentNode` but also to provide additional syntax highlighting in your
|
|
13
|
+
* editor (with the appropriate editor plugin).
|
|
14
|
+
*
|
|
15
|
+
* ```js
|
|
16
|
+
* const typeDefs = gql`
|
|
17
|
+
* type Query {
|
|
18
|
+
* posts: [Post]
|
|
19
|
+
* author(id: Int!): Author
|
|
20
|
+
* }
|
|
21
|
+
* `;
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* The `resolvers` object should be a map of type names to nested object, which
|
|
25
|
+
* themselves map the type's fields to their appropriate resolvers.
|
|
26
|
+
* See the [Resolvers](/docs/resolvers) section of the documentation for more details.
|
|
27
|
+
*
|
|
28
|
+
* ```js
|
|
29
|
+
* const resolvers = {
|
|
30
|
+
* Query: {
|
|
31
|
+
* posts: (obj, args, ctx, info) => getAllPosts(),
|
|
32
|
+
* author: (obj, args, ctx, info) => getAuthorById(args.id)
|
|
33
|
+
* }
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* Once you've defined both the `typeDefs` and `resolvers`, you can create your
|
|
38
|
+
* schema:
|
|
39
|
+
*
|
|
40
|
+
* ```js
|
|
41
|
+
* const schema = makeExecutableSchema({
|
|
42
|
+
* typeDefs,
|
|
43
|
+
* resolvers,
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function makeExecutableSchema<TContext = any>({ typeDefs, resolvers, resolverValidationOptions, parseOptions, inheritResolversFromInterfaces, pruningOptions, updateResolversInPlace, schemaExtensions, }: IExecutableSchemaDefinition<TContext>): GraphQLSchema;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { IExecutableSchemaDefinition } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration object for schema merging
|
|
5
|
+
*/
|
|
6
|
+
export declare type MergeSchemasConfig<T = any> = Partial<IExecutableSchemaDefinition<T>> & IExecutableSchemaDefinition<T>['parseOptions'] & {
|
|
7
|
+
/**
|
|
8
|
+
* The schemas to be merged
|
|
9
|
+
*/
|
|
10
|
+
schemas?: GraphQLSchema[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Synchronously merges multiple schemas, typeDefinitions and/or resolvers into a single schema.
|
|
14
|
+
* @param config Configuration object
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeSchemas(config: MergeSchemasConfig): GraphQLSchema;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TypeSource, IResolvers, IResolverValidationOptions, GraphQLParseOptions, PruneSchemaOptions } from '@graphql-tools/utils';
|
|
2
|
+
import { SchemaExtensions } from '@graphql-tools/merge';
|
|
3
|
+
import { BuildSchemaOptions } from 'graphql';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration object for creating an executable schema
|
|
6
|
+
*/
|
|
7
|
+
export interface IExecutableSchemaDefinition<TContext = any> {
|
|
8
|
+
/**
|
|
9
|
+
* The type definitions used to create the schema
|
|
10
|
+
*/
|
|
11
|
+
typeDefs: TypeSource;
|
|
12
|
+
/**
|
|
13
|
+
* Object describing the field resolvers for the provided type definitions
|
|
14
|
+
*/
|
|
15
|
+
resolvers?: IResolvers<any, TContext> | Array<IResolvers<any, TContext>>;
|
|
16
|
+
/**
|
|
17
|
+
* Additional options for validating the provided resolvers
|
|
18
|
+
*/
|
|
19
|
+
resolverValidationOptions?: IResolverValidationOptions;
|
|
20
|
+
/**
|
|
21
|
+
* Additional options for parsing the type definitions if they are provided
|
|
22
|
+
* as a string
|
|
23
|
+
*/
|
|
24
|
+
parseOptions?: BuildSchemaOptions & GraphQLParseOptions;
|
|
25
|
+
/**
|
|
26
|
+
* GraphQL object types that implement interfaces will inherit any missing
|
|
27
|
+
* resolvers from their interface types defined in the `resolvers` object
|
|
28
|
+
*/
|
|
29
|
+
inheritResolversFromInterfaces?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Additional options for removing unused types from the schema
|
|
32
|
+
*/
|
|
33
|
+
pruningOptions?: PruneSchemaOptions;
|
|
34
|
+
/**
|
|
35
|
+
* Do not create a schema again and use the one from `buildASTSchema`
|
|
36
|
+
*/
|
|
37
|
+
updateResolversInPlace?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Schema extensions
|
|
40
|
+
*/
|
|
41
|
+
schemaExtensions?: SchemaExtensions | Array<SchemaExtensions>;
|
|
42
|
+
}
|
package/typings/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeSource, IResolvers, IResolverValidationOptions, GraphQLParseOptions, PruneSchemaOptions } from '@graphql-tools/utils';
|
|
2
2
|
import { SchemaExtensions } from '@graphql-tools/merge';
|
|
3
|
-
import { BuildSchemaOptions } from '
|
|
3
|
+
import { BuildSchemaOptions } from 'graphql';
|
|
4
4
|
/**
|
|
5
5
|
* Configuration object for creating an executable schema
|
|
6
6
|
*/
|