UNPKG

3.63 kBTypeScriptView Raw
1import Command from '../base';
2import { OpCommand, Config, OpWorkflow, RunCommandArgs, OpsYml } from '../types';
3export interface RunInputs {
4 parsedArgs: RunCommandArgs;
5 teamName: string;
6 opName: string;
7 opVersion: string;
8 config: Config;
9 opsAndWorkflows: (OpCommand | OpWorkflow)[];
10 opOrWorkflow: OpCommand | OpWorkflow;
11}
12export default class Run extends Command {
13 static description: string;
14 static flags: {
15 help: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
16 build: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
17 };
18 static strict: boolean;
19 static args: {
20 name: string;
21 description: string;
22 parse: (input: string) => string;
23 }[];
24 opsAndWorkflows: (OpCommand | OpWorkflow)[];
25 customParse: (options: typeof Run, argv: string[]) => {
26 args: any;
27 flags: any;
28 opParams: string[];
29 };
30 checkPathOpsYmlExists: (nameOrPath: string) => boolean;
31 parseYamlFile: (relativePathToOpsYml: string) => Promise<OpsYml | null>;
32 logResolvedLocalMessage: (inputs: RunInputs) => RunInputs;
33 getOpsAndWorkflowsFromFileSystem: (relativePathToOpsYml: string) => (inputs: RunInputs) => Promise<RunInputs>;
34 addMissingApiFieldsToLocalOps: (inputs: RunInputs) => Promise<RunInputs>;
35 filterLocalOps: (inputs: RunInputs) => RunInputs;
36 formatOpOrWorkflowEmoji: (opOrWorkflow: OpCommand | OpWorkflow) => string;
37 formatOpOrWorkflowName: (opOrWorkflow: OpCommand | OpWorkflow) => string;
38 fuzzyFilterParams: () => {
39 list: {
40 name: string;
41 value: OpCommand | OpWorkflow;
42 }[];
43 options: {
44 extract: (el: any) => any;
45 };
46 };
47 autocompleteSearch: (_: Record<string, any>, input?: string) => Promise<{
48 value: OpCommand | OpWorkflow;
49 name: string;
50 }[]>;
51 selectOpOrWorkflowToRun: (inputs: RunInputs) => Promise<RunInputs>;
52 printCustomHelp: (op: OpCommand) => void;
53 checkForHelpMessage: (inputs: RunInputs) => void | RunInputs;
54 executeOpOrWorkflowService: (inputs: RunInputs) => Promise<RunInputs>;
55 /**
56 * Extracts the Op Team and Name from the input argument
57 * @cto.ai/github -> { teamName: cto.ai, opname: github, opVersion: '' }
58 * cto.ai/github -> { teamName: cto.ai, opname: github, opVersion: '' }
59 * github -> { teamName: '', opname: github, opVersion: '' }
60 * @cto.ai/github:0.1.0 -> { teamName: cto.ai, opname: github, opVersion: '0.1.0' }
61 * cto.ai/github:customVersion -> { teamName: cto.ai, opname: github, opVersion: 'customVersion' }
62 * github:myVersion -> { teamName: '', opname: github, opVersion: 'myVersion' }
63 * cto.ai/extra/blah -> InvalidOpName
64 * cto.ai/extra:version1:version2 -> InvalidOpName
65 * null -> InvalidOpName
66 */
67 parseTeamOpNameVersion: (inputs: RunInputs) => {
68 teamName: string;
69 opName: string;
70 opVersion: string;
71 parsedArgs: RunCommandArgs;
72 config: Config;
73 opsAndWorkflows: (OpCommand | OpWorkflow)[];
74 opOrWorkflow: OpCommand | OpWorkflow;
75 };
76 /**
77 * Extracts the version and op name from input argument.
78 * github -> { opName: 'github', opVersion: '' }
79 * github:0.1.0 -> { opName: 'github', opVersion: '0.1.0' }
80 * github:: -> InvalidOpName
81 */
82 parseOpNameAndVersion: (opNameAndVersion: string) => {
83 opName: string;
84 opVersion: string;
85 };
86 getApiOps: (inputs: RunInputs) => Promise<RunInputs>;
87 sendAnalytics: (inputs: RunInputs) => Promise<RunInputs>;
88 run(): Promise<void>;
89}