@adinsure-ops/ops-cli 5.0.8 → 5.0.10-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/CHANGELOGS.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelogs
2
2
 
3
+ ## 5.0.9: 2023-01-03
4
+
5
+ - ops-cli sql command is now case insensitive
6
+ - LJADIRDSUP-12244: axios already returns json and doesn't need to be parsed again
7
+
3
8
  ## 5.0.8: 2023-12-22
4
9
 
5
10
  - gitlab:get-nightly-tag command request is fixed since the parameters in the HTTP header were misconfigured
@@ -1,9 +1,9 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { Command } from '@oclif/core';
3
+ import axios from 'axios';
4
+ import chalk from 'chalk';
3
5
  import fs from 'fs-extra';
4
6
  import path from 'path';
5
- import chalk from 'chalk';
6
- import axios from 'axios';
7
7
  import SecurityContext from './security/context.js';
8
8
  /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
9
9
  export default class CommandBase extends Command {
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadClient extends CommandBase {
10
10
  constructor() {
@@ -53,11 +53,9 @@ class DownloadClient extends CommandBase {
53
53
  switch (error.statusCode) {
54
54
  case 404: {
55
55
  this.error('Does not exists.', { exit: 1 });
56
- break;
57
56
  }
58
57
  case 400: {
59
58
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
60
- break;
61
59
  }
62
60
  default: {
63
61
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadIdentityServer extends CommandBase {
10
10
  constructor() {
@@ -53,11 +53,9 @@ class DownloadIdentityServer extends CommandBase {
53
53
  switch (error.statusCode) {
54
54
  case 404: {
55
55
  this.error('Does not exists.', { exit: 1 });
56
- break;
57
56
  }
58
57
  case 400: {
59
58
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
60
- break;
61
59
  }
62
60
  default: {
63
61
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadJmeter extends CommandBase {
10
10
  constructor() {
@@ -48,11 +48,9 @@ class DownloadJmeter extends CommandBase {
48
48
  switch (error.statusCode) {
49
49
  case 404: {
50
50
  this.error('Does not exists.', { exit: 1 });
51
- break;
52
51
  }
53
52
  case 400: {
54
53
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
55
- break;
56
54
  }
57
55
  default: {
58
56
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadKeycloak extends CommandBase {
10
10
  constructor() {
@@ -48,11 +48,9 @@ class DownloadKeycloak extends CommandBase {
48
48
  switch (error.statusCode) {
49
49
  case 404: {
50
50
  this.error('Does not exists.', { exit: 1 });
51
- break;
52
51
  }
53
52
  case 400: {
54
53
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
55
- break;
56
54
  }
57
55
  default: {
58
56
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadPlatform extends CommandBase {
10
10
  constructor() {
@@ -53,11 +53,9 @@ class DownloadPlatform extends CommandBase {
53
53
  switch (error.statusCode) {
54
54
  case 404: {
55
55
  this.error('Does not exists.', { exit: 1 });
56
- break;
57
56
  }
58
57
  case 400: {
59
58
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
60
- break;
61
59
  }
62
60
  default: {
63
61
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadScheduler extends CommandBase {
10
10
  constructor() {
@@ -53,11 +53,9 @@ class DownloadScheduler extends CommandBase {
53
53
  switch (error.statusCode) {
54
54
  case 404: {
55
55
  this.error('Does not exists.', { exit: 1 });
56
- break;
57
56
  }
58
57
  case 400: {
59
58
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
60
- break;
61
59
  }
62
60
  default: {
63
61
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadServer extends CommandBase {
10
10
  constructor() {
@@ -53,11 +53,9 @@ class DownloadServer extends CommandBase {
53
53
  switch (error.statusCode) {
54
54
  case 404: {
55
55
  this.error('Does not exists.', { exit: 1 });
56
- break;
57
56
  }
58
57
  case 400: {
59
58
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
60
- break;
61
59
  }
62
60
  default: {
63
61
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  class DownloadSignalrServer extends CommandBase {
10
10
  constructor() {
@@ -53,11 +53,9 @@ class DownloadSignalrServer extends CommandBase {
53
53
  switch (error.statusCode) {
54
54
  case 404: {
55
55
  this.error('Does not exists.', { exit: 1 });
56
- break;
57
56
  }
58
57
  case 400: {
59
58
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
60
- break;
61
59
  }
62
60
  default: {
63
61
  this.error(error.message);
@@ -3,8 +3,8 @@ import { Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
- import path from 'path';
7
6
  import os from 'os';
7
+ import path from 'path';
8
8
  import CommandBase from '../../command.base.js';
9
9
  import ChildProcessCommand from '../../lib/command.js';
10
10
  class DownloadStudio extends CommandBase {
@@ -103,11 +103,9 @@ class DownloadStudio extends CommandBase {
103
103
  switch (error.statusCode) {
104
104
  case 404: {
105
105
  this.error('Does not exists.', { exit: 1 });
106
- break;
107
106
  }
108
107
  case 400: {
109
108
  this.error('Try refreshing your login credentials with "ops login".', { exit: 1 });
110
- break;
111
109
  }
112
110
  default: {
113
111
  this.error(error.message);
@@ -43,7 +43,7 @@ class NpmCheckPublish extends CommandBase {
43
43
  ux.action.stop(`${chalk.green('done')}`);
44
44
  ux.action.start('Getting list of available packages', undefined, { stdout: true });
45
45
  // eslint-disable-next-line unicorn/no-await-expression-member
46
- const allPackages = JSON.parse((yield npmContext.getAllNpmPackages(flags.pat)).data);
46
+ const allPackages = (yield npmContext.getAllNpmPackages(flags.pat)).data;
47
47
  ux.action.stop(`${chalk.green('done')}`);
48
48
  yield this.checkPackagesExists(packages, allPackages, flags.version);
49
49
  ux.action.stop('success');
@@ -151,7 +151,7 @@ class NpmPublish extends CommandBase {
151
151
  ux.action.stop(`${chalk.green('done')}`);
152
152
  ux.action.start('Getting list of published packages', undefined, { stdout: true });
153
153
  // eslint-disable-next-line unicorn/no-await-expression-member
154
- const allPackages = JSON.parse((yield npmContext.getAllNpmPackages(flags.pat)).data);
154
+ const allPackages = (yield npmContext.getAllNpmPackages(flags.pat)).data;
155
155
  ux.action.stop(`${chalk.green('done')}`);
156
156
  yield this.publishPackages(packages, allPackages, flags.version, flags.retry);
157
157
  ux.action.stop('success');
@@ -3,8 +3,8 @@ import { Args, Flags } from '@oclif/core';
3
3
  import chalk from 'chalk';
4
4
  import fs from 'fs-extra';
5
5
  import semver from 'semver';
6
- import NugetContext from '../../lib/nuget.js';
7
6
  import CommandBase from '../../command.base.js';
7
+ import NugetContext from '../../lib/nuget.js';
8
8
  class NuGetDependencyUpdate extends CommandBase {
9
9
  /**
10
10
  * Update dependencies in csproj files for @adinsure packages
@@ -170,9 +170,7 @@ class PrepareContent extends CommandBase {
170
170
  throw new Error(error.message);
171
171
  }
172
172
  const lines = fileContent.split(/\r?\n/).filter(line => line.length > 0);
173
- const lineParse = lines.map(line => {
174
- return this.parseDotfileLine(line.trim(), sourceDirectory);
175
- });
173
+ const lineParse = lines.map(line => this.parseDotfileLine(line.trim(), sourceDirectory));
176
174
  const parsedLines = Promise.all(lineParse).then(lines => lines.filter(line => line.prefix !== '#'));
177
175
  return parsedLines;
178
176
  });
@@ -230,9 +228,7 @@ class PrepareContent extends CommandBase {
230
228
  }
231
229
  prepareTransformations(linesData, baseSourceDir, baseDestinationDir) {
232
230
  return __awaiter(this, void 0, void 0, function* () {
233
- const transformations = linesData.map(line => {
234
- return this.getTransformation(line, baseSourceDir, baseDestinationDir);
235
- });
231
+ const transformations = linesData.map(line => this.getTransformation(line, baseSourceDir, baseDestinationDir));
236
232
  return Promise.all(transformations);
237
233
  });
238
234
  }
@@ -8,6 +8,7 @@ import _ from 'lodash-es';
8
8
  import path from 'path';
9
9
  import semver from 'semver';
10
10
  import CommandBase from '../command.base.js';
11
+ import { capitalizeFirstLetter } from '../lib/helper.js';
11
12
  class Sql extends CommandBase {
12
13
  constructor() {
13
14
  super(...arguments);
@@ -55,12 +56,9 @@ class Sql extends CommandBase {
55
56
  ('0' + (date.getUTCSeconds())).slice(-2);
56
57
  const versionSplit = version.split('.');
57
58
  let scriptId = prefix +
58
- '_' +
59
- ('00' + versionSplit[0]).slice(-3) +
60
- '.' +
61
- ('00' + versionSplit[1]).slice(-3) +
62
- '.' +
63
- ('00' + versionSplit[2]).slice(-3) +
59
+ '_' + ('00' + versionSplit[0]).slice(-3) +
60
+ '.' + ('00' + versionSplit[1]).slice(-3) +
61
+ '.' + ('00' + versionSplit[2]).slice(-3) +
64
62
  '_' + timestamp;
65
63
  if (description) {
66
64
  scriptId = scriptId + '_' + _.snakeCase(description).slice(0, 100);
@@ -185,7 +183,6 @@ end;`;
185
183
  }
186
184
  // Validation of input parameters
187
185
  let scriptType = args.type;
188
- console.log(scriptType);
189
186
  if (!scriptType) {
190
187
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
191
188
  const responses = yield inquirer.prompt([{
@@ -196,8 +193,7 @@ end;`;
196
193
  }]);
197
194
  scriptType = responses.type;
198
195
  }
199
- if (scriptType === 'Migration')
200
- scriptType = scriptType.toLowerCase();
196
+ scriptType = scriptType === 'Migration' ? scriptType.toLowerCase() : capitalizeFirstLetter(scriptType);
201
197
  let scriptModule = args.module;
202
198
  if (!scriptModule && scriptType === 'data') {
203
199
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -32,7 +32,7 @@ class Translate extends CommandBase {
32
32
  'Content-Type': this.getFormat(format),
33
33
  },
34
34
  responseType: 'arraybuffer',
35
- params: Object.assign({ languages: languages }, (modules && { modules: modules })),
35
+ params: Object.assign({ languages }, (modules && { modules })),
36
36
  };
37
37
  try {
38
38
  return (yield axios.get(`https://dictionary.adinsure.com/api/Translations`, requestOptions));
@@ -1,13 +1,13 @@
1
1
  import { __awaiter } from "tslib";
2
- import { Flags, Args, ux } from '@oclif/core';
2
+ import { Args, Flags, ux } from '@oclif/core';
3
3
  import axios from 'axios';
4
4
  import chalk from 'chalk';
5
5
  import fs from 'fs-extra';
6
6
  import { globby } from 'globby';
7
7
  import moment from 'moment';
8
8
  import path from 'path';
9
- import semver from 'semver';
10
9
  import replaceInFile from 'replace-in-file';
10
+ import semver from 'semver';
11
11
  import CommandBase from '../command.base.js';
12
12
  class Version extends CommandBase {
13
13
  /**
@@ -76,15 +76,12 @@ class Version extends CommandBase {
76
76
  validateOptions(args, flags) {
77
77
  if (args.type !== 'new' && flags.version) {
78
78
  this.error(`${chalk.red('Version flag can only be used with new type')}`, { exit: 2 });
79
- return false;
80
79
  }
81
80
  if (args.type === 'new' && !flags.version) {
82
81
  this.error(`${chalk.red('Version flag is required with new type')}`, { exit: 2 });
83
- return false;
84
82
  }
85
83
  if (args.type === 'new' && flags.increment) {
86
84
  this.error(`${chalk.red('Increment flag not supported with new type')}`, { exit: 2 });
87
- return false;
88
85
  }
89
86
  return true;
90
87
  }
@@ -133,7 +130,6 @@ class Version extends CommandBase {
133
130
  switch (error.response.status) {
134
131
  case 401: {
135
132
  this.error(`${chalk.red('You don\'t have permissions. If this was intentional command, please contact Operations for permissions, do git reset and rerun command.')}`);
136
- break;
137
133
  }
138
134
  default: {
139
135
  this.error(`${chalk.red(error)}`);
@@ -87,7 +87,7 @@ export default class SecurityContext {
87
87
  scopes: [this.resource + '/.default', 'offline_access'],
88
88
  }).then(response => {
89
89
  if (response) {
90
- const accessToken = response.accessToken;
90
+ const { accessToken } = response;
91
91
  resolve(accessToken);
92
92
  }
93
93
  else {
@@ -116,7 +116,7 @@ export default class SecurityContext {
116
116
  scopes: [this.resource + '/.default'],
117
117
  }).then(response => {
118
118
  if (response) {
119
- const accessToken = response.accessToken;
119
+ const { accessToken } = response;
120
120
  resolve(accessToken);
121
121
  }
122
122
  else {
@@ -131,7 +131,7 @@ export default class SecurityContext {
131
131
  scopes: [this.resource + '/.default', 'offline_access'],
132
132
  }).then(response => {
133
133
  if (response) {
134
- const accessToken = response.accessToken;
134
+ const { accessToken } = response;
135
135
  resolve(accessToken);
136
136
  }
137
137
  else {
@@ -185,7 +185,7 @@ export default class SecurityContext {
185
185
  acquireTokenDeviceFlow() {
186
186
  return new Promise((resolve, reject) => {
187
187
  this._pca.acquireTokenByDeviceCode({
188
- deviceCodeCallback: response => {
188
+ deviceCodeCallback(response) {
189
189
  if (response.message) {
190
190
  // tslint:disable-next-line: no-console
191
191
  console.log(response.message);
@@ -1,6 +1,6 @@
1
1
  export interface ChangelogEntry {
2
- type: string;
3
- issue: string;
4
2
  component: string;
5
3
  content: string;
4
+ issue: string;
5
+ type: string;
6
6
  }
@@ -4,31 +4,31 @@ export type AzurePackageArray = {
4
4
  };
5
5
  export type AzurePackage = {
6
6
  id: string;
7
- normalizedName: string;
8
7
  name: string;
8
+ normalizedName: string;
9
9
  protocolType: string;
10
10
  url: string;
11
11
  versions: AzurePackageVersion[];
12
12
  };
13
13
  export type AzurePackageVersion = {
14
14
  id: string;
15
- normalizedVersion: string;
16
- version: string;
17
15
  isLatest: boolean;
18
16
  isListed: boolean;
17
+ normalizedVersion: string;
18
+ publishDate: string;
19
19
  storageId: string;
20
+ version: string;
20
21
  views: AzurePackageView[];
21
- publishDate: string;
22
22
  };
23
23
  export type AzurePackageView = {
24
24
  id: string;
25
25
  name: string;
26
- url: string;
27
26
  type: boolean;
27
+ url: string;
28
28
  };
29
29
  export type NpmPackage = {
30
+ jsonPath: string;
30
31
  name: string;
31
- version: string;
32
32
  path: string;
33
- jsonPath: string;
33
+ version: string;
34
34
  };
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.8",
2
+ "version": "5.0.10-rc1",
3
3
  "commands": {
4
4
  "doctor": {
5
5
  "id": "doctor",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adinsure-ops/ops-cli",
3
3
  "description": "Operations CLI for working with AdInsure",
4
- "version": "5.0.8",
4
+ "version": "5.0.10-rc1",
5
5
  "author": "Adacta Digital Service Department",
6
6
  "bin": {
7
7
  "ops": "./bin/run.js"
@@ -32,7 +32,6 @@
32
32
  "semver": "^7.5.4",
33
33
  "tough-cookie": "^4.1.3",
34
34
  "tslib": "^2.6.2",
35
- "typescript": "^5.2.2",
36
35
  "yaml": "^2.3.1"
37
36
  },
38
37
  "devDependencies": {
@@ -68,7 +67,8 @@
68
67
  "sinon": "^15.1.0",
69
68
  "timekeeper": "^2.2.0",
70
69
  "ts-mockito": "^2.6.1",
71
- "ts-node": "^10.9.1"
70
+ "ts-node": "^10.9.1",
71
+ "typescript": "^5.2.2"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "@types/node": "^20.5.7"
@@ -121,7 +121,7 @@
121
121
  "test-with-coverage": "nyc --require ts-node/register --extension .ts mocha --reporter=doc --timeout 20000 --forbid-only \"test/**/*.test.ts\"",
122
122
  "test-single": "nyc --require ts-node/register --extension .ts mocha --timeout 20000 --forbid-only",
123
123
  "test-single-with-coverage": "nyc --require ts-node/register --extension .ts mocha --reporter=doc --timeout 20000 --forbid-only",
124
- "eslint": "eslint ./src ./test --ext .ts --config .eslintrc"
124
+ "eslint": "eslint --quiet ./src ./test --ext .ts --config .eslintrc"
125
125
  },
126
126
  "types": "lib/index.d.ts"
127
127
  }