@graphql-tools/load 7.7.2-alpha-e7752ba5.0 → 7.7.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/documents.js +1 -1
- package/cjs/filter-document-kind.js +1 -1
- package/cjs/load-typedefs/collect-sources.js +1 -1
- package/cjs/schema.js +1 -1
- package/esm/documents.js +1 -1
- package/esm/filter-document-kind.js +1 -1
- package/esm/load-typedefs/collect-sources.js +1 -1
- package/esm/schema.js +1 -1
- package/package.json +8 -6
- package/typings/documents.d.cts +31 -0
- package/typings/documents.d.ts +1 -1
- package/typings/filter-document-kind.d.cts +5 -0
- package/typings/filter-document-kind.d.ts +1 -1
- package/typings/index.d.cts +4 -0
- package/typings/load-typedefs/collect-sources.d.cts +14 -0
- package/typings/load-typedefs/load-file.d.cts +4 -0
- package/typings/load-typedefs/options.d.cts +2 -0
- package/typings/load-typedefs/parse.d.cts +10 -0
- package/typings/load-typedefs.d.cts +31 -0
- package/typings/schema.d.cts +23 -0
- package/typings/schema.d.ts +1 -1
- package/typings/utils/custom-loader.d.cts +3 -0
- package/typings/utils/helpers.d.cts +9 -0
- package/typings/utils/pointers.d.cts +5 -0
- package/typings/utils/queue.d.cts +10 -0
package/cjs/documents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadDocumentsSync = exports.loadDocuments = exports.NON_OPERATION_KINDS = exports.OPERATION_KINDS = void 0;
|
|
4
|
-
const graphql_1 = require("
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
5
|
const load_typedefs_js_1 = require("./load-typedefs.js");
|
|
6
6
|
/**
|
|
7
7
|
* Kinds of AST nodes that are included in executable documents
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.collectSourcesSync = exports.collectSources = void 0;
|
|
27
27
|
const utils_1 = require("@graphql-tools/utils");
|
|
28
|
-
const graphql_1 = require("
|
|
28
|
+
const graphql_1 = require("graphql");
|
|
29
29
|
const load_file_js_1 = require("./load-file.js");
|
|
30
30
|
const helpers_js_1 = require("../utils/helpers.js");
|
|
31
31
|
const custom_loader_js_1 = require("../utils/custom-loader.js");
|
package/cjs/schema.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadSchemaSync = exports.loadSchema = void 0;
|
|
4
4
|
const load_typedefs_js_1 = require("./load-typedefs.js");
|
|
5
|
-
const graphql_1 = require("
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
6
|
const documents_js_1 = require("./documents.js");
|
|
7
7
|
const schema_1 = require("@graphql-tools/schema");
|
|
8
8
|
/**
|
package/esm/documents.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDocumentString, parseGraphQLSDL, getDocumentNodeFromSchema, asArray } from '@graphql-tools/utils';
|
|
2
|
-
import { isSchema, Kind } from '
|
|
2
|
+
import { isSchema, Kind } from 'graphql';
|
|
3
3
|
import { loadFile, loadFileSync } from './load-file.js';
|
|
4
4
|
import { stringToHash, useStack } from '../utils/helpers.js';
|
|
5
5
|
import { useCustomLoader, useCustomLoaderSync } from '../utils/custom-loader.js';
|
package/esm/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadTypedefs, loadTypedefsSync } from './load-typedefs.js';
|
|
2
|
-
import { Source as GraphQLSource, print, lexicographicSortSchema, } from '
|
|
2
|
+
import { Source as GraphQLSource, print, lexicographicSortSchema, } from 'graphql';
|
|
3
3
|
import { OPERATION_KINDS } from './documents.js';
|
|
4
4
|
import { mergeSchemas } from '@graphql-tools/schema';
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/load",
|
|
3
|
-
"version": "7.7.2-alpha-
|
|
3
|
+
"version": "7.7.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/utils": "8.9.1-alpha-
|
|
8
|
-
"@graphql-tools/schema": "8.5.2-alpha-
|
|
9
|
-
"@graphql-tools/graphql": "0.1.0-alpha-e7752ba5.0",
|
|
10
|
+
"@graphql-tools/utils": "8.9.1-alpha-420b7771.0",
|
|
11
|
+
"@graphql-tools/schema": "8.5.2-alpha-420b7771.0",
|
|
10
12
|
"p-limit": "3.1.0",
|
|
11
13
|
"tslib": "^2.4.0"
|
|
12
14
|
},
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
"exports": {
|
|
28
30
|
".": {
|
|
29
31
|
"require": {
|
|
30
|
-
"types": "./typings/index.d.
|
|
32
|
+
"types": "./typings/index.d.cts",
|
|
31
33
|
"default": "./cjs/index.js"
|
|
32
34
|
},
|
|
33
35
|
"import": {
|
|
@@ -41,7 +43,7 @@
|
|
|
41
43
|
},
|
|
42
44
|
"./*": {
|
|
43
45
|
"require": {
|
|
44
|
-
"types": "./typings/*.d.
|
|
46
|
+
"types": "./typings/*.d.cts",
|
|
45
47
|
"default": "./cjs/*.js"
|
|
46
48
|
},
|
|
47
49
|
"import": {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Source } from '@graphql-tools/utils';
|
|
2
|
+
import { Kind } from 'graphql';
|
|
3
|
+
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';
|
|
4
|
+
declare type KindList = Array<typeof Kind[keyof typeof Kind]>;
|
|
5
|
+
/**
|
|
6
|
+
* Kinds of AST nodes that are included in executable documents
|
|
7
|
+
*/
|
|
8
|
+
export declare const OPERATION_KINDS: KindList;
|
|
9
|
+
/**
|
|
10
|
+
* Kinds of AST nodes that are included in type system definition documents
|
|
11
|
+
*/
|
|
12
|
+
export declare const NON_OPERATION_KINDS: KindList;
|
|
13
|
+
/**
|
|
14
|
+
* Asynchronously loads executable documents (i.e. operations and fragments) from
|
|
15
|
+
* the provided pointers. The pointers may be individual files or a glob pattern.
|
|
16
|
+
* The files themselves may be `.graphql` files or `.js` and `.ts` (in which
|
|
17
|
+
* case they will be parsed using graphql-tag-pluck).
|
|
18
|
+
* @param pointerOrPointers Pointers to the files to load the documents from
|
|
19
|
+
* @param options Additional options
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadDocuments(pointerOrPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], options: LoadTypedefsOptions): Promise<Source[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronously loads executable documents (i.e. operations and fragments) from
|
|
24
|
+
* the provided pointers. The pointers may be individual files or a glob pattern.
|
|
25
|
+
* The files themselves may be `.graphql` files or `.js` and `.ts` (in which
|
|
26
|
+
* case they will be parsed using graphql-tag-pluck).
|
|
27
|
+
* @param pointerOrPointers Pointers to the files to load the documents from
|
|
28
|
+
* @param options Additional options
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadDocumentsSync(pointerOrPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], options: LoadTypedefsOptions): Source[];
|
|
31
|
+
export {};
|
package/typings/documents.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Source } from '@graphql-tools/utils';
|
|
2
|
-
import { Kind } from '
|
|
2
|
+
import { Kind } from 'graphql';
|
|
3
3
|
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';
|
|
4
4
|
declare type KindList = Array<typeof Kind[keyof typeof Kind]>;
|
|
5
5
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Source } from '@graphql-tools/utils';
|
|
2
|
+
import { LoadTypedefsOptions } from '../load-typedefs.js';
|
|
3
|
+
export declare function collectSources<TOptions>({ pointerOptionMap, options, }: {
|
|
4
|
+
pointerOptionMap: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
options: LoadTypedefsOptions<Partial<TOptions>>;
|
|
8
|
+
}): Promise<Source[]>;
|
|
9
|
+
export declare function collectSourcesSync<TOptions>({ pointerOptionMap, options, }: {
|
|
10
|
+
pointerOptionMap: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
options: LoadTypedefsOptions<Partial<TOptions>>;
|
|
14
|
+
}): Source[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Source } from '@graphql-tools/utils';
|
|
2
|
+
import { LoadTypedefsOptions } from '../load-typedefs.js';
|
|
3
|
+
export declare function loadFile(pointer: string, options: LoadTypedefsOptions): Promise<Source[]>;
|
|
4
|
+
export declare function loadFileSync(pointer: string, options: LoadTypedefsOptions): Source[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Source } from '@graphql-tools/utils';
|
|
2
|
+
declare type AddValidSource = (source: Source) => void;
|
|
3
|
+
declare type ParseOptions = {
|
|
4
|
+
partialSource: Source;
|
|
5
|
+
options: any;
|
|
6
|
+
pointerOptionMap: any;
|
|
7
|
+
addValidSource: AddValidSource;
|
|
8
|
+
};
|
|
9
|
+
export declare function parseSource({ partialSource, options, pointerOptionMap, addValidSource }: ParseOptions): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Source, BaseLoaderOptions, Loader } from '@graphql-tools/utils';
|
|
2
|
+
export declare type LoadTypedefsOptions<ExtraConfig = {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}> = BaseLoaderOptions & ExtraConfig & {
|
|
5
|
+
cache?: {
|
|
6
|
+
[key: string]: Source[];
|
|
7
|
+
};
|
|
8
|
+
loaders: Loader[];
|
|
9
|
+
filterKinds?: string[];
|
|
10
|
+
sort?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare type UnnormalizedTypeDefPointer = {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
} | string;
|
|
15
|
+
/**
|
|
16
|
+
* Asynchronously loads any GraphQL documents (i.e. executable documents like
|
|
17
|
+
* operations and fragments as well as type system definitions) from the
|
|
18
|
+
* provided pointers.
|
|
19
|
+
* loadTypedefs does not merge the typeDefs when `#import` is used ( https://github.com/ardatan/graphql-tools/issues/2980#issuecomment-1003692728 )
|
|
20
|
+
* @param pointerOrPointers Pointers to the sources to load the documents from
|
|
21
|
+
* @param options Additional options
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadTypedefs<AdditionalConfig = Record<string, unknown>>(pointerOrPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], options: LoadTypedefsOptions<Partial<AdditionalConfig>>): Promise<Source[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Synchronously loads any GraphQL documents (i.e. executable documents like
|
|
26
|
+
* operations and fragments as well as type system definitions) from the
|
|
27
|
+
* provided pointers.
|
|
28
|
+
* @param pointerOrPointers Pointers to the sources to load the documents from
|
|
29
|
+
* @param options Additional options
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadTypedefsSync<AdditionalConfig = Record<string, unknown>>(pointerOrPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], options: LoadTypedefsOptions<Partial<AdditionalConfig>>): Source[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';
|
|
2
|
+
import { GraphQLSchema, BuildSchemaOptions } from 'graphql';
|
|
3
|
+
import { MergeSchemasConfig } from '@graphql-tools/schema';
|
|
4
|
+
export declare type LoadSchemaOptions = BuildSchemaOptions & LoadTypedefsOptions & Partial<MergeSchemasConfig> & {
|
|
5
|
+
/**
|
|
6
|
+
* Adds a list of Sources in to `extensions.sources`
|
|
7
|
+
*
|
|
8
|
+
* Disabled by default.
|
|
9
|
+
*/
|
|
10
|
+
includeSources?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Asynchronously loads a schema from the provided pointers.
|
|
14
|
+
* @param schemaPointers Pointers to the sources to load the schema from
|
|
15
|
+
* @param options Additional options
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadSchema(schemaPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], options: LoadSchemaOptions): Promise<GraphQLSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* Synchronously loads a schema from the provided pointers.
|
|
20
|
+
* @param schemaPointers Pointers to the sources to load the schema from
|
|
21
|
+
* @param options Additional options
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadSchemaSync(schemaPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], options: LoadSchemaOptions): GraphQLSchema;
|
package/typings/schema.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';
|
|
2
|
-
import { GraphQLSchema, BuildSchemaOptions } from '
|
|
2
|
+
import { GraphQLSchema, BuildSchemaOptions } from 'graphql';
|
|
3
3
|
import { MergeSchemasConfig } from '@graphql-tools/schema';
|
|
4
4
|
export declare type LoadSchemaOptions = BuildSchemaOptions & LoadTypedefsOptions & Partial<MergeSchemasConfig> & {
|
|
5
5
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import pLimit from 'p-limit';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a string to 32bit integer
|
|
4
|
+
*/
|
|
5
|
+
export declare function stringToHash(str: string): number;
|
|
6
|
+
export declare type StackNext = () => void;
|
|
7
|
+
export declare type StackFn<T> = (input: T, next: StackNext) => void;
|
|
8
|
+
export declare function useStack<T>(...fns: Array<StackFn<T>>): (input: T) => void;
|
|
9
|
+
export declare function useLimit(concurrency: number): pLimit.Limit;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UnnormalizedTypeDefPointer } from './../load-typedefs.js';
|
|
2
|
+
export declare function normalizePointers(unnormalizedPointerOrPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[]): {
|
|
3
|
+
ignore: string[];
|
|
4
|
+
pointerOptionMap: Record<string, Record<string, any>>;
|
|
5
|
+
};
|