zcatalyst-cli 1.11.1 → 1.13.0

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 (188) hide show
  1. package/docs/optional-import.toml +10 -0
  2. package/lib/apig-utils.js +39 -39
  3. package/lib/archiver.js +13 -9
  4. package/lib/authentication/index.js +22 -18
  5. package/lib/authentication/login.js +37 -39
  6. package/lib/bin/catalyst.js +15 -15
  7. package/lib/cli_table/src/cell.js +26 -26
  8. package/lib/cli_table/src/layout-manager.js +44 -45
  9. package/lib/cli_table/src/table.js +9 -9
  10. package/lib/cli_table/src/utils.js +35 -36
  11. package/lib/client-utils.js +18 -18
  12. package/lib/client.js +1 -1
  13. package/lib/command_needs/auth.js +7 -7
  14. package/lib/command_needs/rc.js +24 -24
  15. package/lib/commands/apig/disable.js +5 -5
  16. package/lib/commands/apig/enable.js +5 -5
  17. package/lib/commands/apig/status.js +9 -9
  18. package/lib/commands/client/delete.js +19 -19
  19. package/lib/commands/client/setup.js +8 -4
  20. package/lib/commands/deploy.js +18 -14
  21. package/lib/commands/ds/export.js +11 -11
  22. package/lib/commands/ds/import.js +12 -12
  23. package/lib/commands/ds/status.js +15 -15
  24. package/lib/commands/event/generate/index.js +21 -17
  25. package/lib/commands/event/generate/integ.js +7 -3
  26. package/lib/commands/functions/add.js +8 -4
  27. package/lib/commands/functions/config.js +5 -5
  28. package/lib/commands/functions/delete.js +22 -22
  29. package/lib/commands/functions/setup.js +8 -4
  30. package/lib/commands/functions/shell.js +12 -5
  31. package/lib/commands/help.js +4 -4
  32. package/lib/commands/iac/export.js +8 -8
  33. package/lib/commands/iac/import.js +29 -21
  34. package/lib/commands/iac/pack.js +15 -11
  35. package/lib/commands/iac/status.js +6 -2
  36. package/lib/commands/index.js +5 -1
  37. package/lib/commands/init.js +14 -10
  38. package/lib/commands/login.js +5 -1
  39. package/lib/commands/logout.js +5 -1
  40. package/lib/commands/project/list.js +14 -10
  41. package/lib/commands/project/reset.js +5 -5
  42. package/lib/commands/project/use.js +9 -9
  43. package/lib/commands/pull.js +18 -14
  44. package/lib/commands/run.js +13 -9
  45. package/lib/commands/serve.js +5 -1
  46. package/lib/commands/token/generate.js +6 -2
  47. package/lib/commands/token/list.js +7 -3
  48. package/lib/commands/token/revoke.js +6 -2
  49. package/lib/commands/whoami.js +3 -3
  50. package/lib/dc.js +2 -2
  51. package/lib/deploy/features/apig.js +6 -6
  52. package/lib/deploy/features/client.js +1 -1
  53. package/lib/deploy/features/functions/index.js +9 -9
  54. package/lib/deploy/features/index.js +5 -1
  55. package/lib/deploy/index.js +2 -2
  56. package/lib/endpoints/index.js +17 -13
  57. package/lib/endpoints/lib/apig.js +5 -5
  58. package/lib/endpoints/lib/applogic.js +4 -4
  59. package/lib/endpoints/lib/cache.js +3 -3
  60. package/lib/endpoints/lib/catalyst-details.js +1 -1
  61. package/lib/endpoints/lib/client.js +5 -5
  62. package/lib/endpoints/lib/datastore.js +2 -2
  63. package/lib/endpoints/lib/ds-bulk.js +5 -5
  64. package/lib/endpoints/lib/env.js +1 -1
  65. package/lib/endpoints/lib/event-bus.js +1 -1
  66. package/lib/endpoints/lib/filestore.js +2 -2
  67. package/lib/endpoints/lib/functions.js +4 -4
  68. package/lib/endpoints/lib/iac.js +10 -10
  69. package/lib/endpoints/lib/project.js +20 -5
  70. package/lib/endpoints/lib/queue.js +3 -3
  71. package/lib/endpoints/lib/sdk.js +1 -1
  72. package/lib/endpoints/lib/zcql.js +1 -1
  73. package/lib/error.js +11 -9
  74. package/lib/errorOut.js +2 -2
  75. package/lib/event_generate/cache.js +5 -5
  76. package/lib/event_generate/custom.js +2 -2
  77. package/lib/event_generate/datastore.js +5 -5
  78. package/lib/event_generate/filestore.js +5 -5
  79. package/lib/event_generate/integration/cliq.js +3 -3
  80. package/lib/event_generate/user.js +1 -1
  81. package/lib/event_generate/webapp.js +5 -5
  82. package/lib/execute-script.js +19 -15
  83. package/lib/express_middlewares/authenticator.js +32 -5
  84. package/lib/express_middlewares/logger.js +2 -2
  85. package/lib/express_middlewares/unknownReqProxy.js +1 -1
  86. package/lib/fn-utils/index.js +5 -1
  87. package/lib/fn-utils/lib/common.js +44 -44
  88. package/lib/fn-utils/lib/integ.js +9 -9
  89. package/lib/fn-utils/lib/java.js +48 -46
  90. package/lib/fn-utils/lib/node.js +8 -8
  91. package/lib/fn-watcher.js +9 -11
  92. package/lib/iac/status/bundle.js +5 -5
  93. package/lib/iac/status/deploy.js +4 -4
  94. package/lib/index.js +2 -2
  95. package/lib/init/dependencies/npm-install.js +8 -1
  96. package/lib/init/dependencies/package-json.js +6 -6
  97. package/lib/init/features/client/index.js +5 -1
  98. package/lib/init/features/client/initializers/angular.js +29 -27
  99. package/lib/init/features/client/initializers/basic.js +10 -6
  100. package/lib/init/features/client/initializers/lyte.js +12 -13
  101. package/lib/init/features/client/initializers/react.js +23 -18
  102. package/lib/init/features/functions/index.js +23 -14
  103. package/lib/init/features/functions/languages/java.js +10 -10
  104. package/lib/init/features/functions/languages/node.js +9 -9
  105. package/lib/init/features/index.js +12 -8
  106. package/lib/init/features/project.js +20 -20
  107. package/lib/init/index.js +2 -2
  108. package/lib/init/util/client.js +12 -7
  109. package/lib/init/util/functions.js +1 -1
  110. package/lib/init/util/project.js +4 -4
  111. package/lib/internal/api.js +19 -19
  112. package/lib/internal/command.js +20 -16
  113. package/lib/internal/config.js +5 -5
  114. package/lib/internal/credential.js +10 -10
  115. package/lib/internal/crypt.js +5 -5
  116. package/lib/internal/rc.js +5 -5
  117. package/lib/migration/global/1.6.2.js +3 -3
  118. package/lib/migration/index.js +22 -18
  119. package/lib/option-filter.js +34 -30
  120. package/lib/optional-import.js +30 -11
  121. package/lib/plugin-loader.js +28 -13
  122. package/lib/port-resolver.js +4 -4
  123. package/lib/progress.js +2 -2
  124. package/lib/prompt/index.js +6 -2
  125. package/lib/prompt/types/file-path.js +1 -1
  126. package/lib/pull/features/apig.js +9 -9
  127. package/lib/pull/features/client.js +7 -7
  128. package/lib/pull/features/functions/index.js +15 -15
  129. package/lib/pull/features/index.js +5 -1
  130. package/lib/pull/index.js +4 -4
  131. package/lib/repl-server.js +2 -2
  132. package/lib/serve/features/apig.js +1 -1
  133. package/lib/serve/features/index.js +8 -4
  134. package/lib/serve/index.js +15 -11
  135. package/lib/serve/server/index.js +34 -27
  136. package/lib/serve/server/lib/java/JavaaioServer.java +5 -3
  137. package/lib/serve/server/lib/java/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  138. package/lib/serve/server/lib/java/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  139. package/lib/serve/server/lib/java/lib/zip4j-2.5.0.jar +0 -0
  140. package/lib/serve/server/lib/master.js +33 -36
  141. package/lib/serve/server/lib/node.js +7 -3
  142. package/lib/serve/server/lib/web_client/index.js +3 -3
  143. package/lib/serve/server/lib/web_client/server.js +33 -30
  144. package/lib/shell/dependencies/http-functions.js +38 -33
  145. package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +14 -3
  146. package/lib/shell/dependencies/invoker/bio/node.js +5 -2
  147. package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +7 -2
  148. package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +7 -2
  149. package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +7 -2
  150. package/lib/shell/dependencies/invoker/integ/node.js +8 -4
  151. package/lib/shell/dependencies/local-function.js +44 -40
  152. package/lib/shell/index.js +16 -12
  153. package/lib/shell/prepare/index.js +2 -2
  154. package/lib/shell/prepare/languages/index.js +5 -1
  155. package/lib/shell/prepare/languages/java.js +1 -1
  156. package/lib/throbber/index.js +17 -17
  157. package/lib/throbber/utils.js +9 -9
  158. package/lib/track.js +7 -7
  159. package/lib/util_modules/config/index.js +5 -1
  160. package/lib/util_modules/config/lib/client.js +18 -21
  161. package/lib/util_modules/constants/lib/auth.js +6 -6
  162. package/lib/util_modules/constants/lib/cliq-handlers.js +2 -2
  163. package/lib/util_modules/constants/lib/template.js +21 -21
  164. package/lib/util_modules/constants/lib/urls.js +20 -12
  165. package/lib/util_modules/context-help.js +15 -15
  166. package/lib/util_modules/fs/index.js +5 -1
  167. package/lib/util_modules/fs/lib/async.js +4 -4
  168. package/lib/util_modules/fs/utils.js +1 -1
  169. package/lib/util_modules/global-space.js +0 -97
  170. package/lib/util_modules/logger.js +2 -2
  171. package/lib/util_modules/parser/toml.js +1 -1
  172. package/lib/util_modules/project.js +6 -6
  173. package/lib/util_modules/server.js +53 -0
  174. package/lib/util_modules/shell.js +4 -4
  175. package/lib/winston.js +5 -5
  176. package/package.json +40 -40
  177. package/scripts/postInstall.js +7 -6
  178. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +23 -5
  179. package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +23 -8
  180. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -3
  181. package/templates/init/functions/node/integ/cliq/package.json +2 -1
  182. package/templates/init/functions/node/integ/cliq/sample.js +3 -1
  183. package/docs/.DS_Store +0 -0
  184. package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  185. package/templates/.DS_Store +0 -0
  186. package/templates/init/.DS_Store +0 -0
  187. package/templates/init/client/.DS_Store +0 -0
  188. package/templates/init/client/react/.DS_Store +0 -0
@@ -18,6 +18,7 @@ import java.util.logging.Handler;
18
18
  import java.util.logging.LogManager;
19
19
  import java.util.logging.LogRecord;
20
20
  import java.util.logging.Logger;
21
+ import java.util.logging.SimpleFormatter;
21
22
 
22
23
  import org.json.JSONException;
23
24
  import org.json.JSONObject;
@@ -39,7 +40,7 @@ public class JavaintegInvoker {
39
40
  if (record.getThrown() != null) {
40
41
  exceptionMessage = getStackTraceAsString(record.getThrown());
41
42
  }
42
- String message = record.getMessage() + " " + exceptionMessage;
43
+ String message = new SimpleFormatter().format(record) + " " + exceptionMessage;
43
44
  if (message.length() > MESSAGE_LENGTH) {
44
45
  message = message.substring(0, MESSAGE_LENGTH);
45
46
  }
@@ -140,9 +141,13 @@ public class JavaintegInvoker {
140
141
 
141
142
  clientAuth.put((userAuthHeaderType.equals("token")) ? "access_token" : "ticket", userAuthToken); // No I18N
142
143
  }
144
+ if(auth.containsKey("x-zc-user-type")) { // No I18N
145
+ String userType = auth.get("x-zc-user-type").toString(); // No I18N
146
+ clientAuth.put("user_type", userType); // No I18N
147
+ }
143
148
  catalystAuth.put("client_cred", clientAuth);
144
-
145
149
  ZCThreadLocal.putValue("CATALYST_AUTH", catalystAuth.toString()); // No I18N
150
+
146
151
  if (auth.containsKey("x-zc-cookie")) {
147
152
  String cookie = auth.get("x-zc-cookie").toString();
148
153
  ZCThreadLocal.putValue("client_cookie", cookie); // No I18N
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -28,9 +32,9 @@ const data = JSON.parse(args[1]);
28
32
  const projectJson = JSON.parse(args[2]);
29
33
  const authJson = JSON.parse(args[3]);
30
34
  const buildDir = JSON.parse(args[4]);
31
- const responseFile = path_1.join(buildDir, '.catalyst', 'user_res_body');
35
+ const responseFile = (0, path_1.join)(buildDir, '.catalyst', 'user_res_body');
32
36
  const writeAndExit = (resp, exitCode = 0) => {
33
- fs_1.writeFileSync(responseFile, JSON.stringify(resp));
37
+ (0, fs_1.writeFileSync)(responseFile, JSON.stringify(resp));
34
38
  process.exit(exitCode);
35
39
  };
36
40
  const integrationRequest = data || {};
@@ -71,5 +75,5 @@ try {
71
75
  }
72
76
  catch (e) {
73
77
  console.error(e);
74
- writeAndExit({ error: util_1.inspect(e) }, 2);
78
+ writeAndExit({ error: (0, util_1.inspect)(e) }, 2);
75
79
  }
@@ -34,13 +34,13 @@ class LocalFunction {
34
34
  this.watcher = target.watcher;
35
35
  this.target = js_1.JS.omit(target, ['zip_stream', 'watcher']);
36
36
  this.slave = null;
37
- this.nodeInvoker = path_1.normalize(path_1.join(__dirname, './invoker', target.type, 'node.js'));
38
- this.javaInvoker = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'Java' + target.type + 'Invoker');
37
+ this.nodeInvoker = (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'node.js'));
38
+ this.javaInvoker = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'Java' + target.type + 'Invoker');
39
39
  if ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) {
40
- fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker, path_1.normalize(path_1.join(__dirname, './invoker', target.type, 'java', 'Java' + target.type + 'Invoker.java')));
40
+ fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker, (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'java', 'Java' + target.type + 'Invoker.java')));
41
41
  }
42
- this.responseFile = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_res_body');
43
- this.metaFile = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_meta.json');
42
+ this.responseFile = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_res_body');
43
+ this.metaFile = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_meta.json');
44
44
  this.call = this._call.bind(this);
45
45
  (_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('preparing', () => {
46
46
  if (!this.repl.paused) {
@@ -48,7 +48,7 @@ class LocalFunction {
48
48
  }
49
49
  });
50
50
  (_c = this.watcher) === null || _c === void 0 ? void 0 : _c.on('compiled', () => {
51
- logger_1.labeled(`functions(${target.name})`, 'ready!').MESSAGE();
51
+ (0, logger_1.labeled)(`functions(${target.name})`, 'ready!').MESSAGE();
52
52
  if (this.repl.paused) {
53
53
  repl.resume();
54
54
  repl.showPrompt();
@@ -64,7 +64,7 @@ class LocalFunction {
64
64
  try {
65
65
  data = JSON.stringify(rawData);
66
66
  if (!data.startsWith('{') || !data.endsWith('}')) {
67
- const content = fs_1.SYNC.readFile(path_1.resolve(runtime_store_1.default.get('cwd'), data.slice(1, data.length - 1)));
67
+ const content = fs_1.SYNC.readFile((0, path_1.resolve)(runtime_store_1.default.get('cwd'), data.slice(1, data.length - 1)));
68
68
  if (content === undefined) {
69
69
  return new error_1.default('content is undefined for provided file path');
70
70
  }
@@ -72,12 +72,12 @@ class LocalFunction {
72
72
  }
73
73
  }
74
74
  catch (e) {
75
- logger_1.info('the input must be in the form of json or a path to a file containing json data.');
75
+ (0, logger_1.info)('the input must be in the form of json or a path to a file containing json data.');
76
76
  return new error_1.default('Invalid input');
77
77
  }
78
78
  if (this.target.type === constants_1.FN_TYPE.event && !data.includes('event_bus_details')) {
79
- logger_1.info('For event function kindly use event:generate command to generate the input json.');
80
- logger_1.info('You can also provide event details as per documentation.');
79
+ (0, logger_1.info)('For event function kindly use event:generate command to generate the input json.');
80
+ (0, logger_1.info)('You can also provide event details as per documentation.');
81
81
  return new error_1.default('Event bus details missing');
82
82
  }
83
83
  return (() => __awaiter(this, void 0, void 0, function* () {
@@ -95,57 +95,61 @@ class LocalFunction {
95
95
  slaveOptions.push(JSON.stringify(this.target));
96
96
  slaveOptions.push(data);
97
97
  slaveOptions.push(JSON.stringify({
98
- 'x-zc-projectid': project_1.getProjectId(),
99
- 'x-zc-project-domain': project_1.getDomainPrefix() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
100
- 'x-zc-project-key': project_1.getDomainKey(),
101
- 'x-zc-environment': project_1.getEnvName()
98
+ 'x-zc-projectid': (0, project_1.getProjectId)(),
99
+ 'x-zc-project-domain': (0, project_1.getDomainPrefix)() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
100
+ 'x-zc-project-key': (0, project_1.getDomainKey)(),
101
+ 'x-zc-environment': (0, project_1.getEnvName)()
102
102
  }));
103
103
  slaveOptions.push(JSON.stringify({
104
104
  'x-zc-user-cred-type': 'token',
105
105
  'x-zc-user-cred-token': accessToken,
106
106
  'x-zc-admin-cred-type': 'token',
107
- 'x-zc-admin-cred-token': accessToken
107
+ 'x-zc-admin-cred-token': accessToken,
108
+ 'x-zc-user-type': 'admin'
108
109
  }));
109
- slaveOptions.push(JSON.stringify(path_1.join(runtime_store_1.default.get('cwd'), '.build')));
110
- this.slave = shell_1.spawn('node', slaveOptions, {
110
+ slaveOptions.push(JSON.stringify((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')));
111
+ this.slave = (0, shell_1.spawn)('node', slaveOptions, {
111
112
  cwd: this.target.source,
112
113
  stdio: 'pipe',
113
114
  env: {
114
115
  X_ZOHO_CATALYST_IS_LOCAL: 'true',
116
+ X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
115
117
  X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
116
118
  X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
117
119
  }
118
120
  }).RAW();
119
121
  }
120
122
  else if ((_b = this.target.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java)) {
121
- const javaInvokerDir = path_1.parse(this.javaInvoker).dir;
123
+ const javaInvokerDir = (0, path_1.parse)(this.javaInvoker).dir;
122
124
  slaveOptions.push('-cp');
123
- slaveOptions.push(javaInvokerDir + fn_utils_1.fnUtils.java.classPathSep + path_1.join(javaInvokerDir, 'lib', '*'));
125
+ slaveOptions.push(javaInvokerDir + fn_utils_1.fnUtils.java.classPathSep + (0, path_1.join)(javaInvokerDir, 'lib', '*'));
124
126
  if (debugPort !== null) {
125
127
  slaveOptions.push('-Xdebug');
126
128
  slaveOptions.push('-Xrunjdwp:transport=dt_socket,address=' + debugPort + ',server=y,suspend=y');
127
129
  }
128
- slaveOptions.push(path_1.basename(this.javaInvoker));
130
+ slaveOptions.push((0, path_1.basename)(this.javaInvoker));
129
131
  slaveOptions.push(javaInvokerDir);
130
132
  slaveOptions.push(JSON.stringify(this.target));
131
133
  slaveOptions.push(data);
132
134
  slaveOptions.push(JSON.stringify({
133
- 'x-zc-projectid': project_1.getProjectId(),
134
- 'x-zc-project-domain': project_1.getDomainPrefix() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
135
- 'x-zc-project-key': project_1.getDomainKey(),
136
- 'x-zc-environment': project_1.getEnvName()
135
+ 'x-zc-projectid': (0, project_1.getProjectId)(),
136
+ 'x-zc-project-domain': (0, project_1.getDomainPrefix)() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
137
+ 'x-zc-project-key': (0, project_1.getDomainKey)(),
138
+ 'x-zc-environment': (0, project_1.getEnvName)()
137
139
  }));
138
140
  slaveOptions.push(JSON.stringify({
139
141
  'x-zc-user-cred-type': 'token',
140
142
  'x-zc-user-cred-token': accessToken,
141
143
  'x-zc-admin-cred-type': 'token',
142
- 'x-zc-admin-cred-token': accessToken
144
+ 'x-zc-admin-cred-token': accessToken,
145
+ 'x-zc-user-type': 'admin'
143
146
  }));
144
- this.slave = shell_1.spawn('java', slaveOptions, {
147
+ this.slave = (0, shell_1.spawn)('java', slaveOptions, {
145
148
  cwd: this.target.source,
146
149
  stdio: 'pipe',
147
150
  env: {
148
151
  X_ZOHO_CATALYST_IS_LOCAL: 'true',
152
+ X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
149
153
  X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
150
154
  X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
151
155
  }
@@ -157,18 +161,18 @@ class LocalFunction {
157
161
  });
158
162
  }
159
163
  (_c = this.slave.stdout) === null || _c === void 0 ? void 0 : _c.on('data', (message) => {
160
- shell_1.clearLine(process.stdout);
161
- logger_1.info(message.toString());
164
+ (0, shell_1.clearLine)(process.stdout);
165
+ (0, logger_1.info)(message.toString());
162
166
  });
163
167
  (_d = this.slave.stderr) === null || _d === void 0 ? void 0 : _d.on('data', (message) => {
164
168
  const errorStr = js_1.JS.trim(message.toString());
165
- shell_1.clearLine(process.stdout);
166
- logger_1.info(errorStr);
169
+ (0, shell_1.clearLine)(process.stdout);
170
+ (0, logger_1.info)(errorStr);
167
171
  });
168
172
  this.slave.on('exit', (code) => __awaiter(this, void 0, void 0, function* () {
169
173
  if (code !== null && code !== 130) {
170
- logger_1.info('[cli] Function execution complete');
171
- logger_1.info();
174
+ (0, logger_1.info)('[cli] Function execution complete');
175
+ (0, logger_1.info)();
172
176
  const response = yield fs_1.ASYNC.readFile(this.responseFile);
173
177
  let meta;
174
178
  try {
@@ -179,19 +183,19 @@ class LocalFunction {
179
183
  }
180
184
  switch (this.target.type) {
181
185
  case constants_1.FN_TYPE.basic:
182
- logger_1.info('[response]');
183
- logger_1.info(response);
184
- logger_1.info('[status]');
185
- logger_1.info(meta.statusCode || 200);
186
+ (0, logger_1.info)('[response]');
187
+ (0, logger_1.info)(response);
188
+ (0, logger_1.info)('[status]');
189
+ (0, logger_1.info)(meta.statusCode || 200);
186
190
  break;
187
191
  case constants_1.FN_TYPE.cron:
188
192
  case constants_1.FN_TYPE.event:
189
- logger_1.info('[status]');
190
- logger_1.info(response);
193
+ (0, logger_1.info)('[status]');
194
+ (0, logger_1.info)(response);
191
195
  break;
192
196
  case constants_1.FN_TYPE.integration:
193
- logger_1.info('[response]');
194
- logger_1.info(response);
197
+ (0, logger_1.info)('[response]');
198
+ (0, logger_1.info)(response);
195
199
  break;
196
200
  default:
197
201
  break;
@@ -21,7 +21,7 @@ const fn_utils_1 = require("../fn-utils");
21
21
  const runtime_store_1 = __importDefault(require("../runtime-store"));
22
22
  const constants_1 = require("../util_modules/constants");
23
23
  const fs_1 = require("../util_modules/fs");
24
- const logger_1 = require("../util_modules/logger");
24
+ const logger_js_1 = require("../util_modules/logger.js");
25
25
  const option_1 = require("../util_modules/option");
26
26
  const http_functions_1 = __importDefault(require("./dependencies/http-functions"));
27
27
  const local_function_1 = __importDefault(require("./dependencies/local-function"));
@@ -38,19 +38,19 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
38
38
  if (output instanceof Error) {
39
39
  return ansi_colors_1.bold.red('Error: ') + output.message;
40
40
  }
41
- return util_1.inspect(output);
41
+ return (0, util_1.inspect)(output);
42
42
  }
43
43
  return '';
44
44
  }
45
45
  });
46
- const httpServer = new http_functions_1.default(replServer);
46
+ const httpServer = new http_functions_1.default({ repl: replServer });
47
47
  try {
48
- yield prepare_1.default([constants_1.FN_TYPE.basic, constants_1.FN_TYPE.cron, constants_1.FN_TYPE.event, constants_1.FN_TYPE.integration]);
48
+ yield (0, prepare_1.default)([constants_1.FN_TYPE.basic, constants_1.FN_TYPE.cron, constants_1.FN_TYPE.event, constants_1.FN_TYPE.integration]);
49
49
  const targets = runtime_store_1.default
50
50
  .get('context.functions.targets', [])
51
51
  .filter((target) => {
52
52
  if (!target.valid) {
53
- logger_1.warning('target [' +
53
+ (0, logger_js_1.warning)('target [' +
54
54
  target.name +
55
55
  '] is not a valid one reason : ' +
56
56
  target.failure_reason);
@@ -64,10 +64,14 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
64
64
  });
65
65
  }
66
66
  replServer.start();
67
- const watchOpt = option_1.getOptionValue('watch', false);
67
+ const watchOpt = (0, option_1.getOptionValue)('watch');
68
+ if (watchOpt === true) {
69
+ (0, logger_js_1.info)();
70
+ (0, logger_js_1.labeled)('DEPRECATED', `The ${ansi_colors_1.italic.bold('--watch')} option is deprecated. \nThe watch mode will be enabled by default. If you wish to disable it use the ${ansi_colors_1.italic.bold('--no-watch')} option. \nPlease execute ${(0, ansi_colors_1.bold)('catalyst functions:shell ' + (0, ansi_colors_1.italic)('--help'))} command for more usage details.`).WARN();
71
+ }
68
72
  yield Promise.all(targets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
69
- if (watchOpt) {
70
- yield fn_watcher_1.default(target);
73
+ if (watchOpt !== false) {
74
+ yield (0, fn_watcher_1.default)(target);
71
75
  }
72
76
  const localFn = new local_function_1.default(replServer, target);
73
77
  replServer.setContext(target.name, localFn.call);
@@ -83,14 +87,14 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
83
87
  return target.localFn.shutdown();
84
88
  }
85
89
  })));
86
- yield fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch();
90
+ yield fs_1.ASYNC.deleteDir((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')).catch();
87
91
  fn_utils_1.fnUtils.common.executeHook({ prefix: 'post', command: 'serve' });
88
- logger_1.info();
89
- logger_1.success('shell complete');
92
+ (0, logger_js_1.info)();
93
+ (0, logger_js_1.success)('shell complete');
90
94
  }
91
95
  catch (e) {
92
96
  yield Promise.all([
93
- fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch(),
97
+ fs_1.ASYNC.deleteDir((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')).catch(),
94
98
  httpServer ? httpServer.stop() : undefined
95
99
  ]);
96
100
  throw e;
@@ -32,7 +32,7 @@ exports.default = (fnTypes) => __awaiter(void 0, void 0, void 0, function* () {
32
32
  return target;
33
33
  });
34
34
  runtime_store_1.default.set('context.functions.targets', refinedTargets);
35
- yield languages_1.prepareFunctions(refinedTargets);
36
- yield common_1.resolveAllFnPorts(refinedTargets);
35
+ yield (0, languages_1.prepareFunctions)(refinedTargets);
36
+ yield (0, common_1.resolveAllFnPorts)(refinedTargets);
37
37
  return refinedTargets;
38
38
  });
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -28,7 +28,7 @@ exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
28
28
  return target;
29
29
  });
30
30
  return Promise.all(javaTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
31
- yield fs_1.ASYNC.copyDir(path_1.join(target.source, '.output'), path_1.join(runtime_store_1.default.get('cwd'), '.build', path_1.basename(target.source)));
31
+ yield fs_1.ASYNC.copyDir((0, path_1.join)(target.source, '.output'), (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', (0, path_1.basename)(target.source)));
32
32
  return target;
33
33
  })));
34
34
  });
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const ansi_colors_1 = __importDefault(require("ansi-colors"));
7
- const cli_cursor_1 = require("cli-cursor");
7
+ const cli_cursor_1 = __importDefault(require("cli-cursor"));
8
8
  const readline_1 = require("readline");
9
9
  const strip_ansi_1 = __importDefault(require("strip-ansi"));
10
10
  const error_js_1 = __importDefault(require("../error.js"));
@@ -30,7 +30,7 @@ class Throbber {
30
30
  if (Throbber.instance !== undefined) {
31
31
  return Throbber.instance;
32
32
  }
33
- const instance = new Throbber(Object.assign({ spinnerColor: 'cyanBright', spinner: shell_js_1.supportsUnicode() ? spinners_json_1.dots : spinners_json_1.dashes, disableSpins: false, status: 'spinning', succeedPrefix: char_js_1.CHAR.success, failPrefix: char_js_1.CHAR.error }, options));
33
+ const instance = new Throbber(Object.assign({ spinnerColor: 'cyanBright', spinner: (0, shell_js_1.supportsUnicode)() ? spinners_json_1.dots : spinners_json_1.dashes, disableSpins: false, status: 'spinning', succeedPrefix: char_js_1.CHAR.success, failPrefix: char_js_1.CHAR.error }, options));
34
34
  Throbber.instance = instance;
35
35
  return instance;
36
36
  }
@@ -107,7 +107,7 @@ class Throbber {
107
107
  }
108
108
  this.currentInterval = this.loopStream();
109
109
  if (!this.isCursorHidden) {
110
- cli_cursor_1.hide();
110
+ cli_cursor_1.default.hide();
111
111
  }
112
112
  this.isCursorHidden = true;
113
113
  this.checkIfActiveSpinners();
@@ -139,40 +139,40 @@ class Throbber {
139
139
  let prefixLength = indent || 0;
140
140
  if (status === 'spinning') {
141
141
  prefixLength += frame.length + 1;
142
- text = utils_1.breakText(text, prefixLength);
142
+ text = (0, utils_1.breakText)(text, prefixLength);
143
143
  line = `${ansi_colors_1.default[spinnerColor](frame)} ${color ? ansi_colors_1.default[color](text) : text}`;
144
144
  }
145
145
  else {
146
146
  if (status === 'succeed') {
147
- prefixLength += strip_ansi_1.default(succeedPrefix).length + 1;
147
+ prefixLength += (0, strip_ansi_1.default)(succeedPrefix).length + 1;
148
148
  if (hasActiveSpinners) {
149
- text = utils_1.breakText(text, prefixLength);
149
+ text = (0, utils_1.breakText)(text, prefixLength);
150
150
  }
151
151
  line = `${succeedPrefix} ${text}`;
152
152
  }
153
153
  else if (status === 'fail') {
154
- prefixLength += strip_ansi_1.default(failPrefix).length + 1;
154
+ prefixLength += (0, strip_ansi_1.default)(failPrefix).length + 1;
155
155
  if (hasActiveSpinners) {
156
- text = utils_1.breakText(text, prefixLength);
156
+ text = (0, utils_1.breakText)(text, prefixLength);
157
157
  }
158
158
  line = `${failPrefix} ${text}`;
159
159
  }
160
160
  else {
161
161
  if (hasActiveSpinners) {
162
- text = utils_1.breakText(text, prefixLength);
162
+ text = (0, utils_1.breakText)(text, prefixLength);
163
163
  }
164
164
  line = color ? ansi_colors_1.default[color](text) : text;
165
165
  }
166
166
  }
167
- linesLength.push(...utils_1.getLinesLength(text, prefixLength));
167
+ linesLength.push(...(0, utils_1.getLinesLength)(text, prefixLength));
168
168
  output += indent ? `${' '.repeat(indent)}${line}\n` : `${line}\n`;
169
169
  });
170
170
  if (!hasActiveSpinners) {
171
- readline_1.clearScreenDown(this.stream);
171
+ (0, readline_1.clearScreenDown)(this.stream);
172
172
  }
173
- utils_1.writeStream(this.stream, output, linesLength);
173
+ (0, utils_1.writeStream)(this.stream, output, linesLength);
174
174
  if (hasActiveSpinners) {
175
- utils_1.cleanStream(this.stream, linesLength);
175
+ (0, utils_1.cleanStream)(this.stream, linesLength);
176
176
  }
177
177
  this.lineCount = linesLength.length;
178
178
  }
@@ -185,20 +185,20 @@ class Throbber {
185
185
  if (!this.hasActiveSpinners()) {
186
186
  if (this.spin) {
187
187
  this.setStreamOutput();
188
- readline_1.moveCursor(this.stream, 0, this.lineCount);
188
+ (0, readline_1.moveCursor)(this.stream, 0, this.lineCount);
189
189
  if (this.currentInterval !== null) {
190
190
  clearInterval(this.currentInterval);
191
191
  }
192
192
  this.isCursorHidden = false;
193
- cli_cursor_1.show();
193
+ cli_cursor_1.default.show();
194
194
  }
195
195
  this.spinners = {};
196
196
  }
197
197
  }
198
198
  bindSigint() {
199
199
  process.prependOnceListener('SIGINT', () => {
200
- cli_cursor_1.show();
201
- readline_1.moveCursor(process.stderr, 0, this.lineCount);
200
+ cli_cursor_1.default.show();
201
+ (0, readline_1.moveCursor)(process.stderr, 0, this.lineCount);
202
202
  process.exit(0);
203
203
  });
204
204
  }
@@ -7,7 +7,7 @@ exports.cleanStream = exports.writeStream = exports.getLinesLength = exports.bre
7
7
  const readline_1 = require("readline");
8
8
  const strip_ansi_1 = __importDefault(require("strip-ansi"));
9
9
  function breakText(text, prefixLength) {
10
- return strip_ansi_1.default(text)
10
+ return (0, strip_ansi_1.default)(text)
11
11
  .split('\n')
12
12
  .map((line, index) => (index === 0 ? breakLine(line, prefixLength) : breakLine(line, 0)))
13
13
  .join('\n');
@@ -20,24 +20,24 @@ function breakLine(line, prefixLength) {
20
20
  : line;
21
21
  }
22
22
  function getLinesLength(text, prefixLength) {
23
- return strip_ansi_1.default(text)
23
+ return (0, strip_ansi_1.default)(text)
24
24
  .split('\n')
25
25
  .map((line, index) => (index === 0 ? line.length + prefixLength : line.length));
26
26
  }
27
27
  exports.getLinesLength = getLinesLength;
28
28
  function writeStream(stream, output, rawLines) {
29
29
  stream.write(output);
30
- readline_1.moveCursor(stream, 0, -rawLines.length);
30
+ (0, readline_1.moveCursor)(stream, 0, -rawLines.length);
31
31
  }
32
32
  exports.writeStream = writeStream;
33
33
  function cleanStream(stream, rawLines) {
34
34
  rawLines.forEach((lineLength, index) => {
35
- readline_1.moveCursor(stream, lineLength, index);
36
- readline_1.clearLine(stream, 1);
37
- readline_1.moveCursor(stream, -lineLength, -index);
35
+ (0, readline_1.moveCursor)(stream, lineLength, index);
36
+ (0, readline_1.clearLine)(stream, 1);
37
+ (0, readline_1.moveCursor)(stream, -lineLength, -index);
38
38
  });
39
- readline_1.moveCursor(stream, 0, rawLines.length);
40
- readline_1.clearScreenDown(stream);
41
- readline_1.moveCursor(stream, 0, -rawLines.length);
39
+ (0, readline_1.moveCursor)(stream, 0, rawLines.length);
40
+ (0, readline_1.clearScreenDown)(stream);
41
+ (0, readline_1.moveCursor)(stream, 0, -rawLines.length);
42
42
  }
43
43
  exports.cleanStream = cleanStream;
package/lib/track.js CHANGED
@@ -22,8 +22,8 @@ const fs_1 = require("./util_modules/fs");
22
22
  const logger_1 = require("./util_modules/logger");
23
23
  const winston_1 = require("./winston");
24
24
  exports.default = (event, message, duration) => __awaiter(void 0, void 0, void 0, function* () {
25
- logger_1.debug(`EXEC ENDED with event: ${event}, message: ${message}`);
26
- logger_1.debug('TOTAL DURATION OF COMMAND EXEC : ' + duration);
25
+ (0, logger_1.debug)(`EXEC ENDED with event: ${event}, message: ${message}`);
26
+ (0, logger_1.debug)('TOTAL DURATION OF COMMAND EXEC : ' + duration);
27
27
  try {
28
28
  const httpLog = winston_1.logger.transports.find((transport) => {
29
29
  return (transport.filename ===
@@ -32,14 +32,14 @@ exports.default = (event, message, duration) => __awaiter(void 0, void 0, void 0
32
32
  if (runtime_store_1.default.get('credential', false) &&
33
33
  config_store_1.default.get('usage', false) &&
34
34
  httpLog !== undefined) {
35
- const httpLogger = yield endpoints_1.logAPI();
35
+ const httpLogger = yield (0, endpoints_1.logAPI)();
36
36
  if (httpLogger === undefined) {
37
- logger_1.debug('Unable to initialise the log API');
37
+ (0, logger_1.debug)('Unable to initialise the log API');
38
38
  return;
39
39
  }
40
40
  winston_1.logger.remove(httpLog);
41
- const rl = readline_1.createInterface({
42
- input: fs_1.SYNC.getReadStream(path_1.join(httpLog.dirname, httpLog.filename)),
41
+ const rl = (0, readline_1.createInterface)({
42
+ input: fs_1.SYNC.getReadStream((0, path_1.join)(httpLog.dirname, httpLog.filename)),
43
43
  crlfDelay: Infinity
44
44
  });
45
45
  const logInput = yield new Promise((resolve) => {
@@ -55,6 +55,6 @@ exports.default = (event, message, duration) => __awaiter(void 0, void 0, void 0
55
55
  }
56
56
  catch (e) {
57
57
  const err = error_1.default.getErrorInstance(e);
58
- logger_1.debug('Unable to send debug log to server: ' + err.message);
58
+ (0, logger_1.debug)('Unable to send debug log to server: ' + err.message);
59
59
  }
60
60
  });
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -5,16 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.script = exports.ignore = exports.plugin = exports.source = exports.raw = void 0;
7
7
  const path_1 = require("path");
8
- const error_1 = __importDefault(require("../../../error"));
9
- const runtime_store_1 = __importDefault(require("../../../runtime-store"));
10
- const constants_1 = require("../../constants");
11
- const js_1 = require("../../js");
12
- const logger_1 = require("../../logger");
8
+ const error_js_1 = __importDefault(require("../../../error.js"));
9
+ const runtime_store_js_1 = __importDefault(require("../../../runtime-store.js"));
10
+ const file_names_js_1 = __importDefault(require("../../constants/lib/file-names.js"));
11
+ const folder_names_js_1 = __importDefault(require("../../constants/lib/folder-names.js"));
12
+ const js_js_1 = require("../../js.js");
13
13
  function raw(throwError = false) {
14
- const config = runtime_store_1.default.get('config', null);
14
+ const config = runtime_store_js_1.default.get('config', null);
15
15
  if (config === null) {
16
16
  if (throwError) {
17
- throw new error_1.default(constants_1.FILENAME.config + ' file is required', { exit: 2 });
17
+ throw new error_js_1.default(file_names_js_1.default.config + ' file is required', { exit: 2 });
18
18
  }
19
19
  return;
20
20
  }
@@ -23,13 +23,10 @@ function raw(throwError = false) {
23
23
  exports.raw = raw;
24
24
  function source() {
25
25
  const clientConfig = raw();
26
- return (clientConfig && clientConfig.source) || constants_1.FOLDERNAME.client;
26
+ return (clientConfig && clientConfig.source) || folder_names_js_1.default.client;
27
27
  }
28
28
  exports.source = source;
29
- function plugin(name, source) {
30
- if (source) {
31
- logger_1.debug('Source config not supported for client');
32
- }
29
+ function plugin(name) {
33
30
  const clientConfig = raw();
34
31
  const rawPlugins = clientConfig && clientConfig.plugin;
35
32
  if (!rawPlugins) {
@@ -55,17 +52,17 @@ function ignore(sourcePath) {
55
52
  const clientConfig = raw();
56
53
  const ignoreArr = (clientConfig && clientConfig.ignore) || [];
57
54
  return ignoreArr.map((value) => {
58
- if (js_1.JS.indexOf(value, path_1.sep) === js_1.JS.size(value) - 1) {
59
- return '**' + path_1.sep + js_1.JS.initial(value).join('');
55
+ if (js_js_1.JS.indexOf(value, path_1.sep) === js_js_1.JS.size(value) - 1) {
56
+ return '**' + path_1.sep + js_js_1.JS.initial(value).join('');
60
57
  }
61
58
  else {
62
- if (js_1.JS.startsWith(value, path_1.sep)) {
63
- return js_1.JS.endsWith(value, path_1.sep)
64
- ? sourcePath + js_1.JS.initial(value).join('')
59
+ if (js_js_1.JS.startsWith(value, path_1.sep)) {
60
+ return js_js_1.JS.endsWith(value, path_1.sep)
61
+ ? sourcePath + js_js_1.JS.initial(value).join('')
65
62
  : sourcePath + value;
66
63
  }
67
- return js_1.JS.endsWith(value, path_1.sep)
68
- ? sourcePath + path_1.sep + js_1.JS.initial(value).join('')
64
+ return js_js_1.JS.endsWith(value, path_1.sep)
65
+ ? sourcePath + path_1.sep + js_js_1.JS.initial(value).join('')
69
66
  : sourcePath + path_1.sep + value;
70
67
  }
71
68
  });
@@ -75,13 +72,13 @@ function script(name, fallback) {
75
72
  const clientConfig = raw();
76
73
  const rawScripts = clientConfig && (clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.scripts);
77
74
  if (rawScripts === undefined && fallback === undefined) {
78
- throw new error_1.default('Scripts not found', { exit: 2 });
75
+ throw new error_js_1.default('Scripts not found', { exit: 2 });
79
76
  }
80
77
  if (name === undefined) {
81
78
  return rawScripts || fallback;
82
79
  }
83
80
  if (rawScripts && rawScripts[name] === undefined && fallback === undefined) {
84
- throw new error_1.default('Scripts not found', { exit: 2 });
81
+ throw new error_js_1.default('Scripts not found', { exit: 2 });
85
82
  }
86
83
  return (rawScripts && rawScripts[name]) || fallback;
87
84
  }