@sw-tsdk/plugin-connector 2.17.4 → 2.19.0

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.
package/README.md CHANGED
@@ -16,7 +16,7 @@ $ npm install -g @sw-tsdk/plugin-connector
16
16
  $ sw-tsdk-connector COMMAND
17
17
  running command...
18
18
  $ sw-tsdk-connector (--version)
19
- @sw-tsdk/plugin-connector/2.17.4 linux-x64 node-v16.20.2
19
+ @sw-tsdk/plugin-connector/2.19.0 linux-x64 node-v16.20.2
20
20
  $ sw-tsdk-connector --help [COMMAND]
21
21
  USAGE
22
22
  $ sw-tsdk-connector COMMAND
@@ -31,6 +31,10 @@ USAGE
31
31
  * [`sw-tsdk-connector action:generate:output`](#sw-tsdk-connector-actiongenerateoutput)
32
32
  * [`sw-tsdk-connector action:run:local`](#sw-tsdk-connector-actionrunlocal)
33
33
  * [`sw-tsdk-connector asset:add`](#sw-tsdk-connector-assetadd)
34
+ * [`sw-tsdk-connector component:create`](#sw-tsdk-connector-componentcreate)
35
+ * [`sw-tsdk-connector component:logo`](#sw-tsdk-connector-componentlogo)
36
+ * [`sw-tsdk-connector component:ssp`](#sw-tsdk-connector-componentssp)
37
+ * [`sw-tsdk-connector component:update`](#sw-tsdk-connector-componentupdate)
34
38
  * [`sw-tsdk-connector connector:build`](#sw-tsdk-connector-connectorbuild)
35
39
  * [`sw-tsdk-connector connector:create`](#sw-tsdk-connector-connectorcreate)
36
40
  * [`sw-tsdk-connector connector:create:openapi`](#sw-tsdk-connector-connectorcreateopenapi)
@@ -39,6 +43,9 @@ USAGE
39
43
  * [`sw-tsdk-connector connector:sign`](#sw-tsdk-connector-connectorsign)
40
44
  * [`sw-tsdk-connector connector:update`](#sw-tsdk-connector-connectorupdate)
41
45
  * [`sw-tsdk-connector connector:validate`](#sw-tsdk-connector-connectorvalidate)
46
+ * [`sw-tsdk-connector description:action`](#sw-tsdk-connector-descriptionaction)
47
+ * [`sw-tsdk-connector description:actions`](#sw-tsdk-connector-descriptionactions)
48
+ * [`sw-tsdk-connector description:connector`](#sw-tsdk-connector-descriptionconnector)
42
49
 
43
50
  ## `sw-tsdk-connector action:add`
44
51
 
@@ -58,7 +65,7 @@ DESCRIPTION
58
65
  Update a connector action.
59
66
  ```
60
67
 
61
- _See code: [lib/commands/action/add.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/action/add.js)_
68
+ _See code: [lib/commands/action/add.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/action/add.js)_
62
69
 
63
70
  ## `sw-tsdk-connector action:generate:data`
64
71
 
@@ -83,7 +90,7 @@ DESCRIPTION
83
90
  Use to test a task in an integration
84
91
  ```
85
92
 
86
- _See code: [lib/commands/action/generate/data.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/action/generate/data.js)_
93
+ _See code: [lib/commands/action/generate/data.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/action/generate/data.js)_
87
94
 
88
95
  ## `sw-tsdk-connector action:generate:input`
89
96
 
@@ -108,7 +115,7 @@ DESCRIPTION
108
115
  Update action input schema.
109
116
  ```
110
117
 
111
- _See code: [lib/commands/action/generate/input.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/action/generate/input.js)_
118
+ _See code: [lib/commands/action/generate/input.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/action/generate/input.js)_
112
119
 
113
120
  ## `sw-tsdk-connector action:generate:output`
114
121
 
@@ -132,7 +139,7 @@ DESCRIPTION
132
139
  Update a connector action.
133
140
  ```
134
141
 
135
- _See code: [lib/commands/action/generate/output.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/action/generate/output.js)_
142
+ _See code: [lib/commands/action/generate/output.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/action/generate/output.js)_
136
143
 
137
144
  ## `sw-tsdk-connector action:run:local`
138
145
 
@@ -161,7 +168,7 @@ DESCRIPTION
161
168
  Runs a connector action. (Defaults to current image version in local repository).
162
169
  ```
163
170
 
164
- _See code: [lib/commands/action/run/local.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/action/run/local.js)_
171
+ _See code: [lib/commands/action/run/local.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/action/run/local.js)_
165
172
 
166
173
  ## `sw-tsdk-connector asset:add`
167
174
 
@@ -182,7 +189,101 @@ DESCRIPTION
182
189
  Update a connector action.
183
190
  ```
184
191
 
185
- _See code: [lib/commands/asset/add.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/asset/add.js)_
192
+ _See code: [lib/commands/asset/add.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/asset/add.js)_
193
+
194
+ ## `sw-tsdk-connector component:create`
195
+
196
+ Scaffold a new Component
197
+
198
+ ```
199
+ USAGE
200
+ $ sw-tsdk-connector component:create [-d <value>] [--componentType <value>] [--vendor <value>] [--componentName
201
+ <value>] [--keywords <value>] [--description <value>] [--logoPath <value>] [--sspPath <value>] [--author <value>]
202
+ [--authorEmail <value>] [--homepage <value>] [-h]
203
+
204
+ FLAGS
205
+ -d, --directory=<value> [default: ./] root directory for where to store Component.
206
+ -h, --help Show CLI help.
207
+ --author=<value> Component Author
208
+ --authorEmail=<value> Component Author Email
209
+ --componentName=<value> Component Name (e.g. Alert Ingestion)
210
+ --componentType=<value> Component Type (e.g. classic)
211
+ --description=<value> Description (e.g. CrowdStrike Alert Ingestion Component)
212
+ --homepage=<value> Component Author Support URL
213
+ --keywords=<value> Enter keywords
214
+ --logoPath=<value> URL or absolute path to logo file
215
+ --sspPath=<value> absolute path to .ssp file
216
+ --vendor=<value> Vendor (e.g. CrowdStrike)
217
+
218
+ DESCRIPTION
219
+ Scaffold a new Component
220
+ ```
221
+
222
+ _See code: [lib/commands/component/create.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/create.js)_
223
+
224
+ ## `sw-tsdk-connector component:logo`
225
+
226
+ Update a Component logo.
227
+
228
+ ```
229
+ USAGE
230
+ $ sw-tsdk-connector component:logo [-d <value>] [-t <value>] [-n <value>] [-p <value>] [-h]
231
+
232
+ FLAGS
233
+ -d, --directory=<value> [default: ./] root directory of the component folder.
234
+ -h, --help Show CLI help.
235
+ -n, --componentName=<value> Component Name (e.g. google_alert_ingestion)
236
+ -p, --logoPath=<value> path or URL to product logo in PNG format.
237
+ -t, --componentType=<value> Component Type (e.g. classic)
238
+
239
+ DESCRIPTION
240
+ Update a Component logo.
241
+ ```
242
+
243
+ _See code: [lib/commands/component/logo.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/logo.js)_
244
+
245
+ ## `sw-tsdk-connector component:ssp`
246
+
247
+ Update an SSP.
248
+
249
+ ```
250
+ USAGE
251
+ $ sw-tsdk-connector component:ssp [-d <value>] [-t <value>] [-n <value>] [-p <value>] [-h]
252
+
253
+ FLAGS
254
+ -d, --directory=<value> [default: ./] root directory of the component folder.
255
+ -h, --help Show CLI help.
256
+ -n, --componentName=<value> Component Name (e.g. google_alert_ingestion)
257
+ -p, --sspPath=<value> Absolute path to .SSP file
258
+ -t, --componentType=<value> Component Type (e.g. classic)
259
+
260
+ DESCRIPTION
261
+ Update an SSP.
262
+ ```
263
+
264
+ _See code: [lib/commands/component/ssp.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/ssp.js)_
265
+
266
+ ## `sw-tsdk-connector component:update`
267
+
268
+ Update Component Version.
269
+
270
+ ```
271
+ USAGE
272
+ $ sw-tsdk-connector component:update [-d <value>] [-v <value>] [-t <value>] [-n <value>] [-f <value>] [-h]
273
+
274
+ FLAGS
275
+ -d, --directory=<value> [default: .] root directory of the all Components
276
+ -f, --manifestPath=<value> [default: manifest.yml] Component manifest path relative to directory.
277
+ -h, --help Show CLI help.
278
+ -n, --componentName=<value> Component Name (e.g. google_alert_ingestion)
279
+ -t, --componentType=<value> Component Type (e.g. classic)
280
+ -v, --version=<value> new version of the component.
281
+
282
+ DESCRIPTION
283
+ Update Component Version.
284
+ ```
285
+
286
+ _See code: [lib/commands/component/update.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/update.js)_
186
287
 
187
288
  ## `sw-tsdk-connector connector:build`
188
289
 
@@ -212,7 +313,7 @@ DESCRIPTION
212
313
  Builds a local docker image of the connector.
213
314
  ```
214
315
 
215
- _See code: [lib/commands/connector/build.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/build.js)_
316
+ _See code: [lib/commands/connector/build.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/build.js)_
216
317
 
217
318
  ## `sw-tsdk-connector connector:create`
218
319
 
@@ -244,7 +345,7 @@ DESCRIPTION
244
345
  Scaffold a new connector
245
346
  ```
246
347
 
247
- _See code: [lib/commands/connector/create.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/create.js)_
348
+ _See code: [lib/commands/connector/create.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/create.js)_
248
349
 
249
350
  ## `sw-tsdk-connector connector:create:openapi`
250
351
 
@@ -273,7 +374,7 @@ DESCRIPTION
273
374
  Scaffold a new connector
274
375
  ```
275
376
 
276
- _See code: [lib/commands/connector/create/openapi.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/create/openapi.js)_
377
+ _See code: [lib/commands/connector/create/openapi.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/create/openapi.js)_
277
378
 
278
379
  ## `sw-tsdk-connector connector:create:source`
279
380
 
@@ -291,7 +392,7 @@ DESCRIPTION
291
392
  Generates 11x source from 10x
292
393
  ```
293
394
 
294
- _See code: [lib/commands/connector/create/source.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/create/source.js)_
395
+ _See code: [lib/commands/connector/create/source.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/create/source.js)_
295
396
 
296
397
  ## `sw-tsdk-connector connector:logo`
297
398
 
@@ -310,7 +411,7 @@ DESCRIPTION
310
411
  Update a connector.
311
412
  ```
312
413
 
313
- _See code: [lib/commands/connector/logo.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/logo.js)_
414
+ _See code: [lib/commands/connector/logo.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/logo.js)_
314
415
 
315
416
  ## `sw-tsdk-connector connector:sign`
316
417
 
@@ -335,7 +436,7 @@ DESCRIPTION
335
436
  Builds a local docker image of the connector.
336
437
  ```
337
438
 
338
- _See code: [lib/commands/connector/sign.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/sign.js)_
439
+ _See code: [lib/commands/connector/sign.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/sign.js)_
339
440
 
340
441
  ## `sw-tsdk-connector connector:update`
341
442
 
@@ -355,7 +456,7 @@ DESCRIPTION
355
456
  Update a connector.
356
457
  ```
357
458
 
358
- _See code: [lib/commands/connector/update.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/update.js)_
459
+ _See code: [lib/commands/connector/update.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/update.js)_
359
460
 
360
461
  ## `sw-tsdk-connector connector:validate`
361
462
 
@@ -378,5 +479,66 @@ DESCRIPTION
378
479
  Use to validate an integration
379
480
  ```
380
481
 
381
- _See code: [lib/commands/connector/validate.js](https://github.com/swimlane/turbine-sdk/blob/v2.17.4/lib/commands/connector/validate.js)_
482
+ _See code: [lib/commands/connector/validate.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/connector/validate.js)_
483
+
484
+ ## `sw-tsdk-connector description:action`
485
+
486
+ Use to generate action description
487
+
488
+ ```
489
+ USAGE
490
+ $ sw-tsdk-connector description:action [-h] [-i <value>] [-s] [-d <value>] [-a <value>]
491
+
492
+ FLAGS
493
+ -a, --action=<value> Generate description for specific action
494
+ -d, --directory=<value> [default: ./] current directory to mount
495
+ -h, --help Show CLI help.
496
+ -i, --image=<value> image to use
497
+ -s, --skip-pull skips pulling the image
498
+
499
+ DESCRIPTION
500
+ Use to generate action description
501
+ ```
502
+
503
+ _See code: [lib/commands/description/action.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/description/action.js)_
504
+
505
+ ## `sw-tsdk-connector description:actions`
506
+
507
+ Use to generate description for all actions
508
+
509
+ ```
510
+ USAGE
511
+ $ sw-tsdk-connector description:actions [-h] [-i <value>] [-s] [-d <value>]
512
+
513
+ FLAGS
514
+ -d, --directory=<value> [default: ./] current directory to mount
515
+ -h, --help Show CLI help.
516
+ -i, --image=<value> image to use
517
+ -s, --skip-pull skips pulling the image
518
+
519
+ DESCRIPTION
520
+ Use to generate description for all actions
521
+ ```
522
+
523
+ _See code: [lib/commands/description/actions.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/description/actions.js)_
524
+
525
+ ## `sw-tsdk-connector description:connector`
526
+
527
+ Use to generate connector descriptions
528
+
529
+ ```
530
+ USAGE
531
+ $ sw-tsdk-connector description:connector [-h] [-i <value>] [-s] [-d <value>]
532
+
533
+ FLAGS
534
+ -d, --directory=<value> [default: ./] current directory to mount
535
+ -h, --help Show CLI help.
536
+ -i, --image=<value> image to use
537
+ -s, --skip-pull skips pulling the image
538
+
539
+ DESCRIPTION
540
+ Use to generate connector descriptions
541
+ ```
542
+
543
+ _See code: [lib/commands/description/connector.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/description/connector.js)_
382
544
  <!-- commandsstop -->
@@ -0,0 +1,34 @@
1
+ import { Base } from '@sw-tsdk/core';
2
+ export interface ComponentManifest {
3
+ schema: string;
4
+ componentType: string;
5
+ vendor: string;
6
+ name: string;
7
+ author: string;
8
+ bugs: string;
9
+ iconImage: string;
10
+ description: string;
11
+ homepage: string;
12
+ license: string;
13
+ title: string;
14
+ version: string;
15
+ keywords: string[];
16
+ }
17
+ export declare class Create extends Base {
18
+ static description: string;
19
+ static flags: {
20
+ directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
21
+ componentType: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
22
+ vendor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
23
+ componentName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
24
+ keywords: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
25
+ description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
26
+ logoPath: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
27
+ sspPath: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
28
+ author: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
29
+ authorEmail: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
30
+ homepage: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
31
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
32
+ };
33
+ run(): Promise<void>;
34
+ }
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Create = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
6
+ const connector_1 = require("@sw-tsdk/connector");
7
+ const core_2 = require("@sw-tsdk/core");
8
+ const fs_extra_1 = require("fs-extra");
9
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
10
+ const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
11
+ const fs = tslib_1.__importStar(require("node:fs"));
12
+ const node_fs_1 = require("node:fs");
13
+ const path = tslib_1.__importStar(require("node:path"));
14
+ const node_path_1 = require("node:path");
15
+ const snake_case_1 = require("snake-case");
16
+ const common_1 = require("../../common");
17
+ // noinspection JSUnusedGlobalSymbols
18
+ class Create extends core_2.Base {
19
+ async run() {
20
+ const { flags } = await this.parse(Create);
21
+ let { directory } = flags;
22
+ directory = (0, node_path_1.resolve)(directory || process.cwd());
23
+ try {
24
+ await node_fs_1.promises.access(directory);
25
+ }
26
+ catch {
27
+ this.error(`Could not access ${directory}`);
28
+ }
29
+ const masterQuestions = [{
30
+ type: 'list',
31
+ name: 'componentType',
32
+ message: 'Choose Component Type',
33
+ choices: common_1.contentCategories,
34
+ },
35
+ {
36
+ type: 'input',
37
+ name: 'vendor',
38
+ message: 'Vendor (e.g. CrowdStrike)',
39
+ },
40
+ {
41
+ type: 'input',
42
+ name: 'componentName',
43
+ message: 'Component Name (e.g. Alert Ingestion)',
44
+ },
45
+ {
46
+ type: 'input',
47
+ name: 'description',
48
+ message: 'Description (e.g. CrowdStrike Alert Ingestion Component)',
49
+ },
50
+ {
51
+ type: 'list',
52
+ name: 'keywords',
53
+ message: 'Choose a category (Comma-separated)',
54
+ choices: common_1.connectorCategories,
55
+ },
56
+ {
57
+ type: 'input',
58
+ name: 'logoPath',
59
+ message: 'URL or absolute path to logo file',
60
+ },
61
+ {
62
+ type: 'input',
63
+ name: 'sspPath',
64
+ message: 'Absolute path to .ssp file',
65
+ },
66
+ {
67
+ type: 'input',
68
+ name: 'author',
69
+ message: 'Integration Author',
70
+ default: 'Swimlane',
71
+ },
72
+ {
73
+ type: 'input',
74
+ name: 'authorEmail',
75
+ message: 'Integration Author Email',
76
+ default: 'info@swimlane.com',
77
+ },
78
+ {
79
+ type: 'input',
80
+ name: 'homepage',
81
+ message: 'Author URL',
82
+ default: 'https://swimlane.com',
83
+ }];
84
+ const filteredQuestions = masterQuestions.filter(q => !flags[q.name]);
85
+ const answers = Object.assign(await inquirer_1.default.prompt(filteredQuestions), flags);
86
+ const componentType = answers.componentType;
87
+ const errors = [];
88
+ if (!answers.vendor) {
89
+ errors.push('Vendor Field is required.');
90
+ }
91
+ if (!answers.componentName) {
92
+ errors.push('Component Name is required.');
93
+ }
94
+ const name = (0, snake_case_1.snakeCase)(`${answers.vendor} ${answers.componentName}`.toLocaleLowerCase());
95
+ const componentDirectory = (0, node_path_1.join)(directory, componentType, `${name}`);
96
+ await (0, fs_extra_1.ensureDir)(componentDirectory);
97
+ const component = {
98
+ vendor: answers.vendor,
99
+ name: name,
100
+ schema: 'component/1',
101
+ author: answers.author,
102
+ bugs: '',
103
+ iconImage: '../image/logo.png',
104
+ description: answers.description,
105
+ homepage: answers.homepage,
106
+ license: 'AGPL-3.0',
107
+ title: await (0, connector_1.titleCaseString)(`${answers.vendor} ${answers.componentName}`),
108
+ version: '0.0.0',
109
+ componentType: componentType,
110
+ keywords: answers.keywords.split(',').map(x => x.trim()),
111
+ };
112
+ core_1.ux.action.start('Generating folder structure.');
113
+ if (answers.logoPath?.endsWith('.png') || answers.logoPath?.endsWith('.jpg') || answers.logoPath?.endsWith('.jpeg')) {
114
+ core_1.ux.action.start('Processing Logo');
115
+ await (0, connector_1.updateImage)(componentDirectory, answers.logoPath);
116
+ core_1.ux.action.stop();
117
+ }
118
+ else {
119
+ core_1.ux.action.stop();
120
+ errors.push('Invalid logo file provided');
121
+ }
122
+ if (answers.sspPath?.endsWith('.ssp')) {
123
+ core_1.ux.action.start('Processing SSP File');
124
+ const destinationPath = path.join(componentDirectory, `${name}.ssp`);
125
+ await fs.promises.copyFile(answers.sspPath, destinationPath);
126
+ core_1.ux.action.stop();
127
+ }
128
+ else {
129
+ errors.push('Invalid ssp file provided');
130
+ }
131
+ if (errors.length > 0) {
132
+ core_1.ux.action.stop();
133
+ return this.error(errors.join('\n'));
134
+ }
135
+ const manifestFilePath = (0, node_path_1.join)(componentDirectory, 'manifest.yml');
136
+ await (0, fs_extra_1.writeFile)(manifestFilePath, js_yaml_1.default.dump(component, {
137
+ indent: 2,
138
+ noRefs: true,
139
+ }));
140
+ await (0, fs_extra_1.writeFile)((0, node_path_1.join)(componentDirectory, 'external.yml'), '', 'utf8');
141
+ await (0, fs_extra_1.writeFile)((0, node_path_1.join)(componentDirectory, 'README.md'), 'Description will be updated shortly.', 'utf8');
142
+ await (0, fs_extra_1.writeFile)((0, node_path_1.join)(componentDirectory, 'EXTERNAL_README.md'), 'Description will be updated shortly.', 'utf8');
143
+ await (0, fs_extra_1.writeFile)((0, node_path_1.join)(componentDirectory, 'documentation.README.md'), 'Description will be updated shortly.', 'utf8');
144
+ core_1.ux.action.stop();
145
+ }
146
+ }
147
+ exports.Create = Create;
148
+ Create.description = 'Scaffold a new Component';
149
+ Create.flags = {
150
+ ...core_2.Base.flags,
151
+ directory: core_1.Flags.string({
152
+ char: 'd',
153
+ description: 'root directory for where to store Component.',
154
+ default: './',
155
+ }),
156
+ componentType: core_1.Flags.string({ description: 'Component Type (e.g. classic)' }),
157
+ vendor: core_1.Flags.string({ description: 'Vendor (e.g. CrowdStrike)' }),
158
+ componentName: core_1.Flags.string({ description: 'Component Name (e.g. Alert Ingestion)' }),
159
+ keywords: core_1.Flags.string({ description: 'Enter keywords' }),
160
+ description: core_1.Flags.string({ description: 'Description (e.g. CrowdStrike Alert Ingestion Component)' }),
161
+ logoPath: core_1.Flags.string({ description: 'URL or absolute path to logo file' }),
162
+ sspPath: core_1.Flags.string({ description: 'absolute path to .ssp file' }),
163
+ author: core_1.Flags.string({ description: 'Component Author' }),
164
+ authorEmail: core_1.Flags.string({ description: 'Component Author Email' }),
165
+ homepage: core_1.Flags.string({ description: 'Component Author Support URL' }),
166
+ help: core_1.Flags.help({ char: 'h' }),
167
+ };
168
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/component/create.ts"],"names":[],"mappings":";;;;AAAA,sCAAqC;AACrC,kDAA+D;AAC/D,wCAAkC;AAClC,uCAA6C;AAC7C,gEAA+B;AAC/B,8DAA0B;AAC1B,oDAA6B;AAC7B,qCAAgC;AAChC,wDAAiC;AACjC,yCAAuC;AACvC,2CAAoC;AACpC,yCAAmE;AAkBnE,qCAAqC;AACrC,MAAa,MAAO,SAAQ,WAAI;IAuB9B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAExC,IAAI,EAAC,SAAS,EAAC,GAAG,KAAK,CAAA;QACvB,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAE/C,IAAI;YACF,MAAM,kBAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;SACjC;QAAC,MAAM;YACN,IAAI,CAAC,KAAK,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAA;SAC5C;QAED,MAAM,eAAe,GAAG,CAAC;gBACvB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,uBAAuB;gBAChC,OAAO,EAAE,0BAAiB;aAC3B;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2BAA2B;aACrC;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,uCAAuC;aACjD;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,0DAA0D;aACpE;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,qCAAqC;gBAC9C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AAC;IACrE,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC;CAC9B,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { Base } from '@sw-tsdk/core';
2
+ export declare class Logo extends Base {
3
+ static description: string;
4
+ static flags: {
5
+ directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
6
+ componentType: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ componentName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ logoPath: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Logo = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
6
+ const connector_1 = require("@sw-tsdk/connector");
7
+ const core_2 = require("@sw-tsdk/core");
8
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
9
+ const node_path_1 = require("node:path");
10
+ const common_1 = require("../../common");
11
+ // noinspection JSUnusedGlobalSymbols
12
+ class Logo extends core_2.Base {
13
+ async run() {
14
+ const { flags } = await this.parse(Logo);
15
+ let { directory } = flags;
16
+ directory = (0, node_path_1.resolve)(directory || process.cwd());
17
+ const masterQuestions = [
18
+ {
19
+ type: 'input',
20
+ name: 'logoPath',
21
+ message: 'URL or absolute path to logo file',
22
+ },
23
+ ];
24
+ const componentTypeSelected = await (0, common_1.chooseComponentType)();
25
+ const componentNameSelected = await (0, common_1.chooseComponentName)(directory, componentTypeSelected);
26
+ const filteredQuestions = masterQuestions.filter(q => !flags[q.name]);
27
+ const answers = Object.assign(await inquirer_1.default.prompt(filteredQuestions), flags);
28
+ const componentDirectory = (0, node_path_1.join)(directory, componentTypeSelected, componentNameSelected);
29
+ if (answers.logoPath?.endsWith('.png') || answers.logoPath?.endsWith('.jpg') || answers.logoPath?.endsWith('.jpeg')) {
30
+ core_1.ux.action.start('Updating Logo');
31
+ await (0, connector_1.updateImage)(componentDirectory, answers.logoPath);
32
+ core_1.ux.action.stop();
33
+ }
34
+ else {
35
+ core_1.ux.action.stop();
36
+ this.error('Invalid logo file provided');
37
+ }
38
+ }
39
+ }
40
+ exports.Logo = Logo;
41
+ Logo.description = 'Update a Component logo.';
42
+ Logo.flags = {
43
+ ...core_2.Base.flags,
44
+ directory: core_1.Flags.string({
45
+ char: 'd',
46
+ description: 'root directory of the component folder.',
47
+ default: './',
48
+ }),
49
+ componentType: core_1.Flags.string({
50
+ description: 'Component Type (e.g. classic)',
51
+ char: 't',
52
+ }),
53
+ componentName: core_1.Flags.string({
54
+ description: 'Component Name (e.g. google_alert_ingestion)',
55
+ char: 'n',
56
+ }),
57
+ logoPath: core_1.Flags.string({
58
+ char: 'p',
59
+ description: 'path or URL to product logo in PNG format.',
60
+ }),
61
+ help: core_1.Flags.help({ char: 'h' }),
62
+ };
63
+ //# sourceMappingURL=logo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logo.js","sourceRoot":"","sources":["../../../src/commands/component/logo.ts"],"names":[],"mappings":";;;;AAAA,sCAAqC;AACrC,kDAA8C;AAC9C,wCAAkC;AAClC,gEAA+B;AAC/B,yCAAuC;AAEvC,yCAAqE;AAGrE,qCAAqC;AACrC,MAAa,IAAK,SAAQ,WAAI;IAyB1B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAEtC,IAAI,EAAC,SAAS,EAAC,GAAG,KAAK,CAAA;QACvB,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,IAAI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AAC,KAAK;IACb,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yCAAyC;QACtD,OAAO,EAAE,IAAI;KACd,CAAC;IACF,aAAa,EAAE,YAAK,CAAC,MAAM,CAAC;QAC1B,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,GAAG;KACV,CAAC;IACF,aAAa,EAAE,YAAK,CAAC,MAAM,CAAC;QAC1B,WAAW,EAAE,8CAA8C;QAC3D,IAAI,EAAE,GAAG;KACV,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4CAA4C;KAC1D,CAAC;IACF,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC;CAC9B,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { Base } from '@sw-tsdk/core';
2
+ export declare class Logo extends Base {
3
+ static description: string;
4
+ static flags: {
5
+ directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
6
+ componentType: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ componentName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ sspPath: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
10
+ };
11
+ run(): Promise<void>;
12
+ }