@graphql-inspector/commands
Advanced tools
Comparing version 0.0.0-canary.36985fe to 0.0.0-canary.36b26d2
@@ -29,2 +29,6 @@ import { InspectorConfig } from '@graphql-inspector/config'; | ||
}; | ||
export declare function mockCommand(mod: Command, cmd: string): Promise<string>; | ||
export declare function mockCommand(mod: Command, cmd: string): Promise<{ | ||
[x: string]: unknown; | ||
_: (string | number)[]; | ||
$0: string; | ||
}>; |
24
index.js
@@ -12,3 +12,3 @@ 'use strict'; | ||
function useCommands(api) { | ||
return api.config.commands.map((name) => loadCommand(name)(api)); | ||
return api.config.commands.map(name => loadCommand(name)(api)); | ||
} | ||
@@ -30,3 +30,3 @@ function createCommand(factory) { | ||
if (args.header) { | ||
args.header.forEach((header) => { | ||
args.header.forEach(header => { | ||
const [name, ...values] = header.split(':'); | ||
@@ -37,3 +37,3 @@ headers[name] = values.join(''); | ||
if (args.leftHeader) { | ||
args.leftHeader.forEach((leftHeader) => { | ||
args.leftHeader.forEach(leftHeader => { | ||
const [lname, ...lvalues] = leftHeader.split(':'); | ||
@@ -44,3 +44,3 @@ leftHeaders[lname] = lvalues.join(''); | ||
if (args.rightHeader) { | ||
args.rightHeader.forEach((rightHeader) => { | ||
args.rightHeader.forEach(rightHeader => { | ||
const [rname, ...rvalues] = rightHeader.split(':'); | ||
@@ -51,3 +51,3 @@ rightHeaders[rname] = rvalues.join(''); | ||
if (args.require) { | ||
args.require.forEach((mod) => require(mod)); | ||
args.require.forEach(mod => require(mod)); | ||
} | ||
@@ -58,15 +58,3 @@ return { headers, leftHeaders, rightHeaders, token: args.token }; | ||
return tslib.__awaiter(this, void 0, void 0, function* () { | ||
return new Promise((resolve, reject) => { | ||
yargs | ||
.exitProcess(false) | ||
.command(mod) | ||
.parse(cmd, (err, _, output) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(output); | ||
} | ||
}); | ||
}); | ||
return yargs.command(mod).parseAsync(cmd); | ||
}); | ||
@@ -73,0 +61,0 @@ } |
{ | ||
"name": "@graphql-inspector/commands", | ||
"version": "0.0.0-canary.36985fe", | ||
"version": "0.0.0-canary.36b26d2", | ||
"description": "Plugin system for commands in GraphQL Inspector", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"@graphql-inspector/config": "0.0.0-canary.36985fe", | ||
"@graphql-inspector/loaders": "0.0.0-canary.36985fe", | ||
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0", | ||
"yargs": "17.1.1" | ||
"@graphql-inspector/config": "0.0.0-canary.36b26d2", | ||
"@graphql-inspector/loaders": "0.0.0-canary.36b26d2", | ||
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0", | ||
"yargs": "17.2.1" | ||
}, | ||
@@ -12,0 +12,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
5942
138