UNPKG

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