@sw-tsdk/plugin-connector 2.11.1 → 2.11.2-alpha.39
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 +25 -25
- package/lib/commands/action/add.d.ts +2 -2
- package/lib/commands/action/add.js +14 -8
- package/lib/commands/action/add.js.map +1 -1
- package/lib/commands/action/generate/data.d.ts +4 -4
- package/lib/commands/action/generate/data.js +23 -13
- package/lib/commands/action/generate/data.js.map +1 -1
- package/lib/commands/action/generate/input.d.ts +4 -4
- package/lib/commands/action/generate/input.js +19 -11
- package/lib/commands/action/generate/input.js.map +1 -1
- package/lib/commands/action/generate/output.d.ts +4 -4
- package/lib/commands/action/generate/output.js +19 -11
- package/lib/commands/action/generate/output.js.map +1 -1
- package/lib/commands/action/run/image.d.ts +9 -9
- package/lib/commands/action/run/image.js +39 -27
- package/lib/commands/action/run/image.js.map +1 -1
- package/lib/commands/action/run/local.d.ts +11 -11
- package/lib/commands/action/run/local.js +50 -34
- package/lib/commands/action/run/local.js.map +1 -1
- package/lib/commands/asset/add.d.ts +2 -2
- package/lib/commands/asset/add.js +12 -7
- package/lib/commands/asset/add.js.map +1 -1
- package/lib/commands/connector/build.d.ts +10 -10
- package/lib/commands/connector/build.js +37 -20
- package/lib/commands/connector/build.js.map +1 -1
- package/lib/commands/connector/create/openapi.d.ts +12 -11
- package/lib/commands/connector/create/openapi.js +117 -60
- package/lib/commands/connector/create/openapi.js.map +1 -1
- package/lib/commands/connector/create/source.d.ts +2 -2
- package/lib/commands/connector/create/source.js +12 -6
- package/lib/commands/connector/create/source.js.map +1 -1
- package/lib/commands/connector/create.d.ts +10 -10
- package/lib/commands/connector/create.js +24 -11
- package/lib/commands/connector/create.js.map +1 -1
- package/lib/commands/connector/logo.d.ts +2 -2
- package/lib/commands/connector/logo.js +10 -5
- package/lib/commands/connector/logo.js.map +1 -1
- package/lib/commands/connector/sign.d.ts +6 -6
- package/lib/commands/connector/sign.js +24 -13
- package/lib/commands/connector/sign.js.map +1 -1
- package/lib/commands/connector/update.d.ts +3 -3
- package/lib/commands/connector/update.js +14 -8
- package/lib/commands/connector/update.js.map +1 -1
- package/lib/commands/connector/validate.d.ts +4 -4
- package/lib/commands/connector/validate.js +22 -14
- package/lib/commands/connector/validate.js.map +1 -1
- package/lib/common.js +4 -0
- package/lib/common.js.map +1 -1
- package/lib/templates/assets/http_bearer.yaml +1 -2
- package/lib/types/connector-types.d.ts +2 -2
- package/oclif.manifest.json +1007 -1
- package/package.json +13 -13
|
@@ -18,7 +18,6 @@ class Image extends core_2.Base {
|
|
|
18
18
|
this.docker = new docker_1.Docker();
|
|
19
19
|
}
|
|
20
20
|
async run() {
|
|
21
|
-
var _a;
|
|
22
21
|
const { flags, } = await this.parse(Image);
|
|
23
22
|
let { directory, } = flags;
|
|
24
23
|
const { action, repository, version, stdin, } = flags;
|
|
@@ -27,7 +26,7 @@ class Image extends core_2.Base {
|
|
|
27
26
|
try {
|
|
28
27
|
await fs_extra_1.promises.access(directory);
|
|
29
28
|
}
|
|
30
|
-
catch
|
|
29
|
+
catch {
|
|
31
30
|
this.error(`Could not access ${directory}`);
|
|
32
31
|
}
|
|
33
32
|
const inputPath = flags['input-path'] || (0, node_path_1.join)(directory, 'data', `${action}.json`);
|
|
@@ -35,31 +34,31 @@ class Image extends core_2.Base {
|
|
|
35
34
|
const errorPath = flags['error-path'] || (0, node_path_1.join)(directory, 'data', `${action}_error.txt`);
|
|
36
35
|
const assetPath = flags['asset-path'] || (0, node_path_1.join)(directory, 'data', 'asset.json');
|
|
37
36
|
if (!await (0, core_2.fileExists)(inputPath)) {
|
|
38
|
-
core_1.
|
|
37
|
+
core_1.ux.error(`Missing test data ${inputPath}`);
|
|
39
38
|
}
|
|
40
39
|
const asset = await (0, core_2.fileExists)(assetPath) ? await (0, fs_extra_1.readJson)(assetPath) : {};
|
|
41
40
|
// merge inputs and asset as 11.x sends it.
|
|
42
41
|
const inputs = JSON.stringify(Object.assign(await (0, fs_extra_1.readJson)(inputPath), asset));
|
|
43
42
|
// check that docker is running
|
|
44
|
-
core_1.
|
|
43
|
+
core_1.ux.action.start('Checking for docker...');
|
|
45
44
|
await this.docker.ping();
|
|
46
|
-
core_1.
|
|
45
|
+
core_1.ux.action.stop();
|
|
47
46
|
// Can run latest from quay, image provided, or default to the last built.
|
|
48
47
|
const image = `${repository}:${version}`;
|
|
49
|
-
core_1.
|
|
48
|
+
core_1.ux.action.start(`Pulling image ${image}...`);
|
|
50
49
|
await this.docker.pullImage(image);
|
|
51
50
|
await this.docker.pullImage('halverneus/static-file-server:latest');
|
|
52
|
-
core_1.
|
|
51
|
+
core_1.ux.action.stop();
|
|
53
52
|
await (0, fs_extra_1.ensureDir)((0, node_path_1.join)(directory, 'data', 'files'));
|
|
54
53
|
await fs_extra_1.promises.writeFile(outputPath, '{}');
|
|
55
54
|
await fs_extra_1.promises.writeFile(errorPath, '');
|
|
56
55
|
const containerReference = (0, docker_reference_1.parseQualifiedName)(image);
|
|
57
|
-
this.containerName = (0, slug_1.default)(
|
|
56
|
+
this.containerName = (0, slug_1.default)(containerReference.repository ?? '');
|
|
58
57
|
const environmentVars = Object.entries({
|
|
59
58
|
INPUTS: stdin ? '' : inputs,
|
|
60
59
|
IPC_API_URI: 'http://localhost:8080',
|
|
61
60
|
IPC_API_TOKEN: '',
|
|
62
|
-
}).map(([key, value]) => `${key}=${value
|
|
61
|
+
}).map(([key, value]) => `${key}=${value ?? ''}`);
|
|
63
62
|
const createOptions = {
|
|
64
63
|
Image: image,
|
|
65
64
|
Env: environmentVars,
|
|
@@ -72,11 +71,11 @@ class Image extends core_2.Base {
|
|
|
72
71
|
AutoRemove: true,
|
|
73
72
|
},
|
|
74
73
|
};
|
|
75
|
-
core_1.
|
|
74
|
+
core_1.ux.action.start('Executing...');
|
|
76
75
|
const outputFile = new connector_1.ContainerStdoutActionOutputTransform((0, fs_extra_1.createWriteStream)(outputPath));
|
|
77
76
|
const errorFile = await (0, fs_extra_1.createWriteStream)(errorPath);
|
|
78
77
|
const success = await this.docker.runStdinImage(createOptions, outputFile, errorFile, inputs);
|
|
79
|
-
core_1.
|
|
78
|
+
core_1.ux.action.stop();
|
|
80
79
|
if (!success) {
|
|
81
80
|
core_1.Errors.exit(-1);
|
|
82
81
|
}
|
|
@@ -87,50 +86,63 @@ class Image extends core_2.Base {
|
|
|
87
86
|
throw error;
|
|
88
87
|
}
|
|
89
88
|
async cleanup() {
|
|
90
|
-
core_1.
|
|
89
|
+
core_1.ux.action.start('Removing stale containers...');
|
|
91
90
|
try {
|
|
92
91
|
await this.docker.deleteContainer('IPC_API');
|
|
93
92
|
}
|
|
94
|
-
catch
|
|
93
|
+
catch { }
|
|
95
94
|
try {
|
|
96
95
|
await this.docker.deleteContainer(this.containerName);
|
|
97
96
|
}
|
|
98
|
-
catch
|
|
99
|
-
core_1.
|
|
97
|
+
catch { }
|
|
98
|
+
core_1.ux.action.stop();
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
exports.Image = Image;
|
|
103
102
|
Image.description = 'Runs a connector action. (Defaults to current image version in local repository).';
|
|
104
103
|
Image.hidden = true;
|
|
105
|
-
Image.flags =
|
|
104
|
+
Image.flags = {
|
|
105
|
+
...core_2.Base.flags,
|
|
106
|
+
action: core_1.Flags.string({
|
|
106
107
|
char: 'a',
|
|
107
108
|
description: 'Action name to run',
|
|
108
109
|
required: true,
|
|
109
|
-
}),
|
|
110
|
+
}),
|
|
111
|
+
directory: core_1.Flags.string({
|
|
110
112
|
char: 'd',
|
|
111
113
|
description: 'Root directory of the repository.',
|
|
112
114
|
default: './',
|
|
113
|
-
}),
|
|
115
|
+
}),
|
|
116
|
+
'input-path': core_1.Flags.string({
|
|
114
117
|
description: 'File to input data JSON file',
|
|
115
118
|
required: true,
|
|
116
|
-
}),
|
|
119
|
+
}),
|
|
120
|
+
'output-path': core_1.Flags.string({
|
|
117
121
|
description: 'File to write the outputs to, defaults to /data/<action>_output.json',
|
|
118
|
-
}),
|
|
122
|
+
}),
|
|
123
|
+
'error-path': core_1.Flags.string({
|
|
119
124
|
description: 'File to write the errors to, defaults to /data/<action>_error.json',
|
|
120
|
-
}),
|
|
125
|
+
}),
|
|
126
|
+
'asset-path': core_1.Flags.string({
|
|
121
127
|
description: 'File to asset data JSON file, defaults to /data/asset.json',
|
|
122
|
-
}),
|
|
128
|
+
}),
|
|
129
|
+
repository: core_1.Flags.string({
|
|
123
130
|
char: 'r',
|
|
124
131
|
description: 'The connector image repository to run.',
|
|
125
|
-
}),
|
|
132
|
+
}),
|
|
133
|
+
version: core_1.Flags.string({
|
|
126
134
|
description: 'Use the latest release image from quay.',
|
|
127
135
|
default: 'latest',
|
|
128
|
-
}),
|
|
136
|
+
}),
|
|
137
|
+
stdin: core_1.Flags.boolean({
|
|
129
138
|
description: 'Send the inputs through stdin instead of an environment variable.',
|
|
130
|
-
}),
|
|
139
|
+
}),
|
|
140
|
+
platform: core_1.Flags.string({
|
|
131
141
|
hidden: true,
|
|
132
142
|
default: 'linux/amd64',
|
|
133
|
-
}),
|
|
143
|
+
}),
|
|
144
|
+
help: core_1.Flags.help({
|
|
134
145
|
char: 'h',
|
|
135
|
-
})
|
|
146
|
+
}),
|
|
147
|
+
};
|
|
136
148
|
//# sourceMappingURL=image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/commands/action/run/image.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/commands/action/run/image.ts"],"names":[],"mappings":";;;;AAAA,sCAA6C;AAC7C,wCAA8C;AAC9C,yCAAuC;AACvC,uCAAyE;AACzE,4CAAqD;AACrD,wEAAkC;AAClC,wDAAuB;AACvB,iEAA6D;AAC7D,kDAAuE;AAEvE,qCAAqC;AACrC,MAAa,KAAM,SAAQ,WAAI;IAA/B;;QAgDU,WAAM,GAAW,IAAI,eAAM,EAAE,CAAA;IAkHvC,CAAC;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AAW,EAAE,mEAAmE;KACjF,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,aAAa;KACvB,CAAC;IACF,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC;QACf,IAAI,EAAE,GAAG;KACV,CAAC;CACH,AA3CW,CA2CX"}
|
|
@@ -2,18 +2,18 @@ import { Base } from '@sw-tsdk/core';
|
|
|
2
2
|
export declare class Local extends Base {
|
|
3
3
|
static description: string;
|
|
4
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
|
-
template: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
-
'compile-override': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
13
|
-
'runner-override': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
14
|
-
'runtime-override': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
5
|
+
action: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
6
|
+
directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
'input-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
'output-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
'error-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
'asset-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
template: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
'compile-override': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
'runner-override': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
'runtime-override': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
15
|
'force-rebuild': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
-
platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
+
platform: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
17
17
|
debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
18
|
'no-remove': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
19
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
@@ -22,7 +22,6 @@ class Local extends core_2.Base {
|
|
|
22
22
|
this.IPC_API = 'IPC_API';
|
|
23
23
|
}
|
|
24
24
|
async run() {
|
|
25
|
-
var _a, _b;
|
|
26
25
|
const { flags, } = await this.parse(Local);
|
|
27
26
|
let { directory, } = flags;
|
|
28
27
|
let image = '';
|
|
@@ -32,7 +31,7 @@ class Local extends core_2.Base {
|
|
|
32
31
|
try {
|
|
33
32
|
await fs_extra_1.promises.access(directory);
|
|
34
33
|
}
|
|
35
|
-
catch
|
|
34
|
+
catch {
|
|
36
35
|
this.error(`Could not access ${directory}`);
|
|
37
36
|
}
|
|
38
37
|
// select action if not provided.
|
|
@@ -55,15 +54,15 @@ class Local extends core_2.Base {
|
|
|
55
54
|
const errorPath = flags['error-path'] || (0, node_path_1.join)(directory, 'data', `${actionToExecute}_error.txt`);
|
|
56
55
|
const assetPath = flags['asset-path'] || (0, node_path_1.join)(directory, 'data', `${assetName || 'asset'}.json`);
|
|
57
56
|
if (!await (0, core_2.fileExists)(inputPath)) {
|
|
58
|
-
core_1.
|
|
57
|
+
core_1.ux.error(`Missing test data ${inputPath}`);
|
|
59
58
|
}
|
|
60
59
|
const asset = await (0, core_2.fileExists)(assetPath) ? await (0, fs_extra_1.readJson)(assetPath) : {};
|
|
61
60
|
// merge inputs and asset as 11.x sends it.
|
|
62
61
|
const inputs = JSON.stringify(Object.assign(await (0, fs_extra_1.readJson)(inputPath), asset));
|
|
63
62
|
// check that docker is running
|
|
64
|
-
core_1.
|
|
63
|
+
core_1.ux.action.start('Checking for docker...');
|
|
65
64
|
await this.docker.ping();
|
|
66
|
-
core_1.
|
|
65
|
+
core_1.ux.action.stop();
|
|
67
66
|
// Can run latest from quay, image provided, or default to the last built.
|
|
68
67
|
const connector = new connector_1.BuildConnector();
|
|
69
68
|
const result = await connector.build({
|
|
@@ -78,7 +77,7 @@ class Local extends core_2.Base {
|
|
|
78
77
|
});
|
|
79
78
|
image = result.imageTag;
|
|
80
79
|
if (!image) {
|
|
81
|
-
core_1.
|
|
80
|
+
core_1.ux.error('No image to run, check command flags.');
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
84
83
|
const filesDirectory = (0, node_path_1.join)(directory, 'data', 'files');
|
|
@@ -87,8 +86,8 @@ class Local extends core_2.Base {
|
|
|
87
86
|
`${filesDirectory}:/web/files`,
|
|
88
87
|
];
|
|
89
88
|
const containerReference = (0, docker_reference_1.parseQualifiedName)(image);
|
|
90
|
-
this.containerName = (0, slug_1.default)(
|
|
91
|
-
core_1.
|
|
89
|
+
this.containerName = (0, slug_1.default)(containerReference.repository ?? '');
|
|
90
|
+
core_1.ux.action.start('Starting IPC API...');
|
|
92
91
|
await this.docker.pullImage(docker_1.DockerDefaults.SdkFileImage);
|
|
93
92
|
await this.docker.startImage({
|
|
94
93
|
Image: docker_1.DockerDefaults.SdkFileImage,
|
|
@@ -103,10 +102,10 @@ class Local extends core_2.Base {
|
|
|
103
102
|
},
|
|
104
103
|
},
|
|
105
104
|
});
|
|
106
|
-
core_1.
|
|
105
|
+
core_1.ux.action.stop();
|
|
107
106
|
await fs_extra_1.promises.writeFile(outputPath, '{}');
|
|
108
107
|
await fs_extra_1.promises.writeFile(errorPath, '');
|
|
109
|
-
const ipcAddress =
|
|
108
|
+
const ipcAddress = Object.values((0, node_os_1.networkInterfaces)()).flat().find(i => i?.family === 'IPv4' && !i?.internal)?.address || 'localhost';
|
|
110
109
|
const commands = [];
|
|
111
110
|
const entrypoint = [];
|
|
112
111
|
if (debug) {
|
|
@@ -122,7 +121,7 @@ class Local extends core_2.Base {
|
|
|
122
121
|
INPUTS: useStdin ? '' : inputs,
|
|
123
122
|
IPC_API_URI: `http://${ipcAddress}:8080`,
|
|
124
123
|
IPC_API_TOKEN: '',
|
|
125
|
-
}).map(([key, value]) => `${key}=${value
|
|
124
|
+
}).map(([key, value]) => `${key}=${value ?? ''}`);
|
|
126
125
|
const createOptions = {
|
|
127
126
|
Image: image,
|
|
128
127
|
Env: environmentVars,
|
|
@@ -144,74 +143,91 @@ class Local extends core_2.Base {
|
|
|
144
143
|
}],
|
|
145
144
|
};
|
|
146
145
|
}
|
|
147
|
-
core_1.
|
|
146
|
+
core_1.ux.action.start('Executing...');
|
|
148
147
|
const outputFile = new connector_1.ContainerStdoutActionOutputTransform((0, fs_extra_1.createWriteStream)(outputPath));
|
|
149
148
|
const errorFile = await (0, fs_extra_1.createWriteStream)(errorPath);
|
|
150
149
|
const success = await this.docker.runStdinImage(createOptions, outputFile, errorFile, inputs);
|
|
151
|
-
core_1.
|
|
150
|
+
core_1.ux.action.stop();
|
|
152
151
|
if (!success) {
|
|
153
152
|
core_1.Errors.exit(-1);
|
|
154
153
|
}
|
|
155
154
|
await this.cleanup();
|
|
156
155
|
}
|
|
157
156
|
async cleanup() {
|
|
158
|
-
core_1.
|
|
157
|
+
core_1.ux.action.start('Removing stale containers...');
|
|
159
158
|
try {
|
|
160
159
|
await this.docker.deleteContainer(`${this.IPC_API}-${this.containerName}`);
|
|
161
160
|
}
|
|
162
161
|
catch (error) {
|
|
163
|
-
core_1.
|
|
162
|
+
core_1.ux.debug(`Error deleting ${this.IPC_API}`, error.message);
|
|
164
163
|
}
|
|
165
164
|
try {
|
|
166
165
|
await this.docker.deleteContainer(this.containerName);
|
|
167
166
|
}
|
|
168
167
|
catch (error) {
|
|
169
|
-
core_1.
|
|
168
|
+
core_1.ux.debug(`Error deleting ${this.containerName}`, error.message);
|
|
170
169
|
}
|
|
171
|
-
core_1.
|
|
170
|
+
core_1.ux.action.stop();
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
173
|
exports.Local = Local;
|
|
175
174
|
Local.description = 'Runs a connector action. (Defaults to current image version in local repository).';
|
|
176
|
-
Local.flags =
|
|
175
|
+
Local.flags = {
|
|
176
|
+
...core_2.Base.flags,
|
|
177
|
+
action: core_1.Flags.string({
|
|
177
178
|
char: 'a',
|
|
178
179
|
description: 'Action name to run',
|
|
179
|
-
}),
|
|
180
|
+
}),
|
|
181
|
+
directory: core_1.Flags.string({
|
|
180
182
|
char: 'd',
|
|
181
183
|
description: 'Root directory of the repository.',
|
|
182
184
|
default: './',
|
|
183
|
-
}),
|
|
185
|
+
}),
|
|
186
|
+
'input-path': core_1.Flags.string({
|
|
184
187
|
description: 'File to input data JSON file, defaults to /data/<action>.json',
|
|
185
|
-
}),
|
|
188
|
+
}),
|
|
189
|
+
'output-path': core_1.Flags.string({
|
|
186
190
|
description: 'File to write the outputs to, defaults to /data/<action>_output.json',
|
|
187
|
-
}),
|
|
191
|
+
}),
|
|
192
|
+
'error-path': core_1.Flags.string({
|
|
188
193
|
description: 'File to write the errors to, defaults to /data/<action>_error.json',
|
|
189
|
-
}),
|
|
194
|
+
}),
|
|
195
|
+
'asset-path': core_1.Flags.string({
|
|
190
196
|
description: 'File to asset data JSON file, defaults to /data/asset.json',
|
|
191
|
-
}),
|
|
197
|
+
}),
|
|
198
|
+
template: core_1.Flags.string({
|
|
192
199
|
description: 'connector template',
|
|
193
|
-
options: ['python_37_swimlane', 'node_18', 'python_39_definition', 'python_310_definition', 'python_311_definition'],
|
|
200
|
+
options: ['python_37_swimlane', 'node_18', 'node_20', 'python_39_definition', 'python_310_definition', 'python_311_definition'],
|
|
194
201
|
required: false,
|
|
195
|
-
}),
|
|
202
|
+
}),
|
|
203
|
+
'compile-override': core_1.Flags.string({
|
|
196
204
|
hidden: true,
|
|
197
205
|
default: 'Compile.Dockerfile',
|
|
198
|
-
}),
|
|
206
|
+
}),
|
|
207
|
+
'runner-override': core_1.Flags.string({
|
|
199
208
|
hidden: true,
|
|
200
209
|
default: 'Runner.Dockerfile',
|
|
201
|
-
}),
|
|
210
|
+
}),
|
|
211
|
+
'runtime-override': core_1.Flags.string({
|
|
202
212
|
hidden: true,
|
|
203
|
-
}),
|
|
213
|
+
}),
|
|
214
|
+
'force-rebuild': core_1.Flags.boolean({
|
|
204
215
|
char: 'f',
|
|
205
216
|
description: 'forces nocache on the image build',
|
|
206
|
-
}),
|
|
217
|
+
}),
|
|
218
|
+
platform: core_1.Flags.string({
|
|
207
219
|
hidden: true,
|
|
208
220
|
default: 'linux/amd64',
|
|
209
|
-
}),
|
|
221
|
+
}),
|
|
222
|
+
debug: core_1.Flags.boolean({
|
|
210
223
|
hidden: true,
|
|
211
224
|
description: 'forces a breakpoint in run.py',
|
|
212
|
-
}),
|
|
225
|
+
}),
|
|
226
|
+
'no-remove': core_1.Flags.boolean({
|
|
213
227
|
hidden: true,
|
|
214
|
-
}),
|
|
228
|
+
}),
|
|
229
|
+
help: core_1.Flags.help({
|
|
215
230
|
char: 'h',
|
|
216
|
-
})
|
|
231
|
+
}),
|
|
232
|
+
};
|
|
217
233
|
//# sourceMappingURL=local.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../src/commands/action/run/local.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../src/commands/action/run/local.ts"],"names":[],"mappings":";;;;AAAA,sCAA6C;AAC7C,wCAA8C;AAC9C,yCAAuC;AACvC,uCAAyE;AACzE,4CAAqE;AACrE,wEAAkC;AAClC,wDAAuB;AACvB,iEAA6D;AAC7D,kDAAqG;AACrG,4CAAyD;AACzD,yEAA2F;AAC3F,qCAAyC;AAEzC,qCAAqC;AACrC,MAAa,KAAM,SAAQ,WAAI;IAA/B;;QA8DU,WAAM,GAAW,IAAI,eAAM,EAAE,CAAA;QAE7B,YAAO,GAAG,SAAS,CAAA;IAsM7B,CAAC;IApMC,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,GACN,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAE3B,IAAI,EACF,SAAS,GACV,GAAG,KAAK,CAAA;QAET,IAAI,KAAK,GAAG,EAAE,CAAA;QAEd,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,kBAAkB,EAAE,eAAe,EACnC,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,OAAO,EACxB,QAAQ,EACR,KAAK,EACL,WAAW,EAAE,QAAQ,GACtB,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,MAAM;YACN,IAAI,CAAC,KAAK,CAAC,oBAAoB,SAAS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mCAAmC;KACjD,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,aAAa;KACvB,CAAC;IACF,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,+BAA+B;KAC7C,CAAC;IACF,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC;QACzB,MAAM,EAAE,IAAI;KACb,CAAC;IACF,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC;QACf,IAAI,EAAE,GAAG;KACV,CAAC;CACH,AAzDW,CAyDX"}
|
|
@@ -2,8 +2,8 @@ import { Base } from '@sw-tsdk/core';
|
|
|
2
2
|
export declare class Add extends Base {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
directory: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
-
scheme: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
5
|
+
directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
6
|
+
scheme: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
7
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
@@ -30,22 +30,27 @@ class Add extends core_2.Base {
|
|
|
30
30
|
}]);
|
|
31
31
|
scheme = answers.scheme;
|
|
32
32
|
}
|
|
33
|
-
core_1.
|
|
34
|
-
await (0, fs_extra_1.copy)((0, node_path_1.join)(__dirname, '..', '..', 'templates', 'assets', `${scheme}.yaml`), (0, node_path_1.join)(directory, 'connector', 'config', 'assets', `${scheme}.yaml`)
|
|
35
|
-
core_1.
|
|
33
|
+
core_1.ux.action.start('Scaffolding new asset');
|
|
34
|
+
await (0, fs_extra_1.copy)((0, node_path_1.join)(__dirname, '..', '..', 'templates', 'assets', `${scheme}.yaml`), (0, node_path_1.join)(directory, 'connector', 'config', 'assets', `${scheme}.yaml`));
|
|
35
|
+
core_1.ux.action.stop();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
exports.Add = Add;
|
|
39
39
|
Add.description = 'Update a connector action.';
|
|
40
|
-
Add.flags =
|
|
40
|
+
Add.flags = {
|
|
41
|
+
...core_2.Base.flags,
|
|
42
|
+
directory: core_1.Flags.string({
|
|
41
43
|
char: 'd',
|
|
42
44
|
description: 'Root directory of the repository.',
|
|
43
45
|
default: './',
|
|
44
|
-
}),
|
|
46
|
+
}),
|
|
47
|
+
scheme: core_1.Flags.string({
|
|
45
48
|
char: 's',
|
|
46
49
|
description: 'asset template to scaffold',
|
|
47
50
|
options: ['custom', 'apikey', 'oauth2_client_credentials', 'http_basic', 'http_bearer'],
|
|
48
|
-
}),
|
|
51
|
+
}),
|
|
52
|
+
help: core_1.Flags.help({
|
|
49
53
|
char: 'h',
|
|
50
|
-
})
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
51
56
|
//# sourceMappingURL=add.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/asset/add.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/asset/add.ts"],"names":[],"mappings":";;;;AAAA,sCAAqC;AACrC,wCAAkC;AAClC,yCAAuC;AACvC,uCAA6B;AAC7B,wEAAkC;AAClC,gEAA+B;AAE/B,qCAAqC;AACrC,MAAa,GAAI,SAAQ,WAAI;IAoB3B,KAAK,CAAC,GAAG;QACP,MAAM,EACJ,KAAK,GACN,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAEzB,IAAI,EACF,SAAS,EACT,MAAM,GACP,GAAG,KAAK,CAAA;QAET,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,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KACV,CAAC;CACH,CAAA"}
|
|
@@ -2,20 +2,20 @@ import { Base } from '@sw-tsdk/core';
|
|
|
2
2
|
export declare class Build extends Base {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
template: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
-
'compile-override': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
7
|
-
'runner-override': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
-
'runtime-override': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
9
|
-
directory: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
5
|
+
template: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
6
|
+
'compile-override': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
'runner-override': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
'runtime-override': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
directory: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
10
|
save: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
squash: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
12
|
'force-rebuild': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
14
|
-
'signing-password': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
15
|
-
'key-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
13
|
+
platform: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
'signing-password': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
+
'key-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
16
|
'skip-upload': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
registry: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
18
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
17
|
+
registry: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
19
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
20
20
|
};
|
|
21
21
|
run(): Promise<void>;
|
|
@@ -34,13 +34,13 @@ class Build extends core_2.Base {
|
|
|
34
34
|
try {
|
|
35
35
|
await node_fs_1.promises.access(directory);
|
|
36
36
|
}
|
|
37
|
-
catch
|
|
37
|
+
catch {
|
|
38
38
|
this.error(`Could not access ${directory}`);
|
|
39
39
|
}
|
|
40
40
|
const docker = new docker_1.Docker();
|
|
41
|
-
core_1.
|
|
41
|
+
core_1.ux.action.start('Checking for docker...');
|
|
42
42
|
await docker.ping();
|
|
43
|
-
core_1.
|
|
43
|
+
core_1.ux.action.stop();
|
|
44
44
|
const dockerFileDir = `${directory}/Dockerfile`;
|
|
45
45
|
if ((0, node_fs_1.existsSync)(dockerFileDir)) {
|
|
46
46
|
await node_fs_1.promises.rm(dockerFileDir);
|
|
@@ -86,48 +86,65 @@ class Build extends core_2.Base {
|
|
|
86
86
|
}
|
|
87
87
|
exports.Build = Build;
|
|
88
88
|
Build.description = 'Builds a local docker image of the connector.';
|
|
89
|
-
Build.flags =
|
|
89
|
+
Build.flags = {
|
|
90
|
+
...core_2.Base.flags,
|
|
91
|
+
template: core_1.Flags.string({
|
|
90
92
|
description: 'connector language',
|
|
91
|
-
options: ['python_37_swimlane', 'node_18', 'python_39_definition', 'python_310_definition', 'python_311_definition'],
|
|
93
|
+
options: ['python_37_swimlane', 'node_18', 'node_20', 'python_39_definition', 'python_310_definition', 'python_311_definition'],
|
|
92
94
|
required: false,
|
|
93
|
-
}),
|
|
95
|
+
}),
|
|
96
|
+
'compile-override': core_1.Flags.string({
|
|
94
97
|
hidden: true,
|
|
95
98
|
default: 'Compile.Dockerfile',
|
|
96
|
-
}),
|
|
99
|
+
}),
|
|
100
|
+
'runner-override': core_1.Flags.string({
|
|
97
101
|
hidden: true,
|
|
98
102
|
default: 'Runner.Dockerfile',
|
|
99
|
-
}),
|
|
103
|
+
}),
|
|
104
|
+
'runtime-override': core_1.Flags.string({
|
|
100
105
|
hidden: true,
|
|
101
|
-
}),
|
|
106
|
+
}),
|
|
107
|
+
directory: core_1.Flags.string({
|
|
102
108
|
char: 'd',
|
|
103
109
|
description: 'root directory of the repository.',
|
|
104
110
|
default: './',
|
|
105
|
-
}),
|
|
111
|
+
}),
|
|
112
|
+
save: core_1.Flags.boolean({
|
|
106
113
|
description: 'saves a signed docker image as tar in local directory.',
|
|
107
|
-
}),
|
|
114
|
+
}),
|
|
115
|
+
squash: core_1.Flags.boolean({
|
|
108
116
|
description: 'squashes the docker layers.',
|
|
109
117
|
hidden: true,
|
|
110
|
-
}),
|
|
118
|
+
}),
|
|
119
|
+
'force-rebuild': core_1.Flags.boolean({
|
|
111
120
|
char: 'f',
|
|
112
121
|
description: 'forces nocache on the image build',
|
|
113
|
-
}),
|
|
122
|
+
}),
|
|
123
|
+
platform: core_1.Flags.string({
|
|
114
124
|
hidden: true,
|
|
115
125
|
default: 'linux/amd64',
|
|
116
|
-
}),
|
|
126
|
+
}),
|
|
127
|
+
'signing-password': core_1.Flags.string({
|
|
117
128
|
description: 'password used for the private key (ENV: TURBINE_SIGNING_PASSWORD)',
|
|
118
129
|
default: '',
|
|
119
130
|
env: 'TURBINE_SIGNING_PASSWORD',
|
|
120
|
-
}),
|
|
131
|
+
}),
|
|
132
|
+
'key-name': core_1.Flags.string({
|
|
121
133
|
description: 'name used for the key (default: username_yyyy-MM-dd)',
|
|
122
|
-
}),
|
|
134
|
+
}),
|
|
135
|
+
'skip-upload': core_1.Flags.boolean({
|
|
123
136
|
hidden: true,
|
|
124
|
-
}),
|
|
137
|
+
}),
|
|
138
|
+
registry: core_1.Flags.string({
|
|
125
139
|
description: 'registry to use for signing',
|
|
126
140
|
default: 'localhost:5000',
|
|
127
|
-
}),
|
|
141
|
+
}),
|
|
142
|
+
output: core_1.Flags.string({
|
|
128
143
|
char: 'o',
|
|
129
144
|
description: 'output path to where to store the image.',
|
|
130
|
-
}),
|
|
145
|
+
}),
|
|
146
|
+
help: core_1.Flags.help({
|
|
131
147
|
char: 'h',
|
|
132
|
-
})
|
|
148
|
+
}),
|
|
149
|
+
};
|
|
133
150
|
//# sourceMappingURL=build.js.map
|