Socket
Socket
Sign inDemoInstall

@graphql-tools/load

Package Overview
Dependencies
Maintainers
3
Versions
1163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/load - npm Package Compare versions

Comparing version 8.0.0 to 8.0.1-alpha-20231101094738-8c69848a

12

cjs/documents.js

@@ -25,3 +25,7 @@ "use strict";

function loadDocuments(pointerOrPointers, options) {
return (0, load_typedefs_js_1.loadTypedefs)(pointerOrPointers, { noRequire: true, filterKinds: exports.NON_OPERATION_KINDS, ...options });
return (0, load_typedefs_js_1.loadTypedefs)(pointerOrPointers, {
noRequire: true,
filterKinds: exports.NON_OPERATION_KINDS,
...options,
});
}

@@ -38,4 +42,8 @@ exports.loadDocuments = loadDocuments;

function loadDocumentsSync(pointerOrPointers, options) {
return (0, load_typedefs_js_1.loadTypedefsSync)(pointerOrPointers, { noRequire: true, filterKinds: exports.NON_OPERATION_KINDS, ...options });
return (0, load_typedefs_js_1.loadTypedefsSync)(pointerOrPointers, {
noRequire: true,
filterKinds: exports.NON_OPERATION_KINDS,
...options,
});
}
exports.loadDocumentsSync = loadDocumentsSync;

8

cjs/filter-document-kind.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterKind = void 0;
const process_1 = require("process");
const graphql_1 = require("graphql");
const process_1 = require("process");
/**

@@ -10,3 +10,7 @@ * @internal

const filterKind = (content, filterKinds) => {
if (content && content.definitions && content.definitions.length && filterKinds && filterKinds.length > 0) {
if (content &&
content.definitions &&
content.definitions.length &&
filterKinds &&
filterKinds.length > 0) {
const invalidDefinitions = [];

@@ -13,0 +17,0 @@ const validDefinitions = [];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadTypedefsSync = exports.loadTypedefs = void 0;
const process_1 = require("process");
const utils_1 = require("@graphql-tools/utils");
const pointers_js_1 = require("./utils/pointers.js");
const collect_sources_js_1 = require("./load-typedefs/collect-sources.js");
const options_js_1 = require("./load-typedefs/options.js");
const collect_sources_js_1 = require("./load-typedefs/collect-sources.js");
const parse_js_1 = require("./load-typedefs/parse.js");
const helpers_js_1 = require("./utils/helpers.js");
const process_1 = require("process");
const pointers_js_1 = require("./utils/pointers.js");
const CONCURRENCY_LIMIT = 100;

@@ -12,0 +12,0 @@ /**

@@ -27,10 +27,10 @@ "use strict";

exports.collectSourcesSync = exports.collectSources = void 0;
const module_1 = require("module");
const process_1 = require("process");
const graphql_1 = require("graphql");
const utils_1 = require("@graphql-tools/utils");
const graphql_1 = require("graphql");
const load_file_js_1 = require("./load-file.js");
const custom_loader_js_1 = require("../utils/custom-loader.js");
const helpers_js_1 = require("../utils/helpers.js");
const custom_loader_js_1 = require("../utils/custom-loader.js");
const queue_js_1 = require("../utils/queue.js");
const module_1 = require("module");
const process_1 = require("process");
const load_file_js_1 = require("./load-file.js");
const CONCURRENCY_LIMIT = 50;

@@ -111,3 +111,3 @@ async function collectSources({ pointerOptionMap, options, }) {

exports.collectSourcesSync = collectSourcesSync;
function createHelpers({ sources, stack }) {
function createHelpers({ sources, stack, }) {
const addSource = ({ source }) => {

@@ -226,3 +226,3 @@ sources.push(source);

}
function collectFallback({ queue, pointer, options, pointerOptions, addSource }) {
function collectFallback({ queue, pointer, options, pointerOptions, addSource, }) {
return queue(async () => {

@@ -246,3 +246,3 @@ if (process_1.env['DEBUG'] != null) {

}
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource }) {
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource, }) {
return queue(() => {

@@ -249,0 +249,0 @@ if (process_1.env['DEBUG'] != null) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseSource = void 0;
const process_1 = require("process");
const utils_1 = require("@graphql-tools/utils");
const process_1 = require("process");
const filter_document_kind_js_1 = require("../filter-document-kind.js");
function parseSource({ partialSource, options, pointerOptionMap, addValidSource }) {
function parseSource({ partialSource, options, pointerOptionMap, addValidSource, }) {
if (process_1.env['DEBUG'] != null) {

@@ -9,0 +9,0 @@ console.time(`@graphql-tools/load: parseSource ${partialSource.location}`);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadSchemaSync = exports.loadSchema = void 0;
const load_typedefs_js_1 = require("./load-typedefs.js");
const graphql_1 = require("graphql");
const documents_js_1 = require("./documents.js");
const schema_1 = require("@graphql-tools/schema");
const utils_1 = require("@graphql-tools/utils");
const documents_js_1 = require("./documents.js");
const load_typedefs_js_1 = require("./load-typedefs.js");
/**

@@ -52,3 +52,6 @@ * Asynchronously loads a schema from the provided pointers.

function getSchemaFromSources(sources, options) {
if (sources.length === 1 && sources[0].schema != null && options.typeDefs == null && options.resolvers == null) {
if (sources.length === 1 &&
sources[0].schema != null &&
options.typeDefs == null &&
options.resolvers == null) {
return options.sort ? (0, graphql_1.lexicographicSortSchema)(sources[0].schema) : sources[0].schema;

@@ -55,0 +58,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizePointers = void 0;
const process_1 = require("process");
const utils_1 = require("@graphql-tools/utils");
const process_1 = require("process");
function normalizePointers(unnormalizedPointerOrPointers) {

@@ -7,0 +7,0 @@ if (process_1.env['DEBUG'] != null) {

@@ -8,3 +8,5 @@ "use strict";

const queue = [];
const limit = 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 +13,0 @@ add(fn) {

import { Kind } from 'graphql';
import { loadTypedefs, loadTypedefsSync } from './load-typedefs.js';
import { loadTypedefs, loadTypedefsSync, } from './load-typedefs.js';
/**

@@ -22,3 +22,7 @@ * Kinds of AST nodes that are included in executable documents

export function loadDocuments(pointerOrPointers, options) {
return loadTypedefs(pointerOrPointers, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options });
return loadTypedefs(pointerOrPointers, {
noRequire: true,
filterKinds: NON_OPERATION_KINDS,
...options,
});
}

@@ -34,3 +38,7 @@ /**

export function loadDocumentsSync(pointerOrPointers, options) {
return loadTypedefsSync(pointerOrPointers, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options });
return loadTypedefsSync(pointerOrPointers, {
noRequire: true,
filterKinds: NON_OPERATION_KINDS,
...options,
});
}

@@ -0,3 +1,3 @@

import { env } from 'process';
import { Kind } from 'graphql';
import { env } from 'process';
/**

@@ -7,3 +7,7 @@ * @internal

export const filterKind = (content, filterKinds) => {
if (content && content.definitions && content.definitions.length && filterKinds && filterKinds.length > 0) {
if (content &&
content.definitions &&
content.definitions.length &&
filterKinds &&
filterKinds.length > 0) {
const invalidDefinitions = [];

@@ -10,0 +14,0 @@ const validDefinitions = [];

@@ -1,8 +0,8 @@

import { compareStrings, asArray } from '@graphql-tools/utils';
import { normalizePointers } from './utils/pointers.js';
import { env } from 'process';
import { asArray, compareStrings } from '@graphql-tools/utils';
import { collectSources, collectSourcesSync } from './load-typedefs/collect-sources.js';
import { applyDefaultOptions } from './load-typedefs/options.js';
import { collectSources, collectSourcesSync } from './load-typedefs/collect-sources.js';
import { parseSource } from './load-typedefs/parse.js';
import { useLimit } from './utils/helpers.js';
import { env } from 'process';
import { normalizePointers } from './utils/pointers.js';
const CONCURRENCY_LIMIT = 100;

@@ -9,0 +9,0 @@ /**

@@ -1,9 +0,9 @@

import { isDocumentString, parseGraphQLSDL, getDocumentNodeFromSchema, asArray } from '@graphql-tools/utils';
import { createRequire } from 'module';
import { cwd, env } from 'process';
import { isSchema, Kind } from 'graphql';
import { loadFile, loadFileSync } from './load-file.js';
import { asArray, getDocumentNodeFromSchema, isDocumentString, parseGraphQLSDL, } from '@graphql-tools/utils';
import { useCustomLoader, useCustomLoaderSync } from '../utils/custom-loader.js';
import { stringToHash, useStack } from '../utils/helpers.js';
import { useCustomLoader, useCustomLoaderSync } from '../utils/custom-loader.js';
import { useQueue, useSyncQueue } from '../utils/queue.js';
import { createRequire } from 'module';
import { cwd, env } from 'process';
import { loadFile, loadFileSync } from './load-file.js';
const CONCURRENCY_LIMIT = 50;

@@ -82,3 +82,3 @@ export async function collectSources({ pointerOptionMap, options, }) {

}
function createHelpers({ sources, stack }) {
function createHelpers({ sources, stack, }) {
const addSource = ({ source }) => {

@@ -197,3 +197,3 @@ sources.push(source);

}
function collectFallback({ queue, pointer, options, pointerOptions, addSource }) {
function collectFallback({ queue, pointer, options, pointerOptions, addSource, }) {
return queue(async () => {

@@ -217,3 +217,3 @@ if (env['DEBUG'] != null) {

}
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource }) {
function collectFallbackSync({ queue, pointer, options, pointerOptions, addSource, }) {
return queue(() => {

@@ -220,0 +220,0 @@ if (env['DEBUG'] != null) {

@@ -1,5 +0,5 @@

import { printSchemaWithDirectives, parseGraphQLSDL, printWithComments, resetComments, } from '@graphql-tools/utils';
import { env } from 'process';
import { parseGraphQLSDL, printSchemaWithDirectives, printWithComments, resetComments, } from '@graphql-tools/utils';
import { filterKind } from '../filter-document-kind.js';
export function parseSource({ partialSource, options, pointerOptionMap, addValidSource }) {
export function parseSource({ partialSource, options, pointerOptionMap, addValidSource, }) {
if (env['DEBUG'] != null) {

@@ -6,0 +6,0 @@ console.time(`@graphql-tools/load: parseSource ${partialSource.location}`);

@@ -1,6 +0,6 @@

import { loadTypedefs, loadTypedefsSync } from './load-typedefs.js';
import { Source as GraphQLSource, print, lexicographicSortSchema } from 'graphql';
import { Source as GraphQLSource, lexicographicSortSchema, print, } from 'graphql';
import { extractExtensionsFromSchema, mergeSchemas, } from '@graphql-tools/schema';
import { getResolversFromSchema, } from '@graphql-tools/utils';
import { OPERATION_KINDS } from './documents.js';
import { mergeSchemas, extractExtensionsFromSchema } from '@graphql-tools/schema';
import { getResolversFromSchema } from '@graphql-tools/utils';
import { loadTypedefs, loadTypedefsSync, } from './load-typedefs.js';
/**

@@ -47,3 +47,6 @@ * Asynchronously loads a schema from the provided pointers.

function getSchemaFromSources(sources, options) {
if (sources.length === 1 && sources[0].schema != null && options.typeDefs == null && options.resolvers == null) {
if (sources.length === 1 &&
sources[0].schema != null &&
options.typeDefs == null &&
options.resolvers == null) {
return options.sort ? lexicographicSortSchema(sources[0].schema) : sources[0].schema;

@@ -50,0 +53,0 @@ }

@@ -0,3 +1,3 @@

import { env } from 'process';
import { asArray } from '@graphql-tools/utils';
import { env } from 'process';
export function normalizePointers(unnormalizedPointerOrPointers) {

@@ -4,0 +4,0 @@ if (env['DEBUG'] != null) {

import pLimit from 'p-limit';
export function useQueue(options) {
const queue = [];
const limit = options?.concurrency ? pLimit(options.concurrency) : async (fn) => fn();
const limit = options?.concurrency
? pLimit(options.concurrency)
: async (fn) => fn();
return {

@@ -6,0 +8,0 @@ add(fn) {

{
"name": "@graphql-tools/load",
"version": "8.0.0",
"version": "8.0.1-alpha-20231101094738-8c69848a",
"description": "A set of utils for faster development of GraphQL tools",

@@ -10,5 +10,5 @@ "sideEffects": false,

"dependencies": {
"@graphql-tools/schema": "^10.0.0",
"@graphql-tools/utils": "^10.0.0",
"@graphql-tools/schema": "^10.0.0",
"p-limit": "3.1.0",
"p-limit": "5.0.0",
"tslib": "^2.4.0"

@@ -15,0 +15,0 @@ },

@@ -0,3 +1,3 @@

import { Kind } from 'graphql';
import { Source } from '@graphql-tools/utils';
import { Kind } from 'graphql';
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';

@@ -4,0 +4,0 @@ type KindList = Array<(typeof Kind)[keyof typeof Kind]>;

@@ -1,2 +0,2 @@

import { Source, BaseLoaderOptions, Loader } from '@graphql-tools/utils';
import { BaseLoaderOptions, Loader, Source } from '@graphql-tools/utils';
export type LoadTypedefsOptions<ExtraConfig = {

@@ -3,0 +3,0 @@ [key: string]: any;

@@ -9,3 +9,3 @@ import { Source } from '@graphql-tools/utils';

};
export declare function parseSource({ partialSource, options, pointerOptionMap, addValidSource }: ParseOptions): void;
export declare function parseSource({ partialSource, options, pointerOptionMap, addValidSource, }: ParseOptions): void;
export {};

@@ -0,4 +1,4 @@

import { BuildSchemaOptions, GraphQLSchema } from 'graphql';
import { IExecutableSchemaDefinition } from '@graphql-tools/schema';
import { LoadTypedefsOptions, UnnormalizedTypeDefPointer } from './load-typedefs.js';
import { GraphQLSchema, BuildSchemaOptions } from 'graphql';
import { IExecutableSchemaDefinition } from '@graphql-tools/schema';
export type LoadSchemaOptions = BuildSchemaOptions & LoadTypedefsOptions & Partial<IExecutableSchemaDefinition> & {

@@ -5,0 +5,0 @@ /**

@@ -1,2 +0,1 @@

import pLimit from 'p-limit';
/**

@@ -9,2 +8,2 @@ * Converts a string to 32bit integer

export declare function useStack<T>(...fns: Array<StackFn<T>>): (input: T) => void;
export declare function useLimit(concurrency: number): pLimit.Limit;
export declare function useLimit(concurrency: number): import("p-limit").LimitFunction;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc