@graphql-inspector/commands
Advanced tools
Comparing version 0.0.0-canary.9cf9b2c to 0.0.0-canary.a883150
@@ -12,3 +12,12 @@ '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 tslib.__awaiter(this, void 0, void 0, function* () { | ||
return args; | ||
}); | ||
} }, api))); | ||
} | ||
@@ -15,0 +24,0 @@ function createCommand(factory) { |
import { InspectorConfig } from '@graphql-inspector/config'; | ||
import { Loaders } from '@graphql-inspector/loaders'; | ||
import { CommandModule } from 'yargs'; | ||
export { CommandModule as Command }; | ||
import { CommandModule as Command, PositionalOptions, Options } from 'yargs'; | ||
export { Command }; | ||
export interface UseCommandsAPI { | ||
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): Promise<T>; | ||
} | ||
export declare type CommandFactory<T = {}, U = {}> = (api: UseCommandsAPI) => CommandModule<T, U>; | ||
export declare function useCommands(api: UseCommandsAPI): CommandModule[]; | ||
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>; | ||
@@ -22,2 +32,2 @@ export declare function ensureAbsolute(filepath: string, basepath?: string): string; | ||
}; | ||
export declare function mockCommand(mod: CommandModule, cmd: string): Promise<string>; | ||
export declare function mockCommand(mod: Command, cmd: string): Promise<string>; |
@@ -6,3 +6,12 @@ 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 __awaiter(this, void 0, void 0, function* () { | ||
return args; | ||
}); | ||
} }, api))); | ||
} | ||
@@ -9,0 +18,0 @@ function createCommand(factory) { |
{ | ||
"name": "@graphql-inspector/commands", | ||
"version": "0.0.0-canary.9cf9b2c", | ||
"version": "0.0.0-canary.a883150", | ||
"description": "Plugin system for commands in GraphQL Inspector", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"@graphql-inspector/config": "0.0.0-canary.9cf9b2c", | ||
"@graphql-inspector/loaders": "0.0.0-canary.9cf9b2c", | ||
"@graphql-inspector/config": "0.0.0-canary.a883150", | ||
"@graphql-inspector/loaders": "0.0.0-canary.a883150", | ||
"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
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
13708
147
0
6