@sw-tsdk/plugin-connector 2.18.0 → 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.18.0 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
@@ -43,6 +43,9 @@ USAGE
43
43
  * [`sw-tsdk-connector connector:sign`](#sw-tsdk-connector-connectorsign)
44
44
  * [`sw-tsdk-connector connector:update`](#sw-tsdk-connector-connectorupdate)
45
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)
46
49
 
47
50
  ## `sw-tsdk-connector action:add`
48
51
 
@@ -62,7 +65,7 @@ DESCRIPTION
62
65
  Update a connector action.
63
66
  ```
64
67
 
65
- _See code: [lib/commands/action/add.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
66
69
 
67
70
  ## `sw-tsdk-connector action:generate:data`
68
71
 
@@ -87,7 +90,7 @@ DESCRIPTION
87
90
  Use to test a task in an integration
88
91
  ```
89
92
 
90
- _See code: [lib/commands/action/generate/data.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
91
94
 
92
95
  ## `sw-tsdk-connector action:generate:input`
93
96
 
@@ -112,7 +115,7 @@ DESCRIPTION
112
115
  Update action input schema.
113
116
  ```
114
117
 
115
- _See code: [lib/commands/action/generate/input.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
116
119
 
117
120
  ## `sw-tsdk-connector action:generate:output`
118
121
 
@@ -136,7 +139,7 @@ DESCRIPTION
136
139
  Update a connector action.
137
140
  ```
138
141
 
139
- _See code: [lib/commands/action/generate/output.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
140
143
 
141
144
  ## `sw-tsdk-connector action:run:local`
142
145
 
@@ -165,7 +168,7 @@ DESCRIPTION
165
168
  Runs a connector action. (Defaults to current image version in local repository).
166
169
  ```
167
170
 
168
- _See code: [lib/commands/action/run/local.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
169
172
 
170
173
  ## `sw-tsdk-connector asset:add`
171
174
 
@@ -186,7 +189,7 @@ DESCRIPTION
186
189
  Update a connector action.
187
190
  ```
188
191
 
189
- _See code: [lib/commands/asset/add.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
190
193
 
191
194
  ## `sw-tsdk-connector component:create`
192
195
 
@@ -216,7 +219,7 @@ DESCRIPTION
216
219
  Scaffold a new Component
217
220
  ```
218
221
 
219
- _See code: [lib/commands/component/create.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/lib/commands/component/create.js)_
222
+ _See code: [lib/commands/component/create.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/create.js)_
220
223
 
221
224
  ## `sw-tsdk-connector component:logo`
222
225
 
@@ -237,7 +240,7 @@ DESCRIPTION
237
240
  Update a Component logo.
238
241
  ```
239
242
 
240
- _See code: [lib/commands/component/logo.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/lib/commands/component/logo.js)_
243
+ _See code: [lib/commands/component/logo.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/logo.js)_
241
244
 
242
245
  ## `sw-tsdk-connector component:ssp`
243
246
 
@@ -258,7 +261,7 @@ DESCRIPTION
258
261
  Update an SSP.
259
262
  ```
260
263
 
261
- _See code: [lib/commands/component/ssp.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/lib/commands/component/ssp.js)_
264
+ _See code: [lib/commands/component/ssp.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/ssp.js)_
262
265
 
263
266
  ## `sw-tsdk-connector component:update`
264
267
 
@@ -280,7 +283,7 @@ DESCRIPTION
280
283
  Update Component Version.
281
284
  ```
282
285
 
283
- _See code: [lib/commands/component/update.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/lib/commands/component/update.js)_
286
+ _See code: [lib/commands/component/update.js](https://github.com/swimlane/turbine-sdk/blob/v2.19.0/lib/commands/component/update.js)_
284
287
 
285
288
  ## `sw-tsdk-connector connector:build`
286
289
 
@@ -310,7 +313,7 @@ DESCRIPTION
310
313
  Builds a local docker image of the connector.
311
314
  ```
312
315
 
313
- _See code: [lib/commands/connector/build.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
314
317
 
315
318
  ## `sw-tsdk-connector connector:create`
316
319
 
@@ -342,7 +345,7 @@ DESCRIPTION
342
345
  Scaffold a new connector
343
346
  ```
344
347
 
345
- _See code: [lib/commands/connector/create.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
346
349
 
347
350
  ## `sw-tsdk-connector connector:create:openapi`
348
351
 
@@ -371,7 +374,7 @@ DESCRIPTION
371
374
  Scaffold a new connector
372
375
  ```
373
376
 
374
- _See code: [lib/commands/connector/create/openapi.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
375
378
 
376
379
  ## `sw-tsdk-connector connector:create:source`
377
380
 
@@ -389,7 +392,7 @@ DESCRIPTION
389
392
  Generates 11x source from 10x
390
393
  ```
391
394
 
392
- _See code: [lib/commands/connector/create/source.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
393
396
 
394
397
  ## `sw-tsdk-connector connector:logo`
395
398
 
@@ -408,7 +411,7 @@ DESCRIPTION
408
411
  Update a connector.
409
412
  ```
410
413
 
411
- _See code: [lib/commands/connector/logo.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
412
415
 
413
416
  ## `sw-tsdk-connector connector:sign`
414
417
 
@@ -433,7 +436,7 @@ DESCRIPTION
433
436
  Builds a local docker image of the connector.
434
437
  ```
435
438
 
436
- _See code: [lib/commands/connector/sign.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
437
440
 
438
441
  ## `sw-tsdk-connector connector:update`
439
442
 
@@ -453,7 +456,7 @@ DESCRIPTION
453
456
  Update a connector.
454
457
  ```
455
458
 
456
- _See code: [lib/commands/connector/update.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
457
460
 
458
461
  ## `sw-tsdk-connector connector:validate`
459
462
 
@@ -476,5 +479,66 @@ DESCRIPTION
476
479
  Use to validate an integration
477
480
  ```
478
481
 
479
- _See code: [lib/commands/connector/validate.js](https://github.com/swimlane/turbine-sdk/blob/v2.18.0/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)_
480
544
  <!-- commandsstop -->
@@ -0,0 +1,12 @@
1
+ import { Base } from '@sw-tsdk/core';
2
+ export declare class Action extends Base {
3
+ static description: string;
4
+ static flags: {
5
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
+ image: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ 'skip-pull': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ action: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Action = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const node_path_1 = require("node:path");
6
+ const docker_1 = require("@sw-tsdk/docker");
7
+ const core_2 = require("@oclif/core");
8
+ const node_fs_1 = require("node:fs");
9
+ const core_3 = require("@sw-tsdk/core");
10
+ const common_1 = require("../../common");
11
+ // noinspection JSUnusedGlobalSymbols
12
+ class Action extends core_3.Base {
13
+ async run() {
14
+ const { flags } = await this.parse(Action);
15
+ const { 'skip-pull': skipPull, action, } = flags;
16
+ let { image } = flags;
17
+ let { directory } = flags;
18
+ directory = (0, node_path_1.resolve)(directory);
19
+ const typeOfContent = 'action';
20
+ if (!image) {
21
+ image = `${docker_1.DockerDefaults.SdkTurbineContentDescriptionImage}`;
22
+ }
23
+ try {
24
+ await node_fs_1.promises.access(directory);
25
+ }
26
+ catch {
27
+ this.error(`Could not access ${directory}`);
28
+ }
29
+ const docker = new docker_1.Docker();
30
+ core_2.ux.action.start('Checking for docker...');
31
+ await docker.ping();
32
+ core_2.ux.action.stop();
33
+ if (!skipPull) {
34
+ core_2.ux.action.start(`Pulling image (${image})...`);
35
+ await docker.pullImage(image);
36
+ core_2.ux.action.stop();
37
+ }
38
+ const actionToExecute = action || await (0, common_1.chooseAction)(directory);
39
+ const bindings = [`${directory}:/app/content`];
40
+ const commands = ['main.py'];
41
+ commands.push('-t', typeOfContent, '-a', actionToExecute);
42
+ const envVars = [
43
+ `OPENAI_API_KEY=${process.env.OPENAI_API_KEY}`,
44
+ `OPENAI_ORGANIZATION=${process.env.OPENAI_ORGANIZATION}`,
45
+ ];
46
+ const createOptions = {
47
+ Cmd: commands,
48
+ HostConfig: {
49
+ AutoRemove: false,
50
+ Binds: bindings,
51
+ },
52
+ Env: envVars,
53
+ };
54
+ core_2.ux.action.start('Generating Action Description...');
55
+ const outputStream = (0, core_3.writableNoopStream)();
56
+ const errorStream = (0, core_3.writableNoopStream)();
57
+ const success = await docker.runImage(image, createOptions, outputStream, errorStream);
58
+ core_2.ux.action.stop();
59
+ if (!success) {
60
+ core_2.Errors.exit(1);
61
+ }
62
+ }
63
+ }
64
+ exports.Action = Action;
65
+ Action.description = 'Use to generate action description';
66
+ Action.flags = {
67
+ ...core_3.Base.flags,
68
+ help: core_1.Flags.help({ char: 'h' }),
69
+ image: core_1.Flags.string({
70
+ char: 'i',
71
+ description: 'image to use',
72
+ }),
73
+ 'skip-pull': core_1.Flags.boolean({
74
+ char: 's',
75
+ description: 'skips pulling the image',
76
+ }),
77
+ directory: core_1.Flags.string({
78
+ char: 'd',
79
+ description: 'current directory to mount',
80
+ default: './',
81
+ }),
82
+ action: core_1.Flags.string({
83
+ char: 'a',
84
+ description: 'Generate description for specific action',
85
+ }),
86
+ };
87
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/commands/description/action.ts"],"names":[],"mappings":";;;AAAA,sCAAiC;AACjC,yCAAiC;AACjC,4CAAsD;AACtD,sCAAsC;AACtC,qCAAgC;AAChC,wCAAsD;AACtD,yCAAyC;AAEzC,qCAAqC;AACrC,MAAa,MAAO,SAAQ,WAAI;IAyB9B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACxC,MAAM,EACJ,WAAW,EAAE,QAAQ,EAAE,MAAM,GAC9B,GAAG,KAAK,CAAA;QACT,IAAI,EAAC,KAAK,EAAC,GAAG,KAAK,CAAA;QAEnB,IAAI,EAAC,SAAS,EAAC,GAAG,KAAK,CAAA;QACvB,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,CAAC,CAAA;QAE9B,MAAM,aAAa,GAAG,QAAQ,CAAA;QAC9B,IAAI,CAAC,KAAK,EAAE;YACV,KAAK,GAAG,GAAG,uBAAc,CAAC,iCAAiC,EAAE,CAAA;SAC9D;QAED,IAAI;YACF,MAAM,kBAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;SACjC;QAAC,MAAM;YACN,IAAI,CAAC,KAAK,CAAC,oBAAoB,SAAS,EA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KAAK,EACL,aAAa,EACb,YAAY,EACZ,WAAW,CACZ,CAAA;QACD,SAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;QAChB,IAAI,CAAC,OAAO,EAAE;YACZ,aAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SACf;IACH,CAAC;;AA5FH,wBA6FC;AA5FQ,kBAAW,GAAG,oCAAoC,CAAC;AAEnD,YAAK,GAAG;IACb,GAAG,WAAI,CAAC,KAAK;IACb,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC;IAC7B,KAAK,EAAE,YAAK,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,cAAc;KAC5B,CAAC;IACF,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yBAAyB;KACvC,CAAC;IACF,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4BAA4B;QACzC,OAAO,EAAE,IAAI;KACd,CAAC;IACF,MAAM,EAAE,YAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,0CAA0C;KACxD,CAAC;CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Base } from '@sw-tsdk/core';
2
+ export declare class Actions extends Base {
3
+ static description: string;
4
+ static flags: {
5
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
+ image: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ 'skip-pull': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Actions = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const node_path_1 = require("node:path");
6
+ const docker_1 = require("@sw-tsdk/docker");
7
+ const core_2 = require("@oclif/core");
8
+ const node_fs_1 = require("node:fs");
9
+ const core_3 = require("@sw-tsdk/core");
10
+ // noinspection JSUnusedGlobalSymbols
11
+ class Actions extends core_3.Base {
12
+ async run() {
13
+ const { flags } = await this.parse(Actions);
14
+ const { 'skip-pull': skipPull, } = flags;
15
+ let { image } = flags;
16
+ let { directory } = flags;
17
+ directory = (0, node_path_1.resolve)(directory);
18
+ const typeOfContent = 'actions';
19
+ if (!image) {
20
+ image = `${docker_1.DockerDefaults.SdkTurbineContentDescriptionImage}`;
21
+ }
22
+ try {
23
+ await node_fs_1.promises.access(directory);
24
+ }
25
+ catch {
26
+ this.error(`Could not access ${directory}`);
27
+ }
28
+ const docker = new docker_1.Docker();
29
+ core_2.ux.action.start('Checking for docker...');
30
+ await docker.ping();
31
+ core_2.ux.action.stop();
32
+ if (!skipPull) {
33
+ core_2.ux.action.start(`Pulling image (${image})...`);
34
+ await docker.pullImage(image);
35
+ core_2.ux.action.stop();
36
+ }
37
+ const bindings = [`${directory}:/app/content`];
38
+ const commands = ['main.py'];
39
+ commands.push('-t', typeOfContent);
40
+ const envVars = [
41
+ `OPENAI_API_KEY=${process.env.OPENAI_API_KEY}`,
42
+ `OPENAI_ORGANIZATION=${process.env.OPENAI_ORGANIZATION}`,
43
+ ];
44
+ const createOptions = {
45
+ Cmd: commands,
46
+ HostConfig: {
47
+ AutoRemove: false,
48
+ Binds: bindings,
49
+ },
50
+ Env: envVars,
51
+ };
52
+ core_2.ux.action.start('Generating Actions Description...');
53
+ const outputStream = (0, core_3.writableNoopStream)();
54
+ const errorStream = (0, core_3.writableNoopStream)();
55
+ const success = await docker.runImage(image, createOptions, outputStream, errorStream);
56
+ core_2.ux.action.stop();
57
+ if (!success) {
58
+ core_2.Errors.exit(1);
59
+ }
60
+ }
61
+ }
62
+ exports.Actions = Actions;
63
+ Actions.description = 'Use to generate description for all actions';
64
+ Actions.flags = {
65
+ ...core_3.Base.flags,
66
+ help: core_1.Flags.help({ char: 'h' }),
67
+ image: core_1.Flags.string({
68
+ char: 'i',
69
+ description: 'image to use',
70
+ }),
71
+ 'skip-pull': core_1.Flags.boolean({
72
+ char: 's',
73
+ description: 'skips pulling the image',
74
+ }),
75
+ directory: core_1.Flags.string({
76
+ char: 'd',
77
+ description: 'current directory to mount',
78
+ default: './',
79
+ }),
80
+ };
81
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/commands/description/actions.ts"],"names":[],"mappings":";;;AAAA,sCAAiC;AACjC,yCAAiC;AACjC,4CAAsD;AACtD,sCAAsC;AACtC,qCAAgC;AAChC,wCAAsD;AAEtD,qCAAqC;AACrC,MAAa,OAAQ,SAAQ,WAAI;IAqB/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACzC,MAAM,EACJ,WAAW,EAAE,QAAQ,GACtB,GAAG,KAAK,CAAA;QACT,IAAI,EAAC,KAAK,EAAC,GAAG,KAAK,CAAA;QAEnB,IAAI,EAAC,SAAS,EAAC,GAAG,KAAK,CAAA;QACvB,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,CAAC,CAAA;QAE9B,MAAM,aAAa,GAAG,SAAS,CAAA;QAC/B,IAAI,CAAC,KAAK,EAAE;YACV,KAAK,GAAG,GAAG,uBAAc,CAAC,iCAAiC,EAAE,CAAA;SAC9D;QAED,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,MAAM,GAAG,IAAI,eAAM,E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CAAC,CAAA;SACf;IACH,CAAC;;AAtFH,0BAuFC;AAtFQ,mBAAW,GAAG,6CAA6C,CAAC;AAE5D,aAAK,GAAG;IACb,GAAG,WAAI,CAAC,KAAK;IACb,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC;IAC7B,KAAK,EAAE,YAAK,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,cAAc;KAC5B,CAAC;IACF,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yBAAyB;KACvC,CAAC;IACF,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4BAA4B;QACzC,OAAO,EAAE,IAAI;KACd,CAAC;CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Base } from '@sw-tsdk/core';
2
+ export declare class Connector extends Base {
3
+ static description: string;
4
+ static flags: {
5
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
+ image: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ 'skip-pull': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Connector = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const node_path_1 = require("node:path");
6
+ const docker_1 = require("@sw-tsdk/docker");
7
+ const core_2 = require("@oclif/core");
8
+ const node_fs_1 = require("node:fs");
9
+ const core_3 = require("@sw-tsdk/core");
10
+ // noinspection JSUnusedGlobalSymbols
11
+ class Connector extends core_3.Base {
12
+ async run() {
13
+ const { flags } = await this.parse(Connector);
14
+ const { 'skip-pull': skipPull, } = flags;
15
+ let { image } = flags;
16
+ let { directory } = flags;
17
+ directory = (0, node_path_1.resolve)(directory);
18
+ const typeOfContent = 'connector';
19
+ if (!image) {
20
+ image = `${docker_1.DockerDefaults.SdkTurbineContentDescriptionImage}`;
21
+ }
22
+ try {
23
+ await node_fs_1.promises.access(directory);
24
+ }
25
+ catch {
26
+ this.error(`Could not access ${directory}`);
27
+ }
28
+ const docker = new docker_1.Docker();
29
+ core_2.ux.action.start('Checking for docker...');
30
+ await docker.ping();
31
+ core_2.ux.action.stop();
32
+ if (!skipPull) {
33
+ core_2.ux.action.start(`Pulling image (${image})...`);
34
+ await docker.pullImage(image);
35
+ core_2.ux.action.stop();
36
+ }
37
+ const bindings = [`${directory}:/app/content`];
38
+ const commands = ['main.py'];
39
+ commands.push('-t', typeOfContent);
40
+ const envVars = [
41
+ `OPENAI_API_KEY=${process.env.OPENAI_API_KEY}`,
42
+ `OPENAI_ORGANIZATION=${process.env.OPENAI_ORGANIZATION}`,
43
+ ];
44
+ const createOptions = {
45
+ Cmd: commands,
46
+ HostConfig: {
47
+ AutoRemove: false,
48
+ Binds: bindings,
49
+ },
50
+ Env: envVars,
51
+ };
52
+ core_2.ux.action.start('Generating Connector Description...');
53
+ const outputStream = (0, core_3.writableNoopStream)();
54
+ const errorStream = (0, core_3.writableNoopStream)();
55
+ const success = await docker.runImage(image, createOptions, outputStream, errorStream);
56
+ core_2.ux.action.stop();
57
+ if (!success) {
58
+ core_2.Errors.exit(1);
59
+ }
60
+ }
61
+ }
62
+ exports.Connector = Connector;
63
+ Connector.description = 'Use to generate connector descriptions';
64
+ Connector.flags = {
65
+ ...core_3.Base.flags,
66
+ help: core_1.Flags.help({ char: 'h' }),
67
+ image: core_1.Flags.string({
68
+ char: 'i',
69
+ description: 'image to use',
70
+ }),
71
+ 'skip-pull': core_1.Flags.boolean({
72
+ char: 's',
73
+ description: 'skips pulling the image',
74
+ }),
75
+ directory: core_1.Flags.string({
76
+ char: 'd',
77
+ description: 'current directory to mount',
78
+ default: './',
79
+ }),
80
+ };
81
+ //# sourceMappingURL=connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.js","sourceRoot":"","sources":["../../../src/commands/description/connector.ts"],"names":[],"mappings":";;;AAAA,sCAAiC;AACjC,yCAAiC;AACjC,4CAAsD;AACtD,sCAAsC;AACtC,qCAAgC;AAChC,wCAAsD;AAEtD,qCAAqC;AACrC,MAAa,SAAU,SAAQ,WAAI;IAqBjC,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QAC3C,MAAM,EACJ,WAAW,EAAE,QAAQ,GACtB,GAAG,KAAK,CAAA;QACT,IAAI,EAAC,KAAK,EAAC,GAAG,KAAK,CAAA;QAEnB,IAAI,EAAC,SAAS,EAAC,GAAG,KAAK,CAAA;QACvB,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,CAAC,CAAA;QAE9B,MAAM,aAAa,GAAG,WAAW,CAAA;QACjC,IAAI,CAAC,KAAK,EAAE;YACV,KAAK,GAAG,GAAG,uBAAc,CAAC,iCAAiC,EAAE,CAAA;SAC9D;QAED,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,MAAM,GAAG,IAAI,eAAM,EAAE,CAAA;QAC3B,SAAE,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;QACzC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;QACnB,SAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;QAEhB,IAAI,CAAC,QAAQ,EAAE;YACb,SAAE,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,KAAK,MAAM,CAAC,CA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GAAG;QACT,WAAW,EAAE,cAAc;KAC5B,CAAC;IACF,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yBAAyB;KACvC,CAAC;IACF,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4BAA4B;QACzC,OAAO,EAAE,IAAI;KACd,CAAC;CACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.18.0",
2
+ "version": "2.19.0",
3
3
  "commands": {
4
4
  "action:add": {
5
5
  "id": "action:add",
@@ -757,6 +757,136 @@
757
757
  },
758
758
  "args": {}
759
759
  },
760
+ "description:action": {
761
+ "id": "description:action",
762
+ "description": "Use to generate action description",
763
+ "strict": true,
764
+ "pluginName": "@sw-tsdk/plugin-connector",
765
+ "pluginAlias": "@sw-tsdk/plugin-connector",
766
+ "pluginType": "core",
767
+ "aliases": [],
768
+ "flags": {
769
+ "help": {
770
+ "name": "help",
771
+ "type": "boolean",
772
+ "char": "h",
773
+ "description": "Show CLI help.",
774
+ "allowNo": false
775
+ },
776
+ "image": {
777
+ "name": "image",
778
+ "type": "option",
779
+ "char": "i",
780
+ "description": "image to use",
781
+ "multiple": false
782
+ },
783
+ "skip-pull": {
784
+ "name": "skip-pull",
785
+ "type": "boolean",
786
+ "char": "s",
787
+ "description": "skips pulling the image",
788
+ "allowNo": false
789
+ },
790
+ "directory": {
791
+ "name": "directory",
792
+ "type": "option",
793
+ "char": "d",
794
+ "description": "current directory to mount",
795
+ "multiple": false,
796
+ "default": "./"
797
+ },
798
+ "action": {
799
+ "name": "action",
800
+ "type": "option",
801
+ "char": "a",
802
+ "description": "Generate description for specific action",
803
+ "multiple": false
804
+ }
805
+ },
806
+ "args": {}
807
+ },
808
+ "description:actions": {
809
+ "id": "description:actions",
810
+ "description": "Use to generate description for all actions",
811
+ "strict": true,
812
+ "pluginName": "@sw-tsdk/plugin-connector",
813
+ "pluginAlias": "@sw-tsdk/plugin-connector",
814
+ "pluginType": "core",
815
+ "aliases": [],
816
+ "flags": {
817
+ "help": {
818
+ "name": "help",
819
+ "type": "boolean",
820
+ "char": "h",
821
+ "description": "Show CLI help.",
822
+ "allowNo": false
823
+ },
824
+ "image": {
825
+ "name": "image",
826
+ "type": "option",
827
+ "char": "i",
828
+ "description": "image to use",
829
+ "multiple": false
830
+ },
831
+ "skip-pull": {
832
+ "name": "skip-pull",
833
+ "type": "boolean",
834
+ "char": "s",
835
+ "description": "skips pulling the image",
836
+ "allowNo": false
837
+ },
838
+ "directory": {
839
+ "name": "directory",
840
+ "type": "option",
841
+ "char": "d",
842
+ "description": "current directory to mount",
843
+ "multiple": false,
844
+ "default": "./"
845
+ }
846
+ },
847
+ "args": {}
848
+ },
849
+ "description:connector": {
850
+ "id": "description:connector",
851
+ "description": "Use to generate connector descriptions",
852
+ "strict": true,
853
+ "pluginName": "@sw-tsdk/plugin-connector",
854
+ "pluginAlias": "@sw-tsdk/plugin-connector",
855
+ "pluginType": "core",
856
+ "aliases": [],
857
+ "flags": {
858
+ "help": {
859
+ "name": "help",
860
+ "type": "boolean",
861
+ "char": "h",
862
+ "description": "Show CLI help.",
863
+ "allowNo": false
864
+ },
865
+ "image": {
866
+ "name": "image",
867
+ "type": "option",
868
+ "char": "i",
869
+ "description": "image to use",
870
+ "multiple": false
871
+ },
872
+ "skip-pull": {
873
+ "name": "skip-pull",
874
+ "type": "boolean",
875
+ "char": "s",
876
+ "description": "skips pulling the image",
877
+ "allowNo": false
878
+ },
879
+ "directory": {
880
+ "name": "directory",
881
+ "type": "option",
882
+ "char": "d",
883
+ "description": "current directory to mount",
884
+ "multiple": false,
885
+ "default": "./"
886
+ }
887
+ },
888
+ "args": {}
889
+ },
760
890
  "action:generate:data": {
761
891
  "id": "action:generate:data",
762
892
  "description": "Use to test a task in an integration",
package/package.json CHANGED
@@ -6,10 +6,10 @@
6
6
  "dependencies": {
7
7
  "@apidevtools/json-schema-ref-parser": "10.1.0",
8
8
  "@oclif/core": "2.8.5",
9
- "@sw-tsdk/common": "^2.18.0",
10
- "@sw-tsdk/connector": "^2.18.0",
11
- "@sw-tsdk/core": "^2.18.0",
12
- "@sw-tsdk/docker": "^2.18.0",
9
+ "@sw-tsdk/common": "^2.19.0",
10
+ "@sw-tsdk/connector": "^2.19.0",
11
+ "@sw-tsdk/core": "^2.19.0",
12
+ "@sw-tsdk/docker": "^2.19.0",
13
13
  "@swimlane/connector-interfaces": "1.11.0",
14
14
  "@swimlane/cosign": "1.4.1",
15
15
  "@swimlane/docker-reference": "2.0.1",
@@ -67,6 +67,12 @@
67
67
  },
68
68
  "connectors": {
69
69
  "description": "Local connectors commands"
70
+ },
71
+ "component": {
72
+ "description": "Local component commands"
73
+ },
74
+ "description": {
75
+ "description": "Local description commands"
70
76
  }
71
77
  }
72
78
  },
@@ -89,6 +95,6 @@
89
95
  "posttest": "yarn lint",
90
96
  "dev:setup": "npm link"
91
97
  },
92
- "version": "2.18.0",
93
- "gitHead": "e6a84357aa223deda77b786a7633c63b0d9c7158"
98
+ "version": "2.19.0",
99
+ "gitHead": "bc3713cc4df54c48dff7e8bf2444cc0cfb1cb7e7"
94
100
  }