mstate-cli 0.1.7 → 0.1.8

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.
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MOBIOFFICE_URL = exports.MSTATE_URL = void 0;
4
- exports.MSTATE_URL = 'http://localhost:3000/api';
5
- // export const MSTATE_URL = 'https://dev.mstate.mobioffice.io/api';
6
- // export const MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
4
+ exports.MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
7
5
  exports.MOBIOFFICE_URL = 'https://server.mobioffice.io/api';
@@ -10,12 +10,18 @@ class HelpHandler {
10
10
  utils_1.customLog.info(enum_1.CmdAction.ADD, 'Add new workflow');
11
11
  utils_1.customLog.info(enum_1.CmdAction.CLONE, 'Clone workflow with actions and environments');
12
12
  utils_1.customLog.info(enum_1.CmdAction.PUSH, 'Update the changes one in cloned workflow');
13
- utils_1.customLog.info(enum_1.CmdAction.LINK, 'add workflow and allow user to view workflow to mobioffice application');
14
- utils_1.customLog.info(enum_1.CmdAction.UNLINK, 'add workflow and remove user to view workflow to mobioffice application');
15
- utils_1.customLog.info([enum_1.CmdAction.VERSION_FLAG, enum_1.CmdAction.VERSION].toString(), 'add workflow and remove user to view workflow to mobioffice application');
13
+ utils_1.customLog.info(enum_1.CmdAction.LINK, 'Add workflow and allow user to view workflow in the mobioffice application');
14
+ utils_1.customLog.info(enum_1.CmdAction.UNLINK, 'Disallow user to view workflow in the mobioffice application');
15
+ utils_1.customLog.info([enum_1.CmdAction.VERSION_FLAG, enum_1.CmdAction.VERSION].toString(), 'print mstate-cli version');
16
16
  }
17
17
  logActionInfo(action) {
18
- console.log({ action });
18
+ switch (action) {
19
+ case enum_1.CmdAction.ADD:
20
+ break;
21
+ default:
22
+ utils_1.customLog.error(`${action ? 'Invalid' : 'Missing'} script: ${action !== null && action !== void 0 ? action : ''}`);
23
+ console.log(`use 'mstate ${enum_1.CmdAction.HELP_FLAG}, ${enum_1.CmdAction.HELP}' for getting allowed action`);
24
+ }
19
25
  }
20
26
  }
21
27
  exports.helpHandler = new HelpHandler();
package/dist/index.js CHANGED
@@ -60,11 +60,13 @@ const [action] = process_1.argv.slice(2);
60
60
  help_handler_1.helpHandler.logCommandInfo();
61
61
  break;
62
62
  default:
63
- utils_1.customLog.changeAndThrow(`${action ? 'Invalid' : 'Missing'} script: ${action !== null && action !== void 0 ? action : ''}`);
64
- console.log(`use 'mstate ${enum_1.CmdAction.HELP_FLAG}, ${enum_1.CmdAction.HELP}' for getting allowed action`);
63
+ utils_1.customLog.error(`${action ? 'Invalid' : 'Missing'} script: ${action !== null && action !== void 0 ? action : ''}`);
64
+ console.log(`use 'mstate [command]? ${enum_1.CmdAction.HELP_FLAG}, ${enum_1.CmdAction.HELP}' for getting allowed action`);
65
65
  }
66
66
  });
67
- })().catch((error) => {
67
+ })()
68
+ .then()
69
+ .catch((error) => {
68
70
  if ((0, utils_1.hasFlag)(process_1.argv, enum_1.CmdAction.HELP) || (0, utils_1.hasFlag)(process_1.argv, enum_1.CmdAction.HELP_FLAG)) {
69
71
  help_handler_1.helpHandler.logActionInfo(action);
70
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mstate-cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "main": "index.js",
5
5
  "bin": {
6
6
  "mstate": "./dist/index.js"
@@ -1,4 +1,2 @@
1
- export const MSTATE_URL = 'http://localhost:3000/api';
2
- // export const MSTATE_URL = 'https://dev.mstate.mobioffice.io/api';
3
- // export const MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
1
+ export const MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
4
2
  export const MOBIOFFICE_URL = 'https://server.mobioffice.io/api';
@@ -14,20 +14,30 @@ class HelpHandler {
14
14
  customLog.info(CmdAction.PUSH, 'Update the changes one in cloned workflow');
15
15
  customLog.info(
16
16
  CmdAction.LINK,
17
- 'add workflow and allow user to view workflow to mobioffice application',
17
+ 'Add workflow and allow user to view workflow in the mobioffice application',
18
18
  );
19
19
  customLog.info(
20
20
  CmdAction.UNLINK,
21
- 'add workflow and remove user to view workflow to mobioffice application',
21
+ 'Disallow user to view workflow in the mobioffice application',
22
22
  );
23
23
  customLog.info(
24
24
  [CmdAction.VERSION_FLAG, CmdAction.VERSION].toString(),
25
- 'add workflow and remove user to view workflow to mobioffice application',
25
+ 'print mstate-cli version',
26
26
  );
27
27
  }
28
28
 
29
29
  logActionInfo(action: CmdAction) {
30
- console.log({ action });
30
+ switch (action) {
31
+ case CmdAction.ADD:
32
+ break;
33
+ default:
34
+ customLog.error(
35
+ `${action ? 'Invalid' : 'Missing'} script: ${action ?? ''}`,
36
+ );
37
+ console.log(
38
+ `use 'mstate ${CmdAction.HELP_FLAG}, ${CmdAction.HELP}' for getting allowed action`,
39
+ );
40
+ }
31
41
  }
32
42
  }
33
43
 
package/src/index.ts CHANGED
@@ -52,16 +52,18 @@ const [action] = argv.slice(2);
52
52
  break;
53
53
 
54
54
  default:
55
- customLog.changeAndThrow(
55
+ customLog.error(
56
56
  `${action ? 'Invalid' : 'Missing'} script: ${action ?? ''}`,
57
57
  );
58
58
  console.log(
59
- `use 'mstate ${CmdAction.HELP_FLAG}, ${CmdAction.HELP}' for getting allowed action`,
59
+ `use 'mstate [command]? ${CmdAction.HELP_FLAG}, ${CmdAction.HELP}' for getting allowed action`,
60
60
  );
61
61
  }
62
- })().catch((error: any) => {
63
- if (hasFlag(argv, CmdAction.HELP) || hasFlag(argv, CmdAction.HELP_FLAG)) {
64
- helpHandler.logActionInfo(action as CmdAction);
65
- } else customLog.error(error.message);
66
- });
62
+ })()
63
+ .then()
64
+ .catch((error: any) => {
65
+ if (hasFlag(argv, CmdAction.HELP) || hasFlag(argv, CmdAction.HELP_FLAG)) {
66
+ helpHandler.logActionInfo(action as CmdAction);
67
+ } else customLog.error(error.message);
68
+ });
67
69
  console.log('');