@adinsure-ops/ops-cli 5.0.3 → 5.0.4

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,9 @@
1
1
  # Changelogs
2
2
 
3
+ ## 5.0.4: 2023-09-27
4
+
5
+ - Fixed version command's post request, where the headers were actually stored in the body
6
+
3
7
  ## 5.0.3: 2023-09-25
4
8
 
5
9
  - Updated node engine support to also include 20.x and deprecated the use of 14.x
package/README.md CHANGED
@@ -36,7 +36,7 @@ You can run and debug commands directly from terminal by running `ops [command]`
36
36
  - [`ops download:signalr <flags>`](#ops-downloadsignalr-flags)
37
37
  - [`ops download:studio <flags>`](#ops-downloadstudio-flags)
38
38
  - [`ops download:keycloak-scim <flags>`](#ops-downloadkeycloak-scim-flags)
39
- - [`ops download:jmeter-examples <flags>`](#ops-downloadstudio-flags)
39
+ - [`ops download:jmeter <flags>`](#ops-downloadstudio-flags)
40
40
  - [`ops gitlab:get-tag-pipeline`](#ops-gitlabget-tag-pipeline)
41
41
  - [`ops gitlab:next-nightly-tag`](#ops-gitlabnext-nightly-tag)
42
42
  - [`ops log <issue> -t <type> -c [component]`](#ops-log-issue-t-type-c-component)
@@ -222,19 +222,19 @@ EXAMPLES
222
222
  $ ops download:keycloak-scim -v 3.0.0
223
223
  ```
224
224
 
225
- ## `ops download:jmeter-examples <flags>`
225
+ ## `ops download:jmeter <flags>`
226
226
 
227
227
  Download the Jmeter examples zip
228
228
 
229
229
  ```txt
230
230
  USAGE
231
- $ ops download:jmeter-examples <flags>
231
+ $ ops download:jmeter <flags>
232
232
 
233
233
  OPTIONS
234
234
  -o, --output=output [default: ./] output directory.
235
235
 
236
236
  EXAMPLES
237
- $ ops download:jmeter-examples -o ~/Downloads
237
+ $ ops download:jmeter -o ~/Downloads
238
238
  ```
239
239
 
240
240
  ## `ops gitlab:get-tag-pipeline`
@@ -404,13 +404,16 @@ USAGE
404
404
  $ ops login
405
405
 
406
406
  OPTIONS
407
- --servicePrincipal # authenticate using service principal credentials.
408
- -c, --clientId # (application) client id.
409
- -s, --secret # client secret.
407
+ --deviceFlow authenticate using device flow
408
+ --force Force a change of login token
409
+ --npm register also for npm
410
+ --skipCI=<value> Skip login if environment variables is set
410
411
 
411
412
  EXAMPLES
412
413
  $ ops login
413
- $ ops login --servicePrincipal -c {client id} -s {secret}
414
+ $ ops login --npm
415
+ $ ops login --skipCi CI
416
+ $ ops login --deviceFlow
414
417
  ```
415
418
 
416
419
  ## `ops npm:check-publish`
@@ -59,9 +59,9 @@ class DownloadJmeter extends CommandBase {
59
59
  }
60
60
  }
61
61
  DownloadJmeter.description = 'download jmeter examples from Azure storage';
62
- DownloadJmeter.usage = 'download:jmeter-examples <flags>';
62
+ DownloadJmeter.usage = 'download:jmeter <flags>';
63
63
  DownloadJmeter.examples = [
64
- `$ ops download:jmeter-examples -o ~/Downloads`,
64
+ `$ ops download:jmeter -o ~/Downloads`,
65
65
  ];
66
66
  DownloadJmeter.flags = {
67
67
  output: Flags.string({
@@ -4,10 +4,7 @@ export default class Login extends CommandBase<typeof Login> {
4
4
  static usage: string;
5
5
  static examples: string[];
6
6
  static flags: {
7
- servicePrincipal: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
8
7
  deviceFlow: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
9
- clientId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- secret: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
8
  npm: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
9
  skipCI: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
10
  force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
@@ -75,9 +75,6 @@ class Login extends CommandBase {
75
75
  this.error(error);
76
76
  }
77
77
  }
78
- else if (flags.servicePrincipal || flags.clientId || flags.secret) {
79
- this.warn(`${chalk.red('[DEPRECATED] --servicePrincipal parameter is deprecated. To use with service principal, please set environment variables AZURE_CLIENT_ID and AZURE_CLIENT_SECRET! Login is not required!')}`);
80
- }
81
78
  else {
82
79
  this.log(`${chalk.yellow('Note: We have launched a browser for you to login.')}`);
83
80
  const loginUrl = yield this.security.getLoginUrl();
@@ -125,24 +122,10 @@ Login.examples = [
125
122
  `$ ops login --deviceFlow`,
126
123
  ];
127
124
  Login.flags = {
128
- servicePrincipal: Flags.boolean({
129
- description: 'authenticate using service principal credentials',
130
- default: false,
131
- }),
132
125
  deviceFlow: Flags.boolean({
133
126
  description: 'authenticate using device flow',
134
127
  default: false,
135
128
  }),
136
- clientId: Flags.string({
137
- char: 'c',
138
- env: 'AZURE_CLIENT_ID',
139
- description: '[DEPRECATED] (application) client id',
140
- }),
141
- secret: Flags.string({
142
- char: 's',
143
- env: 'AZURE_CLIENT_SECRET',
144
- description: '[DEPRECATED] client secret',
145
- }),
146
129
  npm: Flags.boolean({
147
130
  description: 'register also for npm',
148
131
  default: false,
@@ -75,15 +75,15 @@ class Version extends CommandBase {
75
75
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
76
  validateOptions(args, flags) {
77
77
  if (args.type !== 'new' && flags.version) {
78
- this.error(`${chalk.red('Version flag can only be used with new type')}`);
78
+ this.error(`${chalk.red('Version flag can only be used with new type')}`, { exit: 2 });
79
79
  return false;
80
80
  }
81
81
  if (args.type === 'new' && !flags.version) {
82
- this.error(`${chalk.red('Version flag is required with new type')}`);
82
+ this.error(`${chalk.red('Version flag is required with new type')}`, { exit: 2 });
83
83
  return false;
84
84
  }
85
85
  if (args.type === 'new' && flags.increment) {
86
- this.error(`${chalk.red('Increment flag not supported with new type')}`);
86
+ this.error(`${chalk.red('Increment flag not supported with new type')}`, { exit: 2 });
87
87
  return false;
88
88
  }
89
89
  return true;
@@ -113,15 +113,11 @@ class Version extends CommandBase {
113
113
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
114
  insertScriptRequest(token, version, prefix) {
115
115
  return __awaiter(this, void 0, void 0, function* () {
116
- return axios.post(`https://ops.adinsure.com/api/script`, {
116
+ return axios.post(`https://ops.adinsure.com/api/script`, { version, prefix }, {
117
117
  headers: {
118
118
  Authorization: 'Bearer ' + token,
119
119
  'Content-Type': 'application/json',
120
120
  },
121
- params: {
122
- version,
123
- prefix,
124
- },
125
121
  });
126
122
  });
127
123
  }
@@ -132,12 +128,9 @@ class Version extends CommandBase {
132
128
  ux.action.stop(`${chalk.blue('skip')}`);
133
129
  }
134
130
  else if (token) {
135
- try {
136
- yield this.insertScriptRequest(token, version, prefix);
137
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
138
- }
139
- catch (error) {
140
- switch (error.statusCode) {
131
+ yield this.insertScriptRequest(token, version, prefix)
132
+ .catch((error) => {
133
+ switch (error.response.status) {
141
134
  case 401: {
142
135
  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.')}`);
143
136
  break;
@@ -146,7 +139,7 @@ class Version extends CommandBase {
146
139
  this.error(`${chalk.red(error)}`);
147
140
  }
148
141
  }
149
- }
142
+ });
150
143
  ux.action.stop(`${chalk.green('done')}`);
151
144
  }
152
145
  else {
@@ -17,7 +17,6 @@ export default class SecurityContext {
17
17
  this.devopsResourceId = '499b84ac-1321-427f-aa17-267ca6975798';
18
18
  this.tenant = 'adfintech.onmicrosoft.com';
19
19
  this.authorityUrl = `https://login.microsoftonline.com/${this.tenant}/`;
20
- // tslint:disable-next-line: no-http-string
21
20
  this.redirectUri = 'http://localhost:3044';
22
21
  this.resource = 'https://ops.adinsure.com';
23
22
  this._verifier = null;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.3",
2
+ "version": "5.0.4",
3
3
  "commands": {
4
4
  "doctor": {
5
5
  "id": "doctor",
@@ -40,32 +40,12 @@
40
40
  "$ ops login --deviceFlow"
41
41
  ],
42
42
  "flags": {
43
- "servicePrincipal": {
44
- "name": "servicePrincipal",
45
- "type": "boolean",
46
- "description": "authenticate using service principal credentials",
47
- "allowNo": false
48
- },
49
43
  "deviceFlow": {
50
44
  "name": "deviceFlow",
51
45
  "type": "boolean",
52
46
  "description": "authenticate using device flow",
53
47
  "allowNo": false
54
48
  },
55
- "clientId": {
56
- "name": "clientId",
57
- "type": "option",
58
- "char": "c",
59
- "description": "[DEPRECATED] (application) client id",
60
- "multiple": false
61
- },
62
- "secret": {
63
- "name": "secret",
64
- "type": "option",
65
- "char": "s",
66
- "description": "[DEPRECATED] client secret",
67
- "multiple": false
68
- },
69
49
  "npm": {
70
50
  "name": "npm",
71
51
  "type": "boolean",
@@ -477,13 +457,13 @@
477
457
  "id": "download:jmeter",
478
458
  "description": "download jmeter examples from Azure storage",
479
459
  "strict": true,
480
- "usage": "download:jmeter-examples <flags>",
460
+ "usage": "download:jmeter <flags>",
481
461
  "pluginName": "@adinsure-ops/ops-cli",
482
462
  "pluginAlias": "@adinsure-ops/ops-cli",
483
463
  "pluginType": "core",
484
464
  "aliases": [],
485
465
  "examples": [
486
- "$ ops download:jmeter-examples -o ~/Downloads"
466
+ "$ ops download:jmeter -o ~/Downloads"
487
467
  ],
488
468
  "flags": {
489
469
  "output": {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@adinsure-ops/ops-cli",
3
3
  "description": "Operations CLI for working with AdInsure",
4
- "version": "5.0.3",
4
+ "version": "5.0.4",
5
5
  "author": "Adacta Digital Service Department",
6
6
  "bin": {
7
7
  "ops": "./bin/run.js"
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@azure/msal-node": "^1.14.5",
11
+ "@azure/msal-node": "^2.1.0",
12
12
  "@oclif/core": "^2.11.8",
13
13
  "@oclif/plugin-help": "^5.2.17",
14
14
  "@oclif/plugin-not-found": "^2.3.37",
@@ -74,7 +74,7 @@
74
74
  "@types/node": "^20.5.7"
75
75
  },
76
76
  "engines": {
77
- "node": "^16 || ^18 || ^20"
77
+ "node": "^18 || ^20"
78
78
  },
79
79
  "files": [
80
80
  "/bin",