@aikidosec/ci-api-client 1.0.4 → 1.0.6

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,34 +1,34 @@
1
- import { Argument, Command } from 'commander';
2
- import { setApiKey } from '../configuration.js';
3
- import { outputError, outputLog } from '../output.js';
4
-
5
- const API_KEY_REGEX = /^AIK_CI_[a-zA-Z0-9]{64}$/g;
6
-
7
- function cli(apiKey: string): void {
8
- const isValidApiKey =
9
- API_KEY_REGEX.test(apiKey) || apiKey.trim().length === 128;
10
- if (apiKey && !isValidApiKey) {
11
- outputError('That does not seem right, please verify your api key');
12
- }
13
-
14
- setApiKey(apiKey);
15
- outputLog(
16
- apiKey
17
- ? 'Your new Aikido API key has been set'
18
- : 'Your Aikido API key has been removed'
19
- );
20
- }
21
-
22
- export const cliSetup = (program: Command): Command =>
23
- program
24
- .command('apikey')
25
- .addArgument(
26
- new Argument(
27
- '<key>',
28
- '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.'
29
- ).argOptional()
30
- )
31
- .description('Set (or remove) your Aikido public CI API key.')
32
- .action(cli);
33
-
34
- export default { cli, cliSetup };
1
+ import { Argument, Command } from 'commander';
2
+ import { setApiKey } from '../configuration.js';
3
+ import { outputError, outputLog } from '../output.js';
4
+
5
+ const API_KEY_REGEX = /^AIK_CI_[a-zA-Z0-9]{64}$/g;
6
+
7
+ function cli(apiKey: string): void {
8
+ const isValidApiKey =
9
+ API_KEY_REGEX.test(apiKey) || apiKey.trim().length === 128;
10
+ if (apiKey && !isValidApiKey) {
11
+ outputError('That does not seem right, please verify your api key');
12
+ }
13
+
14
+ setApiKey(apiKey);
15
+ outputLog(
16
+ apiKey
17
+ ? 'Your new Aikido API key has been set'
18
+ : 'Your Aikido API key has been removed'
19
+ );
20
+ }
21
+
22
+ export const cliSetup = (program: Command): Command =>
23
+ program
24
+ .command('apikey')
25
+ .addArgument(
26
+ new Argument(
27
+ '<key>',
28
+ '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.'
29
+ ).argOptional()
30
+ )
31
+ .description('Set (or remove) your Aikido public CI API key.')
32
+ .action(cli);
33
+
34
+ export default { cli, cliSetup };