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

@graphql-inspector/commands

Package Overview
Dependencies
Maintainers
1
Versions
420
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-inspector/commands - npm Package Compare versions

Comparing version 0.0.0-canary.8127707 to 0.0.0-canary.3c127cf

70

index.cjs.js

@@ -12,40 +12,56 @@ 'use strict';

function useCommands(api) {
return api.config.commands.map((name) => loadCommand(name)(api));
return api.config.commands.map((name) =>
loadCommand(name)(
Object.assign(
{
interceptOptions(opts) {
return opts;
},
interceptPositional(_key, opt) {
return opt;
},
interceptArguments(args) {
return args;
},
},
api,
),
),
);
}
function createCommand(factory) {
return factory;
return factory;
}
function loadCommand(name) {
const mod = require(`@graphql-inspector/${name}-command`);
return mod.default || mod;
const mod = require(`@graphql-inspector/${name}-command`);
return mod.default || mod;
}
function ensureAbsolute(filepath, basepath = process.cwd()) {
return path.isAbsolute(filepath) ? filepath : path.resolve(basepath, filepath);
return path.isAbsolute(filepath) ? filepath : path.resolve(basepath, filepath);
}
function parseGlobalArgs(args) {
const headers = {};
if (args.header) {
args.header.forEach((header) => {
const [name, ...values] = header.split(':');
headers[name] = values.join('');
});
}
if (args.require) {
args.require.forEach((mod) => require(mod));
}
return { headers, token: args.token };
const headers = {};
if (args.header) {
args.header.forEach((header) => {
const [name, ...values] = header.split(':');
headers[name] = values.join('');
});
}
if (args.require) {
args.require.forEach((mod) => require(mod));
}
return {headers, token: args.token};
}
function mockCommand(mod, cmd) {
return tslib.__awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
yargs.command(mod).parse(cmd, (err, _, output) => {
if (err) {
reject(err);
}
else {
resolve(output);
}
});
});
return tslib.__awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
yargs.command(mod).parse(cmd, (err, _, output) => {
if (err) {
reject(err);
} else {
resolve(output);
}
});
});
});
}

@@ -52,0 +68,0 @@

@@ -1,23 +0,52 @@

import { InspectorConfig } from '@graphql-inspector/config';
import { Loaders } from '@graphql-inspector/loaders';
import { CommandModule } from 'yargs';
export { CommandModule as Command };
import {InspectorConfig} from '@graphql-inspector/config';
import {Loaders} from '@graphql-inspector/loaders';
import {CommandModule as Command, PositionalOptions, Options} from 'yargs';
export {Command};
export interface UseCommandsAPI {
config: InspectorConfig;
loaders: Loaders;
intercept?<T>(args: T): Promise<T>;
config: InspectorConfig;
loaders: Loaders;
/** @internal */
interceptPositional?<TKey extends string, TOptions extends PositionalOptions>(
key: TKey,
options: TOptions,
): TOptions;
/** @internal */
interceptOptions?<
T extends {
[key: string]: Options;
}
>(
options: T,
): T;
/** @internal */
interceptArguments?<
T extends {
[key: string]: any;
}
>(
args: T,
): T;
}
export declare type CommandFactory<T = {}, U = {}> = (api: UseCommandsAPI) => CommandModule<T, U>;
export declare function useCommands(api: UseCommandsAPI): CommandModule[];
export declare function createCommand<T = {}, U = {}>(factory: CommandFactory<T, U>): CommandFactory<T, U>;
export declare function ensureAbsolute(filepath: string, basepath?: string): string;
export declare type CommandFactory<T = {}, U = {}> = (
api: Required<UseCommandsAPI>,
) => Command<T, U>;
export declare function useCommands(api: UseCommandsAPI): Command[];
export declare function createCommand<T = {}, U = {}>(
factory: CommandFactory<T, U>,
): CommandFactory<T, U>;
export declare function ensureAbsolute(
filepath: string,
basepath?: string,
): string;
export interface GlobalArgs {
require?: string[];
token?: string;
header?: string[];
require?: string[];
token?: string;
header?: string[];
}
export declare function parseGlobalArgs(args: GlobalArgs): {
headers: Record<string, string>;
token: string | undefined;
export declare function parseGlobalArgs(
args: GlobalArgs,
): {
headers: Record<string, string>;
token: string | undefined;
};
export declare function mockCommand(mod: CommandModule, cmd: string): Promise<string>;
export declare function mockCommand(mod: Command, cmd: string): Promise<string>;

@@ -6,40 +6,56 @@ import { __awaiter } from 'tslib';

function useCommands(api) {
return api.config.commands.map((name) => loadCommand(name)(api));
return api.config.commands.map((name) =>
loadCommand(name)(
Object.assign(
{
interceptOptions(opts) {
return opts;
},
interceptPositional(_key, opt) {
return opt;
},
interceptArguments(args) {
return args;
},
},
api,
),
),
);
}
function createCommand(factory) {
return factory;
return factory;
}
function loadCommand(name) {
const mod = require(`@graphql-inspector/${name}-command`);
return mod.default || mod;
const mod = require(`@graphql-inspector/${name}-command`);
return mod.default || mod;
}
function ensureAbsolute(filepath, basepath = process.cwd()) {
return isAbsolute(filepath) ? filepath : resolve(basepath, filepath);
return isAbsolute(filepath) ? filepath : resolve(basepath, filepath);
}
function parseGlobalArgs(args) {
const headers = {};
if (args.header) {
args.header.forEach((header) => {
const [name, ...values] = header.split(':');
headers[name] = values.join('');
});
}
if (args.require) {
args.require.forEach((mod) => require(mod));
}
return { headers, token: args.token };
const headers = {};
if (args.header) {
args.header.forEach((header) => {
const [name, ...values] = header.split(':');
headers[name] = values.join('');
});
}
if (args.require) {
args.require.forEach((mod) => require(mod));
}
return {headers, token: args.token};
}
function mockCommand(mod, cmd) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
yargs.command(mod).parse(cmd, (err, _, output) => {
if (err) {
reject(err);
}
else {
resolve(output);
}
});
});
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
yargs.command(mod).parse(cmd, (err, _, output) => {
if (err) {
reject(err);
} else {
resolve(output);
}
});
});
});
}

@@ -46,0 +62,0 @@

{
"name": "@graphql-inspector/commands",
"version": "0.0.0-canary.8127707",
"version": "0.0.0-canary.3c127cf",
"description": "Plugin system for commands in GraphQL Inspector",
"sideEffects": false,
"peerDependencies": {
"@graphql-inspector/config": "0.0.0-canary.8127707",
"@graphql-inspector/loaders": "0.0.0-canary.8127707",
"@graphql-inspector/config": "0.0.0-canary.3c127cf",
"@graphql-inspector/loaders": "0.0.0-canary.3c127cf",
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0",

@@ -10,0 +10,0 @@ "yargs": "15.3.1"

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