@graphql-tools/load
Advanced tools
Comparing version 8.0.0-rc-20230519104353-b09f3180 to 8.0.0-rc-20230519104627-f6fea064
@@ -6,7 +6,6 @@ "use strict"; | ||
async function loadFile(pointer, options) { | ||
var _a; | ||
if (process_1.env['DEBUG'] != null) { | ||
console.time(`@graphql-tools/load: loadFile ${pointer}`); | ||
} | ||
let results = (_a = options.cache) === null || _a === void 0 ? void 0 : _a[pointer]; | ||
let results = options.cache?.[pointer]; | ||
if (!results) { | ||
@@ -18,3 +17,3 @@ results = []; | ||
const loaderResults = await loader.load(pointer, options); | ||
loaderResults === null || loaderResults === void 0 ? void 0 : loaderResults.forEach(result => results.push(result)); | ||
loaderResults?.forEach(result => results.push(result)); | ||
} | ||
@@ -54,7 +53,6 @@ catch (error) { | ||
function loadFileSync(pointer, options) { | ||
var _a; | ||
if (process_1.env['DEBUG'] != null) { | ||
console.time(`@graphql-tools/load: loadFileSync ${pointer}`); | ||
} | ||
let results = (_a = options.cache) === null || _a === void 0 ? void 0 : _a[pointer]; | ||
let results = options.cache?.[pointer]; | ||
if (!results) { | ||
@@ -67,3 +65,3 @@ results = []; | ||
const loaderResults = loader.loadSync(pointer, options); | ||
loaderResults === null || loaderResults === void 0 ? void 0 : loaderResults.forEach(result => results.push(result)); | ||
loaderResults?.forEach(result => results.push(result)); | ||
} | ||
@@ -70,0 +68,0 @@ catch (error) { |
@@ -86,7 +86,6 @@ "use strict"; | ||
function collectValidSources(input, addValidSource) { | ||
var _a; | ||
if (process_1.env['DEBUG'] != null) { | ||
console.time(`@graphql-tools/load: collectValidSources ${input.source.location}`); | ||
} | ||
if (((_a = input.source.document) === null || _a === void 0 ? void 0 : _a.definitions) && input.source.document.definitions.length > 0) { | ||
if (input.source.document?.definitions && input.source.document.definitions.length > 0) { | ||
addValidSource(input.source); | ||
@@ -93,0 +92,0 @@ } |
@@ -62,3 +62,3 @@ "use strict"; | ||
}); | ||
if (options === null || options === void 0 ? void 0 : options.includeSources) { | ||
if (options?.includeSources) { | ||
includeSources(schema, sources); | ||
@@ -65,0 +65,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
const queue = []; | ||
const limit = (options === null || options === void 0 ? void 0 : options.concurrency) ? (0, p_limit_1.default)(options.concurrency) : async (fn) => fn(); | ||
const limit = options?.concurrency ? (0, p_limit_1.default)(options.concurrency) : async (fn) => fn(); | ||
return { | ||
@@ -11,0 +11,0 @@ add(fn) { |
import { env } from 'process'; | ||
export async function loadFile(pointer, options) { | ||
var _a; | ||
if (env['DEBUG'] != null) { | ||
console.time(`@graphql-tools/load: loadFile ${pointer}`); | ||
} | ||
let results = (_a = options.cache) === null || _a === void 0 ? void 0 : _a[pointer]; | ||
let results = options.cache?.[pointer]; | ||
if (!results) { | ||
@@ -14,3 +13,3 @@ results = []; | ||
const loaderResults = await loader.load(pointer, options); | ||
loaderResults === null || loaderResults === void 0 ? void 0 : loaderResults.forEach(result => results.push(result)); | ||
loaderResults?.forEach(result => results.push(result)); | ||
} | ||
@@ -49,7 +48,6 @@ catch (error) { | ||
export function loadFileSync(pointer, options) { | ||
var _a; | ||
if (env['DEBUG'] != null) { | ||
console.time(`@graphql-tools/load: loadFileSync ${pointer}`); | ||
} | ||
let results = (_a = options.cache) === null || _a === void 0 ? void 0 : _a[pointer]; | ||
let results = options.cache?.[pointer]; | ||
if (!results) { | ||
@@ -62,3 +60,3 @@ results = []; | ||
const loaderResults = loader.loadSync(pointer, options); | ||
loaderResults === null || loaderResults === void 0 ? void 0 : loaderResults.forEach(result => results.push(result)); | ||
loaderResults?.forEach(result => results.push(result)); | ||
} | ||
@@ -65,0 +63,0 @@ catch (error) { |
@@ -82,7 +82,6 @@ import { printSchemaWithDirectives, parseGraphQLSDL, printWithComments, resetComments, } from '@graphql-tools/utils'; | ||
function collectValidSources(input, addValidSource) { | ||
var _a; | ||
if (env['DEBUG'] != null) { | ||
console.time(`@graphql-tools/load: collectValidSources ${input.source.location}`); | ||
} | ||
if (((_a = input.source.document) === null || _a === void 0 ? void 0 : _a.definitions) && input.source.document.definitions.length > 0) { | ||
if (input.source.document?.definitions && input.source.document.definitions.length > 0) { | ||
addValidSource(input.source); | ||
@@ -89,0 +88,0 @@ } |
@@ -57,3 +57,3 @@ import { loadTypedefs, loadTypedefsSync } from './load-typedefs.js'; | ||
}); | ||
if (options === null || options === void 0 ? void 0 : options.includeSources) { | ||
if (options?.includeSources) { | ||
includeSources(schema, sources); | ||
@@ -60,0 +60,0 @@ } |
import pLimit from 'p-limit'; | ||
export function useQueue(options) { | ||
const queue = []; | ||
const limit = (options === null || options === void 0 ? void 0 : options.concurrency) ? pLimit(options.concurrency) : async (fn) => fn(); | ||
const limit = options?.concurrency ? pLimit(options.concurrency) : async (fn) => fn(); | ||
return { | ||
@@ -6,0 +6,0 @@ add(fn) { |
{ | ||
"name": "@graphql-tools/load", | ||
"version": "8.0.0-rc-20230519104353-b09f3180", | ||
"version": "8.0.0-rc-20230519104627-f6fea064", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -10,4 +10,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@graphql-tools/utils": "10.0.0-rc-20230519104353-b09f3180", | ||
"@graphql-tools/schema": "10.0.0-rc-20230519104353-b09f3180", | ||
"@graphql-tools/utils": "10.0.0-rc-20230519104627-f6fea064", | ||
"@graphql-tools/schema": "10.0.0-rc-20230519104627-f6fea064", | ||
"p-limit": "3.1.0", | ||
@@ -14,0 +14,0 @@ "tslib": "^2.4.0" |
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
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
79494
1875
+ Added@graphql-tools/merge@9.0.0-rc-20230519104627-f6fea064(transitive)
+ Added@graphql-tools/schema@10.0.0-rc-20230519104627-f6fea064(transitive)
+ Added@graphql-tools/utils@10.0.0-rc-20230519104627-f6fea064(transitive)
+ Added@graphql-typed-document-node/core@3.2.0(transitive)
+ Addedvalue-or-promise@1.0.12(transitive)
Updated@graphql-tools/schema@10.0.0-rc-20230519104627-f6fea064
Updated@graphql-tools/utils@10.0.0-rc-20230519104627-f6fea064