@sw-tsdk/plugin-connector 0.1.1-next.23
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/LICENSE +8 -0
- package/README.md +341 -0
- package/lib/commands/action/add.d.ts +10 -0
- package/lib/commands/action/add.js +88 -0
- package/lib/commands/action/add.js.map +1 -0
- package/lib/commands/action/input.d.ts +13 -0
- package/lib/commands/action/input.js +69 -0
- package/lib/commands/action/input.js.map +1 -0
- package/lib/commands/action/output.d.ts +13 -0
- package/lib/commands/action/output.js +68 -0
- package/lib/commands/action/output.js.map +1 -0
- package/lib/commands/action/run.d.ts +23 -0
- package/lib/commands/action/run.js +142 -0
- package/lib/commands/action/run.js.map +1 -0
- package/lib/commands/asset/add.d.ts +10 -0
- package/lib/commands/asset/add.js +50 -0
- package/lib/commands/asset/add.js.map +1 -0
- package/lib/commands/connector/build.d.ts +17 -0
- package/lib/commands/connector/build.js +71 -0
- package/lib/commands/connector/build.js.map +1 -0
- package/lib/commands/connector/create-source.d.ts +9 -0
- package/lib/commands/connector/create-source.js +31 -0
- package/lib/commands/connector/create-source.js.map +1 -0
- package/lib/commands/connector/create.d.ts +21 -0
- package/lib/commands/connector/create.js +169 -0
- package/lib/commands/connector/create.js.map +1 -0
- package/lib/commands/connector/logo.d.ts +10 -0
- package/lib/commands/connector/logo.js +31 -0
- package/lib/commands/connector/logo.js.map +1 -0
- package/lib/commands/connector/save.d.ts +12 -0
- package/lib/commands/connector/save.js +37 -0
- package/lib/commands/connector/save.js.map +1 -0
- package/lib/commands/connector/sign.d.ts +15 -0
- package/lib/commands/connector/sign.js +58 -0
- package/lib/commands/connector/sign.js.map +1 -0
- package/lib/commands/connector/update.d.ts +11 -0
- package/lib/commands/connector/update.js +54 -0
- package/lib/commands/connector/update.js.map +1 -0
- package/lib/commands/connector/validate.d.ts +14 -0
- package/lib/commands/connector/validate.js +90 -0
- package/lib/commands/connector/validate.js.map +1 -0
- package/lib/common.d.ts +3 -0
- package/lib/common.js +43 -0
- package/lib/common.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -0
- package/lib/templates/assets/apikey.yaml +34 -0
- package/lib/templates/assets/custom.yaml +22 -0
- package/lib/templates/assets/http_basic.yaml +38 -0
- package/lib/templates/assets/http_bearer.yaml +34 -0
- package/lib/templates/assets/oauth2_client_credentials.yaml +51 -0
- package/lib/templates/python_310_definition/template/connector/config/actions/example.yaml +40 -0
- package/lib/templates/python_310_definition/template/connector/config/assets/example.yaml +27 -0
- package/lib/templates/python_310_definition/template/data/asset.json +1 -0
- package/lib/templates/python_310_definition/template/docs/CHANGELOG.md.t +7 -0
- package/lib/templates/python_310_definition/template/docs/README.md +38 -0
- package/lib/templates/python_310_definition/template/requirements.txt +0 -0
- package/lib/types/connector-types.d.ts +29 -0
- package/lib/types/connector-types.js +14 -0
- package/lib/types/connector-types.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +5 -0
- package/lib/types/index.js.map +1 -0
- package/oclif.manifest.json +1 -0
- package/package.json +91 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The ISC License (ISC)
|
|
2
|
+
|
|
3
|
+
Copyright © SWIMLANE 2021
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
8
|
+
{"mode":"full","isActive":false}
|
package/README.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
Integration Task CLI Plugin
|
|
2
|
+
============
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://npmjs.org/package/@tsdk/plugin-task)
|
|
6
|
+
[](https://npmjs.org/package/@tsdk/plugin-task)
|
|
7
|
+
[](https://github.com/swimlane/turbine-developer-kit/blob/main/packages/cli/package.json)
|
|
8
|
+
<!-- toc -->
|
|
9
|
+
* [Usage](#usage)
|
|
10
|
+
* [Commands](#commands)
|
|
11
|
+
<!-- tocstop -->
|
|
12
|
+
# Usage
|
|
13
|
+
<!-- usage -->
|
|
14
|
+
```sh-session
|
|
15
|
+
$ npm install -g @sw-tsdk/plugin-connector
|
|
16
|
+
$ sw-tsdk-connector COMMAND
|
|
17
|
+
running command...
|
|
18
|
+
$ sw-tsdk-connector (--version)
|
|
19
|
+
@sw-tsdk/plugin-connector/0.1.1-next.23+038e7a6 darwin-x64 node-v16.17.0
|
|
20
|
+
$ sw-tsdk-connector --help [COMMAND]
|
|
21
|
+
USAGE
|
|
22
|
+
$ sw-tsdk-connector COMMAND
|
|
23
|
+
...
|
|
24
|
+
```
|
|
25
|
+
<!-- usagestop -->
|
|
26
|
+
# Commands
|
|
27
|
+
<!-- commands -->
|
|
28
|
+
* [`sw-tsdk-connector action:add`](#sw-tsdk-connector-actionadd)
|
|
29
|
+
* [`sw-tsdk-connector action:input`](#sw-tsdk-connector-actioninput)
|
|
30
|
+
* [`sw-tsdk-connector action:output`](#sw-tsdk-connector-actionoutput)
|
|
31
|
+
* [`sw-tsdk-connector action:run`](#sw-tsdk-connector-actionrun)
|
|
32
|
+
* [`sw-tsdk-connector asset:add`](#sw-tsdk-connector-assetadd)
|
|
33
|
+
* [`sw-tsdk-connector connector:build`](#sw-tsdk-connector-connectorbuild)
|
|
34
|
+
* [`sw-tsdk-connector connector:create`](#sw-tsdk-connector-connectorcreate)
|
|
35
|
+
* [`sw-tsdk-connector connector:create-source`](#sw-tsdk-connector-connectorcreate-source)
|
|
36
|
+
* [`sw-tsdk-connector connector:logo`](#sw-tsdk-connector-connectorlogo)
|
|
37
|
+
* [`sw-tsdk-connector connector:save`](#sw-tsdk-connector-connectorsave)
|
|
38
|
+
* [`sw-tsdk-connector connector:sign`](#sw-tsdk-connector-connectorsign)
|
|
39
|
+
* [`sw-tsdk-connector connector:update`](#sw-tsdk-connector-connectorupdate)
|
|
40
|
+
* [`sw-tsdk-connector connector:validate`](#sw-tsdk-connector-connectorvalidate)
|
|
41
|
+
|
|
42
|
+
## `sw-tsdk-connector action:add`
|
|
43
|
+
|
|
44
|
+
Update a connector action.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
USAGE
|
|
48
|
+
$ sw-tsdk-connector action:add [-d <value>] [-t node_18|python_310_definition|python_3.7_swimlane] [-h]
|
|
49
|
+
|
|
50
|
+
FLAGS
|
|
51
|
+
-d, --directory=<value> [default: ./] Root directory of the repository.
|
|
52
|
+
-h, --help Show CLI help.
|
|
53
|
+
-t, --template=<option> [default: python_310_definition] action template to scaffold
|
|
54
|
+
<options: node_18|python_310_definition|python_3.7_swimlane>
|
|
55
|
+
|
|
56
|
+
DESCRIPTION
|
|
57
|
+
Update a connector action.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
_See code: [lib/commands/action/add.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/action/add.js)_
|
|
61
|
+
|
|
62
|
+
## `sw-tsdk-connector action:input`
|
|
63
|
+
|
|
64
|
+
Update action input schema.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
USAGE
|
|
68
|
+
$ sw-tsdk-connector action:input [-a <value>] [-d <value>] [--amend] [--action-config-path <value>]
|
|
69
|
+
[--input-path <value> ] [-h]
|
|
70
|
+
|
|
71
|
+
FLAGS
|
|
72
|
+
-a, --action=<value> Action name to run
|
|
73
|
+
-d, --directory=<value> [default: ./] Root directory of the repository.
|
|
74
|
+
-h, --help Show CLI help.
|
|
75
|
+
--action-config-path=<value> Override path to action configuration file. Defaults to
|
|
76
|
+
/connector/config/actions/<action>.yaml
|
|
77
|
+
--amend Merge with existing schema.
|
|
78
|
+
--input-path=<value> Relative path to the output data JSON file, defaults to the task name under the data
|
|
79
|
+
folder. ie: /data/<taskName>_output.json
|
|
80
|
+
|
|
81
|
+
DESCRIPTION
|
|
82
|
+
Update action input schema.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
_See code: [lib/commands/action/input.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/action/input.js)_
|
|
86
|
+
|
|
87
|
+
## `sw-tsdk-connector action:output`
|
|
88
|
+
|
|
89
|
+
Update a connector action.
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
USAGE
|
|
93
|
+
$ sw-tsdk-connector action:output [-a <value>] [-d <value>] [--action-config-path <value>] [--amend]
|
|
94
|
+
[--output-path <value> ] [-h]
|
|
95
|
+
|
|
96
|
+
FLAGS
|
|
97
|
+
-a, --action=<value> Action name to run
|
|
98
|
+
-d, --directory=<value> [default: ./] Root directory of the repository.
|
|
99
|
+
-h, --help Show CLI help.
|
|
100
|
+
--action-config-path=<value> Override path to action configuration file. Defaults to /connector/config/<action>.yaml
|
|
101
|
+
--amend Merge with existing schema.
|
|
102
|
+
--output-path=<value> Relative path to the output data JSON file, defaults to the task name under the data
|
|
103
|
+
folder. ie: /data/<taskName>_output.json
|
|
104
|
+
|
|
105
|
+
DESCRIPTION
|
|
106
|
+
Update a connector action.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
_See code: [lib/commands/action/output.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/action/output.js)_
|
|
110
|
+
|
|
111
|
+
## `sw-tsdk-connector action:run`
|
|
112
|
+
|
|
113
|
+
Runs a connector action. (Defaults to current image version in local repository).
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
USAGE
|
|
117
|
+
$ sw-tsdk-connector action:run [-a <value>] [-d <value>] [--input-path <value>] [--output-path <value>]
|
|
118
|
+
[--error-path <value>] [--asset-path <value>] [-i <value> | --build | --latest] [--template
|
|
119
|
+
python_3.7|node_18|python_310_definition] [-f ] [-h]
|
|
120
|
+
|
|
121
|
+
FLAGS
|
|
122
|
+
-a, --action=<value> Action name to run
|
|
123
|
+
-d, --directory=<value> [default: ./] Root directory of the repository.
|
|
124
|
+
-f, --force-rebuild forces nocache on the image build
|
|
125
|
+
-h, --help Show CLI help.
|
|
126
|
+
-i, --image=<value> The connector image to run.
|
|
127
|
+
--asset-path=<value> File to asset data JSON file, defaults to /data/asset.json
|
|
128
|
+
--build Builds image and runs it.
|
|
129
|
+
--error-path=<value> File to write the errors to, defaults to /data/<action>_error.json
|
|
130
|
+
--input-path=<value> File to input data JSON file, defaults to /data/<action>.json
|
|
131
|
+
--latest Use the latest release image from quay.
|
|
132
|
+
--output-path=<value> File to write the outputs to, defaults to /data/<action>_output.json
|
|
133
|
+
--template=<option> [default: python_310_definition] connector template
|
|
134
|
+
<options: python_3.7|node_18|python_310_definition>
|
|
135
|
+
|
|
136
|
+
DESCRIPTION
|
|
137
|
+
Runs a connector action. (Defaults to current image version in local repository).
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
_See code: [lib/commands/action/run.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/action/run.js)_
|
|
141
|
+
|
|
142
|
+
## `sw-tsdk-connector asset:add`
|
|
143
|
+
|
|
144
|
+
Update a connector action.
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
USAGE
|
|
148
|
+
$ sw-tsdk-connector asset:add [-d <value>] [-s custom|apikey|client_credentials|basic|bearer] [-h]
|
|
149
|
+
|
|
150
|
+
FLAGS
|
|
151
|
+
-d, --directory=<value> [default: ./] Root directory of the repository.
|
|
152
|
+
-h, --help Show CLI help.
|
|
153
|
+
-s, --scheme=<option> asset template to scaffold
|
|
154
|
+
<options: custom|apikey|client_credentials|basic|bearer>
|
|
155
|
+
|
|
156
|
+
DESCRIPTION
|
|
157
|
+
Update a connector action.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
_See code: [lib/commands/asset/add.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/asset/add.js)_
|
|
161
|
+
|
|
162
|
+
## `sw-tsdk-connector connector:build`
|
|
163
|
+
|
|
164
|
+
Builds a local docker image of the connector.
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
USAGE
|
|
168
|
+
$ sw-tsdk-connector connector:build --template python_3.7_swimlane|node_18|python_310_definition [-d <value>]
|
|
169
|
+
[--save] [-f] [-h]
|
|
170
|
+
|
|
171
|
+
FLAGS
|
|
172
|
+
-d, --directory=<value> [default: ./] root directory of the repository.
|
|
173
|
+
-f, --force-rebuild forces nocache on the image build
|
|
174
|
+
-h, --help Show CLI help.
|
|
175
|
+
--save saves docker image as tar in local directory.
|
|
176
|
+
--template=<option> (required) [default: python_310_definition] connector language
|
|
177
|
+
<options: python_3.7_swimlane|node_18|python_310_definition>
|
|
178
|
+
|
|
179
|
+
DESCRIPTION
|
|
180
|
+
Builds a local docker image of the connector.
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
_See code: [lib/commands/connector/build.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/build.js)_
|
|
184
|
+
|
|
185
|
+
## `sw-tsdk-connector connector:create`
|
|
186
|
+
|
|
187
|
+
Scaffold a new connector
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
USAGE
|
|
191
|
+
$ sw-tsdk-connector connector:create [-d <value>] [-t node_18|python_310_definition|python_3.7_swimlane]
|
|
192
|
+
[--skip-repo] [--vendor <value>] [--product <value>] [--keywords <value>] [--description <value>] [--logoPath
|
|
193
|
+
<value>] [--author <value>] [--authorEmail <value>] [--homepage <value>] [-h]
|
|
194
|
+
|
|
195
|
+
FLAGS
|
|
196
|
+
-d, --directory=<value> [default: ./] root directory for where to store connectors, the connector directory will be
|
|
197
|
+
generated.
|
|
198
|
+
-h, --help Show CLI help.
|
|
199
|
+
-t, --template=<option> [default: python_310_definition] connector template to scaffold
|
|
200
|
+
<options: node_18|python_310_definition|python_3.7_swimlane>
|
|
201
|
+
--author=<value> Connector Author
|
|
202
|
+
--authorEmail=<value> Connector Author Email
|
|
203
|
+
--description=<value> Description (e.g. CrowdStrike Host Query API)
|
|
204
|
+
--homepage=<value> Connector Author Support URL
|
|
205
|
+
--keywords=<value> Please enter keyword (Comma-Separated)
|
|
206
|
+
--logoPath=<value> URL or absolute path to logo file
|
|
207
|
+
--product=<value> Product (e.g. Falcon)
|
|
208
|
+
--skip-repo skips the repository creation process
|
|
209
|
+
--vendor=<value> Vendor (e.g. CrowdStrike)
|
|
210
|
+
|
|
211
|
+
DESCRIPTION
|
|
212
|
+
Scaffold a new connector
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
_See code: [lib/commands/connector/create.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/create.js)_
|
|
216
|
+
|
|
217
|
+
## `sw-tsdk-connector connector:create-source`
|
|
218
|
+
|
|
219
|
+
Generates 11x source from 10x
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
USAGE
|
|
223
|
+
$ sw-tsdk-connector connector:create-source [-d <value>] [-h]
|
|
224
|
+
|
|
225
|
+
FLAGS
|
|
226
|
+
-d, --directory=<value> [default: ./] root directory of the repository.
|
|
227
|
+
-h, --help Show CLI help.
|
|
228
|
+
|
|
229
|
+
DESCRIPTION
|
|
230
|
+
Generates 11x source from 10x
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
_See code: [lib/commands/connector/create-source.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/create-source.js)_
|
|
234
|
+
|
|
235
|
+
## `sw-tsdk-connector connector:logo`
|
|
236
|
+
|
|
237
|
+
Update a connector.
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
USAGE
|
|
241
|
+
$ sw-tsdk-connector connector:logo -p <value> [-d <value>] [-h]
|
|
242
|
+
|
|
243
|
+
FLAGS
|
|
244
|
+
-d, --directory=<value> [default: .] root directory of the connector folder.
|
|
245
|
+
-h, --help Show CLI help.
|
|
246
|
+
-p, --path=<value> (required) path or URL to product logo in PNG format.
|
|
247
|
+
|
|
248
|
+
DESCRIPTION
|
|
249
|
+
Update a connector.
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
_See code: [lib/commands/connector/logo.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/logo.js)_
|
|
253
|
+
|
|
254
|
+
## `sw-tsdk-connector connector:save`
|
|
255
|
+
|
|
256
|
+
Save a docker image locally as .tar.gz
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
USAGE
|
|
260
|
+
$ sw-tsdk-connector connector:save -o <value> -i <value> [-d <value>] [-s] [-h]
|
|
261
|
+
|
|
262
|
+
FLAGS
|
|
263
|
+
-d, --directory=<value> [default: .] Root directory of the repo.
|
|
264
|
+
-h, --help Show CLI help.
|
|
265
|
+
-i, --image=<value> (required) image to save.
|
|
266
|
+
-o, --output=<value> (required) output file to where to store the image.
|
|
267
|
+
-s, --skip-pull skips pulling the image
|
|
268
|
+
|
|
269
|
+
DESCRIPTION
|
|
270
|
+
Save a docker image locally as .tar.gz
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
_See code: [lib/commands/connector/save.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/save.js)_
|
|
274
|
+
|
|
275
|
+
## `sw-tsdk-connector connector:sign`
|
|
276
|
+
|
|
277
|
+
Builds a local docker image of the connector.
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
USAGE
|
|
281
|
+
$ sw-tsdk-connector connector:sign --image <value> --key-name <value> [-d <value>] [--signing-password <value>]
|
|
282
|
+
[--save] [--registry <value>] [-h]
|
|
283
|
+
|
|
284
|
+
FLAGS
|
|
285
|
+
-d, --directory=<value> [default: ./] root directory of the repository.
|
|
286
|
+
-h, --help Show CLI help.
|
|
287
|
+
--image=<value> (required) image name to sign
|
|
288
|
+
--key-name=<value> (required) name used for the key (default: username)
|
|
289
|
+
--registry=<value> [default: localhost:50000] registry to use for signing
|
|
290
|
+
--save saves docker image as tar in local directory.
|
|
291
|
+
--signing-password=<value> password used for the private key
|
|
292
|
+
|
|
293
|
+
DESCRIPTION
|
|
294
|
+
Builds a local docker image of the connector.
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
_See code: [lib/commands/connector/sign.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/sign.js)_
|
|
298
|
+
|
|
299
|
+
## `sw-tsdk-connector connector:update`
|
|
300
|
+
|
|
301
|
+
Update a connector.
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
USAGE
|
|
305
|
+
$ sw-tsdk-connector connector:update [-d <value>] [-v <value>] [-f <value>] [-h]
|
|
306
|
+
|
|
307
|
+
FLAGS
|
|
308
|
+
-d, --directory=<value> [default: .] root directory of the connector folder.
|
|
309
|
+
-f, --manifest-path=<value> [default: /connector/connector.yaml] connector manifest path relative to directory.
|
|
310
|
+
-h, --help Show CLI help.
|
|
311
|
+
-v, --version=<value> new version of the connector.
|
|
312
|
+
|
|
313
|
+
DESCRIPTION
|
|
314
|
+
Update a connector.
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
_See code: [lib/commands/connector/update.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/update.js)_
|
|
318
|
+
|
|
319
|
+
## `sw-tsdk-connector connector:validate`
|
|
320
|
+
|
|
321
|
+
Use to validate an integration
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
USAGE
|
|
325
|
+
$ sw-tsdk-connector connector:validate -c <value> [-h] [-i <value>] [--key <value> --signed] [-s] [-d <value>]
|
|
326
|
+
|
|
327
|
+
FLAGS
|
|
328
|
+
-c, --connector=<value> (required) connector to validate (relative to directory)
|
|
329
|
+
-d, --directory=<value> [default: ./] current directory to mount
|
|
330
|
+
-h, --help Show CLI help.
|
|
331
|
+
-i, --image=<value> image to use
|
|
332
|
+
-s, --skip-pull skips pulling the image
|
|
333
|
+
--key=<value> public key for verfication
|
|
334
|
+
--signed validates a signed connector
|
|
335
|
+
|
|
336
|
+
DESCRIPTION
|
|
337
|
+
Use to validate an integration
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
_See code: [lib/commands/connector/validate.js](https://github.com/swimlane/turbine-sdk/blob/v0.1.1-next.23+038e7a6/lib/commands/connector/validate.js)_
|
|
341
|
+
<!-- commandsstop -->
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Base } from '@sw-tsdk/core';
|
|
2
|
+
export declare class Add extends Base {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
directory: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
template: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
7
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Add = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const core_2 = require("@sw-tsdk/core");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const fs_extra_1 = require("fs-extra");
|
|
10
|
+
const node_process_1 = tslib_1.__importDefault(require("node:process"));
|
|
11
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
12
|
+
const snake_case_1 = require("snake-case");
|
|
13
|
+
const connector_1 = require("@sw-tsdk/connector");
|
|
14
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
15
|
+
// noinspection JSUnusedGlobalSymbols
|
|
16
|
+
class Add extends core_2.Base {
|
|
17
|
+
async run() {
|
|
18
|
+
const { flags, } = await this.parse(Add);
|
|
19
|
+
let { directory, } = flags;
|
|
20
|
+
const { template, } = flags;
|
|
21
|
+
directory = (0, node_path_1.resolve)(directory || node_process_1.default.cwd());
|
|
22
|
+
const masterQuestions = [{
|
|
23
|
+
type: 'input',
|
|
24
|
+
name: 'title',
|
|
25
|
+
message: 'Action Title (e.g. Get Alerts)',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'input',
|
|
29
|
+
name: 'description',
|
|
30
|
+
message: 'Description (e.g. CrowdStrike Host Query API)',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'input',
|
|
34
|
+
name: 'endpoint',
|
|
35
|
+
message: 'entire endpoint after URL (e.g. api/v3/search)',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'input',
|
|
39
|
+
name: 'method',
|
|
40
|
+
message: 'Connector template and language.',
|
|
41
|
+
choices: ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'CONNECT', 'OPTIONS', 'TRACE'],
|
|
42
|
+
default: 'GET',
|
|
43
|
+
}];
|
|
44
|
+
const answers = await inquirer_1.default.prompt(masterQuestions);
|
|
45
|
+
const action = {
|
|
46
|
+
schema: 'action/1',
|
|
47
|
+
title: answers.title,
|
|
48
|
+
name: (0, snake_case_1.snakeCase)(answers.title),
|
|
49
|
+
description: answers.description,
|
|
50
|
+
inputs: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
properties: {},
|
|
53
|
+
required: [],
|
|
54
|
+
},
|
|
55
|
+
output: {},
|
|
56
|
+
meta: {},
|
|
57
|
+
};
|
|
58
|
+
core_1.CliUx.ux.action.start('Scaffolding new action');
|
|
59
|
+
switch (template) {
|
|
60
|
+
case 'python_310_definition':
|
|
61
|
+
// Update input defaults.
|
|
62
|
+
action.inputs = connector_1.pythonDefinitionInputDefaults;
|
|
63
|
+
action.meta = {
|
|
64
|
+
endpoint: answers.endpoint || '',
|
|
65
|
+
method: answers.method,
|
|
66
|
+
};
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
const actionPath = (0, node_path_1.join)(directory, 'connector', 'config', 'actions', `${action.name}.yaml`);
|
|
70
|
+
await (0, fs_extra_1.writeFile)(actionPath, js_yaml_1.default.dump(action));
|
|
71
|
+
core_1.CliUx.ux.action.stop();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.Add = Add;
|
|
75
|
+
Add.description = 'Update a connector action.';
|
|
76
|
+
Add.flags = Object.assign(Object.assign({}, core_2.Base.flags), { directory: core_1.Flags.string({
|
|
77
|
+
char: 'd',
|
|
78
|
+
description: 'Root directory of the repository.',
|
|
79
|
+
default: './',
|
|
80
|
+
}), template: core_1.Flags.string({
|
|
81
|
+
char: 't',
|
|
82
|
+
description: 'action template to scaffold',
|
|
83
|
+
default: 'python_310_definition',
|
|
84
|
+
options: ['node_18', 'python_310_definition', 'python_3.7_swimlane'],
|
|
85
|
+
}), help: core_1.Flags.help({
|
|
86
|
+
char: 'h',
|
|
87
|
+
}) });
|
|
88
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/action/add.ts"],"names":[],"mappings":";;;;AAAA,8BAA8B;AAC9B,sCAAwC;AACxC,wCAAkC;AAClC,yCAAuC;AACvC,uCAAkC;AAClC,wEAAkC;AAClC,8DAA0B;AAC1B,2CAAoC;AAEpC,kDAAgE;AAEhE,gEAA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-tsdk/core';
|
|
2
|
+
export declare class Input extends Base {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
action: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
+
directory: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
7
|
+
amend: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
'action-config-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
|
+
'input-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Input = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const core_2 = require("@sw-tsdk/core");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const node_process_1 = tslib_1.__importDefault(require("node:process"));
|
|
10
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
11
|
+
const connector_1 = require("@sw-tsdk/connector");
|
|
12
|
+
const common_1 = require("../../common");
|
|
13
|
+
// noinspection JSUnusedGlobalSymbols
|
|
14
|
+
class Input extends core_2.Base {
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags, } = await this.parse(Input);
|
|
17
|
+
let { directory, 'input-path': inputPath, 'action-config-path': actionConfigPath, action, } = flags;
|
|
18
|
+
const { amend, } = flags;
|
|
19
|
+
directory = (0, node_path_1.resolve)(directory || node_process_1.default.cwd());
|
|
20
|
+
// ensure directory path
|
|
21
|
+
try {
|
|
22
|
+
await fs_extra_1.promises.access(directory);
|
|
23
|
+
}
|
|
24
|
+
catch (_a) {
|
|
25
|
+
this.error(`Could not access ${directory}`);
|
|
26
|
+
}
|
|
27
|
+
// select action if not provided.
|
|
28
|
+
if (!action) {
|
|
29
|
+
action = await (0, common_1.chooseAction)(directory);
|
|
30
|
+
}
|
|
31
|
+
actionConfigPath = actionConfigPath || (0, node_path_1.join)(directory, 'connector', 'config', 'actions', `${action}.yaml`);
|
|
32
|
+
const actionConfig = await js_yaml_1.default.load(await (0, fs_extra_1.readFile)(actionConfigPath, 'utf-8'));
|
|
33
|
+
core_1.CliUx.ux.action.start('Updating output schema');
|
|
34
|
+
inputPath = inputPath || (0, node_path_1.join)(directory, 'data', `${action}.json`);
|
|
35
|
+
const inputData = await (0, fs_extra_1.readJson)(inputPath);
|
|
36
|
+
const inputSchema = await (0, connector_1.generateSchema)('inputs', inputData, connector_1.schemaDefaults);
|
|
37
|
+
// remove unnecessary top level attributes
|
|
38
|
+
delete inputSchema.inputs.title;
|
|
39
|
+
delete inputSchema.inputs.examples;
|
|
40
|
+
if (amend) {
|
|
41
|
+
Object.assign(actionConfig.inputs, inputSchema.inputs);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
actionConfig.inputs = inputSchema.inputs;
|
|
45
|
+
}
|
|
46
|
+
await (0, fs_extra_1.writeFile)(actionConfigPath, js_yaml_1.default.dump(actionConfig, { noRefs: true }));
|
|
47
|
+
core_1.CliUx.ux.action.stop();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.Input = Input;
|
|
51
|
+
Input.description = 'Update action input schema.';
|
|
52
|
+
Input.flags = Object.assign(Object.assign({}, core_2.Base.flags), { action: core_1.Flags.string({
|
|
53
|
+
char: 'a',
|
|
54
|
+
description: 'Action name to run',
|
|
55
|
+
}), directory: core_1.Flags.string({
|
|
56
|
+
char: 'd',
|
|
57
|
+
description: 'Root directory of the repository.',
|
|
58
|
+
default: './',
|
|
59
|
+
}), amend: core_1.Flags.boolean({
|
|
60
|
+
description: 'Merge with existing schema.',
|
|
61
|
+
}), 'action-config-path': core_1.Flags.string({
|
|
62
|
+
description: 'Override path to action configuration file. Defaults to /connector/config/actions/<action>.yaml',
|
|
63
|
+
}), 'input-path': core_1.Flags.string({
|
|
64
|
+
description: 'Relative path to the output data JSON file, defaults to the task name under the data folder. ie: /data/<taskName>_output.json',
|
|
65
|
+
dependsOn: ['update-output-schema'],
|
|
66
|
+
}), help: core_1.Flags.help({
|
|
67
|
+
char: 'h',
|
|
68
|
+
}) });
|
|
69
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/commands/action/input.ts"],"names":[],"mappings":";;;;AAAA,sCAAwC;AACxC,wCAAkC;AAClC,yCAAuC;AACvC,uCAAgE;AAChE,wEAAkC;AAClC,8DAA0B;AAK1B,kDAAiE;AACjE,yCAAyC;AAEzC,qCAAqC;AACrC,MAAa,KAAM,SAAQ,WAAI;IA6B7B,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,GACN,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAE3B,IAAI,EACF,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,oBAAoB,EAAE,gBAAgB,EACtC,MAAM,GACP,GAAG,KAAK,CAAA;QAET,MAAM,EACJ,KAAK,GACN,GAAG,KAAK,CAAA;QAET,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,IAAI,sBAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAE/C,wBAAwB;QACxB,IAAI;YACF,MAAM,mBAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;SACjC;QAAC,WAAM;YACN,IAAI,CAAC,KAAK,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAA;SAC5C;QAED,iCAAiC;QACjC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,SAAS,CAAC,CAAA;SACvC;QAED,gB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,EAAE,GAAG;QACT,WAAW,EAAE,oBAAoB;KAClC,CAAC,EACF,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,IAAI;KACd,CAAC,EACF,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;QACnB,WAAW,EAAE,6BAA6B;KAC3C,CAAC,EACF,oBAAoB,EAAE,YAAK,CAAC,MAAM,CAAC;QACjC,WAAW,EAAE,iGAAiG;KAC/G,CAAC,EACF,YAAY,EAAE,YAAK,CAAC,MAAM,CAAC;QACzB,WAAW,EAAE,+HAA+H;QAC5I,SAAS,EAAE,CAAC,sBAAsB,CAAC;KACpC,CAAC,EACF,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC;QACf,IAAI,EAAE,GAAG;KACV,CAAC,IACH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Base } from '@sw-tsdk/core';
|
|
2
|
+
export declare class Output extends Base {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
action: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
+
directory: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
7
|
+
'action-config-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
|
+
amend: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
'output-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Output = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const core_2 = require("@sw-tsdk/core");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const node_process_1 = tslib_1.__importDefault(require("node:process"));
|
|
10
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
11
|
+
const connector_1 = require("@sw-tsdk/connector");
|
|
12
|
+
const common_1 = require("../../common");
|
|
13
|
+
// noinspection JSUnusedGlobalSymbols
|
|
14
|
+
class Output extends core_2.Base {
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags, } = await this.parse(Output);
|
|
17
|
+
let { directory, 'output-path': outputPath, 'action-config-path': actionConfigPath, action, } = flags;
|
|
18
|
+
const { amend, } = flags;
|
|
19
|
+
directory = (0, node_path_1.resolve)(directory || node_process_1.default.cwd());
|
|
20
|
+
// ensure directory path
|
|
21
|
+
try {
|
|
22
|
+
await fs_extra_1.promises.access(directory);
|
|
23
|
+
}
|
|
24
|
+
catch (_a) {
|
|
25
|
+
this.error(`Could not access ${directory}`);
|
|
26
|
+
}
|
|
27
|
+
// select action if not provided.
|
|
28
|
+
if (!action) {
|
|
29
|
+
action = await (0, common_1.chooseAction)(directory);
|
|
30
|
+
}
|
|
31
|
+
actionConfigPath = actionConfigPath || (0, node_path_1.join)(directory, 'connector', 'config', 'actions', `${action}.yaml`);
|
|
32
|
+
const actionConfig = await js_yaml_1.default.load(await (0, fs_extra_1.readFile)(actionConfigPath, 'utf-8'));
|
|
33
|
+
core_1.CliUx.ux.action.start('Updating output schema');
|
|
34
|
+
outputPath = outputPath || (0, node_path_1.join)(directory, 'data', `${action}_output.json`);
|
|
35
|
+
const outputData = await (0, fs_extra_1.readJson)(outputPath);
|
|
36
|
+
const outputSchema = await (0, connector_1.generateSchema)('output', outputData, connector_1.schemaDefaults);
|
|
37
|
+
// remove unnecessary top level attributes
|
|
38
|
+
delete outputSchema.output.title;
|
|
39
|
+
if (amend) {
|
|
40
|
+
Object.assign(actionConfig.output, outputSchema.output);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
actionConfig.output = outputSchema.output;
|
|
44
|
+
}
|
|
45
|
+
await (0, fs_extra_1.writeFile)(actionConfigPath, js_yaml_1.default.dump(actionConfig, { noRefs: true }));
|
|
46
|
+
core_1.CliUx.ux.action.stop();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Output = Output;
|
|
50
|
+
Output.description = 'Update a connector action.';
|
|
51
|
+
Output.flags = Object.assign(Object.assign({}, core_2.Base.flags), { action: core_1.Flags.string({
|
|
52
|
+
char: 'a',
|
|
53
|
+
description: 'Action name to run',
|
|
54
|
+
}), directory: core_1.Flags.string({
|
|
55
|
+
char: 'd',
|
|
56
|
+
description: 'Root directory of the repository.',
|
|
57
|
+
default: './',
|
|
58
|
+
}), 'action-config-path': core_1.Flags.string({
|
|
59
|
+
description: 'Override path to action configuration file. Defaults to /connector/config/<action>.yaml',
|
|
60
|
+
}), amend: core_1.Flags.boolean({
|
|
61
|
+
description: 'Merge with existing schema.',
|
|
62
|
+
}), 'output-path': core_1.Flags.string({
|
|
63
|
+
description: 'Relative path to the output data JSON file, defaults to the task name under the data folder. ie: /data/<taskName>_output.json',
|
|
64
|
+
dependsOn: ['update-output-schema'],
|
|
65
|
+
}), help: core_1.Flags.help({
|
|
66
|
+
char: 'h',
|
|
67
|
+
}) });
|
|
68
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/commands/action/output.ts"],"names":[],"mappings":";;;;AAAA,sCAAwC;AACxC,wCAAkC;AAClC,yCAAuC;AACvC,uCAAgE;AAChE,wEAAkC;AAClC,8DAA0B;AAK1B,kDAAiE;AACjE,yCAAyC;AAEzC,qCAAqC;AACrC,MAAa,MAAO,SAAQ,WAAI;IA6B9B,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,GACN,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MA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MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;SACxD;aAAM;YACL,YAAY,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAA;SAC1C;QAED,MAAM,IAAA,oBAAS,EAAC,gBAAgB,EAAE,iBAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC,CAAA;QAC1E,YAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;;AA7EH,wBA8EC;AA7EQ,kBAAW,GAAG,4BAA4B,CAAA;AAE1C,YAAK,mCACP,WAAI,CAAC,KAAK,KACb,MAAM,EAAE,YAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,oBAAoB;KAClC,CAAC,EACF,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,IAAI;KACd,CAAC,EACF,oBAAoB,EAAE,YAAK,CAAC,MAAM,CAAC;QACjC,WAAW,EAAE,yFAAyF;KACvG,CAAC,EACF,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;QACnB,WAAW,EAAE,6BAA6B;KAC3C,CAAC,EACF,aAAa,EAAE,YAAK,CAAC,MAAM,CAAC;QAC1B,WAAW,EAAE,+HAA+H;QAC5I,SAAS,EAAE,CAAC,sBAAsB,CAAC;KACpC,CAAC,EACF,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC;QACf,IAAI,EAAE,GAAG;KACV,CAAC,IACH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Base } from '@sw-tsdk/core';
|
|
2
|
+
export declare class Run extends Base {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
action: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
+
directory: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
7
|
+
'input-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
|
+
'output-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
|
+
'error-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
'asset-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
11
|
+
image: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
latest: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
build: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
template: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
15
|
+
'compile-override': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
+
'runner-override': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
17
|
+
'runtime-override': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
18
|
+
'force-rebuild': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
20
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
21
|
+
};
|
|
22
|
+
run(): Promise<void>;
|
|
23
|
+
}
|