@adinsure-ops/ops-cli 5.4.2-rc1 → 5.5.0-rc1
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 +140 -2
- package/bin/run.js +2 -6
- package/lib/command.base.d.ts +7 -1
- package/lib/command.base.jira.d.ts +23 -5
- package/lib/command.base.jira.js +47 -12
- package/lib/command.base.js +37 -8
- package/lib/command.download.d.ts +11 -0
- package/lib/command.download.js +27 -0
- package/lib/commands/config/get.d.ts +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.d.ts +2 -2
- package/lib/commands/config/set.js +2 -2
- package/lib/commands/config/unset.d.ts +1 -1
- package/lib/commands/docker/update-image-version.d.ts +31 -3
- package/lib/commands/docker/update-image-version.js +112 -6
- package/lib/commands/doctor.d.ts +1 -1
- package/lib/commands/download/client.d.ts +7 -20
- package/lib/commands/download/client.js +12 -47
- package/lib/commands/download/identity-server.d.ts +7 -20
- package/lib/commands/download/identity-server.js +12 -47
- package/lib/commands/download/jmeter.d.ts +3 -3
- package/lib/commands/download/jmeter.js +9 -11
- package/lib/commands/download/keycloak-scim.d.ts +4 -4
- package/lib/commands/download/keycloak-scim.js +9 -11
- package/lib/commands/download/platform.d.ts +7 -20
- package/lib/commands/download/platform.js +12 -47
- package/lib/commands/download/scheduler.d.ts +7 -20
- package/lib/commands/download/scheduler.js +12 -47
- package/lib/commands/download/server.d.ts +7 -20
- package/lib/commands/download/server.js +12 -47
- package/lib/commands/download/signalr.d.ts +7 -20
- package/lib/commands/download/signalr.js +12 -47
- package/lib/commands/download/studio.d.ts +12 -24
- package/lib/commands/download/studio.js +14 -48
- package/lib/commands/gitlab/get-tag-pipeline.d.ts +7 -7
- package/lib/commands/gitlab/get-tag-pipeline.js +5 -5
- package/lib/commands/gitlab/next-nightly-tag.d.ts +7 -7
- package/lib/commands/gitlab/next-nightly-tag.js +6 -6
- package/lib/commands/jira/issue.d.ts +4 -4
- package/lib/commands/jira/issue.js +2 -2
- package/lib/commands/jira/labels.d.ts +8 -9
- package/lib/commands/jira/labels.js +11 -10
- package/lib/commands/log/add.d.ts +10 -5
- package/lib/commands/log/add.js +42 -13
- package/lib/commands/log/generate.d.ts +6 -6
- package/lib/commands/log/generate.js +16 -8
- package/lib/commands/log/validate.js +2 -2
- package/lib/commands/login.d.ts +25 -5
- package/lib/commands/login.js +162 -40
- package/lib/commands/login.ru.d.ts +2 -2
- package/lib/commands/login.ru.js +1 -1
- package/lib/commands/npm/check-publish.d.ts +4 -4
- package/lib/commands/npm/check-publish.js +1 -1
- package/lib/commands/npm/dependency-update.d.ts +17 -4
- package/lib/commands/npm/dependency-update.js +64 -41
- package/lib/commands/npm/publish.d.ts +5 -5
- package/lib/commands/npm/publish.js +2 -2
- package/lib/commands/nuget/dependency-update.d.ts +3 -3
- package/lib/commands/prepare-content.d.ts +3 -3
- package/lib/commands/prepare-content.js +24 -41
- package/lib/commands/sql.d.ts +17 -17
- package/lib/commands/sql.js +23 -27
- package/lib/commands/translate.d.ts +8 -8
- package/lib/commands/translate.js +10 -8
- package/lib/commands/version.d.ts +10 -10
- package/lib/commands/version.js +6 -7
- package/lib/lib/command.d.ts +5 -3
- package/lib/lib/command.js +44 -44
- package/lib/lib/config.js +1 -1
- package/lib/lib/gitlab.d.ts +3 -1
- package/lib/lib/gitlab.js +13 -7
- package/lib/lib/http.d.ts +37 -0
- package/lib/lib/http.js +278 -0
- package/lib/lib/npm.d.ts +7 -4
- package/lib/lib/npm.js +15 -6
- package/lib/lib/npmrc.js +3 -3
- package/lib/lib/yarnrc.js +3 -3
- package/lib/security/cache.js +1 -1
- package/lib/security/context.d.ts +10 -8
- package/lib/security/context.js +49 -64
- package/oclif.manifest.json +533 -532
- package/package.json +71 -62
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { Args, Flags } from '@oclif/core';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
|
-
import {
|
|
4
|
+
import { isAlias, isMap, isNode, isScalar, isSeq, Pair, parseDocument, Scalar, visit } from 'yaml';
|
|
5
5
|
import CommandBase from '../../command.base.js';
|
|
6
6
|
class DockerUpdateImageVersion extends CommandBase {
|
|
7
7
|
run() {
|
|
@@ -12,13 +12,15 @@ class DockerUpdateImageVersion extends CommandBase {
|
|
|
12
12
|
_super.run.call(this);
|
|
13
13
|
const { args, flags } = yield this.parse(DockerUpdateImageVersion);
|
|
14
14
|
try {
|
|
15
|
-
|
|
15
|
+
// Edit the document in place, so comments, quoting and layout of the file are kept
|
|
16
|
+
const document = parseDocument(fs.readFileSync(flags['file-path'], 'utf8'));
|
|
17
|
+
if (document.errors.length > 0) {
|
|
18
|
+
throw document.errors[0];
|
|
19
|
+
}
|
|
16
20
|
for (const service of flags.services) {
|
|
17
|
-
|
|
18
|
-
image[1] = args.version;
|
|
19
|
-
parsedYaml.services[service].image = image.join(':');
|
|
21
|
+
this.updateImage(document, service, args.version, flags['file-path']);
|
|
20
22
|
}
|
|
21
|
-
fs.writeFileSync(flags['file-path'],
|
|
23
|
+
fs.writeFileSync(flags['file-path'], document.toString({ lineWidth: 0, flowCollectionPadding: false }));
|
|
22
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
25
|
}
|
|
24
26
|
catch (error) {
|
|
@@ -26,6 +28,110 @@ class DockerUpdateImageVersion extends CommandBase {
|
|
|
26
28
|
}
|
|
27
29
|
});
|
|
28
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Update the image tag of a single service. Aliases, alias keys and merge keys are resolved as YAML resolves them,
|
|
33
|
+
* and only the selected service changes, also when its image or mapping is shared with other nodes.
|
|
34
|
+
*/
|
|
35
|
+
updateImage(document, service, version, filePath) {
|
|
36
|
+
const root = document.contents;
|
|
37
|
+
const services = isMap(root) ? this.ownValue(document, root, 'services') : undefined;
|
|
38
|
+
const serviceNode = isMap(services) ? this.ownValue(document, services, service) : undefined;
|
|
39
|
+
const image = isMap(serviceNode) ? this.ownValue(document, serviceNode, 'image') : undefined;
|
|
40
|
+
if (!isScalar(image) || typeof image.value !== 'string') {
|
|
41
|
+
throw new Error(`Service '${service}' with an image was not found in ${filePath}`);
|
|
42
|
+
}
|
|
43
|
+
const parts = image.value.split(':');
|
|
44
|
+
parts[1] = version;
|
|
45
|
+
image.value = parts.join(':');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get the value of a key in a map as a node that belongs only to this map, so it can be changed without changing
|
|
49
|
+
* other nodes. An aliased or inherited value is replaced with a copy, and aliases of an anchored value get a copy.
|
|
50
|
+
*/
|
|
51
|
+
ownValue(document, map, key) {
|
|
52
|
+
const found = this.findPair(document, map, key);
|
|
53
|
+
if (!found) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (found.inherited) {
|
|
57
|
+
// Override the inherited value, so the merged mapping stays as it is
|
|
58
|
+
const value = this.copy(document, found.pair.value);
|
|
59
|
+
map.items.push(new Pair(new Scalar(key), value));
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
if (isAlias(found.pair.value)) {
|
|
63
|
+
found.pair.value = this.copy(document, found.pair.value);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.detachAliases(document, found.pair.value);
|
|
67
|
+
}
|
|
68
|
+
return found.pair.value;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Find the pair of a key in a map. Keys may be aliases, and keys that are not in the map itself
|
|
72
|
+
* are looked up in its merge keys (<<), in the order YAML 1.1 merges them.
|
|
73
|
+
*/
|
|
74
|
+
findPair(document, map, key) {
|
|
75
|
+
const ownPair = map.items.find(pair => !this.isMergeKey(document, pair.key) && this.keyValue(document, pair.key) === key);
|
|
76
|
+
if (ownPair) {
|
|
77
|
+
return { pair: ownPair, inherited: false };
|
|
78
|
+
}
|
|
79
|
+
for (const merge of map.items.filter(pair => this.isMergeKey(document, pair.key))) {
|
|
80
|
+
const value = this.resolveAlias(document, merge.value);
|
|
81
|
+
for (const source of isSeq(value) ? value.items : [value]) {
|
|
82
|
+
const resolved = this.resolveAlias(document, source);
|
|
83
|
+
const found = isMap(resolved) ? this.findPair(document, resolved, key) : undefined;
|
|
84
|
+
if (found) {
|
|
85
|
+
return { pair: found.pair, inherited: true };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
keyValue(document, key) {
|
|
92
|
+
const resolved = this.resolveAlias(document, key);
|
|
93
|
+
return isScalar(resolved) ? String(resolved.value) : undefined;
|
|
94
|
+
}
|
|
95
|
+
isMergeKey(document, key) {
|
|
96
|
+
return isScalar(key) &&
|
|
97
|
+
(key.value === '<<' || (typeof key.value === 'symbol' && key.value.description === '<<')) &&
|
|
98
|
+
document.schema.tags.some(tag => tag.tag === 'tag:yaml.org,2002:merge');
|
|
99
|
+
}
|
|
100
|
+
resolveAlias(document, node) {
|
|
101
|
+
return isAlias(node) ? node.resolve(document) : node;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Copy a node without its anchors, so the copy does not redefine them. Aliases in the node are replaced
|
|
105
|
+
* with copies of the nodes they resolve to where they are now, because they may resolve to another node
|
|
106
|
+
* where the copy is placed (an anchor can be redefined in between).
|
|
107
|
+
*/
|
|
108
|
+
copy(document, node) {
|
|
109
|
+
const source = this.resolveAlias(document, node);
|
|
110
|
+
if (!isNode(source)) {
|
|
111
|
+
return source;
|
|
112
|
+
}
|
|
113
|
+
// An alias was resolved above, so the node is a scalar or a collection
|
|
114
|
+
const copy = source.clone();
|
|
115
|
+
copy.anchor = undefined;
|
|
116
|
+
if (isMap(source) && isMap(copy)) {
|
|
117
|
+
copy.items = source.items.map(pair => new Pair(this.copy(document, pair.key), this.copy(document, pair.value)));
|
|
118
|
+
}
|
|
119
|
+
else if (isSeq(source) && isSeq(copy)) {
|
|
120
|
+
copy.items = source.items.map(item => this.copy(document, item));
|
|
121
|
+
}
|
|
122
|
+
return copy;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Replace every alias of an anchored node with a copy of it, so changing the node does not change its aliases
|
|
126
|
+
*/
|
|
127
|
+
detachAliases(document, node) {
|
|
128
|
+
if (!isNode(node) || !node.anchor) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
visit(document, {
|
|
132
|
+
Alias: (_key, alias) => (alias.resolve(document) === node ? this.copy(document, node) : undefined),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
29
135
|
}
|
|
30
136
|
DockerUpdateImageVersion.description = 'update docker image version docker compose file';
|
|
31
137
|
DockerUpdateImageVersion.usage = 'docker:update-image-version <tag>';
|
package/lib/commands/doctor.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export default class Doctor extends CommandBase<typeof Doctor> {
|
|
|
4
4
|
static usage: string;
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
-
fix: import("@oclif/core/
|
|
7
|
+
fix: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
};
|
|
9
9
|
private readonly cp;
|
|
10
10
|
private nvm;
|
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export default class DownloadClient extends CommandBase<typeof DownloadClient> {
|
|
1
|
+
import DownloadCommand from '../../command.download.js';
|
|
2
|
+
export default class DownloadClient extends DownloadCommand<typeof DownloadClient> {
|
|
4
3
|
static aliases: string[];
|
|
5
4
|
static description: string;
|
|
6
5
|
static usage: string;
|
|
7
6
|
static examples: string[];
|
|
8
7
|
static flags: {
|
|
9
|
-
source: import("@oclif/core/
|
|
10
|
-
version: import("@oclif/core/
|
|
11
|
-
output: import("@oclif/core/
|
|
8
|
+
source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
version: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get unique AdInsure Client zip by specified version
|
|
17
|
-
* @param {string} version The version of AdInsure Client
|
|
18
|
-
* @returns {Promise<AxiosResponse<any, any>>}
|
|
19
|
-
*/
|
|
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>>;
|
|
12
|
+
protected readonly azureUrl = "https://ops.adinsure.com/api/storage/binaries";
|
|
13
|
+
protected readonly packageName = "AdInsure-client";
|
|
27
14
|
run(): Promise<void>;
|
|
28
15
|
}
|
|
@@ -1,52 +1,17 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { Flags, ux } from '@oclif/core';
|
|
3
|
-
import axios from 'axios';
|
|
4
3
|
import chalk from 'chalk';
|
|
5
4
|
import fs from 'fs-extra';
|
|
6
|
-
import os from 'os';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import DownloadCommand from '../../command.download.js';
|
|
8
|
+
import { HttpError } from '../../lib/http.js';
|
|
9
9
|
import OpsConfig from '../../lib/config.js';
|
|
10
|
-
class DownloadClient extends
|
|
10
|
+
class DownloadClient extends DownloadCommand {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get unique AdInsure Client zip by specified version
|
|
18
|
-
* @param {string} version The version of AdInsure Client
|
|
19
|
-
* @returns {Promise<AxiosResponse<any, any>>}
|
|
20
|
-
*/
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
downloadFileFromAzure(version) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
return axios.get(`${this.url_azure}/AdInsure-client-${version}.zip`, {
|
|
25
|
-
headers: {
|
|
26
|
-
Authorization: 'Bearer ' + (yield this.security.getToken()),
|
|
27
|
-
'Content-Type': 'application/octet-stream',
|
|
28
|
-
},
|
|
29
|
-
responseType: 'arraybuffer',
|
|
30
|
-
});
|
|
31
|
-
});
|
|
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
|
-
});
|
|
13
|
+
this.azureUrl = 'https://ops.adinsure.com/api/storage/binaries';
|
|
14
|
+
this.packageName = 'AdInsure-client';
|
|
50
15
|
}
|
|
51
16
|
run() {
|
|
52
17
|
const _super = Object.create(null, {
|
|
@@ -63,14 +28,14 @@ class DownloadClient extends CommandBase {
|
|
|
63
28
|
outputDir = defaultFolder || './'; // no flag -> DEFAULT output is "./"
|
|
64
29
|
}
|
|
65
30
|
// Expand tilde if present
|
|
66
|
-
const basePath = outputDir.charAt(0) === '~'
|
|
67
|
-
|
|
68
|
-
|
|
31
|
+
const basePath = outputDir.charAt(0) === '~' ?
|
|
32
|
+
os.homedir() + outputDir.split('~')[1] :
|
|
33
|
+
outputDir;
|
|
69
34
|
const filename = `AdInsure-client-${flags.version}.zip`;
|
|
70
35
|
const filePath = path.resolve(basePath, filename);
|
|
71
36
|
ux.action.start(`Downloading AdInsure Client version ${flags.version} to ${filePath}`, undefined, { stdout: true });
|
|
72
37
|
try {
|
|
73
|
-
|
|
38
|
+
let file;
|
|
74
39
|
if (!flags.source) {
|
|
75
40
|
const config = new OpsConfig(this.security.getConfigPath());
|
|
76
41
|
flags.source = config.get('endpoint') || 'azure'; // no flag -> DEFAULT source is azure
|
|
@@ -90,7 +55,7 @@ class DownloadClient extends CommandBase {
|
|
|
90
55
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
56
|
}
|
|
92
57
|
catch (error) {
|
|
93
|
-
switch (error.
|
|
58
|
+
switch (error instanceof HttpError ? error.status : undefined) {
|
|
94
59
|
case 404: {
|
|
95
60
|
this.error('Does not exist.', { exit: 1 });
|
|
96
61
|
}
|
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export default class DownloadIdentityServer extends CommandBase<typeof DownloadIdentityServer> {
|
|
1
|
+
import DownloadCommand from '../../command.download.js';
|
|
2
|
+
export default class DownloadIdentityServer extends DownloadCommand<typeof DownloadIdentityServer> {
|
|
4
3
|
static description: string;
|
|
5
4
|
static usage: string;
|
|
6
5
|
static examples: string[];
|
|
7
6
|
static flags: {
|
|
8
|
-
source: import("@oclif/core/
|
|
9
|
-
version: import("@oclif/core/
|
|
10
|
-
output: import("@oclif/core/
|
|
7
|
+
source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
version: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
10
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Get unique Identity Server zip by specified version
|
|
16
|
-
* @param {string} version The version of Identity Server
|
|
17
|
-
* @returns {Promise<AxiosResponse<any, any>>}
|
|
18
|
-
*/
|
|
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>>;
|
|
11
|
+
protected readonly azureUrl = "https://ops.adinsure.com/api/storage/binaries";
|
|
12
|
+
protected readonly packageName = "AdInsure-identityServer";
|
|
26
13
|
run(): Promise<void>;
|
|
27
14
|
}
|
|
@@ -1,52 +1,17 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { Flags, ux } from '@oclif/core';
|
|
3
|
-
import axios from 'axios';
|
|
4
3
|
import chalk from 'chalk';
|
|
5
4
|
import fs from 'fs-extra';
|
|
6
|
-
import os from 'os';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import DownloadCommand from '../../command.download.js';
|
|
8
|
+
import { HttpError } from '../../lib/http.js';
|
|
9
9
|
import OpsConfig from '../../lib/config.js';
|
|
10
|
-
class DownloadIdentityServer extends
|
|
10
|
+
class DownloadIdentityServer extends DownloadCommand {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get unique Identity Server zip by specified version
|
|
18
|
-
* @param {string} version The version of Identity Server
|
|
19
|
-
* @returns {Promise<AxiosResponse<any, any>>}
|
|
20
|
-
*/
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
downloadFileFromAzure(version) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
return axios.get(`${this.url_azure}/AdInsure-identityServer-${version}.zip`, {
|
|
25
|
-
headers: {
|
|
26
|
-
Authorization: 'Bearer ' + (yield this.security.getToken()),
|
|
27
|
-
'Content-Type': 'application/octet-stream',
|
|
28
|
-
},
|
|
29
|
-
responseType: 'arraybuffer',
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get unique Identity Server zip by specified version
|
|
35
|
-
* @param {string} version The version of Identity Server
|
|
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-identityServer';
|
|
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
|
-
});
|
|
13
|
+
this.azureUrl = 'https://ops.adinsure.com/api/storage/binaries';
|
|
14
|
+
this.packageName = 'AdInsure-identityServer';
|
|
50
15
|
}
|
|
51
16
|
run() {
|
|
52
17
|
const _super = Object.create(null, {
|
|
@@ -64,14 +29,14 @@ class DownloadIdentityServer extends CommandBase {
|
|
|
64
29
|
outputDir = defaultFolder || './'; // no flag -> DEFAULT output is "./"
|
|
65
30
|
}
|
|
66
31
|
// Expand tilde if present
|
|
67
|
-
const basePath = outputDir.charAt(0) === '~'
|
|
68
|
-
|
|
69
|
-
|
|
32
|
+
const basePath = outputDir.charAt(0) === '~' ?
|
|
33
|
+
os.homedir() + outputDir.split('~')[1] :
|
|
34
|
+
outputDir;
|
|
70
35
|
const filename = `AdInsure-identityServer-${flags.version}.zip`;
|
|
71
36
|
const filePath = path.resolve(basePath, filename);
|
|
72
37
|
ux.action.start(`Downloading AdInsure Identity Server version ${flags.version} to ${filePath}`, undefined, { stdout: true });
|
|
73
38
|
try {
|
|
74
|
-
|
|
39
|
+
let file;
|
|
75
40
|
if (!flags.source) {
|
|
76
41
|
const config = new OpsConfig(this.security.getConfigPath());
|
|
77
42
|
flags.source = config.get('endpoint') || 'azure'; // no flag -> DEFAULT source is azure
|
|
@@ -91,7 +56,7 @@ class DownloadIdentityServer extends CommandBase {
|
|
|
91
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
57
|
}
|
|
93
58
|
catch (error) {
|
|
94
|
-
switch (error.
|
|
59
|
+
switch (error instanceof HttpError ? error.status : undefined) {
|
|
95
60
|
case 404: {
|
|
96
61
|
this.error('Does not exist.', { exit: 1 });
|
|
97
62
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpResponse } from '../../lib/http.js';
|
|
2
2
|
import CommandBase from '../../command.base.js';
|
|
3
3
|
export default class DownloadJmeter extends CommandBase<typeof DownloadJmeter> {
|
|
4
4
|
static description: string;
|
|
5
5
|
static usage: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
-
output: import("@oclif/core/
|
|
8
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
};
|
|
10
10
|
private readonly url;
|
|
11
|
-
downloadFile(): Promise<
|
|
11
|
+
downloadFile(): Promise<HttpResponse<Buffer>>;
|
|
12
12
|
run(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { Flags, ux } from '@oclif/core';
|
|
3
|
-
import axios from 'axios';
|
|
4
3
|
import chalk from 'chalk';
|
|
5
4
|
import fs from 'fs-extra';
|
|
6
|
-
import os from 'os';
|
|
7
|
-
import path from 'path';
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { HttpError } from '../../lib/http.js';
|
|
8
8
|
import CommandBase from '../../command.base.js';
|
|
9
9
|
import OpsConfig from '../../lib/config.js';
|
|
10
10
|
class DownloadJmeter extends CommandBase {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.url = 'https://ops.adinsure.com/api/storage/jmeter
|
|
13
|
+
this.url = 'https://ops.adinsure.com/api/storage/jmeter';
|
|
14
14
|
}
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
15
|
downloadFile() {
|
|
17
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
return
|
|
17
|
+
return this.http.getBuffer(`${this.url}/jmeter-artifacts.zip`, {
|
|
19
18
|
headers: {
|
|
20
19
|
Authorization: 'Bearer ' + (yield this.security.getToken()),
|
|
21
20
|
'Content-Type': 'application/octet-stream',
|
|
22
21
|
},
|
|
23
|
-
responseType: 'arraybuffer',
|
|
24
22
|
});
|
|
25
23
|
});
|
|
26
24
|
}
|
|
@@ -39,9 +37,9 @@ class DownloadJmeter extends CommandBase {
|
|
|
39
37
|
outputDir = defaultFolder || './'; // no flag -> DEFAULT output is "./"
|
|
40
38
|
}
|
|
41
39
|
// Expand tilde if present
|
|
42
|
-
const basePath = outputDir.charAt(0) === '~'
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
const basePath = outputDir.charAt(0) === '~' ?
|
|
41
|
+
os.homedir() + outputDir.split('~')[1] :
|
|
42
|
+
outputDir;
|
|
45
43
|
const filename = `jmeter-artifacts.zip`;
|
|
46
44
|
const filePath = path.resolve(basePath, filename);
|
|
47
45
|
ux.action.start(`Downloading jmeter examples to ${filePath}`, undefined, { stdout: true });
|
|
@@ -56,7 +54,7 @@ class DownloadJmeter extends CommandBase {
|
|
|
56
54
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
55
|
}
|
|
58
56
|
catch (error) {
|
|
59
|
-
switch (error.
|
|
57
|
+
switch (error instanceof HttpError ? error.status : undefined) {
|
|
60
58
|
case 404: {
|
|
61
59
|
this.error('Does not exist.', { exit: 1 });
|
|
62
60
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpResponse } from '../../lib/http.js';
|
|
2
2
|
import CommandBase from '../../command.base.js';
|
|
3
3
|
export default class DownloadKeycloak extends CommandBase<typeof DownloadKeycloak> {
|
|
4
4
|
static description: string;
|
|
5
5
|
static usage: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
-
version: import("@oclif/core/
|
|
9
|
-
output: import("@oclif/core/
|
|
8
|
+
version: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
11
|
private readonly url;
|
|
12
|
-
downloadFile(version: string): Promise<
|
|
12
|
+
downloadFile(version: string): Promise<HttpResponse<Buffer>>;
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { Flags, ux } from '@oclif/core';
|
|
3
|
-
import axios from 'axios';
|
|
4
3
|
import chalk from 'chalk';
|
|
5
4
|
import fs from 'fs-extra';
|
|
6
|
-
import os from 'os';
|
|
7
|
-
import path from 'path';
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { HttpError } from '../../lib/http.js';
|
|
8
8
|
import CommandBase from '../../command.base.js';
|
|
9
9
|
import OpsConfig from '../../lib/config.js';
|
|
10
10
|
class DownloadKeycloak extends CommandBase {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.url = 'https://ops.adinsure.com/api/storage/extensions
|
|
13
|
+
this.url = 'https://ops.adinsure.com/api/storage/extensions';
|
|
14
14
|
}
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
15
|
downloadFile(version) {
|
|
17
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
return
|
|
17
|
+
return this.http.getBuffer(`${this.url}/keycloak-scim2-outbound-provisioning-${version}.zip`, {
|
|
19
18
|
headers: {
|
|
20
19
|
Authorization: 'Bearer ' + (yield this.security.getToken()),
|
|
21
20
|
'Content-Type': 'application/octet-stream',
|
|
22
21
|
},
|
|
23
|
-
responseType: 'arraybuffer',
|
|
24
22
|
});
|
|
25
23
|
});
|
|
26
24
|
}
|
|
@@ -39,9 +37,9 @@ class DownloadKeycloak extends CommandBase {
|
|
|
39
37
|
outputDir = defaultFolder || './'; // no flag -> DEFAULT output is "./"
|
|
40
38
|
}
|
|
41
39
|
// Expand tilde if present
|
|
42
|
-
const basePath = outputDir.charAt(0) === '~'
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
const basePath = outputDir.charAt(0) === '~' ?
|
|
41
|
+
os.homedir() + outputDir.split('~')[1] :
|
|
42
|
+
outputDir;
|
|
45
43
|
const filename = `Keycloak-scim-${flags.version}.zip`;
|
|
46
44
|
const filePath = path.resolve(basePath, filename);
|
|
47
45
|
ux.action.start(`Downloading Keycloack version ${flags.version} to ${filePath}`, undefined, { stdout: true });
|
|
@@ -56,7 +54,7 @@ class DownloadKeycloak extends CommandBase {
|
|
|
56
54
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
55
|
}
|
|
58
56
|
catch (error) {
|
|
59
|
-
switch (error.
|
|
57
|
+
switch (error instanceof HttpError ? error.status : undefined) {
|
|
60
58
|
case 404: {
|
|
61
59
|
this.error('Does not exist.', { exit: 1 });
|
|
62
60
|
}
|
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export default class DownloadPlatform extends CommandBase<typeof DownloadPlatform> {
|
|
1
|
+
import DownloadCommand from '../../command.download.js';
|
|
2
|
+
export default class DownloadPlatform extends DownloadCommand<typeof DownloadPlatform> {
|
|
4
3
|
static aliases: string[];
|
|
5
4
|
static description: string;
|
|
6
5
|
static usage: string;
|
|
7
6
|
static examples: string[];
|
|
8
7
|
static flags: {
|
|
9
|
-
source: import("@oclif/core/
|
|
10
|
-
version: import("@oclif/core/
|
|
11
|
-
output: import("@oclif/core/
|
|
8
|
+
source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
version: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get unique AdInsure Platform zip by specified version
|
|
17
|
-
* @param {string} version The version of AdInsure Platform
|
|
18
|
-
* @returns {Promise<AxiosResponse<any, any>>}
|
|
19
|
-
*/
|
|
20
|
-
downloadFileFromAzure(version: string): Promise<AxiosResponse<any, any>>;
|
|
21
|
-
/**
|
|
22
|
-
* Get unique AdInsure Platform zip by specified version
|
|
23
|
-
* @param {string} version The version of AdInsure Platform
|
|
24
|
-
* @returns {Promise<AxiosResponse<any, any>>}
|
|
25
|
-
*/
|
|
26
|
-
downloadFileFromGitLabRu(version: string): Promise<AxiosResponse<any>>;
|
|
12
|
+
protected readonly azureUrl = "https://ops.adinsure.com/api/storage/binaries";
|
|
13
|
+
protected readonly packageName = "AdInsure";
|
|
27
14
|
run(): Promise<void>;
|
|
28
15
|
}
|