@aikidosec/ci-api-client 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,20 @@
1
- import { Argument } from 'commander';
2
- import { setApiKey } from '../configuration.js';
3
- import { outputError, outputLog } from '../output.js';
4
- function cli(apiKey) {
5
- if (apiKey && apiKey.trim().length != 128) {
6
- outputError('That does not seem right, please verify your api key');
7
- }
8
- setApiKey(apiKey);
9
- outputLog(apiKey
10
- ? 'Your new Aikido API key has been set'
11
- : 'Your Aikido API key has been removed');
12
- }
13
- export const cliSetup = (program) => program
14
- .command('apikey')
15
- .addArgument(new Argument('<key>', 'Your Aikido public CI API key. See also: https://app.aikido.dev/settings/integrations/continuous-integration. To remove your apikey, leave the <key> argument value empty.').argOptional())
16
- .description('Set (or remove) your Aikido public CI API key.')
17
- .action(cli);
18
- export default { cli, cliSetup };
1
+ import { Argument } from 'commander';
2
+ import { setApiKey } from '../configuration.js';
3
+ import { outputError, outputLog } from '../output.js';
4
+ const API_KEY_REGEX = /^AIK_CI_[a-zA-Z0-9]{64}$/g;
5
+ function cli(apiKey) {
6
+ const isValidApiKey = API_KEY_REGEX.test(apiKey) || apiKey.trim().length === 128;
7
+ if (apiKey && !isValidApiKey) {
8
+ outputError('That does not seem right, please verify your api key');
9
+ }
10
+ setApiKey(apiKey);
11
+ outputLog(apiKey
12
+ ? 'Your new Aikido API key has been set'
13
+ : 'Your Aikido API key has been removed');
14
+ }
15
+ export const cliSetup = (program) => program
16
+ .command('apikey')
17
+ .addArgument(new Argument('<key>', 'Your Aikido public CI API key. See also: https://app.aikido.dev/settings/integrations/continuous-integration. To remove your apikey, leave the <key> argument value empty.').argOptional())
18
+ .description('Set (or remove) your Aikido public CI API key.')
19
+ .action(cli);
20
+ export default { cli, cliSetup };
@@ -1,36 +1,36 @@
1
- import { Command } from 'commander';
2
- import { TPollIsScanningResult, TPollScanCompletedDefaultBranchResult, TPollScanFeatureBranchCompletedResult, TScanApiOptions } from '../aikidoApi.js';
3
- type TScanArguments = {
4
- repoId: string | number;
5
- baseCommitId: string;
6
- headCommitId: string;
7
- branchName: string;
8
- options: TScanApiOptions;
9
- pollInterval: number;
10
- onStart?: () => void | null;
11
- onStartComplete?: (startResult: any) => void | null;
12
- onStartFail?: (error: any) => void | null;
13
- onScanStart?: (startResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
14
- onNextPoll?: (pollResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
15
- onScanComplete?: (pollResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
16
- onScanFail?: (error: any) => void | null;
17
- };
18
- type TScanUserCliOptions = {
19
- pullRequestTitle?: string;
20
- pullRequestUrl?: string;
21
- selfManagedScanners?: string[];
22
- failOnDependencyScan?: boolean;
23
- failOnSastScan?: boolean;
24
- failOnIacScan?: boolean;
25
- minimumSeverityLevel?: string;
26
- pollInterval?: number;
27
- };
28
- declare function cli(repoId: string, baseCommitId: string, headCommitId: string, branchName: string, options: TScanUserCliOptions, command: string): Promise<void>;
29
- export declare const scan: ({ repoId, baseCommitId, headCommitId, branchName, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
30
- export declare const cliSetup: (program: Command) => Command;
31
- declare const _default: {
32
- cli: typeof cli;
33
- cliSetup: (program: Command) => Command;
34
- scan: ({ repoId, baseCommitId, headCommitId, branchName, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
35
- };
36
- export default _default;
1
+ import { Command } from 'commander';
2
+ import { TPollIsScanningResult, TPollScanCompletedDefaultBranchResult, TPollScanFeatureBranchCompletedResult, TScanApiOptions } from '../aikidoApi.js';
3
+ type TScanArguments = {
4
+ repoId: string | number;
5
+ baseCommitId: string;
6
+ headCommitId: string;
7
+ branchName: string;
8
+ options: TScanApiOptions;
9
+ pollInterval: number;
10
+ onStart?: () => void | null;
11
+ onStartComplete?: (startResult: any) => void | null;
12
+ onStartFail?: (error: any) => void | null;
13
+ onScanStart?: (startResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
14
+ onNextPoll?: (pollResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
15
+ onScanComplete?: (pollResult: TPollIsScanningResult | TPollScanFeatureBranchCompletedResult | TPollScanCompletedDefaultBranchResult) => void | null;
16
+ onScanFail?: (error: any) => void | null;
17
+ };
18
+ type TScanUserCliOptions = {
19
+ pullRequestTitle?: string;
20
+ pullRequestUrl?: string;
21
+ selfManagedScanners?: string[];
22
+ failOnDependencyScan?: boolean;
23
+ failOnSastScan?: boolean;
24
+ failOnIacScan?: boolean;
25
+ minimumSeverityLevel?: string;
26
+ pollInterval?: number;
27
+ };
28
+ declare function cli(repoId: string, baseCommitId: string, headCommitId: string, branchName: string, options: TScanUserCliOptions, command: string): Promise<void>;
29
+ export declare const scan: ({ repoId, baseCommitId, headCommitId, branchName, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
30
+ export declare const cliSetup: (program: Command) => Command;
31
+ declare const _default: {
32
+ cli: typeof cli;
33
+ cliSetup: (program: Command) => Command;
34
+ scan: ({ repoId, baseCommitId, headCommitId, branchName, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
35
+ };
36
+ export default _default;
@@ -1,188 +1,188 @@
1
- import chalk from 'chalk';
2
- import { Argument, InvalidArgumentError, Option } from 'commander';
3
- import { pollScanStatus, startScan, } from '../aikidoApi.js';
4
- import { getApiKey } from '../configuration.js';
5
- import { outputError, outputHttpError, outputLog, startSpinner, } from '../output.js';
6
- async function cli(repoId, baseCommitId, headCommitId, branchName, options, command) {
7
- const apiKey = getApiKey();
8
- if (!apiKey) {
9
- outputError('Please set an api key using: aikido-cli apikey <key>');
10
- }
11
- const { apiOptions, cliOptions } = parseCliOptions(options);
12
- let loader;
13
- let pollCount = 1;
14
- const onStart = () => {
15
- loader = startSpinner('Starting Aikido Security scan');
16
- };
17
- const onStartComplete = (startResult) => {
18
- loader?.succeed(`Aikido Security scan started (id: ${startResult.scan_id})`);
19
- };
20
- const onNextPoll = () => {
21
- if (loader) {
22
- loader.text = `Polling for Aikido Security scan to complete (${pollCount})`;
23
- }
24
- pollCount += 1;
25
- };
26
- const onScanStart = () => {
27
- loader = startSpinner('Waiting for scan to complete');
28
- };
29
- const onScanComplete = (pollResult) => {
30
- if (pollResult.gate_passed === true) {
31
- loader?.succeed('Scan completed, no new issues found');
32
- }
33
- else {
34
- loader?.fail('Scan completed with issues');
35
- if (pollResult.open_issues_found) {
36
- outputLog(chalk.gray(chalk.bold('Open issues found: ') + pollResult.open_issues_found));
37
- }
38
- if (pollResult.issue_links) {
39
- outputLog(chalk.gray(pollResult.issue_links
40
- .map((issueLink) => '- ' + issueLink)
41
- .join('\n')));
42
- }
43
- if (pollResult.diff_url) {
44
- outputLog(chalk.gray(`* Diff url: ${pollResult.diff_url}`));
45
- }
46
- process.exit(10);
47
- }
48
- };
49
- const onFail = (error) => {
50
- loader?.fail();
51
- if (error.response?.status && error.response?.status === 404) {
52
- outputError('Please verify your repoId, baseCommitId, headCommitId and branchName');
53
- }
54
- else {
55
- outputHttpError(error);
56
- }
57
- process.exit(1);
58
- };
59
- await scan({
60
- repoId,
61
- baseCommitId,
62
- headCommitId,
63
- branchName,
64
- options: apiOptions,
65
- pollInterval: cliOptions.pollInterval,
66
- onStart,
67
- onStartComplete,
68
- onStartFail: onFail,
69
- onNextPoll,
70
- onScanStart,
71
- onScanComplete,
72
- onScanFail: onFail,
73
- });
74
- }
75
- export const scan = async ({ repoId, baseCommitId, headCommitId, branchName, options, pollInterval = 5, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }) => {
76
- onStart?.();
77
- let result = null;
78
- try {
79
- result = await startScan({
80
- repository_id: repoId,
81
- base_commit_id: baseCommitId,
82
- head_commit_id: headCommitId,
83
- branch_name: branchName,
84
- ...options,
85
- });
86
- if (result.scan_id) {
87
- onStartComplete?.(result);
88
- }
89
- else {
90
- onStartFail?.(result);
91
- return;
92
- }
93
- }
94
- catch (error) {
95
- onStartFail?.(error);
96
- return;
97
- }
98
- onScanStart?.(result);
99
- let pollResult;
100
- const pollStatus = async () => {
101
- try {
102
- pollResult = await pollScanStatus(result.scan_id);
103
- if (pollResult.all_scans_completed === false) {
104
- onNextPoll?.(pollResult);
105
- setTimeout(pollStatus, pollInterval * 1000);
106
- }
107
- else {
108
- onScanComplete?.(pollResult);
109
- }
110
- }
111
- catch (error) {
112
- onScanFail?.(error);
113
- }
114
- };
115
- pollStatus();
116
- };
117
- const parseCliOptions = (userCliOptions) => {
118
- const apiOptions = { version: '1.0.5' };
119
- const cliOptions = { pollInterval: 5 };
120
- if (userCliOptions.pullRequestTitle) {
121
- apiOptions.pull_request_metadata = {
122
- ...(apiOptions.pull_request_metadata ?? {}),
123
- title: userCliOptions.pullRequestTitle,
124
- };
125
- }
126
- if (userCliOptions.pullRequestUrl) {
127
- apiOptions.pull_request_metadata = {
128
- ...(apiOptions.pull_request_metadata ?? {}),
129
- url: userCliOptions.pullRequestUrl,
130
- };
131
- }
132
- if (userCliOptions.selfManagedScanners) {
133
- apiOptions.self_managed_scanners = userCliOptions.selfManagedScanners;
134
- }
135
- if (userCliOptions.failOnDependencyScan != undefined) {
136
- apiOptions.fail_on_dependency_scan = userCliOptions.failOnDependencyScan;
137
- }
138
- if (userCliOptions.failOnSastScan != undefined) {
139
- apiOptions.fail_on_sast_scan = userCliOptions.failOnSastScan;
140
- }
141
- if (userCliOptions.failOnIacScan != undefined) {
142
- apiOptions.fail_on_iac_scan = userCliOptions.failOnIacScan;
143
- }
144
- if (userCliOptions.minimumSeverityLevel) {
145
- apiOptions.minimum_severity = userCliOptions.minimumSeverityLevel;
146
- }
147
- if (userCliOptions.pollInterval &&
148
- (isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)) {
149
- outputError('Please provide a valid poll interval');
150
- }
151
- else if (userCliOptions.pollInterval) {
152
- cliOptions.pollInterval = userCliOptions.pollInterval;
153
- }
154
- return { apiOptions, cliOptions };
155
- };
156
- const validateCommitId = (value) => {
157
- const testCommitId = (commitId) => commitId.length === 40 && /^[0-9a-f]{40}$/.test(commitId);
158
- if (testCommitId(value) === false) {
159
- throw new InvalidArgumentError('Please provide a valid commit ID');
160
- }
161
- return value;
162
- };
163
- export const cliSetup = (program) => program
164
- .command('scan')
165
- .addArgument(new Argument('<repository_id>', 'The internal GitHub/Gitlab/Bitbucket/.. repository id you want to scan.').argRequired())
166
- .addArgument(new Argument('<base_commit_id>', 'The base commit of the code you want to scan (e.g. the commit where you branched from for your PR or the initial commit of your repo)')
167
- .argRequired()
168
- .argParser(validateCommitId))
169
- .addArgument(new Argument('<head_commit_id>', 'The latest commit you want to include in your scan (e.g. the latest commit id of your pull request)')
170
- .argRequired()
171
- .argParser(validateCommitId))
172
- .addArgument(new Argument('<branch_name>', 'The branch name')
173
- .argOptional()
174
- .default('main'))
175
- .option('--pull-request-title <title>', 'Your pull request title')
176
- .option('--pull-request-url <url>', 'Your pull request URL')
177
- .addOption(new Option('--self-managed-scanners <scanners...>', 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.').choices(['checkov', 'json-sbom']))
178
- .option('--expected-amount-json-sboms <amount>', 'The expected amount of json sbombs')
179
- .addOption(new Option('--no-fail-on-dependency-scan', "Don't fail when scanning depedencies..."))
180
- .option('--fail-on-sast-scan', 'Let Aikido fail when new static code analysis issues have been detected...')
181
- .option('--fail-on-iac-scan', 'Let Aikido fail when new infrastructure as code issues have been detected...')
182
- .addOption(new Option('--minimum-severity-level <level>', 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.').choices(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']))
183
- .addOption(new Option('--poll-interval [interval]', 'The poll interval when checking for an updated scan result')
184
- .preset(5)
185
- .argParser(parseFloat))
186
- .description('Run a scan of an Aikido repo.')
187
- .action(cli);
188
- export default { cli, cliSetup, scan };
1
+ import chalk from 'chalk';
2
+ import { Argument, InvalidArgumentError, Option } from 'commander';
3
+ import { pollScanStatus, startScan, } from '../aikidoApi.js';
4
+ import { getApiKey } from '../configuration.js';
5
+ import { outputError, outputHttpError, outputLog, startSpinner, } from '../output.js';
6
+ async function cli(repoId, baseCommitId, headCommitId, branchName, options, command) {
7
+ const apiKey = getApiKey();
8
+ if (!apiKey) {
9
+ outputError('Please set an api key using: aikido-cli apikey <key>');
10
+ }
11
+ const { apiOptions, cliOptions } = parseCliOptions(options);
12
+ let loader;
13
+ let pollCount = 1;
14
+ const onStart = () => {
15
+ loader = startSpinner('Starting Aikido Security scan');
16
+ };
17
+ const onStartComplete = (startResult) => {
18
+ loader?.succeed(`Aikido Security scan started (id: ${startResult.scan_id})`);
19
+ };
20
+ const onNextPoll = () => {
21
+ if (loader) {
22
+ loader.text = `Polling for Aikido Security scan to complete (${pollCount})`;
23
+ }
24
+ pollCount += 1;
25
+ };
26
+ const onScanStart = () => {
27
+ loader = startSpinner('Waiting for scan to complete');
28
+ };
29
+ const onScanComplete = (pollResult) => {
30
+ if (pollResult.gate_passed === true) {
31
+ loader?.succeed('Scan completed, no new issues found');
32
+ }
33
+ else {
34
+ loader?.fail('Scan completed with issues');
35
+ if (pollResult.open_issues_found) {
36
+ outputLog(chalk.gray(chalk.bold('Open issues found: ') + pollResult.open_issues_found));
37
+ }
38
+ if (pollResult.issue_links) {
39
+ outputLog(chalk.gray(pollResult.issue_links
40
+ .map((issueLink) => '- ' + issueLink)
41
+ .join('\n')));
42
+ }
43
+ if (pollResult.diff_url) {
44
+ outputLog(chalk.gray(`* Diff url: ${pollResult.diff_url}`));
45
+ }
46
+ process.exit(10);
47
+ }
48
+ };
49
+ const onFail = (error) => {
50
+ loader?.fail();
51
+ if (error.response?.status && error.response?.status === 404) {
52
+ outputError('Please verify your repoId, baseCommitId, headCommitId and branchName');
53
+ }
54
+ else {
55
+ outputHttpError(error);
56
+ }
57
+ process.exit(1);
58
+ };
59
+ await scan({
60
+ repoId,
61
+ baseCommitId,
62
+ headCommitId,
63
+ branchName,
64
+ options: apiOptions,
65
+ pollInterval: cliOptions.pollInterval,
66
+ onStart,
67
+ onStartComplete,
68
+ onStartFail: onFail,
69
+ onNextPoll,
70
+ onScanStart,
71
+ onScanComplete,
72
+ onScanFail: onFail,
73
+ });
74
+ }
75
+ export const scan = async ({ repoId, baseCommitId, headCommitId, branchName, options, pollInterval = 5, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }) => {
76
+ onStart?.();
77
+ let result = null;
78
+ try {
79
+ result = await startScan({
80
+ repository_id: repoId,
81
+ base_commit_id: baseCommitId,
82
+ head_commit_id: headCommitId,
83
+ branch_name: branchName,
84
+ ...options,
85
+ });
86
+ if (result.scan_id) {
87
+ onStartComplete?.(result);
88
+ }
89
+ else {
90
+ onStartFail?.(result);
91
+ return;
92
+ }
93
+ }
94
+ catch (error) {
95
+ onStartFail?.(error);
96
+ return;
97
+ }
98
+ onScanStart?.(result);
99
+ let pollResult;
100
+ const pollStatus = async () => {
101
+ try {
102
+ pollResult = await pollScanStatus(result.scan_id);
103
+ if (pollResult.all_scans_completed === false) {
104
+ onNextPoll?.(pollResult);
105
+ setTimeout(pollStatus, pollInterval * 1000);
106
+ }
107
+ else {
108
+ onScanComplete?.(pollResult);
109
+ }
110
+ }
111
+ catch (error) {
112
+ onScanFail?.(error);
113
+ }
114
+ };
115
+ pollStatus();
116
+ };
117
+ const parseCliOptions = (userCliOptions) => {
118
+ const apiOptions = { version: '1.0.5' };
119
+ const cliOptions = { pollInterval: 5 };
120
+ if (userCliOptions.pullRequestTitle) {
121
+ apiOptions.pull_request_metadata = {
122
+ ...(apiOptions.pull_request_metadata ?? {}),
123
+ title: userCliOptions.pullRequestTitle,
124
+ };
125
+ }
126
+ if (userCliOptions.pullRequestUrl) {
127
+ apiOptions.pull_request_metadata = {
128
+ ...(apiOptions.pull_request_metadata ?? {}),
129
+ url: userCliOptions.pullRequestUrl,
130
+ };
131
+ }
132
+ if (userCliOptions.selfManagedScanners) {
133
+ apiOptions.self_managed_scanners = userCliOptions.selfManagedScanners;
134
+ }
135
+ if (userCliOptions.failOnDependencyScan != undefined) {
136
+ apiOptions.fail_on_dependency_scan = userCliOptions.failOnDependencyScan;
137
+ }
138
+ if (userCliOptions.failOnSastScan != undefined) {
139
+ apiOptions.fail_on_sast_scan = userCliOptions.failOnSastScan;
140
+ }
141
+ if (userCliOptions.failOnIacScan != undefined) {
142
+ apiOptions.fail_on_iac_scan = userCliOptions.failOnIacScan;
143
+ }
144
+ if (userCliOptions.minimumSeverityLevel) {
145
+ apiOptions.minimum_severity = userCliOptions.minimumSeverityLevel;
146
+ }
147
+ if (userCliOptions.pollInterval &&
148
+ (isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)) {
149
+ outputError('Please provide a valid poll interval');
150
+ }
151
+ else if (userCliOptions.pollInterval) {
152
+ cliOptions.pollInterval = userCliOptions.pollInterval;
153
+ }
154
+ return { apiOptions, cliOptions };
155
+ };
156
+ const validateCommitId = (value) => {
157
+ const testCommitId = (commitId) => commitId.length === 40 && /^[0-9a-f]{40}$/.test(commitId);
158
+ if (testCommitId(value) === false) {
159
+ throw new InvalidArgumentError('Please provide a valid commit ID');
160
+ }
161
+ return value;
162
+ };
163
+ export const cliSetup = (program) => program
164
+ .command('scan')
165
+ .addArgument(new Argument('<repository_id>', 'The internal GitHub/Gitlab/Bitbucket/.. repository id you want to scan.').argRequired())
166
+ .addArgument(new Argument('<base_commit_id>', 'The base commit of the code you want to scan (e.g. the commit where you branched from for your PR or the initial commit of your repo)')
167
+ .argRequired()
168
+ .argParser(validateCommitId))
169
+ .addArgument(new Argument('<head_commit_id>', 'The latest commit you want to include in your scan (e.g. the latest commit id of your pull request)')
170
+ .argRequired()
171
+ .argParser(validateCommitId))
172
+ .addArgument(new Argument('<branch_name>', 'The branch name')
173
+ .argOptional()
174
+ .default('main'))
175
+ .option('--pull-request-title <title>', 'Your pull request title')
176
+ .option('--pull-request-url <url>', 'Your pull request URL')
177
+ .addOption(new Option('--self-managed-scanners <scanners...>', 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.').choices(['checkov', 'json-sbom']))
178
+ .option('--expected-amount-json-sboms <amount>', 'The expected amount of json sbombs')
179
+ .addOption(new Option('--no-fail-on-dependency-scan', "Don't fail when scanning depedencies..."))
180
+ .option('--fail-on-sast-scan', 'Let Aikido fail when new static code analysis issues have been detected...')
181
+ .option('--fail-on-iac-scan', 'Let Aikido fail when new infrastructure as code issues have been detected...')
182
+ .addOption(new Option('--minimum-severity-level <level>', 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.').choices(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']))
183
+ .addOption(new Option('--poll-interval [interval]', 'The poll interval when checking for an updated scan result')
184
+ .preset(5)
185
+ .argParser(parseFloat))
186
+ .description('Run a scan of an Aikido repo.')
187
+ .action(cli);
188
+ export default { cli, cliSetup, scan };
@@ -1,23 +1,23 @@
1
- import { Command } from 'commander';
2
- import { TUploadApiOptions, TUploadPayloadType, TUploadResult } from '../aikidoApi.js';
3
- type TUploadArguments = {
4
- data: TUploadApiOptions;
5
- onUploadComplete?: (startResult: TUploadResult) => void | null;
6
- onUploadFail?: (error: any) => void | null;
7
- };
8
- type TUploadUserCliOptions = {
9
- scanId?: string | number;
10
- repositoryId: string | number;
11
- containerImage?: string;
12
- type: TUploadPayloadType;
13
- file?: string;
14
- payload?: string;
15
- };
16
- declare function cli(options: TUploadUserCliOptions, command: string): Promise<void>;
17
- export declare const upload: ({ data, onUploadComplete, onUploadFail, }: TUploadArguments) => Promise<void>;
18
- export declare const cliSetup: (program: Command) => Command;
19
- declare const _default: {
20
- cli: typeof cli;
21
- cliSetup: (program: Command) => Command;
22
- };
23
- export default _default;
1
+ import { Command } from 'commander';
2
+ import { TUploadApiOptions, TUploadPayloadType, TUploadResult } from '../aikidoApi.js';
3
+ type TUploadArguments = {
4
+ data: TUploadApiOptions;
5
+ onUploadComplete?: (startResult: TUploadResult) => void | null;
6
+ onUploadFail?: (error: any) => void | null;
7
+ };
8
+ type TUploadUserCliOptions = {
9
+ scanId?: string | number;
10
+ repositoryId: string | number;
11
+ containerImage?: string;
12
+ type: TUploadPayloadType;
13
+ file?: string;
14
+ payload?: string;
15
+ };
16
+ declare function cli(options: TUploadUserCliOptions, command: string): Promise<void>;
17
+ export declare const upload: ({ data, onUploadComplete, onUploadFail, }: TUploadArguments) => Promise<void>;
18
+ export declare const cliSetup: (program: Command) => Command;
19
+ declare const _default: {
20
+ cli: typeof cli;
21
+ cliSetup: (program: Command) => Command;
22
+ };
23
+ export default _default;