@adinsure-ops/ops-cli 5.2.2 → 5.3.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 +123 -9
- package/lib/commands/config/get.d.ts +11 -0
- package/lib/commands/config/get.js +40 -0
- package/lib/commands/config/list.d.ts +8 -0
- package/lib/commands/config/list.js +26 -0
- package/lib/commands/config/set.d.ts +12 -0
- package/lib/commands/config/set.js +60 -0
- package/lib/commands/config/unset.d.ts +11 -0
- package/lib/commands/config/unset.js +42 -0
- package/lib/commands/download/client.d.ts +11 -3
- package/lib/commands/download/client.js +52 -8
- package/lib/commands/download/identity-server.d.ts +11 -3
- package/lib/commands/download/identity-server.js +53 -8
- package/lib/commands/download/jmeter.d.ts +1 -1
- package/lib/commands/download/jmeter.js +13 -3
- package/lib/commands/download/keycloak-scim.d.ts +1 -1
- package/lib/commands/download/keycloak-scim.js +13 -3
- package/lib/commands/download/platform.d.ts +11 -3
- package/lib/commands/download/platform.js +53 -8
- package/lib/commands/download/scheduler.d.ts +11 -3
- package/lib/commands/download/scheduler.js +52 -8
- package/lib/commands/download/server.d.ts +11 -3
- package/lib/commands/download/server.js +53 -9
- package/lib/commands/download/signalr.d.ts +11 -3
- package/lib/commands/download/signalr.js +52 -8
- package/lib/commands/download/studio.d.ts +11 -3
- package/lib/commands/download/studio.js +52 -8
- package/lib/commands/login.d.ts +9 -0
- package/lib/commands/login.js +60 -1
- package/lib/commands/login.ru.d.ts +12 -0
- package/lib/commands/login.ru.js +42 -0
- package/lib/commands/npm/check-publish.js +1 -1
- package/lib/lib/config.d.ts +10 -0
- package/lib/lib/config.js +33 -0
- package/lib/lib/yarnrc.d.ts +22 -0
- package/lib/lib/yarnrc.js +40 -0
- package/lib/security/context.d.ts +22 -0
- package/lib/security/context.js +113 -0
- package/oclif.manifest.json +275 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,6 +57,7 @@ We changed the way service principal login works. It is no longer needed to call
|
|
|
57
57
|
- [`ops log:gen [options]`](#ops-loggen-options)
|
|
58
58
|
- [`ops log:validate [options]`](#ops-logvalidate-options)
|
|
59
59
|
- [`ops login`](#ops-login)
|
|
60
|
+
- [`ops login:ru`](#ops-loginru---token-token)
|
|
60
61
|
- [`ops npm:check-publish`](#ops-npmcheck-publish)
|
|
61
62
|
- [`ops npm:publish`](#ops-npmpublish)
|
|
62
63
|
- [`ops npm:dependency-update`](#ops-npmdependency-update)
|
|
@@ -65,6 +66,10 @@ We changed the way service principal login works. It is no longer needed to call
|
|
|
65
66
|
- [`ops sql <type> <module> [flags]`](#ops-sql-type-module-flags)
|
|
66
67
|
- [`ops translate`](#ops-translate)
|
|
67
68
|
- [`ops version <type> [flags]`](#ops-version-type)
|
|
69
|
+
- [`ops config:set <type> <value>`](#ops-configset-type-value)
|
|
70
|
+
- [`ops config:unset <type>`](#ops-configunset-type)
|
|
71
|
+
- [`ops config:get <type>`](#ops-configget-type)
|
|
72
|
+
- [`ops config:list`](#ops-configlist)
|
|
68
73
|
|
|
69
74
|
## `ops help [COMMAND]`
|
|
70
75
|
|
|
@@ -107,11 +112,13 @@ USAGE
|
|
|
107
112
|
$ ops download:client <flags>
|
|
108
113
|
|
|
109
114
|
OPTIONS
|
|
110
|
-
-o, --output=output [default: ./] output directory.
|
|
115
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
111
116
|
-v, --version=version (required) version we want to download.
|
|
117
|
+
-s, --source=source [default: azure] artifact source. (can be configured via 'config:set endpoint')
|
|
112
118
|
|
|
113
119
|
EXAMPLE
|
|
114
120
|
$ ops download:client -v 3.2.0 -o ~/Downloads
|
|
121
|
+
$ ops download:client -v 3.2.0 -s gitlabru
|
|
115
122
|
```
|
|
116
123
|
|
|
117
124
|
## `ops download:identity-server <flags>`
|
|
@@ -123,11 +130,14 @@ USAGE
|
|
|
123
130
|
$ ops download:identity-server <flags>
|
|
124
131
|
|
|
125
132
|
OPTIONS
|
|
126
|
-
-o, --output=output [default: ./] output directory.
|
|
133
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
127
134
|
-v, --version=version (required) version we want to download.
|
|
135
|
+
-s, --source=source [default: azure] artifact source. (can be configured via 'config:set endpoint')
|
|
136
|
+
|
|
128
137
|
|
|
129
138
|
EXAMPLE
|
|
130
139
|
$ ops download:identity-server -v 3.0.3 -o ~/Downloads
|
|
140
|
+
$ ops download:identity-server -v 3.0.3 -s gitlabru
|
|
131
141
|
```
|
|
132
142
|
|
|
133
143
|
## `ops download:platform <flags>`
|
|
@@ -139,14 +149,17 @@ USAGE
|
|
|
139
149
|
$ ops download <flags>
|
|
140
150
|
|
|
141
151
|
OPTIONS
|
|
142
|
-
-o, --output=output [default: ./] output directory.
|
|
152
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
143
153
|
-v, --version=version (required) version we want to download.
|
|
154
|
+
-s, --source=source [default: azure] artifact source. (can be configured via 'config:set endpoint')
|
|
155
|
+
|
|
144
156
|
|
|
145
157
|
ALIASES
|
|
146
158
|
$ ops download
|
|
147
159
|
|
|
148
160
|
EXAMPLE
|
|
149
161
|
$ ops download -v 6.0.0 -o ~/Downloads
|
|
162
|
+
$ ops download -v 6.0.0 -s gitlabru
|
|
150
163
|
```
|
|
151
164
|
|
|
152
165
|
## `ops download:scheduler <flags>`
|
|
@@ -158,11 +171,14 @@ USAGE
|
|
|
158
171
|
$ ops download:scheduler <flags>
|
|
159
172
|
|
|
160
173
|
OPTIONS
|
|
161
|
-
-o, --output=output [default: ./] output directory.
|
|
174
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
162
175
|
-v, --version=version (required) version we want to download.
|
|
176
|
+
-s, --source=source [default: azure] artifact source. (can be configured via 'config:set endpoint')
|
|
177
|
+
|
|
163
178
|
|
|
164
179
|
EXAMPLE
|
|
165
180
|
$ ops download:scheduler -v 3.2.0 -o ~/Downloads
|
|
181
|
+
$ ops download:scheduler -v 3.2.0 -s gitlabru
|
|
166
182
|
```
|
|
167
183
|
|
|
168
184
|
## `ops download:server <flags>`
|
|
@@ -174,11 +190,14 @@ USAGE
|
|
|
174
190
|
$ ops download:server <flags>
|
|
175
191
|
|
|
176
192
|
OPTIONS
|
|
177
|
-
-o, --output=output [default: ./] output directory.
|
|
193
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
178
194
|
-v, --version=version (required) version we want to download.
|
|
195
|
+
-s, --source=source [default: azure] artifact source. (can be configured via 'config:set endpoint')
|
|
196
|
+
|
|
179
197
|
|
|
180
198
|
EXAMPLE
|
|
181
199
|
$ ops download:server -v 3.2.0 -o ~/Downloads
|
|
200
|
+
$ ops download:server -v 3.2.0 -s gitlabru
|
|
182
201
|
```
|
|
183
202
|
|
|
184
203
|
## `ops download:signalr <flags>`
|
|
@@ -190,11 +209,14 @@ USAGE
|
|
|
190
209
|
$ ops download:signalr <flags>
|
|
191
210
|
|
|
192
211
|
OPTIONS
|
|
193
|
-
-o, --output=output [default: ./] output directory.
|
|
212
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
194
213
|
-v, --version=version (required) version we want to download.
|
|
214
|
+
-s, --source=source [default: azure] artifact source. (can be configured via 'config:set endpoint')
|
|
215
|
+
|
|
195
216
|
|
|
196
217
|
EXAMPLE
|
|
197
218
|
$ ops download:signalr -v 18.0.0 -o ~/Downloads
|
|
219
|
+
$ ops download:signalr -v 18.0.0 -s gitlabru
|
|
198
220
|
```
|
|
199
221
|
|
|
200
222
|
## `ops download:studio <flags>`
|
|
@@ -208,15 +230,18 @@ USAGE
|
|
|
208
230
|
OPTIONS
|
|
209
231
|
-k, --keep only with install. If passed, it will not remove the vsix file.
|
|
210
232
|
-i, --install install plugin to vscode. save to temp folder and remove vsix after.
|
|
211
|
-
-o, --output=output [default: ./] output directory.
|
|
233
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
212
234
|
-s, --skip only with install. If passed, and desired version is installed it will skip it.
|
|
213
235
|
-v, --version=version (required) version we want to download.
|
|
214
236
|
-f, --force Create output directory if it does not exist. By default this is false and it depends on the output switch.
|
|
237
|
+
--source=source [default: azure] artifact source. (can be configured via 'config:set endpoint')
|
|
238
|
+
|
|
215
239
|
|
|
216
240
|
EXAMPLES
|
|
217
241
|
$ ops download:studio -v 15.0.0 -o ~/Downloads
|
|
218
242
|
$ ops download:studio -v 15.0.0 -i
|
|
219
243
|
$ ops download:studio -v 15.0.0 -i -s
|
|
244
|
+
$ ops download:studio -v 15.0.0 --source=gitlabru
|
|
220
245
|
```
|
|
221
246
|
|
|
222
247
|
## `ops download:keycloak-scim <flags>`
|
|
@@ -228,7 +253,7 @@ USAGE
|
|
|
228
253
|
$ ops download:keycloak-scim <flags>
|
|
229
254
|
|
|
230
255
|
OPTIONS
|
|
231
|
-
-o, --output=output [default: ./] output directory.
|
|
256
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
232
257
|
-v, --version=version (required) version we want to download.
|
|
233
258
|
|
|
234
259
|
EXAMPLES
|
|
@@ -245,7 +270,7 @@ USAGE
|
|
|
245
270
|
$ ops download:jmeter <flags>
|
|
246
271
|
|
|
247
272
|
OPTIONS
|
|
248
|
-
-o, --output=output [default: ./] output directory.
|
|
273
|
+
-o, --output=output [default: ./] output directory. (can be configured via 'config:set download_folder')
|
|
249
274
|
|
|
250
275
|
EXAMPLES
|
|
251
276
|
$ ops download:jmeter -o ~/Downloads
|
|
@@ -430,6 +455,26 @@ EXAMPLES
|
|
|
430
455
|
$ ops login --deviceFlow
|
|
431
456
|
```
|
|
432
457
|
|
|
458
|
+
## `ops login:ru --token <token>`
|
|
459
|
+
|
|
460
|
+
Log in to use OPS services with a GitLabRu token.
|
|
461
|
+
|
|
462
|
+
```txt
|
|
463
|
+
USAGE
|
|
464
|
+
$ ops login:ru --token <token> [--force]
|
|
465
|
+
|
|
466
|
+
OPTIONS
|
|
467
|
+
--token=token (required) The GitLabRu token to store.
|
|
468
|
+
--force Force update of the stored token.
|
|
469
|
+
|
|
470
|
+
ALIASES
|
|
471
|
+
$ ops login:ru
|
|
472
|
+
|
|
473
|
+
EXAMPLES
|
|
474
|
+
$ ops login:ru --token abc123
|
|
475
|
+
$ ops login:ru --token xyz789 --force
|
|
476
|
+
```
|
|
477
|
+
|
|
433
478
|
## `ops npm:check-publish`
|
|
434
479
|
|
|
435
480
|
check if npm packages were published
|
|
@@ -832,3 +877,72 @@ EXAMPLES
|
|
|
832
877
|
$ ops translate "en-US=en-US;ru-Ru=ru-RU" -f json -m "Client business accounting;Client business base;"
|
|
833
878
|
$ ops translate "en-US=en-US;ru-Ru=ru-RU" -f xml -o translationDestination
|
|
834
879
|
```
|
|
880
|
+
|
|
881
|
+
## `ops config:set <type> <value>`
|
|
882
|
+
|
|
883
|
+
Set a configuration value for OPS.
|
|
884
|
+
|
|
885
|
+
```txt
|
|
886
|
+
USAGE
|
|
887
|
+
$ ops config:set <type> <value>
|
|
888
|
+
|
|
889
|
+
OPTIONS
|
|
890
|
+
type (required) Type of OPS configuration. Available options: [endpoint, download_folder].
|
|
891
|
+
value (required) Possible configuration values. Available options for endpoint: [azure, gitlabru]. Expects a valid path for download_folder.
|
|
892
|
+
|
|
893
|
+
ALIASES
|
|
894
|
+
$ ops config:set
|
|
895
|
+
|
|
896
|
+
EXAMPLES
|
|
897
|
+
$ ops config:set endpoint gitlabru
|
|
898
|
+
$ ops config:set endpoint azure
|
|
899
|
+
$ ops config:set download_folder ./Downloads
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
## `ops config:unset <type>`
|
|
903
|
+
|
|
904
|
+
Remove a configuration value so that the system default is used.
|
|
905
|
+
|
|
906
|
+
```txt
|
|
907
|
+
USAGE
|
|
908
|
+
$ ops config:unset <type>
|
|
909
|
+
|
|
910
|
+
OPTIONS
|
|
911
|
+
type (required) Type of OPS configuration. Available options: [endpoint, download_folder].
|
|
912
|
+
|
|
913
|
+
ALIASES
|
|
914
|
+
$ ops config:unset
|
|
915
|
+
|
|
916
|
+
EXAMPLES
|
|
917
|
+
$ ops config:unset endpoint
|
|
918
|
+
$ ops config:unset download_folder
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
## `ops config:get <type>`
|
|
923
|
+
|
|
924
|
+
Retrieve a configuration value for OPS.
|
|
925
|
+
|
|
926
|
+
```txt
|
|
927
|
+
USAGE
|
|
928
|
+
$ ops config:get <type>
|
|
929
|
+
|
|
930
|
+
OPTIONS
|
|
931
|
+
type (required) Type of OPS configuration to retrieve. Available options: [endpoint, download_folder].
|
|
932
|
+
|
|
933
|
+
ALIASES
|
|
934
|
+
$ ops config:get
|
|
935
|
+
|
|
936
|
+
EXAMPLES
|
|
937
|
+
$ ops config:get endpoint
|
|
938
|
+
$ ops config:get download_folder
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
## `ops config:list`
|
|
942
|
+
|
|
943
|
+
List all OPS configuration values stored in the config file.
|
|
944
|
+
|
|
945
|
+
```txt
|
|
946
|
+
USAGE
|
|
947
|
+
$ ops config:list
|
|
948
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CommandBase from '../../command.base.js';
|
|
2
|
+
export default class ConfigGet extends CommandBase<typeof ConfigGet> {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static description: string;
|
|
5
|
+
static usage: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static args: {
|
|
8
|
+
type: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { Args } from '@oclif/core';
|
|
3
|
+
import CommandBase from '../../command.base.js';
|
|
4
|
+
import OpsConfig from '../../lib/config.js';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
class ConfigGet extends CommandBase {
|
|
7
|
+
run() {
|
|
8
|
+
const _super = Object.create(null, {
|
|
9
|
+
run: { get: () => super.run }
|
|
10
|
+
});
|
|
11
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
_super.run.call(this);
|
|
13
|
+
const { args } = yield this.parse(ConfigGet);
|
|
14
|
+
const configPath = this.security.getConfigPath();
|
|
15
|
+
const config = new OpsConfig(configPath);
|
|
16
|
+
const value = config.get(args.type);
|
|
17
|
+
if (value === undefined) {
|
|
18
|
+
this.log(chalk.yellow(`No configuration found for '${args.type}'.`));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.log(chalk.green(`${args.type} = ${value}`));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
ConfigGet.aliases = ['config:get'];
|
|
27
|
+
ConfigGet.description = 'Get a configuration value';
|
|
28
|
+
ConfigGet.usage = 'config:get <type>';
|
|
29
|
+
ConfigGet.examples = [
|
|
30
|
+
'$ ops config:get endpoint',
|
|
31
|
+
'$ ops config:get download_folder',
|
|
32
|
+
];
|
|
33
|
+
ConfigGet.args = {
|
|
34
|
+
type: Args.string({
|
|
35
|
+
description: 'Type of OPS configuration to retrieve',
|
|
36
|
+
options: ['endpoint', 'download_folder'],
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
export default ConfigGet;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import CommandBase from '../../command.base.js';
|
|
4
|
+
import OpsConfig from '../../lib/config.js';
|
|
5
|
+
class ConfigList extends CommandBase {
|
|
6
|
+
run() {
|
|
7
|
+
const _super = Object.create(null, {
|
|
8
|
+
run: { get: () => super.run }
|
|
9
|
+
});
|
|
10
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
_super.run.call(this);
|
|
12
|
+
const configPath = this.security.getConfigPath();
|
|
13
|
+
const config = new OpsConfig(configPath);
|
|
14
|
+
const allConfig = config.list();
|
|
15
|
+
this.log(chalk.green("config.json:"));
|
|
16
|
+
this.log(JSON.stringify(allConfig, null, 2));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
ConfigList.aliases = ['config:list'];
|
|
21
|
+
ConfigList.description = 'List all configuration values';
|
|
22
|
+
ConfigList.usage = 'config:list';
|
|
23
|
+
ConfigList.examples = [
|
|
24
|
+
'$ ops config:list'
|
|
25
|
+
];
|
|
26
|
+
export default ConfigList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import CommandBase from '../../command.base.js';
|
|
2
|
+
export default class ConfigSet extends CommandBase<typeof ConfigSet> {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static description: string;
|
|
5
|
+
static usage: 'config:set <type> <value>';
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static args: {
|
|
8
|
+
type: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
9
|
+
value: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { Args } from '@oclif/core';
|
|
3
|
+
import CommandBase from '../../command.base.js';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import OpsConfig from '../../lib/config.js';
|
|
8
|
+
class ConfigSet extends CommandBase {
|
|
9
|
+
run() {
|
|
10
|
+
const _super = Object.create(null, {
|
|
11
|
+
run: { get: () => super.run }
|
|
12
|
+
});
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
_super.run.call(this);
|
|
15
|
+
const { args } = yield this.parse(ConfigSet);
|
|
16
|
+
const configPath = this.security.getConfigPath();
|
|
17
|
+
const config = new OpsConfig(configPath);
|
|
18
|
+
if (args.type === 'endpoint') {
|
|
19
|
+
if (args.value !== 'azure' && args.value !== 'gitlabru') {
|
|
20
|
+
this.error(chalk.red('For endpoint, allowed values are "azure" and "gitlabru".'));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (args.type === 'download_folder') {
|
|
24
|
+
// Resolve the given path
|
|
25
|
+
const resolvedPath = path.resolve(args.value);
|
|
26
|
+
// Check if the path exists and is a directory
|
|
27
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
28
|
+
this.error(chalk.red(`The specified download folder does not exist: ${resolvedPath}`));
|
|
29
|
+
}
|
|
30
|
+
else if (!fs.statSync(resolvedPath).isDirectory()) {
|
|
31
|
+
this.error(chalk.red(`The specified path is not a directory: ${resolvedPath}`));
|
|
32
|
+
}
|
|
33
|
+
// Overwrite args.value with the resolved absolute path for consistency
|
|
34
|
+
args.value = resolvedPath;
|
|
35
|
+
}
|
|
36
|
+
config.set(args.type, args.value);
|
|
37
|
+
config.save();
|
|
38
|
+
this.log(chalk.green(`Configuration updated: ${args.type} = ${args.value}`));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
ConfigSet.aliases = ['config:set'];
|
|
43
|
+
ConfigSet.description = 'Set a configuration value';
|
|
44
|
+
ConfigSet.examples = [
|
|
45
|
+
'$ ops config:set endpoint gitlabru',
|
|
46
|
+
'$ ops config:set endpoint azure',
|
|
47
|
+
'$ ops config:set download_folder ~/Downloads',
|
|
48
|
+
];
|
|
49
|
+
ConfigSet.args = {
|
|
50
|
+
type: Args.string({
|
|
51
|
+
description: 'Type of OPS configuration',
|
|
52
|
+
options: ['endpoint', 'download_folder'],
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
value: Args.string({
|
|
56
|
+
description: 'For "endpoint", allowed values: azure, gitlabru; for "download_folder", a valid folder path is expected.',
|
|
57
|
+
required: true,
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
export default ConfigSet;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CommandBase from '../../command.base.js';
|
|
2
|
+
export default class ConfigUnset extends CommandBase<typeof ConfigUnset> {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static description: string;
|
|
5
|
+
static usage: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static args: {
|
|
8
|
+
type: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { Args } from '@oclif/core';
|
|
3
|
+
import CommandBase from '../../command.base.js';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import OpsConfig from '../../lib/config.js';
|
|
6
|
+
class ConfigUnset extends CommandBase {
|
|
7
|
+
run() {
|
|
8
|
+
const _super = Object.create(null, {
|
|
9
|
+
run: { get: () => super.run }
|
|
10
|
+
});
|
|
11
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
_super.run.call(this);
|
|
13
|
+
const { args } = yield this.parse(ConfigUnset);
|
|
14
|
+
const configPath = this.security.getConfigPath();
|
|
15
|
+
const config = new OpsConfig(configPath);
|
|
16
|
+
// Check if the key is set; if not, inform the user.
|
|
17
|
+
if (config.get(args.type) === undefined) {
|
|
18
|
+
this.log(chalk.yellow(`Configuration '${args.type}' is not set.`));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// Remove the configuration key and save the file
|
|
22
|
+
config.unset(args.type);
|
|
23
|
+
config.save();
|
|
24
|
+
this.log(chalk.green(`Configuration '${args.type}' has been removed. System defaults will be used.`));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
ConfigUnset.aliases = ['config:unset'];
|
|
29
|
+
ConfigUnset.description = 'Remove a configuration value so that the system default is used';
|
|
30
|
+
ConfigUnset.usage = 'config:unset <type>';
|
|
31
|
+
ConfigUnset.examples = [
|
|
32
|
+
'$ ops config:unset endpoint',
|
|
33
|
+
'$ ops config:unset download_folder'
|
|
34
|
+
];
|
|
35
|
+
ConfigUnset.args = {
|
|
36
|
+
type: Args.string({
|
|
37
|
+
description: 'Type of OPS configuration to remove',
|
|
38
|
+
options: ['endpoint', 'download_folder'],
|
|
39
|
+
required: true,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
export default ConfigUnset;
|
|
@@ -6,15 +6,23 @@ export default class DownloadClient extends CommandBase<typeof DownloadClient> {
|
|
|
6
6
|
static usage: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
+
source: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
10
|
version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
|
-
output: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
output: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
12
|
};
|
|
12
|
-
private readonly
|
|
13
|
+
private readonly url_azure;
|
|
14
|
+
private readonly url_gitlabru;
|
|
13
15
|
/**
|
|
14
16
|
* Get unique AdInsure Client zip by specified version
|
|
15
17
|
* @param {string} version The version of AdInsure Client
|
|
16
18
|
* @returns {Promise<AxiosResponse<any, any>>}
|
|
17
19
|
*/
|
|
18
|
-
|
|
20
|
+
downloadFileFromAzure(version: string): Promise<AxiosResponse<any, any>>;
|
|
21
|
+
/**
|
|
22
|
+
* Get unique AdInsure Client zip by specified version
|
|
23
|
+
* @param {string} version The version of AdInsure Client
|
|
24
|
+
* @returns {Promise<AxiosResponse<any, any>>}
|
|
25
|
+
*/
|
|
26
|
+
downloadFileFromGitLabRu(version: string): Promise<AxiosResponse<any>>;
|
|
19
27
|
run(): Promise<void>;
|
|
20
28
|
}
|
|
@@ -6,10 +6,12 @@ import fs from 'fs-extra';
|
|
|
6
6
|
import os from 'os';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import CommandBase from '../../command.base.js';
|
|
9
|
+
import OpsConfig from '../../lib/config.js';
|
|
9
10
|
class DownloadClient extends CommandBase {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments);
|
|
12
|
-
this.
|
|
13
|
+
this.url_azure = 'https://ops.adinsure.com/api/storage/binaries/';
|
|
14
|
+
this.url_gitlabru = 'https://gitlabru.adacta-fintech.ru/api/v4/projects/2/packages/generic';
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Get unique AdInsure Client zip by specified version
|
|
@@ -17,9 +19,9 @@ class DownloadClient extends CommandBase {
|
|
|
17
19
|
* @returns {Promise<AxiosResponse<any, any>>}
|
|
18
20
|
*/
|
|
19
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
|
|
22
|
+
downloadFileFromAzure(version) {
|
|
21
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return axios.get(`${this.
|
|
24
|
+
return axios.get(`${this.url_azure}/AdInsure-client-${version}.zip`, {
|
|
23
25
|
headers: {
|
|
24
26
|
Authorization: 'Bearer ' + (yield this.security.getToken()),
|
|
25
27
|
'Content-Type': 'application/octet-stream',
|
|
@@ -28,6 +30,24 @@ class DownloadClient extends CommandBase {
|
|
|
28
30
|
});
|
|
29
31
|
});
|
|
30
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Get unique AdInsure Client zip by specified version
|
|
35
|
+
* @param {string} version The version of AdInsure Client
|
|
36
|
+
* @returns {Promise<AxiosResponse<any, any>>}
|
|
37
|
+
*/
|
|
38
|
+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
downloadFileFromGitLabRu(version) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const packageName = 'AdInsure-client';
|
|
42
|
+
const fileName = `${packageName}-${version}.zip`;
|
|
43
|
+
return axios.get(`${this.url_gitlabru}/${packageName}/${version}/${fileName}`, {
|
|
44
|
+
headers: {
|
|
45
|
+
'PRIVATE-TOKEN': this.security.getTokenRu(),
|
|
46
|
+
},
|
|
47
|
+
responseType: 'arraybuffer',
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
31
51
|
run() {
|
|
32
52
|
const _super = Object.create(null, {
|
|
33
53
|
run: { get: () => super.run }
|
|
@@ -35,12 +55,32 @@ class DownloadClient extends CommandBase {
|
|
|
35
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
56
|
_super.run.call(this);
|
|
37
57
|
const { flags } = yield this.parse(DownloadClient);
|
|
38
|
-
|
|
58
|
+
let outputDir = flags.output;
|
|
59
|
+
if (!outputDir) {
|
|
60
|
+
// If the user didn't provide the output flag, try to get the default from config.
|
|
61
|
+
const config = new OpsConfig(this.security.getConfigPath());
|
|
62
|
+
const defaultFolder = config.get('download_folder');
|
|
63
|
+
outputDir = defaultFolder || './'; // no flag -> DEFAULT output is "./"
|
|
64
|
+
}
|
|
65
|
+
// Expand tilde if present
|
|
66
|
+
const basePath = outputDir.charAt(0) === '~'
|
|
67
|
+
? os.homedir() + outputDir.split('~')[1]
|
|
68
|
+
: outputDir;
|
|
39
69
|
const filename = `AdInsure-client-${flags.version}.zip`;
|
|
40
70
|
const filePath = path.resolve(basePath, filename);
|
|
41
71
|
ux.action.start(`Downloading AdInsure Client version ${flags.version} to ${filePath}`, undefined, { stdout: true });
|
|
42
72
|
try {
|
|
43
|
-
|
|
73
|
+
var file;
|
|
74
|
+
if (!flags.source) {
|
|
75
|
+
const config = new OpsConfig(this.security.getConfigPath());
|
|
76
|
+
flags.source = config.get('endpoint') || 'azure'; // no flag -> DEFAULT source is azure
|
|
77
|
+
}
|
|
78
|
+
if (flags.source === 'azure') {
|
|
79
|
+
file = yield this.downloadFileFromAzure(flags.version);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
file = yield this.downloadFileFromGitLabRu(flags.version);
|
|
83
|
+
}
|
|
44
84
|
const writeStream = fs.createWriteStream(filePath);
|
|
45
85
|
writeStream.write(file.data, 'binary');
|
|
46
86
|
writeStream.on('finish', () => {
|
|
@@ -52,10 +92,10 @@ class DownloadClient extends CommandBase {
|
|
|
52
92
|
catch (error) {
|
|
53
93
|
switch (error.statusCode) {
|
|
54
94
|
case 404: {
|
|
55
|
-
this.error('Does not
|
|
95
|
+
this.error('Does not exist.', { exit: 1 });
|
|
56
96
|
}
|
|
57
97
|
case 400: {
|
|
58
|
-
this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
|
|
98
|
+
this.error('Try refreshing your login credentials with "ops login" or "ops login:ru".', { exit: 1 });
|
|
59
99
|
}
|
|
60
100
|
default: {
|
|
61
101
|
this.error(error.message);
|
|
@@ -72,6 +112,11 @@ DownloadClient.examples = [
|
|
|
72
112
|
`$ ops download:client -v 3.2.0 -o ~/Downloads`,
|
|
73
113
|
];
|
|
74
114
|
DownloadClient.flags = {
|
|
115
|
+
source: Flags.string({
|
|
116
|
+
char: 's',
|
|
117
|
+
description: '[default: azure] artifact source, configurable with config:set endpoint <option>',
|
|
118
|
+
options: ['azure', 'gitlabru'],
|
|
119
|
+
}),
|
|
75
120
|
version: Flags.string({
|
|
76
121
|
char: 'v',
|
|
77
122
|
description: 'version we want to download',
|
|
@@ -80,7 +125,6 @@ DownloadClient.flags = {
|
|
|
80
125
|
output: Flags.string({
|
|
81
126
|
char: 'o',
|
|
82
127
|
description: 'output directory',
|
|
83
|
-
default: './',
|
|
84
128
|
}),
|
|
85
129
|
};
|
|
86
130
|
export default DownloadClient;
|
|
@@ -5,15 +5,23 @@ export default class DownloadIdentityServer extends CommandBase<typeof DownloadI
|
|
|
5
5
|
static usage: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
source: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
9
|
version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
|
-
output: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
|
+
output: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
11
|
};
|
|
11
|
-
private readonly
|
|
12
|
+
private readonly url_azure;
|
|
13
|
+
private readonly url_gitlabru;
|
|
12
14
|
/**
|
|
13
15
|
* Get unique Identity Server zip by specified version
|
|
14
16
|
* @param {string} version The version of Identity Server
|
|
15
17
|
* @returns {Promise<AxiosResponse<any, any>>}
|
|
16
18
|
*/
|
|
17
|
-
|
|
19
|
+
downloadFileFromAzure(version: string): Promise<AxiosResponse<any, any>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get unique Identity Server zip by specified version
|
|
22
|
+
* @param {string} version The version of Identity Server
|
|
23
|
+
* @returns {Promise<AxiosResponse<any, any>>}
|
|
24
|
+
*/
|
|
25
|
+
downloadFileFromGitLabRu(version: string): Promise<AxiosResponse<any>>;
|
|
18
26
|
run(): Promise<void>;
|
|
19
27
|
}
|