@graphql-toolkit/core
Advanced tools
Comparing version 0.10.3 to 0.10.4-alpha-06022e7.8
@@ -0,0 +0,0 @@ import { Source } from '@graphql-toolkit/common'; |
import { DocumentNode } from 'graphql'; | ||
export declare const filterKind: (content: DocumentNode, filterKinds: string[]) => DocumentNode; |
@@ -0,0 +0,0 @@ import { DefinitionNode } from 'graphql'; |
@@ -0,0 +0,0 @@ import { DefinitionNode, DocumentNode } from 'graphql'; |
130
index.cjs.js
@@ -8,18 +8,18 @@ 'use strict'; | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) { return e; } else { | ||
var n = {}; | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
}); | ||
}); | ||
if (e && e.__esModule) { return e; } else { | ||
var n = {}; | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
}); | ||
}); | ||
} | ||
n['default'] = e; | ||
return n; | ||
} | ||
n['default'] = e; | ||
return n; | ||
} | ||
} | ||
@@ -30,3 +30,2 @@ | ||
const isGlob = _interopDefault(require('is-glob')); | ||
const tslib = require('tslib'); | ||
const pLimit = _interopDefault(require('p-limit')); | ||
@@ -73,3 +72,2 @@ const schemaMerging = require('@graphql-toolkit/schema-merging'); | ||
async function loadFile(pointer, options) { | ||
var e_1, _a; | ||
const cached = useCache({ pointer, options }); | ||
@@ -79,23 +77,13 @@ if (cached) { | ||
} | ||
try { | ||
for (var _b = tslib.__asyncValues(options.loaders), _c; _c = await _b.next(), !_c.done;) { | ||
const loader = _c.value; | ||
try { | ||
const canLoad = await loader.canLoad(pointer, options); | ||
if (canLoad) { | ||
return await loader.load(pointer, options); | ||
} | ||
for await (const loader of options.loaders) { | ||
try { | ||
const canLoad = await loader.canLoad(pointer, options); | ||
if (canLoad) { | ||
return await loader.load(pointer, options); | ||
} | ||
catch (error) { | ||
common.debugLog(`Failed to find any GraphQL type definitions in: ${pointer} - ${error.message}`); | ||
throw error; | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) await _a.call(_b); | ||
catch (error) { | ||
common.debugLog(`Failed to find any GraphQL type definitions in: ${pointer} - ${error.message}`); | ||
throw error; | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
@@ -265,3 +253,6 @@ return undefined; | ||
for (const pointer in pointerOptionMap) { | ||
const pointerOptions = Object.assign(Object.assign({}, ((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {})), { unixify }); | ||
const pointerOptions = { | ||
...((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {}), | ||
unixify, | ||
}; | ||
collect({ | ||
@@ -313,3 +304,6 @@ pointer, | ||
for (const pointer in pointerOptionMap) { | ||
const pointerOptions = Object.assign(Object.assign({}, ((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {})), { unixify }); | ||
const pointerOptions = { | ||
...((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {}), | ||
unixify, | ||
}; | ||
collect({ | ||
@@ -375,3 +369,3 @@ pointer, | ||
function createGlobbyOptions(options) { | ||
return Object.assign(Object.assign({ absolute: true }, options), { ignore: [] }); | ||
return { absolute: true, ...options, ignore: [] }; | ||
} | ||
@@ -435,3 +429,6 @@ function collectSourcesFromGlobals({ filepaths, options, globOptions, pointerOptionMap, addSource, queue, }) { | ||
addSource({ | ||
source: Object.assign({ location: pointer }, result), | ||
source: { | ||
location: pointer, | ||
...result, | ||
}, | ||
pointer, | ||
@@ -444,3 +441,6 @@ }); | ||
return queue(() => { | ||
const source = common.parseGraphQLSDL(`${stringToHash(pointer)}.graphql`, pointer, Object.assign(Object.assign({}, options), pointerOptions)); | ||
const source = common.parseGraphQLSDL(`${stringToHash(pointer)}.graphql`, pointer, { | ||
...options, | ||
...pointerOptions, | ||
}); | ||
addSource({ | ||
@@ -467,3 +467,3 @@ source, | ||
const loader = await useCustomLoader(pointerOptions.loader, options.cwd); | ||
const result = await loader(pointer, Object.assign(Object.assign({}, options), pointerOptions), pointerOptionMap); | ||
const result = await loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap); | ||
if (!result) { | ||
@@ -481,3 +481,3 @@ return; | ||
const loader = useCustomLoaderSync(pointerOptions.loader, options.cwd); | ||
const result = loader(pointer, Object.assign(Object.assign({}, options), pointerOptions), pointerOptionMap); | ||
const result = loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap); | ||
if (result) { | ||
@@ -492,3 +492,6 @@ addResultOfCustomLoader({ pointer, result, addSource }); | ||
return queue(async () => { | ||
const source = await loadFile(pointer, Object.assign(Object.assign({}, options), pointerOptions)); | ||
const source = await loadFile(pointer, { | ||
...options, | ||
...pointerOptions, | ||
}); | ||
if (source) { | ||
@@ -501,3 +504,6 @@ addSource({ source, pointer }); | ||
return queue(() => { | ||
const source = loadFileSync(pointer, Object.assign(Object.assign({}, options), pointerOptions)); | ||
const source = loadFileSync(pointer, { | ||
...options, | ||
...pointerOptions, | ||
}); | ||
if (source) { | ||
@@ -1034,4 +1040,7 @@ addSource({ source, pointer }); | ||
function prepareInput({ source, options, globOptions, pointerOptionMap, }) { | ||
const specificOptions = Object.assign(Object.assign({}, options), (source.location in pointerOptionMap ? globOptions : pointerOptionMap[source.location])); | ||
return { source: Object.assign({}, source), options: specificOptions }; | ||
const specificOptions = { | ||
...options, | ||
...(source.location in pointerOptionMap ? globOptions : pointerOptionMap[source.location]), | ||
}; | ||
return { source: { ...source }, options: specificOptions }; | ||
} | ||
@@ -1159,10 +1168,13 @@ function parseSchema(input) { | ||
function loadDocuments(documentDef, options) { | ||
return loadTypedefs(documentDef, Object.assign({ noRequire: true, filterKinds: NON_OPERATION_KINDS }, options)); | ||
return loadTypedefs(documentDef, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options }); | ||
} | ||
function loadDocumentsSync(documentDef, options) { | ||
return loadTypedefsSync(documentDef, Object.assign({ noRequire: true, filterKinds: NON_OPERATION_KINDS }, options)); | ||
return loadTypedefsSync(documentDef, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options }); | ||
} | ||
async function loadSchema(schemaPointers, options) { | ||
const sources = await loadTypedefs(schemaPointers, Object.assign({ filterKinds: OPERATION_KINDS }, options)); | ||
const sources = await loadTypedefs(schemaPointers, { | ||
filterKinds: OPERATION_KINDS, | ||
...options, | ||
}); | ||
const schemas = []; | ||
@@ -1178,8 +1190,14 @@ const typeDefs = []; | ||
}); | ||
const mergeSchemasOptions = Object.assign({ schemas, | ||
typeDefs }, options); | ||
const mergeSchemasOptions = { | ||
schemas, | ||
typeDefs, | ||
...options, | ||
}; | ||
return schemaMerging.mergeSchemasAsync(mergeSchemasOptions); | ||
} | ||
function loadSchemaSync(schemaPointers, options) { | ||
const sources = loadTypedefsSync(schemaPointers, Object.assign({ filterKinds: OPERATION_KINDS }, options)); | ||
const sources = loadTypedefsSync(schemaPointers, { | ||
filterKinds: OPERATION_KINDS, | ||
...options, | ||
}); | ||
const schemas = []; | ||
@@ -1195,4 +1213,7 @@ const typeDefs = []; | ||
}); | ||
const mergeSchemasOptions = Object.assign({ schemas, | ||
typeDefs }, options); | ||
const mergeSchemasOptions = { | ||
schemas, | ||
typeDefs, | ||
...options, | ||
}; | ||
return schemaMerging.mergeSchemas(mergeSchemasOptions); | ||
@@ -1219,1 +1240,2 @@ } | ||
exports.resolveModuleFilePath = resolveModuleFilePath; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -0,0 +0,0 @@ export * from './load-typedefs'; |
100
index.esm.js
import { asArray, resolveBuiltinModule, resolveBuiltinModuleSync, debugLog, printSchemaWithDirectives, isDocumentString, parseGraphQLSDL, compareNodes, fixSchemaAst, compareStrings } from '@graphql-toolkit/common'; | ||
import { isSchema, parse, Kind, Source } from 'graphql'; | ||
import isGlob from 'is-glob'; | ||
import { __asyncValues } from 'tslib'; | ||
import pLimit from 'p-limit'; | ||
@@ -46,3 +45,2 @@ import { printWithComments, resetComments, mergeSchemasAsync, mergeSchemas } from '@graphql-toolkit/schema-merging'; | ||
async function loadFile(pointer, options) { | ||
var e_1, _a; | ||
const cached = useCache({ pointer, options }); | ||
@@ -52,23 +50,13 @@ if (cached) { | ||
} | ||
try { | ||
for (var _b = __asyncValues(options.loaders), _c; _c = await _b.next(), !_c.done;) { | ||
const loader = _c.value; | ||
try { | ||
const canLoad = await loader.canLoad(pointer, options); | ||
if (canLoad) { | ||
return await loader.load(pointer, options); | ||
} | ||
for await (const loader of options.loaders) { | ||
try { | ||
const canLoad = await loader.canLoad(pointer, options); | ||
if (canLoad) { | ||
return await loader.load(pointer, options); | ||
} | ||
catch (error) { | ||
debugLog(`Failed to find any GraphQL type definitions in: ${pointer} - ${error.message}`); | ||
throw error; | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) await _a.call(_b); | ||
catch (error) { | ||
debugLog(`Failed to find any GraphQL type definitions in: ${pointer} - ${error.message}`); | ||
throw error; | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
@@ -238,3 +226,6 @@ return undefined; | ||
for (const pointer in pointerOptionMap) { | ||
const pointerOptions = Object.assign(Object.assign({}, ((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {})), { unixify }); | ||
const pointerOptions = { | ||
...((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {}), | ||
unixify, | ||
}; | ||
collect({ | ||
@@ -286,3 +277,6 @@ pointer, | ||
for (const pointer in pointerOptionMap) { | ||
const pointerOptions = Object.assign(Object.assign({}, ((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {})), { unixify }); | ||
const pointerOptions = { | ||
...((_a = pointerOptionMap[pointer]) !== null && _a !== void 0 ? _a : {}), | ||
unixify, | ||
}; | ||
collect({ | ||
@@ -348,3 +342,3 @@ pointer, | ||
function createGlobbyOptions(options) { | ||
return Object.assign(Object.assign({ absolute: true }, options), { ignore: [] }); | ||
return { absolute: true, ...options, ignore: [] }; | ||
} | ||
@@ -408,3 +402,6 @@ function collectSourcesFromGlobals({ filepaths, options, globOptions, pointerOptionMap, addSource, queue, }) { | ||
addSource({ | ||
source: Object.assign({ location: pointer }, result), | ||
source: { | ||
location: pointer, | ||
...result, | ||
}, | ||
pointer, | ||
@@ -417,3 +414,6 @@ }); | ||
return queue(() => { | ||
const source = parseGraphQLSDL(`${stringToHash(pointer)}.graphql`, pointer, Object.assign(Object.assign({}, options), pointerOptions)); | ||
const source = parseGraphQLSDL(`${stringToHash(pointer)}.graphql`, pointer, { | ||
...options, | ||
...pointerOptions, | ||
}); | ||
addSource({ | ||
@@ -440,3 +440,3 @@ source, | ||
const loader = await useCustomLoader(pointerOptions.loader, options.cwd); | ||
const result = await loader(pointer, Object.assign(Object.assign({}, options), pointerOptions), pointerOptionMap); | ||
const result = await loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap); | ||
if (!result) { | ||
@@ -454,3 +454,3 @@ return; | ||
const loader = useCustomLoaderSync(pointerOptions.loader, options.cwd); | ||
const result = loader(pointer, Object.assign(Object.assign({}, options), pointerOptions), pointerOptionMap); | ||
const result = loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap); | ||
if (result) { | ||
@@ -465,3 +465,6 @@ addResultOfCustomLoader({ pointer, result, addSource }); | ||
return queue(async () => { | ||
const source = await loadFile(pointer, Object.assign(Object.assign({}, options), pointerOptions)); | ||
const source = await loadFile(pointer, { | ||
...options, | ||
...pointerOptions, | ||
}); | ||
if (source) { | ||
@@ -474,3 +477,6 @@ addSource({ source, pointer }); | ||
return queue(() => { | ||
const source = loadFileSync(pointer, Object.assign(Object.assign({}, options), pointerOptions)); | ||
const source = loadFileSync(pointer, { | ||
...options, | ||
...pointerOptions, | ||
}); | ||
if (source) { | ||
@@ -1007,4 +1013,7 @@ addSource({ source, pointer }); | ||
function prepareInput({ source, options, globOptions, pointerOptionMap, }) { | ||
const specificOptions = Object.assign(Object.assign({}, options), (source.location in pointerOptionMap ? globOptions : pointerOptionMap[source.location])); | ||
return { source: Object.assign({}, source), options: specificOptions }; | ||
const specificOptions = { | ||
...options, | ||
...(source.location in pointerOptionMap ? globOptions : pointerOptionMap[source.location]), | ||
}; | ||
return { source: { ...source }, options: specificOptions }; | ||
} | ||
@@ -1132,10 +1141,13 @@ function parseSchema(input) { | ||
function loadDocuments(documentDef, options) { | ||
return loadTypedefs(documentDef, Object.assign({ noRequire: true, filterKinds: NON_OPERATION_KINDS }, options)); | ||
return loadTypedefs(documentDef, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options }); | ||
} | ||
function loadDocumentsSync(documentDef, options) { | ||
return loadTypedefsSync(documentDef, Object.assign({ noRequire: true, filterKinds: NON_OPERATION_KINDS }, options)); | ||
return loadTypedefsSync(documentDef, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options }); | ||
} | ||
async function loadSchema(schemaPointers, options) { | ||
const sources = await loadTypedefs(schemaPointers, Object.assign({ filterKinds: OPERATION_KINDS }, options)); | ||
const sources = await loadTypedefs(schemaPointers, { | ||
filterKinds: OPERATION_KINDS, | ||
...options, | ||
}); | ||
const schemas = []; | ||
@@ -1151,8 +1163,14 @@ const typeDefs = []; | ||
}); | ||
const mergeSchemasOptions = Object.assign({ schemas, | ||
typeDefs }, options); | ||
const mergeSchemasOptions = { | ||
schemas, | ||
typeDefs, | ||
...options, | ||
}; | ||
return mergeSchemasAsync(mergeSchemasOptions); | ||
} | ||
function loadSchemaSync(schemaPointers, options) { | ||
const sources = loadTypedefsSync(schemaPointers, Object.assign({ filterKinds: OPERATION_KINDS }, options)); | ||
const sources = loadTypedefsSync(schemaPointers, { | ||
filterKinds: OPERATION_KINDS, | ||
...options, | ||
}); | ||
const schemas = []; | ||
@@ -1168,4 +1186,7 @@ const typeDefs = []; | ||
}); | ||
const mergeSchemasOptions = Object.assign({ schemas, | ||
typeDefs }, options); | ||
const mergeSchemasOptions = { | ||
schemas, | ||
typeDefs, | ||
...options, | ||
}; | ||
return mergeSchemas(mergeSchemasOptions); | ||
@@ -1175,1 +1196,2 @@ } | ||
export { NON_OPERATION_KINDS, OPERATION_KINDS, collectDefinitions, collectDefinitionsSync, filterKind, getDocumentFromSDL, isEmptySDL, loadDocuments, loadDocumentsSync, loadSchema, loadSchemaSync, loadTypedefs, loadTypedefsSync, parseImportLine, parseSDL, processImportSyntax, processImportSyntaxSync, resolveModuleFilePath }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -0,0 +0,0 @@ import { Source, SingleFileOptions, Loader } from '@graphql-toolkit/common'; |
@@ -0,0 +0,0 @@ import { Source } from '@graphql-toolkit/common'; |
@@ -0,0 +0,0 @@ import { Source } from '@graphql-toolkit/common'; |
import { LoadTypedefsOptions } from './../load-typedefs'; | ||
export declare function prepareOptions<T>(options: LoadTypedefsOptions<Partial<T>>): Promise<LoadTypedefsOptions<Partial<T>>>; | ||
export declare function prepareOptionsSync<T>(options: LoadTypedefsOptions<Partial<T>>): Promise<LoadTypedefsOptions<Partial<T>>>; |
@@ -0,0 +0,0 @@ import { Source } from '@graphql-toolkit/common'; |
{ | ||
"name": "@graphql-toolkit/core", | ||
"version": "0.10.3", | ||
"version": "0.10.4-alpha-06022e7.8+06022e7", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -8,14 +8,5 @@ "peerDependencies": { | ||
}, | ||
"repository": "git@github.com:ardatan/graphql-toolkit.git", | ||
"author": "Dotan Simha <dotansimha@gmail.com>", | ||
"license": "MIT", | ||
"main": "index.cjs.js", | ||
"module": "index.esm.js", | ||
"typings": "index.d.ts", | ||
"typescript": { | ||
"definition": "index.d.ts" | ||
}, | ||
"dependencies": { | ||
"@graphql-toolkit/common": "0.10.3", | ||
"@graphql-toolkit/schema-merging": "0.10.3", | ||
"@graphql-toolkit/common": "0.10.4-alpha-06022e7.8+06022e7", | ||
"@graphql-toolkit/schema-merging": "0.10.4-alpha-06022e7.8+06022e7", | ||
"aggregate-error": "3.0.1", | ||
@@ -32,3 +23,12 @@ "globby": "11.0.0", | ||
}, | ||
"repository": "git@github.com:ardatan/graphql-toolkit.git", | ||
"author": "Dotan Simha <dotansimha@gmail.com>", | ||
"license": "MIT", | ||
"main": "index.cjs.js", | ||
"module": "index.esm.js", | ||
"typings": "index.d.ts", | ||
"typescript": { | ||
"definition": "index.d.ts" | ||
}, | ||
"sideEffects": false | ||
} |
@@ -0,0 +0,0 @@ import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs'; |
@@ -0,0 +0,0 @@ export declare function getCustomLoaderByPath(path: string, cwd: string): Promise<any>; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import { UnnormalizedTypeDefPointer } from './../load-typedefs'; |
@@ -0,0 +0,0 @@ export declare function useQueue<T>(options?: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
273503
21
2580
1
- Removed@graphql-toolkit/common@0.10.3(transitive)
- Removed@graphql-toolkit/schema-merging@0.10.3(transitive)
- Removed@wry/equality@0.1.11(transitive)
- Removedapollo-link@1.2.14(transitive)
- Removedapollo-link-http-common@0.2.16(transitive)
- Removedapollo-utilities@1.3.4(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedcamel-case@4.1.1(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddeepmerge@4.2.2(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddeprecated-decorator@0.1.6(transitive)
- Removedextract-files@7.0.0(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedform-data@3.0.1(transitive)
- Removedgraphql-tools-fork@9.0.1(transitive)
- Removediterall@1.3.0(transitive)
- Removedlower-case@2.0.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedno-case@3.0.4(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedpascal-case@3.1.2(transitive)
- Removedtr46@0.0.3(transitive)
- Removedts-invariant@0.4.4(transitive)
- Removedtslib@2.7.0(transitive)
- Removeduuid@7.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedzen-observable@0.8.15(transitive)
- Removedzen-observable-ts@0.8.21(transitive)
Updated@graphql-toolkit/common@0.10.4-alpha-06022e7.8+06022e7
Updated@graphql-toolkit/schema-merging@0.10.4-alpha-06022e7.8+06022e7