@graphql-tools/json-file-loader 7.4.2-alpha-e7752ba5.0 → 7.4.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/package.json +7 -5
- package/typings/index.d.cts +39 -0
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/json-file-loader",
|
|
3
|
-
"version": "7.4.2-alpha-
|
|
3
|
+
"version": "7.4.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/graphql": "0.1.0-alpha-e7752ba5.0",
|
|
10
|
+
"@graphql-tools/utils": "8.9.1-alpha-420b7771.0",
|
|
9
11
|
"globby": "^11.0.3",
|
|
10
12
|
"unixify": "^1.0.0",
|
|
11
13
|
"tslib": "^2.4.0"
|
|
@@ -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,39 @@
|
|
|
1
|
+
import { Source, Loader, BaseLoaderOptions } from '@graphql-tools/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Additional options for loading from a JSON file
|
|
4
|
+
*/
|
|
5
|
+
export interface JsonFileLoaderOptions extends BaseLoaderOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* This loader loads documents and type definitions from JSON files.
|
|
9
|
+
*
|
|
10
|
+
* The JSON file can be the result of an introspection query made against a schema:
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* const schema = await loadSchema('schema-introspection.json', {
|
|
14
|
+
* loaders: [
|
|
15
|
+
* new JsonFileLoader()
|
|
16
|
+
* ]
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Or it can be a `DocumentNode` object representing a GraphQL document or type definitions:
|
|
21
|
+
*
|
|
22
|
+
* ```js
|
|
23
|
+
* const documents = await loadDocuments('queries/*.json', {
|
|
24
|
+
* loaders: [
|
|
25
|
+
* new GraphQLFileLoader()
|
|
26
|
+
* ]
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class JsonFileLoader implements Loader {
|
|
31
|
+
canLoad(pointer: string, options: JsonFileLoaderOptions): Promise<boolean>;
|
|
32
|
+
canLoadSync(pointer: string, options: JsonFileLoaderOptions): boolean;
|
|
33
|
+
private _buildGlobs;
|
|
34
|
+
resolveGlobs(glob: string, options: JsonFileLoaderOptions): Promise<string[]>;
|
|
35
|
+
resolveGlobsSync(glob: string, options: JsonFileLoaderOptions): string[];
|
|
36
|
+
load(pointer: string, options: JsonFileLoaderOptions): Promise<Source[]>;
|
|
37
|
+
loadSync(pointer: string, options: JsonFileLoaderOptions): Source[];
|
|
38
|
+
handleFileContent(normalizedFilePath: string, rawSDL: string, options: JsonFileLoaderOptions): Source;
|
|
39
|
+
}
|