Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-inspector/config

Package Overview
Dependencies
Maintainers
1
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-inspector/config - npm Package Compare versions

Comparing version 0.0.0-canary.57e2caa to 0.0.0-canary.6f0f272

93

index.cjs.js

@@ -6,14 +6,14 @@ 'use strict';

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Copyright (c) Microsoft Corporation.
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

@@ -33,49 +33,52 @@

const availableCommands = [
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
];
const availableLoaders = [
'code',
'git',
'github',
'graphql',
'json',
'url',
'code',
'git',
'github',
'graphql',
'json',
'url',
];
function useConfig() {
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
}
function moduleExists(name) {
try {
require.resolve(name);
return true;
}
catch (error) {
return false;
}
try {
require.resolve(name);
return true;
} catch (error) {
return false;
}
}
function discoverLoaders(loaders) {
return loaders.filter((name) => moduleExists(`@graphql-inspector/${name}-loader`));
return loaders.filter((name) =>
moduleExists(`@graphql-inspector/${name}-loader`),
);
}
function discoverCommands(commands) {
return commands.filter((name) => moduleExists(`@graphql-inspector/${name}-command`));
return commands.filter((name) =>
moduleExists(`@graphql-inspector/${name}-command`),
);
}
function ensureList(list, path) {
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
}

@@ -82,0 +85,0 @@

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

export interface GraphQLConfig {
schema?: string;
documents?: string;
}
export interface InspectorConfig {
loaders: string[];
commands: string[];
loaders: string[];
commands: string[];
}

@@ -9,0 +5,0 @@ export declare const availableCommands: string[];

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Copyright (c) Microsoft Corporation.
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

@@ -28,49 +28,52 @@

const availableCommands = [
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
];
const availableLoaders = [
'code',
'git',
'github',
'graphql',
'json',
'url',
'code',
'git',
'github',
'graphql',
'json',
'url',
];
function useConfig() {
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
}
function moduleExists(name) {
try {
require.resolve(name);
return true;
}
catch (error) {
return false;
}
try {
require.resolve(name);
return true;
} catch (error) {
return false;
}
}
function discoverLoaders(loaders) {
return loaders.filter((name) => moduleExists(`@graphql-inspector/${name}-loader`));
return loaders.filter((name) =>
moduleExists(`@graphql-inspector/${name}-loader`),
);
}
function discoverCommands(commands) {
return commands.filter((name) => moduleExists(`@graphql-inspector/${name}-command`));
return commands.filter((name) =>
moduleExists(`@graphql-inspector/${name}-command`),
);
}
function ensureList(list, path) {
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
}

@@ -77,0 +80,0 @@

{
"name": "@graphql-inspector/config",
"version": "0.0.0-canary.57e2caa",
"version": "0.0.0-canary.6f0f272",
"sideEffects": false,
"peerDependencies": {

@@ -5,0 +6,0 @@ "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0"

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