@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.
Files changed (82) hide show
  1. package/README.md +140 -2
  2. package/bin/run.js +2 -6
  3. package/lib/command.base.d.ts +7 -1
  4. package/lib/command.base.jira.d.ts +23 -5
  5. package/lib/command.base.jira.js +47 -12
  6. package/lib/command.base.js +37 -8
  7. package/lib/command.download.d.ts +11 -0
  8. package/lib/command.download.js +27 -0
  9. package/lib/commands/config/get.d.ts +1 -1
  10. package/lib/commands/config/list.js +1 -1
  11. package/lib/commands/config/set.d.ts +2 -2
  12. package/lib/commands/config/set.js +2 -2
  13. package/lib/commands/config/unset.d.ts +1 -1
  14. package/lib/commands/docker/update-image-version.d.ts +31 -3
  15. package/lib/commands/docker/update-image-version.js +112 -6
  16. package/lib/commands/doctor.d.ts +1 -1
  17. package/lib/commands/download/client.d.ts +7 -20
  18. package/lib/commands/download/client.js +12 -47
  19. package/lib/commands/download/identity-server.d.ts +7 -20
  20. package/lib/commands/download/identity-server.js +12 -47
  21. package/lib/commands/download/jmeter.d.ts +3 -3
  22. package/lib/commands/download/jmeter.js +9 -11
  23. package/lib/commands/download/keycloak-scim.d.ts +4 -4
  24. package/lib/commands/download/keycloak-scim.js +9 -11
  25. package/lib/commands/download/platform.d.ts +7 -20
  26. package/lib/commands/download/platform.js +12 -47
  27. package/lib/commands/download/scheduler.d.ts +7 -20
  28. package/lib/commands/download/scheduler.js +12 -47
  29. package/lib/commands/download/server.d.ts +7 -20
  30. package/lib/commands/download/server.js +12 -47
  31. package/lib/commands/download/signalr.d.ts +7 -20
  32. package/lib/commands/download/signalr.js +12 -47
  33. package/lib/commands/download/studio.d.ts +12 -24
  34. package/lib/commands/download/studio.js +14 -48
  35. package/lib/commands/gitlab/get-tag-pipeline.d.ts +7 -7
  36. package/lib/commands/gitlab/get-tag-pipeline.js +5 -5
  37. package/lib/commands/gitlab/next-nightly-tag.d.ts +7 -7
  38. package/lib/commands/gitlab/next-nightly-tag.js +6 -6
  39. package/lib/commands/jira/issue.d.ts +4 -4
  40. package/lib/commands/jira/issue.js +2 -2
  41. package/lib/commands/jira/labels.d.ts +8 -9
  42. package/lib/commands/jira/labels.js +11 -10
  43. package/lib/commands/log/add.d.ts +10 -5
  44. package/lib/commands/log/add.js +42 -13
  45. package/lib/commands/log/generate.d.ts +6 -6
  46. package/lib/commands/log/generate.js +16 -8
  47. package/lib/commands/log/validate.js +2 -2
  48. package/lib/commands/login.d.ts +25 -5
  49. package/lib/commands/login.js +162 -40
  50. package/lib/commands/login.ru.d.ts +2 -2
  51. package/lib/commands/login.ru.js +1 -1
  52. package/lib/commands/npm/check-publish.d.ts +4 -4
  53. package/lib/commands/npm/check-publish.js +1 -1
  54. package/lib/commands/npm/dependency-update.d.ts +17 -4
  55. package/lib/commands/npm/dependency-update.js +64 -41
  56. package/lib/commands/npm/publish.d.ts +5 -5
  57. package/lib/commands/npm/publish.js +2 -2
  58. package/lib/commands/nuget/dependency-update.d.ts +3 -3
  59. package/lib/commands/prepare-content.d.ts +3 -3
  60. package/lib/commands/prepare-content.js +24 -41
  61. package/lib/commands/sql.d.ts +17 -17
  62. package/lib/commands/sql.js +23 -27
  63. package/lib/commands/translate.d.ts +8 -8
  64. package/lib/commands/translate.js +10 -8
  65. package/lib/commands/version.d.ts +10 -10
  66. package/lib/commands/version.js +6 -7
  67. package/lib/lib/command.d.ts +5 -3
  68. package/lib/lib/command.js +44 -44
  69. package/lib/lib/config.js +1 -1
  70. package/lib/lib/gitlab.d.ts +3 -1
  71. package/lib/lib/gitlab.js +13 -7
  72. package/lib/lib/http.d.ts +37 -0
  73. package/lib/lib/http.js +278 -0
  74. package/lib/lib/npm.d.ts +7 -4
  75. package/lib/lib/npm.js +15 -6
  76. package/lib/lib/npmrc.js +3 -3
  77. package/lib/lib/yarnrc.js +3 -3
  78. package/lib/security/cache.js +1 -1
  79. package/lib/security/context.d.ts +10 -8
  80. package/lib/security/context.js +49 -64
  81. package/oclif.manifest.json +533 -532
  82. package/package.json +71 -62
@@ -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 CommandBase from '../../command.base.js';
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 DownloadPlatform extends CommandBase {
10
+ class DownloadPlatform extends DownloadCommand {
11
11
  constructor() {
12
12
  super(...arguments);
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';
15
- }
16
- /**
17
- * Get unique AdInsure Platform zip by specified version
18
- * @param {string} version The version of AdInsure Platform
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-${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 Platform zip by specified version
35
- * @param {string} version The version of AdInsure Platform
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';
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';
50
15
  }
51
16
  run() {
52
17
  const _super = Object.create(null, {
@@ -64,14 +29,14 @@ class DownloadPlatform 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
- ? os.homedir() + outputDir.split('~')[1]
69
- : outputDir;
32
+ const basePath = outputDir.charAt(0) === '~' ?
33
+ os.homedir() + outputDir.split('~')[1] :
34
+ outputDir;
70
35
  const filename = `AdInsure-${flags.version}.zip`;
71
36
  const filePath = path.resolve(basePath, filename);
72
37
  ux.action.start(`Downloading AdInsure Platform version ${flags.version} to ${filePath}`, undefined, { stdout: true });
73
38
  try {
74
- var file;
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 DownloadPlatform extends CommandBase {
91
56
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
57
  }
93
58
  catch (error) {
94
- switch (error.statusCode) {
59
+ switch (error instanceof HttpError ? error.status : undefined) {
95
60
  case 404: {
96
61
  this.error('Does not exist.', { exit: 1 });
97
62
  }
@@ -1,27 +1,14 @@
1
- import { AxiosResponse } from 'axios';
2
- import CommandBase from '../../command.base.js';
3
- export default class DownloadScheduler extends CommandBase<typeof DownloadScheduler> {
1
+ import DownloadCommand from '../../command.download.js';
2
+ export default class DownloadScheduler extends DownloadCommand<typeof DownloadScheduler> {
4
3
  static description: string;
5
4
  static usage: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- source: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
- 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 | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
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
- private readonly url_azure;
13
- private readonly url_gitlabru;
14
- /**
15
- * Get unique AdInsureScheduler zip by specified version
16
- * @param {string} version The version of AdInsureScheduler
17
- * @returns {Promise<AxiosResponse<any, any>>}
18
- */
19
- downloadFileFromAzure(version: string): Promise<AxiosResponse<any, any>>;
20
- /**
21
- * Get unique AdInsureScheduler zip by specified version
22
- * @param {string} version The version of AdInsureScheduler
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 = "AdInsureScheduler";
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 CommandBase from '../../command.base.js';
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 DownloadScheduler extends CommandBase {
10
+ class DownloadScheduler extends DownloadCommand {
11
11
  constructor() {
12
12
  super(...arguments);
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';
15
- }
16
- /**
17
- * Get unique AdInsureScheduler zip by specified version
18
- * @param {string} version The version of AdInsureScheduler
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}/AdInsureScheduler-${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 AdInsureScheduler zip by specified version
35
- * @param {string} version The version of AdInsureScheduler
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 = 'AdInsureScheduler';
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 = 'AdInsureScheduler';
50
15
  }
51
16
  run() {
52
17
  const _super = Object.create(null, {
@@ -63,14 +28,14 @@ class DownloadScheduler 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
- ? os.homedir() + outputDir.split('~')[1]
68
- : outputDir;
31
+ const basePath = outputDir.charAt(0) === '~' ?
32
+ os.homedir() + outputDir.split('~')[1] :
33
+ outputDir;
69
34
  const filename = `AdInsureScheduler-${flags.version}.zip`;
70
35
  const filePath = path.resolve(basePath, filename);
71
36
  ux.action.start(`Downloading AdInsure Scheduler version ${flags.version} to ${filePath}`, undefined, { stdout: true });
72
37
  try {
73
- var file;
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 DownloadScheduler extends CommandBase {
90
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
56
  }
92
57
  catch (error) {
93
- switch (error.statusCode) {
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 { AxiosResponse } from 'axios';
2
- import CommandBase from '../../command.base.js';
3
- export default class DownloadServer extends CommandBase<typeof DownloadServer> {
1
+ import DownloadCommand from '../../command.download.js';
2
+ export default class DownloadServer extends DownloadCommand<typeof DownloadServer> {
4
3
  static description: string;
5
4
  static usage: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- source: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
- 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 | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
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
- private readonly url_azure;
13
- private readonly url_gitlabru;
14
- /**
15
- * Get unique AdInsure Server zip by specified version
16
- * @param {string} version The version of AdInsure Server
17
- * @returns {Promise<AxiosResponse<any, any>>}
18
- */
19
- downloadFileFromAzure(version: string): Promise<AxiosResponse<any, any>>;
20
- /**
21
- * Get unique AdInsure Server zip by specified version
22
- * @param {string} version The version of AdInsure 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-server";
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 CommandBase from '../../command.base.js';
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 DownloadServer extends CommandBase {
10
+ class DownloadServer extends DownloadCommand {
11
11
  constructor() {
12
12
  super(...arguments);
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';
15
- }
16
- /**
17
- * Get unique AdInsure Server zip by specified version
18
- * @param {string} version The version of AdInsure 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-server-${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 Server zip by specified version
35
- * @param {string} version The version of AdInsure 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-server';
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-server';
50
15
  }
51
16
  run() {
52
17
  const _super = Object.create(null, {
@@ -63,14 +28,14 @@ class DownloadServer 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
- ? os.homedir() + outputDir.split('~')[1]
68
- : outputDir;
31
+ const basePath = outputDir.charAt(0) === '~' ?
32
+ os.homedir() + outputDir.split('~')[1] :
33
+ outputDir;
69
34
  const filename = `AdInsure-server-${flags.version}.zip`;
70
35
  const filePath = path.resolve(basePath, filename);
71
36
  ux.action.start(`Downloading AdInsure Server version ${flags.version} to ${filePath}`, undefined, { stdout: true });
72
37
  try {
73
- var file;
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 DownloadServer extends CommandBase {
90
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
56
  }
92
57
  catch (error) {
93
- switch (error.statusCode) {
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 { AxiosResponse } from 'axios';
2
- import CommandBase from '../../command.base.js';
3
- export default class DownloadSignalrServer extends CommandBase<typeof DownloadSignalrServer> {
1
+ import DownloadCommand from '../../command.download.js';
2
+ export default class DownloadSignalrServer extends DownloadCommand<typeof DownloadSignalrServer> {
4
3
  static description: string;
5
4
  static usage: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- source: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
- 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 | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
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
- private readonly url_azure;
13
- private readonly url_gitlabru;
14
- /**
15
- * Get unique AdInsure SignalR Server zip by specified version
16
- * @param {string} version The version of AdInsure SignalR Server
17
- * @returns {Promise<AxiosResponse<any, any>>}
18
- */
19
- downloadFileFromAzure(version: string): Promise<AxiosResponse<any, any>>;
20
- /**
21
- * Get unique AdInsure SignalR zip by specified version
22
- * @param {string} version The version of AdInsure SignalR
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-signalr";
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 CommandBase from '../../command.base.js';
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 DownloadSignalrServer extends CommandBase {
10
+ class DownloadSignalrServer extends DownloadCommand {
11
11
  constructor() {
12
12
  super(...arguments);
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';
15
- }
16
- /**
17
- * Get unique AdInsure SignalR Server zip by specified version
18
- * @param {string} version The version of AdInsure SignalR 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-signalr-${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 SignalR zip by specified version
35
- * @param {string} version The version of AdInsure SignalR
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-signalr';
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-signalr';
50
15
  }
51
16
  run() {
52
17
  const _super = Object.create(null, {
@@ -63,14 +28,14 @@ class DownloadSignalrServer 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
- ? os.homedir() + outputDir.split('~')[1]
68
- : outputDir;
31
+ const basePath = outputDir.charAt(0) === '~' ?
32
+ os.homedir() + outputDir.split('~')[1] :
33
+ outputDir;
69
34
  const filename = `AdInsure-signalr-${flags.version}.zip`;
70
35
  const filePath = path.resolve(basePath, filename);
71
36
  ux.action.start(`Downloading AdInsure SignalR Server version ${flags.version} to ${filePath}`, undefined, { stdout: true });
72
37
  try {
73
- var file;
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 DownloadSignalrServer extends CommandBase {
90
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
56
  }
92
57
  catch (error) {
93
- switch (error.statusCode) {
58
+ switch (error instanceof HttpError ? error.status : undefined) {
94
59
  case 404: {
95
60
  this.error('Does not exist.', { exit: 1 });
96
61
  }
@@ -1,33 +1,21 @@
1
- import { AxiosResponse } from 'axios';
2
- import CommandBase from '../../command.base.js';
3
- export default class DownloadStudio extends CommandBase<typeof DownloadStudio> {
1
+ import DownloadCommand from '../../command.download.js';
2
+ export default class DownloadStudio extends DownloadCommand<typeof DownloadStudio> {
4
3
  static description: string;
5
4
  static usage: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- source: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
- 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
- install: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
- skip: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
13
- keep: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
14
- force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
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, import("@oclif/core/interfaces").CustomOptions>;
10
+ install: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ skip: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ keep: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
14
  };
16
- private readonly url_azure;
17
- private readonly url_gitlabru;
15
+ protected readonly azureUrl = "https://ops.adinsure.com/api/storage/extensions";
16
+ protected readonly packageName = "adinsure-studio";
17
+ protected readonly extension = "vsix";
18
18
  private get vscodeExecutable();
19
- /**
20
- * Get unique AdInsure Studio vsix zip by specified version
21
- * @param {string} version The version of AdInsure Studio vsix
22
- * @returns {Promise<AxiosResponse<any, any>>}
23
- */
24
- downloadFileFromAzure(version: string): Promise<AxiosResponse<any, any>>;
25
- /**
26
- * Get unique AdInsure Studio zip by specified version
27
- * @param {string} version The version of AdInsure Studio
28
- * @returns {Promise<AxiosResponse<any, any>>}
29
- */
30
- downloadFileFromGitLabRu(version: string): Promise<AxiosResponse<any>>;
31
19
  installExtension(extensionPath: string): Promise<void>;
32
20
  findExtensionIfEnabled(studioVersion: string, enabled: boolean): Promise<boolean>;
33
21
  run(): Promise<0 | undefined>;
@@ -1,18 +1,19 @@
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 CommandBase from '../../command.base.js';
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 ChildProcessCommand from '../../lib/command.js';
10
10
  import OpsConfig from '../../lib/config.js';
11
- class DownloadStudio extends CommandBase {
11
+ class DownloadStudio extends DownloadCommand {
12
12
  constructor() {
13
13
  super(...arguments);
14
- this.url_azure = 'https://ops.adinsure.com/api/storage/extensions/';
15
- this.url_gitlabru = 'https://gitlabru.adacta-fintech.ru/api/v4/projects/2/packages/generic';
14
+ this.azureUrl = 'https://ops.adinsure.com/api/storage/extensions';
15
+ this.packageName = 'adinsure-studio';
16
+ this.extension = 'vsix';
16
17
  }
17
18
  get vscodeExecutable() {
18
19
  if (process.platform === 'win32') {
@@ -27,41 +28,6 @@ class DownloadStudio extends CommandBase {
27
28
  }
28
29
  return 'code';
29
30
  }
30
- /**
31
- * Get unique AdInsure Studio vsix zip by specified version
32
- * @param {string} version The version of AdInsure Studio vsix
33
- * @returns {Promise<AxiosResponse<any, any>>}
34
- */
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- downloadFileFromAzure(version) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- return axios.get(`${this.url_azure}/adinsure-studio-${version}.vsix`, {
39
- headers: {
40
- Authorization: 'Bearer ' + (yield this.security.getToken()),
41
- 'Content-Type': 'application/octet-stream',
42
- },
43
- responseType: 'arraybuffer',
44
- });
45
- });
46
- }
47
- /**
48
- * Get unique AdInsure Studio zip by specified version
49
- * @param {string} version The version of AdInsure Studio
50
- * @returns {Promise<AxiosResponse<any, any>>}
51
- */
52
- //eslint-disable-next-line @typescript-eslint/no-explicit-any
53
- downloadFileFromGitLabRu(version) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- const packageName = 'adinsure-studio';
56
- const fileName = `${packageName}-${version}.vsix`;
57
- return axios.get(`${this.url_gitlabru}/${packageName}/${version}/${fileName}`, {
58
- headers: {
59
- 'PRIVATE-TOKEN': this.security.getTokenRu(),
60
- },
61
- responseType: 'arraybuffer',
62
- });
63
- });
64
- }
65
31
  installExtension(extensionPath) {
66
32
  return __awaiter(this, void 0, void 0, function* () {
67
33
  const cp = new ChildProcessCommand();
@@ -99,10 +65,10 @@ class DownloadStudio extends CommandBase {
99
65
  DownloadStudio.flags.output.default = defaultFolder || './';
100
66
  const { flags } = yield this.parse(DownloadStudio);
101
67
  // The os.homedir expands the ~ char, as the node path.resolve method does not expand it
102
- let outputDir = flags.output;
103
- const basePath = outputDir.charAt(0) === '~'
104
- ? os.homedir() + outputDir.split('~')[1]
105
- : outputDir;
68
+ const outputDir = flags.output;
69
+ const basePath = outputDir.charAt(0) === '~' ?
70
+ os.homedir() + outputDir.split('~')[1] :
71
+ outputDir;
106
72
  if (flags.force && !(yield fs.pathExists(basePath))) {
107
73
  yield fs.mkdirp(basePath);
108
74
  }
@@ -127,7 +93,7 @@ class DownloadStudio extends CommandBase {
127
93
  return;
128
94
  }
129
95
  ux.action.start(`Downloading AdInsure Studio version ${flags.version} to ${filePath}`, undefined, { stdout: true });
130
- var file;
96
+ let file;
131
97
  if (!flags.source) {
132
98
  const config = new OpsConfig(this.security.getConfigPath());
133
99
  flags.source = config.get('endpoint') || 'azure'; // no flag -> DEFAULT source is azure
@@ -158,7 +124,7 @@ class DownloadStudio extends CommandBase {
158
124
  if (error.oclif) {
159
125
  throw error;
160
126
  }
161
- switch (error.statusCode) {
127
+ switch (error instanceof HttpError ? error.status : undefined) {
162
128
  case 404: {
163
129
  this.error('Does not exist.', { exit: 1 });
164
130
  }
@@ -6,15 +6,15 @@ export default class GitlabGetTagPipeline extends CommandBase<typeof GitlabGetTa
6
6
  static usage: string;
7
7
  static examples: string[];
8
8
  static args: {
9
- tag: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
9
+ tag: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
10
10
  };
11
11
  static flags: {
12
- pat: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
- host: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
- project: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
15
- wait: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
16
- timeout: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
17
- delay: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
+ pat: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ host: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ wait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ timeout: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ delay: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
18
18
  };
19
19
  waitPipelineStatus(gitlab: GitLab, tag: string, timeout: number, delay: number): Promise<string>;
20
20
  hostConfigValidation(config: OpsConfig): Promise<void>;